mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-22 20:38:03 +00:00
Merge "fix(rpi3): initialize SD card host controller" into integration
This commit is contained in:
commit
24ddb6ce01
3 changed files with 7 additions and 3 deletions
|
@ -245,13 +245,12 @@ static void rpi3_sdhost_reset(void)
|
||||||
|
|
||||||
static void rpi3_sdhost_initialize(void)
|
static void rpi3_sdhost_initialize(void)
|
||||||
{
|
{
|
||||||
uintptr_t reg_base = rpi3_sdhost_params.reg_base;
|
|
||||||
|
|
||||||
assert((rpi3_sdhost_params.reg_base & MMC_BLOCK_MASK) == 0);
|
assert((rpi3_sdhost_params.reg_base & MMC_BLOCK_MASK) == 0);
|
||||||
|
|
||||||
rpi3_sdhost_reset();
|
rpi3_sdhost_reset();
|
||||||
|
|
||||||
mmio_write_32(reg_base + HC_CLOCKDIVISOR, HC_CLOCKDIVISOR_PREFERVAL);
|
rpi3_sdhost_set_ios(rpi3_sdhost_params.clk_rate_initial,
|
||||||
|
rpi3_sdhost_params.bus_width);
|
||||||
udelay(300);
|
udelay(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
struct rpi3_sdhost_params {
|
struct rpi3_sdhost_params {
|
||||||
uintptr_t reg_base;
|
uintptr_t reg_base;
|
||||||
uint32_t clk_rate;
|
uint32_t clk_rate;
|
||||||
|
uint32_t clk_rate_initial;
|
||||||
uint32_t bus_width;
|
uint32_t bus_width;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t current_cmd;
|
uint32_t current_cmd;
|
||||||
|
@ -57,6 +58,8 @@ void rpi3_sdhost_stop(void);
|
||||||
#define HC_CMD_READ 0x0040
|
#define HC_CMD_READ 0x0040
|
||||||
#define HC_CMD_COMMAND_MASK 0x003f
|
#define HC_CMD_COMMAND_MASK 0x003f
|
||||||
|
|
||||||
|
#define RPI3_SDHOST_MAX_CLOCK 250000000 // technically, we should obtain this number from the mailbox
|
||||||
|
|
||||||
#define HC_CLOCKDIVISOR_MAXVAL 0x07ff
|
#define HC_CLOCKDIVISOR_MAXVAL 0x07ff
|
||||||
#define HC_CLOCKDIVISOR_PREFERVAL 0x027b
|
#define HC_CLOCKDIVISOR_PREFERVAL 0x027b
|
||||||
#define HC_CLOCKDIVISOR_SLOWVAL 0x0148
|
#define HC_CLOCKDIVISOR_SLOWVAL 0x0148
|
||||||
|
|
|
@ -35,7 +35,9 @@ static void rpi3_sdhost_setup(void)
|
||||||
params.reg_base = RPI3_SDHOST_BASE;
|
params.reg_base = RPI3_SDHOST_BASE;
|
||||||
params.bus_width = MMC_BUS_WIDTH_1;
|
params.bus_width = MMC_BUS_WIDTH_1;
|
||||||
params.clk_rate = 50000000;
|
params.clk_rate = 50000000;
|
||||||
|
params.clk_rate_initial = (RPI3_SDHOST_MAX_CLOCK / HC_CLOCKDIVISOR_MAXVAL);
|
||||||
mmc_info.mmc_dev_type = MMC_IS_SD_HC;
|
mmc_info.mmc_dev_type = MMC_IS_SD_HC;
|
||||||
|
mmc_info.ocr_voltage = OCR_3_2_3_3 | OCR_3_3_3_4;
|
||||||
rpi3_sdhost_init(¶ms, &mmc_info);
|
rpi3_sdhost_init(¶ms, &mmc_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue