Commit Graph

12 Commits

Author SHA1 Message Date
Ian Lepore
f3a4b7f73b Export an mmc or sd card's serial number from the mmc layer as an ivar.
In the mmcsd layer use this value to populate disk->d_ident.  Also set
disk->d_descr to the full set of card identification info (includes vendor,
model, manufacturing date, etc).
2014-07-31 16:54:54 +00:00
Marius Strobl
7aa6584632 o Fixes:
- When switching to 4-bit operation, send a SET_CLR_CARD_DETECT command
    to disconnect the card-detect pull-up resistor from the DAT3 line before
    sending the SET_BUS_WIDTH command.
  - Add the missing "reserved" zero entry to the mantissa table used to
    decode various CSD fields. This was causing SD cards to report that they
    could run at 30 MHz instead of the maximum 25 MHz mandated in the spec.
o Enhancements:
  - At the MMC layer, format various info from the CID into a string that
    uniquely identifies the card instance (manufacturer number, serial
    number, product name and revision, etc). Export it as an instance
    variable.
  - At the MMCSD layer, display the formatted card ID string, and also
    report the clock speed of the hardware (not the card's max speed), and
    the number of bits and number of blocks per transfer. It comes out like
    this now:
    mmcsd0: 968MB <SD SD01G 8.0 SN 276886905 MFG 08/2008 by 3 SD> at mmc0
    22.5MHz/4bit/128-block
o Use DEVMETHOD_END.
o Use NULL instead of 0 for pointers.

PR:		156496
Submitted by:	Ian Lepore
MFC after:	1 week
2012-04-21 01:51:16 +00:00
Jayachandran C.
bcd91d25da Fix read_ivar implementation for MMC and SD.
1. Both mmc_read_ivar() and sdhci_read_ivar() use the expression
'*(int *)result = val' to assign to result which is uintptr_t *.
This does not work on big-endian 64 bit systems.

2. The media_size ivar is declared as 'off_t' which does not fit
into uintptr_t in 32bit systems, change this to long.

Submitted by:	kanthms at netlogicmicro com (initial version)
2011-05-30 06:23:51 +00:00
Alexander Motin
3a4a255741 Allow card reader bridge driver to report maximum supported transfer size.
sdhci supports up to 65535 blocks transfers, at91_mci - one block.

Enable multiblock operations disabled before to follow at91_mci driver
limitations.

Reviewed by:	imp@
2008-10-29 20:01:26 +00:00
Alexander Motin
3906d42d63 Implement BIO_DELETE command with MMC and SD erase commands.
Erase operation gives card's logic information about unused areas to help it
implement wear-leveling with lower overhead comparing to usual writing.
Erase is much faster then write and does not depends on data bus speed.
Also as result of hitting in-card write logic optimizations I have measured
up to 50% performance boost on writing undersized blocks into preerased areas.

At the same time there are strict limitations on size and allignment of erase
operations. We can erase only blocks aligned to the erase sector size and
with size multiple of it. Different cards has different erase sector size
which usually varies from 64KB to 4MB. SD cards actually allow to erase
smaller blocks, but it is much more expensive as it is implemented via
read-erase-write sequence and so not sutable for the BIO_DELETE purposes.

Reviewed by:	imp@
2008-10-18 16:17:04 +00:00
Alexander Motin
67d752c3d4 Give mmcsd driver a bit more information about card. It allows to reorganize
log message in a way a bit more common for disk devices. Also it will allow
mmcsd driver to use MMC/SD specific commands when needed.
2008-10-11 13:05:13 +00:00
Alexander Motin
c18f1e2627 Set of mmc layer improvements:
- add MMC support.
 - add SDHC support.
 - add 4 and 8 bit bus width support.
 - add High Speed bus timing support.
2008-10-08 17:35:41 +00:00
Warner Losh
38c51cbe85 Define and use MMC_SECTOR_SIZE.
Make mmc_get_media_size now return an off_t and remove now useless cast.
2008-10-02 07:06:59 +00:00
Warner Losh
40fab6e7c7 Propigate read-only status of cards. Right now it is read only at
device attach time.  We may need to read this more often in the
future, but for now simplicity of implementation wins.

Submitted by:	mav@
2008-09-28 22:40:11 +00:00
Warner Losh
14eced725c A careful reading of the disclaimer that is required to download the
SD Simplified specification, as well as other SD and SDIO
implemenations I've examined, suggest this disclaimer may be required.
It is unclear to me exactly what the license would be for, or why it
might be required.  Err on the side of caution and include this
disclaimer so anybody deploying this code can judge for themselves.  I
have no further unformation about the details.
2007-05-26 05:23:36 +00:00
Warner Losh
78f8edfb44 Don't need mmc_mode ivar 2007-05-15 05:46:58 +00:00
Warner Losh
114b4164dd Preliminary MMC stack. This stack supports SD 1.0 cards only, but
should be easily adapted to SD 2.0 (aka SDHC), SDIO, MMC and MMCplus
cards.  At the present time, there's only one bridge driver for the
ARM9 based Atmel AT91RM9200.
2006-10-20 06:39:59 +00:00