Skip to content

Commit

Permalink
Merge tag 'armsoc-for-3.8' of git://server.prisktech.co.nz/git/linuxw…
Browse files Browse the repository at this point in the history
…mt into next/multiplatform

From Tony Prisk <linux@prisktech.co.nz>:

Convert arch-vt8500 to multiplatform

* tag 'armsoc-for-3.8' of git://server.prisktech.co.nz/git/linuxwmt:
  ARM: vt8500: Convert arch-vt8500 to multiplatform
  arm: vt8500: Convert irq.c for multiplatform integration

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Oct 26, 2012
2 parents 6f0c058 + 6f35f9a commit e4de6c9
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 87 deletions.
6 changes: 5 additions & 1 deletion arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ config ARCH_OMAP
help
Support for TI's OMAP platform (OMAP1/2/3/4).

config ARCH_VT8500
config ARCH_VT8500_SINGLE
bool "VIA/WonderMedia 85xx"
select ARCH_HAS_CPUFREQ
select ARCH_REQUIRE_GPIOLIB
Expand All @@ -951,6 +951,8 @@ config ARCH_VT8500
select GENERIC_CLOCKEVENTS
select GENERIC_GPIO
select HAVE_CLK
select MULTI_IRQ_HANDLER
select SPARSE_IRQ
select USE_OF
help
Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
Expand Down Expand Up @@ -1126,6 +1128,8 @@ source "arch/arm/mach-versatile/Kconfig"
source "arch/arm/mach-vexpress/Kconfig"
source "arch/arm/plat-versatile/Kconfig"

source "arch/arm/mach-vt8500/Kconfig"

source "arch/arm/mach-w90x900/Kconfig"

# Definitions to make life easier
Expand Down
12 changes: 12 additions & 0 deletions arch/arm/mach-vt8500/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
config ARCH_VT8500
bool "VIA/WonderMedia 85xx" if ARCH_MULTI_V5
default ARCH_VT8500_SINGLE
select ARCH_HAS_CPUFREQ
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
select CPU_ARM926T
select GENERIC_CLOCKEVENTS
select GENERIC_GPIO
select HAVE_CLK
help
Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
3 changes: 3 additions & 0 deletions arch/arm/mach-vt8500/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ int __init vt8500_irq_init(struct device_node *node,
/* defined in drivers/clk/clk-vt8500.c */
void __init vtwm_clk_init(void __iomem *pmc_base);

/* defined in irq.c */
asmlinkage void vt8500_handle_irq(struct pt_regs *regs);

#endif
26 changes: 0 additions & 26 deletions arch/arm/mach-vt8500/include/mach/entry-macro.S

This file was deleted.

22 changes: 0 additions & 22 deletions arch/arm/mach-vt8500/include/mach/irqs.h

This file was deleted.

108 changes: 70 additions & 38 deletions arch/arm/mach-vt8500/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <linux/of_address.h>

#include <asm/irq.h>

#include <asm/exception.h>

#define VT8500_ICPC_IRQ 0x20
#define VT8500_ICPC_FIQ 0x24
Expand Down Expand Up @@ -66,39 +66,42 @@
#define VT8500_EDGE ( VT8500_TRIGGER_RISING \
| VT8500_TRIGGER_FALLING)

static int irq_cnt;
/* vt8500 has 1 intc, wm8505 and wm8650 have 2 */
#define VT8500_INTC_MAX 2

