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 #include <linux/types.h> 17 #include <linux/spi/spi.h> 18 19 #include <asm/io.h> 20 #include <asm/setup.h> 21 #include <asm/arch/at32ap7000.h> ··· 25 #include <asm/arch/init.h> 26 #include <asm/arch/portmux.h> 27 28 29 #define SW2_DEFAULT /* MMCI and UART_A available */ 30 ··· 34 }; 35 36 static struct eth_addr __initdata hw_addr[2]; 37 - 38 static struct eth_platform_data __initdata eth_data[2]; 39 - static struct lcdc_platform_data atstk1000_fb0_data; 40 41 static struct spi_board_info spi0_board_info[] __initdata = { 42 { ··· 149 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 150 151 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); 155 156 return 0; 157 }
··· 16 #include <linux/types.h> 17 #include <linux/spi/spi.h> 18 19 + #include <video/atmel_lcdc.h> 20 + 21 #include <asm/io.h> 22 #include <asm/setup.h> 23 #include <asm/arch/at32ap7000.h> ··· 23 #include <asm/arch/init.h> 24 #include <asm/arch/portmux.h> 25 26 + #include "atstk1000.h" 27 28 #define SW2_DEFAULT /* MMCI and UART_A available */ 29 ··· 31 }; 32 33 static struct eth_addr __initdata hw_addr[2]; 34 static struct eth_platform_data __initdata eth_data[2]; 35 36 static struct spi_board_info spi0_board_info[] __initdata = { 37 { ··· 148 set_hw_addr(at32_add_device_eth(0, &eth_data[0])); 149 150 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); 151 + at32_add_device_lcdc(0, &atstk1000_lcdc_data, 152 + fbmem_start, fbmem_size); 153 154 return 0; 155 }
+44 -1
arch/avr32/boards/atstk1000/setup.c
··· 8 * published by the Free Software Foundation. 9 */ 10 #include <linux/bootmem.h> 11 #include <linux/init.h> 12 #include <linux/types.h> 13 #include <linux/linkage.h> 14 15 - #include <asm/setup.h> 16 17 #include <asm/arch/board.h> 18 19 /* Initialized by bootloader-specific startup code. */ 20 struct tag *bootloader_tags __initdata;
··· 8 * published by the Free Software Foundation. 9 */ 10 #include <linux/bootmem.h> 11 + #include <linux/fb.h> 12 #include <linux/init.h> 13 #include <linux/types.h> 14 #include <linux/linkage.h> 15 16 + #include <video/atmel_lcdc.h> 17 18 + #include <asm/setup.h> 19 #include <asm/arch/board.h> 20 + 21 + #include "atstk1000.h" 22 23 /* Initialized by bootloader-specific startup code. */ 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 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 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 */ 20 21 #include <linux/interrupt.h>
··· 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 */ 11 12 #include <linux/interrupt.h>
+1 -6
arch/avr32/kernel/kprobes.c
··· 179 return 1; 180 } 181 182 - static int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 183 { 184 struct kprobe *cur = kprobe_running(); 185 ··· 214 break; 215 case DIE_SSTEP: 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 ret = NOTIFY_STOP; 223 break; 224 default:
··· 179 return 1; 180 } 181 182 + int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 183 { 184 struct kprobe *cur = kprobe_running(); 185 ··· 214 break; 215 case DIE_SSTEP: 216 if (post_kprobe_handler(args->regs)) 217 ret = NOTIFY_STOP; 218 break; 219 default:
+3
arch/avr32/kernel/syscall_table.S
··· 292 .long sys_shmdt 293 .long sys_shmctl 294 .long sys_utimensat 295 .long sys_ni_syscall /* r8 is saturated at nr_syscalls */
··· 292 .long sys_shmdt 293 .long sys_shmctl 294 .long sys_utimensat 295 + .long sys_signalfd 296 + .long sys_timerfd /* 280 */ 297 + .long sys_eventfd 298 .long sys_ni_syscall /* r8 is saturated at nr_syscalls */
+60 -17
arch/avr32/mach-at32ap/at32ap7000.c
··· 6 * published by the Free Software Foundation. 7 */ 8 #include <linux/clk.h> 9 #include <linux/init.h> 10 #include <linux/platform_device.h> 11 #include <linux/spi/spi.h> ··· 17 #include <asm/arch/board.h> 18 #include <asm/arch/portmux.h> 19 #include <asm/arch/sm.h> 20 21 #include "clock.h" 22 #include "hmatrix.h" ··· 884 /* -------------------------------------------------------------------- 885 * LCDC 886 * -------------------------------------------------------------------- */ 887 - static struct lcdc_platform_data lcdc0_data; 888 - static struct resource lcdc0_resource[] = { 889 { 890 .start = 0xff000000, 891 .end = 0xff000fff, 892 .flags = IORESOURCE_MEM, 893 }, 894 IRQ(1), 895 }; 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, 901 .mode = genclk_mode, 902 .get_rate = genclk_get_rate, 903 .set_rate = genclk_set_rate, ··· 912 }; 913 914 struct platform_device *__init 915 - at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data) 916 { 917 struct platform_device *pdev; 918 919 switch (id) { 920 case 0: 921 - pdev = &lcdc0_device; 922 select_peripheral(PC(19), PERIPH_A, 0); /* CC */ 923 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ 924 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ ··· 972 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ 973 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ 974 975 - clk_set_parent(&lcdc0_pixclk, &pll0); 976 - clk_set_rate(&lcdc0_pixclk, clk_get_rate(&pll0)); 977 break; 978 979 default: 980 - return NULL; 981 } 982 983 - memcpy(pdev->dev.platform_data, data, 984 - sizeof(struct lcdc_platform_data)); 985 986 platform_device_register(pdev); 987 return pdev; 988 } 989 990 /* -------------------------------------------------------------------- ··· 1080 &macb1_pclk, 1081 &atmel_spi0_spi_clk, 1082 &atmel_spi1_spi_clk, 1083 - &lcdc0_hclk, 1084 - &lcdc0_pixclk, 1085 &gclk0, 1086 &gclk1, 1087 &gclk2, ··· 1120 genclk_init_parent(&gclk2); 1121 genclk_init_parent(&gclk3); 1122 genclk_init_parent(&gclk4); 1123 - genclk_init_parent(&lcdc0_pixclk); 1124 1125 /* 1126 * Turn on all clocks that have at least one user already, and
··· 6 * published by the Free Software Foundation. 7 */ 8 #include <linux/clk.h> 9 + #include <linux/fb.h> 10 #include <linux/init.h> 11 #include <linux/platform_device.h> 12 #include <linux/spi/spi.h> ··· 16 #include <asm/arch/board.h> 17 #include <asm/arch/portmux.h> 18 #include <asm/arch/sm.h> 19 + 20 + #include <video/atmel_lcdc.h> 21 22 #include "clock.h" 23 #include "hmatrix.h" ··· 881 /* -------------------------------------------------------------------- 882 * LCDC 883 * -------------------------------------------------------------------- */ 884 + static struct atmel_lcdfb_info atmel_lcdfb0_data; 885 + static struct resource atmel_lcdfb0_resource[] = { 886 { 887 .start = 0xff000000, 888 .end = 0xff000fff, 889 .flags = IORESOURCE_MEM, 890 }, 891 IRQ(1), 892 + { 893 + /* Placeholder for pre-allocated fb memory */ 894 + .start = 0x00000000, 895 + .end = 0x00000000, 896 + .flags = 0, 897 + }, 898 }; 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, 904 .mode = genclk_mode, 905 .get_rate = genclk_get_rate, 906 .set_rate = genclk_set_rate, ··· 903 }; 904 905 struct platform_device *__init 906 + at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 907 + unsigned long fbmem_start, unsigned long fbmem_len) 908 { 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; 930 931 switch (id) { 932 case 0: 933 + pdev = &atmel_lcdfb0_device; 934 select_peripheral(PC(19), PERIPH_A, 0); /* CC */ 935 select_peripheral(PC(20), PERIPH_A, 0); /* HSYNC */ 936 select_peripheral(PC(21), PERIPH_A, 0); /* PCLK */ ··· 942 select_peripheral(PD(16), PERIPH_A, 0); /* DATA22 */ 943 select_peripheral(PD(17), PERIPH_A, 0); /* DATA23 */ 944 945 + clk_set_parent(&atmel_lcdfb0_pixclk, &pll0); 946 + clk_set_rate(&atmel_lcdfb0_pixclk, clk_get_rate(&pll0)); 947 break; 948 949 default: 950 + goto err_invalid_id; 951 } 952 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; 962 963 platform_device_register(pdev); 964 return pdev; 965 + 966 + err_invalid_id: 967 + kfree(modedb); 968 + err_dup_modedb: 969 + kfree(monspecs); 970 + return NULL; 971 } 972 973 /* -------------------------------------------------------------------- ··· 1037 &macb1_pclk, 1038 &atmel_spi0_spi_clk, 1039 &atmel_spi1_spi_clk, 1040 + &atmel_lcdfb0_hck1, 1041 + &atmel_lcdfb0_pixclk, 1042 &gclk0, 1043 &gclk1, 1044 &gclk2, ··· 1077 genclk_init_parent(&gclk2); 1078 genclk_init_parent(&gclk3); 1079 genclk_init_parent(&gclk4); 1080 + genclk_init_parent(&atmel_lcdfb0_pixclk); 1081 1082 /* 1083 * Turn on all clocks that have at least one user already, and
+12 -24
arch/avr32/mm/fault.c
··· 12 #include <linux/mm.h> 13 #include <linux/module.h> 14 #include <linux/pagemap.h> 15 - 16 #include <linux/kdebug.h> 17 #include <asm/mmu_context.h> 18 #include <asm/sysreg.h> 19 #include <asm/tlb.h> 20 #include <asm/uaccess.h> 21 22 #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) 27 { 28 - return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 29 - } 30 31 - int unregister_page_fault_notifier(struct notifier_block *nb) 32 - { 33 - return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb); 34 - } 35 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); 44 } 45 #else 46 - static inline int notify_page_fault(enum die_val val, struct pt_regs *regs, 47 - int trap, int sig) 48 { 49 - return NOTIFY_DONE; 50 } 51 #endif 52 ··· 65 long signr; 66 int code; 67 68 - if (notify_page_fault(DIE_PAGE_FAULT, regs, 69 - ecr, SIGSEGV) == NOTIFY_STOP) 70 return; 71 72 address = sysreg_read(TLBEAR);
··· 12 #include <linux/mm.h> 13 #include <linux/module.h> 14 #include <linux/pagemap.h> 15 #include <linux/kdebug.h> 16 + #include <linux/kprobes.h> 17 + 18 #include <asm/mmu_context.h> 19 #include <asm/sysreg.h> 20 #include <asm/tlb.h> 21 #include <asm/uaccess.h> 22 23 #ifdef CONFIG_KPROBES 24 + static inline int notify_page_fault(struct pt_regs *regs, int trap) 25 { 26 + int ret = 0; 27 28 + if (!user_mode(regs)) { 29 + if (kprobe_running() && kprobe_fault_handler(regs, trap)) 30 + ret = 1; 31 + } 32 33 + return ret; 34 } 35 #else 36 + static inline int notify_page_fault(struct pt_regs *regs, int trap) 37 { 38 + return 0; 39 } 40 #endif 41 ··· 76 long signr; 77 int code; 78 79 + if (notify_page_fault(regs, ecr)) 80 return; 81 82 address = sysreg_read(TLBEAR);
+3 -5
include/asm-avr32/arch-at32ap/board.h
··· 30 struct platform_device * 31 at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); 32 33 - struct lcdc_platform_data { 34 - unsigned long fbmem_start; 35 - unsigned long fbmem_size; 36 - }; 37 struct platform_device * 38 - at32_add_device_lcdc(unsigned int id, struct lcdc_platform_data *data); 39 40 #endif /* __ASM_ARCH_BOARD_H */
··· 30 struct platform_device * 31 at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n); 32 33 + struct atmel_lcdfb_info; 34 struct platform_device * 35 + at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, 36 + unsigned long fbmem_start, unsigned long fbmem_len); 37 38 #endif /* __ASM_ARCH_BOARD_H */
+13 -4
include/asm-avr32/kdebug.h
··· 5 6 /* Grossly misnamed. */ 7 enum die_val { 8 - DIE_FAULT, 9 DIE_BREAKPOINT, 10 DIE_SSTEP, 11 - DIE_PAGE_FAULT, 12 }; 13 14 - int register_page_fault_notifier(struct notifier_block *nb); 15 - int unregister_page_fault_notifier(struct notifier_block *nb); 16 17 #endif /* __ASM_AVR32_KDEBUG_H */
··· 5 6 /* Grossly misnamed. */ 7 enum die_val { 8 DIE_BREAKPOINT, 9 DIE_SSTEP, 10 }; 11 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 + } 25 26 #endif /* __ASM_AVR32_KDEBUG_H */
+1
include/asm-avr32/kprobes.h
··· 26 kprobe_opcode_t insn[MAX_INSN_SIZE]; 27 }; 28 29 extern int kprobe_exceptions_notify(struct notifier_block *self, 30 unsigned long val, void *data); 31
··· 26 kprobe_opcode_t insn[MAX_INSN_SIZE]; 27 }; 28 29 + extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr); 30 extern int kprobe_exceptions_notify(struct notifier_block *self, 31 unsigned long val, void *data); 32
+4 -1
include/asm-avr32/unistd.h
··· 296 #define __NR_shmctl 277 297 298 #define __NR_utimensat 278 299 300 #ifdef __KERNEL__ 301 - #define NR_syscalls 279 302 303 304 #define __ARCH_WANT_IPC_PARSE_VERSION
··· 296 #define __NR_shmctl 277 297 298 #define __NR_utimensat 278 299 + #define __NR_signalfd 279 300 + #define __NR_timerfd 280 301 + #define __NR_eventfd 281 302 303 #ifdef __KERNEL__ 304 + #define NR_syscalls 282 305 306 307 #define __ARCH_WANT_IPC_PARSE_VERSION