diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-09 12:34:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-09 12:34:52 -0400 |
commit | 1442138372d19907473cfc82c37e8dd7c3359034 (patch) | |
tree | d2ee2a1ddc5e608034e273b246269ebd696c410e | |
parent | 902ff186114b50c859c46ac762d4b1e6223991d3 (diff) | |
parent | a2767cfb1d9d97c3f861743f1ad595a80b75ec99 (diff) |
Merge branch 'sh/for-2.6.32' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh/for-2.6.32' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
sh: Don't allocate smaller sized mappings on every iteration
sh: Try PMB mapping based on physical address, not mapping size
sh: Plug PMB alloc memory leak
sh: Sprinkle __uses_jump_to_uncached
sh: enable sleep state LEDs on Ecovec24
usb: r8a66597-udc unaligned fifo fix
sh: mach-ecovec24: Document DS2 switch settings.
sh: Build fix: export __movmem
sh: Disable unaligned kernel access printks by default.
sh: mach-ecovec24: modify 1st MTD area to read only
sh: mach-ecovec24: Add TouchScreen support
sh: magicpanelr2 and dreamcast can use the generic I/O base.
sh: Don't enable interrupts in the page fault path
sh: Set the default I/O port base to P2SEG.
sh: Handle ioport_map() cases for >= P1SEG addresses.
-rw-r--r-- | arch/sh/boards/board-magicpanelr2.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-dreamcast/setup.c | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 63 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/sh3/entry.S | 2 | ||||
-rw-r--r-- | arch/sh/kernel/io_generic.c | 3 | ||||
-rw-r--r-- | arch/sh/kernel/machvec.c | 3 | ||||
-rw-r--r-- | arch/sh/kernel/sh_ksyms_32.c | 1 | ||||
-rw-r--r-- | arch/sh/kernel/traps_32.c | 4 | ||||
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/cache-sh7705.c | 4 | ||||
-rw-r--r-- | arch/sh/mm/ioremap_32.c | 2 | ||||
-rw-r--r-- | arch/sh/mm/pmb.c | 37 | ||||
-rw-r--r-- | drivers/usb/gadget/r8a66597-udc.h | 105 |
13 files changed, 168 insertions, 62 deletions
diff --git a/arch/sh/boards/board-magicpanelr2.c b/arch/sh/boards/board-magicpanelr2.c index 0a37c8bfc959..99ffc5f1c0dd 100644 --- a/arch/sh/boards/board-magicpanelr2.c +++ b/arch/sh/boards/board-magicpanelr2.c | |||
@@ -205,8 +205,6 @@ static void __init setup_port_multiplexing(void) | |||
205 | 205 | ||
206 | static void __init mpr2_setup(char **cmdline_p) | 206 | static void __init mpr2_setup(char **cmdline_p) |
207 | { | 207 | { |
208 | __set_io_port_base(0xa0000000); | ||
209 | |||
210 | /* set Pin Select Register A: | 208 | /* set Pin Select Register A: |
211 | * /PCC_CD1, /PCC_CD2, PCC_BVD1, PCC_BVD2, | 209 | * /PCC_CD1, /PCC_CD2, PCC_BVD1, PCC_BVD2, |
212 | * /IOIS16, IRQ4, IRQ5, USB1d_SUSPEND | 210 | * /IOIS16, IRQ4, IRQ5, USB1d_SUSPEND |
diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c index ebe99227d4e6..a4b7402d6176 100644 --- a/arch/sh/boards/mach-dreamcast/setup.c +++ b/arch/sh/boards/mach-dreamcast/setup.c | |||
@@ -42,8 +42,6 @@ static void __init dreamcast_setup(char **cmdline_p) | |||
42 | /* Acknowledge any previous events */ | 42 | /* Acknowledge any previous events */ |
43 | /* XXX */ | 43 | /* XXX */ |
44 | 44 | ||
45 | __set_io_port_base(0xa0000000); | ||
46 | |||
47 | /* Assign all virtual IRQs to the System ASIC int. handler */ | 45 | /* Assign all virtual IRQs to the System ASIC int. handler */ |
48 | for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++) | 46 | for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++) |
49 | set_irq_chip_and_handler(i, &systemasic_int, | 47 | set_irq_chip_and_handler(i, &systemasic_int, |
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 5f9881e16e2f..3b1ceb46fa54 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/usb/r8a66597.h> | 19 | #include <linux/usb/r8a66597.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <linux/i2c/tsc2007.h> | ||
21 | #include <linux/input.h> | 22 | #include <linux/input.h> |
22 | #include <video/sh_mobile_lcdc.h> | 23 | #include <video/sh_mobile_lcdc.h> |
23 | #include <media/sh_mobile_ceu.h> | 24 | #include <media/sh_mobile_ceu.h> |
@@ -38,6 +39,20 @@ | |||
38 | * 0x1800_0000 MFI 16bit | 39 | * 0x1800_0000 MFI 16bit |
39 | */ | 40 | */ |
40 | 41 | ||
42 | /* SWITCH | ||
43 | *------------------------------ | ||
44 | * DS2[1] = FlashROM write protect ON : write protect | ||
45 | * OFF : No write protect | ||
46 | * DS2[2] = RMII / TS, SCIF ON : RMII | ||
47 | * OFF : TS, SCIF3 | ||
48 | * DS2[3] = Camera / Video ON : Camera | ||
49 | * OFF : NTSC/PAL (IN) | ||
50 | * DS2[5] = NTSC_OUT Clock ON : On board OSC | ||
51 | * OFF : SH7724 DV_CLK | ||
52 | * DS2[6-7] = MMC / SD ON-OFF : SD | ||
53 | * OFF-ON : MMC | ||
54 | */ | ||
55 | |||
41 | /* Heartbeat */ | 56 | /* Heartbeat */ |
42 | static unsigned char led_pos[] = { 0, 1, 2, 3 }; | 57 | static unsigned char led_pos[] = { 0, 1, 2, 3 }; |
43 | static struct heartbeat_data heartbeat_data = { | 58 | static struct heartbeat_data heartbeat_data = { |
@@ -70,7 +85,7 @@ static struct mtd_partition nor_flash_partitions[] = { | |||
70 | .name = "boot loader", | 85 | .name = "boot loader", |
71 | .offset = 0, | 86 | .offset = 0, |
72 | .size = (5 * 1024 * 1024), | 87 | .size = (5 * 1024 * 1024), |
73 | .mask_flags = MTD_CAP_ROM, | 88 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
74 | }, { | 89 | }, { |
75 | .name = "free-area", | 90 | .name = "free-area", |
76 | .offset = MTDPART_OFS_APPEND, | 91 | .offset = MTDPART_OFS_APPEND, |
@@ -376,6 +391,43 @@ static struct platform_device keysc_device = { | |||
376 | }, | 391 | }, |
377 | }; | 392 | }; |
378 | 393 | ||
394 | /* TouchScreen */ | ||
395 | #define IRQ0 32 | ||
396 | static int ts_get_pendown_state(void) | ||
397 | { | ||
398 | int val = 0; | ||
399 | gpio_free(GPIO_FN_INTC_IRQ0); | ||
400 | gpio_request(GPIO_PTZ0, NULL); | ||
401 | gpio_direction_input(GPIO_PTZ0); | ||
402 | |||
403 | val = gpio_get_value(GPIO_PTZ0); | ||
404 | |||
405 | gpio_free(GPIO_PTZ0); | ||
406 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | ||
407 | |||
408 | return val ? 0 : 1; | ||
409 | } | ||
410 | |||
411 | static int ts_init(void) | ||
412 | { | ||
413 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | struct tsc2007_platform_data tsc2007_info = { | ||
418 | .model = 2007, | ||
419 | .x_plate_ohms = 180, | ||
420 | .get_pendown_state = ts_get_pendown_state, | ||
421 | .init_platform_hw = ts_init, | ||
422 | }; | ||
423 | |||
424 | static struct i2c_board_info ts_i2c_clients = { | ||
425 | I2C_BOARD_INFO("tsc2007", 0x48), | ||
426 | .type = "tsc2007", | ||
427 | .platform_data = &tsc2007_info, | ||
428 | .irq = IRQ0, | ||
429 | }; | ||
430 | |||
379 | static struct platform_device *ecovec_devices[] __initdata = { | 431 | static struct platform_device *ecovec_devices[] __initdata = { |
380 | &heartbeat_device, | 432 | &heartbeat_device, |
381 | &nor_flash_device, | 433 | &nor_flash_device, |
@@ -460,6 +512,11 @@ static void __init sh_eth_init(void) | |||
460 | #define IODRIVEA 0xA405018A | 512 | #define IODRIVEA 0xA405018A |
461 | static int __init arch_setup(void) | 513 | static int __init arch_setup(void) |
462 | { | 514 | { |
515 | /* enable STATUS0, STATUS2 and PDSTATUS */ | ||
516 | gpio_request(GPIO_FN_STATUS0, NULL); | ||
517 | gpio_request(GPIO_FN_STATUS2, NULL); | ||
518 | gpio_request(GPIO_FN_PDSTATUS, NULL); | ||
519 | |||
463 | /* enable SCIFA0 */ | 520 | /* enable SCIFA0 */ |
464 | gpio_request(GPIO_FN_SCIF0_TXD, NULL); | 521 | gpio_request(GPIO_FN_SCIF0_TXD, NULL); |
465 | gpio_request(GPIO_FN_SCIF0_RXD, NULL); | 522 | gpio_request(GPIO_FN_SCIF0_RXD, NULL); |
@@ -590,6 +647,10 @@ static int __init arch_setup(void) | |||
590 | */ | 647 | */ |
591 | gpio_request(GPIO_PTF4, NULL); | 648 | gpio_request(GPIO_PTF4, NULL); |
592 | gpio_direction_output(GPIO_PTF4, 1); | 649 | gpio_direction_output(GPIO_PTF4, 1); |
650 | |||
651 | /* enable TouchScreen */ | ||
652 | i2c_register_board_info(0, &ts_i2c_clients, 1); | ||
653 | set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); | ||
593 | } | 654 | } |
594 | 655 | ||
595 | /* enable CEU0 */ | 656 | /* enable CEU0 */ |
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S index 0151933e5253..bb407ef0b91e 100644 --- a/arch/sh/kernel/cpu/sh3/entry.S +++ b/arch/sh/kernel/cpu/sh3/entry.S | |||
@@ -152,8 +152,6 @@ call_do_page_fault: | |||
152 | mov.l 1f, r0 | 152 | mov.l 1f, r0 |
153 | mov.l @r0, r6 | 153 | mov.l @r0, r6 |
154 | 154 | ||
155 | sti | ||
156 | |||
157 | mov.l 3f, r0 | 155 | mov.l 3f, r0 |
158 | mov.l 4f, r1 | 156 | mov.l 4f, r1 |
159 | mov r15, r4 | 157 | mov r15, r4 |
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c index 4ff507239286..b8fa6524760a 100644 --- a/arch/sh/kernel/io_generic.c +++ b/arch/sh/kernel/io_generic.c | |||
@@ -147,6 +147,9 @@ void generic_outsl(unsigned long port, const void *src, unsigned long count) | |||
147 | 147 | ||
148 | void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) | 148 | void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) |
149 | { | 149 | { |
150 | if (PXSEG(addr) >= P1SEG) | ||
151 | return (void __iomem *)addr; | ||
152 | |||
150 | return (void __iomem *)(addr + generic_io_base); | 153 | return (void __iomem *)(addr + generic_io_base); |
151 | } | 154 | } |
152 | 155 | ||
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index 548f6607fd0f..cbce639b108a 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <asm/machvec.h> | 15 | #include <asm/machvec.h> |
16 | #include <asm/sections.h> | 16 | #include <asm/sections.h> |
17 | #include <asm/addrspace.h> | ||
17 | #include <asm/setup.h> | 18 | #include <asm/setup.h> |
18 | #include <asm/io.h> | 19 | #include <asm/io.h> |
19 | #include <asm/irq.h> | 20 | #include <asm/irq.h> |
@@ -133,4 +134,6 @@ void __init sh_mv_setup(void) | |||
133 | 134 | ||
134 | if (!sh_mv.mv_nr_irqs) | 135 | if (!sh_mv.mv_nr_irqs) |
135 | sh_mv.mv_nr_irqs = NR_IRQS; | 136 | sh_mv.mv_nr_irqs = NR_IRQS; |
137 | |||
138 | __set_io_port_base(P2SEG); | ||
136 | } | 139 | } |
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c index 8dbe26b17c44..86c270428357 100644 --- a/arch/sh/kernel/sh_ksyms_32.c +++ b/arch/sh/kernel/sh_ksyms_32.c | |||
@@ -84,6 +84,7 @@ DECLARE_EXPORT(__movstrSI60); | |||
84 | DECLARE_EXPORT(__movstr_i4_even); | 84 | DECLARE_EXPORT(__movstr_i4_even); |
85 | DECLARE_EXPORT(__movstr_i4_odd); | 85 | DECLARE_EXPORT(__movstr_i4_odd); |
86 | DECLARE_EXPORT(__movstrSI12_i4); | 86 | DECLARE_EXPORT(__movstrSI12_i4); |
87 | DECLARE_EXPORT(__movmem); | ||
87 | DECLARE_EXPORT(__movmem_i4_even); | 88 | DECLARE_EXPORT(__movmem_i4_even); |
88 | DECLARE_EXPORT(__movmem_i4_odd); | 89 | DECLARE_EXPORT(__movmem_i4_odd); |
89 | DECLARE_EXPORT(__movmemSI12_i4); | 90 | DECLARE_EXPORT(__movmemSI12_i4); |
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index 69bb1652eccd..e0b5e4b5accd 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c | |||
@@ -54,8 +54,8 @@ static unsigned long se_multi; | |||
54 | /* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not | 54 | /* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not |
55 | valid! */ | 55 | valid! */ |
56 | static int se_usermode = 3; | 56 | static int se_usermode = 3; |
57 | /* 0: no warning 1: print a warning message */ | 57 | /* 0: no warning 1: print a warning message, disabled by default */ |
58 | static int se_kernmode_warn = 1; | 58 | static int se_kernmode_warn; |
59 | 59 | ||
60 | #ifdef CONFIG_PROC_FS | 60 | #ifdef CONFIG_PROC_FS |
61 | static const char *se_usermode_action[] = { | 61 | static const char *se_usermode_action[] = { |
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index b2453bbef4cd..a98c7d8984fa 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -43,7 +43,7 @@ static void (*__flush_dcache_segment_fn)(unsigned long, unsigned long) = | |||
43 | * Called from kernel/module.c:sys_init_module and routine for a.out format, | 43 | * Called from kernel/module.c:sys_init_module and routine for a.out format, |
44 | * signal handler code and kprobes code | 44 | * signal handler code and kprobes code |
45 | */ | 45 | */ |
46 | static void sh4_flush_icache_range(void *args) | 46 | static void __uses_jump_to_uncached sh4_flush_icache_range(void *args) |
47 | { | 47 | { |
48 | struct flusher_data *data = args; | 48 | struct flusher_data *data = args; |
49 | unsigned long start, end; | 49 | unsigned long start, end; |
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c index 2cadee2037ac..2601935eb589 100644 --- a/arch/sh/mm/cache-sh7705.c +++ b/arch/sh/mm/cache-sh7705.c | |||
@@ -78,7 +78,7 @@ static void sh7705_flush_icache_range(void *args) | |||
78 | /* | 78 | /* |
79 | * Writeback&Invalidate the D-cache of the page | 79 | * Writeback&Invalidate the D-cache of the page |
80 | */ | 80 | */ |
81 | static void __flush_dcache_page(unsigned long phys) | 81 | static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys) |
82 | { | 82 | { |
83 | unsigned long ways, waysize, addrstart; | 83 | unsigned long ways, waysize, addrstart; |
84 | unsigned long flags; | 84 | unsigned long flags; |
@@ -144,7 +144,7 @@ static void sh7705_flush_dcache_page(void *arg) | |||
144 | __flush_dcache_page(PHYSADDR(page_address(page))); | 144 | __flush_dcache_page(PHYSADDR(page_address(page))); |
145 | } | 145 | } |
146 | 146 | ||
147 | static void sh7705_flush_cache_all(void *args) | 147 | static void __uses_jump_to_uncached sh7705_flush_cache_all(void *args) |
148 | { | 148 | { |
149 | unsigned long flags; | 149 | unsigned long flags; |
150 | 150 | ||
diff --git a/arch/sh/mm/ioremap_32.c b/arch/sh/mm/ioremap_32.c index c3250614e3ae..a86eaa9d75a5 100644 --- a/arch/sh/mm/ioremap_32.c +++ b/arch/sh/mm/ioremap_32.c | |||
@@ -83,7 +83,7 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size, | |||
83 | * | 83 | * |
84 | * PMB entries are all pre-faulted. | 84 | * PMB entries are all pre-faulted. |
85 | */ | 85 | */ |
86 | if (unlikely(size >= 0x1000000)) { | 86 | if (unlikely(phys_addr >= P1SEG)) { |
87 | unsigned long mapped = pmb_remap(addr, phys_addr, size, flags); | 87 | unsigned long mapped = pmb_remap(addr, phys_addr, size, flags); |
88 | 88 | ||
89 | if (likely(mapped)) { | 89 | if (likely(mapped)) { |
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c index b1a714a92b14..aade31102112 100644 --- a/arch/sh/mm/pmb.c +++ b/arch/sh/mm/pmb.c | |||
@@ -33,6 +33,8 @@ | |||
33 | 33 | ||
34 | #define NR_PMB_ENTRIES 16 | 34 | #define NR_PMB_ENTRIES 16 |
35 | 35 | ||
36 | static void __pmb_unmap(struct pmb_entry *); | ||
37 | |||
36 | static struct kmem_cache *pmb_cache; | 38 | static struct kmem_cache *pmb_cache; |
37 | static unsigned long pmb_map; | 39 | static unsigned long pmb_map; |
38 | 40 | ||
@@ -218,9 +220,10 @@ static struct { | |||
218 | long pmb_remap(unsigned long vaddr, unsigned long phys, | 220 | long pmb_remap(unsigned long vaddr, unsigned long phys, |
219 | unsigned long size, unsigned long flags) | 221 | unsigned long size, unsigned long flags) |
220 | { | 222 | { |
221 | struct pmb_entry *pmbp; | 223 | struct pmb_entry *pmbp, *pmbe; |
222 | unsigned long wanted; | 224 | unsigned long wanted; |
223 | int pmb_flags, i; | 225 | int pmb_flags, i; |
226 | long err; | ||
224 | 227 | ||
225 | /* Convert typical pgprot value to the PMB equivalent */ | 228 | /* Convert typical pgprot value to the PMB equivalent */ |
226 | if (flags & _PAGE_CACHABLE) { | 229 | if (flags & _PAGE_CACHABLE) { |
@@ -236,20 +239,22 @@ long pmb_remap(unsigned long vaddr, unsigned long phys, | |||
236 | 239 | ||
237 | again: | 240 | again: |
238 | for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++) { | 241 | for (i = 0; i < ARRAY_SIZE(pmb_sizes); i++) { |
239 | struct pmb_entry *pmbe; | ||
240 | int ret; | 242 | int ret; |
241 | 243 | ||
242 | if (size < pmb_sizes[i].size) | 244 | if (size < pmb_sizes[i].size) |
243 | continue; | 245 | continue; |
244 | 246 | ||
245 | pmbe = pmb_alloc(vaddr, phys, pmb_flags | pmb_sizes[i].flag); | 247 | pmbe = pmb_alloc(vaddr, phys, pmb_flags | pmb_sizes[i].flag); |
246 | if (IS_ERR(pmbe)) | 248 | if (IS_ERR(pmbe)) { |
247 | return PTR_ERR(pmbe); | 249 | err = PTR_ERR(pmbe); |
250 | goto out; | ||
251 | } | ||
248 | 252 | ||
249 | ret = set_pmb_entry(pmbe); | 253 | ret = set_pmb_entry(pmbe); |
250 | if (ret != 0) { | 254 | if (ret != 0) { |
251 | pmb_free(pmbe); | 255 | pmb_free(pmbe); |
252 | return -EBUSY; | 256 | err = -EBUSY; |
257 | goto out; | ||
253 | } | 258 | } |
254 | 259 | ||
255 | phys += pmb_sizes[i].size; | 260 | phys += pmb_sizes[i].size; |
@@ -264,12 +269,25 @@ again: | |||
264 | pmbp->link = pmbe; | 269 | pmbp->link = pmbe; |
265 | 270 | ||
266 | pmbp = pmbe; | 271 | pmbp = pmbe; |
272 | |||
273 | /* | ||
274 | * Instead of trying smaller sizes on every iteration | ||
275 | * (even if we succeed in allocating space), try using | ||
276 | * pmb_sizes[i].size again. | ||
277 | */ | ||
278 | i--; | ||
267 | } | 279 | } |
268 | 280 | ||
269 | if (size >= 0x1000000) | 281 | if (size >= 0x1000000) |
270 | goto again; | 282 | goto again; |
271 | 283 | ||
272 | return wanted - size; | 284 | return wanted - size; |
285 | |||
286 | out: | ||
287 | if (pmbp) | ||
288 | __pmb_unmap(pmbp); | ||
289 | |||
290 | return err; | ||
273 | } | 291 | } |
274 | 292 | ||
275 | void pmb_unmap(unsigned long addr) | 293 | void pmb_unmap(unsigned long addr) |
@@ -283,12 +301,19 @@ void pmb_unmap(unsigned long addr) | |||
283 | if (unlikely(!pmbe)) | 301 | if (unlikely(!pmbe)) |
284 | return; | 302 | return; |
285 | 303 | ||
304 | __pmb_unmap(pmbe); | ||
305 | } | ||
306 | |||
307 | static void __pmb_unmap(struct pmb_entry *pmbe) | ||
308 | { | ||
286 | WARN_ON(!test_bit(pmbe->entry, &pmb_map)); | 309 | WARN_ON(!test_bit(pmbe->entry, &pmb_map)); |
287 | 310 | ||
288 | do { | 311 | do { |
289 | struct pmb_entry *pmblink = pmbe; | 312 | struct pmb_entry *pmblink = pmbe; |
290 | 313 | ||
291 | clear_pmb_entry(pmbe); | 314 | if (pmbe->entry != PMB_NO_ENTRY) |
315 | clear_pmb_entry(pmbe); | ||
316 | |||
292 | pmbe = pmblink->link; | 317 | pmbe = pmblink->link; |
293 | 318 | ||
294 | pmb_free(pmblink); | 319 | pmb_free(pmblink); |
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h index 03087e7b9190..9a537aa07968 100644 --- a/drivers/usb/gadget/r8a66597-udc.h +++ b/drivers/usb/gadget/r8a66597-udc.h | |||
@@ -131,31 +131,48 @@ static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | 133 | static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, |
134 | unsigned long offset, u16 *buf, | 134 | unsigned long offset, |
135 | unsigned char *buf, | ||
135 | int len) | 136 | int len) |
136 | { | 137 | { |
138 | unsigned long fifoaddr = r8a66597->reg + offset; | ||
139 | unsigned int data; | ||
140 | int i; | ||
141 | |||
137 | if (r8a66597->pdata->on_chip) { | 142 | if (r8a66597->pdata->on_chip) { |
138 | unsigned long fifoaddr = r8a66597->reg + offset; | 143 | /* 32-bit accesses for on_chip controllers */ |
139 | unsigned long count; | 144 | |
140 | union { | 145 | /* aligned buf case */ |
141 | unsigned long dword; | 146 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
142 | unsigned char byte[4]; | 147 | insl(fifoaddr, buf, len / 4); |
143 | } data; | 148 | buf += len & ~0x03; |
144 | unsigned char *pb; | 149 | len &= 0x03; |
145 | int i; | 150 | } |
146 | 151 | ||
147 | count = len / 4; | 152 | /* unaligned buf case */ |
148 | insl(fifoaddr, buf, count); | 153 | for (i = 0; i < len; i++) { |
149 | 154 | if (!(i & 0x03)) | |
150 | if (len & 0x00000003) { | 155 | data = inl(fifoaddr); |
151 | data.dword = inl(fifoaddr); | 156 | |
152 | pb = (unsigned char *)buf + count * 4; | 157 | buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; |
153 | for (i = 0; i < (len & 0x00000003); i++) | ||
154 | pb[i] = data.byte[i]; | ||
155 | } | 158 | } |
156 | } else { | 159 | } else { |
157 | len = (len + 1) / 2; | 160 | /* 16-bit accesses for external controllers */ |
158 | insw(r8a66597->reg + offset, buf, len); | 161 | |
162 | /* aligned buf case */ | ||
163 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | ||
164 | insw(fifoaddr, buf, len / 2); | ||
165 | buf += len & ~0x01; | ||
166 | len &= 0x01; | ||
167 | } | ||
168 | |||
169 | /* unaligned buf case */ | ||
170 | for (i = 0; i < len; i++) { | ||
171 | if (!(i & 0x01)) | ||
172 | data = inw(fifoaddr); | ||
173 | |||
174 | buf[i] = (data >> ((i & 0x01) * 8)) & 0xff; | ||
175 | } | ||
159 | } | 176 | } |
160 | } | 177 | } |
161 | 178 | ||
@@ -166,38 +183,40 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | |||
166 | } | 183 | } |
167 | 184 | ||
168 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | 185 | static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, |
169 | unsigned long offset, u16 *buf, | 186 | unsigned long offset, |
187 | unsigned char *buf, | ||
170 | int len) | 188 | int len) |
171 | { | 189 | { |
172 | unsigned long fifoaddr = r8a66597->reg + offset; | 190 | unsigned long fifoaddr = r8a66597->reg + offset; |
191 | int adj = 0; | ||
192 | int i; | ||
173 | 193 | ||
174 | if (r8a66597->pdata->on_chip) { | 194 | if (r8a66597->pdata->on_chip) { |
175 | unsigned long count; | 195 | /* 32-bit access only if buf is 32-bit aligned */ |
176 | unsigned char *pb; | 196 | if (len >= 4 && !((unsigned long)buf & 0x03)) { |
177 | int i; | 197 | outsl(fifoaddr, buf, len / 4); |
178 | 198 | buf += len & ~0x03; | |
179 | count = len / 4; | 199 | len &= 0x03; |
180 | outsl(fifoaddr, buf, count); | ||
181 | |||
182 | if (len & 0x00000003) { | ||
183 | pb = (unsigned char *)buf + count * 4; | ||
184 | for (i = 0; i < (len & 0x00000003); i++) { | ||
185 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | ||
186 | outb(pb[i], fifoaddr + i); | ||
187 | else | ||
188 | outb(pb[i], fifoaddr + 3 - i); | ||
189 | } | ||
190 | } | 200 | } |
191 | } else { | 201 | } else { |
192 | int odd = len & 0x0001; | 202 | /* 16-bit access only if buf is 16-bit aligned */ |
193 | 203 | if (len >= 2 && !((unsigned long)buf & 0x01)) { | |
194 | len = len / 2; | 204 | outsw(fifoaddr, buf, len / 2); |
195 | outsw(fifoaddr, buf, len); | 205 | buf += len & ~0x01; |
196 | if (unlikely(odd)) { | 206 | len &= 0x01; |
197 | buf = &buf[len]; | ||
198 | outb((unsigned char)*buf, fifoaddr); | ||
199 | } | 207 | } |
200 | } | 208 | } |
209 | |||
210 | /* adjust fifo address in the little endian case */ | ||
211 | if (!(r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)) { | ||
212 | if (r8a66597->pdata->on_chip) | ||
213 | adj = 0x03; /* 32-bit wide */ | ||
214 | else | ||
215 | adj = 0x01; /* 16-bit wide */ | ||
216 | } | ||
217 | |||
218 | for (i = 0; i < len; i++) | ||
219 | outb(buf[i], fifoaddr + adj - (i & adj)); | ||
201 | } | 220 | } |
202 | 221 | ||
203 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 222 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, |