From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andes Date: Tue, 19 Mar 2019 17:07:45 +0800 Subject: [U-Boot] [PATCH 4/9] riscv: ae350: initialize PLIC In-Reply-To: <20190319090750.8923-1-uboot@andestech.com> References: <20190319090750.8923-1-uboot@andestech.com> Message-ID: <20190319090750.8923-5-uboot@andestech.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Rick Chen Initialize PLIC when ae350 board startup. Signed-off-by: Rick Chen Cc: Greentime Hu --- board/AndesTech/ax25-ae350/ax25-ae350.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c index d343453..ebeb4b8 100644 --- a/board/AndesTech/ax25-ae350/ax25-ae350.c +++ b/board/AndesTech/ax25-ae350/ax25-ae350.c @@ -11,10 +11,17 @@ #include #include #include +#include +#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; extern phys_addr_t prior_stage_fdt_address; +extern int plic_init(int harts); + /* * Miscellaneous platform dependent initializations */ @@ -97,9 +104,32 @@ int smc_init(void) return 0; } +#ifdef CONFIG_NDS_PLIC +int init_plic(void) +{ + struct udevice *dev; + int ret; + + ret = uclass_find_first_device(UCLASS_CPU, &dev); + if (ret) + return ret; + + if (ret == 0 && dev != NULL) { + ret = cpu_get_count(dev); + plic_init(ret); + return 0; + } + + return -ENODEV; +} +#endif + #ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f(void) { +#ifdef CONFIG_NDS_PLIC + init_plic(); +#endif smc_init(); return 0; -- 2.7.4