struct vt8500_irq_priv {
void __iomem *base;
struct vt8500_irq_data {
void __iomem *base; /* IO Memory base address */
struct irq_domain *domain; /* Domain for this controller */
};

/* Global variable for accessing io-mem addresses */
static struct vt8500_irq_data intc[VT8500_INTC_MAX];
static u32 active_cnt = 0;

static void vt8500_irq_mask(struct irq_data *d)
{
struct vt8500_irq_priv *priv =
(struct vt8500_irq_priv *)(d->domain->host_data);
struct vt8500_irq_data *priv = d->domain->host_data;
void __iomem *base = priv->base;
u8 edge;
void __iomem *stat_reg = base + VT8500_ICIS + (d->hwirq < 32 ? 0 : 4);
u8 edge, dctr;
u32 status;

edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE;
if (edge) {
void __iomem *stat_reg = base + VT8500_ICIS
+ (d->hwirq < 32 ? 0 : 4);
unsigned status = readl(stat_reg);
status = readl(stat_reg);

status |= (1 << (d->hwirq & 0x1f));
writel(status, stat_reg);
} else {
u8 dctr = readb(base + VT8500_ICDC + d->hwirq);

dctr = readb(base + VT8500_ICDC + d->hwirq);
dctr &= ~VT8500_INT_ENABLE;
writeb(dctr, base + VT8500_ICDC + d->hwirq);
}
}

static void vt8500_irq_unmask(struct irq_data *d)
{
struct vt8500_irq_priv *priv =
(struct vt8500_irq_priv *)(d->domain->host_data);
struct vt8500_irq_data *priv = d->domain->host_data;
void __iomem *base = priv->base;
u8 dctr;

Expand All @@ -109,8 +112,7 @@ static void vt8500_irq_unmask(struct irq_data *d)

static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type)
{
struct vt8500_irq_priv *priv =
(struct vt8500_irq_priv *)(d->domain->host_data);
struct vt8500_irq_data *priv = d->domain->host_data;
void __iomem *base = priv->base;
u8 dctr;

Expand Down Expand Up @@ -148,17 +150,15 @@ static struct irq_chip vt8500_irq_chip = {

static void __init vt8500_init_irq_hw(void __iomem *base)
{
unsigned int i;
u32 i;

/* Enable rotating priority for IRQ */
writel(ICPC_ROTATE, base + VT8500_ICPC_IRQ);
writel(0x00, base + VT8500_ICPC_FIQ);

for (i = 0; i < 64; i++) {
/* Disable all interrupts and route them to IRQ */
writeb(VT8500_INT_DISABLE | ICDC_IRQ,
base + VT8500_ICDC + i);
}
/* Disable all interrupts and route them to IRQ */
for (i = 0; i < 64; i++)
writeb(VT8500_INT_DISABLE | ICDC_IRQ, base + VT8500_ICDC + i);
}

static int vt8500_irq_map(struct irq_domain *h, unsigned int virq,
Expand All @@ -175,33 +175,67 @@ static struct irq_domain_ops vt8500_irq_domain_ops = {
.xlate = irq_domain_xlate_onecell,
};

asmlinkage void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs)
{
u32 stat, i;
int irqnr, virq;
void __iomem *base;

/* Loop through each active controller */
for (i=0; i<active_cnt; i++) {
base = intc[i].base;
irqnr = readl_relaxed(base) & 0x3F;
/*
Highest Priority register default = 63, so check that this
is a real interrupt by checking the status register
*/
if (irqnr == 63) {
stat = readl_relaxed(base + VT8500_ICIS + 4);
if (!(stat & BIT(31)))
continue;
}

virq = irq_find_mapping(intc[i].domain, irqnr);
handle_IRQ(virq, regs);
}
}

int __init vt8500_irq_init(struct device_node *node, struct device_node *parent)
{
struct irq_domain *vt8500_irq_domain;
struct vt8500_irq_priv *priv;
int irq, i;
struct device_node *np = node;

priv = kzalloc(sizeof(struct vt8500_irq_priv), GFP_KERNEL);
priv->base = of_iomap(np, 0);
if (active_cnt == VT8500_INTC_MAX) {
pr_err("%s: Interrupt controllers > VT8500_INTC_MAX\n",
__func__);
goto out;
}

intc[active_cnt].base = of_iomap(np, 0);
intc[active_cnt].domain = irq_domain_add_linear(node, 64,
&vt8500_irq_domain_ops, &intc[active_cnt]);

vt8500_irq_domain = irq_domain_add_legacy(node, 64, irq_cnt, 0,
&vt8500_irq_domain_ops, priv);
if (!vt8500_irq_domain)
pr_err("%s: Unable to add wmt irq domain!\n", __func__);
if (!intc[active_cnt].base) {
pr_err("%s: Unable to map IO memory\n", __func__);
goto out;
}

if (!intc[active_cnt].domain) {
pr_err("%s: Unable to add irq domain!\n", __func__);
goto out;
}

irq_set_default_host(vt8500_irq_domain);
vt8500_init_irq_hw(intc[active_cnt].base);

vt8500_init_irq_hw(priv->base);
pr_info("vt8500-irq: Added interrupt controller\n");

pr_info("Added IRQ Controller @ %x [virq_base = %d]\n",
(u32)(priv->base), irq_cnt);
active_cnt++;

/* check if this is a slaved controller */
if (of_irq_count(np) != 0) {
/* check that we have the correct number of interrupts */
if (of_irq_count(np) != 8) {
pr_err("%s: Incorrect IRQ map for slave controller\n",
pr_err("%s: Incorrect IRQ map for slaved controller\n",
__func__);
return -EINVAL;
}
Expand All @@ -213,9 +247,7 @@ int __init vt8500_irq_init(struct device_node *node, struct device_node *parent)

pr_info("vt8500-irq: Enabled slave->parent interrupts\n");
}

irq_cnt += 64;

out:
return 0;
}

1 change: 1 addition & 0 deletions arch/arm/mach-vt8500/vt8500.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@ DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
.timer = &vt8500_timer,
.init_machine = vt8500_init,
.restart = vt8500_restart,
.handle_irq = vt8500_handle_irq,
MACHINE_END

0 comments on commit e4de6c9

Please sign in to comment.