Commit Graph

238 Commits

Author SHA1 Message Date
jmcneill
91a0a07085 - Get SDIO reset working (from OpenBSD).
- After switching bus width, notify the host controller of the change.
2017-10-23 13:47:17 +00:00
jmcneill
20fc9fd202 For SD cards, send the SET_WR_BLK_ERASE_COUNT app command before a
multi-block write to improve write performance.
2017-09-12 13:43:37 +00:00
mlelstv
aaf4d31325 make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.

make lddiscard synchronous again. This is a requirement of the current
ffs discard code.
2017-08-20 15:58:43 +00:00
jmcneill
82e84007f0 Defer sdmmc discard operations to the sdmmc task queue. Fixes a panic
introduced by ld.c r1.102.
2017-08-11 18:41:42 +00:00
mlelstv
5b68a5ee6d While ld(4) is MP safe, many backends are not.
Add a flag for backends that are MP safe. Take KERNEL_LOCK when calling
into a backend that doesn't have the flag set. Do the same for the
discard routine.

Fixes PR 52462.
2017-08-09 16:44:39 +00:00
jmcneill
3eecdf69e4 Add support for eMMC 4.5's optional cache feature. If a cache is present,
and the host controller reports the SMC_CAPS_POLLING capability (needed
to flush cache at shutdown), it will be automatically enabled and used.
2017-07-16 17:11:46 +00:00
mlelstv
6043c15f37 Decrypt comment about the attach thread. No functional change. 2017-07-10 10:35:07 +00:00
jmcneill
f7cf4f6494 The config_* APIs are not MPSAFE, so make sure the deferred attach
thread holds KERNEL_LOCK.
2017-07-08 18:38:57 +00:00
jmcneill
28029423df Revert part of previous; the SD card spec recommends not to issue a DISCARD
command to the file system area.
2017-06-24 23:25:01 +00:00
jmcneill
e56880414f Read SD status register and print card status when a new SD card is found:
sdmmc0: SD card status: 4-bit, C10, U1, V10

If the SD status register reports discard support, set the DISCARD arg to
the ERASE operation to let the card know that the host doesn't care if the
erase is performed.
2017-06-24 23:07:35 +00:00
jmcneill
087ef2d977 Add discard support to ld@sdmmc using the ERASE (CMD38) command. 2017-06-24 11:27:33 +00:00
ryo
1f8d76d027 fix problem for ESDHC/USDHC due to change of r1.96
on ESDHC/USDHC, even if the iosize is less than SDHC_HOST_CTL_VERSION,
specver must be an appropriate value.
2017-06-23 08:43:59 +00:00
jmcneill
91ce610635 Fix a race between ld_sdmmc_start and ld_sdmmc_dobio that could result in
tasks getting lost from the task queue. The symptom of this is a NULL
deref in ld_sdmmc_start since the code assumes that a task will always be
available from the pool.

