mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-13 16:14:20 +00:00
uniphier: make eMMC controller base address configurable
The next SoC supports the same eMMC controller, but the register base will be changed. Make it configurable. Change-Id: I00cb5531bc3d8d49357ad5e922cdd3d785355edf Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
2cb260053d
commit
070dcbf532
3 changed files with 30 additions and 12 deletions
|
@ -38,7 +38,8 @@ unsigned int uniphier_get_boot_master(unsigned int soc);
|
|||
void uniphier_console_setup(void);
|
||||
|
||||
struct io_block_dev_spec;
|
||||
int uniphier_emmc_init(struct io_block_dev_spec **block_dev_spec);
|
||||
int uniphier_emmc_init(unsigned int soc,
|
||||
struct io_block_dev_spec **block_dev_spec);
|
||||
int uniphier_nand_init(struct io_block_dev_spec **block_dev_spec);
|
||||
int uniphier_usb_init(unsigned int soc,
|
||||
struct io_block_dev_spec **block_dev_spec);
|
||||
|
|
|
@ -87,7 +87,12 @@ struct uniphier_mmc_cmd {
|
|||
unsigned int is_data;
|
||||
};
|
||||
|
||||
static bool uniphier_emmc_block_addressing;
|
||||
struct uniphier_emmc_host {
|
||||
uintptr_t base;
|
||||
bool is_block_addressing;
|
||||
};
|
||||
|
||||
static struct uniphier_emmc_host uniphier_emmc_host;
|
||||
|
||||
static int uniphier_emmc_send_cmd(uintptr_t host_base,
|
||||
struct uniphier_mmc_cmd *cmd)
|
||||
|
@ -214,15 +219,15 @@ static int uniphier_emmc_load_image(uintptr_t host_base,
|
|||
|
||||
static size_t uniphier_emmc_read(int lba, uintptr_t buf, size_t size)
|
||||
{
|
||||
uintptr_t host_base = 0x5a000200;
|
||||
int ret;
|
||||
|
||||
inv_dcache_range(buf, size);
|
||||
|
||||
if (!uniphier_emmc_block_addressing)
|
||||
if (!uniphier_emmc_host.is_block_addressing)
|
||||
lba *= 512;
|
||||
|
||||
ret = uniphier_emmc_load_image(host_base, lba, buf, size / 512);
|
||||
ret = uniphier_emmc_load_image(uniphier_emmc_host.base,
|
||||
lba, buf, size / 512);
|
||||
|
||||
inv_dcache_range(buf, size);
|
||||
|
||||
|
@ -236,10 +241,10 @@ static struct io_block_dev_spec uniphier_emmc_dev_spec = {
|
|||
.block_size = 512,
|
||||
};
|
||||
|
||||
static int uniphier_emmc_hw_init(void)
|
||||
static int uniphier_emmc_hw_init(struct uniphier_emmc_host *host)
|
||||
{
|
||||
uintptr_t host_base = 0x5a000200;
|
||||
struct uniphier_mmc_cmd cmd = {0};
|
||||
uintptr_t host_base = uniphier_emmc_host.base;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
|
@ -258,7 +263,7 @@ static int uniphier_emmc_hw_init(void)
|
|||
;
|
||||
|
||||
ret = uniphier_emmc_check_device_size(host_base,
|
||||
&uniphier_emmc_block_addressing);
|
||||
&uniphier_emmc_host.is_block_addressing);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -277,11 +282,23 @@ static int uniphier_emmc_hw_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int uniphier_emmc_init(struct io_block_dev_spec **block_dev_spec)
|
||||
static const uintptr_t uniphier_emmc_base[] = {
|
||||
[UNIPHIER_SOC_LD11] = 0x5a000200,
|
||||
[UNIPHIER_SOC_LD20] = 0x5a000200,
|
||||
[UNIPHIER_SOC_PXS3] = 0x5a000200,
|
||||
};
|
||||
|
||||
int uniphier_emmc_init(unsigned int soc,
|
||||
struct io_block_dev_spec **block_dev_spec)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = uniphier_emmc_hw_init();
|
||||
assert(soc < ARRAY_SIZE(uniphier_emmc_base));
|
||||
uniphier_emmc_host.base = uniphier_emmc_base[soc];
|
||||
if (uniphier_emmc_host.base == 0UL)
|
||||
return -ENOTSUP;
|
||||
|
||||
ret = uniphier_emmc_hw_init(&uniphier_emmc_host);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -249,12 +249,12 @@ static int uniphier_io_fip_setup(void)
|
|||
return io_dev_open(uniphier_fip_dev_con, 0, &uniphier_fip_dev_handle);
|
||||
}
|
||||
|
||||
static int uniphier_io_emmc_setup(unsigned int soc_id, size_t buffer_offset)
|
||||
static int uniphier_io_emmc_setup(unsigned int soc, size_t buffer_offset)
|
||||
{
|
||||
struct io_block_dev_spec *block_dev_spec;
|
||||
int ret;
|
||||
|
||||
ret = uniphier_emmc_init(&block_dev_spec);
|
||||
ret = uniphier_emmc_init(soc, &block_dev_spec);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue