Commit Graph

224 Commits

Author SHA1 Message Date
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
Xiang Xiao d3c4879113 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-13 12:01:39 -06:00
Xiang Xiao b22e3b9e28 nuttx: Fix the nightly build warning
lpc2148_spi1.c:142:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type 'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  142 |   .send              = spi_send,
      |                        ^~~~~~~~
lpc2148_spi1.c:142:24: note: (near initialization for 'g_spiops.send')

In file included from ieee802154/mac802154_bind.c:49:
ieee802154/mac802154_internal.h: In function 'mac802154_setdevmode':
ieee802154/mac802154_internal.h:788:42: warning: converting a packed 'enum ieee802154_devmode_e' pointer (alignment 1) to a 'const union ieee802154_attr_u' pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  788 |                         (FAR const union ieee802154_attr_u *)&mode);
      |                                          ^~~~~~~~~~~~~~~~~

chip/stm32_hciuart.c: In function 'hciuart_read':
chip/stm32_hciuart.c:2104:30: warning: statement with no effect [-Wunused-value]
 2104 |                       ntotal == (ssize_t)ret;
      |                       ~~~~~~~^~~~~~~~~~~~~~~

wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_auth_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:579:23: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  579 |   type = bcmf_getle32(&event->type);
      |                       ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:580:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  580 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_scan_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:619:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  619 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:620:35: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  620 |   escan_result_len = bcmf_getle32(&event->len);
      |                                   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_bdc.c: In function 'bcmf_bdc_process_event_frame':
wireless/ieee80211/bcm43xxx/bcmf_bdc.c:166:27: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  166 |   event_id = bcmf_getle32(&event_msg->event.type);
      |                           ^~~~~~~~~~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_direct':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:157:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  157 |   ret = SDIO_RECVR5(dev, SD_ACMD52, (uint32_t *)&resp);
      |   ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_extended':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:239:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  239 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:244:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  244 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:257:7: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  257 |       ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |       ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:265:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  265 |   SDIO_RECVR1(dev, SD_ACMD52ABRT, (uint32_t *)&resp);
      |   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:2860:7: warning: unused variable 'ret' [-Wunused-variable]
 2860 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:3044:7: warning: unused variable 'ret' [-Wunused-variable]
 3044 |   int ret;
      |       ^~~

