From e48a411fa097c386c6081f4ed5a952aa3e21ca2b Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 11 Feb 2008 16:55:19 +0100 Subject: AVR32: Define PAGE_SHARED The virtual framebuffer driver needs PAGE_SHARED, which is not defined on avr32. Define it. Reported-by: Oliver Zander Signed-off-by: Haavard Skinnemoen --- include/asm-avr32/pgtable.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h index 018f6e2a0242..3ae7b548fce7 100644 --- a/include/asm-avr32/pgtable.h +++ b/include/asm-avr32/pgtable.h @@ -157,6 +157,7 @@ extern struct page *empty_zero_page; #define _PAGE_S(x) _PAGE_NORMAL(x) #define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ) +#define PAGE_SHARED _PAGE_S(PAGE_WRITE | PAGE_READ) #ifndef __ASSEMBLY__ /* -- cgit v1.2.3 From 32019828d9012e584017a824f84798248c0060dd Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Wed, 13 Feb 2008 12:32:34 +0100 Subject: avr32: Fix broken pte dump code in do_page_fault() The per-task page tables only cover the first 2GiB of the address space. For kernel addresses, we need to do the lookup in init's page tables. This is a temporary workaround until we modify the per-task page tables to cover the whole 4GiB address space. Signed-off-by: Haavard Skinnemoen --- arch/avr32/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c index 6560cb18b4e3..ce4e4296b954 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c @@ -189,6 +189,8 @@ no_context: page = sysreg_read(PTBR); printk(KERN_ALERT "ptbr = %08lx", page); + if (address >= TASK_SIZE) + page = (unsigned long)swapper_pg_dir; if (page) { page = ((unsigned long *)page)[address >> 22]; printk(" pgd = %08lx", page); -- cgit v1.2.3 From f059267e7fa9e3efa1498eb963ba18ec25665c42 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Wed, 13 Feb 2008 14:29:30 +0100 Subject: avr32: Use correct config symbol in atstk1004 board code CONFIG_BOARD_ATSTK1002_SW2_CUSTOM should be CONFIG_BOARD_ATSTK100X_SW2_CUSTOM. Spotted by Robert P. J. Day. Signed-off-by: Haavard Skinnemoen --- arch/avr32/boards/atstk1000/atstk1004.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c index 5a77030e07a0..e765a8652b3e 100644 --- a/arch/avr32/boards/atstk1000/atstk1004.c +++ b/arch/avr32/boards/atstk1000/atstk1004.c @@ -129,7 +129,7 @@ static int __init atstk1004_init(void) #ifdef CONFIG_BOARD_ATSTK100X_SPI1 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); #endif -#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM +#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM at32_add_device_mci(0); #endif at32_add_device_lcdc(0, &atstk1000_lcdc_data, -- cgit v1.2.3 From afe9418f6c2348054a4e61746894c0b262f0bdf3 Mon Sep 17 00:00:00 2001 From: Hans-Christian Egtvedt Date: Tue, 4 Dec 2007 13:15:41 +0100 Subject: Generate raw keyboard codes for AVR32 architecture This patchs adds the AVR32 architecture to the list of archs to generate a table of raw keyboard keycodes. Signed-off-by: Hans-Christian Egtvedt Signed-off-by: Haavard Skinnemoen --- drivers/char/keyboard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 4dbd3425e928..9769bf8279a6 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -1033,7 +1033,8 @@ DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0); #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ - (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) + (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) ||\ + defined(CONFIG_AVR32) #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) -- cgit v1.2.3 From ae6a6cd7fad6780f9a49bd433743d31250fa17c7 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Sun, 3 Feb 2008 14:22:18 +0300 Subject: avr32: cleanup - use _AC macro to define PAGE_SIZE PAGE_SIZE is used both from assembly and C code. We want to have type specifiers when using it from C, but this will make the assembler confused, so we need to make it conditional. This is exactly what the _AC macro is for, so using it allows us to get rid of a few lines of cpp noise. Signed-off-by: Cyrill Gorcunov Signed-off-by: Haavard Skinnemoen --- include/asm-avr32/page.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h index 5582968feee8..cbbc5ca9728b 100644 --- a/include/asm-avr32/page.h +++ b/include/asm-avr32/page.h @@ -8,13 +8,11 @@ #ifndef __ASM_AVR32_PAGE_H #define __ASM_AVR32_PAGE_H +#include + /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 -#ifdef __ASSEMBLY__ -#define PAGE_SIZE (1 << PAGE_SHIFT) -#else -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#endif +#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define PTE_MASK PAGE_MASK -- cgit v1.2.3 From fbfe1e32ca20e73c240bc8883dd3fad129b40dba Mon Sep 17 00:00:00 2001 From: Ben Nizette Date: Thu, 7 Feb 2008 15:28:57 +1100 Subject: avr32: pass i2c board info through at32_add_device_twi New-style I2C drivers require that motherboard-mounted I2C devices are registered with the I2C core, typically at arch_initcall time. This can be done nice and neat by passing the struct i2c_board_info[] through at32_add_device_twi just like we do for the SPI board info. While we've got the hood up, remove a duplicate declaration of at32_add_device_twi() in board.h. [hskinnemoen@atmel.com: add missing i2c_board_info forward-declaration] Signed-Off-By: Ben Nizette Signed-off-by: Haavard Skinnemoen --- arch/avr32/mach-at32ap/at32ap700x.c | 7 ++++++- include/asm-avr32/arch-at32ap/board.h | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 7678fee9a885..82d70169c0e0 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c @@ -989,7 +989,9 @@ static struct clk atmel_twi0_pclk = { .index = 2, }; -struct platform_device *__init at32_add_device_twi(unsigned int id) +struct platform_device *__init at32_add_device_twi(unsigned int id, + struct i2c_board_info *b, + unsigned int n) { struct platform_device *pdev; @@ -1009,6 +1011,9 @@ struct platform_device *__init at32_add_device_twi(unsigned int id) atmel_twi0_pclk.dev = &pdev->dev; + if (b) + i2c_register_board_info(id, b, n); + platform_device_add(pdev); return pdev; diff --git a/include/asm-avr32/arch-at32ap/board.h b/include/asm-avr32/arch-at32ap/board.h index 7597b0bd2f01..e09bbd512926 100644 --- a/include/asm-avr32/arch-at32ap/board.h +++ b/include/asm-avr32/arch-at32ap/board.h @@ -68,7 +68,10 @@ struct platform_device *at32_add_device_pwm(u32 mask); struct platform_device * at32_add_device_ssc(unsigned int id, unsigned int flags); -struct platform_device *at32_add_device_twi(unsigned int id); +struct i2c_board_info; +struct platform_device *at32_add_device_twi(unsigned int id, + struct i2c_board_info *b, + unsigned int n); struct platform_device *at32_add_device_mci(unsigned int id); struct platform_device *at32_add_device_ac97c(unsigned int id); struct platform_device *at32_add_device_abdac(unsigned int id); -- cgit v1.2.3 From 486a068472a410e1c29b645f15f03887a755a827 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 11 Feb 2008 22:46:19 +0100 Subject: avr32: Use better asm constraint in prefetch() The pref instruction takes a displacement. Use it. Signed-off-by: Haavard Skinnemoen --- include/asm-avr32/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h index 49a88f5a9d2f..2abd3de6b4b4 100644 --- a/include/asm-avr32/processor.h +++ b/include/asm-avr32/processor.h @@ -169,7 +169,7 @@ extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp, static inline void prefetch(const void *x) { const char *c = x; - asm volatile("pref %0" : : "r"(c)); + asm volatile("pref %0" : : "RKs16"(*c)); } #define PREFETCH_STRIDE L1_CACHE_BYTES -- cgit v1.2.3 From 86cd9968dd574ff05c60d7f945d5098ca8553f2b Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 12 Feb 2008 14:45:49 -0800 Subject: avr32: start clocksource cleanup Start cleaning up the AVR32 clocksource mess, starting with the cycle counter clocksource: remove unneeded pseudo-RTC (just inline that call to mktime) and associated build warning, and unused sysdev. Add comment about the problem using the cycle counter register, and adjust the clocksource rating accordingly. Later patches can make this usable again (by disabling use of the idle state and providing a proper clocksource without the weak binding hacks) and move towards TCB-based clockevent support (including high resolution timers) that's shared between AT91 and AVR32. Signed-off-by: David Brownell Signed-off-by: Haavard Skinnemoen --- arch/avr32/kernel/time.c | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c index 36a46c3ae308..bf2f762e6a47 100644 --- a/arch/avr32/kernel/time.c +++ b/arch/avr32/kernel/time.c @@ -38,9 +38,15 @@ cycle_t __weak read_cycle_count(void) return (cycle_t)sysreg_read(COUNT); } +/* + * The architectural cycle count registers are a fine clocksource unless + * the system idle loop use sleep states like "idle": the CPU cycles + * measured by COUNT (and COMPARE) don't happen during sleep states. + * So we rate the clocksource using COUNT as very low quality. + */ struct clocksource __weak clocksource_avr32 = { .name = "avr32", - .rating = 350, + .rating = 50, .read = read_cycle_count, .mask = CLOCKSOURCE_MASK(32), .shift = 16, @@ -55,22 +61,6 @@ struct irqaction timer_irqaction = { .name = "timer", }; -/* - * By default we provide the null RTC ops - */ -static unsigned long null_rtc_get_time(void) -{ - return mktime(2007, 1, 1, 0, 0, 0); -} - -static int null_rtc_set_time(unsigned long sec) -{ - return 0; -} - -static unsigned long (*rtc_get_time)(void) = null_rtc_get_time; -static int (*rtc_set_time)(unsigned long) = null_rtc_set_time; - static void avr32_timer_ack(void) { u32 count; @@ -190,7 +180,7 @@ void __init time_init(void) */ sysreg_write(COMPARE, 0); - xtime.tv_sec = rtc_get_time(); + xtime.tv_sec = mktime(2007, 1, 1, 0, 0, 0); xtime.tv_nsec = 0; set_normalized_timespec(&wall_to_monotonic, @@ -212,22 +202,3 @@ void __init time_init(void) return; } } - -static struct sysdev_class timer_class = { - .name = "timer", -}; - -static struct sys_device timer_device = { - .id = 0, - .cls = &timer_class, -}; - -static int __init init_timer_sysfs(void) -{ - int err = sysdev_class_register(&timer_class); - if (!err) - err = sysdev_register(&timer_device); - return err; -} - -device_initcall(init_timer_sysfs); -- cgit v1.2.3