diff options
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 18 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/Kconfig | 26 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 62 | ||||
-rw-r--r-- | include/asm-avr32/io.h | 2 | ||||
-rw-r--r-- | include/asm-avr32/pgalloc.h | 30 | ||||
-rw-r--r-- | include/asm-avr32/pgtable.h | 4 |
6 files changed, 112 insertions, 30 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 2edcecdea8bd..ef801563bbf5 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/etherdevice.h> | 11 | #include <linux/etherdevice.h> |
12 | #include <linux/i2c-gpio.h> | ||
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
14 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
@@ -123,6 +124,19 @@ static struct platform_device ngw_gpio_leds = { | |||
123 | } | 124 | } |
124 | }; | 125 | }; |
125 | 126 | ||
127 | static struct i2c_gpio_platform_data i2c_gpio_data = { | ||
128 | .sda_pin = GPIO_PIN_PA(6), | ||
129 | .scl_pin = GPIO_PIN_PA(7), | ||
130 | }; | ||
131 | |||
132 | static struct platform_device i2c_gpio_device = { | ||
133 | .name = "i2c-gpio", | ||
134 | .id = 0, | ||
135 | .dev = { | ||
136 | .platform_data = &i2c_gpio_data, | ||
137 | }, | ||
138 | }; | ||
139 | |||
126 | static int __init atngw100_init(void) | 140 | static int __init atngw100_init(void) |
127 | { | 141 | { |
128 | unsigned i; | 142 | unsigned i; |
@@ -147,6 +161,10 @@ static int __init atngw100_init(void) | |||
147 | } | 161 | } |
148 | platform_device_register(&ngw_gpio_leds); | 162 | platform_device_register(&ngw_gpio_leds); |
149 | 163 | ||
164 | at32_select_gpio(i2c_gpio_data.sda_pin, 0); | ||
165 | at32_select_gpio(i2c_gpio_data.scl_pin, 0); | ||
166 | platform_device_register(&i2c_gpio_device); | ||
167 | |||
150 | return 0; | 168 | return 0; |
151 | } | 169 | } |
152 | postcore_initcall(atngw100_init); | 170 | postcore_initcall(atngw100_init); |
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig index 71bc7d364fb7..718578f64069 100644 --- a/arch/avr32/boards/atstk1000/Kconfig +++ b/arch/avr32/boards/atstk1000/Kconfig | |||
@@ -50,4 +50,30 @@ config BOARD_ATSTK1002_SPI1 | |||
50 | GPIO lines and accessed through the J1 jumper block. Say "y" | 50 | GPIO lines and accessed through the J1 jumper block. Say "y" |
51 | here to configure that SPI controller. | 51 | here to configure that SPI controller. |
52 | 52 | ||
53 | config BOARD_ATSTK1002_J2_LED | ||
54 | bool | ||
55 | default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB | ||
56 | |||
57 | choice | ||
58 | prompt "LEDs connected to J2:" | ||
59 | depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM | ||
60 | optional | ||
61 | help | ||
62 | Select this if you have jumpered the J2 jumper block to the | ||
63 | LED0..LED7 amber leds, or to the RGB leds, using a ten-pin | ||
64 | IDC cable. A default "heartbeat" trigger is provided, but | ||
65 | you can of course override this. | ||
66 | |||
67 | config BOARD_ATSTK1002_J2_LED8 | ||
68 | bool "LED0..LED7" | ||
69 | help | ||
70 | Select this if J2 is jumpered to LED0..LED7 amber leds. | ||
71 | |||
72 | config BOARD_ATSTK1002_J2_RGB | ||
73 | bool "RGB leds" | ||
74 | help | ||
75 | Select this if J2 is jumpered to the RGB leds. | ||
76 | |||
77 | endchoice | ||
78 | |||
53 | endif # stk 1002 | 79 | endif # stk 1002 |
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index cb93eabb9c6c..c9981b731efa 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/etherdevice.h> | 11 | #include <linux/etherdevice.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/leds.h> | ||
14 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
15 | #include <linux/string.h> | 16 | #include <linux/string.h> |
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev) | |||
120 | clk_put(pclk); | 121 | clk_put(pclk); |
121 | } | 122 | } |
122 | 123 | ||
124 | #ifdef CONFIG_BOARD_ATSTK1002_J2_LED | ||
125 | |||
126 | static struct gpio_led stk_j2_led[] = { | ||
127 | #ifdef CONFIG_BOARD_ATSTK1002_J2_LED8 | ||
128 | #define LEDSTRING "J2 jumpered to LED8" | ||
129 | { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), }, | ||
130 | { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), }, | ||
131 | { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), }, | ||
132 | { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), }, | ||
133 | { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), }, | ||
134 | { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), }, | ||
135 | { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), }, | ||
136 | { .name = "led7:amber", .gpio = GPIO_PIN_PB(30), | ||
137 | .default_trigger = "heartbeat", }, | ||
138 | #else /* RGB */ | ||
139 | #define LEDSTRING "J2 jumpered to RGB LEDs" | ||
140 | { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), }, | ||
141 | { .name = "g1:green", .gpio = GPIO_PIN_PB(10), }, | ||
142 | { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), }, | ||
143 | |||
144 | { .name = "r2:red", .gpio = GPIO_PIN_PB( 9), | ||
145 | .default_trigger = "heartbeat", }, | ||
146 | { .name = "g2:green", .gpio = GPIO_PIN_PB(13), }, | ||
147 | { .name = "b2:blue", .gpio = GPIO_PIN_PB(15), | ||
148 | .default_trigger = "heartbeat", }, | ||
149 | /* PB16, PB30 unused */ | ||
150 | #endif | ||
151 | }; | ||
152 | |||
153 | static struct gpio_led_platform_data stk_j2_led_data = { | ||
154 | .num_leds = ARRAY_SIZE(stk_j2_led), | ||
155 | .leds = stk_j2_led, | ||
156 | }; | ||
157 | |||
158 | static struct platform_device stk_j2_led_dev = { | ||
159 | .name = "leds-gpio", | ||
160 | .id = 2, /* gpio block J2 */ | ||
161 | .dev = { | ||
162 | .platform_data = &stk_j2_led_data, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static void setup_j2_leds(void) | ||
167 | { | ||
168 | unsigned i; | ||
169 | |||
170 | for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++) | ||
171 | at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT); | ||
172 | |||
173 | printk("STK1002: " LEDSTRING "\n"); | ||
174 | platform_device_register(&stk_j2_led_dev); | ||
175 | } | ||
176 | |||
177 | #else | ||
178 | static void setup_j2_leds(void) | ||
179 | { | ||
180 | } | ||
181 | #endif | ||
182 | |||
123 | void __init setup_board(void) | 183 | void __init setup_board(void) |
124 | { | 184 | { |
125 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 185 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM |
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void) | |||
185 | at32_add_device_ssc(0, ATMEL_SSC_TX); | 245 | at32_add_device_ssc(0, ATMEL_SSC_TX); |
186 | #endif | 246 | #endif |
187 | 247 | ||
248 | setup_j2_leds(); | ||
249 | |||
188 | return 0; | 250 | return 0; |
189 | } | 251 | } |
190 | postcore_initcall(atstk1002_init); | 252 | postcore_initcall(atstk1002_init); |
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h index e30d4b3bd836..64bb92bb6773 100644 --- a/include/asm-avr32/io.h +++ b/include/asm-avr32/io.h | |||
@@ -255,6 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val, | |||
255 | memset((void __force *)addr, val, count); | 255 | memset((void __force *)addr, val, count); |
256 | } | 256 | } |
257 | 257 | ||
258 | #define mmiowb() | ||
259 | |||
258 | #define IO_SPACE_LIMIT 0xffffffff | 260 | #define IO_SPACE_LIMIT 0xffffffff |
259 | 261 | ||
260 | extern void __iomem *__ioremap(unsigned long offset, size_t size, | 262 | extern void __iomem *__ioremap(unsigned long offset, size_t size, |
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h index bb82e70cde8d..0e680f47209f 100644 --- a/include/asm-avr32/pgalloc.h +++ b/include/asm-avr32/pgalloc.h | |||
@@ -27,13 +27,7 @@ static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
27 | */ | 27 | */ |
28 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) | 28 | static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) |
29 | { | 29 | { |
30 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); | 30 | return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL); |
31 | pgd_t *pgd = kmalloc(pgd_size, GFP_KERNEL); | ||
32 | |||
33 | if (pgd) | ||
34 | memset(pgd, 0, pgd_size); | ||
35 | |||
36 | return pgd; | ||
37 | } | 31 | } |
38 | 32 | ||
39 | static inline void pgd_free(pgd_t *pgd) | 33 | static inline void pgd_free(pgd_t *pgd) |
@@ -44,18 +38,9 @@ static inline void pgd_free(pgd_t *pgd) | |||
44 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 38 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
45 | unsigned long address) | 39 | unsigned long address) |
46 | { | 40 | { |
47 | int count = 0; | ||
48 | pte_t *pte; | 41 | pte_t *pte; |
49 | 42 | ||
50 | do { | 43 | pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT); |
51 | pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT); | ||
52 | if (pte) | ||
53 | clear_page(pte); | ||
54 | else { | ||
55 | current->state = TASK_UNINTERRUPTIBLE; | ||
56 | schedule_timeout(HZ); | ||
57 | } | ||
58 | } while (!pte && (count++ < 10)); | ||
59 | 44 | ||
60 | return pte; | 45 | return pte; |
61 | } | 46 | } |
@@ -63,18 +48,9 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | |||
63 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 48 | static inline struct page *pte_alloc_one(struct mm_struct *mm, |
64 | unsigned long address) | 49 | unsigned long address) |
65 | { | 50 | { |
66 | int count = 0; | ||
67 | struct page *pte; | 51 | struct page *pte; |
68 | 52 | ||
69 | do { | 53 | pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); |
70 | pte = alloc_pages(GFP_KERNEL, 0); | ||
71 | if (pte) | ||
72 | clear_page(page_address(pte)); | ||
73 | else { | ||
74 | current->state = TASK_UNINTERRUPTIBLE; | ||
75 | schedule_timeout(HZ); | ||
76 | } | ||
77 | } while (!pte && (count++ < 10)); | ||
78 | 54 | ||
79 | return pte; | 55 | return pte; |
80 | } | 56 | } |
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h index c07bdd10b891..018f6e2a0242 100644 --- a/include/asm-avr32/pgtable.h +++ b/include/asm-avr32/pgtable.h | |||
@@ -32,8 +32,6 @@ | |||
32 | #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) | 32 | #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) |
33 | #define FIRST_USER_ADDRESS 0 | 33 | #define FIRST_USER_ADDRESS 0 |
34 | 34 | ||
35 | #define PTE_PHYS_MASK 0x1ffff000 | ||
36 | |||
37 | #ifndef __ASSEMBLY__ | 35 | #ifndef __ASSEMBLY__ |
38 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 36 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
39 | extern void paging_init(void); | 37 | extern void paging_init(void); |
@@ -265,7 +263,7 @@ static inline pte_t pte_mkyoung(pte_t pte) | |||
265 | * trivial. | 263 | * trivial. |
266 | */ | 264 | */ |
267 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | 265 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) |
268 | #define pte_page(x) phys_to_page(pte_val(x) & PTE_PHYS_MASK) | 266 | #define pte_page(x) (pfn_to_page(pte_pfn(x))) |
269 | 267 | ||
270 | /* | 268 | /* |
271 | * Mark the prot value as uncacheable and unbufferable | 269 | * Mark the prot value as uncacheable and unbufferable |