Merge branch 'for-linus' of git://www.atmel.no/~hskinnemoen/linux/kernel/avr32

* 'for-linus' of git://www.atmel.no/~hskinnemoen/linux/kernel/avr32:
[AVR32] Implement platform hooks for atmel_lcdfb driver
[AVR32] Wire up signalfd, timerfd and eventfd
[AVR32] optimize pagefault path
[AVR32] Remove bogus comment in arch/avr32/kernel/irq.c

+161 -72
+15
arch/avr32/boards/atstk1000/atstk1000.h
··· 1 + /* 2 + * ATSTK1000 setup code: Daughterboard interface 3 + * 4 + * Copyright (C) 2007 Atmel Corporation 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + #ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H 11 + #define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H 12 + 13 + extern struct atmel_lcdfb_info atstk1000_lcdc_data; 14 + 15 + #endif /* __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H */
+5 -5
arch/avr32/boards/atstk1000/atstk1002.c
··· 16 16 #include <linux/types.h> 17 17 #include <linux/spi/spi.h> 18 18 19 + #include <video/atmel_lcdc.h> 20 + 19 21 #include <asm/io.h> 20 22 #include <asm/setup.h> 21 23 #include <asm/arch/at32ap7000.h> ··· 25 23 #include <asm/arch/init.h> 26 24 #include <asm/arch/portmux.h> 27 25 26 + #include "atstk1000.h" 28 27 29 28 #define SW2_DEFAULT /* MMCI and UART_A available */ 30 29 ··· 34 31 }; 35 32 36 33 static struct eth_addr __initdata hw_addr[2]; 37 - 38 34 static struct eth_platform_data __initdata eth_data[2]; 39 - static struct lcdc_platform_data atstk1000_fb0_data; 40 35 41 36 static struct spi_board_info spi0_board_info[] __initdata = { 42 37 { ··· 149 148 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 150 149 151 150 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); 152 - atstk1000_fb0_data.fbmem_start = fbmem_start; 153 - atstk1000_fb0_data.fbmem_size = fbmem_size; 154 - at32_add_device_lcdc(0, &atstk1000_fb0_data); 151 + at32_add_device_lcdc(0, &atstk1000_lcdc_data, 152 + fbmem_start, fbmem_size); 155 153 156 154 return 0; 157 155 }
+44 -1
arch/avr32/boards/atstk1000/setup.c
··· 8 8 * published by the Free Software Foundation. 9 9 */ 10 10 #include <linux/bootmem.h> 11 + #include <linux/fb.h> 11 12 #include <linux/init.h> 12 13 #include <linux/types.h> 13 14 #include <linux/linkage.h> 14 15 15 - #include <asm/setup.h> 16 + #include <video/atmel_lcdc.h> 16 17 18 + #include <asm/setup.h> 17 19 #include <asm/arch/board.h> 20 + 21 + #include "atstk1000.h" 18 22 19 23 /* Initialized by bootloader-specific startup code. */ 20 24 struct tag *bootloader_tags __initdata; 25 + 26 + static struct fb_videomode __initdata ltv350qv_modes[] = { 27 + { 28 + .name = "320x240 @ 75", 29 + .refresh = 75, 30 + .xres = 320, .yres = 240, 31 + .pixclock = KHZ2PICOS(6891), 32 + 33 + .left_margin = 17, .right_margin = 33, 34 + .upper_margin = 10, .lower_margin = 10, 35 + .hsync_len = 16, .vsync_len = 1, 36 + 37 + .sync = 0, 38 + .vmode = FB_VMODE_NONINTERLACED, 39 + }, 40 + }; 41 + 42 + static struct fb_monspecs __initdata atstk1000_default_monspecs = { 43 + .manufacturer = "SNG", 44 + .monitor = "LTV350QV", 45 + .modedb = ltv350qv_modes, 46 + .modedb_len = ARRAY_SIZE(ltv350qv_modes), 47 + .hfmin = 14820, 48 + .hfmax = 22230, 49 + .vfmin = 60, 50 + .vfmax = 90, 51 + .dclkmax = 30000000, 52 + }; 53 + 54 + struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = { 55 + .default_bpp = 24, 56 + .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, 57 + .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT 58 + | ATMEL_LCDC_INVCLK 59 + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE 60 + | ATMEL_LCDC_MEMOR_BIG), 61 + .default_monspecs = &atstk1000_default_monspecs, 62 + .guard_time = 2, 63 + };
-9
arch/avr32/kernel/irq.c
··· 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License version 2 as 9 9 * published by the Free Software Foundation. 10 - * 11 - * This file contains the code used by various IRQ handling routines: 12 - * asking for different IRQ's should be done through these routines 13 - * instead of just grabbing them. Thus setups with different IRQ numbers 14 - * shouldn't result in any weird surprises, and installing new handlers 15 - * should be easier. 16 - * 17 - * IRQ's are in fact implemented a bit like signal handlers for the kernel. 18 - * Naturally it's not a 1:1 relation, but there are similarities. 19 10 */ 20 11 21 12 #include <linux/interrupt.h>
+1 -6
arch/avr32/kernel/kprobes.c
··· 179 179 return 1; 180 180 } 181 181 182 - static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 182 + int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 183 183 { 184 184 struct kprobe *cur = kprobe_running(); 185 185 ··· 214 214 break; 215 215 case DIE_SSTEP: 216 216 if (post_kprobe_handler(args->regs)) 217 - ret = NOTIFY_STOP; 218 - break; 219 - case DIE_FAULT: 220 - if (kprobe_running() 221 - && kprobe_fault_handler(args->regs, args->trapnr)) 222 217 ret = NOTIFY_STOP; 223 218 break; 224 219 default:
+3
arch/avr32/kernel/syscall_table.S
··· 292 292 .long sys_shmdt 293 293 .long sys_shmctl 294 294 .long sys_utimensat 295 + .long sys_signalfd 296 + .long sys_timerfd /* 280 */ 297 + .long sys_eventfd 295 298 .long sys_ni_syscall /* r8 is saturated at nr_syscalls */
+60 -17
arch/avr32/mach-at32ap/at32ap7000.c
··· 6 6 * published by the Free Software Foundation. 7 7 */ 8 8 #include <linux/clk.h> 9 + #include <linux/fb.h> 9 10 #include <linux/init.h> 10 11 #include <linux/platform_device.h> 11 12 #include <linux/spi/spi.h> ··· 17 16 #include <asm/arch/board.h> 18 17 #include <asm/arch/portmux.h> 19 18 #include <asm/arch/sm.h> 19 + 20 + #include <video/atmel_lcdc.h> 20 21 21 22 #include "clock.h" 22 23 #include "hmatrix.h" ··· 884 881 /* -------------------------------------------------------------------- 885 882 * LCDC 886 883 * -------------------------------------------------------------------- */ 887 - static struct lcdc_platform_data lcdc0_data; 888 - static struct resource lcdc0_resource[] = { 884 + static struct atmel_lcdfb_info atmel_lcdfb0_data; 885 + static struct resource atmel_lcdfb0_resource[] = { 889 886 { 890 887 .start = 0xff000000, 891 888 .end = 0xff000fff, 892 889 .flags = IORESOURCE_MEM, 893 890 }, 894 891 IRQ(1), 892 + { 893 + /* Placeholder for pre-allocated fb memory */ 894 + .start = 0x00000000, 895 + .end = 0x00000000, 896 + .flags = 0, 897 + }, 895 898 }; 896 - DEFINE_DEV_DATA(lcdc, 0); 897 - DEV_CLK(hclk, lcdc0, hsb, 7); 898 - static struct clk lcdc0_pixclk = { 899 - .name = "pixclk", 900 - .dev = &lcdc0_device.dev, 899 + DEFINE_DEV_DATA(atmel_lcdfb, 0); 900 + DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); 901 + static struct clk atmel_lcdfb0_pixclk = { 902 + .name = "lcdc_clk", 903 + .dev = &atmel_lcdfb0_device.dev, 901 904 .mode = genclk_mode, 902 905 .get_rate = genclk_get_rate, 903 906 .set_rate = genclk_set_rate, ··· 912 903 }; 913 904 914 905 struct platform_device *__init 915 - at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data) 906 + at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 907 + unsigned long fbmem_start, unsigned long fbmem_len) 916 908 { 917 909 struct platform_device *pdev; 910 + struct atmel_lcdfb_info *info; 911 + struct fb_monspecs *monspecs; 912 + struct fb_videomode *modedb; 913 + unsigned int modedb_size; 914 + 915 + /* 916 + * Do a deep copy of the fb data, monspecs and modedb. Make 917 + * sure all allocations are done before setting up the 918 + * portmux. 919 + */ 920 + monspecs = kmemdup(data->default_monspecs, 921 + sizeof(struct fb_monspecs), GFP_KERNEL); 922 + if (!monspecs) 923 + return NULL; 924 + 925 + modedb_size = sizeof(struct fb_videomode) * monspecs->modedb_len; 926 + modedb = kmemdup(monspecs->modedb, modedb_size, GFP_KERNEL); 927 + if (!modedb) 928 + goto err_dup_modedb; 929 + monspecs->modedb = modedb; 918 930 919 931 switch (id) { 920 932 case 0: 921 - pdev = &lcdc0_device; 933 + pdev = &atmel_lcdfb0_device; 922 934 select_peripheral(PC(19), PERIPH_A, 0); /* CC */ 923 935 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ 924 936 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ ··· 972 942 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ 973 943 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ 974 944 975 - clk_set_parent(&lcdc0_pixclk, &pll0); 976 - clk_set_rate(&lcdc0_pixclk, clk_get_rate(&pll0)); 945 + clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); 946 + clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); 977 947 break; 978 948 979 949 default: 980 - return NULL; 950 + goto err_invalid_id; 981 951 } 982 952 983 - memcpy(pdev->dev.platform_data, data, 984 - sizeof(struct lcdc_platform_data)); 953 + if (fbmem_len) { 954 + pdev->resource[2].start = fbmem_start; 955 + pdev->resource[2].end = fbmem_start + fbmem_len - 1; 956 + pdev->resource[2].flags = IORESOURCE_MEM; 957 + } 958 + 959 + info = pdev->dev.platform_data; 960 + memcpy(info, data, sizeof(struct atmel_lcdfb_info)); 961 + info->default_monspecs = monspecs; 985 962 986 963 platform_device_register(pdev); 987 964 return pdev; 965 + 966 + err_invalid_id: 967 + kfree(modedb); 968 + err_dup_modedb: 969 + kfree(monspecs); 970 + return NULL; 988 971 } 989 972 990 973 /* -------------------------------------------------------------------- ··· 1080 1037 &macb1_pclk, 1081 1038 &atmel_spi0_spi_clk, 1082 1039 &atmel_spi1_spi_clk, 1083 - &lcdc0_hclk, 1084 - &lcdc0_pixclk, 1040 + &atmel_lcdfb0_hck1, 1041 + &atmel_lcdfb0_pixclk, 1085 1042 &gclk0, 1086 1043 &gclk1, 1087 1044 &gclk2, ··· 1120 1077 genclk_init_parent(&gclk2); 1121 1078 genclk_init_parent(&gclk3); 1122 1079 genclk_init_parent(&gclk4); 1123 - genclk_init_parent(&lcdc0_pixclk); 1080 + genclk_init_parent(&atmel_lcdfb0_pixclk); 1124 1081 1125 1082 /* 1126 1083 * Turn on all clocks that have at least one user already, and
+12 -24
arch/avr32/mm/fault.c
··· 12 12 #include <linux/mm.h> 13 13 #include <linux/module.h> 14 14 #include <linux/pagemap.h> 15 - 16 15 #include <linux/kdebug.h> 16 + #include <linux/kprobes.h> 17 + 17 18 #include <asm/mmu_context.h> 18 19 #include <asm/sysreg.h> 19 20 #include <asm/tlb.h> 20 21 #include <asm/uaccess.h> 21 22 22 23 #ifdef CONFIG_KPROBES 23 - ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 24 - 25 - /* Hook to register for page fault notifications */ 26 - int register_page_fault_notifier(struct notifier_block *nb) 24 + static inline int notify_page_fault(struct pt_regs *regs, int trap) 27 25 { 28 - return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 29 - } 26 + int ret = 0; 30 27 31 - int unregister_page_fault_notifier(struct notifier_block *nb) 32 - { 33 - return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb); 34 - } 28 + if (!user_mode(regs)) { 29 + if (kprobe_running() && kprobe_fault_handler(regs, trap)) 30 + ret = 1; 31 + } 35 32 36 - static inline int notify_page_fault(enum die_val val, struct pt_regs *regs, 37 - int trap, int sig) 38 - { 39 - struct die_args args = { 40 - .regs = regs, 41 - .trapnr = trap, 42 - }; 43 - return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 33 + return ret; 44 34 } 45 35 #else 46 - static inline int notify_page_fault(enum die_val val, struct pt_regs *regs, 47 - int trap, int sig) 36 + static inline int notify_page_fault(struct pt_regs *regs, int trap) 48 37 { 49 - return NOTIFY_DONE; 38 + return 0; 50 39 } 51 40 #endif 52 41 ··· 65 76 long signr; 66 77 int code; 67 78 68 - if (notify_page_fault(DIE_PAGE_FAULT, regs, 69 - ecr, SIGSEGV) == NOTIFY_STOP) 79 + if (notify_page_fault(regs, ecr)) 70 80 return; 71 81 72 82 address = sysreg_read(TLBEAR);
+3 -5
include/asm-avr32/arch-at32ap/board.h
··· 30 30 struct platform_device * 31 31 at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); 32 32 33 - struct lcdc_platform_data { 34 - unsigned long fbmem_start; 35 - unsigned long fbmem_size; 36 - }; 33 + struct atmel_lcdfb_info; 37 34 struct platform_device * 38 - at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data); 35 + at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 36 + unsigned long fbmem_start, unsigned long fbmem_len); 39 37 40 38 #endif /* __ASM_ARCH_BOARD_H */
+13 -4
include/asm-avr32/kdebug.h
··· 5 5 6 6 /* Grossly misnamed. */ 7 7 enum die_val { 8 - DIE_FAULT, 9 8 DIE_BREAKPOINT, 10 9 DIE_SSTEP, 11 - DIE_PAGE_FAULT, 12 10 }; 13 11 14 - int register_page_fault_notifier(struct notifier_block *nb); 15 - int unregister_page_fault_notifier(struct notifier_block *nb); 12 + /* 13 + * These are only here because kprobes.c wants them to implement a 14 + * blatant layering violation. Will hopefully go away soon once all 15 + * architectures are updated. 16 + */ 17 + static inline int register_page_fault_notifier(struct notifier_block *nb) 18 + { 19 + return 0; 20 + } 21 + static inline int unregister_page_fault_notifier(struct notifier_block *nb) 22 + { 23 + return 0; 24 + } 16 25 17 26 #endif /* __ASM_AVR32_KDEBUG_H */
+1
include/asm-avr32/kprobes.h
··· 26 26 kprobe_opcode_t insn[MAX_INSN_SIZE]; 27 27 }; 28 28 29 + extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 29 30 extern int kprobe_exceptions_notify(struct notifier_block *self, 30 31 unsigned long val, void *data); 31 32
+4 -1
include/asm-avr32/unistd.h
··· 296 296 #define __NR_shmctl 277 297 297 298 298 #define __NR_utimensat 278 299 + #define __NR_signalfd 279 300 + #define __NR_timerfd 280 301 + #define __NR_eventfd 281 299 302 300 303 #ifdef __KERNEL__ 301 - #define NR_syscalls 279 304 + #define NR_syscalls 282 302 305 303 306 304 307 #define __ARCH_WANT_IPC_PARSE_VERSION