Skip to content

Commit

Permalink
ARM: at91: move alternative initial mapping to board-dt-sama5.c
Browse files Browse the repository at this point in the history
For sama5d4, remove an indirection and the remaining need for at91_boot_soc
structure.
This will allow further cleanup.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
  • Loading branch information
Nicolas Ferre committed Feb 2, 2015
1 parent 2b019a4 commit 6bd3e3f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 40 deletions.
37 changes: 36 additions & 1 deletion arch/arm/mach-at91/board-dt-sama5.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <linux/clk-provider.h>
#include <linux/phy.h>

#include <mach/hardware.h>

#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/mach/arch.h>
Expand Down Expand Up @@ -63,14 +65,47 @@ DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
.dt_compat = sama5_dt_board_compat,
MACHINE_END

static struct map_desc at91_io_desc[] __initdata = {
{
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
.pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
.length = SZ_512,
.type = MT_DEVICE,
},
{
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
.pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
.length = SZ_512,
.type = MT_DEVICE,
},
{ /* On sama5d4, we use USART3 as serial console */
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
.pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
.length = SZ_256,
.type = MT_DEVICE,
},
{ /* A bunch of peripheral with fine grained IO space */
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
.pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
.length = SZ_2K,
.type = MT_DEVICE,
},
};

static void __init sama5_alt_map_io(void)
{
at91_alt_map_io();
iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
}

static const char *sama5_alt_dt_board_compat[] __initconst = {
"atmel,sama5d4",
NULL
};

DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)")
/* Maintainer: Atmel */
.map_io = at91_alt_map_io,
.map_io = sama5_alt_map_io,
.init_early = at91_dt_initialize,
.init_machine = sama5_dt_device_init,
.dt_compat = sama5_alt_dt_board_compat,
Expand Down
33 changes: 0 additions & 33 deletions arch/arm/mach-at91/sama5d4.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,6 @@
/* --------------------------------------------------------------------
* Processor initialization
* -------------------------------------------------------------------- */
static struct map_desc at91_io_desc[] __initdata = {
{
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
.pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
.length = SZ_512,
.type = MT_DEVICE,
},
{
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
.pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
.length = SZ_512,
.type = MT_DEVICE,
},
{ /* On sama5d4, we use USART3 as serial console */
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
.pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
.length = SZ_256,
.type = MT_DEVICE,
},
{ /* A bunch of peripheral with fine grained IO space */
.virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
.pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
.length = SZ_2K,
.type = MT_DEVICE,
},
};


static void __init sama5d4_map_io(void)
{
iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
}

AT91_SOC_START(sama5d4)
.map_io = sama5d4_map_io,
AT91_SOC_END
6 changes: 0 additions & 6 deletions arch/arm/mach-at91/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ void __init at91_alt_map_io(void)
if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
pr_info("AT91: Detected soc subtype: %s\n",
at91_get_soc_subtype(&at91_soc_initdata));

if (!at91_soc_is_enabled())
panic("AT91: Soc not enabled");

if (at91_boot_soc.map_io)
at91_boot_soc.map_io();
}

void __iomem *at91_matrix_base;
Expand Down

0 comments on commit 6bd3e3f

Please sign in to comment.