mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
arch/mpfs: Don't include nuttx header file in mpfs_opensbi.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
4e08b1df93
commit
e800f54bfd
1 changed files with 9 additions and 25 deletions
|
@ -22,25 +22,12 @@
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "riscv_arch.h"
|
|
||||||
|
|
||||||
#include <hardware/mpfs_plic.h>
|
#include <hardware/mpfs_plic.h>
|
||||||
#include <hardware/mpfs_memorymap.h>
|
#include <hardware/mpfs_memorymap.h>
|
||||||
#include <hardware/mpfs_clint.h>
|
#include <hardware/mpfs_clint.h>
|
||||||
#include <hardware/mpfs_sysreg.h>
|
#include <hardware/mpfs_sysreg.h>
|
||||||
|
|
||||||
/* OpenSBI will also define NULL. Undefine NULL in order to avoid warning:
|
#include <sbi/riscv_io.h>
|
||||||
* 'warning: "NULL" redefined'
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef NULL
|
|
||||||
#undef NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sbi/riscv_encoding.h>
|
#include <sbi/riscv_encoding.h>
|
||||||
#include <sbi/sbi_console.h>
|
#include <sbi/sbi_console.h>
|
||||||
#include <sbi/sbi_platform.h>
|
#include <sbi/sbi_platform.h>
|
||||||
|
@ -251,8 +238,6 @@ static const uint64_t sbi_entrypoints[] =
|
||||||
|
|
||||||
static unsigned long mpfs_hart_to_scratch(int hartid)
|
static unsigned long mpfs_hart_to_scratch(int hartid)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(hartid < MPFS_MAX_NUM_HARTS);
|
|
||||||
|
|
||||||
return (unsigned long)(&g_scratches[hartid].scratch);
|
return (unsigned long)(&g_scratches[hartid].scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,6 +410,8 @@ static int mpfs_timer_init(bool cold_boot)
|
||||||
|
|
||||||
static int mpfs_early_init(bool cold_boot)
|
static int mpfs_early_init(bool cold_boot)
|
||||||
{
|
{
|
||||||
|
uint32_t val;
|
||||||
|
|
||||||
/* We expect that e51 has terminated the following irqs with
|
/* We expect that e51 has terminated the following irqs with
|
||||||
* up_disable_irq():
|
* up_disable_irq():
|
||||||
* 1. MPFS_IRQ_MMC_MAIN
|
* 1. MPFS_IRQ_MMC_MAIN
|
||||||
|
@ -441,15 +428,16 @@ static int mpfs_early_init(bool cold_boot)
|
||||||
|
|
||||||
/* Explicitly reset eMMC */
|
/* Explicitly reset eMMC */
|
||||||
|
|
||||||
modifyreg32(MPFS_SYSREG_SOFT_RESET_CR, 0, SYSREG_SOFT_RESET_CR_MMC);
|
val = readl((void *)MPFS_SYSREG_SOFT_RESET_CR);
|
||||||
modifyreg32(MPFS_SYSREG_SOFT_RESET_CR, SYSREG_SOFT_RESET_CR_MMC, 0);
|
writel(val | SYSREG_SOFT_RESET_CR_MMC, (void *)MPFS_SYSREG_SOFT_RESET_CR);
|
||||||
|
writel(val & ~SYSREG_SOFT_RESET_CR_MMC, (void *)MPFS_SYSREG_SOFT_RESET_CR);
|
||||||
|
|
||||||
/* There are other clocks that need to be enabled for the Linux kernel to
|
/* There are other clocks that need to be enabled for the Linux kernel to
|
||||||
* run. For now, turn on all the clocks.
|
* run. For now, turn on all the clocks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
putreg32(0x0, MPFS_SYSREG_SOFT_RESET_CR);
|
writel(0x0, (void *)MPFS_SYSREG_SOFT_RESET_CR);
|
||||||
putreg32(0x7fffffff, MPFS_SYSREG_SUBBLK_CLOCK_CR);
|
writel(0x7fffffff, (void *)MPFS_SYSREG_SUBBLK_CLOCK_CR);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -472,8 +460,6 @@ static int mpfs_early_init(bool cold_boot)
|
||||||
|
|
||||||
static void mpfs_opensbi_scratch_setup(uint32_t hartid)
|
static void mpfs_opensbi_scratch_setup(uint32_t hartid)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(hartid < MPFS_MAX_NUM_HARTS);
|
|
||||||
|
|
||||||
g_scratches[hartid].scratch.options = SBI_SCRATCH_DEBUG_PRINTS;
|
g_scratches[hartid].scratch.options = SBI_SCRATCH_DEBUG_PRINTS;
|
||||||
g_scratches[hartid].scratch.hartid_to_scratch =
|
g_scratches[hartid].scratch.hartid_to_scratch =
|
||||||
(unsigned long)mpfs_hart_to_scratch;
|
(unsigned long)mpfs_hart_to_scratch;
|
||||||
|
@ -487,8 +473,6 @@ static void mpfs_opensbi_scratch_setup(uint32_t hartid)
|
||||||
g_scratches[hartid].scratch.fw_start = (unsigned long)&__mpfs_nuttx_start;
|
g_scratches[hartid].scratch.fw_start = (unsigned long)&__mpfs_nuttx_start;
|
||||||
g_scratches[hartid].scratch.fw_size = (unsigned long)&__mpfs_nuttx_end -
|
g_scratches[hartid].scratch.fw_size = (unsigned long)&__mpfs_nuttx_end -
|
||||||
(unsigned long)&__mpfs_nuttx_start;
|
(unsigned long)&__mpfs_nuttx_start;
|
||||||
|
|
||||||
DEBUGASSERT(g_scratches[hartid].scratch.fw_size > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -556,5 +540,5 @@ void __attribute__((noreturn)) mpfs_opensbi_setup(void)
|
||||||
|
|
||||||
/* Will never get here */
|
/* Will never get here */
|
||||||
|
|
||||||
PANIC();
|
sbi_panic(__func__);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue