diff options
Diffstat (limited to 'arch/arm')
313 files changed, 2686 insertions, 5291 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5098564d5879..93180845ae16 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -9,6 +9,7 @@ config ARM | |||
9 | select SYS_SUPPORTS_APM_EMULATION | 9 | select SYS_SUPPORTS_APM_EMULATION |
10 | select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) | 10 | select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) |
11 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) | 11 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) |
12 | select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL | ||
12 | select HAVE_ARCH_KGDB | 13 | select HAVE_ARCH_KGDB |
13 | select HAVE_KPROBES if !XIP_KERNEL | 14 | select HAVE_KPROBES if !XIP_KERNEL |
14 | select HAVE_KRETPROBES if (HAVE_KPROBES) | 15 | select HAVE_KRETPROBES if (HAVE_KPROBES) |
@@ -21,6 +22,7 @@ config ARM | |||
21 | select HAVE_KERNEL_GZIP | 22 | select HAVE_KERNEL_GZIP |
22 | select HAVE_KERNEL_LZO | 23 | select HAVE_KERNEL_LZO |
23 | select HAVE_KERNEL_LZMA | 24 | select HAVE_KERNEL_LZMA |
25 | select HAVE_KERNEL_XZ | ||
24 | select HAVE_IRQ_WORK | 26 | select HAVE_IRQ_WORK |
25 | select HAVE_PERF_EVENTS | 27 | select HAVE_PERF_EVENTS |
26 | select PERF_USE_VMALLOC | 28 | select PERF_USE_VMALLOC |
@@ -28,10 +30,10 @@ config ARM | |||
28 | select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)) | 30 | select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)) |
29 | select HAVE_C_RECORDMCOUNT | 31 | select HAVE_C_RECORDMCOUNT |
30 | select HAVE_GENERIC_HARDIRQS | 32 | select HAVE_GENERIC_HARDIRQS |
31 | select HAVE_SPARSE_IRQ | ||
32 | select GENERIC_IRQ_SHOW | 33 | select GENERIC_IRQ_SHOW |
33 | select CPU_PM if (SUSPEND || CPU_IDLE) | 34 | select CPU_PM if (SUSPEND || CPU_IDLE) |
34 | select GENERIC_PCI_IOMAP | 35 | select GENERIC_PCI_IOMAP |
36 | select HAVE_BPF_JIT if NET | ||
35 | help | 37 | help |
36 | The ARM series is a line of low-power-consumption RISC chip designs | 38 | The ARM series is a line of low-power-consumption RISC chip designs |
37 | licensed by ARM Ltd and targeted at embedded applications and | 39 | licensed by ARM Ltd and targeted at embedded applications and |
@@ -52,9 +54,6 @@ config MIGHT_HAVE_PCI | |||
52 | config SYS_SUPPORTS_APM_EMULATION | 54 | config SYS_SUPPORTS_APM_EMULATION |
53 | bool | 55 | bool |
54 | 56 | ||
55 | config HAVE_SCHED_CLOCK | ||
56 | bool | ||
57 | |||
58 | config GENERIC_GPIO | 57 | config GENERIC_GPIO |
59 | bool | 58 | bool |
60 | 59 | ||
@@ -180,6 +179,9 @@ config ZONE_DMA | |||
180 | config NEED_DMA_MAP_STATE | 179 | config NEED_DMA_MAP_STATE |
181 | def_bool y | 180 | def_bool y |
182 | 181 | ||
182 | config ARCH_HAS_DMA_SET_COHERENT_MASK | ||
183 | bool | ||
184 | |||
183 | config GENERIC_ISA_DMA | 185 | config GENERIC_ISA_DMA |
184 | bool | 186 | bool |
185 | 187 | ||
@@ -217,6 +219,13 @@ config ARM_PATCH_PHYS_VIRT | |||
217 | this feature (eg, building a kernel for a single machine) and | 219 | this feature (eg, building a kernel for a single machine) and |
218 | you need to shrink the kernel to the minimal size. | 220 | you need to shrink the kernel to the minimal size. |
219 | 221 | ||
222 | config NEED_MACH_IO_H | ||
223 | bool | ||
224 | help | ||
225 | Select this when mach/io.h is required to provide special | ||
226 | definitions for this platform. The need for mach/io.h should | ||
227 | be avoided when possible. | ||
228 | |||
220 | config NEED_MACH_MEMORY_H | 229 | config NEED_MACH_MEMORY_H |
221 | bool | 230 | bool |
222 | help | 231 | help |
@@ -268,7 +277,9 @@ config ARCH_INTEGRATOR | |||
268 | select GENERIC_CLOCKEVENTS | 277 | select GENERIC_CLOCKEVENTS |
269 | select PLAT_VERSATILE | 278 | select PLAT_VERSATILE |
270 | select PLAT_VERSATILE_FPGA_IRQ | 279 | select PLAT_VERSATILE_FPGA_IRQ |
280 | select NEED_MACH_IO_H | ||
271 | select NEED_MACH_MEMORY_H | 281 | select NEED_MACH_MEMORY_H |
282 | select SPARSE_IRQ | ||
272 | help | 283 | help |
273 | Support for ARM's Integrator platform. | 284 | Support for ARM's Integrator platform. |
274 | 285 | ||
@@ -315,6 +326,7 @@ config ARCH_VEXPRESS | |||
315 | select HAVE_CLK | 326 | select HAVE_CLK |
316 | select HAVE_PATA_PLATFORM | 327 | select HAVE_PATA_PLATFORM |
317 | select ICST | 328 | select ICST |
329 | select NO_IOPORT | ||
318 | select PLAT_VERSATILE | 330 | select PLAT_VERSATILE |
319 | select PLAT_VERSATILE_CLCD | 331 | select PLAT_VERSATILE_CLCD |
320 | help | 332 | help |
@@ -354,6 +366,7 @@ config ARCH_HIGHBANK | |||
354 | select GENERIC_CLOCKEVENTS | 366 | select GENERIC_CLOCKEVENTS |
355 | select HAVE_ARM_SCU | 367 | select HAVE_ARM_SCU |
356 | select HAVE_SMP | 368 | select HAVE_SMP |
369 | select SPARSE_IRQ | ||
357 | select USE_OF | 370 | select USE_OF |
358 | help | 371 | help |
359 | Support for the Calxeda Highbank SoC based boards. | 372 | Support for the Calxeda Highbank SoC based boards. |
@@ -404,6 +417,7 @@ config ARCH_EBSA110 | |||
404 | select ISA | 417 | select ISA |
405 | select NO_IOPORT | 418 | select NO_IOPORT |
406 | select ARCH_USES_GETTIMEOFFSET | 419 | select ARCH_USES_GETTIMEOFFSET |
420 | select NEED_MACH_IO_H | ||
407 | select NEED_MACH_MEMORY_H | 421 | select NEED_MACH_MEMORY_H |
408 | help | 422 | help |
409 | This is an evaluation board for the StrongARM processor available | 423 | This is an evaluation board for the StrongARM processor available |
@@ -430,6 +444,7 @@ config ARCH_FOOTBRIDGE | |||
430 | select FOOTBRIDGE | 444 | select FOOTBRIDGE |
431 | select GENERIC_CLOCKEVENTS | 445 | select GENERIC_CLOCKEVENTS |
432 | select HAVE_IDE | 446 | select HAVE_IDE |
447 | select NEED_MACH_IO_H | ||
433 | select NEED_MACH_MEMORY_H | 448 | select NEED_MACH_MEMORY_H |
434 | help | 449 | help |
435 | Support for systems based on the DC21285 companion chip | 450 | Support for systems based on the DC21285 companion chip |
@@ -442,7 +457,6 @@ config ARCH_MXC | |||
442 | select CLKDEV_LOOKUP | 457 | select CLKDEV_LOOKUP |
443 | select CLKSRC_MMIO | 458 | select CLKSRC_MMIO |
444 | select GENERIC_IRQ_CHIP | 459 | select GENERIC_IRQ_CHIP |
445 | select HAVE_SCHED_CLOCK | ||
446 | select MULTI_IRQ_HANDLER | 460 | select MULTI_IRQ_HANDLER |
447 | help | 461 | help |
448 | Support for Freescale MXC/iMX-based family of processors | 462 | Support for Freescale MXC/iMX-based family of processors |
@@ -482,6 +496,7 @@ config ARCH_IOP13XX | |||
482 | select PCI | 496 | select PCI |
483 | select ARCH_SUPPORTS_MSI | 497 | select ARCH_SUPPORTS_MSI |
484 | select VMSPLIT_1G | 498 | select VMSPLIT_1G |
499 | select NEED_MACH_IO_H | ||
485 | select NEED_MACH_MEMORY_H | 500 | select NEED_MACH_MEMORY_H |
486 | select NEED_RET_TO_USER | 501 | select NEED_RET_TO_USER |
487 | help | 502 | help |
@@ -491,6 +506,7 @@ config ARCH_IOP32X | |||
491 | bool "IOP32x-based" | 506 | bool "IOP32x-based" |
492 | depends on MMU | 507 | depends on MMU |
493 | select CPU_XSCALE | 508 | select CPU_XSCALE |
509 | select NEED_MACH_IO_H | ||
494 | select NEED_RET_TO_USER | 510 | select NEED_RET_TO_USER |
495 | select PLAT_IOP | 511 | select PLAT_IOP |
496 | select PCI | 512 | select PCI |
@@ -503,6 +519,7 @@ config ARCH_IOP33X | |||
503 | bool "IOP33x-based" | 519 | bool "IOP33x-based" |
504 | depends on MMU | 520 | depends on MMU |
505 | select CPU_XSCALE | 521 | select CPU_XSCALE |
522 | select NEED_MACH_IO_H | ||
506 | select NEED_RET_TO_USER | 523 | select NEED_RET_TO_USER |
507 | select PLAT_IOP | 524 | select PLAT_IOP |
508 | select PCI | 525 | select PCI |
@@ -516,6 +533,7 @@ config ARCH_IXP23XX | |||
516 | select CPU_XSC3 | 533 | select CPU_XSC3 |
517 | select PCI | 534 | select PCI |
518 | select ARCH_USES_GETTIMEOFFSET | 535 | select ARCH_USES_GETTIMEOFFSET |
536 | select NEED_MACH_IO_H | ||
519 | select NEED_MACH_MEMORY_H | 537 | select NEED_MACH_MEMORY_H |
520 | help | 538 | help |
521 | Support for Intel's IXP23xx (XScale) family of processors. | 539 | Support for Intel's IXP23xx (XScale) family of processors. |
@@ -526,6 +544,7 @@ config ARCH_IXP2000 | |||
526 | select CPU_XSCALE | 544 | select CPU_XSCALE |
527 | select PCI | 545 | select PCI |
528 | select ARCH_USES_GETTIMEOFFSET | 546 | select ARCH_USES_GETTIMEOFFSET |
547 | select NEED_MACH_IO_H | ||
529 | select NEED_MACH_MEMORY_H | 548 | select NEED_MACH_MEMORY_H |
530 | help | 549 | help |
531 | Support for Intel's IXP2400/2800 (XScale) family of processors. | 550 | Support for Intel's IXP2400/2800 (XScale) family of processors. |
@@ -533,12 +552,13 @@ config ARCH_IXP2000 | |||
533 | config ARCH_IXP4XX | 552 | config ARCH_IXP4XX |
534 | bool "IXP4xx-based" | 553 | bool "IXP4xx-based" |
535 | depends on MMU | 554 | depends on MMU |
555 | select ARCH_HAS_DMA_SET_COHERENT_MASK | ||
536 | select CLKSRC_MMIO | 556 | select CLKSRC_MMIO |
537 | select CPU_XSCALE | 557 | select CPU_XSCALE |
538 | select GENERIC_GPIO | 558 | select GENERIC_GPIO |
539 | select GENERIC_CLOCKEVENTS | 559 | select GENERIC_CLOCKEVENTS |
540 | select HAVE_SCHED_CLOCK | ||
541 | select MIGHT_HAVE_PCI | 560 | select MIGHT_HAVE_PCI |
561 | select NEED_MACH_IO_H | ||
542 | select DMABOUNCE if PCI | 562 | select DMABOUNCE if PCI |
543 | help | 563 | help |
544 | Support for Intel's IXP4XX (XScale) family of processors. | 564 | Support for Intel's IXP4XX (XScale) family of processors. |
@@ -549,6 +569,7 @@ config ARCH_DOVE | |||
549 | select PCI | 569 | select PCI |
550 | select ARCH_REQUIRE_GPIOLIB | 570 | select ARCH_REQUIRE_GPIOLIB |
551 | select GENERIC_CLOCKEVENTS | 571 | select GENERIC_CLOCKEVENTS |
572 | select NEED_MACH_IO_H | ||
552 | select PLAT_ORION | 573 | select PLAT_ORION |
553 | help | 574 | help |
554 | Support for the Marvell Dove SoC 88AP510 | 575 | Support for the Marvell Dove SoC 88AP510 |
@@ -559,6 +580,7 @@ config ARCH_KIRKWOOD | |||
559 | select PCI | 580 | select PCI |
560 | select ARCH_REQUIRE_GPIOLIB | 581 | select ARCH_REQUIRE_GPIOLIB |
561 | select GENERIC_CLOCKEVENTS | 582 | select GENERIC_CLOCKEVENTS |
583 | select NEED_MACH_IO_H | ||
562 | select PLAT_ORION | 584 | select PLAT_ORION |
563 | help | 585 | help |
564 | Support for the following Marvell Kirkwood series SoCs: | 586 | Support for the following Marvell Kirkwood series SoCs: |
@@ -583,6 +605,7 @@ config ARCH_MV78XX0 | |||
583 | select PCI | 605 | select PCI |
584 | select ARCH_REQUIRE_GPIOLIB | 606 | select ARCH_REQUIRE_GPIOLIB |
585 | select GENERIC_CLOCKEVENTS | 607 | select GENERIC_CLOCKEVENTS |
608 | select NEED_MACH_IO_H | ||
586 | select PLAT_ORION | 609 | select PLAT_ORION |
587 | help | 610 | help |
588 | Support for the following Marvell MV78xx0 series SoCs: | 611 | Support for the following Marvell MV78xx0 series SoCs: |
@@ -608,7 +631,6 @@ config ARCH_MMP | |||
608 | select CLKDEV_LOOKUP | 631 | select CLKDEV_LOOKUP |
609 | select GENERIC_CLOCKEVENTS | 632 | select GENERIC_CLOCKEVENTS |
610 | select GPIO_PXA | 633 | select GPIO_PXA |
611 | select HAVE_SCHED_CLOCK | ||
612 | select TICK_ONESHOT | 634 | select TICK_ONESHOT |
613 | select PLAT_PXA | 635 | select PLAT_PXA |
614 | select SPARSE_IRQ | 636 | select SPARSE_IRQ |
@@ -649,9 +671,9 @@ config ARCH_TEGRA | |||
649 | select GENERIC_CLOCKEVENTS | 671 | select GENERIC_CLOCKEVENTS |
650 | select GENERIC_GPIO | 672 | select GENERIC_GPIO |
651 | select HAVE_CLK | 673 | select HAVE_CLK |
652 | select HAVE_SCHED_CLOCK | ||
653 | select HAVE_SMP | 674 | select HAVE_SMP |
654 | select MIGHT_HAVE_CACHE_L2X0 | 675 | select MIGHT_HAVE_CACHE_L2X0 |
676 | select NEED_MACH_IO_H if PCI | ||
655 | select ARCH_HAS_CPUFREQ | 677 | select ARCH_HAS_CPUFREQ |
656 | help | 678 | help |
657 | This enables support for NVIDIA Tegra based systems (Tegra APX, | 679 | This enables support for NVIDIA Tegra based systems (Tegra APX, |
@@ -666,7 +688,6 @@ config ARCH_PICOXCELL | |||
666 | select DW_APB_TIMER | 688 | select DW_APB_TIMER |
667 | select GENERIC_CLOCKEVENTS | 689 | select GENERIC_CLOCKEVENTS |
668 | select GENERIC_GPIO | 690 | select GENERIC_GPIO |
669 | select HAVE_SCHED_CLOCK | ||
670 | select HAVE_TCM | 691 | select HAVE_TCM |
671 | select NO_IOPORT | 692 | select NO_IOPORT |
672 | select SPARSE_IRQ | 693 | select SPARSE_IRQ |
@@ -694,7 +715,6 @@ config ARCH_PXA | |||
694 | select ARCH_REQUIRE_GPIOLIB | 715 | select ARCH_REQUIRE_GPIOLIB |
695 | select GENERIC_CLOCKEVENTS | 716 | select GENERIC_CLOCKEVENTS |
696 | select GPIO_PXA | 717 | select GPIO_PXA |
697 | select HAVE_SCHED_CLOCK | ||
698 | select TICK_ONESHOT | 718 | select TICK_ONESHOT |
699 | select PLAT_PXA | 719 | select PLAT_PXA |
700 | select SPARSE_IRQ | 720 | select SPARSE_IRQ |
@@ -745,6 +765,7 @@ config ARCH_RPC | |||
745 | select ARCH_SPARSEMEM_ENABLE | 765 | select ARCH_SPARSEMEM_ENABLE |
746 | select ARCH_USES_GETTIMEOFFSET | 766 | select ARCH_USES_GETTIMEOFFSET |
747 | select HAVE_IDE | 767 | select HAVE_IDE |
768 | select NEED_MACH_IO_H | ||
748 | select NEED_MACH_MEMORY_H | 769 | select NEED_MACH_MEMORY_H |
749 | help | 770 | help |
750 | On the Acorn Risc-PC, Linux can support the internal IDE disk and | 771 | On the Acorn Risc-PC, Linux can support the internal IDE disk and |
@@ -761,7 +782,6 @@ config ARCH_SA1100 | |||
761 | select CPU_FREQ | 782 | select CPU_FREQ |
762 | select GENERIC_CLOCKEVENTS | 783 | select GENERIC_CLOCKEVENTS |
763 | select CLKDEV_LOOKUP | 784 | select CLKDEV_LOOKUP |
764 | select HAVE_SCHED_CLOCK | ||
765 | select TICK_ONESHOT | 785 | select TICK_ONESHOT |
766 | select ARCH_REQUIRE_GPIOLIB | 786 | select ARCH_REQUIRE_GPIOLIB |
767 | select HAVE_IDE | 787 | select HAVE_IDE |
@@ -780,6 +800,7 @@ config ARCH_S3C24XX | |||
780 | select HAVE_S3C2410_I2C if I2C | 800 | select HAVE_S3C2410_I2C if I2C |
781 | select HAVE_S3C_RTC if RTC_CLASS | 801 | select HAVE_S3C_RTC if RTC_CLASS |
782 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 802 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
803 | select NEED_MACH_IO_H | ||
783 | help | 804 | help |
784 | Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443 | 805 | Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443 |
785 | and S3C2450 SoCs based systems, such as the Simtec Electronics BAST | 806 | and S3C2450 SoCs based systems, such as the Simtec Electronics BAST |
@@ -818,7 +839,6 @@ config ARCH_S5P64X0 | |||
818 | select CLKSRC_MMIO | 839 | select CLKSRC_MMIO |
819 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 840 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
820 | select GENERIC_CLOCKEVENTS | 841 | select GENERIC_CLOCKEVENTS |
821 | select HAVE_SCHED_CLOCK | ||
822 | select HAVE_S3C2410_I2C if I2C | 842 | select HAVE_S3C2410_I2C if I2C |
823 | select HAVE_S3C_RTC if RTC_CLASS | 843 | select HAVE_S3C_RTC if RTC_CLASS |
824 | help | 844 | help |
@@ -849,7 +869,6 @@ config ARCH_S5PV210 | |||
849 | select CLKSRC_MMIO | 869 | select CLKSRC_MMIO |
850 | select ARCH_HAS_CPUFREQ | 870 | select ARCH_HAS_CPUFREQ |
851 | select GENERIC_CLOCKEVENTS | 871 | select GENERIC_CLOCKEVENTS |
852 | select HAVE_SCHED_CLOCK | ||
853 | select HAVE_S3C2410_I2C if I2C | 872 | select HAVE_S3C2410_I2C if I2C |
854 | select HAVE_S3C_RTC if RTC_CLASS | 873 | select HAVE_S3C_RTC if RTC_CLASS |
855 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 874 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
@@ -883,6 +902,7 @@ config ARCH_SHARK | |||
883 | select PCI | 902 | select PCI |
884 | select ARCH_USES_GETTIMEOFFSET | 903 | select ARCH_USES_GETTIMEOFFSET |
885 | select NEED_MACH_MEMORY_H | 904 | select NEED_MACH_MEMORY_H |
905 | select NEED_MACH_IO_H | ||
886 | help | 906 | help |
887 | Support for the StrongARM based Digital DNARD machine, also known | 907 | Support for the StrongARM based Digital DNARD machine, also known |
888 | as "Shark" (<http://www.shark-linux.de/shark.html>). | 908 | as "Shark" (<http://www.shark-linux.de/shark.html>). |
@@ -892,7 +912,6 @@ config ARCH_U300 | |||
892 | depends on MMU | 912 | depends on MMU |
893 | select CLKSRC_MMIO | 913 | select CLKSRC_MMIO |
894 | select CPU_ARM926T | 914 | select CPU_ARM926T |
895 | select HAVE_SCHED_CLOCK | ||
896 | select HAVE_TCM | 915 | select HAVE_TCM |
897 | select ARM_AMBA | 916 | select ARM_AMBA |
898 | select ARM_PATCH_PHYS_VIRT | 917 | select ARM_PATCH_PHYS_VIRT |
@@ -951,7 +970,6 @@ config ARCH_OMAP | |||
951 | select ARCH_HAS_CPUFREQ | 970 | select ARCH_HAS_CPUFREQ |
952 | select CLKSRC_MMIO | 971 | select CLKSRC_MMIO |
953 | select GENERIC_CLOCKEVENTS | 972 | select GENERIC_CLOCKEVENTS |
954 | select HAVE_SCHED_CLOCK | ||
955 | select ARCH_HAS_HOLES_MEMORYMODEL | 973 | select ARCH_HAS_HOLES_MEMORYMODEL |
956 | help | 974 | help |
957 | Support for TI's OMAP platform (OMAP1/2/3/4). | 975 | Support for TI's OMAP platform (OMAP1/2/3/4). |
@@ -1115,13 +1133,11 @@ config ARCH_ACORN | |||
1115 | config PLAT_IOP | 1133 | config PLAT_IOP |
1116 | bool | 1134 | bool |
1117 | select GENERIC_CLOCKEVENTS | 1135 | select GENERIC_CLOCKEVENTS |
1118 | select HAVE_SCHED_CLOCK | ||
1119 | 1136 | ||
1120 | config PLAT_ORION | 1137 | config PLAT_ORION |
1121 | bool | 1138 | bool |
1122 | select CLKSRC_MMIO | 1139 | select CLKSRC_MMIO |
1123 | select GENERIC_IRQ_CHIP | 1140 | select GENERIC_IRQ_CHIP |
1124 | select HAVE_SCHED_CLOCK | ||
1125 | 1141 | ||
1126 | config PLAT_PXA | 1142 | config PLAT_PXA |
1127 | bool | 1143 | bool |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 66ca8014ff3e..85348a09d655 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -292,6 +292,22 @@ choice | |||
292 | Note that the system will appear to hang during boot if there | 292 | Note that the system will appear to hang during boot if there |
293 | is nothing connected to read from the DCC. | 293 | is nothing connected to read from the DCC. |
294 | 294 | ||
295 | config DEBUG_SEMIHOSTING | ||
296 | bool "Kernel low-level debug output via semihosting I" | ||
297 | help | ||
298 | Semihosting enables code running on an ARM target to use | ||
299 | the I/O facilities on a host debugger/emulator through a | ||
300 | simple SVC calls. The host debugger or emulator must have | ||
301 | semihosting enabled for the special svc call to be trapped | ||
302 | otherwise the kernel will crash. | ||
303 | |||
304 | This is known to work with OpenOCD, as wellas | ||
305 | ARM's Fast Models, or any other controlling environment | ||
306 | that implements semihosting. | ||
307 | |||
308 | For more details about semihosting, please see | ||
309 | chapter 8 of DUI0203I_rvct_developer_guide.pdf from ARM Ltd. | ||
310 | |||
295 | endchoice | 311 | endchoice |
296 | 312 | ||
297 | config EARLY_PRINTK | 313 | config EARLY_PRINTK |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index dcb088e868fe..047a20780fc1 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -253,6 +253,7 @@ core-$(CONFIG_VFP) += arch/arm/vfp/ | |||
253 | 253 | ||
254 | # If we have a machine-specific directory, then include it in the build. | 254 | # If we have a machine-specific directory, then include it in the build. |
255 | core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ | 255 | core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ |
256 | core-y += arch/arm/net/ | ||
256 | core-y += $(machdirs) $(platdirs) | 257 | core-y += $(machdirs) $(platdirs) |
257 | 258 | ||
258 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ | 259 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ |
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore index e0936a148516..d0d441c429ae 100644 --- a/arch/arm/boot/compressed/.gitignore +++ b/arch/arm/boot/compressed/.gitignore | |||
@@ -1,8 +1,10 @@ | |||
1 | ashldi3.S | ||
1 | font.c | 2 | font.c |
2 | lib1funcs.S | 3 | lib1funcs.S |
3 | piggy.gzip | 4 | piggy.gzip |
4 | piggy.lzo | 5 | piggy.lzo |
5 | piggy.lzma | 6 | piggy.lzma |
7 | piggy.xzkern | ||
6 | vmlinux | 8 | vmlinux |
7 | vmlinux.lds | 9 | vmlinux.lds |
8 | 10 | ||
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index cf0a64ce4b83..bb267562e7ed 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
@@ -92,6 +92,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ | |||
92 | suffix_$(CONFIG_KERNEL_GZIP) = gzip | 92 | suffix_$(CONFIG_KERNEL_GZIP) = gzip |
93 | suffix_$(CONFIG_KERNEL_LZO) = lzo | 93 | suffix_$(CONFIG_KERNEL_LZO) = lzo |
94 | suffix_$(CONFIG_KERNEL_LZMA) = lzma | 94 | suffix_$(CONFIG_KERNEL_LZMA) = lzma |
95 | suffix_$(CONFIG_KERNEL_XZ) = xzkern | ||
95 | 96 | ||
96 | # Borrowed libfdt files for the ATAG compatibility mode | 97 | # Borrowed libfdt files for the ATAG compatibility mode |
97 | 98 | ||
@@ -112,10 +113,12 @@ endif | |||
112 | 113 | ||
113 | targets := vmlinux vmlinux.lds \ | 114 | targets := vmlinux vmlinux.lds \ |
114 | piggy.$(suffix_y) piggy.$(suffix_y).o \ | 115 | piggy.$(suffix_y) piggy.$(suffix_y).o \ |
115 | lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS) | 116 | lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \ |
117 | font.o font.c head.o misc.o $(OBJS) | ||
116 | 118 | ||
117 | # Make sure files are removed during clean | 119 | # Make sure files are removed during clean |
118 | extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs) | 120 | extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ |
121 | lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) | ||
119 | 122 | ||
120 | ifeq ($(CONFIG_FUNCTION_TRACER),y) | 123 | ifeq ($(CONFIG_FUNCTION_TRACER),y) |
121 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | 124 | ORIG_CFLAGS := $(KBUILD_CFLAGS) |
@@ -151,6 +154,12 @@ lib1funcs = $(obj)/lib1funcs.o | |||
151 | $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S | 154 | $(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S |
152 | $(call cmd,shipped) | 155 | $(call cmd,shipped) |
153 | 156 | ||
157 | # For __aeabi_llsl | ||
158 | ashldi3 = $(obj)/ashldi3.o | ||
159 | |||
160 | $(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S | ||
161 | $(call cmd,shipped) | ||
162 | |||
154 | # We need to prevent any GOTOFF relocs being used with references | 163 | # We need to prevent any GOTOFF relocs being used with references |
155 | # to symbols in the .bss section since we cannot relocate them | 164 | # to symbols in the .bss section since we cannot relocate them |
156 | # independently from the rest at run time. This can be achieved by | 165 | # independently from the rest at run time. This can be achieved by |
@@ -172,7 +181,7 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \ | |||
172 | fi | 181 | fi |
173 | 182 | ||
174 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ | 183 | $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ |
175 | $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE | 184 | $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE |
176 | @$(check_for_multiple_zreladdr) | 185 | @$(check_for_multiple_zreladdr) |
177 | $(call if_changed,ld) | 186 | $(call if_changed,ld) |
178 | @$(check_for_bad_syms) | 187 | @$(check_for_bad_syms) |
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c index 07be5a2f8302..f41b38cafce8 100644 --- a/arch/arm/boot/compressed/decompress.c +++ b/arch/arm/boot/compressed/decompress.c | |||
@@ -44,6 +44,12 @@ extern void error(char *); | |||
44 | #include "../../../../lib/decompress_unlzma.c" | 44 | #include "../../../../lib/decompress_unlzma.c" |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef CONFIG_KERNEL_XZ | ||
48 | #define memmove memmove | ||
49 | #define memcpy memcpy | ||
50 | #include "../../../../lib/decompress_unxz.c" | ||
51 | #endif | ||
52 | |||
47 | int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) | 53 | int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) |
48 | { | 54 | { |
49 | return decompress(input, len, NULL, NULL, output, NULL, error); | 55 | return decompress(input, len, NULL, NULL, output, NULL, error); |
diff --git a/arch/arm/boot/compressed/piggy.xzkern.S b/arch/arm/boot/compressed/piggy.xzkern.S new file mode 100644 index 000000000000..5703f300d027 --- /dev/null +++ b/arch/arm/boot/compressed/piggy.xzkern.S | |||
@@ -0,0 +1,6 @@ | |||
1 | .section .piggydata,#alloc | ||
2 | .globl input_data | ||
3 | input_data: | ||
4 | .incbin "arch/arm/boot/compressed/piggy.xzkern" | ||
5 | .globl input_data_end | ||
6 | input_data_end: | ||
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 3bb1d7589bd9..283fa1d804f4 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig | |||
@@ -24,9 +24,6 @@ config ARM_VIC_NR | |||
24 | config ICST | 24 | config ICST |
25 | bool | 25 | bool |
26 | 26 | ||
27 | config PL330 | ||
28 | bool | ||
29 | |||
30 | config SA1111 | 27 | config SA1111 |
31 | bool | 28 | bool |
32 | select DMABOUNCE if !ARCH_PXA | 29 | select DMABOUNCE if !ARCH_PXA |
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index 69feafe7286c..215816f1775f 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile | |||
@@ -5,7 +5,6 @@ | |||
5 | obj-$(CONFIG_ARM_GIC) += gic.o | 5 | obj-$(CONFIG_ARM_GIC) += gic.o |
6 | obj-$(CONFIG_ARM_VIC) += vic.o | 6 | obj-$(CONFIG_ARM_VIC) += vic.o |
7 | obj-$(CONFIG_ICST) += icst.o | 7 | obj-$(CONFIG_ICST) += icst.o |
8 | obj-$(CONFIG_PL330) += pl330.o | ||
9 | obj-$(CONFIG_SA1111) += sa1111.o | 8 | obj-$(CONFIG_SA1111) += sa1111.o |
10 | obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o | 9 | obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o |
11 | obj-$(CONFIG_DMABOUNCE) += dmabounce.o | 10 | obj-$(CONFIG_DMABOUNCE) += dmabounce.o |
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index f0783be17352..aa5269984187 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
@@ -686,13 +686,12 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
686 | * For primary GICs, skip over SGIs. | 686 | * For primary GICs, skip over SGIs. |
687 | * For secondary GICs, skip over PPIs, too. | 687 | * For secondary GICs, skip over PPIs, too. |
688 | */ | 688 | */ |
689 | hwirq_base = 32; | 689 | if (gic_nr == 0 && (irq_start & 31) > 0) { |
690 | if (gic_nr == 0) { | 690 | hwirq_base = 16; |
691 | if ((irq_start & 31) > 0) { | 691 | if (irq_start != -1) |
692 | hwirq_base = 16; | 692 | irq_start = (irq_start & ~31) + 16; |
693 | if (irq_start != -1) | 693 | } else { |
694 | irq_start = (irq_start & ~31) + 16; | 694 | hwirq_base = 32; |
695 | } | ||
696 | } | 695 | } |
697 | 696 | ||
698 | /* | 697 | /* |
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c deleted file mode 100644 index ff3ad2244824..000000000000 --- a/arch/arm/common/pl330.c +++ /dev/null | |||
@@ -1,1960 +0,0 @@ | |||
1 | /* linux/arch/arm/common/pl330.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/delay.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/dma-mapping.h> | ||
30 | |||
31 | #include <asm/hardware/pl330.h> | ||
32 | |||
33 | /* Register and Bit field Definitions */ | ||
34 | #define DS 0x0 | ||
35 | #define DS_ST_STOP 0x0 | ||
36 | #define DS_ST_EXEC 0x1 | ||
37 | #define DS_ST_CMISS 0x2 | ||
38 | #define DS_ST_UPDTPC 0x3 | ||
39 | #define DS_ST_WFE 0x4 | ||
40 | #define DS_ST_ATBRR 0x5 | ||
41 | #define DS_ST_QBUSY 0x6 | ||
42 | #define DS_ST_WFP 0x7 | ||
43 | #define DS_ST_KILL 0x8 | ||
44 | #define DS_ST_CMPLT 0x9 | ||
45 | #define DS_ST_FLTCMP 0xe | ||
46 | #define DS_ST_FAULT 0xf | ||
47 | |||
48 | #define DPC 0x4 | ||
49 | #define INTEN 0x20 | ||
50 | #define ES 0x24 | ||
51 | #define INTSTATUS 0x28 | ||
52 | #define INTCLR 0x2c | ||
53 | #define FSM 0x30 | ||
54 | #define FSC 0x34 | ||
55 | #define FTM 0x38 | ||
56 | |||
57 | #define _FTC 0x40 | ||
58 | #define FTC(n) (_FTC + (n)*0x4) | ||
59 | |||
60 | #define _CS 0x100 | ||
61 | #define CS(n) (_CS + (n)*0x8) | ||
62 | #define CS_CNS (1 << 21) | ||
63 | |||
64 | #define _CPC 0x104 | ||
65 | #define CPC(n) (_CPC + (n)*0x8) | ||
66 | |||
67 | #define _SA 0x400 | ||
68 | #define SA(n) (_SA + (n)*0x20) | ||
69 | |||
70 | #define _DA 0x404 | ||
71 | #define DA(n) (_DA + (n)*0x20) | ||
72 | |||
73 | #define _CC 0x408 | ||
74 | #define CC(n) (_CC + (n)*0x20) | ||
75 | |||
76 | #define CC_SRCINC (1 << 0) | ||
77 | #define CC_DSTINC (1 << 14) | ||
78 | #define CC_SRCPRI (1 << 8) | ||
79 | #define CC_DSTPRI (1 << 22) | ||
80 | #define CC_SRCNS (1 << 9) | ||
81 | #define CC_DSTNS (1 << 23) | ||
82 | #define CC_SRCIA (1 << 10) | ||
83 | #define CC_DSTIA (1 << 24) | ||
84 | #define CC_SRCBRSTLEN_SHFT 4 | ||
85 | #define CC_DSTBRSTLEN_SHFT 18 | ||
86 | #define CC_SRCBRSTSIZE_SHFT 1 | ||
87 | #define CC_DSTBRSTSIZE_SHFT 15 | ||
88 | #define CC_SRCCCTRL_SHFT 11 | ||
89 | #define CC_SRCCCTRL_MASK 0x7 | ||
90 | #define CC_DSTCCTRL_SHFT 25 | ||
91 | #define CC_DRCCCTRL_MASK 0x7 | ||
92 | #define CC_SWAP_SHFT 28 | ||
93 | |||
94 | #define _LC0 0x40c | ||
95 | #define LC0(n) (_LC0 + (n)*0x20) | ||
96 | |||
97 | #define _LC1 0x410 | ||
98 | #define LC1(n) (_LC1 + (n)*0x20) | ||
99 | |||
100 | #define DBGSTATUS 0xd00 | ||
101 | #define DBG_BUSY (1 << 0) | ||
102 | |||
103 | #define DBGCMD 0xd04 | ||
104 | #define DBGINST0 0xd08 | ||
105 | #define DBGINST1 0xd0c | ||
106 | |||
107 | #define CR0 0xe00 | ||
108 | #define CR1 0xe04 | ||
109 | #define CR2 0xe08 | ||
110 | #define CR3 0xe0c | ||
111 | #define CR4 0xe10 | ||
112 | #define CRD 0xe14 | ||
113 | |||
114 | #define PERIPH_ID 0xfe0 | ||
115 | #define PCELL_ID 0xff0 | ||
116 | |||
117 | #define CR0_PERIPH_REQ_SET (1 << 0) | ||
118 | #define CR0_BOOT_EN_SET (1 << 1) | ||
119 | #define CR0_BOOT_MAN_NS (1 << 2) | ||
120 | #define CR0_NUM_CHANS_SHIFT 4 | ||
121 | #define CR0_NUM_CHANS_MASK 0x7 | ||
122 | #define CR0_NUM_PERIPH_SHIFT 12 | ||
123 | #define CR0_NUM_PERIPH_MASK 0x1f | ||
124 | #define CR0_NUM_EVENTS_SHIFT 17 | ||
125 | #define CR0_NUM_EVENTS_MASK 0x1f | ||
126 | |||
127 | #define CR1_ICACHE_LEN_SHIFT 0 | ||
128 | #define CR1_ICACHE_LEN_MASK 0x7 | ||
129 | #define CR1_NUM_ICACHELINES_SHIFT 4 | ||
130 | #define CR1_NUM_ICACHELINES_MASK 0xf | ||
131 | |||
132 | #define CRD_DATA_WIDTH_SHIFT 0 | ||
133 | #define CRD_DATA_WIDTH_MASK 0x7 | ||
134 | #define CRD_WR_CAP_SHIFT 4 | ||
135 | #define CRD_WR_CAP_MASK 0x7 | ||
136 | #define CRD_WR_Q_DEP_SHIFT 8 | ||
137 | #define CRD_WR_Q_DEP_MASK 0xf | ||
138 | #define CRD_RD_CAP_SHIFT 12 | ||
139 | #define CRD_RD_CAP_MASK 0x7 | ||
140 | #define CRD_RD_Q_DEP_SHIFT 16 | ||
141 | #define CRD_RD_Q_DEP_MASK 0xf | ||
142 | #define CRD_DATA_BUFF_SHIFT 20 | ||
143 | #define CRD_DATA_BUFF_MASK 0x3ff | ||
144 | |||
145 | #define PART 0x330 | ||
146 | #define DESIGNER 0x41 | ||
147 | #define REVISION 0x0 | ||
148 | #define INTEG_CFG 0x0 | ||
149 | #define PERIPH_ID_VAL ((PART << 0) | (DESIGNER << 12)) | ||
150 | |||
151 | #define PCELL_ID_VAL 0xb105f00d | ||
152 | |||
153 | #define PL330_STATE_STOPPED (1 << 0) | ||
154 | #define PL330_STATE_EXECUTING (1 << 1) | ||
155 | #define PL330_STATE_WFE (1 << 2) | ||
156 | #define PL330_STATE_FAULTING (1 << 3) | ||
157 | #define PL330_STATE_COMPLETING (1 << 4) | ||
158 | #define PL330_STATE_WFP (1 << 5) | ||
159 | #define PL330_STATE_KILLING (1 << 6) | ||
160 | #define PL330_STATE_FAULT_COMPLETING (1 << 7) | ||
161 | #define PL330_STATE_CACHEMISS (1 << 8) | ||
162 | #define PL330_STATE_UPDTPC (1 << 9) | ||
163 | #define PL330_STATE_ATBARRIER (1 << 10) | ||
164 | #define PL330_STATE_QUEUEBUSY (1 << 11) | ||
165 | #define PL330_STATE_INVALID (1 << 15) | ||
166 | |||
167 | #define PL330_STABLE_STATES (PL330_STATE_STOPPED | PL330_STATE_EXECUTING \ | ||
168 | | PL330_STATE_WFE | PL330_STATE_FAULTING) | ||
169 | |||
170 | #define CMD_DMAADDH 0x54 | ||
171 | #define CMD_DMAEND 0x00 | ||
172 | #define CMD_DMAFLUSHP 0x35 | ||
173 | #define CMD_DMAGO 0xa0 | ||
174 | #define CMD_DMALD 0x04 | ||
175 | #define CMD_DMALDP 0x25 | ||
176 | #define CMD_DMALP 0x20 | ||
177 | #define CMD_DMALPEND 0x28 | ||
178 | #define CMD_DMAKILL 0x01 | ||
179 | #define CMD_DMAMOV 0xbc | ||
180 | #define CMD_DMANOP 0x18 | ||
181 | #define CMD_DMARMB 0x12 | ||
182 | #define CMD_DMASEV 0x34 | ||
183 | #define CMD_DMAST 0x08 | ||
184 | #define CMD_DMASTP 0x29 | ||
185 | #define CMD_DMASTZ 0x0c | ||
186 | #define CMD_DMAWFE 0x36 | ||
187 | #define CMD_DMAWFP 0x30 | ||
188 | #define CMD_DMAWMB 0x13 | ||
189 | |||
190 | #define SZ_DMAADDH 3 | ||
191 | #define SZ_DMAEND 1 | ||
192 | #define SZ_DMAFLUSHP 2 | ||
193 | #define SZ_DMALD 1 | ||
194 | #define SZ_DMALDP 2 | ||
195 | #define SZ_DMALP 2 | ||
196 | #define SZ_DMALPEND 2 | ||
197 | #define SZ_DMAKILL 1 | ||
198 | #define SZ_DMAMOV 6 | ||
199 | #define SZ_DMANOP 1 | ||
200 | #define SZ_DMARMB 1 | ||
201 | #define SZ_DMASEV 2 | ||
202 | #define SZ_DMAST 1 | ||
203 | #define SZ_DMASTP 2 | ||
204 | #define SZ_DMASTZ 1 | ||
205 | #define SZ_DMAWFE 2 | ||
206 | #define SZ_DMAWFP 2 | ||
207 | #define SZ_DMAWMB 1 | ||
208 | #define SZ_DMAGO 6 | ||
209 | |||
210 | #define BRST_LEN(ccr) ((((ccr) >> CC_SRCBRSTLEN_SHFT) & 0xf) + 1) | ||
211 | #define BRST_SIZE(ccr) (1 << (((ccr) >> CC_SRCBRSTSIZE_SHFT) & 0x7)) | ||
212 | |||
213 | #define BYTE_TO_BURST(b, ccr) ((b) / BRST_SIZE(ccr) / BRST_LEN(ccr)) | ||
214 | #define BURST_TO_BYTE(c, ccr) ((c) * BRST_SIZE(ccr) * BRST_LEN(ccr)) | ||
215 | |||
216 | /* | ||
217 | * With 256 bytes, we can do more than 2.5MB and 5MB xfers per req | ||
218 | * at 1byte/burst for P<->M and M<->M respectively. | ||
219 | * For typical scenario, at 1word/burst, 10MB and 20MB xfers per req | ||
220 | * should be enough for P<->M and M<->M respectively. | ||
221 | */ | ||
222 | #define MCODE_BUFF_PER_REQ 256 | ||
223 | |||
224 | /* If the _pl330_req is available to the client */ | ||
225 | #define IS_FREE(req) (*((u8 *)((req)->mc_cpu)) == CMD_DMAEND) | ||
226 | |||
227 | /* Use this _only_ to wait on transient states */ | ||
228 | #define UNTIL(t, s) while (!(_state(t) & (s))) cpu_relax(); | ||
229 | |||
230 | #ifdef PL330_DEBUG_MCGEN | ||
231 | static unsigned cmd_line; | ||
232 | #define PL330_DBGCMD_DUMP(off, x...) do { \ | ||
233 | printk("%x:", cmd_line); \ | ||
234 | printk(x); \ | ||
235 | cmd_line += off; \ | ||
236 | } while (0) | ||
237 | #define PL330_DBGMC_START(addr) (cmd_line = addr) | ||
238 | #else | ||
239 | #define PL330_DBGCMD_DUMP(off, x...) do {} while (0) | ||
240 | #define PL330_DBGMC_START(addr) do {} while (0) | ||
241 | #endif | ||
242 | |||
243 | struct _xfer_spec { | ||
244 | u32 ccr; | ||
245 | struct pl330_req *r; | ||
246 | struct pl330_xfer *x; | ||
247 | }; | ||
248 | |||
249 | enum dmamov_dst { | ||
250 | SAR = 0, | ||
251 | CCR, | ||
252 | DAR, | ||
253 | }; | ||
254 | |||
255 | enum pl330_dst { | ||
256 | SRC = 0, | ||
257 | DST, | ||
258 | }; | ||
259 | |||
260 | enum pl330_cond { | ||
261 | SINGLE, | ||
262 | BURST, | ||
263 | ALWAYS, | ||
264 | }; | ||
265 | |||
266 | struct _pl330_req { | ||
267 | u32 mc_bus; | ||
268 | void *mc_cpu; | ||
269 | /* Number of bytes taken to setup MC for the req */ | ||
270 | u32 mc_len; | ||
271 | struct pl330_req *r; | ||
272 | /* Hook to attach to DMAC's list of reqs with due callback */ | ||
273 | struct list_head rqd; | ||
274 | }; | ||
275 | |||
276 | /* ToBeDone for tasklet */ | ||
277 | struct _pl330_tbd { | ||
278 | bool reset_dmac; | ||
279 | bool reset_mngr; | ||
280 | u8 reset_chan; | ||
281 | }; | ||
282 | |||
283 | /* A DMAC Thread */ | ||
284 | struct pl330_thread { | ||
285 | u8 id; | ||
286 | int ev; | ||
287 | /* If the channel is not yet acquired by any client */ | ||
288 | bool free; | ||
289 | /* Parent DMAC */ | ||
290 | struct pl330_dmac *dmac; | ||
291 | /* Only two at a time */ | ||
292 | struct _pl330_req req[2]; | ||
293 | /* Index of the last enqueued request */ | ||
294 | unsigned lstenq; | ||
295 | /* Index of the last submitted request or -1 if the DMA is stopped */ | ||
296 | int req_running; | ||
297 | }; | ||
298 | |||
299 | enum pl330_dmac_state { | ||
300 | UNINIT, | ||
301 | INIT, | ||
302 | DYING, | ||
303 | }; | ||
304 | |||
305 | /* A DMAC */ | ||
306 | struct pl330_dmac { | ||
307 | spinlock_t lock; | ||
308 | /* Holds list of reqs with due callbacks */ | ||
309 | struct list_head req_done; | ||
310 | /* Pointer to platform specific stuff */ | ||
311 | struct pl330_info *pinfo; | ||
312 | /* Maximum possible events/irqs */ | ||
313 | int events[32]; | ||
314 | /* BUS address of MicroCode buffer */ | ||
315 | u32 mcode_bus; | ||
316 | /* CPU address of MicroCode buffer */ | ||
317 | void *mcode_cpu; | ||
318 | /* List of all Channel threads */ | ||
319 | struct pl330_thread *channels; | ||
320 | /* Pointer to the MANAGER thread */ | ||
321 | struct pl330_thread *manager; | ||
322 | /* To handle bad news in interrupt */ | ||
323 | struct tasklet_struct tasks; | ||
324 | struct _pl330_tbd dmac_tbd; | ||
325 | /* State of DMAC operation */ | ||
326 | enum pl330_dmac_state state; | ||
327 | }; | ||
328 | |||
329 | static inline void _callback(struct pl330_req *r, enum pl330_op_err err) | ||
330 | { | ||
331 | if (r && r->xfer_cb) | ||
332 | r->xfer_cb(r->token, err); | ||
333 | } | ||
334 | |||
335 | static inline bool _queue_empty(struct pl330_thread *thrd) | ||
336 | { | ||
337 | return (IS_FREE(&thrd->req[0]) && IS_FREE(&thrd->req[1])) | ||
338 | ? true : false; | ||
339 | } | ||
340 | |||
341 | static inline bool _queue_full(struct pl330_thread *thrd) | ||
342 | { | ||
343 | return (IS_FREE(&thrd->req[0]) || IS_FREE(&thrd->req[1])) | ||
344 | ? false : true; | ||
345 | } | ||
346 | |||
347 | static inline bool is_manager(struct pl330_thread *thrd) | ||
348 | { | ||
349 | struct pl330_dmac *pl330 = thrd->dmac; | ||
350 | |||
351 | /* MANAGER is indexed at the end */ | ||
352 | if (thrd->id == pl330->pinfo->pcfg.num_chan) | ||
353 | return true; | ||
354 | else | ||
355 | return false; | ||
356 | } | ||
357 | |||
358 | /* If manager of the thread is in Non-Secure mode */ | ||
359 | static inline bool _manager_ns(struct pl330_thread *thrd) | ||
360 | { | ||
361 | struct pl330_dmac *pl330 = thrd->dmac; | ||
362 | |||
363 | return (pl330->pinfo->pcfg.mode & DMAC_MODE_NS) ? true : false; | ||
364 | } | ||
365 | |||
366 | static inline u32 get_id(struct pl330_info *pi, u32 off) | ||
367 | { | ||
368 | void __iomem *regs = pi->base; | ||
369 | u32 id = 0; | ||
370 | |||
371 | id |= (readb(regs + off + 0x0) << 0); | ||
372 | id |= (readb(regs + off + 0x4) << 8); | ||
373 | id |= (readb(regs + off + 0x8) << 16); | ||
374 | id |= (readb(regs + off + 0xc) << 24); | ||
375 | |||
376 | return id; | ||
377 | } | ||
378 | |||
379 | static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[], | ||
380 | enum pl330_dst da, u16 val) | ||
381 | { | ||
382 | if (dry_run) | ||
383 | return SZ_DMAADDH; | ||
384 | |||
385 | buf[0] = CMD_DMAADDH; | ||
386 | buf[0] |= (da << 1); | ||
387 | *((u16 *)&buf[1]) = val; | ||
388 | |||
389 | PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n", | ||
390 | da == 1 ? "DA" : "SA", val); | ||
391 | |||
392 | return SZ_DMAADDH; | ||
393 | } | ||
394 | |||
395 | static inline u32 _emit_END(unsigned dry_run, u8 buf[]) | ||
396 | { | ||
397 | if (dry_run) | ||
398 | return SZ_DMAEND; | ||
399 | |||
400 | buf[0] = CMD_DMAEND; | ||
401 | |||
402 | PL330_DBGCMD_DUMP(SZ_DMAEND, "\tDMAEND\n"); | ||
403 | |||
404 | return SZ_DMAEND; | ||
405 | } | ||
406 | |||
407 | static inline u32 _emit_FLUSHP(unsigned dry_run, u8 buf[], u8 peri) | ||
408 | { | ||
409 | if (dry_run) | ||
410 | return SZ_DMAFLUSHP; | ||
411 | |||
412 | buf[0] = CMD_DMAFLUSHP; | ||
413 | |||
414 | peri &= 0x1f; | ||
415 | peri <<= 3; | ||
416 | buf[1] = peri; | ||
417 | |||
418 | PL330_DBGCMD_DUMP(SZ_DMAFLUSHP, "\tDMAFLUSHP %u\n", peri >> 3); | ||
419 | |||
420 | return SZ_DMAFLUSHP; | ||
421 | } | ||
422 | |||
423 | static inline u32 _emit_LD(unsigned dry_run, u8 buf[], enum pl330_cond cond) | ||
424 | { | ||
425 | if (dry_run) | ||
426 | return SZ_DMALD; | ||
427 | |||
428 | buf[0] = CMD_DMALD; | ||
429 | |||
430 | if (cond == SINGLE) | ||
431 | buf[0] |= (0 << 1) | (1 << 0); | ||
432 | else if (cond == BURST) | ||
433 | buf[0] |= (1 << 1) | (1 << 0); | ||
434 | |||
435 | PL330_DBGCMD_DUMP(SZ_DMALD, "\tDMALD%c\n", | ||
436 | cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A')); | ||
437 | |||
438 | return SZ_DMALD; | ||
439 | } | ||
440 | |||
441 | static inline u32 _emit_LDP(unsigned dry_run, u8 buf[], | ||
442 | enum pl330_cond cond, u8 peri) | ||
443 | { | ||
444 | if (dry_run) | ||
445 | return SZ_DMALDP; | ||
446 | |||
447 | buf[0] = CMD_DMALDP; | ||
448 | |||
449 | if (cond == BURST) | ||
450 | buf[0] |= (1 << 1); | ||
451 | |||
452 | peri &= 0x1f; | ||
453 | peri <<= 3; | ||
454 | buf[1] = peri; | ||
455 | |||
456 | PL330_DBGCMD_DUMP(SZ_DMALDP, "\tDMALDP%c %u\n", | ||
457 | cond == SINGLE ? 'S' : 'B', peri >> 3); | ||
458 | |||
459 | return SZ_DMALDP; | ||
460 | } | ||
461 | |||
462 | static inline u32 _emit_LP(unsigned dry_run, u8 buf[], | ||
463 | unsigned loop, u8 cnt) | ||
464 | { | ||
465 | if (dry_run) | ||
466 | return SZ_DMALP; | ||
467 | |||
468 | buf[0] = CMD_DMALP; | ||
469 | |||
470 | if (loop) | ||
471 | buf[0] |= (1 << 1); | ||
472 | |||
473 | cnt--; /* DMAC increments by 1 internally */ | ||
474 | buf[1] = cnt; | ||
475 | |||
476 | PL330_DBGCMD_DUMP(SZ_DMALP, "\tDMALP_%c %u\n", loop ? '1' : '0', cnt); | ||
477 | |||
478 | return SZ_DMALP; | ||
479 | } | ||
480 | |||
481 | struct _arg_LPEND { | ||
482 | enum pl330_cond cond; | ||
483 | bool forever; | ||
484 | unsigned loop; | ||
485 | u8 bjump; | ||
486 | }; | ||
487 | |||
488 | static inline u32 _emit_LPEND(unsigned dry_run, u8 buf[], | ||
489 | const struct _arg_LPEND *arg) | ||
490 | { | ||
491 | enum pl330_cond cond = arg->cond; | ||
492 | bool forever = arg->forever; | ||
493 | unsigned loop = arg->loop; | ||
494 | u8 bjump = arg->bjump; | ||
495 | |||
496 | if (dry_run) | ||
497 | return SZ_DMALPEND; | ||
498 | |||
499 | buf[0] = CMD_DMALPEND; | ||
500 | |||
501 | if (loop) | ||
502 | buf[0] |= (1 << 2); | ||
503 | |||
504 | if (!forever) | ||
505 | buf[0] |= (1 << 4); | ||
506 | |||
507 | if (cond == SINGLE) | ||
508 | buf[0] |= (0 << 1) | (1 << 0); | ||
509 | else if (cond == BURST) | ||
510 | buf[0] |= (1 << 1) | (1 << 0); | ||
511 | |||
512 | buf[1] = bjump; | ||
513 | |||
514 | PL330_DBGCMD_DUMP(SZ_DMALPEND, "\tDMALP%s%c_%c bjmpto_%x\n", | ||
515 | forever ? "FE" : "END", | ||
516 | cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A'), | ||
517 | loop ? '1' : '0', | ||
518 | bjump); | ||
519 | |||
520 | return SZ_DMALPEND; | ||
521 | } | ||
522 | |||
523 | static inline u32 _emit_KILL(unsigned dry_run, u8 buf[]) | ||
524 | { | ||
525 | if (dry_run) | ||
526 | return SZ_DMAKILL; | ||
527 | |||
528 | buf[0] = CMD_DMAKILL; | ||
529 | |||
530 | return SZ_DMAKILL; | ||
531 | } | ||
532 | |||
533 | static inline u32 _emit_MOV(unsigned dry_run, u8 buf[], | ||
534 | enum dmamov_dst dst, u32 val) | ||
535 | { | ||
536 | if (dry_run) | ||
537 | return SZ_DMAMOV; | ||
538 | |||
539 | buf[0] = CMD_DMAMOV; | ||
540 | buf[1] = dst; | ||
541 | *((u32 *)&buf[2]) = val; | ||
542 | |||
543 | PL330_DBGCMD_DUMP(SZ_DMAMOV, "\tDMAMOV %s 0x%x\n", | ||
544 | dst == SAR ? "SAR" : (dst == DAR ? "DAR" : "CCR"), val); | ||
545 | |||
546 | return SZ_DMAMOV; | ||
547 | } | ||
548 | |||
549 | static inline u32 _emit_NOP(unsigned dry_run, u8 buf[]) | ||
550 | { | ||
551 | if (dry_run) | ||
552 | return SZ_DMANOP; | ||
553 | |||
554 | buf[0] = CMD_DMANOP; | ||
555 | |||
556 | PL330_DBGCMD_DUMP(SZ_DMANOP, "\tDMANOP\n"); | ||
557 | |||
558 | return SZ_DMANOP; | ||
559 | } | ||
560 | |||
561 | static inline u32 _emit_RMB(unsigned dry_run, u8 buf[]) | ||
562 | { | ||
563 | if (dry_run) | ||
564 | return SZ_DMARMB; | ||
565 | |||
566 | buf[0] = CMD_DMARMB; | ||
567 | |||
568 | PL330_DBGCMD_DUMP(SZ_DMARMB, "\tDMARMB\n"); | ||
569 | |||
570 | return SZ_DMARMB; | ||
571 | } | ||
572 | |||
573 | static inline u32 _emit_SEV(unsigned dry_run, u8 buf[], u8 ev) | ||
574 | { | ||
575 | if (dry_run) | ||
576 | return SZ_DMASEV; | ||
577 | |||
578 | buf[0] = CMD_DMASEV; | ||
579 | |||
580 | ev &= 0x1f; | ||
581 | ev <<= 3; | ||
582 | buf[1] = ev; | ||
583 | |||
584 | PL330_DBGCMD_DUMP(SZ_DMASEV, "\tDMASEV %u\n", ev >> 3); | ||
585 | |||
586 | return SZ_DMASEV; | ||
587 | } | ||
588 | |||
589 | static inline u32 _emit_ST(unsigned dry_run, u8 buf[], enum pl330_cond cond) | ||
590 | { | ||
591 | if (dry_run) | ||
592 | return SZ_DMAST; | ||
593 | |||
594 | buf[0] = CMD_DMAST; | ||
595 | |||
596 | if (cond == SINGLE) | ||
597 | buf[0] |= (0 << 1) | (1 << 0); | ||
598 | else if (cond == BURST) | ||
599 | buf[0] |= (1 << 1) | (1 << 0); | ||
600 | |||
601 | PL330_DBGCMD_DUMP(SZ_DMAST, "\tDMAST%c\n", | ||
602 | cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A')); | ||
603 | |||
604 | return SZ_DMAST; | ||
605 | } | ||
606 | |||
607 | static inline u32 _emit_STP(unsigned dry_run, u8 buf[], | ||
608 | enum pl330_cond cond, u8 peri) | ||
609 | { | ||
610 | if (dry_run) | ||
611 | return SZ_DMASTP; | ||
612 | |||
613 | buf[0] = CMD_DMASTP; | ||
614 | |||
615 | if (cond == BURST) | ||
616 | buf[0] |= (1 << 1); | ||
617 | |||
618 | peri &= 0x1f; | ||
619 | peri <<= 3; | ||
620 | buf[1] = peri; | ||
621 | |||
622 | PL330_DBGCMD_DUMP(SZ_DMASTP, "\tDMASTP%c %u\n", | ||
623 | cond == SINGLE ? 'S' : 'B', peri >> 3); | ||
624 | |||
625 | return SZ_DMASTP; | ||
626 | } | ||
627 | |||
628 | static inline u32 _emit_STZ(unsigned dry_run, u8 buf[]) | ||
629 | { | ||
630 | if (dry_run) | ||
631 | return SZ_DMASTZ; | ||
632 | |||
633 | buf[0] = CMD_DMASTZ; | ||
634 | |||
635 | PL330_DBGCMD_DUMP(SZ_DMASTZ, "\tDMASTZ\n"); | ||
636 | |||
637 | return SZ_DMASTZ; | ||
638 | } | ||
639 | |||
640 | static inline u32 _emit_WFE(unsigned dry_run, u8 buf[], u8 ev, | ||
641 | unsigned invalidate) | ||
642 | { | ||
643 | if (dry_run) | ||
644 | return SZ_DMAWFE; | ||
645 | |||
646 | buf[0] = CMD_DMAWFE; | ||
647 | |||
648 | ev &= 0x1f; | ||
649 | ev <<= 3; | ||
650 | buf[1] = ev; | ||
651 | |||
652 | if (invalidate) | ||
653 | buf[1] |= (1 << 1); | ||
654 | |||
655 | PL330_DBGCMD_DUMP(SZ_DMAWFE, "\tDMAWFE %u%s\n", | ||
656 | ev >> 3, invalidate ? ", I" : ""); | ||
657 | |||
658 | return SZ_DMAWFE; | ||
659 | } | ||
660 | |||
661 | static inline u32 _emit_WFP(unsigned dry_run, u8 buf[], | ||
662 | enum pl330_cond cond, u8 peri) | ||
663 | { | ||
664 | if (dry_run) | ||
665 | return SZ_DMAWFP; | ||
666 | |||
667 | buf[0] = CMD_DMAWFP; | ||
668 | |||
669 | if (cond == SINGLE) | ||
670 | buf[0] |= (0 << 1) | (0 << 0); | ||
671 | else if (cond == BURST) | ||
672 | buf[0] |= (1 << 1) | (0 << 0); | ||
673 | else | ||
674 | buf[0] |= (0 << 1) | (1 << 0); | ||
675 | |||
676 | peri &= 0x1f; | ||
677 | peri <<= 3; | ||
678 | buf[1] = peri; | ||
679 | |||
680 | PL330_DBGCMD_DUMP(SZ_DMAWFP, "\tDMAWFP%c %u\n", | ||
681 | cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'P'), peri >> 3); | ||
682 | |||
683 | return SZ_DMAWFP; | ||
684 | } | ||
685 | |||
686 | static inline u32 _emit_WMB(unsigned dry_run, u8 buf[]) | ||
687 | { | ||
688 | if (dry_run) | ||
689 | return SZ_DMAWMB; | ||
690 | |||
691 | buf[0] = CMD_DMAWMB; | ||
692 | |||
693 | PL330_DBGCMD_DUMP(SZ_DMAWMB, "\tDMAWMB\n"); | ||
694 | |||
695 | return SZ_DMAWMB; | ||
696 | } | ||
697 | |||
698 | struct _arg_GO { | ||
699 | u8 chan; | ||
700 | u32 addr; | ||
701 | unsigned ns; | ||
702 | }; | ||
703 | |||
704 | static inline u32 _emit_GO(unsigned dry_run, u8 buf[], | ||
705 | const struct _arg_GO *arg) | ||
706 | { | ||
707 | u8 chan = arg->chan; | ||
708 | u32 addr = arg->addr; | ||
709 | unsigned ns = arg->ns; | ||
710 | |||
711 | if (dry_run) | ||
712 | return SZ_DMAGO; | ||
713 | |||
714 | buf[0] = CMD_DMAGO; | ||
715 | buf[0] |= (ns << 1); | ||
716 | |||
717 | buf[1] = chan & 0x7; | ||
718 | |||
719 | *((u32 *)&buf[2]) = addr; | ||
720 | |||
721 | return SZ_DMAGO; | ||
722 | } | ||
723 | |||
724 | #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) | ||
725 | |||
726 | /* Returns Time-Out */ | ||
727 | static bool _until_dmac_idle(struct pl330_thread *thrd) | ||
728 | { | ||
729 | void __iomem *regs = thrd->dmac->pinfo->base; | ||
730 | unsigned long loops = msecs_to_loops(5); | ||
731 | |||
732 | do { | ||
733 | /* Until Manager is Idle */ | ||
734 | if (!(readl(regs + DBGSTATUS) & DBG_BUSY)) | ||
735 | break; | ||
736 | |||
737 | cpu_relax(); | ||
738 | } while (--loops); | ||
739 | |||
740 | if (!loops) | ||
741 | return true; | ||
742 | |||
743 | return false; | ||
744 | } | ||
745 | |||
746 | static inline void _execute_DBGINSN(struct pl330_thread *thrd, | ||
747 | u8 insn[], bool as_manager) | ||
748 | { | ||
749 | void __iomem *regs = thrd->dmac->pinfo->base; | ||
750 | u32 val; | ||
751 | |||
752 | val = (insn[0] << 16) | (insn[1] << 24); | ||
753 | if (!as_manager) { | ||
754 | val |= (1 << 0); | ||
755 | val |= (thrd->id << 8); /* Channel Number */ | ||
756 | } | ||
757 | writel(val, regs + DBGINST0); | ||
758 | |||
759 | val = *((u32 *)&insn[2]); | ||
760 | writel(val, regs + DBGINST1); | ||
761 | |||
762 | /* If timed out due to halted state-machine */ | ||
763 | if (_until_dmac_idle(thrd)) { | ||
764 | dev_err(thrd->dmac->pinfo->dev, "DMAC halted!\n"); | ||
765 | return; | ||
766 | } | ||
767 | |||
768 | /* Get going */ | ||
769 | writel(0, regs + DBGCMD); | ||
770 | } | ||
771 | |||
772 | /* | ||
773 | * Mark a _pl330_req as free. | ||
774 | * We do it by writing DMAEND as the first instruction | ||
775 | * because no valid request is going to have DMAEND as | ||
776 | * its first instruction to execute. | ||
777 | */ | ||
778 | static void mark_free(struct pl330_thread *thrd, int idx) | ||
779 | { | ||
780 | struct _pl330_req *req = &thrd->req[idx]; | ||
781 | |||
782 | _emit_END(0, req->mc_cpu); | ||
783 | req->mc_len = 0; | ||
784 | |||
785 | thrd->req_running = -1; | ||
786 | } | ||
787 | |||
788 | static inline u32 _state(struct pl330_thread *thrd) | ||
789 | { | ||
790 | void __iomem *regs = thrd->dmac->pinfo->base; | ||
791 | u32 val; | ||
792 | |||
793 | if (is_manager(thrd)) | ||
794 | val = readl(regs + DS) & 0xf; | ||
795 | else | ||
796 | val = readl(regs + CS(thrd->id)) & 0xf; | ||
797 | |||
798 | switch (val) { | ||
799 | case DS_ST_STOP: | ||
800 | return PL330_STATE_STOPPED; | ||
801 | case DS_ST_EXEC: | ||
802 | return PL330_STATE_EXECUTING; | ||
803 | case DS_ST_CMISS: | ||
804 | return PL330_STATE_CACHEMISS; | ||
805 | case DS_ST_UPDTPC: | ||
806 | return PL330_STATE_UPDTPC; | ||
807 | case DS_ST_WFE: | ||
808 | return PL330_STATE_WFE; | ||
809 | case DS_ST_FAULT: | ||
810 | return PL330_STATE_FAULTING; | ||
811 | case DS_ST_ATBRR: | ||
812 | if (is_manager(thrd)) | ||
813 | return PL330_STATE_INVALID; | ||
814 | else | ||
815 | return PL330_STATE_ATBARRIER; | ||
816 | case DS_ST_QBUSY: | ||
817 | if (is_manager(thrd)) | ||
818 | return PL330_STATE_INVALID; | ||
819 | else | ||
820 | return PL330_STATE_QUEUEBUSY; | ||
821 | case DS_ST_WFP: | ||
822 | if (is_manager(thrd)) | ||
823 | return PL330_STATE_INVALID; | ||
824 | else | ||
825 | return PL330_STATE_WFP; | ||
826 | case DS_ST_KILL: | ||
827 | if (is_manager(thrd)) | ||
828 | return PL330_STATE_INVALID; | ||
829 | else | ||
830 | return PL330_STATE_KILLING; | ||
831 | case DS_ST_CMPLT: | ||
832 | if (is_manager(thrd)) | ||
833 | return PL330_STATE_INVALID; | ||
834 | else | ||
835 | return PL330_STATE_COMPLETING; | ||
836 | case DS_ST_FLTCMP: | ||
837 | if (is_manager(thrd)) | ||
838 | return PL330_STATE_INVALID; | ||
839 | else | ||
840 | return PL330_STATE_FAULT_COMPLETING; | ||
841 | default: | ||
842 | return PL330_STATE_INVALID; | ||
843 | } | ||
844 | } | ||
845 | |||
846 | static void _stop(struct pl330_thread *thrd) | ||
847 | { | ||
848 | void __iomem *regs = thrd->dmac->pinfo->base; | ||
849 | u8 insn[6] = {0, 0, 0, 0, 0, 0}; | ||
850 | |||
851 | if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) | ||
852 | UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); | ||
853 | |||
854 | /* Return if nothing needs to be done */ | ||
855 | if (_state(thrd) == PL330_STATE_COMPLETING | ||
856 | || _state(thrd) == PL330_STATE_KILLING | ||
857 | || _state(thrd) == PL330_STATE_STOPPED) | ||
858 | return; | ||
859 | |||
860 | _emit_KILL(0, insn); | ||
861 | |||
862 | /* Stop generating interrupts for SEV */ | ||
863 | writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN); | ||
864 | |||
865 | _execute_DBGINSN(thrd, insn, is_manager(thrd)); | ||
866 | } | ||
867 | |||
868 | /* Start doing req 'idx' of thread 'thrd' */ | ||
869 | static bool _trigger(struct pl330_thread *thrd) | ||
870 | { | ||
871 | void __iomem *regs = thrd->dmac->pinfo->base; | ||
872 | struct _pl330_req *req; | ||
873 | struct pl330_req *r; | ||
874 | struct _arg_GO go; | ||
875 | unsigned ns; | ||
876 | u8 insn[6] = {0, 0, 0, 0, 0, 0}; | ||
877 | int idx; | ||
878 | |||
879 | /* Return if already ACTIVE */ | ||
880 | if (_state(thrd) != PL330_STATE_STOPPED) | ||
881 | return true; | ||
882 | |||
883 | idx = 1 - thrd->lstenq; | ||
884 | if (!IS_FREE(&thrd->req[idx])) | ||
885 | req = &thrd->req[idx]; | ||
886 | else { | ||
887 | idx = thrd->lstenq; | ||
888 | if (!IS_FREE(&thrd->req[idx])) | ||
889 | req = &thrd->req[idx]; | ||
890 | else | ||
891 | req = NULL; | ||
892 | } | ||
893 | |||
894 | /* Return if no request */ | ||
895 | if (!req || !req->r) | ||
896 | return true; | ||
897 | |||
898 | r = req->r; | ||
899 | |||
900 | if (r->cfg) | ||
901 | ns = r->cfg->nonsecure ? 1 : 0; | ||
902 | else if (readl(regs + CS(thrd->id)) & CS_CNS) | ||
903 | ns = 1; | ||
904 | else | ||
905 | ns = 0; | ||
906 | |||
907 | /* See 'Abort Sources' point-4 at Page 2-25 */ | ||
908 | if (_manager_ns(thrd) && !ns) | ||
909 | dev_info(thrd->dmac->pinfo->dev, "%s:%d Recipe for ABORT!\n", | ||
910 | __func__, __LINE__); | ||
911 | |||
912 | go.chan = thrd->id; | ||
913 | go.addr = req->mc_bus; | ||
914 | go.ns = ns; | ||
915 | _emit_GO(0, insn, &go); | ||
916 | |||
917 | /* Set to generate interrupts for SEV */ | ||
918 | writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN); | ||
919 | |||
920 | /* Only manager can execute GO */ | ||
921 | _execute_DBGINSN(thrd, insn, true); | ||
922 | |||
923 | thrd->req_running = idx; | ||
924 | |||
925 | return true; | ||
926 | } | ||
927 | |||
928 | static bool _start(struct pl330_thread *thrd) | ||
929 | { | ||
930 | switch (_state(thrd)) { | ||
931 | case PL330_STATE_FAULT_COMPLETING: | ||
932 | UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); | ||
933 | |||
934 | if (_state(thrd) == PL330_STATE_KILLING) | ||
935 | UNTIL(thrd, PL330_STATE_STOPPED) | ||
936 | |||
937 | case PL330_STATE_FAULTING: | ||
938 | _stop(thrd); | ||
939 | |||
940 | case PL330_STATE_KILLING: | ||
941 | case PL330_STATE_COMPLETING: | ||
942 | UNTIL(thrd, PL330_STATE_STOPPED) | ||
943 | |||
944 | case PL330_STATE_STOPPED: | ||
945 | return _trigger(thrd); | ||
946 | |||
947 | case PL330_STATE_WFP: | ||
948 | case PL330_STATE_QUEUEBUSY: | ||
949 | case PL330_STATE_ATBARRIER: | ||
950 | case PL330_STATE_UPDTPC: | ||
951 | case PL330_STATE_CACHEMISS: | ||
952 | case PL330_STATE_EXECUTING: | ||
953 | return true; | ||
954 | |||
955 | case PL330_STATE_WFE: /* For RESUME, nothing yet */ | ||
956 | default: | ||
957 | return false; | ||
958 | } | ||
959 | } | ||
960 | |||
961 | static inline int _ldst_memtomem(unsigned dry_run, u8 buf[], | ||
962 | const struct _xfer_spec *pxs, int cyc) | ||
963 | { | ||
964 | int off = 0; | ||
965 | |||
966 | while (cyc--) { | ||
967 | off += _emit_LD(dry_run, &buf[off], ALWAYS); | ||
968 | off += _emit_RMB(dry_run, &buf[off]); | ||
969 | off += _emit_ST(dry_run, &buf[off], ALWAYS); | ||
970 | off += _emit_WMB(dry_run, &buf[off]); | ||
971 | } | ||
972 | |||
973 | return off; | ||
974 | } | ||
975 | |||
976 | static inline int _ldst_devtomem(unsigned dry_run, u8 buf[], | ||
977 | const struct _xfer_spec *pxs, int cyc) | ||
978 | { | ||
979 | int off = 0; | ||
980 | |||
981 | while (cyc--) { | ||
982 | off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->r->peri); | ||
983 | off += _emit_LDP(dry_run, &buf[off], SINGLE, pxs->r->peri); | ||
984 | off += _emit_ST(dry_run, &buf[off], ALWAYS); | ||
985 | off += _emit_FLUSHP(dry_run, &buf[off], pxs->r->peri); | ||
986 | } | ||
987 | |||
988 | return off; | ||
989 | } | ||
990 | |||
991 | static inline int _ldst_memtodev(unsigned dry_run, u8 buf[], | ||
992 | const struct _xfer_spec *pxs, int cyc) | ||
993 | { | ||
994 | int off = 0; | ||
995 | |||
996 | while (cyc--) { | ||
997 | off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->r->peri); | ||
998 | off += _emit_LD(dry_run, &buf[off], ALWAYS); | ||
999 | off += _emit_STP(dry_run, &buf[off], SINGLE, pxs->r->peri); | ||
1000 | off += _emit_FLUSHP(dry_run, &buf[off], pxs->r->peri); | ||
1001 | } | ||
1002 | |||
1003 | return off; | ||
1004 | } | ||
1005 | |||
1006 | static int _bursts(unsigned dry_run, u8 buf[], | ||
1007 | const struct _xfer_spec *pxs, int cyc) | ||
1008 | { | ||
1009 | int off = 0; | ||
1010 | |||
1011 | switch (pxs->r->rqtype) { | ||
1012 | case MEMTODEV: | ||
1013 | off += _ldst_memtodev(dry_run, &buf[off], pxs, cyc); | ||
1014 | break; | ||
1015 | case DEVTOMEM: | ||
1016 | off += _ldst_devtomem(dry_run, &buf[off], pxs, cyc); | ||
1017 | break; | ||
1018 | case MEMTOMEM: | ||
1019 | off += _ldst_memtomem(dry_run, &buf[off], pxs, cyc); | ||
1020 | break; | ||
1021 | default: | ||
1022 | off += 0x40000000; /* Scare off the Client */ | ||
1023 | break; | ||
1024 | } | ||
1025 | |||
1026 | return off; | ||
1027 | } | ||
1028 | |||
1029 | /* Returns bytes consumed and updates bursts */ | ||
1030 | static inline int _loop(unsigned dry_run, u8 buf[], | ||
1031 | unsigned long *bursts, const struct _xfer_spec *pxs) | ||
1032 | { | ||
1033 | int cyc, cycmax, szlp, szlpend, szbrst, off; | ||
1034 | unsigned lcnt0, lcnt1, ljmp0, ljmp1; | ||
1035 | struct _arg_LPEND lpend; | ||
1036 | |||
1037 | /* Max iterations possible in DMALP is 256 */ | ||
1038 | if (*bursts >= 256*256) { | ||
1039 | lcnt1 = 256; | ||
1040 | lcnt0 = 256; | ||
1041 | cyc = *bursts / lcnt1 / lcnt0; | ||
1042 | } else if (*bursts > 256) { | ||
1043 | lcnt1 = 256; | ||
1044 | lcnt0 = *bursts / lcnt1; | ||
1045 | cyc = 1; | ||
1046 | } else { | ||
1047 | lcnt1 = *bursts; | ||
1048 | lcnt0 = 0; | ||
1049 | cyc = 1; | ||
1050 | } | ||
1051 | |||
1052 | szlp = _emit_LP(1, buf, 0, 0); | ||
1053 | szbrst = _bursts(1, buf, pxs, 1); | ||
1054 | |||
1055 | lpend.cond = ALWAYS; | ||
1056 | lpend.forever = false; | ||
1057 | lpend.loop = 0; | ||
1058 | lpend.bjump = 0; | ||
1059 | szlpend = _emit_LPEND(1, buf, &lpend); | ||
1060 | |||
1061 | if (lcnt0) { | ||
1062 | szlp *= 2; | ||
1063 | szlpend *= 2; | ||
1064 | } | ||
1065 | |||
1066 | /* | ||
1067 | * Max bursts that we can unroll due to limit on the | ||
1068 | * size of backward jump that can be encoded in DMALPEND | ||
1069 | * which is 8-bits and hence 255 | ||
1070 | */ | ||
1071 | cycmax = (255 - (szlp + szlpend)) / szbrst; | ||
1072 | |||
1073 | cyc = (cycmax < cyc) ? cycmax : cyc; | ||
1074 | |||
1075 | off = 0; | ||
1076 | |||
1077 | if (lcnt0) { | ||
1078 | off += _emit_LP(dry_run, &buf[off], 0, lcnt0); | ||
1079 | ljmp0 = off; | ||
1080 | } | ||
1081 | |||
1082 | off += _emit_LP(dry_run, &buf[off], 1, lcnt1); | ||
1083 | ljmp1 = off; | ||
1084 | |||
1085 | off += _bursts(dry_run, &buf[off], pxs, cyc); | ||
1086 | |||
1087 | lpend.cond = ALWAYS; | ||
1088 | lpend.forever = false; | ||
1089 | lpend.loop = 1; | ||
1090 | lpend.bjump = off - ljmp1; | ||
1091 | off += _emit_LPEND(dry_run, &buf[off], &lpend); | ||
1092 | |||
1093 | if (lcnt0) { | ||
1094 | lpend.cond = ALWAYS; | ||
1095 | lpend.forever = false; | ||
1096 | lpend.loop = 0; | ||
1097 | lpend.bjump = off - ljmp0; | ||
1098 | off += _emit_LPEND(dry_run, &buf[off], &lpend); | ||
1099 | } | ||
1100 | |||
1101 | *bursts = lcnt1 * cyc; | ||
1102 | if (lcnt0) | ||
1103 | *bursts *= lcnt0; | ||
1104 | |||
1105 | return off; | ||
1106 | } | ||
1107 | |||
1108 | static inline int _setup_loops(unsigned dry_run, u8 buf[], | ||
1109 | const struct _xfer_spec *pxs) | ||
1110 | { | ||
1111 | struct pl330_xfer *x = pxs->x; | ||
1112 | u32 ccr = pxs->ccr; | ||
1113 | unsigned long c, bursts = BYTE_TO_BURST(x->bytes, ccr); | ||
1114 | int off = 0; | ||
1115 | |||
1116 | while (bursts) { | ||
1117 | c = bursts; | ||
1118 | off += _loop(dry_run, &buf[off], &c, pxs); | ||
1119 | bursts -= c; | ||
1120 | } | ||
1121 | |||
1122 | return off; | ||
1123 | } | ||
1124 | |||
1125 | static inline int _setup_xfer(unsigned dry_run, u8 buf[], | ||
1126 | const struct _xfer_spec *pxs) | ||
1127 | { | ||
1128 | struct pl330_xfer *x = pxs->x; | ||
1129 | int off = 0; | ||
1130 | |||
1131 | /* DMAMOV SAR, x->src_addr */ | ||
1132 | off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr); | ||
1133 | /* DMAMOV DAR, x->dst_addr */ | ||
1134 | off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr); | ||
1135 | |||
1136 | /* Setup Loop(s) */ | ||
1137 | off += _setup_loops(dry_run, &buf[off], pxs); | ||
1138 | |||
1139 | return off; | ||
1140 | } | ||
1141 | |||
1142 | /* | ||
1143 | * A req is a sequence of one or more xfer units. | ||
1144 | * Returns the number of bytes taken to setup the MC for the req. | ||
1145 | */ | ||
1146 | static int _setup_req(unsigned dry_run, struct pl330_thread *thrd, | ||
1147 | unsigned index, struct _xfer_spec *pxs) | ||
1148 | { | ||
1149 | struct _pl330_req *req = &thrd->req[index]; | ||
1150 | struct pl330_xfer *x; | ||
1151 | u8 *buf = req->mc_cpu; | ||
1152 | int off = 0; | ||
1153 | |||
1154 | PL330_DBGMC_START(req->mc_bus); | ||
1155 | |||
1156 | /* DMAMOV CCR, ccr */ | ||
1157 | off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr); | ||
1158 | |||
1159 | x = pxs->r->x; | ||
1160 | do { | ||
1161 | /* Error if xfer length is not aligned at burst size */ | ||
1162 | if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr))) | ||
1163 | return -EINVAL; | ||
1164 | |||
1165 | pxs->x = x; | ||
1166 | off += _setup_xfer(dry_run, &buf[off], pxs); | ||
1167 | |||
1168 | x = x->next; | ||
1169 | } while (x); | ||
1170 | |||
1171 | /* DMASEV peripheral/event */ | ||
1172 | off += _emit_SEV(dry_run, &buf[off], thrd->ev); | ||
1173 | /* DMAEND */ | ||
1174 | off += _emit_END(dry_run, &buf[off]); | ||
1175 | |||
1176 | return off; | ||
1177 | } | ||
1178 | |||
1179 | static inline u32 _prepare_ccr(const struct pl330_reqcfg *rqc) | ||
1180 | { | ||
1181 | u32 ccr = 0; | ||
1182 | |||
1183 | if (rqc->src_inc) | ||
1184 | ccr |= CC_SRCINC; | ||
1185 | |||
1186 | if (rqc->dst_inc) | ||
1187 | ccr |= CC_DSTINC; | ||
1188 | |||
1189 | /* We set same protection levels for Src and DST for now */ | ||
1190 | if (rqc->privileged) | ||
1191 | ccr |= CC_SRCPRI | CC_DSTPRI; | ||
1192 | if (rqc->nonsecure) | ||
1193 | ccr |= CC_SRCNS | CC_DSTNS; | ||
1194 | if (rqc->insnaccess) | ||
1195 | ccr |= CC_SRCIA | CC_DSTIA; | ||
1196 | |||
1197 | ccr |= (((rqc->brst_len - 1) & 0xf) << CC_SRCBRSTLEN_SHFT); | ||
1198 | ccr |= (((rqc->brst_len - 1) & 0xf) << CC_DSTBRSTLEN_SHFT); | ||
1199 | |||
1200 | ccr |= (rqc->brst_size << CC_SRCBRSTSIZE_SHFT); | ||
1201 | ccr |= (rqc->brst_size << CC_DSTBRSTSIZE_SHFT); | ||
1202 | |||
1203 | ccr |= (rqc->scctl << CC_SRCCCTRL_SHFT); | ||
1204 | ccr |= (rqc->dcctl << CC_DSTCCTRL_SHFT); | ||
1205 | |||
1206 | ccr |= (rqc->swap << CC_SWAP_SHFT); | ||
1207 | |||
1208 | return ccr; | ||
1209 | } | ||
1210 | |||
1211 | static inline bool _is_valid(u32 ccr) | ||
1212 | { | ||
1213 | enum pl330_dstcachectrl dcctl; | ||
1214 | enum pl330_srccachectrl scctl; | ||
1215 | |||
1216 | dcctl = (ccr >> CC_DSTCCTRL_SHFT) & CC_DRCCCTRL_MASK; | ||
1217 | scctl = (ccr >> CC_SRCCCTRL_SHFT) & CC_SRCCCTRL_MASK; | ||
1218 | |||
1219 | if (dcctl == DINVALID1 || dcctl == DINVALID2 | ||
1220 | || scctl == SINVALID1 || scctl == SINVALID2) | ||
1221 | return false; | ||
1222 | else | ||
1223 | return true; | ||
1224 | } | ||
1225 | |||
1226 | /* | ||
1227 | * Submit a list of xfers after which the client wants notification. | ||
1228 | * Client is not notified after each xfer unit, just once after all | ||
1229 | * xfer units are done or some error occurs. | ||
1230 | */ | ||
1231 | int pl330_submit_req(void *ch_id, struct pl330_req *r) | ||
1232 | { | ||
1233 | struct pl330_thread *thrd = ch_id; | ||
1234 | struct pl330_dmac *pl330; | ||
1235 | struct pl330_info *pi; | ||
1236 | struct _xfer_spec xs; | ||
1237 | unsigned long flags; | ||
1238 | void __iomem *regs; | ||
1239 | unsigned idx; | ||
1240 | u32 ccr; | ||
1241 | int ret = 0; | ||
1242 | |||
1243 | /* No Req or Unacquired Channel or DMAC */ | ||
1244 | if (!r || !thrd || thrd->free) | ||
1245 | return -EINVAL; | ||
1246 | |||
1247 | pl330 = thrd->dmac; | ||
1248 | pi = pl330->pinfo; | ||
1249 | regs = pi->base; | ||
1250 | |||
1251 | if (pl330->state == DYING | ||
1252 | || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) { | ||
1253 | dev_info(thrd->dmac->pinfo->dev, "%s:%d\n", | ||
1254 | __func__, __LINE__); | ||
1255 | return -EAGAIN; | ||
1256 | } | ||
1257 | |||
1258 | /* If request for non-existing peripheral */ | ||
1259 | if (r->rqtype != MEMTOMEM && r->peri >= pi->pcfg.num_peri) { | ||
1260 | dev_info(thrd->dmac->pinfo->dev, | ||
1261 | "%s:%d Invalid peripheral(%u)!\n", | ||
1262 | __func__, __LINE__, r->peri); | ||
1263 | return -EINVAL; | ||
1264 | } | ||
1265 | |||
1266 | spin_lock_irqsave(&pl330->lock, flags); | ||
1267 | |||
1268 | if (_queue_full(thrd)) { | ||
1269 | ret = -EAGAIN; | ||
1270 | goto xfer_exit; | ||
1271 | } | ||
1272 | |||
1273 | /* Prefer Secure Channel */ | ||
1274 | if (!_manager_ns(thrd)) | ||
1275 | r->cfg->nonsecure = 0; | ||
1276 | else | ||
1277 | r->cfg->nonsecure = 1; | ||
1278 | |||
1279 | /* Use last settings, if not provided */ | ||
1280 | if (r->cfg) | ||
1281 | ccr = _prepare_ccr(r->cfg); | ||
1282 | else | ||
1283 | ccr = readl(regs + CC(thrd->id)); | ||
1284 | |||
1285 | /* If this req doesn't have valid xfer settings */ | ||
1286 | if (!_is_valid(ccr)) { | ||
1287 | ret = -EINVAL; | ||
1288 | dev_info(thrd->dmac->pinfo->dev, "%s:%d Invalid CCR(%x)!\n", | ||
1289 | __func__, __LINE__, ccr); | ||
1290 | goto xfer_exit; | ||
1291 | } | ||
1292 | |||
1293 | idx = IS_FREE(&thrd->req[0]) ? 0 : 1; | ||
1294 | |||
1295 | xs.ccr = ccr; | ||
1296 | xs.r = r; | ||
1297 | |||
1298 | /* First dry run to check if req is acceptable */ | ||
1299 | ret = _setup_req(1, thrd, idx, &xs); | ||
1300 | if (ret < 0) | ||
1301 | goto xfer_exit; | ||
1302 | |||
1303 | if (ret > pi->mcbufsz / 2) { | ||
1304 | dev_info(thrd->dmac->pinfo->dev, | ||
1305 | "%s:%d Trying increasing mcbufsz\n", | ||
1306 | __func__, __LINE__); | ||
1307 | ret = -ENOMEM; | ||
1308 | goto xfer_exit; | ||
1309 | } | ||
1310 | |||
1311 | /* Hook the request */ | ||
1312 | thrd->lstenq = idx; | ||
1313 | thrd->req[idx].mc_len = _setup_req(0, thrd, idx, &xs); | ||
1314 | thrd->req[idx].r = r; | ||
1315 | |||
1316 | ret = 0; | ||
1317 | |||
1318 | xfer_exit: | ||
1319 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1320 | |||
1321 | return ret; | ||
1322 | } | ||
1323 | EXPORT_SYMBOL(pl330_submit_req); | ||
1324 | |||
1325 | static void pl330_dotask(unsigned long data) | ||
1326 | { | ||
1327 | struct pl330_dmac *pl330 = (struct pl330_dmac *) data; | ||
1328 | struct pl330_info *pi = pl330->pinfo; | ||
1329 | unsigned long flags; | ||
1330 | int i; | ||
1331 | |||
1332 | spin_lock_irqsave(&pl330->lock, flags); | ||
1333 | |||
1334 | /* The DMAC itself gone nuts */ | ||
1335 | if (pl330->dmac_tbd.reset_dmac) { | ||
1336 | pl330->state = DYING; | ||
1337 | /* Reset the manager too */ | ||
1338 | pl330->dmac_tbd.reset_mngr = true; | ||
1339 | /* Clear the reset flag */ | ||
1340 | pl330->dmac_tbd.reset_dmac = false; | ||
1341 | } | ||
1342 | |||
1343 | if (pl330->dmac_tbd.reset_mngr) { | ||
1344 | _stop(pl330->manager); | ||
1345 | /* Reset all channels */ | ||
1346 | pl330->dmac_tbd.reset_chan = (1 << pi->pcfg.num_chan) - 1; | ||
1347 | /* Clear the reset flag */ | ||
1348 | pl330->dmac_tbd.reset_mngr = false; | ||
1349 | } | ||
1350 | |||
1351 | for (i = 0; i < pi->pcfg.num_chan; i++) { | ||
1352 | |||
1353 | if (pl330->dmac_tbd.reset_chan & (1 << i)) { | ||
1354 | struct pl330_thread *thrd = &pl330->channels[i]; | ||
1355 | void __iomem *regs = pi->base; | ||
1356 | enum pl330_op_err err; | ||
1357 | |||
1358 | _stop(thrd); | ||
1359 | |||
1360 | if (readl(regs + FSC) & (1 << thrd->id)) | ||
1361 | err = PL330_ERR_FAIL; | ||
1362 | else | ||
1363 | err = PL330_ERR_ABORT; | ||
1364 | |||
1365 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1366 | |||
1367 | _callback(thrd->req[1 - thrd->lstenq].r, err); | ||
1368 | _callback(thrd->req[thrd->lstenq].r, err); | ||
1369 | |||
1370 | spin_lock_irqsave(&pl330->lock, flags); | ||
1371 | |||
1372 | thrd->req[0].r = NULL; | ||
1373 | thrd->req[1].r = NULL; | ||
1374 | mark_free(thrd, 0); | ||
1375 | mark_free(thrd, 1); | ||
1376 | |||
1377 | /* Clear the reset flag */ | ||
1378 | pl330->dmac_tbd.reset_chan &= ~(1 << i); | ||
1379 | } | ||
1380 | } | ||
1381 | |||
1382 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1383 | |||
1384 | return; | ||
1385 | } | ||
1386 | |||
1387 | /* Returns 1 if state was updated, 0 otherwise */ | ||
1388 | int pl330_update(const struct pl330_info *pi) | ||
1389 | { | ||
1390 | struct _pl330_req *rqdone; | ||
1391 | struct pl330_dmac *pl330; | ||
1392 | unsigned long flags; | ||
1393 | void __iomem *regs; | ||
1394 | u32 val; | ||
1395 | int id, ev, ret = 0; | ||
1396 | |||
1397 | if (!pi || !pi->pl330_data) | ||
1398 | return 0; | ||
1399 | |||
1400 | regs = pi->base; | ||
1401 | pl330 = pi->pl330_data; | ||
1402 | |||
1403 | spin_lock_irqsave(&pl330->lock, flags); | ||
1404 | |||
1405 | val = readl(regs + FSM) & 0x1; | ||
1406 | if (val) | ||
1407 | pl330->dmac_tbd.reset_mngr = true; | ||
1408 | else | ||
1409 | pl330->dmac_tbd.reset_mngr = false; | ||
1410 | |||
1411 | val = readl(regs + FSC) & ((1 << pi->pcfg.num_chan) - 1); | ||
1412 | pl330->dmac_tbd.reset_chan |= val; | ||
1413 | if (val) { | ||
1414 | int i = 0; | ||
1415 | while (i < pi->pcfg.num_chan) { | ||
1416 | if (val & (1 << i)) { | ||
1417 | dev_info(pi->dev, | ||
1418 | "Reset Channel-%d\t CS-%x FTC-%x\n", | ||
1419 | i, readl(regs + CS(i)), | ||
1420 | readl(regs + FTC(i))); | ||
1421 | _stop(&pl330->channels[i]); | ||
1422 | } | ||
1423 | i++; | ||
1424 | } | ||
1425 | } | ||
1426 | |||
1427 | /* Check which event happened i.e, thread notified */ | ||
1428 | val = readl(regs + ES); | ||
1429 | if (pi->pcfg.num_events < 32 | ||
1430 | && val & ~((1 << pi->pcfg.num_events) - 1)) { | ||
1431 | pl330->dmac_tbd.reset_dmac = true; | ||
1432 | dev_err(pi->dev, "%s:%d Unexpected!\n", __func__, __LINE__); | ||
1433 | ret = 1; | ||
1434 | goto updt_exit; | ||
1435 | } | ||
1436 | |||
1437 | for (ev = 0; ev < pi->pcfg.num_events; ev++) { | ||
1438 | if (val & (1 << ev)) { /* Event occurred */ | ||
1439 | struct pl330_thread *thrd; | ||
1440 | u32 inten = readl(regs + INTEN); | ||
1441 | int active; | ||
1442 | |||
1443 | /* Clear the event */ | ||
1444 | if (inten & (1 << ev)) | ||
1445 | writel(1 << ev, regs + INTCLR); | ||
1446 | |||
1447 | ret = 1; | ||
1448 | |||
1449 | id = pl330->events[ev]; | ||
1450 | |||
1451 | thrd = &pl330->channels[id]; | ||
1452 | |||
1453 | active = thrd->req_running; | ||
1454 | if (active == -1) /* Aborted */ | ||
1455 | continue; | ||
1456 | |||
1457 | rqdone = &thrd->req[active]; | ||
1458 | mark_free(thrd, active); | ||
1459 | |||
1460 | /* Get going again ASAP */ | ||
1461 | _start(thrd); | ||
1462 | |||
1463 | /* For now, just make a list of callbacks to be done */ | ||
1464 | list_add_tail(&rqdone->rqd, &pl330->req_done); | ||
1465 | } | ||
1466 | } | ||
1467 | |||
1468 | /* Now that we are in no hurry, do the callbacks */ | ||
1469 | while (!list_empty(&pl330->req_done)) { | ||
1470 | struct pl330_req *r; | ||
1471 | |||
1472 | rqdone = container_of(pl330->req_done.next, | ||
1473 | struct _pl330_req, rqd); | ||
1474 | |||
1475 | list_del_init(&rqdone->rqd); | ||
1476 | |||
1477 | /* Detach the req */ | ||
1478 | r = rqdone->r; | ||
1479 | rqdone->r = NULL; | ||
1480 | |||
1481 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1482 | _callback(r, PL330_ERR_NONE); | ||
1483 | spin_lock_irqsave(&pl330->lock, flags); | ||
1484 | } | ||
1485 | |||
1486 | updt_exit: | ||
1487 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1488 | |||
1489 | if (pl330->dmac_tbd.reset_dmac | ||
1490 | || pl330->dmac_tbd.reset_mngr | ||
1491 | || pl330->dmac_tbd.reset_chan) { | ||
1492 | ret = 1; | ||
1493 | tasklet_schedule(&pl330->tasks); | ||
1494 | } | ||
1495 | |||
1496 | return ret; | ||
1497 | } | ||
1498 | EXPORT_SYMBOL(pl330_update); | ||
1499 | |||
1500 | int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op) | ||
1501 | { | ||
1502 | struct pl330_thread *thrd = ch_id; | ||
1503 | struct pl330_dmac *pl330; | ||
1504 | unsigned long flags; | ||
1505 | int ret = 0, active; | ||
1506 | |||
1507 | if (!thrd || thrd->free || thrd->dmac->state == DYING) | ||
1508 | return -EINVAL; | ||
1509 | |||
1510 | pl330 = thrd->dmac; | ||
1511 | active = thrd->req_running; | ||
1512 | |||
1513 | spin_lock_irqsave(&pl330->lock, flags); | ||
1514 | |||
1515 | switch (op) { | ||
1516 | case PL330_OP_FLUSH: | ||
1517 | /* Make sure the channel is stopped */ | ||
1518 | _stop(thrd); | ||
1519 | |||
1520 | thrd->req[0].r = NULL; | ||
1521 | thrd->req[1].r = NULL; | ||
1522 | mark_free(thrd, 0); | ||
1523 | mark_free(thrd, 1); | ||
1524 | break; | ||
1525 | |||
1526 | case PL330_OP_ABORT: | ||
1527 | /* Make sure the channel is stopped */ | ||
1528 | _stop(thrd); | ||
1529 | |||
1530 | /* ABORT is only for the active req */ | ||
1531 | if (active == -1) | ||
1532 | break; | ||
1533 | |||
1534 | thrd->req[active].r = NULL; | ||
1535 | mark_free(thrd, active); | ||
1536 | |||
1537 | /* Start the next */ | ||
1538 | case PL330_OP_START: | ||
1539 | if ((active == -1) && !_start(thrd)) | ||
1540 | ret = -EIO; | ||
1541 | break; | ||
1542 | |||
1543 | default: | ||
1544 | ret = -EINVAL; | ||
1545 | } | ||
1546 | |||
1547 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1548 | return ret; | ||
1549 | } | ||
1550 | EXPORT_SYMBOL(pl330_chan_ctrl); | ||
1551 | |||
1552 | int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus) | ||
1553 | { | ||
1554 | struct pl330_thread *thrd = ch_id; | ||
1555 | struct pl330_dmac *pl330; | ||
1556 | struct pl330_info *pi; | ||
1557 | void __iomem *regs; | ||
1558 | int active; | ||
1559 | u32 val; | ||
1560 | |||
1561 | if (!pstatus || !thrd || thrd->free) | ||
1562 | return -EINVAL; | ||
1563 | |||
1564 | pl330 = thrd->dmac; | ||
1565 | pi = pl330->pinfo; | ||
1566 | regs = pi->base; | ||
1567 | |||
1568 | /* The client should remove the DMAC and add again */ | ||
1569 | if (pl330->state == DYING) | ||
1570 | pstatus->dmac_halted = true; | ||
1571 | else | ||
1572 | pstatus->dmac_halted = false; | ||
1573 | |||
1574 | val = readl(regs + FSC); | ||
1575 | if (val & (1 << thrd->id)) | ||
1576 | pstatus->faulting = true; | ||
1577 | else | ||
1578 | pstatus->faulting = false; | ||
1579 | |||
1580 | active = thrd->req_running; | ||
1581 | |||
1582 | if (active == -1) { | ||
1583 | /* Indicate that the thread is not running */ | ||
1584 | pstatus->top_req = NULL; | ||
1585 | pstatus->wait_req = NULL; | ||
1586 | } else { | ||
1587 | pstatus->top_req = thrd->req[active].r; | ||
1588 | pstatus->wait_req = !IS_FREE(&thrd->req[1 - active]) | ||
1589 | ? thrd->req[1 - active].r : NULL; | ||
1590 | } | ||
1591 | |||
1592 | pstatus->src_addr = readl(regs + SA(thrd->id)); | ||
1593 | pstatus->dst_addr = readl(regs + DA(thrd->id)); | ||
1594 | |||
1595 | return 0; | ||
1596 | } | ||
1597 | EXPORT_SYMBOL(pl330_chan_status); | ||
1598 | |||
1599 | /* Reserve an event */ | ||
1600 | static inline int _alloc_event(struct pl330_thread *thrd) | ||
1601 | { | ||
1602 | struct pl330_dmac *pl330 = thrd->dmac; | ||
1603 | struct pl330_info *pi = pl330->pinfo; | ||
1604 | int ev; | ||
1605 | |||
1606 | for (ev = 0; ev < pi->pcfg.num_events; ev++) | ||
1607 | if (pl330->events[ev] == -1) { | ||
1608 | pl330->events[ev] = thrd->id; | ||
1609 | return ev; | ||
1610 | } | ||
1611 | |||
1612 | return -1; | ||
1613 | } | ||
1614 | |||
1615 | static bool _chan_ns(const struct pl330_info *pi, int i) | ||
1616 | { | ||
1617 | return pi->pcfg.irq_ns & (1 << i); | ||
1618 | } | ||
1619 | |||
1620 | /* Upon success, returns IdentityToken for the | ||
1621 | * allocated channel, NULL otherwise. | ||
1622 | */ | ||
1623 | void *pl330_request_channel(const struct pl330_info *pi) | ||
1624 | { | ||
1625 | struct pl330_thread *thrd = NULL; | ||
1626 | struct pl330_dmac *pl330; | ||
1627 | unsigned long flags; | ||
1628 | int chans, i; | ||
1629 | |||
1630 | if (!pi || !pi->pl330_data) | ||
1631 | return NULL; | ||
1632 | |||
1633 | pl330 = pi->pl330_data; | ||
1634 | |||
1635 | if (pl330->state == DYING) | ||
1636 | return NULL; | ||
1637 | |||
1638 | chans = pi->pcfg.num_chan; | ||
1639 | |||
1640 | spin_lock_irqsave(&pl330->lock, flags); | ||
1641 | |||
1642 | for (i = 0; i < chans; i++) { | ||
1643 | thrd = &pl330->channels[i]; | ||
1644 | if ((thrd->free) && (!_manager_ns(thrd) || | ||
1645 | _chan_ns(pi, i))) { | ||
1646 | thrd->ev = _alloc_event(thrd); | ||
1647 | if (thrd->ev >= 0) { | ||
1648 | thrd->free = false; | ||
1649 | thrd->lstenq = 1; | ||
1650 | thrd->req[0].r = NULL; | ||
1651 | mark_free(thrd, 0); | ||
1652 | thrd->req[1].r = NULL; | ||
1653 | mark_free(thrd, 1); | ||
1654 | break; | ||
1655 | } | ||
1656 | } | ||
1657 | thrd = NULL; | ||
1658 | } | ||
1659 | |||
1660 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1661 | |||
1662 | return thrd; | ||
1663 | } | ||
1664 | EXPORT_SYMBOL(pl330_request_channel); | ||
1665 | |||
1666 | /* Release an event */ | ||
1667 | static inline void _free_event(struct pl330_thread *thrd, int ev) | ||
1668 | { | ||
1669 | struct pl330_dmac *pl330 = thrd->dmac; | ||
1670 | struct pl330_info *pi = pl330->pinfo; | ||
1671 | |||
1672 | /* If the event is valid and was held by the thread */ | ||
1673 | if (ev >= 0 && ev < pi->pcfg.num_events | ||
1674 | && pl330->events[ev] == thrd->id) | ||
1675 | pl330->events[ev] = -1; | ||
1676 | } | ||
1677 | |||
1678 | void pl330_release_channel(void *ch_id) | ||
1679 | { | ||
1680 | struct pl330_thread *thrd = ch_id; | ||
1681 | struct pl330_dmac *pl330; | ||
1682 | unsigned long flags; | ||
1683 | |||
1684 | if (!thrd || thrd->free) | ||
1685 | return; | ||
1686 | |||
1687 | _stop(thrd); | ||
1688 | |||
1689 | _callback(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT); | ||
1690 | _callback(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT); | ||
1691 | |||
1692 | pl330 = thrd->dmac; | ||
1693 | |||
1694 | spin_lock_irqsave(&pl330->lock, flags); | ||
1695 | _free_event(thrd, thrd->ev); | ||
1696 | thrd->free = true; | ||
1697 | spin_unlock_irqrestore(&pl330->lock, flags); | ||
1698 | } | ||
1699 | EXPORT_SYMBOL(pl330_release_channel); | ||
1700 | |||
1701 | /* Initialize the structure for PL330 configuration, that can be used | ||
1702 | * by the client driver the make best use of the DMAC | ||
1703 | */ | ||
1704 | static void read_dmac_config(struct pl330_info *pi) | ||
1705 | { | ||
1706 | void __iomem *regs = pi->base; | ||
1707 | u32 val; | ||
1708 | |||
1709 | val = readl(regs + CRD) >> CRD_DATA_WIDTH_SHIFT; | ||
1710 | val &= CRD_DATA_WIDTH_MASK; | ||
1711 | pi->pcfg.data_bus_width = 8 * (1 << val); | ||
1712 | |||
1713 | val = readl(regs + CRD) >> CRD_DATA_BUFF_SHIFT; | ||
1714 | val &= CRD_DATA_BUFF_MASK; | ||
1715 | pi->pcfg.data_buf_dep = val + 1; | ||
1716 | |||
1717 | val = readl(regs + CR0) >> CR0_NUM_CHANS_SHIFT; | ||
1718 | val &= CR0_NUM_CHANS_MASK; | ||
1719 | val += 1; | ||
1720 | pi->pcfg.num_chan = val; | ||
1721 | |||
1722 | val = readl(regs + CR0); | ||
1723 | if (val & CR0_PERIPH_REQ_SET) { | ||
1724 | val = (val >> CR0_NUM_PERIPH_SHIFT) & CR0_NUM_PERIPH_MASK; | ||
1725 | val += 1; | ||
1726 | pi->pcfg.num_peri = val; | ||
1727 | pi->pcfg.peri_ns = readl(regs + CR4); | ||
1728 | } else { | ||
1729 | pi->pcfg.num_peri = 0; | ||
1730 | } | ||
1731 | |||
1732 | val = readl(regs + CR0); | ||
1733 | if (val & CR0_BOOT_MAN_NS) | ||
1734 | pi->pcfg.mode |= DMAC_MODE_NS; | ||
1735 | else | ||
1736 | pi->pcfg.mode &= ~DMAC_MODE_NS; | ||
1737 | |||
1738 | val = readl(regs + CR0) >> CR0_NUM_EVENTS_SHIFT; | ||
1739 | val &= CR0_NUM_EVENTS_MASK; | ||
1740 | val += 1; | ||
1741 | pi->pcfg.num_events = val; | ||
1742 | |||
1743 | pi->pcfg.irq_ns = readl(regs + CR3); | ||
1744 | |||
1745 | pi->pcfg.periph_id = get_id(pi, PERIPH_ID); | ||
1746 | pi->pcfg.pcell_id = get_id(pi, PCELL_ID); | ||
1747 | } | ||
1748 | |||
1749 | static inline void _reset_thread(struct pl330_thread *thrd) | ||
1750 | { | ||
1751 | struct pl330_dmac *pl330 = thrd->dmac; | ||
1752 | struct pl330_info *pi = pl330->pinfo; | ||
1753 | |||
1754 | thrd->req[0].mc_cpu = pl330->mcode_cpu | ||
1755 | + (thrd->id * pi->mcbufsz); | ||
1756 | thrd->req[0].mc_bus = pl330->mcode_bus | ||
1757 | + (thrd->id * pi->mcbufsz); | ||
1758 | thrd->req[0].r = NULL; | ||
1759 | mark_free(thrd, 0); | ||
1760 | |||
1761 | thrd->req[1].mc_cpu = thrd->req[0].mc_cpu | ||
1762 | + pi->mcbufsz / 2; | ||
1763 | thrd->req[1].mc_bus = thrd->req[0].mc_bus | ||
1764 | + pi->mcbufsz / 2; | ||
1765 | thrd->req[1].r = NULL; | ||
1766 | mark_free(thrd, 1); | ||
1767 | } | ||
1768 | |||
1769 | static int dmac_alloc_threads(struct pl330_dmac *pl330) | ||
1770 | { | ||
1771 | struct pl330_info *pi = pl330->pinfo; | ||
1772 | int chans = pi->pcfg.num_chan; | ||
1773 | struct pl330_thread *thrd; | ||
1774 | int i; | ||
1775 | |||
1776 | /* Allocate 1 Manager and 'chans' Channel threads */ | ||
1777 | pl330->channels = kzalloc((1 + chans) * sizeof(*thrd), | ||
1778 | GFP_KERNEL); | ||
1779 | if (!pl330->channels) | ||
1780 | return -ENOMEM; | ||
1781 | |||
1782 | /* Init Channel threads */ | ||
1783 | for (i = 0; i < chans; i++) { | ||
1784 | thrd = &pl330->channels[i]; | ||
1785 | thrd->id = i; | ||
1786 | thrd->dmac = pl330; | ||
1787 | _reset_thread(thrd); | ||
1788 | thrd->free = true; | ||
1789 | } | ||
1790 | |||
1791 | /* MANAGER is indexed at the end */ | ||
1792 | thrd = &pl330->channels[chans]; | ||
1793 | thrd->id = chans; | ||
1794 | thrd->dmac = pl330; | ||
1795 | thrd->free = false; | ||
1796 | pl330->manager = thrd; | ||
1797 | |||
1798 | return 0; | ||
1799 | } | ||
1800 | |||
1801 | static int dmac_alloc_resources(struct pl330_dmac *pl330) | ||
1802 | { | ||
1803 | struct pl330_info *pi = pl330->pinfo; | ||
1804 | int chans = pi->pcfg.num_chan; | ||
1805 | int ret; | ||
1806 | |||
1807 | /* | ||
1808 | * Alloc MicroCode buffer for 'chans' Channel threads. | ||
1809 | * A channel's buffer offset is (Channel_Id * MCODE_BUFF_PERCHAN) | ||
1810 | */ | ||
1811 | pl330->mcode_cpu = dma_alloc_coherent(pi->dev, | ||
1812 | chans * pi->mcbufsz, | ||
1813 | &pl330->mcode_bus, GFP_KERNEL); | ||
1814 | if (!pl330->mcode_cpu) { | ||
1815 | dev_err(pi->dev, "%s:%d Can't allocate memory!\n", | ||
1816 | __func__, __LINE__); | ||
1817 | return -ENOMEM; | ||
1818 | } | ||
1819 | |||
1820 | ret = dmac_alloc_threads(pl330); | ||
1821 | if (ret) { | ||
1822 | dev_err(pi->dev, "%s:%d Can't to create channels for DMAC!\n", | ||
1823 | __func__, __LINE__); | ||
1824 | dma_free_coherent(pi->dev, | ||
1825 | chans * pi->mcbufsz, | ||
1826 | pl330->mcode_cpu, pl330->mcode_bus); | ||
1827 | return ret; | ||
1828 | } | ||
1829 | |||
1830 | return 0; | ||
1831 | } | ||
1832 | |||
1833 | int pl330_add(struct pl330_info *pi) | ||
1834 | { | ||
1835 | struct pl330_dmac *pl330; | ||
1836 | void __iomem *regs; | ||
1837 | int i, ret; | ||
1838 | |||
1839 | if (!pi || !pi->dev) | ||
1840 | return -EINVAL; | ||
1841 | |||
1842 | /* If already added */ | ||
1843 | if (pi->pl330_data) | ||
1844 | return -EINVAL; | ||
1845 | |||
1846 | /* | ||
1847 | * If the SoC can perform reset on the DMAC, then do it | ||
1848 | * before reading its configuration. | ||
1849 | */ | ||
1850 | if (pi->dmac_reset) | ||
1851 | pi->dmac_reset(pi); | ||
1852 | |||
1853 | regs = pi->base; | ||
1854 | |||
1855 | /* Check if we can handle this DMAC */ | ||
1856 | if ((get_id(pi, PERIPH_ID) & 0xfffff) != PERIPH_ID_VAL | ||
1857 | || get_id(pi, PCELL_ID) != PCELL_ID_VAL) { | ||
1858 | dev_err(pi->dev, "PERIPH_ID 0x%x, PCELL_ID 0x%x !\n", | ||
1859 | get_id(pi, PERIPH_ID), get_id(pi, PCELL_ID)); | ||
1860 | return -EINVAL; | ||
1861 | } | ||
1862 | |||
1863 | /* Read the configuration of the DMAC */ | ||
1864 | read_dmac_config(pi); | ||
1865 | |||
1866 | if (pi->pcfg.num_events == 0) { | ||
1867 | dev_err(pi->dev, "%s:%d Can't work without events!\n", | ||
1868 | __func__, __LINE__); | ||
1869 | return -EINVAL; | ||
1870 | } | ||
1871 | |||
1872 | pl330 = kzalloc(sizeof(*pl330), GFP_KERNEL); | ||
1873 | if (!pl330) { | ||
1874 | dev_err(pi->dev, "%s:%d Can't allocate memory!\n", | ||
1875 | __func__, __LINE__); | ||
1876 | return -ENOMEM; | ||
1877 | } | ||
1878 | |||
1879 | /* Assign the info structure and private data */ | ||
1880 | pl330->pinfo = pi; | ||
1881 | pi->pl330_data = pl330; | ||
1882 | |||
1883 | spin_lock_init(&pl330->lock); | ||
1884 | |||
1885 | INIT_LIST_HEAD(&pl330->req_done); | ||
1886 | |||
1887 | /* Use default MC buffer size if not provided */ | ||
1888 | if (!pi->mcbufsz) | ||
1889 | pi->mcbufsz = MCODE_BUFF_PER_REQ * 2; | ||
1890 | |||
1891 | /* Mark all events as free */ | ||
1892 | for (i = 0; i < pi->pcfg.num_events; i++) | ||
1893 | pl330->events[i] = -1; | ||
1894 | |||
1895 | /* Allocate resources needed by the DMAC */ | ||
1896 | ret = dmac_alloc_resources(pl330); | ||
1897 | if (ret) { | ||
1898 | dev_err(pi->dev, "Unable to create channels for DMAC\n"); | ||
1899 | kfree(pl330); | ||
1900 | return ret; | ||
1901 | } | ||
1902 | |||
1903 | tasklet_init(&pl330->tasks, pl330_dotask, (unsigned long) pl330); | ||
1904 | |||
1905 | pl330->state = INIT; | ||
1906 | |||
1907 | return 0; | ||
1908 | } | ||
1909 | EXPORT_SYMBOL(pl330_add); | ||
1910 | |||
1911 | static int dmac_free_threads(struct pl330_dmac *pl330) | ||
1912 | { | ||
1913 | struct pl330_info *pi = pl330->pinfo; | ||
1914 | int chans = pi->pcfg.num_chan; | ||
1915 | struct pl330_thread *thrd; | ||
1916 | int i; | ||
1917 | |||
1918 | /* Release Channel threads */ | ||
1919 | for (i = 0; i < chans; i++) { | ||
1920 | thrd = &pl330->channels[i]; | ||
1921 | pl330_release_channel((void *)thrd); | ||
1922 | } | ||
1923 | |||
1924 | /* Free memory */ | ||
1925 | kfree(pl330->channels); | ||
1926 | |||
1927 | return 0; | ||
1928 | } | ||
1929 | |||
1930 | static void dmac_free_resources(struct pl330_dmac *pl330) | ||
1931 | { | ||
1932 | struct pl330_info *pi = pl330->pinfo; | ||
1933 | int chans = pi->pcfg.num_chan; | ||
1934 | |||
1935 | dmac_free_threads(pl330); | ||
1936 | |||
1937 | dma_free_coherent(pi->dev, chans * pi->mcbufsz, | ||
1938 | pl330->mcode_cpu, pl330->mcode_bus); | ||
1939 | } | ||
1940 | |||
1941 | void pl330_del(struct pl330_info *pi) | ||
1942 | { | ||
1943 | struct pl330_dmac *pl330; | ||
1944 | |||
1945 | if (!pi || !pi->pl330_data) | ||
1946 | return; | ||
1947 | |||
1948 | pl330 = pi->pl330_data; | ||
1949 | |||
1950 | pl330->state = UNINIT; | ||
1951 | |||
1952 | tasklet_kill(&pl330->tasks); | ||
1953 | |||
1954 | /* Free DMAC resources */ | ||
1955 | dmac_free_resources(pl330); | ||
1956 | |||
1957 | kfree(pl330); | ||
1958 | pi->pl330_data = NULL; | ||
1959 | } | ||
1960 | EXPORT_SYMBOL(pl330_del); | ||
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig index 1103f62a1964..a8314c3ee84d 100644 --- a/arch/arm/configs/integrator_defconfig +++ b/arch/arm/configs/integrator_defconfig | |||
@@ -57,18 +57,24 @@ CONFIG_NETDEVICES=y | |||
57 | CONFIG_NET_ETHERNET=y | 57 | CONFIG_NET_ETHERNET=y |
58 | CONFIG_NET_PCI=y | 58 | CONFIG_NET_PCI=y |
59 | CONFIG_E100=y | 59 | CONFIG_E100=y |
60 | CONFIG_SMC91X=y | ||
60 | # CONFIG_KEYBOARD_ATKBD is not set | 61 | # CONFIG_KEYBOARD_ATKBD is not set |
61 | # CONFIG_SERIO_SERPORT is not set | 62 | # CONFIG_SERIO_SERPORT is not set |
62 | CONFIG_SERIAL_AMBA_PL010=y | 63 | CONFIG_SERIAL_AMBA_PL010=y |
63 | CONFIG_SERIAL_AMBA_PL010_CONSOLE=y | 64 | CONFIG_SERIAL_AMBA_PL010_CONSOLE=y |
64 | CONFIG_FB=y | 65 | CONFIG_FB=y |
65 | CONFIG_FB_MODE_HELPERS=y | 66 | CONFIG_FB_MODE_HELPERS=y |
67 | CONFIG_FB_ARMCLCD=y | ||
66 | CONFIG_FB_MATROX=y | 68 | CONFIG_FB_MATROX=y |
67 | CONFIG_FB_MATROX_MILLENIUM=y | 69 | CONFIG_FB_MATROX_MILLENIUM=y |
68 | CONFIG_FB_MATROX_MYSTIQUE=y | 70 | CONFIG_FB_MATROX_MYSTIQUE=y |
71 | # CONFIG_VGA_CONSOLE is not set | ||
72 | CONFIG_MMC=y | ||
73 | CONFIG_MMC_ARMMMCI=y | ||
69 | CONFIG_RTC_CLASS=y | 74 | CONFIG_RTC_CLASS=y |
70 | CONFIG_RTC_DRV_PL030=y | 75 | CONFIG_RTC_DRV_PL030=y |
71 | CONFIG_EXT2_FS=y | 76 | CONFIG_EXT2_FS=y |
77 | CONFIG_VFAT_FS=y | ||
72 | CONFIG_TMPFS=y | 78 | CONFIG_TMPFS=y |
73 | CONFIG_JFFS2_FS=y | 79 | CONFIG_JFFS2_FS=y |
74 | CONFIG_CRAMFS=y | 80 | CONFIG_CRAMFS=y |
@@ -78,5 +84,7 @@ CONFIG_ROOT_NFS=y | |||
78 | CONFIG_NFSD=y | 84 | CONFIG_NFSD=y |
79 | CONFIG_NFSD_V3=y | 85 | CONFIG_NFSD_V3=y |
80 | CONFIG_PARTITION_ADVANCED=y | 86 | CONFIG_PARTITION_ADVANCED=y |
87 | CONFIG_NLS_CODEPAGE_437=y | ||
88 | CONFIG_NLS_ISO8859_1=y | ||
81 | CONFIG_MAGIC_SYSRQ=y | 89 | CONFIG_MAGIC_SYSRQ=y |
82 | CONFIG_DEBUG_KERNEL=y | 90 | CONFIG_DEBUG_KERNEL=y |
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 23371b17b23e..03fb93621d0d 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <asm/ptrace.h> | 23 | #include <asm/ptrace.h> |
24 | #include <asm/domain.h> | 24 | #include <asm/domain.h> |
25 | 25 | ||
26 | #define IOMEM(x) (x) | ||
27 | |||
26 | /* | 28 | /* |
27 | * Endian independent macros for shifting bytes within registers. | 29 | * Endian independent macros for shifting bytes within registers. |
28 | */ | 30 | */ |
diff --git a/arch/arm/include/asm/cpuidle.h b/arch/arm/include/asm/cpuidle.h new file mode 100644 index 000000000000..2fca60ab513a --- /dev/null +++ b/arch/arm/include/asm/cpuidle.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __ASM_ARM_CPUIDLE_H | ||
2 | #define __ASM_ARM_CPUIDLE_H | ||
3 | |||
4 | #ifdef CONFIG_CPU_IDLE | ||
5 | extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev, | ||
6 | struct cpuidle_driver *drv, int index); | ||
7 | #else | ||
8 | static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev, | ||
9 | struct cpuidle_driver *drv, int index) { return -ENODEV; } | ||
10 | #endif | ||
11 | |||
12 | /* Common ARM WFI state */ | ||
13 | #define ARM_CPUIDLE_WFI_STATE_PWR(p) {\ | ||
14 | .enter = arm_cpuidle_simple_enter,\ | ||
15 | .exit_latency = 1,\ | ||
16 | .target_residency = 1,\ | ||
17 | .power_usage = p,\ | ||
18 | .flags = CPUIDLE_FLAG_TIME_VALID,\ | ||
19 | .name = "WFI",\ | ||
20 | .desc = "ARM WFI",\ | ||
21 | } | ||
22 | |||
23 | /* | ||
24 | * in case power_specified == 1, give a default WFI power value needed | ||
25 | * by some governors | ||
26 | */ | ||
27 | #define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX) | ||
28 | |||
29 | #endif | ||
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 0e9ce8d9686e..38050b1c4800 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -130,8 +130,4 @@ struct mm_struct; | |||
130 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); | 130 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); |
131 | #define arch_randomize_brk arch_randomize_brk | 131 | #define arch_randomize_brk arch_randomize_brk |
132 | 132 | ||
133 | extern int vectors_user_mapping(void); | ||
134 | #define arch_setup_additional_pages(bprm, uses_interp) vectors_user_mapping() | ||
135 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
136 | |||
137 | #endif | 133 | #endif |
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h index 7df239bcdf27..c4c87bc12231 100644 --- a/arch/arm/include/asm/hardware/cache-l2x0.h +++ b/arch/arm/include/asm/hardware/cache-l2x0.h | |||
@@ -103,11 +103,11 @@ | |||
103 | #define L2X0_ADDR_FILTER_EN 1 | 103 | #define L2X0_ADDR_FILTER_EN 1 |
104 | 104 | ||
105 | #ifndef __ASSEMBLY__ | 105 | #ifndef __ASSEMBLY__ |
106 | extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); | 106 | extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask); |
107 | #if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF) | 107 | #if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF) |
108 | extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask); | 108 | extern int l2x0_of_init(u32 aux_val, u32 aux_mask); |
109 | #else | 109 | #else |
110 | static inline int l2x0_of_init(__u32 aux_val, __u32 aux_mask) | 110 | static inline int l2x0_of_init(u32 aux_val, u32 aux_mask) |
111 | { | 111 | { |
112 | return -ENODEV; | 112 | return -ENODEV; |
113 | } | 113 | } |
diff --git a/arch/arm/include/asm/hardware/iop_adma.h b/arch/arm/include/asm/hardware/iop_adma.h index 59b8c3892f76..122f86d8c991 100644 --- a/arch/arm/include/asm/hardware/iop_adma.h +++ b/arch/arm/include/asm/hardware/iop_adma.h | |||
@@ -49,7 +49,6 @@ struct iop_adma_device { | |||
49 | /** | 49 | /** |
50 | * struct iop_adma_chan - internal representation of an ADMA device | 50 | * struct iop_adma_chan - internal representation of an ADMA device |
51 | * @pending: allows batching of hardware operations | 51 | * @pending: allows batching of hardware operations |
52 | * @completed_cookie: identifier for the most recently completed operation | ||
53 | * @lock: serializes enqueue/dequeue operations to the slot pool | 52 | * @lock: serializes enqueue/dequeue operations to the slot pool |
54 | * @mmr_base: memory mapped register base | 53 | * @mmr_base: memory mapped register base |
55 | * @chain: device chain view of the descriptors | 54 | * @chain: device chain view of the descriptors |
@@ -62,7 +61,6 @@ struct iop_adma_device { | |||
62 | */ | 61 | */ |
63 | struct iop_adma_chan { | 62 | struct iop_adma_chan { |
64 | int pending; | 63 | int pending; |
65 | dma_cookie_t completed_cookie; | ||
66 | spinlock_t lock; /* protects the descriptor slot pool */ | 64 | spinlock_t lock; /* protects the descriptor slot pool */ |
67 | void __iomem *mmr_base; | 65 | void __iomem *mmr_base; |
68 | struct list_head chain; | 66 | struct list_head chain; |
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h index 43cab498bc27..73f84fa4f366 100644 --- a/arch/arm/include/asm/hardware/it8152.h +++ b/arch/arm/include/asm/hardware/it8152.h | |||
@@ -9,6 +9,9 @@ | |||
9 | 9 | ||
10 | #ifndef __ASM_HARDWARE_IT8152_H | 10 | #ifndef __ASM_HARDWARE_IT8152_H |
11 | #define __ASM_HARDWARE_IT8152_H | 11 | #define __ASM_HARDWARE_IT8152_H |
12 | |||
13 | #include <mach/irqs.h> | ||
14 | |||
12 | extern void __iomem *it8152_base_address; | 15 | extern void __iomem *it8152_base_address; |
13 | 16 | ||
14 | #define IT8152_IO_BASE (it8152_base_address + 0x03e00000) | 17 | #define IT8152_IO_BASE (it8152_base_address + 0x03e00000) |
diff --git a/arch/arm/include/asm/hardware/pl330.h b/arch/arm/include/asm/hardware/pl330.h deleted file mode 100644 index c1821385abfa..000000000000 --- a/arch/arm/include/asm/hardware/pl330.h +++ /dev/null | |||
@@ -1,217 +0,0 @@ | |||
1 | /* linux/include/asm/hardware/pl330.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __PL330_CORE_H | ||
22 | #define __PL330_CORE_H | ||
23 | |||
24 | #define PL330_MAX_CHAN 8 | ||
25 | #define PL330_MAX_IRQS 32 | ||
26 | #define PL330_MAX_PERI 32 | ||
27 | |||
28 | enum pl330_srccachectrl { | ||
29 | SCCTRL0 = 0, /* Noncacheable and nonbufferable */ | ||
30 | SCCTRL1, /* Bufferable only */ | ||
31 | SCCTRL2, /* Cacheable, but do not allocate */ | ||
32 | SCCTRL3, /* Cacheable and bufferable, but do not allocate */ | ||
33 | SINVALID1, | ||
34 | SINVALID2, | ||
35 | SCCTRL6, /* Cacheable write-through, allocate on reads only */ | ||
36 | SCCTRL7, /* Cacheable write-back, allocate on reads only */ | ||
37 | }; | ||
38 | |||
39 | enum pl330_dstcachectrl { | ||
40 | DCCTRL0 = 0, /* Noncacheable and nonbufferable */ | ||
41 | DCCTRL1, /* Bufferable only */ | ||
42 | DCCTRL2, /* Cacheable, but do not allocate */ | ||
43 | DCCTRL3, /* Cacheable and bufferable, but do not allocate */ | ||
44 | DINVALID1, /* AWCACHE = 0x1000 */ | ||
45 | DINVALID2, | ||
46 | DCCTRL6, /* Cacheable write-through, allocate on writes only */ | ||
47 | DCCTRL7, /* Cacheable write-back, allocate on writes only */ | ||
48 | }; | ||
49 | |||
50 | /* Populated by the PL330 core driver for DMA API driver's info */ | ||
51 | struct pl330_config { | ||
52 | u32 periph_id; | ||
53 | u32 pcell_id; | ||
54 | #define DMAC_MODE_NS (1 << 0) | ||
55 | unsigned int mode; | ||
56 | unsigned int data_bus_width:10; /* In number of bits */ | ||
57 | unsigned int data_buf_dep:10; | ||
58 | unsigned int num_chan:4; | ||
59 | unsigned int num_peri:6; | ||
60 | u32 peri_ns; | ||
61 | unsigned int num_events:6; | ||
62 | u32 irq_ns; | ||
63 | }; | ||
64 | |||
65 | /* Handle to the DMAC provided to the PL330 core */ | ||
66 | struct pl330_info { | ||
67 | /* Owning device */ | ||
68 | struct device *dev; | ||
69 | /* Size of MicroCode buffers for each channel. */ | ||
70 | unsigned mcbufsz; | ||
71 | /* ioremap'ed address of PL330 registers. */ | ||
72 | void __iomem *base; | ||
73 | /* Client can freely use it. */ | ||
74 | void *client_data; | ||
75 | /* PL330 core data, Client must not touch it. */ | ||
76 | void *pl330_data; | ||
77 | /* Populated by the PL330 core driver during pl330_add */ | ||
78 | struct pl330_config pcfg; | ||
79 | /* | ||
80 | * If the DMAC has some reset mechanism, then the | ||
81 | * client may want to provide pointer to the method. | ||
82 | */ | ||
83 | void (*dmac_reset)(struct pl330_info *pi); | ||
84 | }; | ||
85 | |||
86 | enum pl330_byteswap { | ||
87 | SWAP_NO = 0, | ||
88 | SWAP_2, | ||
89 | SWAP_4, | ||
90 | SWAP_8, | ||
91 | SWAP_16, | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * Request Configuration. | ||
96 | * The PL330 core does not modify this and uses the last | ||
97 | * working configuration if the request doesn't provide any. | ||
98 | * | ||
99 | * The Client may want to provide this info only for the | ||
100 | * first request and a request with new settings. | ||
101 | */ | ||
102 | struct pl330_reqcfg { | ||
103 | /* Address Incrementing */ | ||
104 | unsigned dst_inc:1; | ||
105 | unsigned src_inc:1; | ||
106 | |||
107 | /* | ||
108 | * For now, the SRC & DST protection levels | ||
109 | * and burst size/length are assumed same. | ||
110 | */ | ||
111 | bool nonsecure; | ||
112 | bool privileged; | ||
113 | bool insnaccess; | ||
114 | unsigned brst_len:5; | ||
115 | unsigned brst_size:3; /* in power of 2 */ | ||
116 | |||
117 | enum pl330_dstcachectrl dcctl; | ||
118 | enum pl330_srccachectrl scctl; | ||
119 | enum pl330_byteswap swap; | ||
120 | }; | ||
121 | |||
122 | /* | ||
123 | * One cycle of DMAC operation. | ||
124 | * There may be more than one xfer in a request. | ||
125 | */ | ||
126 | struct pl330_xfer { | ||
127 | u32 src_addr; | ||
128 | u32 dst_addr; | ||
129 | /* Size to xfer */ | ||
130 | u32 bytes; | ||
131 | /* | ||
132 | * Pointer to next xfer in the list. | ||
133 | * The last xfer in the req must point to NULL. | ||
134 | */ | ||
135 | struct pl330_xfer *next; | ||
136 | }; | ||
137 | |||
138 | /* The xfer callbacks are made with one of these arguments. */ | ||
139 | enum pl330_op_err { | ||
140 | /* The all xfers in the request were success. */ | ||
141 | PL330_ERR_NONE, | ||
142 | /* If req aborted due to global error. */ | ||
143 | PL330_ERR_ABORT, | ||
144 | /* If req failed due to problem with Channel. */ | ||
145 | PL330_ERR_FAIL, | ||
146 | }; | ||
147 | |||
148 | enum pl330_reqtype { | ||
149 | MEMTOMEM, | ||
150 | MEMTODEV, | ||
151 | DEVTOMEM, | ||
152 | DEVTODEV, | ||
153 | }; | ||
154 | |||
155 | /* A request defining Scatter-Gather List ending with NULL xfer. */ | ||
156 | struct pl330_req { | ||
157 | enum pl330_reqtype rqtype; | ||
158 | /* Index of peripheral for the xfer. */ | ||
159 | unsigned peri:5; | ||
160 | /* Unique token for this xfer, set by the client. */ | ||
161 | void *token; | ||
162 | /* Callback to be called after xfer. */ | ||
163 | void (*xfer_cb)(void *token, enum pl330_op_err err); | ||
164 | /* If NULL, req will be done at last set parameters. */ | ||
165 | struct pl330_reqcfg *cfg; | ||
166 | /* Pointer to first xfer in the request. */ | ||
167 | struct pl330_xfer *x; | ||
168 | }; | ||
169 | |||
170 | /* | ||
171 | * To know the status of the channel and DMAC, the client | ||
172 | * provides a pointer to this structure. The PL330 core | ||
173 | * fills it with current information. | ||
174 | */ | ||
175 | struct pl330_chanstatus { | ||
176 | /* | ||
177 | * If the DMAC engine halted due to some error, | ||
178 | * the client should remove-add DMAC. | ||
179 | */ | ||
180 | bool dmac_halted; | ||
181 | /* | ||
182 | * If channel is halted due to some error, | ||
183 | * the client should ABORT/FLUSH and START the channel. | ||
184 | */ | ||
185 | bool faulting; | ||
186 | /* Location of last load */ | ||
187 | u32 src_addr; | ||
188 | /* Location of last store */ | ||
189 | u32 dst_addr; | ||
190 | /* | ||
191 | * Pointer to the currently active req, NULL if channel is | ||
192 | * inactive, even though the requests may be present. | ||
193 | */ | ||
194 | struct pl330_req *top_req; | ||
195 | /* Pointer to req waiting second in the queue if any. */ | ||
196 | struct pl330_req *wait_req; | ||
197 | }; | ||
198 | |||
199 | enum pl330_chan_op { | ||
200 | /* Start the channel */ | ||
201 | PL330_OP_START, | ||
202 | /* Abort the active xfer */ | ||
203 | PL330_OP_ABORT, | ||
204 | /* Stop xfer and flush queue */ | ||
205 | PL330_OP_FLUSH, | ||
206 | }; | ||
207 | |||
208 | extern int pl330_add(struct pl330_info *); | ||
209 | extern void pl330_del(struct pl330_info *pi); | ||
210 | extern int pl330_update(const struct pl330_info *pi); | ||
211 | extern void pl330_release_channel(void *ch_id); | ||
212 | extern void *pl330_request_channel(const struct pl330_info *pi); | ||
213 | extern int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus); | ||
214 | extern int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op); | ||
215 | extern int pl330_submit_req(void *ch_id, struct pl330_req *r); | ||
216 | |||
217 | #endif /* __PL330_CORE_H */ | ||
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index bae7eb6011d2..df0ac0bb39aa 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -82,6 +82,11 @@ extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, uns | |||
82 | extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); | 82 | extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); |
83 | extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached); | 83 | extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached); |
84 | extern void __iounmap(volatile void __iomem *addr); | 84 | extern void __iounmap(volatile void __iomem *addr); |
85 | extern void __arm_iounmap(volatile void __iomem *addr); | ||
86 | |||
87 | extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, | ||
88 | unsigned int, void *); | ||
89 | extern void (*arch_iounmap)(volatile void __iomem *); | ||
85 | 90 | ||
86 | /* | 91 | /* |
87 | * Bad read/write accesses... | 92 | * Bad read/write accesses... |
@@ -96,6 +101,8 @@ static inline void __iomem *__typesafe_io(unsigned long addr) | |||
96 | return (void __iomem *)addr; | 101 | return (void __iomem *)addr; |
97 | } | 102 | } |
98 | 103 | ||
104 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
105 | |||
99 | /* IO barriers */ | 106 | /* IO barriers */ |
100 | #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE | 107 | #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE |
101 | #include <asm/barrier.h> | 108 | #include <asm/barrier.h> |
@@ -109,7 +116,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr) | |||
109 | /* | 116 | /* |
110 | * Now, pick up the machine-defined IO definitions | 117 | * Now, pick up the machine-defined IO definitions |
111 | */ | 118 | */ |
119 | #ifdef CONFIG_NEED_MACH_IO_H | ||
112 | #include <mach/io.h> | 120 | #include <mach/io.h> |
121 | #else | ||
122 | #define __io(a) ({ (void)(a); __typesafe_io(0); }) | ||
123 | #endif | ||
113 | 124 | ||
114 | /* | 125 | /* |
115 | * This is the limit of PC card/PCI/ISA IO space, which is by default | 126 | * This is the limit of PC card/PCI/ISA IO space, which is by default |
@@ -211,18 +222,18 @@ extern void _memset_io(volatile void __iomem *, int, size_t); | |||
211 | * Again, this are defined to perform little endian accesses. See the | 222 | * Again, this are defined to perform little endian accesses. See the |
212 | * IO port primitives for more information. | 223 | * IO port primitives for more information. |
213 | */ | 224 | */ |
214 | #ifdef __mem_pci | 225 | #ifndef readl |
215 | #define readb_relaxed(c) ({ u8 __r = __raw_readb(__mem_pci(c)); __r; }) | 226 | #define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; }) |
216 | #define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \ | 227 | #define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \ |
217 | __raw_readw(__mem_pci(c))); __r; }) | 228 | __raw_readw(c)); __r; }) |
218 | #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \ | 229 | #define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \ |
219 | __raw_readl(__mem_pci(c))); __r; }) | 230 | __raw_readl(c)); __r; }) |
220 | 231 | ||
221 | #define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c))) | 232 | #define writeb_relaxed(v,c) ((void)__raw_writeb(v,c)) |
222 | #define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ | 233 | #define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ |
223 | cpu_to_le16(v),__mem_pci(c))) | 234 | cpu_to_le16(v),c)) |
224 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ | 235 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ |
225 | cpu_to_le32(v),__mem_pci(c))) | 236 | cpu_to_le32(v),c)) |
226 | 237 | ||
227 | #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) | 238 | #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) |
228 | #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) | 239 | #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) |
@@ -232,30 +243,19 @@ extern void _memset_io(volatile void __iomem *, int, size_t); | |||
232 | #define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); }) | 243 | #define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); }) |
233 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); }) | 244 | #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); }) |
234 | 245 | ||
235 | #define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l) | 246 | #define readsb(p,d,l) __raw_readsb(p,d,l) |
236 | #define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l) | 247 | #define readsw(p,d,l) __raw_readsw(p,d,l) |
237 | #define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l) | 248 | #define readsl(p,d,l) __raw_readsl(p,d,l) |
238 | |||
239 | #define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l) | ||
240 | #define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l) | ||
241 | #define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l) | ||
242 | 249 | ||
243 | #define memset_io(c,v,l) _memset_io(__mem_pci(c),(v),(l)) | 250 | #define writesb(p,d,l) __raw_writesb(p,d,l) |
244 | #define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l)) | 251 | #define writesw(p,d,l) __raw_writesw(p,d,l) |
245 | #define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l)) | 252 | #define writesl(p,d,l) __raw_writesl(p,d,l) |
246 | 253 | ||
247 | #elif !defined(readb) | 254 | #define memset_io(c,v,l) _memset_io(c,(v),(l)) |
255 | #define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l)) | ||
256 | #define memcpy_toio(c,a,l) _memcpy_toio(c,(a),(l)) | ||
248 | 257 | ||
249 | #define readb(c) (__readwrite_bug("readb"),0) | 258 | #endif /* readl */ |
250 | #define readw(c) (__readwrite_bug("readw"),0) | ||
251 | #define readl(c) (__readwrite_bug("readl"),0) | ||
252 | #define writeb(v,c) __readwrite_bug("writeb") | ||
253 | #define writew(v,c) __readwrite_bug("writew") | ||
254 | #define writel(v,c) __readwrite_bug("writel") | ||
255 | |||
256 | #define check_signature(io,sig,len) (0) | ||
257 | |||
258 | #endif /* __mem_pci */ | ||
259 | 259 | ||
260 | /* | 260 | /* |
261 | * ioremap and friends. | 261 | * ioremap and friends. |
@@ -264,16 +264,11 @@ extern void _memset_io(volatile void __iomem *, int, size_t); | |||
264 | * Documentation/io-mapping.txt. | 264 | * Documentation/io-mapping.txt. |
265 | * | 265 | * |
266 | */ | 266 | */ |
267 | #ifndef __arch_ioremap | 267 | #define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) |
268 | #define __arch_ioremap __arm_ioremap | 268 | #define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) |
269 | #define __arch_iounmap __iounmap | 269 | #define ioremap_cached(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED) |
270 | #endif | 270 | #define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC) |
271 | 271 | #define iounmap __arm_iounmap | |
272 | #define ioremap(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE) | ||
273 | #define ioremap_nocache(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE) | ||
274 | #define ioremap_cached(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_CACHED) | ||
275 | #define ioremap_wc(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_WC) | ||
276 | #define iounmap __arch_iounmap | ||
277 | 272 | ||
278 | /* | 273 | /* |
279 | * io{read,write}{8,16,32} macros | 274 | * io{read,write}{8,16,32} macros |
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h index 5a526afb5f18..35c21c375d81 100644 --- a/arch/arm/include/asm/irq.h +++ b/arch/arm/include/asm/irq.h | |||
@@ -1,14 +1,18 @@ | |||
1 | #ifndef __ASM_ARM_IRQ_H | 1 | #ifndef __ASM_ARM_IRQ_H |
2 | #define __ASM_ARM_IRQ_H | 2 | #define __ASM_ARM_IRQ_H |
3 | 3 | ||
4 | #define NR_IRQS_LEGACY 16 | ||
5 | |||
6 | #ifndef CONFIG_SPARSE_IRQ | ||
4 | #include <mach/irqs.h> | 7 | #include <mach/irqs.h> |
8 | #else | ||
9 | #define NR_IRQS NR_IRQS_LEGACY | ||
10 | #endif | ||
5 | 11 | ||
6 | #ifndef irq_canonicalize | 12 | #ifndef irq_canonicalize |
7 | #define irq_canonicalize(i) (i) | 13 | #define irq_canonicalize(i) (i) |
8 | #endif | 14 | #endif |
9 | 15 | ||
10 | #define NR_IRQS_LEGACY 16 | ||
11 | |||
12 | /* | 16 | /* |
13 | * Use this value to indicate lack of interrupt | 17 | * Use this value to indicate lack of interrupt |
14 | * capability | 18 | * capability |
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h new file mode 100644 index 000000000000..5c5ca2ea62b0 --- /dev/null +++ b/arch/arm/include/asm/jump_label.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef _ASM_ARM_JUMP_LABEL_H | ||
2 | #define _ASM_ARM_JUMP_LABEL_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/types.h> | ||
7 | #include <asm/system.h> | ||
8 | |||
9 | #define JUMP_LABEL_NOP_SIZE 4 | ||
10 | |||
11 | #ifdef CONFIG_THUMB2_KERNEL | ||
12 | #define JUMP_LABEL_NOP "nop.w" | ||
13 | #else | ||
14 | #define JUMP_LABEL_NOP "nop" | ||
15 | #endif | ||
16 | |||
17 | static __always_inline bool arch_static_branch(struct jump_label_key *key) | ||
18 | { | ||
19 | asm goto("1:\n\t" | ||
20 | JUMP_LABEL_NOP "\n\t" | ||
21 | ".pushsection __jump_table, \"aw\"\n\t" | ||
22 | ".word 1b, %l[l_yes], %c0\n\t" | ||
23 | ".popsection\n\t" | ||
24 | : : "i" (key) : : l_yes); | ||
25 | |||
26 | return false; | ||
27 | l_yes: | ||
28 | return true; | ||
29 | } | ||
30 | |||
31 | #endif /* __KERNEL__ */ | ||
32 | |||
33 | typedef u32 jump_label_t; | ||
34 | |||
35 | struct jump_entry { | ||
36 | jump_label_t code; | ||
37 | jump_label_t target; | ||
38 | jump_label_t key; | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/arch/arm/include/asm/mc146818rtc.h b/arch/arm/include/asm/mc146818rtc.h index 6b884d2b0b69..e8567bb99dfc 100644 --- a/arch/arm/include/asm/mc146818rtc.h +++ b/arch/arm/include/asm/mc146818rtc.h | |||
@@ -5,7 +5,9 @@ | |||
5 | #define _ASM_MC146818RTC_H | 5 | #define _ASM_MC146818RTC_H |
6 | 6 | ||
7 | #include <linux/io.h> | 7 | #include <linux/io.h> |
8 | #include <mach/irqs.h> | 8 | #include <linux/kernel.h> |
9 | |||
10 | #define RTC_IRQ BUILD_BUG_ON(1) | ||
9 | 11 | ||
10 | #ifndef RTC_PORT | 12 | #ifndef RTC_PORT |
11 | #define RTC_PORT(x) (0x70 + (x)) | 13 | #define RTC_PORT(x) (0x70 + (x)) |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index a8997d71084e..fcb575747e5e 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -116,6 +116,8 @@ | |||
116 | #define MODULES_END (END_MEM) | 116 | #define MODULES_END (END_MEM) |
117 | #define MODULES_VADDR (PHYS_OFFSET) | 117 | #define MODULES_VADDR (PHYS_OFFSET) |
118 | 118 | ||
119 | #define XIP_VIRT_ADDR(physaddr) (physaddr) | ||
120 | |||
119 | #endif /* !CONFIG_MMU */ | 121 | #endif /* !CONFIG_MMU */ |
120 | 122 | ||
121 | /* | 123 | /* |
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 71605d9f8e42..a0b3cac0547c 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/cachetype.h> | 19 | #include <asm/cachetype.h> |
20 | #include <asm/proc-fns.h> | 20 | #include <asm/proc-fns.h> |
21 | #include <asm-generic/mm_hooks.h> | ||
21 | 22 | ||
22 | void __check_kvm_seq(struct mm_struct *mm); | 23 | void __check_kvm_seq(struct mm_struct *mm); |
23 | 24 | ||
@@ -133,32 +134,4 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
133 | #define deactivate_mm(tsk,mm) do { } while (0) | 134 | #define deactivate_mm(tsk,mm) do { } while (0) |
134 | #define activate_mm(prev,next) switch_mm(prev, next, NULL) | 135 | #define activate_mm(prev,next) switch_mm(prev, next, NULL) |
135 | 136 | ||
136 | /* | ||
137 | * We are inserting a "fake" vma for the user-accessible vector page so | ||
138 | * gdb and friends can get to it through ptrace and /proc/<pid>/mem. | ||
139 | * But we also want to remove it before the generic code gets to see it | ||
140 | * during process exit or the unmapping of it would cause total havoc. | ||
141 | * (the macro is used as remove_vma() is static to mm/mmap.c) | ||
142 | */ | ||
143 | #define arch_exit_mmap(mm) \ | ||
144 | do { \ | ||
145 | struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \ | ||
146 | if (high_vma) { \ | ||
147 | BUG_ON(high_vma->vm_next); /* it should be last */ \ | ||
148 | if (high_vma->vm_prev) \ | ||
149 | high_vma->vm_prev->vm_next = NULL; \ | ||
150 | else \ | ||
151 | mm->mmap = NULL; \ | ||
152 | rb_erase(&high_vma->vm_rb, &mm->mm_rb); \ | ||
153 | mm->mmap_cache = NULL; \ | ||
154 | mm->map_count--; \ | ||
155 | remove_vma(high_vma); \ | ||
156 | } \ | ||
157 | } while (0) | ||
158 | |||
159 | static inline void arch_dup_mmap(struct mm_struct *oldmm, | ||
160 | struct mm_struct *mm) | ||
161 | { | ||
162 | } | ||
163 | |||
164 | #endif | 137 | #endif |
diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h index c0efdd60966f..19c48deda70f 100644 --- a/arch/arm/include/asm/opcodes.h +++ b/arch/arm/include/asm/opcodes.h | |||
@@ -17,4 +17,63 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr); | |||
17 | #define ARM_OPCODE_CONDTEST_PASS 1 | 17 | #define ARM_OPCODE_CONDTEST_PASS 1 |
18 | #define ARM_OPCODE_CONDTEST_UNCOND 2 | 18 | #define ARM_OPCODE_CONDTEST_UNCOND 2 |
19 | 19 | ||
20 | |||
21 | /* | ||
22 | * Opcode byteswap helpers | ||
23 | * | ||
24 | * These macros help with converting instructions between a canonical integer | ||
25 | * format and in-memory representation, in an endianness-agnostic manner. | ||
26 | * | ||
27 | * __mem_to_opcode_*() convert from in-memory representation to canonical form. | ||
28 | * __opcode_to_mem_*() convert from canonical form to in-memory representation. | ||
29 | * | ||
30 | * | ||
31 | * Canonical instruction representation: | ||
32 | * | ||
33 | * ARM: 0xKKLLMMNN | ||
34 | * Thumb 16-bit: 0x0000KKLL, where KK < 0xE8 | ||
35 | * Thumb 32-bit: 0xKKLLMMNN, where KK >= 0xE8 | ||
36 | * | ||
37 | * There is no way to distinguish an ARM instruction in canonical representation | ||
38 | * from a Thumb instruction (just as these cannot be distinguished in memory). | ||
39 | * Where this distinction is important, it needs to be tracked separately. | ||
40 | * | ||
41 | * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not | ||
42 | * represent any valid Thumb-2 instruction. For this range, | ||
43 | * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false. | ||
44 | */ | ||
45 | |||
46 | #ifndef __ASSEMBLY__ | ||
47 | |||
48 | #include <linux/types.h> | ||
49 | #include <linux/swab.h> | ||
50 | |||
51 | #ifdef CONFIG_CPU_ENDIAN_BE8 | ||
52 | #define __opcode_to_mem_arm(x) swab32(x) | ||
53 | #define __opcode_to_mem_thumb16(x) swab16(x) | ||
54 | #define __opcode_to_mem_thumb32(x) swahb32(x) | ||
55 | #else | ||
56 | #define __opcode_to_mem_arm(x) ((u32)(x)) | ||
57 | #define __opcode_to_mem_thumb16(x) ((u16)(x)) | ||
58 | #define __opcode_to_mem_thumb32(x) swahw32(x) | ||
59 | #endif | ||
60 | |||
61 | #define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x) | ||
62 | #define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x) | ||
63 | #define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x) | ||
64 | |||
65 | /* Operations specific to Thumb opcodes */ | ||
66 | |||
67 | /* Instruction size checks: */ | ||
68 | #define __opcode_is_thumb32(x) ((u32)(x) >= 0xE8000000UL) | ||
69 | #define __opcode_is_thumb16(x) ((u32)(x) < 0xE800UL) | ||
70 | |||
71 | /* Operations to construct or split 32-bit Thumb instructions: */ | ||
72 | #define __opcode_thumb32_first(x) ((u16)((x) >> 16)) | ||
73 | #define __opcode_thumb32_second(x) ((u16)(x)) | ||
74 | #define __opcode_thumb32_compose(first, second) \ | ||
75 | (((u32)(u16)(first) << 16) | (u32)(u16)(second)) | ||
76 | |||
77 | #endif /* __ASSEMBLY__ */ | ||
78 | |||
20 | #endif /* __ASM_ARM_OPCODES_H */ | 79 | #endif /* __ASM_ARM_OPCODES_H */ |
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index 97b440c25c58..5838361c48b3 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h | |||
@@ -151,6 +151,8 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from, | |||
151 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | 151 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |
152 | extern void copy_page(void *to, const void *from); | 152 | extern void copy_page(void *to, const void *from); |
153 | 153 | ||
154 | #define __HAVE_ARCH_GATE_AREA 1 | ||
155 | |||
154 | #ifdef CONFIG_ARM_LPAE | 156 | #ifdef CONFIG_ARM_LPAE |
155 | #include <asm/pgtable-3level-types.h> | 157 | #include <asm/pgtable-3level-types.h> |
156 | #else | 158 | #else |
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h index 7523340afb8a..00cbe10a50e3 100644 --- a/arch/arm/include/asm/perf_event.h +++ b/arch/arm/include/asm/perf_event.h | |||
@@ -22,6 +22,7 @@ enum arm_perf_pmu_ids { | |||
22 | ARM_PERF_PMU_ID_CA9, | 22 | ARM_PERF_PMU_ID_CA9, |
23 | ARM_PERF_PMU_ID_CA5, | 23 | ARM_PERF_PMU_ID_CA5, |
24 | ARM_PERF_PMU_ID_CA15, | 24 | ARM_PERF_PMU_ID_CA15, |
25 | ARM_PERF_PMU_ID_CA7, | ||
25 | ARM_NUM_PMU_IDS, | 26 | ARM_NUM_PMU_IDS, |
26 | }; | 27 | }; |
27 | 28 | ||
diff --git a/arch/arm/include/asm/posix_types.h b/arch/arm/include/asm/posix_types.h index 2446d23bfdbf..efdf99045d87 100644 --- a/arch/arm/include/asm/posix_types.h +++ b/arch/arm/include/asm/posix_types.h | |||
@@ -19,59 +19,22 @@ | |||
19 | * assume GCC is being used. | 19 | * assume GCC is being used. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | typedef unsigned long __kernel_ino_t; | ||
23 | typedef unsigned short __kernel_mode_t; | 22 | typedef unsigned short __kernel_mode_t; |
23 | #define __kernel_mode_t __kernel_mode_t | ||
24 | |||
24 | typedef unsigned short __kernel_nlink_t; | 25 | typedef unsigned short __kernel_nlink_t; |
25 | typedef long __kernel_off_t; | 26 | #define __kernel_nlink_t __kernel_nlink_t |
26 | typedef int __kernel_pid_t; | 27 | |
27 | typedef unsigned short __kernel_ipc_pid_t; | 28 | typedef unsigned short __kernel_ipc_pid_t; |
29 | #define __kernel_ipc_pid_t __kernel_ipc_pid_t | ||
30 | |||
28 | typedef unsigned short __kernel_uid_t; | 31 | typedef unsigned short __kernel_uid_t; |
29 | typedef unsigned short __kernel_gid_t; | 32 | typedef unsigned short __kernel_gid_t; |
30 | typedef unsigned int __kernel_size_t; | 33 | #define __kernel_uid_t __kernel_uid_t |
31 | typedef int __kernel_ssize_t; | ||
32 | typedef int __kernel_ptrdiff_t; | ||
33 | typedef long __kernel_time_t; | ||
34 | typedef long __kernel_suseconds_t; | ||
35 | typedef long __kernel_clock_t; | ||
36 | typedef int __kernel_timer_t; | ||
37 | typedef int __kernel_clockid_t; | ||
38 | typedef int __kernel_daddr_t; | ||
39 | typedef char * __kernel_caddr_t; | ||
40 | typedef unsigned short __kernel_uid16_t; | ||
41 | typedef unsigned short __kernel_gid16_t; | ||
42 | typedef unsigned int __kernel_uid32_t; | ||
43 | typedef unsigned int __kernel_gid32_t; | ||
44 | 34 | ||
45 | typedef unsigned short __kernel_old_uid_t; | ||
46 | typedef unsigned short __kernel_old_gid_t; | ||
47 | typedef unsigned short __kernel_old_dev_t; | 35 | typedef unsigned short __kernel_old_dev_t; |
36 | #define __kernel_old_dev_t __kernel_old_dev_t | ||
48 | 37 | ||
49 | #ifdef __GNUC__ | 38 | #include <asm-generic/posix_types.h> |
50 | typedef long long __kernel_loff_t; | ||
51 | #endif | ||
52 | |||
53 | typedef struct { | ||
54 | int val[2]; | ||
55 | } __kernel_fsid_t; | ||
56 | |||
57 | #if defined(__KERNEL__) | ||
58 | |||
59 | #undef __FD_SET | ||
60 | #define __FD_SET(fd, fdsetp) \ | ||
61 | (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31))) | ||
62 | |||
63 | #undef __FD_CLR | ||
64 | #define __FD_CLR(fd, fdsetp) \ | ||
65 | (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31))) | ||
66 | |||
67 | #undef __FD_ISSET | ||
68 | #define __FD_ISSET(fd, fdsetp) \ | ||
69 | ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0) | ||
70 | |||
71 | #undef __FD_ZERO | ||
72 | #define __FD_ZERO(fdsetp) \ | ||
73 | (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp)))) | ||
74 | |||
75 | #endif | ||
76 | 39 | ||
77 | #endif | 40 | #endif |
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index f4d7f56ee51f..5ac8d3d3e025 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h | |||
@@ -55,7 +55,6 @@ struct thread_struct { | |||
55 | #define start_thread(regs,pc,sp) \ | 55 | #define start_thread(regs,pc,sp) \ |
56 | ({ \ | 56 | ({ \ |
57 | unsigned long *stack = (unsigned long *)sp; \ | 57 | unsigned long *stack = (unsigned long *)sp; \ |
58 | set_fs(USER_DS); \ | ||
59 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ | 58 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ |
60 | if (current->personality & ADDR_LIMIT_32BIT) \ | 59 | if (current->personality & ADDR_LIMIT_32BIT) \ |
61 | regs->ARM_cpsr = USR_MODE; \ | 60 | regs->ARM_cpsr = USR_MODE; \ |
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h index ee0363307918..aeae9c609df4 100644 --- a/arch/arm/include/asm/prom.h +++ b/arch/arm/include/asm/prom.h | |||
@@ -13,8 +13,6 @@ | |||
13 | 13 | ||
14 | #ifdef CONFIG_OF | 14 | #ifdef CONFIG_OF |
15 | 15 | ||
16 | #include <asm/irq.h> | ||
17 | |||
18 | extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); | 16 | extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); |
19 | extern void arm_dt_memblock_reserve(void); | 17 | extern void arm_dt_memblock_reserve(void); |
20 | 18 | ||
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index 02b2f8203982..85fe61e73202 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -318,6 +318,21 @@ extern struct cpu_tlb_fns cpu_tlb; | |||
318 | 318 | ||
319 | #define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f))) | 319 | #define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f))) |
320 | 320 | ||
321 | #define __tlb_op(f, insnarg, arg) \ | ||
322 | do { \ | ||
323 | if (always_tlb_flags & (f)) \ | ||
324 | asm("mcr " insnarg \ | ||
325 | : : "r" (arg) : "cc"); \ | ||
326 | else if (possible_tlb_flags & (f)) \ | ||
327 | asm("tst %1, %2\n\t" \ | ||
328 | "mcrne " insnarg \ | ||
329 | : : "r" (arg), "r" (__tlb_flag), "Ir" (f) \ | ||
330 | : "cc"); \ | ||
331 | } while (0) | ||
332 | |||
333 | #define tlb_op(f, regs, arg) __tlb_op(f, "p15, 0, %0, " regs, arg) | ||
334 | #define tlb_l2_op(f, regs, arg) __tlb_op(f, "p15, 1, %0, " regs, arg) | ||
335 | |||
321 | static inline void local_flush_tlb_all(void) | 336 | static inline void local_flush_tlb_all(void) |
322 | { | 337 | { |
323 | const int zero = 0; | 338 | const int zero = 0; |
@@ -326,16 +341,11 @@ static inline void local_flush_tlb_all(void) | |||
326 | if (tlb_flag(TLB_WB)) | 341 | if (tlb_flag(TLB_WB)) |
327 | dsb(); | 342 | dsb(); |
328 | 343 | ||
329 | if (tlb_flag(TLB_V3_FULL)) | 344 | tlb_op(TLB_V3_FULL, "c6, c0, 0", zero); |
330 | asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); | 345 | tlb_op(TLB_V4_U_FULL | TLB_V6_U_FULL, "c8, c7, 0", zero); |
331 | if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL)) | 346 | tlb_op(TLB_V4_D_FULL | TLB_V6_D_FULL, "c8, c6, 0", zero); |
332 | asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc"); | 347 | tlb_op(TLB_V4_I_FULL | TLB_V6_I_FULL, "c8, c5, 0", zero); |
333 | if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL)) | 348 | tlb_op(TLB_V7_UIS_FULL, "c8, c3, 0", zero); |
334 | asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); | ||
335 | if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL)) | ||
336 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); | ||
337 | if (tlb_flag(TLB_V7_UIS_FULL)) | ||
338 | asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc"); | ||
339 | 349 | ||
340 | if (tlb_flag(TLB_BARRIER)) { | 350 | if (tlb_flag(TLB_BARRIER)) { |
341 | dsb(); | 351 | dsb(); |
@@ -352,29 +362,23 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm) | |||
352 | if (tlb_flag(TLB_WB)) | 362 | if (tlb_flag(TLB_WB)) |
353 | dsb(); | 363 | dsb(); |
354 | 364 | ||
355 | if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) { | 365 | if (possible_tlb_flags & (TLB_V3_FULL|TLB_V4_U_FULL|TLB_V4_D_FULL|TLB_V4_I_FULL)) { |
356 | if (tlb_flag(TLB_V3_FULL)) | 366 | if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) { |
357 | asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); | 367 | tlb_op(TLB_V3_FULL, "c6, c0, 0", zero); |
358 | if (tlb_flag(TLB_V4_U_FULL)) | 368 | tlb_op(TLB_V4_U_FULL, "c8, c7, 0", zero); |
359 | asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc"); | 369 | tlb_op(TLB_V4_D_FULL, "c8, c6, 0", zero); |
360 | if (tlb_flag(TLB_V4_D_FULL)) | 370 | tlb_op(TLB_V4_I_FULL, "c8, c5, 0", zero); |
361 | asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); | 371 | } |
362 | if (tlb_flag(TLB_V4_I_FULL)) | 372 | put_cpu(); |
363 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); | ||
364 | } | 373 | } |
365 | put_cpu(); | 374 | |
366 | 375 | tlb_op(TLB_V6_U_ASID, "c8, c7, 2", asid); | |
367 | if (tlb_flag(TLB_V6_U_ASID)) | 376 | tlb_op(TLB_V6_D_ASID, "c8, c6, 2", asid); |
368 | asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc"); | 377 | tlb_op(TLB_V6_I_ASID, "c8, c5, 2", asid); |
369 | if (tlb_flag(TLB_V6_D_ASID)) | ||
370 | asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc"); | ||
371 | if (tlb_flag(TLB_V6_I_ASID)) | ||
372 | asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc"); | ||
373 | if (tlb_flag(TLB_V7_UIS_ASID)) | ||
374 | #ifdef CONFIG_ARM_ERRATA_720789 | 378 | #ifdef CONFIG_ARM_ERRATA_720789 |
375 | asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc"); | 379 | tlb_op(TLB_V7_UIS_ASID, "c8, c3, 0", zero); |
376 | #else | 380 | #else |
377 | asm("mcr p15, 0, %0, c8, c3, 2" : : "r" (asid) : "cc"); | 381 | tlb_op(TLB_V7_UIS_ASID, "c8, c3, 2", asid); |
378 | #endif | 382 | #endif |
379 | 383 | ||
380 | if (tlb_flag(TLB_BARRIER)) | 384 | if (tlb_flag(TLB_BARRIER)) |
@@ -392,30 +396,23 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
392 | if (tlb_flag(TLB_WB)) | 396 | if (tlb_flag(TLB_WB)) |
393 | dsb(); | 397 | dsb(); |
394 | 398 | ||
395 | if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) { | 399 | if (possible_tlb_flags & (TLB_V3_PAGE|TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) && |
396 | if (tlb_flag(TLB_V3_PAGE)) | 400 | cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) { |
397 | asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (uaddr) : "cc"); | 401 | tlb_op(TLB_V3_PAGE, "c6, c0, 0", uaddr); |
398 | if (tlb_flag(TLB_V4_U_PAGE)) | 402 | tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", uaddr); |
399 | asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc"); | 403 | tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", uaddr); |
400 | if (tlb_flag(TLB_V4_D_PAGE)) | 404 | tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", uaddr); |
401 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc"); | ||
402 | if (tlb_flag(TLB_V4_I_PAGE)) | ||
403 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc"); | ||
404 | if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) | 405 | if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) |
405 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); | 406 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); |
406 | } | 407 | } |
407 | 408 | ||
408 | if (tlb_flag(TLB_V6_U_PAGE)) | 409 | tlb_op(TLB_V6_U_PAGE, "c8, c7, 1", uaddr); |
409 | asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc"); | 410 | tlb_op(TLB_V6_D_PAGE, "c8, c6, 1", uaddr); |
410 | if (tlb_flag(TLB_V6_D_PAGE)) | 411 | tlb_op(TLB_V6_I_PAGE, "c8, c5, 1", uaddr); |
411 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc"); | ||
412 | if (tlb_flag(TLB_V6_I_PAGE)) | ||
413 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc"); | ||
414 | if (tlb_flag(TLB_V7_UIS_PAGE)) | ||
415 | #ifdef CONFIG_ARM_ERRATA_720789 | 412 | #ifdef CONFIG_ARM_ERRATA_720789 |
416 | asm("mcr p15, 0, %0, c8, c3, 3" : : "r" (uaddr & PAGE_MASK) : "cc"); | 413 | tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 3", uaddr & PAGE_MASK); |
417 | #else | 414 | #else |
418 | asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (uaddr) : "cc"); | 415 | tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 1", uaddr); |
419 | #endif | 416 | #endif |
420 | 417 | ||
421 | if (tlb_flag(TLB_BARRIER)) | 418 | if (tlb_flag(TLB_BARRIER)) |
@@ -432,25 +429,17 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr) | |||
432 | if (tlb_flag(TLB_WB)) | 429 | if (tlb_flag(TLB_WB)) |
433 | dsb(); | 430 | dsb(); |
434 | 431 | ||
435 | if (tlb_flag(TLB_V3_PAGE)) | 432 | tlb_op(TLB_V3_PAGE, "c6, c0, 0", kaddr); |
436 | asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc"); | 433 | tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", kaddr); |
437 | if (tlb_flag(TLB_V4_U_PAGE)) | 434 | tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", kaddr); |
438 | asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc"); | 435 | tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", kaddr); |
439 | if (tlb_flag(TLB_V4_D_PAGE)) | ||
440 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc"); | ||
441 | if (tlb_flag(TLB_V4_I_PAGE)) | ||
442 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc"); | ||
443 | if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) | 436 | if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) |
444 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); | 437 | asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); |
445 | 438 | ||
446 | if (tlb_flag(TLB_V6_U_PAGE)) | 439 | tlb_op(TLB_V6_U_PAGE, "c8, c7, 1", kaddr); |
447 | asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc"); | 440 | tlb_op(TLB_V6_D_PAGE, "c8, c6, 1", kaddr); |
448 | if (tlb_flag(TLB_V6_D_PAGE)) | 441 | tlb_op(TLB_V6_I_PAGE, "c8, c5, 1", kaddr); |
449 | asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc"); | 442 | tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 1", kaddr); |
450 | if (tlb_flag(TLB_V6_I_PAGE)) | ||
451 | asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc"); | ||
452 | if (tlb_flag(TLB_V7_UIS_PAGE)) | ||
453 | asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (kaddr) : "cc"); | ||
454 | 443 | ||
455 | if (tlb_flag(TLB_BARRIER)) { | 444 | if (tlb_flag(TLB_BARRIER)) { |
456 | dsb(); | 445 | dsb(); |
@@ -475,13 +464,8 @@ static inline void flush_pmd_entry(void *pmd) | |||
475 | { | 464 | { |
476 | const unsigned int __tlb_flag = __cpu_tlb_flags; | 465 | const unsigned int __tlb_flag = __cpu_tlb_flags; |
477 | 466 | ||
478 | if (tlb_flag(TLB_DCLEAN)) | 467 | tlb_op(TLB_DCLEAN, "c7, c10, 1 @ flush_pmd", pmd); |
479 | asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" | 468 | tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1 @ L2 flush_pmd", pmd); |
480 | : : "r" (pmd) : "cc"); | ||
481 | |||
482 | if (tlb_flag(TLB_L2CLEAN_FR)) | ||
483 | asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd" | ||
484 | : : "r" (pmd) : "cc"); | ||
485 | 469 | ||
486 | if (tlb_flag(TLB_WB)) | 470 | if (tlb_flag(TLB_WB)) |
487 | dsb(); | 471 | dsb(); |
@@ -491,15 +475,11 @@ static inline void clean_pmd_entry(void *pmd) | |||
491 | { | 475 | { |
492 | const unsigned int __tlb_flag = __cpu_tlb_flags; | 476 | const unsigned int __tlb_flag = __cpu_tlb_flags; |
493 | 477 | ||
494 | if (tlb_flag(TLB_DCLEAN)) | 478 | tlb_op(TLB_DCLEAN, "c7, c10, 1 @ flush_pmd", pmd); |
495 | asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" | 479 | tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1 @ L2 flush_pmd", pmd); |
496 | : : "r" (pmd) : "cc"); | ||
497 | |||
498 | if (tlb_flag(TLB_L2CLEAN_FR)) | ||
499 | asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd" | ||
500 | : : "r" (pmd) : "cc"); | ||
501 | } | 480 | } |
502 | 481 | ||
482 | #undef tlb_op | ||
503 | #undef tlb_flag | 483 | #undef tlb_flag |
504 | #undef always_tlb_flags | 484 | #undef always_tlb_flags |
505 | #undef possible_tlb_flags | 485 | #undef possible_tlb_flags |
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h index 5b29a6673625..f555bb3664dc 100644 --- a/arch/arm/include/asm/traps.h +++ b/arch/arm/include/asm/traps.h | |||
@@ -46,7 +46,7 @@ static inline int in_exception_text(unsigned long ptr) | |||
46 | return in ? : __in_irqentry_text(ptr); | 46 | return in ? : __in_irqentry_text(ptr); |
47 | } | 47 | } |
48 | 48 | ||
49 | extern void __init early_trap_init(void); | 49 | extern void __init early_trap_init(void *); |
50 | extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame); | 50 | extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame); |
51 | extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs); | 51 | extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs); |
52 | 52 | ||
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 3a274878412e..7b787d642af4 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -7,6 +7,8 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET) | |||
7 | 7 | ||
8 | ifdef CONFIG_FUNCTION_TRACER | 8 | ifdef CONFIG_FUNCTION_TRACER |
9 | CFLAGS_REMOVE_ftrace.o = -pg | 9 | CFLAGS_REMOVE_ftrace.o = -pg |
10 | CFLAGS_REMOVE_insn.o = -pg | ||
11 | CFLAGS_REMOVE_patch.o = -pg | ||
10 | endif | 12 | endif |
11 | 13 | ||
12 | CFLAGS_REMOVE_return_address.o = -pg | 14 | CFLAGS_REMOVE_return_address.o = -pg |
@@ -14,14 +16,14 @@ CFLAGS_REMOVE_return_address.o = -pg | |||
14 | # Object file lists. | 16 | # Object file lists. |
15 | 17 | ||
16 | obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ | 18 | obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ |
17 | process.o ptrace.o return_address.o setup.o signal.o \ | 19 | process.o ptrace.o return_address.o sched_clock.o \ |
18 | sys_arm.o stacktrace.o time.o traps.o | 20 | setup.o signal.o stacktrace.o sys_arm.o time.o traps.o |
19 | 21 | ||
20 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o | 22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o |
21 | 23 | ||
22 | obj-$(CONFIG_LEDS) += leds.o | 24 | obj-$(CONFIG_LEDS) += leds.o |
23 | obj-$(CONFIG_OC_ETM) += etm.o | 25 | obj-$(CONFIG_OC_ETM) += etm.o |
24 | 26 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | |
25 | obj-$(CONFIG_ISA_DMA_API) += dma.o | 27 | obj-$(CONFIG_ISA_DMA_API) += dma.o |
26 | obj-$(CONFIG_FIQ) += fiq.o fiqasm.o | 28 | obj-$(CONFIG_FIQ) += fiq.o fiqasm.o |
27 | obj-$(CONFIG_MODULES) += armksyms.o module.o | 29 | obj-$(CONFIG_MODULES) += armksyms.o module.o |
@@ -29,14 +31,14 @@ obj-$(CONFIG_ARTHUR) += arthur.o | |||
29 | obj-$(CONFIG_ISA_DMA) += dma-isa.o | 31 | obj-$(CONFIG_ISA_DMA) += dma-isa.o |
30 | obj-$(CONFIG_PCI) += bios32.o isa.o | 32 | obj-$(CONFIG_PCI) += bios32.o isa.o |
31 | obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o | 33 | obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o |
32 | obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o | ||
33 | obj-$(CONFIG_SMP) += smp.o smp_tlb.o | 34 | obj-$(CONFIG_SMP) += smp.o smp_tlb.o |
34 | obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o | 35 | obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o |
35 | obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o | 36 | obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o |
36 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 37 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o |
37 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o | 38 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o |
39 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o | ||
38 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o | 40 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o |
39 | obj-$(CONFIG_KPROBES) += kprobes.o kprobes-common.o | 41 | obj-$(CONFIG_KPROBES) += kprobes.o kprobes-common.o patch.o |
40 | ifdef CONFIG_THUMB2_KERNEL | 42 | ifdef CONFIG_THUMB2_KERNEL |
41 | obj-$(CONFIG_KPROBES) += kprobes-thumb.o | 43 | obj-$(CONFIG_KPROBES) += kprobes-thumb.o |
42 | else | 44 | else |
diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c new file mode 100644 index 000000000000..89545f6c8403 --- /dev/null +++ b/arch/arm/kernel/cpuidle.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Linaro Ltd. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/cpuidle.h> | ||
13 | #include <asm/proc-fns.h> | ||
14 | |||
15 | int arm_cpuidle_simple_enter(struct cpuidle_device *dev, | ||
16 | struct cpuidle_driver *drv, int index) | ||
17 | { | ||
18 | cpu_do_idle(); | ||
19 | |||
20 | return index; | ||
21 | } | ||
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S index 204e2160cfcc..c45522c36787 100644 --- a/arch/arm/kernel/debug.S +++ b/arch/arm/kernel/debug.S | |||
@@ -10,6 +10,7 @@ | |||
10 | * 32-bit debugging code | 10 | * 32-bit debugging code |
11 | */ | 11 | */ |
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <asm/assembler.h> | ||
13 | 14 | ||
14 | .text | 15 | .text |
15 | 16 | ||
@@ -100,7 +101,7 @@ | |||
100 | 101 | ||
101 | #endif /* CONFIG_CPU_V6 */ | 102 | #endif /* CONFIG_CPU_V6 */ |
102 | 103 | ||
103 | #else | 104 | #elif !defined(CONFIG_DEBUG_SEMIHOSTING) |
104 | #include <mach/debug-macro.S> | 105 | #include <mach/debug-macro.S> |
105 | #endif /* CONFIG_DEBUG_ICEDCC */ | 106 | #endif /* CONFIG_DEBUG_ICEDCC */ |
106 | 107 | ||
@@ -155,6 +156,8 @@ hexbuf: .space 16 | |||
155 | 156 | ||
156 | .ltorg | 157 | .ltorg |
157 | 158 | ||
159 | #ifndef CONFIG_DEBUG_SEMIHOSTING | ||
160 | |||
158 | ENTRY(printascii) | 161 | ENTRY(printascii) |
159 | addruart_current r3, r1, r2 | 162 | addruart_current r3, r1, r2 |
160 | b 2f | 163 | b 2f |
@@ -177,3 +180,24 @@ ENTRY(printch) | |||
177 | mov r0, #0 | 180 | mov r0, #0 |
178 | b 1b | 181 | b 1b |
179 | ENDPROC(printch) | 182 | ENDPROC(printch) |
183 | |||
184 | #else | ||
185 | |||
186 | ENTRY(printascii) | ||
187 | mov r1, r0 | ||
188 | mov r0, #0x04 @ SYS_WRITE0 | ||
189 | ARM( svc #0x123456 ) | ||
190 | THUMB( svc #0xab ) | ||
191 | mov pc, lr | ||
192 | ENDPROC(printascii) | ||
193 | |||
194 | ENTRY(printch) | ||
195 | adr r1, hexbuf | ||
196 | strb r0, [r1] | ||
197 | mov r0, #0x03 @ SYS_WRITEC | ||
198 | ARM( svc #0x123456 ) | ||
199 | THUMB( svc #0xab ) | ||
200 | mov pc, lr | ||
201 | ENDPROC(printch) | ||
202 | |||
203 | #endif | ||
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 8ec5eed55e37..7fd3ad048da9 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -15,6 +15,7 @@ | |||
15 | * that causes it to save wrong values... Be aware! | 15 | * that causes it to save wrong values... Be aware! |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <asm/assembler.h> | ||
18 | #include <asm/memory.h> | 19 | #include <asm/memory.h> |
19 | #include <asm/glue-df.h> | 20 | #include <asm/glue-df.h> |
20 | #include <asm/glue-pf.h> | 21 | #include <asm/glue-pf.h> |
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index c0062ad1e847..df0bf0c8cb79 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c | |||
@@ -16,10 +16,13 @@ | |||
16 | #include <linux/uaccess.h> | 16 | #include <linux/uaccess.h> |
17 | 17 | ||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/opcodes.h> | ||
19 | #include <asm/ftrace.h> | 20 | #include <asm/ftrace.h> |
20 | 21 | ||
22 | #include "insn.h" | ||
23 | |||
21 | #ifdef CONFIG_THUMB2_KERNEL | 24 | #ifdef CONFIG_THUMB2_KERNEL |
22 | #define NOP 0xeb04f85d /* pop.w {lr} */ | 25 | #define NOP 0xf85deb04 /* pop.w {lr} */ |
23 | #else | 26 | #else |
24 | #define NOP 0xe8bd4000 /* pop {lr} */ | 27 | #define NOP 0xe8bd4000 /* pop {lr} */ |
25 | #endif | 28 | #endif |
@@ -60,76 +63,31 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr) | |||
60 | } | 63 | } |
61 | #endif | 64 | #endif |
62 | 65 | ||
63 | #ifdef CONFIG_THUMB2_KERNEL | ||
64 | static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr, | ||
65 | bool link) | ||
66 | { | ||
67 | unsigned long s, j1, j2, i1, i2, imm10, imm11; | ||
68 | unsigned long first, second; | ||
69 | long offset; | ||
70 | |||
71 | offset = (long)addr - (long)(pc + 4); | ||
72 | if (offset < -16777216 || offset > 16777214) { | ||
73 | WARN_ON_ONCE(1); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | s = (offset >> 24) & 0x1; | ||
78 | i1 = (offset >> 23) & 0x1; | ||
79 | i2 = (offset >> 22) & 0x1; | ||
80 | imm10 = (offset >> 12) & 0x3ff; | ||
81 | imm11 = (offset >> 1) & 0x7ff; | ||
82 | |||
83 | j1 = (!i1) ^ s; | ||
84 | j2 = (!i2) ^ s; | ||
85 | |||
86 | first = 0xf000 | (s << 10) | imm10; | ||
87 | second = 0x9000 | (j1 << 13) | (j2 << 11) | imm11; | ||
88 | if (link) | ||
89 | second |= 1 << 14; | ||
90 | |||
91 | return (second << 16) | first; | ||
92 | } | ||
93 | #else | ||
94 | static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr, | ||
95 | bool link) | ||
96 | { | ||
97 | unsigned long opcode = 0xea000000; | ||
98 | long offset; | ||
99 | |||
100 | if (link) | ||
101 | opcode |= 1 << 24; | ||
102 | |||
103 | offset = (long)addr - (long)(pc + 8); | ||
104 | if (unlikely(offset < -33554432 || offset > 33554428)) { | ||
105 | /* Can't generate branches that far (from ARM ARM). Ftrace | ||
106 | * doesn't generate branches outside of kernel text. | ||
107 | */ | ||
108 | WARN_ON_ONCE(1); | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | offset = (offset >> 2) & 0x00ffffff; | ||
113 | |||
114 | return opcode | offset; | ||
115 | } | ||
116 | #endif | ||
117 | |||
118 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) | 66 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) |
119 | { | 67 | { |
120 | return ftrace_gen_branch(pc, addr, true); | 68 | return arm_gen_branch_link(pc, addr); |
121 | } | 69 | } |
122 | 70 | ||
123 | static int ftrace_modify_code(unsigned long pc, unsigned long old, | 71 | static int ftrace_modify_code(unsigned long pc, unsigned long old, |
124 | unsigned long new) | 72 | unsigned long new, bool validate) |
125 | { | 73 | { |
126 | unsigned long replaced; | 74 | unsigned long replaced; |
127 | 75 | ||
128 | if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) | 76 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { |
129 | return -EFAULT; | 77 | old = __opcode_to_mem_thumb32(old); |
78 | new = __opcode_to_mem_thumb32(new); | ||
79 | } else { | ||
80 | old = __opcode_to_mem_arm(old); | ||
81 | new = __opcode_to_mem_arm(new); | ||
82 | } | ||
130 | 83 | ||
131 | if (replaced != old) | 84 | if (validate) { |
132 | return -EINVAL; | 85 | if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) |
86 | return -EFAULT; | ||
87 | |||
88 | if (replaced != old) | ||
89 | return -EINVAL; | ||
90 | } | ||
133 | 91 | ||
134 | if (probe_kernel_write((void *)pc, &new, MCOUNT_INSN_SIZE)) | 92 | if (probe_kernel_write((void *)pc, &new, MCOUNT_INSN_SIZE)) |
135 | return -EPERM; | 93 | return -EPERM; |
@@ -141,23 +99,21 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old, | |||
141 | 99 | ||
142 | int ftrace_update_ftrace_func(ftrace_func_t func) | 100 | int ftrace_update_ftrace_func(ftrace_func_t func) |
143 | { | 101 | { |
144 | unsigned long pc, old; | 102 | unsigned long pc; |
145 | unsigned long new; | 103 | unsigned long new; |
146 | int ret; | 104 | int ret; |
147 | 105 | ||
148 | pc = (unsigned long)&ftrace_call; | 106 | pc = (unsigned long)&ftrace_call; |
149 | memcpy(&old, &ftrace_call, MCOUNT_INSN_SIZE); | ||
150 | new = ftrace_call_replace(pc, (unsigned long)func); | 107 | new = ftrace_call_replace(pc, (unsigned long)func); |
151 | 108 | ||
152 | ret = ftrace_modify_code(pc, old, new); | 109 | ret = ftrace_modify_code(pc, 0, new, false); |
153 | 110 | ||
154 | #ifdef CONFIG_OLD_MCOUNT | 111 | #ifdef CONFIG_OLD_MCOUNT |
155 | if (!ret) { | 112 | if (!ret) { |
156 | pc = (unsigned long)&ftrace_call_old; | 113 | pc = (unsigned long)&ftrace_call_old; |
157 | memcpy(&old, &ftrace_call_old, MCOUNT_INSN_SIZE); | ||
158 | new = ftrace_call_replace(pc, (unsigned long)func); | 114 | new = ftrace_call_replace(pc, (unsigned long)func); |
159 | 115 | ||
160 | ret = ftrace_modify_code(pc, old, new); | 116 | ret = ftrace_modify_code(pc, 0, new, false); |
161 | } | 117 | } |
162 | #endif | 118 | #endif |
163 | 119 | ||
@@ -172,7 +128,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
172 | old = ftrace_nop_replace(rec); | 128 | old = ftrace_nop_replace(rec); |
173 | new = ftrace_call_replace(ip, adjust_address(rec, addr)); | 129 | new = ftrace_call_replace(ip, adjust_address(rec, addr)); |
174 | 130 | ||
175 | return ftrace_modify_code(rec->ip, old, new); | 131 | return ftrace_modify_code(rec->ip, old, new, true); |
176 | } | 132 | } |
177 | 133 | ||
178 | int ftrace_make_nop(struct module *mod, | 134 | int ftrace_make_nop(struct module *mod, |
@@ -185,7 +141,7 @@ int ftrace_make_nop(struct module *mod, | |||
185 | 141 | ||
186 | old = ftrace_call_replace(ip, adjust_address(rec, addr)); | 142 | old = ftrace_call_replace(ip, adjust_address(rec, addr)); |
187 | new = ftrace_nop_replace(rec); | 143 | new = ftrace_nop_replace(rec); |
188 | ret = ftrace_modify_code(ip, old, new); | 144 | ret = ftrace_modify_code(ip, old, new, true); |
189 | 145 | ||
190 | #ifdef CONFIG_OLD_MCOUNT | 146 | #ifdef CONFIG_OLD_MCOUNT |
191 | if (ret == -EINVAL && addr == MCOUNT_ADDR) { | 147 | if (ret == -EINVAL && addr == MCOUNT_ADDR) { |
@@ -193,7 +149,7 @@ int ftrace_make_nop(struct module *mod, | |||
193 | 149 | ||
194 | old = ftrace_call_replace(ip, adjust_address(rec, addr)); | 150 | old = ftrace_call_replace(ip, adjust_address(rec, addr)); |
195 | new = ftrace_nop_replace(rec); | 151 | new = ftrace_nop_replace(rec); |
196 | ret = ftrace_modify_code(ip, old, new); | 152 | ret = ftrace_modify_code(ip, old, new, true); |
197 | } | 153 | } |
198 | #endif | 154 | #endif |
199 | 155 | ||
@@ -249,12 +205,12 @@ static int __ftrace_modify_caller(unsigned long *callsite, | |||
249 | { | 205 | { |
250 | unsigned long caller_fn = (unsigned long) func; | 206 | unsigned long caller_fn = (unsigned long) func; |
251 | unsigned long pc = (unsigned long) callsite; | 207 | unsigned long pc = (unsigned long) callsite; |
252 | unsigned long branch = ftrace_gen_branch(pc, caller_fn, false); | 208 | unsigned long branch = arm_gen_branch(pc, caller_fn); |
253 | unsigned long nop = 0xe1a00000; /* mov r0, r0 */ | 209 | unsigned long nop = 0xe1a00000; /* mov r0, r0 */ |
254 | unsigned long old = enable ? nop : branch; | 210 | unsigned long old = enable ? nop : branch; |
255 | unsigned long new = enable ? branch : nop; | 211 | unsigned long new = enable ? branch : nop; |
256 | 212 | ||
257 | return ftrace_modify_code(pc, old, new); | 213 | return ftrace_modify_code(pc, old, new, true); |
258 | } | 214 | } |
259 | 215 | ||
260 | static int ftrace_modify_graph_caller(bool enable) | 216 | static int ftrace_modify_graph_caller(bool enable) |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index a2e9694a68ee..3bf0c7f8b043 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -265,7 +265,7 @@ __create_page_tables: | |||
265 | str r6, [r3] | 265 | str r6, [r3] |
266 | 266 | ||
267 | #ifdef CONFIG_DEBUG_LL | 267 | #ifdef CONFIG_DEBUG_LL |
268 | #ifndef CONFIG_DEBUG_ICEDCC | 268 | #if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING) |
269 | /* | 269 | /* |
270 | * Map in IO space for serial debugging. | 270 | * Map in IO space for serial debugging. |
271 | * This allows debug messages to be output | 271 | * This allows debug messages to be output |
@@ -297,10 +297,10 @@ __create_page_tables: | |||
297 | cmp r0, r6 | 297 | cmp r0, r6 |
298 | blo 1b | 298 | blo 1b |
299 | 299 | ||
300 | #else /* CONFIG_DEBUG_ICEDCC */ | 300 | #else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */ |
301 | /* we don't need any serial debugging mappings for ICEDCC */ | 301 | /* we don't need any serial debugging mappings */ |
302 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags | 302 | ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags |
303 | #endif /* !CONFIG_DEBUG_ICEDCC */ | 303 | #endif |
304 | 304 | ||
305 | #if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS) | 305 | #if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS) |
306 | /* | 306 | /* |
diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c new file mode 100644 index 000000000000..ab312e516546 --- /dev/null +++ b/arch/arm/kernel/insn.c | |||
@@ -0,0 +1,61 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <asm/opcodes.h> | ||
3 | |||
4 | static unsigned long | ||
5 | __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) | ||
6 | { | ||
7 | unsigned long s, j1, j2, i1, i2, imm10, imm11; | ||
8 | unsigned long first, second; | ||
9 | long offset; | ||
10 | |||
11 | offset = (long)addr - (long)(pc + 4); | ||
12 | if (offset < -16777216 || offset > 16777214) { | ||
13 | WARN_ON_ONCE(1); | ||
14 | return 0; | ||
15 | } | ||
16 | |||
17 | s = (offset >> 24) & 0x1; | ||
18 | i1 = (offset >> 23) & 0x1; | ||
19 | i2 = (offset >> 22) & 0x1; | ||
20 | imm10 = (offset >> 12) & 0x3ff; | ||
21 | imm11 = (offset >> 1) & 0x7ff; | ||
22 | |||
23 | j1 = (!i1) ^ s; | ||
24 | j2 = (!i2) ^ s; | ||
25 | |||
26 | first = 0xf000 | (s << 10) | imm10; | ||
27 | second = 0x9000 | (j1 << 13) | (j2 << 11) | imm11; | ||
28 | if (link) | ||
29 | second |= 1 << 14; | ||
30 | |||
31 | return __opcode_thumb32_compose(first, second); | ||
32 | } | ||
33 | |||
34 | static unsigned long | ||
35 | __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) | ||
36 | { | ||
37 | unsigned long opcode = 0xea000000; | ||
38 | long offset; | ||
39 | |||
40 | if (link) | ||
41 | opcode |= 1 << 24; | ||
42 | |||
43 | offset = (long)addr - (long)(pc + 8); | ||
44 | if (unlikely(offset < -33554432 || offset > 33554428)) { | ||
45 | WARN_ON_ONCE(1); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | offset = (offset >> 2) & 0x00ffffff; | ||
50 | |||
51 | return opcode | offset; | ||
52 | } | ||
53 | |||
54 | unsigned long | ||
55 | __arm_gen_branch(unsigned long pc, unsigned long addr, bool link) | ||
56 | { | ||
57 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) | ||
58 | return __arm_gen_branch_thumb2(pc, addr, link); | ||
59 | else | ||
60 | return __arm_gen_branch_arm(pc, addr, link); | ||
61 | } | ||
diff --git a/arch/arm/kernel/insn.h b/arch/arm/kernel/insn.h new file mode 100644 index 000000000000..e96065da4dae --- /dev/null +++ b/arch/arm/kernel/insn.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __ASM_ARM_INSN_H | ||
2 | #define __ASM_ARM_INSN_H | ||
3 | |||
4 | static inline unsigned long | ||
5 | arm_gen_nop(void) | ||
6 | { | ||
7 | #ifdef CONFIG_THUMB2_KERNEL | ||
8 | return 0xf3af8000; /* nop.w */ | ||
9 | #else | ||
10 | return 0xe1a00000; /* mov r0, r0 */ | ||
11 | #endif | ||
12 | } | ||
13 | |||
14 | unsigned long | ||
15 | __arm_gen_branch(unsigned long pc, unsigned long addr, bool link); | ||
16 | |||
17 | static inline unsigned long | ||
18 | arm_gen_branch(unsigned long pc, unsigned long addr) | ||
19 | { | ||
20 | return __arm_gen_branch(pc, addr, false); | ||
21 | } | ||
22 | |||
23 | static inline unsigned long | ||
24 | arm_gen_branch_link(unsigned long pc, unsigned long addr) | ||
25 | { | ||
26 | return __arm_gen_branch(pc, addr, true); | ||
27 | } | ||
28 | |||
29 | #endif | ||
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 6a6a097edd61..71ccdbfed662 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
@@ -180,10 +180,7 @@ void migrate_irqs(void) | |||
180 | local_irq_save(flags); | 180 | local_irq_save(flags); |
181 | 181 | ||
182 | for_each_irq_desc(i, desc) { | 182 | for_each_irq_desc(i, desc) { |
183 | bool affinity_broken = false; | 183 | bool affinity_broken; |
184 | |||
185 | if (!desc) | ||
186 | continue; | ||
187 | 184 | ||
188 | raw_spin_lock(&desc->lock); | 185 | raw_spin_lock(&desc->lock); |
189 | affinity_broken = migrate_one_irq(desc); | 186 | affinity_broken = migrate_one_irq(desc); |
diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c new file mode 100644 index 000000000000..4ce4f789446d --- /dev/null +++ b/arch/arm/kernel/jump_label.c | |||
@@ -0,0 +1,39 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/jump_label.h> | ||
3 | |||
4 | #include "insn.h" | ||
5 | #include "patch.h" | ||
6 | |||
7 | #ifdef HAVE_JUMP_LABEL | ||
8 | |||
9 | static void __arch_jump_label_transform(struct jump_entry *entry, | ||
10 | enum jump_label_type type, | ||
11 | bool is_static) | ||
12 | { | ||
13 | void *addr = (void *)entry->code; | ||
14 | unsigned int insn; | ||
15 | |||
16 | if (type == JUMP_LABEL_ENABLE) | ||
17 | insn = arm_gen_branch(entry->code, entry->target); | ||
18 | else | ||
19 | insn = arm_gen_nop(); | ||
20 | |||
21 | if (is_static) | ||
22 | __patch_text(addr, insn); | ||
23 | else | ||
24 | patch_text(addr, insn); | ||
25 | } | ||
26 | |||
27 | void arch_jump_label_transform(struct jump_entry *entry, | ||
28 | enum jump_label_type type) | ||
29 | { | ||
30 | __arch_jump_label_transform(entry, type, false); | ||
31 | } | ||
32 | |||
33 | void arch_jump_label_transform_static(struct jump_entry *entry, | ||
34 | enum jump_label_type type) | ||
35 | { | ||
36 | __arch_jump_label_transform(entry, type, true); | ||
37 | } | ||
38 | |||
39 | #endif | ||
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index 129c1163248b..ab1869dac97a 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/cacheflush.h> | 29 | #include <asm/cacheflush.h> |
30 | 30 | ||
31 | #include "kprobes.h" | 31 | #include "kprobes.h" |
32 | #include "patch.h" | ||
32 | 33 | ||
33 | #define MIN_STACK_SIZE(addr) \ | 34 | #define MIN_STACK_SIZE(addr) \ |
34 | min((unsigned long)MAX_STACK_SIZE, \ | 35 | min((unsigned long)MAX_STACK_SIZE, \ |
@@ -103,57 +104,33 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
103 | return 0; | 104 | return 0; |
104 | } | 105 | } |
105 | 106 | ||
106 | #ifdef CONFIG_THUMB2_KERNEL | ||
107 | |||
108 | /* | ||
109 | * For a 32-bit Thumb breakpoint spanning two memory words we need to take | ||
110 | * special precautions to insert the breakpoint atomically, especially on SMP | ||
111 | * systems. This is achieved by calling this arming function using stop_machine. | ||
112 | */ | ||
113 | static int __kprobes set_t32_breakpoint(void *addr) | ||
114 | { | ||
115 | ((u16 *)addr)[0] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION >> 16; | ||
116 | ((u16 *)addr)[1] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION & 0xffff; | ||
117 | flush_insns(addr, 2*sizeof(u16)); | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 107 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
122 | { | 108 | { |
123 | uintptr_t addr = (uintptr_t)p->addr & ~1; /* Remove any Thumb flag */ | 109 | unsigned int brkp; |
124 | 110 | void *addr; | |
125 | if (!is_wide_instruction(p->opcode)) { | 111 | |
126 | *(u16 *)addr = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION; | 112 | if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { |
127 | flush_insns(addr, sizeof(u16)); | 113 | /* Remove any Thumb flag */ |
128 | } else if (addr & 2) { | 114 | addr = (void *)((uintptr_t)p->addr & ~1); |
129 | /* A 32-bit instruction spanning two words needs special care */ | 115 | |
130 | stop_machine(set_t32_breakpoint, (void *)addr, &cpu_online_map); | 116 | if (is_wide_instruction(p->opcode)) |
117 | brkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION; | ||
118 | else | ||
119 | brkp = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION; | ||
131 | } else { | 120 | } else { |
132 | /* Word aligned 32-bit instruction can be written atomically */ | 121 | kprobe_opcode_t insn = p->opcode; |
133 | u32 bkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION; | ||
134 | #ifndef __ARMEB__ /* Swap halfwords for little-endian */ | ||
135 | bkp = (bkp >> 16) | (bkp << 16); | ||
136 | #endif | ||
137 | *(u32 *)addr = bkp; | ||
138 | flush_insns(addr, sizeof(u32)); | ||
139 | } | ||
140 | } | ||
141 | 122 | ||
142 | #else /* !CONFIG_THUMB2_KERNEL */ | 123 | addr = p->addr; |
124 | brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION; | ||
143 | 125 | ||
144 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 126 | if (insn >= 0xe0000000) |
145 | { | 127 | brkp |= 0xe0000000; /* Unconditional instruction */ |
146 | kprobe_opcode_t insn = p->opcode; | 128 | else |
147 | kprobe_opcode_t brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION; | 129 | brkp |= insn & 0xf0000000; /* Copy condition from insn */ |
148 | if (insn >= 0xe0000000) | 130 | } |
149 | brkp |= 0xe0000000; /* Unconditional instruction */ | ||
150 | else | ||
151 | brkp |= insn & 0xf0000000; /* Copy condition from insn */ | ||
152 | *p->addr = brkp; | ||
153 | flush_insns(p->addr, sizeof(p->addr[0])); | ||
154 | } | ||
155 | 131 | ||
156 | #endif /* !CONFIG_THUMB2_KERNEL */ | 132 | patch_text(addr, brkp); |
133 | } | ||
157 | 134 | ||
158 | /* | 135 | /* |
159 | * The actual disarming is done here on each CPU and synchronized using | 136 | * The actual disarming is done here on each CPU and synchronized using |
@@ -166,25 +143,10 @@ void __kprobes arch_arm_kprobe(struct kprobe *p) | |||
166 | int __kprobes __arch_disarm_kprobe(void *p) | 143 | int __kprobes __arch_disarm_kprobe(void *p) |
167 | { | 144 | { |
168 | struct kprobe *kp = p; | 145 | struct kprobe *kp = p; |
169 | #ifdef CONFIG_THUMB2_KERNEL | 146 | void *addr = (void *)((uintptr_t)kp->addr & ~1); |
170 | u16 *addr = (u16 *)((uintptr_t)kp->addr & ~1); | ||
171 | kprobe_opcode_t insn = kp->opcode; | ||
172 | unsigned int len; | ||
173 | 147 | ||
174 | if (is_wide_instruction(insn)) { | 148 | __patch_text(addr, kp->opcode); |
175 | ((u16 *)addr)[0] = insn>>16; | ||
176 | ((u16 *)addr)[1] = insn; | ||
177 | len = 2*sizeof(u16); | ||
178 | } else { | ||
179 | ((u16 *)addr)[0] = insn; | ||
180 | len = sizeof(u16); | ||
181 | } | ||
182 | flush_insns(addr, len); | ||
183 | 149 | ||
184 | #else /* !CONFIG_THUMB2_KERNEL */ | ||
185 | *kp->addr = kp->opcode; | ||
186 | flush_insns(kp->addr, sizeof(kp->addr[0])); | ||
187 | #endif | ||
188 | return 0; | 150 | return 0; |
189 | } | 151 | } |
190 | 152 | ||
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index 56995983eed8..dfcdb9f7c126 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | #include <linux/reboot.h> | 8 | #include <linux/reboot.h> |
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/irq.h> | ||
10 | #include <asm/pgtable.h> | 11 | #include <asm/pgtable.h> |
11 | #include <asm/pgalloc.h> | 12 | #include <asm/pgalloc.h> |
12 | #include <asm/mmu_context.h> | 13 | #include <asm/mmu_context.h> |
@@ -53,6 +54,29 @@ void machine_crash_nonpanic_core(void *unused) | |||
53 | cpu_relax(); | 54 | cpu_relax(); |
54 | } | 55 | } |
55 | 56 | ||
57 | static void machine_kexec_mask_interrupts(void) | ||
58 | { | ||
59 | unsigned int i; | ||
60 | struct irq_desc *desc; | ||
61 | |||
62 | for_each_irq_desc(i, desc) { | ||
63 | struct irq_chip *chip; | ||
64 | |||
65 | chip = irq_desc_get_chip(desc); | ||
66 | if (!chip) | ||
67 | continue; | ||
68 | |||
69 | if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) | ||
70 | chip->irq_eoi(&desc->irq_data); | ||
71 | |||
72 | if (chip->irq_mask) | ||
73 | chip->irq_mask(&desc->irq_data); | ||
74 | |||
75 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data)) | ||
76 | chip->irq_disable(&desc->irq_data); | ||
77 | } | ||
78 | } | ||
79 | |||
56 | void machine_crash_shutdown(struct pt_regs *regs) | 80 | void machine_crash_shutdown(struct pt_regs *regs) |
57 | { | 81 | { |
58 | unsigned long msecs; | 82 | unsigned long msecs; |
@@ -70,6 +94,7 @@ void machine_crash_shutdown(struct pt_regs *regs) | |||
70 | printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n"); | 94 | printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n"); |
71 | 95 | ||
72 | crash_save_cpu(regs, smp_processor_id()); | 96 | crash_save_cpu(regs, smp_processor_id()); |
97 | machine_kexec_mask_interrupts(); | ||
73 | 98 | ||
74 | printk(KERN_INFO "Loading crashdump kernel...\n"); | 99 | printk(KERN_INFO "Loading crashdump kernel...\n"); |
75 | } | 100 | } |
diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c new file mode 100644 index 000000000000..07314af47733 --- /dev/null +++ b/arch/arm/kernel/patch.c | |||
@@ -0,0 +1,75 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/kprobes.h> | ||
3 | #include <linux/stop_machine.h> | ||
4 | |||
5 | #include <asm/cacheflush.h> | ||
6 | #include <asm/smp_plat.h> | ||
7 | #include <asm/opcodes.h> | ||
8 | |||
9 | #include "patch.h" | ||
10 | |||
11 | struct patch { | ||
12 | void *addr; | ||
13 | unsigned int insn; | ||
14 | }; | ||
15 | |||
16 | void __kprobes __patch_text(void *addr, unsigned int insn) | ||
17 | { | ||
18 | bool thumb2 = IS_ENABLED(CONFIG_THUMB2_KERNEL); | ||
19 | int size; | ||
20 | |||
21 | if (thumb2 && __opcode_is_thumb16(insn)) { | ||
22 | *(u16 *)addr = __opcode_to_mem_thumb16(insn); | ||
23 | size = sizeof(u16); | ||
24 | } else if (thumb2 && ((uintptr_t)addr & 2)) { | ||
25 | u16 first = __opcode_thumb32_first(insn); | ||
26 | u16 second = __opcode_thumb32_second(insn); | ||
27 | u16 *addrh = addr; | ||
28 | |||
29 | addrh[0] = __opcode_to_mem_thumb16(first); | ||
30 | addrh[1] = __opcode_to_mem_thumb16(second); | ||
31 | |||
32 | size = sizeof(u32); | ||
33 | } else { | ||
34 | if (thumb2) | ||
35 | insn = __opcode_to_mem_thumb32(insn); | ||
36 | else | ||
37 | insn = __opcode_to_mem_arm(insn); | ||
38 | |||
39 | *(u32 *)addr = insn; | ||
40 | size = sizeof(u32); | ||
41 | } | ||
42 | |||
43 | flush_icache_range((uintptr_t)(addr), | ||
44 | (uintptr_t)(addr) + size); | ||
45 | } | ||
46 | |||
47 | static int __kprobes patch_text_stop_machine(void *data) | ||
48 | { | ||
49 | struct patch *patch = data; | ||
50 | |||
51 | __patch_text(patch->addr, patch->insn); | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | void __kprobes patch_text(void *addr, unsigned int insn) | ||
57 | { | ||
58 | struct patch patch = { | ||
59 | .addr = addr, | ||
60 | .insn = insn, | ||
61 | }; | ||
62 | |||
63 | if (cache_ops_need_broadcast()) { | ||
64 | stop_machine(patch_text_stop_machine, &patch, cpu_online_mask); | ||
65 | } else { | ||
66 | bool straddles_word = IS_ENABLED(CONFIG_THUMB2_KERNEL) | ||
67 | && __opcode_is_thumb32(insn) | ||
68 | && ((uintptr_t)addr & 2); | ||
69 | |||
70 | if (straddles_word) | ||
71 | stop_machine(patch_text_stop_machine, &patch, NULL); | ||
72 | else | ||
73 | __patch_text(addr, insn); | ||
74 | } | ||
75 | } | ||
diff --git a/arch/arm/kernel/patch.h b/arch/arm/kernel/patch.h new file mode 100644 index 000000000000..b4731f2dac38 --- /dev/null +++ b/arch/arm/kernel/patch.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef _ARM_KERNEL_PATCH_H | ||
2 | #define _ARM_KERNEL_PATCH_H | ||
3 | |||
4 | void patch_text(void *addr, unsigned int insn); | ||
5 | void __patch_text(void *addr, unsigned int insn); | ||
6 | |||
7 | #endif | ||
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 8a89d3b7626b..186c8cb982c5 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -738,6 +738,9 @@ init_hw_perf_events(void) | |||
738 | case 0xC0F0: /* Cortex-A15 */ | 738 | case 0xC0F0: /* Cortex-A15 */ |
739 | cpu_pmu = armv7_a15_pmu_init(); | 739 | cpu_pmu = armv7_a15_pmu_init(); |
740 | break; | 740 | break; |
741 | case 0xC070: /* Cortex-A7 */ | ||
742 | cpu_pmu = armv7_a7_pmu_init(); | ||
743 | break; | ||
741 | } | 744 | } |
742 | /* Intel CPUs [xscale]. */ | 745 | /* Intel CPUs [xscale]. */ |
743 | } else if (0x69 == implementor) { | 746 | } else if (0x69 == implementor) { |
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 4d7095af2ab3..00755d82e2f2 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c | |||
@@ -610,6 +610,130 @@ static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] | |||
610 | }; | 610 | }; |
611 | 611 | ||
612 | /* | 612 | /* |
613 | * Cortex-A7 HW events mapping | ||
614 | */ | ||
615 | static const unsigned armv7_a7_perf_map[PERF_COUNT_HW_MAX] = { | ||
616 | [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, | ||
617 | [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED, | ||
618 | [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, | ||
619 | [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL, | ||
620 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, | ||
621 | [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, | ||
622 | [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES, | ||
623 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED, | ||
624 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED, | ||
625 | }; | ||
626 | |||
627 | static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] | ||
628 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
629 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = { | ||
630 | [C(L1D)] = { | ||
631 | /* | ||
632 | * The performance counters don't differentiate between read | ||
633 | * and write accesses/misses so this isn't strictly correct, | ||
634 | * but it's the best we can do. Writes and reads get | ||
635 | * combined. | ||
636 | */ | ||
637 | [C(OP_READ)] = { | ||
638 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, | ||
639 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, | ||
640 | }, | ||
641 | [C(OP_WRITE)] = { | ||
642 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS, | ||
643 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL, | ||
644 | }, | ||
645 | [C(OP_PREFETCH)] = { | ||
646 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
647 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
648 | }, | ||
649 | }, | ||
650 | [C(L1I)] = { | ||
651 | [C(OP_READ)] = { | ||
652 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, | ||
653 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, | ||
654 | }, | ||
655 | [C(OP_WRITE)] = { | ||
656 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS, | ||
657 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL, | ||
658 | }, | ||
659 | [C(OP_PREFETCH)] = { | ||
660 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
661 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
662 | }, | ||
663 | }, | ||
664 | [C(LL)] = { | ||
665 | [C(OP_READ)] = { | ||
666 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS, | ||
667 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL, | ||
668 | }, | ||
669 | [C(OP_WRITE)] = { | ||
670 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS, | ||
671 | [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL, | ||
672 | }, | ||
673 | [C(OP_PREFETCH)] = { | ||
674 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
675 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
676 | }, | ||
677 | }, | ||
678 | [C(DTLB)] = { | ||
679 | [C(OP_READ)] = { | ||
680 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
681 | [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL, | ||
682 | }, | ||
683 | [C(OP_WRITE)] = { | ||
684 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
685 | [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL, | ||
686 | }, | ||
687 | [C(OP_PREFETCH)] = { | ||
688 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
689 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
690 | }, | ||
691 | }, | ||
692 | [C(ITLB)] = { | ||
693 | [C(OP_READ)] = { | ||
694 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
695 | [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL, | ||
696 | }, | ||
697 | [C(OP_WRITE)] = { | ||
698 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
699 | [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL, | ||
700 | }, | ||
701 | [C(OP_PREFETCH)] = { | ||
702 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
703 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
704 | }, | ||
705 | }, | ||
706 | [C(BPU)] = { | ||
707 | [C(OP_READ)] = { | ||
708 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED, | ||
709 | [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, | ||
710 | }, | ||
711 | [C(OP_WRITE)] = { | ||
712 | [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED, | ||
713 | [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, | ||
714 | }, | ||
715 | [C(OP_PREFETCH)] = { | ||
716 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
717 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
718 | }, | ||
719 | }, | ||
720 | [C(NODE)] = { | ||
721 | [C(OP_READ)] = { | ||
722 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
723 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
724 | }, | ||
725 | [C(OP_WRITE)] = { | ||
726 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
727 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
728 | }, | ||
729 | [C(OP_PREFETCH)] = { | ||
730 | [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | ||
731 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | ||
732 | }, | ||
733 | }, | ||
734 | }; | ||
735 | |||
736 | /* | ||
613 | * Perf Events' indices | 737 | * Perf Events' indices |
614 | */ | 738 | */ |
615 | #define ARMV7_IDX_CYCLE_COUNTER 0 | 739 | #define ARMV7_IDX_CYCLE_COUNTER 0 |
@@ -1104,6 +1228,12 @@ static int armv7_a15_map_event(struct perf_event *event) | |||
1104 | &armv7_a15_perf_cache_map, 0xFF); | 1228 | &armv7_a15_perf_cache_map, 0xFF); |
1105 | } | 1229 | } |
1106 | 1230 | ||
1231 | static int armv7_a7_map_event(struct perf_event *event) | ||
1232 | { | ||
1233 | return map_cpu_event(event, &armv7_a7_perf_map, | ||
1234 | &armv7_a7_perf_cache_map, 0xFF); | ||
1235 | } | ||
1236 | |||
1107 | static struct arm_pmu armv7pmu = { | 1237 | static struct arm_pmu armv7pmu = { |
1108 | .handle_irq = armv7pmu_handle_irq, | 1238 | .handle_irq = armv7pmu_handle_irq, |
1109 | .enable = armv7pmu_enable_event, | 1239 | .enable = armv7pmu_enable_event, |
@@ -1164,6 +1294,16 @@ static struct arm_pmu *__init armv7_a15_pmu_init(void) | |||
1164 | armv7pmu.set_event_filter = armv7pmu_set_event_filter; | 1294 | armv7pmu.set_event_filter = armv7pmu_set_event_filter; |
1165 | return &armv7pmu; | 1295 | return &armv7pmu; |
1166 | } | 1296 | } |
1297 | |||
1298 | static struct arm_pmu *__init armv7_a7_pmu_init(void) | ||
1299 | { | ||
1300 | armv7pmu.id = ARM_PERF_PMU_ID_CA7; | ||
1301 | armv7pmu.name = "ARMv7 Cortex-A7"; | ||
1302 | armv7pmu.map_event = armv7_a7_map_event; | ||
1303 | armv7pmu.num_events = armv7_read_num_pmnc_events(); | ||
1304 | armv7pmu.set_event_filter = armv7pmu_set_event_filter; | ||
1305 | return &armv7pmu; | ||
1306 | } | ||
1167 | #else | 1307 | #else |
1168 | static struct arm_pmu *__init armv7_a8_pmu_init(void) | 1308 | static struct arm_pmu *__init armv7_a8_pmu_init(void) |
1169 | { | 1309 | { |
@@ -1184,4 +1324,9 @@ static struct arm_pmu *__init armv7_a15_pmu_init(void) | |||
1184 | { | 1324 | { |
1185 | return NULL; | 1325 | return NULL; |
1186 | } | 1326 | } |
1327 | |||
1328 | static struct arm_pmu *__init armv7_a7_pmu_init(void) | ||
1329 | { | ||
1330 | return NULL; | ||
1331 | } | ||
1187 | #endif /* CONFIG_CPU_V7 */ | 1332 | #endif /* CONFIG_CPU_V7 */ |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 7b9cddef6e53..2b7b017a20cd 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -528,21 +528,39 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
528 | #ifdef CONFIG_MMU | 528 | #ifdef CONFIG_MMU |
529 | /* | 529 | /* |
530 | * The vectors page is always readable from user space for the | 530 | * The vectors page is always readable from user space for the |
531 | * atomic helpers and the signal restart code. Let's declare a mapping | 531 | * atomic helpers and the signal restart code. Insert it into the |
532 | * for it so it is visible through ptrace and /proc/<pid>/mem. | 532 | * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. |
533 | */ | 533 | */ |
534 | static struct vm_area_struct gate_vma; | ||
534 | 535 | ||
535 | int vectors_user_mapping(void) | 536 | static int __init gate_vma_init(void) |
536 | { | 537 | { |
537 | struct mm_struct *mm = current->mm; | 538 | gate_vma.vm_start = 0xffff0000; |
538 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, | 539 | gate_vma.vm_end = 0xffff0000 + PAGE_SIZE; |
539 | VM_READ | VM_EXEC | | 540 | gate_vma.vm_page_prot = PAGE_READONLY_EXEC; |
540 | VM_MAYREAD | VM_MAYEXEC | VM_RESERVED, | 541 | gate_vma.vm_flags = VM_READ | VM_EXEC | |
541 | NULL); | 542 | VM_MAYREAD | VM_MAYEXEC; |
543 | return 0; | ||
544 | } | ||
545 | arch_initcall(gate_vma_init); | ||
546 | |||
547 | struct vm_area_struct *get_gate_vma(struct mm_struct *mm) | ||
548 | { | ||
549 | return &gate_vma; | ||
550 | } | ||
551 | |||
552 | int in_gate_area(struct mm_struct *mm, unsigned long addr) | ||
553 | { | ||
554 | return (addr >= gate_vma.vm_start) && (addr < gate_vma.vm_end); | ||
555 | } | ||
556 | |||
557 | int in_gate_area_no_mm(unsigned long addr) | ||
558 | { | ||
559 | return in_gate_area(NULL, addr); | ||
542 | } | 560 | } |
543 | 561 | ||
544 | const char *arch_vma_name(struct vm_area_struct *vma) | 562 | const char *arch_vma_name(struct vm_area_struct *vma) |
545 | { | 563 | { |
546 | return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL; | 564 | return (vma == &gate_vma) ? "[vectors]" : NULL; |
547 | } | 565 | } |
548 | #endif | 566 | #endif |
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 5416c7c12528..27d186abbc06 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/jiffies.h> | 10 | #include <linux/jiffies.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/syscore_ops.h> | ||
13 | #include <linux/timer.h> | 14 | #include <linux/timer.h> |
14 | 15 | ||
15 | #include <asm/sched_clock.h> | 16 | #include <asm/sched_clock.h> |
@@ -164,3 +165,20 @@ void __init sched_clock_postinit(void) | |||
164 | 165 | ||
165 | sched_clock_poll(sched_clock_timer.data); | 166 | sched_clock_poll(sched_clock_timer.data); |
166 | } | 167 | } |
168 | |||
169 | static int sched_clock_suspend(void) | ||
170 | { | ||
171 | sched_clock_poll(sched_clock_timer.data); | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static struct syscore_ops sched_clock_ops = { | ||
176 | .suspend = sched_clock_suspend, | ||
177 | }; | ||
178 | |||
179 | static int __init sched_clock_syscore_init(void) | ||
180 | { | ||
181 | register_syscore_ops(&sched_clock_ops); | ||
182 | return 0; | ||
183 | } | ||
184 | device_initcall(sched_clock_syscore_init); | ||
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 9e0fdb3a1988..b91411371ae1 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -976,7 +976,6 @@ void __init setup_arch(char **cmdline_p) | |||
976 | conswitchp = &dummy_con; | 976 | conswitchp = &dummy_con; |
977 | #endif | 977 | #endif |
978 | #endif | 978 | #endif |
979 | early_trap_init(); | ||
980 | 979 | ||
981 | if (mdesc->init_early) | 980 | if (mdesc->init_early) |
982 | mdesc->init_early(); | 981 | mdesc->init_early(); |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 9e617bd4a146..7cb532fc8aa4 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -66,12 +66,13 @@ const unsigned long syscall_restart_code[2] = { | |||
66 | */ | 66 | */ |
67 | asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) | 67 | asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) |
68 | { | 68 | { |
69 | mask &= _BLOCKABLE; | 69 | sigset_t blocked; |
70 | spin_lock_irq(¤t->sighand->siglock); | 70 | |
71 | current->saved_sigmask = current->blocked; | 71 | current->saved_sigmask = current->blocked; |
72 | siginitset(¤t->blocked, mask); | 72 | |
73 | recalc_sigpending(); | 73 | mask &= _BLOCKABLE; |
74 | spin_unlock_irq(¤t->sighand->siglock); | 74 | siginitset(&blocked, mask); |
75 | set_current_blocked(&blocked); | ||
75 | 76 | ||
76 | current->state = TASK_INTERRUPTIBLE; | 77 | current->state = TASK_INTERRUPTIBLE; |
77 | schedule(); | 78 | schedule(); |
@@ -280,10 +281,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) | |||
280 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); | 281 | err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); |
281 | if (err == 0) { | 282 | if (err == 0) { |
282 | sigdelsetmask(&set, ~_BLOCKABLE); | 283 | sigdelsetmask(&set, ~_BLOCKABLE); |
283 | spin_lock_irq(¤t->sighand->siglock); | 284 | set_current_blocked(&set); |
284 | current->blocked = set; | ||
285 | recalc_sigpending(); | ||
286 | spin_unlock_irq(¤t->sighand->siglock); | ||
287 | } | 285 | } |
288 | 286 | ||
289 | __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); | 287 | __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); |
@@ -636,13 +634,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
636 | /* | 634 | /* |
637 | * Block the signal if we were successful. | 635 | * Block the signal if we were successful. |
638 | */ | 636 | */ |
639 | spin_lock_irq(&tsk->sighand->siglock); | 637 | block_sigmask(ka, sig); |
640 | sigorsets(&tsk->blocked, &tsk->blocked, | ||
641 | &ka->sa.sa_mask); | ||
642 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
643 | sigaddset(&tsk->blocked, sig); | ||
644 | recalc_sigpending(); | ||
645 | spin_unlock_irq(&tsk->sighand->siglock); | ||
646 | 638 | ||
647 | return 0; | 639 | return 0; |
648 | } | 640 | } |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 8f8cce2c46c4..2cee7d1eb958 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -58,6 +58,8 @@ enum ipi_msg_type { | |||
58 | IPI_CPU_STOP, | 58 | IPI_CPU_STOP, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static DECLARE_COMPLETION(cpu_running); | ||
62 | |||
61 | int __cpuinit __cpu_up(unsigned int cpu) | 63 | int __cpuinit __cpu_up(unsigned int cpu) |
62 | { | 64 | { |
63 | struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); | 65 | struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); |
@@ -98,20 +100,12 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
98 | */ | 100 | */ |
99 | ret = boot_secondary(cpu, idle); | 101 | ret = boot_secondary(cpu, idle); |
100 | if (ret == 0) { | 102 | if (ret == 0) { |
101 | unsigned long timeout; | ||
102 | |||
103 | /* | 103 | /* |
104 | * CPU was successfully started, wait for it | 104 | * CPU was successfully started, wait for it |
105 | * to come online or time out. | 105 | * to come online or time out. |
106 | */ | 106 | */ |
107 | timeout = jiffies + HZ; | 107 | wait_for_completion_timeout(&cpu_running, |
108 | while (time_before(jiffies, timeout)) { | 108 | msecs_to_jiffies(1000)); |
109 | if (cpu_online(cpu)) | ||
110 | break; | ||
111 | |||
112 | udelay(10); | ||
113 | barrier(); | ||
114 | } | ||
115 | 109 | ||
116 | if (!cpu_online(cpu)) { | 110 | if (!cpu_online(cpu)) { |
117 | pr_crit("CPU%u: failed to come online\n", cpu); | 111 | pr_crit("CPU%u: failed to come online\n", cpu); |
@@ -288,9 +282,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void) | |||
288 | /* | 282 | /* |
289 | * OK, now it's safe to let the boot CPU continue. Wait for | 283 | * OK, now it's safe to let the boot CPU continue. Wait for |
290 | * the CPU migration code to notice that the CPU is online | 284 | * the CPU migration code to notice that the CPU is online |
291 | * before we continue. | 285 | * before we continue - which happens after __cpu_up returns. |
292 | */ | 286 | */ |
293 | set_cpu_online(cpu, true); | 287 | set_cpu_online(cpu, true); |
288 | complete(&cpu_running); | ||
294 | 289 | ||
295 | /* | 290 | /* |
296 | * Setup the percpu timer for this CPU. | 291 | * Setup the percpu timer for this CPU. |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 8c57dd3680e9..fe31b22f18fd 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -25,8 +25,6 @@ | |||
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | 27 | ||
28 | #include <linux/mc146818rtc.h> | ||
29 | |||
30 | #include <asm/leds.h> | 28 | #include <asm/leds.h> |
31 | #include <asm/thread_info.h> | 29 | #include <asm/thread_info.h> |
32 | #include <asm/sched_clock.h> | 30 | #include <asm/sched_clock.h> |
@@ -149,8 +147,6 @@ void __init time_init(void) | |||
149 | { | 147 | { |
150 | system_timer = machine_desc->timer; | 148 | system_timer = machine_desc->timer; |
151 | system_timer->init(); | 149 | system_timer->init(); |
152 | #ifdef CONFIG_HAVE_SCHED_CLOCK | ||
153 | sched_clock_postinit(); | 150 | sched_clock_postinit(); |
154 | #endif | ||
155 | } | 151 | } |
156 | 152 | ||
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index cd77743472a2..778454750a6c 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -227,6 +227,11 @@ void show_stack(struct task_struct *tsk, unsigned long *sp) | |||
227 | #else | 227 | #else |
228 | #define S_SMP "" | 228 | #define S_SMP "" |
229 | #endif | 229 | #endif |
230 | #ifdef CONFIG_THUMB2_KERNEL | ||
231 | #define S_ISA " THUMB2" | ||
232 | #else | ||
233 | #define S_ISA " ARM" | ||
234 | #endif | ||
230 | 235 | ||
231 | static int __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs) | 236 | static int __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs) |
232 | { | 237 | { |
@@ -234,8 +239,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt | |||
234 | static int die_counter; | 239 | static int die_counter; |
235 | int ret; | 240 | int ret; |
236 | 241 | ||
237 | printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", | 242 | printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP |
238 | str, err, ++die_counter); | 243 | S_ISA "\n", str, err, ++die_counter); |
239 | 244 | ||
240 | /* trap and error numbers are mostly meaningless on ARM */ | 245 | /* trap and error numbers are mostly meaningless on ARM */ |
241 | ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); | 246 | ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); |
@@ -784,18 +789,16 @@ static void __init kuser_get_tls_init(unsigned long vectors) | |||
784 | memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); | 789 | memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); |
785 | } | 790 | } |
786 | 791 | ||
787 | void __init early_trap_init(void) | 792 | void __init early_trap_init(void *vectors_base) |
788 | { | 793 | { |
789 | #if defined(CONFIG_CPU_USE_DOMAINS) | 794 | unsigned long vectors = (unsigned long)vectors_base; |
790 | unsigned long vectors = CONFIG_VECTORS_BASE; | ||
791 | #else | ||
792 | unsigned long vectors = (unsigned long)vectors_page; | ||
793 | #endif | ||
794 | extern char __stubs_start[], __stubs_end[]; | 795 | extern char __stubs_start[], __stubs_end[]; |
795 | extern char __vectors_start[], __vectors_end[]; | 796 | extern char __vectors_start[], __vectors_end[]; |
796 | extern char __kuser_helper_start[], __kuser_helper_end[]; | 797 | extern char __kuser_helper_start[], __kuser_helper_end[]; |
797 | int kuser_sz = __kuser_helper_end - __kuser_helper_start; | 798 | int kuser_sz = __kuser_helper_end - __kuser_helper_start; |
798 | 799 | ||
800 | vectors_page = vectors_base; | ||
801 | |||
799 | /* | 802 | /* |
800 | * Copy the vectors, stubs and kuser helpers (in entry-armv.S) | 803 | * Copy the vectors, stubs and kuser helpers (in entry-armv.S) |
801 | * into the vector page, mapped at 0xffff0000, and ensure these | 804 | * into the vector page, mapped at 0xffff0000, and ensure these |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 4320b2096789..698479f1e197 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -437,7 +437,6 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
437 | 437 | ||
438 | /* DMA slave channel configuration */ | 438 | /* DMA slave channel configuration */ |
439 | atslave->dma_dev = &at_hdmac_device.dev; | 439 | atslave->dma_dev = &at_hdmac_device.dev; |
440 | atslave->reg_width = AT_DMA_SLAVE_WIDTH_32BIT; | ||
441 | atslave->cfg = ATC_FIFOCFG_HALFFIFO | 440 | atslave->cfg = ATC_FIFOCFG_HALFFIFO |
442 | | ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW; | 441 | | ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW; |
443 | atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16; | 442 | atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16; |
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c index 555d956b3a57..ece1f9aefb47 100644 --- a/arch/arm/mach-at91/cpuidle.c +++ b/arch/arm/mach-at91/cpuidle.c | |||
@@ -17,9 +17,10 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/cpuidle.h> | 19 | #include <linux/cpuidle.h> |
20 | #include <asm/proc-fns.h> | ||
21 | #include <linux/io.h> | 20 | #include <linux/io.h> |
22 | #include <linux/export.h> | 21 | #include <linux/export.h> |
22 | #include <asm/proc-fns.h> | ||
23 | #include <asm/cpuidle.h> | ||
23 | 24 | ||
24 | #include "pm.h" | 25 | #include "pm.h" |
25 | 26 | ||
@@ -27,61 +28,39 @@ | |||
27 | 28 | ||
28 | static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device); | 29 | static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device); |
29 | 30 | ||
30 | static struct cpuidle_driver at91_idle_driver = { | ||
31 | .name = "at91_idle", | ||
32 | .owner = THIS_MODULE, | ||
33 | }; | ||
34 | |||
35 | /* Actual code that puts the SoC in different idle states */ | 31 | /* Actual code that puts the SoC in different idle states */ |
36 | static int at91_enter_idle(struct cpuidle_device *dev, | 32 | static int at91_enter_idle(struct cpuidle_device *dev, |
37 | struct cpuidle_driver *drv, | 33 | struct cpuidle_driver *drv, |
38 | int index) | 34 | int index) |
39 | { | 35 | { |
40 | struct timeval before, after; | 36 | at91_standby(); |
41 | int idle_time; | ||
42 | |||
43 | local_irq_disable(); | ||
44 | do_gettimeofday(&before); | ||
45 | if (index == 0) | ||
46 | /* Wait for interrupt state */ | ||
47 | cpu_do_idle(); | ||
48 | else if (index == 1) | ||
49 | at91_standby(); | ||
50 | 37 | ||
51 | do_gettimeofday(&after); | ||
52 | local_irq_enable(); | ||
53 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
54 | (after.tv_usec - before.tv_usec); | ||
55 | |||
56 | dev->last_residency = idle_time; | ||
57 | return index; | 38 | return index; |
58 | } | 39 | } |
59 | 40 | ||
41 | static struct cpuidle_driver at91_idle_driver = { | ||
42 | .name = "at91_idle", | ||
43 | .owner = THIS_MODULE, | ||
44 | .en_core_tk_irqen = 1, | ||
45 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
46 | .states[1] = { | ||
47 | .enter = at91_enter_idle, | ||
48 | .exit_latency = 10, | ||
49 | .target_residency = 100000, | ||
50 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
51 | .name = "RAM_SR", | ||
52 | .desc = "WFI and DDR Self Refresh", | ||
53 | }, | ||
54 | .state_count = AT91_MAX_STATES, | ||
55 | }; | ||
56 | |||
60 | /* Initialize CPU idle by registering the idle states */ | 57 | /* Initialize CPU idle by registering the idle states */ |
61 | static int at91_init_cpuidle(void) | 58 | static int at91_init_cpuidle(void) |
62 | { | 59 | { |
63 | struct cpuidle_device *device; | 60 | struct cpuidle_device *device; |
64 | struct cpuidle_driver *driver = &at91_idle_driver; | ||
65 | 61 | ||
66 | device = &per_cpu(at91_cpuidle_device, smp_processor_id()); | 62 | device = &per_cpu(at91_cpuidle_device, smp_processor_id()); |
67 | device->state_count = AT91_MAX_STATES; | 63 | device->state_count = AT91_MAX_STATES; |
68 | driver->state_count = AT91_MAX_STATES; | ||
69 | |||
70 | /* Wait for interrupt state */ | ||
71 | driver->states[0].enter = at91_enter_idle; | ||
72 | driver->states[0].exit_latency = 1; | ||
73 | driver->states[0].target_residency = 10000; | ||
74 | driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID; | ||
75 | strcpy(driver->states[0].name, "WFI"); | ||
76 | strcpy(driver->states[0].desc, "Wait for interrupt"); | ||
77 | |||
78 | /* Wait for interrupt and RAM self refresh state */ | ||
79 | driver->states[1].enter = at91_enter_idle; | ||
80 | driver->states[1].exit_latency = 10; | ||
81 | driver->states[1].target_residency = 10000; | ||
82 | driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID; | ||
83 | strcpy(driver->states[1].name, "RAM_SR"); | ||
84 | strcpy(driver->states[1].desc, "WFI and RAM Self Refresh"); | ||
85 | 64 | ||
86 | cpuidle_register_driver(&at91_idle_driver); | 65 | cpuidle_register_driver(&at91_idle_driver); |
87 | 66 | ||
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h index 187cb58345c0..fff48d1a0f4e 100644 --- a/arch/arm/mach-at91/include/mach/at_hdmac.h +++ b/arch/arm/mach-at91/include/mach/at_hdmac.h | |||
@@ -24,18 +24,6 @@ struct at_dma_platform_data { | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * enum at_dma_slave_width - DMA slave register access width. | ||
28 | * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses | ||
29 | * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses | ||
30 | * @AT_DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses | ||
31 | */ | ||
32 | enum at_dma_slave_width { | ||
33 | AT_DMA_SLAVE_WIDTH_8BIT = 0, | ||
34 | AT_DMA_SLAVE_WIDTH_16BIT, | ||
35 | AT_DMA_SLAVE_WIDTH_32BIT, | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * struct at_dma_slave - Controller-specific information about a slave | 27 | * struct at_dma_slave - Controller-specific information about a slave |
40 | * @dma_dev: required DMA master device | 28 | * @dma_dev: required DMA master device |
41 | * @tx_reg: physical address of data register used for | 29 | * @tx_reg: physical address of data register used for |
@@ -48,9 +36,6 @@ enum at_dma_slave_width { | |||
48 | */ | 36 | */ |
49 | struct at_dma_slave { | 37 | struct at_dma_slave { |
50 | struct device *dma_dev; | 38 | struct device *dma_dev; |
51 | dma_addr_t tx_reg; | ||
52 | dma_addr_t rx_reg; | ||
53 | enum at_dma_slave_width reg_width; | ||
54 | u32 cfg; | 39 | u32 cfg; |
55 | u32 ctrla; | 40 | u32 ctrla; |
56 | }; | 41 | }; |
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h deleted file mode 100644 index 4003001eca3d..000000000000 --- a/arch/arm/mach-at91/include/mach/io.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-at91/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 SAN People | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __ASM_ARCH_IO_H | ||
22 | #define __ASM_ARCH_IO_H | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | |||
26 | #define IO_SPACE_LIMIT 0xFFFFFFFF | ||
27 | |||
28 | #define __io(a) __typesafe_io(a) | ||
29 | #define __mem_pci(a) (a) | ||
30 | |||
31 | #endif | ||
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h index 0234fd9d20d6..4218647c1fcd 100644 --- a/arch/arm/mach-at91/include/mach/uncompress.h +++ b/arch/arm/mach-at91/include/mach/uncompress.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/atmel_serial.h> | 25 | #include <linux/atmel_serial.h> |
26 | #include <mach/hardware.h> | ||
26 | 27 | ||
27 | #if defined(CONFIG_AT91_EARLY_DBGU0) | 28 | #if defined(CONFIG_AT91_EARLY_DBGU0) |
28 | #define UART_OFFSET AT91_BASE_DBGU0 | 29 | #define UART_OFFSET AT91_BASE_DBGU0 |
diff --git a/arch/arm/mach-bcmring/include/mach/io.h b/arch/arm/mach-bcmring/include/mach/io.h deleted file mode 100644 index dae5e9b166ea..000000000000 --- a/arch/arm/mach-bcmring/include/mach/io.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 1999 ARM Limited | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
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 | #ifndef __ASM_ARM_ARCH_IO_H | ||
20 | #define __ASM_ARM_ARCH_IO_H | ||
21 | |||
22 | #include <mach/hardware.h> | ||
23 | |||
24 | #define IO_SPACE_LIMIT 0xffffffff | ||
25 | |||
26 | /* | ||
27 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
28 | * drivers out there that might just work if we fake them... | ||
29 | */ | ||
30 | #define __io(a) __typesafe_io(a) | ||
31 | #define __mem_pci(a) (a) | ||
32 | |||
33 | #endif | ||
diff --git a/arch/arm/mach-clps711x/include/mach/io.h b/arch/arm/mach-clps711x/include/mach/io.h deleted file mode 100644 index 2e0b3ced8f07..000000000000 --- a/arch/arm/mach-clps711x/include/mach/io.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-clps711x/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 1999 ARM Limited | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define IO_SPACE_LIMIT 0xffffffff | ||
24 | |||
25 | #define __io(a) __typesafe_io(a) | ||
26 | #define __mem_pci(a) (a) | ||
27 | |||
28 | /* | ||
29 | * We don't support ins[lb]/outs[lb]. Make them fault. | ||
30 | */ | ||
31 | #define __raw_readsb(p,d,l) do { *(int *)0 = 0; } while (0) | ||
32 | #define __raw_readsl(p,d,l) do { *(int *)0 = 0; } while (0) | ||
33 | #define __raw_writesb(p,d,l) do { *(int *)0 = 0; } while (0) | ||
34 | #define __raw_writesl(p,d,l) do { *(int *)0 = 0; } while (0) | ||
35 | |||
36 | #endif | ||
diff --git a/arch/arm/mach-clps711x/include/mach/uncompress.h b/arch/arm/mach-clps711x/include/mach/uncompress.h index 7164310dea7c..35ed731b9f16 100644 --- a/arch/arm/mach-clps711x/include/mach/uncompress.h +++ b/arch/arm/mach-clps711x/include/mach/uncompress.h | |||
@@ -17,7 +17,6 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | #include <mach/io.h> | ||
21 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
22 | #include <asm/hardware/clps7111.h> | 21 | #include <asm/hardware/clps7111.h> |
23 | 22 | ||
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c index 941a308e1253..031805b1428d 100644 --- a/arch/arm/mach-cns3xxx/core.c +++ b/arch/arm/mach-cns3xxx/core.c | |||
@@ -72,13 +72,13 @@ void __init cns3xxx_map_io(void) | |||
72 | /* used by entry-macro.S */ | 72 | /* used by entry-macro.S */ |
73 | void __init cns3xxx_init_irq(void) | 73 | void __init cns3xxx_init_irq(void) |
74 | { | 74 | { |
75 | gic_init(0, 29, __io(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT), | 75 | gic_init(0, 29, IOMEM(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT), |
76 | __io(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT)); | 76 | IOMEM(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT)); |
77 | } | 77 | } |
78 | 78 | ||
79 | void cns3xxx_power_off(void) | 79 | void cns3xxx_power_off(void) |
80 | { | 80 | { |
81 | u32 __iomem *pm_base = __io(CNS3XXX_PM_BASE_VIRT); | 81 | u32 __iomem *pm_base = IOMEM(CNS3XXX_PM_BASE_VIRT); |
82 | u32 clkctrl; | 82 | u32 clkctrl; |
83 | 83 | ||
84 | printk(KERN_INFO "powering system down...\n"); | 84 | printk(KERN_INFO "powering system down...\n"); |
@@ -237,7 +237,7 @@ static void __init __cns3xxx_timer_init(unsigned int timer_irq) | |||
237 | 237 | ||
238 | static void __init cns3xxx_timer_init(void) | 238 | static void __init cns3xxx_timer_init(void) |
239 | { | 239 | { |
240 | cns3xxx_tmr1 = __io(CNS3XXX_TIMER1_2_3_BASE_VIRT); | 240 | cns3xxx_tmr1 = IOMEM(CNS3XXX_TIMER1_2_3_BASE_VIRT); |
241 | 241 | ||
242 | __cns3xxx_timer_init(IRQ_CNS3XXX_TIMER0); | 242 | __cns3xxx_timer_init(IRQ_CNS3XXX_TIMER0); |
243 | } | 243 | } |
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c index 79d1fb02c23f..1e40c99b015f 100644 --- a/arch/arm/mach-cns3xxx/devices.c +++ b/arch/arm/mach-cns3xxx/devices.c | |||
@@ -98,7 +98,7 @@ static struct platform_device cns3xxx_sdhci_pdev = { | |||
98 | 98 | ||
99 | void __init cns3xxx_sdhci_init(void) | 99 | void __init cns3xxx_sdhci_init(void) |
100 | { | 100 | { |
101 | u32 __iomem *gpioa = __io(CNS3XXX_MISC_BASE_VIRT + 0x0014); | 101 | u32 __iomem *gpioa = IOMEM(CNS3XXX_MISC_BASE_VIRT + 0x0014); |
102 | u32 gpioa_pins = __raw_readl(gpioa); | 102 | u32 gpioa_pins = __raw_readl(gpioa); |
103 | 103 | ||
104 | /* MMC/SD pins share with GPIOA */ | 104 | /* MMC/SD pins share with GPIOA */ |
diff --git a/arch/arm/mach-cns3xxx/include/mach/io.h b/arch/arm/mach-cns3xxx/include/mach/io.h deleted file mode 100644 index 33b6fc1ece7c..000000000000 --- a/arch/arm/mach-cns3xxx/include/mach/io.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Cavium Networks | ||
3 | * Copyright 2003 ARM Limited | ||
4 | * | ||
5 | * This file is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License, Version 2, as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | #ifndef __MACH_IO_H | ||
10 | #define __MACH_IO_H | ||
11 | |||
12 | #define IO_SPACE_LIMIT 0xffffffff | ||
13 | |||
14 | #define __io(a) __typesafe_io(a) | ||
15 | #define __mem_pci(a) (a) | ||
16 | |||
17 | #endif | ||
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index a30c7c5a6d83..9107691adbdb 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/export.h> | 19 | #include <linux/export.h> |
20 | #include <asm/proc-fns.h> | 20 | #include <asm/proc-fns.h> |
21 | #include <asm/cpuidle.h> | ||
21 | 22 | ||
22 | #include <mach/cpuidle.h> | 23 | #include <mach/cpuidle.h> |
23 | #include <mach/ddr2.h> | 24 | #include <mach/ddr2.h> |
@@ -30,12 +31,43 @@ struct davinci_ops { | |||
30 | u32 flags; | 31 | u32 flags; |
31 | }; | 32 | }; |
32 | 33 | ||
34 | /* Actual code that puts the SoC in different idle states */ | ||
35 | static int davinci_enter_idle(struct cpuidle_device *dev, | ||
36 | struct cpuidle_driver *drv, | ||
37 | int index) | ||
38 | { | ||
39 | struct cpuidle_state_usage *state_usage = &dev->states_usage[index]; | ||
40 | struct davinci_ops *ops = cpuidle_get_statedata(state_usage); | ||
41 | |||
42 | if (ops && ops->enter) | ||
43 | ops->enter(ops->flags); | ||
44 | |||
45 | index = cpuidle_wrap_enter(dev, drv, index, | ||
46 | arm_cpuidle_simple_enter); | ||
47 | |||
48 | if (ops && ops->exit) | ||
49 | ops->exit(ops->flags); | ||
50 | |||
51 | return index; | ||
52 | } | ||
53 | |||
33 | /* fields in davinci_ops.flags */ | 54 | /* fields in davinci_ops.flags */ |
34 | #define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0) | 55 | #define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0) |
35 | 56 | ||
36 | static struct cpuidle_driver davinci_idle_driver = { | 57 | static struct cpuidle_driver davinci_idle_driver = { |
37 | .name = "cpuidle-davinci", | 58 | .name = "cpuidle-davinci", |
38 | .owner = THIS_MODULE, | 59 | .owner = THIS_MODULE, |
60 | .en_core_tk_irqen = 1, | ||
61 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
62 | .states[1] = { | ||
63 | .enter = davinci_enter_idle, | ||
64 | .exit_latency = 10, | ||
65 | .target_residency = 100000, | ||
66 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
67 | .name = "DDR SR", | ||
68 | .desc = "WFI and DDR Self Refresh", | ||
69 | }, | ||
70 | .state_count = DAVINCI_CPUIDLE_MAX_STATES, | ||
39 | }; | 71 | }; |
40 | 72 | ||
41 | static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); | 73 | static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); |
@@ -77,41 +109,10 @@ static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = { | |||
77 | }, | 109 | }, |
78 | }; | 110 | }; |
79 | 111 | ||
80 | /* Actual code that puts the SoC in different idle states */ | ||
81 | static int davinci_enter_idle(struct cpuidle_device *dev, | ||
82 | struct cpuidle_driver *drv, | ||
83 | int index) | ||
84 | { | ||
85 | struct cpuidle_state_usage *state_usage = &dev->states_usage[index]; | ||
86 | struct davinci_ops *ops = cpuidle_get_statedata(state_usage); | ||
87 | struct timeval before, after; | ||
88 | int idle_time; | ||
89 | |||
90 | local_irq_disable(); | ||
91 | do_gettimeofday(&before); | ||
92 | |||
93 | if (ops && ops->enter) | ||
94 | ops->enter(ops->flags); | ||
95 | /* Wait for interrupt state */ | ||
96 | cpu_do_idle(); | ||
97 | if (ops && ops->exit) | ||
98 | ops->exit(ops->flags); | ||
99 | |||
100 | do_gettimeofday(&after); | ||
101 | local_irq_enable(); | ||
102 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
103 | (after.tv_usec - before.tv_usec); | ||
104 | |||
105 | dev->last_residency = idle_time; | ||
106 | |||
107 | return index; | ||
108 | } | ||
109 | |||
110 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) | 112 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) |
111 | { | 113 | { |
112 | int ret; | 114 | int ret; |
113 | struct cpuidle_device *device; | 115 | struct cpuidle_device *device; |
114 | struct cpuidle_driver *driver = &davinci_idle_driver; | ||
115 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; | 116 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; |
116 | 117 | ||
117 | device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); | 118 | device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); |
@@ -123,27 +124,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) | |||
123 | 124 | ||
124 | ddr2_reg_base = pdata->ddr2_ctlr_base; | 125 | ddr2_reg_base = pdata->ddr2_ctlr_base; |
125 | 126 | ||
126 | /* Wait for interrupt state */ | ||
127 | driver->states[0].enter = davinci_enter_idle; | ||
128 | driver->states[0].exit_latency = 1; | ||
129 | driver->states[0].target_residency = 10000; | ||
130 | driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID; | ||
131 | strcpy(driver->states[0].name, "WFI"); | ||
132 | strcpy(driver->states[0].desc, "Wait for interrupt"); | ||
133 | |||
134 | /* Wait for interrupt and DDR self refresh state */ | ||
135 | driver->states[1].enter = davinci_enter_idle; | ||
136 | driver->states[1].exit_latency = 10; | ||
137 | driver->states[1].target_residency = 10000; | ||
138 | driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID; | ||
139 | strcpy(driver->states[1].name, "DDR SR"); | ||
140 | strcpy(driver->states[1].desc, "WFI and DDR Self Refresh"); | ||
141 | if (pdata->ddr2_pdown) | 127 | if (pdata->ddr2_pdown) |
142 | davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; | 128 | davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; |
143 | cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]); | 129 | cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]); |
144 | 130 | ||
145 | device->state_count = DAVINCI_CPUIDLE_MAX_STATES; | 131 | device->state_count = DAVINCI_CPUIDLE_MAX_STATES; |
146 | driver->state_count = DAVINCI_CPUIDLE_MAX_STATES; | ||
147 | 132 | ||
148 | ret = cpuidle_register_driver(&davinci_idle_driver); | 133 | ret = cpuidle_register_driver(&davinci_idle_driver); |
149 | if (ret) { | 134 | if (ret) { |
diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S b/arch/arm/mach-davinci/include/mach/entry-macro.S index c1661d2feca9..768b3c060214 100644 --- a/arch/arm/mach-davinci/include/mach/entry-macro.S +++ b/arch/arm/mach-davinci/include/mach/entry-macro.S | |||
@@ -8,7 +8,6 @@ | |||
8 | * is licensed "as is" without any warranty of any kind, whether express | 8 | * is licensed "as is" without any warranty of any kind, whether express |
9 | * or implied. | 9 | * or implied. |
10 | */ | 10 | */ |
11 | #include <mach/io.h> | ||
12 | #include <mach/irqs.h> | 11 | #include <mach/irqs.h> |
13 | 12 | ||
14 | .macro get_irqnr_preamble, base, tmp | 13 | .macro get_irqnr_preamble, base, tmp |
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h index 0209b1fc22a1..2184691ebc2f 100644 --- a/arch/arm/mach-davinci/include/mach/hardware.h +++ b/arch/arm/mach-davinci/include/mach/hardware.h | |||
@@ -30,10 +30,4 @@ | |||
30 | #define __IO_ADDRESS(x) ((x) + IO_OFFSET) | 30 | #define __IO_ADDRESS(x) ((x) + IO_OFFSET) |
31 | #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) | 31 | #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) |
32 | 32 | ||
33 | #ifdef __ASSEMBLER__ | ||
34 | #define IOMEM(x) x | ||
35 | #else | ||
36 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
37 | #endif | ||
38 | |||
39 | #endif /* __ASM_ARCH_HARDWARE_H */ | 33 | #endif /* __ASM_ARCH_HARDWARE_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h deleted file mode 100644 index b2267d1e1a71..000000000000 --- a/arch/arm/mach-davinci/include/mach/io.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * DaVinci IO address definitions | ||
3 | * | ||
4 | * Copied from include/asm/arm/arch-omap/io.h | ||
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_IO_H | ||
12 | #define __ASM_ARCH_IO_H | ||
13 | |||
14 | #define IO_SPACE_LIMIT 0xffffffff | ||
15 | |||
16 | /* | ||
17 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
18 | * drivers out there that might just work if we fake them... | ||
19 | */ | ||
20 | #define __io(a) __typesafe_io(a) | ||
21 | #define __mem_pci(a) (a) | ||
22 | #define __mem_isa(a) (a) | ||
23 | |||
24 | #endif /* __ASM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h index 9dc7cf9664fe..da2fb2c2155a 100644 --- a/arch/arm/mach-davinci/include/mach/uncompress.h +++ b/arch/arm/mach-davinci/include/mach/uncompress.h | |||
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include <mach/serial.h> | 26 | #include <mach/serial.h> |
27 | 27 | ||
28 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
29 | |||
28 | u32 *uart; | 30 | u32 *uart; |
29 | 31 | ||
30 | /* PORT_16C550A, in polled non-fifo mode */ | 32 | /* PORT_16C550A, in polled non-fifo mode */ |
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index e1969ce904dc..75da315b6587 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c | |||
@@ -19,11 +19,14 @@ | |||
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | 21 | ||
22 | #include <mach/hardware.h> | 22 | #include <asm/sched_clock.h> |
23 | #include <asm/mach/irq.h> | 23 | #include <asm/mach/irq.h> |
24 | #include <asm/mach/time.h> | 24 | #include <asm/mach/time.h> |
25 | |||
25 | #include <mach/cputype.h> | 26 | #include <mach/cputype.h> |
27 | #include <mach/hardware.h> | ||
26 | #include <mach/time.h> | 28 | #include <mach/time.h> |
29 | |||
27 | #include "clock.h" | 30 | #include "clock.h" |
28 | 31 | ||
29 | static struct clock_event_device clockevent_davinci; | 32 | static struct clock_event_device clockevent_davinci; |
@@ -272,19 +275,9 @@ static cycle_t read_cycles(struct clocksource *cs) | |||
272 | return (cycles_t)timer32_read(t); | 275 | return (cycles_t)timer32_read(t); |
273 | } | 276 | } |
274 | 277 | ||
275 | /* | ||
276 | * Kernel assumes that sched_clock can be called early but may not have | ||
277 | * things ready yet. | ||
278 | */ | ||
279 | static cycle_t read_dummy(struct clocksource *cs) | ||
280 | { | ||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | |||
285 | static struct clocksource clocksource_davinci = { | 278 | static struct clocksource clocksource_davinci = { |
286 | .rating = 300, | 279 | .rating = 300, |
287 | .read = read_dummy, | 280 | .read = read_cycles, |
288 | .mask = CLOCKSOURCE_MASK(32), | 281 | .mask = CLOCKSOURCE_MASK(32), |
289 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 282 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
290 | }; | 283 | }; |
@@ -292,12 +285,9 @@ static struct clocksource clocksource_davinci = { | |||
292 | /* | 285 | /* |
293 | * Overwrite weak default sched_clock with something more precise | 286 | * Overwrite weak default sched_clock with something more precise |
294 | */ | 287 | */ |
295 | unsigned long long notrace sched_clock(void) | 288 | static u32 notrace davinci_read_sched_clock(void) |
296 | { | 289 | { |
297 | const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); | 290 | return timer32_read(&timers[TID_CLOCKSOURCE]); |
298 | |||
299 | return clocksource_cyc2ns(cyc, clocksource_davinci.mult, | ||
300 | clocksource_davinci.shift); | ||
301 | } | 291 | } |
302 | 292 | ||
303 | /* | 293 | /* |
@@ -397,12 +387,14 @@ static void __init davinci_timer_init(void) | |||
397 | davinci_clock_tick_rate = clk_get_rate(timer_clk); | 387 | davinci_clock_tick_rate = clk_get_rate(timer_clk); |
398 | 388 | ||
399 | /* setup clocksource */ | 389 | /* setup clocksource */ |
400 | clocksource_davinci.read = read_cycles; | ||
401 | clocksource_davinci.name = id_to_name[clocksource_id]; | 390 | clocksource_davinci.name = id_to_name[clocksource_id]; |
402 | if (clocksource_register_hz(&clocksource_davinci, | 391 | if (clocksource_register_hz(&clocksource_davinci, |
403 | davinci_clock_tick_rate)) | 392 | davinci_clock_tick_rate)) |
404 | printk(err, clocksource_davinci.name); | 393 | printk(err, clocksource_davinci.name); |
405 | 394 | ||
395 | setup_sched_clock(davinci_read_sched_clock, 32, | ||
396 | davinci_clock_tick_rate); | ||
397 | |||
406 | /* setup clockevent */ | 398 | /* setup clockevent */ |
407 | clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; | 399 | clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; |
408 | clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC, | 400 | clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC, |
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c index 98b8c83b09ab..2a06c0163418 100644 --- a/arch/arm/mach-dove/addr-map.c +++ b/arch/arm/mach-dove/addr-map.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
16 | #include <asm/setup.h> | 16 | #include <asm/setup.h> |
17 | #include <mach/dove.h> | ||
17 | #include <plat/addr-map.h> | 18 | #include <plat/addr-map.h> |
18 | #include "common.h" | 19 | #include "common.h" |
19 | 20 | ||
diff --git a/arch/arm/mach-dove/include/mach/io.h b/arch/arm/mach-dove/include/mach/io.h index eb4936ff90ad..29c8b85355a5 100644 --- a/arch/arm/mach-dove/include/mach/io.h +++ b/arch/arm/mach-dove/include/mach/io.h | |||
@@ -15,6 +15,5 @@ | |||
15 | 15 | ||
16 | #define __io(a) ((void __iomem *)(((a) - DOVE_PCIE0_IO_BUS_BASE) + \ | 16 | #define __io(a) ((void __iomem *)(((a) - DOVE_PCIE0_IO_BUS_BASE) + \ |
17 | DOVE_PCIE0_IO_VIRT_BASE)) | 17 | DOVE_PCIE0_IO_VIRT_BASE)) |
18 | #define __mem_pci(a) (a) | ||
19 | 18 | ||
20 | #endif | 19 | #endif |
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c index 8c9f56a3e8ec..6f8068692edf 100644 --- a/arch/arm/mach-ebsa110/core.c +++ b/arch/arm/mach-ebsa110/core.c | |||
@@ -116,6 +116,20 @@ static void __init ebsa110_map_io(void) | |||
116 | iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc)); | 116 | iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc)); |
117 | } | 117 | } |
118 | 118 | ||
119 | static void __iomem *ebsa110_ioremap_caller(unsigned long cookie, size_t size, | ||
120 | unsigned int flags, void *caller) | ||
121 | { | ||
122 | return (void __iomem *)cookie; | ||
123 | } | ||
124 | |||
125 | static void ebsa110_iounmap(volatile void __iomem *io_addr) | ||
126 | {} | ||
127 | |||
128 | static void __init ebsa110_init_early(void) | ||
129 | { | ||
130 | arch_ioremap_caller = ebsa110_ioremap_caller; | ||
131 | arch_iounmap = ebsa110_iounmap; | ||
132 | } | ||
119 | 133 | ||
120 | #define PIT_CTRL (PIT_BASE + 0x0d) | 134 | #define PIT_CTRL (PIT_BASE + 0x0d) |
121 | #define PIT_T2 (PIT_BASE + 0x09) | 135 | #define PIT_T2 (PIT_BASE + 0x09) |
@@ -312,6 +326,7 @@ MACHINE_START(EBSA110, "EBSA110") | |||
312 | .reserve_lp2 = 1, | 326 | .reserve_lp2 = 1, |
313 | .restart_mode = 's', | 327 | .restart_mode = 's', |
314 | .map_io = ebsa110_map_io, | 328 | .map_io = ebsa110_map_io, |
329 | .init_early = ebsa110_init_early, | ||
315 | .init_irq = ebsa110_init_irq, | 330 | .init_irq = ebsa110_init_irq, |
316 | .timer = &ebsa110_timer, | 331 | .timer = &ebsa110_timer, |
317 | .restart = ebsa110_restart, | 332 | .restart = ebsa110_restart, |
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h index 44679db672fb..11bb0799424b 100644 --- a/arch/arm/mach-ebsa110/include/mach/io.h +++ b/arch/arm/mach-ebsa110/include/mach/io.h | |||
@@ -62,15 +62,6 @@ void __writel(u32 val, void __iomem *addr); | |||
62 | #define writew(v,b) __writew(v,b) | 62 | #define writew(v,b) __writew(v,b) |
63 | #define writel(v,b) __writel(v,b) | 63 | #define writel(v,b) __writel(v,b) |
64 | 64 | ||
65 | static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size, | ||
66 | unsigned int flags) | ||
67 | { | ||
68 | return (void __iomem *)cookie; | ||
69 | } | ||
70 | |||
71 | #define __arch_ioremap __arch_ioremap | ||
72 | #define __arch_iounmap(cookie) do { } while (0) | ||
73 | |||
74 | extern void insb(unsigned int port, void *buf, int sz); | 65 | extern void insb(unsigned int port, void *buf, int sz); |
75 | extern void insw(unsigned int port, void *buf, int sz); | 66 | extern void insw(unsigned int port, void *buf, int sz); |
76 | extern void insl(unsigned int port, void *buf, int sz); | 67 | extern void insl(unsigned int port, void *buf, int sz); |
diff --git a/arch/arm/mach-ep93xx/include/mach/io.h b/arch/arm/mach-ep93xx/include/mach/io.h deleted file mode 100644 index 594b77f21054..000000000000 --- a/arch/arm/mach-ep93xx/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ep93xx/include/mach/io.h | ||
3 | */ | ||
4 | |||
5 | #ifndef __ASM_MACH_IO_H | ||
6 | #define __ASM_MACH_IO_H | ||
7 | |||
8 | #define IO_SPACE_LIMIT 0xffffffff | ||
9 | |||
10 | #define __io(p) __typesafe_io(p) | ||
11 | #define __mem_pci(p) (p) | ||
12 | |||
13 | /* | ||
14 | * A typesafe __io() variation for variable initialisers | ||
15 | */ | ||
16 | #ifdef __ASSEMBLER__ | ||
17 | #define IOMEM(p) p | ||
18 | #else | ||
19 | #define IOMEM(p) ((void __iomem __force *)(p)) | ||
20 | #endif | ||
21 | |||
22 | #endif /* __ASM_MACH_IO_H */ | ||
diff --git a/arch/arm/mach-exynos/include/mach/io.h b/arch/arm/mach-exynos/include/mach/io.h deleted file mode 100644 index d5478d247535..000000000000 --- a/arch/arm/mach-exynos/include/mach/io.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-exynos4/include/mach/io.h | ||
2 | * | ||
3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org> | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6442/include/mach/io.h | ||
9 | * | ||
10 | * Default IO routines for EXYNOS4 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARM_ARCH_IO_H | ||
18 | #define __ASM_ARM_ARCH_IO_H __FILE__ | ||
19 | |||
20 | /* No current ISA/PCI bus support. */ | ||
21 | #define __io(a) __typesafe_io(a) | ||
22 | #define __mem_pci(a) (a) | ||
23 | |||
24 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
25 | |||
26 | #endif /* __ASM_ARM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h index 15a70396c27d..aba531eebbc6 100644 --- a/arch/arm/mach-footbridge/include/mach/io.h +++ b/arch/arm/mach-footbridge/include/mach/io.h | |||
@@ -27,18 +27,5 @@ | |||
27 | * Translation of various region addresses to virtual addresses | 27 | * Translation of various region addresses to virtual addresses |
28 | */ | 28 | */ |
29 | #define __io(a) ((void __iomem *)(PCIO_BASE + (a))) | 29 | #define __io(a) ((void __iomem *)(PCIO_BASE + (a))) |
30 | #if 1 | ||
31 | #define __mem_pci(a) (a) | ||
32 | #else | ||
33 | |||
34 | static inline void __iomem *___mem_pci(void __iomem *p) | ||
35 | { | ||
36 | unsigned long a = (unsigned long)p; | ||
37 | BUG_ON(a <= 0xc0000000 || a >= 0xe0000000); | ||
38 | return p; | ||
39 | } | ||
40 | |||
41 | #define __mem_pci(a) ___mem_pci(a) | ||
42 | #endif | ||
43 | 30 | ||
44 | #endif | 31 | #endif |
diff --git a/arch/arm/mach-gemini/include/mach/io.h b/arch/arm/mach-gemini/include/mach/io.h deleted file mode 100644 index c548056b98b2..000000000000 --- a/arch/arm/mach-gemini/include/mach/io.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001-2006 Storlink, Corp. | ||
3 | * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | */ | ||
10 | #ifndef __MACH_IO_H | ||
11 | #define __MACH_IO_H | ||
12 | |||
13 | #define IO_SPACE_LIMIT 0xffffffff | ||
14 | |||
15 | #define __io(a) __typesafe_io(a) | ||
16 | #define __mem_pci(a) (a) | ||
17 | |||
18 | #endif /* __MACH_IO_H */ | ||
diff --git a/arch/arm/mach-h720x/include/mach/io.h b/arch/arm/mach-h720x/include/mach/io.h deleted file mode 100644 index 2c8659c21a93..000000000000 --- a/arch/arm/mach-h720x/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-h720x/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2000 Steve Hill (sjhill@cotw.com) | ||
5 | * | ||
6 | * Changelog: | ||
7 | * | ||
8 | * 09-19-2001 JJKIM | ||
9 | * Created from arch/arm/mach-l7200/include/mach/io.h | ||
10 | * | ||
11 | * 03-27-2003 Robert Schwebel <r.schwebel@pengutronix.de>: | ||
12 | * re-unified header files for h720x | ||
13 | */ | ||
14 | #ifndef __ASM_ARM_ARCH_IO_H | ||
15 | #define __ASM_ARM_ARCH_IO_H | ||
16 | |||
17 | #define IO_SPACE_LIMIT 0xffffffff | ||
18 | |||
19 | #define __io(a) __typesafe_io(a) | ||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif | ||
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 808b055289b2..410a112bb52e 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
36 | #include <asm/mach/map.h> | 36 | #include <asm/mach/map.h> |
37 | #include <asm/mach/time.h> | 37 | #include <asm/mach/time.h> |
38 | #include <mach/irqs.h> | ||
39 | 38 | ||
40 | #include "core.h" | 39 | #include "core.h" |
41 | #include "sysregs.h" | 40 | #include "sysregs.h" |
diff --git a/arch/arm/mach-highbank/include/mach/io.h b/arch/arm/mach-highbank/include/mach/io.h deleted file mode 100644 index 70cfa3ba7697..000000000000 --- a/arch/arm/mach-highbank/include/mach/io.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef __MACH_IO_H | ||
2 | #define __MACH_IO_H | ||
3 | |||
4 | #define __io(a) ({ (void)(a); __typesafe_io(0); }) | ||
5 | #define __mem_pci(a) (a) | ||
6 | |||
7 | #endif | ||
diff --git a/arch/arm/mach-highbank/include/mach/irqs.h b/arch/arm/mach-highbank/include/mach/irqs.h deleted file mode 100644 index 9746aab14e9a..000000000000 --- a/arch/arm/mach-highbank/include/mach/irqs.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __MACH_IRQS_H | ||
2 | #define __MACH_IRQS_H | ||
3 | |||
4 | #define NR_IRQS 192 | ||
5 | |||
6 | #endif | ||
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 52359f80c42d..7561eca131b0 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -1,6 +1,3 @@ | |||
1 | config IMX_HAVE_DMA_V1 | ||
2 | bool | ||
3 | |||
4 | config HAVE_IMX_GPC | 1 | config HAVE_IMX_GPC |
5 | bool | 2 | bool |
6 | 3 | ||
@@ -38,7 +35,6 @@ config SOC_IMX1 | |||
38 | bool | 35 | bool |
39 | select ARCH_MX1 | 36 | select ARCH_MX1 |
40 | select CPU_ARM920T | 37 | select CPU_ARM920T |
41 | select IMX_HAVE_DMA_V1 | ||
42 | select IMX_HAVE_IOMUX_V1 | 38 | select IMX_HAVE_IOMUX_V1 |
43 | select MXC_AVIC | 39 | select MXC_AVIC |
44 | 40 | ||
@@ -46,7 +42,6 @@ config SOC_IMX21 | |||
46 | bool | 42 | bool |
47 | select MACH_MX21 | 43 | select MACH_MX21 |
48 | select CPU_ARM926T | 44 | select CPU_ARM926T |
49 | select IMX_HAVE_DMA_V1 | ||
50 | select IMX_HAVE_IOMUX_V1 | 45 | select IMX_HAVE_IOMUX_V1 |
51 | select MXC_AVIC | 46 | select MXC_AVIC |
52 | 47 | ||
@@ -61,7 +56,6 @@ config SOC_IMX27 | |||
61 | bool | 56 | bool |
62 | select MACH_MX27 | 57 | select MACH_MX27 |
63 | select CPU_ARM926T | 58 | select CPU_ARM926T |
64 | select IMX_HAVE_DMA_V1 | ||
65 | select IMX_HAVE_IOMUX_V1 | 59 | select IMX_HAVE_IOMUX_V1 |
66 | select MXC_AVIC | 60 | select MXC_AVIC |
67 | 61 | ||
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 35fc450fa263..ab939c5046c3 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile | |||
@@ -1,5 +1,3 @@ | |||
1 | obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o | ||
2 | |||
3 | obj-$(CONFIG_SOC_IMX1) += clock-imx1.o mm-imx1.o | 1 | obj-$(CONFIG_SOC_IMX1) += clock-imx1.o mm-imx1.o |
4 | obj-$(CONFIG_SOC_IMX21) += clock-imx21.o mm-imx21.o | 2 | obj-$(CONFIG_SOC_IMX21) += clock-imx21.o mm-imx21.o |
5 | 3 | ||
diff --git a/arch/arm/mach-imx/dma-v1.c b/arch/arm/mach-imx/dma-v1.c deleted file mode 100644 index 3189a6004cf9..000000000000 --- a/arch/arm/mach-imx/dma-v1.c +++ /dev/null | |||
@@ -1,845 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/plat-mxc/dma-v1.c | ||
3 | * | ||
4 | * i.MX DMA registration and IRQ dispatching | ||
5 | * | ||
6 | * Copyright 2006 Pavel Pisa <pisa@cmp.felk.cvut.cz> | ||
7 | * Copyright 2008 Juergen Beisert, <kernel@pengutronix.de> | ||
8 | * Copyright 2008 Sascha Hauer, <s.hauer@pengutronix.de> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 | ||
13 | * of the License, or (at your option) any later version. | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
22 | * MA 02110-1301, USA. | ||
23 | */ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/err.h> | ||
30 | #include <linux/errno.h> | ||
31 | #include <linux/clk.h> | ||
32 | #include <linux/scatterlist.h> | ||
33 | #include <linux/io.h> | ||
34 | |||
35 | #include <asm/irq.h> | ||
36 | #include <mach/hardware.h> | ||
37 | #include <mach/dma-v1.h> | ||
38 | |||
39 | #define DMA_DCR 0x00 /* Control Register */ | ||
40 | #define DMA_DISR 0x04 /* Interrupt status Register */ | ||
41 | #define DMA_DIMR 0x08 /* Interrupt mask Register */ | ||
42 | #define DMA_DBTOSR 0x0c /* Burst timeout status Register */ | ||
43 | #define DMA_DRTOSR 0x10 /* Request timeout Register */ | ||
44 | #define DMA_DSESR 0x14 /* Transfer Error Status Register */ | ||
45 | #define DMA_DBOSR 0x18 /* Buffer overflow status Register */ | ||
46 | #define DMA_DBTOCR 0x1c /* Burst timeout control Register */ | ||
47 | #define DMA_WSRA 0x40 /* W-Size Register A */ | ||
48 | #define DMA_XSRA 0x44 /* X-Size Register A */ | ||
49 | #define DMA_YSRA 0x48 /* Y-Size Register A */ | ||
50 | #define DMA_WSRB 0x4c /* W-Size Register B */ | ||
51 | #define DMA_XSRB 0x50 /* X-Size Register B */ | ||
52 | #define DMA_YSRB 0x54 /* Y-Size Register B */ | ||
53 | #define DMA_SAR(x) (0x80 + ((x) << 6)) /* Source Address Registers */ | ||
54 | #define DMA_DAR(x) (0x84 + ((x) << 6)) /* Destination Address Registers */ | ||
55 | #define DMA_CNTR(x) (0x88 + ((x) << 6)) /* Count Registers */ | ||
56 | #define DMA_CCR(x) (0x8c + ((x) << 6)) /* Control Registers */ | ||
57 | #define DMA_RSSR(x) (0x90 + ((x) << 6)) /* Request source select Registers */ | ||
58 | #define DMA_BLR(x) (0x94 + ((x) << 6)) /* Burst length Registers */ | ||
59 | #define DMA_RTOR(x) (0x98 + ((x) << 6)) /* Request timeout Registers */ | ||
60 | #define DMA_BUCR(x) (0x98 + ((x) << 6)) /* Bus Utilization Registers */ | ||
61 | #define DMA_CCNR(x) (0x9C + ((x) << 6)) /* Channel counter Registers */ | ||
62 | |||
63 | #define DCR_DRST (1<<1) | ||
64 | #define DCR_DEN (1<<0) | ||
65 | #define DBTOCR_EN (1<<15) | ||
66 | #define DBTOCR_CNT(x) ((x) & 0x7fff) | ||
67 | #define CNTR_CNT(x) ((x) & 0xffffff) | ||
68 | #define CCR_ACRPT (1<<14) | ||
69 | #define CCR_DMOD_LINEAR (0x0 << 12) | ||
70 | #define CCR_DMOD_2D (0x1 << 12) | ||
71 | #define CCR_DMOD_FIFO (0x2 << 12) | ||
72 | #define CCR_DMOD_EOBFIFO (0x3 << 12) | ||
73 | #define CCR_SMOD_LINEAR (0x0 << 10) | ||
74 | #define CCR_SMOD_2D (0x1 << 10) | ||
75 | #define CCR_SMOD_FIFO (0x2 << 10) | ||
76 | #define CCR_SMOD_EOBFIFO (0x3 << 10) | ||
77 | #define CCR_MDIR_DEC (1<<9) | ||
78 | #define CCR_MSEL_B (1<<8) | ||
79 | #define CCR_DSIZ_32 (0x0 << 6) | ||
80 | #define CCR_DSIZ_8 (0x1 << 6) | ||
81 | #define CCR_DSIZ_16 (0x2 << 6) | ||
82 | #define CCR_SSIZ_32 (0x0 << 4) | ||
83 | #define CCR_SSIZ_8 (0x1 << 4) | ||
84 | #define CCR_SSIZ_16 (0x2 << 4) | ||
85 | #define CCR_REN (1<<3) | ||
86 | #define CCR_RPT (1<<2) | ||
87 | #define CCR_FRC (1<<1) | ||
88 | #define CCR_CEN (1<<0) | ||
89 | #define RTOR_EN (1<<15) | ||
90 | #define RTOR_CLK (1<<14) | ||
91 | #define RTOR_PSC (1<<13) | ||
92 | |||
93 | /* | ||
94 | * struct imx_dma_channel - i.MX specific DMA extension | ||
95 | * @name: name specified by DMA client | ||
96 | * @irq_handler: client callback for end of transfer | ||
97 | * @err_handler: client callback for error condition | ||
98 | * @data: clients context data for callbacks | ||
99 | * @dma_mode: direction of the transfer %DMA_MODE_READ or %DMA_MODE_WRITE | ||
100 | * @sg: pointer to the actual read/written chunk for scatter-gather emulation | ||
101 | * @resbytes: total residual number of bytes to transfer | ||
102 | * (it can be lower or same as sum of SG mapped chunk sizes) | ||
103 | * @sgcount: number of chunks to be read/written | ||
104 | * | ||
105 | * Structure is used for IMX DMA processing. It would be probably good | ||
106 | * @struct dma_struct in the future for external interfacing and use | ||
107 | * @struct imx_dma_channel only as extension to it. | ||
108 | */ | ||
109 | |||
110 | struct imx_dma_channel { | ||
111 | const char *name; | ||
112 | void (*irq_handler) (int, void *); | ||
113 | void (*err_handler) (int, void *, int errcode); | ||
114 | void (*prog_handler) (int, void *, struct scatterlist *); | ||
115 | void *data; | ||
116 | unsigned int dma_mode; | ||
117 | struct scatterlist *sg; | ||
118 | unsigned int resbytes; | ||
119 | int dma_num; | ||
120 | |||
121 | int in_use; | ||
122 | |||
123 | u32 ccr_from_device; | ||
124 | u32 ccr_to_device; | ||
125 | |||
126 | struct timer_list watchdog; | ||
127 | |||
128 | int hw_chaining; | ||
129 | }; | ||
130 | |||
131 | static void __iomem *imx_dmav1_baseaddr; | ||
132 | |||
133 | static void imx_dmav1_writel(unsigned val, unsigned offset) | ||
134 | { | ||
135 | __raw_writel(val, imx_dmav1_baseaddr + offset); | ||
136 | } | ||
137 | |||
138 | static unsigned imx_dmav1_readl(unsigned offset) | ||
139 | { | ||
140 | return __raw_readl(imx_dmav1_baseaddr + offset); | ||
141 | } | ||
142 | |||
143 | static struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; | ||
144 | |||
145 | static struct clk *dma_clk; | ||
146 | |||
147 | static int imx_dma_hw_chain(struct imx_dma_channel *imxdma) | ||
148 | { | ||
149 | if (cpu_is_mx27()) | ||
150 | return imxdma->hw_chaining; | ||
151 | else | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | /* | ||
156 | * imx_dma_sg_next - prepare next chunk for scatter-gather DMA emulation | ||
157 | */ | ||
158 | static inline int imx_dma_sg_next(int channel, struct scatterlist *sg) | ||
159 | { | ||
160 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
161 | unsigned long now; | ||
162 | |||
163 | if (!imxdma->name) { | ||
164 | printk(KERN_CRIT "%s: called for not allocated channel %d\n", | ||
165 | __func__, channel); | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | now = min(imxdma->resbytes, sg->length); | ||
170 | if (imxdma->resbytes != IMX_DMA_LENGTH_LOOP) | ||
171 | imxdma->resbytes -= now; | ||
172 | |||
173 | if ((imxdma->dma_mode & DMA_MODE_MASK) == DMA_MODE_READ) | ||
174 | imx_dmav1_writel(sg->dma_address, DMA_DAR(channel)); | ||
175 | else | ||
176 | imx_dmav1_writel(sg->dma_address, DMA_SAR(channel)); | ||
177 | |||
178 | imx_dmav1_writel(now, DMA_CNTR(channel)); | ||
179 | |||
180 | pr_debug("imxdma%d: next sg chunk dst 0x%08x, src 0x%08x, " | ||
181 | "size 0x%08x\n", channel, | ||
182 | imx_dmav1_readl(DMA_DAR(channel)), | ||
183 | imx_dmav1_readl(DMA_SAR(channel)), | ||
184 | imx_dmav1_readl(DMA_CNTR(channel))); | ||
185 | |||
186 | return now; | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * imx_dma_setup_single - setup i.MX DMA channel for linear memory to/from | ||
191 | * device transfer | ||
192 | * | ||
193 | * @channel: i.MX DMA channel number | ||
194 | * @dma_address: the DMA/physical memory address of the linear data block | ||
195 | * to transfer | ||
196 | * @dma_length: length of the data block in bytes | ||
197 | * @dev_addr: physical device port address | ||
198 | * @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory | ||
199 | * or %DMA_MODE_WRITE from memory to the device | ||
200 | * | ||
201 | * Return value: if incorrect parameters are provided -%EINVAL. | ||
202 | * Zero indicates success. | ||
203 | */ | ||
204 | int | ||
205 | imx_dma_setup_single(int channel, dma_addr_t dma_address, | ||
206 | unsigned int dma_length, unsigned int dev_addr, | ||
207 | unsigned int dmamode) | ||
208 | { | ||
209 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
210 | |||
211 | imxdma->sg = NULL; | ||
212 | imxdma->dma_mode = dmamode; | ||
213 | |||
214 | if (!dma_address) { | ||
215 | printk(KERN_ERR "imxdma%d: imx_dma_setup_single null address\n", | ||
216 | channel); | ||
217 | return -EINVAL; | ||
218 | } | ||
219 | |||
220 | if (!dma_length) { | ||
221 | printk(KERN_ERR "imxdma%d: imx_dma_setup_single zero length\n", | ||
222 | channel); | ||
223 | return -EINVAL; | ||
224 | } | ||
225 | |||
226 | if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) { | ||
227 | pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d " | ||
228 | "dev_addr=0x%08x for read\n", | ||
229 | channel, __func__, (unsigned int)dma_address, | ||
230 | dma_length, dev_addr); | ||
231 | |||
232 | imx_dmav1_writel(dev_addr, DMA_SAR(channel)); | ||
233 | imx_dmav1_writel(dma_address, DMA_DAR(channel)); | ||
234 | imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel)); | ||
235 | } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) { | ||
236 | pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d " | ||
237 | "dev_addr=0x%08x for write\n", | ||
238 | channel, __func__, (unsigned int)dma_address, | ||
239 | dma_length, dev_addr); | ||
240 | |||
241 | imx_dmav1_writel(dma_address, DMA_SAR(channel)); | ||
242 | imx_dmav1_writel(dev_addr, DMA_DAR(channel)); | ||
243 | imx_dmav1_writel(imxdma->ccr_to_device, | ||
244 | DMA_CCR(channel)); | ||
245 | } else { | ||
246 | printk(KERN_ERR "imxdma%d: imx_dma_setup_single bad dmamode\n", | ||
247 | channel); | ||
248 | return -EINVAL; | ||
249 | } | ||
250 | |||
251 | imx_dmav1_writel(dma_length, DMA_CNTR(channel)); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | EXPORT_SYMBOL(imx_dma_setup_single); | ||
256 | |||
257 | /** | ||
258 | * imx_dma_setup_sg - setup i.MX DMA channel SG list to/from device transfer | ||
259 | * @channel: i.MX DMA channel number | ||
260 | * @sg: pointer to the scatter-gather list/vector | ||
261 | * @sgcount: scatter-gather list hungs count | ||
262 | * @dma_length: total length of the transfer request in bytes | ||
263 | * @dev_addr: physical device port address | ||
264 | * @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory | ||
265 | * or %DMA_MODE_WRITE from memory to the device | ||
266 | * | ||
267 | * The function sets up DMA channel state and registers to be ready for | ||
268 | * transfer specified by provided parameters. The scatter-gather emulation | ||
269 | * is set up according to the parameters. | ||
270 | * | ||
271 | * The full preparation of the transfer requires setup of more register | ||
272 | * by the caller before imx_dma_enable() can be called. | ||
273 | * | ||
274 | * %BLR(channel) holds transfer burst length in bytes, 0 means 64 bytes | ||
275 | * | ||
276 | * %RSSR(channel) has to be set to the DMA request line source %DMA_REQ_xxx | ||
277 | * | ||
278 | * %CCR(channel) has to specify transfer parameters, the next settings is | ||
279 | * typical for linear or simple scatter-gather transfers if %DMA_MODE_READ is | ||
280 | * specified | ||
281 | * | ||
282 | * %CCR_DMOD_LINEAR | %CCR_DSIZ_32 | %CCR_SMOD_FIFO | %CCR_SSIZ_x | ||
283 | * | ||
284 | * The typical setup for %DMA_MODE_WRITE is specified by next options | ||
285 | * combination | ||
286 | * | ||
287 | * %CCR_SMOD_LINEAR | %CCR_SSIZ_32 | %CCR_DMOD_FIFO | %CCR_DSIZ_x | ||
288 | * | ||
289 | * Be careful here and do not mistakenly mix source and target device | ||
290 | * port sizes constants, they are really different: | ||
291 | * %CCR_SSIZ_8, %CCR_SSIZ_16, %CCR_SSIZ_32, | ||
292 | * %CCR_DSIZ_8, %CCR_DSIZ_16, %CCR_DSIZ_32 | ||
293 | * | ||
294 | * Return value: if incorrect parameters are provided -%EINVAL. | ||
295 | * Zero indicates success. | ||
296 | */ | ||
297 | int | ||
298 | imx_dma_setup_sg(int channel, | ||
299 | struct scatterlist *sg, unsigned int sgcount, | ||
300 | unsigned int dma_length, unsigned int dev_addr, | ||
301 | unsigned int dmamode) | ||
302 | { | ||
303 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
304 | |||
305 | if (imxdma->in_use) | ||
306 | return -EBUSY; | ||
307 | |||
308 | imxdma->sg = sg; | ||
309 | imxdma->dma_mode = dmamode; | ||
310 | imxdma->resbytes = dma_length; | ||
311 | |||
312 | if (!sg || !sgcount) { | ||
313 | printk(KERN_ERR "imxdma%d: imx_dma_setup_sg empty sg list\n", | ||
314 | channel); | ||
315 | return -EINVAL; | ||
316 | } | ||
317 | |||
318 | if (!sg->length) { | ||
319 | printk(KERN_ERR "imxdma%d: imx_dma_setup_sg zero length\n", | ||
320 | channel); | ||
321 | return -EINVAL; | ||
322 | } | ||
323 | |||
324 | if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) { | ||
325 | pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d " | ||
326 | "dev_addr=0x%08x for read\n", | ||
327 | channel, __func__, sg, sgcount, dma_length, dev_addr); | ||
328 | |||
329 | imx_dmav1_writel(dev_addr, DMA_SAR(channel)); | ||
330 | imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel)); | ||
331 | } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) { | ||
332 | pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d " | ||
333 | "dev_addr=0x%08x for write\n", | ||
334 | channel, __func__, sg, sgcount, dma_length, dev_addr); | ||
335 | |||
336 | imx_dmav1_writel(dev_addr, DMA_DAR(channel)); | ||
337 | imx_dmav1_writel(imxdma->ccr_to_device, DMA_CCR(channel)); | ||
338 | } else { | ||
339 | printk(KERN_ERR "imxdma%d: imx_dma_setup_sg bad dmamode\n", | ||
340 | channel); | ||
341 | return -EINVAL; | ||
342 | } | ||
343 | |||
344 | imx_dma_sg_next(channel, sg); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | EXPORT_SYMBOL(imx_dma_setup_sg); | ||
349 | |||
350 | int | ||
351 | imx_dma_config_channel(int channel, unsigned int config_port, | ||
352 | unsigned int config_mem, unsigned int dmareq, int hw_chaining) | ||
353 | { | ||
354 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
355 | u32 dreq = 0; | ||
356 | |||
357 | imxdma->hw_chaining = 0; | ||
358 | |||
359 | if (hw_chaining) { | ||
360 | imxdma->hw_chaining = 1; | ||
361 | if (!imx_dma_hw_chain(imxdma)) | ||
362 | return -EINVAL; | ||
363 | } | ||
364 | |||
365 | if (dmareq) | ||
366 | dreq = CCR_REN; | ||
367 | |||
368 | imxdma->ccr_from_device = config_port | (config_mem << 2) | dreq; | ||
369 | imxdma->ccr_to_device = config_mem | (config_port << 2) | dreq; | ||
370 | |||
371 | imx_dmav1_writel(dmareq, DMA_RSSR(channel)); | ||
372 | |||
373 | return 0; | ||
374 | } | ||
375 | EXPORT_SYMBOL(imx_dma_config_channel); | ||
376 | |||
377 | void imx_dma_config_burstlen(int channel, unsigned int burstlen) | ||
378 | { | ||
379 | imx_dmav1_writel(burstlen, DMA_BLR(channel)); | ||
380 | } | ||
381 | EXPORT_SYMBOL(imx_dma_config_burstlen); | ||
382 | |||
383 | /** | ||
384 | * imx_dma_setup_handlers - setup i.MX DMA channel end and error notification | ||
385 | * handlers | ||
386 | * @channel: i.MX DMA channel number | ||
387 | * @irq_handler: the pointer to the function called if the transfer | ||
388 | * ends successfully | ||
389 | * @err_handler: the pointer to the function called if the premature | ||
390 | * end caused by error occurs | ||
391 | * @data: user specified value to be passed to the handlers | ||
392 | */ | ||
393 | int | ||
394 | imx_dma_setup_handlers(int channel, | ||
395 | void (*irq_handler) (int, void *), | ||
396 | void (*err_handler) (int, void *, int), | ||
397 | void *data) | ||
398 | { | ||
399 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
400 | unsigned long flags; | ||
401 | |||
402 | if (!imxdma->name) { | ||
403 | printk(KERN_CRIT "%s: called for not allocated channel %d\n", | ||
404 | __func__, channel); | ||
405 | return -ENODEV; | ||
406 | } | ||
407 | |||
408 | local_irq_save(flags); | ||
409 | imx_dmav1_writel(1 << channel, DMA_DISR); | ||
410 | imxdma->irq_handler = irq_handler; | ||
411 | imxdma->err_handler = err_handler; | ||
412 | imxdma->data = data; | ||
413 | local_irq_restore(flags); | ||
414 | return 0; | ||
415 | } | ||
416 | EXPORT_SYMBOL(imx_dma_setup_handlers); | ||
417 | |||
418 | /** | ||
419 | * imx_dma_setup_progression_handler - setup i.MX DMA channel progression | ||
420 | * handlers | ||
421 | * @channel: i.MX DMA channel number | ||
422 | * @prog_handler: the pointer to the function called if the transfer progresses | ||
423 | */ | ||
424 | int | ||
425 | imx_dma_setup_progression_handler(int channel, | ||
426 | void (*prog_handler) (int, void*, struct scatterlist*)) | ||
427 | { | ||
428 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
429 | unsigned long flags; | ||
430 | |||
431 | if (!imxdma->name) { | ||
432 | printk(KERN_CRIT "%s: called for not allocated channel %d\n", | ||
433 | __func__, channel); | ||
434 | return -ENODEV; | ||
435 | } | ||
436 | |||
437 | local_irq_save(flags); | ||
438 | imxdma->prog_handler = prog_handler; | ||
439 | local_irq_restore(flags); | ||
440 | return 0; | ||
441 | } | ||
442 | EXPORT_SYMBOL(imx_dma_setup_progression_handler); | ||
443 | |||
444 | /** | ||
445 | * imx_dma_enable - function to start i.MX DMA channel operation | ||
446 | * @channel: i.MX DMA channel number | ||
447 | * | ||
448 | * The channel has to be allocated by driver through imx_dma_request() | ||
449 | * or imx_dma_request_by_prio() function. | ||
450 | * The transfer parameters has to be set to the channel registers through | ||
451 | * call of the imx_dma_setup_single() or imx_dma_setup_sg() function | ||
452 | * and registers %BLR(channel), %RSSR(channel) and %CCR(channel) has to | ||
453 | * be set prior this function call by the channel user. | ||
454 | */ | ||
455 | void imx_dma_enable(int channel) | ||
456 | { | ||
457 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
458 | unsigned long flags; | ||
459 | |||
460 | pr_debug("imxdma%d: imx_dma_enable\n", channel); | ||
461 | |||
462 | if (!imxdma->name) { | ||
463 | printk(KERN_CRIT "%s: called for not allocated channel %d\n", | ||
464 | __func__, channel); | ||
465 | return; | ||
466 | } | ||
467 | |||
468 | if (imxdma->in_use) | ||
469 | return; | ||
470 | |||
471 | local_irq_save(flags); | ||
472 | |||
473 | imx_dmav1_writel(1 << channel, DMA_DISR); | ||
474 | imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) & ~(1 << channel), DMA_DIMR); | ||
475 | imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) | CCR_CEN | | ||
476 | CCR_ACRPT, DMA_CCR(channel)); | ||
477 | |||
478 | if ((cpu_is_mx21() || cpu_is_mx27()) && | ||
479 | imxdma->sg && imx_dma_hw_chain(imxdma)) { | ||
480 | imxdma->sg = sg_next(imxdma->sg); | ||
481 | if (imxdma->sg) { | ||
482 | u32 tmp; | ||
483 | imx_dma_sg_next(channel, imxdma->sg); | ||
484 | tmp = imx_dmav1_readl(DMA_CCR(channel)); | ||
485 | imx_dmav1_writel(tmp | CCR_RPT | CCR_ACRPT, | ||
486 | DMA_CCR(channel)); | ||
487 | } | ||
488 | } | ||
489 | imxdma->in_use = 1; | ||
490 | |||
491 | local_irq_restore(flags); | ||
492 | } | ||
493 | EXPORT_SYMBOL(imx_dma_enable); | ||
494 | |||
495 | /** | ||
496 | * imx_dma_disable - stop, finish i.MX DMA channel operatin | ||
497 | * @channel: i.MX DMA channel number | ||
498 | */ | ||
499 | void imx_dma_disable(int channel) | ||
500 | { | ||
501 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
502 | unsigned long flags; | ||
503 | |||
504 | pr_debug("imxdma%d: imx_dma_disable\n", channel); | ||
505 | |||
506 | if (imx_dma_hw_chain(imxdma)) | ||
507 | del_timer(&imxdma->watchdog); | ||
508 | |||
509 | local_irq_save(flags); | ||
510 | imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) | (1 << channel), DMA_DIMR); | ||
511 | imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) & ~CCR_CEN, | ||
512 | DMA_CCR(channel)); | ||
513 | imx_dmav1_writel(1 << channel, DMA_DISR); | ||
514 | imxdma->in_use = 0; | ||
515 | local_irq_restore(flags); | ||
516 | } | ||
517 | EXPORT_SYMBOL(imx_dma_disable); | ||
518 | |||
519 | static void imx_dma_watchdog(unsigned long chno) | ||
520 | { | ||
521 | struct imx_dma_channel *imxdma = &imx_dma_channels[chno]; | ||
522 | |||
523 | imx_dmav1_writel(0, DMA_CCR(chno)); | ||
524 | imxdma->in_use = 0; | ||
525 | imxdma->sg = NULL; | ||
526 | |||
527 | if (imxdma->err_handler) | ||
528 | imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT); | ||
529 | } | ||
530 | |||
531 | static irqreturn_t dma_err_handler(int irq, void *dev_id) | ||
532 | { | ||
533 | int i, disr; | ||
534 | struct imx_dma_channel *imxdma; | ||
535 | unsigned int err_mask; | ||
536 | int errcode; | ||
537 | |||
538 | disr = imx_dmav1_readl(DMA_DISR); | ||
539 | |||
540 | err_mask = imx_dmav1_readl(DMA_DBTOSR) | | ||
541 | imx_dmav1_readl(DMA_DRTOSR) | | ||
542 | imx_dmav1_readl(DMA_DSESR) | | ||
543 | imx_dmav1_readl(DMA_DBOSR); | ||
544 | |||
545 | if (!err_mask) | ||
546 | return IRQ_HANDLED; | ||
547 | |||
548 | imx_dmav1_writel(disr & err_mask, DMA_DISR); | ||
549 | |||
550 | for (i = 0; i < IMX_DMA_CHANNELS; i++) { | ||
551 | if (!(err_mask & (1 << i))) | ||
552 | continue; | ||
553 | imxdma = &imx_dma_channels[i]; | ||
554 | errcode = 0; | ||
555 | |||
556 | if (imx_dmav1_readl(DMA_DBTOSR) & (1 << i)) { | ||
557 | imx_dmav1_writel(1 << i, DMA_DBTOSR); | ||
558 | errcode |= IMX_DMA_ERR_BURST; | ||
559 | } | ||
560 | if (imx_dmav1_readl(DMA_DRTOSR) & (1 << i)) { | ||
561 | imx_dmav1_writel(1 << i, DMA_DRTOSR); | ||
562 | errcode |= IMX_DMA_ERR_REQUEST; | ||
563 | } | ||
564 | if (imx_dmav1_readl(DMA_DSESR) & (1 << i)) { | ||
565 | imx_dmav1_writel(1 << i, DMA_DSESR); | ||
566 | errcode |= IMX_DMA_ERR_TRANSFER; | ||
567 | } | ||
568 | if (imx_dmav1_readl(DMA_DBOSR) & (1 << i)) { | ||
569 | imx_dmav1_writel(1 << i, DMA_DBOSR); | ||
570 | errcode |= IMX_DMA_ERR_BUFFER; | ||
571 | } | ||
572 | if (imxdma->name && imxdma->err_handler) { | ||
573 | imxdma->err_handler(i, imxdma->data, errcode); | ||
574 | continue; | ||
575 | } | ||
576 | |||
577 | imx_dma_channels[i].sg = NULL; | ||
578 | |||
579 | printk(KERN_WARNING | ||
580 | "DMA timeout on channel %d (%s) -%s%s%s%s\n", | ||
581 | i, imxdma->name, | ||
582 | errcode & IMX_DMA_ERR_BURST ? " burst" : "", | ||
583 | errcode & IMX_DMA_ERR_REQUEST ? " request" : "", | ||
584 | errcode & IMX_DMA_ERR_TRANSFER ? " transfer" : "", | ||
585 | errcode & IMX_DMA_ERR_BUFFER ? " buffer" : ""); | ||
586 | } | ||
587 | return IRQ_HANDLED; | ||
588 | } | ||
589 | |||
590 | static void dma_irq_handle_channel(int chno) | ||
591 | { | ||
592 | struct imx_dma_channel *imxdma = &imx_dma_channels[chno]; | ||
593 | |||
594 | if (!imxdma->name) { | ||
595 | /* | ||
596 | * IRQ for an unregistered DMA channel: | ||
597 | * let's clear the interrupts and disable it. | ||
598 | */ | ||
599 | printk(KERN_WARNING | ||
600 | "spurious IRQ for DMA channel %d\n", chno); | ||
601 | return; | ||
602 | } | ||
603 | |||
604 | if (imxdma->sg) { | ||
605 | u32 tmp; | ||
606 | struct scatterlist *current_sg = imxdma->sg; | ||
607 | imxdma->sg = sg_next(imxdma->sg); | ||
608 | |||
609 | if (imxdma->sg) { | ||
610 | imx_dma_sg_next(chno, imxdma->sg); | ||
611 | |||
612 | tmp = imx_dmav1_readl(DMA_CCR(chno)); | ||
613 | |||
614 | if (imx_dma_hw_chain(imxdma)) { | ||
615 | /* FIXME: The timeout should probably be | ||
616 | * configurable | ||
617 | */ | ||
618 | mod_timer(&imxdma->watchdog, | ||
619 | jiffies + msecs_to_jiffies(500)); | ||
620 | |||
621 | tmp |= CCR_CEN | CCR_RPT | CCR_ACRPT; | ||
622 | imx_dmav1_writel(tmp, DMA_CCR(chno)); | ||
623 | } else { | ||
624 | imx_dmav1_writel(tmp & ~CCR_CEN, DMA_CCR(chno)); | ||
625 | tmp |= CCR_CEN; | ||
626 | } | ||
627 | |||
628 | imx_dmav1_writel(tmp, DMA_CCR(chno)); | ||
629 | |||
630 | if (imxdma->prog_handler) | ||
631 | imxdma->prog_handler(chno, imxdma->data, | ||
632 | current_sg); | ||
633 | |||
634 | return; | ||
635 | } | ||
636 | |||
637 | if (imx_dma_hw_chain(imxdma)) { | ||
638 | del_timer(&imxdma->watchdog); | ||
639 | return; | ||
640 | } | ||
641 | } | ||
642 | |||
643 | imx_dmav1_writel(0, DMA_CCR(chno)); | ||
644 | imxdma->in_use = 0; | ||
645 | if (imxdma->irq_handler) | ||
646 | imxdma->irq_handler(chno, imxdma->data); | ||
647 | } | ||
648 | |||
649 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) | ||
650 | { | ||
651 | int i, disr; | ||
652 | |||
653 | if (cpu_is_mx21() || cpu_is_mx27()) | ||
654 | dma_err_handler(irq, dev_id); | ||
655 | |||
656 | disr = imx_dmav1_readl(DMA_DISR); | ||
657 | |||
658 | pr_debug("imxdma: dma_irq_handler called, disr=0x%08x\n", | ||
659 | disr); | ||
660 | |||
661 | imx_dmav1_writel(disr, DMA_DISR); | ||
662 | for (i = 0; i < IMX_DMA_CHANNELS; i++) { | ||
663 | if (disr & (1 << i)) | ||
664 | dma_irq_handle_channel(i); | ||
665 | } | ||
666 | |||
667 | return IRQ_HANDLED; | ||
668 | } | ||
669 | |||
670 | /** | ||
671 | * imx_dma_request - request/allocate specified channel number | ||
672 | * @channel: i.MX DMA channel number | ||
673 | * @name: the driver/caller own non-%NULL identification | ||
674 | */ | ||
675 | int imx_dma_request(int channel, const char *name) | ||
676 | { | ||
677 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
678 | unsigned long flags; | ||
679 | int ret = 0; | ||
680 | |||
681 | /* basic sanity checks */ | ||
682 | if (!name) | ||
683 | return -EINVAL; | ||
684 | |||
685 | if (channel >= IMX_DMA_CHANNELS) { | ||
686 | printk(KERN_CRIT "%s: called for non-existed channel %d\n", | ||
687 | __func__, channel); | ||
688 | return -EINVAL; | ||
689 | } | ||
690 | |||
691 | local_irq_save(flags); | ||
692 | if (imxdma->name) { | ||
693 | local_irq_restore(flags); | ||
694 | return -EBUSY; | ||
695 | } | ||
696 | memset(imxdma, 0, sizeof(*imxdma)); | ||
697 | imxdma->name = name; | ||
698 | local_irq_restore(flags); /* request_irq() can block */ | ||
699 | |||
700 | if (cpu_is_mx21() || cpu_is_mx27()) { | ||
701 | ret = request_irq(MX2x_INT_DMACH0 + channel, | ||
702 | dma_irq_handler, 0, "DMA", NULL); | ||
703 | if (ret) { | ||
704 | imxdma->name = NULL; | ||
705 | pr_crit("Can't register IRQ %d for DMA channel %d\n", | ||
706 | MX2x_INT_DMACH0 + channel, channel); | ||
707 | return ret; | ||
708 | } | ||
709 | init_timer(&imxdma->watchdog); | ||
710 | imxdma->watchdog.function = &imx_dma_watchdog; | ||
711 | imxdma->watchdog.data = channel; | ||
712 | } | ||
713 | |||
714 | return ret; | ||
715 | } | ||
716 | EXPORT_SYMBOL(imx_dma_request); | ||
717 | |||
718 | /** | ||
719 | * imx_dma_free - release previously acquired channel | ||
720 | * @channel: i.MX DMA channel number | ||
721 | */ | ||
722 | void imx_dma_free(int channel) | ||
723 | { | ||
724 | unsigned long flags; | ||
725 | struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; | ||
726 | |||
727 | if (!imxdma->name) { | ||
728 | printk(KERN_CRIT | ||
729 | "%s: trying to free free channel %d\n", | ||
730 | __func__, channel); | ||
731 | return; | ||
732 | } | ||
733 | |||
734 | local_irq_save(flags); | ||
735 | /* Disable interrupts */ | ||
736 | imx_dma_disable(channel); | ||
737 | imxdma->name = NULL; | ||
738 | |||
739 | if (cpu_is_mx21() || cpu_is_mx27()) | ||
740 | free_irq(MX2x_INT_DMACH0 + channel, NULL); | ||
741 | |||
742 | local_irq_restore(flags); | ||
743 | } | ||
744 | EXPORT_SYMBOL(imx_dma_free); | ||
745 | |||
746 | /** | ||
747 | * imx_dma_request_by_prio - find and request some of free channels best | ||
748 | * suiting requested priority | ||
749 | * @channel: i.MX DMA channel number | ||
750 | * @name: the driver/caller own non-%NULL identification | ||
751 | * | ||
752 | * This function tries to find a free channel in the specified priority group | ||
753 | * if the priority cannot be achieved it tries to look for free channel | ||
754 | * in the higher and then even lower priority groups. | ||
755 | * | ||
756 | * Return value: If there is no free channel to allocate, -%ENODEV is returned. | ||
757 | * On successful allocation channel is returned. | ||
758 | */ | ||
759 | int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio) | ||
760 | { | ||
761 | int i; | ||
762 | int best; | ||
763 | |||
764 | switch (prio) { | ||
765 | case (DMA_PRIO_HIGH): | ||
766 | best = 8; | ||
767 | break; | ||
768 | case (DMA_PRIO_MEDIUM): | ||
769 | best = 4; | ||
770 | break; | ||
771 | case (DMA_PRIO_LOW): | ||
772 | default: | ||
773 | best = 0; | ||
774 | break; | ||
775 | } | ||
776 | |||
777 | for (i = best; i < IMX_DMA_CHANNELS; i++) | ||
778 | if (!imx_dma_request(i, name)) | ||
779 | return i; | ||
780 | |||
781 | for (i = best - 1; i >= 0; i--) | ||
782 | if (!imx_dma_request(i, name)) | ||
783 | return i; | ||
784 | |||
785 | printk(KERN_ERR "%s: no free DMA channel found\n", __func__); | ||
786 | |||
787 | return -ENODEV; | ||
788 | } | ||
789 | EXPORT_SYMBOL(imx_dma_request_by_prio); | ||
790 | |||
791 | static int __init imx_dma_init(void) | ||
792 | { | ||
793 | int ret = 0; | ||
794 | int i; | ||
795 | |||
796 | if (cpu_is_mx1()) | ||
797 | imx_dmav1_baseaddr = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR); | ||
798 | else if (cpu_is_mx21()) | ||
799 | imx_dmav1_baseaddr = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR); | ||
800 | else if (cpu_is_mx27()) | ||
801 | imx_dmav1_baseaddr = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR); | ||
802 | else | ||
803 | return 0; | ||
804 | |||
805 | dma_clk = clk_get(NULL, "dma"); | ||
806 | if (IS_ERR(dma_clk)) | ||
807 | return PTR_ERR(dma_clk); | ||
808 | clk_enable(dma_clk); | ||
809 | |||
810 | /* reset DMA module */ | ||
811 | imx_dmav1_writel(DCR_DRST, DMA_DCR); | ||
812 | |||
813 | if (cpu_is_mx1()) { | ||
814 | ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", NULL); | ||
815 | if (ret) { | ||
816 | pr_crit("Wow! Can't register IRQ for DMA\n"); | ||
817 | return ret; | ||
818 | } | ||
819 | |||
820 | ret = request_irq(MX1_DMA_ERR, dma_err_handler, 0, "DMA", NULL); | ||
821 | if (ret) { | ||
822 | pr_crit("Wow! Can't register ERRIRQ for DMA\n"); | ||
823 | free_irq(MX1_DMA_INT, NULL); | ||
824 | return ret; | ||
825 | } | ||
826 | } | ||
827 | |||
828 | /* enable DMA module */ | ||
829 | imx_dmav1_writel(DCR_DEN, DMA_DCR); | ||
830 | |||
831 | /* clear all interrupts */ | ||
832 | imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DISR); | ||
833 | |||
834 | /* disable interrupts */ | ||
835 | imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR); | ||
836 | |||
837 | for (i = 0; i < IMX_DMA_CHANNELS; i++) { | ||
838 | imx_dma_channels[i].sg = NULL; | ||
839 | imx_dma_channels[i].dma_num = i; | ||
840 | } | ||
841 | |||
842 | return ret; | ||
843 | } | ||
844 | |||
845 | arch_initcall(imx_dma_init); | ||
diff --git a/arch/arm/mach-imx/include/mach/dma-v1.h b/arch/arm/mach-imx/include/mach/dma-v1.h deleted file mode 100644 index ac6fd713828a..000000000000 --- a/arch/arm/mach-imx/include/mach/dma-v1.h +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-imx/include/mach/dma-v1.h | ||
3 | * | ||
4 | * i.MX DMA registration and IRQ dispatching | ||
5 | * | ||
6 | * Copyright 2006 Pavel Pisa <pisa@cmp.felk.cvut.cz> | ||
7 | * Copyright 2008 Juergen Beisert, <kernel@pengutronix.de> | ||
8 | * Copyright 2008 Sascha Hauer, <s.hauer@pengutronix.de> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 | ||
13 | * of the License, or (at your option) any later version. | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
22 | * MA 02110-1301, USA. | ||
23 | */ | ||
24 | |||
25 | #ifndef __MACH_DMA_V1_H__ | ||
26 | #define __MACH_DMA_V1_H__ | ||
27 | |||
28 | #define imx_has_dma_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) | ||
29 | |||
30 | #include <mach/dma.h> | ||
31 | |||
32 | #define IMX_DMA_CHANNELS 16 | ||
33 | |||
34 | #define DMA_MODE_READ 0 | ||
35 | #define DMA_MODE_WRITE 1 | ||
36 | #define DMA_MODE_MASK 1 | ||
37 | |||
38 | #define MX1_DMA_REG(offset) MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR + (offset)) | ||
39 | |||
40 | /* DMA Interrupt Mask Register */ | ||
41 | #define MX1_DMA_DIMR MX1_DMA_REG(0x08) | ||
42 | |||
43 | /* Channel Control Register */ | ||
44 | #define MX1_DMA_CCR(x) MX1_DMA_REG(0x8c + ((x) << 6)) | ||
45 | |||
46 | #define IMX_DMA_MEMSIZE_32 (0 << 4) | ||
47 | #define IMX_DMA_MEMSIZE_8 (1 << 4) | ||
48 | #define IMX_DMA_MEMSIZE_16 (2 << 4) | ||
49 | #define IMX_DMA_TYPE_LINEAR (0 << 10) | ||
50 | #define IMX_DMA_TYPE_2D (1 << 10) | ||
51 | #define IMX_DMA_TYPE_FIFO (2 << 10) | ||
52 | |||
53 | #define IMX_DMA_ERR_BURST (1 << 0) | ||
54 | #define IMX_DMA_ERR_REQUEST (1 << 1) | ||
55 | #define IMX_DMA_ERR_TRANSFER (1 << 2) | ||
56 | #define IMX_DMA_ERR_BUFFER (1 << 3) | ||
57 | #define IMX_DMA_ERR_TIMEOUT (1 << 4) | ||
58 | |||
59 | int | ||
60 | imx_dma_config_channel(int channel, unsigned int config_port, | ||
61 | unsigned int config_mem, unsigned int dmareq, int hw_chaining); | ||
62 | |||
63 | void | ||
64 | imx_dma_config_burstlen(int channel, unsigned int burstlen); | ||
65 | |||
66 | int | ||
67 | imx_dma_setup_single(int channel, dma_addr_t dma_address, | ||
68 | unsigned int dma_length, unsigned int dev_addr, | ||
69 | unsigned int dmamode); | ||
70 | |||
71 | |||
72 | /* | ||
73 | * Use this flag as the dma_length argument to imx_dma_setup_sg() | ||
74 | * to create an endless running dma loop. The end of the scatterlist | ||
75 | * must be linked to the beginning for this to work. | ||
76 | */ | ||
77 | #define IMX_DMA_LENGTH_LOOP ((unsigned int)-1) | ||
78 | |||
79 | int | ||
80 | imx_dma_setup_sg(int channel, struct scatterlist *sg, | ||
81 | unsigned int sgcount, unsigned int dma_length, | ||
82 | unsigned int dev_addr, unsigned int dmamode); | ||
83 | |||
84 | int | ||
85 | imx_dma_setup_handlers(int channel, | ||
86 | void (*irq_handler) (int, void *), | ||
87 | void (*err_handler) (int, void *, int), void *data); | ||
88 | |||
89 | int | ||
90 | imx_dma_setup_progression_handler(int channel, | ||
91 | void (*prog_handler) (int, void*, struct scatterlist*)); | ||
92 | |||
93 | void imx_dma_enable(int channel); | ||
94 | |||
95 | void imx_dma_disable(int channel); | ||
96 | |||
97 | int imx_dma_request(int channel, const char *name); | ||
98 | |||
99 | void imx_dma_free(int channel); | ||
100 | |||
101 | int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio); | ||
102 | |||
103 | #endif /* __MACH_DMA_V1_H__ */ | ||
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c index 1912ab578676..74127389e7ab 100644 --- a/arch/arm/mach-imx/mm-imx3.c +++ b/arch/arm/mach-imx/mm-imx3.c | |||
@@ -62,8 +62,8 @@ static void imx3_idle(void) | |||
62 | : "=r" (reg)); | 62 | : "=r" (reg)); |
63 | } | 63 | } |
64 | 64 | ||
65 | static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, | 65 | static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size, |
66 | unsigned int mtype) | 66 | unsigned int mtype, void *caller) |
67 | { | 67 | { |
68 | if (mtype == MT_DEVICE) { | 68 | if (mtype == MT_DEVICE) { |
69 | /* | 69 | /* |
@@ -76,7 +76,7 @@ static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, | |||
76 | mtype = MT_DEVICE_NONSHARED; | 76 | mtype = MT_DEVICE_NONSHARED; |
77 | } | 77 | } |
78 | 78 | ||
79 | return __arm_ioremap(phys_addr, size, mtype); | 79 | return __arm_ioremap_caller(phys_addr, size, mtype, caller); |
80 | } | 80 | } |
81 | 81 | ||
82 | void __init imx3_init_l2x0(void) | 82 | void __init imx3_init_l2x0(void) |
@@ -135,7 +135,7 @@ void __init imx31_init_early(void) | |||
135 | { | 135 | { |
136 | mxc_set_cpu_type(MXC_CPU_MX31); | 136 | mxc_set_cpu_type(MXC_CPU_MX31); |
137 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); | 137 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); |
138 | imx_ioremap = imx3_ioremap; | 138 | arch_ioremap_caller = imx3_ioremap_caller; |
139 | arm_pm_idle = imx3_idle; | 139 | arm_pm_idle = imx3_idle; |
140 | } | 140 | } |
141 | 141 | ||
@@ -209,7 +209,7 @@ void __init imx35_init_early(void) | |||
209 | mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); | 209 | mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); |
210 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); | 210 | mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); |
211 | arm_pm_idle = imx3_idle; | 211 | arm_pm_idle = imx3_idle; |
212 | imx_ioremap = imx3_ioremap; | 212 | arch_ioremap_caller = imx3_ioremap_caller; |
213 | } | 213 | } |
214 | 214 | ||
215 | void __init mx35_init_irq(void) | 215 | void __init mx35_init_irq(void) |
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index 1a65d77bd55d..eaf6c6366ffa 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c | |||
@@ -25,8 +25,9 @@ | |||
25 | 25 | ||
26 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
27 | #include <mach/platform.h> | 27 | #include <mach/platform.h> |
28 | #include <asm/irq.h> | ||
29 | #include <mach/cm.h> | 28 | #include <mach/cm.h> |
29 | #include <mach/irqs.h> | ||
30 | |||
30 | #include <asm/leds.h> | 31 | #include <asm/leds.h> |
31 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
32 | #include <asm/mach/time.h> | 33 | #include <asm/mach/time.h> |
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h index 37beed3fa3ed..8de70de3dd0a 100644 --- a/arch/arm/mach-integrator/include/mach/io.h +++ b/arch/arm/mach-integrator/include/mach/io.h | |||
@@ -29,6 +29,5 @@ | |||
29 | #define PCI_IO_VADDR 0xee000000 | 29 | #define PCI_IO_VADDR 0xee000000 |
30 | 30 | ||
31 | #define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a))) | 31 | #define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a))) |
32 | #define __mem_pci(a) (a) | ||
33 | 32 | ||
34 | #endif | 33 | #endif |
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h index 1fbe6d190222..a19a1a2fcf6b 100644 --- a/arch/arm/mach-integrator/include/mach/irqs.h +++ b/arch/arm/mach-integrator/include/mach/irqs.h | |||
@@ -78,5 +78,6 @@ | |||
78 | #define IRQ_SIC_CP_LMINT7 46 | 78 | #define IRQ_SIC_CP_LMINT7 46 |
79 | #define IRQ_SIC_END 46 | 79 | #define IRQ_SIC_END 46 |
80 | 80 | ||
81 | #define NR_IRQS 47 | 81 | #define NR_IRQS_INTEGRATOR_AP 34 |
82 | #define NR_IRQS_INTEGRATOR_CP 47 | ||
82 | 83 | ||
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 21a1d6cbef40..871f148ffd72 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -38,12 +38,13 @@ | |||
38 | #include <mach/hardware.h> | 38 | #include <mach/hardware.h> |
39 | #include <mach/platform.h> | 39 | #include <mach/platform.h> |
40 | #include <asm/hardware/arm_timer.h> | 40 | #include <asm/hardware/arm_timer.h> |
41 | #include <asm/irq.h> | ||
42 | #include <asm/setup.h> | 41 | #include <asm/setup.h> |
43 | #include <asm/param.h> /* HZ */ | 42 | #include <asm/param.h> /* HZ */ |
44 | #include <asm/mach-types.h> | 43 | #include <asm/mach-types.h> |
44 | #include <asm/sched_clock.h> | ||
45 | 45 | ||
46 | #include <mach/lm.h> | 46 | #include <mach/lm.h> |
47 | #include <mach/irqs.h> | ||
47 | 48 | ||
48 | #include <asm/mach/arch.h> | 49 | #include <asm/mach/arch.h> |
49 | #include <asm/mach/irq.h> | 50 | #include <asm/mach/irq.h> |
@@ -325,6 +326,11 @@ static void __init ap_init(void) | |||
325 | 326 | ||
326 | static unsigned long timer_reload; | 327 | static unsigned long timer_reload; |
327 | 328 | ||
329 | static u32 notrace integrator_read_sched_clock(void) | ||
330 | { | ||
331 | return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE); | ||
332 | } | ||
333 | |||
328 | static void integrator_clocksource_init(unsigned long inrate) | 334 | static void integrator_clocksource_init(unsigned long inrate) |
329 | { | 335 | { |
330 | void __iomem *base = (void __iomem *)TIMER2_VA_BASE; | 336 | void __iomem *base = (void __iomem *)TIMER2_VA_BASE; |
@@ -341,6 +347,7 @@ static void integrator_clocksource_init(unsigned long inrate) | |||
341 | 347 | ||
342 | clocksource_mmio_init(base + TIMER_VALUE, "timer2", | 348 | clocksource_mmio_init(base + TIMER_VALUE, "timer2", |
343 | rate, 200, 16, clocksource_mmio_readl_down); | 349 | rate, 200, 16, clocksource_mmio_readl_down); |
350 | setup_sched_clock(integrator_read_sched_clock, 16, rate); | ||
344 | } | 351 | } |
345 | 352 | ||
346 | static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; | 353 | static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; |
@@ -468,6 +475,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator") | |||
468 | .atag_offset = 0x100, | 475 | .atag_offset = 0x100, |
469 | .reserve = integrator_reserve, | 476 | .reserve = integrator_reserve, |
470 | .map_io = ap_map_io, | 477 | .map_io = ap_map_io, |
478 | .nr_irqs = NR_IRQS_INTEGRATOR_AP, | ||
471 | .init_early = integrator_init_early, | 479 | .init_early = integrator_init_early, |
472 | .init_irq = ap_init_irq, | 480 | .init_irq = ap_init_irq, |
473 | .timer = &ap_timer, | 481 | .timer = &ap_timer, |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index be9ead4a3bcc..48a115a91d9d 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
28 | #include <mach/platform.h> | 28 | #include <mach/platform.h> |
29 | #include <asm/irq.h> | ||
30 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
31 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
32 | #include <asm/hardware/arm_timer.h> | 31 | #include <asm/hardware/arm_timer.h> |
@@ -34,6 +33,7 @@ | |||
34 | 33 | ||
35 | #include <mach/cm.h> | 34 | #include <mach/cm.h> |
36 | #include <mach/lm.h> | 35 | #include <mach/lm.h> |
36 | #include <mach/irqs.h> | ||
37 | 37 | ||
38 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
39 | #include <asm/mach/irq.h> | 39 | #include <asm/mach/irq.h> |
@@ -464,6 +464,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") | |||
464 | .atag_offset = 0x100, | 464 | .atag_offset = 0x100, |
465 | .reserve = integrator_reserve, | 465 | .reserve = integrator_reserve, |
466 | .map_io = intcp_map_io, | 466 | .map_io = intcp_map_io, |
467 | .nr_irqs = NR_IRQS_INTEGRATOR_CP, | ||
467 | .init_early = intcp_init_early, | 468 | .init_early = intcp_init_early, |
468 | .init_irq = intcp_init_irq, | 469 | .init_irq = intcp_init_irq, |
469 | .timer = &cp_timer, | 470 | .timer = &cp_timer, |
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c index 36068f438f2b..f1ca9c122861 100644 --- a/arch/arm/mach-integrator/pci.c +++ b/arch/arm/mach-integrator/pci.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | 28 | ||
29 | #include <asm/irq.h> | ||
30 | #include <asm/mach/pci.h> | 29 | #include <asm/mach/pci.h> |
31 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
32 | 31 | ||
32 | #include <mach/irqs.h> | ||
33 | |||
33 | /* | 34 | /* |
34 | * A small note about bridges and interrupts. The DECchip 21050 (and | 35 | * A small note about bridges and interrupts. The DECchip 21050 (and |
35 | * later) adheres to the PCI-PCI bridge specification. This says that | 36 | * later) adheres to the PCI-PCI bridge specification. This says that |
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index 4be172c3cbe0..67e6f9a9d1a0 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c | |||
@@ -30,7 +30,8 @@ | |||
30 | 30 | ||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/platform.h> | 32 | #include <mach/platform.h> |
33 | #include <asm/irq.h> | 33 | #include <mach/irqs.h> |
34 | |||
34 | #include <asm/signal.h> | 35 | #include <asm/signal.h> |
35 | #include <asm/mach/pci.h> | 36 | #include <asm/mach/pci.h> |
36 | #include <asm/irq_regs.h> | 37 | #include <asm/irq_regs.h> |
diff --git a/arch/arm/mach-iop13xx/include/mach/io.h b/arch/arm/mach-iop13xx/include/mach/io.h index dffb234bb967..f13188518025 100644 --- a/arch/arm/mach-iop13xx/include/mach/io.h +++ b/arch/arm/mach-iop13xx/include/mach/io.h | |||
@@ -22,20 +22,7 @@ | |||
22 | #define IO_SPACE_LIMIT 0xffffffff | 22 | #define IO_SPACE_LIMIT 0xffffffff |
23 | 23 | ||
24 | #define __io(a) __iop13xx_io(a) | 24 | #define __io(a) __iop13xx_io(a) |
25 | #define __mem_pci(a) (a) | ||
26 | #define __mem_isa(a) (a) | ||
27 | 25 | ||
28 | extern void __iomem * __iop13xx_io(unsigned long io_addr); | 26 | extern void __iomem * __iop13xx_io(unsigned long io_addr); |
29 | extern void __iomem *__iop13xx_ioremap(unsigned long cookie, size_t size, | ||
30 | unsigned int mtype); | ||
31 | extern void __iop13xx_iounmap(void __iomem *addr); | ||
32 | |||
33 | extern u32 iop13xx_atue_mem_base; | ||
34 | extern u32 iop13xx_atux_mem_base; | ||
35 | extern size_t iop13xx_atue_mem_size; | ||
36 | extern size_t iop13xx_atux_mem_size; | ||
37 | |||
38 | #define __arch_ioremap __iop13xx_ioremap | ||
39 | #define __arch_iounmap __iop13xx_iounmap | ||
40 | 27 | ||
41 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h index 07e9ff7adafb..e190dcd7d72d 100644 --- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h +++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h | |||
@@ -5,6 +5,7 @@ | |||
5 | /* The ATU offsets can change based on the strapping */ | 5 | /* The ATU offsets can change based on the strapping */ |
6 | extern u32 iop13xx_atux_pmmr_offset; | 6 | extern u32 iop13xx_atux_pmmr_offset; |
7 | extern u32 iop13xx_atue_pmmr_offset; | 7 | extern u32 iop13xx_atue_pmmr_offset; |
8 | void iop13xx_init_early(void); | ||
8 | void iop13xx_init_irq(void); | 9 | void iop13xx_init_irq(void); |
9 | void iop13xx_map_io(void); | 10 | void iop13xx_map_io(void); |
10 | void iop13xx_platform_init(void); | 11 | void iop13xx_platform_init(void); |
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c index 48642e66c566..3c364198db9c 100644 --- a/arch/arm/mach-iop13xx/io.c +++ b/arch/arm/mach-iop13xx/io.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
23 | 23 | ||
24 | #include "pci.h" | ||
25 | |||
24 | void * __iomem __iop13xx_io(unsigned long io_addr) | 26 | void * __iomem __iop13xx_io(unsigned long io_addr) |
25 | { | 27 | { |
26 | void __iomem * io_virt; | 28 | void __iomem * io_virt; |
@@ -40,8 +42,8 @@ void * __iomem __iop13xx_io(unsigned long io_addr) | |||
40 | } | 42 | } |
41 | EXPORT_SYMBOL(__iop13xx_io); | 43 | EXPORT_SYMBOL(__iop13xx_io); |
42 | 44 | ||
43 | void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size, | 45 | static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie, |
44 | unsigned int mtype) | 46 | size_t size, unsigned int mtype, void *caller) |
45 | { | 47 | { |
46 | void __iomem * retval; | 48 | void __iomem * retval; |
47 | 49 | ||
@@ -76,17 +78,14 @@ void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size, | |||
76 | break; | 78 | break; |
77 | default: | 79 | default: |
78 | retval = __arm_ioremap_caller(cookie, size, mtype, | 80 | retval = __arm_ioremap_caller(cookie, size, mtype, |
79 | __builtin_return_address(0)); | 81 | caller); |
80 | } | 82 | } |
81 | 83 | ||
82 | return retval; | 84 | return retval; |
83 | } | 85 | } |
84 | EXPORT_SYMBOL(__iop13xx_ioremap); | ||
85 | 86 | ||
86 | void __iop13xx_iounmap(void __iomem *addr) | 87 | static void __iop13xx_iounmap(volatile void __iomem *addr) |
87 | { | 88 | { |
88 | extern void __iounmap(volatile void __iomem *addr); | ||
89 | |||
90 | if (iop13xx_atue_mem_base) | 89 | if (iop13xx_atue_mem_base) |
91 | if (addr >= (void __iomem *) iop13xx_atue_mem_base && | 90 | if (addr >= (void __iomem *) iop13xx_atue_mem_base && |
92 | addr < (void __iomem *) (iop13xx_atue_mem_base + | 91 | addr < (void __iomem *) (iop13xx_atue_mem_base + |
@@ -110,4 +109,9 @@ void __iop13xx_iounmap(void __iomem *addr) | |||
110 | skip: | 109 | skip: |
111 | return; | 110 | return; |
112 | } | 111 | } |
113 | EXPORT_SYMBOL(__iop13xx_iounmap); | 112 | |
113 | void __init iop13xx_init_early(void) | ||
114 | { | ||
115 | arch_ioremap_caller = __iop13xx_ioremap_caller; | ||
116 | arch_iounmap = __iop13xx_iounmap; | ||
117 | } | ||
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c index abaee8833588..5c96b73e6964 100644 --- a/arch/arm/mach-iop13xx/iq81340mc.c +++ b/arch/arm/mach-iop13xx/iq81340mc.c | |||
@@ -92,6 +92,7 @@ static struct sys_timer iq81340mc_timer = { | |||
92 | MACHINE_START(IQ81340MC, "Intel IQ81340MC") | 92 | MACHINE_START(IQ81340MC, "Intel IQ81340MC") |
93 | /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ | 93 | /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ |
94 | .atag_offset = 0x100, | 94 | .atag_offset = 0x100, |
95 | .init_early = iop13xx_init_early, | ||
95 | .map_io = iop13xx_map_io, | 96 | .map_io = iop13xx_map_io, |
96 | .init_irq = iop13xx_init_irq, | 97 | .init_irq = iop13xx_init_irq, |
97 | .timer = &iq81340mc_timer, | 98 | .timer = &iq81340mc_timer, |
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c index 690916a09dc6..aa4dd750135a 100644 --- a/arch/arm/mach-iop13xx/iq81340sc.c +++ b/arch/arm/mach-iop13xx/iq81340sc.c | |||
@@ -94,6 +94,7 @@ static struct sys_timer iq81340sc_timer = { | |||
94 | MACHINE_START(IQ81340SC, "Intel IQ81340SC") | 94 | MACHINE_START(IQ81340SC, "Intel IQ81340SC") |
95 | /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ | 95 | /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ |
96 | .atag_offset = 0x100, | 96 | .atag_offset = 0x100, |
97 | .init_early = iop13xx_init_early, | ||
97 | .map_io = iop13xx_map_io, | 98 | .map_io = iop13xx_map_io, |
98 | .init_irq = iop13xx_init_irq, | 99 | .init_irq = iop13xx_init_irq, |
99 | .timer = &iq81340sc_timer, | 100 | .timer = &iq81340sc_timer, |
diff --git a/arch/arm/mach-iop13xx/pci.h b/arch/arm/mach-iop13xx/pci.h new file mode 100644 index 000000000000..c70cf5b41e31 --- /dev/null +++ b/arch/arm/mach-iop13xx/pci.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #include <linux/types.h> | ||
2 | |||
3 | extern u32 iop13xx_atue_mem_base; | ||
4 | extern u32 iop13xx_atux_mem_base; | ||
5 | extern size_t iop13xx_atue_mem_size; | ||
6 | extern size_t iop13xx_atux_mem_size; | ||
diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h index 2d88264b9863..e2ada265bb8d 100644 --- a/arch/arm/mach-iop32x/include/mach/io.h +++ b/arch/arm/mach-iop32x/include/mach/io.h | |||
@@ -15,6 +15,5 @@ | |||
15 | 15 | ||
16 | #define IO_SPACE_LIMIT 0xffffffff | 16 | #define IO_SPACE_LIMIT 0xffffffff |
17 | #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) | 17 | #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) |
18 | #define __mem_pci(a) (a) | ||
19 | 18 | ||
20 | #endif | 19 | #endif |
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h index a8a66fc8fbdb..f7c1b6595660 100644 --- a/arch/arm/mach-iop33x/include/mach/io.h +++ b/arch/arm/mach-iop33x/include/mach/io.h | |||
@@ -15,6 +15,5 @@ | |||
15 | 15 | ||
16 | #define IO_SPACE_LIMIT 0xffffffff | 16 | #define IO_SPACE_LIMIT 0xffffffff |
17 | #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) | 17 | #define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) |
18 | #define __mem_pci(a) (a) | ||
19 | 18 | ||
20 | #endif | 19 | #endif |
diff --git a/arch/arm/mach-ixp2000/include/mach/io.h b/arch/arm/mach-ixp2000/include/mach/io.h index 859e584914d9..f6552d6f35ab 100644 --- a/arch/arm/mach-ixp2000/include/mach/io.h +++ b/arch/arm/mach-ixp2000/include/mach/io.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
19 | 19 | ||
20 | #define IO_SPACE_LIMIT 0xffffffff | 20 | #define IO_SPACE_LIMIT 0xffffffff |
21 | #define __mem_pci(a) (a) | ||
22 | 21 | ||
23 | /* | 22 | /* |
24 | * The A? revisions of the IXP2000s assert byte lanes for PCI I/O | 23 | * The A? revisions of the IXP2000s assert byte lanes for PCI I/O |
diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h index 4ce4353b9f72..a7aceb55c130 100644 --- a/arch/arm/mach-ixp23xx/include/mach/io.h +++ b/arch/arm/mach-ixp23xx/include/mach/io.h | |||
@@ -18,6 +18,5 @@ | |||
18 | #define IO_SPACE_LIMIT 0xffffffff | 18 | #define IO_SPACE_LIMIT 0xffffffff |
19 | 19 | ||
20 | #define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT)) | 20 | #define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT)) |
21 | #define __mem_pci(a) (a) | ||
22 | 21 | ||
23 | #endif | 22 | #endif |
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c index a7277ad470a5..90e42e9982cb 100644 --- a/arch/arm/mach-ixp4xx/avila-setup.c +++ b/arch/arm/mach-ixp4xx/avila-setup.c | |||
@@ -165,6 +165,7 @@ static void __init avila_init(void) | |||
165 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") | 165 | MACHINE_START(AVILA, "Gateworks Avila Network Platform") |
166 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ | 166 | /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ |
167 | .map_io = ixp4xx_map_io, | 167 | .map_io = ixp4xx_map_io, |
168 | .init_early = ixp4xx_init_early, | ||
168 | .init_irq = ixp4xx_init_irq, | 169 | .init_irq = ixp4xx_init_irq, |
169 | .timer = &ixp4xx_timer, | 170 | .timer = &ixp4xx_timer, |
170 | .atag_offset = 0x100, | 171 | .atag_offset = 0x100, |
@@ -184,6 +185,7 @@ MACHINE_END | |||
184 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") | 185 | MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") |
185 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ | 186 | /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ |
186 | .map_io = ixp4xx_map_io, | 187 | .map_io = ixp4xx_map_io, |
188 | .init_early = ixp4xx_init_early, | ||
187 | .init_irq = ixp4xx_init_irq, | 189 | .init_irq = ixp4xx_init_irq, |
188 | .timer = &ixp4xx_timer, | 190 | .timer = &ixp4xx_timer, |
189 | .atag_offset = 0x100, | 191 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index fa7c9c0e5672..ebbd7fc90eb4 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <mach/udc.h> | 32 | #include <mach/udc.h> |
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <mach/io.h> | ||
34 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
35 | #include <asm/pgtable.h> | 36 | #include <asm/pgtable.h> |
36 | #include <asm/page.h> | 37 | #include <asm/page.h> |
@@ -518,3 +519,35 @@ void ixp4xx_restart(char mode, const char *cmd) | |||
518 | *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; | 519 | *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; |
519 | } | 520 | } |
520 | } | 521 | } |
522 | |||
523 | #ifdef CONFIG_IXP4XX_INDIRECT_PCI | ||
524 | /* | ||
525 | * In the case of using indirect PCI, we simply return the actual PCI | ||
526 | * address and our read/write implementation use that to drive the | ||
527 | * access registers. If something outside of PCI is ioremap'd, we | ||
528 | * fallback to the default. | ||
529 | */ | ||
530 | |||
531 | static void __iomem *ixp4xx_ioremap_caller(unsigned long addr, size_t size, | ||
532 | unsigned int mtype, void *caller) | ||
533 | { | ||
534 | if (!is_pci_memory(addr)) | ||
535 | return __arm_ioremap_caller(addr, size, mtype, caller); | ||
536 | |||
537 | return (void __iomem *)addr; | ||
538 | } | ||
539 | |||
540 | static void ixp4xx_iounmap(void __iomem *addr) | ||
541 | { | ||
542 | if (!is_pci_memory((__force u32)addr)) | ||
543 | __iounmap(addr); | ||
544 | } | ||
545 | |||
546 | void __init ixp4xx_init_early(void) | ||
547 | { | ||
548 | arch_ioremap_caller = ixp4xx_ioremap_caller; | ||
549 | arch_iounmap = ixp4xx_iounmap; | ||
550 | } | ||
551 | #else | ||
552 | void __init ixp4xx_init_early(void) {} | ||
553 | #endif | ||
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c index a74f86ce8bcc..1b83110028d6 100644 --- a/arch/arm/mach-ixp4xx/coyote-setup.c +++ b/arch/arm/mach-ixp4xx/coyote-setup.c | |||
@@ -110,6 +110,7 @@ static void __init coyote_init(void) | |||
110 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") | 110 | MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") |
111 | /* Maintainer: MontaVista Software, Inc. */ | 111 | /* Maintainer: MontaVista Software, Inc. */ |
112 | .map_io = ixp4xx_map_io, | 112 | .map_io = ixp4xx_map_io, |
113 | .init_early = ixp4xx_init_early, | ||
113 | .init_irq = ixp4xx_init_irq, | 114 | .init_irq = ixp4xx_init_irq, |
114 | .timer = &ixp4xx_timer, | 115 | .timer = &ixp4xx_timer, |
115 | .atag_offset = 0x100, | 116 | .atag_offset = 0x100, |
@@ -129,6 +130,7 @@ MACHINE_END | |||
129 | MACHINE_START(IXDPG425, "Intel IXDPG425") | 130 | MACHINE_START(IXDPG425, "Intel IXDPG425") |
130 | /* Maintainer: MontaVista Software, Inc. */ | 131 | /* Maintainer: MontaVista Software, Inc. */ |
131 | .map_io = ixp4xx_map_io, | 132 | .map_io = ixp4xx_map_io, |
133 | .init_early = ixp4xx_init_early, | ||
132 | .init_irq = ixp4xx_init_irq, | 134 | .init_irq = ixp4xx_init_irq, |
133 | .timer = &ixp4xx_timer, | 135 | .timer = &ixp4xx_timer, |
134 | .atag_offset = 0x100, | 136 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 67be177b336a..97a0af8f1955 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c | |||
@@ -280,6 +280,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 RevA") | |||
280 | /* Maintainer: www.nslu2-linux.org */ | 280 | /* Maintainer: www.nslu2-linux.org */ |
281 | .atag_offset = 0x100, | 281 | .atag_offset = 0x100, |
282 | .map_io = ixp4xx_map_io, | 282 | .map_io = ixp4xx_map_io, |
283 | .init_early = ixp4xx_init_early, | ||
283 | .init_irq = ixp4xx_init_irq, | 284 | .init_irq = ixp4xx_init_irq, |
284 | .timer = &dsmg600_timer, | 285 | .timer = &dsmg600_timer, |
285 | .init_machine = dsmg600_init, | 286 | .init_machine = dsmg600_init, |
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c index 6d5818285af8..9175a25a7511 100644 --- a/arch/arm/mach-ixp4xx/fsg-setup.c +++ b/arch/arm/mach-ixp4xx/fsg-setup.c | |||
@@ -270,6 +270,7 @@ static void __init fsg_init(void) | |||
270 | MACHINE_START(FSG, "Freecom FSG-3") | 270 | MACHINE_START(FSG, "Freecom FSG-3") |
271 | /* Maintainer: www.nslu2-linux.org */ | 271 | /* Maintainer: www.nslu2-linux.org */ |
272 | .map_io = ixp4xx_map_io, | 272 | .map_io = ixp4xx_map_io, |
273 | .init_early = ixp4xx_init_early, | ||
273 | .init_irq = ixp4xx_init_irq, | 274 | .init_irq = ixp4xx_init_irq, |
274 | .timer = &ixp4xx_timer, | 275 | .timer = &ixp4xx_timer, |
275 | .atag_offset = 0x100, | 276 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c index 7ecf9b28f1c0..033c71758953 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-setup.c +++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c | |||
@@ -97,6 +97,7 @@ static void __init gateway7001_init(void) | |||
97 | MACHINE_START(GATEWAY7001, "Gateway 7001 AP") | 97 | MACHINE_START(GATEWAY7001, "Gateway 7001 AP") |
98 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ | 98 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ |
99 | .map_io = ixp4xx_map_io, | 99 | .map_io = ixp4xx_map_io, |
100 | .init_early = ixp4xx_init_early, | ||
100 | .init_irq = ixp4xx_init_irq, | 101 | .init_irq = ixp4xx_init_irq, |
101 | .timer = &ixp4xx_timer, | 102 | .timer = &ixp4xx_timer, |
102 | .atag_offset = 0x100, | 103 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index 78ae12c46261..46bb924962ee 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c | |||
@@ -496,6 +496,7 @@ subsys_initcall(gmlr_pci_init); | |||
496 | MACHINE_START(GORAMO_MLR, "MultiLink") | 496 | MACHINE_START(GORAMO_MLR, "MultiLink") |
497 | /* Maintainer: Krzysztof Halasa */ | 497 | /* Maintainer: Krzysztof Halasa */ |
498 | .map_io = ixp4xx_map_io, | 498 | .map_io = ixp4xx_map_io, |
499 | .init_early = ixp4xx_init_early, | ||
499 | .init_irq = ixp4xx_init_irq, | 500 | .init_irq = ixp4xx_init_irq, |
500 | .timer = &ixp4xx_timer, | 501 | .timer = &ixp4xx_timer, |
501 | .atag_offset = 0x100, | 502 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index a23f89391458..18ebc6be7969 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c | |||
@@ -165,6 +165,7 @@ static void __init gtwx5715_init(void) | |||
165 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") | 165 | MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") |
166 | /* Maintainer: George Joseph */ | 166 | /* Maintainer: George Joseph */ |
167 | .map_io = ixp4xx_map_io, | 167 | .map_io = ixp4xx_map_io, |
168 | .init_early = ixp4xx_init_early, | ||
168 | .init_irq = ixp4xx_init_irq, | 169 | .init_irq = ixp4xx_init_irq, |
169 | .timer = &ixp4xx_timer, | 170 | .timer = &ixp4xx_timer, |
170 | .atag_offset = 0x100, | 171 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h index c30e7e923a73..034bb2a1b805 100644 --- a/arch/arm/mach-ixp4xx/include/mach/hardware.h +++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h | |||
@@ -23,8 +23,6 @@ | |||
23 | #define PCIBIOS_MAX_MEM 0x4BFFFFFF | 23 | #define PCIBIOS_MAX_MEM 0x4BFFFFFF |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #define ARCH_HAS_DMA_SET_COHERENT_MASK | ||
27 | |||
28 | /* Register locations and bits */ | 26 | /* Register locations and bits */ |
29 | #include "ixp4xx-regs.h" | 27 | #include "ixp4xx-regs.h" |
30 | 28 | ||
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index ffb9d6afb89f..5cf30d1b78d2 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h | |||
@@ -39,11 +39,7 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); | |||
39 | * but in some cases the performance hit is acceptable. In addition, you | 39 | * but in some cases the performance hit is acceptable. In addition, you |
40 | * cannot mmap() PCI devices in this case. | 40 | * cannot mmap() PCI devices in this case. |
41 | */ | 41 | */ |
42 | #ifndef CONFIG_IXP4XX_INDIRECT_PCI | 42 | #ifdef CONFIG_IXP4XX_INDIRECT_PCI |
43 | |||
44 | #define __mem_pci(a) (a) | ||
45 | |||
46 | #else | ||
47 | 43 | ||
48 | /* | 44 | /* |
49 | * In the case of using indirect PCI, we simply return the actual PCI | 45 | * In the case of using indirect PCI, we simply return the actual PCI |
@@ -57,24 +53,6 @@ static inline int is_pci_memory(u32 addr) | |||
57 | return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF); | 53 | return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF); |
58 | } | 54 | } |
59 | 55 | ||
60 | static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size, | ||
61 | unsigned int mtype) | ||
62 | { | ||
63 | if (!is_pci_memory(addr)) | ||
64 | return __arm_ioremap(addr, size, mtype); | ||
65 | |||
66 | return (void __iomem *)addr; | ||
67 | } | ||
68 | |||
69 | static inline void __indirect_iounmap(void __iomem *addr) | ||
70 | { | ||
71 | if (!is_pci_memory((__force u32)addr)) | ||
72 | __iounmap(addr); | ||
73 | } | ||
74 | |||
75 | #define __arch_ioremap __indirect_ioremap | ||
76 | #define __arch_iounmap __indirect_iounmap | ||
77 | |||
78 | #define writeb(v, p) __indirect_writeb(v, p) | 56 | #define writeb(v, p) __indirect_writeb(v, p) |
79 | #define writew(v, p) __indirect_writew(v, p) | 57 | #define writew(v, p) __indirect_writew(v, p) |
80 | #define writel(v, p) __indirect_writel(v, p) | 58 | #define writel(v, p) __indirect_writel(v, p) |
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h index df9250bbf13d..b66bedc64de1 100644 --- a/arch/arm/mach-ixp4xx/include/mach/platform.h +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h | |||
@@ -121,6 +121,7 @@ extern unsigned long ixp4xx_timer_freq; | |||
121 | * Functions used by platform-level setup code | 121 | * Functions used by platform-level setup code |
122 | */ | 122 | */ |
123 | extern void ixp4xx_map_io(void); | 123 | extern void ixp4xx_map_io(void); |
124 | extern void ixp4xx_init_early(void); | ||
124 | extern void ixp4xx_init_irq(void); | 125 | extern void ixp4xx_init_irq(void); |
125 | extern void ixp4xx_sys_init(void); | 126 | extern void ixp4xx_sys_init(void); |
126 | extern void ixp4xx_timer_init(void); | 127 | extern void ixp4xx_timer_init(void); |
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 8a38b39999f8..3d742aee1773 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c | |||
@@ -254,6 +254,7 @@ static void __init ixdp425_init(void) | |||
254 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") | 254 | MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") |
255 | /* Maintainer: MontaVista Software, Inc. */ | 255 | /* Maintainer: MontaVista Software, Inc. */ |
256 | .map_io = ixp4xx_map_io, | 256 | .map_io = ixp4xx_map_io, |
257 | .init_early = ixp4xx_init_early, | ||
257 | .init_irq = ixp4xx_init_irq, | 258 | .init_irq = ixp4xx_init_irq, |
258 | .timer = &ixp4xx_timer, | 259 | .timer = &ixp4xx_timer, |
259 | .atag_offset = 0x100, | 260 | .atag_offset = 0x100, |
@@ -269,6 +270,7 @@ MACHINE_END | |||
269 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") | 270 | MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") |
270 | /* Maintainer: MontaVista Software, Inc. */ | 271 | /* Maintainer: MontaVista Software, Inc. */ |
271 | .map_io = ixp4xx_map_io, | 272 | .map_io = ixp4xx_map_io, |
273 | .init_early = ixp4xx_init_early, | ||
272 | .init_irq = ixp4xx_init_irq, | 274 | .init_irq = ixp4xx_init_irq, |
273 | .timer = &ixp4xx_timer, | 275 | .timer = &ixp4xx_timer, |
274 | .atag_offset = 0x100, | 276 | .atag_offset = 0x100, |
@@ -283,6 +285,7 @@ MACHINE_END | |||
283 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") | 285 | MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") |
284 | /* Maintainer: MontaVista Software, Inc. */ | 286 | /* Maintainer: MontaVista Software, Inc. */ |
285 | .map_io = ixp4xx_map_io, | 287 | .map_io = ixp4xx_map_io, |
288 | .init_early = ixp4xx_init_early, | ||
286 | .init_irq = ixp4xx_init_irq, | 289 | .init_irq = ixp4xx_init_irq, |
287 | .timer = &ixp4xx_timer, | 290 | .timer = &ixp4xx_timer, |
288 | .atag_offset = 0x100, | 291 | .atag_offset = 0x100, |
@@ -297,6 +300,7 @@ MACHINE_END | |||
297 | MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform") | 300 | MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform") |
298 | /* Maintainer: MontaVista Software, Inc. */ | 301 | /* Maintainer: MontaVista Software, Inc. */ |
299 | .map_io = ixp4xx_map_io, | 302 | .map_io = ixp4xx_map_io, |
303 | .init_early = ixp4xx_init_early, | ||
300 | .init_irq = ixp4xx_init_irq, | 304 | .init_irq = ixp4xx_init_irq, |
301 | .timer = &ixp4xx_timer, | 305 | .timer = &ixp4xx_timer, |
302 | .atag_offset = 0x100, | 306 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 1010eb7b0083..33cb0955b6bf 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -315,6 +315,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d") | |||
315 | /* Maintainer: www.nslu2-linux.org */ | 315 | /* Maintainer: www.nslu2-linux.org */ |
316 | .atag_offset = 0x100, | 316 | .atag_offset = 0x100, |
317 | .map_io = ixp4xx_map_io, | 317 | .map_io = ixp4xx_map_io, |
318 | .init_early = ixp4xx_init_early, | ||
318 | .init_irq = ixp4xx_init_irq, | 319 | .init_irq = ixp4xx_init_irq, |
319 | .timer = &ixp4xx_timer, | 320 | .timer = &ixp4xx_timer, |
320 | .init_machine = nas100d_init, | 321 | .init_machine = nas100d_init, |
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index aa355c360d57..e2903faaebb3 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -301,6 +301,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2") | |||
301 | /* Maintainer: www.nslu2-linux.org */ | 301 | /* Maintainer: www.nslu2-linux.org */ |
302 | .atag_offset = 0x100, | 302 | .atag_offset = 0x100, |
303 | .map_io = ixp4xx_map_io, | 303 | .map_io = ixp4xx_map_io, |
304 | .init_early = ixp4xx_init_early, | ||
304 | .init_irq = ixp4xx_init_irq, | 305 | .init_irq = ixp4xx_init_irq, |
305 | .timer = &nslu2_timer, | 306 | .timer = &nslu2_timer, |
306 | .init_machine = nslu2_init, | 307 | .init_machine = nslu2_init, |
diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c index 0940869fcfdd..158ddb79821d 100644 --- a/arch/arm/mach-ixp4xx/omixp-setup.c +++ b/arch/arm/mach-ixp4xx/omixp-setup.c | |||
@@ -243,6 +243,7 @@ static void __init omixp_init(void) | |||
243 | MACHINE_START(DEVIXP, "Omicron DEVIXP") | 243 | MACHINE_START(DEVIXP, "Omicron DEVIXP") |
244 | .atag_offset = 0x100, | 244 | .atag_offset = 0x100, |
245 | .map_io = ixp4xx_map_io, | 245 | .map_io = ixp4xx_map_io, |
246 | .init_early = ixp4xx_init_early, | ||
246 | .init_irq = ixp4xx_init_irq, | 247 | .init_irq = ixp4xx_init_irq, |
247 | .timer = &ixp4xx_timer, | 248 | .timer = &ixp4xx_timer, |
248 | .init_machine = omixp_init, | 249 | .init_machine = omixp_init, |
@@ -254,6 +255,7 @@ MACHINE_END | |||
254 | MACHINE_START(MICCPT, "Omicron MICCPT") | 255 | MACHINE_START(MICCPT, "Omicron MICCPT") |
255 | .atag_offset = 0x100, | 256 | .atag_offset = 0x100, |
256 | .map_io = ixp4xx_map_io, | 257 | .map_io = ixp4xx_map_io, |
258 | .init_early = ixp4xx_init_early, | ||
257 | .init_irq = ixp4xx_init_irq, | 259 | .init_irq = ixp4xx_init_irq, |
258 | .timer = &ixp4xx_timer, | 260 | .timer = &ixp4xx_timer, |
259 | .init_machine = omixp_init, | 261 | .init_machine = omixp_init, |
@@ -268,6 +270,7 @@ MACHINE_END | |||
268 | MACHINE_START(MIC256, "Omicron MIC256") | 270 | MACHINE_START(MIC256, "Omicron MIC256") |
269 | .atag_offset = 0x100, | 271 | .atag_offset = 0x100, |
270 | .map_io = ixp4xx_map_io, | 272 | .map_io = ixp4xx_map_io, |
273 | .init_early = ixp4xx_init_early, | ||
271 | .init_irq = ixp4xx_init_irq, | 274 | .init_irq = ixp4xx_init_irq, |
272 | .timer = &ixp4xx_timer, | 275 | .timer = &ixp4xx_timer, |
273 | .init_machine = omixp_init, | 276 | .init_machine = omixp_init, |
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c index 9dec20683291..2798f435aaf4 100644 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c | |||
@@ -237,6 +237,7 @@ static void __init vulcan_init(void) | |||
237 | MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan") | 237 | MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan") |
238 | /* Maintainer: Marc Zyngier <maz@misterjones.org> */ | 238 | /* Maintainer: Marc Zyngier <maz@misterjones.org> */ |
239 | .map_io = ixp4xx_map_io, | 239 | .map_io = ixp4xx_map_io, |
240 | .init_early = ixp4xx_init_early, | ||
240 | .init_irq = ixp4xx_init_irq, | 241 | .init_irq = ixp4xx_init_irq, |
241 | .timer = &ixp4xx_timer, | 242 | .timer = &ixp4xx_timer, |
242 | .atag_offset = 0x100, | 243 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c index 5ac0f0a0fd8c..a785175b115b 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-setup.c +++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c | |||
@@ -98,6 +98,7 @@ static void __init wg302v2_init(void) | |||
98 | MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") | 98 | MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") |
99 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ | 99 | /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ |
100 | .map_io = ixp4xx_map_io, | 100 | .map_io = ixp4xx_map_io, |
101 | .init_early = ixp4xx_init_early, | ||
101 | .init_irq = ixp4xx_init_irq, | 102 | .init_irq = ixp4xx_init_irq, |
102 | .timer = &ixp4xx_timer, | 103 | .timer = &ixp4xx_timer, |
103 | .atag_offset = 0x100, | 104 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c index 7088180b018b..0f1710941878 100644 --- a/arch/arm/mach-kirkwood/cpuidle.c +++ b/arch/arm/mach-kirkwood/cpuidle.c | |||
@@ -20,77 +20,47 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/export.h> | 21 | #include <linux/export.h> |
22 | #include <asm/proc-fns.h> | 22 | #include <asm/proc-fns.h> |
23 | #include <asm/cpuidle.h> | ||
23 | #include <mach/kirkwood.h> | 24 | #include <mach/kirkwood.h> |
24 | 25 | ||
25 | #define KIRKWOOD_MAX_STATES 2 | 26 | #define KIRKWOOD_MAX_STATES 2 |
26 | 27 | ||
27 | static struct cpuidle_driver kirkwood_idle_driver = { | ||
28 | .name = "kirkwood_idle", | ||
29 | .owner = THIS_MODULE, | ||
30 | }; | ||
31 | |||
32 | static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device); | ||
33 | |||
34 | /* Actual code that puts the SoC in different idle states */ | 28 | /* Actual code that puts the SoC in different idle states */ |
35 | static int kirkwood_enter_idle(struct cpuidle_device *dev, | 29 | static int kirkwood_enter_idle(struct cpuidle_device *dev, |
36 | struct cpuidle_driver *drv, | 30 | struct cpuidle_driver *drv, |
37 | int index) | 31 | int index) |
38 | { | 32 | { |
39 | struct timeval before, after; | 33 | writel(0x7, DDR_OPERATION_BASE); |
40 | int idle_time; | 34 | cpu_do_idle(); |
41 | |||
42 | local_irq_disable(); | ||
43 | do_gettimeofday(&before); | ||
44 | if (index == 0) | ||
45 | /* Wait for interrupt state */ | ||
46 | cpu_do_idle(); | ||
47 | else if (index == 1) { | ||
48 | /* | ||
49 | * Following write will put DDR in self refresh. | ||
50 | * Note that we have 256 cycles before DDR puts it | ||
51 | * self in self-refresh, so the wait-for-interrupt | ||
52 | * call afterwards won't get the DDR from self refresh | ||
53 | * mode. | ||
54 | */ | ||
55 | writel(0x7, DDR_OPERATION_BASE); | ||
56 | cpu_do_idle(); | ||
57 | } | ||
58 | do_gettimeofday(&after); | ||
59 | local_irq_enable(); | ||
60 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | ||
61 | (after.tv_usec - before.tv_usec); | ||
62 | |||
63 | /* Update last residency */ | ||
64 | dev->last_residency = idle_time; | ||
65 | 35 | ||
66 | return index; | 36 | return index; |
67 | } | 37 | } |
68 | 38 | ||
39 | static struct cpuidle_driver kirkwood_idle_driver = { | ||
40 | .name = "kirkwood_idle", | ||
41 | .owner = THIS_MODULE, | ||
42 | .en_core_tk_irqen = 1, | ||
43 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
44 | .states[1] = { | ||
45 | .enter = kirkwood_enter_idle, | ||
46 | .exit_latency = 10, | ||
47 | .target_residency = 100000, | ||
48 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
49 | .name = "DDR SR", | ||
50 | .desc = "WFI and DDR Self Refresh", | ||
51 | }, | ||
52 | .state_count = KIRKWOOD_MAX_STATES, | ||
53 | }; | ||
54 | |||
55 | static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device); | ||
56 | |||
69 | /* Initialize CPU idle by registering the idle states */ | 57 | /* Initialize CPU idle by registering the idle states */ |
70 | static int kirkwood_init_cpuidle(void) | 58 | static int kirkwood_init_cpuidle(void) |
71 | { | 59 | { |
72 | struct cpuidle_device *device; | 60 | struct cpuidle_device *device; |
73 | struct cpuidle_driver *driver = &kirkwood_idle_driver; | ||
74 | 61 | ||
75 | device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); | 62 | device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); |
76 | device->state_count = KIRKWOOD_MAX_STATES; | 63 | device->state_count = KIRKWOOD_MAX_STATES; |
77 | driver->state_count = KIRKWOOD_MAX_STATES; | ||
78 | |||
79 | /* Wait for interrupt state */ | ||
80 | driver->states[0].enter = kirkwood_enter_idle; | ||
81 | driver->states[0].exit_latency = 1; | ||
82 | driver->states[0].target_residency = 10000; | ||
83 | driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID; | ||
84 | strcpy(driver->states[0].name, "WFI"); | ||
85 | strcpy(driver->states[0].desc, "Wait for interrupt"); | ||
86 | |||
87 | /* Wait for interrupt and DDR self refresh state */ | ||
88 | driver->states[1].enter = kirkwood_enter_idle; | ||
89 | driver->states[1].exit_latency = 10; | ||
90 | driver->states[1].target_residency = 10000; | ||
91 | driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID; | ||
92 | strcpy(driver->states[1].name, "DDR SR"); | ||
93 | strcpy(driver->states[1].desc, "WFI and DDR Self Refresh"); | ||
94 | 64 | ||
95 | cpuidle_register_driver(&kirkwood_idle_driver); | 65 | cpuidle_register_driver(&kirkwood_idle_driver); |
96 | if (cpuidle_register_device(device)) { | 66 | if (cpuidle_register_device(device)) { |
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h index 49dd0cb5e166..5d0ab61700d2 100644 --- a/arch/arm/mach-kirkwood/include/mach/io.h +++ b/arch/arm/mach-kirkwood/include/mach/io.h | |||
@@ -20,7 +20,5 @@ static inline void __iomem *__io(unsigned long addr) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | #define __io(a) __io(a) | 22 | #define __io(a) __io(a) |
23 | #define __mem_pci(a) (a) | ||
24 | |||
25 | 23 | ||
26 | #endif | 24 | #endif |
diff --git a/arch/arm/mach-ks8695/include/mach/io.h b/arch/arm/mach-ks8695/include/mach/io.h deleted file mode 100644 index a7a63ac3ba4e..000000000000 --- a/arch/arm/mach-ks8695/include/mach/io.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ks8695/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2006 Andrew Victor | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_IO_H | ||
12 | #define __ASM_ARCH_IO_H | ||
13 | |||
14 | #define IO_SPACE_LIMIT 0xffffffff | ||
15 | |||
16 | #define __io(a) __typesafe_io(a) | ||
17 | #define __mem_pci(a) (a) | ||
18 | |||
19 | #endif | ||
diff --git a/arch/arm/mach-lpc32xx/include/mach/io.h b/arch/arm/mach-lpc32xx/include/mach/io.h deleted file mode 100644 index 9b59ab5cef89..000000000000 --- a/arch/arm/mach-lpc32xx/include/mach/io.h +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-lpc32xx/include/mach/io.h | ||
3 | * | ||
4 | * Author: Kevin Wells <kevin.wells@nxp.com> | ||
5 | * | ||
6 | * Copyright (C) 2010 NXP Semiconductors | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | */ | ||
18 | |||
19 | #ifndef __ASM_ARM_ARCH_IO_H | ||
20 | #define __ASM_ARM_ARCH_IO_H | ||
21 | |||
22 | #define IO_SPACE_LIMIT 0xffffffff | ||
23 | |||
24 | #define __io(a) __typesafe_io(a) | ||
25 | #define __mem_pci(a) (a) | ||
26 | |||
27 | #endif | ||
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c index 3588a5584153..bf5d8e195c3e 100644 --- a/arch/arm/mach-mmp/aspenite.c +++ b/arch/arm/mach-mmp/aspenite.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <mach/addr-map.h> | 23 | #include <mach/addr-map.h> |
24 | #include <mach/mfp-pxa168.h> | 24 | #include <mach/mfp-pxa168.h> |
25 | #include <mach/pxa168.h> | 25 | #include <mach/pxa168.h> |
26 | #include <mach/irqs.h> | ||
26 | #include <video/pxa168fb.h> | 27 | #include <video/pxa168fb.h> |
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
28 | #include <plat/pxa27x_keypad.h> | 29 | #include <plat/pxa27x_keypad.h> |
@@ -239,7 +240,7 @@ static void __init common_init(void) | |||
239 | 240 | ||
240 | MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") | 241 | MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") |
241 | .map_io = mmp_map_io, | 242 | .map_io = mmp_map_io, |
242 | .nr_irqs = IRQ_BOARD_START, | 243 | .nr_irqs = MMP_NR_IRQS, |
243 | .init_irq = pxa168_init_irq, | 244 | .init_irq = pxa168_init_irq, |
244 | .timer = &pxa168_timer, | 245 | .timer = &pxa168_timer, |
245 | .init_machine = common_init, | 246 | .init_machine = common_init, |
@@ -248,7 +249,7 @@ MACHINE_END | |||
248 | 249 | ||
249 | MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform") | 250 | MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform") |
250 | .map_io = mmp_map_io, | 251 | .map_io = mmp_map_io, |
251 | .nr_irqs = IRQ_BOARD_START, | 252 | .nr_irqs = MMP_NR_IRQS, |
252 | .init_irq = pxa168_init_irq, | 253 | .init_irq = pxa168_init_irq, |
253 | .timer = &pxa168_timer, | 254 | .timer = &pxa168_timer, |
254 | .init_machine = common_init, | 255 | .init_machine = common_init, |
diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c index b148a9dc5a44..603542ae6fbd 100644 --- a/arch/arm/mach-mmp/avengers_lite.c +++ b/arch/arm/mach-mmp/avengers_lite.c | |||
@@ -43,6 +43,7 @@ static void __init avengers_lite_init(void) | |||
43 | 43 | ||
44 | MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform") | 44 | MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform") |
45 | .map_io = mmp_map_io, | 45 | .map_io = mmp_map_io, |
46 | .nr_irqs = MMP_NR_IRQS, | ||
46 | .init_irq = pxa168_init_irq, | 47 | .init_irq = pxa168_init_irq, |
47 | .timer = &pxa168_timer, | 48 | .timer = &pxa168_timer, |
48 | .init_machine = avengers_lite_init, | 49 | .init_machine = avengers_lite_init, |
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c index d839fe6421e6..5cb769cd26d9 100644 --- a/arch/arm/mach-mmp/brownstone.c +++ b/arch/arm/mach-mmp/brownstone.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "common.h" | 29 | #include "common.h" |
30 | 30 | ||
31 | #define BROWNSTONE_NR_IRQS (IRQ_BOARD_START + 40) | 31 | #define BROWNSTONE_NR_IRQS (MMP_NR_IRQS + 40) |
32 | 32 | ||
33 | #define GPIO_5V_ENABLE (89) | 33 | #define GPIO_5V_ENABLE (89) |
34 | 34 | ||
@@ -158,7 +158,7 @@ static struct platform_device brownstone_v_5vp_device = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct max8925_platform_data brownstone_max8925_info = { | 160 | static struct max8925_platform_data brownstone_max8925_info = { |
161 | .irq_base = IRQ_BOARD_START, | 161 | .irq_base = MMP_NR_IRQS, |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static struct i2c_board_info brownstone_twsi1_info[] = { | 164 | static struct i2c_board_info brownstone_twsi1_info[] = { |
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c index 2ee8cd7829dd..8059cc0905c6 100644 --- a/arch/arm/mach-mmp/flint.c +++ b/arch/arm/mach-mmp/flint.c | |||
@@ -23,10 +23,11 @@ | |||
23 | #include <mach/addr-map.h> | 23 | #include <mach/addr-map.h> |
24 | #include <mach/mfp-mmp2.h> | 24 | #include <mach/mfp-mmp2.h> |
25 | #include <mach/mmp2.h> | 25 | #include <mach/mmp2.h> |
26 | #include <mach/irqs.h> | ||
26 | 27 | ||
27 | #include "common.h" | 28 | #include "common.h" |
28 | 29 | ||
29 | #define FLINT_NR_IRQS (IRQ_BOARD_START + 48) | 30 | #define FLINT_NR_IRQS (MMP_NR_IRQS + 48) |
30 | 31 | ||
31 | static unsigned long flint_pin_config[] __initdata = { | 32 | static unsigned long flint_pin_config[] __initdata = { |
32 | /* UART1 */ | 33 | /* UART1 */ |
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c index 87765467de63..f516e74ce0d5 100644 --- a/arch/arm/mach-mmp/gplugd.c +++ b/arch/arm/mach-mmp/gplugd.c | |||
@@ -191,7 +191,7 @@ static void __init gplugd_init(void) | |||
191 | 191 | ||
192 | MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform") | 192 | MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform") |
193 | .map_io = mmp_map_io, | 193 | .map_io = mmp_map_io, |
194 | .nr_irqs = IRQ_BOARD_START, | 194 | .nr_irqs = MMP_NR_IRQS, |
195 | .init_irq = pxa168_init_irq, | 195 | .init_irq = pxa168_init_irq, |
196 | .timer = &pxa168_timer, | 196 | .timer = &pxa168_timer, |
197 | .init_machine = gplugd_init, | 197 | .init_machine = gplugd_init, |
diff --git a/arch/arm/mach-mmp/include/mach/addr-map.h b/arch/arm/mach-mmp/include/mach/addr-map.h index 3e404acd6ff4..b1ece08174e8 100644 --- a/arch/arm/mach-mmp/include/mach/addr-map.h +++ b/arch/arm/mach-mmp/include/mach/addr-map.h | |||
@@ -11,12 +11,6 @@ | |||
11 | #ifndef __ASM_MACH_ADDR_MAP_H | 11 | #ifndef __ASM_MACH_ADDR_MAP_H |
12 | #define __ASM_MACH_ADDR_MAP_H | 12 | #define __ASM_MACH_ADDR_MAP_H |
13 | 13 | ||
14 | #ifndef __ASSEMBLER__ | ||
15 | #define IOMEM(x) ((void __iomem *)(x)) | ||
16 | #else | ||
17 | #define IOMEM(x) (x) | ||
18 | #endif | ||
19 | |||
20 | /* APB - Application Subsystem Peripheral Bus | 14 | /* APB - Application Subsystem Peripheral Bus |
21 | * | 15 | * |
22 | * NOTE: the DMA controller registers are actually on the AXI fabric #1 | 16 | * NOTE: the DMA controller registers are actually on the AXI fabric #1 |
diff --git a/arch/arm/mach-mmp/include/mach/io.h b/arch/arm/mach-mmp/include/mach/io.h deleted file mode 100644 index e7adf3d012c1..000000000000 --- a/arch/arm/mach-mmp/include/mach/io.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-mmp/include/mach/io.h | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_MACH_IO_H | ||
10 | #define __ASM_MACH_IO_H | ||
11 | |||
12 | #define IO_SPACE_LIMIT 0xffffffff | ||
13 | |||
14 | /* | ||
15 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
16 | * drivers out there that might just work if we fake them... | ||
17 | */ | ||
18 | #define __io(a) __typesafe_io(a) | ||
19 | #define __mem_pci(a) (a) | ||
20 | |||
21 | #endif /* __ASM_MACH_IO_H */ | ||
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h index 34635a0bbb59..d0e746626a3d 100644 --- a/arch/arm/mach-mmp/include/mach/irqs.h +++ b/arch/arm/mach-mmp/include/mach/irqs.h | |||
@@ -223,7 +223,6 @@ | |||
223 | #define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio)) | 223 | #define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio)) |
224 | 224 | ||
225 | #define IRQ_BOARD_START (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO) | 225 | #define IRQ_BOARD_START (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO) |
226 | 226 | #define MMP_NR_IRQS IRQ_BOARD_START | |
227 | #define NR_IRQS (IRQ_BOARD_START) | ||
228 | 227 | ||
229 | #endif /* __ASM_MACH_IRQS_H */ | 228 | #endif /* __ASM_MACH_IRQS_H */ |
diff --git a/arch/arm/mach-mmp/irq-mmp2.c b/arch/arm/mach-mmp/irq-mmp2.c index d21c5441a3d0..7895d277421e 100644 --- a/arch/arm/mach-mmp/irq-mmp2.c +++ b/arch/arm/mach-mmp/irq-mmp2.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <mach/irqs.h> | ||
18 | #include <mach/regs-icu.h> | 19 | #include <mach/regs-icu.h> |
19 | #include <mach/mmp2.h> | 20 | #include <mach/mmp2.h> |
20 | 21 | ||
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c index 96cf5c8fe47d..ff73249884d0 100644 --- a/arch/arm/mach-mmp/jasper.c +++ b/arch/arm/mach-mmp/jasper.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/mfd/max8925.h> | 19 | #include <linux/mfd/max8925.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | 21 | ||
22 | #include <mach/irqs.h> | ||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
24 | #include <mach/addr-map.h> | 25 | #include <mach/addr-map.h> |
@@ -27,7 +28,7 @@ | |||
27 | 28 | ||
28 | #include "common.h" | 29 | #include "common.h" |
29 | 30 | ||
30 | #define JASPER_NR_IRQS (IRQ_BOARD_START + 48) | 31 | #define JASPER_NR_IRQS (MMP_NR_IRQS + 48) |
31 | 32 | ||
32 | static unsigned long jasper_pin_config[] __initdata = { | 33 | static unsigned long jasper_pin_config[] __initdata = { |
33 | /* UART1 */ | 34 | /* UART1 */ |
@@ -135,7 +136,7 @@ static struct max8925_power_pdata jasper_power_data = { | |||
135 | static struct max8925_platform_data jasper_max8925_info = { | 136 | static struct max8925_platform_data jasper_max8925_info = { |
136 | .backlight = &jasper_backlight_data, | 137 | .backlight = &jasper_backlight_data, |
137 | .power = &jasper_power_data, | 138 | .power = &jasper_power_data, |
138 | .irq_base = IRQ_BOARD_START, | 139 | .irq_base = MMP_NR_IRQS, |
139 | }; | 140 | }; |
140 | 141 | ||
141 | static struct i2c_board_info jasper_twsi1_info[] = { | 142 | static struct i2c_board_info jasper_twsi1_info[] = { |
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c index bc97170125bf..b28f9084dfff 100644 --- a/arch/arm/mach-mmp/tavorevb.c +++ b/arch/arm/mach-mmp/tavorevb.c | |||
@@ -101,6 +101,7 @@ static void __init tavorevb_init(void) | |||
101 | 101 | ||
102 | MACHINE_START(TAVOREVB, "PXA910 Evaluation Board (aka TavorEVB)") | 102 | MACHINE_START(TAVOREVB, "PXA910 Evaluation Board (aka TavorEVB)") |
103 | .map_io = mmp_map_io, | 103 | .map_io = mmp_map_io, |
104 | .nr_irqs = MMP_NR_IRQS, | ||
104 | .init_irq = pxa910_init_irq, | 105 | .init_irq = pxa910_init_irq, |
105 | .timer = &pxa910_timer, | 106 | .timer = &pxa910_timer, |
106 | .init_machine = tavorevb_init, | 107 | .init_machine = tavorevb_init, |
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c index 0523e422990e..42bef6674ecf 100644 --- a/arch/arm/mach-mmp/teton_bga.c +++ b/arch/arm/mach-mmp/teton_bga.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <mach/mfp-pxa168.h> | 26 | #include <mach/mfp-pxa168.h> |
27 | #include <mach/pxa168.h> | 27 | #include <mach/pxa168.h> |
28 | #include <mach/teton_bga.h> | 28 | #include <mach/teton_bga.h> |
29 | #include <mach/irqs.h> | ||
29 | 30 | ||
30 | #include "common.h" | 31 | #include "common.h" |
31 | 32 | ||
@@ -83,7 +84,7 @@ static void __init teton_bga_init(void) | |||
83 | 84 | ||
84 | MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform") | 85 | MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform") |
85 | .map_io = mmp_map_io, | 86 | .map_io = mmp_map_io, |
86 | .nr_irqs = IRQ_BOARD_START, | 87 | .nr_irqs = MMP_NR_IRQS, |
87 | .init_irq = pxa168_init_irq, | 88 | .init_irq = pxa168_init_irq, |
88 | .timer = &pxa168_timer, | 89 | .timer = &pxa168_timer, |
89 | .init_machine = teton_bga_init, | 90 | .init_machine = teton_bga_init, |
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index e72c709da44f..3fc9ed21f97d 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * 16 board interrupts -- PCA9575 GPIO expander | 38 | * 16 board interrupts -- PCA9575 GPIO expander |
39 | * 24 board interrupts -- 88PM860x PMIC | 39 | * 24 board interrupts -- 88PM860x PMIC |
40 | */ | 40 | */ |
41 | #define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24) | 41 | #define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24) |
42 | 42 | ||
43 | static unsigned long ttc_dkb_pin_config[] __initdata = { | 43 | static unsigned long ttc_dkb_pin_config[] __initdata = { |
44 | /* UART2 */ | 44 | /* UART2 */ |
@@ -131,7 +131,7 @@ static struct platform_device *ttc_dkb_devices[] = { | |||
131 | static struct pca953x_platform_data max7312_data[] = { | 131 | static struct pca953x_platform_data max7312_data[] = { |
132 | { | 132 | { |
133 | .gpio_base = TTCDKB_GPIO_EXT0(0), | 133 | .gpio_base = TTCDKB_GPIO_EXT0(0), |
134 | .irq_base = IRQ_BOARD_START, | 134 | .irq_base = MMP_NR_IRQS, |
135 | }, | 135 | }, |
136 | }; | 136 | }; |
137 | 137 | ||
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c index a60ab6d04ec5..3698a370d636 100644 --- a/arch/arm/mach-msm/board-halibut.c +++ b/arch/arm/mach-msm/board-halibut.c | |||
@@ -68,6 +68,11 @@ static struct platform_device *devices[] __initdata = { | |||
68 | 68 | ||
69 | extern struct sys_timer msm_timer; | 69 | extern struct sys_timer msm_timer; |
70 | 70 | ||
71 | static void __init halibut_init_early(void) | ||
72 | { | ||
73 | arch_ioremap_caller = __msm_ioremap_caller; | ||
74 | } | ||
75 | |||
71 | static void __init halibut_init_irq(void) | 76 | static void __init halibut_init_irq(void) |
72 | { | 77 | { |
73 | msm_init_irq(); | 78 | msm_init_irq(); |
@@ -96,6 +101,7 @@ MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)") | |||
96 | .atag_offset = 0x100, | 101 | .atag_offset = 0x100, |
97 | .fixup = halibut_fixup, | 102 | .fixup = halibut_fixup, |
98 | .map_io = halibut_map_io, | 103 | .map_io = halibut_map_io, |
104 | .init_early = halibut_init_early, | ||
99 | .init_irq = halibut_init_irq, | 105 | .init_irq = halibut_init_irq, |
100 | .init_machine = halibut_init, | 106 | .init_machine = halibut_init, |
101 | .timer = &msm_timer, | 107 | .timer = &msm_timer, |
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c index 6b9b227c87c5..5414f76ec0a9 100644 --- a/arch/arm/mach-msm/board-trout.c +++ b/arch/arm/mach-msm/board-trout.c | |||
@@ -43,6 +43,11 @@ static struct platform_device *devices[] __initdata = { | |||
43 | 43 | ||
44 | extern struct sys_timer msm_timer; | 44 | extern struct sys_timer msm_timer; |
45 | 45 | ||
46 | static void __init trout_init_early(void) | ||
47 | { | ||
48 | arch_ioremap_caller = __msm_ioremap_caller; | ||
49 | } | ||
50 | |||
46 | static void __init trout_init_irq(void) | 51 | static void __init trout_init_irq(void) |
47 | { | 52 | { |
48 | msm_init_irq(); | 53 | msm_init_irq(); |
@@ -96,6 +101,7 @@ MACHINE_START(TROUT, "HTC Dream") | |||
96 | .atag_offset = 0x100, | 101 | .atag_offset = 0x100, |
97 | .fixup = trout_fixup, | 102 | .fixup = trout_fixup, |
98 | .map_io = trout_map_io, | 103 | .map_io = trout_map_io, |
104 | .init_early = trout_init_early, | ||
99 | .init_irq = trout_init_irq, | 105 | .init_irq = trout_init_irq, |
100 | .init_machine = trout_init, | 106 | .init_machine = trout_init, |
101 | .timer = &msm_timer, | 107 | .timer = &msm_timer, |
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h deleted file mode 100644 index dc1b928745e9..000000000000 --- a/arch/arm/mach-msm/include/mach/io.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* arch/arm/mach-msm/include/mach/io.h | ||
2 | * | ||
3 | * Copyright (C) 2007 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASM_ARM_ARCH_IO_H | ||
17 | #define __ASM_ARM_ARCH_IO_H | ||
18 | |||
19 | #define IO_SPACE_LIMIT 0xffffffff | ||
20 | |||
21 | #define __arch_ioremap __msm_ioremap | ||
22 | #define __arch_iounmap __iounmap | ||
23 | |||
24 | void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype); | ||
25 | |||
26 | #define __io(a) __typesafe_io(a) | ||
27 | #define __mem_pci(a) (a) | ||
28 | |||
29 | void msm_map_qsd8x50_io(void); | ||
30 | void msm_map_msm7x30_io(void); | ||
31 | void msm_map_msm8x60_io(void); | ||
32 | void msm_map_msm8960_io(void); | ||
33 | |||
34 | extern unsigned int msm_shared_ram_phys; | ||
35 | |||
36 | #endif | ||
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h index 8af46123dab6..6c4046c21296 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | |||
@@ -38,12 +38,6 @@ | |||
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #ifdef __ASSEMBLY__ | ||
42 | #define IOMEM(x) x | ||
43 | #else | ||
44 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
45 | #endif | ||
46 | |||
47 | #define MSM_VIC_BASE IOMEM(0xE0000000) | 41 | #define MSM_VIC_BASE IOMEM(0xE0000000) |
48 | #define MSM_VIC_PHYS 0xC0000000 | 42 | #define MSM_VIC_PHYS 0xC0000000 |
49 | #define MSM_VIC_SIZE SZ_4K | 43 | #define MSM_VIC_SIZE SZ_4K |
@@ -111,5 +105,11 @@ | |||
111 | #define MSM_AD5_PHYS 0xAC000000 | 105 | #define MSM_AD5_PHYS 0xAC000000 |
112 | #define MSM_AD5_SIZE (SZ_1M*13) | 106 | #define MSM_AD5_SIZE (SZ_1M*13) |
113 | 107 | ||
108 | #ifndef __ASSEMBLY__ | ||
109 | |||
110 | extern void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size, | ||
111 | unsigned int mtype, void *caller); | ||
112 | |||
113 | #endif | ||
114 | 114 | ||
115 | #endif | 115 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h index 198202c267c8..f944fe65a657 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | |||
@@ -100,4 +100,8 @@ | |||
100 | #define MSM_HSUSB_PHYS 0xA3600000 | 100 | #define MSM_HSUSB_PHYS 0xA3600000 |
101 | #define MSM_HSUSB_SIZE SZ_1K | 101 | #define MSM_HSUSB_SIZE SZ_1K |
102 | 102 | ||
103 | #ifndef __ASSEMBLY__ | ||
104 | extern void msm_map_msm7x30_io(void); | ||
105 | #endif | ||
106 | |||
103 | #endif | 107 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h index 800b55767e6b..a1752c0284fc 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h | |||
@@ -50,4 +50,8 @@ | |||
50 | #define MSM_DEBUG_UART_PHYS 0x16440000 | 50 | #define MSM_DEBUG_UART_PHYS 0x16440000 |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #ifndef __ASSEMBLY__ | ||
54 | extern void msm_map_msm8960_io(void); | ||
55 | #endif | ||
56 | |||
53 | #endif | 57 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h index 0faa894729b7..da77cc1d545d 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | |||
@@ -122,4 +122,8 @@ | |||
122 | #define MSM_SDC4_PHYS 0xA0600000 | 122 | #define MSM_SDC4_PHYS 0xA0600000 |
123 | #define MSM_SDC4_SIZE SZ_4K | 123 | #define MSM_SDC4_SIZE SZ_4K |
124 | 124 | ||
125 | #ifndef __ASSEMBLY__ | ||
126 | extern void msm_map_qsd8x50_io(void); | ||
127 | #endif | ||
128 | |||
125 | #endif | 129 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h index 54e12caa8d86..5aed57dc808c 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | |||
@@ -67,4 +67,8 @@ | |||
67 | #define MSM_DEBUG_UART_PHYS 0x19C40000 | 67 | #define MSM_DEBUG_UART_PHYS 0x19C40000 |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #ifndef __ASSEMBLY__ | ||
71 | extern void msm_map_msm8x60_io(void); | ||
72 | #endif | ||
73 | |||
70 | #endif | 74 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h index 90682f4599d3..00afdfb8c38f 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap.h | |||
@@ -37,12 +37,6 @@ | |||
37 | * | 37 | * |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #ifdef __ASSEMBLY__ | ||
41 | #define IOMEM(x) x | ||
42 | #else | ||
43 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
44 | #endif | ||
45 | |||
46 | #if defined(CONFIG_ARCH_MSM7X30) | 40 | #if defined(CONFIG_ARCH_MSM7X30) |
47 | #include "msm_iomap-7x30.h" | 41 | #include "msm_iomap-7x30.h" |
48 | #elif defined(CONFIG_ARCH_QSD8X50) | 42 | #elif defined(CONFIG_ARCH_QSD8X50) |
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index 578b04e42deb..a1e7b1168850 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c | |||
@@ -172,8 +172,8 @@ void __init msm_map_msm7x30_io(void) | |||
172 | } | 172 | } |
173 | #endif /* CONFIG_ARCH_MSM7X30 */ | 173 | #endif /* CONFIG_ARCH_MSM7X30 */ |
174 | 174 | ||
175 | void __iomem * | 175 | void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size, |
176 | __msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | 176 | unsigned int mtype, void *caller) |
177 | { | 177 | { |
178 | if (mtype == MT_DEVICE) { | 178 | if (mtype == MT_DEVICE) { |
179 | /* The peripherals in the 88000000 - D0000000 range | 179 | /* The peripherals in the 88000000 - D0000000 range |
@@ -184,7 +184,5 @@ __msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | |||
184 | mtype = MT_DEVICE_NONSHARED; | 184 | mtype = MT_DEVICE_NONSHARED; |
185 | } | 185 | } |
186 | 186 | ||
187 | return __arm_ioremap_caller(phys_addr, size, mtype, | 187 | return __arm_ioremap_caller(phys_addr, size, mtype, caller); |
188 | __builtin_return_address(0)); | ||
189 | } | 188 | } |
190 | EXPORT_SYMBOL(__msm_ioremap); | ||
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c index 75f4be40b3e5..812808254936 100644 --- a/arch/arm/mach-msm/timer.c +++ b/arch/arm/mach-msm/timer.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/mach/time.h> | 24 | #include <asm/mach/time.h> |
25 | #include <asm/hardware/gic.h> | 25 | #include <asm/hardware/gic.h> |
26 | #include <asm/localtimer.h> | 26 | #include <asm/localtimer.h> |
27 | #include <asm/sched_clock.h> | ||
27 | 28 | ||
28 | #include <mach/msm_iomap.h> | 29 | #include <mach/msm_iomap.h> |
29 | #include <mach/cpu.h> | 30 | #include <mach/cpu.h> |
@@ -105,12 +106,12 @@ static union { | |||
105 | 106 | ||
106 | static void __iomem *source_base; | 107 | static void __iomem *source_base; |
107 | 108 | ||
108 | static cycle_t msm_read_timer_count(struct clocksource *cs) | 109 | static notrace cycle_t msm_read_timer_count(struct clocksource *cs) |
109 | { | 110 | { |
110 | return readl_relaxed(source_base + TIMER_COUNT_VAL); | 111 | return readl_relaxed(source_base + TIMER_COUNT_VAL); |
111 | } | 112 | } |
112 | 113 | ||
113 | static cycle_t msm_read_timer_count_shift(struct clocksource *cs) | 114 | static notrace cycle_t msm_read_timer_count_shift(struct clocksource *cs) |
114 | { | 115 | { |
115 | /* | 116 | /* |
116 | * Shift timer count down by a constant due to unreliable lower bits | 117 | * Shift timer count down by a constant due to unreliable lower bits |
@@ -166,6 +167,11 @@ static struct local_timer_ops msm_local_timer_ops __cpuinitdata = { | |||
166 | }; | 167 | }; |
167 | #endif /* CONFIG_LOCAL_TIMERS */ | 168 | #endif /* CONFIG_LOCAL_TIMERS */ |
168 | 169 | ||
170 | static notrace u32 msm_sched_clock_read(void) | ||
171 | { | ||
172 | return msm_clocksource.read(&msm_clocksource); | ||
173 | } | ||
174 | |||
169 | static void __init msm_timer_init(void) | 175 | static void __init msm_timer_init(void) |
170 | { | 176 | { |
171 | struct clock_event_device *ce = &msm_clockevent; | 177 | struct clock_event_device *ce = &msm_clockevent; |
@@ -232,6 +238,8 @@ err: | |||
232 | res = clocksource_register_hz(cs, dgt_hz); | 238 | res = clocksource_register_hz(cs, dgt_hz); |
233 | if (res) | 239 | if (res) |
234 | pr_err("clocksource_register failed\n"); | 240 | pr_err("clocksource_register failed\n"); |
241 | setup_sched_clock(msm_sched_clock_read, | ||
242 | cpu_is_msm7x01() ? 32 - MSM_DGT_SHIFT : 32, dgt_hz); | ||
235 | } | 243 | } |
236 | 244 | ||
237 | struct sys_timer msm_timer = { | 245 | struct sys_timer msm_timer = { |
diff --git a/arch/arm/mach-mv78xx0/include/mach/io.h b/arch/arm/mach-mv78xx0/include/mach/io.h index 450e0e1ad092..c7d9d00d8fc1 100644 --- a/arch/arm/mach-mv78xx0/include/mach/io.h +++ b/arch/arm/mach-mv78xx0/include/mach/io.h | |||
@@ -20,7 +20,5 @@ static inline void __iomem *__io(unsigned long addr) | |||
20 | } | 20 | } |
21 | 21 | ||
22 | #define __io(a) __io(a) | 22 | #define __io(a) __io(a) |
23 | #define __mem_pci(a) (a) | ||
24 | |||
25 | 23 | ||
26 | #endif | 24 | #endif |
diff --git a/arch/arm/mach-mxs/include/mach/hardware.h b/arch/arm/mach-mxs/include/mach/hardware.h index 53e89a09bf0d..4c0e8a64d8c7 100644 --- a/arch/arm/mach-mxs/include/mach/hardware.h +++ b/arch/arm/mach-mxs/include/mach/hardware.h | |||
@@ -20,10 +20,4 @@ | |||
20 | #ifndef __MACH_MXS_HARDWARE_H__ | 20 | #ifndef __MACH_MXS_HARDWARE_H__ |
21 | #define __MACH_MXS_HARDWARE_H__ | 21 | #define __MACH_MXS_HARDWARE_H__ |
22 | 22 | ||
23 | #ifdef __ASSEMBLER__ | ||
24 | #define IOMEM(addr) (addr) | ||
25 | #else | ||
26 | #define IOMEM(addr) ((void __force __iomem *)(addr)) | ||
27 | #endif | ||
28 | |||
29 | #endif /* __MACH_MXS_HARDWARE_H__ */ | 23 | #endif /* __MACH_MXS_HARDWARE_H__ */ |
diff --git a/arch/arm/mach-mxs/include/mach/io.h b/arch/arm/mach-mxs/include/mach/io.h deleted file mode 100644 index 289b7227e072..000000000000 --- a/arch/arm/mach-mxs/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
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 __MACH_MXS_IO_H__ | ||
12 | #define __MACH_MXS_IO_H__ | ||
13 | |||
14 | /* Allow IO space to be anywhere in the memory */ | ||
15 | #define IO_SPACE_LIMIT 0xffffffff | ||
16 | |||
17 | /* io address mapping macro */ | ||
18 | #define __io(a) __typesafe_io(a) | ||
19 | |||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif /* __MACH_MXS_IO_H__ */ | ||
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c index 59e67979f197..aa627465d914 100644 --- a/arch/arm/mach-netx/generic.c +++ b/arch/arm/mach-netx/generic.c | |||
@@ -168,7 +168,7 @@ void __init netx_init_irq(void) | |||
168 | { | 168 | { |
169 | int irq; | 169 | int irq; |
170 | 170 | ||
171 | vic_init(__io(io_p2v(NETX_PA_VIC)), 0, ~0, 0); | 171 | vic_init(io_p2v(NETX_PA_VIC), 0, ~0, 0); |
172 | 172 | ||
173 | for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) { | 173 | for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) { |
174 | irq_set_chip_and_handler(irq, &netx_hif_chip, | 174 | irq_set_chip_and_handler(irq, &netx_hif_chip, |
diff --git a/arch/arm/mach-netx/include/mach/hardware.h b/arch/arm/mach-netx/include/mach/hardware.h index 517a2bd37842..b661af2f2145 100644 --- a/arch/arm/mach-netx/include/mach/hardware.h +++ b/arch/arm/mach-netx/include/mach/hardware.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define XMAC_MEM_SIZE 0x1000 | 33 | #define XMAC_MEM_SIZE 0x1000 |
34 | #define SRAM_MEM_SIZE 0x8000 | 34 | #define SRAM_MEM_SIZE 0x8000 |
35 | 35 | ||
36 | #define io_p2v(x) ((x) - NETX_IO_PHYS + NETX_IO_VIRT) | 36 | #define io_p2v(x) IOMEM((x) - NETX_IO_PHYS + NETX_IO_VIRT) |
37 | #define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS) | 37 | #define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS) |
38 | 38 | ||
39 | #endif | 39 | #endif |
diff --git a/arch/arm/mach-netx/include/mach/io.h b/arch/arm/mach-netx/include/mach/io.h deleted file mode 100644 index c3921cb3b6a6..000000000000 --- a/arch/arm/mach-netx/include/mach/io.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-netx/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix | ||
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 | ||
8 | * as 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 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define IO_SPACE_LIMIT 0xffffffff | ||
24 | |||
25 | #define __io(a) __typesafe_io(a) | ||
26 | #define __mem_pci(a) (a) | ||
27 | |||
28 | #endif | ||
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h index 5a03e7ccb01a..fdde22b58ac3 100644 --- a/arch/arm/mach-netx/include/mach/netx-regs.h +++ b/arch/arm/mach-netx/include/mach/netx-regs.h | |||
@@ -115,7 +115,7 @@ | |||
115 | *********************************/ | 115 | *********************************/ |
116 | 116 | ||
117 | /* Registers */ | 117 | /* Registers */ |
118 | #define NETX_SYSTEM_REG(ofs) __io(NETX_VA_SYSTEM + (ofs)) | 118 | #define NETX_SYSTEM_REG(ofs) IOMEM(NETX_VA_SYSTEM + (ofs)) |
119 | #define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00) | 119 | #define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00) |
120 | #define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04) | 120 | #define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04) |
121 | #define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08) | 121 | #define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08) |
@@ -185,7 +185,7 @@ | |||
185 | *******************************/ | 185 | *******************************/ |
186 | 186 | ||
187 | /* Registers */ | 187 | /* Registers */ |
188 | #define NETX_GPIO_REG(ofs) __io(NETX_VA_GPIO + (ofs)) | 188 | #define NETX_GPIO_REG(ofs) IOMEM(NETX_VA_GPIO + (ofs)) |
189 | #define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2)) | 189 | #define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2)) |
190 | #define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2)) | 190 | #define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2)) |
191 | #define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2)) | 191 | #define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2)) |
@@ -230,7 +230,7 @@ | |||
230 | *******************************/ | 230 | *******************************/ |
231 | 231 | ||
232 | /* Registers */ | 232 | /* Registers */ |
233 | #define NETX_PIO_REG(ofs) __io(NETX_VA_PIO + (ofs)) | 233 | #define NETX_PIO_REG(ofs) IOMEM(NETX_VA_PIO + (ofs)) |
234 | #define NETX_PIO_INPIO NETX_PIO_REG(0x0) | 234 | #define NETX_PIO_INPIO NETX_PIO_REG(0x0) |
235 | #define NETX_PIO_OUTPIO NETX_PIO_REG(0x4) | 235 | #define NETX_PIO_OUTPIO NETX_PIO_REG(0x4) |
236 | #define NETX_PIO_OEPIO NETX_PIO_REG(0x8) | 236 | #define NETX_PIO_OEPIO NETX_PIO_REG(0x8) |
@@ -240,7 +240,7 @@ | |||
240 | *******************************/ | 240 | *******************************/ |
241 | 241 | ||
242 | /* Registers */ | 242 | /* Registers */ |
243 | #define NETX_MIIMU __io(NETX_VA_MIIMU) | 243 | #define NETX_MIIMU IOMEM(NETX_VA_MIIMU) |
244 | 244 | ||
245 | /* Bits */ | 245 | /* Bits */ |
246 | #define MIIMU_SNRDY (1<<0) | 246 | #define MIIMU_SNRDY (1<<0) |
@@ -317,7 +317,7 @@ | |||
317 | *******************************/ | 317 | *******************************/ |
318 | 318 | ||
319 | /* Registers */ | 319 | /* Registers */ |
320 | #define NETX_PFIFO_REG(ofs) __io(NETX_VA_PFIFO + (ofs)) | 320 | #define NETX_PFIFO_REG(ofs) IOMEM(NETX_VA_PFIFO + (ofs)) |
321 | #define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2)) | 321 | #define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2)) |
322 | #define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2)) | 322 | #define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2)) |
323 | #define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100) | 323 | #define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100) |
@@ -334,7 +334,7 @@ | |||
334 | *******************************/ | 334 | *******************************/ |
335 | 335 | ||
336 | /* Registers */ | 336 | /* Registers */ |
337 | #define NETX_MEMCR_REG(ofs) __io(NETX_VA_MEMCR + (ofs)) | 337 | #define NETX_MEMCR_REG(ofs) IOMEM(NETX_VA_MEMCR + (ofs)) |
338 | #define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */ | 338 | #define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */ |
339 | #define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40) | 339 | #define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40) |
340 | #define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44) | 340 | #define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44) |
@@ -355,7 +355,7 @@ | |||
355 | *******************************/ | 355 | *******************************/ |
356 | 356 | ||
357 | /* Registers */ | 357 | /* Registers */ |
358 | #define NETX_DPMAS_REG(ofs) __io(NETX_VA_DPMAS + (ofs)) | 358 | #define NETX_DPMAS_REG(ofs) IOMEM(NETX_VA_DPMAS + (ofs)) |
359 | #define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8) | 359 | #define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8) |
360 | #define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0) | 360 | #define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0) |
361 | #define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0) | 361 | #define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0) |
@@ -425,7 +425,7 @@ | |||
425 | /******************************* | 425 | /******************************* |
426 | * I2C * | 426 | * I2C * |
427 | *******************************/ | 427 | *******************************/ |
428 | #define NETX_I2C_REG(ofs) __io(NETX_VA_I2C, (ofs)) | 428 | #define NETX_I2C_REG(ofs) IOMEM(NETX_VA_I2C, (ofs)) |
429 | #define NETX_I2C_CTRL NETX_I2C_REG(0x0) | 429 | #define NETX_I2C_CTRL NETX_I2C_REG(0x0) |
430 | #define NETX_I2C_DATA NETX_I2C_REG(0x4) | 430 | #define NETX_I2C_DATA NETX_I2C_REG(0x4) |
431 | 431 | ||
diff --git a/arch/arm/mach-nomadik/include/mach/io.h b/arch/arm/mach-nomadik/include/mach/io.h deleted file mode 100644 index 2e1eca1b8243..000000000000 --- a/arch/arm/mach-nomadik/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-nomadik/include/mach/io.h (copied from mach-sa1100) | ||
3 | * | ||
4 | * Copyright (C) 1997-1999 Russell King | ||
5 | * | ||
6 | * Modifications: | ||
7 | * 06-12-1997 RMK Created. | ||
8 | * 07-04-1999 RMK Major cleanup | ||
9 | */ | ||
10 | #ifndef __ASM_ARM_ARCH_IO_H | ||
11 | #define __ASM_ARM_ARCH_IO_H | ||
12 | |||
13 | #define IO_SPACE_LIMIT 0xffffffff | ||
14 | |||
15 | /* | ||
16 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
17 | * drivers out there that might just work if we fake them... | ||
18 | */ | ||
19 | #define __io(a) __typesafe_io(a) | ||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif | ||
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S index 399c4c49722f..a051cb8ae57f 100644 --- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S +++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S | |||
@@ -14,6 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/linkage.h> | 16 | #include <linux/linkage.h> |
17 | #include <asm/assembler.h> | ||
17 | 18 | ||
18 | #include <plat/board-ams-delta.h> | 19 | #include <plat/board-ams-delta.h> |
19 | 20 | ||
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S index fa0f32a686aa..88f08cab1717 100644 --- a/arch/arm/mach-omap1/include/mach/entry-macro.S +++ b/arch/arm/mach-omap1/include/mach/entry-macro.S | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <mach/hardware.h> | 13 | #include <mach/hardware.h> |
14 | #include <mach/io.h> | ||
15 | #include <mach/irqs.h> | 14 | #include <mach/irqs.h> |
16 | 15 | ||
17 | #include "../../iomap.h" | 16 | #include "../../iomap.h" |
diff --git a/arch/arm/mach-omap1/include/mach/io.h b/arch/arm/mach-omap1/include/mach/io.h deleted file mode 100644 index 37b12e1fd022..000000000000 --- a/arch/arm/mach-omap1/include/mach/io.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-omap1/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for TI OMAP processors and boards | ||
5 | * | ||
6 | * Copied from arch/arm/mach-sa1100/include/mach/io.h | ||
7 | * Copyright (C) 1997-1999 Russell King | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | * | ||
29 | * Modifications: | ||
30 | * 06-12-1997 RMK Created. | ||
31 | * 07-04-1999 RMK Major cleanup | ||
32 | */ | ||
33 | |||
34 | #ifndef __ASM_ARM_ARCH_IO_H | ||
35 | #define __ASM_ARM_ARCH_IO_H | ||
36 | |||
37 | #define IO_SPACE_LIMIT 0xffffffff | ||
38 | |||
39 | /* | ||
40 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
41 | * drivers out there that might just work if we fake them... | ||
42 | */ | ||
43 | #define __io(a) __typesafe_io(a) | ||
44 | #define __mem_pci(a) (a) | ||
45 | |||
46 | #endif | ||
diff --git a/arch/arm/mach-omap1/iomap.h b/arch/arm/mach-omap1/iomap.h index d68175761c3d..330c4716b028 100644 --- a/arch/arm/mach-omap1/iomap.h +++ b/arch/arm/mach-omap1/iomap.h | |||
@@ -22,12 +22,6 @@ | |||
22 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 22 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifdef __ASSEMBLER__ | ||
26 | #define IOMEM(x) (x) | ||
27 | #else | ||
28 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
29 | #endif | ||
30 | |||
31 | #define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ | 25 | #define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ |
32 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) | 26 | #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) |
33 | 27 | ||
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S index 0779db150da7..0e628743bd03 100644 --- a/arch/arm/mach-omap1/sleep.S +++ b/arch/arm/mach-omap1/sleep.S | |||
@@ -36,8 +36,6 @@ | |||
36 | 36 | ||
37 | #include <asm/assembler.h> | 37 | #include <asm/assembler.h> |
38 | 38 | ||
39 | #include <mach/io.h> | ||
40 | |||
41 | #include "iomap.h" | 39 | #include "iomap.h" |
42 | #include "pm.h" | 40 | #include "pm.h" |
43 | 41 | ||
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S index 2ce0b9ab20e5..00e9d9e9adf1 100644 --- a/arch/arm/mach-omap1/sram.S +++ b/arch/arm/mach-omap1/sram.S | |||
@@ -12,7 +12,6 @@ | |||
12 | 12 | ||
13 | #include <asm/assembler.h> | 13 | #include <asm/assembler.h> |
14 | 14 | ||
15 | #include <mach/io.h> | ||
16 | #include <mach/hardware.h> | 15 | #include <mach/hardware.h> |
17 | 16 | ||
18 | #include "iomap.h" | 17 | #include "iomap.h" |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index 981b9f9111a4..480fb8f09aed 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/io.h> | ||
22 | 23 | ||
23 | #include <plat/hardware.h> | 24 | #include <plat/hardware.h> |
24 | #include <plat/clkdev_omap.h> | 25 | #include <plat/clkdev_omap.h> |
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 79b98f22f207..c03c1108468e 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | #include <linux/io.h> | ||
29 | 30 | ||
30 | #include <plat/hardware.h> | 31 | #include <plat/hardware.h> |
31 | #include <plat/clkdev_omap.h> | 32 | #include <plat/clkdev_omap.h> |
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 464cffde58fe..535866489ce3 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c | |||
@@ -87,29 +87,14 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm, | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | static int __omap3_enter_idle(struct cpuidle_device *dev, |
91 | * omap3_enter_idle - Programs OMAP3 to enter the specified state | ||
92 | * @dev: cpuidle device | ||
93 | * @drv: cpuidle driver | ||
94 | * @index: the index of state to be entered | ||
95 | * | ||
96 | * Called from the CPUidle framework to program the device to the | ||
97 | * specified target state selected by the governor. | ||
98 | */ | ||
99 | static int omap3_enter_idle(struct cpuidle_device *dev, | ||
100 | struct cpuidle_driver *drv, | 91 | struct cpuidle_driver *drv, |
101 | int index) | 92 | int index) |
102 | { | 93 | { |
103 | struct omap3_idle_statedata *cx = | 94 | struct omap3_idle_statedata *cx = |
104 | cpuidle_get_statedata(&dev->states_usage[index]); | 95 | cpuidle_get_statedata(&dev->states_usage[index]); |
105 | struct timespec ts_preidle, ts_postidle, ts_idle; | ||
106 | u32 mpu_state = cx->mpu_state, core_state = cx->core_state; | 96 | u32 mpu_state = cx->mpu_state, core_state = cx->core_state; |
107 | int idle_time; | ||
108 | |||
109 | /* Used to keep track of the total time in idle */ | ||
110 | getnstimeofday(&ts_preidle); | ||
111 | 97 | ||
112 | local_irq_disable(); | ||
113 | local_fiq_disable(); | 98 | local_fiq_disable(); |
114 | 99 | ||
115 | pwrdm_set_next_pwrst(mpu_pd, mpu_state); | 100 | pwrdm_set_next_pwrst(mpu_pd, mpu_state); |
@@ -148,22 +133,29 @@ static int omap3_enter_idle(struct cpuidle_device *dev, | |||
148 | } | 133 | } |
149 | 134 | ||
150 | return_sleep_time: | 135 | return_sleep_time: |
151 | getnstimeofday(&ts_postidle); | ||
152 | ts_idle = timespec_sub(ts_postidle, ts_preidle); | ||
153 | 136 | ||
154 | local_irq_enable(); | ||
155 | local_fiq_enable(); | 137 | local_fiq_enable(); |
156 | 138 | ||
157 | idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \ | ||
158 | USEC_PER_SEC; | ||
159 | |||
160 | /* Update cpuidle counters */ | ||
161 | dev->last_residency = idle_time; | ||
162 | |||
163 | return index; | 139 | return index; |
164 | } | 140 | } |
165 | 141 | ||
166 | /** | 142 | /** |
143 | * omap3_enter_idle - Programs OMAP3 to enter the specified state | ||
144 | * @dev: cpuidle device | ||
145 | * @drv: cpuidle driver | ||
146 | * @index: the index of state to be entered | ||
147 | * | ||
148 | * Called from the CPUidle framework to program the device to the | ||
149 | * specified target state selected by the governor. | ||
150 | */ | ||
151 | static inline int omap3_enter_idle(struct cpuidle_device *dev, | ||
152 | struct cpuidle_driver *drv, | ||
153 | int index) | ||
154 | { | ||
155 | return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle); | ||
156 | } | ||
157 | |||
158 | /** | ||
167 | * next_valid_state - Find next valid C-state | 159 | * next_valid_state - Find next valid C-state |
168 | * @dev: cpuidle device | 160 | * @dev: cpuidle device |
169 | * @drv: cpuidle driver | 161 | * @drv: cpuidle driver |
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index 72e018b9b260..f386cbe9c889 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
@@ -62,15 +62,9 @@ static int omap4_enter_idle(struct cpuidle_device *dev, | |||
62 | { | 62 | { |
63 | struct omap4_idle_statedata *cx = | 63 | struct omap4_idle_statedata *cx = |
64 | cpuidle_get_statedata(&dev->states_usage[index]); | 64 | cpuidle_get_statedata(&dev->states_usage[index]); |
65 | struct timespec ts_preidle, ts_postidle, ts_idle; | ||
66 | u32 cpu1_state; | 65 | u32 cpu1_state; |
67 | int idle_time; | ||
68 | int cpu_id = smp_processor_id(); | 66 | int cpu_id = smp_processor_id(); |
69 | 67 | ||
70 | /* Used to keep track of the total time in idle */ | ||
71 | getnstimeofday(&ts_preidle); | ||
72 | |||
73 | local_irq_disable(); | ||
74 | local_fiq_disable(); | 68 | local_fiq_disable(); |
75 | 69 | ||
76 | /* | 70 | /* |
@@ -128,26 +122,17 @@ static int omap4_enter_idle(struct cpuidle_device *dev, | |||
128 | if (index > 0) | 122 | if (index > 0) |
129 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id); | 123 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id); |
130 | 124 | ||
131 | getnstimeofday(&ts_postidle); | ||
132 | ts_idle = timespec_sub(ts_postidle, ts_preidle); | ||
133 | |||
134 | local_irq_enable(); | ||
135 | local_fiq_enable(); | 125 | local_fiq_enable(); |
136 | 126 | ||
137 | idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \ | ||
138 | USEC_PER_SEC; | ||
139 | |||
140 | /* Update cpuidle counters */ | ||
141 | dev->last_residency = idle_time; | ||
142 | |||
143 | return index; | 127 | return index; |
144 | } | 128 | } |
145 | 129 | ||
146 | DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); | 130 | DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); |
147 | 131 | ||
148 | struct cpuidle_driver omap4_idle_driver = { | 132 | struct cpuidle_driver omap4_idle_driver = { |
149 | .name = "omap4_idle", | 133 | .name = "omap4_idle", |
150 | .owner = THIS_MODULE, | 134 | .owner = THIS_MODULE, |
135 | .en_core_tk_irqen = 1, | ||
151 | }; | 136 | }; |
152 | 137 | ||
153 | static inline void _fill_cstate(struct cpuidle_driver *drv, | 138 | static inline void _fill_cstate(struct cpuidle_driver *drv, |
diff --git a/arch/arm/mach-omap2/include/mach/io.h b/arch/arm/mach-omap2/include/mach/io.h deleted file mode 100644 index b8758c8a9394..000000000000 --- a/arch/arm/mach-omap2/include/mach/io.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-omap2/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for TI OMAP processors and boards | ||
5 | * | ||
6 | * Copied from arch/arm/mach-sa1100/include/mach/io.h | ||
7 | * Copyright (C) 1997-1999 Russell King | ||
8 | * | ||
9 | * Copyright (C) 2009 Texas Instruments | ||
10 | * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | * | ||
32 | * Modifications: | ||
33 | * 06-12-1997 RMK Created. | ||
34 | * 07-04-1999 RMK Major cleanup | ||
35 | */ | ||
36 | |||
37 | #ifndef __ASM_ARM_ARCH_IO_H | ||
38 | #define __ASM_ARM_ARCH_IO_H | ||
39 | |||
40 | #define IO_SPACE_LIMIT 0xffffffff | ||
41 | |||
42 | /* | ||
43 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
44 | * drivers out there that might just work if we fake them... | ||
45 | */ | ||
46 | #define __io(a) __typesafe_io(a) | ||
47 | #define __mem_pci(a) (a) | ||
48 | |||
49 | #endif | ||
diff --git a/arch/arm/mach-omap2/iomap.h b/arch/arm/mach-omap2/iomap.h index e6f958165296..0812b154f5b5 100644 --- a/arch/arm/mach-omap2/iomap.h +++ b/arch/arm/mach-omap2/iomap.h | |||
@@ -22,12 +22,6 @@ | |||
22 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 22 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifdef __ASSEMBLER__ | ||
26 | #define IOMEM(x) (x) | ||
27 | #else | ||
28 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
29 | #endif | ||
30 | |||
31 | #define OMAP2_L3_IO_OFFSET 0x90000000 | 25 | #define OMAP2_L3_IO_OFFSET 0x90000000 |
32 | #define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ | 26 | #define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ |
33 | 27 | ||
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index d2513ac79ff5..2e6454c8d4ba 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h | |||
@@ -57,5 +57,14 @@ struct meminfo; | |||
57 | struct tag; | 57 | struct tag; |
58 | extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); | 58 | extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); |
59 | 59 | ||
60 | /***************************************************************************** | ||
61 | * Helpers to access Orion registers | ||
62 | ****************************************************************************/ | ||
63 | /* | ||
64 | * These are not preempt-safe. Locks, if needed, must be taken | ||
65 | * care of by the caller. | ||
66 | */ | ||
67 | #define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r)) | ||
68 | #define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r)) | ||
60 | 69 | ||
61 | #endif | 70 | #endif |
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h deleted file mode 100644 index e9d9afdc2659..000000000000 --- a/arch/arm/mach-orion5x/include/mach/io.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-orion5x/include/mach/io.h | ||
3 | * | ||
4 | * Tzachi Perelstein <tzachi@marvell.com> | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_IO_H | ||
12 | #define __ASM_ARCH_IO_H | ||
13 | |||
14 | #include "orion5x.h" | ||
15 | |||
16 | #define IO_SPACE_LIMIT 0xffffffff | ||
17 | |||
18 | #define __io(a) __typesafe_io(a) | ||
19 | #define __mem_pci(a) (a) | ||
20 | |||
21 | |||
22 | /***************************************************************************** | ||
23 | * Helpers to access Orion registers | ||
24 | ****************************************************************************/ | ||
25 | /* | ||
26 | * These are not preempt-safe. Locks, if needed, must be taken | ||
27 | * care of by the caller. | ||
28 | */ | ||
29 | #define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r)) | ||
30 | #define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r)) | ||
31 | |||
32 | |||
33 | #endif | ||
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index d6a91948e4dc..cb19e1661bb3 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/mach/pci.h> | 19 | #include <asm/mach/pci.h> |
20 | #include <plat/pcie.h> | 20 | #include <plat/pcie.h> |
21 | #include <plat/addr-map.h> | 21 | #include <plat/addr-map.h> |
22 | #include <mach/orion5x.h> | ||
22 | #include "common.h" | 23 | #include "common.h" |
23 | 24 | ||
24 | /***************************************************************************** | 25 | /***************************************************************************** |
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c index c9abb8fbfa70..7189827d641d 100644 --- a/arch/arm/mach-orion5x/tsx09-common.c +++ b/arch/arm/mach-orion5x/tsx09-common.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
16 | #include <linux/timex.h> | 16 | #include <linux/timex.h> |
17 | #include <linux/serial_reg.h> | 17 | #include <linux/serial_reg.h> |
18 | #include <mach/orion5x.h> | ||
18 | #include "tsx09-common.h" | 19 | #include "tsx09-common.h" |
19 | #include "common.h" | 20 | #include "common.h" |
20 | 21 | ||
diff --git a/arch/arm/mach-picoxcell/include/mach/io.h b/arch/arm/mach-picoxcell/include/mach/io.h deleted file mode 100644 index 7573ec7d10a3..000000000000 --- a/arch/arm/mach-picoxcell/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | #ifndef __ASM_ARM_ARCH_IO_H | ||
15 | #define __ASM_ARM_ARCH_IO_H | ||
16 | |||
17 | /* No ioports, but needed for driver compatibility. */ | ||
18 | #define __io(a) __typesafe_io(a) | ||
19 | /* No PCI possible on picoxcell. */ | ||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif /* __ASM_ARM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-picoxcell/include/mach/irqs.h b/arch/arm/mach-picoxcell/include/mach/irqs.h deleted file mode 100644 index 59eac1ee2820..000000000000 --- a/arch/arm/mach-picoxcell/include/mach/irqs.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | #ifndef __MACH_IRQS_H | ||
15 | #define __MACH_IRQS_H | ||
16 | |||
17 | /* We dynamically allocate our irq_desc's. */ | ||
18 | #define NR_IRQS 0 | ||
19 | |||
20 | #endif /* __MACH_IRQS_H */ | ||
diff --git a/arch/arm/mach-pnx4008/include/mach/io.h b/arch/arm/mach-pnx4008/include/mach/io.h deleted file mode 100644 index cbf0904540ea..000000000000 --- a/arch/arm/mach-pnx4008/include/mach/io.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | |||
2 | /* | ||
3 | * arch/arm/mach-pnx4008/include/mach/io.h | ||
4 | * | ||
5 | * Author: Dmitry Chigirev <chigirev@ru.mvista.com> | ||
6 | * | ||
7 | * 2005 (c) MontaVista Software, Inc. This file is licensed under | ||
8 | * the terms of the GNU General Public License version 2. This program | ||
9 | * is licensed "as is" without any warranty of any kind, whether express | ||
10 | * or implied. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_ARCH_IO_H | ||
14 | #define __ASM_ARM_ARCH_IO_H | ||
15 | |||
16 | #define IO_SPACE_LIMIT 0xffffffff | ||
17 | |||
18 | #define __io(a) __typesafe_io(a) | ||
19 | #define __mem_pci(a) (a) | ||
20 | |||
21 | #endif | ||
diff --git a/arch/arm/mach-prima2/include/mach/io.h b/arch/arm/mach-prima2/include/mach/io.h deleted file mode 100644 index 6c31e9ec279e..000000000000 --- a/arch/arm/mach-prima2/include/mach/io.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-prima2/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. | ||
5 | * | ||
6 | * Licensed under GPLv2 or later. | ||
7 | */ | ||
8 | |||
9 | #ifndef __MACH_PRIMA2_IO_H | ||
10 | #define __MACH_PRIMA2_IO_H | ||
11 | |||
12 | #define IO_SPACE_LIMIT ((resource_size_t)0) | ||
13 | |||
14 | #define __mem_pci(a) (a) | ||
15 | |||
16 | #endif | ||
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c index b7a6091ce791..0d024b1e916d 100644 --- a/arch/arm/mach-prima2/timer.c +++ b/arch/arm/mach-prima2/timer.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
20 | #include <mach/map.h> | 20 | #include <mach/map.h> |
21 | #include <asm/sched_clock.h> | ||
21 | #include <asm/mach/time.h> | 22 | #include <asm/mach/time.h> |
22 | 23 | ||
23 | #define SIRFSOC_TIMER_COUNTER_LO 0x0000 | 24 | #define SIRFSOC_TIMER_COUNTER_LO 0x0000 |
@@ -165,21 +166,9 @@ static struct irqaction sirfsoc_timer_irq = { | |||
165 | }; | 166 | }; |
166 | 167 | ||
167 | /* Overwrite weak default sched_clock with more precise one */ | 168 | /* Overwrite weak default sched_clock with more precise one */ |
168 | unsigned long long notrace sched_clock(void) | 169 | static u32 notrace sirfsoc_read_sched_clock(void) |
169 | { | 170 | { |
170 | static int is_mapped; | 171 | return (u32)(sirfsoc_timer_read(NULL) & 0xffffffff); |
171 | |||
172 | /* | ||
173 | * sched_clock is called earlier than .init of sys_timer | ||
174 | * if we map timer memory in .init of sys_timer, system | ||
175 | * will panic due to illegal memory access | ||
176 | */ | ||
177 | if (!is_mapped) { | ||
178 | sirfsoc_of_timer_map(); | ||
179 | is_mapped = 1; | ||
180 | } | ||
181 | |||
182 | return sirfsoc_timer_read(NULL) * (NSEC_PER_SEC / CLOCK_TICK_RATE); | ||
183 | } | 172 | } |
184 | 173 | ||
185 | static void __init sirfsoc_clockevent_init(void) | 174 | static void __init sirfsoc_clockevent_init(void) |
@@ -210,6 +199,8 @@ static void __init sirfsoc_timer_init(void) | |||
210 | BUG_ON(rate < CLOCK_TICK_RATE); | 199 | BUG_ON(rate < CLOCK_TICK_RATE); |
211 | BUG_ON(rate % CLOCK_TICK_RATE); | 200 | BUG_ON(rate % CLOCK_TICK_RATE); |
212 | 201 | ||
202 | sirfsoc_of_timer_map(); | ||
203 | |||
213 | writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV); | 204 | writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV); |
214 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); | 205 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); |
215 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); | 206 | writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); |
@@ -217,6 +208,8 @@ static void __init sirfsoc_timer_init(void) | |||
217 | 208 | ||
218 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); | 209 | BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); |
219 | 210 | ||
211 | setup_sched_clock(sirfsoc_read_sched_clock, 32, CLOCK_TICK_RATE); | ||
212 | |||
220 | BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); | 213 | BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); |
221 | 214 | ||
222 | sirfsoc_clockevent_init(); | 215 | sirfsoc_clockevent_init(); |
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 61d3c72ded84..109ccd2a8885 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -108,6 +108,7 @@ config CSB726_CSB701 | |||
108 | 108 | ||
109 | config MACH_ARMCORE | 109 | config MACH_ARMCORE |
110 | bool "CompuLab CM-X255/CM-X270 modules" | 110 | bool "CompuLab CM-X255/CM-X270 modules" |
111 | select ARCH_HAS_DMA_SET_COHERENT_MASK if PCI | ||
111 | select PXA27x | 112 | select PXA27x |
112 | select IWMMXT | 113 | select IWMMXT |
113 | select PXA25x | 114 | select PXA25x |
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c index c91727d1fe09..9a8760b72913 100644 --- a/arch/arm/mach-pxa/capc7117.c +++ b/arch/arm/mach-pxa/capc7117.c | |||
@@ -150,6 +150,7 @@ MACHINE_START(CAPC7117, | |||
150 | "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM") | 150 | "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM") |
151 | .atag_offset = 0x100, | 151 | .atag_offset = 0x100, |
152 | .map_io = pxa3xx_map_io, | 152 | .map_io = pxa3xx_map_io, |
153 | .nr_irqs = PXA_NR_IRQS, | ||
153 | .init_irq = pxa3xx_init_irq, | 154 | .init_irq = pxa3xx_init_irq, |
154 | .handle_irq = pxa3xx_handle_irq, | 155 | .handle_irq = pxa3xx_handle_irq, |
155 | .timer = &pxa_timer, | 156 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/clock-pxa2xx.c b/arch/arm/mach-pxa/clock-pxa2xx.c index 1d5859d9a0e3..9ee2ad6a0a07 100644 --- a/arch/arm/mach-pxa/clock-pxa2xx.c +++ b/arch/arm/mach-pxa/clock-pxa2xx.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/io.h> | ||
12 | #include <linux/syscore_ops.h> | 13 | #include <linux/syscore_ops.h> |
13 | 14 | ||
14 | #include <mach/pxa2xx-regs.h> | 15 | #include <mach/pxa2xx-regs.h> |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 0c920fccb79e..313274016277 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -853,6 +853,7 @@ static void __init cm_x300_fixup(struct tag *tags, char **cmdline, | |||
853 | MACHINE_START(CM_X300, "CM-X300 module") | 853 | MACHINE_START(CM_X300, "CM-X300 module") |
854 | .atag_offset = 0x100, | 854 | .atag_offset = 0x100, |
855 | .map_io = pxa3xx_map_io, | 855 | .map_io = pxa3xx_map_io, |
856 | .nr_irqs = PXA_NR_IRQS, | ||
856 | .init_irq = pxa3xx_init_irq, | 857 | .init_irq = pxa3xx_init_irq, |
857 | .handle_irq = pxa3xx_handle_irq, | 858 | .handle_irq = pxa3xx_handle_irq, |
858 | .timer = &pxa_timer, | 859 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c index 29d5d541f602..b2f227d36125 100644 --- a/arch/arm/mach-pxa/colibri-pxa270.c +++ b/arch/arm/mach-pxa/colibri-pxa270.c | |||
@@ -310,6 +310,7 @@ MACHINE_START(COLIBRI, "Toradex Colibri PXA270") | |||
310 | .atag_offset = 0x100, | 310 | .atag_offset = 0x100, |
311 | .init_machine = colibri_pxa270_init, | 311 | .init_machine = colibri_pxa270_init, |
312 | .map_io = pxa27x_map_io, | 312 | .map_io = pxa27x_map_io, |
313 | .nr_irqs = PXA_NR_IRQS, | ||
313 | .init_irq = pxa27x_init_irq, | 314 | .init_irq = pxa27x_init_irq, |
314 | .handle_irq = pxa27x_handle_irq, | 315 | .handle_irq = pxa27x_handle_irq, |
315 | .timer = &pxa_timer, | 316 | .timer = &pxa_timer, |
@@ -320,6 +321,7 @@ MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC") | |||
320 | .atag_offset = 0x100, | 321 | .atag_offset = 0x100, |
321 | .init_machine = colibri_pxa270_income_init, | 322 | .init_machine = colibri_pxa270_income_init, |
322 | .map_io = pxa27x_map_io, | 323 | .map_io = pxa27x_map_io, |
324 | .nr_irqs = PXA_NR_IRQS, | ||
323 | .init_irq = pxa27x_init_irq, | 325 | .init_irq = pxa27x_init_irq, |
324 | .handle_irq = pxa27x_handle_irq, | 326 | .handle_irq = pxa27x_handle_irq, |
325 | .timer = &pxa_timer, | 327 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c index 0846d210cb05..bb6def8ec979 100644 --- a/arch/arm/mach-pxa/colibri-pxa300.c +++ b/arch/arm/mach-pxa/colibri-pxa300.c | |||
@@ -186,6 +186,7 @@ MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") | |||
186 | .atag_offset = 0x100, | 186 | .atag_offset = 0x100, |
187 | .init_machine = colibri_pxa300_init, | 187 | .init_machine = colibri_pxa300_init, |
188 | .map_io = pxa3xx_map_io, | 188 | .map_io = pxa3xx_map_io, |
189 | .nr_irqs = PXA_NR_IRQS, | ||
189 | .init_irq = pxa3xx_init_irq, | 190 | .init_irq = pxa3xx_init_irq, |
190 | .handle_irq = pxa3xx_handle_irq, | 191 | .handle_irq = pxa3xx_handle_irq, |
191 | .timer = &pxa_timer, | 192 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c index 6ad3359063af..d88e7b37f1da 100644 --- a/arch/arm/mach-pxa/colibri-pxa320.c +++ b/arch/arm/mach-pxa/colibri-pxa320.c | |||
@@ -256,6 +256,7 @@ MACHINE_START(COLIBRI320, "Toradex Colibri PXA320") | |||
256 | .atag_offset = 0x100, | 256 | .atag_offset = 0x100, |
257 | .init_machine = colibri_pxa320_init, | 257 | .init_machine = colibri_pxa320_init, |
258 | .map_io = pxa3xx_map_io, | 258 | .map_io = pxa3xx_map_io, |
259 | .nr_irqs = PXA_NR_IRQS, | ||
259 | .init_irq = pxa3xx_init_irq, | 260 | .init_irq = pxa3xx_init_irq, |
260 | .handle_irq = pxa3xx_handle_irq, | 261 | .handle_irq = pxa3xx_handle_irq, |
261 | .timer = &pxa_timer, | 262 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index de9d45e673fd..c1fe32db4755 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -729,6 +729,7 @@ static void __init fixup_corgi(struct tag *tags, char **cmdline, | |||
729 | MACHINE_START(CORGI, "SHARP Corgi") | 729 | MACHINE_START(CORGI, "SHARP Corgi") |
730 | .fixup = fixup_corgi, | 730 | .fixup = fixup_corgi, |
731 | .map_io = pxa25x_map_io, | 731 | .map_io = pxa25x_map_io, |
732 | .nr_irqs = PXA_NR_IRQS, | ||
732 | .init_irq = pxa25x_init_irq, | 733 | .init_irq = pxa25x_init_irq, |
733 | .handle_irq = pxa25x_handle_irq, | 734 | .handle_irq = pxa25x_handle_irq, |
734 | .init_machine = corgi_init, | 735 | .init_machine = corgi_init, |
@@ -741,6 +742,7 @@ MACHINE_END | |||
741 | MACHINE_START(SHEPHERD, "SHARP Shepherd") | 742 | MACHINE_START(SHEPHERD, "SHARP Shepherd") |
742 | .fixup = fixup_corgi, | 743 | .fixup = fixup_corgi, |
743 | .map_io = pxa25x_map_io, | 744 | .map_io = pxa25x_map_io, |
745 | .nr_irqs = PXA_NR_IRQS, | ||
744 | .init_irq = pxa25x_init_irq, | 746 | .init_irq = pxa25x_init_irq, |
745 | .handle_irq = pxa25x_handle_irq, | 747 | .handle_irq = pxa25x_handle_irq, |
746 | .init_machine = corgi_init, | 748 | .init_machine = corgi_init, |
@@ -753,6 +755,7 @@ MACHINE_END | |||
753 | MACHINE_START(HUSKY, "SHARP Husky") | 755 | MACHINE_START(HUSKY, "SHARP Husky") |
754 | .fixup = fixup_corgi, | 756 | .fixup = fixup_corgi, |
755 | .map_io = pxa25x_map_io, | 757 | .map_io = pxa25x_map_io, |
758 | .nr_irqs = PXA_NR_IRQS, | ||
756 | .init_irq = pxa25x_init_irq, | 759 | .init_irq = pxa25x_init_irq, |
757 | .handle_irq = pxa25x_handle_irq, | 760 | .handle_irq = pxa25x_handle_irq, |
758 | .init_machine = corgi_init, | 761 | .init_machine = corgi_init, |
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index 39e265cfc86d..048c4299473c 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/apm-emulation.h> | 21 | #include <linux/apm-emulation.h> |
22 | #include <linux/io.h> | ||
22 | 23 | ||
23 | #include <asm/irq.h> | 24 | #include <asm/irq.h> |
24 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c index 88fbec05ec50..b85b4ab7aac6 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/cpufreq.h> | 16 | #include <linux/cpufreq.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/io.h> | ||
18 | 19 | ||
19 | #include <mach/pxa3xx-regs.h> | 20 | #include <mach/pxa3xx-regs.h> |
20 | 21 | ||
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c index fb5a51d834e5..67f0de37f46e 100644 --- a/arch/arm/mach-pxa/csb726.c +++ b/arch/arm/mach-pxa/csb726.c | |||
@@ -274,6 +274,7 @@ static void __init csb726_init(void) | |||
274 | MACHINE_START(CSB726, "Cogent CSB726") | 274 | MACHINE_START(CSB726, "Cogent CSB726") |
275 | .atag_offset = 0x100, | 275 | .atag_offset = 0x100, |
276 | .map_io = pxa27x_map_io, | 276 | .map_io = pxa27x_map_io, |
277 | .nr_irqs = PXA_NR_IRQS, | ||
277 | .init_irq = pxa27x_init_irq, | 278 | .init_irq = pxa27x_init_irq, |
278 | .handle_irq = pxa27x_handle_irq, | 279 | .handle_irq = pxa27x_handle_irq, |
279 | .init_machine = csb726_init, | 280 | .init_machine = csb726_init, |
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 84f2d7015cfe..166eee5b8a70 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <mach/pxafb.h> | 12 | #include <mach/pxafb.h> |
13 | #include <mach/mmc.h> | 13 | #include <mach/mmc.h> |
14 | #include <mach/irda.h> | 14 | #include <mach/irda.h> |
15 | #include <mach/irqs.h> | ||
15 | #include <mach/ohci.h> | 16 | #include <mach/ohci.h> |
16 | #include <plat/pxa27x_keypad.h> | 17 | #include <plat/pxa27x_keypad.h> |
17 | #include <mach/camera.h> | 18 | #include <mach/camera.h> |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index b88e11cd75ed..16ec557b8e43 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -1301,6 +1301,7 @@ static void __init em_x270_init(void) | |||
1301 | MACHINE_START(EM_X270, "Compulab EM-X270") | 1301 | MACHINE_START(EM_X270, "Compulab EM-X270") |
1302 | .atag_offset = 0x100, | 1302 | .atag_offset = 0x100, |
1303 | .map_io = pxa27x_map_io, | 1303 | .map_io = pxa27x_map_io, |
1304 | .nr_irqs = PXA_NR_IRQS, | ||
1304 | .init_irq = pxa27x_init_irq, | 1305 | .init_irq = pxa27x_init_irq, |
1305 | .handle_irq = pxa27x_handle_irq, | 1306 | .handle_irq = pxa27x_handle_irq, |
1306 | .timer = &pxa_timer, | 1307 | .timer = &pxa_timer, |
@@ -1311,6 +1312,7 @@ MACHINE_END | |||
1311 | MACHINE_START(EXEDA, "Compulab eXeda") | 1312 | MACHINE_START(EXEDA, "Compulab eXeda") |
1312 | .atag_offset = 0x100, | 1313 | .atag_offset = 0x100, |
1313 | .map_io = pxa27x_map_io, | 1314 | .map_io = pxa27x_map_io, |
1315 | .nr_irqs = PXA_NR_IRQS, | ||
1314 | .init_irq = pxa27x_init_irq, | 1316 | .init_irq = pxa27x_init_irq, |
1315 | .handle_irq = pxa27x_handle_irq, | 1317 | .handle_irq = pxa27x_handle_irq, |
1316 | .timer = &pxa_timer, | 1318 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index ac3b1cef4751..e529a35a44ce 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c | |||
@@ -235,6 +235,7 @@ static void __init gumstix_init(void) | |||
235 | MACHINE_START(GUMSTIX, "Gumstix") | 235 | MACHINE_START(GUMSTIX, "Gumstix") |
236 | .atag_offset = 0x100, /* match u-boot bi_boot_params */ | 236 | .atag_offset = 0x100, /* match u-boot bi_boot_params */ |
237 | .map_io = pxa25x_map_io, | 237 | .map_io = pxa25x_map_io, |
238 | .nr_irqs = PXA_NR_IRQS, | ||
238 | .init_irq = pxa25x_init_irq, | 239 | .init_irq = pxa25x_init_irq, |
239 | .handle_irq = pxa25x_handle_irq, | 240 | .handle_irq = pxa25x_handle_irq, |
240 | .timer = &pxa_timer, | 241 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c index fde6b4c873c4..e7dec589f014 100644 --- a/arch/arm/mach-pxa/h5000.c +++ b/arch/arm/mach-pxa/h5000.c | |||
@@ -205,6 +205,7 @@ static void __init h5000_init(void) | |||
205 | MACHINE_START(H5400, "HP iPAQ H5000") | 205 | MACHINE_START(H5400, "HP iPAQ H5000") |
206 | .atag_offset = 0x100, | 206 | .atag_offset = 0x100, |
207 | .map_io = pxa25x_map_io, | 207 | .map_io = pxa25x_map_io, |
208 | .nr_irqs = PXA_NR_IRQS, | ||
208 | .init_irq = pxa25x_init_irq, | 209 | .init_irq = pxa25x_init_irq, |
209 | .handle_irq = pxa25x_handle_irq, | 210 | .handle_irq = pxa25x_handle_irq, |
210 | .timer = &pxa_timer, | 211 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c index 26d069a9f900..2962de898da9 100644 --- a/arch/arm/mach-pxa/himalaya.c +++ b/arch/arm/mach-pxa/himalaya.c | |||
@@ -160,6 +160,7 @@ static void __init himalaya_init(void) | |||
160 | MACHINE_START(HIMALAYA, "HTC Himalaya") | 160 | MACHINE_START(HIMALAYA, "HTC Himalaya") |
161 | .atag_offset = 0x100, | 161 | .atag_offset = 0x100, |
162 | .map_io = pxa25x_map_io, | 162 | .map_io = pxa25x_map_io, |
163 | .nr_irqs = PXA_NR_IRQS, | ||
163 | .init_irq = pxa25x_init_irq, | 164 | .init_irq = pxa25x_init_irq, |
164 | .handle_irq = pxa25x_handle_irq, | 165 | .handle_irq = pxa25x_handle_irq, |
165 | .init_machine = himalaya_init, | 166 | .init_machine = himalaya_init, |
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c index 67400192ed3b..1d02eabc9c65 100644 --- a/arch/arm/mach-pxa/icontrol.c +++ b/arch/arm/mach-pxa/icontrol.c | |||
@@ -193,6 +193,7 @@ static void __init icontrol_init(void) | |||
193 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") | 193 | MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") |
194 | .atag_offset = 0x100, | 194 | .atag_offset = 0x100, |
195 | .map_io = pxa3xx_map_io, | 195 | .map_io = pxa3xx_map_io, |
196 | .nr_irqs = PXA_NR_IRQS, | ||
196 | .init_irq = pxa3xx_init_irq, | 197 | .init_irq = pxa3xx_init_irq, |
197 | .handle_irq = pxa3xx_handle_irq, | 198 | .handle_irq = pxa3xx_handle_irq, |
198 | .timer = &pxa_timer, | 199 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index 8af1840e12cc..6ff466bd43e8 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -195,6 +195,7 @@ static void __init idp_map_io(void) | |||
195 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 195 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") |
196 | /* Maintainer: Vibren Technologies */ | 196 | /* Maintainer: Vibren Technologies */ |
197 | .map_io = idp_map_io, | 197 | .map_io = idp_map_io, |
198 | .nr_irqs = PXA_NR_IRQS, | ||
198 | .init_irq = pxa25x_init_irq, | 199 | .init_irq = pxa25x_init_irq, |
199 | .handle_irq = pxa25x_handle_irq, | 200 | .handle_irq = pxa25x_handle_irq, |
200 | .timer = &pxa_timer, | 201 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h index 8184669dde28..56d92e5cad85 100644 --- a/arch/arm/mach-pxa/include/mach/hardware.h +++ b/arch/arm/mach-pxa/include/mach/hardware.h | |||
@@ -40,7 +40,6 @@ | |||
40 | #define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1)) | 40 | #define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1)) |
41 | 41 | ||
42 | #ifndef __ASSEMBLY__ | 42 | #ifndef __ASSEMBLY__ |
43 | # define IOMEM(x) ((void __iomem *)(x)) | ||
44 | # define __REG(x) (*((volatile u32 __iomem *)io_p2v(x))) | 43 | # define __REG(x) (*((volatile u32 __iomem *)io_p2v(x))) |
45 | 44 | ||
46 | /* With indexed regs we don't want to feed the index through io_p2v() | 45 | /* With indexed regs we don't want to feed the index through io_p2v() |
@@ -52,7 +51,6 @@ | |||
52 | 51 | ||
53 | #else | 52 | #else |
54 | 53 | ||
55 | # define IOMEM(x) x | ||
56 | # define __REG(x) io_p2v(x) | 54 | # define __REG(x) io_p2v(x) |
57 | # define __PREG(x) io_v2p(x) | 55 | # define __PREG(x) io_v2p(x) |
58 | 56 | ||
@@ -337,8 +335,4 @@ extern unsigned int get_memclk_frequency_10khz(void); | |||
337 | extern unsigned long get_clock_tick_rate(void); | 335 | extern unsigned long get_clock_tick_rate(void); |
338 | #endif | 336 | #endif |
339 | 337 | ||
340 | #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) | ||
341 | #define ARCH_HAS_DMA_SET_COHERENT_MASK | ||
342 | #endif | ||
343 | |||
344 | #endif /* _ASM_ARCH_HARDWARE_H */ | 338 | #endif /* _ASM_ARCH_HARDWARE_H */ |
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h deleted file mode 100644 index fdca3be47d9b..000000000000 --- a/arch/arm/mach-pxa/include/mach/io.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/include/mach/io.h | ||
3 | * | ||
4 | * Copied from asm/arch/sa1100/io.h | ||
5 | */ | ||
6 | #ifndef __ASM_ARM_ARCH_IO_H | ||
7 | #define __ASM_ARM_ARCH_IO_H | ||
8 | |||
9 | #include <mach/hardware.h> | ||
10 | |||
11 | #define IO_SPACE_LIMIT 0xffffffff | ||
12 | |||
13 | /* | ||
14 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
15 | * drivers out there that might just work if we fake them... | ||
16 | */ | ||
17 | #define __io(a) __typesafe_io(a) | ||
18 | #define __mem_pci(a) (a) | ||
19 | |||
20 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h index 32975adf3ca4..8765782dd955 100644 --- a/arch/arm/mach-pxa/include/mach/irqs.h +++ b/arch/arm/mach-pxa/include/mach/irqs.h | |||
@@ -100,7 +100,7 @@ | |||
100 | */ | 100 | */ |
101 | #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO) | 101 | #define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO) |
102 | 102 | ||
103 | #define NR_IRQS (IRQ_BOARD_START) | 103 | #define PXA_NR_IRQS (IRQ_BOARD_START) |
104 | 104 | ||
105 | #ifndef __ASSEMBLY__ | 105 | #ifndef __ASSEMBLY__ |
106 | struct irq_data; | 106 | struct irq_data; |
diff --git a/arch/arm/mach-pxa/include/mach/mainstone.h b/arch/arm/mach-pxa/include/mach/mainstone.h index 4c2d11cd824d..1bfc4e822a41 100644 --- a/arch/arm/mach-pxa/include/mach/mainstone.h +++ b/arch/arm/mach-pxa/include/mach/mainstone.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef ASM_ARCH_MAINSTONE_H | 13 | #ifndef ASM_ARCH_MAINSTONE_H |
14 | #define ASM_ARCH_MAINSTONE_H | 14 | #define ASM_ARCH_MAINSTONE_H |
15 | 15 | ||
16 | #include <mach/irqs.h> | ||
17 | |||
16 | #define MST_ETH_PHYS PXA_CS4_PHYS | 18 | #define MST_ETH_PHYS PXA_CS4_PHYS |
17 | 19 | ||
18 | #define MST_FPGA_PHYS PXA_CS2_PHYS | 20 | #define MST_FPGA_PHYS PXA_CS2_PHYS |
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c index 29b62afc6f7c..b0a842887780 100644 --- a/arch/arm/mach-pxa/mfp-pxa2xx.c +++ b/arch/arm/mach-pxa/mfp-pxa2xx.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/io.h> | ||
20 | #include <linux/syscore_ops.h> | 21 | #include <linux/syscore_ops.h> |
21 | 22 | ||
22 | #include <mach/pxa2xx-regs.h> | 23 | #include <mach/pxa2xx-regs.h> |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index e80a3db735c2..061d57009cee 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -758,6 +758,7 @@ MACHINE_START(MIOA701, "MIO A701") | |||
758 | .atag_offset = 0x100, | 758 | .atag_offset = 0x100, |
759 | .restart_mode = 's', | 759 | .restart_mode = 's', |
760 | .map_io = &pxa27x_map_io, | 760 | .map_io = &pxa27x_map_io, |
761 | .nr_irqs = PXA_NR_IRQS, | ||
761 | .init_irq = &pxa27x_init_irq, | 762 | .init_irq = &pxa27x_init_irq, |
762 | .handle_irq = &pxa27x_handle_irq, | 763 | .handle_irq = &pxa27x_handle_irq, |
763 | .init_machine = mioa701_machine_init, | 764 | .init_machine = mioa701_machine_init, |
diff --git a/arch/arm/mach-pxa/mp900.c b/arch/arm/mach-pxa/mp900.c index 169bf8f97af0..152efbf093f6 100644 --- a/arch/arm/mach-pxa/mp900.c +++ b/arch/arm/mach-pxa/mp900.c | |||
@@ -95,6 +95,7 @@ MACHINE_START(NEC_MP900, "MobilePro900/C") | |||
95 | .atag_offset = 0x220100, | 95 | .atag_offset = 0x220100, |
96 | .timer = &pxa_timer, | 96 | .timer = &pxa_timer, |
97 | .map_io = pxa25x_map_io, | 97 | .map_io = pxa25x_map_io, |
98 | .nr_irqs = PXA_NR_IRQS, | ||
98 | .init_irq = pxa25x_init_irq, | 99 | .init_irq = pxa25x_init_irq, |
99 | .handle_irq = pxa25x_handle_irq, | 100 | .handle_irq = pxa25x_handle_irq, |
100 | .init_machine = mp900c_init, | 101 | .init_machine = mp900c_init, |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 1fa80f4f80c8..31e0433d83ba 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -344,6 +344,7 @@ static void __init palmld_init(void) | |||
344 | MACHINE_START(PALMLD, "Palm LifeDrive") | 344 | MACHINE_START(PALMLD, "Palm LifeDrive") |
345 | .atag_offset = 0x100, | 345 | .atag_offset = 0x100, |
346 | .map_io = palmld_map_io, | 346 | .map_io = palmld_map_io, |
347 | .nr_irqs = PXA_NR_IRQS, | ||
347 | .init_irq = pxa27x_init_irq, | 348 | .init_irq = pxa27x_init_irq, |
348 | .handle_irq = pxa27x_handle_irq, | 349 | .handle_irq = pxa27x_handle_irq, |
349 | .timer = &pxa_timer, | 350 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 5ba14316bd9c..0f6bd4fcfa3b 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -205,6 +205,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5") | |||
205 | .atag_offset = 0x100, | 205 | .atag_offset = 0x100, |
206 | .map_io = pxa27x_map_io, | 206 | .map_io = pxa27x_map_io, |
207 | .reserve = palmt5_reserve, | 207 | .reserve = palmt5_reserve, |
208 | .nr_irqs = PXA_NR_IRQS, | ||
208 | .init_irq = pxa27x_init_irq, | 209 | .init_irq = pxa27x_init_irq, |
209 | .handle_irq = pxa27x_handle_irq, | 210 | .handle_irq = pxa27x_handle_irq, |
210 | .timer = &pxa_timer, | 211 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 29b51b40f09d..e2d97eed07a7 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
@@ -539,6 +539,7 @@ static void __init palmtc_init(void) | |||
539 | MACHINE_START(PALMTC, "Palm Tungsten|C") | 539 | MACHINE_START(PALMTC, "Palm Tungsten|C") |
540 | .atag_offset = 0x100, | 540 | .atag_offset = 0x100, |
541 | .map_io = pxa25x_map_io, | 541 | .map_io = pxa25x_map_io, |
542 | .nr_irqs = PXA_NR_IRQS, | ||
542 | .init_irq = pxa25x_init_irq, | 543 | .init_irq = pxa25x_init_irq, |
543 | .handle_irq = pxa25x_handle_irq, | 544 | .handle_irq = pxa25x_handle_irq, |
544 | .timer = &pxa_timer, | 545 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index 5ebf49acb827..c054827c567f 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -358,6 +358,7 @@ static void __init palmte2_init(void) | |||
358 | MACHINE_START(PALMTE2, "Palm Tungsten|E2") | 358 | MACHINE_START(PALMTE2, "Palm Tungsten|E2") |
359 | .atag_offset = 0x100, | 359 | .atag_offset = 0x100, |
360 | .map_io = pxa25x_map_io, | 360 | .map_io = pxa25x_map_io, |
361 | .nr_irqs = PXA_NR_IRQS, | ||
361 | .init_irq = pxa25x_init_irq, | 362 | .init_irq = pxa25x_init_irq, |
362 | .handle_irq = pxa25x_handle_irq, | 363 | .handle_irq = pxa25x_handle_irq, |
363 | .timer = &pxa_timer, | 364 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c index ec8249156c08..fbdebee39a53 100644 --- a/arch/arm/mach-pxa/palmtreo.c +++ b/arch/arm/mach-pxa/palmtreo.c | |||
@@ -448,6 +448,7 @@ MACHINE_START(TREO680, "Palm Treo 680") | |||
448 | .atag_offset = 0x100, | 448 | .atag_offset = 0x100, |
449 | .map_io = pxa27x_map_io, | 449 | .map_io = pxa27x_map_io, |
450 | .reserve = treo_reserve, | 450 | .reserve = treo_reserve, |
451 | .nr_irqs = PXA_NR_IRQS, | ||
451 | .init_irq = pxa27x_init_irq, | 452 | .init_irq = pxa27x_init_irq, |
452 | .handle_irq = pxa27x_handle_irq, | 453 | .handle_irq = pxa27x_handle_irq, |
453 | .timer = &pxa_timer, | 454 | .timer = &pxa_timer, |
@@ -461,6 +462,7 @@ MACHINE_START(CENTRO, "Palm Centro 685") | |||
461 | .atag_offset = 0x100, | 462 | .atag_offset = 0x100, |
462 | .map_io = pxa27x_map_io, | 463 | .map_io = pxa27x_map_io, |
463 | .reserve = treo_reserve, | 464 | .reserve = treo_reserve, |
465 | .nr_irqs = PXA_NR_IRQS, | ||
464 | .init_irq = pxa27x_init_irq, | 466 | .init_irq = pxa27x_init_irq, |
465 | .handle_irq = pxa27x_handle_irq, | 467 | .handle_irq = pxa27x_handle_irq, |
466 | .timer = &pxa_timer, | 468 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 6170d76dfba8..9507605ed547 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -366,6 +366,7 @@ static void __init palmtx_init(void) | |||
366 | MACHINE_START(PALMTX, "Palm T|X") | 366 | MACHINE_START(PALMTX, "Palm T|X") |
367 | .atag_offset = 0x100, | 367 | .atag_offset = 0x100, |
368 | .map_io = palmtx_map_io, | 368 | .map_io = palmtx_map_io, |
369 | .nr_irqs = PXA_NR_IRQS, | ||
369 | .init_irq = pxa27x_init_irq, | 370 | .init_irq = pxa27x_init_irq, |
370 | .handle_irq = pxa27x_handle_irq, | 371 | .handle_irq = pxa27x_handle_irq, |
371 | .timer = &pxa_timer, | 372 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index b2dff9d415eb..a97b59965bb9 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c | |||
@@ -401,6 +401,7 @@ static void __init palmz72_init(void) | |||
401 | MACHINE_START(PALMZ72, "Palm Zire72") | 401 | MACHINE_START(PALMZ72, "Palm Zire72") |
402 | .atag_offset = 0x100, | 402 | .atag_offset = 0x100, |
403 | .map_io = pxa27x_map_io, | 403 | .map_io = pxa27x_map_io, |
404 | .nr_irqs = PXA_NR_IRQS, | ||
404 | .init_irq = pxa27x_init_irq, | 405 | .init_irq = pxa27x_init_irq, |
405 | .handle_irq = pxa27x_handle_irq, | 406 | .handle_irq = pxa27x_handle_irq, |
406 | .timer = &pxa_timer, | 407 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index 868270421b8c..f8ec85450c42 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/io.h> | ||
16 | 17 | ||
17 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
18 | #include <mach/pxa2xx-regs.h> | 19 | #include <mach/pxa2xx-regs.h> |
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c index 40bb16501d86..17cbc0c7bdb8 100644 --- a/arch/arm/mach-pxa/pxa300.c +++ b/arch/arm/mach-pxa/pxa300.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <mach/pxa300.h> | 21 | #include <mach/pxa300.h> |
21 | 22 | ||
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c index 8d614ecd8e99..6dc99d4f2dc6 100644 --- a/arch/arm/mach-pxa/pxa320.c +++ b/arch/arm/mach-pxa/pxa320.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <mach/pxa320.h> | 21 | #include <mach/pxa320.h> |
21 | 22 | ||
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 1570d457fea3..dffb7e813d98 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <mach/pm.h> | 31 | #include <mach/pm.h> |
32 | #include <mach/dma.h> | 32 | #include <mach/dma.h> |
33 | #include <mach/smemc.h> | 33 | #include <mach/smemc.h> |
34 | #include <mach/irqs.h> | ||
34 | 35 | ||
35 | #include "generic.h" | 36 | #include "generic.h" |
36 | #include "devices.h" | 37 | #include "devices.h" |
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c index 708b4f407acc..5905ed130e94 100644 --- a/arch/arm/mach-pxa/raumfeld.c +++ b/arch/arm/mach-pxa/raumfeld.c | |||
@@ -1092,6 +1092,7 @@ MACHINE_START(RAUMFELD_RC, "Raumfeld Controller") | |||
1092 | .atag_offset = 0x100, | 1092 | .atag_offset = 0x100, |
1093 | .init_machine = raumfeld_controller_init, | 1093 | .init_machine = raumfeld_controller_init, |
1094 | .map_io = pxa3xx_map_io, | 1094 | .map_io = pxa3xx_map_io, |
1095 | .nr_irqs = PXA_NR_IRQS, | ||
1095 | .init_irq = pxa3xx_init_irq, | 1096 | .init_irq = pxa3xx_init_irq, |
1096 | .handle_irq = pxa3xx_handle_irq, | 1097 | .handle_irq = pxa3xx_handle_irq, |
1097 | .timer = &pxa_timer, | 1098 | .timer = &pxa_timer, |
@@ -1104,6 +1105,7 @@ MACHINE_START(RAUMFELD_CONNECTOR, "Raumfeld Connector") | |||
1104 | .atag_offset = 0x100, | 1105 | .atag_offset = 0x100, |
1105 | .init_machine = raumfeld_connector_init, | 1106 | .init_machine = raumfeld_connector_init, |
1106 | .map_io = pxa3xx_map_io, | 1107 | .map_io = pxa3xx_map_io, |
1108 | .nr_irqs = PXA_NR_IRQS, | ||
1107 | .init_irq = pxa3xx_init_irq, | 1109 | .init_irq = pxa3xx_init_irq, |
1108 | .handle_irq = pxa3xx_handle_irq, | 1110 | .handle_irq = pxa3xx_handle_irq, |
1109 | .timer = &pxa_timer, | 1111 | .timer = &pxa_timer, |
@@ -1116,6 +1118,7 @@ MACHINE_START(RAUMFELD_SPEAKER, "Raumfeld Speaker") | |||
1116 | .atag_offset = 0x100, | 1118 | .atag_offset = 0x100, |
1117 | .init_machine = raumfeld_speaker_init, | 1119 | .init_machine = raumfeld_speaker_init, |
1118 | .map_io = pxa3xx_map_io, | 1120 | .map_io = pxa3xx_map_io, |
1121 | .nr_irqs = PXA_NR_IRQS, | ||
1119 | .init_irq = pxa3xx_init_irq, | 1122 | .init_irq = pxa3xx_init_irq, |
1120 | .handle_irq = pxa3xx_handle_irq, | 1123 | .handle_irq = pxa3xx_handle_irq, |
1121 | .timer = &pxa_timer, | 1124 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c index 0fe354efb931..86c95a5d8533 100644 --- a/arch/arm/mach-pxa/saar.c +++ b/arch/arm/mach-pxa/saar.c | |||
@@ -598,6 +598,7 @@ MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)") | |||
598 | /* Maintainer: Eric Miao <eric.miao@marvell.com> */ | 598 | /* Maintainer: Eric Miao <eric.miao@marvell.com> */ |
599 | .atag_offset = 0x100, | 599 | .atag_offset = 0x100, |
600 | .map_io = pxa3xx_map_io, | 600 | .map_io = pxa3xx_map_io, |
601 | .nr_irqs = PXA_NR_IRQS, | ||
601 | .init_irq = pxa3xx_init_irq, | 602 | .init_irq = pxa3xx_init_irq, |
602 | .handle_irq = pxa3xx_handle_irq, | 603 | .handle_irq = pxa3xx_handle_irq, |
603 | .timer = &pxa_timer, | 604 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 30989baf7f2a..bdf4cb88ca0a 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/leds.h> | 24 | #include <linux/leds.h> |
25 | #include <linux/suspend.h> | 25 | #include <linux/suspend.h> |
26 | #include <linux/gpio.h> | 26 | #include <linux/gpio.h> |
27 | #include <linux/io.h> | ||
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <mach/pm.h> | 30 | #include <mach/pm.h> |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index abf355d0c92f..df2ab0fb2ace 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -984,6 +984,7 @@ MACHINE_START(SPITZ, "SHARP Spitz") | |||
984 | .restart_mode = 'g', | 984 | .restart_mode = 'g', |
985 | .fixup = spitz_fixup, | 985 | .fixup = spitz_fixup, |
986 | .map_io = pxa27x_map_io, | 986 | .map_io = pxa27x_map_io, |
987 | .nr_irqs = PXA_NR_IRQS, | ||
987 | .init_irq = pxa27x_init_irq, | 988 | .init_irq = pxa27x_init_irq, |
988 | .handle_irq = pxa27x_handle_irq, | 989 | .handle_irq = pxa27x_handle_irq, |
989 | .init_machine = spitz_init, | 990 | .init_machine = spitz_init, |
@@ -997,6 +998,7 @@ MACHINE_START(BORZOI, "SHARP Borzoi") | |||
997 | .restart_mode = 'g', | 998 | .restart_mode = 'g', |
998 | .fixup = spitz_fixup, | 999 | .fixup = spitz_fixup, |
999 | .map_io = pxa27x_map_io, | 1000 | .map_io = pxa27x_map_io, |
1001 | .nr_irqs = PXA_NR_IRQS, | ||
1000 | .init_irq = pxa27x_init_irq, | 1002 | .init_irq = pxa27x_init_irq, |
1001 | .handle_irq = pxa27x_handle_irq, | 1003 | .handle_irq = pxa27x_handle_irq, |
1002 | .init_machine = spitz_init, | 1004 | .init_machine = spitz_init, |
@@ -1010,6 +1012,7 @@ MACHINE_START(AKITA, "SHARP Akita") | |||
1010 | .restart_mode = 'g', | 1012 | .restart_mode = 'g', |
1011 | .fixup = spitz_fixup, | 1013 | .fixup = spitz_fixup, |
1012 | .map_io = pxa27x_map_io, | 1014 | .map_io = pxa27x_map_io, |
1015 | .nr_irqs = PXA_NR_IRQS, | ||
1013 | .init_irq = pxa27x_init_irq, | 1016 | .init_irq = pxa27x_init_irq, |
1014 | .handle_irq = pxa27x_handle_irq, | 1017 | .handle_irq = pxa27x_handle_irq, |
1015 | .init_machine = spitz_init, | 1018 | .init_machine = spitz_init, |
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index 227a6309dba7..4cd645e29b64 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c | |||
@@ -1006,6 +1006,7 @@ static void __init stargate2_init(void) | |||
1006 | #ifdef CONFIG_MACH_INTELMOTE2 | 1006 | #ifdef CONFIG_MACH_INTELMOTE2 |
1007 | MACHINE_START(INTELMOTE2, "IMOTE 2") | 1007 | MACHINE_START(INTELMOTE2, "IMOTE 2") |
1008 | .map_io = pxa27x_map_io, | 1008 | .map_io = pxa27x_map_io, |
1009 | .nr_irqs = PXA_NR_IRQS, | ||
1009 | .init_irq = pxa27x_init_irq, | 1010 | .init_irq = pxa27x_init_irq, |
1010 | .handle_irq = pxa27x_handle_irq, | 1011 | .handle_irq = pxa27x_handle_irq, |
1011 | .timer = &pxa_timer, | 1012 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c index 9fb38e80e076..736bfdc50ee6 100644 --- a/arch/arm/mach-pxa/tavorevb.c +++ b/arch/arm/mach-pxa/tavorevb.c | |||
@@ -491,6 +491,7 @@ MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)") | |||
491 | /* Maintainer: Eric Miao <eric.miao@marvell.com> */ | 491 | /* Maintainer: Eric Miao <eric.miao@marvell.com> */ |
492 | .atag_offset = 0x100, | 492 | .atag_offset = 0x100, |
493 | .map_io = pxa3xx_map_io, | 493 | .map_io = pxa3xx_map_io, |
494 | .nr_irqs = PXA_NR_IRQS, | ||
494 | .init_irq = pxa3xx_init_irq, | 495 | .init_irq = pxa3xx_init_irq, |
495 | .handle_irq = pxa3xx_handle_irq, | 496 | .handle_irq = pxa3xx_handle_irq, |
496 | .timer = &pxa_timer, | 497 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index b503049d6d26..3d6c9bd90de6 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/mach/time.h> | 22 | #include <asm/mach/time.h> |
23 | #include <asm/sched_clock.h> | 23 | #include <asm/sched_clock.h> |
24 | #include <mach/regs-ost.h> | 24 | #include <mach/regs-ost.h> |
25 | #include <mach/irqs.h> | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * This is PXA's sched_clock implementation. This has a resolution | 28 | * This is PXA's sched_clock implementation. This has a resolution |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index 0f30af617d8f..2b6ac00b2cd9 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -558,6 +558,7 @@ MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module") | |||
558 | .atag_offset = 0x100, | 558 | .atag_offset = 0x100, |
559 | .init_machine = trizeps4_init, | 559 | .init_machine = trizeps4_init, |
560 | .map_io = trizeps4_map_io, | 560 | .map_io = trizeps4_map_io, |
561 | .nr_irqs = PXA_NR_IRQS, | ||
561 | .init_irq = pxa27x_init_irq, | 562 | .init_irq = pxa27x_init_irq, |
562 | .handle_irq = pxa27x_handle_irq, | 563 | .handle_irq = pxa27x_handle_irq, |
563 | .timer = &pxa_timer, | 564 | .timer = &pxa_timer, |
@@ -569,6 +570,7 @@ MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module") | |||
569 | .atag_offset = 0x100, | 570 | .atag_offset = 0x100, |
570 | .init_machine = trizeps4_init, | 571 | .init_machine = trizeps4_init, |
571 | .map_io = trizeps4_map_io, | 572 | .map_io = trizeps4_map_io, |
573 | .nr_irqs = PXA_NR_IRQS, | ||
572 | .init_irq = pxa27x_init_irq, | 574 | .init_irq = pxa27x_init_irq, |
573 | .handle_irq = pxa27x_handle_irq, | 575 | .handle_irq = pxa27x_handle_irq, |
574 | .timer = &pxa_timer, | 576 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c index 7a3d342a7732..130379fb9d0f 100644 --- a/arch/arm/mach-pxa/viper.c +++ b/arch/arm/mach-pxa/viper.c | |||
@@ -995,6 +995,7 @@ MACHINE_START(VIPER, "Arcom/Eurotech VIPER SBC") | |||
995 | /* Maintainer: Marc Zyngier <maz@misterjones.org> */ | 995 | /* Maintainer: Marc Zyngier <maz@misterjones.org> */ |
996 | .atag_offset = 0x100, | 996 | .atag_offset = 0x100, |
997 | .map_io = viper_map_io, | 997 | .map_io = viper_map_io, |
998 | .nr_irqs = PXA_NR_IRQS, | ||
998 | .init_irq = viper_init_irq, | 999 | .init_irq = viper_init_irq, |
999 | .handle_irq = pxa25x_handle_irq, | 1000 | .handle_irq = pxa25x_handle_irq, |
1000 | .timer = &pxa_timer, | 1001 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c index 1f5cfa96f6d6..c57ab636ea9c 100644 --- a/arch/arm/mach-pxa/vpac270.c +++ b/arch/arm/mach-pxa/vpac270.c | |||
@@ -718,6 +718,7 @@ static void __init vpac270_init(void) | |||
718 | MACHINE_START(VPAC270, "Voipac PXA270") | 718 | MACHINE_START(VPAC270, "Voipac PXA270") |
719 | .atag_offset = 0x100, | 719 | .atag_offset = 0x100, |
720 | .map_io = pxa27x_map_io, | 720 | .map_io = pxa27x_map_io, |
721 | .nr_irqs = PXA_NR_IRQS, | ||
721 | .init_irq = pxa27x_init_irq, | 722 | .init_irq = pxa27x_init_irq, |
722 | .handle_irq = pxa27x_handle_irq, | 723 | .handle_irq = pxa27x_handle_irq, |
723 | .timer = &pxa_timer, | 724 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c index 4bbe9a36fe74..4275713ccd10 100644 --- a/arch/arm/mach-pxa/xcep.c +++ b/arch/arm/mach-pxa/xcep.c | |||
@@ -182,6 +182,7 @@ MACHINE_START(XCEP, "Iskratel XCEP") | |||
182 | .atag_offset = 0x100, | 182 | .atag_offset = 0x100, |
183 | .init_machine = xcep_init, | 183 | .init_machine = xcep_init, |
184 | .map_io = pxa25x_map_io, | 184 | .map_io = pxa25x_map_io, |
185 | .nr_irqs = PXA_NR_IRQS, | ||
185 | .init_irq = pxa25x_init_irq, | 186 | .init_irq = pxa25x_init_irq, |
186 | .handle_irq = pxa25x_handle_irq, | 187 | .handle_irq = pxa25x_handle_irq, |
187 | .timer = &pxa_timer, | 188 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c index b6476848b561..fa8619970841 100644 --- a/arch/arm/mach-pxa/z2.c +++ b/arch/arm/mach-pxa/z2.c | |||
@@ -721,6 +721,7 @@ static void __init z2_init(void) | |||
721 | MACHINE_START(ZIPIT2, "Zipit Z2") | 721 | MACHINE_START(ZIPIT2, "Zipit Z2") |
722 | .atag_offset = 0x100, | 722 | .atag_offset = 0x100, |
723 | .map_io = pxa27x_map_io, | 723 | .map_io = pxa27x_map_io, |
724 | .nr_irqs = PXA_NR_IRQS, | ||
724 | .init_irq = pxa27x_init_irq, | 725 | .init_irq = pxa27x_init_irq, |
725 | .handle_irq = pxa27x_handle_irq, | 726 | .handle_irq = pxa27x_handle_irq, |
726 | .timer = &pxa_timer, | 727 | .timer = &pxa_timer, |
diff --git a/arch/arm/mach-realview/include/mach/hardware.h b/arch/arm/mach-realview/include/mach/hardware.h index 8a638d15797f..281e71c97525 100644 --- a/arch/arm/mach-realview/include/mach/hardware.h +++ b/arch/arm/mach-realview/include/mach/hardware.h | |||
@@ -37,6 +37,6 @@ | |||
37 | #else | 37 | #else |
38 | #define IO_ADDRESS(x) (x) | 38 | #define IO_ADDRESS(x) (x) |
39 | #endif | 39 | #endif |
40 | #define __io_address(n) __io(IO_ADDRESS(n)) | 40 | #define __io_address(n) IOMEM(IO_ADDRESS(n)) |
41 | 41 | ||
42 | #endif | 42 | #endif |
diff --git a/arch/arm/mach-realview/include/mach/io.h b/arch/arm/mach-realview/include/mach/io.h deleted file mode 100644 index f05bcdf605d8..000000000000 --- a/arch/arm/mach-realview/include/mach/io.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-realview/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 ARM Limited | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define IO_SPACE_LIMIT 0xffffffff | ||
24 | |||
25 | #define __io(a) __typesafe_io(a) | ||
26 | #define __mem_pci(a) (a) | ||
27 | |||
28 | #endif | ||
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h index 050d63c74cc1..257166b21f3d 100644 --- a/arch/arm/mach-rpc/include/mach/hardware.h +++ b/arch/arm/mach-rpc/include/mach/hardware.h | |||
@@ -14,12 +14,6 @@ | |||
14 | 14 | ||
15 | #include <mach/memory.h> | 15 | #include <mach/memory.h> |
16 | 16 | ||
17 | #ifndef __ASSEMBLY__ | ||
18 | #define IOMEM(x) ((void __iomem *)(unsigned long)(x)) | ||
19 | #else | ||
20 | #define IOMEM(x) x | ||
21 | #endif /* __ASSEMBLY__ */ | ||
22 | |||
23 | /* | 17 | /* |
24 | * What hardware must be present | 18 | * What hardware must be present |
25 | */ | 19 | */ |
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h index 695f4ed2e11b..707071a7ea4e 100644 --- a/arch/arm/mach-rpc/include/mach/io.h +++ b/arch/arm/mach-rpc/include/mach/io.h | |||
@@ -28,9 +28,4 @@ | |||
28 | */ | 28 | */ |
29 | #define __io(a) (PCIO_BASE + ((a) << 2)) | 29 | #define __io(a) (PCIO_BASE + ((a) << 2)) |
30 | 30 | ||
31 | /* | ||
32 | * 1:1 mapping for ioremapped regions. | ||
33 | */ | ||
34 | #define __mem_pci(x) (x) | ||
35 | |||
36 | #endif | 31 | #endif |
diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h index 118749f37c4c..5dd1db4e2677 100644 --- a/arch/arm/mach-s3c24xx/include/mach/io.h +++ b/arch/arm/mach-s3c24xx/include/mach/io.h | |||
@@ -208,9 +208,4 @@ DECLARE_IO(int,l,"") | |||
208 | #define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l) | 208 | #define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l) |
209 | #define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l) | 209 | #define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l) |
210 | 210 | ||
211 | /* | ||
212 | * 1:1 mapping for ioremapped regions. | ||
213 | */ | ||
214 | #define __mem_pci(x) (x) | ||
215 | |||
216 | #endif | 211 | #endif |
diff --git a/arch/arm/mach-s3c64xx/include/mach/io.h b/arch/arm/mach-s3c64xx/include/mach/io.h deleted file mode 100644 index de5716dbbd65..000000000000 --- a/arch/arm/mach-s3c64xx/include/mach/io.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* arch/arm/mach-s3c64xxinclude/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben-linux@fluff.org> | ||
5 | * | ||
6 | * Default IO routines for S3C64XX based | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_ARM_ARCH_IO_H | ||
10 | #define __ASM_ARM_ARCH_IO_H | ||
11 | |||
12 | /* No current ISA/PCI bus support. */ | ||
13 | #define __io(a) __typesafe_io(a) | ||
14 | #define __mem_pci(a) (a) | ||
15 | |||
16 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
17 | |||
18 | #endif | ||
diff --git a/arch/arm/mach-s5p64x0/include/mach/io.h b/arch/arm/mach-s5p64x0/include/mach/io.h deleted file mode 100644 index a3e095c02fb5..000000000000 --- a/arch/arm/mach-s5p64x0/include/mach/io.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/include/mach/io.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2008 Simtec Electronics | ||
7 | * Ben Dooks <ben-linux@fluff.org> | ||
8 | * | ||
9 | * Default IO routines for S5P64X0 based | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASM_ARM_ARCH_IO_H | ||
17 | #define __ASM_ARM_ARCH_IO_H | ||
18 | |||
19 | /* No current ISA/PCI bus support. */ | ||
20 | #define __io(a) __typesafe_io(a) | ||
21 | #define __mem_pci(a) (a) | ||
22 | |||
23 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
24 | |||
25 | #endif | ||
diff --git a/arch/arm/mach-s5pc100/include/mach/io.h b/arch/arm/mach-s5pc100/include/mach/io.h deleted file mode 100644 index 819acf5eaf89..000000000000 --- a/arch/arm/mach-s5pc100/include/mach/io.h +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* arch/arm/mach-s5pc100/include/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben-linux@fluff.org> | ||
5 | * | ||
6 | * Default IO routines for S5PC100 systems | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_ARM_ARCH_IO_H | ||
10 | #define __ASM_ARM_ARCH_IO_H | ||
11 | |||
12 | /* No current ISA/PCI bus support. */ | ||
13 | #define __io(a) __typesafe_io(a) | ||
14 | #define __mem_pci(a) (a) | ||
15 | |||
16 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
17 | |||
18 | #endif | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/io.h b/arch/arm/mach-s5pv210/include/mach/io.h deleted file mode 100644 index 5ab9d560bc86..000000000000 --- a/arch/arm/mach-s5pv210/include/mach/io.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
6 | * http://www.samsung.com/ | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6442/include/mach/io.h | ||
9 | * | ||
10 | * Default IO routines for S5PV210 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARM_ARCH_IO_H | ||
18 | #define __ASM_ARM_ARCH_IO_H __FILE__ | ||
19 | |||
20 | /* No current ISA/PCI bus support. */ | ||
21 | #define __io(a) __typesafe_io(a) | ||
22 | #define __mem_pci(a) (a) | ||
23 | |||
24 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
25 | |||
26 | #endif /* __ASM_ARM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h deleted file mode 100644 index dfc27ff08344..000000000000 --- a/arch/arm/mach-sa1100/include/mach/io.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-sa1100/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 1997-1999 Russell King | ||
5 | * | ||
6 | * Modifications: | ||
7 | * 06-12-1997 RMK Created. | ||
8 | * 07-04-1999 RMK Major cleanup | ||
9 | */ | ||
10 | #ifndef __ASM_ARM_ARCH_IO_H | ||
11 | #define __ASM_ARM_ARCH_IO_H | ||
12 | |||
13 | /* | ||
14 | * __io() is required to be an equivalent mapping to __mem_pci() for | ||
15 | * SOC_COMMON to work. | ||
16 | */ | ||
17 | #define __io(a) __typesafe_io(a) | ||
18 | #define __mem_pci(a) (a) | ||
19 | |||
20 | #endif | ||
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h index 9ccbcecc430b..1a45fc01ff1d 100644 --- a/arch/arm/mach-shark/include/mach/io.h +++ b/arch/arm/mach-shark/include/mach/io.h | |||
@@ -15,6 +15,4 @@ | |||
15 | 15 | ||
16 | #define __io(a) ((void __iomem *)(0xe0000000 + (a))) | 16 | #define __io(a) ((void __iomem *)(0xe0000000 + (a))) |
17 | 17 | ||
18 | #define __mem_pci(addr) (addr) | ||
19 | |||
20 | #endif | 18 | #endif |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 060e5644c49c..34560cab45d9 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -100,6 +100,10 @@ config MACH_MARZEN | |||
100 | 100 | ||
101 | comment "SH-Mobile System Configuration" | 101 | comment "SH-Mobile System Configuration" |
102 | 102 | ||
103 | config CPU_HAS_INTEVT | ||
104 | bool | ||
105 | default y | ||
106 | |||
103 | menu "Memory configuration" | 107 | menu "Memory configuration" |
104 | 108 | ||
105 | config MEMORY_START | 109 | config MEMORY_START |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index f50d7c8b1221..cb224a344af0 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <video/sh_mipi_dsi.h> | 43 | #include <video/sh_mipi_dsi.h> |
44 | #include <sound/sh_fsi.h> | 44 | #include <sound/sh_fsi.h> |
45 | #include <mach/hardware.h> | 45 | #include <mach/hardware.h> |
46 | #include <mach/irqs.h> | ||
46 | #include <mach/sh73a0.h> | 47 | #include <mach/sh73a0.h> |
47 | #include <mach/common.h> | 48 | #include <mach/common.h> |
48 | #include <asm/mach-types.h> | 49 | #include <asm/mach-types.h> |
@@ -584,7 +585,7 @@ static void __init ag5evm_init(void) | |||
584 | 585 | ||
585 | #ifdef CONFIG_CACHE_L2X0 | 586 | #ifdef CONFIG_CACHE_L2X0 |
586 | /* Shared attribute override enable, 64K*8way */ | 587 | /* Shared attribute override enable, 64K*8way */ |
587 | l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); | 588 | l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff); |
588 | #endif | 589 | #endif |
589 | sh73a0_add_standard_devices(); | 590 | sh73a0_add_standard_devices(); |
590 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); | 591 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); |
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c index 8b2124da245d..81fd95f7f52a 100644 --- a/arch/arm/mach-shmobile/board-bonito.c +++ b/arch/arm/mach-shmobile/board-bonito.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/mach/time.h> | 35 | #include <asm/mach/time.h> |
36 | #include <asm/hardware/cache-l2x0.h> | 36 | #include <asm/hardware/cache-l2x0.h> |
37 | #include <mach/r8a7740.h> | 37 | #include <mach/r8a7740.h> |
38 | #include <mach/irqs.h> | ||
38 | #include <video/sh_mobile_lcdc.h> | 39 | #include <video/sh_mobile_lcdc.h> |
39 | 40 | ||
40 | /* | 41 | /* |
@@ -370,7 +371,7 @@ static void __init bonito_init(void) | |||
370 | 371 | ||
371 | #ifdef CONFIG_CACHE_L2X0 | 372 | #ifdef CONFIG_CACHE_L2X0 |
372 | /* Early BRESP enable, Shared attribute override enable, 32K*8way */ | 373 | /* Early BRESP enable, Shared attribute override enable, 32K*8way */ |
373 | l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff); | 374 | l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff); |
374 | #endif | 375 | #endif |
375 | 376 | ||
376 | r8a7740_add_standard_devices(); | 377 | r8a7740_add_standard_devices(); |
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c index b627e89037f5..39b6cf85ced6 100644 --- a/arch/arm/mach-shmobile/board-g3evm.c +++ b/arch/arm/mach-shmobile/board-g3evm.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/input.h> | 33 | #include <linux/input.h> |
34 | #include <linux/input/sh_keysc.h> | 34 | #include <linux/input/sh_keysc.h> |
35 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
36 | #include <mach/irqs.h> | ||
36 | #include <mach/sh7367.h> | 37 | #include <mach/sh7367.h> |
37 | #include <mach/common.h> | 38 | #include <mach/common.h> |
38 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index 46d757d2759d..0e5a39c670bc 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/mmc/sh_mobile_sdhi.h> | 34 | #include <linux/mmc/sh_mobile_sdhi.h> |
35 | #include <linux/gpio.h> | 35 | #include <linux/gpio.h> |
36 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
37 | #include <mach/irqs.h> | ||
37 | #include <mach/sh7377.h> | 38 | #include <mach/sh7377.h> |
38 | #include <mach/common.h> | 39 | #include <mach/common.h> |
39 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c index 61c067294660..200dcd42a3a0 100644 --- a/arch/arm/mach-shmobile/board-kota2.c +++ b/arch/arm/mach-shmobile/board-kota2.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mfd/tmio.h> | 39 | #include <linux/mfd/tmio.h> |
40 | #include <linux/mmc/sh_mobile_sdhi.h> | 40 | #include <linux/mmc/sh_mobile_sdhi.h> |
41 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
42 | #include <mach/irqs.h> | ||
42 | #include <mach/sh73a0.h> | 43 | #include <mach/sh73a0.h> |
43 | #include <mach/common.h> | 44 | #include <mach/common.h> |
44 | #include <asm/mach-types.h> | 45 | #include <asm/mach-types.h> |
@@ -507,7 +508,7 @@ static void __init kota2_init(void) | |||
507 | 508 | ||
508 | #ifdef CONFIG_CACHE_L2X0 | 509 | #ifdef CONFIG_CACHE_L2X0 |
509 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ | 510 | /* Early BRESP enable, Shared attribute override enable, 64K*8way */ |
510 | l2x0_init(__io(0xf0100000), 0x40460000, 0x82000fff); | 511 | l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); |
511 | #endif | 512 | #endif |
512 | sh73a0_add_standard_devices(); | 513 | sh73a0_add_standard_devices(); |
513 | platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); | 514 | platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index ca609502d6cd..a125d4e114ec 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <sound/sh_fsi.h> | 54 | #include <sound/sh_fsi.h> |
55 | 55 | ||
56 | #include <mach/common.h> | 56 | #include <mach/common.h> |
57 | #include <mach/irqs.h> | ||
57 | #include <mach/sh7372.h> | 58 | #include <mach/sh7372.h> |
58 | 59 | ||
59 | #include <asm/mach/arch.h> | 60 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index cbd5e4cd06d2..ef0e13bf0b3a 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/r8a7779.h> | 32 | #include <mach/r8a7779.h> |
33 | #include <mach/common.h> | 33 | #include <mach/common.h> |
34 | #include <mach/irqs.h> | ||
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
36 | #include <asm/hardware/gic.h> | 37 | #include <asm/hardware/gic.h> |
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c index 21b09b6455e4..7e6559105d40 100644 --- a/arch/arm/mach-shmobile/cpuidle.c +++ b/arch/arm/mach-shmobile/cpuidle.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/suspend.h> | 13 | #include <linux/suspend.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/err.h> | 15 | #include <linux/err.h> |
16 | #include <asm/cpuidle.h> | ||
16 | #include <asm/io.h> | 17 | #include <asm/io.h> |
17 | 18 | ||
18 | static void shmobile_enter_wfi(void) | 19 | static void shmobile_enter_wfi(void) |
@@ -28,37 +29,19 @@ static int shmobile_cpuidle_enter(struct cpuidle_device *dev, | |||
28 | struct cpuidle_driver *drv, | 29 | struct cpuidle_driver *drv, |
29 | int index) | 30 | int index) |
30 | { | 31 | { |
31 | ktime_t before, after; | ||
32 | |||
33 | before = ktime_get(); | ||
34 | |||
35 | local_irq_disable(); | ||
36 | local_fiq_disable(); | ||
37 | |||
38 | shmobile_cpuidle_modes[index](); | 32 | shmobile_cpuidle_modes[index](); |
39 | 33 | ||
40 | local_irq_enable(); | ||
41 | local_fiq_enable(); | ||
42 | |||
43 | after = ktime_get(); | ||
44 | dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10; | ||
45 | |||
46 | return index; | 34 | return index; |
47 | } | 35 | } |
48 | 36 | ||
49 | static struct cpuidle_device shmobile_cpuidle_dev; | 37 | static struct cpuidle_device shmobile_cpuidle_dev; |
50 | static struct cpuidle_driver shmobile_cpuidle_driver = { | 38 | static struct cpuidle_driver shmobile_cpuidle_driver = { |
51 | .name = "shmobile_cpuidle", | 39 | .name = "shmobile_cpuidle", |
52 | .owner = THIS_MODULE, | 40 | .owner = THIS_MODULE, |
53 | .states[0] = { | 41 | .en_core_tk_irqen = 1, |
54 | .name = "C1", | 42 | .states[0] = ARM_CPUIDLE_WFI_STATE, |
55 | .desc = "WFI", | 43 | .safe_state_index = 0, /* C1 */ |
56 | .exit_latency = 1, | 44 | .state_count = 1, |
57 | .target_residency = 1 * 2, | ||
58 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
59 | }, | ||
60 | .safe_state_index = 0, /* C1 */ | ||
61 | .state_count = 1, | ||
62 | }; | 45 | }; |
63 | 46 | ||
64 | void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); | 47 | void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); |
diff --git a/arch/arm/mach-shmobile/include/mach/io.h b/arch/arm/mach-shmobile/include/mach/io.h deleted file mode 100644 index 7339fe46cb7c..000000000000 --- a/arch/arm/mach-shmobile/include/mach/io.h +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #ifndef __ASM_MACH_IO_H | ||
2 | #define __ASM_MACH_IO_H | ||
3 | |||
4 | #define IO_SPACE_LIMIT 0xffffffff | ||
5 | |||
6 | #define __io(a) ((void __iomem *)(a)) | ||
7 | #define __mem_pci(a) (a) | ||
8 | |||
9 | #endif /* __ASM_MACH_IO_H */ | ||
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h index dcb714f4d75a..4e686cc201fc 100644 --- a/arch/arm/mach-shmobile/include/mach/irqs.h +++ b/arch/arm/mach-shmobile/include/mach/irqs.h | |||
@@ -1,15 +1,11 @@ | |||
1 | #ifndef __ASM_MACH_IRQS_H | 1 | #ifndef __ASM_MACH_IRQS_H |
2 | #define __ASM_MACH_IRQS_H | 2 | #define __ASM_MACH_IRQS_H |
3 | 3 | ||
4 | #define NR_IRQS 1024 | 4 | #include <linux/sh_intc.h> |
5 | 5 | ||
6 | /* GIC */ | 6 | /* GIC */ |
7 | #define gic_spi(nr) ((nr) + 32) | 7 | #define gic_spi(nr) ((nr) + 32) |
8 | 8 | ||
9 | /* INTCA */ | ||
10 | #define evt2irq(evt) (((evt) >> 5) - 16) | ||
11 | #define irq2evt(irq) (((irq) + 16) << 5) | ||
12 | |||
13 | /* INTCS */ | 9 | /* INTCS */ |
14 | #define INTCS_VECT_BASE 0x2200 | 10 | #define INTCS_VECT_BASE 0x2200 |
15 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) | 11 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) |
diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c index 272c84c20c83..09c42afcb22d 100644 --- a/arch/arm/mach-shmobile/intc-r8a7740.c +++ b/arch/arm/mach-shmobile/intc-r8a7740.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/sh_intc.h> | 26 | #include <linux/sh_intc.h> |
27 | #include <mach/intc.h> | 27 | #include <mach/intc.h> |
28 | #include <mach/irqs.h> | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
30 | 31 | ||
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c index 5d92fcde2bc3..550b23df4fd4 100644 --- a/arch/arm/mach-shmobile/intc-r8a7779.c +++ b/arch/arm/mach-shmobile/intc-r8a7779.c | |||
@@ -42,8 +42,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on) | |||
42 | 42 | ||
43 | void __init r8a7779_init_irq(void) | 43 | void __init r8a7779_init_irq(void) |
44 | { | 44 | { |
45 | void __iomem *gic_dist_base = __io(0xf0001000); | 45 | void __iomem *gic_dist_base = IOMEM(0xf0001000); |
46 | void __iomem *gic_cpu_base = __io(0xf0000100); | 46 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); |
47 | 47 | ||
48 | /* use GIC to handle interrupts */ | 48 | /* use GIC to handle interrupts */ |
49 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | 49 | gic_init(0, 29, gic_dist_base, gic_cpu_base); |
diff --git a/arch/arm/mach-shmobile/intc-sh7367.c b/arch/arm/mach-shmobile/intc-sh7367.c index cfde9bfc3669..5bf776495b75 100644 --- a/arch/arm/mach-shmobile/intc-sh7367.c +++ b/arch/arm/mach-shmobile/intc-sh7367.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/sh_intc.h> | 24 | #include <linux/sh_intc.h> |
25 | #include <mach/intc.h> | 25 | #include <mach/intc.h> |
26 | #include <mach/irqs.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | 29 | ||
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c index 89afcaba99a1..6447e0af52d4 100644 --- a/arch/arm/mach-shmobile/intc-sh7372.c +++ b/arch/arm/mach-shmobile/intc-sh7372.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/sh_intc.h> | 24 | #include <linux/sh_intc.h> |
25 | #include <mach/intc.h> | 25 | #include <mach/intc.h> |
26 | #include <mach/irqs.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | 29 | ||
diff --git a/arch/arm/mach-shmobile/intc-sh7377.c b/arch/arm/mach-shmobile/intc-sh7377.c index 2af4e6e9bc5b..b84a460a3405 100644 --- a/arch/arm/mach-shmobile/intc-sh7377.c +++ b/arch/arm/mach-shmobile/intc-sh7377.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/sh_intc.h> | 24 | #include <linux/sh_intc.h> |
25 | #include <mach/intc.h> | 25 | #include <mach/intc.h> |
26 | #include <mach/irqs.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
28 | 29 | ||
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c index 9857595eaa79..ee447404c857 100644 --- a/arch/arm/mach-shmobile/intc-sh73a0.c +++ b/arch/arm/mach-shmobile/intc-sh73a0.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/sh_intc.h> | 25 | #include <linux/sh_intc.h> |
26 | #include <mach/intc.h> | 26 | #include <mach/intc.h> |
27 | #include <mach/irqs.h> | ||
27 | #include <mach/sh73a0.h> | 28 | #include <mach/sh73a0.h> |
28 | #include <asm/hardware/gic.h> | 29 | #include <asm/hardware/gic.h> |
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
@@ -420,8 +421,8 @@ static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id) | |||
420 | 421 | ||
421 | void __init sh73a0_init_irq(void) | 422 | void __init sh73a0_init_irq(void) |
422 | { | 423 | { |
423 | void __iomem *gic_dist_base = __io(0xf0001000); | 424 | void __iomem *gic_dist_base = IOMEM(0xf0001000); |
424 | void __iomem *gic_cpu_base = __io(0xf0000100); | 425 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); |
425 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); | 426 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); |
426 | int k, n; | 427 | int k, n; |
427 | 428 | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 74e52341dd1b..14edb5cffa7f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/sh_timer.h> | 26 | #include <linux/sh_timer.h> |
27 | #include <mach/r8a7740.h> | 27 | #include <mach/r8a7740.h> |
28 | #include <mach/common.h> | 28 | #include <mach/common.h> |
29 | #include <mach/irqs.h> | ||
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
30 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index 6820d785493d..12c6f529ab89 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sh_intc.h> | 29 | #include <linux/sh_intc.h> |
30 | #include <linux/sh_timer.h> | 30 | #include <linux/sh_timer.h> |
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/irqs.h> | ||
32 | #include <mach/r8a7779.h> | 33 | #include <mach/r8a7779.h> |
33 | #include <mach/common.h> | 34 | #include <mach/common.h> |
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c index a51e1a1e6996..2e3074ab75b3 100644 --- a/arch/arm/mach-shmobile/setup-sh7367.c +++ b/arch/arm/mach-shmobile/setup-sh7367.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/sh_timer.h> | 30 | #include <linux/sh_timer.h> |
31 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
32 | #include <mach/common.h> | 32 | #include <mach/common.h> |
33 | #include <mach/irqs.h> | ||
33 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
34 | #include <asm/mach/arch.h> | 35 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/map.h> | 36 | #include <asm/mach/map.h> |
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index 4e818b7de781..2fe8f83ca124 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pm_domain.h> | 33 | #include <linux/pm_domain.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <mach/irqs.h> | ||
36 | #include <mach/sh7372.h> | 37 | #include <mach/sh7372.h> |
37 | #include <mach/common.h> | 38 | #include <mach/common.h> |
38 | #include <asm/mach/map.h> | 39 | #include <asm/mach/map.h> |
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c index 9f146095098b..d576a6abbade 100644 --- a/arch/arm/mach-shmobile/setup-sh7377.c +++ b/arch/arm/mach-shmobile/setup-sh7377.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
33 | #include <mach/common.h> | 33 | #include <mach/common.h> |
34 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
35 | #include <mach/irqs.h> | ||
35 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
36 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
37 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index b6a0734a738e..5bebffc10455 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/sh_intc.h> | 31 | #include <linux/sh_intc.h> |
32 | #include <linux/sh_timer.h> | 32 | #include <linux/sh_timer.h> |
33 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
34 | #include <mach/irqs.h> | ||
34 | #include <mach/sh73a0.h> | 35 | #include <mach/sh73a0.h> |
35 | #include <mach/common.h> | 36 | #include <mach/common.h> |
36 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c index 9bb7b8575a1f..b62e19d4c9af 100644 --- a/arch/arm/mach-shmobile/smp-r8a7779.c +++ b/arch/arm/mach-shmobile/smp-r8a7779.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/smp_twd.h> | 30 | #include <asm/smp_twd.h> |
31 | #include <asm/hardware/gic.h> | 31 | #include <asm/hardware/gic.h> |
32 | 32 | ||
33 | #define AVECR 0xfe700040 | 33 | #define AVECR IOMEM(0xfe700040) |
34 | 34 | ||
35 | static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { | 35 | static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { |
36 | .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ | 36 | .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ |
@@ -138,7 +138,7 @@ void __init r8a7779_smp_prepare_cpus(void) | |||
138 | scu_enable(scu_base_addr()); | 138 | scu_enable(scu_base_addr()); |
139 | 139 | ||
140 | /* Map the reset vector (in headsmp.S) */ | 140 | /* Map the reset vector (in headsmp.S) */ |
141 | __raw_writel(__pa(shmobile_secondary_vector), __io(AVECR)); | 141 | __raw_writel(__pa(shmobile_secondary_vector), AVECR); |
142 | 142 | ||
143 | /* enable cache coherency on CPU0 */ | 143 | /* enable cache coherency on CPU0 */ |
144 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | 144 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); |
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c index c0a9093ba3a8..14ad8b052f1a 100644 --- a/arch/arm/mach-shmobile/smp-sh73a0.c +++ b/arch/arm/mach-shmobile/smp-sh73a0.c | |||
@@ -28,11 +28,11 @@ | |||
28 | #include <asm/smp_twd.h> | 28 | #include <asm/smp_twd.h> |
29 | #include <asm/hardware/gic.h> | 29 | #include <asm/hardware/gic.h> |
30 | 30 | ||
31 | #define WUPCR 0xe6151010 | 31 | #define WUPCR IOMEM(0xe6151010) |
32 | #define SRESCR 0xe6151018 | 32 | #define SRESCR IOMEM(0xe6151018) |
33 | #define PSTR 0xe6151040 | 33 | #define PSTR IOMEM(0xe6151040) |
34 | #define SBAR 0xe6180020 | 34 | #define SBAR IOMEM(0xe6180020) |
35 | #define APARMBAREA 0xe6f10020 | 35 | #define APARMBAREA IOMEM(0xe6f10020) |
36 | 36 | ||
37 | static void __iomem *scu_base_addr(void) | 37 | static void __iomem *scu_base_addr(void) |
38 | { | 38 | { |
@@ -78,10 +78,10 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu) | |||
78 | /* enable cache coherency */ | 78 | /* enable cache coherency */ |
79 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | 79 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); |
80 | 80 | ||
81 | if (((__raw_readl(__io(PSTR)) >> (4 * cpu)) & 3) == 3) | 81 | if (((__raw_readl(PSTR) >> (4 * cpu)) & 3) == 3) |
82 | __raw_writel(1 << cpu, __io(WUPCR)); /* wake up */ | 82 | __raw_writel(1 << cpu, WUPCR); /* wake up */ |
83 | else | 83 | else |
84 | __raw_writel(1 << cpu, __io(SRESCR)); /* reset */ | 84 | __raw_writel(1 << cpu, SRESCR); /* reset */ |
85 | 85 | ||
86 | return 0; | 86 | return 0; |
87 | } | 87 | } |
@@ -93,8 +93,8 @@ void __init sh73a0_smp_prepare_cpus(void) | |||
93 | scu_enable(scu_base_addr()); | 93 | scu_enable(scu_base_addr()); |
94 | 94 | ||
95 | /* Map the reset vector (in headsmp.S) */ | 95 | /* Map the reset vector (in headsmp.S) */ |
96 | __raw_writel(0, __io(APARMBAREA)); /* 4k */ | 96 | __raw_writel(0, APARMBAREA); /* 4k */ |
97 | __raw_writel(__pa(shmobile_secondary_vector), __io(SBAR)); | 97 | __raw_writel(__pa(shmobile_secondary_vector), SBAR); |
98 | 98 | ||
99 | /* enable cache coherency on CPU0 */ | 99 | /* enable cache coherency on CPU0 */ |
100 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | 100 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); |
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c index f67860cd649f..6c4841f55223 100644 --- a/arch/arm/mach-spear3xx/clock.c +++ b/arch/arm/mach-spear3xx/clock.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/io.h> | ||
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
17 | #include <plat/clock.h> | 18 | #include <plat/clock.h> |
diff --git a/arch/arm/mach-spear3xx/include/mach/io.h b/arch/arm/mach-spear3xx/include/mach/io.h deleted file mode 100644 index 30cff8a1f6b5..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/io.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for SPEAr3xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar<viresh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_IO_H | ||
15 | #define __MACH_IO_H | ||
16 | |||
17 | #include <plat/io.h> | ||
18 | |||
19 | #endif /* __MACH_IO_H */ | ||
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c index 358f2800f17b..a86499a8a15f 100644 --- a/arch/arm/mach-spear6xx/clock.c +++ b/arch/arm/mach-spear6xx/clock.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/io.h> | ||
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <plat/clock.h> | 17 | #include <plat/clock.h> |
17 | #include <mach/misc_regs.h> | 18 | #include <mach/misc_regs.h> |
diff --git a/arch/arm/mach-spear6xx/include/mach/io.h b/arch/arm/mach-spear6xx/include/mach/io.h deleted file mode 100644 index fb7c106cea94..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/io.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/io.h | ||
3 | * | ||
4 | * IO definitions for SPEAr6xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_IO_H | ||
15 | #define __MACH_IO_H | ||
16 | |||
17 | #include <plat/io.h> | ||
18 | |||
19 | #endif /* __MACH_IO_H */ | ||
20 | |||
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S index 90069abd37bd..8ce0661b8a3d 100644 --- a/arch/arm/mach-tegra/include/mach/debug-macro.S +++ b/arch/arm/mach-tegra/include/mach/debug-macro.S | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <linux/serial_reg.h> | 27 | #include <linux/serial_reg.h> |
28 | 28 | ||
29 | #include <mach/io.h> | ||
30 | #include <mach/iomap.h> | 29 | #include <mach/iomap.h> |
31 | #include <mach/irammap.h> | 30 | #include <mach/irammap.h> |
32 | 31 | ||
diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h index f15defffb5d2..fe700f9ce7dc 100644 --- a/arch/arm/mach-tegra/include/mach/io.h +++ b/arch/arm/mach-tegra/include/mach/io.h | |||
@@ -23,56 +23,8 @@ | |||
23 | 23 | ||
24 | #define IO_SPACE_LIMIT 0xffff | 24 | #define IO_SPACE_LIMIT 0xffff |
25 | 25 | ||
26 | /* On TEGRA, many peripherals are very closely packed in | ||
27 | * two 256MB io windows (that actually only use about 64KB | ||
28 | * at the start of each). | ||
29 | * | ||
30 | * We will just map the first 1MB of each window (to minimize | ||
31 | * pt entries needed) and provide a macro to transform physical | ||
32 | * io addresses to an appropriate void __iomem *. | ||
33 | * | ||
34 | */ | ||
35 | |||
36 | #ifdef __ASSEMBLY__ | ||
37 | #define IOMEM(x) (x) | ||
38 | #else | ||
39 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
40 | #endif | ||
41 | |||
42 | #define IO_IRAM_PHYS 0x40000000 | ||
43 | #define IO_IRAM_VIRT IOMEM(0xFE400000) | ||
44 | #define IO_IRAM_SIZE SZ_256K | ||
45 | |||
46 | #define IO_CPU_PHYS 0x50040000 | ||
47 | #define IO_CPU_VIRT IOMEM(0xFE000000) | ||
48 | #define IO_CPU_SIZE SZ_16K | ||
49 | |||
50 | #define IO_PPSB_PHYS 0x60000000 | ||
51 | #define IO_PPSB_VIRT IOMEM(0xFE200000) | ||
52 | #define IO_PPSB_SIZE SZ_1M | ||
53 | |||
54 | #define IO_APB_PHYS 0x70000000 | ||
55 | #define IO_APB_VIRT IOMEM(0xFE300000) | ||
56 | #define IO_APB_SIZE SZ_1M | ||
57 | |||
58 | #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) | ||
59 | #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst))) | ||
60 | |||
61 | #define IO_TO_VIRT(n) ( \ | ||
62 | IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \ | ||
63 | IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \ | ||
64 | IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \ | ||
65 | IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \ | ||
66 | IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \ | ||
67 | IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \ | ||
68 | IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \ | ||
69 | IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \ | ||
70 | NULL) | ||
71 | |||
72 | #ifndef __ASSEMBLER__ | 26 | #ifndef __ASSEMBLER__ |
73 | 27 | ||
74 | #define IO_ADDRESS(n) (IO_TO_VIRT(n)) | ||
75 | |||
76 | #ifdef CONFIG_TEGRA_PCI | 28 | #ifdef CONFIG_TEGRA_PCI |
77 | extern void __iomem *tegra_pcie_io_base; | 29 | extern void __iomem *tegra_pcie_io_base; |
78 | 30 | ||
@@ -88,7 +40,6 @@ static inline void __iomem *__io(unsigned long addr) | |||
88 | #endif | 40 | #endif |
89 | 41 | ||
90 | #define __io(a) __io(a) | 42 | #define __io(a) __io(a) |
91 | #define __mem_pci(a) (a) | ||
92 | 43 | ||
93 | #endif | 44 | #endif |
94 | 45 | ||
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h index cff672a344f4..7e76da73121c 100644 --- a/arch/arm/mach-tegra/include/mach/iomap.h +++ b/arch/arm/mach-tegra/include/mach/iomap.h | |||
@@ -277,4 +277,46 @@ | |||
277 | # define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE | 277 | # define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE |
278 | #endif | 278 | #endif |
279 | 279 | ||
280 | /* On TEGRA, many peripherals are very closely packed in | ||
281 | * two 256MB io windows (that actually only use about 64KB | ||
282 | * at the start of each). | ||
283 | * | ||
284 | * We will just map the first 1MB of each window (to minimize | ||
285 | * pt entries needed) and provide a macro to transform physical | ||
286 | * io addresses to an appropriate void __iomem *. | ||
287 | * | ||
288 | */ | ||
289 | |||
290 | #define IO_IRAM_PHYS 0x40000000 | ||
291 | #define IO_IRAM_VIRT IOMEM(0xFE400000) | ||
292 | #define IO_IRAM_SIZE SZ_256K | ||
293 | |||
294 | #define IO_CPU_PHYS 0x50040000 | ||
295 | #define IO_CPU_VIRT IOMEM(0xFE000000) | ||
296 | #define IO_CPU_SIZE SZ_16K | ||
297 | |||
298 | #define IO_PPSB_PHYS 0x60000000 | ||
299 | #define IO_PPSB_VIRT IOMEM(0xFE200000) | ||
300 | #define IO_PPSB_SIZE SZ_1M | ||
301 | |||
302 | #define IO_APB_PHYS 0x70000000 | ||
303 | #define IO_APB_VIRT IOMEM(0xFE300000) | ||
304 | #define IO_APB_SIZE SZ_1M | ||
305 | |||
306 | #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) | ||
307 | #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst))) | ||
308 | |||
309 | #define IO_TO_VIRT(n) ( \ | ||
310 | IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \ | ||
311 | IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \ | ||
312 | IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \ | ||
313 | IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \ | ||
314 | IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \ | ||
315 | IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \ | ||
316 | IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \ | ||
317 | IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \ | ||
318 | NULL) | ||
319 | |||
320 | #define IO_ADDRESS(n) (IO_TO_VIRT(n)) | ||
321 | |||
280 | #endif | 322 | #endif |
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c index d23ee2db2827..58b4baf9c483 100644 --- a/arch/arm/mach-tegra/io.c +++ b/arch/arm/mach-tegra/io.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <asm/page.h> | 27 | #include <asm/page.h> |
28 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
29 | #include <mach/iomap.h> | ||
29 | 30 | ||
30 | #include "board.h" | 31 | #include "board.h" |
31 | 32 | ||
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S index 8f9fde161c34..5b20197bae7f 100644 --- a/arch/arm/mach-tegra/sleep.S +++ b/arch/arm/mach-tegra/sleep.S | |||
@@ -23,7 +23,9 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/linkage.h> | 25 | #include <linux/linkage.h> |
26 | #include <mach/io.h> | 26 | |
27 | #include <asm/assembler.h> | ||
28 | |||
27 | #include <mach/iomap.h> | 29 | #include <mach/iomap.h> |
28 | 30 | ||
29 | #include "flowctrl.h" | 31 | #include "flowctrl.h" |
diff --git a/arch/arm/mach-u300/include/mach/io.h b/arch/arm/mach-u300/include/mach/io.h deleted file mode 100644 index 5d6b4c13b3a0..000000000000 --- a/arch/arm/mach-u300/include/mach/io.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * arch/arm/mach-u300/include/mach/io.h | ||
4 | * | ||
5 | * | ||
6 | * Copyright (C) 2006-2009 ST-Ericsson AB | ||
7 | * License terms: GNU General Public License (GPL) version 2 | ||
8 | * Dummy IO map for being able to use writew()/readw(), | ||
9 | * writel()/readw() and similar accessor functions. | ||
10 | * Author: Linus Walleij <linus.walleij@stericsson.com> | ||
11 | */ | ||
12 | #ifndef __MACH_IO_H | ||
13 | #define __MACH_IO_H | ||
14 | |||
15 | #define IO_SPACE_LIMIT 0xffffffff | ||
16 | |||
17 | #define __io(a) __typesafe_io(a) | ||
18 | #define __mem_pci(a) (a) | ||
19 | |||
20 | #endif | ||
diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h index 035fdc9dbdb0..7b7cba960b69 100644 --- a/arch/arm/mach-u300/include/mach/u300-regs.h +++ b/arch/arm/mach-u300/include/mach/u300-regs.h | |||
@@ -18,12 +18,6 @@ | |||
18 | * the defines are used for setting up the I/O memory mapping. | 18 | * the defines are used for setting up the I/O memory mapping. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifdef __ASSEMBLER__ | ||
22 | #define IOMEM(a) (a) | ||
23 | #else | ||
24 | #define IOMEM(a) (void __iomem *) a | ||
25 | #endif | ||
26 | |||
27 | /* NAND Flash CS0 */ | 21 | /* NAND Flash CS0 */ |
28 | #define U300_NAND_CS0_PHYS_BASE 0x80000000 | 22 | #define U300_NAND_CS0_PHYS_BASE 0x80000000 |
29 | 23 | ||
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h index d93d6dbef25b..f84698936d36 100644 --- a/arch/arm/mach-ux500/include/mach/hardware.h +++ b/arch/arm/mach-ux500/include/mach/hardware.h | |||
@@ -23,7 +23,7 @@ | |||
23 | (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL) | 23 | (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL) |
24 | 24 | ||
25 | /* typesafe io address */ | 25 | /* typesafe io address */ |
26 | #define __io_address(n) __io(IO_ADDRESS(n)) | 26 | #define __io_address(n) IOMEM(IO_ADDRESS(n)) |
27 | /* Used by some plat-nomadik code */ | 27 | /* Used by some plat-nomadik code */ |
28 | #define io_p2v(n) __io_address(n) | 28 | #define io_p2v(n) __io_address(n) |
29 | 29 | ||
diff --git a/arch/arm/mach-ux500/include/mach/io.h b/arch/arm/mach-ux500/include/mach/io.h deleted file mode 100644 index 1cf3f44ce5b2..000000000000 --- a/arch/arm/mach-ux500/include/mach/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-u8500/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 1997-1999 Russell King | ||
5 | * | ||
6 | * Modifications: | ||
7 | * 06-12-1997 RMK Created. | ||
8 | * 07-04-1999 RMK Major cleanup | ||
9 | */ | ||
10 | #ifndef __ASM_ARM_ARCH_IO_H | ||
11 | #define __ASM_ARM_ARCH_IO_H | ||
12 | |||
13 | #define IO_SPACE_LIMIT 0xffffffff | ||
14 | |||
15 | /* | ||
16 | * We don't actually have real ISA nor PCI buses, but there is so many | ||
17 | * drivers out there that might just work if we fake them... | ||
18 | */ | ||
19 | #define __io(a) __typesafe_io(a) | ||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif | ||
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h deleted file mode 100644 index f067c14c7182..000000000000 --- a/arch/arm/mach-versatile/include/mach/io.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-versatile/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 ARM Limited | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define IO_SPACE_LIMIT 0xffffffff | ||
24 | |||
25 | #define __io(a) __typesafe_io(a) | ||
26 | #define __mem_pci(a) (a) | ||
27 | |||
28 | #endif | ||
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h deleted file mode 100644 index 13522d86685e..000000000000 --- a/arch/arm/mach-vexpress/include/mach/io.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vexpress/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2003 ARM Limited | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define __io(a) __typesafe_io(a) | ||
24 | #define __mem_pci(a) (a) | ||
25 | |||
26 | #endif | ||
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h deleted file mode 100644 index 46181eecf273..000000000000 --- a/arch/arm/mach-vt8500/include/mach/io.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov | ||
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 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_IO_H | ||
21 | #define __ASM_ARM_ARCH_IO_H | ||
22 | |||
23 | #define __io(a) __typesafe_io((a) + 0xf0000000) | ||
24 | #define __mem_pci(a) (a) | ||
25 | |||
26 | #endif | ||
diff --git a/arch/arm/mach-w90x900/include/mach/io.h b/arch/arm/mach-w90x900/include/mach/io.h deleted file mode 100644 index d96ab99df05b..000000000000 --- a/arch/arm/mach-w90x900/include/mach/io.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/io.h | ||
3 | * | ||
4 | * Copyright (c) 2008 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Wan ZongShun <mcuos.com@gmail.com> | ||
8 | * | ||
9 | * Based on arch/arm/mach-s3c2410/include/mach/io.h | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __ASM_ARM_ARCH_IO_H | ||
19 | #define __ASM_ARM_ARCH_IO_H | ||
20 | |||
21 | #define IO_SPACE_LIMIT 0xffffffff | ||
22 | |||
23 | /* | ||
24 | * 1:1 mapping for ioremapped regions. | ||
25 | */ | ||
26 | |||
27 | #define __mem_pci(a) (a) | ||
28 | #define __io(a) __typesafe_io(a) | ||
29 | |||
30 | #endif | ||
diff --git a/arch/arm/mach-zynq/include/mach/io.h b/arch/arm/mach-zynq/include/mach/io.h deleted file mode 100644 index 39d9885e0e9a..000000000000 --- a/arch/arm/mach-zynq/include/mach/io.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* arch/arm/mach-zynq/include/mach/io.h | ||
2 | * | ||
3 | * Copyright (C) 2011 Xilinx | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef __MACH_IO_H__ | ||
16 | #define __MACH_IO_H__ | ||
17 | |||
18 | /* Allow IO space to be anywhere in the memory */ | ||
19 | |||
20 | #define IO_SPACE_LIMIT 0xffff | ||
21 | |||
22 | /* IO address mapping macros, nothing special at this time but required */ | ||
23 | |||
24 | #ifdef __ASSEMBLER__ | ||
25 | #define IOMEM(x) (x) | ||
26 | #else | ||
27 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
28 | #endif | ||
29 | |||
30 | #define __io(a) __typesafe_io(a) | ||
31 | #define __mem_pci(a) (a) | ||
32 | |||
33 | #endif | ||
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index b1e192ba8c24..a53fd2aaa2f4 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -30,13 +30,13 @@ | |||
30 | 30 | ||
31 | static void __iomem *l2x0_base; | 31 | static void __iomem *l2x0_base; |
32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); | 32 | static DEFINE_RAW_SPINLOCK(l2x0_lock); |
33 | static uint32_t l2x0_way_mask; /* Bitmask of active ways */ | 33 | static u32 l2x0_way_mask; /* Bitmask of active ways */ |
34 | static uint32_t l2x0_size; | 34 | static u32 l2x0_size; |
35 | 35 | ||
36 | struct l2x0_regs l2x0_saved_regs; | 36 | struct l2x0_regs l2x0_saved_regs; |
37 | 37 | ||
38 | struct l2x0_of_data { | 38 | struct l2x0_of_data { |
39 | void (*setup)(const struct device_node *, __u32 *, __u32 *); | 39 | void (*setup)(const struct device_node *, u32 *, u32 *); |
40 | void (*save)(void); | 40 | void (*save)(void); |
41 | void (*resume)(void); | 41 | void (*resume)(void); |
42 | }; | 42 | }; |
@@ -288,7 +288,7 @@ static void l2x0_disable(void) | |||
288 | raw_spin_unlock_irqrestore(&l2x0_lock, flags); | 288 | raw_spin_unlock_irqrestore(&l2x0_lock, flags); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void l2x0_unlock(__u32 cache_id) | 291 | static void l2x0_unlock(u32 cache_id) |
292 | { | 292 | { |
293 | int lockregs; | 293 | int lockregs; |
294 | int i; | 294 | int i; |
@@ -307,11 +307,11 @@ static void l2x0_unlock(__u32 cache_id) | |||
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) | 310 | void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) |
311 | { | 311 | { |
312 | __u32 aux; | 312 | u32 aux; |
313 | __u32 cache_id; | 313 | u32 cache_id; |
314 | __u32 way_size = 0; | 314 | u32 way_size = 0; |
315 | int ways; | 315 | int ways; |
316 | const char *type; | 316 | const char *type; |
317 | 317 | ||
@@ -388,7 +388,7 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) | |||
388 | 388 | ||
389 | #ifdef CONFIG_OF | 389 | #ifdef CONFIG_OF |
390 | static void __init l2x0_of_setup(const struct device_node *np, | 390 | static void __init l2x0_of_setup(const struct device_node *np, |
391 | __u32 *aux_val, __u32 *aux_mask) | 391 | u32 *aux_val, u32 *aux_mask) |
392 | { | 392 | { |
393 | u32 data[2] = { 0, 0 }; | 393 | u32 data[2] = { 0, 0 }; |
394 | u32 tag = 0; | 394 | u32 tag = 0; |
@@ -422,7 +422,7 @@ static void __init l2x0_of_setup(const struct device_node *np, | |||
422 | } | 422 | } |
423 | 423 | ||
424 | static void __init pl310_of_setup(const struct device_node *np, | 424 | static void __init pl310_of_setup(const struct device_node *np, |
425 | __u32 *aux_val, __u32 *aux_mask) | 425 | u32 *aux_val, u32 *aux_mask) |
426 | { | 426 | { |
427 | u32 data[3] = { 0, 0, 0 }; | 427 | u32 data[3] = { 0, 0, 0 }; |
428 | u32 tag[3] = { 0, 0, 0 }; | 428 | u32 tag[3] = { 0, 0, 0 }; |
@@ -548,7 +548,7 @@ static const struct of_device_id l2x0_ids[] __initconst = { | |||
548 | {} | 548 | {} |
549 | }; | 549 | }; |
550 | 550 | ||
551 | int __init l2x0_of_init(__u32 aux_val, __u32 aux_mask) | 551 | int __init l2x0_of_init(u32 aux_val, u32 aux_mask) |
552 | { | 552 | { |
553 | struct device_node *np; | 553 | struct device_node *np; |
554 | struct l2x0_of_data *data; | 554 | struct l2x0_of_data *data; |
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c index ec8c3befb9c8..1267e64133b9 100644 --- a/arch/arm/mm/copypage-v4mc.c +++ b/arch/arm/mm/copypage-v4mc.c | |||
@@ -23,10 +23,6 @@ | |||
23 | 23 | ||
24 | #include "mm.h" | 24 | #include "mm.h" |
25 | 25 | ||
26 | /* | ||
27 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
28 | * specific hacks for copying pages efficiently. | ||
29 | */ | ||
30 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ | 26 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ |
31 | L_PTE_MT_MINICACHE) | 27 | L_PTE_MT_MINICACHE) |
32 | 28 | ||
@@ -78,10 +74,9 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from, | |||
78 | 74 | ||
79 | raw_spin_lock(&minicache_lock); | 75 | raw_spin_lock(&minicache_lock); |
80 | 76 | ||
81 | set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); | 77 | set_top_pte(COPYPAGE_MINICACHE, mk_pte(from, minicache_pgprot)); |
82 | flush_tlb_kernel_page(0xffff8000); | ||
83 | 78 | ||
84 | mc_copy_user_page((void *)0xffff8000, kto); | 79 | mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); |
85 | 80 | ||
86 | raw_spin_unlock(&minicache_lock); | 81 | raw_spin_unlock(&minicache_lock); |
87 | 82 | ||
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c index 8b03a5814d00..b9bcc9d79176 100644 --- a/arch/arm/mm/copypage-v6.c +++ b/arch/arm/mm/copypage-v6.c | |||
@@ -24,9 +24,6 @@ | |||
24 | #error FIX ME | 24 | #error FIX ME |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #define from_address (0xffff8000) | ||
28 | #define to_address (0xffffc000) | ||
29 | |||
30 | static DEFINE_RAW_SPINLOCK(v6_lock); | 27 | static DEFINE_RAW_SPINLOCK(v6_lock); |
31 | 28 | ||
32 | /* | 29 | /* |
@@ -90,14 +87,11 @@ static void v6_copy_user_highpage_aliasing(struct page *to, | |||
90 | */ | 87 | */ |
91 | raw_spin_lock(&v6_lock); | 88 | raw_spin_lock(&v6_lock); |
92 | 89 | ||
93 | set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); | 90 | kfrom = COPYPAGE_V6_FROM + (offset << PAGE_SHIFT); |
94 | set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); | 91 | kto = COPYPAGE_V6_TO + (offset << PAGE_SHIFT); |
95 | |||
96 | kfrom = from_address + (offset << PAGE_SHIFT); | ||
97 | kto = to_address + (offset << PAGE_SHIFT); | ||
98 | 92 | ||
99 | flush_tlb_kernel_page(kfrom); | 93 | set_top_pte(kfrom, mk_pte(from, PAGE_KERNEL)); |
100 | flush_tlb_kernel_page(kto); | 94 | set_top_pte(kto, mk_pte(to, PAGE_KERNEL)); |
101 | 95 | ||
102 | copy_page((void *)kto, (void *)kfrom); | 96 | copy_page((void *)kto, (void *)kfrom); |
103 | 97 | ||
@@ -111,8 +105,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to, | |||
111 | */ | 105 | */ |
112 | static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) | 106 | static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) |
113 | { | 107 | { |
114 | unsigned int offset = CACHE_COLOUR(vaddr); | 108 | unsigned long to = COPYPAGE_V6_TO + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); |
115 | unsigned long to = to_address + (offset << PAGE_SHIFT); | ||
116 | 109 | ||
117 | /* FIXME: not highmem safe */ | 110 | /* FIXME: not highmem safe */ |
118 | discard_old_kernel_data(page_address(page)); | 111 | discard_old_kernel_data(page_address(page)); |
@@ -123,8 +116,7 @@ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vad | |||
123 | */ | 116 | */ |
124 | raw_spin_lock(&v6_lock); | 117 | raw_spin_lock(&v6_lock); |
125 | 118 | ||
126 | set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); | 119 | set_top_pte(to, mk_pte(page, PAGE_KERNEL)); |
127 | flush_tlb_kernel_page(to); | ||
128 | clear_page((void *)to); | 120 | clear_page((void *)to); |
129 | 121 | ||
130 | raw_spin_unlock(&v6_lock); | 122 | raw_spin_unlock(&v6_lock); |
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c index 439d106ae638..0fb85025344d 100644 --- a/arch/arm/mm/copypage-xscale.c +++ b/arch/arm/mm/copypage-xscale.c | |||
@@ -23,12 +23,6 @@ | |||
23 | 23 | ||
24 | #include "mm.h" | 24 | #include "mm.h" |
25 | 25 | ||
26 | /* | ||
27 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
28 | * specific hacks for copying pages efficiently. | ||
29 | */ | ||
30 | #define COPYPAGE_MINICACHE 0xffff8000 | ||
31 | |||
32 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ | 26 | #define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ |
33 | L_PTE_MT_MINICACHE) | 27 | L_PTE_MT_MINICACHE) |
34 | 28 | ||
@@ -100,8 +94,7 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from, | |||
100 | 94 | ||
101 | raw_spin_lock(&minicache_lock); | 95 | raw_spin_lock(&minicache_lock); |
102 | 96 | ||
103 | set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); | 97 | set_top_pte(COPYPAGE_MINICACHE, mk_pte(from, minicache_pgprot)); |
104 | flush_tlb_kernel_page(COPYPAGE_MINICACHE); | ||
105 | 98 | ||
106 | mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); | 99 | mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); |
107 | 100 | ||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 1aa664a1999f..db23ae4aaaab 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -214,7 +214,8 @@ static int __init consistent_init(void) | |||
214 | core_initcall(consistent_init); | 214 | core_initcall(consistent_init); |
215 | 215 | ||
216 | static void * | 216 | static void * |
217 | __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) | 217 | __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot, |
218 | const void *caller) | ||
218 | { | 219 | { |
219 | struct arm_vmregion *c; | 220 | struct arm_vmregion *c; |
220 | size_t align; | 221 | size_t align; |
@@ -241,7 +242,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) | |||
241 | * Allocate a virtual address in the consistent mapping region. | 242 | * Allocate a virtual address in the consistent mapping region. |
242 | */ | 243 | */ |
243 | c = arm_vmregion_alloc(&consistent_head, align, size, | 244 | c = arm_vmregion_alloc(&consistent_head, align, size, |
244 | gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); | 245 | gfp & ~(__GFP_DMA | __GFP_HIGHMEM), caller); |
245 | if (c) { | 246 | if (c) { |
246 | pte_t *pte; | 247 | pte_t *pte; |
247 | int idx = CONSISTENT_PTE_INDEX(c->vm_start); | 248 | int idx = CONSISTENT_PTE_INDEX(c->vm_start); |
@@ -320,14 +321,14 @@ static void __dma_free_remap(void *cpu_addr, size_t size) | |||
320 | 321 | ||
321 | #else /* !CONFIG_MMU */ | 322 | #else /* !CONFIG_MMU */ |
322 | 323 | ||
323 | #define __dma_alloc_remap(page, size, gfp, prot) page_address(page) | 324 | #define __dma_alloc_remap(page, size, gfp, prot, c) page_address(page) |
324 | #define __dma_free_remap(addr, size) do { } while (0) | 325 | #define __dma_free_remap(addr, size) do { } while (0) |
325 | 326 | ||
326 | #endif /* CONFIG_MMU */ | 327 | #endif /* CONFIG_MMU */ |
327 | 328 | ||
328 | static void * | 329 | static void * |
329 | __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | 330 | __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, |
330 | pgprot_t prot) | 331 | pgprot_t prot, const void *caller) |
331 | { | 332 | { |
332 | struct page *page; | 333 | struct page *page; |
333 | void *addr; | 334 | void *addr; |
@@ -349,7 +350,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
349 | return NULL; | 350 | return NULL; |
350 | 351 | ||
351 | if (!arch_is_coherent()) | 352 | if (!arch_is_coherent()) |
352 | addr = __dma_alloc_remap(page, size, gfp, prot); | 353 | addr = __dma_alloc_remap(page, size, gfp, prot, caller); |
353 | else | 354 | else |
354 | addr = page_address(page); | 355 | addr = page_address(page); |
355 | 356 | ||
@@ -374,7 +375,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gf | |||
374 | return memory; | 375 | return memory; |
375 | 376 | ||
376 | return __dma_alloc(dev, size, handle, gfp, | 377 | return __dma_alloc(dev, size, handle, gfp, |
377 | pgprot_dmacoherent(pgprot_kernel)); | 378 | pgprot_dmacoherent(pgprot_kernel), |
379 | __builtin_return_address(0)); | ||
378 | } | 380 | } |
379 | EXPORT_SYMBOL(dma_alloc_coherent); | 381 | EXPORT_SYMBOL(dma_alloc_coherent); |
380 | 382 | ||
@@ -386,7 +388,8 @@ void * | |||
386 | dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp) | 388 | dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp) |
387 | { | 389 | { |
388 | return __dma_alloc(dev, size, handle, gfp, | 390 | return __dma_alloc(dev, size, handle, gfp, |
389 | pgprot_writecombine(pgprot_kernel)); | 391 | pgprot_writecombine(pgprot_kernel), |
392 | __builtin_return_address(0)); | ||
390 | } | 393 | } |
391 | EXPORT_SYMBOL(dma_alloc_writecombine); | 394 | EXPORT_SYMBOL(dma_alloc_writecombine); |
392 | 395 | ||
@@ -723,6 +726,9 @@ EXPORT_SYMBOL(dma_set_mask); | |||
723 | 726 | ||
724 | static int __init dma_debug_do_init(void) | 727 | static int __init dma_debug_do_init(void) |
725 | { | 728 | { |
729 | #ifdef CONFIG_MMU | ||
730 | arm_vmregion_create_proc("dma-mappings", &consistent_head); | ||
731 | #endif | ||
726 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); | 732 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); |
727 | return 0; | 733 | return 0; |
728 | } | 734 | } |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 5bdff5c3e6cb..9055b5a84ec5 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
@@ -165,7 +165,8 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr, | |||
165 | struct siginfo si; | 165 | struct siginfo si; |
166 | 166 | ||
167 | #ifdef CONFIG_DEBUG_USER | 167 | #ifdef CONFIG_DEBUG_USER |
168 | if (user_debug & UDBG_SEGV) { | 168 | if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) || |
169 | ((user_debug & UDBG_BUS) && (sig == SIGBUS))) { | ||
169 | printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n", | 170 | printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n", |
170 | tsk->comm, sig, addr, fsr); | 171 | tsk->comm, sig, addr, fsr); |
171 | show_pte(tsk->mm, addr); | 172 | show_pte(tsk->mm, addr); |
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 062d61a1f87d..77458548e031 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c | |||
@@ -22,15 +22,12 @@ | |||
22 | 22 | ||
23 | #ifdef CONFIG_CPU_CACHE_VIPT | 23 | #ifdef CONFIG_CPU_CACHE_VIPT |
24 | 24 | ||
25 | #define ALIAS_FLUSH_START 0xffff4000 | ||
26 | |||
27 | static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) | 25 | static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) |
28 | { | 26 | { |
29 | unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); | 27 | unsigned long to = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); |
30 | const int zero = 0; | 28 | const int zero = 0; |
31 | 29 | ||
32 | set_pte_ext(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL), 0); | 30 | set_top_pte(to, pfn_pte(pfn, PAGE_KERNEL)); |
33 | flush_tlb_kernel_page(to); | ||
34 | 31 | ||
35 | asm( "mcrr p15, 0, %1, %0, c14\n" | 32 | asm( "mcrr p15, 0, %1, %0, c14\n" |
36 | " mcr p15, 0, %2, c7, c10, 4" | 33 | " mcr p15, 0, %2, c7, c10, 4" |
@@ -41,13 +38,12 @@ static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) | |||
41 | 38 | ||
42 | static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned long len) | 39 | static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned long len) |
43 | { | 40 | { |
44 | unsigned long colour = CACHE_COLOUR(vaddr); | 41 | unsigned long va = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); |
45 | unsigned long offset = vaddr & (PAGE_SIZE - 1); | 42 | unsigned long offset = vaddr & (PAGE_SIZE - 1); |
46 | unsigned long to; | 43 | unsigned long to; |
47 | 44 | ||
48 | set_pte_ext(TOP_PTE(ALIAS_FLUSH_START) + colour, pfn_pte(pfn, PAGE_KERNEL), 0); | 45 | set_top_pte(va, pfn_pte(pfn, PAGE_KERNEL)); |
49 | to = ALIAS_FLUSH_START + (colour << PAGE_SHIFT) + offset; | 46 | to = va + offset; |
50 | flush_tlb_kernel_page(to); | ||
51 | flush_icache_range(to, to + len); | 47 | flush_icache_range(to, to + len); |
52 | } | 48 | } |
53 | 49 | ||
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 5a21505d7550..21b9e1bf9b77 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
@@ -69,15 +69,14 @@ void *kmap_atomic(struct page *page) | |||
69 | * With debugging enabled, kunmap_atomic forces that entry to 0. | 69 | * With debugging enabled, kunmap_atomic forces that entry to 0. |
70 | * Make sure it was indeed properly unmapped. | 70 | * Make sure it was indeed properly unmapped. |
71 | */ | 71 | */ |
72 | BUG_ON(!pte_none(*(TOP_PTE(vaddr)))); | 72 | BUG_ON(!pte_none(get_top_pte(vaddr))); |
73 | #endif | 73 | #endif |
74 | set_pte_ext(TOP_PTE(vaddr), mk_pte(page, kmap_prot), 0); | ||
75 | /* | 74 | /* |
76 | * When debugging is off, kunmap_atomic leaves the previous mapping | 75 | * When debugging is off, kunmap_atomic leaves the previous mapping |
77 | * in place, so this TLB flush ensures the TLB is updated with the | 76 | * in place, so the contained TLB flush ensures the TLB is updated |
78 | * new mapping. | 77 | * with the new mapping. |
79 | */ | 78 | */ |
80 | local_flush_tlb_kernel_page(vaddr); | 79 | set_top_pte(vaddr, mk_pte(page, kmap_prot)); |
81 | 80 | ||
82 | return (void *)vaddr; | 81 | return (void *)vaddr; |
83 | } | 82 | } |
@@ -96,8 +95,7 @@ void __kunmap_atomic(void *kvaddr) | |||
96 | __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); | 95 | __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); |
97 | #ifdef CONFIG_DEBUG_HIGHMEM | 96 | #ifdef CONFIG_DEBUG_HIGHMEM |
98 | BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); | 97 | BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); |
99 | set_pte_ext(TOP_PTE(vaddr), __pte(0), 0); | 98 | set_top_pte(vaddr, __pte(0)); |
100 | local_flush_tlb_kernel_page(vaddr); | ||
101 | #else | 99 | #else |
102 | (void) idx; /* to kill a warning */ | 100 | (void) idx; /* to kill a warning */ |
103 | #endif | 101 | #endif |
@@ -121,10 +119,9 @@ void *kmap_atomic_pfn(unsigned long pfn) | |||
121 | idx = type + KM_TYPE_NR * smp_processor_id(); | 119 | idx = type + KM_TYPE_NR * smp_processor_id(); |
122 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | 120 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |
123 | #ifdef CONFIG_DEBUG_HIGHMEM | 121 | #ifdef CONFIG_DEBUG_HIGHMEM |
124 | BUG_ON(!pte_none(*(TOP_PTE(vaddr)))); | 122 | BUG_ON(!pte_none(get_top_pte(vaddr))); |
125 | #endif | 123 | #endif |
126 | set_pte_ext(TOP_PTE(vaddr), pfn_pte(pfn, kmap_prot), 0); | 124 | set_top_pte(vaddr, pfn_pte(pfn, kmap_prot)); |
127 | local_flush_tlb_kernel_page(vaddr); | ||
128 | 125 | ||
129 | return (void *)vaddr; | 126 | return (void *)vaddr; |
130 | } | 127 | } |
@@ -132,11 +129,9 @@ void *kmap_atomic_pfn(unsigned long pfn) | |||
132 | struct page *kmap_atomic_to_page(const void *ptr) | 129 | struct page *kmap_atomic_to_page(const void *ptr) |
133 | { | 130 | { |
134 | unsigned long vaddr = (unsigned long)ptr; | 131 | unsigned long vaddr = (unsigned long)ptr; |
135 | pte_t *pte; | ||
136 | 132 | ||
137 | if (vaddr < FIXADDR_START) | 133 | if (vaddr < FIXADDR_START) |
138 | return virt_to_page(ptr); | 134 | return virt_to_page(ptr); |
139 | 135 | ||
140 | pte = TOP_PTE(vaddr); | 136 | return pte_page(get_top_pte(vaddr)); |
141 | return pte_page(*pte); | ||
142 | } | 137 | } |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 245a55a0a5bb..595079fa9d1d 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -658,7 +658,9 @@ void __init mem_init(void) | |||
658 | #ifdef CONFIG_HIGHMEM | 658 | #ifdef CONFIG_HIGHMEM |
659 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" | 659 | " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" |
660 | #endif | 660 | #endif |
661 | #ifdef CONFIG_MODULES | ||
661 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 662 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" |
663 | #endif | ||
662 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" | 664 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" |
663 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | 665 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" |
664 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 666 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" |
@@ -677,7 +679,9 @@ void __init mem_init(void) | |||
677 | MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * | 679 | MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * |
678 | (PAGE_SIZE)), | 680 | (PAGE_SIZE)), |
679 | #endif | 681 | #endif |
682 | #ifdef CONFIG_MODULES | ||
680 | MLM(MODULES_VADDR, MODULES_END), | 683 | MLM(MODULES_VADDR, MODULES_END), |
684 | #endif | ||
681 | 685 | ||
682 | MLK_ROUNDUP(_text, _etext), | 686 | MLK_ROUNDUP(_text, _etext), |
683 | MLK_ROUNDUP(__init_begin, __init_end), | 687 | MLK_ROUNDUP(__init_begin, __init_end), |
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c index 6780b49f2c69..4f55f5062ab7 100644 --- a/arch/arm/mm/ioremap.c +++ b/arch/arm/mm/ioremap.c | |||
@@ -308,11 +308,15 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size, | |||
308 | } | 308 | } |
309 | EXPORT_SYMBOL(__arm_ioremap_pfn); | 309 | EXPORT_SYMBOL(__arm_ioremap_pfn); |
310 | 310 | ||
311 | void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, | ||
312 | unsigned int, void *) = | ||
313 | __arm_ioremap_caller; | ||
314 | |||
311 | void __iomem * | 315 | void __iomem * |
312 | __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | 316 | __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) |
313 | { | 317 | { |
314 | return __arm_ioremap_caller(phys_addr, size, mtype, | 318 | return arch_ioremap_caller(phys_addr, size, mtype, |
315 | __builtin_return_address(0)); | 319 | __builtin_return_address(0)); |
316 | } | 320 | } |
317 | EXPORT_SYMBOL(__arm_ioremap); | 321 | EXPORT_SYMBOL(__arm_ioremap); |
318 | 322 | ||
@@ -371,4 +375,11 @@ void __iounmap(volatile void __iomem *io_addr) | |||
371 | 375 | ||
372 | vunmap(addr); | 376 | vunmap(addr); |
373 | } | 377 | } |
374 | EXPORT_SYMBOL(__iounmap); | 378 | |
379 | void (*arch_iounmap)(volatile void __iomem *) = __iounmap; | ||
380 | |||
381 | void __arm_iounmap(volatile void __iomem *io_addr) | ||
382 | { | ||
383 | arch_iounmap(io_addr); | ||
384 | } | ||
385 | EXPORT_SYMBOL(__arm_iounmap); | ||
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 70f6d3ea4834..27f4a619b35d 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h | |||
@@ -3,7 +3,31 @@ | |||
3 | /* the upper-most page table pointer */ | 3 | /* the upper-most page table pointer */ |
4 | extern pmd_t *top_pmd; | 4 | extern pmd_t *top_pmd; |
5 | 5 | ||
6 | #define TOP_PTE(x) pte_offset_kernel(top_pmd, x) | 6 | /* |
7 | * 0xffff8000 to 0xffffffff is reserved for any ARM architecture | ||
8 | * specific hacks for copying pages efficiently, while 0xffff4000 | ||
9 | * is reserved for VIPT aliasing flushing by generic code. | ||
10 | * | ||
11 | * Note that we don't allow VIPT aliasing caches with SMP. | ||
12 | */ | ||
13 | #define COPYPAGE_MINICACHE 0xffff8000 | ||
14 | #define COPYPAGE_V6_FROM 0xffff8000 | ||
15 | #define COPYPAGE_V6_TO 0xffffc000 | ||
16 | /* PFN alias flushing, for VIPT caches */ | ||
17 | #define FLUSH_ALIAS_START 0xffff4000 | ||
18 | |||
19 | static inline void set_top_pte(unsigned long va, pte_t pte) | ||
20 | { | ||
21 | pte_t *ptep = pte_offset_kernel(top_pmd, va); | ||
22 | set_pte_ext(ptep, pte, 0); | ||
23 | local_flush_tlb_kernel_page(va); | ||
24 | } | ||
25 | |||
26 | static inline pte_t get_top_pte(unsigned long va) | ||
27 | { | ||
28 | pte_t *ptep = pte_offset_kernel(top_pmd, va); | ||
29 | return *ptep; | ||
30 | } | ||
7 | 31 | ||
8 | static inline pmd_t *pmd_off_k(unsigned long virt) | 32 | static inline pmd_t *pmd_off_k(unsigned long virt) |
9 | { | 33 | { |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index cd439c1dd506..b86f8933ff91 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -999,11 +999,14 @@ static void __init devicemaps_init(struct machine_desc *mdesc) | |||
999 | { | 999 | { |
1000 | struct map_desc map; | 1000 | struct map_desc map; |
1001 | unsigned long addr; | 1001 | unsigned long addr; |
1002 | void *vectors; | ||
1002 | 1003 | ||
1003 | /* | 1004 | /* |
1004 | * Allocate the vector page early. | 1005 | * Allocate the vector page early. |
1005 | */ | 1006 | */ |
1006 | vectors_page = early_alloc(PAGE_SIZE); | 1007 | vectors = early_alloc(PAGE_SIZE); |
1008 | |||
1009 | early_trap_init(vectors); | ||
1007 | 1010 | ||
1008 | for (addr = VMALLOC_START; addr; addr += PMD_SIZE) | 1011 | for (addr = VMALLOC_START; addr; addr += PMD_SIZE) |
1009 | pmd_clear(pmd_off_k(addr)); | 1012 | pmd_clear(pmd_off_k(addr)); |
@@ -1043,7 +1046,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc) | |||
1043 | * location (0xffff0000). If we aren't using high-vectors, also | 1046 | * location (0xffff0000). If we aren't using high-vectors, also |
1044 | * create a mapping at the low-vectors virtual address. | 1047 | * create a mapping at the low-vectors virtual address. |
1045 | */ | 1048 | */ |
1046 | map.pfn = __phys_to_pfn(virt_to_phys(vectors_page)); | 1049 | map.pfn = __phys_to_pfn(virt_to_phys(vectors)); |
1047 | map.virtual = 0xffff0000; | 1050 | map.virtual = 0xffff0000; |
1048 | map.length = PAGE_SIZE; | 1051 | map.length = PAGE_SIZE; |
1049 | map.type = MT_HIGH_VECTORS; | 1052 | map.type = MT_HIGH_VECTORS; |
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c index 4fc6794cca4b..6486d2f253cd 100644 --- a/arch/arm/mm/nommu.c +++ b/arch/arm/mm/nommu.c | |||
@@ -86,13 +86,17 @@ void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, | |||
86 | } | 86 | } |
87 | EXPORT_SYMBOL(__arm_ioremap); | 87 | EXPORT_SYMBOL(__arm_ioremap); |
88 | 88 | ||
89 | void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *); | ||
90 | |||
89 | void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, | 91 | void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, |
90 | unsigned int mtype, void *caller) | 92 | unsigned int mtype, void *caller) |
91 | { | 93 | { |
92 | return __arm_ioremap(phys_addr, size, mtype); | 94 | return __arm_ioremap(phys_addr, size, mtype); |
93 | } | 95 | } |
94 | 96 | ||
95 | void __iounmap(volatile void __iomem *addr) | 97 | void (*arch_iounmap)(volatile void __iomem *); |
98 | |||
99 | void __arm_iounmap(volatile void __iomem *addr) | ||
96 | { | 100 | { |
97 | } | 101 | } |
98 | EXPORT_SYMBOL(__iounmap); | 102 | EXPORT_SYMBOL(__arm_iounmap); |
diff --git a/arch/arm/mm/vmregion.c b/arch/arm/mm/vmregion.c index 036fdbfdd62f..a631016e1f8f 100644 --- a/arch/arm/mm/vmregion.c +++ b/arch/arm/mm/vmregion.c | |||
@@ -1,5 +1,8 @@ | |||
1 | #include <linux/fs.h> | ||
1 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
2 | #include <linux/list.h> | 3 | #include <linux/list.h> |
4 | #include <linux/proc_fs.h> | ||
5 | #include <linux/seq_file.h> | ||
3 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
4 | 7 | ||
5 | #include "vmregion.h" | 8 | #include "vmregion.h" |
@@ -36,7 +39,7 @@ | |||
36 | 39 | ||
37 | struct arm_vmregion * | 40 | struct arm_vmregion * |
38 | arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align, | 41 | arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align, |
39 | size_t size, gfp_t gfp) | 42 | size_t size, gfp_t gfp, const void *caller) |
40 | { | 43 | { |
41 | unsigned long start = head->vm_start, addr = head->vm_end; | 44 | unsigned long start = head->vm_start, addr = head->vm_end; |
42 | unsigned long flags; | 45 | unsigned long flags; |
@@ -52,6 +55,8 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align, | |||
52 | if (!new) | 55 | if (!new) |
53 | goto out; | 56 | goto out; |
54 | 57 | ||
58 | new->caller = caller; | ||
59 | |||
55 | spin_lock_irqsave(&head->vm_lock, flags); | 60 | spin_lock_irqsave(&head->vm_lock, flags); |
56 | 61 | ||
57 | addr = rounddown(addr - size, align); | 62 | addr = rounddown(addr - size, align); |
@@ -129,3 +134,72 @@ void arm_vmregion_free(struct arm_vmregion_head *head, struct arm_vmregion *c) | |||
129 | 134 | ||
130 | kfree(c); | 135 | kfree(c); |
131 | } | 136 | } |
137 | |||
138 | #ifdef CONFIG_PROC_FS | ||
139 | static int arm_vmregion_show(struct seq_file *m, void *p) | ||
140 | { | ||
141 | struct arm_vmregion *c = list_entry(p, struct arm_vmregion, vm_list); | ||
142 | |||
143 | seq_printf(m, "0x%08lx-0x%08lx %7lu", c->vm_start, c->vm_end, | ||
144 | c->vm_end - c->vm_start); | ||
145 | if (c->caller) | ||
146 | seq_printf(m, " %pS", (void *)c->caller); | ||
147 | seq_putc(m, '\n'); | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | static void *arm_vmregion_start(struct seq_file *m, loff_t *pos) | ||
152 | { | ||
153 | struct arm_vmregion_head *h = m->private; | ||
154 | spin_lock_irq(&h->vm_lock); | ||
155 | return seq_list_start(&h->vm_list, *pos); | ||
156 | } | ||
157 | |||
158 | static void *arm_vmregion_next(struct seq_file *m, void *p, loff_t *pos) | ||
159 | { | ||
160 | struct arm_vmregion_head *h = m->private; | ||
161 | return seq_list_next(p, &h->vm_list, pos); | ||
162 | } | ||
163 | |||
164 | static void arm_vmregion_stop(struct seq_file *m, void *p) | ||
165 | { | ||
166 | struct arm_vmregion_head *h = m->private; | ||
167 | spin_unlock_irq(&h->vm_lock); | ||
168 | } | ||
169 | |||
170 | static const struct seq_operations arm_vmregion_ops = { | ||
171 | .start = arm_vmregion_start, | ||
172 | .stop = arm_vmregion_stop, | ||
173 | .next = arm_vmregion_next, | ||
174 | .show = arm_vmregion_show, | ||
175 | }; | ||
176 | |||
177 | static int arm_vmregion_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | struct arm_vmregion_head *h = PDE(inode)->data; | ||
180 | int ret = seq_open(file, &arm_vmregion_ops); | ||
181 | if (!ret) { | ||
182 | struct seq_file *m = file->private_data; | ||
183 | m->private = h; | ||
184 | } | ||
185 | return ret; | ||
186 | } | ||
187 | |||
188 | static const struct file_operations arm_vmregion_fops = { | ||
189 | .open = arm_vmregion_open, | ||
190 | .read = seq_read, | ||
191 | .llseek = seq_lseek, | ||
192 | .release = seq_release, | ||
193 | }; | ||
194 | |||
195 | int arm_vmregion_create_proc(const char *path, struct arm_vmregion_head *h) | ||
196 | { | ||
197 | proc_create_data(path, S_IRUSR, NULL, &arm_vmregion_fops, h); | ||
198 | return 0; | ||
199 | } | ||
200 | #else | ||
201 | int arm_vmregion_create_proc(const char *path, struct arm_vmregion_head *h) | ||
202 | { | ||
203 | return 0; | ||
204 | } | ||
205 | #endif | ||
diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h index 15e9f044db9f..162be662c088 100644 --- a/arch/arm/mm/vmregion.h +++ b/arch/arm/mm/vmregion.h | |||
@@ -19,11 +19,14 @@ struct arm_vmregion { | |||
19 | unsigned long vm_end; | 19 | unsigned long vm_end; |
20 | struct page *vm_pages; | 20 | struct page *vm_pages; |
21 | int vm_active; | 21 | int vm_active; |
22 | const void *caller; | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t); | 25 | struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t, const void *); |
25 | struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long); | 26 | struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long); |
26 | struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long); | 27 | struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long); |
27 | void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *); | 28 | void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *); |
28 | 29 | ||
30 | int arm_vmregion_create_proc(const char *, struct arm_vmregion_head *); | ||
31 | |||
29 | #endif | 32 | #endif |
diff --git a/arch/arm/net/Makefile b/arch/arm/net/Makefile new file mode 100644 index 000000000000..c2c10841b6be --- /dev/null +++ b/arch/arm/net/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | # ARM-specific networking code | ||
2 | |||
3 | obj-$(CONFIG_BPF_JIT) += bpf_jit_32.o | ||
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c new file mode 100644 index 000000000000..62135849f48b --- /dev/null +++ b/arch/arm/net/bpf_jit_32.c | |||
@@ -0,0 +1,915 @@ | |||
1 | /* | ||
2 | * Just-In-Time compiler for BPF filters on 32bit ARM | ||
3 | * | ||
4 | * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; version 2 of the License. | ||
9 | */ | ||
10 | |||
11 | #include <linux/bitops.h> | ||
12 | #include <linux/compiler.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/filter.h> | ||
15 | #include <linux/moduleloader.h> | ||
16 | #include <linux/netdevice.h> | ||
17 | #include <linux/string.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <asm/cacheflush.h> | ||
20 | #include <asm/hwcap.h> | ||
21 | |||
22 | #include "bpf_jit_32.h" | ||
23 | |||
24 | /* | ||
25 | * ABI: | ||
26 | * | ||
27 | * r0 scratch register | ||
28 | * r4 BPF register A | ||
29 | * r5 BPF register X | ||
30 | * r6 pointer to the skb | ||
31 | * r7 skb->data | ||
32 | * r8 skb_headlen(skb) | ||
33 | */ | ||
34 | |||
35 | #define r_scratch ARM_R0 | ||
36 | /* r1-r3 are (also) used for the unaligned loads on the non-ARMv7 slowpath */ | ||
37 | #define r_off ARM_R1 | ||
38 | #define r_A ARM_R4 | ||
39 | #define r_X ARM_R5 | ||
40 | #define r_skb ARM_R6 | ||
41 | #define r_skb_data ARM_R7 | ||
42 | #define r_skb_hl ARM_R8 | ||
43 | |||
44 | #define SCRATCH_SP_OFFSET 0 | ||
45 | #define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + (k)) | ||
46 | |||
47 | #define SEEN_MEM ((1 << BPF_MEMWORDS) - 1) | ||
48 | #define SEEN_MEM_WORD(k) (1 << (k)) | ||
49 | #define SEEN_X (1 << BPF_MEMWORDS) | ||
50 | #define SEEN_CALL (1 << (BPF_MEMWORDS + 1)) | ||
51 | #define SEEN_SKB (1 << (BPF_MEMWORDS + 2)) | ||
52 | #define SEEN_DATA (1 << (BPF_MEMWORDS + 3)) | ||
53 | |||
54 | #define FLAG_NEED_X_RESET (1 << 0) | ||
55 | |||
56 | struct jit_ctx { | ||
57 | const struct sk_filter *skf; | ||
58 | unsigned idx; | ||
59 | unsigned prologue_bytes; | ||
60 | int ret0_fp_idx; | ||
61 | u32 seen; | ||
62 | u32 flags; | ||
63 | u32 *offsets; | ||
64 | u32 *target; | ||
65 | #if __LINUX_ARM_ARCH__ < 7 | ||
66 | u16 epilogue_bytes; | ||
67 | u16 imm_count; | ||
68 | u32 *imms; | ||
69 | #endif | ||
70 | }; | ||
71 | |||
72 | int bpf_jit_enable __read_mostly; | ||
73 | |||
74 | static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset) | ||
75 | { | ||
76 | u8 ret; | ||
77 | int err; | ||
78 | |||
79 | err = skb_copy_bits(skb, offset, &ret, 1); | ||
80 | |||
81 | return (u64)err << 32 | ret; | ||
82 | } | ||
83 | |||
84 | static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset) | ||
85 | { | ||
86 | u16 ret; | ||
87 | int err; | ||
88 | |||
89 | err = skb_copy_bits(skb, offset, &ret, 2); | ||
90 | |||
91 | return (u64)err << 32 | ntohs(ret); | ||
92 | } | ||
93 | |||
94 | static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset) | ||
95 | { | ||
96 | u32 ret; | ||
97 | int err; | ||
98 | |||
99 | err = skb_copy_bits(skb, offset, &ret, 4); | ||
100 | |||
101 | return (u64)err << 32 | ntohl(ret); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * Wrapper that handles both OABI and EABI and assures Thumb2 interworking | ||
106 | * (where the assembly routines like __aeabi_uidiv could cause problems). | ||
107 | */ | ||
108 | static u32 jit_udiv(u32 dividend, u32 divisor) | ||
109 | { | ||
110 | return dividend / divisor; | ||
111 | } | ||
112 | |||
113 | static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx) | ||
114 | { | ||
115 | if (ctx->target != NULL) | ||
116 | ctx->target[ctx->idx] = inst | (cond << 28); | ||
117 | |||
118 | ctx->idx++; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Emit an instruction that will be executed unconditionally. | ||
123 | */ | ||
124 | static inline void emit(u32 inst, struct jit_ctx *ctx) | ||
125 | { | ||
126 | _emit(ARM_COND_AL, inst, ctx); | ||
127 | } | ||
128 | |||
129 | static u16 saved_regs(struct jit_ctx *ctx) | ||
130 | { | ||
131 | u16 ret = 0; | ||
132 | |||
133 | if ((ctx->skf->len > 1) || | ||
134 | (ctx->skf->insns[0].code == BPF_S_RET_A)) | ||
135 | ret |= 1 << r_A; | ||
136 | |||
137 | #ifdef CONFIG_FRAME_POINTER | ||
138 | ret |= (1 << ARM_FP) | (1 << ARM_IP) | (1 << ARM_LR) | (1 << ARM_PC); | ||
139 | #else | ||
140 | if (ctx->seen & SEEN_CALL) | ||
141 | ret |= 1 << ARM_LR; | ||
142 | #endif | ||
143 | if (ctx->seen & (SEEN_DATA | SEEN_SKB)) | ||
144 | ret |= 1 << r_skb; | ||
145 | if (ctx->seen & SEEN_DATA) | ||
146 | ret |= (1 << r_skb_data) | (1 << r_skb_hl); | ||
147 | if (ctx->seen & SEEN_X) | ||
148 | ret |= 1 << r_X; | ||
149 | |||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | static inline int mem_words_used(struct jit_ctx *ctx) | ||
154 | { | ||
155 | /* yes, we do waste some stack space IF there are "holes" in the set" */ | ||
156 | return fls(ctx->seen & SEEN_MEM); | ||
157 | } | ||
158 | |||
159 | static inline bool is_load_to_a(u16 inst) | ||
160 | { | ||
161 | switch (inst) { | ||
162 | case BPF_S_LD_W_LEN: | ||
163 | case BPF_S_LD_W_ABS: | ||
164 | case BPF_S_LD_H_ABS: | ||
165 | case BPF_S_LD_B_ABS: | ||
166 | case BPF_S_ANC_CPU: | ||
167 | case BPF_S_ANC_IFINDEX: | ||
168 | case BPF_S_ANC_MARK: | ||
169 | case BPF_S_ANC_PROTOCOL: | ||
170 | case BPF_S_ANC_RXHASH: | ||
171 | case BPF_S_ANC_QUEUE: | ||
172 | return true; | ||
173 | default: | ||
174 | return false; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | static void build_prologue(struct jit_ctx *ctx) | ||
179 | { | ||
180 | u16 reg_set = saved_regs(ctx); | ||
181 | u16 first_inst = ctx->skf->insns[0].code; | ||
182 | u16 off; | ||
183 | |||
184 | #ifdef CONFIG_FRAME_POINTER | ||
185 | emit(ARM_MOV_R(ARM_IP, ARM_SP), ctx); | ||
186 | emit(ARM_PUSH(reg_set), ctx); | ||
187 | emit(ARM_SUB_I(ARM_FP, ARM_IP, 4), ctx); | ||
188 | #else | ||
189 | if (reg_set) | ||
190 | emit(ARM_PUSH(reg_set), ctx); | ||
191 | #endif | ||
192 | |||
193 | if (ctx->seen & (SEEN_DATA | SEEN_SKB)) | ||
194 | emit(ARM_MOV_R(r_skb, ARM_R0), ctx); | ||
195 | |||
196 | if (ctx->seen & SEEN_DATA) { | ||
197 | off = offsetof(struct sk_buff, data); | ||
198 | emit(ARM_LDR_I(r_skb_data, r_skb, off), ctx); | ||
199 | /* headlen = len - data_len */ | ||
200 | off = offsetof(struct sk_buff, len); | ||
201 | emit(ARM_LDR_I(r_skb_hl, r_skb, off), ctx); | ||
202 | off = offsetof(struct sk_buff, data_len); | ||
203 | emit(ARM_LDR_I(r_scratch, r_skb, off), ctx); | ||
204 | emit(ARM_SUB_R(r_skb_hl, r_skb_hl, r_scratch), ctx); | ||
205 | } | ||
206 | |||
207 | if (ctx->flags & FLAG_NEED_X_RESET) | ||
208 | emit(ARM_MOV_I(r_X, 0), ctx); | ||
209 | |||
210 | /* do not leak kernel data to userspace */ | ||
211 | if ((first_inst != BPF_S_RET_K) && !(is_load_to_a(first_inst))) | ||
212 | emit(ARM_MOV_I(r_A, 0), ctx); | ||
213 | |||
214 | /* stack space for the BPF_MEM words */ | ||
215 | if (ctx->seen & SEEN_MEM) | ||
216 | emit(ARM_SUB_I(ARM_SP, ARM_SP, mem_words_used(ctx) * 4), ctx); | ||
217 | } | ||
218 | |||
219 | static void build_epilogue(struct jit_ctx *ctx) | ||
220 | { | ||
221 | u16 reg_set = saved_regs(ctx); | ||
222 | |||
223 | if (ctx->seen & SEEN_MEM) | ||
224 | emit(ARM_ADD_I(ARM_SP, ARM_SP, mem_words_used(ctx) * 4), ctx); | ||
225 | |||
226 | reg_set &= ~(1 << ARM_LR); | ||
227 | |||
228 | #ifdef CONFIG_FRAME_POINTER | ||
229 | /* the first instruction of the prologue was: mov ip, sp */ | ||
230 | reg_set &= ~(1 << ARM_IP); | ||
231 | reg_set |= (1 << ARM_SP); | ||
232 | emit(ARM_LDM(ARM_SP, reg_set), ctx); | ||
233 | #else | ||
234 | if (reg_set) { | ||
235 | if (ctx->seen & SEEN_CALL) | ||
236 | reg_set |= 1 << ARM_PC; | ||
237 | emit(ARM_POP(reg_set), ctx); | ||
238 | } | ||
239 | |||
240 | if (!(ctx->seen & SEEN_CALL)) | ||
241 | emit(ARM_BX(ARM_LR), ctx); | ||
242 | #endif | ||
243 | } | ||
244 | |||
245 | static int16_t imm8m(u32 x) | ||
246 | { | ||
247 | u32 rot; | ||
248 | |||
249 | for (rot = 0; rot < 16; rot++) | ||
250 | if ((x & ~ror32(0xff, 2 * rot)) == 0) | ||
251 | return rol32(x, 2 * rot) | (rot << 8); | ||
252 | |||
253 | return -1; | ||
254 | } | ||
255 | |||
256 | #if __LINUX_ARM_ARCH__ < 7 | ||
257 | |||
258 | static u16 imm_offset(u32 k, struct jit_ctx *ctx) | ||
259 | { | ||
260 | unsigned i = 0, offset; | ||
261 | u16 imm; | ||
262 | |||
263 | /* on the "fake" run we just count them (duplicates included) */ | ||
264 | if (ctx->target == NULL) { | ||
265 | ctx->imm_count++; | ||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | while ((i < ctx->imm_count) && ctx->imms[i]) { | ||
270 | if (ctx->imms[i] == k) | ||
271 | break; | ||
272 | i++; | ||
273 | } | ||
274 | |||
275 | if (ctx->imms[i] == 0) | ||
276 | ctx->imms[i] = k; | ||
277 | |||
278 | /* constants go just after the epilogue */ | ||
279 | offset = ctx->offsets[ctx->skf->len]; | ||
280 | offset += ctx->prologue_bytes; | ||
281 | offset += ctx->epilogue_bytes; | ||
282 | offset += i * 4; | ||
283 | |||
284 | ctx->target[offset / 4] = k; | ||
285 | |||
286 | /* PC in ARM mode == address of the instruction + 8 */ | ||
287 | imm = offset - (8 + ctx->idx * 4); | ||
288 | |||
289 | return imm; | ||
290 | } | ||
291 | |||
292 | #endif /* __LINUX_ARM_ARCH__ */ | ||
293 | |||
294 | /* | ||
295 | * Move an immediate that's not an imm8m to a core register. | ||
296 | */ | ||
297 | static inline void emit_mov_i_no8m(int rd, u32 val, struct jit_ctx *ctx) | ||
298 | { | ||
299 | #if __LINUX_ARM_ARCH__ < 7 | ||
300 | emit(ARM_LDR_I(rd, ARM_PC, imm_offset(val, ctx)), ctx); | ||
301 | #else | ||
302 | emit(ARM_MOVW(rd, val & 0xffff), ctx); | ||
303 | if (val > 0xffff) | ||
304 | emit(ARM_MOVT(rd, val >> 16), ctx); | ||
305 | #endif | ||
306 | } | ||
307 | |||
308 | static inline void emit_mov_i(int rd, u32 val, struct jit_ctx *ctx) | ||
309 | { | ||
310 | int imm12 = imm8m(val); | ||
311 | |||
312 | if (imm12 >= 0) | ||
313 | emit(ARM_MOV_I(rd, imm12), ctx); | ||
314 | else | ||
315 | emit_mov_i_no8m(rd, val, ctx); | ||
316 | } | ||
317 | |||
318 | #if __LINUX_ARM_ARCH__ < 6 | ||
319 | |||
320 | static void emit_load_be32(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx) | ||
321 | { | ||
322 | _emit(cond, ARM_LDRB_I(ARM_R3, r_addr, 1), ctx); | ||
323 | _emit(cond, ARM_LDRB_I(ARM_R1, r_addr, 0), ctx); | ||
324 | _emit(cond, ARM_LDRB_I(ARM_R2, r_addr, 3), ctx); | ||
325 | _emit(cond, ARM_LSL_I(ARM_R3, ARM_R3, 16), ctx); | ||
326 | _emit(cond, ARM_LDRB_I(ARM_R0, r_addr, 2), ctx); | ||
327 | _emit(cond, ARM_ORR_S(ARM_R3, ARM_R3, ARM_R1, SRTYPE_LSL, 24), ctx); | ||
328 | _emit(cond, ARM_ORR_R(ARM_R3, ARM_R3, ARM_R2), ctx); | ||
329 | _emit(cond, ARM_ORR_S(r_res, ARM_R3, ARM_R0, SRTYPE_LSL, 8), ctx); | ||
330 | } | ||
331 | |||
332 | static void emit_load_be16(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx) | ||
333 | { | ||
334 | _emit(cond, ARM_LDRB_I(ARM_R1, r_addr, 0), ctx); | ||
335 | _emit(cond, ARM_LDRB_I(ARM_R2, r_addr, 1), ctx); | ||
336 | _emit(cond, ARM_ORR_S(r_res, ARM_R2, ARM_R1, SRTYPE_LSL, 8), ctx); | ||
337 | } | ||
338 | |||
339 | static inline void emit_swap16(u8 r_dst, u8 r_src, struct jit_ctx *ctx) | ||
340 | { | ||
341 | emit(ARM_LSL_R(ARM_R1, r_src, 8), ctx); | ||
342 | emit(ARM_ORR_S(r_dst, ARM_R1, r_src, SRTYPE_LSL, 8), ctx); | ||
343 | emit(ARM_LSL_I(r_dst, r_dst, 8), ctx); | ||
344 | emit(ARM_LSL_R(r_dst, r_dst, 8), ctx); | ||
345 | } | ||
346 | |||
347 | #else /* ARMv6+ */ | ||
348 | |||
349 | static void emit_load_be32(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx) | ||
350 | { | ||
351 | _emit(cond, ARM_LDR_I(r_res, r_addr, 0), ctx); | ||
352 | #ifdef __LITTLE_ENDIAN | ||
353 | _emit(cond, ARM_REV(r_res, r_res), ctx); | ||
354 | #endif | ||
355 | } | ||
356 | |||
357 | static void emit_load_be16(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx) | ||
358 | { | ||
359 | _emit(cond, ARM_LDRH_I(r_res, r_addr, 0), ctx); | ||
360 | #ifdef __LITTLE_ENDIAN | ||
361 | _emit(cond, ARM_REV16(r_res, r_res), ctx); | ||
362 | #endif | ||
363 | } | ||
364 | |||
365 | static inline void emit_swap16(u8 r_dst __maybe_unused, | ||
366 | u8 r_src __maybe_unused, | ||
367 | struct jit_ctx *ctx __maybe_unused) | ||
368 | { | ||
369 | #ifdef __LITTLE_ENDIAN | ||
370 | emit(ARM_REV16(r_dst, r_src), ctx); | ||
371 | #endif | ||
372 | } | ||
373 | |||
374 | #endif /* __LINUX_ARM_ARCH__ < 6 */ | ||
375 | |||
376 | |||
377 | /* Compute the immediate value for a PC-relative branch. */ | ||
378 | static inline u32 b_imm(unsigned tgt, struct jit_ctx *ctx) | ||
379 | { | ||
380 | u32 imm; | ||
381 | |||
382 | if (ctx->target == NULL) | ||
383 | return 0; | ||
384 | /* | ||
385 | * BPF allows only forward jumps and the offset of the target is | ||
386 | * still the one computed during the first pass. | ||
387 | */ | ||
388 | imm = ctx->offsets[tgt] + ctx->prologue_bytes - (ctx->idx * 4 + 8); | ||
389 | |||
390 | return imm >> 2; | ||
391 | } | ||
392 | |||
393 | #define OP_IMM3(op, r1, r2, imm_val, ctx) \ | ||
394 | do { \ | ||
395 | imm12 = imm8m(imm_val); \ | ||
396 | if (imm12 < 0) { \ | ||
397 | emit_mov_i_no8m(r_scratch, imm_val, ctx); \ | ||
398 | emit(op ## _R((r1), (r2), r_scratch), ctx); \ | ||
399 | } else { \ | ||
400 | emit(op ## _I((r1), (r2), imm12), ctx); \ | ||
401 | } \ | ||
402 | } while (0) | ||
403 | |||
404 | static inline void emit_err_ret(u8 cond, struct jit_ctx *ctx) | ||
405 | { | ||
406 | if (ctx->ret0_fp_idx >= 0) { | ||
407 | _emit(cond, ARM_B(b_imm(ctx->ret0_fp_idx, ctx)), ctx); | ||
408 | /* NOP to keep the size constant between passes */ | ||
409 | emit(ARM_MOV_R(ARM_R0, ARM_R0), ctx); | ||
410 | } else { | ||
411 | _emit(cond, ARM_MOV_I(ARM_R0, 0), ctx); | ||
412 | _emit(cond, ARM_B(b_imm(ctx->skf->len, ctx)), ctx); | ||
413 | } | ||
414 | } | ||
415 | |||
416 | static inline void emit_blx_r(u8 tgt_reg, struct jit_ctx *ctx) | ||
417 | { | ||
418 | #if __LINUX_ARM_ARCH__ < 5 | ||
419 | emit(ARM_MOV_R(ARM_LR, ARM_PC), ctx); | ||
420 | |||
421 | if (elf_hwcap & HWCAP_THUMB) | ||
422 | emit(ARM_BX(tgt_reg), ctx); | ||
423 | else | ||
424 | emit(ARM_MOV_R(ARM_PC, tgt_reg), ctx); | ||
425 | #else | ||
426 | emit(ARM_BLX_R(tgt_reg), ctx); | ||
427 | #endif | ||
428 | } | ||
429 | |||
430 | static inline void emit_udiv(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx) | ||
431 | { | ||
432 | #if __LINUX_ARM_ARCH__ == 7 | ||
433 | if (elf_hwcap & HWCAP_IDIVA) { | ||
434 | emit(ARM_UDIV(rd, rm, rn), ctx); | ||
435 | return; | ||
436 | } | ||
437 | #endif | ||
438 | if (rm != ARM_R0) | ||
439 | emit(ARM_MOV_R(ARM_R0, rm), ctx); | ||
440 | if (rn != ARM_R1) | ||
441 | emit(ARM_MOV_R(ARM_R1, rn), ctx); | ||
442 | |||
443 | ctx->seen |= SEEN_CALL; | ||
444 | emit_mov_i(ARM_R3, (u32)jit_udiv, ctx); | ||
445 | emit_blx_r(ARM_R3, ctx); | ||
446 | |||
447 | if (rd != ARM_R0) | ||
448 | emit(ARM_MOV_R(rd, ARM_R0), ctx); | ||
449 | } | ||
450 | |||
451 | static inline void update_on_xread(struct jit_ctx *ctx) | ||
452 | { | ||
453 | if (!(ctx->seen & SEEN_X)) | ||
454 | ctx->flags |= FLAG_NEED_X_RESET; | ||
455 | |||
456 | ctx->seen |= SEEN_X; | ||
457 | } | ||
458 | |||
459 | static int build_body(struct jit_ctx *ctx) | ||
460 | { | ||
461 | void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w}; | ||
462 | const struct sk_filter *prog = ctx->skf; | ||
463 | const struct sock_filter *inst; | ||
464 | unsigned i, load_order, off, condt; | ||
465 | int imm12; | ||
466 | u32 k; | ||
467 | |||
468 | for (i = 0; i < prog->len; i++) { | ||
469 | inst = &(prog->insns[i]); | ||
470 | /* K as an immediate value operand */ | ||
471 | k = inst->k; | ||
472 | |||
473 | /* compute offsets only in the fake pass */ | ||
474 | if (ctx->target == NULL) | ||
475 | ctx->offsets[i] = ctx->idx * 4; | ||
476 | |||
477 | switch (inst->code) { | ||
478 | case BPF_S_LD_IMM: | ||
479 | emit_mov_i(r_A, k, ctx); | ||
480 | break; | ||
481 | case BPF_S_LD_W_LEN: | ||
482 | ctx->seen |= SEEN_SKB; | ||
483 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4); | ||
484 | emit(ARM_LDR_I(r_A, r_skb, | ||
485 | offsetof(struct sk_buff, len)), ctx); | ||
486 | break; | ||
487 | case BPF_S_LD_MEM: | ||
488 | /* A = scratch[k] */ | ||
489 | ctx->seen |= SEEN_MEM_WORD(k); | ||
490 | emit(ARM_LDR_I(r_A, ARM_SP, SCRATCH_OFF(k)), ctx); | ||
491 | break; | ||
492 | case BPF_S_LD_W_ABS: | ||
493 | load_order = 2; | ||
494 | goto load; | ||
495 | case BPF_S_LD_H_ABS: | ||
496 | load_order = 1; | ||
497 | goto load; | ||
498 | case BPF_S_LD_B_ABS: | ||
499 | load_order = 0; | ||
500 | load: | ||
501 | /* the interpreter will deal with the negative K */ | ||
502 | if ((int)k < 0) | ||
503 | return -ENOTSUPP; | ||
504 | emit_mov_i(r_off, k, ctx); | ||
505 | load_common: | ||
506 | ctx->seen |= SEEN_DATA | SEEN_CALL; | ||
507 | |||
508 | if (load_order > 0) { | ||
509 | emit(ARM_SUB_I(r_scratch, r_skb_hl, | ||
510 | 1 << load_order), ctx); | ||
511 | emit(ARM_CMP_R(r_scratch, r_off), ctx); | ||
512 | condt = ARM_COND_HS; | ||
513 | } else { | ||
514 | emit(ARM_CMP_R(r_skb_hl, r_off), ctx); | ||
515 | condt = ARM_COND_HI; | ||
516 | } | ||
517 | |||
518 | _emit(condt, ARM_ADD_R(r_scratch, r_off, r_skb_data), | ||
519 | ctx); | ||
520 | |||
521 | if (load_order == 0) | ||
522 | _emit(condt, ARM_LDRB_I(r_A, r_scratch, 0), | ||
523 | ctx); | ||
524 | else if (load_order == 1) | ||
525 | emit_load_be16(condt, r_A, r_scratch, ctx); | ||
526 | else if (load_order == 2) | ||
527 | emit_load_be32(condt, r_A, r_scratch, ctx); | ||
528 | |||
529 | _emit(condt, ARM_B(b_imm(i + 1, ctx)), ctx); | ||
530 | |||
531 | /* the slowpath */ | ||
532 | emit_mov_i(ARM_R3, (u32)load_func[load_order], ctx); | ||
533 | emit(ARM_MOV_R(ARM_R0, r_skb), ctx); | ||
534 | /* the offset is already in R1 */ | ||
535 | emit_blx_r(ARM_R3, ctx); | ||
536 | /* check the result of skb_copy_bits */ | ||
537 | emit(ARM_CMP_I(ARM_R1, 0), ctx); | ||
538 | emit_err_ret(ARM_COND_NE, ctx); | ||
539 | emit(ARM_MOV_R(r_A, ARM_R0), ctx); | ||
540 | break; | ||
541 | case BPF_S_LD_W_IND: | ||
542 | load_order = 2; | ||
543 | goto load_ind; | ||
544 | case BPF_S_LD_H_IND: | ||
545 | load_order = 1; | ||
546 | goto load_ind; | ||
547 | case BPF_S_LD_B_IND: | ||
548 | load_order = 0; | ||
549 | load_ind: | ||
550 | OP_IMM3(ARM_ADD, r_off, r_X, k, ctx); | ||
551 | goto load_common; | ||
552 | case BPF_S_LDX_IMM: | ||
553 | ctx->seen |= SEEN_X; | ||
554 | emit_mov_i(r_X, k, ctx); | ||
555 | break; | ||
556 | case BPF_S_LDX_W_LEN: | ||
557 | ctx->seen |= SEEN_X | SEEN_SKB; | ||
558 | emit(ARM_LDR_I(r_X, r_skb, | ||
559 | offsetof(struct sk_buff, len)), ctx); | ||
560 | break; | ||
561 | case BPF_S_LDX_MEM: | ||
562 | ctx->seen |= SEEN_X | SEEN_MEM_WORD(k); | ||
563 | emit(ARM_LDR_I(r_X, ARM_SP, SCRATCH_OFF(k)), ctx); | ||
564 | break; | ||
565 | case BPF_S_LDX_B_MSH: | ||
566 | /* x = ((*(frame + k)) & 0xf) << 2; */ | ||
567 | ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL; | ||
568 | /* the interpreter should deal with the negative K */ | ||
569 | if (k < 0) | ||
570 | return -1; | ||
571 | /* offset in r1: we might have to take the slow path */ | ||
572 | emit_mov_i(r_off, k, ctx); | ||
573 | emit(ARM_CMP_R(r_skb_hl, r_off), ctx); | ||
574 | |||
575 | /* load in r0: common with the slowpath */ | ||
576 | _emit(ARM_COND_HI, ARM_LDRB_R(ARM_R0, r_skb_data, | ||
577 | ARM_R1), ctx); | ||
578 | /* | ||
579 | * emit_mov_i() might generate one or two instructions, | ||
580 | * the same holds for emit_blx_r() | ||
581 | */ | ||
582 | _emit(ARM_COND_HI, ARM_B(b_imm(i + 1, ctx) - 2), ctx); | ||
583 | |||
584 | emit(ARM_MOV_R(ARM_R0, r_skb), ctx); | ||
585 | /* r_off is r1 */ | ||
586 | emit_mov_i(ARM_R3, (u32)jit_get_skb_b, ctx); | ||
587 | emit_blx_r(ARM_R3, ctx); | ||
588 | /* check the return value of skb_copy_bits */ | ||
589 | emit(ARM_CMP_I(ARM_R1, 0), ctx); | ||
590 | emit_err_ret(ARM_COND_NE, ctx); | ||
591 | |||
592 | emit(ARM_AND_I(r_X, ARM_R0, 0x00f), ctx); | ||
593 | emit(ARM_LSL_I(r_X, r_X, 2), ctx); | ||
594 | break; | ||
595 | case BPF_S_ST: | ||
596 | ctx->seen |= SEEN_MEM_WORD(k); | ||
597 | emit(ARM_STR_I(r_A, ARM_SP, SCRATCH_OFF(k)), ctx); | ||
598 | break; | ||
599 | case BPF_S_STX: | ||
600 | update_on_xread(ctx); | ||
601 | ctx->seen |= SEEN_MEM_WORD(k); | ||
602 | emit(ARM_STR_I(r_X, ARM_SP, SCRATCH_OFF(k)), ctx); | ||
603 | break; | ||
604 | case BPF_S_ALU_ADD_K: | ||
605 | /* A += K */ | ||
606 | OP_IMM3(ARM_ADD, r_A, r_A, k, ctx); | ||
607 | break; | ||
608 | case BPF_S_ALU_ADD_X: | ||
609 | update_on_xread(ctx); | ||
610 | emit(ARM_ADD_R(r_A, r_A, r_X), ctx); | ||
611 | break; | ||
612 | case BPF_S_ALU_SUB_K: | ||
613 | /* A -= K */ | ||
614 | OP_IMM3(ARM_SUB, r_A, r_A, k, ctx); | ||
615 | break; | ||
616 | case BPF_S_ALU_SUB_X: | ||
617 | update_on_xread(ctx); | ||
618 | emit(ARM_SUB_R(r_A, r_A, r_X), ctx); | ||
619 | break; | ||
620 | case BPF_S_ALU_MUL_K: | ||
621 | /* A *= K */ | ||
622 | emit_mov_i(r_scratch, k, ctx); | ||
623 | emit(ARM_MUL(r_A, r_A, r_scratch), ctx); | ||
624 | break; | ||
625 | case BPF_S_ALU_MUL_X: | ||
626 | update_on_xread(ctx); | ||
627 | emit(ARM_MUL(r_A, r_A, r_X), ctx); | ||
628 | break; | ||
629 | case BPF_S_ALU_DIV_K: | ||
630 | /* current k == reciprocal_value(userspace k) */ | ||
631 | emit_mov_i(r_scratch, k, ctx); | ||
632 | /* A = top 32 bits of the product */ | ||
633 | emit(ARM_UMULL(r_scratch, r_A, r_A, r_scratch), ctx); | ||
634 | break; | ||
635 | case BPF_S_ALU_DIV_X: | ||
636 | update_on_xread(ctx); | ||
637 | emit(ARM_CMP_I(r_X, 0), ctx); | ||
638 | emit_err_ret(ARM_COND_EQ, ctx); | ||
639 | emit_udiv(r_A, r_A, r_X, ctx); | ||
640 | break; | ||
641 | case BPF_S_ALU_OR_K: | ||
642 | /* A |= K */ | ||
643 | OP_IMM3(ARM_ORR, r_A, r_A, k, ctx); | ||
644 | break; | ||
645 | case BPF_S_ALU_OR_X: | ||
646 | update_on_xread(ctx); | ||
647 | emit(ARM_ORR_R(r_A, r_A, r_X), ctx); | ||
648 | break; | ||
649 | case BPF_S_ALU_AND_K: | ||
650 | /* A &= K */ | ||
651 | OP_IMM3(ARM_AND, r_A, r_A, k, ctx); | ||
652 | break; | ||
653 | case BPF_S_ALU_AND_X: | ||
654 | update_on_xread(ctx); | ||
655 | emit(ARM_AND_R(r_A, r_A, r_X), ctx); | ||
656 | break; | ||
657 | case BPF_S_ALU_LSH_K: | ||
658 | if (unlikely(k > 31)) | ||
659 | return -1; | ||
660 | emit(ARM_LSL_I(r_A, r_A, k), ctx); | ||
661 | break; | ||
662 | case BPF_S_ALU_LSH_X: | ||
663 | update_on_xread(ctx); | ||
664 | emit(ARM_LSL_R(r_A, r_A, r_X), ctx); | ||
665 | break; | ||
666 | case BPF_S_ALU_RSH_K: | ||
667 | if (unlikely(k > 31)) | ||
668 | return -1; | ||
669 | emit(ARM_LSR_I(r_A, r_A, k), ctx); | ||
670 | break; | ||
671 | case BPF_S_ALU_RSH_X: | ||
672 | update_on_xread(ctx); | ||
673 | emit(ARM_LSR_R(r_A, r_A, r_X), ctx); | ||
674 | break; | ||
675 | case BPF_S_ALU_NEG: | ||
676 | /* A = -A */ | ||
677 | emit(ARM_RSB_I(r_A, r_A, 0), ctx); | ||
678 | break; | ||
679 | case BPF_S_JMP_JA: | ||
680 | /* pc += K */ | ||
681 | emit(ARM_B(b_imm(i + k + 1, ctx)), ctx); | ||
682 | break; | ||
683 | case BPF_S_JMP_JEQ_K: | ||
684 | /* pc += (A == K) ? pc->jt : pc->jf */ | ||
685 | condt = ARM_COND_EQ; | ||
686 | goto cmp_imm; | ||
687 | case BPF_S_JMP_JGT_K: | ||
688 | /* pc += (A > K) ? pc->jt : pc->jf */ | ||
689 | condt = ARM_COND_HI; | ||
690 | goto cmp_imm; | ||
691 | case BPF_S_JMP_JGE_K: | ||
692 | /* pc += (A >= K) ? pc->jt : pc->jf */ | ||
693 | condt = ARM_COND_HS; | ||
694 | cmp_imm: | ||
695 | imm12 = imm8m(k); | ||
696 | if (imm12 < 0) { | ||
697 | emit_mov_i_no8m(r_scratch, k, ctx); | ||
698 | emit(ARM_CMP_R(r_A, r_scratch), ctx); | ||
699 | } else { | ||
700 | emit(ARM_CMP_I(r_A, imm12), ctx); | ||
701 | } | ||
702 | cond_jump: | ||
703 | if (inst->jt) | ||
704 | _emit(condt, ARM_B(b_imm(i + inst->jt + 1, | ||
705 | ctx)), ctx); | ||
706 | if (inst->jf) | ||
707 | _emit(condt ^ 1, ARM_B(b_imm(i + inst->jf + 1, | ||
708 | ctx)), ctx); | ||
709 | break; | ||
710 | case BPF_S_JMP_JEQ_X: | ||
711 | /* pc += (A == X) ? pc->jt : pc->jf */ | ||
712 | condt = ARM_COND_EQ; | ||
713 | goto cmp_x; | ||
714 | case BPF_S_JMP_JGT_X: | ||
715 | /* pc += (A > X) ? pc->jt : pc->jf */ | ||
716 | condt = ARM_COND_HI; | ||
717 | goto cmp_x; | ||
718 | case BPF_S_JMP_JGE_X: | ||
719 | /* pc += (A >= X) ? pc->jt : pc->jf */ | ||
720 | condt = ARM_COND_CS; | ||
721 | cmp_x: | ||
722 | update_on_xread(ctx); | ||
723 | emit(ARM_CMP_R(r_A, r_X), ctx); | ||
724 | goto cond_jump; | ||
725 | case BPF_S_JMP_JSET_K: | ||
726 | /* pc += (A & K) ? pc->jt : pc->jf */ | ||
727 | condt = ARM_COND_NE; | ||
728 | /* not set iff all zeroes iff Z==1 iff EQ */ | ||
729 | |||
730 | imm12 = imm8m(k); | ||
731 | if (imm12 < 0) { | ||
732 | emit_mov_i_no8m(r_scratch, k, ctx); | ||
733 | emit(ARM_TST_R(r_A, r_scratch), ctx); | ||
734 | } else { | ||
735 | emit(ARM_TST_I(r_A, imm12), ctx); | ||
736 | } | ||
737 | goto cond_jump; | ||
738 | case BPF_S_JMP_JSET_X: | ||
739 | /* pc += (A & X) ? pc->jt : pc->jf */ | ||
740 | update_on_xread(ctx); | ||
741 | condt = ARM_COND_NE; | ||
742 | emit(ARM_TST_R(r_A, r_X), ctx); | ||
743 | goto cond_jump; | ||
744 | case BPF_S_RET_A: | ||
745 | emit(ARM_MOV_R(ARM_R0, r_A), ctx); | ||
746 | goto b_epilogue; | ||
747 | case BPF_S_RET_K: | ||
748 | if ((k == 0) && (ctx->ret0_fp_idx < 0)) | ||
749 | ctx->ret0_fp_idx = i; | ||
750 | emit_mov_i(ARM_R0, k, ctx); | ||
751 | b_epilogue: | ||
752 | if (i != ctx->skf->len - 1) | ||
753 | emit(ARM_B(b_imm(prog->len, ctx)), ctx); | ||
754 | break; | ||
755 | case BPF_S_MISC_TAX: | ||
756 | /* X = A */ | ||
757 | ctx->seen |= SEEN_X; | ||
758 | emit(ARM_MOV_R(r_X, r_A), ctx); | ||
759 | break; | ||
760 | case BPF_S_MISC_TXA: | ||
761 | /* A = X */ | ||
762 | update_on_xread(ctx); | ||
763 | emit(ARM_MOV_R(r_A, r_X), ctx); | ||
764 | break; | ||
765 | case BPF_S_ANC_PROTOCOL: | ||
766 | /* A = ntohs(skb->protocol) */ | ||
767 | ctx->seen |= SEEN_SKB; | ||
768 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | ||
769 | protocol) != 2); | ||
770 | off = offsetof(struct sk_buff, protocol); | ||
771 | emit(ARM_LDRH_I(r_scratch, r_skb, off), ctx); | ||
772 | emit_swap16(r_A, r_scratch, ctx); | ||
773 | break; | ||
774 | case BPF_S_ANC_CPU: | ||
775 | /* r_scratch = current_thread_info() */ | ||
776 | OP_IMM3(ARM_BIC, r_scratch, ARM_SP, THREAD_SIZE - 1, ctx); | ||
777 | /* A = current_thread_info()->cpu */ | ||
778 | BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, cpu) != 4); | ||
779 | off = offsetof(struct thread_info, cpu); | ||
780 | emit(ARM_LDR_I(r_A, r_scratch, off), ctx); | ||
781 | break; | ||
782 | case BPF_S_ANC_IFINDEX: | ||
783 | /* A = skb->dev->ifindex */ | ||
784 | ctx->seen |= SEEN_SKB; | ||
785 | off = offsetof(struct sk_buff, dev); | ||
786 | emit(ARM_LDR_I(r_scratch, r_skb, off), ctx); | ||
787 | |||
788 | emit(ARM_CMP_I(r_scratch, 0), ctx); | ||
789 | emit_err_ret(ARM_COND_EQ, ctx); | ||
790 | |||
791 | BUILD_BUG_ON(FIELD_SIZEOF(struct net_device, | ||
792 | ifindex) != 4); | ||
793 | off = offsetof(struct net_device, ifindex); | ||
794 | emit(ARM_LDR_I(r_A, r_scratch, off), ctx); | ||
795 | break; | ||
796 | case BPF_S_ANC_MARK: | ||
797 | ctx->seen |= SEEN_SKB; | ||
798 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4); | ||
799 | off = offsetof(struct sk_buff, mark); | ||
800 | emit(ARM_LDR_I(r_A, r_skb, off), ctx); | ||
801 | break; | ||
802 | case BPF_S_ANC_RXHASH: | ||
803 | ctx->seen |= SEEN_SKB; | ||
804 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4); | ||
805 | off = offsetof(struct sk_buff, rxhash); | ||
806 | emit(ARM_LDR_I(r_A, r_skb, off), ctx); | ||
807 | break; | ||
808 | case BPF_S_ANC_QUEUE: | ||
809 | ctx->seen |= SEEN_SKB; | ||
810 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | ||
811 | queue_mapping) != 2); | ||
812 | BUILD_BUG_ON(offsetof(struct sk_buff, | ||
813 | queue_mapping) > 0xff); | ||
814 | off = offsetof(struct sk_buff, queue_mapping); | ||
815 | emit(ARM_LDRH_I(r_A, r_skb, off), ctx); | ||
816 | break; | ||
817 | default: | ||
818 | return -1; | ||
819 | } | ||
820 | } | ||
821 | |||
822 | /* compute offsets only during the first pass */ | ||
823 | if (ctx->target == NULL) | ||
824 | ctx->offsets[i] = ctx->idx * 4; | ||
825 | |||
826 | return 0; | ||
827 | } | ||
828 | |||
829 | |||
830 | void bpf_jit_compile(struct sk_filter *fp) | ||
831 | { | ||
832 | struct jit_ctx ctx; | ||
833 | unsigned tmp_idx; | ||
834 | unsigned alloc_size; | ||
835 | |||
836 | if (!bpf_jit_enable) | ||
837 | return; | ||
838 | |||
839 | memset(&ctx, 0, sizeof(ctx)); | ||
840 | ctx.skf = fp; | ||
841 | ctx.ret0_fp_idx = -1; | ||
842 | |||
843 | ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1)); | ||
844 | if (ctx.offsets == NULL) | ||
845 | return; | ||
846 | |||
847 | /* fake pass to fill in the ctx->seen */ | ||
848 | if (unlikely(build_body(&ctx))) | ||
849 | goto out; | ||
850 | |||
851 | tmp_idx = ctx.idx; | ||
852 | build_prologue(&ctx); | ||
853 | ctx.prologue_bytes = (ctx.idx - tmp_idx) * 4; | ||
854 | |||
855 | #if __LINUX_ARM_ARCH__ < 7 | ||
856 | tmp_idx = ctx.idx; | ||
857 | build_epilogue(&ctx); | ||
858 | ctx.epilogue_bytes = (ctx.idx - tmp_idx) * 4; | ||
859 | |||
860 | ctx.idx += ctx.imm_count; | ||
861 | if (ctx.imm_count) { | ||
862 | ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count); | ||
863 | if (ctx.imms == NULL) | ||
864 | goto out; | ||
865 | } | ||
866 | #else | ||
867 | /* there's nothing after the epilogue on ARMv7 */ | ||
868 | build_epilogue(&ctx); | ||
869 | #endif | ||
870 | |||
871 | alloc_size = 4 * ctx.idx; | ||
872 | ctx.target = module_alloc(max(sizeof(struct work_struct), | ||
873 | alloc_size)); | ||
874 | if (unlikely(ctx.target == NULL)) | ||
875 | goto out; | ||
876 | |||
877 | ctx.idx = 0; | ||
878 | build_prologue(&ctx); | ||
879 | build_body(&ctx); | ||
880 | build_epilogue(&ctx); | ||
881 | |||
882 | flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx)); | ||
883 | |||
884 | #if __LINUX_ARM_ARCH__ < 7 | ||
885 | if (ctx.imm_count) | ||
886 | kfree(ctx.imms); | ||
887 | #endif | ||
888 | |||
889 | if (bpf_jit_enable > 1) | ||
890 | print_hex_dump(KERN_INFO, "BPF JIT code: ", | ||
891 | DUMP_PREFIX_ADDRESS, 16, 4, ctx.target, | ||
892 | alloc_size, false); | ||
893 | |||
894 | fp->bpf_func = (void *)ctx.target; | ||
895 | out: | ||
896 | kfree(ctx.offsets); | ||
897 | return; | ||
898 | } | ||
899 | |||
900 | static void bpf_jit_free_worker(struct work_struct *work) | ||
901 | { | ||
902 | module_free(NULL, work); | ||
903 | } | ||
904 | |||
905 | void bpf_jit_free(struct sk_filter *fp) | ||
906 | { | ||
907 | struct work_struct *work; | ||
908 | |||
909 | if (fp->bpf_func != sk_run_filter) { | ||
910 | work = (struct work_struct *)fp->bpf_func; | ||
911 | |||
912 | INIT_WORK(work, bpf_jit_free_worker); | ||
913 | schedule_work(work); | ||
914 | } | ||
915 | } | ||
diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h new file mode 100644 index 000000000000..99ae5e3f46d2 --- /dev/null +++ b/arch/arm/net/bpf_jit_32.h | |||
@@ -0,0 +1,190 @@ | |||
1 | /* | ||
2 | * Just-In-Time compiler for BPF filters on 32bit ARM | ||
3 | * | ||
4 | * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; version 2 of the License. | ||
9 | */ | ||
10 | |||
11 | #ifndef PFILTER_OPCODES_ARM_H | ||
12 | #define PFILTER_OPCODES_ARM_H | ||
13 | |||
14 | #define ARM_R0 0 | ||
15 | #define ARM_R1 1 | ||
16 | #define ARM_R2 2 | ||
17 | #define ARM_R3 3 | ||
18 | #define ARM_R4 4 | ||
19 | #define ARM_R5 5 | ||
20 | #define ARM_R6 6 | ||
21 | #define ARM_R7 7 | ||
22 | #define ARM_R8 8 | ||
23 | #define ARM_R9 9 | ||
24 | #define ARM_R10 10 | ||
25 | #define ARM_FP 11 | ||
26 | #define ARM_IP 12 | ||
27 | #define ARM_SP 13 | ||
28 | #define ARM_LR 14 | ||
29 | #define ARM_PC 15 | ||
30 | |||
31 | #define ARM_COND_EQ 0x0 | ||
32 | #define ARM_COND_NE 0x1 | ||
33 | #define ARM_COND_CS 0x2 | ||
34 | #define ARM_COND_HS ARM_COND_CS | ||
35 | #define ARM_COND_CC 0x3 | ||
36 | #define ARM_COND_LO ARM_COND_CC | ||
37 | #define ARM_COND_MI 0x4 | ||
38 | #define ARM_COND_PL 0x5 | ||
39 | #define ARM_COND_VS 0x6 | ||
40 | #define ARM_COND_VC 0x7 | ||
41 | #define ARM_COND_HI 0x8 | ||
42 | #define ARM_COND_LS 0x9 | ||
43 | #define ARM_COND_GE 0xa | ||
44 | #define ARM_COND_LT 0xb | ||
45 | #define ARM_COND_GT 0xc | ||
46 | #define ARM_COND_LE 0xd | ||
47 | #define ARM_COND_AL 0xe | ||
48 | |||
49 | /* register shift types */ | ||
50 | #define SRTYPE_LSL 0 | ||
51 | #define SRTYPE_LSR 1 | ||
52 | #define SRTYPE_ASR 2 | ||
53 | #define SRTYPE_ROR 3 | ||
54 | |||
55 | #define ARM_INST_ADD_R 0x00800000 | ||
56 | #define ARM_INST_ADD_I 0x02800000 | ||
57 | |||
58 | #define ARM_INST_AND_R 0x00000000 | ||
59 | #define ARM_INST_AND_I 0x02000000 | ||
60 | |||
61 | #define ARM_INST_BIC_R 0x01c00000 | ||
62 | #define ARM_INST_BIC_I 0x03c00000 | ||
63 | |||
64 | #define ARM_INST_B 0x0a000000 | ||
65 | #define ARM_INST_BX 0x012FFF10 | ||
66 | #define ARM_INST_BLX_R 0x012fff30 | ||
67 | |||
68 | #define ARM_INST_CMP_R 0x01500000 | ||
69 | #define ARM_INST_CMP_I 0x03500000 | ||
70 | |||
71 | #define ARM_INST_LDRB_I 0x05d00000 | ||
72 | #define ARM_INST_LDRB_R 0x07d00000 | ||
73 | #define ARM_INST_LDRH_I 0x01d000b0 | ||
74 | #define ARM_INST_LDR_I 0x05900000 | ||
75 | |||
76 | #define ARM_INST_LDM 0x08900000 | ||
77 | |||
78 | #define ARM_INST_LSL_I 0x01a00000 | ||
79 | #define ARM_INST_LSL_R 0x01a00010 | ||
80 | |||
81 | #define ARM_INST_LSR_I 0x01a00020 | ||
82 | #define ARM_INST_LSR_R 0x01a00030 | ||
83 | |||
84 | #define ARM_INST_MOV_R 0x01a00000 | ||
85 | #define ARM_INST_MOV_I 0x03a00000 | ||
86 | #define ARM_INST_MOVW 0x03000000 | ||
87 | #define ARM_INST_MOVT 0x03400000 | ||
88 | |||
89 | #define ARM_INST_MUL 0x00000090 | ||
90 | |||
91 | #define ARM_INST_POP 0x08bd0000 | ||
92 | #define ARM_INST_PUSH 0x092d0000 | ||
93 | |||
94 | #define ARM_INST_ORR_R 0x01800000 | ||
95 | #define ARM_INST_ORR_I 0x03800000 | ||
96 | |||
97 | #define ARM_INST_REV 0x06bf0f30 | ||
98 | #define ARM_INST_REV16 0x06bf0fb0 | ||
99 | |||
100 | #define ARM_INST_RSB_I 0x02600000 | ||
101 | |||
102 | #define ARM_INST_SUB_R 0x00400000 | ||
103 | #define ARM_INST_SUB_I 0x02400000 | ||
104 | |||
105 | #define ARM_INST_STR_I 0x05800000 | ||
106 | |||
107 | #define ARM_INST_TST_R 0x01100000 | ||
108 | #define ARM_INST_TST_I 0x03100000 | ||
109 | |||
110 | #define ARM_INST_UDIV 0x0730f010 | ||
111 | |||
112 | #define ARM_INST_UMULL 0x00800090 | ||
113 | |||
114 | /* register */ | ||
115 | #define _AL3_R(op, rd, rn, rm) ((op ## _R) | (rd) << 12 | (rn) << 16 | (rm)) | ||
116 | /* immediate */ | ||
117 | #define _AL3_I(op, rd, rn, imm) ((op ## _I) | (rd) << 12 | (rn) << 16 | (imm)) | ||
118 | |||
119 | #define ARM_ADD_R(rd, rn, rm) _AL3_R(ARM_INST_ADD, rd, rn, rm) | ||
120 | #define ARM_ADD_I(rd, rn, imm) _AL3_I(ARM_INST_ADD, rd, rn, imm) | ||
121 | |||
122 | #define ARM_AND_R(rd, rn, rm) _AL3_R(ARM_INST_AND, rd, rn, rm) | ||
123 | #define ARM_AND_I(rd, rn, imm) _AL3_I(ARM_INST_AND, rd, rn, imm) | ||
124 | |||
125 | #define ARM_BIC_R(rd, rn, rm) _AL3_R(ARM_INST_BIC, rd, rn, rm) | ||
126 | #define ARM_BIC_I(rd, rn, imm) _AL3_I(ARM_INST_BIC, rd, rn, imm) | ||
127 | |||
128 | #define ARM_B(imm24) (ARM_INST_B | ((imm24) & 0xffffff)) | ||
129 | #define ARM_BX(rm) (ARM_INST_BX | (rm)) | ||
130 | #define ARM_BLX_R(rm) (ARM_INST_BLX_R | (rm)) | ||
131 | |||
132 | #define ARM_CMP_R(rn, rm) _AL3_R(ARM_INST_CMP, 0, rn, rm) | ||
133 | #define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm) | ||
134 | |||
135 | #define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \ | ||
136 | | (off)) | ||
137 | #define ARM_LDRB_I(rt, rn, off) (ARM_INST_LDRB_I | (rt) << 12 | (rn) << 16 \ | ||
138 | | (off)) | ||
139 | #define ARM_LDRB_R(rt, rn, rm) (ARM_INST_LDRB_R | (rt) << 12 | (rn) << 16 \ | ||
140 | | (rm)) | ||
141 | #define ARM_LDRH_I(rt, rn, off) (ARM_INST_LDRH_I | (rt) << 12 | (rn) << 16 \ | ||
142 | | (((off) & 0xf0) << 4) | ((off) & 0xf)) | ||
143 | |||
144 | #define ARM_LDM(rn, regs) (ARM_INST_LDM | (rn) << 16 | (regs)) | ||
145 | |||
146 | #define ARM_LSL_R(rd, rn, rm) (_AL3_R(ARM_INST_LSL, rd, 0, rn) | (rm) << 8) | ||
147 | #define ARM_LSL_I(rd, rn, imm) (_AL3_I(ARM_INST_LSL, rd, 0, rn) | (imm) << 7) | ||
148 | |||
149 | #define ARM_LSR_R(rd, rn, rm) (_AL3_R(ARM_INST_LSR, rd, 0, rn) | (rm) << 8) | ||
150 | #define ARM_LSR_I(rd, rn, imm) (_AL3_I(ARM_INST_LSR, rd, 0, rn) | (imm) << 7) | ||
151 | |||
152 | #define ARM_MOV_R(rd, rm) _AL3_R(ARM_INST_MOV, rd, 0, rm) | ||
153 | #define ARM_MOV_I(rd, imm) _AL3_I(ARM_INST_MOV, rd, 0, imm) | ||
154 | |||
155 | #define ARM_MOVW(rd, imm) \ | ||
156 | (ARM_INST_MOVW | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff)) | ||
157 | |||
158 | #define ARM_MOVT(rd, imm) \ | ||
159 | (ARM_INST_MOVT | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff)) | ||
160 | |||
161 | #define ARM_MUL(rd, rm, rn) (ARM_INST_MUL | (rd) << 16 | (rm) << 8 | (rn)) | ||
162 | |||
163 | #define ARM_POP(regs) (ARM_INST_POP | (regs)) | ||
164 | #define ARM_PUSH(regs) (ARM_INST_PUSH | (regs)) | ||
165 | |||
166 | #define ARM_ORR_R(rd, rn, rm) _AL3_R(ARM_INST_ORR, rd, rn, rm) | ||
167 | #define ARM_ORR_I(rd, rn, imm) _AL3_I(ARM_INST_ORR, rd, rn, imm) | ||
168 | #define ARM_ORR_S(rd, rn, rm, type, rs) \ | ||
169 | (ARM_ORR_R(rd, rn, rm) | (type) << 5 | (rs) << 7) | ||
170 | |||
171 | #define ARM_REV(rd, rm) (ARM_INST_REV | (rd) << 12 | (rm)) | ||
172 | #define ARM_REV16(rd, rm) (ARM_INST_REV16 | (rd) << 12 | (rm)) | ||
173 | |||
174 | #define ARM_RSB_I(rd, rn, imm) _AL3_I(ARM_INST_RSB, rd, rn, imm) | ||
175 | |||
176 | #define ARM_SUB_R(rd, rn, rm) _AL3_R(ARM_INST_SUB, rd, rn, rm) | ||
177 | #define ARM_SUB_I(rd, rn, imm) _AL3_I(ARM_INST_SUB, rd, rn, imm) | ||
178 | |||
179 | #define ARM_STR_I(rt, rn, off) (ARM_INST_STR_I | (rt) << 12 | (rn) << 16 \ | ||
180 | | (off)) | ||
181 | |||
182 | #define ARM_TST_R(rn, rm) _AL3_R(ARM_INST_TST, 0, rn, rm) | ||
183 | #define ARM_TST_I(rn, imm) _AL3_I(ARM_INST_TST, 0, rn, imm) | ||
184 | |||
185 | #define ARM_UDIV(rd, rn, rm) (ARM_INST_UDIV | (rd) << 16 | (rn) | (rm) << 8) | ||
186 | |||
187 | #define ARM_UMULL(rd_lo, rd_hi, rn, rm) (ARM_INST_UMULL | (rd_hi) << 16 \ | ||
188 | | (rd_lo) << 12 | (rm) << 8 | rn) | ||
189 | |||
190 | #endif /* PFILTER_OPCODES_ARM_H */ | ||
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h index a599f01f8b92..0630513554de 100644 --- a/arch/arm/plat-mxc/include/mach/hardware.h +++ b/arch/arm/plat-mxc/include/mach/hardware.h | |||
@@ -22,11 +22,8 @@ | |||
22 | 22 | ||
23 | #include <asm/sizes.h> | 23 | #include <asm/sizes.h> |
24 | 24 | ||
25 | #ifdef __ASSEMBLER__ | 25 | #define addr_in_module(addr, mod) \ |
26 | #define IOMEM(addr) (addr) | 26 | ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE) |
27 | #else | ||
28 | #define IOMEM(addr) ((void __force __iomem *)(addr)) | ||
29 | #endif | ||
30 | 27 | ||
31 | #define IMX_IO_P2V_MODULE(addr, module) \ | 28 | #define IMX_IO_P2V_MODULE(addr, module) \ |
32 | (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \ | 29 | (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \ |
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h deleted file mode 100644 index 338300b18b00..000000000000 --- a/arch/arm/plat-mxc/include/mach/io.h +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
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_MXC_IO_H__ | ||
12 | #define __ASM_ARCH_MXC_IO_H__ | ||
13 | |||
14 | /* Allow IO space to be anywhere in the memory */ | ||
15 | #define IO_SPACE_LIMIT 0xffffffff | ||
16 | |||
17 | #define __arch_ioremap __imx_ioremap | ||
18 | #define __arch_iounmap __iounmap | ||
19 | |||
20 | #define addr_in_module(addr, mod) \ | ||
21 | ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE) | ||
22 | |||
23 | extern void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int); | ||
24 | |||
25 | static inline void __iomem * | ||
26 | __imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) | ||
27 | { | ||
28 | if (imx_ioremap != NULL) | ||
29 | return imx_ioremap(phys_addr, size, mtype); | ||
30 | else | ||
31 | return __arm_ioremap(phys_addr, size, mtype); | ||
32 | } | ||
33 | |||
34 | /* io address mapping macro */ | ||
35 | #define __io(a) __typesafe_io(a) | ||
36 | |||
37 | #define __mem_pci(a) (a) | ||
38 | |||
39 | #endif | ||
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig index bca4914b4b9d..4c48c8b60b54 100644 --- a/arch/arm/plat-nomadik/Kconfig +++ b/arch/arm/plat-nomadik/Kconfig | |||
@@ -23,7 +23,6 @@ config HAS_MTU | |||
23 | config NOMADIK_MTU_SCHED_CLOCK | 23 | config NOMADIK_MTU_SCHED_CLOCK |
24 | bool | 24 | bool |
25 | depends on HAS_MTU | 25 | depends on HAS_MTU |
26 | select HAVE_SCHED_CLOCK | ||
27 | help | 26 | help |
28 | Use the Multi Timer Unit as the sched_clock. | 27 | Use the Multi Timer Unit as the sched_clock. |
29 | 28 | ||
diff --git a/arch/arm/plat-nomadik/include/plat/ste_dma40.h b/arch/arm/plat-nomadik/include/plat/ste_dma40.h index fd0ee84c45d1..9ff93b065686 100644 --- a/arch/arm/plat-nomadik/include/plat/ste_dma40.h +++ b/arch/arm/plat-nomadik/include/plat/ste_dma40.h | |||
@@ -200,8 +200,7 @@ dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan, | |||
200 | sg.dma_address = addr; | 200 | sg.dma_address = addr; |
201 | sg.length = size; | 201 | sg.length = size; |
202 | 202 | ||
203 | return chan->device->device_prep_slave_sg(chan, &sg, 1, | 203 | return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags); |
204 | direction, flags); | ||
205 | } | 204 | } |
206 | 205 | ||
207 | #else | 206 | #else |
diff --git a/arch/arm/plat-omap/include/plat/hardware.h b/arch/arm/plat-omap/include/plat/hardware.h index 537b05ae1f51..e897978371c2 100644 --- a/arch/arm/plat-omap/include/plat/hardware.h +++ b/arch/arm/plat-omap/include/plat/hardware.h | |||
@@ -43,12 +43,6 @@ | |||
43 | #endif | 43 | #endif |
44 | #include <plat/serial.h> | 44 | #include <plat/serial.h> |
45 | 45 | ||
46 | #ifdef __ASSEMBLER__ | ||
47 | #define IOMEM(x) (x) | ||
48 | #else | ||
49 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
50 | #endif | ||
51 | |||
52 | /* | 46 | /* |
53 | * --------------------------------------------------------------------------- | 47 | * --------------------------------------------------------------------------- |
54 | * Common definitions for all OMAP processors | 48 | * Common definitions for all OMAP processors |
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h index 925b12b500dc..9bb978ecd884 100644 --- a/arch/arm/plat-omap/include/plat/sdrc.h +++ b/arch/arm/plat-omap/include/plat/sdrc.h | |||
@@ -16,7 +16,6 @@ | |||
16 | * published by the Free Software Foundation. | 16 | * published by the Free Software Foundation. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <mach/io.h> | ||
20 | 19 | ||
21 | /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ | 20 | /* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ |
22 | 21 | ||
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index d0fc9f4dc155..762eeb0626c1 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h | |||
@@ -112,7 +112,6 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend); | |||
112 | */ | 112 | */ |
113 | 113 | ||
114 | #define OMAP2_L4_IO_OFFSET 0xb2000000 | 114 | #define OMAP2_L4_IO_OFFSET 0xb2000000 |
115 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
116 | #define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) | 115 | #define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) |
117 | 116 | ||
118 | static inline u8 omap_readb(u32 pa) | 117 | static inline u8 omap_readb(u32 pa) |
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c index 301d9c319d0b..eb9f4f534006 100644 --- a/arch/arm/plat-samsung/dma-ops.c +++ b/arch/arm/plat-samsung/dma-ops.c | |||
@@ -79,11 +79,11 @@ static int samsung_dmadev_prepare(unsigned ch, | |||
79 | info->len, offset_in_page(info->buf)); | 79 | info->len, offset_in_page(info->buf)); |
80 | sg_dma_address(&sg) = info->buf; | 80 | sg_dma_address(&sg) = info->buf; |
81 | 81 | ||
82 | desc = chan->device->device_prep_slave_sg(chan, | 82 | desc = dmaengine_prep_slave_sg(chan, |
83 | &sg, 1, info->direction, DMA_PREP_INTERRUPT); | 83 | &sg, 1, info->direction, DMA_PREP_INTERRUPT); |
84 | break; | 84 | break; |
85 | case DMA_CYCLIC: | 85 | case DMA_CYCLIC: |
86 | desc = chan->device->device_prep_dma_cyclic(chan, | 86 | desc = dmaengine_prep_dma_cyclic(chan, |
87 | info->buf, info->len, info->period, info->direction); | 87 | info->buf, info->len, info->period, info->direction); |
88 | break; | 88 | break; |
89 | default: | 89 | default: |
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h index 66d677225d15..70187d763e26 100644 --- a/arch/arm/plat-spear/include/plat/hardware.h +++ b/arch/arm/plat-spear/include/plat/hardware.h | |||
@@ -14,10 +14,4 @@ | |||
14 | #ifndef __PLAT_HARDWARE_H | 14 | #ifndef __PLAT_HARDWARE_H |
15 | #define __PLAT_HARDWARE_H | 15 | #define __PLAT_HARDWARE_H |
16 | 16 | ||
17 | #ifndef __ASSEMBLY__ | ||
18 | #define IOMEM(x) ((void __iomem __force *)(x)) | ||
19 | #else | ||
20 | #define IOMEM(x) (x) | ||
21 | #endif | ||
22 | |||
23 | #endif /* __PLAT_HARDWARE_H */ | 17 | #endif /* __PLAT_HARDWARE_H */ |
diff --git a/arch/arm/plat-spear/include/plat/io.h b/arch/arm/plat-spear/include/plat/io.h deleted file mode 100644 index 4d4ba822b3eb..000000000000 --- a/arch/arm/plat-spear/include/plat/io.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/plat-spear/include/plat/io.h | ||
3 | * | ||
4 | * IO definitions for SPEAr platform | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar<viresh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __PLAT_IO_H | ||
15 | #define __PLAT_IO_H | ||
16 | |||
17 | #define IO_SPACE_LIMIT 0xFFFFFFFF | ||
18 | |||
19 | #define __io(a) __typesafe_io(a) | ||
20 | #define __mem_pci(a) (a) | ||
21 | |||
22 | #endif /* __PLAT_IO_H */ | ||
diff --git a/arch/arm/plat-spear/include/plat/keyboard.h b/arch/arm/plat-spear/include/plat/keyboard.h index c16cc31ecbed..0562f134621d 100644 --- a/arch/arm/plat-spear/include/plat/keyboard.h +++ b/arch/arm/plat-spear/include/plat/keyboard.h | |||
@@ -159,11 +159,4 @@ struct kbd_platform_data { | |||
159 | unsigned int mode; | 159 | unsigned int mode; |
160 | }; | 160 | }; |
161 | 161 | ||
162 | /* This function is used to set platform data field of pdev->dev */ | ||
163 | static inline void | ||
164 | kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data) | ||
165 | { | ||
166 | pdev->dev.platform_data = data; | ||
167 | } | ||
168 | |||
169 | #endif /* __PLAT_KEYBOARD_H */ | 162 | #endif /* __PLAT_KEYBOARD_H */ |
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig index 52353beb369d..043f7b02a9e7 100644 --- a/arch/arm/plat-versatile/Kconfig +++ b/arch/arm/plat-versatile/Kconfig | |||
@@ -11,7 +11,6 @@ config PLAT_VERSATILE_LEDS | |||
11 | depends on ARCH_REALVIEW || ARCH_VERSATILE | 11 | depends on ARCH_REALVIEW || ARCH_VERSATILE |
12 | 12 | ||
13 | config PLAT_VERSATILE_SCHED_CLOCK | 13 | config PLAT_VERSATILE_SCHED_CLOCK |
14 | def_bool y if !ARCH_INTEGRATOR_AP | 14 | def_bool y |
15 | select HAVE_SCHED_CLOCK | ||
16 | 15 | ||
17 | endif | 16 | endif |