Skip to content

Commit d24e45f

Browse files
Nicolas PitreRussell King
authored andcommitted
[ARM PATCH] 1660/1: misc PXA/Lubbock fixes
Patch from Nicolas Pitre
1 parent 162c65f commit d24e45f

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

arch/arm/mach-pxa/irq.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,19 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
5858
{
5959
int gpio, idx;
6060

61-
gpio = irq - ((irq >= IRQ_GPIO(2)) ? IRQ_GPIO(2) + 2 : IRQ_GPIO(0));
61+
gpio = IRQ_TO_GPIO(irq);
62+
idx = gpio >> 5;
63+
64+
if (type == IRQT_PROBE) {
65+
/* Don't mess with enabled GPIOs using preconfigured edges or
66+
GPIOs set to alternate function during probe */
67+
if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx]) &
68+
GPIO_bit(gpio))
69+
return 0;
70+
if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))
71+
return 0;
72+
type = __IRQT_RISEDGE | __IRQT_FALEDGE;
73+
}
6274

6375
printk(KERN_DEBUG "IRQ%d (GPIO%d): ", irq, gpio);
6476

@@ -78,10 +90,8 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
7890

7991
printk("edges\n");
8092

81-
idx = gpio >> 5;
8293
GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx];
8394
GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx];
84-
8595
return 0;
8696
}
8797

arch/arm/mach-pxa/lubbock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void __init lubbock_init_irq(void)
7878
pxa_init_irq();
7979

8080
/* setup extra lubbock irqs */
81-
for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_IRQ(5); irq++) {
81+
for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
8282
set_irq_chip(irq, &lubbock_irq_chip);
8383
set_irq_handler(irq, do_level_IRQ);
8484
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
@@ -124,6 +124,7 @@ static struct map_desc lubbock_io_desc[] __initdata = {
124124
{ 0xf0000000, 0x08000000, 0x00100000, MT_DEVICE }, /* CPLD */
125125
{ 0xf1000000, 0x0c000000, 0x00100000, MT_DEVICE }, /* LAN91C96 IO */
126126
{ 0xf1100000, 0x0e000000, 0x00100000, MT_DEVICE }, /* LAN91C96 Attr */
127+
{ 0xf4000000, 0x10000000, 0x00800000, MT_DEVICE }, /* SA1111 */
127128
};
128129

129130
static void __init lubbock_map_io(void)

include/asm-arm/arch-pxa/irqs.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
#define PXA_IRQ_SKIP 7 /* The first 7 IRQs are not yet used */
14-
#define PXA_IRQ(x) ((x) - PXA_IRQ_SKIP)
14+
#define PXA_IRQ(x) ((x) - PXA_IRQ_SKIP)
1515

1616
#define IRQ_HWUART PXA_IRQ(7) /* HWUART Transmit/Receive/Error */
1717
#define IRQ_GPIO0 PXA_IRQ(8) /* GPIO0 Edge Detect */
@@ -45,7 +45,7 @@
4545

4646
#define IRQ_TO_GPIO_2_80(i) \
4747
((i) - PXA_IRQ(32) + 2)
48-
#define IRQ_TO_GPIO(i) ((i) - (((i) > IRQ_GPIO1) ? IRQ_GPIO(2) : IRQ_GPIO(0)))
48+
#define IRQ_TO_GPIO(i) ((i) - (((i) > IRQ_GPIO1) ? IRQ_GPIO(2) - 2 : IRQ_GPIO(0)))
4949

5050
/*
5151
* The next 16 interrupts are for board specific purposes. Since
@@ -129,8 +129,10 @@
129129
#define LUBBOCK_IRQ(x) (IRQ_BOARD_START + (x))
130130
#define LUBBOCK_SD_IRQ LUBBOCK_IRQ(0)
131131
#define LUBBOCK_SA1111_IRQ LUBBOCK_IRQ(1)
132-
#define LUBBOCK_USB_IRQ LUBBOCK_IRQ(2)
132+
#define LUBBOCK_USB_IRQ LUBBOCK_IRQ(2) /* usb connect */
133133
#define LUBBOCK_ETH_IRQ LUBBOCK_IRQ(3)
134134
#define LUBBOCK_UCB1400_IRQ LUBBOCK_IRQ(4)
135135
#define LUBBOCK_BB_IRQ LUBBOCK_IRQ(5)
136+
#define LUBBOCK_USB_DISC_IRQ LUBBOCK_IRQ(6) /* usb disconnect */
137+
#define LUBBOCK_LAST_IRQ LUBBOCK_IRQ(6)
136138

include/asm-arm/arch-pxa/lubbock.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
#define LUBBOCK_FPGA_PHYS PXA_CS2_PHYS
1414
#define LUBBOCK_FPGA_VIRT (0xf0000000) /* phys 0x08000000 */
15-
#define LUBBOCK_ETH_BASE (0xf1000000) /* phys 0x0c000000 */
15+
#define LUBBOCK_ETH_PHYS PXA_CS3_PHYS
16+
#define LUBBOCK_ETH_VIRT (0xf1000000)
1617

1718
#define LUB_P2V(x) ((x) - LUBBOCK_FPGA_PHYS + LUBBOCK_FPGA_VIRT)
1819
#define LUB_V2P(x) ((x) - LUBBOCK_FPGA_VIRT + LUBBOCK_FPGA_PHYS)

0 commit comments

Comments
 (0)