Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339860
b: refs/heads/master
c: e6fae08
h: refs/heads/master
v: v3
  • Loading branch information
Linus Walleij committed Nov 16, 2012
1 parent c072cb0 commit e81a92c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 83feba511e5df2fd63a25610d43fe16af02b0742
refs/heads/master: e6fae083b9cc7e27b65660eaa7b2ce6cf871b99a
50 changes: 33 additions & 17 deletions trunk/arch/arm/mach-integrator/integrator_cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@

#include "common.h"

/* Base address to the CP controller */
static void __iomem *intcp_con_base;

#define INTCP_PA_FLASH_BASE 0x24000000

#define INTCP_PA_CLCD_BASE 0xc0000000

#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE)
#define INTCP_FLASHPROG 0x04
#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
#define CINTEGRATOR_FLASHPROG_FLWREN (1 << 1)
Expand Down Expand Up @@ -127,11 +129,6 @@ static struct map_desc intcp_io_desc[] __initdata = {
.pfn = __phys_to_pfn(INTEGRATOR_CP_SIC_BASE),
.length = SZ_4K,
.type = MT_DEVICE
}, {
.virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
.pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
.length = SZ_4K,
.type = MT_DEVICE
}
};

Expand All @@ -147,9 +144,9 @@ static int intcp_flash_init(struct platform_device *dev)
{
u32 val;

val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
val = readl(intcp_con_base + INTCP_FLASHPROG);
val |= CINTEGRATOR_FLASHPROG_FLWREN;
writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
writel(val, intcp_con_base + INTCP_FLASHPROG);

return 0;
}
Expand All @@ -158,21 +155,21 @@ static void intcp_flash_exit(struct platform_device *dev)
{
u32 val;

val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
val = readl(intcp_con_base + INTCP_FLASHPROG);
val &= ~(CINTEGRATOR_FLASHPROG_FLVPPEN|CINTEGRATOR_FLASHPROG_FLWREN);
writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
writel(val, intcp_con_base + INTCP_FLASHPROG);
}

static void intcp_flash_set_vpp(struct platform_device *pdev, int on)
{
u32 val;

val = readl(INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
val = readl(intcp_con_base + INTCP_FLASHPROG);
if (on)
val |= CINTEGRATOR_FLASHPROG_FLVPPEN;
else
val &= ~CINTEGRATOR_FLASHPROG_FLVPPEN;
writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG);
writel(val, intcp_con_base + INTCP_FLASHPROG);
}

static struct physmap_flash_data intcp_flash_data = {
Expand All @@ -191,7 +188,7 @@ static struct physmap_flash_data intcp_flash_data = {
static unsigned int mmc_status(struct device *dev)
{
unsigned int status = readl(__io_address(0xca000000 + 4));
writel(8, __io_address(INTEGRATOR_CP_CTL_BASE + 8));
writel(8, intcp_con_base + 8);

return status & 8;
}
Expand Down Expand Up @@ -337,9 +334,6 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
{ /* sentinel */ },
};

/* Base address to the CP controller */
static void __iomem *intcp_con_base;

static void __init intcp_init_of(void)
{
struct device_node *root;
Expand Down Expand Up @@ -417,6 +411,28 @@ 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 intcp_io_desc_atag[] __initdata = {
{
.virtual = IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
.pfn = __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
.length = SZ_4K,
.type = MT_DEVICE
},
};

static void __init intcp_map_io_atag(void)
{
iotable_init(intcp_io_desc_atag, ARRAY_SIZE(intcp_io_desc_atag));
intcp_con_base = __io_address(INTEGRATOR_CP_CTL_BASE);
intcp_map_io();
}


/*
* This is where non-devicetree initialization code is collected and stashed
* for eventual deletion.
Expand Down Expand Up @@ -556,7 +572,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
.reserve = integrator_reserve,
.map_io = intcp_map_io,
.map_io = intcp_map_io_atag,
.nr_irqs = NR_IRQS_INTEGRATOR_CP,
.init_early = intcp_init_early,
.init_irq = intcp_init_irq,
Expand Down

0 comments on commit e81a92c

Please sign in to comment.