diff options
Diffstat (limited to 'arch/arm/boards/sama5d27-som1/lowlevel.c')
-rw-r--r-- | arch/arm/boards/sama5d27-som1/lowlevel.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/arch/arm/boards/sama5d27-som1/lowlevel.c b/arch/arm/boards/sama5d27-som1/lowlevel.c index 7df5a4772d..67300587fe 100644 --- a/arch/arm/boards/sama5d27-som1/lowlevel.c +++ b/arch/arm/boards/sama5d27-som1/lowlevel.c @@ -5,15 +5,12 @@ #include <common.h> #include <init.h> - -#include <asm/barebox-arm-head.h> -#include <asm/barebox-arm.h> -#include <mach/at91_pmc_ll.h> - -#include <mach/hardware.h> -#include <mach/iomux.h> +#include <mach/at91/barebox-arm.h> +#include <mach/at91/sama5d2_ll.h> +#include <mach/at91/iomux.h> +#include <mach/at91/xload.h> #include <debug_ll.h> -#include <mach/at91_dbgu.h> +#include <mach/at91/sama5d2-sip-ddramc.h> #define RGB_LED_GREEN (1 << 0) #define RGB_LED_RED (1 << 1) @@ -22,13 +19,10 @@ /* PCK = 492MHz, MCK = 164MHz */ #define MASTER_CLOCK 164000000 -#define sama5d2_pmc_enable_periph_clock(clk) \ - at91_pmc_sam9x5_enable_periph_clock(IOMEM(SAMA5D2_BASE_PMC), clk) - static void ek_turn_led(unsigned color) { struct { - unsigned long pio; + void __iomem *pio; unsigned bit; unsigned color; } *led, leds[] = { @@ -39,43 +33,41 @@ static void ek_turn_led(unsigned color) }; for (led = leds; led->pio; led++) { - at91_mux_gpio4_enable(IOMEM(led->pio), BIT(led->bit)); - at91_mux_gpio4_input(IOMEM(led->pio), BIT(led->bit), false); - at91_mux_gpio4_set(IOMEM(led->pio), BIT(led->bit), led->color); + at91_mux_gpio4_enable(led->pio, BIT(led->bit)); + at91_mux_gpio4_input(led->pio, BIT(led->bit), false); + at91_mux_gpio4_set(led->pio, BIT(led->bit), led->color); } } -static void ek_dbgu_init(void) +SAMA5D2_ENTRY_FUNCTION(start_sama5d27_som1_ek_xload_mmc, r4) { - unsigned mck = MASTER_CLOCK / 2; + void __iomem *dbgu_base; + sama5d2_lowlevel_init(); - sama5d2_pmc_enable_periph_clock(SAMA5D2_ID_PIOD); - - at91_mux_pio4_set_A_periph(IOMEM(SAMA5D2_BASE_PIOD), - pin_to_mask(AT91_PIN_PD3)); /* DBGU TXD */ + dbgu_base = sama5d2_resetup_uart_console(MASTER_CLOCK); + putc_ll('>'); - sama5d2_pmc_enable_periph_clock(SAMA5D2_ID_UART1); + relocate_to_current_adr(); + setup_c(); - at91_dbgu_setup_ll(IOMEM(SAMA5D2_BASE_UART1), mck, 115200); + pbl_set_putc(at91_dbgu_putc, dbgu_base); - putc_ll('>'); + ek_turn_led(RGB_LED_RED | RGB_LED_GREEN); /* Yellow */ + sama5d2_udelay_init(MASTER_CLOCK); + sama5d2_d1g_ddrconf(); + sama5d2_sdhci_start_image(r4); } extern char __dtb_z_at91_sama5d27_som1_ek_start[]; -ENTRY_FUNCTION(start_sama5d27_som1_ek, r0, r1, r2) +SAMA5D2_ENTRY_FUNCTION(start_sama5d27_som1_ek, r4) { void *fdt; - arm_cpu_lowlevel_init(); - - arm_setup_stack(SAMA5D2_SRAM_BASE + SAMA5D2_SRAM_SIZE - 16); - - if (IS_ENABLED(CONFIG_DEBUG_LL)) - ek_dbgu_init(); + putc_ll('>'); fdt = __dtb_z_at91_sama5d27_som1_ek_start + get_runtime_offset(); ek_turn_led(RGB_LED_GREEN); - barebox_arm_entry(SAMA5_DDRCS, SZ_128M, fdt); + sama5d2_barebox_entry(r4, fdt); } |