risc-v/mpfs: emmcsd: allow switching from SD to eMMC
If the system starts up using the SD-card, and later wants to switch to use the eMMC, it's not going to happen. SD-card will be kept selected within the FPGA making the transition fail. It's been possible to switch from eMMC to SD, but now the transition is possible for both directions. Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
This commit is contained in:
parent
d7b04a2b8b
commit
945e531eaf
@ -1423,6 +1423,16 @@ static void mpfs_emmc_card_init(struct mpfs_dev_s *priv)
|
||||
MPFS_SYSREG_B4_10_11);
|
||||
putreg32(LIBERO_SETTING_MSSIO_BANK4_IO_CFG_12_13_CR_EMMC,
|
||||
MPFS_SYSREG_4_12_13);
|
||||
|
||||
#ifdef CONFIG_MPFS_EMMCSD_MUX_GPIO
|
||||
/* Select eMMC-card */
|
||||
|
||||
mcinfo("Selecting eMMC card\n");
|
||||
mpfs_gpiowrite(MPFS_EMMCSD_GPIO, false);
|
||||
|
||||
#else
|
||||
putreg32(0, SDIO_REGISTER_ADDRESS);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1453,6 +1463,19 @@ static bool mpfs_device_reset(struct sdio_dev_s *dev)
|
||||
|
||||
up_disable_irq(priv->plic_irq);
|
||||
|
||||
/* SD card needs FPGA out of reset and FIC3 clks for the eMMC / SD
|
||||
* switch. It's OK if these are already out of reset or clk applied.
|
||||
* Also, switching back from SD card to eMMC needs these clocks.
|
||||
*/
|
||||
|
||||
modifyreg32(MPFS_SYSREG_SOFT_RESET_CR,
|
||||
SYSREG_SOFT_RESET_CR_FPGA |
|
||||
SYSREG_SOFT_RESET_CR_FIC3,
|
||||
0);
|
||||
|
||||
modifyreg32(MPFS_SYSREG_SUBBLK_CLOCK_CR, 0,
|
||||
SYSREG_SUBBLK_CLOCK_CR_FIC3);
|
||||
|
||||
if (!priv->emmc)
|
||||
{
|
||||
/* Apply default HW settings */
|
||||
@ -1461,17 +1484,6 @@ static bool mpfs_device_reset(struct sdio_dev_s *dev)
|
||||
priv->bus_speed = MPFS_EMMCSD_MODE_SDR;
|
||||
priv->jumpers_3v3 = true;
|
||||
|
||||
/* SD card needs FPGA out of reset and FIC3 clks for the eMMC / SD
|
||||
* switch. It's OK if these are already out of reset or clk applied.
|
||||
*/
|
||||
|
||||
modifyreg32(MPFS_SYSREG_SOFT_RESET_CR,
|
||||
SYSREG_SOFT_RESET_CR_FPGA |
|
||||
SYSREG_SOFT_RESET_CR_FIC3, 0);
|
||||
|
||||
modifyreg32(MPFS_SYSREG_SUBBLK_CLOCK_CR, 0,
|
||||
SYSREG_SUBBLK_CLOCK_CR_FIC3);
|
||||
|
||||
mpfs_sdcard_init(priv);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user