mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 00:54:22 +00:00
uniphier: make NAND controller base address configurable
The next SoC does not support the NAND controller, but make the base address configurable for consistency and future proof. Change-Id: I776e43ff2b0408577919b0b72849c3e1e5ce0758 Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
070dcbf532
commit
bda9cd70a7
3 changed files with 19 additions and 6 deletions
|
@ -40,7 +40,8 @@ void uniphier_console_setup(void);
|
||||||
struct io_block_dev_spec;
|
struct io_block_dev_spec;
|
||||||
int uniphier_emmc_init(unsigned int soc,
|
int uniphier_emmc_init(unsigned int soc,
|
||||||
struct io_block_dev_spec **block_dev_spec);
|
struct io_block_dev_spec **block_dev_spec);
|
||||||
int uniphier_nand_init(struct io_block_dev_spec **block_dev_spec);
|
int uniphier_nand_init(unsigned int soc,
|
||||||
|
struct io_block_dev_spec **block_dev_spec);
|
||||||
int uniphier_usb_init(unsigned int soc,
|
int uniphier_usb_init(unsigned int soc,
|
||||||
struct io_block_dev_spec **block_dev_spec);
|
struct io_block_dev_spec **block_dev_spec);
|
||||||
|
|
||||||
|
|
|
@ -261,12 +261,12 @@ static int uniphier_io_emmc_setup(unsigned int soc, size_t buffer_offset)
|
||||||
return uniphier_io_block_setup(0x20000, block_dev_spec, buffer_offset);
|
return uniphier_io_block_setup(0x20000, block_dev_spec, buffer_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uniphier_io_nand_setup(unsigned int soc_id, size_t buffer_offset)
|
static int uniphier_io_nand_setup(unsigned int soc, size_t buffer_offset)
|
||||||
{
|
{
|
||||||
struct io_block_dev_spec *block_dev_spec;
|
struct io_block_dev_spec *block_dev_spec;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = uniphier_nand_init(&block_dev_spec);
|
ret = uniphier_nand_init(soc, &block_dev_spec);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <platform_def.h>
|
#include <platform_def.h>
|
||||||
|
@ -237,8 +238,7 @@ static int uniphier_nand_hw_init(struct uniphier_nand *nand)
|
||||||
for (i = 0; i < ARRAY_SIZE(nand->bbt); i++)
|
for (i = 0; i < ARRAY_SIZE(nand->bbt); i++)
|
||||||
nand->bbt[i] = UNIPHIER_NAND_BBT_UNKNOWN;
|
nand->bbt[i] = UNIPHIER_NAND_BBT_UNKNOWN;
|
||||||
|
|
||||||
nand->host_base = 0x68000000;
|
nand->reg_base = nand->host_base + 0x100000;
|
||||||
nand->reg_base = 0x68100000;
|
|
||||||
|
|
||||||
nand->pages_per_block =
|
nand->pages_per_block =
|
||||||
mmio_read_32(nand->reg_base + DENALI_PAGES_PER_BLOCK);
|
mmio_read_32(nand->reg_base + DENALI_PAGES_PER_BLOCK);
|
||||||
|
@ -255,10 +255,22 @@ static int uniphier_nand_hw_init(struct uniphier_nand *nand)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uniphier_nand_init(struct io_block_dev_spec **block_dev_spec)
|
static const uintptr_t uniphier_nand_base[] = {
|
||||||
|
[UNIPHIER_SOC_LD11] = 0x68000000,
|
||||||
|
[UNIPHIER_SOC_LD20] = 0x68000000,
|
||||||
|
[UNIPHIER_SOC_PXS3] = 0x68000000,
|
||||||
|
};
|
||||||
|
|
||||||
|
int uniphier_nand_init(unsigned int soc,
|
||||||
|
struct io_block_dev_spec **block_dev_spec)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
assert(soc < ARRAY_SIZE(uniphier_nand_base));
|
||||||
|
uniphier_nand.host_base = uniphier_nand_base[soc];
|
||||||
|
if (!uniphier_nand.host_base)
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
ret = uniphier_nand_hw_init(&uniphier_nand);
|
ret = uniphier_nand_hw_init(&uniphier_nand);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue