diff options
| author | Tom Rini <[email protected]> | 2023-07-24 10:58:25 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-07-24 10:58:25 -0400 |
| commit | 7177259893fa95047720941121edee5ca76e0988 (patch) | |
| tree | 8b959af4842943a9183fc0748ef0601ad1ebaf46 | |
| parent | 590a6cff974ab76df364cae2c793a89759cf78f3 (diff) | |
| parent | e83b6f99fc512acda05691db35e7d83817eac0b9 (diff) | |
Merge tag 'u-boot-at91-fixes-2023.10-a' of https://source.denx.de/u-boot/custodians/u-boot-at91
First set of u-boot-atmel fixes for the 2023.07 cycle:
This small fixes set includes the LTO configs for the boards that had
the SPL size up to the limit (sama5d2-based), such that more code can be
added. It also includes a fix for mmc non-removable.
| -rw-r--r-- | configs/sama5d2_icp_mmc_defconfig | 1 | ||||
| -rw-r--r-- | configs/sama5d2_xplained_emmc_defconfig | 1 | ||||
| -rw-r--r-- | configs/sama5d2_xplained_mmc_defconfig | 1 | ||||
| -rw-r--r-- | configs/sama5d2_xplained_qspiflash_defconfig | 1 | ||||
| -rw-r--r-- | configs/sama5d2_xplained_spiflash_defconfig | 1 | ||||
| -rw-r--r-- | drivers/mmc/atmel_sdhci.c | 39 |
6 files changed, 42 insertions, 2 deletions
diff --git a/configs/sama5d2_icp_mmc_defconfig b/configs/sama5d2_icp_mmc_defconfig index 185694d4319..9456b9e1e13 100644 --- a/configs/sama5d2_icp_mmc_defconfig +++ b/configs/sama5d2_icp_mmc_defconfig @@ -27,6 +27,7 @@ CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_LOAD_ADDR=0x22000000 CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y CONFIG_SD_BOOT=y diff --git a/configs/sama5d2_xplained_emmc_defconfig b/configs/sama5d2_xplained_emmc_defconfig index e33dcb8fb80..9ef0ff4aa9a 100644 --- a/configs/sama5d2_xplained_emmc_defconfig +++ b/configs/sama5d2_xplained_emmc_defconfig @@ -28,6 +28,7 @@ CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_LOAD_ADDR=0x22000000 CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y CONFIG_SD_BOOT=y diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index acd75174f7d..aed9edafdf7 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -29,6 +29,7 @@ CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_LOAD_ADDR=0x22000000 CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y CONFIG_SD_BOOT=y diff --git a/configs/sama5d2_xplained_qspiflash_defconfig b/configs/sama5d2_xplained_qspiflash_defconfig index 6346e5315bf..c9a20723f5a 100644 --- a/configs/sama5d2_xplained_qspiflash_defconfig +++ b/configs/sama5d2_xplained_qspiflash_defconfig @@ -29,6 +29,7 @@ CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SYS_LOAD_ADDR=0x22000000 CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y CONFIG_QSPI_BOOT=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index 76fa56ebeb5..c01a0c4cc7c 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -31,6 +31,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x22000000 CONFIG_DEBUG_UART=y +CONFIG_LTO=y CONFIG_ENV_VARS_UBOOT_CONFIG=y CONFIG_FIT=y CONFIG_SPI_BOOT=y diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index 37b0beeed47..5347ba90431 100644 --- a/drivers/mmc/atmel_sdhci.c +++ b/drivers/mmc/atmel_sdhci.c @@ -15,6 +15,9 @@ #define ATMEL_SDHC_MIN_FREQ 400000 #define ATMEL_SDHC_GCK_RATE 240000000 +#define ATMEL_SDHC_MC1R 0x204 +#define ATMEL_SDHC_MC1R_FCD 0x80 + #ifndef CONFIG_DM_MMC int atmel_sdhci_init(void *regbase, u32 id) { @@ -52,11 +55,37 @@ struct atmel_sdhci_plat { struct mmc mmc; }; +static void atmel_sdhci_config_fcd(struct sdhci_host *host) +{ + u8 mc1r; + + /* If nonremovable, assume that the card is always present. + * + * WA: SAMA5D2 doesn't drive CMD if using CD GPIO line. + */ + if ((host->mmc->cfg->host_caps & MMC_CAP_NONREMOVABLE) +#if CONFIG_IS_ENABLED(DM_GPIO) + || dm_gpio_get_value(&host->cd_gpio) >= 0 +#endif + ) { + sdhci_readb(host, ATMEL_SDHC_MC1R); + mc1r |= ATMEL_SDHC_MC1R_FCD; + sdhci_writeb(host, mc1r, ATMEL_SDHC_MC1R); + } +} + static int atmel_sdhci_deferred_probe(struct sdhci_host *host) { struct udevice *dev = host->mmc->dev; + int ret; - return sdhci_probe(dev); + ret = sdhci_probe(dev); + if (ret) + return ret; + + atmel_sdhci_config_fcd(host); + + return 0; } static const struct sdhci_ops atmel_sdhci_ops = { @@ -120,7 +149,13 @@ static int atmel_sdhci_probe(struct udevice *dev) clk_free(&clk); - return sdhci_probe(dev); + ret = sdhci_probe(dev); + if (ret) + return ret; + + atmel_sdhci_config_fcd(host); + + return 0; } static int atmel_sdhci_bind(struct udevice *dev) |
