axs10x/emdk/hsdk/iot_dk: Implement board_mmc_getcd()
authorAlexey Brodkin <abrodkin@synopsys.com>
Thu, 11 Oct 2018 09:39:55 +0000 (12:39 +0300)
committerAlexey Brodkin <abrodkin@synopsys.com>
Fri, 12 Oct 2018 12:14:41 +0000 (15:14 +0300)
So now we may detect MMC/SD-card existence and
instead of completely misleading message on missing card:
------------------------>8-----------------------
Loading Environment from FAT... Card did not respond to voltage select!
------------------------>8-----------------------

we now get very clear one:
------------------------>8-----------------------
Loading Environment from FAT... MMC: no card present
------------------------>8-----------------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
board/synopsys/axs10x/axs10x.c
board/synopsys/emdk/emdk.c
board/synopsys/hsdk/hsdk.c
board/synopsys/iot_devkit/iot_devkit.c

index af78127dde93131a9bde02bb104b7a3fc613250f..c95f7af7a7681ca1dd5c803a99e1b4a5afaa6142 100644 (file)
@@ -33,6 +33,13 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct dwmci_host *host = mmc->priv;
+
+       return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
 #define AXS_MB_CREG    0xE0011000
 
 int board_early_init_f(void)
index bbb946a700b98d0212afa0785935cf30ffa225bd..79cafefb8b8e9655b962d90e5d3676e3f79ec50d 100644 (file)
@@ -34,6 +34,13 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct dwmci_host *host = mmc->priv;
+
+       return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
 #define CREG_BASE              0xF0001000
 #define CREG_BOOT_OFFSET       0
 #define CREG_BOOT_WP_OFFSET    8
index 4f46d2e25be9ec05cce512cbabd8cf84aa332ab5..b6aefdbe6d6a52620c52d57b4c551e66802757b0 100644 (file)
@@ -1019,6 +1019,13 @@ int board_late_init(void)
        return 0;
 }
 
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct dwmci_host *host = mmc->priv;
+
+       return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
 int board_mmc_init(bd_t *bis)
 {
        struct dwmci_host *host = NULL;
index 40c29e79ba1c1b5692df937085ac01fa6b618356..f8838fb3ce87a15e654b5ddeea3bd73169343737 100644 (file)
@@ -170,6 +170,13 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 
+int board_mmc_getcd(struct mmc *mmc)
+{
+       struct dwmci_host *host = mmc->priv;
+
+       return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
 #define IOTDK_RESET_SEQ                0x55AA6699
 
 void reset_cpu(ulong addr)