Skip to content

Commit

Permalink
ARM: integrator: remove static AP syscon mapping
Browse files Browse the repository at this point in the history
This removes the static mapping for the AP system controller for
the device tree case. Fork the static mappings table and move
the system controller to only be statically mapped in the ATAG
boot path.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Linus Walleij committed Nov 16, 2012
1 parent 64100a0 commit 83feba5
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions arch/arm/mach-integrator/integrator_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@

#include "common.h"

/*
/* Base address to the AP system controller */
static void __iomem *ap_syscon_base;

/*
* All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
* is the (PA >> 12).
*
* Setup a VA for the Integrator interrupt controller (for header #0,
* just for now).
*/
#define VA_IC_BASE __io_address(INTEGRATOR_IC_BASE)
#define VA_SC_BASE __io_address(INTEGRATOR_SC_BASE)
#define VA_EBI_BASE __io_address(INTEGRATOR_EBI_BASE)
#define VA_CMIC_BASE __io_address(INTEGRATOR_HDR_IC)

Expand Down Expand Up @@ -98,11 +100,6 @@ static struct map_desc ap_io_desc[] __initdata = {
.pfn = __phys_to_pfn(INTEGRATOR_HDR_BASE),
.length = SZ_4K,
.type = MT_DEVICE
}, {
.virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
.pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
.length = SZ_4K,
.type = MT_DEVICE
}, {
.virtual = IO_ADDRESS(INTEGRATOR_EBI_BASE),
.pfn = __phys_to_pfn(INTEGRATOR_EBI_BASE),
Expand Down Expand Up @@ -203,16 +200,15 @@ device_initcall(irq_syscore_init);
/*
* Flash handling.
*/
#define SC_CTRLC (VA_SC_BASE + INTEGRATOR_SC_CTRLC_OFFSET)
#define SC_CTRLS (VA_SC_BASE + INTEGRATOR_SC_CTRLS_OFFSET)
#define EBI_CSR1 (VA_EBI_BASE + INTEGRATOR_EBI_CSR1_OFFSET)
#define EBI_LOCK (VA_EBI_BASE + INTEGRATOR_EBI_LOCK_OFFSET)

static int ap_flash_init(struct platform_device *dev)
{
u32 tmp;

writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC);
writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);

tmp = readl(EBI_CSR1) | INTEGRATOR_EBI_WRITE_ENABLE;
writel(tmp, EBI_CSR1);
Expand All @@ -229,7 +225,8 @@ static void ap_flash_exit(struct platform_device *dev)
{
u32 tmp;

writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP, SC_CTRLC);
writel(INTEGRATOR_SC_CTRL_nFLVPPEN | INTEGRATOR_SC_CTRL_nFLWP,
ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);

tmp = readl(EBI_CSR1) & ~INTEGRATOR_EBI_WRITE_ENABLE;
writel(tmp, EBI_CSR1);
Expand All @@ -243,9 +240,12 @@ static void ap_flash_exit(struct platform_device *dev)

static void ap_flash_set_vpp(struct platform_device *pdev, int on)
{
void __iomem *reg = on ? SC_CTRLS : SC_CTRLC;

writel(INTEGRATOR_SC_CTRL_nFLVPPEN, reg);
if (on)
writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
ap_syscon_base + INTEGRATOR_SC_CTRLS_OFFSET);
else
writel(INTEGRATOR_SC_CTRL_nFLVPPEN,
ap_syscon_base + INTEGRATOR_SC_CTRLC_OFFSET);
}

static struct physmap_flash_data ap_flash_data = {
Expand Down Expand Up @@ -464,9 +464,6 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
{ /* sentinel */ },
};

/* Base address to the AP system controller */
static void __iomem *ap_syscon_base;

static void __init ap_init_of(void)
{
unsigned long sc_dec;
Expand Down Expand Up @@ -523,7 +520,7 @@ static void __init ap_init_of(void)
of_platform_populate(root, of_default_bus_match_table,
ap_auxdata_lookup, parent);

sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
for (i = 0; i < 4; i++) {
struct lm_device *lmdev;

Expand Down Expand Up @@ -566,6 +563,27 @@ MACHINE_END

#ifdef CONFIG_ATAGS

/*
* For the ATAG boot some static mappings are needed. This will
* go away with the ATAG support down the road.
*/

static struct map_desc ap_io_desc_atag[] __initdata = {
{
.virtual = IO_ADDRESS(INTEGRATOR_SC_BASE),
.pfn = __phys_to_pfn(INTEGRATOR_SC_BASE),
.length = SZ_4K,
.type = MT_DEVICE
},
};

static void __init ap_map_io_atag(void)
{
iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
ap_map_io();
}

/*
* This is where non-devicetree initialization code is collected and stashed
* for eventual deletion.
Expand Down Expand Up @@ -634,7 +652,7 @@ static void __init ap_init(void)

platform_device_register(&cfi_flash_device);

sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
for (i = 0; i < 4; i++) {
struct lm_device *lmdev;

Expand All @@ -661,7 +679,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
.reserve = integrator_reserve,
.map_io = ap_map_io,
.map_io = ap_map_io_atag,
.nr_irqs = NR_IRQS_INTEGRATOR_AP,
.init_early = ap_init_early,
.init_irq = ap_init_irq,
Expand Down

0 comments on commit 83feba5

Please sign in to comment.