From dcc88a170ce9f90e4b819c67feebb16e8a123f79 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 13 Feb 2008 16:39:21 +0100 Subject: [ARM] 4830/1: Add support for the CLK_POUT pin on PXA3xx CPUs Expose control of the PXA3xx 13MHz CLK_POUT pin via the clock API Signed-off-by: Mark Brown Signed-off-by: Russell King --- arch/arm/mach-pxa/pxa3xx.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 35f25fdaeba3..54c9e8371a21 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -156,6 +156,21 @@ static const struct clkops clk_pxa3xx_hsio_ops = { .getrate = clk_pxa3xx_hsio_getrate, }; +static void clk_pout_enable(struct clk *clk) +{ + OSCC |= OSCC_PEN; +} + +static void clk_pout_disable(struct clk *clk) +{ + OSCC &= ~OSCC_PEN; +} + +static const struct clkops clk_pout_ops = { + .enable = clk_pout_enable, + .disable = clk_pout_disable, +}; + #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ { \ .name = _name, \ @@ -175,6 +190,13 @@ static const struct clkops clk_pxa3xx_hsio_ops = { } static struct clk pxa3xx_clks[] = { + { + .name = "CLK_POUT", + .ops = &clk_pout_ops, + .rate = 13000000, + .delay = 70, + }, + PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), -- cgit v1.2.3-59-g8ed1b From 60bfe7fa3dc13fe90d273371b65ae3ec89583c52 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 4 Mar 2008 11:14:23 +0100 Subject: [ARM] 4832/2: Support AC97CLK on PXA3xx via the clock API The AC97 clock rate on PXA3xx is generated with a configurable divider from sys_pll. Signed-off-by: Mark Brown Acked-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/pxa3xx.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 54c9e8371a21..93f3236b4100 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -109,6 +109,25 @@ unsigned int pxa3xx_get_memclk_frequency_10khz(void) return (clk / 10000); } +/* + * Return the current AC97 clock frequency. + */ +static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk) +{ + unsigned long rate = 312000000; + unsigned long ac97_div; + + ac97_div = AC97_DIV; + + /* This may loose precision for some rates but won't for the + * standard 24.576MHz. + */ + rate /= (ac97_div >> 12) & 0x7fff; + rate *= (ac97_div & 0xfff); + + return rate; +} + /* * Return the current HSIO bus clock frequency */ @@ -156,6 +175,12 @@ static const struct clkops clk_pxa3xx_hsio_ops = { .getrate = clk_pxa3xx_hsio_getrate, }; +static const struct clkops clk_pxa3xx_ac97_ops = { + .enable = clk_pxa3xx_cken_enable, + .disable = clk_pxa3xx_cken_disable, + .getrate = clk_pxa3xx_ac97_getrate, +}; + static void clk_pout_enable(struct clk *clk) { OSCC |= OSCC_PEN; @@ -197,8 +222,9 @@ static struct clk pxa3xx_clks[] = { .delay = 70, }, - PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), - PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), + PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), + PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), + PXA3xx_CK("AC97CLK", AC97, &clk_pxa3xx_ac97_ops, NULL), PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), -- cgit v1.2.3-59-g8ed1b From f6fb7af4768bc1ddc2349f6eaefedd746c8e4913 Mon Sep 17 00:00:00 2001 From: eric miao Date: Tue, 4 Mar 2008 13:53:05 +0800 Subject: [ARM] pxa: integrate low IRQ chip (ICIP) and high IRQ chip (ICIP2) into one This makes the code better organized and simplified a bit. The change will lose a bit of performance when performing IRQ ack/mask/unmask,but that's not too much after checking the result binary. This patch also removes the ugly #ifdef CONFIG_PXA27x .. #endif by carefully not to access those pxa{27x,3xx} specific registers, this is done by keeping an internal IRQ number variable. The pxa-regs.h is also modified so registers for IRQ > PXA_IRQ(31) are made public even if CONFIG_PXA{27x,3xx} isn't defined (for pxa25x's sake) The incorrect assumption in the original code that internal irq starts from 0 is also corrected by comparing with PXA_IRQ(0). "struct sys_device" for the IRQ are reduced into one single device on pxa{27x,3xx}. Signed-off-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/generic.h | 3 +- arch/arm/mach-pxa/irq.c | 117 ++++++++++-------------------------- arch/arm/mach-pxa/pxa25x.c | 2 +- arch/arm/mach-pxa/pxa27x.c | 7 +-- arch/arm/mach-pxa/pxa3xx.c | 7 +-- include/asm-arm/arch-pxa/pxa-regs.h | 11 ++-- 6 files changed, 42 insertions(+), 105 deletions(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index cbe6693b1b6f..0e3e058296fa 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h @@ -12,8 +12,7 @@ struct sys_timer; extern struct sys_timer pxa_timer; -extern void __init pxa_init_irq_low(void); -extern void __init pxa_init_irq_high(void); +extern void __init pxa_init_irq(int irq_nr); extern void __init pxa_init_irq_gpio(int gpio_nr); extern void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)); extern void __init pxa_init_gpio_set_wake(int (*set_wake)(unsigned int, unsigned int)); diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index da3a44a4249a..cccc3ed3c679 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c @@ -24,92 +24,57 @@ #include "generic.h" +#define IRQ_BIT(n) (((n) - PXA_IRQ(0)) & 0x1f) +#define _ICMR(n) (*((((n) - PXA_IRQ(0)) & ~0x1f) ? &ICMR2 : &ICMR)) +#define _ICLR(n) (*((((n) - PXA_IRQ(0)) & ~0x1f) ? &ICLR2 : &ICLR)) /* * This is for peripheral IRQs internal to the PXA chip. */ -static void pxa_mask_low_irq(unsigned int irq) +static int pxa_internal_irq_nr; + +static void pxa_mask_irq(unsigned int irq) { - ICMR &= ~(1 << irq); + _ICMR(irq) &= ~(1 << IRQ_BIT(irq)); } -static void pxa_unmask_low_irq(unsigned int irq) +static void pxa_unmask_irq(unsigned int irq) { - ICMR |= (1 << irq); + _ICMR(irq) |= 1 << IRQ_BIT(irq); } -static struct irq_chip pxa_internal_chip_low = { +static struct irq_chip pxa_internal_irq_chip = { .name = "SC", - .ack = pxa_mask_low_irq, - .mask = pxa_mask_low_irq, - .unmask = pxa_unmask_low_irq, + .ack = pxa_mask_irq, + .mask = pxa_mask_irq, + .unmask = pxa_unmask_irq, }; -void __init pxa_init_irq_low(void) +void __init pxa_init_irq(int irq_nr) { int irq; - /* disable all IRQs */ - ICMR = 0; + pxa_internal_irq_nr = irq_nr; - /* all IRQs are IRQ, not FIQ */ - ICLR = 0; + for (irq = 0; irq < irq_nr; irq += 32) { + _ICMR(irq) = 0; /* disable all IRQs */ + _ICLR(irq) = 0; /* all IRQs are IRQ, not FIQ */ + } /* only unmasked interrupts kick us out of idle */ ICCR = 1; - for (irq = PXA_IRQ(0); irq <= PXA_IRQ(31); irq++) { - set_irq_chip(irq, &pxa_internal_chip_low); - set_irq_handler(irq, handle_level_irq); - set_irq_flags(irq, IRQF_VALID); - } -} - -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) - -/* - * This is for the second set of internal IRQs as found on the PXA27x. - */ - -static void pxa_mask_high_irq(unsigned int irq) -{ - ICMR2 &= ~(1 << (irq - 32)); -} - -static void pxa_unmask_high_irq(unsigned int irq) -{ - ICMR2 |= (1 << (irq - 32)); -} - -static struct irq_chip pxa_internal_chip_high = { - .name = "SC-hi", - .ack = pxa_mask_high_irq, - .mask = pxa_mask_high_irq, - .unmask = pxa_unmask_high_irq, -}; - -void __init pxa_init_irq_high(void) -{ - int irq; - - ICMR2 = 0; - ICLR2 = 0; - - for (irq = PXA_IRQ(32); irq < PXA_IRQ(64); irq++) { - set_irq_chip(irq, &pxa_internal_chip_high); + for (irq = PXA_IRQ(0); irq < PXA_IRQ(irq_nr); irq++) { + set_irq_chip(irq, &pxa_internal_irq_chip); set_irq_handler(irq, handle_level_irq); set_irq_flags(irq, IRQF_VALID); } } -#endif void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)) { - pxa_internal_chip_low.set_wake = set_wake; -#ifdef CONFIG_PXA27x - pxa_internal_chip_high.set_wake = set_wake; -#endif + pxa_internal_irq_chip.set_wake = set_wake; pxa_init_gpio_set_wake(set_wake); } @@ -118,19 +83,11 @@ static unsigned long saved_icmr[2]; static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) { - switch (dev->id) { - case 0: - saved_icmr[0] = ICMR; - ICMR = 0; - break; -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) - case 1: - saved_icmr[1] = ICMR2; - ICMR2 = 0; - break; -#endif - default: - return -EINVAL; + int i, irq = PXA_IRQ(0); + + for (i = 0; irq < PXA_IRQ(pxa_internal_irq_nr); i++, irq += 32) { + saved_icmr[i] = _ICMR(irq); + _ICMR(irq) = 0; } return 0; @@ -138,22 +95,14 @@ static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) static int pxa_irq_resume(struct sys_device *dev) { - switch (dev->id) { - case 0: - ICMR = saved_icmr[0]; - ICLR = 0; - ICCR = 1; - break; -#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) - case 1: - ICMR2 = saved_icmr[1]; - ICLR2 = 0; - break; -#endif - default: - return -EINVAL; + int i, irq = PXA_IRQ(0); + + for (i = 0; irq < PXA_IRQ(pxa_internal_irq_nr); i++, irq += 32) { + _ICMR(irq) = saved_icmr[i]; + _ICLR(irq) = 0; } + ICCR = 1; return 0; } #else diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index f3799289b8f0..bb0bf51f5039 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -267,7 +267,7 @@ set_pwer: void __init pxa25x_init_irq(void) { - pxa_init_irq_low(); + pxa_init_irq(32); pxa_init_irq_gpio(85); pxa_init_irq_set_wake(pxa25x_set_wake); } diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index c186bd1f8673..54d8448cad7b 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -340,8 +340,7 @@ set_pwer: void __init pxa27x_init_irq(void) { - pxa_init_irq_low(); - pxa_init_irq_high(); + pxa_init_irq(34); pxa_init_irq_gpio(128); pxa_init_irq_set_wake(pxa27x_set_wake); } @@ -389,10 +388,6 @@ static struct platform_device *devices[] __initdata = { static struct sys_device pxa27x_sysdev[] = { { - .id = 0, - .cls = &pxa_irq_sysclass, - }, { - .id = 1, .cls = &pxa_irq_sysclass, }, { .cls = &pxa_gpio_sysclass, diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 93f3236b4100..8f8179b2fc38 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -513,8 +513,7 @@ void __init pxa3xx_init_irq(void) value |= (1 << 6); __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); - pxa_init_irq_low(); - pxa_init_irq_high(); + pxa_init_irq(56); pxa_init_irq_gpio(128); pxa3xx_init_irq_pm(); } @@ -538,10 +537,6 @@ static struct platform_device *devices[] __initdata = { static struct sys_device pxa3xx_sysdev[] = { { - .id = 0, - .cls = &pxa_irq_sysclass, - }, { - .id = 1, .cls = &pxa_irq_sysclass, }, { .cls = &pxa_gpio_sysclass, diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h index fd81e559f15d..e659be4df3ac 100644 --- a/include/asm-arm/arch-pxa/pxa-regs.h +++ b/include/asm-arm/arch-pxa/pxa-regs.h @@ -1129,6 +1129,11 @@ #define ICPR __REG(0x40D00010) /* Interrupt Controller Pending Register */ #define ICCR __REG(0x40D00014) /* Interrupt Controller Control Register */ +#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */ +#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */ +#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */ +#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */ +#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */ /* * General Purpose I/O @@ -1200,12 +1205,6 @@ /* Interrupt Controller */ -#define ICIP2 __REG(0x40D0009C) /* Interrupt Controller IRQ Pending Register 2 */ -#define ICMR2 __REG(0x40D000A0) /* Interrupt Controller Mask Register 2 */ -#define ICLR2 __REG(0x40D000A4) /* Interrupt Controller Level Register 2 */ -#define ICFP2 __REG(0x40D000A8) /* Interrupt Controller FIQ Pending Register 2 */ -#define ICPR2 __REG(0x40D000AC) /* Interrupt Controller Pending Register 2 */ - #define _GPLR(x) __REG2(0x40E00000, ((x) & 0x60) >> 3) #define _GPDR(x) __REG2(0x40E0000C, ((x) & 0x60) >> 3) #define _GPSR(x) __REG2(0x40E00018, ((x) & 0x60) >> 3) -- cgit v1.2.3-59-g8ed1b From b9e25aced33eeb7279ccbaef198f28370cfb4e93 Mon Sep 17 00:00:00 2001 From: eric miao Date: Tue, 4 Mar 2008 14:19:58 +0800 Subject: [ARM] pxa: merge assignment of set_wake into pxa_init_{irq,gpio}() To further clean up the GPIO and IRQ structure: 1. pxa_init_irq_gpio() and pxa_init_gpio() combines into a single function pxa_init_gpio() 2. assignment of set_wake merged into pxa_init_{irq,gpio}() as an argument Signed-off-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/generic.h | 9 ++++----- arch/arm/mach-pxa/gpio.c | 34 ++++++++++++---------------------- arch/arm/mach-pxa/irq.c | 8 ++------ arch/arm/mach-pxa/pxa25x.c | 5 ++--- arch/arm/mach-pxa/pxa27x.c | 5 ++--- arch/arm/mach-pxa/pxa3xx.c | 13 +++---------- 6 files changed, 25 insertions(+), 49 deletions(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index 0e3e058296fa..bd2a2356d976 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h @@ -9,14 +9,13 @@ * published by the Free Software Foundation. */ +typedef int (*set_wake_t)(unsigned int, unsigned int); + struct sys_timer; extern struct sys_timer pxa_timer; -extern void __init pxa_init_irq(int irq_nr); -extern void __init pxa_init_irq_gpio(int gpio_nr); -extern void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)); -extern void __init pxa_init_gpio_set_wake(int (*set_wake)(unsigned int, unsigned int)); -extern void __init pxa_init_gpio(int gpio_nr); +extern void __init pxa_init_irq(int irq_nr, set_wake_t fn); +extern void __init pxa_init_gpio(int gpio_nr, set_wake_t fn); extern void __init pxa25x_init_irq(void); extern void __init pxa27x_init_irq(void); extern void __init pxa3xx_init_irq(void); diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c index a64227254151..bf4c08408f2e 100644 --- a/arch/arm/mach-pxa/gpio.c +++ b/arch/arm/mach-pxa/gpio.c @@ -153,20 +153,6 @@ static struct pxa_gpio_chip pxa_gpio_chip[] = { #endif }; -void __init pxa_init_gpio(int gpio_nr) -{ - int i; - - /* add a GPIO chip for each register bank. - * the last PXA25x register only contains 21 GPIOs - */ - for (i = 0; i < gpio_nr; i += 32) { - if (i+32 > gpio_nr) - pxa_gpio_chip[i/32].chip.ngpio = gpio_nr - i; - gpiochip_add(&pxa_gpio_chip[i/32].chip); - } -} - /* * PXA GPIO edge detection for IRQs: * IRQs are generated on Falling-Edge, Rising-Edge, or both. @@ -309,9 +295,9 @@ static struct irq_chip pxa_muxed_gpio_chip = { .set_type = pxa_gpio_irq_type, }; -void __init pxa_init_irq_gpio(int gpio_nr) +void __init pxa_init_gpio(int gpio_nr, set_wake_t fn) { - int irq, i; + int irq, i, gpio; pxa_last_gpio = gpio_nr - 1; @@ -340,11 +326,15 @@ void __init pxa_init_irq_gpio(int gpio_nr) /* Install handler for GPIO>=2 edge detect interrupts */ set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); - pxa_init_gpio(gpio_nr); -} + pxa_low_gpio_chip.set_wake = fn; + pxa_muxed_gpio_chip.set_wake = fn; -void __init pxa_init_gpio_set_wake(int (*set_wake)(unsigned int, unsigned int)) -{ - pxa_low_gpio_chip.set_wake = set_wake; - pxa_muxed_gpio_chip.set_wake = set_wake; + /* add a GPIO chip for each register bank. + * the last PXA25x register only contains 21 GPIOs + */ + for (gpio = 0, i = 0; gpio < gpio_nr; gpio += 32, i++) { + if (gpio + 32 > gpio_nr) + pxa_gpio_chip[i].chip.ngpio = gpio_nr - gpio; + gpiochip_add(&pxa_gpio_chip[i].chip); + } } diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c index cccc3ed3c679..fbff557bb225 100644 --- a/arch/arm/mach-pxa/irq.c +++ b/arch/arm/mach-pxa/irq.c @@ -51,7 +51,7 @@ static struct irq_chip pxa_internal_irq_chip = { .unmask = pxa_unmask_irq, }; -void __init pxa_init_irq(int irq_nr) +void __init pxa_init_irq(int irq_nr, set_wake_t fn) { int irq; @@ -70,12 +70,8 @@ void __init pxa_init_irq(int irq_nr) set_irq_handler(irq, handle_level_irq); set_irq_flags(irq, IRQF_VALID); } -} -void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)) -{ - pxa_internal_irq_chip.set_wake = set_wake; - pxa_init_gpio_set_wake(set_wake); + pxa_internal_irq_chip.set_wake = fn; } #ifdef CONFIG_PM diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index bb0bf51f5039..653a3b63d073 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -267,9 +267,8 @@ set_pwer: void __init pxa25x_init_irq(void) { - pxa_init_irq(32); - pxa_init_irq_gpio(85); - pxa_init_irq_set_wake(pxa25x_set_wake); + pxa_init_irq(32, pxa25x_set_wake); + pxa_init_gpio(85, pxa25x_set_wake); } static struct platform_device *pxa25x_devices[] __initdata = { diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 54d8448cad7b..87ade40865f1 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -340,9 +340,8 @@ set_pwer: void __init pxa27x_init_irq(void) { - pxa_init_irq(34); - pxa_init_irq_gpio(128); - pxa_init_irq_set_wake(pxa27x_set_wake); + pxa_init_irq(34, pxa27x_set_wake); + pxa_init_gpio(128, pxa27x_set_wake); } /* diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 8f8179b2fc38..eedcec0bf3f0 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -494,15 +494,9 @@ static int pxa3xx_set_wake(unsigned int irq, unsigned int on) return 0; } - -static void pxa3xx_init_irq_pm(void) -{ - pxa_init_irq_set_wake(pxa3xx_set_wake); -} - #else static inline void pxa3xx_init_pm(void) {} -static inline void pxa3xx_init_irq_pm(void) {} +#define pxa3xx_set_wake NULL #endif void __init pxa3xx_init_irq(void) @@ -513,9 +507,8 @@ void __init pxa3xx_init_irq(void) value |= (1 << 6); __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); - pxa_init_irq(56); - pxa_init_irq_gpio(128); - pxa3xx_init_irq_pm(); + pxa_init_irq(56, pxa3xx_set_wake); + pxa_init_gpio(128, NULL); } /* -- cgit v1.2.3-59-g8ed1b From 4be35e236c4a0e346442d98de3e470cf87c4e947 Mon Sep 17 00:00:00 2001 From: eric miao Date: Mon, 4 Feb 2008 10:07:09 +0800 Subject: [ARM] pxa: move mfp sysdev registeration out for suspend/resume order MFP configurations after resume should be done before the GPIO registers are restored. Move the mfp sysdev registeration to the same place where GPIO and IRQ sysdev(s) are registered to better control the order. Signed-off-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/generic.h | 1 + arch/arm/mach-pxa/mfp-pxa3xx.c | 20 ++++++++++---------- arch/arm/mach-pxa/pxa3xx.c | 2 ++ 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h index bd2a2356d976..8bca89c4a256 100644 --- a/arch/arm/mach-pxa/generic.h +++ b/arch/arm/mach-pxa/generic.h @@ -55,3 +55,4 @@ extern unsigned pxa3xx_get_memclk_frequency_10khz(void); extern struct sysdev_class pxa_irq_sysclass; extern struct sysdev_class pxa_gpio_sysclass; +extern struct sysdev_class pxa3xx_mfp_sysclass; diff --git a/arch/arm/mach-pxa/mfp-pxa3xx.c b/arch/arm/mach-pxa/mfp-pxa3xx.c index f5809adce298..b84c3ba7a8d6 100644 --- a/arch/arm/mach-pxa/mfp-pxa3xx.c +++ b/arch/arm/mach-pxa/mfp-pxa3xx.c @@ -234,22 +234,22 @@ static int pxa3xx_mfp_resume(struct sys_device *d) return 0; } +#else +#define pxa3xx_mfp_suspend NULL +#define pxa3xx_mfp_resume NULL +#endif -static struct sysdev_class mfp_sysclass = { +struct sysdev_class pxa3xx_mfp_sysclass = { .name = "mfp", .suspend = pxa3xx_mfp_suspend, .resume = pxa3xx_mfp_resume, }; -static struct sys_device mfp_device = { - .id = 0, - .cls = &mfp_sysclass, -}; - static int __init mfp_init_devicefs(void) { - sysdev_class_register(&mfp_sysclass); - return sysdev_register(&mfp_device); + if (cpu_is_pxa3xx()) + return sysdev_class_register(&pxa3xx_mfp_sysclass); + + return 0; } -device_initcall(mfp_init_devicefs); -#endif +postcore_initcall(mfp_init_devicefs); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index eedcec0bf3f0..85b1df3f69c9 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -531,6 +531,8 @@ static struct platform_device *devices[] __initdata = { static struct sys_device pxa3xx_sysdev[] = { { .cls = &pxa_irq_sysclass, + }, { + .cls = &pxa3xx_mfp_sysclass, }, { .cls = &pxa_gpio_sysclass, }, -- cgit v1.2.3-59-g8ed1b From 37320980414f5a7654ee08a047194224c6bba46e Mon Sep 17 00:00:00 2001 From: eric miao Date: Wed, 23 Jan 2008 13:39:13 +0800 Subject: [ARM] pxa: add pxa27x_keypad device and pxa_set_keypad_info() also update the clk definitions in pxa27x and pxa3xx. Signed-off-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/devices.c | 26 ++++++++++++++++++++++++++ arch/arm/mach-pxa/devices.h | 1 + arch/arm/mach-pxa/pxa27x.c | 2 +- arch/arm/mach-pxa/pxa3xx.c | 1 + include/asm-arm/arch-pxa/pxa27x_keypad.h | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index bfccb80ac8ef..3665e242f1f9 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "devices.h" @@ -396,6 +397,31 @@ struct platform_device pxa25x_device_assp = { #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) +static struct resource pxa27x_resource_keypad[] = { + [0] = { + .start = 0x41500000, + .end = 0x4150004c, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_KEYPAD, + .end = IRQ_KEYPAD, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device pxa27x_device_keypad = { + .name = "pxa27x-keypad", + .id = -1, + .resource = pxa27x_resource_keypad, + .num_resources = ARRAY_SIZE(pxa27x_resource_keypad), +}; + +void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info) +{ + pxa_register_device(&pxa27x_device_keypad, info); +} + static u64 pxa27x_ohci_dma_mask = DMA_BIT_MASK(32); static struct resource pxa27x_resource_ohci[] = { diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index 96c7c8909068..fcab017f27ee 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h @@ -14,6 +14,7 @@ extern struct platform_device pxa_device_rtc; extern struct platform_device pxa27x_device_i2c_power; extern struct platform_device pxa27x_device_ohci; +extern struct platform_device pxa27x_device_keypad; extern struct platform_device pxa25x_device_ssp; extern struct platform_device pxa25x_device_nssp; diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index b230af22ae05..f910fe57fcc1 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -152,7 +152,7 @@ static struct clk pxa27x_clks[] = { INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev), INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), - INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), + INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 85b1df3f69c9..dc8d5ee9f286 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -233,6 +233,7 @@ static struct clk pxa3xx_clks[] = { PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), PXA3xx_CKEN("USBCLK", USBH, 48000000, 0, &pxa27x_device_ohci.dev), + PXA3xx_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev), PXA3xx_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev), PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), diff --git a/include/asm-arm/arch-pxa/pxa27x_keypad.h b/include/asm-arm/arch-pxa/pxa27x_keypad.h index 644f7609b523..d5a48a96dea7 100644 --- a/include/asm-arm/arch-pxa/pxa27x_keypad.h +++ b/include/asm-arm/arch-pxa/pxa27x_keypad.h @@ -53,4 +53,6 @@ struct pxa27x_keypad_platform_data { #define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val)) +extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info); + #endif /* __ASM_ARCH_PXA27x_KEYPAD_H */ -- cgit v1.2.3-59-g8ed1b From b86a5da8f7f57b9b0fe468d83d3f2af297fa1e14 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Apr 2008 11:32:21 +0100 Subject: [ARM] 4946/1: pxa3xx: Print an error if we refuse to suspend The PXA3xx will not suspend if there are no wakeup sources configured. Print a diagnostic message to make it easier for the user to see what's happening. Signed-off-by: Mark Brown Acked-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/pxa3xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index dc8d5ee9f286..604b68adc4ba 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -354,8 +354,10 @@ static void pxa3xx_cpu_pm_enter(suspend_state_t state) /* * Don't sleep if no wakeup sources are defined */ - if (wakeup_src == 0) + if (wakeup_src == 0) { + printk(KERN_ERR "Not suspending: no wakeup sources\n"); return; + } switch (state) { case PM_SUSPEND_STANDBY: -- cgit v1.2.3-59-g8ed1b From 1c104e0e4f6ab396960c058e95e18bdedcac945b Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 19 Apr 2008 10:59:24 +0100 Subject: [ARM] pxa: initialise PXA devices before platform init code Initialise PXA devices before platform initialisation, so that platforms can parent devices to these. Acked-by: eric miao Signed-off-by: Russell King --- arch/arm/mach-pxa/pxa25x.c | 2 +- arch/arm/mach-pxa/pxa27x.c | 2 +- arch/arm/mach-pxa/pxa3xx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'arch/arm/mach-pxa/pxa3xx.c') diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index c486c3055cfb..d9b5450aee5b 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -313,4 +313,4 @@ static int __init pxa25x_init(void) return ret; } -subsys_initcall(pxa25x_init); +postcore_initcall(pxa25x_init); diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index f910fe57fcc1..7a2449dd0fd4 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -396,4 +396,4 @@ static int __init pxa27x_init(void) return ret; } -subsys_initcall(pxa27x_init); +postcore_initcall(pxa27x_init); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 604b68adc4ba..dde355e88fa1 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -573,4 +573,4 @@ static int __init pxa3xx_init(void) return ret; } -subsys_initcall(pxa3xx_init); +postcore_initcall(pxa3xx_init); -- cgit v1.2.3-59-g8ed1b