Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm

* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (50 commits)
[ARM] sa1100: remove boot time RTC initialisation
[ARM] sa1100: stop doing our own rtc management over suspend
[ARM] 4474/1: Do not check the PSR_F_BIT in valid_user_regs
[ARM] 4473/2: Take the HWCAP definitions out of the elf.h file
[ARM] pxa: move platform devices to separate header file
[ARM] pxa: move device registration into CPU-specific file
[ARM] pxa: remove boot time RTC initialisation
[ARM] pxa: stop doing our own rtc management over suspend
[ARM] 4451/1: pxa: make dma.c generic and remove cpu specific dma code
[ARM] 4450/1: pxa: add pxa25x_init_irq() and pxa27x_init_irq()
[ARM] 4440/1: PXA: enable the checking of ICIP2 for IRQs
[ARM] 4438/1: PXA: remove #ifdef .. #endif from pxa_gpio_demux_handler()
[ARM] 4437/1: PXA: move the GPIO IRQ initialization code to pxa_init_irq_gpio()
[ARM] 4436/1: PXA: move low IRQ initialization code to pxa_init_irq_low()
[ARM] 4435/1: PXA: remove PXA_INTERNAL_IRQS
[ARM] 4434/1: PXA: remove PXA_IRQ_SKIP
[ARM] pxa: Fix PXA27x suspend type validation, remove pxa_pm_prepare()
[ARM] pxa: move pm_ops structure into CPU specific files
[ARM] pxa: introduce cpu_is_pxaXXX macros
[ARM] pxa: remove MMC register defines from pxa-regs.h
...