chip/stm32_i2c.c:722:12: warning: 'stm32_i2c_sem_wait_noncancelable' defined but not used [-Wunused-function]
  722 | static int stm32_i2c_sem_wait_noncancelable(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/gs2200m.c: In function 'gs2200m_read':
wireless/gs2200m.c:727:20: warning: passing argument 1 of 'nxsem_wait' from incompatible pointer type [-Wincompatible-pointer-types]
  727 |   ret = nxsem_wait(dev);
      |                    ^~~
      |                    |
      |                    struct gs2200m_dev_s *

.config:1207:warning: symbol value '' invalid for TESTING_OSTEST_FPUSIZE

platform/audio/cxd56_audio_analog.c:69:13: warning: inline function 'cxd56_audio_clock_is_enabled' declared but never defined
   69 | inline bool cxd56_audio_clock_is_enabled(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:68:13: warning: inline function 'cxd56_audio_clock_disable' declared but never defined
   68 | inline void cxd56_audio_clock_disable(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:67:13: warning: inline function 'cxd56_audio_clock_enable' declared but never defined
   67 | inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:1348:7: warning: unused variable 'ret' [-Wunused-variable]
 1348 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:1496:7: warning: unused variable 'ret' [-Wunused-variable]
 1496 |   int ret;
      |       ^~~

chip/stm32_i2c.c:729:12: warning: 'stm32_i2c_sem_wait_uninterruptble' defined but not used [-Wunused-function]
  729 | static int stm32_i2c_sem_wait_uninterruptble(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/lpwan/sx127x/sx127x.c:147:52: warning: missing terminating ' character
  147 | #  warning OOK support is not complete, RX+TX doesn't work yet!
      |                                                    ^

str71_spi.c:435:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type
                                               'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  435 |   .send              = spi_send,
      |                        ^~~~~~~~
str71_spi.c:435:24: note: (near initialization for 'g_spiops.send')

chip/pic32mx-lowconsole.c:147:24: warning: 'pic32mx_getreg' defined but not used [-Wunused-function]
 static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
                        ^
chip/pic32mx-gpio.c:113:20: warning: 'pic32mx_value' defined but not used [-Wunused-function]
 static inline bool pic32mx_value(uint16_t pinset)
                    ^
chip/pic32mz-gpio.c:124:20: warning: 'pic32mz_value' defined but not used [-Wunused-function]
 static inline bool pic32mz_value(pinset_t pinset)
                    ^
chip/pic32mx-usbdev.c:3065:1: warning: 'pic32mx_epreserved' defined but not used [-Wunused-function]
 pic32mx_epreserved(struct pic32mx_usbdev_s *priv, int epno)
 ^

mmcsd/mmcsd_spi.c: In function 'mmcsd_mediachanged':
mmcsd/mmcsd_spi.c:1938:7: warning: 'return' with a value, in function returning void
       return ret;
       ^

In file included from partition/fs_partition.c:42:0:
partition/partition.h:66:19: warning: 'read_partition_block' defined but not used [-Wunused-function]
 static inline int read_partition_block(FAR struct partition_state_s *state,
                   ^

local/local_netpoll.c: In function 'local_pollsetup':
local/local_netpoll.c:305:1: warning: label 'pollerr' defined but not used [-Wunused-label]
 pollerr:
 ^~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If3ea8f32b878aa218072130f7c3018f0d3c1aca5
2020-04-13 12:01:39 -06:00
Gregory Nutt a6e69a82ad SDIO: Make interface field names conform to standard.
The SDIO interface structure includes fields with names like recvR1 and others.  These cause "Mixed case identifier" errors from nxstyle in all places they are uses.
This change performs a mass substition of recvR with recv_r to correct this coding standard violation.
2020-04-04 18:15:25 +01:00
Ouss4 997d4fabb0 Check return from nxsem_wait_uninterruptible
This commit is only for those files under drivers/1wire, drivers/bch,
drivers/can and drivers/mmcsd.
2020-03-31 14:58:09 -06:00
Gregory Nutt 5c0e8e88b1 Revert "Makefile: move INCDIROPT to common place (#625)"
This reverts commit b9ace36fcc.

This change was added by PR 625 but has a serious logic flaw.  It removes all occurrences of INCDIROPT and replaces it with a definition in tools/Config.mk:

    else ifeq ($(WINTOOL),y)
      DEFINE = "$(TOPDIR)/tools/define.sh"
      INCDIR = "$(TOPDIR)/tools/incdir.sh" -w

This logic flaw is the Config.mk is included in all Make.defs files BEFORE WINTOOL is defined.  As a result, the definition is wrong in many places when building under Cygwin with a Windows native toolchain.
2020-03-26 08:50:29 -07:00
Xiang Xiao b9ace36fcc
Makefile: move INCDIROPT to common place (#625) 2020-03-26 08:09:59 -06:00
Gregory Nutt 547a3cb3d9 Run all .c and .h files in previous commits through nxstyle. 2020-03-22 08:24:07 -05:00
Gregory Nutt 66ab039b89 drivers/: Remove support for CONFIG_FS_WRITABLE 2020-03-22 08:24:07 -05:00
GAEHWILER Reto 85e461c59c STM32H7/STM32F30: Typos, register correction and extension
* Correction in stm32h7x3xx_rcc
* Adding GPIO_TIM2_CH1OUT_1 to stm32f30xxx_pinmap
* Comment typo fix in drivers/mmcsd/mmcsd_spi.c
2020-03-03 09:20:58 -06:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Gregory Nutt 21aef0dd68 drivers/*/Kconfig: Consolidate driver Kconfig Files.
This commit does two things:

1. First, it reorganizes the driver Kconfig files so that each is self contained.  Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig.  Now, all of the driver configuration is consolitated in the latter.

2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files.  This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.

The nature of the introduced error was basically this:

- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.

This error was easy to make because the driver Kconfig files were not well modularized.  Making them fully self-contained should eliminate this kind of error in the future.
2020-02-15 15:19:11 +01:00
Xiang Xiao 3cb259daa6 drivers/Kconfig: Move if/endif to subfolder Kconfig
Move if/endif to subfolder Kconfig and make ARCH_HAVE_XXX option always selectable by moving out of if/endif
2020-02-08 08:04:05 -06:00
Xiang Xiao ac2aec96e0 Refine Kconfig under drivers folder
1.Move subsystem config into sub folder
2.Remove the duplicated if/endif

Change-Id: I0b96ac0570ee1ba62bbb95586381f5410b90bcf0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-06 08:47:30 -03:00
Xiang Xiao 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt 4465916c5e drivers/mmcsd/mmcsd_sdio.c: Correct typo noted in Issue 180 2019-11-30 09:27:55 -06:00
Gregory Nutt 0002258f17 drivers/mmcsd/mmcsd_sdio.c: Commit 29612c40c5 slipped on by me: None of the common code may include ANY GCC dependencies. Fixed appropriately by adding a definition for the compiler dependency in include/nuttx/compiler.h. 2019-10-31 18:02:14 -06:00
David S. Alessio 29612c40c5 drivers/mmcsd/mmcsd_sdio.c: Align DMA buffer for MBURST size. 2019-10-31 07:18:47 -06:00
David Sidrane 5f65012449 drivers/mmcsd/mmcsd_sdio.c: Enter a removed card state On a failure. If we fail to read cardstatus in mmcsd_transferready consider this a hard error and set the card to removed. 2019-10-29 10:05:10 -06:00
David Sidrane b7073a366b drivers/mmcsd/mmcsd_sdio.c: Set wrbusy after success of all the operations. Any failure could leave wrbusy set when it should not be if the operation failed. 2019-10-29 10:03:18 -06:00
Gregory Nutt 6ddd4752b0 Eliminate new warnings found in build testing. 2019-08-21 13:45:31 -06:00
Gregory Nutt cc945b00e0 drivers/mmcsd/mmcsd_sdio.c: Correct a misplaced #endif. 2019-08-21 11:22:59 -06:00
Ivan Ucherdzhiev f2c6a3f108 drivers/mmcsd/mmcsd_sdio.c: Copy/paste error fix for MMC. 2019-08-21 09:26:54 -06:00
Ivan Ucherdzhiev 19c070e0d1 drivers/mmcsd: Added support for MMC(eMMC) bigger than 2 GB (Tested with IMXRT1050EVKB and samsung eMMC 16GB). arch/arm/src/imxrt: IMXRT uSDHC driver cmd line reset logic modified. 2019-08-21 09:23:29 -06:00
Anthony Merlino 5cd2a1ae68 Merged in antmerlino/nuttx/mmcsd-bugfix (pull request #893)
drivers/mmcsd: Fixes bug where thread gets deadlocked due to recursive call and addresses comment regarding events.

When initializing the MMCSD, if we are being told there is a card, but we fail to initialize it, we should not re-register for an insertion event as this will immediately cause us to call in again. Instead, we should register for a removal event and wait for the card to be removed and re-inserted.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-06-13 01:27:02 +00:00
Gregory Nutt 3e848fb893 Merged imxrt1020 into master 2019-04-30 16:08:46 -06:00
Bob Feretich c6851201c0 This commit adds a new function arch_invalidate_dcache_by_addr(). It takes the same parameters as arch_invalidate_dcache(), but performs invalidation of only the lines in cache that need to be invalidated. This new function could be used as a a direct replacement for arch_invalidate_dcache().
The user of this invalidation are mmcsd_sdio currently.  The mmcsd_sdio driver makes calls for dcache invalidation through the chip specific architecture function SDIO_DMARECVSETUP(). I changed the arch/arm/stm32f7 chips to use arch_invalidate_dcache_by_addr() instead of arch_invalidate_dcache().

This commit includes additional changes to mmcsd_sdio.c.  I created SDIO_DMADELYDINVLDT() (DMA delayed invalidate) to invalidate store-into mode dcaches after the DMA transfer.  I have been using SDIO_DMADELYDINVLDT() for several weeks now and it has fixed the problems that I previously reported regarding non-cache aligned buffer invalidation errors (for my store-through dcache). However, it does not permit use of unaligned DMA buffers for store-into mode dcaches.

SDIO_DMADELYDINVLDT() is a NoOp unless the chip specific Kconfig file selects CONFIG_ARCH_HAVE_SDIO_DELAYED_INVLDT. I have modified all the stm32f7 chips to select it.
2018-11-20 14:03:42 -06:00
Gregory Nutt 31485356b8 Updates based on coding style review of PR 755 2018-11-09 07:51:43 -06:00
Petteri Aimonen 96da659c0b Merged in paimonen/nuttx/pullreq_FAT_improvements (pull request #755)
Pullreq FAT improvements

* NuttX: Add CONFIG_FAT_LFN_ALIAS_HASH to speed up creating long filenames.

    Long filenames on FAT filesystems have associated 8.3 character alias
    short filenames. The traditional form of these is FILENA~1.EXT with
    a running count of the number of similar names. However creating this
    unique count can take several seconds if there are many similarly named
    files in the directory. Enabling FAT_LFN_ALIAS_HASH uses an alternative
    format of FI0123~1.TXT where the four digits are a hash of the original
    filename. This method is similar to what is used by Windows 2000 and
    later.

* NuttX: Add CONFIG_FAT_LFN_ALIAS_TRAILCHARS alternative format for 8.3 filenames.

    Traditional format for long filename 8.3 aliases takes first 6
    characters of long filename. If this option is set to N > 0,
    NuttX will instead take first 6-N and last N characters to form
    the short name. This is useful for filenames like "datafile12.txt"
    where the first characters would always remain the same.

* NuttX: FAT32: Fix file date corruption in fat_truncate().

* NuttX: if SD card wait seems to be a long one, give time for other threads to run.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-11-09 13:46:16 +00:00
Gregory Nutt 5c8831c886 drivers/mmcsd/Kconfig: Remove executable bit from file permissions. 2018-10-30 09:48:53 -06:00
Dave Marples d1c01e1135 With these changes the SDMMC card for LPC4330 is now working properly BUT it needs more testing, especially with different cards etc. This code should be applicable to all members of the lpc43xx family.
In addition to the problems that were previously identified there were a few other bits and pieces outstanding;

  * Timing was dependent on CPU speed rather than absolute time
  * End of transfer handling was a bit mixed up
  * It's possible for data to still be in the FIFO (i.e. not have reached
    the card) when a next write is requested, so we need to wait for that to
    complete
  * Interrupt Status could be carried over from one transfer episode to the
    next, corrupting progress
  * Multi-descriptor DMA writing simply wasn't implemented, but there were no
    indications ... it just failed silently
2018-10-24 18:06:38 -06:00
Gregory Nutt 4e5cf1229c drivers/mmcsd/Kconfig: three configuration settings were within ifdef/endif and led to warning: xxx selects xxxx which has unmet direct dependencies. Fix by moving settings to drivers/Kconfig and outside of the ifdef-endif. Also renamed CONFIG_SDIO_PREFLIGHT to CONFIG_ARCH_HAVE_SDIO_PREFLIGHT to follow naming of similar hidden architecture capability configurations. 2018-08-05 17:58:17 -06:00
Gregory Nutt 92890552f1 drivrs/mmcsd: Partial reversion of commit 17b6c7ba39. Backed out all block callback logic controlled CONFIG_SDIO_BLK_CALLBACK. Usage of this feature by applications is a blatant violation of the POSIX interface standard. 2018-07-20 10:08:01 -06:00