Commit Graph

39 Commits

Author SHA1 Message Date
mav
e989bd475b Implement suspend/resume for mmc and mmcsd drivers.
Now it is possible to suspend/resume with inserted and active card.

To reinitialize card on resume and to detect card change while suspended,
implement bus rescan routines. It can also be used by controllers without
card presence detection signals or with multiple cards per slot support.

While there, cleanup msleep() usage. We have no any rights to exit without
"request done" signal from driver as it could lead to modify after free.
2008-12-06 21:41:27 +00:00
mav
3da37e1610 Report card erase sector size as disk stripe size. 2008-11-23 14:32:40 +00:00
mav
effe067191 Improve detach handling: close races, flush queue. 2008-11-23 14:02:06 +00:00
mav
3c4dfce5ca 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
mav
5d85764b41 Coalesce sequentional BIO_DELETE requests to slightly relax size and alignment
constraints required by the card.
2008-10-18 22:22:25 +00:00
mav
89dcfbd0c6 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
mav
eee0889b0a Use GB suffix only from 10GB instead of 1GB.
There are lot of cards with uneven sizes and too strong rounding
will lead to very significant rounding errors.

Reviewed by:	imp@
2008-10-12 19:19:26 +00:00
imp
63d968fc5f style(9): spaces around operators. 2008-10-12 07:30:05 +00:00
imp
43311b35e5 Print the cards natural size.
Move nested tertiary operator expressions into their own function.
Remove extra blank line.
cache sd->disk in 'd' to make the code easier to read.
2008-10-12 07:24:31 +00:00
mav
dd3c40ad71 SELECT_CARD command with zero RCA deselects all cards and so has no reply. 2008-10-11 17:30:02 +00:00
mav
5bace10bb3 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
mav
8e7aede58a Add high capacity MMC cards support. 2008-10-09 20:09:56 +00:00
imp
2dffc5408e o Use seprate routines to decode cid and csd for sd and mmc cards. All they
have in common right now is a memset.  This saves a parameter to
  these routines, as well as a level of indentation.
o Make mmc_get_bits a little clearer...  It really only works on 128-bit
  registers right now.
2008-10-09 19:47:28 +00:00
mav
9f45d71ed9 Only voltage bits should be zero in send_op_cond argument to ignore busy. 2008-10-08 21:10:55 +00:00
mav
3092a6ddfc Generic SD Host Controller driver going to be named sdhci. 2008-10-08 20:00:51 +00:00
mav
74aa2a1a28 Fix bit offset in mmc_sd_switch(). 2008-10-08 18:13:14 +00:00
mav
a13e6527d9 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
imp
97389cb928 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
imp
fa4528e966 MAXPHYS seems more stable on the AT91RM9200 boards that I have. We
may need to ask the host controller for the right number to use
here...
2008-10-02 07:00:31 +00:00
imp
51dc1b851d Improve support for multiple block read/write. This code is currently
disabled by default because there's problems with it on AT91RM9200,
currently the only host controller in the tree.  I've not had time to
track those problems to ground.  I'm committing because this is
important for other host controllers that are in the pipeline.

Submitted by:	mav@
2008-09-30 02:34:45 +00:00
imp
7e5e6d6f27 Make the media size return the block rather than the bytes on the device. 2008-09-29 18:55:45 +00:00
imp
8b764e092e Explicitly set data to NULL rather than relying mmc_wait_for_cmd() to
do it for us.  There may be commands we have to wait for that need to
set data.

Submitted by:	mav@
2008-09-29 18:33:08 +00:00
imp
c6c9e7b65c Minor style fixes from mav@ (with similar problems fixed where I noticed
them):
	#define<tab>
	zero memory when we allocate it
	Put device name in error message.

Submitted by:	mav@
2008-09-29 18:17:23 +00:00
imp
8a3e9c9a9d Conform to style(9) for return (foo); The files were a mix before.
Submitted by:	mav@
2008-09-29 18:05:26 +00:00
imp
10320dbb60 Convert all C++ comments to C style. There's lots of folks that don't
like them and they don't add enough to be worth standing out.
2008-09-29 01:32:21 +00:00
imp
ba2b227bfc The parameters to the MMCBR_ACQUIRE_HOST and MMCBR_RELEAES_HOST were
the device in question, rather than the bus doing the requesting.  Fix
it so that it is the bus.

Submitted by:	mav@
2008-09-29 01:28:30 +00:00
imp
c737e2ef82 Add "caps" word to host bridge. 2008-09-28 23:37:06 +00:00
imp
24e5e160a7 Implement power down, and power down the bus on detach.
Submitted by:	mav@
2008-09-28 23:24:52 +00:00
imp
83045cd47b When a device is read only, fail all non-read BIO requests.
Submitted by:	mav@
2008-09-28 22:42:29 +00:00
imp
0de91f430b 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
imp
db3715c928 The OCR register defines both acceptable voltage bits, as well as bits
for other things.  Mask out the voltage only bits when returning the
Vdd mask for voltage computation.

Submitted by:	mav@
2008-09-28 22:27:29 +00:00
imp
bc9f965b27 Other busses on the system use the official capitalization for the
technology.  Make mmc conform to that.

Submitted by:	mav@
2008-09-28 22:23:06 +00:00
imp
21506de7c8 Fix line continuation whitespace.
Submitted by:	mav@
2008-09-28 22:21:53 +00:00
julian
51d643caa6 Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
imp
3cd4cdf93d MFp4: When querying the operating condition of SD cards (using the
application specific SEND_OP_COND (CMD55 + ACMD41), go ahead and allow
100 tries.  This gives a timeout of a second rather than the ~100ms
the old style produces.

I've had one old 16MB SD card which needs the extra time.  I've now
had reports from the field that other cards need this too.

Originally done at BSDcan 2007 while waiting to give my embedding
madness minitalk.
2007-06-05 17:04:44 +00:00
imp
f2854751ef 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
imp
9ebc525a3d First cut at making detach work. also add sdh as a possible mmc bridge.
Submitted by: Andrea Bittau
(Andrea may have updated patches, but I've tested these)
2007-05-15 05:49:14 +00:00
imp
a5222a8523 Don't need mmc_mode ivar 2007-05-15 05:46:58 +00:00
imp
30743982ca 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