* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
@ 2012-12-01 7:33 Alexander Shiyan
2012-12-01 13:05 ` Jason Cooper
2012-12-01 21:25 ` Arnd Bergmann
0 siblings, 2 replies; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-01 7:33 UTC (permalink / raw)
To: linux-arm-kernel
Rather than modify the EOI flags directly in the timer interrupt,
let's deal with these flags in the "ask" procedure.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-ixp4xx/common.c | 34 +++++++++++++++++++++++++---------
drivers/input/misc/ixp4xx-beeper.c | 3 ---
2 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 8c0c0e2..27046ec 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -202,10 +202,28 @@ static void ixp4xx_irq_mask(struct irq_data *d)
static void ixp4xx_irq_ack(struct irq_data *d)
{
- int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
+ int line;
- if (line >= 0)
- *IXP4XX_GPIO_GPISR = (1 << line);
+ switch (d->irq) {
+ case IRQ_IXP4XX_TIMER1:
+ *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
+ break;
+ case IRQ_IXP4XX_TIMER2:
+ *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
+ break;
+ case IRQ_IXP4XX_TIMESTAMP:
+ *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
+ break;
+ case IRQ_IXP4XX_WDOG:
+ *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
+ break;
+ default:
+ line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
+
+ if (line >= 0)
+ *IXP4XX_GPIO_GPISR = (1 << line);
+ break;
+ }
}
/*
@@ -247,6 +265,10 @@ void __init ixp4xx_init_irq(void)
/* Disable all interrupt */
*IXP4XX_ICMR = 0x0;
+ /* Clear Timer Pending Interrupts */
+ *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND | IXP4XX_OSST_TIMER_2_PEND |
+ IXP4XX_OSST_TIMER_TS_PEND | IXP4XX_OSST_TIMER_WDOG_PEND;
+
if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
/* Route upper 32 sources to IRQ instead of FIQ */
*IXP4XX_ICLR2 = 0x00;
@@ -274,9 +296,6 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *evt = dev_id;
- /* Clear Pending Interrupt by writing '1' to it */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
-
evt->event_handler(evt);
return IRQ_HANDLED;
@@ -294,9 +313,6 @@ void __init ixp4xx_timer_init(void)
/* Reset/disable counter */
*IXP4XX_OSRT1 = 0;
- /* Clear Pending Interrupt by writing '1' to it */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
-
/* Reset time-stamp counter */
*IXP4XX_OSTS = 0;
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 6ab3dec..2923e47 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -78,9 +78,6 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
{
- /* clear interrupt */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
-
/* flip the beeper output */
*IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 7:33 [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts Alexander Shiyan
@ 2012-12-01 13:05 ` Jason Cooper
2012-12-01 13:14 ` Re[2]: " Alexander Shiyan
2012-12-01 21:25 ` Arnd Bergmann
1 sibling, 1 reply; 17+ messages in thread
From: Jason Cooper @ 2012-12-01 13:05 UTC (permalink / raw)
To: linux-arm-kernel
Hi Alexander,
On Sat, Dec 01, 2012 at 11:33:33AM +0400, Alexander Shiyan wrote:
> Rather than modify the EOI flags directly in the timer interrupt,
> let's deal with these flags in the "ask" procedure.
Please specify the procedure name instead of "ask", eg ixp4xx_irq_ack().
Same goes for the Subject line.
What brought about this change, is this part of a larger series?
thx,
Jason.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> arch/arm/mach-ixp4xx/common.c | 34 +++++++++++++++++++++++++---------
> drivers/input/misc/ixp4xx-beeper.c | 3 ---
> 2 files changed, 25 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
> index 8c0c0e2..27046ec 100644
> --- a/arch/arm/mach-ixp4xx/common.c
> +++ b/arch/arm/mach-ixp4xx/common.c
> @@ -202,10 +202,28 @@ static void ixp4xx_irq_mask(struct irq_data *d)
>
> static void ixp4xx_irq_ack(struct irq_data *d)
> {
> - int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
> + int line;
>
> - if (line >= 0)
> - *IXP4XX_GPIO_GPISR = (1 << line);
> + switch (d->irq) {
> + case IRQ_IXP4XX_TIMER1:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> + break;
> + case IRQ_IXP4XX_TIMER2:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> + break;
> + case IRQ_IXP4XX_TIMESTAMP:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
> + break;
> + case IRQ_IXP4XX_WDOG:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
> + break;
> + default:
> + line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
> +
> + if (line >= 0)
> + *IXP4XX_GPIO_GPISR = (1 << line);
> + break;
> + }
> }
>
> /*
> @@ -247,6 +265,10 @@ void __init ixp4xx_init_irq(void)
> /* Disable all interrupt */
> *IXP4XX_ICMR = 0x0;
>
> + /* Clear Timer Pending Interrupts */
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND | IXP4XX_OSST_TIMER_2_PEND |
> + IXP4XX_OSST_TIMER_TS_PEND | IXP4XX_OSST_TIMER_WDOG_PEND;
> +
> if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
> /* Route upper 32 sources to IRQ instead of FIQ */
> *IXP4XX_ICLR2 = 0x00;
> @@ -274,9 +296,6 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
> {
> struct clock_event_device *evt = dev_id;
>
> - /* Clear Pending Interrupt by writing '1' to it */
> - *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> -
> evt->event_handler(evt);
>
> return IRQ_HANDLED;
> @@ -294,9 +313,6 @@ void __init ixp4xx_timer_init(void)
> /* Reset/disable counter */
> *IXP4XX_OSRT1 = 0;
>
> - /* Clear Pending Interrupt by writing '1' to it */
> - *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> -
> /* Reset time-stamp counter */
> *IXP4XX_OSTS = 0;
>
> diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
> index 6ab3dec..2923e47 100644
> --- a/drivers/input/misc/ixp4xx-beeper.c
> +++ b/drivers/input/misc/ixp4xx-beeper.c
> @@ -78,9 +78,6 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
>
> static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
> {
> - /* clear interrupt */
> - *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> -
> /* flip the beeper output */
> *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id);
>
> --
> 1.7.8.6
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re[2]: [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 13:05 ` Jason Cooper
@ 2012-12-01 13:14 ` Alexander Shiyan
2012-12-01 15:41 ` Jason Cooper
0 siblings, 1 reply; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-01 13:14 UTC (permalink / raw)
To: linux-arm-kernel
> On Sat, Dec 01, 2012 at 11:33:33AM +0400, Alexander Shiyan wrote:
> > Rather than modify the EOI flags directly in the timer interrupt,
> > let's deal with these flags in the "ask" procedure.
>
> Please specify the procedure name instead of "ask", eg ixp4xx_irq_ack().
> Same goes for the Subject line.
>
> What brought about this change, is this part of a larger series?
It all started with an attempt to clear the unneeded calls from drivers.
Series not yet, just an initial attempt to put everything in its place.
---
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 13:14 ` Re[2]: " Alexander Shiyan
@ 2012-12-01 15:41 ` Jason Cooper
0 siblings, 0 replies; 17+ messages in thread
From: Jason Cooper @ 2012-12-01 15:41 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Dec 01, 2012 at 05:14:48PM +0400, Alexander Shiyan wrote:
> > On Sat, Dec 01, 2012 at 11:33:33AM +0400, Alexander Shiyan wrote:
> > > Rather than modify the EOI flags directly in the timer interrupt,
> > > let's deal with these flags in the "ask" procedure.
> >
> > Please specify the procedure name instead of "ask", eg ixp4xx_irq_ack().
> > Same goes for the Subject line.
> >
> > What brought about this change, is this part of a larger series?
>
> It all started with an attempt to clear the unneeded calls from drivers.
> Series not yet, just an initial attempt to put everything in its place.
Ok, sounds good. There's definitely a lot of cleanup work in ixp4xx.
Drivers needing moved to drivers/, etc.
thx,
Jason.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 7:33 [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts Alexander Shiyan
2012-12-01 13:05 ` Jason Cooper
@ 2012-12-01 21:25 ` Arnd Bergmann
2012-12-01 21:45 ` Jason Cooper
1 sibling, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-01 21:25 UTC (permalink / raw)
To: linux-arm-kernel
On Saturday 01 December 2012, Alexander Shiyan wrote:
> + switch (d->irq) {
> + case IRQ_IXP4XX_TIMER1:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> + break;
> + case IRQ_IXP4XX_TIMER2:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> + break;
> + case IRQ_IXP4XX_TIMESTAMP:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
> + break;
> + case IRQ_IXP4XX_WDOG:
> + *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
> + break;
Since you are touching these lines, it probably makes sense to convert them
to use writel_relaxed() in the process. Dereferencing a volatile pointer
in order to do MMIO is strongly discouraged, see
Documentation/volatile-considered-harmful.txt
Arnd
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 21:25 ` Arnd Bergmann
@ 2012-12-01 21:45 ` Jason Cooper
2012-12-02 0:11 ` Arnd Bergmann
0 siblings, 1 reply; 17+ messages in thread
From: Jason Cooper @ 2012-12-01 21:45 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Dec 01, 2012 at 09:25:51PM +0000, Arnd Bergmann wrote:
> On Saturday 01 December 2012, Alexander Shiyan wrote:
> > + switch (d->irq) {
> > + case IRQ_IXP4XX_TIMER1:
> > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> > + break;
> > + case IRQ_IXP4XX_TIMER2:
> > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> > + break;
> > + case IRQ_IXP4XX_TIMESTAMP:
> > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
> > + break;
> > + case IRQ_IXP4XX_WDOG:
> > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
> > + break;
>
> Since you are touching these lines, it probably makes sense to convert them
> to use writel_relaxed() in the process. Dereferencing a volatile pointer
> in order to do MMIO is strongly discouraged, see
> Documentation/volatile-considered-harmful.txt
Arnd,
I took a quick look at the ixp4xx code when I saw this. It appears the
entire sub-arch is written this way :-( Perhaps it would be better to
do a cleanup patch before this one? I didn't mention it in my initial
comment because it looks like quite a bit of work.
In either case, it's all cleanup, so it shouldn't cause a dependency
headache.
Alexander, if you're so inclined, a cleanup series would be much
appreciated. If you don't have the time, no problem, just make the
changes suggested by Arnd and I and we'll get to the cleanup eventually.
thx,
Jason.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-01 21:45 ` Jason Cooper
@ 2012-12-02 0:11 ` Arnd Bergmann
2012-12-02 6:02 ` Re[2]: " Alexander Shiyan
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
0 siblings, 2 replies; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-02 0:11 UTC (permalink / raw)
To: linux-arm-kernel
On Saturday 01 December 2012, Jason Cooper wrote:
> On Sat, Dec 01, 2012 at 09:25:51PM +0000, Arnd Bergmann wrote:
> > On Saturday 01 December 2012, Alexander Shiyan wrote:
> > > + switch (d->irq) {
> > > + case IRQ_IXP4XX_TIMER1:
> > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> > > + break;
> > > + case IRQ_IXP4XX_TIMER2:
> > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> > > + break;
> > > + case IRQ_IXP4XX_TIMESTAMP:
> > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
> > > + break;
> > > + case IRQ_IXP4XX_WDOG:
> > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
> > > + break;
> >
> > Since you are touching these lines, it probably makes sense to convert them
> > to use writel_relaxed() in the process. Dereferencing a volatile pointer
> > in order to do MMIO is strongly discouraged, see
> > Documentation/volatile-considered-harmful.txt
>
> Arnd,
>
> I took a quick look at the ixp4xx code when I saw this. It appears the
> entire sub-arch is written this way :-( Perhaps it would be better to
> do a cleanup patch before this one? I didn't mention it in my initial
> comment because it looks like quite a bit of work.
>
> In either case, it's all cleanup, so it shouldn't cause a dependency
> headache.
>
> Alexander, if you're so inclined, a cleanup series would be much
> appreciated. If you don't have the time, no problem, just make the
> changes suggested by Arnd and I and we'll get to the cleanup eventually.
I got curious to how hard this would be and ended up with a patch.
Arnd
8<--------
[PATCH] ARM: ixp4xx: use proper __iomem annotations consistently
The ixp4xx platform on ARM is one of the remaining locations still using
direct pointer dereferences for MMIO access. This patch should convert
all known instances to use readl_relaxed/writel_relaxed.
I could not find a nice solution for mach/hardware.h, which is included
by mach/io.h indirectly but actually requires MMIO accesses as defined
in asm/io.h. Using a macro as a workaround helps, but the better solution
in the long run would be to have a proper gpiolib driver rather than
using a private API to do GPIO.
I did not touch the definitions used in drivers/usb/gadget/pxa25x_udc.c,
they are shared with the pxa platform and ever more screwed up than the
other ones in ixp4xx that I fixed.
In the process of doing this patch, I noticed that indirect PCI access
on ixp4xx is broken since the PCIBIOS_MIN_MEM consolidateion, and this
does not get fixed here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index 90e42e9..6cb33b9 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -78,7 +78,7 @@ static struct resource avila_uart_resources[] = {
static struct plat_serial8250_port avila_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -87,7 +87,7 @@ static struct plat_serial8250_port avila_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 1694f01..05b5722 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -63,8 +63,8 @@ static void crp_read(u32 ad_cbe, u32 *data)
{
unsigned long flags;
raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- *PCI_CRP_AD_CBE = ad_cbe;
- *data = *PCI_CRP_RDATA;
+ writel_relaxed(ad_cbe, PCI_CRP_AD_CBE);
+ *data = readl_relaxed(PCI_CRP_RDATA);
raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
}
@@ -75,19 +75,19 @@ static void crp_write(u32 ad_cbe, u32 data)
{
unsigned long flags;
raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- *PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
- *PCI_CRP_WDATA = data;
+ writel_relaxed(CRP_AD_CBE_WRITE | ad_cbe, PCI_CRP_AD_CBE);
+ writel_relaxed(data, PCI_CRP_WDATA);
raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
}
static inline int check_master_abort(void)
{
/* check Master Abort bit after access */
- unsigned long isr = *PCI_ISR;
+ unsigned long isr = readl_relaxed(PCI_ISR);
if (isr & PCI_ISR_PFE) {
/* make sure the Master Abort bit is reset */
- *PCI_ISR = PCI_ISR_PFE;
+ writel_relaxed(PCI_ISR_PFE, PCI_ISR);
pr_debug("%s failed\n", __func__);
return 1;
}
@@ -103,16 +103,16 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- *PCI_NP_AD = addr;
+ writel_relaxed(addr, PCI_NP_AD);
/*
* PCI workaround - only works if NP PCI space reads have
* no side effects!!! Read 8 times. last one will be good.
*/
for (i = 0; i < 8; i++) {
- *PCI_NP_CBE = cmd;
- *data = *PCI_NP_RDATA;
- *data = *PCI_NP_RDATA;
+ writel_relaxed(cmd, PCI_NP_CBE);
+ *data = readl_relaxed(PCI_NP_RDATA);
+ *data = readl_relaxed(PCI_NP_RDATA);
}
if(check_master_abort())
@@ -129,13 +129,13 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- *PCI_NP_AD = addr;
+ writel_relaxed(addr, PCI_NP_AD);
- /* set up and execute the read */
- *PCI_NP_CBE = cmd;
+ /* set up and execute the read */
+ writel_relaxed(cmd, PCI_NP_CBE);
/* the result of the read is now in NP_RDATA */
- *data = *PCI_NP_RDATA;
+ *data = readl_relaxed(PCI_NP_RDATA);
if(check_master_abort())
retval = 1;
@@ -151,13 +151,13 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
- *PCI_NP_AD = addr;
+ writel_relaxed(addr, PCI_NP_AD);
/* set up the write */
- *PCI_NP_CBE = cmd;
+ writel_relaxed(cmd, PCI_NP_CBE);
/* execute the write by writing to NP_WDATA */
- *PCI_NP_WDATA = data;
+ writel_relaxed(data, PCI_NP_WDATA);
if(check_master_abort())
retval = 1;
@@ -295,13 +295,13 @@ static int abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *r
{
u32 isr, status;
- isr = *PCI_ISR;
+ isr = readl_relaxed(PCI_ISR);
local_read_config(PCI_STATUS, 2, &status);
pr_debug("PCI: abort_handler addr = %#lx, isr = %#x, "
"status = %#x\n", addr, isr, status);
/* make sure the Master Abort bit is reset */
- *PCI_ISR = PCI_ISR_PFE;
+ writel_relaxed(PCI_ISR_PFE, PCI_ISR);
status |= PCI_STATUS_REC_MASTER_ABORT;
local_write_config(PCI_STATUS, 2, status);
@@ -373,19 +373,19 @@ void __init ixp4xx_pci_preinit(void)
* We use identity AHB->PCI address translation
* in the 0x48000000 to 0x4bffffff address space
*/
- *PCI_PCIMEMBASE = 0x48494A4B;
+ writel_relaxed(0x48494A4B, PCI_PCIMEMBASE);
/*
* We also use identity PCI->AHB address translation
* in 4 16MB BARs that begin at the physical memory start
*/
- *PCI_AHBMEMBASE = (PHYS_OFFSET & 0xFF000000) +
+ writel_relaxed((PHYS_OFFSET & 0xFF000000) +
((PHYS_OFFSET & 0xFF000000) >> 8) +
((PHYS_OFFSET & 0xFF000000) >> 16) +
((PHYS_OFFSET & 0xFF000000) >> 24) +
- 0x00010203;
+ 0x00010203, PCI_AHBMEMBASE);
- if (*PCI_CSR & PCI_CSR_HOST) {
+ if (readl_relaxed(PCI_CSR) & PCI_CSR_HOST) {
printk("PCI: IXP4xx is host\n");
pr_debug("setup BARs in controller\n");
@@ -423,7 +423,7 @@ void __init ixp4xx_pci_preinit(void)
);
pr_debug("clear error bits in ISR\n");
- *PCI_ISR = PCI_ISR_PSE | PCI_ISR_PFE | PCI_ISR_PPE | PCI_ISR_AHBE;
+ writel_relaxed(PCI_ISR_PSE | PCI_ISR_PFE | PCI_ISR_PPE | PCI_ISR_AHBE, PCI_ISR);
/*
* Set Initialize Complete in PCI Control Register: allow IXP4XX to
@@ -432,9 +432,10 @@ void __init ixp4xx_pci_preinit(void)
* little-endian PCI and the big-endian AHB bus
*/
#ifdef __ARMEB__
- *PCI_CSR = PCI_CSR_IC | PCI_CSR_ABE | PCI_CSR_PDS | PCI_CSR_ADS;
+ writel_relaxed(PCI_CSR_IC | PCI_CSR_ABE | PCI_CSR_PDS |
+ PCI_CSR_ADS, PCI_CSR);
#else
- *PCI_CSR = PCI_CSR_IC | PCI_CSR_ABE;
+ writel_relaxed(PCI_CSR_IC | PCI_CSR_ABE, PCI_CSR);
#endif
pr_debug("DONE\n");
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fdf91a1..ecc2f32 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -32,7 +32,6 @@
#include <mach/udc.h>
#include <mach/hardware.h>
-#include <mach/io.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/page.h>
@@ -135,7 +134,7 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
int line = irq2gpio[d->irq];
u32 int_style;
enum ixp4xx_irq_type irq_type;
- volatile u32 *int_reg;
+ u32 __iomem *int_reg;
/*
* Only for GPIO IRQs
@@ -181,13 +180,16 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
}
/* Clear the style for the appropriate pin */
- *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR <<
- (line * IXP4XX_GPIO_STYLE_SIZE));
+ writel_relaxed(readl_relaxed(int_reg) &
+ ~IXP4XX_GPIO_STYLE_CLEAR << (line *
+ IXP4XX_GPIO_STYLE_SIZE), int_reg);
- *IXP4XX_GPIO_GPISR = (1 << line);
+ writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
/* Set the new style */
- *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
+ writel_relaxed(readl_relaxed(int_reg) |
+ (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)),
+ int_reg);
/* Configure the line as an input */
gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN);
@@ -198,9 +200,9 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
static void ixp4xx_irq_mask(struct irq_data *d)
{
if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
- *IXP4XX_ICMR2 &= ~(1 << (d->irq - 32));
+ writel_relaxed(readl_relaxed(IXP4XX_ICMR2) & ~(1 << (d->irq - 32)), IXP4XX_ICMR2);
else
- *IXP4XX_ICMR &= ~(1 << d->irq);
+ writel_relaxed(readl_relaxed(IXP4XX_ICMR) & ~(1 << (d->irq - 32)), IXP4XX_ICMR);
}
static void ixp4xx_irq_ack(struct irq_data *d)
@@ -208,7 +210,7 @@ static void ixp4xx_irq_ack(struct irq_data *d)
int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
if (line >= 0)
- *IXP4XX_GPIO_GPISR = (1 << line);
+ writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
}
/*
@@ -221,9 +223,9 @@ static void ixp4xx_irq_unmask(struct irq_data *d)
ixp4xx_irq_ack(d);
if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32)
- *IXP4XX_ICMR2 |= (1 << (d->irq - 32));
+ writel_relaxed(readl_relaxed(IXP4XX_ICMR2) | (1 << (d->irq - 32)), IXP4XX_ICMR2);
else
- *IXP4XX_ICMR |= (1 << d->irq);
+ writel_relaxed(readl_relaxed(IXP4XX_ICMR) | (1 << (d->irq - 32)), IXP4XX_ICMR);
}
static struct irq_chip ixp4xx_irq_chip = {
@@ -245,17 +247,17 @@ void __init ixp4xx_init_irq(void)
disable_hlt();
/* Route all sources to IRQ instead of FIQ */
- *IXP4XX_ICLR = 0x0;
+ writel_relaxed(0, IXP4XX_ICLR);
/* Disable all interrupt */
- *IXP4XX_ICMR = 0x0;
+ writel_relaxed(0, IXP4XX_ICMR);
if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
/* Route upper 32 sources to IRQ instead of FIQ */
- *IXP4XX_ICLR2 = 0x00;
+ writel_relaxed(0, IXP4XX_ICLR2);
/* Disable upper 32 interrupts */
- *IXP4XX_ICMR2 = 0x00;
+ writel_relaxed(0, IXP4XX_ICMR2);
}
/* Default to all level triggered */
@@ -278,7 +280,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
struct clock_event_device *evt = dev_id;
/* Clear Pending Interrupt by writing '1' to it */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
+ writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
evt->event_handler(evt);
@@ -295,13 +297,13 @@ static struct irqaction ixp4xx_timer_irq = {
void __init ixp4xx_timer_init(void)
{
/* Reset/disable counter */
- *IXP4XX_OSRT1 = 0;
+ writel_relaxed(0, IXP4XX_OSRT1);
/* Clear Pending Interrupt by writing '1' to it */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
+ writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
/* Reset time-stamp counter */
- *IXP4XX_OSTS = 0;
+ writel_relaxed(0, IXP4XX_OSTS);
/* Connect the interrupt handler and enable the interrupt */
setup_irq(IRQ_IXP4XX_TIMER1, &ixp4xx_timer_irq);
@@ -440,7 +442,7 @@ void __init ixp4xx_sys_init(void)
ARRAY_SIZE(ixp46x_devices));
for (region = 0; region < 7; region++) {
- if((*(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
+ if((readl_relaxed(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
ixp4xx_exp_bus_size = SZ_32M;
break;
}
@@ -456,7 +458,7 @@ void __init ixp4xx_sys_init(void)
*/
static u32 notrace ixp4xx_read_sched_clock(void)
{
- return *IXP4XX_OSTS;
+ return readl_relaxed(IXP4XX_OSTS);
}
/*
@@ -465,7 +467,7 @@ static u32 notrace ixp4xx_read_sched_clock(void)
static cycle_t ixp4xx_clocksource_read(struct clocksource *c)
{
- return *IXP4XX_OSTS;
+ return readl_relaxed(IXP4XX_OSTS);
}
unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
@@ -484,9 +486,9 @@ static void __init ixp4xx_clocksource_init(void)
static int ixp4xx_set_next_event(unsigned long evt,
struct clock_event_device *unused)
{
- unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
+ unsigned long opts = readl_relaxed(IXP4XX_OSRT1) & IXP4XX_OST_RELOAD_MASK;
- *IXP4XX_OSRT1 = (evt & ~IXP4XX_OST_RELOAD_MASK) | opts;
+ writel_relaxed((evt & ~IXP4XX_OST_RELOAD_MASK) | opts, IXP4XX_OSRT1);
return 0;
}
@@ -494,8 +496,8 @@ static int ixp4xx_set_next_event(unsigned long evt,
static void ixp4xx_set_mode(enum clock_event_mode mode,
struct clock_event_device *evt)
{
- unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
- unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
+ unsigned long opts = readl_relaxed(IXP4XX_OSRT1) & IXP4XX_OST_RELOAD_MASK;
+ unsigned long osrt = readl_relaxed(IXP4XX_OSRT1) & ~IXP4XX_OST_RELOAD_MASK;
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
@@ -519,7 +521,7 @@ static void ixp4xx_set_mode(enum clock_event_mode mode,
break;
}
- *IXP4XX_OSRT1 = osrt | opts;
+ writel_relaxed(osrt | opts, IXP4XX_OSRT1);
}
static struct clock_event_device clockevent_ixp4xx = {
@@ -555,12 +557,12 @@ void ixp4xx_restart(char mode, const char *cmd)
/* set the "key" register to enable access to
* "timer" and "enable" registers
*/
- *IXP4XX_OSWK = IXP4XX_WDT_KEY;
+ writel_relaxed(IXP4XX_WDT_KEY, IXP4XX_OSWK);
/* write 0 to the timer register for an immediate reset */
- *IXP4XX_OSWT = 0;
+ writel_relaxed(0, IXP4XX_OSWT);
- *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
+ writel_relaxed(IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE, IXP4XX_OSWE);
}
}
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 1b83110..02a1e98 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -61,7 +61,7 @@ static struct resource coyote_uart_resource = {
static struct plat_serial8250_port coyote_uart_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -93,12 +93,11 @@ static void __init coyote_init(void)
coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
- *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
- *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0) | IXP4XX_FLASH_WRITABLE, IXP4XX_EXP_CS0);
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0), IXP4XX_EXP_CS1);
if (machine_is_ixdpg425()) {
- coyote_uart_data[0].membase =
- (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
+ coyote_uart_data[0].membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET;
coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
}
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 97a0af8..2f24df1 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -24,6 +24,7 @@
#include <linux/serial_8250.h>
#include <linux/leds.h>
#include <linux/reboot.h>
+#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
@@ -124,7 +125,7 @@ static struct resource dsmg600_uart_resources[] = {
static struct plat_serial8250_port dsmg600_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
@@ -133,7 +134,7 @@ static struct plat_serial8250_port dsmg600_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
@@ -235,7 +236,7 @@ static void __init dsmg600_init(void)
ixp4xx_sys_init();
/* Make sure that GPIO14 and GPIO15 are not used as clocks */
- *IXP4XX_GPIO_GPCLKR = 0;
+ writel_relaxed(0, IXP4XX_GPIO_GPCLKR);
dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
dsmg600_flash_resource.end =
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 9175a25..d3b0737 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -89,7 +89,7 @@ static struct resource fsg_uart_resources[] = {
static struct plat_serial8250_port fsg_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -98,7 +98,7 @@ static struct plat_serial8250_port fsg_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -190,11 +190,11 @@ static void __init fsg_init(void)
fsg_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
- *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
- *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0) | IXP4XX_FLASH_WRITABLE, IXP4XX_EXP_CS0);
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0), IXP4XX_EXP_CS1);
/* Configure CS2 for operation, 8bit and writable */
- *IXP4XX_EXP_CS2 = 0xbfff0002;
+ writel_relaxed(0xbfff0002, IXP4XX_EXP_CS2);
i2c_register_board_info(0, fsg_i2c_board_info,
ARRAY_SIZE(fsg_i2c_board_info));
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c
index 033c717..57a58ea 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-setup.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c
@@ -55,7 +55,7 @@ static struct resource gateway7001_uart_resource = {
static struct plat_serial8250_port gateway7001_uart_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -87,8 +87,8 @@ static void __init gateway7001_init(void)
gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
- *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
- *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0) | IXP4XX_FLASH_WRITABLE, IXP4XX_EXP_CS0);
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0), IXP4XX_EXP_CS1);
platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices));
}
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index b800a03..9e52b88 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/serial_8250.h>
+#include <asm/system_info.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 18ebc6b..62e3dee 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -107,7 +107,7 @@ static struct resource gtwx5715_uart_resources[] = {
static struct plat_serial8250_port gtwx5715_uart_platform_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 5cf30d1..795988d 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -75,7 +75,7 @@ static inline void __indirect_writeb(u8 value, volatile void __iomem *p)
u32 n, byte_enables, data;
if (!is_pci_memory(addr)) {
- __raw_writeb(value, addr);
+ __raw_writeb(value, p);
return;
}
@@ -98,7 +98,7 @@ static inline void __indirect_writew(u16 value, volatile void __iomem *p)
u32 n, byte_enables, data;
if (!is_pci_memory(addr)) {
- __raw_writew(value, addr);
+ __raw_writew(value, p);
return;
}
@@ -140,7 +140,7 @@ static inline unsigned char __indirect_readb(const volatile void __iomem *p)
u32 n, byte_enables, data;
if (!is_pci_memory(addr))
- return __raw_readb(addr);
+ return __raw_readb(p);
n = addr % 4;
byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL;
@@ -163,7 +163,7 @@ static inline unsigned short __indirect_readw(const volatile void __iomem *p)
u32 n, byte_enables, data;
if (!is_pci_memory(addr))
- return __raw_readw(addr);
+ return __raw_readw(p);
n = addr % 4;
byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL;
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
index eb68b61..2522ab0 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -92,7 +92,7 @@
/*
* Expansion Bus Controller registers.
*/
-#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
+#define IXP4XX_EXP_REG(x) (IXP4XX_EXP_CFG_BASE_VIRT+(x))
#define IXP4XX_EXP_CS0 IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
#define IXP4XX_EXP_CS1 IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
@@ -182,7 +182,7 @@
* Interrupt Controller Register Definitions.
*/
-#define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
+#define IXP4XX_INTC_REG(x) (IXP4XX_INTC_BASE_VIRT+(x))
#define IXP4XX_ICPR IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
#define IXP4XX_ICMR IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
@@ -215,7 +215,7 @@
* GPIO Register Definitions.
* [Only perform 32bit reads/writes]
*/
-#define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
+#define IXP4XX_GPIO_REG(x) (IXP4XX_GPIO_BASE_VIRT+(x))
#define IXP4XX_GPIO_GPOUTR IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
#define IXP4XX_GPIO_GPOER IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
@@ -261,7 +261,7 @@
* Operating System Timer Register Definitions.
*/
-#define IXP4XX_TIMER_REG(x) ((volatile u32 *)(IXP4XX_TIMER_BASE_VIRT+(x)))
+#define IXP4XX_TIMER_REG(x) (IXP4XX_TIMER_BASE_VIRT+(x))
#define IXP4XX_OSTS IXP4XX_TIMER_REG(IXP4XX_OSTS_OFFSET)
#define IXP4XX_OST1 IXP4XX_TIMER_REG(IXP4XX_OST1_OFFSET)
@@ -323,7 +323,7 @@
/*
* PCI Control/Status Registers
*/
-#define IXP4XX_PCI_CSR(x) ((volatile u32 *)(IXP4XX_PCI_CFG_BASE_VIRT+(x)))
+#define IXP4XX_PCI_CSR(x) (IXP4XX_PCI_CFG_BASE_VIRT+(x))
#define PCI_NP_AD IXP4XX_PCI_CSR(PCI_NP_AD_OFFSET)
#define PCI_NP_CBE IXP4XX_PCI_CSR(PCI_NP_CBE_OFFSET)
@@ -411,7 +411,7 @@
* IXP4XX_ naming convetions.
*
*/
-# define IXP4XX_USB_REG(x) (*((volatile u32 *)(x)))
+# define IXP4XX_USB_REG(x) (*((volatile u32 __iomem *)(x)))
/* UDC Undocumented - Reserved1 */
#define UDC_RES1 IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0004)
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index 5bce94a..2d3e3f1 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -81,8 +81,8 @@ extern unsigned long ixp4xx_exp_bus_size;
* passed as platform_data.
*/
struct ixp4xx_pata_data {
- volatile u32 *cs0_cfg;
- volatile u32 *cs1_cfg;
+ u32 __iomem *cs0_cfg;
+ u32 __iomem *cs1_cfg;
unsigned long cs0_bits;
unsigned long cs1_bits;
void __iomem *cs0;
@@ -150,26 +150,29 @@ extern struct pci_ops ixp4xx_ops;
#define IXP4XX_GPIO_CLK_0 14
#define IXP4XX_GPIO_CLK_1 15
-static inline void gpio_line_config(u8 line, u32 direction)
-{
- if (direction == IXP4XX_GPIO_IN)
- *IXP4XX_GPIO_GPOER |= (1 << line);
- else
- *IXP4XX_GPIO_GPOER &= ~(1 << line);
-}
-
-static inline void gpio_line_get(u8 line, int *value)
-{
- *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
-}
-
-static inline void gpio_line_set(u8 line, int value)
-{
- if (value == IXP4XX_GPIO_HIGH)
- *IXP4XX_GPIO_GPOUTR |= (1 << line);
- else if (value == IXP4XX_GPIO_LOW)
- *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
-}
+/* using macros here to work around circular dependency with asm/io.h */
+#define gpio_line_config(line, direction) \
+do { \
+ u8 __line = (line); \
+ if ((direction) == IXP4XX_GPIO_IN) \
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) | (1 << __line), IXP4XX_GPIO_GPOER); \
+ else \
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) & ~(1 << __line), IXP4XX_GPIO_GPOER); \
+} while (0)
+
+#define gpio_line_get(line, value) \
+do { \
+ *(value) = (readl_relaxed(IXP4XX_GPIO_GPINR) >> (line)) & 0x1; \
+} while(0)
+
+#define gpio_line_set(line, value) \
+do { \
+ u8 __line = (line); \
+ if ((value) == IXP4XX_GPIO_HIGH) \
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) | (1 << __line), IXP4XX_GPIO_GPOUTR); \
+ else if ((value) == IXP4XX_GPIO_LOW) \
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) & ~(1 << __line), IXP4XX_GPIO_GPOUTR); \
+} while (0)
#endif // __ASSEMBLY__
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
index c9e930f..0396d89 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -3,7 +3,7 @@
*
*/
-#include <mach/hardware.h>
+#include <mach/ixp4xx-regs.h>
/*
* We use IXP425 General purpose timer for our timer needs, it runs at
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 108a9d3..399c5e3 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -150,7 +150,7 @@ static struct resource ixdp425_uart_resources[] = {
static struct plat_serial8250_port ixdp425_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -159,7 +159,7 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index 852f7c9..f0e1169 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -55,14 +55,14 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev)
u32 en_bitmap, src, stat;
/* ACK - it may clear any bits so don't rely on it */
- __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]);
+ writel_relaxed(0xFFFFFFFF, &qmgr_regs->irqstat[0]);
- en_bitmap = qmgr_regs->irqen[0];
+ en_bitmap = readl_relaxed(&qmgr_regs->irqen[0]);
while (en_bitmap) {
i = __fls(en_bitmap); /* number of the last "low" queue */
en_bitmap &= ~BIT(i);
- src = qmgr_regs->irqsrc[i >> 3];
- stat = qmgr_regs->stat1[i >> 3];
+ src = readl_relaxed(&qmgr_regs->irqsrc[i >> 3]);
+ stat = readl_relaxed(&qmgr_regs->stat1[i >> 3]);
if (src & 4) /* the IRQ condition is inverted */
stat = ~stat;
if (stat & BIT(src & 3)) {
@@ -80,9 +80,9 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev)
u32 req_bitmap;
/* ACK - it may clear any bits so don't rely on it */
- __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]);
+ writel_relaxed(0xFFFFFFFF, &qmgr_regs->irqstat[1]);
- req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h;
+ req_bitmap = readl_relaxed(&qmgr_regs->irqen[1]) & readl_relaxed(&qmgr_regs->statne_h);
while (req_bitmap) {
i = __fls(req_bitmap); /* number of the last "high" queue */
req_bitmap &= ~BIT(i);
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 33cb095..647d377 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -129,7 +129,7 @@ static struct resource nas100d_uart_resources[] = {
static struct plat_serial8250_port nas100d_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
@@ -138,7 +138,7 @@ static struct plat_serial8250_port nas100d_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
@@ -250,7 +250,7 @@ static void __init nas100d_init(void)
ixp4xx_sys_init();
/* gpio 14 and 15 are _not_ clocks */
- *IXP4XX_GPIO_GPCLKR = 0;
+ writel_relaxed(0, IXP4XX_GPIO_GPCLKR);
nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
nas100d_flash_resource.end =
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index e2903fa..ada1175 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -141,7 +141,7 @@ static struct resource nslu2_uart_resources[] = {
static struct plat_serial8250_port nslu2_uart_data[] = {
{
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
@@ -150,7 +150,7 @@ static struct plat_serial8250_port nslu2_uart_data[] = {
},
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c
index 158ddb7..6a0be72 100644
--- a/arch/arm/mach-ixp4xx/omixp-setup.c
+++ b/arch/arm/mach-ixp4xx/omixp-setup.c
@@ -17,6 +17,7 @@
#include <linux/serial_8250.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
+#include <linux/io.h>
#ifdef CONFIG_LEDS_CLASS
#include <linux/leds.h>
#endif
@@ -125,7 +126,7 @@ static struct resource omixp_uart_resources[] = {
static struct plat_serial8250_port omixp_uart_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -133,7 +134,7 @@ static struct plat_serial8250_port omixp_uart_data[] = {
.uartclk = IXP4XX_UART_XTAL,
}, {
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c
index 2798f43..846192d 100644
--- a/arch/arm/mach-ixp4xx/vulcan-setup.c
+++ b/arch/arm/mach-ixp4xx/vulcan-setup.c
@@ -77,7 +77,7 @@ static struct resource vulcan_uart_resources[] = {
static struct plat_serial8250_port vulcan_uart_data[] = {
[0] = {
.mapbase = IXP4XX_UART1_BASE_PHYS,
- .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART1,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -86,7 +86,7 @@ static struct plat_serial8250_port vulcan_uart_data[] = {
},
[1] = {
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -190,46 +190,46 @@ static void __init vulcan_init(void)
/* Flash is spread over both CS0 and CS1 */
vulcan_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
vulcan_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
- *IXP4XX_EXP_CS0 = IXP4XX_EXP_BUS_CS_EN |
+ writel_relaxed(IXP4XX_EXP_BUS_CS_EN |
IXP4XX_EXP_BUS_STROBE_T(3) |
IXP4XX_EXP_BUS_SIZE(0xF) |
IXP4XX_EXP_BUS_BYTE_RD16 |
- IXP4XX_EXP_BUS_WR_EN;
- *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+ IXP4XX_EXP_BUS_WR_EN, IXP4XX_EXP_CS0);
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0), IXP4XX_EXP_CS1);
/* SRAM on CS2, (256kB, 8bit, writable) */
vulcan_sram_resource.start = IXP4XX_EXP_BUS_BASE(2);
vulcan_sram_resource.end = IXP4XX_EXP_BUS_BASE(2) + SZ_256K - 1;
- *IXP4XX_EXP_CS2 = IXP4XX_EXP_BUS_CS_EN |
+ writel_relaxed(IXP4XX_EXP_BUS_CS_EN |
IXP4XX_EXP_BUS_STROBE_T(1) |
IXP4XX_EXP_BUS_HOLD_T(2) |
IXP4XX_EXP_BUS_SIZE(9) |
IXP4XX_EXP_BUS_SPLT_EN |
IXP4XX_EXP_BUS_WR_EN |
- IXP4XX_EXP_BUS_BYTE_EN;
+ IXP4XX_EXP_BUS_BYTE_EN, IXP4XX_EXP_CS2);
/* XR16L2551 on CS3 (Moto style, 512 bytes, 8bits, writable) */
vulcan_uart_resources[2].start = IXP4XX_EXP_BUS_BASE(3);
vulcan_uart_resources[2].end = IXP4XX_EXP_BUS_BASE(3) + 16 - 1;
vulcan_uart_data[2].mapbase = vulcan_uart_resources[2].start;
vulcan_uart_data[3].mapbase = vulcan_uart_data[2].mapbase + 8;
- *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
+ writel_relaxed(IXP4XX_EXP_BUS_CS_EN |
IXP4XX_EXP_BUS_STROBE_T(3) |
IXP4XX_EXP_BUS_CYCLES(IXP4XX_EXP_BUS_CYCLES_MOTOROLA)|
IXP4XX_EXP_BUS_WR_EN |
- IXP4XX_EXP_BUS_BYTE_EN;
+ IXP4XX_EXP_BUS_BYTE_EN, IXP4XX_EXP_CS3);
/* GPIOS on CS4 (512 bytes, 8bits, writable) */
- *IXP4XX_EXP_CS4 = IXP4XX_EXP_BUS_CS_EN |
+ writel_relaxed(IXP4XX_EXP_BUS_CS_EN |
IXP4XX_EXP_BUS_WR_EN |
- IXP4XX_EXP_BUS_BYTE_EN;
+ IXP4XX_EXP_BUS_BYTE_EN, IXP4XX_EXP_CS4);
/* max6369 on CS5 (512 bytes, 8bits, writable) */
vulcan_max6369_resource.start = IXP4XX_EXP_BUS_BASE(5);
vulcan_max6369_resource.end = IXP4XX_EXP_BUS_BASE(5);
- *IXP4XX_EXP_CS5 = IXP4XX_EXP_BUS_CS_EN |
+ writel_relaxed(IXP4XX_EXP_BUS_CS_EN |
IXP4XX_EXP_BUS_WR_EN |
- IXP4XX_EXP_BUS_BYTE_EN;
+ IXP4XX_EXP_BUS_BYTE_EN, IXP4XX_EXP_CS5);
platform_add_devices(vulcan_devices, ARRAY_SIZE(vulcan_devices));
}
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c
index a785175..93f7948 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-setup.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c
@@ -56,7 +56,7 @@ static struct resource wg302v2_uart_resource = {
static struct plat_serial8250_port wg302v2_uart_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
- .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+ .membase = IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
@@ -88,8 +88,8 @@ static void __init wg302v2_init(void)
wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
- *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
- *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0) | IXP4XX_FLASH_WRITABLE, IXP4XX_EXP_CS0);
+ writel_relaxed(readl_relaxed(IXP4XX_EXP_CS0), IXP4XX_EXP_CS1);
platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices));
}
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 50e2830..d6d17e5 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -39,12 +39,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
gpio_line_config(pin, IXP4XX_GPIO_OUT);
gpio_line_set(pin, IXP4XX_GPIO_LOW);
- *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
+ writel_relaxed((count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE, IXP4XX_OSRT2);
} else {
gpio_line_config(pin, IXP4XX_GPIO_IN);
gpio_line_set(pin, IXP4XX_GPIO_HIGH);
- *IXP4XX_OSRT2 = 0;
+ writel_relaxed(0, IXP4XX_OSRT2);
}
spin_unlock_irqrestore(&beep_lock, flags);
@@ -79,10 +79,10 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
{
/* clear interrupt */
- *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
+ writel_relaxed(IXP4XX_OSST_TIMER_2_PEND, IXP4XX_OSST);
/* flip the beeper output */
- *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id);
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) ^ (1 << (unsigned int) dev_id), IXP4XX_GPIO_GPOUTR);
return IRQ_HANDLED;
}
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c
index 5580b4f..f5ade39 100644
--- a/drivers/watchdog/ixp4xx_wdt.c
+++ b/drivers/watchdog/ixp4xx_wdt.c
@@ -41,20 +41,20 @@ static DEFINE_SPINLOCK(wdt_lock);
static void wdt_enable(void)
{
spin_lock(&wdt_lock);
- *IXP4XX_OSWK = IXP4XX_WDT_KEY;
- *IXP4XX_OSWE = 0;
- *IXP4XX_OSWT = WDT_TICK_RATE * heartbeat;
- *IXP4XX_OSWE = IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE;
- *IXP4XX_OSWK = 0;
+ writel_relaxed(IXP4XX_WDT_KEY, IXP4XX_OSWK);
+ writel_relaxed(0, IXP4XX_OSWE);
+ writel_relaxed(WDT_TICK_RATE * heartbeat, IXP4XX_OSWT);
+ writel_relaxed(IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE, IXP4XX_OSWE);
+ writel_relaxed(0, IXP4XX_OSWK);
spin_unlock(&wdt_lock);
}
static void wdt_disable(void)
{
spin_lock(&wdt_lock);
- *IXP4XX_OSWK = IXP4XX_WDT_KEY;
- *IXP4XX_OSWE = 0;
- *IXP4XX_OSWK = 0;
+ writel_relaxed(IXP4XX_WDT_KEY, IXP4XX_OSWK);
+ writel_relaxed(0, IXP4XX_OSWE);
+ writel_relaxed(0, IXP4XX_OSWK);
spin_unlock(&wdt_lock);
}
@@ -181,7 +181,7 @@ static int __init ixp4xx_wdt_init(void)
return -ENODEV;
}
- boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
+ boot_status = (readl_relaxed(IXP4XX_OSST) & IXP4XX_OSST_TIMER_WARM_RESET) ?
WDIOF_CARDRESET : 0;
ret = misc_register(&ixp4xx_wdt_miscdev);
if (ret == 0)
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re[2]: [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-02 0:11 ` Arnd Bergmann
@ 2012-12-02 6:02 ` Alexander Shiyan
2012-12-02 13:13 ` Arnd Bergmann
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
1 sibling, 1 reply; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-02 6:02 UTC (permalink / raw)
To: linux-arm-kernel
> On Saturday 01 December 2012, Jason Cooper wrote:
> > On Sat, Dec 01, 2012 at 09:25:51PM +0000, Arnd Bergmann wrote:
> > > On Saturday 01 December 2012, Alexander Shiyan wrote:
> > > > + switch (d->irq) {
> > > > + case IRQ_IXP4XX_TIMER1:
> > > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
> > > > + break;
> > > > + case IRQ_IXP4XX_TIMER2:
> > > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
> > > > + break;
> > > > + case IRQ_IXP4XX_TIMESTAMP:
> > > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_TS_PEND;
> > > > + break;
> > > > + case IRQ_IXP4XX_WDOG:
> > > > + *IXP4XX_OSST = IXP4XX_OSST_TIMER_WDOG_PEND;
> > > > + break;
> > >
> > > Since you are touching these lines, it probably makes sense to convert them
> > > to use writel_relaxed() in the process. Dereferencing a volatile pointer
> > > in order to do MMIO is strongly discouraged, see
> > > Documentation/volatile-considered-harmful.txt
> >
> > Arnd,
> >
> > I took a quick look at the ixp4xx code when I saw this. It appears the
> > entire sub-arch is written this way :-( Perhaps it would be better to
> > do a cleanup patch before this one? I didn't mention it in my initial
> > comment because it looks like quite a bit of work.
> >
> > In either case, it's all cleanup, so it shouldn't cause a dependency
> > headache.
> >
> > Alexander, if you're so inclined, a cleanup series would be much
> > appreciated. If you don't have the time, no problem, just make the
> > changes suggested by Arnd and I and we'll get to the cleanup eventually.
>
> I got curious to how hard this would be and ended up with a patch.
>
> Arnd
>
> 8<--------
> [PATCH] ARM: ixp4xx: use proper __iomem annotations consistently
>
> The ixp4xx platform on ARM is one of the remaining locations still using
> direct pointer dereferences for MMIO access. This patch should convert
> all known instances to use readl_relaxed/writel_relaxed.
>
> I could not find a nice solution for mach/hardware.h, which is included
> by mach/io.h indirectly but actually requires MMIO accesses as defined
> in asm/io.h. Using a macro as a workaround helps, but the better solution
> in the long run would be to have a proper gpiolib driver rather than
> using a private API to do GPIO.
>
> I did not touch the definitions used in drivers/usb/gadget/pxa25x_udc.c,
> they are shared with the pxa platform and ever more screwed up than the
> other ones in ixp4xx that I fixed.
>
> In the process of doing this patch, I noticed that indirect PCI access
> on ixp4xx is broken since the PCIBIOS_MIN_MEM consolidateion, and this
> does not get fixed here.
Nice work! I changed my patch and maybe do another one for this modified
version of common.c. Only one comment about this patch is below.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
...
> diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> index eb68b61..2522ab0 100644
> --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> @@ -92,7 +92,7 @@
> /*
> * Expansion Bus Controller registers.
> */
> -#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
> +#define IXP4XX_EXP_REG(x) (IXP4XX_EXP_CFG_BASE_VIRT+(x))
Modify this to:
#define IXP4XX_EXP_REG(x) IOMEM(IXP4XX_EXP_CFG_BASE_VIRT+(x))
to avoid compiler warnings.
---
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure
2012-12-02 0:11 ` Arnd Bergmann
2012-12-02 6:02 ` Re[2]: " Alexander Shiyan
@ 2012-12-02 8:09 ` Alexander Shiyan
2012-12-02 8:09 ` [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API Alexander Shiyan
` (2 more replies)
1 sibling, 3 replies; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-02 8:09 UTC (permalink / raw)
To: linux-arm-kernel
Rather than modify the EOI flags directly in the timer interrupt,
let's deal with these flags in the ixp4xx_irq_ack() procedure.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-ixp4xx/common.c | 35 ++++++++++++++++++++++++++---------
drivers/input/misc/ixp4xx-beeper.c | 3 ---
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 7443e1d..8e2a3b8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -204,10 +204,28 @@ static void ixp4xx_irq_mask(struct irq_data *d)
static void ixp4xx_irq_ack(struct irq_data *d)
{
- int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
+ int line;
- if (line >= 0)
- writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
+ switch (d->irq) {
+ case IRQ_IXP4XX_TIMER1:
+ writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
+ break;
+ case IRQ_IXP4XX_TIMER2:
+ writel_relaxed(IXP4XX_OSST_TIMER_2_PEND, IXP4XX_OSST);
+ break;
+ case IRQ_IXP4XX_TIMESTAMP:
+ writel_relaxed(IXP4XX_OSST_TIMER_TS_PEND, IXP4XX_OSST);
+ break;
+ case IRQ_IXP4XX_WDOG:
+ writel_relaxed(IXP4XX_OSST_TIMER_WDOG_PEND, IXP4XX_OSST);
+ break;
+ default:
+ line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
+
+ if (line >= 0)
+ writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
+ break;
+ }
}
/*
@@ -249,6 +267,11 @@ void __init ixp4xx_init_irq(void)
/* Disable all interrupt */
writel_relaxed(0, IXP4XX_ICMR);
+ /* Clear Timer Pending Interrupts */
+ writel_relaxed(IXP4XX_OSST_TIMER_1_PEND | IXP4XX_OSST_TIMER_2_PEND |
+ IXP4XX_OSST_TIMER_TS_PEND | IXP4XX_OSST_TIMER_WDOG_PEND,
+ IXP4XX_OSST);
+
if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
/* Route upper 32 sources to IRQ instead of FIQ */
writel_relaxed(0, IXP4XX_ICLR2);
@@ -276,9 +299,6 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *evt = dev_id;
- /* Clear Pending Interrupt by writing '1' to it */
- writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
-
evt->event_handler(evt);
return IRQ_HANDLED;
@@ -296,9 +316,6 @@ void __init ixp4xx_timer_init(void)
/* Reset/disable counter */
writel_relaxed(0, IXP4XX_OSRT1);
- /* Clear Pending Interrupt by writing '1' to it */
- writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
-
/* Reset time-stamp counter */
writel_relaxed(0, IXP4XX_OSTS);
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index eae50fe..6b40950 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -78,9 +78,6 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
{
- /* clear interrupt */
- writel_relaxed(IXP4XX_OSST_TIMER_2_PEND, IXP4XX_OSST);
-
/* flip the beeper output */
writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) ^ (1 << (unsigned int) dev_id), IXP4XX_GPIO_GPOUTR);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
@ 2012-12-02 8:09 ` Alexander Shiyan
2012-12-02 13:25 ` Arnd Bergmann
2012-12-02 13:24 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Arnd Bergmann
2012-12-02 13:37 ` Mikael Pettersson
2 siblings, 1 reply; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-02 8:09 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-ixp4xx/common.c | 29 ++++++++++-----
arch/arm/mach-ixp4xx/dsmg600-setup.c | 9 ++---
arch/arm/mach-ixp4xx/goramo_mlr.c | 31 ++++++++--------
arch/arm/mach-ixp4xx/include/mach/platform.h | 38 --------------------
arch/arm/mach-ixp4xx/ixdp425-setup.c | 6 ++--
arch/arm/mach-ixp4xx/nas100d-setup.c | 9 ++---
arch/arm/mach-ixp4xx/nslu2-setup.c | 5 +--
drivers/input/misc/ixp4xx-beeper.c | 49 ++++++++++++++------------
drivers/ptp/ptp_ixp46x.c | 31 +++++++++++-----
9 files changed, 91 insertions(+), 116 deletions(-)
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 8e2a3b8..2039051 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -189,7 +189,7 @@ static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)
int_reg);
/* Configure the line as an input */
- gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN);
+ gpio_direction_input(line);
return 0;
}
@@ -401,7 +401,8 @@ EXPORT_SYMBOL(ixp4xx_exp_bus_size);
static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
{
- gpio_line_config(gpio, IXP4XX_GPIO_IN);
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) | (1 << gpio),
+ IXP4XX_GPIO_GPOER);
return 0;
}
@@ -409,25 +410,33 @@ static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
int level)
{
- gpio_line_set(gpio, level);
- gpio_line_config(gpio, IXP4XX_GPIO_OUT);
+ u32 outval = readl_relaxed(IXP4XX_GPIO_GPOUTR) & ~(1 << gpio);
+
+ if (level)
+ outval |= 1 << gpio;
+
+ writel_relaxed(outval, IXP4XX_GPIO_GPOUTR);
+
+ writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) & ~(1 << gpio),
+ IXP4XX_GPIO_GPOER);
return 0;
}
static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
{
- int value;
-
- gpio_line_get(gpio, &value);
-
- return value;
+ return !!(readl_relaxed(IXP4XX_GPIO_GPINR) & (1 << gpio));
}
static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio,
int value)
{
- gpio_line_set(gpio, value);
+ u32 outval = readl_relaxed(IXP4XX_GPIO_GPOUTR) & ~(1 << gpio);
+
+ if (value)
+ outval |= 1 << gpio;
+
+ writel_relaxed(outval, IXP4XX_GPIO_GPOUTR);
}
static struct gpio_chip ixp4xx_gpio_chip = {
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 2f24df1..f6a80dc 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -161,10 +161,7 @@ static struct platform_device *dsmg600_devices[] __initdata = {
static void dsmg600_power_off(void)
{
/* enable the pwr cntl gpio */
- gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT);
-
- /* poweroff */
- gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH);
+ gpio_direction_output(DSMG600_PO_GPIO, 1);
}
/* This is used to make sure the power-button pusher is serious. The button
@@ -201,7 +198,7 @@ static void dsmg600_power_handler(unsigned long data)
ctrl_alt_del();
/* Change the state of the power LED to "blink" */
- gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
+ gpio_set_value(DSMG600_LED_PWR_GPIO, 0);
} else {
power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
}
@@ -269,7 +266,7 @@ static void __init dsmg600_init(void)
*/
/* Make sure that the power button GPIO is set up as an input */
- gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN);
+ gpio_direction_input(DSMG600_PB_GPIO);
/* Set the initial value for the power button IRQ handler */
power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index b81aa79..b80a256 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -8,6 +8,7 @@
#include <linux/i2c-gpio.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/serial_8250.h>
@@ -80,19 +81,19 @@ static u8 control_value;
static void set_scl(u8 value)
{
- gpio_line_set(GPIO_SCL, !!value);
+ gpio_set_value(GPIO_SCL, value);
udelay(3);
}
static void set_sda(u8 value)
{
- gpio_line_set(GPIO_SDA, !!value);
+ gpio_set_value(GPIO_SDA, value);
udelay(3);
}
static void set_str(u8 value)
{
- gpio_line_set(GPIO_STR, !!value);
+ gpio_set_value(GPIO_STR, value);
udelay(3);
}
@@ -109,8 +110,8 @@ static void output_control(void)
{
int i;
- gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT);
+ gpio_direction_output(GPIO_SCL, 1);
+ gpio_direction_output(GPIO_SDA, 1);
for (i = 0; i < 8; i++) {
set_scl(0);
@@ -153,7 +154,7 @@ static int hss_set_clock(int port, unsigned int clock_type)
static irqreturn_t hss_dcd_irq(int irq, void *pdev)
{
int i, port = (irq == IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N));
- gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i);
+ i = gpio_get_value(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N);
set_carrier_cb_tab[port](pdev, !i);
return IRQ_HANDLED;
}
@@ -169,7 +170,7 @@ static int hss_open(int port, void *pdev,
else
irq = IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N);
- gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i);
+ i = gpio_get_value(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N);
set_carrier_cb(pdev, !i);
set_carrier_cb_tab[!!port] = set_carrier_cb;
@@ -182,7 +183,7 @@ static int hss_open(int port, void *pdev,
set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 0);
output_control();
- gpio_line_set(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 0);
+ gpio_set_value(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 0);
return 0;
}
@@ -194,7 +195,7 @@ static void hss_close(int port, void *pdev)
set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 1);
output_control();
- gpio_line_set(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 1);
+ gpio_set_value(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 1);
}
@@ -414,13 +415,11 @@ static void __init gmlr_init(void)
if (hw_bits & CFG_HW_HAS_EEPROM)
device_tab[devices++] = &device_i2c; /* max index 6 */
- gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_STR, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_HSS0_RTS_N, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_HSS1_RTS_N, IXP4XX_GPIO_OUT);
- gpio_line_config(GPIO_HSS0_DCD_N, IXP4XX_GPIO_IN);
- gpio_line_config(GPIO_HSS1_DCD_N, IXP4XX_GPIO_IN);
+ gpio_direction_output(GPIO_SCL, 1);
+ gpio_direction_output(GPIO_SDA, 1);
+ gpio_direction_output(GPIO_STR, 1);
+ gpio_direction_output(GPIO_HSS0_RTS_N, 0);
+ gpio_direction_output(GPIO_HSS1_RTS_N, 0);
irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N), IRQ_TYPE_EDGE_BOTH);
irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N), IRQ_TYPE_EDGE_BOTH);
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index 2d3e3f1..7fef868 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -132,47 +132,9 @@ struct pci_sys_data;
extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
extern struct pci_ops ixp4xx_ops;
-/*
- * GPIO-functions
- */
-/*
- * The following converted to the real HW bits the gpio_line_config
- */
-/* GPIO pin types */
-#define IXP4XX_GPIO_OUT 0x1
-#define IXP4XX_GPIO_IN 0x2
-
-/* GPIO signal types */
-#define IXP4XX_GPIO_LOW 0
-#define IXP4XX_GPIO_HIGH 1
-
/* GPIO Clocks */
#define IXP4XX_GPIO_CLK_0 14
#define IXP4XX_GPIO_CLK_1 15
-/* using macros here to work around circular dependency with asm/io.h */
-#define gpio_line_config(line, direction) \
-do { \
- u8 __line = (line); \
- if ((direction) == IXP4XX_GPIO_IN) \
- writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) | (1 << __line), IXP4XX_GPIO_GPOER); \
- else \
- writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOER) & ~(1 << __line), IXP4XX_GPIO_GPOER); \
-} while (0)
-
-#define gpio_line_get(line, value) \
-do { \
- *(value) = (readl_relaxed(IXP4XX_GPIO_GPINR) >> (line)) & 0x1; \
-} while(0)
-
-#define gpio_line_set(line, value) \
-do { \
- u8 __line = (line); \
- if ((value) == IXP4XX_GPIO_HIGH) \
- writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) | (1 << __line), IXP4XX_GPIO_GPOUTR); \
- else if ((value) == IXP4XX_GPIO_LOW) \
- writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) & ~(1 << __line), IXP4XX_GPIO_GPOUTR); \
-} while (0)
-
#endif // __ASSEMBLY__
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 399c5e3..736900a 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -80,10 +80,10 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
if (ctrl & NAND_CTRL_CHANGE) {
if (ctrl & NAND_NCE) {
- gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW);
+ gpio_set_value(IXDP425_NAND_NCE_PIN, 0);
udelay(5);
} else
- gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH);
+ gpio_set_value(IXDP425_NAND_NCE_PIN, 1);
offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;
offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0;
@@ -227,7 +227,7 @@ static void __init ixdp425_init(void)
ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),
ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1;
- gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT);
+ gpio_direction_output(IXDP425_NAND_NCE_PIN, 1);
/* Configure expansion bus for NAND Flash */
*IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 647d377..373cbd2 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -185,10 +185,7 @@ static void nas100d_power_off(void)
/* This causes the box to drop the power and go dead. */
/* enable the pwr cntl gpio */
- gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
-
- /* do the deed */
- gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
+ gpio_direction_output(NAS100D_PO_GPIO, 1);
}
/* This is used to make sure the power-button pusher is serious. The button
@@ -225,7 +222,7 @@ static void nas100d_power_handler(unsigned long data)
ctrl_alt_del();
/* Change the state of the power LED to "blink" */
- gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW);
+ gpio_set_value(NAS100D_LED_PWR_GPIO, 0);
} else {
power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
}
@@ -284,7 +281,7 @@ static void __init nas100d_init(void)
*/
/* Make sure that the power button GPIO is set up as an input */
- gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN);
+ gpio_direction_input(NAS100D_PB_GPIO);
/* Set the initial value for the power button IRQ handler */
power_button_countdown = PBUTTON_HOLDDOWN_COUNT;
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index ada1175..6272e16 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -198,10 +198,7 @@ static void nslu2_power_off(void)
/* This causes the box to drop the power and go dead. */
/* enable the pwr cntl gpio */
- gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
-
- /* do the deed */
- gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
+ gpio_direction_output(NSLU2_PO_GPIO, 1);
}
static irqreturn_t nslu2_power_handler(int irq, void *dev_id)
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index 6b40950..07f75b2 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/input.h>
#include <linux/delay.h>
+#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <mach/hardware.h>
@@ -35,14 +36,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
spin_lock_irqsave(&beep_lock, flags);
- if (count) {
- gpio_line_config(pin, IXP4XX_GPIO_OUT);
- gpio_line_set(pin, IXP4XX_GPIO_LOW);
+ if (count) {
+ gpio_direction_output(pin, 0);
writel_relaxed((count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE, IXP4XX_OSRT2);
} else {
- gpio_line_config(pin, IXP4XX_GPIO_IN);
- gpio_line_set(pin, IXP4XX_GPIO_HIGH);
+ gpio_direction_input(pin);
writel_relaxed(0, IXP4XX_OSRT2);
}
@@ -52,7 +51,7 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
- unsigned int pin = (unsigned int) input_get_drvdata(dev);
+ unsigned int pin = (unsigned int)input_get_drvdata(dev);
unsigned int count = 0;
if (type != EV_SND)
@@ -78,13 +77,15 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
{
- /* flip the beeper output */
- writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) ^ (1 << (unsigned int) dev_id), IXP4XX_GPIO_GPOUTR);
+ unsigned int pin = (unsigned int)dev_id;
+
+ /* Flip the beeper output */
+ gpio_set_value(pin, gpio_get_value(pin));
return IRQ_HANDLED;
}
-static int ixp4xx_spkr_probe(struct platform_device *dev)
+static int ixp4xx_spkr_probe(struct platform_device *pdev)
{
struct input_dev *input_dev;
int err;
@@ -93,7 +94,10 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
if (!input_dev)
return -ENOMEM;
- input_set_drvdata(input_dev, (void *) dev->id);
+ WARN_ON(devm_gpio_request_one(&pdev->dev, pdev->id, GPIOF_IN,
+ dev_name(&pdev->dev)));
+
+ input_set_drvdata(input_dev, (void *)pdev->id);
input_dev->name = "ixp4xx beeper",
input_dev->phys = "ixp4xx/gpio";
@@ -101,7 +105,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
input_dev->id.vendor = 0x001f;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
- input_dev->dev.parent = &dev->dev;
+ input_dev->dev.parent = &pdev->dev;
input_dev->evbit[0] = BIT_MASK(EV_SND);
input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
@@ -109,7 +113,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
IRQF_NO_SUSPEND, "ixp4xx-beeper",
- (void *) dev->id);
+ (void *)pdev->id);
if (err)
goto err_free_device;
@@ -117,39 +121,39 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
if (err)
goto err_free_irq;
- platform_set_drvdata(dev, input_dev);
+ platform_set_drvdata(pdev, input_dev);
return 0;
err_free_irq:
- free_irq(IRQ_IXP4XX_TIMER2, dev);
+ free_irq(IRQ_IXP4XX_TIMER2, (void *)pdev->id);
err_free_device:
input_free_device(input_dev);
return err;
}
-static int ixp4xx_spkr_remove(struct platform_device *dev)
+static int ixp4xx_spkr_remove(struct platform_device *pdev)
{
- struct input_dev *input_dev = platform_get_drvdata(dev);
- unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
+ struct input_dev *input_dev = platform_get_drvdata(pdev);
+ unsigned int pin = (unsigned int)input_get_drvdata(input_dev);
input_unregister_device(input_dev);
- platform_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
/* turn the speaker off */
disable_irq(IRQ_IXP4XX_TIMER2);
ixp4xx_spkr_control(pin, 0);
- free_irq(IRQ_IXP4XX_TIMER2, dev);
+ free_irq(IRQ_IXP4XX_TIMER2, (void *)pdev->id);
return 0;
}
-static void ixp4xx_spkr_shutdown(struct platform_device *dev)
+static void ixp4xx_spkr_shutdown(struct platform_device *pdev)
{
- struct input_dev *input_dev = platform_get_drvdata(dev);
- unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
+ struct input_dev *input_dev = platform_get_drvdata(pdev);
+ unsigned int pin = (unsigned int)input_get_drvdata(input_dev);
/* turn off the speaker */
disable_irq(IRQ_IXP4XX_TIMER2);
@@ -166,4 +170,3 @@ static struct platform_driver ixp4xx_spkr_platform_driver = {
.shutdown = ixp4xx_spkr_shutdown,
};
module_platform_driver(ixp4xx_spkr_platform_driver);
-
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c
index d49b851..84ac0d2 100644
--- a/drivers/ptp/ptp_ixp46x.c
+++ b/drivers/ptp/ptp_ixp46x.c
@@ -260,8 +260,6 @@ static int setup_interrupt(int gpio)
{
int irq;
- gpio_line_config(gpio, IXP4XX_GPIO_IN);
-
irq = gpio_to_irq(gpio);
if (NO_IRQ == irq)
@@ -280,14 +278,6 @@ static int setup_interrupt(int gpio)
return irq;
}
-static void __exit ptp_ixp_exit(void)
-{
- free_irq(MASTER_IRQ, &ixp_clock);
- free_irq(SLAVE_IRQ, &ixp_clock);
- ixp46x_phc_index = -1;
- ptp_clock_unregister(ixp_clock.ptp_clock);
-}
-
static int __init ptp_ixp_init(void)
{
if (!cpu_is_ixp46x())
@@ -310,6 +300,9 @@ static int __init ptp_ixp_init(void)
__raw_writel(0, &ixp_clock.regs->trgt_hi);
__raw_writel(TTIPEND, &ixp_clock.regs->event);
+ gpio_request_one(MASTER_GPIO, GPIOF_IN, "PTP Master");
+ gpio_request_one(SLAVE_GPIO, GPIOF_IN, "PTP Slave");
+
if (MASTER_IRQ != setup_interrupt(MASTER_GPIO)) {
pr_err("failed to setup gpio %d as irq\n", MASTER_GPIO);
goto no_master;
@@ -320,13 +313,31 @@ static int __init ptp_ixp_init(void)
}
return 0;
+
no_slave:
free_irq(MASTER_IRQ, &ixp_clock);
+
no_master:
+ gpio_free(MASTER_GPIO);
+ gpio_free(SLAVE_GPIO);
+
ptp_clock_unregister(ixp_clock.ptp_clock);
+
return -ENODEV;
}
+static void __exit ptp_ixp_exit(void)
+{
+ free_irq(MASTER_IRQ, &ixp_clock);
+ free_irq(SLAVE_IRQ, &ixp_clock);
+
+ gpio_free(MASTER_GPIO);
+ gpio_free(SLAVE_GPIO);
+
+ ixp46x_phc_index = -1;
+ ptp_clock_unregister(ixp_clock.ptp_clock);
+}
+
module_init(ptp_ixp_init);
module_exit(ptp_ixp_exit);
--
1.7.8.6
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-02 6:02 ` Re[2]: " Alexander Shiyan
@ 2012-12-02 13:13 ` Arnd Bergmann
2012-12-02 13:55 ` Re[4]: " Alexander Shiyan
0 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-02 13:13 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 02 December 2012, Alexander Shiyan wrote:
> > diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > index eb68b61..2522ab0 100644
> > --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > @@ -92,7 +92,7 @@
> > /*
> > * Expansion Bus Controller registers.
> > */
> > -#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
> > +#define IXP4XX_EXP_REG(x) (IXP4XX_EXP_CFG_BASE_VIRT+(x))
> Modify this to:
> #define IXP4XX_EXP_REG(x) IOMEM(IXP4XX_EXP_CFG_BASE_VIRT+(x))
> to avoid compiler warnings.
>
Hmm, not sure what went wrong here. Actually the definition of
IXP4XX_EXP_CFG_BASE_VIRT itself should use the IOMEM() macro, like
all the other IXP4XX_*_BASE_VIRT do.
Arnd
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
2012-12-02 8:09 ` [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API Alexander Shiyan
@ 2012-12-02 13:24 ` Arnd Bergmann
2012-12-02 13:37 ` Mikael Pettersson
2 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-02 13:24 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 02 December 2012, Alexander Shiyan wrote:
>
> Rather than modify the EOI flags directly in the timer interrupt,
> let's deal with these flags in the ixp4xx_irq_ack() procedure.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API
2012-12-02 8:09 ` [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API Alexander Shiyan
@ 2012-12-02 13:25 ` Arnd Bergmann
0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-02 13:25 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 02 December 2012, Alexander Shiyan wrote:
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> arch/arm/mach-ixp4xx/common.c | 29 ++++++++++-----
> arch/arm/mach-ixp4xx/dsmg600-setup.c | 9 ++---
> arch/arm/mach-ixp4xx/goramo_mlr.c | 31 ++++++++--------
> arch/arm/mach-ixp4xx/include/mach/platform.h | 38 --------------------
> arch/arm/mach-ixp4xx/ixdp425-setup.c | 6 ++--
> arch/arm/mach-ixp4xx/nas100d-setup.c | 9 ++---
> arch/arm/mach-ixp4xx/nslu2-setup.c | 5 +--
> drivers/input/misc/ixp4xx-beeper.c | 49 ++++++++++++++------------
> drivers/ptp/ptp_ixp46x.c | 31 +++++++++++-----
> 9 files changed, 91 insertions(+), 116 deletions(-)
Very nice!
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
2012-12-02 8:09 ` [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API Alexander Shiyan
2012-12-02 13:24 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Arnd Bergmann
@ 2012-12-02 13:37 ` Mikael Pettersson
2012-12-02 13:50 ` Re[2]: " Alexander Shiyan
2 siblings, 1 reply; 17+ messages in thread
From: Mikael Pettersson @ 2012-12-02 13:37 UTC (permalink / raw)
To: linux-arm-kernel
Alexander Shiyan writes:
> Rather than modify the EOI flags directly in the timer interrupt,
> let's deal with these flags in the ixp4xx_irq_ack() procedure.
Why?
All I see is that you're removing simple unconditional code from two
interrupt handlers and adding a large conditional to ixp4xx_irq_ack,
which will slow down all interrupt acks.
So in what way is this an improvement?
/Mikael
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> arch/arm/mach-ixp4xx/common.c | 35 ++++++++++++++++++++++++++---------
> drivers/input/misc/ixp4xx-beeper.c | 3 ---
> 2 files changed, 26 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
> index 7443e1d..8e2a3b8 100644
> --- a/arch/arm/mach-ixp4xx/common.c
> +++ b/arch/arm/mach-ixp4xx/common.c
> @@ -204,10 +204,28 @@ static void ixp4xx_irq_mask(struct irq_data *d)
>
> static void ixp4xx_irq_ack(struct irq_data *d)
> {
> - int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
> + int line;
>
> - if (line >= 0)
> - writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
> + switch (d->irq) {
> + case IRQ_IXP4XX_TIMER1:
> + writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
> + break;
> + case IRQ_IXP4XX_TIMER2:
> + writel_relaxed(IXP4XX_OSST_TIMER_2_PEND, IXP4XX_OSST);
> + break;
> + case IRQ_IXP4XX_TIMESTAMP:
> + writel_relaxed(IXP4XX_OSST_TIMER_TS_PEND, IXP4XX_OSST);
> + break;
> + case IRQ_IXP4XX_WDOG:
> + writel_relaxed(IXP4XX_OSST_TIMER_WDOG_PEND, IXP4XX_OSST);
> + break;
> + default:
> + line = (d->irq < 32) ? irq2gpio[d->irq] : -1;
> +
> + if (line >= 0)
> + writel_relaxed(1 << line, IXP4XX_GPIO_GPISR);
> + break;
> + }
> }
>
> /*
> @@ -249,6 +267,11 @@ void __init ixp4xx_init_irq(void)
> /* Disable all interrupt */
> writel_relaxed(0, IXP4XX_ICMR);
>
> + /* Clear Timer Pending Interrupts */
> + writel_relaxed(IXP4XX_OSST_TIMER_1_PEND | IXP4XX_OSST_TIMER_2_PEND |
> + IXP4XX_OSST_TIMER_TS_PEND | IXP4XX_OSST_TIMER_WDOG_PEND,
> + IXP4XX_OSST);
> +
> if (cpu_is_ixp46x() || cpu_is_ixp43x()) {
> /* Route upper 32 sources to IRQ instead of FIQ */
> writel_relaxed(0, IXP4XX_ICLR2);
> @@ -276,9 +299,6 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)
> {
> struct clock_event_device *evt = dev_id;
>
> - /* Clear Pending Interrupt by writing '1' to it */
> - writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
> -
> evt->event_handler(evt);
>
> return IRQ_HANDLED;
> @@ -296,9 +316,6 @@ void __init ixp4xx_timer_init(void)
> /* Reset/disable counter */
> writel_relaxed(0, IXP4XX_OSRT1);
>
> - /* Clear Pending Interrupt by writing '1' to it */
> - writel_relaxed(IXP4XX_OSST_TIMER_1_PEND, IXP4XX_OSST);
> -
> /* Reset time-stamp counter */
> writel_relaxed(0, IXP4XX_OSTS);
>
> diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
> index eae50fe..6b40950 100644
> --- a/drivers/input/misc/ixp4xx-beeper.c
> +++ b/drivers/input/misc/ixp4xx-beeper.c
> @@ -78,9 +78,6 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
>
> static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
> {
> - /* clear interrupt */
> - writel_relaxed(IXP4XX_OSST_TIMER_2_PEND, IXP4XX_OSST);
> -
> /* flip the beeper output */
> writel_relaxed(readl_relaxed(IXP4XX_GPIO_GPOUTR) ^ (1 << (unsigned int) dev_id), IXP4XX_GPIO_GPOUTR);
>
> --
> 1.7.8.6
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re[2]: [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure
2012-12-02 13:37 ` Mikael Pettersson
@ 2012-12-02 13:50 ` Alexander Shiyan
0 siblings, 0 replies; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-02 13:50 UTC (permalink / raw)
To: linux-arm-kernel
> Alexander Shiyan writes:
> > Rather than modify the EOI flags directly in the timer interrupt,
> > let's deal with these flags in the ixp4xx_irq_ack() procedure.
>
> Why?
>
> All I see is that you're removing simple unconditional code from two
> interrupt handlers and adding a large conditional to ixp4xx_irq_ack,
> which will slow down all interrupt acks.
>
> So in what way is this an improvement?
This is a right place for do it. Now we can use these interrupts in any
drivers without patching last one for touching ACK.
---
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re[4]: [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-02 13:13 ` Arnd Bergmann
@ 2012-12-02 13:55 ` Alexander Shiyan
2012-12-03 23:40 ` Arnd Bergmann
0 siblings, 1 reply; 17+ messages in thread
From: Alexander Shiyan @ 2012-12-02 13:55 UTC (permalink / raw)
To: linux-arm-kernel
> On Sunday 02 December 2012, Alexander Shiyan wrote:
> > > diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > > index eb68b61..2522ab0 100644
> > > --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > > +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
> > > @@ -92,7 +92,7 @@
> > > /*
> > > * Expansion Bus Controller registers.
> > > */
> > > -#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
> > > +#define IXP4XX_EXP_REG(x) (IXP4XX_EXP_CFG_BASE_VIRT+(x))
> > Modify this to:
> > #define IXP4XX_EXP_REG(x) IOMEM(IXP4XX_EXP_CFG_BASE_VIRT+(x))
> > to avoid compiler warnings.
> >
>
> Hmm, not sure what went wrong here. Actually the definition of
> IXP4XX_EXP_CFG_BASE_VIRT itself should use the IOMEM() macro, like
> all the other IXP4XX_*_BASE_VIRT do.
But without this is produce warnings:
CC arch/arm/common/dmabounce.o
In file included from arch/arm/mach-ixp4xx/include/mach/hardware.h:30,
from arch/arm/mach-ixp4xx/include/mach/io.h:18,
from /home/git/linux-next/arch/arm/include/asm/io.h:180,
from include/linux/scatterlist.h:10,
from include/linux/dma-mapping.h:9,
from arch/arm/common/dmabounce.c:30:
arch/arm/mach-ixp4xx/include/mach/cpu.h: In function 'ixp4xx_read_feature_bits':
arch/arm/mach-ixp4xx/include/mach/cpu.h:41: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast
arch/arm/mach-ixp4xx/include/mach/cpu.h: In function 'ixp4xx_write_feature_bits':
arch/arm/mach-ixp4xx/include/mach/cpu.h:55: warning: passing argument 2 of '__raw_writel' makes pointer from integer without a cast
---
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts
2012-12-02 13:55 ` Re[4]: " Alexander Shiyan
@ 2012-12-03 23:40 ` Arnd Bergmann
0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2012-12-03 23:40 UTC (permalink / raw)
To: linux-arm-kernel
On Sunday 02 December 2012, Alexander Shiyan wrote:
> > > > -#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
> > > > +#define IXP4XX_EXP_REG(x) (IXP4XX_EXP_CFG_BASE_VIRT+(x))
> > > Modify this to:
> > > #define IXP4XX_EXP_REG(x) IOMEM(IXP4XX_EXP_CFG_BASE_VIRT+(x))
> > > to avoid compiler warnings.
> > >
> >
> > Hmm, not sure what went wrong here. Actually the definition of
> > IXP4XX_EXP_CFG_BASE_VIRT itself should use the IOMEM() macro, like
> > all the other IXP4XX_*_BASE_VIRT do.
>
> But without this is produce warnings:
> CC arch/arm/common/dmabounce.o
> In file included from arch/arm/mach-ixp4xx/include/mach/hardware.h:30,
> from arch/arm/mach-ixp4xx/include/mach/io.h:18,
> from /home/git/linux-next/arch/arm/include/asm/io.h:180,
> from include/linux/scatterlist.h:10,
> from include/linux/dma-mapping.h:9,
> from arch/arm/common/dmabounce.c:30:
> arch/arm/mach-ixp4xx/include/mach/cpu.h: In function 'ixp4xx_read_feature_bits':
> arch/arm/mach-ixp4xx/include/mach/cpu.h:41: warning: passing argument 1 of '__raw_readl' makes pointer from integer without a cast
> arch/arm/mach-ixp4xx/include/mach/cpu.h: In function 'ixp4xx_write_feature_bits':
> arch/arm/mach-ixp4xx/include/mach/cpu.h:55: warning: passing argument 2 of '__raw_writel' makes pointer from integer without a cast
>
I understand what the problem is, my point was that a better solution is to do
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
index c5bae9c..daf5c4e 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -65,7 +65,7 @@
* Expansion BUS Configuration registers
*/
#define IXP4XX_EXP_CFG_BASE_PHYS 0xC4000000
-#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEF14000
+#define IXP4XX_EXP_CFG_BASE_VIRT IOMEM(0xFEF14000)
#define IXP4XX_EXP_CFG_REGION_SIZE 0x00001000
#define IXP4XX_EXP_CS0_OFFSET 0x00
instead of your suggested fix, because that matches how all the other _VIRT macros in that
file are defined. I found now that it was correct until recently, but b7b23db72f accidentally
broke it while fixing the MMIO location.
Arnd
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-12-03 23:40 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-01 7:33 [PATCH] ARM: ixp4xx: Add "ask" handler for timer interrupts Alexander Shiyan
2012-12-01 13:05 ` Jason Cooper
2012-12-01 13:14 ` Re[2]: " Alexander Shiyan
2012-12-01 15:41 ` Jason Cooper
2012-12-01 21:25 ` Arnd Bergmann
2012-12-01 21:45 ` Jason Cooper
2012-12-02 0:11 ` Arnd Bergmann
2012-12-02 6:02 ` Re[2]: " Alexander Shiyan
2012-12-02 13:13 ` Arnd Bergmann
2012-12-02 13:55 ` Re[4]: " Alexander Shiyan
2012-12-03 23:40 ` Arnd Bergmann
2012-12-02 8:09 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Alexander Shiyan
2012-12-02 8:09 ` [PATCH 2/2] ARM: ixp4xx: Using gpiolib rather than a private GPIO API Alexander Shiyan
2012-12-02 13:25 ` Arnd Bergmann
2012-12-02 13:24 ` [PATCH 1/2] ARM: ixp4xx: Moving the timer flags control in ixp4xx_irq_ack() procedure Arnd Bergmann
2012-12-02 13:37 ` Mikael Pettersson
2012-12-02 13:50 ` Re[2]: " Alexander Shiyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox