• Damien Le Moal's avatar
    riscv: Add SOC early init support · 335b1390
    Damien Le Moal authored
    Add a mechanism for early SoC initialization for platforms that need
    additional hardware initialization not possible through the regular
    device tree and drivers mechanism. With this, a SoC specific
    initialization function can be called very early, before DTB parsing
    is done by parse_dtb() in Linux RISC-V kernel setup code.
    
    This can be very useful for early hardware initialization for No-MMU
    kernels booted directly in M-mode because it is quite likely that no
    other booting stage exist prior to the No-MMU kernel.
    
    Example use of a SoC early initialization is as follows:
    
    static void vendor_abc_early_init(const void *fdt)
    {
    	/*
    	 * some early init code here that can use simple matches
    	 * against the flat device tree file.
    	 */
    }
    SOC_EARLY_INIT_DECLARE("vendor,abc", abc_early_init);
    
    This early initialization function is executed only if the flat device
    tree for the board has a 'compatible = "vendor,abc"' entry;
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
    Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
    Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
    335b1390
soc.h 591 Bytes