Commit Graph

258 Commits

Author SHA1 Message Date
anjiahao d7b4e91dda Call nxsem_destroy or nxmutex_destry in the error path
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01:00
Xiang Xiao 57b6447e0a Fix error: mmcsd/mmcsd_sdio.c:2669:35: error: 'buffer' may be used uninitialized [-Werror=maybe-uninitialized]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-23 22:44:35 +02:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Nathan Hartman 00666a8778 drivers/mmcsd: Remove executable permissions from source files 2022-09-13 23:07:34 +08:00
licheng 6a01099c59 reinit spi sd when sd status is wrong.
Signed-off-by: licheng <chengli@bestechnic.com>
2022-09-12 17:12:02 -03:00
Simon Filgis 423ee67554 Double the MMCSD_IDLE_DELAY from 50ms to 100ms because I found one card that needs this to work after initial CMD0. 2022-08-26 13:37:08 +08:00
Xiang Xiao a2239891e7 mmcsd: Remove the not really used capacity field
to avoid the check of CONFIG_HAVE_LONG_LONG in many place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-16 11:12:30 +03:00
licheng ee0dc87059 fix sd can't usage when mult-block receive errro 2022-07-04 20:43:50 +03:00
chao.an 591942f69b mmcsd/sdio: correct return value of sdio_probe()
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-06-16 22:48:21 +08:00
chao.an 7e1f906b74 drvers/mmcsd/sdio: function enable should wait for CCCR_IORDY
1. function enable should wait for CCCR_IORDY
2. enlarge wait timeout from 10ms to 1s

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-06-13 15:45:09 +03:00
Xiang Xiao 323d8d9547 mmcsd: Add FAR to the pointer argument
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-13 15:41:27 +03:00
Xiang Xiao 679bc88cab drivers/sdio: Call SDIO_LOCK before and after the transaction
follow the same behaviour in drivers/mmcsd/mmcsd_sdio.c

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-13 15:41:27 +03:00
Xiang Xiao bb1e81eb95 driver/mmcsdio: do not hold the semaphore in idle thread too
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-14 17:12:10 +03:00
chao.an 062010c660 driver/mmcsdio: do not hold the semaphore on interrupt context
so we can do the full dump to mmc/sd card in the panic case

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-04-14 17:12:10 +03:00
anjianjun 75ec6dffb6 mmcsd: Fix mmc card error but system can not catch it
Signed-off-by: anjianjun <anjianjun@xiaomi.com>
2022-04-01 20:54:57 +03:00
anjianjun f95d13b3a1 mmcsd: Add gotextcsd callback to sdio_dev_s
so the driver implementation could get critical EXTCSD info

Signed-off-by: anjianjun <anjianjun@xiaomi.com>
2022-04-01 20:54:57 +03:00
Richard Tucker 163e3fd93c driver/mmcsd: add option to support SD/MMC PHYs that only run in 4-bit mode 2022-03-30 02:35:27 +08:00
Xiang Xiao 4c167b0729 Correct the code alignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 21:22:21 -03:00
Xu Xingliang 021363f1db driver/mmcsd: add option to limit block count in multiple-block transfer mode.
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2022-01-22 14:59:26 +08:00
Jukka Laitinen 297c8dfc3a drivers/mmcsd/sdio.c: Fix struct packing of sdio_resp_r5
The struct memeber should be packed as well

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-01-13 10:34:28 -03:00
Xiang Xiao 828f04f0e5 sdio: Move sdio utils functions to drivers/mmcsd
so all sdio client driver can reuse them

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-04 17:44:24 +01:00
Xiang Xiao 643e34efde sdio: Update the defintion to the latest spec
and correct the comment:
https://www.sdcard.org/downloads/pls/
https://www.jedec.org/standards-documents/technology-focus-areas/flash-memory-ssds-ufs-emmc/e-mmc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-17 06:29:13 -03:00
Janne Rosberg f75535607e drivers/mmcsd/mmcsd_spi: fix warning with finfo print 2021-09-18 12:18:09 -03:00
Xiang Xiao 44cbba2c56 drivers/sdmmc: Remove rwbuffer to avoid panic
since rwbuffer isn't fully initiailized in mmcsd_slotinitialize.
BTW, if the cache is important for performance, it is better to
implement a general block cache and put in a common location.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-15 14:09:23 -03:00
Xiang Xiao 60b2a0e2a0 drivers/mmcsd: Pass the right buffer size to SDIO_DMAPREFLIGHT
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-09 09:37:45 -03:00
Xiang Xiao c60002cd74 drivers/mmcsd: Fix the wrong format argument in mmcsd_dmpcsd
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-05 17:26:31 -03:00
Xiang Xiao c1f9d2c2d5 drivers/mmcsd: Handle the failure correctly in mmcsd_slotinitialize
1.Return -ENOMEM directly if kmm_malloc return NULL
2.Call nxsem_destroy if the initialization can't succeed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-05 17:24:41 -03:00
Xiang Xiao 7312a553bb drivers/mmcsd: Change up_udelay to nxsig_usleep if delay >= 1ms
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-05 17:22:47 -03:00
Xiang Xiao 76a725cab2 drivers/mmcsd: Change mmsd_ prefix to mmcsd_ prefix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-05 17:21:44 -03:00
Xiang Xiao 6a396eb224 Fix the printf warning after off_t change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id46daa2ee690a73d3187b479f0e7ab0e2e361764
2021-08-04 06:48:30 -07:00
anjianjun 2866c27c19 drivers/mmcsd:Send cmd0 just once for Increased compatibility
Signed-off-by: anjianjun <anjianjun@xiaomi.com>
2021-07-28 08:34:09 -03:00
anjianjun 3c393d6dfc drivers/mmcsd:fix build error of debug
Signed-off-by: anjianjun <anjianjun@xiaomi.com>
2021-07-27 20:12:27 -07:00
Xiang Xiao 2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Anthony Merlino b21cb3308a Fixes race condition in event wait logic of SDMMC driver.
This change makes it so that the timeout is set as part of the SDIO_WAITENABLE call instead of the SDIO_EVENTWAIT call. By doing so, you eliminate all opportunity for a race condition.

stm32h7:sdmmc Check if busy ended early
2021-04-05 23:08:45 -05:00
David Sidrane 0c57351f78 mmcsd:Stuck in 1-bit mode, Removed CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT
mmcsd:Remove CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT
   stm32h7:sdmmc remove CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT
   stm32f7:sdmmc remove CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT
   stm32f7:sdmmc WRITE COMPLETE prevent false triggers
   stm32h7:sdmmc WRITE COMPLETE prevent false triggers

   While testing PR #2989 on the H7 I noticed that the cards
   were staying in 1-bit mode. The root cause was that the
   scr read path was using DMA without an invlidate.

   This was caused by CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT,
   but the sdmmc driver, did not use the delayed invalidate
   nor would it work on 8 bytes.

   The driver fully supported dcache mgt on runt buffers, but
   the #ifdef CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT blocked it.

   Reviewing the PR that added CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT
   it may have been valid at the time. But after the dcache operations
   we fixed. It is not necessary and offers no benefit.
2021-03-12 16:42:16 -03:00
Alin Jerpelea ccff570e6f drivers: nxstyle fixes
nxstyle fixes to pass the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Alin Jerpelea e5b6305f4a drivers: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Byron Ellacott 9a1b726bae fs: change geometry types from `size_t` to `blkcnt_t` and `blksize_t`
This change reflects that the geometry isn't related to the largest
allocatable unit on the platform.

Calls to read and write block devices are also affected and have
been updated.
2021-02-18 20:38:22 -08:00
yjdwbj 6aba444359 Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro.
Fixed: SDIO Interface hanging after inserted SD Card.

Disabled the CONFIG_SYSTEMTICK_EXTCLK, using nxsig_usleep instead of usleep
2020-12-04 22:41:46 -08:00
YAMAMOTO Takashi 597675bd7f drivers/mmcsd/mmcsd_sdio.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi c8958586a7 drivers/mmcsd/mmcsd_spi.c: Fix syslog formats 2020-11-22 19:01:05 -08:00
YAMAMOTO Takashi a88dcb3b77 drivers/mmcsd/mmcsd_spi.c: Fix a syslog format 2020-11-22 19:01:05 -08:00
YAMAMOTO Takashi ec448f64a1 drivers/mmcsd/mmcsd_sdio.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
Brennan Ashton 26395a6908 mmcsd: Allow setting ID mode frequency vi Kconfig
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-09-16 03:13:43 -07:00
David Sidrane 55b48b14eb mmcsd_sdio: Arm the write complete detection
The Multiblock write path was missing the
   the SDIO_WAITENABLE with SDIOWAIT_WRCOMPLETE.

   This could be seen with debugging turned on as

   mmcsd_eventwait: ERROR: Awakened with 10
   mmcsd_transferready: ERROR: mmcsd_eventwait for transfer ready failed: -5
2020-09-10 14:55:41 +01:00
David Sidrane e21dd68755 mmcsd_sdio:Fix breakage from 997d4 SD not functional
When CONFIG_MMCSD_MULTIBLOCK_DISABLE is lit, all SD
   read/write failed. The function return the number of
   blocks in `ret`, set on entry to nsectors. That was
   then wiped out by using the ret for the mmcsd_takesem.

   Since the code had many path setting return, the choices for
   the fix could have been add a new varaible or simple init it
   were used. I choose the latter.
2020-08-19 03:22:09 -05:00
SPRESENSE e4b50c4ba0 drivers/mmcsd: Fix minor bugs
- Add missing cancel process when the send command fails
- Make it possible to recover from SD initialization error
- Reduce time in changing transfer mode to 5msec from 500msec.
  Replace usleep function instead of up_udelay in other to avoid
  blocking other tasks from working.
2020-07-22 09:51:54 -05:00
Xiang Xiao 5eae32577e build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:02:55 -06:00
Xiang Xiao 517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Xiang Xiao b7d922960f Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00