+3204 -489
+5
arch/arm/Kconfig
··· 241 241 242 242 config ARCH_IMX 243 243 bool "IMX" 244 + select GENERIC_GPIO 245 + select GENERIC_TIME 246 + select GENERIC_CLOCKEVENTS 244 247 help 245 248 Support for Motorola's i.MX family of processors (MX1, MXL). 246 249 ··· 311 308 312 309 config ARCH_KS8695 313 310 bool "Micrel/Kendin KS8695" 311 + select GENERIC_GPIO 314 312 help 315 313 Support for Micrel/Kendin KS8695 "Centaur" (ARM922T) based 316 314 System-on-Chip devices. ··· 388 384 bool "TI DaVinci" 389 385 select GENERIC_TIME 390 386 select GENERIC_CLOCKEVENTS 387 + select GENERIC_GPIO 391 388 help 392 389 Support for TI's DaVinci platform. 393 390
+1
arch/arm/boot/compressed/.gitignore
··· 1 1 piggy.gz 2 + font.c
+7 -6
arch/arm/boot/compressed/Makefile
··· 6 6 7 7 HEAD = head.o 8 8 OBJS = misc.o 9 - FONTC = drivers/video/console/font_acorn_8x8.c 10 - 11 - FONT = $(addprefix ../../../../drivers/video/console/, font_acorn_8x8.o) 9 + FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 12 10 13 11 # 14 12 # Architecture dependencies 15 13 # 16 14 ifeq ($(CONFIG_ARCH_ACORN),y) 17 - OBJS += ll_char_wr.o $(FONT) 15 + OBJS += ll_char_wr.o font.o 18 16 endif 19 17 20 18 ifeq ($(CONFIG_ARCH_SHARK),y) ··· 71 73 72 74 SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ 73 75 74 - targets := vmlinux vmlinux.lds piggy.gz piggy.o $(FONT) \ 76 + targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \ 75 77 head.o misc.o $(OBJS) 76 78 EXTRA_CFLAGS := -fpic 77 79 EXTRA_AFLAGS := ··· 103 105 104 106 $(obj)/piggy.o: $(obj)/piggy.gz FORCE 105 107 106 - CFLAGS_font_acorn_8x8.o := -Dstatic= 108 + CFLAGS_font.o := -Dstatic= 109 + 110 + $(obj)/font.c: $(FONTC) 111 + $(call cmd,shipped) 107 112 108 113 $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config 109 114 @sed "$(SEDFLAGS)" < $< > $@
-5
arch/arm/boot/compressed/head-xscale.S
··· 41 41 mov r7, #MACH_TYPE_COTULLA_IDP 42 42 #endif 43 43 44 - #ifdef CONFIG_MACH_GTWX5715 45 - mov r7, #(MACH_TYPE_GTWX5715 & 0xff) 46 - orr r7, r7, #(MACH_TYPE_GTWX5715 & 0xff00) 47 - #endif 48 - 49 44 #ifdef CONFIG_ARCH_IXP2000 50 45 mov r1, #-1 51 46 mov r0, #0xd6000000
+92 -1
arch/arm/boot/compressed/head.S
··· 436 436 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs 437 437 mov pc, r12 438 438 439 + __armv7_mmu_cache_on: 440 + mov r12, lr 441 + mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0 442 + tst r11, #0xf @ VMSA 443 + blne __setup_mmu 444 + mov r0, #0 445 + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 446 + tst r11, #0xf @ VMSA 447 + mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs 448 + mrc p15, 0, r0, c1, c0, 0 @ read control reg 449 + orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 450 + orr r0, r0, #0x003c @ write buffer 451 + orrne r0, r0, #1 @ MMU enabled 452 + movne r1, #-1 453 + mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer 454 + mcrne p15, 0, r1, c3, c0, 0 @ load domain access control 455 + mcr p15, 0, r0, c1, c0, 0 @ load control register 456 + mrc p15, 0, r0, c1, c0, 0 @ and read it back 457 + mov r0, #0 458 + mcr p15, 0, r0, c7, c5, 4 @ ISB 459 + mov pc, r12 460 + 439 461 __arm6_mmu_cache_on: 440 462 mov r12, lr 441 463 bl __setup_mmu ··· 644 622 b __armv4_mmu_cache_flush 645 623 646 624 .word 0x0007b000 @ ARMv6 647 - .word 0x0007f000 625 + .word 0x000ff000 648 626 b __armv4_mmu_cache_on 649 627 b __armv4_mmu_cache_off 650 628 b __armv6_mmu_cache_flush 629 + 630 + .word 0x000f0000 @ new CPU Id 631 + .word 0x000f0000 632 + b __armv7_mmu_cache_on 633 + b __armv7_mmu_cache_off 634 + b __armv7_mmu_cache_flush 651 635 652 636 .word 0 @ unrecognised type 653 637 .word 0 ··· 701 673 mcr p15, 0, r0, c7, c7 @ invalidate whole cache v4 702 674 mcr p15, 0, r0, c8, c7 @ invalidate whole TLB v4 703 675 mov pc, lr 676 + 677 + __armv7_mmu_cache_off: 678 + mrc p15, 0, r0, c1, c0 679 + bic r0, r0, #0x000d 680 + mcr p15, 0, r0, c1, c0 @ turn MMU and cache off 681 + mov r12, lr 682 + bl __armv7_mmu_cache_flush 683 + mov r0, #0 684 + mcr p15, 0, r0, c8, c7, 0 @ invalidate whole TLB 685 + mov pc, r12 704 686 705 687 __arm6_mmu_cache_off: 706 688 mov r0, #0x00000030 @ ARM6 control reg. ··· 766 728 mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB 767 729 mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified 768 730 mcr p15, 0, r1, c7, c10, 4 @ drain WB 731 + mov pc, lr 732 + 733 + __armv7_mmu_cache_flush: 734 + mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 735 + tst r10, #0xf << 16 @ hierarchical cache (ARMv7) 736 + beq hierarchical 737 + mov r10, #0 738 + mcr p15, 0, r10, c7, c14, 0 @ clean+invalidate D 739 + b iflush 740 + hierarchical: 741 + stmfd sp!, {r0-r5, r7, r9-r11} 742 + mrc p15, 1, r0, c0, c0, 1 @ read clidr 743 + ands r3, r0, #0x7000000 @ extract loc from clidr 744 + mov r3, r3, lsr #23 @ left align loc bit field 745 + beq finished @ if loc is 0, then no need to clean 746 + mov r10, #0 @ start clean at cache level 0 747 + loop1: 748 + add r2, r10, r10, lsr #1 @ work out 3x current cache level 749 + mov r1, r0, lsr r2 @ extract cache type bits from clidr 750 + and r1, r1, #7 @ mask of the bits for current cache only 751 + cmp r1, #2 @ see what cache we have at this level 752 + blt skip @ skip if no cache, or just i-cache 753 + mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 754 + mcr p15, 0, r10, c7, c5, 4 @ isb to sych the new cssr&csidr 755 + mrc p15, 1, r1, c0, c0, 0 @ read the new csidr 756 + and r2, r1, #7 @ extract the length of the cache lines 757 + add r2, r2, #4 @ add 4 (line length offset) 758 + ldr r4, =0x3ff 759 + ands r4, r4, r1, lsr #3 @ find maximum number on the way size 760 + .word 0xe16f5f14 @ clz r5, r4 - find bit position of way size increment 761 + ldr r7, =0x7fff 762 + ands r7, r7, r1, lsr #13 @ extract max number of the index size 763 + loop2: 764 + mov r9, r4 @ create working copy of max way size 765 + loop3: 766 + orr r11, r10, r9, lsl r5 @ factor way and cache number into r11 767 + orr r11, r11, r7, lsl r2 @ factor index number into r11 768 + mcr p15, 0, r11, c7, c14, 2 @ clean & invalidate by set/way 769 + subs r9, r9, #1 @ decrement the way 770 + bge loop3 771 + subs r7, r7, #1 @ decrement the index 772 + bge loop2 773 + skip: 774 + add r10, r10, #2 @ increment cache number 775 + cmp r3, r10 776 + bgt loop1 777 + finished: 778 + mov r10, #0 @ swith back to cache level 0 779 + mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr 780 + ldmfd sp!, {r0-r5, r7, r9-r11} 781 + iflush: 782 + mcr p15, 0, r10, c7, c5, 0 @ invalidate I+BTB 783 + mcr p15, 0, r10, c7, c10, 4 @ drain WB 769 784 mov pc, lr 770 785 771 786 __armv4_mmu_cache_flush:
-2
arch/arm/common/sharpsl_pm.c
··· 766 766 } 767 767 768 768 static struct pm_ops sharpsl_pm_ops = { 769 - .prepare = pxa_pm_prepare, 770 769 .enter = corgi_pxa_pm_enter, 771 - .finish = pxa_pm_finish, 772 770 .valid = pm_valid_only_mem, 773 771 }; 774 772
+37 -3
arch/arm/kernel/head-common.S
··· 20 20 .long _end @ r7 21 21 .long processor_id @ r4 22 22 .long __machine_arch_type @ r5 23 - .long cr_alignment @ r6 23 + .long __atags_pointer @ r6 24 + .long cr_alignment @ r7 24 25 .long init_thread_union + THREAD_START_SP @ sp 25 26 26 27 /* ··· 30 29 * 31 30 * r0 = cp#15 control register 32 31 * r1 = machine ID 32 + * r2 = atags pointer 33 33 * r9 = processor ID 34 34 */ 35 35 .type __mmap_switched, %function ··· 49 47 strcc fp, [r6],#4 50 48 bcc 1b 51 49 52 - ldmia r3, {r4, r5, r6, sp} 50 + ldmia r3, {r4, r5, r6, r7, sp} 53 51 str r9, [r4] @ Save processor ID 54 52 str r1, [r5] @ Save machine type 53 + str r2, [r6] @ Save atags pointer 55 54 bic r4, r0, #CR_A @ Clear 'A' bit 56 - stmia r6, {r0, r4} @ Save control register values 55 + stmia r7, {r0, r4} @ Save control register values 57 56 b start_kernel 58 57 59 58 /* ··· 218 215 bl __lookup_machine_type 219 216 mov r0, r5 220 217 ldmfd sp!, {r4 - r6, pc} 218 + 219 + /* Determine validity of the r2 atags pointer. The heuristic requires 220 + * that the pointer be aligned, in the first 16k of physical RAM and 221 + * that the ATAG_CORE marker is first and present. Future revisions 222 + * of this function may be more lenient with the physical address and 223 + * may also be able to move the ATAGS block if necessary. 224 + * 225 + * r8 = machinfo 226 + * 227 + * Returns: 228 + * r2 either valid atags pointer, or zero 229 + * r5, r6 corrupted 230 + */ 231 + 232 + .type __vet_atags, %function 233 + __vet_atags: 234 + tst r2, #0x3 @ aligned? 235 + bne 1f 236 + 237 + ldr r5, [r2, #0] @ is first tag ATAG_CORE? 238 + subs r5, r5, #ATAG_CORE_SIZE 239 + bne 1f 240 + ldr r5, [r2, #4] 241 + ldr r6, =ATAG_CORE 242 + cmp r5, r6 243 + bne 1f 244 + 245 + mov pc, lr @ atag pointer is ok 246 + 247 + 1: mov r2, #0 248 + mov pc, lr
+6 -1
arch/arm/kernel/head.S
··· 29 29 #define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) 30 30 #define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET) 31 31 32 + #define ATAG_CORE 0x54410001 33 + #define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2) 34 + 35 + 32 36 /* 33 37 * swapper_pg_dir is the virtual address of the initial page table. 34 38 * We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must ··· 65 61 * 66 62 * This is normally called from the decompressor code. The requirements 67 63 * are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0, 68 - * r1 = machine nr. 64 + * r1 = machine nr, r2 = atags pointer. 69 65 * 70 66 * This code is mostly position independent, so if you link the kernel at 71 67 * 0xc0008000, you call this at __pa(0xc0008000). ··· 89 85 bl __lookup_machine_type @ r5=machinfo 90 86 movs r8, r5 @ invalid machine (r5=0)? 91 87 beq __error_a @ yes, error 'a' 88 + bl __vet_atags 92 89 bl __create_page_tables 93 90 94 91 /*
+6 -2
arch/arm/kernel/process.c
··· 44 44 "UK8_32" , "UK9_32" , "UK10_32", "UND_32" , "UK12_32", "UK13_32", "UK14_32", "SYS_32" 45 45 }; 46 46 47 + static const char *isa_modes[] = { 48 + "ARM" , "Thumb" , "Jazelle", "ThumbEE" 49 + }; 50 + 47 51 extern void setup_mm_for_reboot(char mode); 48 52 49 53 static volatile int hlt_counter; ··· 234 230 buf[3] = flags & PSR_V_BIT ? 'V' : 'v'; 235 231 buf[4] = '\0'; 236 232 237 - printk("Flags: %s IRQs o%s FIQs o%s Mode %s%s Segment %s\n", 233 + printk("Flags: %s IRQs o%s FIQs o%s Mode %s ISA %s Segment %s\n", 238 234 buf, interrupts_enabled(regs) ? "n" : "ff", 239 235 fast_interrupts_enabled(regs) ? "n" : "ff", 240 236 processor_modes[processor_mode(regs)], 241 - thumb_mode(regs) ? " (T)" : "", 237 + isa_modes[isa_mode(regs)], 242 238 get_fs() == get_ds() ? "kernel" : "user"); 243 239 #ifdef CONFIG_CPU_CP15 244 240 {
+5 -1
arch/arm/kernel/setup.c
··· 63 63 unsigned int __machine_arch_type; 64 64 EXPORT_SYMBOL(__machine_arch_type); 65 65 66 + unsigned int __atags_pointer __initdata; 67 + 66 68 unsigned int system_rev; 67 69 EXPORT_SYMBOL(system_rev); 68 70 ··· 782 780 if (mdesc->soft_reboot) 783 781 reboot_setup("s"); 784 782 785 - if (mdesc->boot_params) 783 + if (__atags_pointer) 784 + tags = phys_to_virt(__atags_pointer); 785 + else if (mdesc->boot_params) 786 786 tags = phys_to_virt(mdesc->boot_params); 787 787 788 788 /*
+130
arch/arm/mach-at91/board-sam9261ek.c
··· 27 27 #include <linux/spi/spi.h> 28 28 #include <linux/spi/ads7846.h> 29 29 #include <linux/dm9000.h> 30 + #include <linux/fb.h> 31 + #include <linux/gpio_keys.h> 32 + #include <linux/input.h> 33 + 34 + #include <video/atmel_lcdc.h> 30 35 31 36 #include <asm/hardware.h> 32 37 #include <asm/setup.h> ··· 276 271 }; 277 272 278 273 274 + /* 275 + * LCD Controller 276 + */ 277 + #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 278 + static struct fb_videomode at91_tft_vga_modes[] = { 279 + { 280 + .name = "TX09D50VM1CCA @ 60", 281 + .refresh = 60, 282 + .xres = 240, .yres = 320, 283 + .pixclock = KHZ2PICOS(4965), 284 + 285 + .left_margin = 1, .right_margin = 33, 286 + .upper_margin = 1, .lower_margin = 0, 287 + .hsync_len = 5, .vsync_len = 1, 288 + 289 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 290 + .vmode = FB_VMODE_NONINTERLACED, 291 + }, 292 + }; 293 + 294 + static struct fb_monspecs at91fb_default_monspecs = { 295 + .manufacturer = "HIT", 296 + .monitor = "TX09D50VM1CCA", 297 + 298 + .modedb = at91_tft_vga_modes, 299 + .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), 300 + .hfmin = 15000, 301 + .hfmax = 64000, 302 + .vfmin = 50, 303 + .vfmax = 150, 304 + }; 305 + 306 + #define AT91SAM9261_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ 307 + | ATMEL_LCDC_DISTYPE_TFT \ 308 + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 309 + 310 + static void at91_lcdc_power_control(int on) 311 + { 312 + if (on) 313 + at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ 314 + else 315 + at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ 316 + } 317 + 318 + /* Driver datas */ 319 + static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 320 + .default_bpp = 16, 321 + .default_dmacon = ATMEL_LCDC_DMAEN, 322 + .default_lcdcon2 = AT91SAM9261_DEFAULT_LCDCON2, 323 + .default_monspecs = &at91fb_default_monspecs, 324 + .atmel_lcdfb_power_control = at91_lcdc_power_control, 325 + .guard_time = 1, 326 + }; 327 + 328 + #else 329 + static struct atmel_lcdfb_info __initdata ek_lcdc_data; 330 + #endif 331 + 332 + 333 + /* 334 + * GPIO Buttons 335 + */ 336 + #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 337 + static struct gpio_keys_button ek_buttons[] = { 338 + { 339 + .gpio = AT91_PIN_PA27, 340 + .keycode = BTN_0, 341 + .desc = "Button 0", 342 + .active_low = 1, 343 + }, 344 + { 345 + .gpio = AT91_PIN_PA26, 346 + .keycode = BTN_1, 347 + .desc = "Button 1", 348 + .active_low = 1, 349 + }, 350 + { 351 + .gpio = AT91_PIN_PA25, 352 + .keycode = BTN_2, 353 + .desc = "Button 2", 354 + .active_low = 1, 355 + }, 356 + { 357 + .gpio = AT91_PIN_PA24, 358 + .keycode = BTN_3, 359 + .desc = "Button 3", 360 + .active_low = 1, 361 + } 362 + }; 363 + 364 + static struct gpio_keys_platform_data ek_button_data = { 365 + .buttons = ek_buttons, 366 + .nbuttons = ARRAY_SIZE(ek_buttons), 367 + }; 368 + 369 + static struct platform_device ek_button_device = { 370 + .name = "gpio-keys", 371 + .id = -1, 372 + .num_resources = 0, 373 + .dev = { 374 + .platform_data = &ek_button_data, 375 + } 376 + }; 377 + 378 + static void __init ek_add_device_buttons(void) 379 + { 380 + at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ 381 + at91_set_deglitch(AT91_PIN_PB27, 1); 382 + at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ 383 + at91_set_deglitch(AT91_PIN_PB26, 1); 384 + at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ 385 + at91_set_deglitch(AT91_PIN_PB25, 1); 386 + at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ 387 + at91_set_deglitch(AT91_PIN_PB24, 1); 388 + 389 + platform_device_register(&ek_button_device); 390 + } 391 + #else 392 + static void __init ek_add_device_buttons(void) {} 393 + #endif 394 + 279 395 static void __init ek_board_init(void) 280 396 { 281 397 /* Serial */ ··· 422 296 /* MMC */ 423 297 at91_add_device_mmc(0, &ek_mmc_data); 424 298 #endif 299 + /* LCD Controller */ 300 + at91_add_device_lcdc(&ek_lcdc_data); 301 + /* Push Buttons */ 302 + ek_add_device_buttons(); 425 303 } 426 304 427 305 MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
+64
arch/arm/mach-at91/board-sam9263ek.c
··· 26 26 #include <linux/platform_device.h> 27 27 #include <linux/spi/spi.h> 28 28 #include <linux/spi/ads7846.h> 29 + #include <linux/fb.h> 30 + 31 + #include <video/atmel_lcdc.h> 29 32 30 33 #include <asm/hardware.h> 31 34 #include <asm/setup.h> ··· 205 202 206 203 207 204 /* 205 + * LCD Controller 206 + */ 207 + #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 208 + static struct fb_videomode at91_tft_vga_modes[] = { 209 + { 210 + .name = "TX09D50VM1CCA @ 60", 211 + .refresh = 60, 212 + .xres = 240, .yres = 320, 213 + .pixclock = KHZ2PICOS(4965), 214 + 215 + .left_margin = 1, .right_margin = 33, 216 + .upper_margin = 1, .lower_margin = 0, 217 + .hsync_len = 5, .vsync_len = 1, 218 + 219 + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 220 + .vmode = FB_VMODE_NONINTERLACED, 221 + }, 222 + }; 223 + 224 + static struct fb_monspecs at91fb_default_monspecs = { 225 + .manufacturer = "HIT", 226 + .monitor = "TX09D70VM1CCA", 227 + 228 + .modedb = at91_tft_vga_modes, 229 + .modedb_len = ARRAY_SIZE(at91_tft_vga_modes), 230 + .hfmin = 15000, 231 + .hfmax = 64000, 232 + .vfmin = 50, 233 + .vfmax = 150, 234 + }; 235 + 236 + #define AT91SAM9263_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ 237 + | ATMEL_LCDC_DISTYPE_TFT \ 238 + | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 239 + 240 + static void at91_lcdc_power_control(int on) 241 + { 242 + if (on) 243 + at91_set_gpio_value(AT91_PIN_PD12, 0); /* power up */ 244 + else 245 + at91_set_gpio_value(AT91_PIN_PD12, 1); /* power down */ 246 + } 247 + 248 + /* Driver datas */ 249 + static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 250 + .default_bpp = 16, 251 + .default_dmacon = ATMEL_LCDC_DMAEN, 252 + .default_lcdcon2 = AT91SAM9263_DEFAULT_LCDCON2, 253 + .default_monspecs = &at91fb_default_monspecs, 254 + .atmel_lcdfb_power_control = at91_lcdc_power_control, 255 + .guard_time = 1, 256 + }; 257 + 258 + #else 259 + static struct atmel_lcdfb_info __initdata ek_lcdc_data; 260 + #endif 261 + 262 + 263 + /* 208 264 * AC97 209 265 */ 210 266 static struct atmel_ac97_data ek_ac97_data = { ··· 292 230 at91_add_device_nand(&ek_nand_data); 293 231 /* I2C */ 294 232 at91_add_device_i2c(); 233 + /* LCD Controller */ 234 + at91_add_device_lcdc(&ek_lcdc_data); 295 235 /* AC97 */ 296 236 at91_add_device_ac97(&ek_ac97_data); 297 237 }
+2 -1
arch/arm/mach-davinci/Makefile
··· 4 4 # 5 5 6 6 # Common objects 7 - obj-y := time.o irq.o serial.o io.o id.o psc.o 7 + obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ 8 + gpio.o mux.o 8 9 9 10 # Board specific 10 11 obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o
+2
arch/arm/mach-davinci/board-evm.c
··· 32 32 void __init davinci_psc_init(void); 33 33 void __init davinci_irq_init(void); 34 34 void __init davinci_map_common_io(void); 35 + void __init davinci_init_common_hw(void); 35 36 36 37 /* NOR Flash base address set to CS0 by default */ 37 38 #define NOR_FLASH_PHYS 0x02000000 ··· 117 116 118 117 static __init void davinci_evm_irq_init(void) 119 118 { 119 + davinci_init_common_hw(); 120 120 davinci_irq_init(); 121 121 } 122 122
+323
arch/arm/mach-davinci/clock.c
··· 1 + /* 2 + * TI DaVinci clock config file 3 + * 4 + * Copyright (C) 2006 Texas Instruments. 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 as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + */ 11 + 12 + #include <linux/module.h> 13 + #include <linux/kernel.h> 14 + #include <linux/init.h> 15 + #include <linux/errno.h> 16 + #include <linux/err.h> 17 + #include <linux/mutex.h> 18 + #include <linux/platform_device.h> 19 + 20 + #include <asm/hardware.h> 21 + #include <asm/io.h> 22 + 23 + #include <asm/arch/psc.h> 24 + #include "clock.h" 25 + 26 + /* PLL/Reset register offsets */ 27 + #define PLLM 0x110 28 + 29 + static LIST_HEAD(clocks); 30 + static DEFINE_MUTEX(clocks_mutex); 31 + static DEFINE_SPINLOCK(clockfw_lock); 32 + 33 + static unsigned int commonrate; 34 + static unsigned int armrate; 35 + static unsigned int fixedrate = 27000000; /* 27 MHZ */ 36 + 37 + extern void davinci_psc_config(unsigned int domain, unsigned int id, char enable); 38 + 39 + /* 40 + * Returns a clock. Note that we first try to use device id on the bus 41 + * and clock name. If this fails, we try to use clock name only. 42 + */ 43 + struct clk *clk_get(struct device *dev, const char *id) 44 + { 45 + struct clk *p, *clk = ERR_PTR(-ENOENT); 46 + int idno; 47 + 48 + if (dev == NULL || dev->bus != &platform_bus_type) 49 + idno = -1; 50 + else 51 + idno = to_platform_device(dev)->id; 52 + 53 + mutex_lock(&clocks_mutex); 54 + 55 + list_for_each_entry(p, &clocks, node) { 56 + if (p->id == idno && 57 + strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 58 + clk = p; 59 + goto found; 60 + } 61 + } 62 + 63 + list_for_each_entry(p, &clocks, node) { 64 + if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 65 + clk = p; 66 + break; 67 + } 68 + } 69 + 70 + found: 71 + mutex_unlock(&clocks_mutex); 72 + 73 + return clk; 74 + } 75 + EXPORT_SYMBOL(clk_get); 76 + 77 + void clk_put(struct clk *clk) 78 + { 79 + if (clk && !IS_ERR(clk)) 80 + module_put(clk->owner); 81 + } 82 + EXPORT_SYMBOL(clk_put); 83 + 84 + static int __clk_enable(struct clk *clk) 85 + { 86 + if (clk->flags & ALWAYS_ENABLED) 87 + return 0; 88 + 89 + davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, clk->lpsc, 1); 90 + return 0; 91 + } 92 + 93 + static void __clk_disable(struct clk *clk) 94 + { 95 + if (clk->usecount) 96 + return; 97 + 98 + davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, clk->lpsc, 0); 99 + } 100 + 101 + int clk_enable(struct clk *clk) 102 + { 103 + unsigned long flags; 104 + int ret = 0; 105 + 106 + if (clk == NULL || IS_ERR(clk)) 107 + return -EINVAL; 108 + 109 + if (clk->usecount++ == 0) { 110 + spin_lock_irqsave(&clockfw_lock, flags); 111 + ret = __clk_enable(clk); 112 + spin_unlock_irqrestore(&clockfw_lock, flags); 113 + } 114 + 115 + return ret; 116 + } 117 + EXPORT_SYMBOL(clk_enable); 118 + 119 + void clk_disable(struct clk *clk) 120 + { 121 + unsigned long flags; 122 + 123 + if (clk == NULL || IS_ERR(clk)) 124 + return; 125 + 126 + if (clk->usecount > 0 && !(--clk->usecount)) { 127 + spin_lock_irqsave(&clockfw_lock, flags); 128 + __clk_disable(clk); 129 + spin_unlock_irqrestore(&clockfw_lock, flags); 130 + } 131 + } 132 + EXPORT_SYMBOL(clk_disable); 133 + 134 + unsigned long clk_get_rate(struct clk *clk) 135 + { 136 + if (clk == NULL || IS_ERR(clk)) 137 + return -EINVAL; 138 + 139 + return *(clk->rate); 140 + } 141 + EXPORT_SYMBOL(clk_get_rate); 142 + 143 + long clk_round_rate(struct clk *clk, unsigned long rate) 144 + { 145 + if (clk == NULL || IS_ERR(clk)) 146 + return -EINVAL; 147 + 148 + return *(clk->rate); 149 + } 150 + EXPORT_SYMBOL(clk_round_rate); 151 + 152 + int clk_set_rate(struct clk *clk, unsigned long rate) 153 + { 154 + if (clk == NULL || IS_ERR(clk)) 155 + return -EINVAL; 156 + 157 + /* changing the clk rate is not supported */ 158 + return -EINVAL; 159 + } 160 + EXPORT_SYMBOL(clk_set_rate); 161 + 162 + int clk_register(struct clk *clk) 163 + { 164 + if (clk == NULL || IS_ERR(clk)) 165 + return -EINVAL; 166 + 167 + mutex_lock(&clocks_mutex); 168 + list_add(&clk->node, &clocks); 169 + mutex_unlock(&clocks_mutex); 170 + 171 + return 0; 172 + } 173 + EXPORT_SYMBOL(clk_register); 174 + 175 + void clk_unregister(struct clk *clk) 176 + { 177 + if (clk == NULL || IS_ERR(clk)) 178 + return; 179 + 180 + mutex_lock(&clocks_mutex); 181 + list_del(&clk->node); 182 + mutex_unlock(&clocks_mutex); 183 + } 184 + EXPORT_SYMBOL(clk_unregister); 185 + 186 + static struct clk davinci_clks[] = { 187 + { 188 + .name = "ARMCLK", 189 + .rate = &armrate, 190 + .lpsc = -1, 191 + .flags = ALWAYS_ENABLED, 192 + }, 193 + { 194 + .name = "UART", 195 + .rate = &fixedrate, 196 + .lpsc = DAVINCI_LPSC_UART0, 197 + }, 198 + { 199 + .name = "EMACCLK", 200 + .rate = &commonrate, 201 + .lpsc = DAVINCI_LPSC_EMAC_WRAPPER, 202 + }, 203 + { 204 + .name = "I2CCLK", 205 + .rate = &fixedrate, 206 + .lpsc = DAVINCI_LPSC_I2C, 207 + }, 208 + { 209 + .name = "IDECLK", 210 + .rate = &commonrate, 211 + .lpsc = DAVINCI_LPSC_ATA, 212 + }, 213 + { 214 + .name = "McBSPCLK", 215 + .rate = &commonrate, 216 + .lpsc = DAVINCI_LPSC_McBSP, 217 + }, 218 + { 219 + .name = "MMCSDCLK", 220 + .rate = &commonrate, 221 + .lpsc = DAVINCI_LPSC_MMC_SD, 222 + }, 223 + { 224 + .name = "SPICLK", 225 + .rate = &commonrate, 226 + .lpsc = DAVINCI_LPSC_SPI, 227 + }, 228 + { 229 + .name = "gpio", 230 + .rate = &commonrate, 231 + .lpsc = DAVINCI_LPSC_GPIO, 232 + }, 233 + { 234 + .name = "AEMIFCLK", 235 + .rate = &commonrate, 236 + .lpsc = DAVINCI_LPSC_AEMIF, 237 + .usecount = 1, 238 + } 239 + }; 240 + 241 + int __init davinci_clk_init(void) 242 + { 243 + struct clk *clkp; 244 + int count = 0; 245 + u32 pll_mult; 246 + 247 + pll_mult = davinci_readl(DAVINCI_PLL_CNTRL0_BASE + PLLM); 248 + commonrate = ((pll_mult + 1) * 27000000) / 6; 249 + armrate = ((pll_mult + 1) * 27000000) / 2; 250 + 251 + for (clkp = davinci_clks; count < ARRAY_SIZE(davinci_clks); 252 + count++, clkp++) { 253 + clk_register(clkp); 254 + 255 + /* Turn on clocks that have been enabled in the 256 + * table above */ 257 + if (clkp->usecount) 258 + clk_enable(clkp); 259 + } 260 + 261 + return 0; 262 + } 263 + 264 + #ifdef CONFIG_PROC_FS 265 + #include <linux/proc_fs.h> 266 + #include <linux/seq_file.h> 267 + 268 + static void *davinci_ck_start(struct seq_file *m, loff_t *pos) 269 + { 270 + return *pos < 1 ? (void *)1 : NULL; 271 + } 272 + 273 + static void *davinci_ck_next(struct seq_file *m, void *v, loff_t *pos) 274 + { 275 + ++*pos; 276 + return NULL; 277 + } 278 + 279 + static void davinci_ck_stop(struct seq_file *m, void *v) 280 + { 281 + } 282 + 283 + static int davinci_ck_show(struct seq_file *m, void *v) 284 + { 285 + struct clk *cp; 286 + 287 + list_for_each_entry(cp, &clocks, node) 288 + seq_printf(m,"%s %d %d\n", cp->name, *(cp->rate), cp->usecount); 289 + 290 + return 0; 291 + } 292 + 293 + static struct seq_operations davinci_ck_op = { 294 + .start = davinci_ck_start, 295 + .next = davinci_ck_next, 296 + .stop = davinci_ck_stop, 297 + .show = davinci_ck_show 298 + }; 299 + 300 + static int davinci_ck_open(struct inode *inode, struct file *file) 301 + { 302 + return seq_open(file, &davinci_ck_op); 303 + } 304 + 305 + static struct file_operations proc_davinci_ck_operations = { 306 + .open = davinci_ck_open, 307 + .read = seq_read, 308 + .llseek = seq_lseek, 309 + .release = seq_release, 310 + }; 311 + 312 + static int __init davinci_ck_proc_init(void) 313 + { 314 + struct proc_dir_entry *entry; 315 + 316 + entry = create_proc_entry("davinci_clocks", 0, NULL); 317 + if (entry) 318 + entry->proc_fops = &proc_davinci_ck_operations; 319 + return 0; 320 + 321 + } 322 + __initcall(davinci_ck_proc_init); 323 + #endif /* CONFIG_DEBUG_PROC_FS */
+33
arch/arm/mach-davinci/clock.h
··· 1 + /* 2 + * TI DaVinci clock definitions 3 + * 4 + * Copyright (C) 2006 Texas Instruments. 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 + 11 + #ifndef __ARCH_ARM_DAVINCI_CLOCK_H 12 + #define __ARCH_ARM_DAVINCI_CLOCK_H 13 + 14 + struct clk { 15 + struct list_head node; 16 + struct module *owner; 17 + const char *name; 18 + unsigned int *rate; 19 + int id; 20 + __s8 usecount; 21 + __u8 flags; 22 + __u8 lpsc; 23 + }; 24 + 25 + /* Clock flags */ 26 + #define RATE_CKCTL 1 27 + #define RATE_FIXED 2 28 + #define RATE_PROPAGATES 4 29 + #define VIRTUAL_CLOCK 8 30 + #define ALWAYS_ENABLED 16 31 + #define ENABLE_REG_32BIT 32 32 + 33 + #endif
+286
arch/arm/mach-davinci/gpio.c
··· 1 + /* 2 + * TI DaVinci GPIO Support 3 + * 4 + * Copyright (c) 2006 David Brownell 5 + * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + */ 12 + 13 + #include <linux/errno.h> 14 + #include <linux/kernel.h> 15 + #include <linux/list.h> 16 + #include <linux/module.h> 17 + #include <linux/clk.h> 18 + #include <linux/err.h> 19 + #include <linux/io.h> 20 + #include <linux/irq.h> 21 + #include <linux/bitops.h> 22 + 23 + #include <asm/arch/irqs.h> 24 + #include <asm/arch/hardware.h> 25 + #include <asm/arch/gpio.h> 26 + 27 + #include <asm/mach/irq.h> 28 + 29 + static DEFINE_SPINLOCK(gpio_lock); 30 + static DECLARE_BITMAP(gpio_in_use, DAVINCI_N_GPIO); 31 + 32 + int gpio_request(unsigned gpio, const char *tag) 33 + { 34 + if (gpio >= DAVINCI_N_GPIO) 35 + return -EINVAL; 36 + 37 + if (test_and_set_bit(gpio, gpio_in_use)) 38 + return -EBUSY; 39 + 40 + return 0; 41 + } 42 + EXPORT_SYMBOL(gpio_request); 43 + 44 + void gpio_free(unsigned gpio) 45 + { 46 + if (gpio >= DAVINCI_N_GPIO) 47 + return; 48 + 49 + clear_bit(gpio, gpio_in_use); 50 + } 51 + EXPORT_SYMBOL(gpio_free); 52 + 53 + /* create a non-inlined version */ 54 + static struct gpio_controller *__iomem gpio2controller(unsigned gpio) 55 + { 56 + return __gpio_to_controller(gpio); 57 + } 58 + 59 + /* 60 + * Assuming the pin is muxed as a gpio output, set its output value. 61 + */ 62 + void __gpio_set(unsigned gpio, int value) 63 + { 64 + struct gpio_controller *__iomem g = gpio2controller(gpio); 65 + 66 + __raw_writel(__gpio_mask(gpio), value ? &g->set_data : &g->clr_data); 67 + } 68 + EXPORT_SYMBOL(__gpio_set); 69 + 70 + 71 + /* 72 + * Read the pin's value (works even if it's set up as output); 73 + * returns zero/nonzero. 74 + * 75 + * Note that changes are synched to the GPIO clock, so reading values back 76 + * right after you've set them may give old values. 77 + */ 78 + int __gpio_get(unsigned gpio) 79 + { 80 + struct gpio_controller *__iomem g = gpio2controller(gpio); 81 + 82 + return !!(__gpio_mask(gpio) & __raw_readl(&g->in_data)); 83 + } 84 + EXPORT_SYMBOL(__gpio_get); 85 + 86 + 87 + /*--------------------------------------------------------------------------*/ 88 + 89 + /* 90 + * board setup code *MUST* set PINMUX0 and PINMUX1 as 91 + * needed, and enable the GPIO clock. 92 + */ 93 + 94 + int gpio_direction_input(unsigned gpio) 95 + { 96 + struct gpio_controller *__iomem g = gpio2controller(gpio); 97 + u32 temp; 98 + u32 mask; 99 + 100 + if (!g) 101 + return -EINVAL; 102 + 103 + spin_lock(&gpio_lock); 104 + mask = __gpio_mask(gpio); 105 + temp = __raw_readl(&g->dir); 106 + temp |= mask; 107 + __raw_writel(temp, &g->dir); 108 + spin_unlock(&gpio_lock); 109 + return 0; 110 + } 111 + EXPORT_SYMBOL(gpio_direction_input); 112 + 113 + int gpio_direction_output(unsigned gpio, int value) 114 + { 115 + struct gpio_controller *__iomem g = gpio2controller(gpio); 116 + u32 temp; 117 + u32 mask; 118 + 119 + if (!g) 120 + return -EINVAL; 121 + 122 + spin_lock(&gpio_lock); 123 + mask = __gpio_mask(gpio); 124 + temp = __raw_readl(&g->dir); 125 + temp &= ~mask; 126 + __raw_writel(mask, value ? &g->set_data : &g->clr_data); 127 + __raw_writel(temp, &g->dir); 128 + spin_unlock(&gpio_lock); 129 + return 0; 130 + } 131 + EXPORT_SYMBOL(gpio_direction_output); 132 + 133 + /* 134 + * We expect irqs will normally be set up as input pins, but they can also be 135 + * used as output pins ... which is convenient for testing. 136 + * 137 + * NOTE: GPIO0..GPIO7 also have direct INTC hookups, which work in addition 138 + * to their GPIOBNK0 irq (but with a bit less overhead). But we don't have 139 + * a good way to hook those up ... 140 + * 141 + * All those INTC hookups (GPIO0..GPIO7 plus five IRQ banks) can also 142 + * serve as EDMA event triggers. 143 + */ 144 + 145 + static void gpio_irq_disable(unsigned irq) 146 + { 147 + struct gpio_controller *__iomem g = get_irq_chip_data(irq); 148 + u32 mask = __gpio_mask(irq_to_gpio(irq)); 149 + 150 + __raw_writel(mask, &g->clr_falling); 151 + __raw_writel(mask, &g->clr_rising); 152 + } 153 + 154 + static void gpio_irq_enable(unsigned irq) 155 + { 156 + struct gpio_controller *__iomem g = get_irq_chip_data(irq); 157 + u32 mask = __gpio_mask(irq_to_gpio(irq)); 158 + 159 + if (irq_desc[irq].status & IRQ_TYPE_EDGE_FALLING) 160 + __raw_writel(mask, &g->set_falling); 161 + if (irq_desc[irq].status & IRQ_TYPE_EDGE_RISING) 162 + __raw_writel(mask, &g->set_rising); 163 + } 164 + 165 + static int gpio_irq_type(unsigned irq, unsigned trigger) 166 + { 167 + struct gpio_controller *__iomem g = get_irq_chip_data(irq); 168 + u32 mask = __gpio_mask(irq_to_gpio(irq)); 169 + 170 + if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 171 + return -EINVAL; 172 + 173 + irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK; 174 + irq_desc[irq].status |= trigger; 175 + 176 + __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING) 177 + ? &g->set_falling : &g->clr_falling); 178 + __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING) 179 + ? &g->set_rising : &g->clr_rising); 180 + return 0; 181 + } 182 + 183 + static struct irq_chip gpio_irqchip = { 184 + .name = "GPIO", 185 + .enable = gpio_irq_enable, 186 + .disable = gpio_irq_disable, 187 + .set_type = gpio_irq_type, 188 + }; 189 + 190 + static void 191 + gpio_irq_handler(unsigned irq, struct irq_desc *desc) 192 + { 193 + struct gpio_controller *__iomem g = get_irq_chip_data(irq); 194 + u32 mask = 0xffff; 195 + 196 + /* we only care about one bank */ 197 + if (irq & 1) 198 + mask <<= 16; 199 + 200 + /* temporarily mask (level sensitive) parent IRQ */ 201 + desc->chip->ack(irq); 202 + while (1) { 203 + u32 status; 204 + struct irq_desc *gpio; 205 + int n; 206 + int res; 207 + 208 + /* ack any irqs */ 209 + status = __raw_readl(&g->intstat) & mask; 210 + if (!status) 211 + break; 212 + __raw_writel(status, &g->intstat); 213 + if (irq & 1) 214 + status >>= 16; 215 + 216 + /* now demux them to the right lowlevel handler */ 217 + n = (int)get_irq_data(irq); 218 + gpio = &irq_desc[n]; 219 + while (status) { 220 + res = ffs(status); 221 + n += res; 222 + gpio += res; 223 + desc_handle_irq(n - 1, gpio - 1); 224 + status >>= res; 225 + } 226 + } 227 + desc->chip->unmask(irq); 228 + /* now it may re-trigger */ 229 + } 230 + 231 + /* 232 + * NOTE: for suspend/resume, probably best to make a sysdev (and class) 233 + * with its suspend/resume calls hooking into the results of the set_wake() 234 + * calls ... so if no gpios are wakeup events the clock can be disabled, 235 + * with outputs left at previously set levels, and so that VDD3P3V.IOPWDN0 236 + * can be set appropriately for GPIOV33 pins. 237 + */ 238 + 239 + static int __init davinci_gpio_irq_setup(void) 240 + { 241 + unsigned gpio, irq, bank; 242 + struct clk *clk; 243 + 244 + clk = clk_get(NULL, "gpio"); 245 + if (IS_ERR(clk)) { 246 + printk(KERN_ERR "Error %ld getting gpio clock?\n", 247 + PTR_ERR(clk)); 248 + return 0; 249 + } 250 + 251 + clk_enable(clk); 252 + 253 + for (gpio = 0, irq = gpio_to_irq(0), bank = IRQ_GPIOBNK0; 254 + gpio < DAVINCI_N_GPIO; bank++) { 255 + struct gpio_controller *__iomem g = gpio2controller(gpio); 256 + unsigned i; 257 + 258 + __raw_writel(~0, &g->clr_falling); 259 + __raw_writel(~0, &g->clr_rising); 260 + 261 + /* set up all irqs in this bank */ 262 + set_irq_chained_handler(bank, gpio_irq_handler); 263 + set_irq_chip_data(bank, g); 264 + set_irq_data(bank, (void *)irq); 265 + 266 + for (i = 0; i < 16 && gpio < DAVINCI_N_GPIO; 267 + i++, irq++, gpio++) { 268 + set_irq_chip(irq, &gpio_irqchip); 269 + set_irq_chip_data(irq, g); 270 + set_irq_handler(irq, handle_simple_irq); 271 + set_irq_flags(irq, IRQF_VALID); 272 + } 273 + } 274 + 275 + /* BINTEN -- per-bank interrupt enable. genirq would also let these 276 + * bits be set/cleared dynamically. 277 + */ 278 + __raw_writel(0x1f, (void *__iomem) 279 + IO_ADDRESS(DAVINCI_GPIO_BASE + 0x08)); 280 + 281 + printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); 282 + 283 + return 0; 284 + } 285 + 286 + arch_initcall(davinci_gpio_irq_setup);
+6
arch/arm/mach-davinci/io.c
··· 17 17 #include <asm/memory.h> 18 18 19 19 #include <asm/mach/map.h> 20 + #include <asm/arch/clock.h> 20 21 21 22 extern void davinci_check_revision(void); 22 23 ··· 49 48 * IO space mapping must be initialized before we can do that. 50 49 */ 51 50 davinci_check_revision(); 51 + } 52 + 53 + void __init davinci_init_common_hw(void) 54 + { 55 + davinci_clk_init(); 52 56 }
+41
arch/arm/mach-davinci/mux.c
··· 1 + /* 2 + * DaVinci pin multiplexing configurations 3 + * 4 + * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com> 5 + * 6 + * 2007 (c) MontaVista Software, Inc. This file is licensed under 7 + * the terms of the GNU General Public License version 2. This program 8 + * is licensed "as is" without any warranty of any kind, whether express 9 + * or implied. 10 + */ 11 + #include <linux/io.h> 12 + #include <linux/spinlock.h> 13 + 14 + #include <asm/hardware.h> 15 + 16 + #include <asm/arch/mux.h> 17 + 18 + /* System control register offsets */ 19 + #define PINMUX0 0x00 20 + #define PINMUX1 0x04 21 + 22 + static DEFINE_SPINLOCK(mux_lock); 23 + 24 + void davinci_mux_peripheral(unsigned int mux, unsigned int enable) 25 + { 26 + u32 pinmux, muxreg = PINMUX0; 27 + 28 + if (mux >= DAVINCI_MUX_LEVEL2) { 29 + muxreg = PINMUX1; 30 + mux -= DAVINCI_MUX_LEVEL2; 31 + } 32 + 33 + spin_lock(&mux_lock); 34 + pinmux = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + muxreg); 35 + if (enable) 36 + pinmux |= (1 << mux); 37 + else 38 + pinmux &= ~(1 << mux); 39 + davinci_writel(pinmux, DAVINCI_SYSTEM_MODULE_BASE + muxreg); 40 + spin_unlock(&mux_lock); 41 + }
+57 -30
arch/arm/mach-davinci/psc.c
··· 25 25 #include <asm/io.h> 26 26 #include <asm/hardware.h> 27 27 #include <asm/arch/psc.h> 28 + #include <asm/arch/mux.h> 28 29 29 - #define PTCMD __REG(0x01C41120) 30 - #define PDSTAT __REG(0x01C41200) 31 - #define PDCTL1 __REG(0x01C41304) 32 - #define EPCPR __REG(0x01C41070) 33 - #define PTSTAT __REG(0x01C41128) 30 + /* PSC register offsets */ 31 + #define EPCPR 0x070 32 + #define PTCMD 0x120 33 + #define PTSTAT 0x128 34 + #define PDSTAT 0x200 35 + #define PDCTL1 0x304 36 + #define MDSTAT 0x800 37 + #define MDCTL 0xA00 34 38 35 - #define MDSTAT IO_ADDRESS(0x01C41800) 36 - #define MDCTL IO_ADDRESS(0x01C41A00) 37 - 38 - #define PINMUX0 __REG(0x01c40000) 39 - #define PINMUX1 __REG(0x01c40004) 40 - #define VDD3P3V_PWDN __REG(0x01C40048) 39 + /* System control register offsets */ 40 + #define VDD3P3V_PWDN 0x48 41 41 42 42 static void davinci_psc_mux(unsigned int id) 43 43 { 44 44 switch (id) { 45 45 case DAVINCI_LPSC_ATA: 46 - PINMUX0 |= (1 << 17) | (1 << 16); 46 + davinci_mux_peripheral(DAVINCI_MUX_HDIREN, 1); 47 + davinci_mux_peripheral(DAVINCI_MUX_ATAEN, 1); 47 48 break; 48 49 case DAVINCI_LPSC_MMC_SD: 49 50 /* VDD power manupulations are done in U-Boot for CPMAC 50 51 * so applies to MMC as well 51 52 */ 52 53 /*Set up the pull regiter for MMC */ 53 - VDD3P3V_PWDN = 0x0; 54 - PINMUX1 &= (~(1 << 9)); 54 + davinci_writel(0, DAVINCI_SYSTEM_MODULE_BASE + VDD3P3V_PWDN); 55 + davinci_mux_peripheral(DAVINCI_MUX_MSTK, 0); 55 56 break; 56 57 case DAVINCI_LPSC_I2C: 57 - PINMUX1 |= (1 << 7); 58 + davinci_mux_peripheral(DAVINCI_MUX_I2C, 1); 58 59 break; 59 60 case DAVINCI_LPSC_McBSP: 60 - PINMUX1 |= (1 << 10); 61 + davinci_mux_peripheral(DAVINCI_MUX_ASP, 1); 61 62 break; 62 63 default: 63 64 break; ··· 68 67 /* Enable or disable a PSC domain */ 69 68 void davinci_psc_config(unsigned int domain, unsigned int id, char enable) 70 69 { 71 - volatile unsigned int *mdstat = (unsigned int *)((int)MDSTAT + 4 * id); 72 - volatile unsigned int *mdctl = (unsigned int *)((int)MDCTL + 4 * id); 70 + u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask; 73 71 74 72 if (id < 0) 75 73 return; 76 74 75 + mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id); 77 76 if (enable) 78 - *mdctl |= 0x00000003; /* Enable Module */ 77 + mdctl |= 0x00000003; /* Enable Module */ 79 78 else 80 - *mdctl &= 0xFFFFFFF2; /* Disable Module */ 79 + mdctl &= 0xFFFFFFF2; /* Disable Module */ 80 + davinci_writel(mdctl, DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id); 81 81 82 - if ((PDSTAT & 0x00000001) == 0) { 83 - PDCTL1 |= 0x1; 84 - PTCMD = (1 << domain); 85 - while ((((EPCPR >> domain) & 1) == 0)); 82 + pdstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDSTAT); 83 + if ((pdstat & 0x00000001) == 0) { 84 + pdctl1 = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 85 + pdctl1 |= 0x1; 86 + davinci_writel(pdctl1, DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 86 87 87 - PDCTL1 |= 0x100; 88 - while (!(((PTSTAT >> domain) & 1) == 0)); 88 + ptcmd = 1 << domain; 89 + davinci_writel(ptcmd, DAVINCI_PWR_SLEEP_CNTRL_BASE + PTCMD); 90 + 91 + do { 92 + epcpr = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 93 + EPCPR); 94 + } while ((((epcpr >> domain) & 1) == 0)); 95 + 96 + pdctl1 = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 97 + pdctl1 |= 0x100; 98 + davinci_writel(pdctl1, DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 99 + 100 + do { 101 + ptstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 102 + PTSTAT); 103 + } while (!(((ptstat >> domain) & 1) == 0)); 89 104 } else { 90 - PTCMD = (1 << domain); 91 - while (!(((PTSTAT >> domain) & 1) == 0)); 105 + ptcmd = 1 << domain; 106 + davinci_writel(ptcmd, DAVINCI_PWR_SLEEP_CNTRL_BASE + PTCMD); 107 + 108 + do { 109 + ptstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 110 + PTSTAT); 111 + } while (!(((ptstat >> domain) & 1) == 0)); 92 112 } 93 113 94 114 if (enable) 95 - while (!((*mdstat & 0x0000001F) == 0x3)); 115 + mdstat_mask = 0x3; 96 116 else 97 - while (!((*mdstat & 0x0000001F) == 0x2)); 117 + mdstat_mask = 0x2; 118 + 119 + do { 120 + mdstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 121 + MDSTAT + 4 * id); 122 + } while (!((mdstat & 0x0000001F) == mdstat_mask)); 98 123 99 124 if (enable) 100 125 davinci_psc_mux(id);
+118
arch/arm/mach-imx/generic.c
··· 28 28 #include <linux/module.h> 29 29 #include <linux/string.h> 30 30 31 + #include <asm/errno.h> 31 32 #include <asm/arch/imxfb.h> 32 33 #include <asm/hardware.h> 33 34 #include <asm/arch/imx-regs.h> 34 35 35 36 #include <asm/mach/map.h> 36 37 #include <asm/arch/mmc.h> 38 + #include <asm/arch/gpio.h> 39 + 40 + unsigned long imx_gpio_alloc_map[(GPIO_PORT_MAX + 1) * 32 / BITS_PER_LONG]; 37 41 38 42 void imx_gpio_mode(int gpio_mode) 39 43 { ··· 98 94 } 99 95 100 96 EXPORT_SYMBOL(imx_gpio_mode); 97 + 98 + int imx_gpio_request(unsigned gpio, const char *label) 99 + { 100 + if(gpio >= (GPIO_PORT_MAX + 1) * 32) 101 + printk(KERN_ERR "imx_gpio: Attempt to request nonexistent GPIO %d for \"%s\"\n", 102 + gpio, label ? label : "?"); 103 + return -EINVAL; 104 + 105 + if(test_and_set_bit(gpio, imx_gpio_alloc_map)) { 106 + printk(KERN_ERR "imx_gpio: GPIO %d already used. Allocation for \"%s\" failed\n", 107 + gpio, label ? label : "?"); 108 + return -EBUSY; 109 + } 110 + 111 + return 0; 112 + } 113 + 114 + EXPORT_SYMBOL(imx_gpio_request); 115 + 116 + void imx_gpio_free(unsigned gpio) 117 + { 118 + if(gpio >= (GPIO_PORT_MAX + 1) * 32) 119 + return; 120 + 121 + clear_bit(gpio, imx_gpio_alloc_map); 122 + } 123 + 124 + EXPORT_SYMBOL(imx_gpio_free); 125 + 126 + int imx_gpio_direction_input(unsigned gpio) 127 + { 128 + imx_gpio_mode(gpio| GPIO_IN); 129 + return 0; 130 + } 131 + 132 + EXPORT_SYMBOL(imx_gpio_direction_input); 133 + 134 + int imx_gpio_direction_output(unsigned gpio, int value) 135 + { 136 + imx_gpio_set_value(gpio, value); 137 + imx_gpio_mode(gpio| GPIO_OUT); 138 + return 0; 139 + } 140 + 141 + EXPORT_SYMBOL(imx_gpio_direction_output); 142 + 143 + int imx_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 144 + int alloc_mode, const char *label) 145 + { 146 + const int *p = pin_list; 147 + int i; 148 + unsigned gpio; 149 + unsigned mode; 150 + 151 + for (i = 0; i < count; i++) { 152 + gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 153 + mode = *p & ~(GPIO_PIN_MASK | GPIO_PORT_MASK); 154 + 155 + if (gpio >= (GPIO_PORT_MAX + 1) * 32) 156 + goto setup_error; 157 + 158 + if (alloc_mode & IMX_GPIO_ALLOC_MODE_RELEASE) 159 + imx_gpio_free(gpio); 160 + else if (!(alloc_mode & IMX_GPIO_ALLOC_MODE_NO_ALLOC)) 161 + if (imx_gpio_request(gpio, label)) 162 + if (!(alloc_mode & IMX_GPIO_ALLOC_MODE_TRY_ALLOC)) 163 + goto setup_error; 164 + 165 + if (!(alloc_mode & (IMX_GPIO_ALLOC_MODE_ALLOC_ONLY | 166 + IMX_GPIO_ALLOC_MODE_RELEASE))) 167 + imx_gpio_mode(gpio | mode); 168 + 169 + p++; 170 + } 171 + return 0; 172 + 173 + setup_error: 174 + if(alloc_mode & (IMX_GPIO_ALLOC_MODE_NO_ALLOC | 175 + IMX_GPIO_ALLOC_MODE_TRY_ALLOC)) 176 + return -EINVAL; 177 + 178 + while (p != pin_list) { 179 + p--; 180 + gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 181 + imx_gpio_free(gpio); 182 + } 183 + 184 + return -EINVAL; 185 + } 186 + 187 + EXPORT_SYMBOL(imx_gpio_setup_multiple_pins); 188 + 189 + void __imx_gpio_set_value(unsigned gpio, int value) 190 + { 191 + imx_gpio_set_value_inline(gpio, value); 192 + } 193 + 194 + EXPORT_SYMBOL(__imx_gpio_set_value); 195 + 196 + int imx_gpio_to_irq(unsigned gpio) 197 + { 198 + return IRQ_GPIOA(0) + gpio; 199 + } 200 + 201 + EXPORT_SYMBOL(imx_gpio_to_irq); 202 + 203 + int imx_irq_to_gpio(unsigned irq) 204 + { 205 + if (irq < IRQ_GPIOA(0)) 206 + return -EINVAL; 207 + return irq - IRQ_GPIOA(0); 208 + } 209 + 210 + EXPORT_SYMBOL(imx_irq_to_gpio); 101 211 102 212 /* 103 213 * get the system pll clock in Hz
+107 -14
arch/arm/mach-imx/time.c
··· 3 3 * 4 4 * Copyright (C) 2000-2001 Deep Blue Solutions 5 5 * Copyright (C) 2002 Shane Nay (shane@minirl.com) 6 + * Copyright (C) 2006-2007 Pavel Pisa (ppisa@pikron.com) 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License version 2 as ··· 16 15 #include <linux/irq.h> 17 16 #include <linux/time.h> 18 17 #include <linux/clocksource.h> 18 + #include <linux/clockchips.h> 19 19 20 20 #include <asm/hardware.h> 21 21 #include <asm/io.h> ··· 27 25 /* Use timer 1 as system timer */ 28 26 #define TIMER_BASE IMX_TIM1_BASE 29 27 30 - static unsigned long evt_diff; 28 + static struct clock_event_device clockevent_imx; 29 + static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; 31 30 32 31 /* 33 32 * IRQ handler for the timer ··· 36 33 static irqreturn_t 37 34 imx_timer_interrupt(int irq, void *dev_id) 38 35 { 36 + struct clock_event_device *evt = &clockevent_imx; 39 37 uint32_t tstat; 38 + irqreturn_t ret = IRQ_NONE; 40 39 41 40 /* clear the interrupt */ 42 41 tstat = IMX_TSTAT(TIMER_BASE); 43 42 IMX_TSTAT(TIMER_BASE) = 0; 44 43 45 44 if (tstat & TSTAT_COMP) { 46 - do { 47 - 48 - write_seqlock(&xtime_lock); 49 - timer_tick(); 50 - write_sequnlock(&xtime_lock); 51 - IMX_TCMP(TIMER_BASE) += evt_diff; 52 - 53 - } while (unlikely((int32_t)(IMX_TCMP(TIMER_BASE) 54 - - IMX_TCN(TIMER_BASE)) < 0)); 45 + evt->event_handler(evt); 46 + ret = IRQ_HANDLED; 55 47 } 56 48 57 - return IRQ_HANDLED; 49 + return ret; 58 50 } 59 51 60 52 static struct irqaction imx_timer_irq = { ··· 68 70 */ 69 71 IMX_TCTL(TIMER_BASE) = 0; 70 72 IMX_TPRER(TIMER_BASE) = 0; 71 - IMX_TCMP(TIMER_BASE) = LATCH - 1; 72 73 73 - IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_IRQEN | TCTL_TEN; 74 - evt_diff = LATCH; 74 + IMX_TCTL(TIMER_BASE) = TCTL_FRR | TCTL_CLK_PCLK1 | TCTL_TEN; 75 75 } 76 76 77 77 cycle_t imx_get_cycles(void) ··· 95 99 return 0; 96 100 } 97 101 102 + static int imx_set_next_event(unsigned long evt, 103 + struct clock_event_device *unused) 104 + { 105 + unsigned long tcmp; 106 + 107 + tcmp = IMX_TCN(TIMER_BASE) + evt; 108 + IMX_TCMP(TIMER_BASE) = tcmp; 109 + 110 + return (int32_t)(tcmp - IMX_TCN(TIMER_BASE)) < 0 ? -ETIME : 0; 111 + } 112 + 113 + #ifdef DEBUG 114 + static const char *clock_event_mode_label[]={ 115 + [CLOCK_EVT_MODE_PERIODIC] = "CLOCK_EVT_MODE_PERIODIC", 116 + [CLOCK_EVT_MODE_ONESHOT] = "CLOCK_EVT_MODE_ONESHOT", 117 + [CLOCK_EVT_MODE_SHUTDOWN] = "CLOCK_EVT_MODE_SHUTDOWN", 118 + [CLOCK_EVT_MODE_UNUSED] = "CLOCK_EVT_MODE_UNUSED" 119 + }; 120 + #endif /*DEBUG*/ 121 + 122 + static void imx_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) 123 + { 124 + unsigned long flags; 125 + 126 + /* 127 + * The timer interrupt generation is disabled at least 128 + * for enough time to call imx_set_next_event() 129 + */ 130 + local_irq_save(flags); 131 + /* Disable interrupt in GPT module */ 132 + IMX_TCTL(TIMER_BASE) &= ~TCTL_IRQEN; 133 + if (mode != clockevent_mode) { 134 + /* Set event time into far-far future */ 135 + IMX_TCMP(TIMER_BASE) = IMX_TCN(TIMER_BASE) - 3; 136 + /* Clear pending interrupt */ 137 + IMX_TSTAT(TIMER_BASE) &= ~TSTAT_COMP; 138 + } 139 + 140 + #ifdef DEBUG 141 + printk(KERN_INFO "imx_set_mode: changing mode from %s to %s\n", 142 + clock_event_mode_label[clockevent_mode], clock_event_mode_label[mode]); 143 + #endif /*DEBUG*/ 144 + 145 + /* Remember timer mode */ 146 + clockevent_mode = mode; 147 + local_irq_restore(flags); 148 + 149 + switch (mode) { 150 + case CLOCK_EVT_MODE_PERIODIC: 151 + printk(KERN_ERR "imx_set_mode: Periodic mode is not supported for i.MX\n"); 152 + break; 153 + case CLOCK_EVT_MODE_ONESHOT: 154 + /* 155 + * Do not put overhead of interrupt enable/disable into 156 + * imx_set_next_event(), the core has about 4 minutes 157 + * to call imx_set_next_event() or shutdown clock after 158 + * mode switching 159 + */ 160 + local_irq_save(flags); 161 + IMX_TCTL(TIMER_BASE) |= TCTL_IRQEN; 162 + local_irq_restore(flags); 163 + break; 164 + case CLOCK_EVT_MODE_SHUTDOWN: 165 + case CLOCK_EVT_MODE_UNUSED: 166 + /* Left event sources disabled, no more interrupts appears */ 167 + break; 168 + } 169 + } 170 + 171 + static struct clock_event_device clockevent_imx = { 172 + .name = "imx_timer1", 173 + .features = CLOCK_EVT_FEAT_ONESHOT, 174 + .shift = 32, 175 + .set_mode = imx_set_mode, 176 + .set_next_event = imx_set_next_event, 177 + .rating = 200, 178 + }; 179 + 180 + static int __init imx_clockevent_init(void) 181 + { 182 + clockevent_imx.mult = div_sc(imx_get_perclk1(), NSEC_PER_SEC, 183 + clockevent_imx.shift); 184 + clockevent_imx.max_delta_ns = 185 + clockevent_delta2ns(0xfffffffe, &clockevent_imx); 186 + clockevent_imx.min_delta_ns = 187 + clockevent_delta2ns(0xf, &clockevent_imx); 188 + 189 + clockevent_imx.cpumask = cpumask_of_cpu(0); 190 + 191 + clockevents_register_device(&clockevent_imx); 192 + 193 + return 0; 194 + } 195 + 196 + 98 197 static void __init imx_timer_init(void) 99 198 { 100 199 imx_timer_hardware_init(); 101 200 imx_clocksource_init(); 201 + 202 + imx_clockevent_init(); 102 203 103 204 /* 104 205 * Make irqs happen for the system timer
+27 -5
arch/arm/mach-iop13xx/tpmi.c
··· 29 29 #define IOP13XX_TPMI_MMR(dev) IOP13XX_REG_ADDR32_PHYS(0x48000 + (dev << 12)) 30 30 #define IOP13XX_TPMI_MEM(dev) IOP13XX_REG_ADDR32_PHYS(0x60000 + (dev << 13)) 31 31 #define IOP13XX_TPMI_CTRL(dev) IOP13XX_REG_ADDR32_PHYS(0x50000 + (dev << 10)) 32 + #define IOP13XX_TPMI_IOP_CTRL(dev) (IOP13XX_TPMI_CTRL(dev) + 0x2000) 32 33 #define IOP13XX_TPMI_MMR_SIZE (SZ_4K - 1) 33 34 #define IOP13XX_TPMI_MEM_SIZE (255) 34 35 #define IOP13XX_TPMI_MEM_CTRL (SZ_1K - 1) 35 36 #define IOP13XX_TPMI_RESOURCE_MMR 0 36 37 #define IOP13XX_TPMI_RESOURCE_MEM 1 37 38 #define IOP13XX_TPMI_RESOURCE_CTRL 2 38 - #define IOP13XX_TPMI_RESOURCE_IRQ 3 39 + #define IOP13XX_TPMI_RESOURCE_IOP_CTRL 3 40 + #define IOP13XX_TPMI_RESOURCE_IRQ 4 39 41 40 42 static struct resource iop13xx_tpmi_0_resources[] = { 41 43 [IOP13XX_TPMI_RESOURCE_MMR] = { ··· 53 51 [IOP13XX_TPMI_RESOURCE_CTRL] = { 54 52 .start = IOP13XX_TPMI_CTRL(0), 55 53 .end = IOP13XX_TPMI_CTRL(0) + IOP13XX_TPMI_MEM_CTRL, 54 + .flags = IORESOURCE_MEM, 55 + }, 56 + [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = { 57 + .start = IOP13XX_TPMI_IOP_CTRL(0), 58 + .end = IOP13XX_TPMI_IOP_CTRL(0) + IOP13XX_TPMI_MEM_CTRL, 56 59 .flags = IORESOURCE_MEM, 57 60 }, 58 61 [IOP13XX_TPMI_RESOURCE_IRQ] = { ··· 83 76 .end = IOP13XX_TPMI_CTRL(1) + IOP13XX_TPMI_MEM_CTRL, 84 77 .flags = IORESOURCE_MEM, 85 78 }, 79 + [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = { 80 + .start = IOP13XX_TPMI_IOP_CTRL(1), 81 + .end = IOP13XX_TPMI_IOP_CTRL(1) + IOP13XX_TPMI_MEM_CTRL, 82 + .flags = IORESOURCE_MEM, 83 + }, 86 84 [IOP13XX_TPMI_RESOURCE_IRQ] = { 87 85 .start = IRQ_IOP13XX_TPMI1_OUT, 88 86 .end = IRQ_IOP13XX_TPMI1_OUT, ··· 109 97 [IOP13XX_TPMI_RESOURCE_CTRL] = { 110 98 .start = IOP13XX_TPMI_CTRL(2), 111 99 .end = IOP13XX_TPMI_CTRL(2) + IOP13XX_TPMI_MEM_CTRL, 100 + .flags = IORESOURCE_MEM, 101 + }, 102 + [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = { 103 + .start = IOP13XX_TPMI_IOP_CTRL(2), 104 + .end = IOP13XX_TPMI_IOP_CTRL(2) + IOP13XX_TPMI_MEM_CTRL, 112 105 .flags = IORESOURCE_MEM, 113 106 }, 114 107 [IOP13XX_TPMI_RESOURCE_IRQ] = { ··· 139 122 .end = IOP13XX_TPMI_CTRL(3) + IOP13XX_TPMI_MEM_CTRL, 140 123 .flags = IORESOURCE_MEM, 141 124 }, 125 + [IOP13XX_TPMI_RESOURCE_IOP_CTRL] = { 126 + .start = IOP13XX_TPMI_IOP_CTRL(3), 127 + .end = IOP13XX_TPMI_IOP_CTRL(3) + IOP13XX_TPMI_MEM_CTRL, 128 + .flags = IORESOURCE_MEM, 129 + }, 142 130 [IOP13XX_TPMI_RESOURCE_IRQ] = { 143 131 .start = IRQ_IOP13XX_TPMI3_OUT, 144 132 .end = IRQ_IOP13XX_TPMI3_OUT, ··· 155 133 static struct platform_device iop13xx_tpmi_0_device = { 156 134 .name = "iop-tpmi", 157 135 .id = 0, 158 - .num_resources = 4, 136 + .num_resources = ARRAY_SIZE(iop13xx_tpmi_0_resources), 159 137 .resource = iop13xx_tpmi_0_resources, 160 138 .dev = { 161 139 .dma_mask = &iop13xx_tpmi_mask, ··· 166 144 static struct platform_device iop13xx_tpmi_1_device = { 167 145 .name = "iop-tpmi", 168 146 .id = 1, 169 - .num_resources = 4, 147 + .num_resources = ARRAY_SIZE(iop13xx_tpmi_1_resources), 170 148 .resource = iop13xx_tpmi_1_resources, 171 149 .dev = { 172 150 .dma_mask = &iop13xx_tpmi_mask, ··· 177 155 static struct platform_device iop13xx_tpmi_2_device = { 178 156 .name = "iop-tpmi", 179 157 .id = 2, 180 - .num_resources = 4, 158 + .num_resources = ARRAY_SIZE(iop13xx_tpmi_2_resources), 181 159 .resource = iop13xx_tpmi_2_resources, 182 160 .dev = { 183 161 .dma_mask = &iop13xx_tpmi_mask, ··· 188 166 static struct platform_device iop13xx_tpmi_3_device = { 189 167 .name = "iop-tpmi", 190 168 .id = 3, 191 - .num_resources = 4, 169 + .num_resources = ARRAY_SIZE(iop13xx_tpmi_3_resources), 192 170 .resource = iop13xx_tpmi_3_resources, 193 171 .dev = { 194 172 .dma_mask = &iop13xx_tpmi_mask,
+16
arch/arm/mach-ixp4xx/Kconfig
··· 41 41 Engineering Coyote Gateway Reference Platform. For more 42 42 information on this platform, see <file:Documentation/arm/IXP4xx>. 43 43 44 + config MACH_GATEWAY7001 45 + bool "Gateway 7001" 46 + select PCI 47 + help 48 + Say 'Y' here if you want your kernel to support Gateway's 49 + 7001 Access Point. For more information on this platform, 50 + see http://openwrt.org 51 + 52 + config MACH_WG302V2 53 + bool "Netgear WG302 v2 / WAG302 v2" 54 + select PCI 55 + help 56 + Say 'Y' here if you want your kernel to support Netgear's 57 + WG302 v2 or WAG302 v2 Access Points. For more information 58 + on this platform, see http://openwrt.org 59 + 44 60 config ARCH_IXDP425 45 61 bool "IXDP425" 46 62 help
+4
arch/arm/mach-ixp4xx/Makefile
··· 13 13 obj-pci-$(CONFIG_MACH_NSLU2) += nslu2-pci.o 14 14 obj-pci-$(CONFIG_MACH_NAS100D) += nas100d-pci.o 15 15 obj-pci-$(CONFIG_MACH_DSMG600) += dsmg600-pci.o 16 + obj-pci-$(CONFIG_MACH_GATEWAY7001) += gateway7001-pci.o 17 + obj-pci-$(CONFIG_MACH_WG302V2) += wg302v2-pci.o 16 18 17 19 obj-y += common.o 18 20 ··· 26 24 obj-$(CONFIG_MACH_NSLU2) += nslu2-setup.o nslu2-power.o 27 25 obj-$(CONFIG_MACH_NAS100D) += nas100d-setup.o nas100d-power.o 28 26 obj-$(CONFIG_MACH_DSMG600) += dsmg600-setup.o dsmg600-power.o 27 + obj-$(CONFIG_MACH_GATEWAY7001) += gateway7001-setup.o 28 + obj-$(CONFIG_MACH_WG302V2) += wg302v2-setup.o 29 29 30 30 obj-$(CONFIG_PCI) += $(obj-pci-$(CONFIG_PCI)) common-pci.o
+63
arch/arm/mach-ixp4xx/gateway7001-pci.c
··· 1 + /* 2 + * arch/arch/mach-ixp4xx/gateway7001-pci.c 3 + * 4 + * PCI setup routines for Gateway 7001 5 + * 6 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * based on coyote-pci.c: 9 + * Copyright (C) 2002 Jungo Software Technologies. 10 + * Copyright (C) 2003 MontaVista Softwrae, Inc. 11 + * 12 + * Maintainer: Imre Kaloz <kaloz@openwrt.org> 13 + * 14 + * This program is free software; you can redistribute it and/or modify 15 + * it under the terms of the GNU General Public License version 2 as 16 + * published by the Free Software Foundation. 17 + * 18 + */ 19 + 20 + #include <linux/kernel.h> 21 + #include <linux/pci.h> 22 + #include <linux/init.h> 23 + #include <linux/irq.h> 24 + 25 + #include <asm/mach-types.h> 26 + #include <asm/hardware.h> 27 + 28 + #include <asm/mach/pci.h> 29 + 30 + void __init gateway7001_pci_preinit(void) 31 + { 32 + set_irq_type(IRQ_IXP4XX_GPIO10, IRQT_LOW); 33 + set_irq_type(IRQ_IXP4XX_GPIO11, IRQT_LOW); 34 + 35 + ixp4xx_pci_preinit(); 36 + } 37 + 38 + static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 39 + { 40 + if (slot == 1) 41 + return IRQ_IXP4XX_GPIO11; 42 + else if (slot == 2) 43 + return IRQ_IXP4XX_GPIO10; 44 + else return -1; 45 + } 46 + 47 + struct hw_pci gateway7001_pci __initdata = { 48 + .nr_controllers = 1, 49 + .preinit = gateway7001_pci_preinit, 50 + .swizzle = pci_std_swizzle, 51 + .setup = ixp4xx_setup, 52 + .scan = ixp4xx_scan_bus, 53 + .map_irq = gateway7001_map_irq, 54 + }; 55 + 56 + int __init gateway7001_pci_init(void) 57 + { 58 + if (machine_is_gateway7001()) 59 + pci_common_init(&gateway7001_pci); 60 + return 0; 61 + } 62 + 63 + subsys_initcall(gateway7001_pci_init);
+108
arch/arm/mach-ixp4xx/gateway7001-setup.c
··· 1 + /* 2 + * arch/arm/mach-ixp4xx/gateway7001-setup.c 3 + * 4 + * Board setup for the Gateway 7001 board 5 + * 6 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * based on coyote-setup.c: 9 + * Copyright (C) 2003-2005 MontaVista Software, Inc. 10 + * 11 + * Author: Imre Kaloz <Kaloz@openwrt.org> 12 + */ 13 + 14 + #include <linux/kernel.h> 15 + #include <linux/init.h> 16 + #include <linux/device.h> 17 + #include <linux/serial.h> 18 + #include <linux/tty.h> 19 + #include <linux/serial_8250.h> 20 + #include <linux/slab.h> 21 + 22 + #include <asm/types.h> 23 + #include <asm/setup.h> 24 + #include <asm/memory.h> 25 + #include <asm/hardware.h> 26 + #include <asm/irq.h> 27 + #include <asm/mach-types.h> 28 + #include <asm/mach/arch.h> 29 + #include <asm/mach/flash.h> 30 + 31 + static struct flash_platform_data gateway7001_flash_data = { 32 + .map_name = "cfi_probe", 33 + .width = 2, 34 + }; 35 + 36 + static struct resource gateway7001_flash_resource = { 37 + .flags = IORESOURCE_MEM, 38 + }; 39 + 40 + static struct platform_device gateway7001_flash = { 41 + .name = "IXP4XX-Flash", 42 + .id = 0, 43 + .dev = { 44 + .platform_data = &gateway7001_flash_data, 45 + }, 46 + .num_resources = 1, 47 + .resource = &gateway7001_flash_resource, 48 + }; 49 + 50 + static struct resource gateway7001_uart_resource = { 51 + .start = IXP4XX_UART2_BASE_PHYS, 52 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, 53 + .flags = IORESOURCE_MEM, 54 + }; 55 + 56 + static struct plat_serial8250_port gateway7001_uart_data[] = { 57 + { 58 + .mapbase = IXP4XX_UART2_BASE_PHYS, 59 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 60 + .irq = IRQ_IXP4XX_UART2, 61 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 62 + .iotype = UPIO_MEM, 63 + .regshift = 2, 64 + .uartclk = IXP4XX_UART_XTAL, 65 + }, 66 + { }, 67 + }; 68 + 69 + static struct platform_device gateway7001_uart = { 70 + .name = "serial8250", 71 + .id = PLAT8250_DEV_PLATFORM, 72 + .dev = { 73 + .platform_data = gateway7001_uart_data, 74 + }, 75 + .num_resources = 1, 76 + .resource = &gateway7001_uart_resource, 77 + }; 78 + 79 + static struct platform_device *gateway7001_devices[] __initdata = { 80 + &gateway7001_flash, 81 + &gateway7001_uart 82 + }; 83 + 84 + static void __init gateway7001_init(void) 85 + { 86 + ixp4xx_sys_init(); 87 + 88 + gateway7001_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 89 + gateway7001_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; 90 + 91 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 92 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 93 + 94 + platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices)); 95 + } 96 + 97 + #ifdef CONFIG_MACH_GATEWAY7001 98 + MACHINE_START(GATEWAY7001, "Gateway 7001 AP") 99 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ 100 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 101 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 102 + .map_io = ixp4xx_map_io, 103 + .init_irq = ixp4xx_init_irq, 104 + .timer = &ixp4xx_timer, 105 + .boot_params = 0x0100, 106 + .init_machine = gateway7001_init, 107 + MACHINE_END 108 + #endif
+2 -6
arch/arm/mach-ixp4xx/gtwx5715-pci.c
··· 25 25 #include <linux/pci.h> 26 26 #include <linux/init.h> 27 27 #include <linux/delay.h> 28 + #include <linux/irq.h> 29 + 28 30 #include <asm/mach-types.h> 29 31 #include <asm/hardware.h> 30 - #include <asm/irq.h> 31 32 #include <asm/arch/gtwx5715.h> 32 33 #include <asm/mach/pci.h> 33 - 34 - extern void ixp4xx_pci_preinit(void); 35 - extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 36 - extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); 37 - 38 34 39 35 /* 40 36 * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h
+96
arch/arm/mach-ixp4xx/ixdp425-setup.c
··· 15 15 #include <linux/tty.h> 16 16 #include <linux/serial_8250.h> 17 17 #include <linux/slab.h> 18 + #include <linux/io.h> 19 + #include <linux/mtd/mtd.h> 20 + #include <linux/mtd/nand.h> 21 + #include <linux/mtd/partitions.h> 18 22 19 23 #include <asm/types.h> 20 24 #include <asm/setup.h> ··· 28 24 #include <asm/irq.h> 29 25 #include <asm/mach/arch.h> 30 26 #include <asm/mach/flash.h> 27 + #include <asm/delay.h> 31 28 32 29 static struct flash_platform_data ixdp425_flash_data = { 33 30 .map_name = "cfi_probe", ··· 48 43 .num_resources = 1, 49 44 .resource = &ixdp425_flash_resource, 50 45 }; 46 + 47 + #if defined(CONFIG_MTD_NAND_PLATFORM) || \ 48 + defined(CONFIG_MTD_NAND_PLATFORM_MODULE) 49 + 50 + #ifdef CONFIG_MTD_PARTITIONS 51 + const char *part_probes[] = { "cmdlinepart", NULL }; 52 + 53 + static struct mtd_partition ixdp425_partitions[] = { 54 + { 55 + .name = "ixp400 NAND FS 0", 56 + .offset = 0, 57 + .size = SZ_8M 58 + }, { 59 + .name = "ixp400 NAND FS 1", 60 + .offset = MTDPART_OFS_APPEND, 61 + .size = MTDPART_SIZ_FULL 62 + }, 63 + }; 64 + #endif 65 + 66 + static void 67 + ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) 68 + { 69 + struct nand_chip *this = mtd->priv; 70 + int offset = (int)this->priv; 71 + 72 + if (ctrl & NAND_CTRL_CHANGE) { 73 + if (ctrl & NAND_NCE) { 74 + gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); 75 + udelay(5); 76 + } else 77 + gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); 78 + 79 + offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; 80 + offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; 81 + this->priv = (void *)offset; 82 + } 83 + 84 + if (cmd != NAND_CMD_NONE) 85 + writeb(cmd, this->IO_ADDR_W + offset); 86 + } 87 + 88 + static struct platform_nand_data ixdp425_flash_nand_data = { 89 + .chip = { 90 + .chip_delay = 30, 91 + .options = NAND_NO_AUTOINCR, 92 + #ifdef CONFIG_MTD_PARTITIONS 93 + .part_probe_types = part_probes, 94 + .partitions = ixdp425_partitions, 95 + .nr_partitions = ARRAY_SIZE(ixdp425_partitions), 96 + #endif 97 + }, 98 + .ctrl = { 99 + .cmd_ctrl = ixdp425_flash_nand_cmd_ctrl 100 + } 101 + }; 102 + 103 + static struct resource ixdp425_flash_nand_resource = { 104 + .flags = IORESOURCE_MEM, 105 + }; 106 + 107 + static struct platform_device ixdp425_flash_nand = { 108 + .name = "gen_nand", 109 + .id = -1, 110 + .dev = { 111 + .platform_data = &ixdp425_flash_nand_data, 112 + }, 113 + .num_resources = 1, 114 + .resource = &ixdp425_flash_nand_resource, 115 + }; 116 + #endif /* CONFIG_MTD_NAND_PLATFORM */ 51 117 52 118 static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { 53 119 .sda_pin = IXDP425_SDA_PIN, ··· 180 104 static struct platform_device *ixdp425_devices[] __initdata = { 181 105 &ixdp425_i2c_controller, 182 106 &ixdp425_flash, 107 + #if defined(CONFIG_MTD_NAND_PLATFORM) || \ 108 + defined(CONFIG_MTD_NAND_PLATFORM_MODULE) 109 + &ixdp425_flash_nand, 110 + #endif 183 111 &ixdp425_uart 184 112 }; 185 113 ··· 194 114 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 195 115 ixdp425_flash_resource.end = 196 116 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 117 + 118 + #if defined(CONFIG_MTD_NAND_PLATFORM) || \ 119 + defined(CONFIG_MTD_NAND_PLATFORM_MODULE) 120 + ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), 121 + ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; 122 + 123 + gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); 124 + 125 + /* Configure expansion bus for NAND Flash */ 126 + *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | 127 + IXP4XX_EXP_BUS_STROBE_T(1) | /* extend by 1 clock */ 128 + IXP4XX_EXP_BUS_CYCLES(0) | /* Intel cycles */ 129 + IXP4XX_EXP_BUS_SIZE(0) | /* 512bytes addr space*/ 130 + IXP4XX_EXP_BUS_WR_EN | 131 + IXP4XX_EXP_BUS_BYTE_EN; /* 8 bit data bus */ 132 + #endif 197 133 198 134 if (cpu_is_ixp43x()) { 199 135 ixdp425_uart.num_resources = 1;
+63
arch/arm/mach-ixp4xx/wg302v2-pci.c
··· 1 + /* 2 + * arch/arch/mach-ixp4xx/wg302v2-pci.c 3 + * 4 + * PCI setup routines for the Netgear WG302 v2 and WAG302 v2 5 + * 6 + * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> 7 + * 8 + * based on coyote-pci.c: 9 + * Copyright (C) 2002 Jungo Software Technologies. 10 + * Copyright (C) 2003 MontaVista Software, Inc. 11 + * 12 + * Maintainer: Imre Kaloz <kaloz@openwrt.org> 13 + * 14 + * This program is free software; you can redistribute it and/or modify 15 + * it under the terms of the GNU General Public License version 2 as 16 + * published by the Free Software Foundation. 17 + * 18 + */ 19 + 20 + #include <linux/kernel.h> 21 + #include <linux/pci.h> 22 + #include <linux/init.h> 23 + #include <linux/irq.h> 24 + 25 + #include <asm/mach-types.h> 26 + #include <asm/hardware.h> 27 + 28 + #include <asm/mach/pci.h> 29 + 30 + void __init wg302v2_pci_preinit(void) 31 + { 32 + set_irq_type(IRQ_IXP4XX_GPIO8, IRQT_LOW); 33 + set_irq_type(IRQ_IXP4XX_GPIO9, IRQT_LOW); 34 + 35 + ixp4xx_pci_preinit(); 36 + } 37 + 38 + static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 39 + { 40 + if (slot == 1) 41 + return IRQ_IXP4XX_GPIO8; 42 + else if (slot == 2) 43 + return IRQ_IXP4XX_GPIO9; 44 + else return -1; 45 + } 46 + 47 + struct hw_pci wg302v2_pci __initdata = { 48 + .nr_controllers = 1, 49 + .preinit = wg302v2_pci_preinit, 50 + .swizzle = pci_std_swizzle, 51 + .setup = ixp4xx_setup, 52 + .scan = ixp4xx_scan_bus, 53 + .map_irq = wg302v2_map_irq, 54 + }; 55 + 56 + int __init wg302v2_pci_init(void) 57 + { 58 + if (machine_is_wg302v2()) 59 + pci_common_init(&wg302v2_pci); 60 + return 0; 61 + } 62 + 63 + subsys_initcall(wg302v2_pci_init);
+109
arch/arm/mach-ixp4xx/wg302v2-setup.c
··· 1 + /* 2 + * arch/arm/mach-ixp4xx/wg302-setup.c 3 + * 4 + * Board setup for the Netgear WG302 v2 and WAG302 v2 5 + * 6 + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> 7 + * 8 + * based on coyote-setup.c: 9 + * Copyright (C) 2003-2005 MontaVista Software, Inc. 10 + * 11 + * Author: Imre Kaloz <kaloz@openwrt.org> 12 + * 13 + */ 14 + 15 + #include <linux/kernel.h> 16 + #include <linux/init.h> 17 + #include <linux/device.h> 18 + #include <linux/serial.h> 19 + #include <linux/tty.h> 20 + #include <linux/serial_8250.h> 21 + #include <linux/slab.h> 22 + 23 + #include <asm/types.h> 24 + #include <asm/setup.h> 25 + #include <asm/memory.h> 26 + #include <asm/hardware.h> 27 + #include <asm/irq.h> 28 + #include <asm/mach-types.h> 29 + #include <asm/mach/arch.h> 30 + #include <asm/mach/flash.h> 31 + 32 + static struct flash_platform_data wg302v2_flash_data = { 33 + .map_name = "cfi_probe", 34 + .width = 2, 35 + }; 36 + 37 + static struct resource wg302v2_flash_resource = { 38 + .flags = IORESOURCE_MEM, 39 + }; 40 + 41 + static struct platform_device wg302v2_flash = { 42 + .name = "IXP4XX-Flash", 43 + .id = 0, 44 + .dev = { 45 + .platform_data = &wg302v2_flash_data, 46 + }, 47 + .num_resources = 1, 48 + .resource = &wg302v2_flash_resource, 49 + }; 50 + 51 + static struct resource wg302v2_uart_resource = { 52 + .start = IXP4XX_UART2_BASE_PHYS, 53 + .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, 54 + .flags = IORESOURCE_MEM, 55 + }; 56 + 57 + static struct plat_serial8250_port wg302v2_uart_data[] = { 58 + { 59 + .mapbase = IXP4XX_UART2_BASE_PHYS, 60 + .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 61 + .irq = IRQ_IXP4XX_UART2, 62 + .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 63 + .iotype = UPIO_MEM, 64 + .regshift = 2, 65 + .uartclk = IXP4XX_UART_XTAL, 66 + }, 67 + { }, 68 + }; 69 + 70 + static struct platform_device wg302v2_uart = { 71 + .name = "serial8250", 72 + .id = PLAT8250_DEV_PLATFORM, 73 + .dev = { 74 + .platform_data = wg302v2_uart_data, 75 + }, 76 + .num_resources = 1, 77 + .resource = &wg302v2_uart_resource, 78 + }; 79 + 80 + static struct platform_device *wg302v2_devices[] __initdata = { 81 + &wg302v2_flash, 82 + &wg302v2_uart, 83 + }; 84 + 85 + static void __init wg302v2_init(void) 86 + { 87 + ixp4xx_sys_init(); 88 + 89 + wg302v2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); 90 + wg302v2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; 91 + 92 + *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 93 + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 94 + 95 + platform_add_devices(wg302v2_devices, ARRAY_SIZE(wg302v2_devices)); 96 + } 97 + 98 + #ifdef CONFIG_MACH_WG302V2 99 + MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") 100 + /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ 101 + .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 102 + .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 103 + .map_io = ixp4xx_map_io, 104 + .init_irq = ixp4xx_init_irq, 105 + .timer = &ixp4xx_timer, 106 + .boot_params = 0x0100, 107 + .init_machine = wg302v2_init, 108 + MACHINE_END 109 + #endif
+1 -1
arch/arm/mach-ks8695/Makefile
··· 3 3 # Makefile for KS8695 architecture support 4 4 # 5 5 6 - obj-y := cpu.o irq.o time.o devices.o 6 + obj-y := cpu.o irq.o time.o gpio.o devices.o 7 7 obj-m := 8 8 obj-n := 9 9 obj- :=
+218
arch/arm/mach-ks8695/gpio.c
··· 1 + /* 2 + * arch/arm/mach-ks8695/gpio.c 3 + * 4 + * Copyright (C) 2006 Andrew Victor 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 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #include <linux/kernel.h> 21 + #include <linux/mm.h> 22 + #include <linux/init.h> 23 + #include <linux/module.h> 24 + 25 + #include <asm/io.h> 26 + #include <asm/hardware.h> 27 + #include <asm/mach/irq.h> 28 + 29 + #include <asm/arch/regs-gpio.h> 30 + #include <asm/arch/gpio.h> 31 + 32 + /* 33 + * Configure a GPIO line for either GPIO function, or its internal 34 + * function (Interrupt, Timer, etc). 35 + */ 36 + static void __init_or_module ks8695_gpio_mode(unsigned int pin, short gpio) 37 + { 38 + unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN }; 39 + unsigned long x, flags; 40 + 41 + if (pin > KS8695_GPIO_5) /* only GPIO 0..5 have internal functions */ 42 + return; 43 + 44 + local_irq_save(flags); 45 + 46 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPC); 47 + if (gpio) /* GPIO: set bit to 0 */ 48 + x &= ~enable[pin]; 49 + else /* Internal function: set bit to 1 */ 50 + x |= enable[pin]; 51 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPC); 52 + 53 + local_irq_restore(flags); 54 + } 55 + 56 + 57 + static unsigned short gpio_irq[] = { KS8695_IRQ_EXTERN0, KS8695_IRQ_EXTERN1, KS8695_IRQ_EXTERN2, KS8695_IRQ_EXTERN3 }; 58 + 59 + /* 60 + * Configure GPIO pin as external interrupt source. 61 + */ 62 + int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type) 63 + { 64 + unsigned long x, flags; 65 + 66 + if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */ 67 + return -EINVAL; 68 + 69 + local_irq_save(flags); 70 + 71 + /* set pin as input */ 72 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM); 73 + x &= ~IOPM_(pin); 74 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM); 75 + 76 + local_irq_restore(flags); 77 + 78 + /* Set IRQ triggering type */ 79 + set_irq_type(gpio_irq[pin], type); 80 + 81 + /* enable interrupt mode */ 82 + ks8695_gpio_mode(pin, 0); 83 + 84 + return 0; 85 + } 86 + EXPORT_SYMBOL(ks8695_gpio_interrupt); 87 + 88 + 89 + 90 + /* .... Generic GPIO interface .............................................. */ 91 + 92 + /* 93 + * Configure the GPIO line as an input. 94 + */ 95 + int __init_or_module gpio_direction_input(unsigned int pin) 96 + { 97 + unsigned long x, flags; 98 + 99 + if (pin > KS8695_GPIO_15) 100 + return -EINVAL; 101 + 102 + /* set pin to GPIO mode */ 103 + ks8695_gpio_mode(pin, 1); 104 + 105 + local_irq_save(flags); 106 + 107 + /* set pin as input */ 108 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM); 109 + x &= ~IOPM_(pin); 110 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM); 111 + 112 + local_irq_restore(flags); 113 + 114 + return 0; 115 + } 116 + EXPORT_SYMBOL(gpio_direction_input); 117 + 118 + 119 + /* 120 + * Configure the GPIO line as an output, with default state. 121 + */ 122 + int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state) 123 + { 124 + unsigned long x, flags; 125 + 126 + if (pin > KS8695_GPIO_15) 127 + return -EINVAL; 128 + 129 + /* set pin to GPIO mode */ 130 + ks8695_gpio_mode(pin, 1); 131 + 132 + local_irq_save(flags); 133 + 134 + /* set line state */ 135 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD); 136 + if (state) 137 + x |= (1 << pin); 138 + else 139 + x &= ~(1 << pin); 140 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD); 141 + 142 + /* set pin as output */ 143 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM); 144 + x |= IOPM_(pin); 145 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM); 146 + 147 + local_irq_restore(flags); 148 + 149 + return 0; 150 + } 151 + EXPORT_SYMBOL(gpio_direction_output); 152 + 153 + 154 + /* 155 + * Set the state of an output GPIO line. 156 + */ 157 + void gpio_set_value(unsigned int pin, unsigned int state) 158 + { 159 + unsigned long x, flags; 160 + 161 + if (pin > KS8695_GPIO_15) 162 + return; 163 + 164 + local_irq_save(flags); 165 + 166 + /* set output line state */ 167 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD); 168 + if (state) 169 + x |= (1 << pin); 170 + else 171 + x &= ~(1 << pin); 172 + __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD); 173 + 174 + local_irq_restore(flags); 175 + } 176 + EXPORT_SYMBOL(gpio_set_value); 177 + 178 + 179 + /* 180 + * Read the state of a GPIO line. 181 + */ 182 + int gpio_get_value(unsigned int pin) 183 + { 184 + unsigned long x; 185 + 186 + if (pin > KS8695_GPIO_15) 187 + return -EINVAL; 188 + 189 + x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD); 190 + return (x & (1 << pin)) != 0; 191 + } 192 + EXPORT_SYMBOL(gpio_get_value); 193 + 194 + 195 + /* 196 + * Map GPIO line to IRQ number. 197 + */ 198 + int gpio_to_irq(unsigned int pin) 199 + { 200 + if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */ 201 + return -EINVAL; 202 + 203 + return gpio_irq[pin]; 204 + } 205 + EXPORT_SYMBOL(gpio_to_irq); 206 + 207 + 208 + /* 209 + * Map IRQ number to GPIO line. 210 + */ 211 + int irq_to_gpio(unsigned int irq) 212 + { 213 + if ((irq < KS8695_IRQ_EXTERN0) || (irq > KS8695_IRQ_EXTERN3)) 214 + return -EINVAL; 215 + 216 + return (irq - KS8695_IRQ_EXTERN0); 217 + } 218 + EXPORT_SYMBOL(irq_to_gpio);
+7 -8
arch/arm/mach-pxa/clock.c
··· 12 12 13 13 #include <asm/arch/pxa-regs.h> 14 14 #include <asm/hardware.h> 15 - #include <asm/semaphore.h> 16 15 17 16 struct clk { 18 17 struct list_head node; ··· 24 25 }; 25 26 26 27 static LIST_HEAD(clocks); 27 - static DECLARE_MUTEX(clocks_sem); 28 + static DEFINE_MUTEX(clocks_mutex); 28 29 static DEFINE_SPINLOCK(clocks_lock); 29 30 30 31 struct clk *clk_get(struct device *dev, const char *id) 31 32 { 32 33 struct clk *p, *clk = ERR_PTR(-ENOENT); 33 34 34 - down(&clocks_sem); 35 + mutex_lock(&clocks_mutex); 35 36 list_for_each_entry(p, &clocks, node) { 36 37 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 37 38 clk = p; 38 39 break; 39 40 } 40 41 } 41 - up(&clocks_sem); 42 + mutex_unlock(&clocks_mutex); 42 43 43 44 return clk; 44 45 } ··· 100 101 101 102 int clk_register(struct clk *clk) 102 103 { 103 - down(&clocks_sem); 104 + mutex_lock(&clocks_mutex); 104 105 list_add(&clk->node, &clocks); 105 - up(&clocks_sem); 106 + mutex_unlock(&clocks_mutex); 106 107 return 0; 107 108 } 108 109 EXPORT_SYMBOL(clk_register); 109 110 110 111 void clk_unregister(struct clk *clk) 111 112 { 112 - down(&clocks_sem); 113 + mutex_lock(&clocks_mutex); 113 114 list_del(&clk->node); 114 - up(&clocks_sem); 115 + mutex_unlock(&clocks_mutex); 115 116 } 116 117 EXPORT_SYMBOL(clk_unregister); 117 118
+4 -3
arch/arm/mach-pxa/corgi.c
··· 44 44 #include <asm/hardware/scoop.h> 45 45 46 46 #include "generic.h" 47 + #include "devices.h" 47 48 #include "sharpsl.h" 48 49 49 50 ··· 369 368 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 370 369 .fixup = fixup_corgi, 371 370 .map_io = pxa_map_io, 372 - .init_irq = pxa_init_irq, 371 + .init_irq = pxa25x_init_irq, 373 372 .init_machine = corgi_init, 374 373 .timer = &pxa_timer, 375 374 MACHINE_END ··· 381 380 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 382 381 .fixup = fixup_corgi, 383 382 .map_io = pxa_map_io, 384 - .init_irq = pxa_init_irq, 383 + .init_irq = pxa25x_init_irq, 385 384 .init_machine = corgi_init, 386 385 .timer = &pxa_timer, 387 386 MACHINE_END ··· 393 392 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 394 393 .fixup = fixup_corgi, 395 394 .map_io = pxa_map_io, 396 - .init_irq = pxa_init_irq, 395 + .init_irq = pxa25x_init_irq, 397 396 .init_machine = corgi_init, 398 397 .timer = &pxa_timer, 399 398 MACHINE_END
+11
arch/arm/mach-pxa/devices.h
··· 1 + extern struct platform_device pxamci_device; 2 + extern struct platform_device pxaudc_device; 3 + extern struct platform_device pxafb_device; 4 + extern struct platform_device ffuart_device; 5 + extern struct platform_device btuart_device; 6 + extern struct platform_device stuart_device; 7 + extern struct platform_device hwuart_device; 8 + extern struct platform_device pxai2c_device; 9 + extern struct platform_device pxai2s_device; 10 + extern struct platform_device pxaficp_device; 11 + extern struct platform_device pxartc_device;
+31 -13
arch/arm/mach-pxa/dma.c
··· 25 25 26 26 #include <asm/arch/pxa-regs.h> 27 27 28 - static struct dma_channel { 28 + struct dma_channel { 29 29 char *name; 30 + pxa_dma_prio prio; 30 31 void (*irq_handler)(int, void *); 31 32 void *data; 32 - } dma_channels[PXA_DMA_CHANNELS]; 33 + }; 33 34 35 + static struct dma_channel *dma_channels; 36 + static int num_dma_channels; 34 37 35 38 int pxa_request_dma (char *name, pxa_dma_prio prio, 36 39 void (*irq_handler)(int, void *), ··· 50 47 51 48 do { 52 49 /* try grabbing a DMA channel with the requested priority */ 53 - pxa_for_each_dma_prio (i, prio) { 54 - if (!dma_channels[i].name) { 50 + for (i = 0; i < num_dma_channels; i++) { 51 + if ((dma_channels[i].prio == prio) && 52 + !dma_channels[i].name) { 55 53 found = 1; 56 54 break; 57 55 } ··· 95 91 { 96 92 int i, dint = DINT; 97 93 98 - for (i = 0; i < PXA_DMA_CHANNELS; i++) { 94 + for (i = 0; i < num_dma_channels; i++) { 99 95 if (dint & (1 << i)) { 100 96 struct dma_channel *channel = &dma_channels[i]; 101 97 if (channel->name && channel->irq_handler) { ··· 113 109 return IRQ_HANDLED; 114 110 } 115 111 116 - static int __init pxa_dma_init (void) 112 + int __init pxa_init_dma(int num_ch) 117 113 { 118 - int ret; 114 + int i, ret; 119 115 120 - ret = request_irq (IRQ_DMA, dma_irq_handler, 0, "DMA", NULL); 121 - if (ret) 116 + dma_channels = kzalloc(sizeof(struct dma_channel) * num_ch, GFP_KERNEL); 117 + if (dma_channels == NULL) 118 + return -ENOMEM; 119 + 120 + ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL); 121 + if (ret) { 122 122 printk (KERN_CRIT "Wow! Can't register IRQ for DMA\n"); 123 - return ret; 124 - } 123 + kfree(dma_channels); 124 + return ret; 125 + } 125 126 126 - arch_initcall(pxa_dma_init); 127 + /* dma channel priorities on pxa2xx processors: 128 + * ch 0 - 3, 16 - 19 <--> (0) DMA_PRIO_HIGH 129 + * ch 4 - 7, 20 - 23 <--> (1) DMA_PRIO_MEDIUM 130 + * ch 8 - 15, 24 - 31 <--> (2) DMA_PRIO_LOW 131 + */ 132 + for (i = 0; i < num_ch; i++) 133 + dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW); 134 + 135 + num_dma_channels = num_ch; 136 + return 0; 137 + } 127 138 128 139 EXPORT_SYMBOL(pxa_request_dma); 129 140 EXPORT_SYMBOL(pxa_free_dma); 130 -
+19 -74
arch/arm/mach-pxa/generic.c
··· 43 43 #include <asm/arch/irda.h> 44 44 #include <asm/arch/i2c.h> 45 45 46 + #include "devices.h" 46 47 #include "generic.h" 47 48 48 49 /* ··· 243 242 244 243 static u64 pxamci_dmamask = 0xffffffffUL; 245 244 246 - static struct platform_device pxamci_device = { 245 + struct platform_device pxamci_device = { 247 246 .name = "pxa2xx-mci", 248 247 .id = -1, 249 248 .dev = { ··· 282 281 283 282 static u64 udc_dma_mask = ~(u32)0; 284 283 285 - static struct platform_device udc_device = { 284 + struct platform_device pxaudc_device = { 286 285 .name = "pxa2xx-udc", 287 286 .id = -1, 288 287 .resource = pxa2xx_udc_resources, ··· 308 307 309 308 static u64 fb_dma_mask = ~(u64)0; 310 309 311 - static struct platform_device pxafb_device = { 310 + struct platform_device pxafb_device = { 312 311 .name = "pxa2xx-fb", 313 312 .id = -1, 314 313 .dev = { ··· 329 328 pxafb_device.dev.parent = parent_dev; 330 329 } 331 330 332 - static struct platform_device ffuart_device = { 331 + struct platform_device ffuart_device = { 333 332 .name = "pxa2xx-uart", 334 333 .id = 0, 335 334 }; 336 - static struct platform_device btuart_device = { 335 + struct platform_device btuart_device = { 337 336 .name = "pxa2xx-uart", 338 337 .id = 1, 339 338 }; 340 - static struct platform_device stuart_device = { 339 + struct platform_device stuart_device = { 341 340 .name = "pxa2xx-uart", 342 341 .id = 2, 343 342 }; 344 - static struct platform_device hwuart_device = { 343 + struct platform_device hwuart_device = { 345 344 .name = "pxa2xx-uart", 346 345 .id = 3, 347 346 }; 348 347 349 - static struct resource i2c_resources[] = { 348 + static struct resource pxai2c_resources[] = { 350 349 { 351 350 .start = 0x40301680, 352 351 .end = 0x403016a3, ··· 358 357 }, 359 358 }; 360 359 361 - static struct platform_device i2c_device = { 360 + struct platform_device pxai2c_device = { 362 361 .name = "pxa2xx-i2c", 363 362 .id = 0, 364 - .resource = i2c_resources, 365 - .num_resources = ARRAY_SIZE(i2c_resources), 363 + .resource = pxai2c_resources, 364 + .num_resources = ARRAY_SIZE(pxai2c_resources), 366 365 }; 367 - 368 - #ifdef CONFIG_PXA27x 369 - static struct resource i2c_power_resources[] = { 370 - { 371 - .start = 0x40f00180, 372 - .end = 0x40f001a3, 373 - .flags = IORESOURCE_MEM, 374 - }, { 375 - .start = IRQ_PWRI2C, 376 - .end = IRQ_PWRI2C, 377 - .flags = IORESOURCE_IRQ, 378 - }, 379 - }; 380 - 381 - static struct platform_device i2c_power_device = { 382 - .name = "pxa2xx-i2c", 383 - .id = 1, 384 - .resource = i2c_power_resources, 385 - .num_resources = ARRAY_SIZE(i2c_resources), 386 - }; 387 - #endif 388 366 389 367 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 390 368 { 391 - i2c_device.dev.platform_data = info; 369 + pxai2c_device.dev.platform_data = info; 392 370 } 393 371 394 - static struct resource i2s_resources[] = { 372 + static struct resource pxai2s_resources[] = { 395 373 { 396 374 .start = 0x40400000, 397 375 .end = 0x40400083, ··· 382 402 }, 383 403 }; 384 404 385 - static struct platform_device i2s_device = { 405 + struct platform_device pxai2s_device = { 386 406 .name = "pxa2xx-i2s", 387 407 .id = -1, 388 - .resource = i2s_resources, 389 - .num_resources = ARRAY_SIZE(i2s_resources), 408 + .resource = pxai2s_resources, 409 + .num_resources = ARRAY_SIZE(pxai2s_resources), 390 410 }; 391 411 392 412 static u64 pxaficp_dmamask = ~(u32)0; 393 413 394 - static struct platform_device pxaficp_device = { 414 + struct platform_device pxaficp_device = { 395 415 .name = "pxa2xx-ir", 396 416 .id = -1, 397 417 .dev = { ··· 405 425 pxaficp_device.dev.platform_data = info; 406 426 } 407 427 408 - static struct platform_device pxartc_device = { 428 + struct platform_device pxartc_device = { 409 429 .name = "sa1100-rtc", 410 430 .id = -1, 411 431 }; 412 - 413 - static struct platform_device *devices[] __initdata = { 414 - &pxamci_device, 415 - &udc_device, 416 - &pxafb_device, 417 - &ffuart_device, 418 - &btuart_device, 419 - &stuart_device, 420 - &pxaficp_device, 421 - &i2c_device, 422 - #ifdef CONFIG_PXA27x 423 - &i2c_power_device, 424 - #endif 425 - &i2s_device, 426 - &pxartc_device, 427 - }; 428 - 429 - static int __init pxa_init(void) 430 - { 431 - int cpuid, ret; 432 - 433 - ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 434 - if (ret) 435 - return ret; 436 - 437 - /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */ 438 - cpuid = read_cpuid(CPUID_ID); 439 - if (((cpuid >> 4) & 0xfff) == 0x2d0 || 440 - ((cpuid >> 4) & 0xfff) == 0x290) 441 - ret = platform_device_register(&hwuart_device); 442 - 443 - return ret; 444 - } 445 - 446 - subsys_initcall(pxa_init);
+5 -1
arch/arm/mach-pxa/generic.h
··· 12 12 struct sys_timer; 13 13 14 14 extern struct sys_timer pxa_timer; 15 + extern void __init pxa_init_irq_low(void); 16 + extern void __init pxa_init_irq_high(void); 17 + extern void __init pxa_init_irq_gpio(int gpio_nr); 18 + extern void __init pxa25x_init_irq(void); 19 + extern void __init pxa27x_init_irq(void); 15 20 extern void __init pxa_map_io(void); 16 - extern void __init pxa_init_irq(void); 17 21 18 22 extern unsigned int get_clk_frequency_khz(int info); 19 23
+2 -1
arch/arm/mach-pxa/idp.c
··· 38 38 #include <asm/arch/mmc.h> 39 39 40 40 #include "generic.h" 41 + #include "devices.h" 41 42 42 43 /* TODO: 43 44 * - add pxa2xx_audio_ops_t device structure ··· 153 152 static void __init idp_init_irq(void) 154 153 { 155 154 156 - pxa_init_irq(); 155 + pxa25x_init_irq(); 157 156 158 157 set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE); 159 158 }
+50 -56
arch/arm/mach-pxa/irq.c
··· 30 30 31 31 static void pxa_mask_low_irq(unsigned int irq) 32 32 { 33 - ICMR &= ~(1 << (irq + PXA_IRQ_SKIP)); 33 + ICMR &= ~(1 << irq); 34 34 } 35 35 36 36 static void pxa_unmask_low_irq(unsigned int irq) 37 37 { 38 - ICMR |= (1 << (irq + PXA_IRQ_SKIP)); 38 + ICMR |= (1 << irq); 39 39 } 40 40 41 41 static int pxa_set_wake(unsigned int irq, unsigned int on) ··· 67 67 .set_wake = pxa_set_wake, 68 68 }; 69 69 70 - #if PXA_INTERNAL_IRQS > 32 70 + void __init pxa_init_irq_low(void) 71 + { 72 + int irq; 73 + 74 + /* disable all IRQs */ 75 + ICMR = 0; 76 + 77 + /* all IRQs are IRQ, not FIQ */ 78 + ICLR = 0; 79 + 80 + /* only unmasked interrupts kick us out of idle */ 81 + ICCR = 1; 82 + 83 + for (irq = PXA_IRQ(0); irq <= PXA_IRQ(31); irq++) { 84 + set_irq_chip(irq, &pxa_internal_chip_low); 85 + set_irq_handler(irq, handle_level_irq); 86 + set_irq_flags(irq, IRQF_VALID); 87 + } 88 + } 89 + 90 + #ifdef CONFIG_PXA27x 71 91 72 92 /* 73 93 * This is for the second set of internal IRQs as found on the PXA27x. ··· 95 75 96 76 static void pxa_mask_high_irq(unsigned int irq) 97 77 { 98 - ICMR2 &= ~(1 << (irq - 32 + PXA_IRQ_SKIP)); 78 + ICMR2 &= ~(1 << (irq - 32)); 99 79 } 100 80 101 81 static void pxa_unmask_high_irq(unsigned int irq) 102 82 { 103 - ICMR2 |= (1 << (irq - 32 + PXA_IRQ_SKIP)); 83 + ICMR2 |= (1 << (irq - 32)); 104 84 } 105 85 106 86 static struct irq_chip pxa_internal_chip_high = { ··· 110 90 .unmask = pxa_unmask_high_irq, 111 91 }; 112 92 93 + void __init pxa_init_irq_high(void) 94 + { 95 + int irq; 96 + 97 + ICMR2 = 0; 98 + ICLR2 = 0; 99 + 100 + for (irq = PXA_IRQ(32); irq < PXA_IRQ(64); irq++) { 101 + set_irq_chip(irq, &pxa_internal_chip_high); 102 + set_irq_handler(irq, handle_level_irq); 103 + set_irq_flags(irq, IRQF_VALID); 104 + } 105 + } 113 106 #endif 114 107 115 108 /* Note that if an input/irq line ever gets changed to an output during ··· 250 217 do { 251 218 loop = 0; 252 219 253 - mask = GEDR0 & ~3; 220 + mask = GEDR0 & GPIO_IRQ_mask[0] & ~3; 254 221 if (mask) { 255 222 GEDR0 = mask; 256 223 irq = IRQ_GPIO(2); ··· 266 233 loop = 1; 267 234 } 268 235 269 - mask = GEDR1; 236 + mask = GEDR1 & GPIO_IRQ_mask[1]; 270 237 if (mask) { 271 238 GEDR1 = mask; 272 239 irq = IRQ_GPIO(32); ··· 281 248 loop = 1; 282 249 } 283 250 284 - mask = GEDR2; 251 + mask = GEDR2 & GPIO_IRQ_mask[2]; 285 252 if (mask) { 286 253 GEDR2 = mask; 287 254 irq = IRQ_GPIO(64); ··· 296 263 loop = 1; 297 264 } 298 265 299 - #if PXA_LAST_GPIO >= 96 300 - mask = GEDR3; 266 + mask = GEDR3 & GPIO_IRQ_mask[3]; 301 267 if (mask) { 302 268 GEDR3 = mask; 303 269 irq = IRQ_GPIO(96); ··· 310 278 } while (mask); 311 279 loop = 1; 312 280 } 313 - #endif 314 281 } while (loop); 315 282 } 316 283 ··· 345 314 .set_wake = pxa_set_gpio_wake, 346 315 }; 347 316 348 - 349 - void __init pxa_init_irq(void) 317 + void __init pxa_init_irq_gpio(int gpio_nr) 350 318 { 351 - int irq; 352 - 353 - /* disable all IRQs */ 354 - ICMR = 0; 355 - 356 - /* all IRQs are IRQ, not FIQ */ 357 - ICLR = 0; 319 + int irq, i; 358 320 359 321 /* clear all GPIO edge detects */ 360 - GFER0 = 0; 361 - GFER1 = 0; 362 - GFER2 = 0; 363 - GRER0 = 0; 364 - GRER1 = 0; 365 - GRER2 = 0; 366 - GEDR0 = GEDR0; 367 - GEDR1 = GEDR1; 368 - GEDR2 = GEDR2; 369 - 370 - #ifdef CONFIG_PXA27x 371 - /* And similarly for the extra regs on the PXA27x */ 372 - ICMR2 = 0; 373 - ICLR2 = 0; 374 - GFER3 = 0; 375 - GRER3 = 0; 376 - GEDR3 = GEDR3; 377 - #endif 378 - 379 - /* only unmasked interrupts kick us out of idle */ 380 - ICCR = 1; 322 + for (i = 0; i < gpio_nr; i += 32) { 323 + GFER(i) = 0; 324 + GRER(i) = 0; 325 + GEDR(i) = GEDR(i); 326 + } 381 327 382 328 /* GPIO 0 and 1 must have their mask bit always set */ 383 329 GPIO_IRQ_mask[0] = 3; 384 - 385 - for (irq = PXA_IRQ(PXA_IRQ_SKIP); irq <= PXA_IRQ(31); irq++) { 386 - set_irq_chip(irq, &pxa_internal_chip_low); 387 - set_irq_handler(irq, handle_level_irq); 388 - set_irq_flags(irq, IRQF_VALID); 389 - } 390 - 391 - #if PXA_INTERNAL_IRQS > 32 392 - for (irq = PXA_IRQ(32); irq < PXA_IRQ(PXA_INTERNAL_IRQS); irq++) { 393 - set_irq_chip(irq, &pxa_internal_chip_high); 394 - set_irq_handler(irq, handle_level_irq); 395 - set_irq_flags(irq, IRQF_VALID); 396 - } 397 - #endif 398 330 399 331 for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) { 400 332 set_irq_chip(irq, &pxa_low_gpio_chip); ··· 365 371 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 366 372 } 367 373 368 - for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(PXA_LAST_GPIO); irq++) { 374 + for (irq = IRQ_GPIO(2); irq <= IRQ_GPIO(gpio_nr); irq++) { 369 375 set_irq_chip(irq, &pxa_muxed_gpio_chip); 370 376 set_irq_handler(irq, handle_edge_irq); 371 377 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+2 -1
arch/arm/mach-pxa/lpd270.c
··· 46 46 #include <asm/arch/ohci.h> 47 47 48 48 #include "generic.h" 49 + #include "devices.h" 49 50 50 51 51 52 static unsigned int lpd270_irq_enabled; ··· 98 97 { 99 98 int irq; 100 99 101 - pxa_init_irq(); 100 + pxa27x_init_irq(); 102 101 103 102 __raw_writew(0, LPD270_INT_MASK); 104 103 __raw_writew(0, LPD270_INT_STATUS);
+2 -1
arch/arm/mach-pxa/lubbock.c
··· 48 48 #include <asm/arch/mmc.h> 49 49 50 50 #include "generic.h" 51 + #include "devices.h" 51 52 52 53 53 54 #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080) ··· 104 103 { 105 104 int irq; 106 105 107 - pxa_init_irq(); 106 + pxa25x_init_irq(); 108 107 109 108 /* setup extra lubbock irqs */ 110 109 for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
+2 -1
arch/arm/mach-pxa/mainstone.c
··· 46 46 #include <asm/arch/ohci.h> 47 47 48 48 #include "generic.h" 49 + #include "devices.h" 49 50 50 51 51 52 static unsigned long mainstone_irq_enabled; ··· 90 89 { 91 90 int irq; 92 91 93 - pxa_init_irq(); 92 + pxa27x_init_irq(); 94 93 95 94 /* setup extra Mainstone irqs */ 96 95 for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) {
-47
arch/arm/mach-pxa/pm.c
··· 77 77 { 78 78 unsigned long sleep_save[SLEEP_SAVE_SIZE]; 79 79 unsigned long checksum = 0; 80 - struct timespec delta, rtc; 81 80 int i; 82 81 extern void pxa_cpu_pm_enter(suspend_state_t state); 83 82 ··· 85 86 if (elf_hwcap & HWCAP_IWMMXT) 86 87 iwmmxt_task_disable(NULL); 87 88 #endif 88 - 89 - /* preserve current time */ 90 - rtc.tv_sec = RCNR; 91 - rtc.tv_nsec = 0; 92 - save_time_delta(&delta, &rtc); 93 89 94 90 SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2); 95 91 SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2); ··· 177 183 178 184 RESTORE(PSTR); 179 185 180 - /* restore current time */ 181 - rtc.tv_sec = RCNR; 182 - restore_time_delta(&delta, &rtc); 183 - 184 186 #ifdef DEBUG 185 187 printk(KERN_DEBUG "*** made it back from resume\n"); 186 188 #endif ··· 190 200 { 191 201 return virt_to_phys(sp); 192 202 } 193 - 194 - /* 195 - * Called after processes are frozen, but before we shut down devices. 196 - */ 197 - int pxa_pm_prepare(suspend_state_t state) 198 - { 199 - extern int pxa_cpu_pm_prepare(suspend_state_t state); 200 - 201 - return pxa_cpu_pm_prepare(state); 202 - } 203 - 204 - EXPORT_SYMBOL_GPL(pxa_pm_prepare); 205 - 206 - /* 207 - * Called after devices are re-setup, but before processes are thawed. 208 - */ 209 - int pxa_pm_finish(suspend_state_t state) 210 - { 211 - return 0; 212 - } 213 - 214 - EXPORT_SYMBOL_GPL(pxa_pm_finish); 215 - 216 - static struct pm_ops pxa_pm_ops = { 217 - .prepare = pxa_pm_prepare, 218 - .enter = pxa_pm_enter, 219 - .finish = pxa_pm_finish, 220 - .valid = pm_valid_only_mem, 221 - }; 222 - 223 - static int __init pxa_pm_init(void) 224 - { 225 - pm_set_ops(&pxa_pm_ops); 226 - return 0; 227 - } 228 - 229 - device_initcall(pxa_pm_init);
+2 -1
arch/arm/mach-pxa/poodle.c
··· 45 45 #include <asm/mach/sharpsl_param.h> 46 46 47 47 #include "generic.h" 48 + #include "devices.h" 48 49 #include "sharpsl.h" 49 50 50 51 static struct resource poodle_scoop_resources[] = { ··· 413 412 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 414 413 .fixup = fixup_poodle, 415 414 .map_io = pxa_map_io, 416 - .init_irq = pxa_init_irq, 415 + .init_irq = pxa25x_init_irq, 417 416 .timer = &pxa_timer, 418 417 .init_machine = poodle_init, 419 418 MACHINE_END
+50 -12
arch/arm/mach-pxa/pxa25x.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/kernel.h> 21 21 #include <linux/init.h> 22 + #include <linux/platform_device.h> 22 23 #include <linux/pm.h> 23 24 24 25 #include <asm/hardware.h> 26 + #include <asm/arch/irqs.h> 25 27 #include <asm/arch/pxa-regs.h> 28 + #include <asm/arch/pm.h> 29 + #include <asm/arch/dma.h> 26 30 27 31 #include "generic.h" 32 + #include "devices.h" 28 33 29 34 /* 30 35 * Various clock factors driven by the CCCR register. ··· 110 105 111 106 #ifdef CONFIG_PM 112 107 113 - int pxa_cpu_pm_prepare(suspend_state_t state) 114 - { 115 - switch (state) { 116 - case PM_SUSPEND_MEM: 117 - break; 118 - default: 119 - return -EINVAL; 120 - } 121 - 122 - return 0; 123 - } 124 - 125 108 void pxa_cpu_pm_enter(suspend_state_t state) 126 109 { 127 110 extern void pxa_cpu_suspend(unsigned int); ··· 126 133 } 127 134 } 128 135 136 + static struct pm_ops pxa25x_pm_ops = { 137 + .enter = pxa_pm_enter, 138 + .valid = pm_valid_only_mem, 139 + }; 129 140 #endif 141 + 142 + void __init pxa25x_init_irq(void) 143 + { 144 + pxa_init_irq_low(); 145 + pxa_init_irq_gpio(85); 146 + } 147 + 148 + static struct platform_device *pxa25x_devices[] __initdata = { 149 + &pxamci_device, 150 + &pxaudc_device, 151 + &pxafb_device, 152 + &ffuart_device, 153 + &btuart_device, 154 + &stuart_device, 155 + &pxai2c_device, 156 + &pxai2s_device, 157 + &pxaficp_device, 158 + &pxartc_device, 159 + }; 160 + 161 + static int __init pxa25x_init(void) 162 + { 163 + int ret = 0; 164 + 165 + if (cpu_is_pxa21x() || cpu_is_pxa25x()) { 166 + if ((ret = pxa_init_dma(16))) 167 + return ret; 168 + #ifdef CONFIG_PM 169 + pm_set_ops(&pxa25x_pm_ops); 170 + #endif 171 + ret = platform_add_devices(pxa25x_devices, 172 + ARRAY_SIZE(pxa25x_devices)); 173 + } 174 + /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */ 175 + if (cpu_is_pxa25x()) 176 + ret = platform_device_register(&hwuart_device); 177 + 178 + return ret; 179 + } 180 + 181 + subsys_initcall(pxa25x_init);
+64 -16
arch/arm/mach-pxa/pxa27x.c
··· 19 19 20 20 #include <asm/hardware.h> 21 21 #include <asm/irq.h> 22 + #include <asm/arch/irqs.h> 22 23 #include <asm/arch/pxa-regs.h> 23 24 #include <asm/arch/ohci.h> 25 + #include <asm/arch/pm.h> 26 + #include <asm/arch/dma.h> 24 27 25 28 #include "generic.h" 29 + #include "devices.h" 26 30 27 31 /* Crystal clock: 13MHz */ 28 32 #define BASE_CLK 13000000 ··· 126 122 127 123 #ifdef CONFIG_PM 128 124 129 - int pxa_cpu_pm_prepare(suspend_state_t state) 130 - { 131 - switch (state) { 132 - case PM_SUSPEND_MEM: 133 - case PM_SUSPEND_STANDBY: 134 - return 0; 135 - default: 136 - return -EINVAL; 137 - } 138 - } 139 - 140 125 void pxa_cpu_pm_enter(suspend_state_t state) 141 126 { 142 127 extern void pxa_cpu_standby(void); ··· 155 162 } 156 163 } 157 164 165 + static int pxa27x_pm_valid(suspend_state_t state) 166 + { 167 + return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY; 168 + } 169 + 170 + static struct pm_ops pxa27x_pm_ops = { 171 + .enter = pxa_pm_enter, 172 + .valid = pxa27x_pm_valid, 173 + }; 158 174 #endif 159 175 160 176 /* ··· 185 183 }, 186 184 }; 187 185 188 - static struct platform_device ohci_device = { 186 + static struct platform_device pxaohci_device = { 189 187 .name = "pxa27x-ohci", 190 188 .id = -1, 191 189 .dev = { ··· 198 196 199 197 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) 200 198 { 201 - ohci_device.dev.platform_data = info; 199 + pxaohci_device.dev.platform_data = info; 202 200 } 203 201 204 - static struct platform_device *devices[] __initdata = { 205 - &ohci_device, 202 + static struct resource i2c_power_resources[] = { 203 + { 204 + .start = 0x40f00180, 205 + .end = 0x40f001a3, 206 + .flags = IORESOURCE_MEM, 207 + }, { 208 + .start = IRQ_PWRI2C, 209 + .end = IRQ_PWRI2C, 210 + .flags = IORESOURCE_IRQ, 211 + }, 206 212 }; 213 + 214 + static struct platform_device pxai2c_power_device = { 215 + .name = "pxa2xx-i2c", 216 + .id = 1, 217 + .resource = i2c_power_resources, 218 + .num_resources = ARRAY_SIZE(i2c_power_resources), 219 + }; 220 + 221 + static struct platform_device *devices[] __initdata = { 222 + &pxamci_device, 223 + &pxaudc_device, 224 + &pxafb_device, 225 + &ffuart_device, 226 + &btuart_device, 227 + &stuart_device, 228 + &pxai2c_device, 229 + &pxai2c_power_device, 230 + &pxai2s_device, 231 + &pxaficp_device, 232 + &pxartc_device, 233 + &pxaohci_device, 234 + }; 235 + 236 + void __init pxa27x_init_irq(void) 237 + { 238 + pxa_init_irq_low(); 239 + pxa_init_irq_high(); 240 + pxa_init_irq_gpio(128); 241 + } 207 242 208 243 static int __init pxa27x_init(void) 209 244 { 210 - return platform_add_devices(devices, ARRAY_SIZE(devices)); 245 + int ret = 0; 246 + if (cpu_is_pxa27x()) { 247 + if ((ret = pxa_init_dma(32))) 248 + return ret; 249 + #ifdef CONFIG_PM 250 + pm_set_ops(&pxa27x_pm_ops); 251 + #endif 252 + ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 253 + } 254 + return ret; 211 255 } 212 256 213 257 subsys_initcall(pxa27x_init);
+4 -3
arch/arm/mach-pxa/spitz.c
··· 48 48 #include <asm/hardware/scoop.h> 49 49 50 50 #include "generic.h" 51 + #include "devices.h" 51 52 #include "sharpsl.h" 52 53 53 54 /* ··· 561 560 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 562 561 .fixup = fixup_spitz, 563 562 .map_io = pxa_map_io, 564 - .init_irq = pxa_init_irq, 563 + .init_irq = pxa27x_init_irq, 565 564 .init_machine = spitz_init, 566 565 .timer = &pxa_timer, 567 566 MACHINE_END ··· 573 572 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 574 573 .fixup = fixup_spitz, 575 574 .map_io = pxa_map_io, 576 - .init_irq = pxa_init_irq, 575 + .init_irq = pxa27x_init_irq, 577 576 .init_machine = spitz_init, 578 577 .timer = &pxa_timer, 579 578 MACHINE_END ··· 585 584 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 586 585 .fixup = fixup_spitz, 587 586 .map_io = pxa_map_io, 588 - .init_irq = pxa_init_irq, 587 + .init_irq = pxa27x_init_irq, 589 588 .init_machine = akita_init, 590 589 .timer = &pxa_timer, 591 590 MACHINE_END
-9
arch/arm/mach-pxa/time.c
··· 30 30 #include <asm/arch/pxa-regs.h> 31 31 32 32 33 - static inline unsigned long pxa_get_rtc_time(void) 34 - { 35 - return RCNR; 36 - } 37 - 38 33 static int pxa_set_rtc(void) 39 34 { 40 35 unsigned long current_time = xtime.tv_sec; ··· 116 121 unsigned long flags; 117 122 118 123 set_rtc = pxa_set_rtc; 119 - 120 - tv.tv_nsec = 0; 121 - tv.tv_sec = pxa_get_rtc_time(); 122 - do_settimeofday(&tv); 123 124 124 125 OIER = 0; /* disable any timer interrupts */ 125 126 OSSR = 0xf; /* clear status on all timers */
+2 -2
arch/arm/mach-pxa/tosa.c
··· 42 42 #include <asm/mach/sharpsl_param.h> 43 43 44 44 #include "generic.h" 45 - 45 + #include "devices.h" 46 46 47 47 /* 48 48 * SCOOP Device ··· 332 332 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 333 333 .fixup = fixup_tosa, 334 334 .map_io = pxa_map_io, 335 - .init_irq = pxa_init_irq, 335 + .init_irq = pxa25x_init_irq, 336 336 .init_machine = tosa_init, 337 337 .timer = &pxa_timer, 338 338 MACHINE_END
+2 -1
arch/arm/mach-pxa/trizeps4.c
··· 49 49 #include <asm/arch/ohci.h> 50 50 51 51 #include "generic.h" 52 + #include "devices.h" 52 53 53 54 /******************************************************************************************** 54 55 * ONBOARD FLASH ··· 504 503 .boot_params = TRIZEPS4_SDRAM_BASE + 0x100, 505 504 .init_machine = trizeps4_init, 506 505 .map_io = trizeps4_map_io, 507 - .init_irq = pxa_init_irq, 506 + .init_irq = pxa27x_init_irq, 508 507 .timer = &pxa_timer, 509 508 MACHINE_END 510 509
+59
arch/arm/mach-s3c2410/mach-bast.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/dm9000.h> 22 22 23 + #include <net/ax88796.h> 24 + 23 25 #include <asm/mach/arch.h> 24 26 #include <asm/mach/map.h> 25 27 #include <asm/mach/irq.h> ··· 411 409 .max_freq = 130*1000, 412 410 }; 413 411 412 + /* Asix AX88796 10/100 ethernet controller */ 413 + 414 + static struct ax_plat_data bast_asix_platdata = { 415 + .flags = AXFLG_MAC_FROMDEV, 416 + .wordlength = 2, 417 + .dcr_val = 0x48, 418 + .rcr_val = 0x40, 419 + }; 420 + 421 + static struct resource bast_asix_resource[] = { 422 + [0] = { 423 + .start = S3C2410_CS5 + BAST_PA_ASIXNET, 424 + .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20) - 1, 425 + .flags = IORESOURCE_MEM, 426 + }, 427 + [1] = { 428 + .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 429 + .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1f * 0x20), 430 + .flags = IORESOURCE_MEM, 431 + }, 432 + [2] = { 433 + .start = IRQ_ASIX, 434 + .end = IRQ_ASIX, 435 + .flags = IORESOURCE_IRQ 436 + } 437 + }; 438 + 439 + static struct platform_device bast_device_asix = { 440 + .name = "ax88796", 441 + .id = 0, 442 + .num_resources = ARRAY_SIZE(bast_asix_resource), 443 + .resource = bast_asix_resource, 444 + .dev = { 445 + .platform_data = &bast_asix_platdata 446 + } 447 + }; 448 + 449 + /* Asix AX88796 10/100 ethernet controller parallel port */ 450 + 451 + static struct resource bast_asixpp_resource[] = { 452 + [0] = { 453 + .start = S3C2410_CS5 + BAST_PA_ASIXNET + (0x18 * 0x20), 454 + .end = S3C2410_CS5 + BAST_PA_ASIXNET + (0x1b * 0x20) - 1, 455 + .flags = IORESOURCE_MEM, 456 + } 457 + }; 458 + 459 + static struct platform_device bast_device_axpp = { 460 + .name = "ax88796-pp", 461 + .id = 0, 462 + .num_resources = ARRAY_SIZE(bast_asixpp_resource), 463 + .resource = bast_asixpp_resource, 464 + }; 465 + 466 + /* LCD/VGA controller */ 414 467 415 468 static struct s3c2410fb_mach_info __initdata bast_lcd_info = { 416 469 .width = 640, ··· 510 453 &s3c_device_nand, 511 454 &bast_device_nor, 512 455 &bast_device_dm9k, 456 + &bast_device_asix, 457 + &bast_device_axpp, 513 458 &bast_sio, 514 459 }; 515 460
+139 -2
arch/arm/mach-s3c2440/mach-anubis.c
··· 18 18 #include <linux/serial_core.h> 19 19 #include <linux/platform_device.h> 20 20 21 + #include <linux/sm501.h> 22 + #include <linux/sm501-regs.h> 23 + 21 24 #include <asm/mach/arch.h> 22 25 #include <asm/mach/map.h> 23 26 #include <asm/mach/irq.h> ··· 44 41 #include <linux/mtd/nand.h> 45 42 #include <linux/mtd/nand_ecc.h> 46 43 #include <linux/mtd/partitions.h> 44 + 45 + #include <net/ax88796.h> 47 46 48 47 #include <asm/plat-s3c24xx/clock.h> 49 48 #include <asm/plat-s3c24xx/devs.h> ··· 145 140 .name = "/boot", 146 141 .size = SZ_4M - SZ_16K, 147 142 .offset = SZ_16K, 143 + }, 144 + [2] = { 145 + .name = "user1", 146 + .offset = SZ_4M, 147 + .size = SZ_32M - SZ_4M, 148 + }, 149 + [3] = { 150 + .name = "user2", 151 + .offset = SZ_32M, 152 + .size = MTDPART_SIZ_FULL, 153 + } 154 + }; 155 + 156 + static struct mtd_partition anubis_default_nand_part_large[] = { 157 + [0] = { 158 + .name = "Boot Agent", 159 + .size = SZ_128K, 160 + .offset = 0, 161 + }, 162 + [1] = { 163 + .name = "/boot", 164 + .size = SZ_4M - SZ_128K, 165 + .offset = SZ_128K, 148 166 }, 149 167 [2] = { 150 168 .name = "user1", ··· 288 260 .resource = anubis_ide1_resource, 289 261 }; 290 262 263 + /* Asix AX88796 10/100 ethernet controller */ 264 + 265 + static struct ax_plat_data anubis_asix_platdata = { 266 + .flags = AXFLG_MAC_FROMDEV, 267 + .wordlength = 2, 268 + .dcr_val = 0x48, 269 + .rcr_val = 0x40, 270 + }; 271 + 272 + static struct resource anubis_asix_resource[] = { 273 + [0] = { 274 + .start = S3C2410_CS5, 275 + .end = S3C2410_CS5 + (0x20 * 0x20) -1, 276 + .flags = IORESOURCE_MEM 277 + }, 278 + [1] = { 279 + .start = IRQ_ASIX, 280 + .end = IRQ_ASIX, 281 + .flags = IORESOURCE_IRQ 282 + } 283 + }; 284 + 285 + static struct platform_device anubis_device_asix = { 286 + .name = "ax88796", 287 + .id = 0, 288 + .num_resources = ARRAY_SIZE(anubis_asix_resource), 289 + .resource = anubis_asix_resource, 290 + .dev = { 291 + .platform_data = &anubis_asix_platdata, 292 + } 293 + }; 294 + 295 + /* SM501 */ 296 + 297 + static struct resource anubis_sm501_resource[] = { 298 + [0] = { 299 + .start = S3C2410_CS2, 300 + .end = S3C2410_CS2 + SZ_8M, 301 + .flags = IORESOURCE_MEM, 302 + }, 303 + [1] = { 304 + .start = S3C2410_CS2 + SZ_64M - SZ_2M, 305 + .end = S3C2410_CS2 + SZ_64M - 1, 306 + .flags = IORESOURCE_MEM, 307 + }, 308 + [2] = { 309 + .start = IRQ_EINT0, 310 + .end = IRQ_EINT0, 311 + .flags = IORESOURCE_IRQ, 312 + }, 313 + }; 314 + 315 + static struct sm501_initdata anubis_sm501_initdata = { 316 + .gpio_high = { 317 + .set = 0x3F000000, /* 24bit panel */ 318 + .mask = 0x0, 319 + }, 320 + .misc_timing = { 321 + .set = 0x010100, /* SDRAM timing */ 322 + .mask = 0x1F1F00, 323 + }, 324 + .misc_control = { 325 + .set = SM501_MISC_PNL_24BIT, 326 + .mask = 0, 327 + }, 328 + 329 + /* set the SDRAM and bus clocks */ 330 + .mclk = 72 * MHZ, 331 + .m1xclk = 144 * MHZ, 332 + }; 333 + 334 + static struct sm501_platdata_gpio_i2c anubis_sm501_gpio_i2c[] = { 335 + [0] = { 336 + .pin_scl = 44, 337 + .pin_sda = 45, 338 + }, 339 + [1] = { 340 + .pin_scl = 40, 341 + .pin_sda = 41, 342 + }, 343 + }; 344 + 345 + static struct sm501_platdata anubis_sm501_platdata = { 346 + .init = &anubis_sm501_initdata, 347 + .gpio_i2c = anubis_sm501_gpio_i2c, 348 + .gpio_i2c_nr = ARRAY_SIZE(anubis_sm501_gpio_i2c), 349 + }; 350 + 351 + static struct platform_device anubis_device_sm501 = { 352 + .name = "sm501", 353 + .id = 0, 354 + .num_resources = ARRAY_SIZE(anubis_sm501_resource), 355 + .resource = anubis_sm501_resource, 356 + .dev = { 357 + .platform_data = &anubis_sm501_platdata, 358 + }, 359 + }; 360 + 291 361 /* Standard Anubis devices */ 292 362 293 363 static struct platform_device *anubis_devices[] __initdata = { ··· 397 271 &s3c_device_nand, 398 272 &anubis_device_ide0, 399 273 &anubis_device_ide1, 274 + &anubis_device_asix, 275 + &anubis_device_sm501, 400 276 }; 401 277 402 278 static struct clk *anubis_clocks[] = { ··· 432 304 s3c24xx_init_clocks(0); 433 305 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 434 306 435 - /* ensure that the GPIO is setup */ 436 - s3c2410_gpio_setpin(S3C2410_GPA0, 1); 307 + /* check for the newer revision boards with large page nand */ 308 + 309 + if ((__raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK) >= 4) { 310 + printk(KERN_INFO "ANUBIS-B detected (revision %d)\n", 311 + __raw_readb(ANUBIS_VA_IDREG) & ANUBIS_IDREG_REVMASK); 312 + anubis_nand_sets[0].partitions = anubis_default_nand_part_large; 313 + anubis_nand_sets[0].nr_partitions = ARRAY_SIZE(anubis_default_nand_part_large); 314 + } else { 315 + /* ensure that the GPIO is setup */ 316 + s3c2410_gpio_setpin(S3C2410_GPA0, 1); 317 + } 437 318 } 438 319 439 320 static void __init anubis_init(void)
+35 -3
arch/arm/mach-s3c2440/mach-osiris.c
··· 166 166 } 167 167 }; 168 168 169 + static struct mtd_partition osiris_default_nand_part_large[] = { 170 + [0] = { 171 + .name = "Boot Agent", 172 + .size = SZ_128K, 173 + .offset = 0, 174 + }, 175 + [1] = { 176 + .name = "/boot", 177 + .size = SZ_4M - SZ_128K, 178 + .offset = SZ_128K, 179 + }, 180 + [2] = { 181 + .name = "user1", 182 + .offset = SZ_4M, 183 + .size = SZ_32M - SZ_4M, 184 + }, 185 + [3] = { 186 + .name = "user2", 187 + .offset = SZ_32M, 188 + .size = MTDPART_SIZ_FULL, 189 + } 190 + }; 191 + 169 192 /* the Osiris has 3 selectable slots for nand-flash, the two 170 193 * on-board chip areas, as well as the external slot. 171 194 * ··· 345 322 s3c24xx_init_clocks(0); 346 323 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 347 324 325 + /* check for the newer revision boards with large page nand */ 326 + 327 + if ((__raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK) >= 4) { 328 + printk(KERN_INFO "OSIRIS-B detected (revision %d)\n", 329 + __raw_readb(OSIRIS_VA_IDREG) & OSIRIS_ID_REVMASK); 330 + osiris_nand_sets[0].partitions = osiris_default_nand_part_large; 331 + osiris_nand_sets[0].nr_partitions = ARRAY_SIZE(osiris_default_nand_part_large); 332 + } else { 333 + /* write-protect line to the NAND */ 334 + s3c2410_gpio_setpin(S3C2410_GPA0, 1); 335 + } 336 + 348 337 /* fix bus configuration (nBE settings wrong on ABLE pre v2.20) */ 349 338 350 339 local_irq_save(flags); 351 340 __raw_writel(__raw_readl(S3C2410_BWSCON) | S3C2410_BWSCON_ST1 | S3C2410_BWSCON_ST2 | S3C2410_BWSCON_ST3 | S3C2410_BWSCON_ST4 | S3C2410_BWSCON_ST5, S3C2410_BWSCON); 352 341 local_irq_restore(flags); 353 - 354 - /* write-protect line to the NAND */ 355 - s3c2410_gpio_setpin(S3C2410_GPA0, 1); 356 342 } 357 343 358 344 static void __init osiris_init(void)
-9
arch/arm/mach-sa1100/pm.c
··· 57 57 static int sa11x0_pm_enter(suspend_state_t state) 58 58 { 59 59 unsigned long gpio, sleep_save[SLEEP_SAVE_SIZE]; 60 - struct timespec delta, rtc; 61 60 62 - /* preserve current time */ 63 - rtc.tv_sec = RCNR; 64 - rtc.tv_nsec = 0; 65 - save_time_delta(&delta, &rtc); 66 61 gpio = GPLR; 67 62 68 63 /* save vital registers */ ··· 113 118 * Clear the peripheral sleep-hold bit. 114 119 */ 115 120 PSSR = PSSR_PH; 116 - 117 - /* restore current time */ 118 - rtc.tv_sec = RCNR; 119 - restore_time_delta(&delta, &rtc); 120 121 121 122 return 0; 122 123 }
-24
arch/arm/mach-sa1100/time.c
··· 21 21 #define RTC_DEF_DIVIDER (32768 - 1) 22 22 #define RTC_DEF_TRIM 0 23 23 24 - static unsigned long __init sa1100_get_rtc_time(void) 25 - { 26 - /* 27 - * According to the manual we should be able to let RTTR be zero 28 - * and then a default divisor for a 32.768KHz clock is used. 29 - * Apparently this doesn't work, at least for my SA1110 rev 5. 30 - * If the clock divider is uninitialized then reset it to the 31 - * default value to get the 1Hz clock. 32 - */ 33 - if (RTTR == 0) { 34 - RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16); 35 - printk(KERN_WARNING "Warning: uninitialized Real Time Clock\n"); 36 - /* The current RTC value probably doesn't make sense either */ 37 - RCNR = 0; 38 - return 0; 39 - } 40 - return RCNR; 41 - } 42 - 43 24 static int sa1100_set_rtc(void) 44 25 { 45 26 unsigned long current_time = xtime.tv_sec; ··· 98 117 99 118 static void __init sa1100_timer_init(void) 100 119 { 101 - struct timespec tv; 102 120 unsigned long flags; 103 121 104 122 set_rtc = sa1100_set_rtc; 105 - 106 - tv.tv_nsec = 0; 107 - tv.tv_sec = sa1100_get_rtc_time(); 108 - do_settimeofday(&tv); 109 123 110 124 OIER = 0; /* disable any timer interrupts */ 111 125 OSSR = 0xf; /* clear status on all timers */
+4 -6
arch/arm/mm/ioremap.c
··· 280 280 if (!type) 281 281 return NULL; 282 282 283 - size = PAGE_ALIGN(size); 283 + /* 284 + * Page align the mapping size, taking account of any offset. 285 + */ 286 + size = PAGE_ALIGN(offset + size); 284 287 285 288 area = get_vm_area(size, VM_IOREMAP); 286 289 if (!area) ··· 327 324 last_addr = phys_addr + size - 1; 328 325 if (!size || last_addr < phys_addr) 329 326 return NULL; 330 - 331 - /* 332 - * Page align the mapping size 333 - */ 334 - size = PAGE_ALIGN(last_addr + 1) - phys_addr; 335 327 336 328 return __arm_ioremap_pfn(pfn, offset, size, mtype); 337 329 }
-22
drivers/mmc/host/pxamci.h
··· 1 - #undef MMC_STRPCL 2 - #undef MMC_STAT 3 - #undef MMC_CLKRT 4 - #undef MMC_SPI 5 - #undef MMC_CMDAT 6 - #undef MMC_RESTO 7 - #undef MMC_RDTO 8 - #undef MMC_BLKLEN 9 - #undef MMC_NOB 10 - #undef MMC_PRTBUF 11 - #undef MMC_I_MASK 12 - #undef END_CMD_RES 13 - #undef PRG_DONE 14 - #undef DATA_TRAN_DONE 15 - #undef MMC_I_REG 16 - #undef MMC_CMD 17 - #undef MMC_ARGH 18 - #undef MMC_ARGL 19 - #undef MMC_RES 20 - #undef MMC_RXFIFO 21 - #undef MMC_TXFIFO 22 - 23 1 #define MMC_STRPCL 0x0000 24 2 #define STOP_CLOCK (1 << 0) 25 3 #define START_CLOCK (2 << 0)
+2
include/asm-arm/Kbuild
··· 1 1 include include/asm-generic/Kbuild.asm 2 + 3 + unifdef-y += hwcap.h
+10 -3
include/asm-arm/arch-at91/at91_dbgu.h
··· 16 16 #ifndef AT91_DBGU_H 17 17 #define AT91_DBGU_H 18 18 19 + #ifdef AT91_DBGU 19 20 #define AT91_DBGU_CR (AT91_DBGU + 0x00) /* Control Register */ 20 21 #define AT91_DBGU_MR (AT91_DBGU + 0x04) /* Mode Register */ 21 22 #define AT91_DBGU_IER (AT91_DBGU + 0x08) /* Interrupt Enable Register */ ··· 31 30 32 31 #define AT91_DBGU_CIDR (AT91_DBGU + 0x40) /* Chip ID Register */ 33 32 #define AT91_DBGU_EXID (AT91_DBGU + 0x44) /* Chip ID Extension Register */ 33 + #define AT91_DBGU_FNR (AT91_DBGU + 0x48) /* Force NTRST Register [SAM9 only] */ 34 + #define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */ 35 + 36 + #endif /* AT91_DBGU */ 37 + 38 + /* 39 + * Some AT91 parts that don't have full DEBUG units still support the ID 40 + * and extensions register. 41 + */ 34 42 #define AT91_CIDR_VERSION (0x1f << 0) /* Version of the Device */ 35 43 #define AT91_CIDR_EPROC (7 << 5) /* Embedded Processor */ 36 44 #define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */ ··· 62 52 #define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */ 63 53 #define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */ 64 54 #define AT91_CIDR_EXT (1 << 31) /* Extension Flag */ 65 - 66 - #define AT91_DBGU_FNR (AT91_DBGU + 0x48) /* Force NTRST Register [SAM9 only] */ 67 - #define AT91_DBGU_FNTRST (1 << 0) /* Force NTRST */ 68 55 69 56 #endif
+55
include/asm-arm/arch-at91/at91x40.h
··· 1 + /* 2 + * include/asm-arm/arch-at91/at91x40.h 3 + * 4 + * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com> 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 as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + */ 11 + 12 + #ifndef AT91X40_H 13 + #define AT91X40_H 14 + 15 + /* 16 + * IRQ list. 17 + */ 18 + #define AT91_ID_FIQ 0 /* FIQ */ 19 + #define AT91_ID_SYS 1 /* System Peripheral */ 20 + #define AT91X40_ID_USART0 2 /* USART port 0 */ 21 + #define AT91X40_ID_USART1 3 /* USART port 1 */ 22 + #define AT91X40_ID_TC0 4 /* Timer/Counter 0 */ 23 + #define AT91X40_ID_TC1 5 /* Timer/Counter 1*/ 24 + #define AT91X40_ID_TC2 6 /* Timer/Counter 2*/ 25 + #define AT91X40_ID_WD 7 /* Watchdog? */ 26 + #define AT91X40_ID_PIOA 8 /* Parallel IO Controller A */ 27 + 28 + #define AT91X40_ID_IRQ0 16 /* External IRQ 0 */ 29 + #define AT91X40_ID_IRQ1 17 /* External IRQ 1 */ 30 + #define AT91X40_ID_IRQ2 18 /* External IRQ 2 */ 31 + 32 + /* 33 + * System Peripherals (offset from AT91_BASE_SYS) 34 + */ 35 + #define AT91_BASE_SYS 0xffc00000 36 + 37 + #define AT91_EBI (0xffe00000 - AT91_BASE_SYS) /* External Bus Interface */ 38 + #define AT91_SF (0xfff00000 - AT91_BASE_SYS) /* Special Function */ 39 + #define AT91_USART1 (0xfffcc000 - AT91_BASE_SYS) /* USART 1 */ 40 + #define AT91_USART0 (0xfffd0000 - AT91_BASE_SYS) /* USART 0 */ 41 + #define AT91_TC (0xfffe0000 - AT91_BASE_SYS) /* Timer Counter */ 42 + #define AT91_PIOA (0xffff0000 - AT91_BASE_SYS) /* PIO Controller A */ 43 + #define AT91_PS (0xffff4000 - AT91_BASE_SYS) /* Power Save */ 44 + #define AT91_WD (0xffff8000 - AT91_BASE_SYS) /* Watchdog Timer */ 45 + #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */ 46 + 47 + /* 48 + * The AT91x40 series doesn't have a debug unit like the other AT91 parts. 49 + * But it does have a chip identify register and extension ID, so define at 50 + * least these here. 51 + */ 52 + #define AT91_DBGU_CIDR (AT91_SF + 0) /* CIDR in PS segment */ 53 + #define AT91_DBGU_EXID (AT91_SF + 4) /* EXID in PS segment */ 54 + 55 + #endif /* AT91X40_H */
+5
include/asm-arm/arch-at91/cpu.h
··· 28 28 29 29 #define ARCH_ID_AT91SAM9RL64 0x019b03a0 30 30 31 + #define ARCH_ID_AT91M40800 0x14080044 32 + #define ARCH_ID_AT91R40807 0x44080746 33 + #define ARCH_ID_AT91M40807 0x14080745 34 + #define ARCH_ID_AT91R40008 0x44000840 35 + 31 36 static inline unsigned long at91_cpu_identify(void) 32 37 { 33 38 return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION);
+16 -1
include/asm-arm/arch-at91/hardware.h
··· 26 26 #include <asm/arch/at91sam9263.h> 27 27 #elif defined(CONFIG_ARCH_AT91SAM9RL) 28 28 #include <asm/arch/at91sam9rl.h> 29 + #elif defined(CONFIG_ARCH_AT91X40) 30 + #include <asm/arch/at91x40.h> 29 31 #else 30 32 #error "Unsupported AT91 processor" 31 33 #endif 32 34 33 35 36 + #ifdef CONFIG_MMU 34 37 /* 35 38 * Remap the peripherals from address 0xFFF78000 .. 0xFFFFFFFF 36 39 * to 0xFEF78000 .. 0xFF000000. (544Kb) 37 40 */ 38 41 #define AT91_IO_PHYS_BASE 0xFFF78000 39 - #define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1) 40 42 #define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE) 43 + #else 44 + /* 45 + * Identity mapping for the non MMU case. 46 + */ 47 + #define AT91_IO_PHYS_BASE AT91_BASE_SYS 48 + #define AT91_IO_VIRT_BASE AT91_IO_PHYS_BASE 49 + #endif 50 + 51 + #define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1) 41 52 42 53 /* Convert a physical IO address to virtual IO address */ 43 54 #define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE) ··· 77 66 #define AT91_CHIPSELECT_7 0x80000000 78 67 79 68 /* SDRAM */ 69 + #ifdef CONFIG_DRAM_BASE 70 + #define AT91_SDRAM_BASE CONFIG_DRAM_BASE 71 + #else 80 72 #define AT91_SDRAM_BASE AT91_CHIPSELECT_1 73 + #endif 81 74 82 75 /* Clocks */ 83 76 #define AT91_SLOW_CLOCK 32768 /* slow clock */
+5
include/asm-arm/arch-at91/timex.h
··· 42 42 #define AT91SAM9_MASTER_CLOCK 100000000 43 43 #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 44 44 45 + #elif defined(CONFIG_ARCH_AT91X40) 46 + 47 + #define AT91X40_MASTER_CLOCK 40000000 48 + #define CLOCK_TICK_RATE (AT91X40_MASTER_CLOCK) 49 + 45 50 #endif 46 51 47 52 #endif
+4
include/asm-arm/arch-at91/uncompress.h
··· 33 33 */ 34 34 static void putc(int c) 35 35 { 36 + #ifdef AT91_DBGU 36 37 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ 37 38 38 39 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) 39 40 barrier(); 40 41 __raw_writel(c, sys + AT91_DBGU_THR); 42 + #endif 41 43 } 42 44 43 45 static inline void flush(void) 44 46 { 47 + #ifdef AT91_DBGU 45 48 void __iomem *sys = (void __iomem *) AT91_BASE_SYS; /* physical address */ 46 49 47 50 /* wait for transmission to complete */ 48 51 while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) 49 52 barrier(); 53 + #endif 50 54 } 51 55 52 56 #define arch_decomp_setup()
+22
include/asm-arm/arch-davinci/clock.h
··· 1 + /* 2 + * include/asm-arm/arch-davinci/clock.h 3 + * 4 + * Clock control driver for DaVinci - header file 5 + * 6 + * Authors: Vladimir Barinov <source@mvista.com> 7 + * 8 + * 2007 (c) MontaVista Software, Inc. This file is licensed under 9 + * the terms of the GNU General Public License version 2. This program 10 + * is licensed "as is" without any warranty of any kind, whether express 11 + * or implied. 12 + */ 13 + #ifndef __ASM_ARCH_DAVINCI_CLOCK_H 14 + #define __ASM_ARCH_DAVINCI_CLOCK_H 15 + 16 + struct clk; 17 + 18 + extern int clk_register(struct clk *clk); 19 + extern void clk_unregister(struct clk *clk); 20 + extern int davinci_clk_init(void); 21 + 22 + #endif
+156
include/asm-arm/arch-davinci/gpio.h
··· 1 + /* 2 + * TI DaVinci GPIO Support 3 + * 4 + * Copyright (c) 2006 David Brownell 5 + * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + */ 12 + 13 + #ifndef __DAVINCI_GPIO_H 14 + #define __DAVINCI_GPIO_H 15 + 16 + /* 17 + * basic gpio routines 18 + * 19 + * board-specific init should be done by arch/.../.../board-XXX.c (maybe 20 + * initializing banks together) rather than boot loaders; kexec() won't 21 + * go through boot loaders. 22 + * 23 + * the gpio clock will be turned on when gpios are used, and you may also 24 + * need to pay attention to PINMUX0 and PINMUX1 to be sure those pins are 25 + * used as gpios, not with other peripherals. 26 + * 27 + * GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation, and maybe 28 + * for later updates, code should write GPIO(N) or: 29 + * - GPIOV18(N) for 1.8V pins, N in 0..53; same as GPIO(0)..GPIO(53) 30 + * - GPIOV33(N) for 3.3V pins, N in 0..17; same as GPIO(54)..GPIO(70) 31 + * 32 + * For GPIO IRQs use gpio_to_irq(GPIO(N)) or gpio_to_irq(GPIOV33(N)) etc 33 + * for now, that's != GPIO(N) 34 + */ 35 + #define GPIO(X) (X) /* 0 <= X <= 70 */ 36 + #define GPIOV18(X) (X) /* 1.8V i/o; 0 <= X <= 53 */ 37 + #define GPIOV33(X) ((X)+54) /* 3.3V i/o; 0 <= X <= 17 */ 38 + 39 + struct gpio_controller { 40 + u32 dir; 41 + u32 out_data; 42 + u32 set_data; 43 + u32 clr_data; 44 + u32 in_data; 45 + u32 set_rising; 46 + u32 clr_rising; 47 + u32 set_falling; 48 + u32 clr_falling; 49 + u32 intstat; 50 + }; 51 + 52 + /* The __gpio_to_controller() and __gpio_mask() functions inline to constants 53 + * with constant parameters; or in outlined code they execute at runtime. 54 + * 55 + * You'd access the controller directly when reading or writing more than 56 + * one gpio value at a time, and to support wired logic where the value 57 + * being driven by the cpu need not match the value read back. 58 + * 59 + * These are NOT part of the cross-platform GPIO interface 60 + */ 61 + static inline struct gpio_controller *__iomem 62 + __gpio_to_controller(unsigned gpio) 63 + { 64 + void *__iomem ptr; 65 + 66 + if (gpio < 32) 67 + ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10); 68 + else if (gpio < 64) 69 + ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38); 70 + else if (gpio < DAVINCI_N_GPIO) 71 + ptr = (void *__iomem)IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60); 72 + else 73 + ptr = NULL; 74 + return ptr; 75 + } 76 + 77 + static inline u32 __gpio_mask(unsigned gpio) 78 + { 79 + return 1 << (gpio % 32); 80 + } 81 + 82 + /* The get/set/clear functions will inline when called with constant 83 + * parameters, for low-overhead bitbanging. Illegal constant parameters 84 + * cause link-time errors. 85 + * 86 + * Otherwise, calls with variable parameters use outlined functions. 87 + */ 88 + extern int __error_inval_gpio(void); 89 + 90 + extern void __gpio_set(unsigned gpio, int value); 91 + extern int __gpio_get(unsigned gpio); 92 + 93 + static inline void gpio_set_value(unsigned gpio, int value) 94 + { 95 + if (__builtin_constant_p(value)) { 96 + struct gpio_controller *__iomem g; 97 + u32 mask; 98 + 99 + if (gpio >= DAVINCI_N_GPIO) 100 + __error_inval_gpio(); 101 + 102 + g = __gpio_to_controller(gpio); 103 + mask = __gpio_mask(gpio); 104 + if (value) 105 + __raw_writel(mask, &g->set_data); 106 + else 107 + __raw_writel(mask, &g->clr_data); 108 + return; 109 + } 110 + 111 + __gpio_set(gpio, value); 112 + } 113 + 114 + /* Returns zero or nonzero; works for gpios configured as inputs OR 115 + * as outputs. 116 + * 117 + * NOTE: changes in reported values are synchronized to the GPIO clock. 118 + * This is most easily seen after calling gpio_set_value() and then immediatly 119 + * gpio_get_value(), where the gpio_get_value() would return the old value 120 + * until the GPIO clock ticks and the new value gets latched. 121 + */ 122 + 123 + static inline int gpio_get_value(unsigned gpio) 124 + { 125 + struct gpio_controller *__iomem g; 126 + 127 + if (!__builtin_constant_p(gpio)) 128 + return __gpio_get(gpio); 129 + 130 + if (gpio >= DAVINCI_N_GPIO) 131 + return __error_inval_gpio(); 132 + 133 + g = __gpio_to_controller(gpio); 134 + return !!(__gpio_mask(gpio) & __raw_readl(&g->in_data)); 135 + } 136 + 137 + /* powerup default direction is IN */ 138 + extern int gpio_direction_input(unsigned gpio); 139 + extern int gpio_direction_output(unsigned gpio, int value); 140 + 141 + #include <asm-generic/gpio.h> /* cansleep wrappers */ 142 + 143 + extern int gpio_request(unsigned gpio, const char *tag); 144 + extern void gpio_free(unsigned gpio); 145 + 146 + static inline int gpio_to_irq(unsigned gpio) 147 + { 148 + return DAVINCI_N_AINTC_IRQ + gpio; 149 + } 150 + 151 + static inline int irq_to_gpio(unsigned irq) 152 + { 153 + return irq - DAVINCI_N_AINTC_IRQ; 154 + } 155 + 156 + #endif /* __DAVINCI_GPIO_H */
+38
include/asm-arm/arch-davinci/hardware.h
··· 11 11 #ifndef __ASM_ARCH_HARDWARE_H 12 12 #define __ASM_ARCH_HARDWARE_H 13 13 14 + /* 15 + * Base register addresses 16 + */ 17 + #define DAVINCI_DMA_3PCC_BASE (0x01C00000) 18 + #define DAVINCI_DMA_3PTC0_BASE (0x01C10000) 19 + #define DAVINCI_DMA_3PTC1_BASE (0x01C10400) 20 + #define DAVINCI_I2C_BASE (0x01C21000) 21 + #define DAVINCI_PWM0_BASE (0x01C22000) 22 + #define DAVINCI_PWM1_BASE (0x01C22400) 23 + #define DAVINCI_PWM2_BASE (0x01C22800) 24 + #define DAVINCI_SYSTEM_MODULE_BASE (0x01C40000) 25 + #define DAVINCI_PLL_CNTRL0_BASE (0x01C40800) 26 + #define DAVINCI_PLL_CNTRL1_BASE (0x01C40C00) 27 + #define DAVINCI_PWR_SLEEP_CNTRL_BASE (0x01C41000) 28 + #define DAVINCI_SYSTEM_DFT_BASE (0x01C42000) 29 + #define DAVINCI_IEEE1394_BASE (0x01C60000) 30 + #define DAVINCI_USB_OTG_BASE (0x01C64000) 31 + #define DAVINCI_CFC_ATA_BASE (0x01C66000) 32 + #define DAVINCI_SPI_BASE (0x01C66800) 33 + #define DAVINCI_GPIO_BASE (0x01C67000) 34 + #define DAVINCI_UHPI_BASE (0x01C67800) 35 + #define DAVINCI_VPSS_REGS_BASE (0x01C70000) 36 + #define DAVINCI_EMAC_CNTRL_REGS_BASE (0x01C80000) 37 + #define DAVINCI_EMAC_WRAPPER_CNTRL_REGS_BASE (0x01C81000) 38 + #define DAVINCI_EMAC_WRAPPER_RAM_BASE (0x01C82000) 39 + #define DAVINCI_MDIO_CNTRL_REGS_BASE (0x01C84000) 40 + #define DAVINCI_IMCOP_BASE (0x01CC0000) 41 + #define DAVINCI_ASYNC_EMIF_CNTRL_BASE (0x01E00000) 42 + #define DAVINCI_VLYNQ_BASE (0x01E01000) 43 + #define DAVINCI_MCBSP_BASE (0x01E02000) 44 + #define DAVINCI_MMC_SD_BASE (0x01E10000) 45 + #define DAVINCI_MS_BASE (0x01E20000) 46 + #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE (0x02000000) 47 + #define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE (0x04000000) 48 + #define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE (0x06000000) 49 + #define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x08000000) 50 + #define DAVINCI_VLYNQ_REMOTE_BASE (0x0C000000) 51 + 14 52 #endif /* __ASM_ARCH_HARDWARE_H */
+55
include/asm-arm/arch-davinci/mux.h
··· 1 + /* 2 + * DaVinci pin multiplexing defines 3 + * 4 + * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com> 5 + * 6 + * 2007 (c) MontaVista Software, Inc. This file is licensed under 7 + * the terms of the GNU General Public License version 2. This program 8 + * is licensed "as is" without any warranty of any kind, whether express 9 + * or implied. 10 + */ 11 + #ifndef __ASM_ARCH_MUX_H 12 + #define __ASM_ARCH_MUX_H 13 + 14 + #define DAVINCI_MUX_AEAW0 0 15 + #define DAVINCI_MUX_AEAW1 1 16 + #define DAVINCI_MUX_AEAW2 2 17 + #define DAVINCI_MUX_AEAW3 3 18 + #define DAVINCI_MUX_AEAW4 4 19 + #define DAVINCI_MUX_AECS4 10 20 + #define DAVINCI_MUX_AECS5 11 21 + #define DAVINCI_MUX_VLYNQWD0 12 22 + #define DAVINCI_MUX_VLYNQWD1 13 23 + #define DAVINCI_MUX_VLSCREN 14 24 + #define DAVINCI_MUX_VLYNQEN 15 25 + #define DAVINCI_MUX_HDIREN 16 26 + #define DAVINCI_MUX_ATAEN 17 27 + #define DAVINCI_MUX_RGB666 22 28 + #define DAVINCI_MUX_RGB888 23 29 + #define DAVINCI_MUX_LOEEN 24 30 + #define DAVINCI_MUX_LFLDEN 25 31 + #define DAVINCI_MUX_CWEN 26 32 + #define DAVINCI_MUX_CFLDEN 27 33 + #define DAVINCI_MUX_HPIEN 29 34 + #define DAVINCI_MUX_1394EN 30 35 + #define DAVINCI_MUX_EMACEN 31 36 + 37 + #define DAVINCI_MUX_LEVEL2 32 38 + #define DAVINCI_MUX_UART0 (DAVINCI_MUX_LEVEL2 + 0) 39 + #define DAVINCI_MUX_UART1 (DAVINCI_MUX_LEVEL2 + 1) 40 + #define DAVINCI_MUX_UART2 (DAVINCI_MUX_LEVEL2 + 2) 41 + #define DAVINCI_MUX_U2FLO (DAVINCI_MUX_LEVEL2 + 3) 42 + #define DAVINCI_MUX_PWM0 (DAVINCI_MUX_LEVEL2 + 4) 43 + #define DAVINCI_MUX_PWM1 (DAVINCI_MUX_LEVEL2 + 5) 44 + #define DAVINCI_MUX_PWM2 (DAVINCI_MUX_LEVEL2 + 6) 45 + #define DAVINCI_MUX_I2C (DAVINCI_MUX_LEVEL2 + 7) 46 + #define DAVINCI_MUX_SPI (DAVINCI_MUX_LEVEL2 + 8) 47 + #define DAVINCI_MUX_MSTK (DAVINCI_MUX_LEVEL2 + 9) 48 + #define DAVINCI_MUX_ASP (DAVINCI_MUX_LEVEL2 + 10) 49 + #define DAVINCI_MUX_CLK0 (DAVINCI_MUX_LEVEL2 + 16) 50 + #define DAVINCI_MUX_CLK1 (DAVINCI_MUX_LEVEL2 + 17) 51 + #define DAVINCI_MUX_TIMIN (DAVINCI_MUX_LEVEL2 + 18) 52 + 53 + extern void davinci_mux_peripheral(unsigned int mux, unsigned int enable); 54 + 55 + #endif /* __ASM_ARCH_MUX_H */
+102
include/asm-arm/arch-imx/gpio.h
··· 1 + #ifndef _IMX_GPIO_H 2 + 3 + #include <asm/arch/imx-regs.h> 4 + 5 + #define IMX_GPIO_ALLOC_MODE_NORMAL 0 6 + #define IMX_GPIO_ALLOC_MODE_NO_ALLOC 1 7 + #define IMX_GPIO_ALLOC_MODE_TRY_ALLOC 2 8 + #define IMX_GPIO_ALLOC_MODE_ALLOC_ONLY 4 9 + #define IMX_GPIO_ALLOC_MODE_RELEASE 8 10 + 11 + extern int imx_gpio_request(unsigned gpio, const char *label); 12 + 13 + extern void imx_gpio_free(unsigned gpio); 14 + 15 + extern int imx_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 16 + int alloc_mode, const char *label); 17 + 18 + extern int imx_gpio_direction_input(unsigned gpio); 19 + 20 + extern int imx_gpio_direction_output(unsigned gpio, int value); 21 + 22 + extern void __imx_gpio_set_value(unsigned gpio, int value); 23 + 24 + static inline int imx_gpio_get_value(unsigned gpio) 25 + { 26 + return SSR(gpio >> GPIO_PORT_SHIFT) & (1 << (gpio & GPIO_PIN_MASK)); 27 + } 28 + 29 + static inline void imx_gpio_set_value_inline(unsigned gpio, int value) 30 + { 31 + unsigned long flags; 32 + 33 + raw_local_irq_save(flags); 34 + if(value) 35 + DR(gpio >> GPIO_PORT_SHIFT) |= (1 << (gpio & GPIO_PIN_MASK)); 36 + else 37 + DR(gpio >> GPIO_PORT_SHIFT) &= ~(1 << (gpio & GPIO_PIN_MASK)); 38 + raw_local_irq_restore(flags); 39 + } 40 + 41 + static inline void imx_gpio_set_value(unsigned gpio, int value) 42 + { 43 + if(__builtin_constant_p(gpio)) 44 + imx_gpio_set_value_inline(gpio, value); 45 + else 46 + __imx_gpio_set_value(gpio, value); 47 + } 48 + 49 + extern int imx_gpio_to_irq(unsigned gpio); 50 + 51 + extern int imx_irq_to_gpio(unsigned irq); 52 + 53 + /*-------------------------------------------------------------------------*/ 54 + 55 + /* Wrappers for "new style" GPIO calls. These calls i.MX specific versions 56 + * to allow future extension of GPIO logic. 57 + */ 58 + 59 + static inline int gpio_request(unsigned gpio, const char *label) 60 + { 61 + return imx_gpio_request(gpio, label); 62 + } 63 + 64 + static inline void gpio_free(unsigned gpio) 65 + { 66 + imx_gpio_free(gpio); 67 + } 68 + 69 + static inline int gpio_direction_input(unsigned gpio) 70 + { 71 + return imx_gpio_direction_input(gpio); 72 + } 73 + 74 + static inline int gpio_direction_output(unsigned gpio, int value) 75 + { 76 + return imx_gpio_direction_output(gpio, value); 77 + } 78 + 79 + static inline int gpio_get_value(unsigned gpio) 80 + { 81 + return imx_gpio_get_value(gpio); 82 + } 83 + 84 + static inline void gpio_set_value(unsigned gpio, int value) 85 + { 86 + imx_gpio_set_value(gpio, value); 87 + } 88 + 89 + #include <asm-generic/gpio.h> /* cansleep wrappers */ 90 + 91 + static inline int gpio_to_irq(unsigned gpio) 92 + { 93 + return imx_gpio_to_irq(gpio); 94 + } 95 + 96 + static inline int irq_to_gpio(unsigned irq) 97 + { 98 + return imx_irq_to_gpio(irq); 99 + } 100 + 101 + 102 + #endif
+2
include/asm-arm/arch-imx/imx-regs.h
··· 77 77 #define SWR(x) __REG2(IMX_GPIO_BASE + 0x3c, ((x) & 3) << 8) 78 78 #define PUEN(x) __REG2(IMX_GPIO_BASE + 0x40, ((x) & 3) << 8) 79 79 80 + #define GPIO_PORT_MAX 3 81 + 80 82 #define GPIO_PIN_MASK 0x1f 81 83 #define GPIO_PORT_MASK (0x3 << 5) 82 84
+4
include/asm-arm/arch-ixp4xx/ixdp425.h
··· 32 32 #define IXDP425_PCI_INTC_PIN 9 33 33 #define IXDP425_PCI_INTD_PIN 8 34 34 35 + /* NAND Flash pins */ 36 + #define IXDP425_NAND_NCE_PIN 12 35 37 38 + #define IXDP425_NAND_CMD_BYTE 0x01 39 + #define IXDP425_NAND_ADDR_BYTE 0x02
+3 -2
include/asm-arm/arch-ixp4xx/uncompress.h
··· 38 38 static __inline__ void __arch_decomp_setup(unsigned long arch_id) 39 39 { 40 40 /* 41 - * Coyote and gtwx5715 only have UART2 connected 41 + * Some boards are using UART2 as console 42 42 */ 43 - if (machine_is_adi_coyote() || machine_is_gtwx5715()) 43 + if (machine_is_adi_coyote() || machine_is_gtwx5715() || 44 + machine_is_gateway7001() || machine_is_wg302v2()) 44 45 uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS; 45 46 else 46 47 uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS;
+79
include/asm-arm/arch-ks8695/gpio.h
··· 1 + /* 2 + * include/asm-arm/arch-ks8695/gpio.h 3 + * 4 + * Copyright (C) 2006 Andrew Victor 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 + 11 + #ifndef __ASM_ARCH_GPIO_H_ 12 + #define __ASM_ARCH_GPIO_H_ 13 + 14 + #define KS8695_GPIO_0 0 15 + #define KS8695_GPIO_1 1 16 + #define KS8695_GPIO_2 2 17 + #define KS8695_GPIO_3 3 18 + #define KS8695_GPIO_4 4 19 + #define KS8695_GPIO_5 5 20 + #define KS8695_GPIO_6 6 21 + #define KS8695_GPIO_7 7 22 + #define KS8695_GPIO_8 8 23 + #define KS8695_GPIO_9 9 24 + #define KS8695_GPIO_10 10 25 + #define KS8695_GPIO_11 11 26 + #define KS8695_GPIO_12 12 27 + #define KS8695_GPIO_13 13 28 + #define KS8695_GPIO_14 14 29 + #define KS8695_GPIO_15 15 30 + 31 + 32 + /* 33 + * Configure GPIO pin as external interrupt source. 34 + */ 35 + int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type); 36 + 37 + /* 38 + * Configure the GPIO line as an input. 39 + */ 40 + int __init_or_module gpio_direction_input(unsigned int pin); 41 + 42 + /* 43 + * Configure the GPIO line as an output, with default state. 44 + */ 45 + int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state); 46 + 47 + /* 48 + * Set the state of an output GPIO line. 49 + */ 50 + void gpio_set_value(unsigned int pin, unsigned int state); 51 + 52 + /* 53 + * Read the state of a GPIO line. 54 + */ 55 + int gpio_get_value(unsigned int pin); 56 + 57 + /* 58 + * Map GPIO line to IRQ number. 59 + */ 60 + int gpio_to_irq(unsigned int pin); 61 + 62 + /* 63 + * Map IRQ number to GPIO line. 64 + */ 65 + int irq_to_gpio(unsigned int irq); 66 + 67 + 68 + #include <asm-generic/gpio.h> 69 + 70 + static inline int gpio_request(unsigned int pin, const char *label) 71 + { 72 + return 0; 73 + } 74 + 75 + static inline void gpio_free(unsigned int pin) 76 + { 77 + } 78 + 79 + #endif
+2 -20
include/asm-arm/arch-pxa/dma.h
··· 30 30 DMA_PRIO_LOW = 2 31 31 } pxa_dma_prio; 32 32 33 - #if defined(CONFIG_PXA27x) 34 - 35 - #define PXA_DMA_CHANNELS 32 36 - 37 - #define pxa_for_each_dma_prio(ch, prio) \ 38 - for ( \ 39 - ch = prio * 4; \ 40 - ch != (4 << prio) + 16; \ 41 - ch = (ch + 1 == (4 << prio)) ? (prio * 4 + 16) : (ch + 1) \ 42 - ) 43 - 44 - #elif defined(CONFIG_PXA25x) 45 - 46 - #define PXA_DMA_CHANNELS 16 47 - 48 - #define pxa_for_each_dma_prio(ch, prio) \ 49 - for (ch = prio * 4; ch != (4 << prio); ch++) 50 - 51 - #endif 52 - 53 33 /* 54 34 * DMA registration 55 35 */ 36 + 37 + int __init pxa_init_dma(int num_ch); 56 38 57 39 int pxa_request_dma (char *name, 58 40 pxa_dma_prio prio,
+24 -6
include/asm-arm/arch-pxa/entry-macro.S
··· 20 20 .endm 21 21 22 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 23 - #ifdef CONFIG_PXA27x 24 - mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP 25 - mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR 26 - #else 23 + mrc p15, 0, \tmp, c0, c0, 0 @ CPUID 24 + mov \tmp, \tmp, lsr #13 25 + and \tmp, \tmp, #0x7 @ Core G 26 + cmp \tmp, #1 27 + bhi 1004f 28 + 27 29 mov \base, #io_p2v(0x40000000) @ IIR Ctl = 0x40d00000 28 30 add \base, \base, #0x00d00000 29 31 ldr \irqstat, [\base, #0] @ ICIP 30 32 ldr \irqnr, [\base, #4] @ ICMR 31 - #endif 33 + b 1002f 34 + 35 + 1004: 36 + mrc p6, 0, \irqstat, c6, c0, 0 @ ICIP2 37 + mrc p6, 0, \irqnr, c7, c0, 0 @ ICMR2 38 + ands \irqstat, \irqstat, \irqnr 39 + beq 1003f 40 + rsb \irqstat, \irqnr, #0 41 + and \irqstat, \irqstat, \irqnr 42 + clz \irqnr, \irqstat 43 + rsb \irqnr, \irqnr, #31 44 + add \irqnr, \irqnr, #32 45 + b 1001f 46 + 1003: 47 + mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP 48 + mrc p6, 0, \irqnr, c1, c0, 0 @ ICMR 49 + 1002: 32 50 ands \irqnr, \irqstat, \irqnr 33 51 beq 1001f 34 52 rsb \irqstat, \irqnr, #0 35 53 and \irqstat, \irqstat, \irqnr 36 54 clz \irqnr, \irqstat 37 - rsb \irqnr, \irqnr, #(31 - PXA_IRQ_SKIP) 55 + rsb \irqnr, \irqnr, #31 38 56 1001: 39 57 .endm
+36
include/asm-arm/arch-pxa/hardware.h
··· 62 62 63 63 #ifndef __ASSEMBLY__ 64 64 65 + #define __cpu_is_pxa21x(id) \ 66 + ({ \ 67 + unsigned int _id = (id) >> 4 & 0xf3f; \ 68 + _id == 0x212; \ 69 + }) 70 + 71 + #define __cpu_is_pxa25x(id) \ 72 + ({ \ 73 + unsigned int _id = (id) >> 4 & 0xfff; \ 74 + _id == 0x2d0 || _id == 0x290; \ 75 + }) 76 + 77 + #define __cpu_is_pxa27x(id) \ 78 + ({ \ 79 + unsigned int _id = (id) >> 4 & 0xfff; \ 80 + _id == 0x411; \ 81 + }) 82 + 83 + #define cpu_is_pxa21x() \ 84 + ({ \ 85 + unsigned int id = read_cpuid(CPUID_ID); \ 86 + __cpu_is_pxa21x(id); \ 87 + }) 88 + 89 + #define cpu_is_pxa25x() \ 90 + ({ \ 91 + unsigned int id = read_cpuid(CPUID_ID); \ 92 + __cpu_is_pxa25x(id); \ 93 + }) 94 + 95 + #define cpu_is_pxa27x() \ 96 + ({ \ 97 + unsigned int id = read_cpuid(CPUID_ID); \ 98 + __cpu_is_pxa27x(id); \ 99 + }) 100 + 65 101 /* 66 102 * Handy routine to set GPIO alternate functions 67 103 */
+10 -16
include/asm-arm/arch-pxa/irqs.h
··· 11 11 */ 12 12 13 13 14 + #define PXA_IRQ(x) (x) 15 + 14 16 #ifdef CONFIG_PXA27x 15 - #define PXA_IRQ_SKIP 0 16 - #else 17 - #define PXA_IRQ_SKIP 7 18 - #endif 19 - 20 - #define PXA_IRQ(x) ((x) - PXA_IRQ_SKIP) 21 - 22 17 #define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ 23 18 #define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ 24 19 #define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ ··· 21 26 #define IRQ_KEYPAD PXA_IRQ(4) /* Key pad controller */ 22 27 #define IRQ_MEMSTK PXA_IRQ(5) /* Memory Stick interrupt */ 23 28 #define IRQ_PWRI2C PXA_IRQ(6) /* Power I2C interrupt */ 29 + #endif 30 + 24 31 #define IRQ_HWUART PXA_IRQ(7) /* HWUART Transmit/Receive/Error (PXA26x) */ 25 32 #define IRQ_OST_4_11 PXA_IRQ(7) /* OS timer 4-11 matches (PXA27x) */ 26 33 #define IRQ_GPIO0 PXA_IRQ(8) /* GPIO0 Edge Detect */ ··· 55 58 #ifdef CONFIG_PXA27x 56 59 #define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ 57 60 #define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ 58 - 59 - #define PXA_INTERNAL_IRQS 34 60 - #else 61 - #define PXA_INTERNAL_IRQS 32 62 61 #endif 63 62 64 - #define GPIO_2_x_TO_IRQ(x) \ 65 - PXA_IRQ((x) - 2 + PXA_INTERNAL_IRQS) 63 + #define PXA_GPIO_IRQ_BASE (64) 64 + #define PXA_GPIO_IRQ_NUM (128) 65 + 66 + #define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x)) 66 67 #define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x)) 67 68 68 - #define IRQ_TO_GPIO_2_x(i) \ 69 - ((i) - IRQ_GPIO(2) + 2) 69 + #define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE) 70 70 #define IRQ_TO_GPIO(i) (((i) < IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) : IRQ_TO_GPIO_2_x(i)) 71 71 72 72 #if defined(CONFIG_PXA25x) ··· 78 84 * these. If you need more, increase IRQ_BOARD_END, but keep it 79 85 * within sensible limits. 80 86 */ 81 - #define IRQ_BOARD_START (IRQ_GPIO(PXA_LAST_GPIO) + 1) 87 + #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_GPIO_IRQ_NUM) 82 88 #define IRQ_BOARD_END (IRQ_BOARD_START + 16) 83 89 84 90 #define IRQ_SA1111_START (IRQ_BOARD_END)
-1
include/asm-arm/arch-pxa/pm.h
··· 9 9 10 10 extern int pxa_pm_prepare(suspend_state_t state); 11 11 extern int pxa_pm_enter(suspend_state_t state); 12 - extern int pxa_pm_finish(suspend_state_t state);
+1 -21
include/asm-arm/arch-pxa/pxa-regs.h
··· 1765 1765 #define SSACD_P(x) (*(((x) == 1) ? &SSACD_P1 : ((x) == 2) ? &SSACD_P2 : ((x) == 3) ? &SSACD_P3 : NULL)) 1766 1766 1767 1767 /* 1768 - * MultiMediaCard (MMC) controller 1768 + * MultiMediaCard (MMC) controller - see drivers/mmc/host/pxamci.h 1769 1769 */ 1770 - 1771 - #define MMC_STRPCL __REG(0x41100000) /* Control to start and stop MMC clock */ 1772 - #define MMC_STAT __REG(0x41100004) /* MMC Status Register (read only) */ 1773 - #define MMC_CLKRT __REG(0x41100008) /* MMC clock rate */ 1774 - #define MMC_SPI __REG(0x4110000c) /* SPI mode control bits */ 1775 - #define MMC_CMDAT __REG(0x41100010) /* Command/response/data sequence control */ 1776 - #define MMC_RESTO __REG(0x41100014) /* Expected response time out */ 1777 - #define MMC_RDTO __REG(0x41100018) /* Expected data read time out */ 1778 - #define MMC_BLKLEN __REG(0x4110001c) /* Block length of data transaction */ 1779 - #define MMC_NOB __REG(0x41100020) /* Number of blocks, for block mode */ 1780 - #define MMC_PRTBUF __REG(0x41100024) /* Partial MMC_TXFIFO FIFO written */ 1781 - #define MMC_I_MASK __REG(0x41100028) /* Interrupt Mask */ 1782 - #define MMC_I_REG __REG(0x4110002c) /* Interrupt Register (read only) */ 1783 - #define MMC_CMD __REG(0x41100030) /* Index of current command */ 1784 - #define MMC_ARGH __REG(0x41100034) /* MSW part of the current command argument */ 1785 - #define MMC_ARGL __REG(0x41100038) /* LSW part of the current command argument */ 1786 - #define MMC_RES __REG(0x4110003c) /* Response FIFO (read only) */ 1787 - #define MMC_RXFIFO __REG(0x41100040) /* Receive FIFO (read only) */ 1788 - #define MMC_TXFIFO __REG(0x41100044) /* Transmit FIFO (write only) */ 1789 - 1790 1770 1791 1771 /* 1792 1772 * Core Clock
+1 -22
include/asm-arm/elf.h
··· 7 7 */ 8 8 #include <asm/ptrace.h> 9 9 #include <asm/user.h> 10 + #include <asm/hwcap.h> 10 11 11 12 typedef unsigned long elf_greg_t; 12 13 typedef unsigned long elf_freg_t[3]; ··· 40 39 #endif 41 40 #define ELF_ARCH EM_ARM 42 41 43 - /* 44 - * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP 45 - */ 46 - #define HWCAP_SWP 1 47 - #define HWCAP_HALF 2 48 - #define HWCAP_THUMB 4 49 - #define HWCAP_26BIT 8 /* Play it safe */ 50 - #define HWCAP_FAST_MULT 16 51 - #define HWCAP_FPA 32 52 - #define HWCAP_VFP 64 53 - #define HWCAP_EDSP 128 54 - #define HWCAP_JAVA 256 55 - #define HWCAP_IWMMXT 512 56 - #define HWCAP_CRUNCH 1024 57 - 58 42 #ifdef __KERNEL__ 59 43 #ifndef __ASSEMBLY__ 60 - /* 61 - * This yields a mask that user programs can use to figure out what 62 - * instruction set this cpu supports. 63 - */ 64 - #define ELF_HWCAP (elf_hwcap) 65 - extern unsigned int elf_hwcap; 66 - 67 44 /* 68 45 * This yields a string that ld.so will use to load implementation 69 46 * specific libraries for optimization. This is more specific in
+28
include/asm-arm/hwcap.h
··· 1 + #ifndef __ASMARM_HWCAP_H 2 + #define __ASMARM_HWCAP_H 3 + 4 + /* 5 + * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP 6 + */ 7 + #define HWCAP_SWP 1 8 + #define HWCAP_HALF 2 9 + #define HWCAP_THUMB 4 10 + #define HWCAP_26BIT 8 /* Play it safe */ 11 + #define HWCAP_FAST_MULT 16 12 + #define HWCAP_FPA 32 13 + #define HWCAP_VFP 64 14 + #define HWCAP_EDSP 128 15 + #define HWCAP_JAVA 256 16 + #define HWCAP_IWMMXT 512 17 + #define HWCAP_CRUNCH 1024 18 + 19 + #if defined(__KERNEL__) && !defined(__ASSEMBLY__) 20 + /* 21 + * This yields a mask that user programs can use to figure out what 22 + * instruction set this cpu supports. 23 + */ 24 + #define ELF_HWCAP (elf_hwcap) 25 + extern unsigned int elf_hwcap; 26 + #endif 27 + 28 + #endif
+13 -3
include/asm-arm/ptrace.h
··· 10 10 #ifndef __ASM_ARM_PTRACE_H 11 11 #define __ASM_ARM_PTRACE_H 12 12 13 + #include <asm/hwcap.h> 14 + 13 15 #define PTRACE_GETREGS 12 14 16 #define PTRACE_SETREGS 13 15 17 #define PTRACE_GETFPREGS 14 ··· 47 45 #define PSR_T_BIT 0x00000020 48 46 #define PSR_F_BIT 0x00000040 49 47 #define PSR_I_BIT 0x00000080 48 + #define PSR_A_BIT 0x00000100 50 49 #define PSR_J_BIT 0x01000000 51 50 #define PSR_Q_BIT 0x08000000 52 51 #define PSR_V_BIT 0x10000000 ··· 106 103 #define thumb_mode(regs) (0) 107 104 #endif 108 105 106 + #define isa_mode(regs) \ 107 + ((((regs)->ARM_cpsr & PSR_J_BIT) >> 23) | \ 108 + (((regs)->ARM_cpsr & PSR_T_BIT) >> 5)) 109 + 109 110 #define processor_mode(regs) \ 110 111 ((regs)->ARM_cpsr & MODE_MASK) 111 112 ··· 124 117 */ 125 118 static inline int valid_user_regs(struct pt_regs *regs) 126 119 { 127 - if (user_mode(regs) && 128 - (regs->ARM_cpsr & (PSR_F_BIT|PSR_I_BIT)) == 0) 120 + if (user_mode(regs) && (regs->ARM_cpsr & PSR_I_BIT) == 0) { 121 + regs->ARM_cpsr &= ~(PSR_F_BIT | PSR_A_BIT); 129 122 return 1; 123 + } 130 124 131 125 /* 132 126 * Force CPSR to something logical... 133 127 */ 134 - regs->ARM_cpsr &= PSR_f | PSR_s | PSR_x | PSR_T_BIT | MODE32_BIT; 128 + regs->ARM_cpsr &= PSR_f | PSR_s | (PSR_x & ~PSR_A_BIT) | PSR_T_BIT | MODE32_BIT; 129 + if (!(elf_hwcap & HWCAP_26BIT)) 130 + regs->ARM_cpsr |= USR_MODE; 135 131 136 132 return 0; 137 133 }