This changes the code to use pcq(9) instead of a TAILQ to manage the free
task list.
2017-06-06 21:01:07 +00:00
jmcneill
c255568acb Give a hint to controllers in the command flags if we are performing a
transfer with an SDHC capable card. If the controller needs to adjust
command args, it can use this hint to understand how it is encoded.
2017-06-04 15:00:02 +00:00
christos
1a4bdd5296 remove my copyright. 2017-06-03 14:46:29 +00:00
jmcneill
872a36d5d4 Add a vendor callback for setting signal voltage. 2017-04-22 21:49:41 +00:00
jmcneill
71dda27406 Ensure that the task is returned to the free task list in an error branch. 2017-04-22 14:19:36 +00:00
jmcneill
760a6ac1d6 Remove a test that prevents tuning from happening on eMMC devices. 2017-04-11 23:26:33 +00:00
nonaka
7003a76595 sdhc(4): hardware reset support for Intel eMMC controller 2017-02-17 10:51:48 +00:00
nonaka
e7641d9af9 sdhc(4), sdmmc(4): Added MMC HS DDR52 support. 2017-02-17 10:50:43 +00:00
nonaka
4c5c8031df sdmmc(4): Add MMC HS DDR52 timing support bit and use __BIT() macro. 2017-02-17 10:49:47 +00:00
nonaka
dcabea4567 sdmmc(4): Use EXT_CSD[HS_TIMING] definitions. 2017-02-17 10:48:19 +00:00
nonaka
47ff4e0d0b sdmmc(4): Added EXT_CSD[HS_TIMING] definitions. 2017-02-17 10:47:09 +00:00
nonaka
a993954cf1 sdmmc(4): Change EXT_CSD[CARD_TYPE] HS DDR 52 MHz definition.
Because it has been difficult to understand from the definition is DDR.
2017-02-17 10:46:20 +00:00
nonaka
363698b288 sdmmc(4): Remove unused EXT_CSD[CARD_TYPE] definitions. 2017-02-17 10:45:23 +00:00
nonaka
4df2cea32e sdmmc(4): Added comments at EXT_CSD[CARD_TYPE] definitions. 2017-02-17 10:44:31 +00:00
nonaka
7ba7173581 sdmmc(4): Added 4 and 8 bit mode DDR definitions at EXT_CSD[BUS_WIDTH]. 2017-02-17 10:43:47 +00:00
nonaka
63d7b96f01 sdmmc(4): Fix cell type in comments.
From JEDEC Standard No.84-B51, 7.4. Extended CSD register.
2017-02-17 10:43:03 +00:00
martin
b42e1be68a Add missing includes 2017-01-07 16:24:40 +00:00
kiyohara
e741f78902 Add flags SDHC_FLAG_NO_AUTO_STOP and SDHC_FLAG_NO_BUSY_INTR. 2017-01-07 15:05:08 +00:00
kiyohara
322a2dc1e7 Don't access SDHC_HOST_CTL_VERSION, if iosize less than this. 2017-01-07 15:00:38 +00:00
kiyohara
8ad0b04215 Support retry when error. like wd(4). 2017-01-07 14:49:53 +00:00
pgoyette
916bdfa5d4 Modularize the ld driver and all of its attachments. Ensure that all
parents are capable of rescan (or otherwise provide a means of attaching
children post-initialization).
2016-09-27 03:33:32 +00:00
jdolecek
e90b5bdddb modify ldattach() to have default strategy as a parameter 2016-09-16 15:20:50 +00:00
nonaka
69fa749227 Fix incorrect sector counts with MMC. 2016-08-11 01:33:25 +00:00
nonaka
29e60e139c Use 1.65-1.95 voltage window for 1.8V support. 2016-08-10 04:24:17 +00:00
msaitoh
d21ffc75e5 - Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
2016-07-14 04:00:45 +00:00
kiyohara
5c0f9a0541 Please more delay, if timeout in sdhc_wait_intr(). 2016-07-03 11:55:27 +00:00
tsutsui
134f761d55 Call the second sdmmc_mem_send_if_cond() only where it's necessary.
This makes SMC_CAPS_SPI_MODE devices (currently evbsh3 only) work again.
"Maybe ok" from nonaka@.
2016-03-13 09:12:16 +00:00
ryo
1fc390a6bc add support iMX6 uSDHC
- some UHS-I/SDR104 card are not stable
- eMMC doesn't work yet
2015-12-31 11:53:18 +00:00
ryo
e92ba46909 fix typo. use pmask for SDHC_PRESENT_STATE. 2015-12-28 16:47:11 +00:00
mlelstv
9f7185b8f3 Be graceful about command timeouts when probing. 2015-12-22 09:56:06 +00:00
mlelstv
898693b4f2 ignore timeouts for APP_CMD prefix as for the application command itself. 2015-12-22 09:55:38 +00:00
jmcneill
7f43a6e6ef Add some event counters to track transfer sizes. 2015-11-29 23:38:47 +00:00
mlelstv
066871a1c6 Also wait for DAT when sending RSP_BSY commands. Fixes PR 50388. 2015-11-03 07:59:29 +00:00
mlelstv
51893517ae fix timeout path in soft reset when building with SDHC_DEBUG 2015-11-03 06:49:39 +00:00
jmcneill
78131770be allow vendor specific code to hook into bus width changes 2015-11-02 22:18:45 +00:00
jmcneill
c4ddc7a9e2 After setting HS_TIMING value for HS200 or later, send repeated SEND_STATUS
command until the device is no longer busy or the SWITCH_ERROR bit is set.
2015-10-29 22:37:15 +00:00
mlelstv
f30ec675b0 support hiding command timeout messages with a new command flag and use this
when probing for cards. Should fix PR 50302.
2015-10-06 14:32:51 +00:00
mlelstv
bf5ddae367 The iMX uSDHC controller doesn't have an interrupt error status flag,
the bit position is reserved and reads as value 0.
- Fake the flag if any of the error bits is set.
- uSDHC supports the 32bit access, the 16bit path doesn't need that quirk.
2015-09-09 08:09:28 +00:00