From c7341d436a7a89dc26706386de0a301fc9dbe49a Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 1 Jun 2007 17:13:59 +0100 Subject: [PATCH 1/8] [ARM] 4392/2: Do not corrupt the SP register in compressed/head.S ARMv7 support code requires a valid stack for saving/restoring registers as the whole D-cache flushing function is more complex. This patch ensures that the SP register is not corrupted. Signed-off-by: Catalin Marinas Signed-off-by: Russell King --- arch/arm/boot/compressed/head.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 2568d311be21..23348e9561b9 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -247,7 +247,7 @@ not_relocated: mov r0, #0 mov r3, r7 bl decompress_kernel - add r0, r0, #127 + add r0, r0, #127 + 128 @ alignment + stack bic r0, r0, #127 @ align the kernel length /* * r0 = decompressed kernel length @@ -269,6 +269,7 @@ not_relocated: mov r0, #0 stmia r1!, {r9 - r14} cmp r2, r3 blo 1b + add sp, r1, #128 @ relocate the stack bl cache_clean_flush add pc, r5, r0 @ call relocation code @@ -476,6 +477,7 @@ __common_mmu_cache_on: */ .align 5 reloc_start: add r9, r5, r0 + sub r9, r9, #128 @ do not copy the stack debug_reloc_start mov r1, r4 1: @@ -486,6 +488,7 @@ reloc_start: add r9, r5, r0 cmp r5, r9 blo 1b + add sp, r1, #128 @ relocate the stack debug_reloc_end call_kernel: bl cache_clean_flush From 1f4b49a4293ea7b0adeaeae37207b9c9fd2dd7c2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 31 May 2007 09:29:33 +0100 Subject: [PATCH 2/8] [ARM] 4418/1: AT91: Number of programmable clocks differs The number of programmable clocks available on the AT91 processors can differ, therefore do not always display the contents of the PMC_PCKR(0) .. PMC_PCKR(3) registers (ie, assume there are 4 clocks). If CONFIG_AT91_PROGRAMMABLE_CLOCKS is enabled, the programmable clocks will be registered like the other system/peripheral clocks, and the state of the programmable clocks will be displayed like with the other clocks. Signed-off-by: Andrew Victor Signed-off-by: Russell King --- arch/arm/mach-at91/clock.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 06c9a0507d0d..848efb2a4ebf 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c @@ -364,19 +364,14 @@ static int at91_clk_show(struct seq_file *s, void *unused) { u32 scsr, pcsr, sr; struct clk *clk; - unsigned i; seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR)); seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR)); - seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); - seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); - for (i = 0; i < 4; i++) - seq_printf(s, "PCK%d = %8x\n", i, at91_sys_read(AT91_PMC_PCKR(i))); seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); seq_printf(s, "\n"); From b6b27ae5e85fb193c08448157943b187958b8ca2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 31 May 2007 09:34:53 +0100 Subject: [PATCH 3/8] [ARM] 4419/1: AT91: SAM9 USB clocks check for suspending When suspending to slow-clock mode, at91_pm_verify_clocks() is called to ensure that all the clocks are disabled or in the correct state. This patch replaces the "#warning TODO" messages for the SAM9 processors with the correct code. Signed-off-by: Andrew Victor Signed-off-by: Russell King --- arch/arm/mach-at91/pm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index ff8db29e989e..47ff676aca5f 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -76,12 +76,11 @@ static int at91_pm_verify_clocks(void) pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); return 0; } - } else if (cpu_is_at91sam9260()) { -#warning "Check SAM9260 USB clocks" - } else if (cpu_is_at91sam9261()) { -#warning "Check SAM9261 USB clocks" - } else if (cpu_is_at91sam9263()) { -#warning "Check SAM9263 USB clocks" + } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { + if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) { + pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); + return 0; + } } #ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS From 29c349d22ccda5678a7dfb732093dbd3befcefa3 Mon Sep 17 00:00:00 2001 From: Bill Gatliff Date: Thu, 31 May 2007 16:17:16 +0100 Subject: [PATCH 4/8] [ARM] 4422/1: Fix default value handling in gpio_direction_output (PXA) The default value passed through to pxa_gpio_mode() is lost due to a missing GPIO_DFLT_HIGH mask for nonzero values. The enclosed patch fixes this programming error. Signed-off-by: Bill Gatliff Signed-off-by: Russell King --- include/asm-arm/arch-pxa/gpio.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h index aeba24347f8e..9e99241f3edf 100644 --- a/include/asm-arm/arch-pxa/gpio.h +++ b/include/asm-arm/arch-pxa/gpio.h @@ -45,7 +45,8 @@ static inline int gpio_direction_input(unsigned gpio) static inline int gpio_direction_output(unsigned gpio, int value) { - return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW)); + return pxa_gpio_mode(gpio | GPIO_OUT | + (value ? GPIO_DFLT_HIGH : GPIO_DFLT_LOW)); } static inline int __gpio_get_value(unsigned gpio) From f72267c30f5a08f9a77c97417ec120e6943195f8 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 2 Jun 2007 15:36:37 +0100 Subject: [PATCH 5/8] [ARM] Solve buggy smp_processor_id() usage BUG: using smp_processor_id() in preemptible [00000001] code: opcontrol/427 Resolve this bug by ensuring that we're not using smp_processor_id() in a preemptable context (by disabling preemption.) Signed-off-by: Russell King --- arch/arm/oprofile/op_model_mpcore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c index 7791da791f5f..75bae067922d 100644 --- a/arch/arm/oprofile/op_model_mpcore.c +++ b/arch/arm/oprofile/op_model_mpcore.c @@ -200,8 +200,10 @@ static int em_call_function(int (*fn)(void)) data.fn = fn; data.ret = 0; + preempt_disable(); smp_call_function(em_func, &data, 1, 1); em_func(&data); + preempt_enable(); return data.ret; } From 0e5f82dda5e60a21cf8ba4f77334d60290277d2c Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Thu, 31 May 2007 10:16:00 +0100 Subject: [PATCH 6/8] [ARM] 4421/1: AT91: Value of _KEY fields. Use the actual value (0xA5) for the AT91_SHDW_KEY and AT91_WDT_KEY register fields instead of a bitmask. This is consistent with how AT91_RSTC_KEY is defined, and is easier to use in code. Signed-off-by: Andrew Victor Signed-off-by: Russell King --- include/asm-arm/arch-at91/at91_shdwc.h | 4 ++-- include/asm-arm/arch-at91/at91_wdt.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/asm-arm/arch-at91/at91_shdwc.h b/include/asm-arm/arch-at91/at91_shdwc.h index 795fcc266228..01b433de2272 100644 --- a/include/asm-arm/arch-at91/at91_shdwc.h +++ b/include/asm-arm/arch-at91/at91_shdwc.h @@ -14,8 +14,8 @@ #define AT91_SHDWC_H #define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */ -#define AT91_SHDW_SHDW (1 << 0) /* Processor Reset */ -#define AT91_SHDW_KEY (0xff << 24) /* KEY Password */ +#define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */ +#define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */ #define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */ #define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */ diff --git a/include/asm-arm/arch-at91/at91_wdt.h b/include/asm-arm/arch-at91/at91_wdt.h index 7251a344c740..1014e9bf181f 100644 --- a/include/asm-arm/arch-at91/at91_wdt.h +++ b/include/asm-arm/arch-at91/at91_wdt.h @@ -15,7 +15,7 @@ #define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ -#define AT91_WDT_KEY (0xff << 24) /* KEY Password */ +#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ #define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ From db002b8597df84643e949cce793d0f696f100c9e Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 5 Jun 2007 19:39:49 +0100 Subject: [PATCH 7/8] [ARM] Fix 4417/1: Serial: Fix AMBA drivers locking 2389b272168ceec056ca1d8a870a97fa9c26e11a contains a merge bug; fix it. Signed-off-by: Russell King --- drivers/serial/amba-pl010.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 00d1255e4c12..e88da72f8304 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c @@ -167,9 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap) ignore_char: status = readb(uap->port.membase + UART01x_FR); } - spin_unlock(&port->lock); + spin_unlock(&uap->port.lock); tty_flip_buffer_push(tty); - spin_lock(&port->lock); + spin_lock(&uap->port.lock); } static void pl010_tx_chars(struct uart_amba_port *uap) From c0f85a82484c25d23b44a87a35daddb2b276b4aa Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 5 Jun 2007 21:14:40 +0100 Subject: [PATCH 8/8] [ARM] pxa: fix pxa27x keyboard driver CKEN macro definitions no longer contains the bit number; remove it from usages in the pxa27x keyboard driver. Signed-off-by: Russell King --- drivers/input/keyboard/pxa27x_keyboard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c index 06eaf766d9d2..f9e82c9ca421 100644 --- a/drivers/input/keyboard/pxa27x_keyboard.c +++ b/drivers/input/keyboard/pxa27x_keyboard.c @@ -104,7 +104,7 @@ static int pxakbd_open(struct input_dev *dev) KPREC = 0x7F; /* Enable unit clock */ - pxa_set_cken(CKEN19_KEYPAD, 1); + pxa_set_cken(CKEN_KEYPAD, 1); return 0; } @@ -112,7 +112,7 @@ static int pxakbd_open(struct input_dev *dev) static void pxakbd_close(struct input_dev *dev) { /* Disable clock unit */ - pxa_set_cken(CKEN19_KEYPAD, 0); + pxa_set_cken(CKEN_KEYPAD, 0); } #ifdef CONFIG_PM @@ -185,7 +185,7 @@ static int __devinit pxakbd_probe(struct platform_device *pdev) DRIVER_NAME, pdev); if (error) { printk(KERN_ERR "Cannot request keypad IRQ\n"); - pxa_set_cken(CKEN19_KEYPAD, 0); + pxa_set_cken(CKEN_KEYPAD, 0); goto err_free_dev; }