diff options
Diffstat (limited to 'arch/arm')
423 files changed, 9321 insertions, 25136 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 70505d8f85c5..8ac460a8f4ca 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -345,22 +345,12 @@ config ARCH_BCM2835 | |||
345 | This enables support for the Broadcom BCM2835 SoC. This SoC is | 345 | This enables support for the Broadcom BCM2835 SoC. This SoC is |
346 | use in the Raspberry Pi, and Roku 2 devices. | 346 | use in the Raspberry Pi, and Roku 2 devices. |
347 | 347 | ||
348 | config ARCH_BCMRING | ||
349 | bool "Broadcom BCMRING" | ||
350 | depends on MMU | ||
351 | select CPU_V6 | ||
352 | select ARM_AMBA | ||
353 | select ARM_TIMER_SP804 | ||
354 | select CLKDEV_LOOKUP | ||
355 | select GENERIC_CLOCKEVENTS | ||
356 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
357 | help | ||
358 | Support for Broadcom's BCMRing platform. | ||
359 | |||
360 | config ARCH_CLPS711X | 348 | config ARCH_CLPS711X |
361 | bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" | 349 | bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" |
362 | select CPU_ARM720T | 350 | select CPU_ARM720T |
363 | select ARCH_USES_GETTIMEOFFSET | 351 | select ARCH_USES_GETTIMEOFFSET |
352 | select COMMON_CLK | ||
353 | select CLKDEV_LOOKUP | ||
364 | select NEED_MACH_MEMORY_H | 354 | select NEED_MACH_MEMORY_H |
365 | help | 355 | help |
366 | Support for Cirrus Logic 711x/721x/731x based boards. | 356 | Support for Cirrus Logic 711x/721x/731x based boards. |
@@ -458,7 +448,9 @@ config ARCH_MXS | |||
458 | select CLKSRC_MMIO | 448 | select CLKSRC_MMIO |
459 | select COMMON_CLK | 449 | select COMMON_CLK |
460 | select HAVE_CLK_PREPARE | 450 | select HAVE_CLK_PREPARE |
451 | select MULTI_IRQ_HANDLER | ||
461 | select PINCTRL | 452 | select PINCTRL |
453 | select SPARSE_IRQ | ||
462 | select USE_OF | 454 | select USE_OF |
463 | help | 455 | help |
464 | Support for Freescale MXS-based family of processors | 456 | Support for Freescale MXS-based family of processors |
@@ -900,6 +892,7 @@ config ARCH_NOMADIK | |||
900 | select COMMON_CLK | 892 | select COMMON_CLK |
901 | select GENERIC_CLOCKEVENTS | 893 | select GENERIC_CLOCKEVENTS |
902 | select PINCTRL | 894 | select PINCTRL |
895 | select PINCTRL_STN8815 | ||
903 | select MIGHT_HAVE_CACHE_L2X0 | 896 | select MIGHT_HAVE_CACHE_L2X0 |
904 | select ARCH_REQUIRE_GPIOLIB | 897 | select ARCH_REQUIRE_GPIOLIB |
905 | help | 898 | help |
@@ -951,6 +944,10 @@ config ARCH_VT8500 | |||
951 | select ARCH_HAS_CPUFREQ | 944 | select ARCH_HAS_CPUFREQ |
952 | select GENERIC_CLOCKEVENTS | 945 | select GENERIC_CLOCKEVENTS |
953 | select ARCH_REQUIRE_GPIOLIB | 946 | select ARCH_REQUIRE_GPIOLIB |
947 | select USE_OF | ||
948 | select COMMON_CLK | ||
949 | select HAVE_CLK | ||
950 | select CLKDEV_LOOKUP | ||
954 | help | 951 | help |
955 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. | 952 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. |
956 | 953 | ||
@@ -1021,8 +1018,6 @@ source "arch/arm/mach-mvebu/Kconfig" | |||
1021 | 1018 | ||
1022 | source "arch/arm/mach-at91/Kconfig" | 1019 | source "arch/arm/mach-at91/Kconfig" |
1023 | 1020 | ||
1024 | source "arch/arm/mach-bcmring/Kconfig" | ||
1025 | |||
1026 | source "arch/arm/mach-clps711x/Kconfig" | 1021 | source "arch/arm/mach-clps711x/Kconfig" |
1027 | 1022 | ||
1028 | source "arch/arm/mach-cns3xxx/Kconfig" | 1023 | source "arch/arm/mach-cns3xxx/Kconfig" |
@@ -1127,8 +1122,6 @@ source "arch/arm/mach-versatile/Kconfig" | |||
1127 | source "arch/arm/mach-vexpress/Kconfig" | 1122 | source "arch/arm/mach-vexpress/Kconfig" |
1128 | source "arch/arm/plat-versatile/Kconfig" | 1123 | source "arch/arm/plat-versatile/Kconfig" |
1129 | 1124 | ||
1130 | source "arch/arm/mach-vt8500/Kconfig" | ||
1131 | |||
1132 | source "arch/arm/mach-w90x900/Kconfig" | 1125 | source "arch/arm/mach-w90x900/Kconfig" |
1133 | 1126 | ||
1134 | # Definitions to make life easier | 1127 | # Definitions to make life easier |
@@ -1619,6 +1612,7 @@ config ARCH_NR_GPIO | |||
1619 | default 355 if ARCH_U8500 | 1612 | default 355 if ARCH_U8500 |
1620 | default 264 if MACH_H4700 | 1613 | default 264 if MACH_H4700 |
1621 | default 512 if SOC_OMAP5 | 1614 | default 512 if SOC_OMAP5 |
1615 | default 288 if ARCH_VT8500 | ||
1622 | default 0 | 1616 | default 0 |
1623 | help | 1617 | help |
1624 | Maximum number of GPIOs in the system. | 1618 | Maximum number of GPIOs in the system. |
@@ -1777,59 +1771,6 @@ config FORCE_MAX_ZONEORDER | |||
1777 | This config option is actually maximum order plus one. For example, | 1771 | This config option is actually maximum order plus one. For example, |
1778 | a value of 11 means that the largest free memory block is 2^10 pages. | 1772 | a value of 11 means that the largest free memory block is 2^10 pages. |
1779 | 1773 | ||
1780 | config LEDS | ||
1781 | bool "Timer and CPU usage LEDs" | ||
1782 | depends on ARCH_CDB89712 || ARCH_EBSA110 || \ | ||
1783 | ARCH_EBSA285 || ARCH_INTEGRATOR || \ | ||
1784 | ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ | ||
1785 | ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ | ||
1786 | ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \ | ||
1787 | ARCH_AT91 || ARCH_DAVINCI || \ | ||
1788 | ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW | ||
1789 | help | ||
1790 | If you say Y here, the LEDs on your machine will be used | ||
1791 | to provide useful information about your current system status. | ||
1792 | |||
1793 | If you are compiling a kernel for a NetWinder or EBSA-285, you will | ||
1794 | be able to select which LEDs are active using the options below. If | ||
1795 | you are compiling a kernel for the EBSA-110 or the LART however, the | ||
1796 | red LED will simply flash regularly to indicate that the system is | ||
1797 | still functional. It is safe to say Y here if you have a CATS | ||
1798 | system, but the driver will do nothing. | ||
1799 | |||
1800 | config LEDS_TIMER | ||
1801 | bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \ | ||
1802 | OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1803 | || MACH_OMAP_PERSEUS2 | ||
1804 | depends on LEDS | ||
1805 | depends on !GENERIC_CLOCKEVENTS | ||
1806 | default y if ARCH_EBSA110 | ||
1807 | help | ||
1808 | If you say Y here, one of the system LEDs (the green one on the | ||
1809 | NetWinder, the amber one on the EBSA285, or the red one on the LART) | ||
1810 | will flash regularly to indicate that the system is still | ||
1811 | operational. This is mainly useful to kernel hackers who are | ||
1812 | debugging unstable kernels. | ||
1813 | |||
1814 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1815 | functions. You may choose to use both, but the Timer LED function | ||
1816 | will overrule the CPU usage LED. | ||
1817 | |||
1818 | config LEDS_CPU | ||
1819 | bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \ | ||
1820 | !ARCH_OMAP) \ | ||
1821 | || OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1822 | || MACH_OMAP_PERSEUS2 | ||
1823 | depends on LEDS | ||
1824 | help | ||
1825 | If you say Y here, the red LED will be used to give a good real | ||
1826 | time indication of CPU usage, by lighting whenever the idle task | ||
1827 | is not currently executing. | ||
1828 | |||
1829 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1830 | functions. You may choose to use both, but the Timer LED function | ||
1831 | will overrule the CPU usage LED. | ||
1832 | |||
1833 | config ALIGNMENT_TRAP | 1774 | config ALIGNMENT_TRAP |
1834 | bool | 1775 | bool |
1835 | depends on CPU_CP15_MMU | 1776 | depends on CPU_CP15_MMU |
@@ -1893,6 +1834,16 @@ config DEPRECATED_PARAM_STRUCT | |||
1893 | This was deprecated in 2001 and announced to live on for 5 years. | 1834 | This was deprecated in 2001 and announced to live on for 5 years. |
1894 | Some old boot loaders still use this way. | 1835 | Some old boot loaders still use this way. |
1895 | 1836 | ||
1837 | config XEN_DOM0 | ||
1838 | def_bool y | ||
1839 | depends on XEN | ||
1840 | |||
1841 | config XEN | ||
1842 | bool "Xen guest support on ARM (EXPERIMENTAL)" | ||
1843 | depends on EXPERIMENTAL && ARM && OF | ||
1844 | help | ||
1845 | Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. | ||
1846 | |||
1896 | endmenu | 1847 | endmenu |
1897 | 1848 | ||
1898 | menu "Boot options" | 1849 | menu "Boot options" |
@@ -2309,7 +2260,7 @@ menu "Power management options" | |||
2309 | source "kernel/power/Kconfig" | 2260 | source "kernel/power/Kconfig" |
2310 | 2261 | ||
2311 | config ARCH_SUSPEND_POSSIBLE | 2262 | config ARCH_SUSPEND_POSSIBLE |
2312 | depends on !ARCH_S5PC100 && !ARCH_TEGRA | 2263 | depends on !ARCH_S5PC100 |
2313 | depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ | 2264 | depends on CPU_ARM920T || CPU_ARM926T || CPU_SA1100 || \ |
2314 | CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK | 2265 | CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE || CPU_MOHAWK |
2315 | def_bool y | 2266 | def_bool y |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index a7eb28260b2e..b0f3857b3a4c 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -224,6 +224,20 @@ choice | |||
224 | Say Y here if you want kernel low-level debugging support | 224 | Say Y here if you want kernel low-level debugging support |
225 | on i.MX6Q UART4. | 225 | on i.MX6Q UART4. |
226 | 226 | ||
227 | config DEBUG_MMP_UART2 | ||
228 | bool "Kernel low-level debugging message via MMP UART2" | ||
229 | depends on ARCH_MMP | ||
230 | help | ||
231 | Say Y here if you want kernel low-level debugging support | ||
232 | on MMP UART2. | ||
233 | |||
234 | config DEBUG_MMP_UART3 | ||
235 | bool "Kernel low-level debugging message via MMP UART3" | ||
236 | depends on ARCH_MMP | ||
237 | help | ||
238 | Say Y here if you want kernel low-level debugging support | ||
239 | on MMP UART3. | ||
240 | |||
227 | config DEBUG_MSM_UART1 | 241 | config DEBUG_MSM_UART1 |
228 | bool "Kernel low-level debugging messages via MSM UART1" | 242 | bool "Kernel low-level debugging messages via MSM UART1" |
229 | depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 | 243 | depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 1c974cf9db1b..40ea991b6782 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -137,7 +137,6 @@ textofs-$(CONFIG_ARCH_MSM8960) := 0x00208000 | |||
137 | # by CONFIG_* macro name. | 137 | # by CONFIG_* macro name. |
138 | machine-$(CONFIG_ARCH_AT91) += at91 | 138 | machine-$(CONFIG_ARCH_AT91) += at91 |
139 | machine-$(CONFIG_ARCH_BCM2835) += bcm2835 | 139 | machine-$(CONFIG_ARCH_BCM2835) += bcm2835 |
140 | machine-$(CONFIG_ARCH_BCMRING) += bcmring | ||
141 | machine-$(CONFIG_ARCH_CLPS711X) += clps711x | 140 | machine-$(CONFIG_ARCH_CLPS711X) += clps711x |
142 | machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx | 141 | machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx |
143 | machine-$(CONFIG_ARCH_DAVINCI) += davinci | 142 | machine-$(CONFIG_ARCH_DAVINCI) += davinci |
@@ -251,10 +250,12 @@ endif | |||
251 | core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ | 250 | core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ |
252 | core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) | 251 | core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) |
253 | core-$(CONFIG_VFP) += arch/arm/vfp/ | 252 | core-$(CONFIG_VFP) += arch/arm/vfp/ |
253 | core-$(CONFIG_XEN) += arch/arm/xen/ | ||
254 | 254 | ||
255 | # If we have a machine-specific directory, then include it in the build. | 255 | # If we have a machine-specific directory, then include it in the build. |
256 | core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ | 256 | core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ |
257 | core-y += arch/arm/net/ | 257 | core-y += arch/arm/net/ |
258 | core-y += arch/arm/crypto/ | ||
258 | core-y += $(machdirs) $(platdirs) | 259 | core-y += $(machdirs) $(platdirs) |
259 | 260 | ||
260 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ | 261 | drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 81769c1341fa..bc67cbff3944 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -653,6 +653,7 @@ __armv7_mmu_cache_on: | |||
653 | mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs | 653 | mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs |
654 | #endif | 654 | #endif |
655 | mrc p15, 0, r0, c1, c0, 0 @ read control reg | 655 | mrc p15, 0, r0, c1, c0, 0 @ read control reg |
656 | bic r0, r0, #1 << 28 @ clear SCTLR.TRE | ||
656 | orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement | 657 | orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement |
657 | orr r0, r0, #0x003c @ write buffer | 658 | orr r0, r0, #0x003c @ write buffer |
658 | #ifdef CONFIG_MMU | 659 | #ifdef CONFIG_MMU |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d4ad2df08920..29f541f0e653 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -22,6 +22,7 @@ dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ | |||
22 | dove-dove-db.dtb | 22 | dove-dove-db.dtb |
23 | dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ | 23 | dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ |
24 | exynos4210-smdkv310.dtb \ | 24 | exynos4210-smdkv310.dtb \ |
25 | exynos4210-trats.dtb \ | ||
25 | exynos5250-smdk5250.dtb | 26 | exynos5250-smdk5250.dtb |
26 | dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb | 27 | dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb |
27 | dtb-$(CONFIG_ARCH_IMX5) += imx51-babbage.dtb \ | 28 | dtb-$(CONFIG_ARCH_IMX5) += imx51-babbage.dtb \ |
@@ -101,6 +102,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ | |||
101 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ | 102 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ |
102 | vexpress-v2p-ca9.dtb \ | 103 | vexpress-v2p-ca9.dtb \ |
103 | vexpress-v2p-ca15-tc1.dtb \ | 104 | vexpress-v2p-ca15-tc1.dtb \ |
104 | vexpress-v2p-ca15_a7.dtb | 105 | vexpress-v2p-ca15_a7.dtb \ |
106 | xenvm-4.2.dtb | ||
105 | 107 | ||
106 | endif | 108 | endif |
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 66389c1c6f62..7c95f76398de 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi | |||
@@ -104,6 +104,7 @@ | |||
104 | #gpio-cells = <2>; | 104 | #gpio-cells = <2>; |
105 | gpio-controller; | 105 | gpio-controller; |
106 | interrupt-controller; | 106 | interrupt-controller; |
107 | #interrupt-cells = <2>; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | pioB: gpio@fffff600 { | 110 | pioB: gpio@fffff600 { |
@@ -113,6 +114,7 @@ | |||
113 | #gpio-cells = <2>; | 114 | #gpio-cells = <2>; |
114 | gpio-controller; | 115 | gpio-controller; |
115 | interrupt-controller; | 116 | interrupt-controller; |
117 | #interrupt-cells = <2>; | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | pioC: gpio@fffff800 { | 120 | pioC: gpio@fffff800 { |
@@ -122,6 +124,7 @@ | |||
122 | #gpio-cells = <2>; | 124 | #gpio-cells = <2>; |
123 | gpio-controller; | 125 | gpio-controller; |
124 | interrupt-controller; | 126 | interrupt-controller; |
127 | #interrupt-cells = <2>; | ||
125 | }; | 128 | }; |
126 | 129 | ||
127 | dbgu: serial@fffff200 { | 130 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index b460d6ce9eb5..195019b7ca0e 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi | |||
@@ -95,6 +95,7 @@ | |||
95 | #gpio-cells = <2>; | 95 | #gpio-cells = <2>; |
96 | gpio-controller; | 96 | gpio-controller; |
97 | interrupt-controller; | 97 | interrupt-controller; |
98 | #interrupt-cells = <2>; | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | pioB: gpio@fffff400 { | 101 | pioB: gpio@fffff400 { |
@@ -104,6 +105,7 @@ | |||
104 | #gpio-cells = <2>; | 105 | #gpio-cells = <2>; |
105 | gpio-controller; | 106 | gpio-controller; |
106 | interrupt-controller; | 107 | interrupt-controller; |
108 | #interrupt-cells = <2>; | ||
107 | }; | 109 | }; |
108 | 110 | ||
109 | pioC: gpio@fffff600 { | 111 | pioC: gpio@fffff600 { |
@@ -113,6 +115,7 @@ | |||
113 | #gpio-cells = <2>; | 115 | #gpio-cells = <2>; |
114 | gpio-controller; | 116 | gpio-controller; |
115 | interrupt-controller; | 117 | interrupt-controller; |
118 | #interrupt-cells = <2>; | ||
116 | }; | 119 | }; |
117 | 120 | ||
118 | pioD: gpio@fffff800 { | 121 | pioD: gpio@fffff800 { |
@@ -122,6 +125,7 @@ | |||
122 | #gpio-cells = <2>; | 125 | #gpio-cells = <2>; |
123 | gpio-controller; | 126 | gpio-controller; |
124 | interrupt-controller; | 127 | interrupt-controller; |
128 | #interrupt-cells = <2>; | ||
125 | }; | 129 | }; |
126 | 130 | ||
127 | pioE: gpio@fffffa00 { | 131 | pioE: gpio@fffffa00 { |
@@ -131,6 +135,7 @@ | |||
131 | #gpio-cells = <2>; | 135 | #gpio-cells = <2>; |
132 | gpio-controller; | 136 | gpio-controller; |
133 | interrupt-controller; | 137 | interrupt-controller; |
138 | #interrupt-cells = <2>; | ||
134 | }; | 139 | }; |
135 | 140 | ||
136 | dbgu: serial@ffffee00 { | 141 | dbgu: serial@ffffee00 { |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index bafa8806fc17..63751b1e744b 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -113,6 +113,7 @@ | |||
113 | #gpio-cells = <2>; | 113 | #gpio-cells = <2>; |
114 | gpio-controller; | 114 | gpio-controller; |
115 | interrupt-controller; | 115 | interrupt-controller; |
116 | #interrupt-cells = <2>; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | pioB: gpio@fffff400 { | 119 | pioB: gpio@fffff400 { |
@@ -122,6 +123,7 @@ | |||
122 | #gpio-cells = <2>; | 123 | #gpio-cells = <2>; |
123 | gpio-controller; | 124 | gpio-controller; |
124 | interrupt-controller; | 125 | interrupt-controller; |
126 | #interrupt-cells = <2>; | ||
125 | }; | 127 | }; |
126 | 128 | ||
127 | pioC: gpio@fffff600 { | 129 | pioC: gpio@fffff600 { |
@@ -131,6 +133,7 @@ | |||
131 | #gpio-cells = <2>; | 133 | #gpio-cells = <2>; |
132 | gpio-controller; | 134 | gpio-controller; |
133 | interrupt-controller; | 135 | interrupt-controller; |
136 | #interrupt-cells = <2>; | ||
134 | }; | 137 | }; |
135 | 138 | ||
136 | pioD: gpio@fffff800 { | 139 | pioD: gpio@fffff800 { |
@@ -140,6 +143,7 @@ | |||
140 | #gpio-cells = <2>; | 143 | #gpio-cells = <2>; |
141 | gpio-controller; | 144 | gpio-controller; |
142 | interrupt-controller; | 145 | interrupt-controller; |
146 | #interrupt-cells = <2>; | ||
143 | }; | 147 | }; |
144 | 148 | ||
145 | pioE: gpio@fffffa00 { | 149 | pioE: gpio@fffffa00 { |
@@ -149,6 +153,7 @@ | |||
149 | #gpio-cells = <2>; | 153 | #gpio-cells = <2>; |
150 | gpio-controller; | 154 | gpio-controller; |
151 | interrupt-controller; | 155 | interrupt-controller; |
156 | #interrupt-cells = <2>; | ||
152 | }; | 157 | }; |
153 | 158 | ||
154 | dbgu: serial@ffffee00 { | 159 | dbgu: serial@ffffee00 { |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index bfac0dfc332c..ef9336ae9614 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
@@ -107,6 +107,7 @@ | |||
107 | #gpio-cells = <2>; | 107 | #gpio-cells = <2>; |
108 | gpio-controller; | 108 | gpio-controller; |
109 | interrupt-controller; | 109 | interrupt-controller; |
110 | #interrupt-cells = <2>; | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | pioB: gpio@fffff600 { | 113 | pioB: gpio@fffff600 { |
@@ -116,6 +117,7 @@ | |||
116 | #gpio-cells = <2>; | 117 | #gpio-cells = <2>; |
117 | gpio-controller; | 118 | gpio-controller; |
118 | interrupt-controller; | 119 | interrupt-controller; |
120 | #interrupt-cells = <2>; | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | pioC: gpio@fffff800 { | 123 | pioC: gpio@fffff800 { |
@@ -125,6 +127,7 @@ | |||
125 | #gpio-cells = <2>; | 127 | #gpio-cells = <2>; |
126 | gpio-controller; | 128 | gpio-controller; |
127 | interrupt-controller; | 129 | interrupt-controller; |
130 | #interrupt-cells = <2>; | ||
128 | }; | 131 | }; |
129 | 132 | ||
130 | pioD: gpio@fffffa00 { | 133 | pioD: gpio@fffffa00 { |
@@ -134,6 +137,7 @@ | |||
134 | #gpio-cells = <2>; | 137 | #gpio-cells = <2>; |
135 | gpio-controller; | 138 | gpio-controller; |
136 | interrupt-controller; | 139 | interrupt-controller; |
140 | #interrupt-cells = <2>; | ||
137 | }; | 141 | }; |
138 | 142 | ||
139 | dbgu: serial@fffff200 { | 143 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 4a18c393b136..8a387a8d61b7 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -115,6 +115,7 @@ | |||
115 | #gpio-cells = <2>; | 115 | #gpio-cells = <2>; |
116 | gpio-controller; | 116 | gpio-controller; |
117 | interrupt-controller; | 117 | interrupt-controller; |
118 | #interrupt-cells = <2>; | ||
118 | }; | 119 | }; |
119 | 120 | ||
120 | pioB: gpio@fffff600 { | 121 | pioB: gpio@fffff600 { |
@@ -124,6 +125,7 @@ | |||
124 | #gpio-cells = <2>; | 125 | #gpio-cells = <2>; |
125 | gpio-controller; | 126 | gpio-controller; |
126 | interrupt-controller; | 127 | interrupt-controller; |
128 | #interrupt-cells = <2>; | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | pioC: gpio@fffff800 { | 131 | pioC: gpio@fffff800 { |
@@ -133,6 +135,7 @@ | |||
133 | #gpio-cells = <2>; | 135 | #gpio-cells = <2>; |
134 | gpio-controller; | 136 | gpio-controller; |
135 | interrupt-controller; | 137 | interrupt-controller; |
138 | #interrupt-cells = <2>; | ||
136 | }; | 139 | }; |
137 | 140 | ||
138 | pioD: gpio@fffffa00 { | 141 | pioD: gpio@fffffa00 { |
@@ -142,6 +145,7 @@ | |||
142 | #gpio-cells = <2>; | 145 | #gpio-cells = <2>; |
143 | gpio-controller; | 146 | gpio-controller; |
144 | interrupt-controller; | 147 | interrupt-controller; |
148 | #interrupt-cells = <2>; | ||
145 | }; | 149 | }; |
146 | 150 | ||
147 | dbgu: serial@fffff200 { | 151 | dbgu: serial@fffff200 { |
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index 3180a9c588b9..748ba7aa746c 100644 --- a/arch/arm/boot/dts/db8500.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi | |||
@@ -194,6 +194,8 @@ | |||
194 | interrupts = <0 47 0x4>; | 194 | interrupts = <0 47 0x4>; |
195 | #address-cells = <1>; | 195 | #address-cells = <1>; |
196 | #size-cells = <1>; | 196 | #size-cells = <1>; |
197 | interrupt-controller; | ||
198 | #interrupt-cells = <2>; | ||
197 | ranges; | 199 | ranges; |
198 | 200 | ||
199 | prcmu-timer-4@80157450 { | 201 | prcmu-timer-4@80157450 { |
@@ -330,6 +332,7 @@ | |||
330 | ab8500@5 { | 332 | ab8500@5 { |
331 | compatible = "stericsson,ab8500"; | 333 | compatible = "stericsson,ab8500"; |
332 | reg = <5>; /* mailbox 5 is i2c */ | 334 | reg = <5>; /* mailbox 5 is i2c */ |
335 | interrupt-parent = <&intc>; | ||
333 | interrupts = <0 40 0x4>; | 336 | interrupts = <0 40 0x4>; |
334 | interrupt-controller; | 337 | interrupt-controller; |
335 | #interrupt-cells = <2>; | 338 | #interrupt-cells = <2>; |
@@ -371,7 +374,7 @@ | |||
371 | }; | 374 | }; |
372 | 375 | ||
373 | ab8500-ponkey { | 376 | ab8500-ponkey { |
374 | compatible = "stericsson,ab8500-ponkey"; | 377 | compatible = "stericsson,ab8500-poweron-key"; |
375 | interrupts = <6 0x4 | 378 | interrupts = <6 0x4 |
376 | 7 0x4>; | 379 | 7 0x4>; |
377 | interrupt-names = "ONKEY_DBF", "ONKEY_DBR"; | 380 | interrupt-names = "ONKEY_DBF", "ONKEY_DBR"; |
@@ -389,6 +392,12 @@ | |||
389 | compatible = "stericsson,ab8500-debug"; | 392 | compatible = "stericsson,ab8500-debug"; |
390 | }; | 393 | }; |
391 | 394 | ||
395 | codec: ab8500-codec { | ||
396 | compatible = "stericsson,ab8500-codec"; | ||
397 | |||
398 | stericsson,earpeice-cmv = <950>; /* Units in mV. */ | ||
399 | }; | ||
400 | |||
392 | ab8500-regulators { | 401 | ab8500-regulators { |
393 | compatible = "stericsson,ab8500-regulator"; | 402 | compatible = "stericsson,ab8500-regulator"; |
394 | 403 | ||
@@ -471,48 +480,63 @@ | |||
471 | }; | 480 | }; |
472 | 481 | ||
473 | i2c@80004000 { | 482 | i2c@80004000 { |
474 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; | 483 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
475 | reg = <0x80004000 0x1000>; | 484 | reg = <0x80004000 0x1000>; |
476 | interrupts = <0 21 0x4>; | 485 | interrupts = <0 21 0x4>; |
477 | #address-cells = <1>; | 486 | #address-cells = <1>; |
478 | #size-cells = <0>; | 487 | #size-cells = <0>; |
488 | v-i2c-supply = <&db8500_vape_reg>; | ||
489 | |||
490 | clock-frequency = <400000>; | ||
479 | }; | 491 | }; |
480 | 492 | ||
481 | i2c@80122000 { | 493 | i2c@80122000 { |
482 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; | 494 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
483 | reg = <0x80122000 0x1000>; | 495 | reg = <0x80122000 0x1000>; |
484 | interrupts = <0 22 0x4>; | 496 | interrupts = <0 22 0x4>; |
485 | #address-cells = <1>; | 497 | #address-cells = <1>; |
486 | #size-cells = <0>; | 498 | #size-cells = <0>; |
499 | v-i2c-supply = <&db8500_vape_reg>; | ||
500 | |||
501 | clock-frequency = <400000>; | ||
487 | }; | 502 | }; |
488 | 503 | ||
489 | i2c@80128000 { | 504 | i2c@80128000 { |
490 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; | 505 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
491 | reg = <0x80128000 0x1000>; | 506 | reg = <0x80128000 0x1000>; |
492 | interrupts = <0 55 0x4>; | 507 | interrupts = <0 55 0x4>; |
493 | #address-cells = <1>; | 508 | #address-cells = <1>; |
494 | #size-cells = <0>; | 509 | #size-cells = <0>; |
510 | v-i2c-supply = <&db8500_vape_reg>; | ||
511 | |||
512 | clock-frequency = <400000>; | ||
495 | }; | 513 | }; |
496 | 514 | ||
497 | i2c@80110000 { | 515 | i2c@80110000 { |
498 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; | 516 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
499 | reg = <0x80110000 0x1000>; | 517 | reg = <0x80110000 0x1000>; |
500 | interrupts = <0 12 0x4>; | 518 | interrupts = <0 12 0x4>; |
501 | #address-cells = <1>; | 519 | #address-cells = <1>; |
502 | #size-cells = <0>; | 520 | #size-cells = <0>; |
521 | v-i2c-supply = <&db8500_vape_reg>; | ||
522 | |||
523 | clock-frequency = <400000>; | ||
503 | }; | 524 | }; |
504 | 525 | ||
505 | i2c@8012a000 { | 526 | i2c@8012a000 { |
506 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c"; | 527 | compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; |
507 | reg = <0x8012a000 0x1000>; | 528 | reg = <0x8012a000 0x1000>; |
508 | interrupts = <0 51 0x4>; | 529 | interrupts = <0 51 0x4>; |
509 | #address-cells = <1>; | 530 | #address-cells = <1>; |
510 | #size-cells = <0>; | 531 | #size-cells = <0>; |
532 | v-i2c-supply = <&db8500_vape_reg>; | ||
533 | |||
534 | clock-frequency = <400000>; | ||
511 | }; | 535 | }; |
512 | 536 | ||
513 | ssp@80002000 { | 537 | ssp@80002000 { |
514 | compatible = "arm,pl022", "arm,primecell"; | 538 | compatible = "arm,pl022", "arm,primecell"; |
515 | reg = <80002000 0x1000>; | 539 | reg = <0x80002000 0x1000>; |
516 | interrupts = <0 14 0x4>; | 540 | interrupts = <0 14 0x4>; |
517 | #address-cells = <1>; | 541 | #address-cells = <1>; |
518 | #size-cells = <0>; | 542 | #size-cells = <0>; |
@@ -580,6 +604,39 @@ | |||
580 | status = "disabled"; | 604 | status = "disabled"; |
581 | }; | 605 | }; |
582 | 606 | ||
607 | msp0: msp@80123000 { | ||
608 | compatible = "stericsson,ux500-msp-i2s"; | ||
609 | reg = <0x80123000 0x1000>; | ||
610 | interrupts = <0 31 0x4>; | ||
611 | v-ape-supply = <&db8500_vape_reg>; | ||
612 | status = "disabled"; | ||
613 | }; | ||
614 | |||
615 | msp1: msp@80124000 { | ||
616 | compatible = "stericsson,ux500-msp-i2s"; | ||
617 | reg = <0x80124000 0x1000>; | ||
618 | interrupts = <0 62 0x4>; | ||
619 | v-ape-supply = <&db8500_vape_reg>; | ||
620 | status = "disabled"; | ||
621 | }; | ||
622 | |||
623 | // HDMI sound | ||
624 | msp2: msp@80117000 { | ||
625 | compatible = "stericsson,ux500-msp-i2s"; | ||
626 | reg = <0x80117000 0x1000>; | ||
627 | interrupts = <0 98 0x4>; | ||
628 | v-ape-supply = <&db8500_vape_reg>; | ||
629 | status = "disabled"; | ||
630 | }; | ||
631 | |||
632 | msp3: msp@80125000 { | ||
633 | compatible = "stericsson,ux500-msp-i2s"; | ||
634 | reg = <0x80125000 0x1000>; | ||
635 | interrupts = <0 62 0x4>; | ||
636 | v-ape-supply = <&db8500_vape_reg>; | ||
637 | status = "disabled"; | ||
638 | }; | ||
639 | |||
583 | external-bus@50000000 { | 640 | external-bus@50000000 { |
584 | compatible = "simple-bus"; | 641 | compatible = "simple-bus"; |
585 | reg = <0x50000000 0x4000000>; | 642 | reg = <0x50000000 0x4000000>; |
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi new file mode 100644 index 000000000000..a26c3dd58269 --- /dev/null +++ b/arch/arm/boot/dts/exynos4.dtsi | |||
@@ -0,0 +1,248 @@ | |||
1 | /* | ||
2 | * Samsung's Exynos4 SoC series common device tree source | ||
3 | * | ||
4 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2010-2011 Linaro Ltd. | ||
7 | * www.linaro.org | ||
8 | * | ||
9 | * Samsung's Exynos4 SoC series device nodes are listed in this file. Particular | ||
10 | * SoCs from Exynos4 series can include this file and provide values for SoCs | ||
11 | * specfic bindings. | ||
12 | * | ||
13 | * Note: This file does not include device nodes for all the controllers in | ||
14 | * Exynos4 SoCs. As device tree coverage for Exynos4 increases, additional | ||
15 | * nodes can be added to this file. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or modify | ||
18 | * it under the terms of the GNU General Public License version 2 as | ||
19 | * published by the Free Software Foundation. | ||
20 | */ | ||
21 | |||
22 | /include/ "skeleton.dtsi" | ||
23 | |||
24 | / { | ||
25 | interrupt-parent = <&gic>; | ||
26 | |||
27 | aliases { | ||
28 | spi0 = &spi_0; | ||
29 | spi1 = &spi_1; | ||
30 | spi2 = &spi_2; | ||
31 | }; | ||
32 | |||
33 | gic:interrupt-controller@10490000 { | ||
34 | compatible = "arm,cortex-a9-gic"; | ||
35 | #interrupt-cells = <3>; | ||
36 | interrupt-controller; | ||
37 | reg = <0x10490000 0x1000>, <0x10480000 0x100>; | ||
38 | }; | ||
39 | |||
40 | combiner:interrupt-controller@10440000 { | ||
41 | compatible = "samsung,exynos4210-combiner"; | ||
42 | #interrupt-cells = <2>; | ||
43 | interrupt-controller; | ||
44 | reg = <0x10440000 0x1000>; | ||
45 | }; | ||
46 | |||
47 | watchdog@10060000 { | ||
48 | compatible = "samsung,s3c2410-wdt"; | ||
49 | reg = <0x10060000 0x100>; | ||
50 | interrupts = <0 43 0>; | ||
51 | status = "disabled"; | ||
52 | }; | ||
53 | |||
54 | rtc@10070000 { | ||
55 | compatible = "samsung,s3c6410-rtc"; | ||
56 | reg = <0x10070000 0x100>; | ||
57 | interrupts = <0 44 0>, <0 45 0>; | ||
58 | status = "disabled"; | ||
59 | }; | ||
60 | |||
61 | keypad@100A0000 { | ||
62 | compatible = "samsung,s5pv210-keypad"; | ||
63 | reg = <0x100A0000 0x100>; | ||
64 | interrupts = <0 109 0>; | ||
65 | status = "disabled"; | ||
66 | }; | ||
67 | |||
68 | sdhci@12510000 { | ||
69 | compatible = "samsung,exynos4210-sdhci"; | ||
70 | reg = <0x12510000 0x100>; | ||
71 | interrupts = <0 73 0>; | ||
72 | status = "disabled"; | ||
73 | }; | ||
74 | |||
75 | sdhci@12520000 { | ||
76 | compatible = "samsung,exynos4210-sdhci"; | ||
77 | reg = <0x12520000 0x100>; | ||
78 | interrupts = <0 74 0>; | ||
79 | status = "disabled"; | ||
80 | }; | ||
81 | |||
82 | sdhci@12530000 { | ||
83 | compatible = "samsung,exynos4210-sdhci"; | ||
84 | reg = <0x12530000 0x100>; | ||
85 | interrupts = <0 75 0>; | ||
86 | status = "disabled"; | ||
87 | }; | ||
88 | |||
89 | sdhci@12540000 { | ||
90 | compatible = "samsung,exynos4210-sdhci"; | ||
91 | reg = <0x12540000 0x100>; | ||
92 | interrupts = <0 76 0>; | ||
93 | status = "disabled"; | ||
94 | }; | ||
95 | |||
96 | serial@13800000 { | ||
97 | compatible = "samsung,exynos4210-uart"; | ||
98 | reg = <0x13800000 0x100>; | ||
99 | interrupts = <0 52 0>; | ||
100 | status = "disabled"; | ||
101 | }; | ||
102 | |||
103 | serial@13810000 { | ||
104 | compatible = "samsung,exynos4210-uart"; | ||
105 | reg = <0x13810000 0x100>; | ||
106 | interrupts = <0 53 0>; | ||
107 | status = "disabled"; | ||
108 | }; | ||
109 | |||
110 | serial@13820000 { | ||
111 | compatible = "samsung,exynos4210-uart"; | ||
112 | reg = <0x13820000 0x100>; | ||
113 | interrupts = <0 54 0>; | ||
114 | status = "disabled"; | ||
115 | }; | ||
116 | |||
117 | serial@13830000 { | ||
118 | compatible = "samsung,exynos4210-uart"; | ||
119 | reg = <0x13830000 0x100>; | ||
120 | interrupts = <0 55 0>; | ||
121 | status = "disabled"; | ||
122 | }; | ||
123 | |||
124 | i2c@13860000 { | ||
125 | #address-cells = <1>; | ||
126 | #size-cells = <0>; | ||
127 | compatible = "samsung,s3c2440-i2c"; | ||
128 | reg = <0x13860000 0x100>; | ||
129 | interrupts = <0 58 0>; | ||
130 | status = "disabled"; | ||
131 | }; | ||
132 | |||
133 | i2c@13870000 { | ||
134 | #address-cells = <1>; | ||
135 | #size-cells = <0>; | ||
136 | compatible = "samsung,s3c2440-i2c"; | ||
137 | reg = <0x13870000 0x100>; | ||
138 | interrupts = <0 59 0>; | ||
139 | status = "disabled"; | ||
140 | }; | ||
141 | |||
142 | i2c@13880000 { | ||
143 | #address-cells = <1>; | ||
144 | #size-cells = <0>; | ||
145 | compatible = "samsung,s3c2440-i2c"; | ||
146 | reg = <0x13880000 0x100>; | ||
147 | interrupts = <0 60 0>; | ||
148 | status = "disabled"; | ||
149 | }; | ||
150 | |||
151 | i2c@13890000 { | ||
152 | #address-cells = <1>; | ||
153 | #size-cells = <0>; | ||
154 | compatible = "samsung,s3c2440-i2c"; | ||
155 | reg = <0x13890000 0x100>; | ||
156 | interrupts = <0 61 0>; | ||
157 | status = "disabled"; | ||
158 | }; | ||
159 | |||
160 | i2c@138A0000 { | ||
161 | #address-cells = <1>; | ||
162 | #size-cells = <0>; | ||
163 | compatible = "samsung,s3c2440-i2c"; | ||
164 | reg = <0x138A0000 0x100>; | ||
165 | interrupts = <0 62 0>; | ||
166 | status = "disabled"; | ||
167 | }; | ||
168 | |||
169 | i2c@138B0000 { | ||
170 | #address-cells = <1>; | ||
171 | #size-cells = <0>; | ||
172 | compatible = "samsung,s3c2440-i2c"; | ||
173 | reg = <0x138B0000 0x100>; | ||
174 | interrupts = <0 63 0>; | ||
175 | status = "disabled"; | ||
176 | }; | ||
177 | |||
178 | i2c@138C0000 { | ||
179 | #address-cells = <1>; | ||
180 | #size-cells = <0>; | ||
181 | compatible = "samsung,s3c2440-i2c"; | ||
182 | reg = <0x138C0000 0x100>; | ||
183 | interrupts = <0 64 0>; | ||
184 | status = "disabled"; | ||
185 | }; | ||
186 | |||
187 | i2c@138D0000 { | ||
188 | #address-cells = <1>; | ||
189 | #size-cells = <0>; | ||
190 | compatible = "samsung,s3c2440-i2c"; | ||
191 | reg = <0x138D0000 0x100>; | ||
192 | interrupts = <0 65 0>; | ||
193 | status = "disabled"; | ||
194 | }; | ||
195 | |||
196 | spi_0: spi@13920000 { | ||
197 | compatible = "samsung,exynos4210-spi"; | ||
198 | reg = <0x13920000 0x100>; | ||
199 | interrupts = <0 66 0>; | ||
200 | tx-dma-channel = <&pdma0 7>; /* preliminary */ | ||
201 | rx-dma-channel = <&pdma0 6>; /* preliminary */ | ||
202 | #address-cells = <1>; | ||
203 | #size-cells = <0>; | ||
204 | status = "disabled"; | ||
205 | }; | ||
206 | |||
207 | spi_1: spi@13930000 { | ||
208 | compatible = "samsung,exynos4210-spi"; | ||
209 | reg = <0x13930000 0x100>; | ||
210 | interrupts = <0 67 0>; | ||
211 | tx-dma-channel = <&pdma1 7>; /* preliminary */ | ||
212 | rx-dma-channel = <&pdma1 6>; /* preliminary */ | ||
213 | #address-cells = <1>; | ||
214 | #size-cells = <0>; | ||
215 | status = "disabled"; | ||
216 | }; | ||
217 | |||
218 | spi_2: spi@13940000 { | ||
219 | compatible = "samsung,exynos4210-spi"; | ||
220 | reg = <0x13940000 0x100>; | ||
221 | interrupts = <0 68 0>; | ||
222 | tx-dma-channel = <&pdma0 9>; /* preliminary */ | ||
223 | rx-dma-channel = <&pdma0 8>; /* preliminary */ | ||
224 | #address-cells = <1>; | ||
225 | #size-cells = <0>; | ||
226 | status = "disabled"; | ||
227 | }; | ||
228 | |||
229 | amba { | ||
230 | #address-cells = <1>; | ||
231 | #size-cells = <1>; | ||
232 | compatible = "arm,amba-bus"; | ||
233 | interrupt-parent = <&gic>; | ||
234 | ranges; | ||
235 | |||
236 | pdma0: pdma@12680000 { | ||
237 | compatible = "arm,pl330", "arm,primecell"; | ||
238 | reg = <0x12680000 0x1000>; | ||
239 | interrupts = <0 35 0>; | ||
240 | }; | ||
241 | |||
242 | pdma1: pdma@12690000 { | ||
243 | compatible = "arm,pl330", "arm,primecell"; | ||
244 | reg = <0x12690000 0x1000>; | ||
245 | interrupts = <0 36 0>; | ||
246 | }; | ||
247 | }; | ||
248 | }; | ||
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts index 0c49caa09978..3e68f52e8454 100644 --- a/arch/arm/boot/dts/exynos4210-origen.dts +++ b/arch/arm/boot/dts/exynos4210-origen.dts | |||
@@ -40,6 +40,7 @@ | |||
40 | <&gpk2 4 2 3 3>, | 40 | <&gpk2 4 2 3 3>, |
41 | <&gpk2 5 2 3 3>, | 41 | <&gpk2 5 2 3 3>, |
42 | <&gpk2 6 2 3 3>; | 42 | <&gpk2 6 2 3 3>; |
43 | status = "okay"; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | sdhci@12510000 { | 46 | sdhci@12510000 { |
@@ -53,6 +54,7 @@ | |||
53 | <&gpk0 4 2 3 3>, | 54 | <&gpk0 4 2 3 3>, |
54 | <&gpk0 5 2 3 3>, | 55 | <&gpk0 5 2 3 3>, |
55 | <&gpk0 6 2 3 3>; | 56 | <&gpk0 6 2 3 3>; |
57 | status = "okay"; | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | gpio_keys { | 60 | gpio_keys { |
@@ -62,88 +64,45 @@ | |||
62 | 64 | ||
63 | up { | 65 | up { |
64 | label = "Up"; | 66 | label = "Up"; |
65 | gpios = <&gpx2 0 0 0 2>; | 67 | gpios = <&gpx2 0 0 0x10000 2>; |
66 | linux,code = <103>; | 68 | linux,code = <103>; |
69 | gpio-key,wakeup; | ||
67 | }; | 70 | }; |
68 | 71 | ||
69 | down { | 72 | down { |
70 | label = "Down"; | 73 | label = "Down"; |
71 | gpios = <&gpx2 1 0 0 2>; | 74 | gpios = <&gpx2 1 0 0x10000 2>; |
72 | linux,code = <108>; | 75 | linux,code = <108>; |
76 | gpio-key,wakeup; | ||
73 | }; | 77 | }; |
74 | 78 | ||
75 | back { | 79 | back { |
76 | label = "Back"; | 80 | label = "Back"; |
77 | gpios = <&gpx1 7 0 0 2>; | 81 | gpios = <&gpx1 7 0 0x10000 2>; |
78 | linux,code = <158>; | 82 | linux,code = <158>; |
83 | gpio-key,wakeup; | ||
79 | }; | 84 | }; |
80 | 85 | ||
81 | home { | 86 | home { |
82 | label = "Home"; | 87 | label = "Home"; |
83 | gpios = <&gpx1 6 0 0 2>; | 88 | gpios = <&gpx1 6 0 0x10000 2>; |
84 | linux,code = <102>; | 89 | linux,code = <102>; |
90 | gpio-key,wakeup; | ||
85 | }; | 91 | }; |
86 | 92 | ||
87 | menu { | 93 | menu { |
88 | label = "Menu"; | 94 | label = "Menu"; |
89 | gpios = <&gpx1 5 0 0 2>; | 95 | gpios = <&gpx1 5 0 0x10000 2>; |
90 | linux,code = <139>; | 96 | linux,code = <139>; |
97 | gpio-key,wakeup; | ||
91 | }; | 98 | }; |
92 | }; | 99 | }; |
93 | 100 | ||
94 | keypad@100A0000 { | 101 | leds { |
95 | status = "disabled"; | 102 | compatible = "gpio-leds"; |
96 | }; | 103 | status { |
97 | 104 | gpios = <&gpx1 3 0 0x10000 2>; | |
98 | sdhci@12520000 { | 105 | linux,default-trigger = "heartbeat"; |
99 | status = "disabled"; | 106 | }; |
100 | }; | ||
101 | |||
102 | sdhci@12540000 { | ||
103 | status = "disabled"; | ||
104 | }; | ||
105 | |||
106 | i2c@13860000 { | ||
107 | status = "disabled"; | ||
108 | }; | ||
109 | |||
110 | i2c@13870000 { | ||
111 | status = "disabled"; | ||
112 | }; | ||
113 | |||
114 | i2c@13880000 { | ||
115 | status = "disabled"; | ||
116 | }; | ||
117 | |||
118 | i2c@13890000 { | ||
119 | status = "disabled"; | ||
120 | }; | ||
121 | |||
122 | i2c@138A0000 { | ||
123 | status = "disabled"; | ||
124 | }; | ||
125 | |||
126 | i2c@138B0000 { | ||
127 | status = "disabled"; | ||
128 | }; | ||
129 | |||
130 | i2c@138C0000 { | ||
131 | status = "disabled"; | ||
132 | }; | ||
133 | |||
134 | i2c@138D0000 { | ||
135 | status = "disabled"; | ||
136 | }; | ||
137 | |||
138 | spi_0: spi@13920000 { | ||
139 | status = "disabled"; | ||
140 | }; | ||
141 | |||
142 | spi_1: spi@13930000 { | ||
143 | status = "disabled"; | ||
144 | }; | ||
145 | |||
146 | spi_2: spi@13940000 { | ||
147 | status = "disabled"; | ||
148 | }; | 107 | }; |
149 | }; | 108 | }; |
diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi new file mode 100644 index 000000000000..b12cf272ad0d --- /dev/null +++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi | |||
@@ -0,0 +1,457 @@ | |||
1 | /* | ||
2 | * Samsung's Exynos4210 SoC pin-mux and pin-config device tree source | ||
3 | * | ||
4 | * Copyright (c) 2011-2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2011-2012 Linaro Ltd. | ||
7 | * www.linaro.org | ||
8 | * | ||
9 | * Samsung's Exynos4210 SoC pin-mux and pin-config optiosn are listed as device | ||
10 | * tree nodes are listed in this file. | ||
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 | / { | ||
18 | pinctrl@11400000 { | ||
19 | uart0_data: uart0-data { | ||
20 | samsung,pins = "gpa0-0", "gpa0-1"; | ||
21 | samsung,pin-function = <0x2>; | ||
22 | samsung,pin-pud = <0>; | ||
23 | samsung,pin-drv = <0>; | ||
24 | }; | ||
25 | |||
26 | uart0_fctl: uart0-fctl { | ||
27 | samsung,pins = "gpa0-2", "gpa0-3"; | ||
28 | samsung,pin-function = <2>; | ||
29 | samsung,pin-pud = <0>; | ||
30 | samsung,pin-drv = <0>; | ||
31 | }; | ||
32 | |||
33 | uart1_data: uart1-data { | ||
34 | samsung,pins = "gpa0-4", "gpa0-5"; | ||
35 | samsung,pin-function = <2>; | ||
36 | samsung,pin-pud = <0>; | ||
37 | samsung,pin-drv = <0>; | ||
38 | }; | ||
39 | |||
40 | uart1_fctl: uart1-fctl { | ||
41 | samsung,pins = "gpa0-6", "gpa0-7"; | ||
42 | samsung,pin-function = <2>; | ||
43 | samsung,pin-pud = <0>; | ||
44 | samsung,pin-drv = <0>; | ||
45 | }; | ||
46 | |||
47 | i2c2_bus: i2c2-bus { | ||
48 | samsung,pins = "gpa0-6", "gpa0-7"; | ||
49 | samsung,pin-function = <3>; | ||
50 | samsung,pin-pud = <3>; | ||
51 | samsung,pin-drv = <0>; | ||
52 | }; | ||
53 | |||
54 | uart2_data: uart2-data { | ||
55 | samsung,pins = "gpa1-0", "gpa1-1"; | ||
56 | samsung,pin-function = <2>; | ||
57 | samsung,pin-pud = <0>; | ||
58 | samsung,pin-drv = <0>; | ||
59 | }; | ||
60 | |||
61 | uart2_fctl: uart2-fctl { | ||
62 | samsung,pins = "gpa1-2", "gpa1-3"; | ||
63 | samsung,pin-function = <2>; | ||
64 | samsung,pin-pud = <0>; | ||
65 | samsung,pin-drv = <0>; | ||
66 | }; | ||
67 | |||
68 | uart_audio_a: uart-audio-a { | ||
69 | samsung,pins = "gpa1-0", "gpa1-1"; | ||
70 | samsung,pin-function = <4>; | ||
71 | samsung,pin-pud = <0>; | ||
72 | samsung,pin-drv = <0>; | ||
73 | }; | ||
74 | |||
75 | i2c3_bus: i2c3-bus { | ||
76 | samsung,pins = "gpa1-2", "gpa1-3"; | ||
77 | samsung,pin-function = <3>; | ||
78 | samsung,pin-pud = <3>; | ||
79 | samsung,pin-drv = <0>; | ||
80 | }; | ||
81 | |||
82 | uart3_data: uart3-data { | ||
83 | samsung,pins = "gpa1-4", "gpa1-5"; | ||
84 | samsung,pin-function = <2>; | ||
85 | samsung,pin-pud = <0>; | ||
86 | samsung,pin-drv = <0>; | ||
87 | }; | ||
88 | |||
89 | uart_audio_b: uart-audio-b { | ||
90 | samsung,pins = "gpa1-4", "gpa1-5"; | ||
91 | samsung,pin-function = <4>; | ||
92 | samsung,pin-pud = <0>; | ||
93 | samsung,pin-drv = <0>; | ||
94 | }; | ||
95 | |||
96 | spi0_bus: spi0-bus { | ||
97 | samsung,pins = "gpb-0", "gpb-2", "gpb-3"; | ||
98 | samsung,pin-function = <2>; | ||
99 | samsung,pin-pud = <3>; | ||
100 | samsung,pin-drv = <0>; | ||
101 | }; | ||
102 | |||
103 | i2c4_bus: i2c4-bus { | ||
104 | samsung,pins = "gpb-2", "gpb-3"; | ||
105 | samsung,pin-function = <3>; | ||
106 | samsung,pin-pud = <3>; | ||
107 | samsung,pin-drv = <0>; | ||
108 | }; | ||
109 | |||
110 | spi1_bus: spi1-bus { | ||
111 | samsung,pins = "gpb-4", "gpb-6", "gpb-7"; | ||
112 | samsung,pin-function = <2>; | ||
113 | samsung,pin-pud = <3>; | ||
114 | samsung,pin-drv = <0>; | ||
115 | }; | ||
116 | |||
117 | i2c5_bus: i2c5-bus { | ||
118 | samsung,pins = "gpb-6", "gpb-7"; | ||
119 | samsung,pin-function = <3>; | ||
120 | samsung,pin-pud = <3>; | ||
121 | samsung,pin-drv = <0>; | ||
122 | }; | ||
123 | |||
124 | i2s1_bus: i2s1-bus { | ||
125 | samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", | ||
126 | "gpc0-4"; | ||
127 | samsung,pin-function = <2>; | ||
128 | samsung,pin-pud = <0>; | ||
129 | samsung,pin-drv = <0>; | ||
130 | }; | ||
131 | |||
132 | pcm1_bus: pcm1-bus { | ||
133 | samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", | ||
134 | "gpc0-4"; | ||
135 | samsung,pin-function = <3>; | ||
136 | samsung,pin-pud = <0>; | ||
137 | samsung,pin-drv = <0>; | ||
138 | }; | ||
139 | |||
140 | ac97_bus: ac97-bus { | ||
141 | samsung,pins = "gpc0-0", "gpc0-1", "gpc0-2", "gpc0-3", | ||
142 | "gpc0-4"; | ||
143 | samsung,pin-function = <4>; | ||
144 | samsung,pin-pud = <0>; | ||
145 | samsung,pin-drv = <0>; | ||
146 | }; | ||
147 | |||
148 | i2s2_bus: i2s2-bus { | ||
149 | samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3", | ||
150 | "gpc1-4"; | ||
151 | samsung,pin-function = <2>; | ||
152 | samsung,pin-pud = <0>; | ||
153 | samsung,pin-drv = <0>; | ||
154 | }; | ||
155 | |||
156 | pcm2_bus: pcm2-bus { | ||
157 | samsung,pins = "gpc1-0", "gpc1-1", "gpc1-2", "gpc1-3", | ||
158 | "gpc1-4"; | ||
159 | samsung,pin-function = <3>; | ||
160 | samsung,pin-pud = <0>; | ||
161 | samsung,pin-drv = <0>; | ||
162 | }; | ||
163 | |||
164 | spdif_bus: spdif-bus { | ||
165 | samsung,pins = "gpc1-0", "gpc1-1"; | ||
166 | samsung,pin-function = <4>; | ||
167 | samsung,pin-pud = <0>; | ||
168 | samsung,pin-drv = <0>; | ||
169 | }; | ||
170 | |||
171 | i2c6_bus: i2c6-bus { | ||
172 | samsung,pins = "gpc1-3", "gpc1-4"; | ||
173 | samsung,pin-function = <4>; | ||
174 | samsung,pin-pud = <3>; | ||
175 | samsung,pin-drv = <0>; | ||
176 | }; | ||
177 | |||
178 | spi2_bus: spi2-bus { | ||
179 | samsung,pins = "gpc1-1", "gpc1-2", "gpc1-3", "gpc1-4"; | ||
180 | samsung,pin-function = <5>; | ||
181 | samsung,pin-pud = <3>; | ||
182 | samsung,pin-drv = <0>; | ||
183 | }; | ||
184 | |||
185 | i2c7_bus: i2c7-bus { | ||
186 | samsung,pins = "gpd0-2", "gpd0-3"; | ||
187 | samsung,pin-function = <3>; | ||
188 | samsung,pin-pud = <3>; | ||
189 | samsung,pin-drv = <0>; | ||
190 | }; | ||
191 | |||
192 | i2c0_bus: i2c0-bus { | ||
193 | samsung,pins = "gpd1-0", "gpd1-1"; | ||
194 | samsung,pin-function = <2>; | ||
195 | samsung,pin-pud = <3>; | ||
196 | samsung,pin-drv = <0>; | ||
197 | }; | ||
198 | |||
199 | i2c1_bus: i2c1-bus { | ||
200 | samsung,pins = "gpd1-2", "gpd1-3"; | ||
201 | samsung,pin-function = <2>; | ||
202 | samsung,pin-pud = <3>; | ||
203 | samsung,pin-drv = <0>; | ||
204 | }; | ||
205 | }; | ||
206 | |||
207 | pinctrl@11000000 { | ||
208 | sd0_clk: sd0-clk { | ||
209 | samsung,pins = "gpk0-0"; | ||
210 | samsung,pin-function = <2>; | ||
211 | samsung,pin-pud = <0>; | ||
212 | samsung,pin-drv = <0>; | ||
213 | }; | ||
214 | |||
215 | sd0_cmd: sd0-cmd { | ||
216 | samsung,pins = "gpk0-1"; | ||
217 | samsung,pin-function = <2>; | ||
218 | samsung,pin-pud = <0>; | ||
219 | samsung,pin-drv = <0>; | ||
220 | }; | ||
221 | |||
222 | sd0_cd: sd0-cd { | ||
223 | samsung,pins = "gpk0-2"; | ||
224 | samsung,pin-function = <2>; | ||
225 | samsung,pin-pud = <3>; | ||
226 | samsung,pin-drv = <0>; | ||
227 | }; | ||
228 | |||
229 | sd0_bus1: sd0-bus-width1 { | ||
230 | samsung,pins = "gpk0-3"; | ||
231 | samsung,pin-function = <2>; | ||
232 | samsung,pin-pud = <3>; | ||
233 | samsung,pin-drv = <0>; | ||
234 | }; | ||
235 | |||
236 | sd0_bus4: sd0-bus-width4 { | ||
237 | samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; | ||
238 | samsung,pin-function = <2>; | ||
239 | samsung,pin-pud = <3>; | ||
240 | samsung,pin-drv = <0>; | ||
241 | }; | ||
242 | |||
243 | sd0_bus8: sd0-bus-width8 { | ||
244 | samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; | ||
245 | samsung,pin-function = <3>; | ||
246 | samsung,pin-pud = <3>; | ||
247 | samsung,pin-drv = <0>; | ||
248 | }; | ||
249 | |||
250 | sd4_clk: sd4-clk { | ||
251 | samsung,pins = "gpk0-0"; | ||
252 | samsung,pin-function = <3>; | ||
253 | samsung,pin-pud = <0>; | ||
254 | samsung,pin-drv = <0>; | ||
255 | }; | ||
256 | |||
257 | sd4_cmd: sd4-cmd { | ||
258 | samsung,pins = "gpk0-1"; | ||
259 | samsung,pin-function = <3>; | ||
260 | samsung,pin-pud = <0>; | ||
261 | samsung,pin-drv = <0>; | ||
262 | }; | ||
263 | |||
264 | sd4_cd: sd4-cd { | ||
265 | samsung,pins = "gpk0-2"; | ||
266 | samsung,pin-function = <3>; | ||
267 | samsung,pin-pud = <3>; | ||
268 | samsung,pin-drv = <0>; | ||
269 | }; | ||
270 | |||
271 | sd4_bus1: sd4-bus-width1 { | ||
272 | samsung,pins = "gpk0-3"; | ||
273 | samsung,pin-function = <3>; | ||
274 | samsung,pin-pud = <3>; | ||
275 | samsung,pin-drv = <0>; | ||
276 | }; | ||
277 | |||
278 | sd4_bus4: sd4-bus-width4 { | ||
279 | samsung,pins = "gpk0-3", "gpk0-4", "gpk0-5", "gpk0-6"; | ||
280 | samsung,pin-function = <3>; | ||
281 | samsung,pin-pud = <3>; | ||
282 | samsung,pin-drv = <0>; | ||
283 | }; | ||
284 | |||
285 | sd4_bus8: sd4-bus-width8 { | ||
286 | samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; | ||
287 | samsung,pin-function = <3>; | ||
288 | samsung,pin-pud = <4>; | ||
289 | samsung,pin-drv = <0>; | ||
290 | }; | ||
291 | |||
292 | sd1_clk: sd1-clk { | ||
293 | samsung,pins = "gpk1-0"; | ||
294 | samsung,pin-function = <2>; | ||
295 | samsung,pin-pud = <0>; | ||
296 | samsung,pin-drv = <0>; | ||
297 | }; | ||
298 | |||
299 | sd1_cmd: sd1-cmd { | ||
300 | samsung,pins = "gpk1-1"; | ||
301 | samsung,pin-function = <2>; | ||
302 | samsung,pin-pud = <0>; | ||
303 | samsung,pin-drv = <0>; | ||
304 | }; | ||
305 | |||
306 | sd1_cd: sd1-cd { | ||
307 | samsung,pins = "gpk1-2"; | ||
308 | samsung,pin-function = <2>; | ||
309 | samsung,pin-pud = <3>; | ||
310 | samsung,pin-drv = <0>; | ||
311 | }; | ||
312 | |||
313 | sd1_bus1: sd1-bus-width1 { | ||
314 | samsung,pins = "gpk1-3"; | ||
315 | samsung,pin-function = <2>; | ||
316 | samsung,pin-pud = <3>; | ||
317 | samsung,pin-drv = <0>; | ||
318 | }; | ||
319 | |||
320 | sd1_bus4: sd1-bus-width4 { | ||
321 | samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; | ||
322 | samsung,pin-function = <2>; | ||
323 | samsung,pin-pud = <3>; | ||
324 | samsung,pin-drv = <0>; | ||
325 | }; | ||
326 | |||
327 | sd2_clk: sd2-clk { | ||
328 | samsung,pins = "gpk2-0"; | ||
329 | samsung,pin-function = <2>; | ||
330 | samsung,pin-pud = <0>; | ||
331 | samsung,pin-drv = <0>; | ||
332 | }; | ||
333 | |||
334 | sd2_cmd: sd2-cmd { | ||
335 | samsung,pins = "gpk2-1"; | ||
336 | samsung,pin-function = <2>; | ||
337 | samsung,pin-pud = <0>; | ||
338 | samsung,pin-drv = <0>; | ||
339 | }; | ||
340 | |||
341 | sd2_cd: sd2-cd { | ||
342 | samsung,pins = "gpk2-2"; | ||
343 | samsung,pin-function = <2>; | ||
344 | samsung,pin-pud = <3>; | ||
345 | samsung,pin-drv = <0>; | ||
346 | }; | ||
347 | |||
348 | sd2_bus1: sd2-bus-width1 { | ||
349 | samsung,pins = "gpk2-3"; | ||
350 | samsung,pin-function = <2>; | ||
351 | samsung,pin-pud = <3>; | ||
352 | samsung,pin-drv = <0>; | ||
353 | }; | ||
354 | |||
355 | sd2_bus4: sd2-bus-width4 { | ||
356 | samsung,pins = "gpk2-3", "gpk2-4", "gpk2-5", "gpk2-6"; | ||
357 | samsung,pin-function = <2>; | ||
358 | samsung,pin-pud = <3>; | ||
359 | samsung,pin-drv = <0>; | ||
360 | }; | ||
361 | |||
362 | sd2_bus8: sd2-bus-width8 { | ||
363 | samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; | ||
364 | samsung,pin-function = <3>; | ||
365 | samsung,pin-pud = <3>; | ||
366 | samsung,pin-drv = <0>; | ||
367 | }; | ||
368 | |||
369 | sd3_clk: sd3-clk { | ||
370 | samsung,pins = "gpk3-0"; | ||
371 | samsung,pin-function = <2>; | ||
372 | samsung,pin-pud = <0>; | ||
373 | samsung,pin-drv = <0>; | ||
374 | }; | ||
375 | |||
376 | sd3_cmd: sd3-cmd { | ||
377 | samsung,pins = "gpk3-1"; | ||
378 | samsung,pin-function = <2>; | ||
379 | samsung,pin-pud = <0>; | ||
380 | samsung,pin-drv = <0>; | ||
381 | }; | ||
382 | |||
383 | sd3_cd: sd3-cd { | ||
384 | samsung,pins = "gpk3-2"; | ||
385 | samsung,pin-function = <2>; | ||
386 | samsung,pin-pud = <3>; | ||
387 | samsung,pin-drv = <0>; | ||
388 | }; | ||
389 | |||
390 | sd3_bus1: sd3-bus-width1 { | ||
391 | samsung,pins = "gpk3-3"; | ||
392 | samsung,pin-function = <2>; | ||
393 | samsung,pin-pud = <3>; | ||
394 | samsung,pin-drv = <0>; | ||
395 | }; | ||
396 | |||
397 | sd3_bus4: sd3-bus-width4 { | ||
398 | samsung,pins = "gpk3-3", "gpk3-4", "gpk3-5", "gpk3-6"; | ||
399 | samsung,pin-function = <2>; | ||
400 | samsung,pin-pud = <3>; | ||
401 | samsung,pin-drv = <0>; | ||
402 | }; | ||
403 | |||
404 | eint0: ext-int0 { | ||
405 | samsung,pins = "gpx0-0"; | ||
406 | samsung,pin-function = <0xf>; | ||
407 | samsung,pin-pud = <0>; | ||
408 | samsung,pin-drv = <0>; | ||
409 | }; | ||
410 | |||
411 | eint8: ext-int8 { | ||
412 | samsung,pins = "gpx1-0"; | ||
413 | samsung,pin-function = <0xf>; | ||
414 | samsung,pin-pud = <0>; | ||
415 | samsung,pin-drv = <0>; | ||
416 | }; | ||
417 | |||
418 | eint15: ext-int15 { | ||
419 | samsung,pins = "gpx1-7"; | ||
420 | samsung,pin-function = <0xf>; | ||
421 | samsung,pin-pud = <0>; | ||
422 | samsung,pin-drv = <0>; | ||
423 | }; | ||
424 | |||
425 | eint16: ext-int16 { | ||
426 | samsung,pins = "gpx2-0"; | ||
427 | samsung,pin-function = <0xf>; | ||
428 | samsung,pin-pud = <0>; | ||
429 | samsung,pin-drv = <0>; | ||
430 | }; | ||
431 | |||
432 | eint31: ext-int31 { | ||
433 | samsung,pins = "gpx3-7"; | ||
434 | samsung,pin-function = <0xf>; | ||
435 | samsung,pin-pud = <0>; | ||
436 | samsung,pin-drv = <0>; | ||
437 | }; | ||
438 | }; | ||
439 | |||
440 | pinctrl@03860000 { | ||
441 | i2s0_bus: i2s0-bus { | ||
442 | samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3", | ||
443 | "gpz-4", "gpz-5", "gpz-6"; | ||
444 | samsung,pin-function = <0x2>; | ||
445 | samsung,pin-pud = <0>; | ||
446 | samsung,pin-drv = <0>; | ||
447 | }; | ||
448 | |||
449 | pcm0_bus: pcm0-bus { | ||
450 | samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3", | ||
451 | "gpz-4"; | ||
452 | samsung,pin-function = <0x3>; | ||
453 | samsung,pin-pud = <0>; | ||
454 | samsung,pin-drv = <0>; | ||
455 | }; | ||
456 | }; | ||
457 | }; | ||
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts index 1beccc8f14ff..63610c3ba3af 100644 --- a/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts | |||
@@ -26,7 +26,7 @@ | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | chosen { | 28 | chosen { |
29 | bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; | 29 | bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | sdhci@12530000 { | 32 | sdhci@12530000 { |
@@ -40,6 +40,7 @@ | |||
40 | <&gpk2 4 2 3 3>, | 40 | <&gpk2 4 2 3 3>, |
41 | <&gpk2 5 2 3 3>, | 41 | <&gpk2 5 2 3 3>, |
42 | <&gpk2 6 2 3 3>; | 42 | <&gpk2 6 2 3 3>; |
43 | status = "okay"; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | keypad@100A0000 { | 46 | keypad@100A0000 { |
@@ -47,6 +48,7 @@ | |||
47 | samsung,keypad-num-columns = <8>; | 48 | samsung,keypad-num-columns = <8>; |
48 | linux,keypad-no-autorepeat; | 49 | linux,keypad-no-autorepeat; |
49 | linux,keypad-wakeup; | 50 | linux,keypad-wakeup; |
51 | status = "okay"; | ||
50 | 52 | ||
51 | row-gpios = <&gpx2 0 3 3 0>, | 53 | row-gpios = <&gpx2 0 3 3 0>, |
52 | <&gpx2 1 3 3 0>; | 54 | <&gpx2 1 3 3 0>; |
@@ -128,6 +130,7 @@ | |||
128 | samsung,i2c-max-bus-freq = <20000>; | 130 | samsung,i2c-max-bus-freq = <20000>; |
129 | gpios = <&gpd1 0 2 3 0>, | 131 | gpios = <&gpd1 0 2 3 0>, |
130 | <&gpd1 1 2 3 0>; | 132 | <&gpd1 1 2 3 0>; |
133 | status = "okay"; | ||
131 | 134 | ||
132 | eeprom@50 { | 135 | eeprom@50 { |
133 | compatible = "samsung,24ad0xd1"; | 136 | compatible = "samsung,24ad0xd1"; |
@@ -140,58 +143,11 @@ | |||
140 | }; | 143 | }; |
141 | }; | 144 | }; |
142 | 145 | ||
143 | sdhci@12510000 { | ||
144 | status = "disabled"; | ||
145 | }; | ||
146 | |||
147 | sdhci@12520000 { | ||
148 | status = "disabled"; | ||
149 | }; | ||
150 | |||
151 | sdhci@12540000 { | ||
152 | status = "disabled"; | ||
153 | }; | ||
154 | |||
155 | i2c@13870000 { | ||
156 | status = "disabled"; | ||
157 | }; | ||
158 | |||
159 | i2c@13880000 { | ||
160 | status = "disabled"; | ||
161 | }; | ||
162 | |||
163 | i2c@13890000 { | ||
164 | status = "disabled"; | ||
165 | }; | ||
166 | |||
167 | i2c@138A0000 { | ||
168 | status = "disabled"; | ||
169 | }; | ||
170 | |||
171 | i2c@138B0000 { | ||
172 | status = "disabled"; | ||
173 | }; | ||
174 | |||
175 | i2c@138C0000 { | ||
176 | status = "disabled"; | ||
177 | }; | ||
178 | |||
179 | i2c@138D0000 { | ||
180 | status = "disabled"; | ||
181 | }; | ||
182 | |||
183 | spi_0: spi@13920000 { | ||
184 | status = "disabled"; | ||
185 | }; | ||
186 | |||
187 | spi_1: spi@13930000 { | ||
188 | status = "disabled"; | ||
189 | }; | ||
190 | |||
191 | spi_2: spi@13940000 { | 146 | spi_2: spi@13940000 { |
192 | gpios = <&gpc1 1 5 3 0>, | 147 | gpios = <&gpc1 1 5 3 0>, |
193 | <&gpc1 3 5 3 0>, | 148 | <&gpc1 3 5 3 0>, |
194 | <&gpc1 4 5 3 0>; | 149 | <&gpc1 4 5 3 0>; |
150 | status = "okay"; | ||
195 | 151 | ||
196 | w25x80@0 { | 152 | w25x80@0 { |
197 | #address-cells = <1>; | 153 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts new file mode 100644 index 000000000000..73567b843e72 --- /dev/null +++ b/arch/arm/boot/dts/exynos4210-trats.dts | |||
@@ -0,0 +1,237 @@ | |||
1 | /* | ||
2 | * Samsung's Exynos4210 based Trats board device tree source | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * | ||
7 | * Device tree source file for Samsung's Trats board which is based on | ||
8 | * Samsung's Exynos4210 SoC. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | /dts-v1/; | ||
16 | /include/ "exynos4210.dtsi" | ||
17 | |||
18 | / { | ||
19 | model = "Samsung Trats based on Exynos4210"; | ||
20 | compatible = "samsung,trats", "samsung,exynos4210"; | ||
21 | |||
22 | memory { | ||
23 | reg = <0x40000000 0x20000000 | ||
24 | 0x60000000 0x20000000>; | ||
25 | }; | ||
26 | |||
27 | chosen { | ||
28 | bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5"; | ||
29 | }; | ||
30 | |||
31 | vemmc_reg: voltage-regulator@0 { | ||
32 | compatible = "regulator-fixed"; | ||
33 | regulator-name = "VMEM_VDD_2.8V"; | ||
34 | regulator-min-microvolt = <2800000>; | ||
35 | regulator-max-microvolt = <2800000>; | ||
36 | gpio = <&gpk0 2 1 0 0>; | ||
37 | enable-active-high; | ||
38 | }; | ||
39 | |||
40 | sdhci_emmc: sdhci@12510000 { | ||
41 | bus-width = <8>; | ||
42 | non-removable; | ||
43 | broken-voltage; | ||
44 | gpios = <&gpk0 0 2 0 3>, | ||
45 | <&gpk0 1 2 0 3>, | ||
46 | <&gpk0 3 2 2 3>, | ||
47 | <&gpk0 4 2 2 3>, | ||
48 | <&gpk0 5 2 2 3>, | ||
49 | <&gpk0 6 2 2 3>, | ||
50 | <&gpk1 3 3 3 3>, | ||
51 | <&gpk1 4 3 3 3>, | ||
52 | <&gpk1 5 3 3 3>, | ||
53 | <&gpk1 6 3 3 3>; | ||
54 | vmmc-supply = <&vemmc_reg>; | ||
55 | status = "okay"; | ||
56 | }; | ||
57 | |||
58 | serial@13800000 { | ||
59 | status = "okay"; | ||
60 | }; | ||
61 | |||
62 | serial@13810000 { | ||
63 | status = "okay"; | ||
64 | }; | ||
65 | |||
66 | serial@13820000 { | ||
67 | status = "okay"; | ||
68 | }; | ||
69 | |||
70 | serial@13830000 { | ||
71 | status = "okay"; | ||
72 | }; | ||
73 | |||
74 | i2c@138B0000 { | ||
75 | samsung,i2c-sda-delay = <100>; | ||
76 | samsung,i2c-slave-addr = <0x10>; | ||
77 | samsung,i2c-max-bus-freq = <100000>; | ||
78 | gpios = <&gpb 6 3 3 0>, | ||
79 | <&gpb 7 3 3 0>; | ||
80 | status = "okay"; | ||
81 | |||
82 | max8997_pmic@66 { | ||
83 | compatible = "maxim,max8997-pmic"; | ||
84 | |||
85 | reg = <0x66>; | ||
86 | |||
87 | max8997,pmic-buck1-uses-gpio-dvs; | ||
88 | max8997,pmic-buck2-uses-gpio-dvs; | ||
89 | max8997,pmic-buck5-uses-gpio-dvs; | ||
90 | |||
91 | max8997,pmic-ignore-gpiodvs-side-effect; | ||
92 | max8997,pmic-buck125-default-dvs-idx = <0>; | ||
93 | |||
94 | max8997,pmic-buck125-dvs-gpios = <&gpx0 5 1 0 0>, | ||
95 | <&gpx0 6 1 0 0>, | ||
96 | <&gpl0 0 1 0 0>; | ||
97 | |||
98 | max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>, | ||
99 | <1250000>, <1200000>, | ||
100 | <1150000>, <1100000>, | ||
101 | <1000000>, <950000>; | ||
102 | |||
103 | max8997,pmic-buck2-dvs-voltage = <1100000>, <1000000>, | ||
104 | <950000>, <900000>, | ||
105 | <1100000>, <1000000>, | ||
106 | <950000>, <900000>; | ||
107 | |||
108 | max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>, | ||
109 | <1200000>, <1200000>, | ||
110 | <1200000>, <1200000>, | ||
111 | <1200000>, <1200000>; | ||
112 | |||
113 | regulators { | ||
114 | valive_reg: LDO2 { | ||
115 | regulator-name = "VALIVE_1.1V_C210"; | ||
116 | regulator-min-microvolt = <1100000>; | ||
117 | regulator-max-microvolt = <1100000>; | ||
118 | regulator-always-on; | ||
119 | }; | ||
120 | |||
121 | vusb_reg: LDO3 { | ||
122 | regulator-name = "VUSB_1.1V_C210"; | ||
123 | regulator-min-microvolt = <1100000>; | ||
124 | regulator-max-microvolt = <1100000>; | ||
125 | }; | ||
126 | |||
127 | vmipi_reg: LDO4 { | ||
128 | regulator-name = "VMIPI_1.8V"; | ||
129 | regulator-min-microvolt = <1800000>; | ||
130 | regulator-max-microvolt = <1800000>; | ||
131 | }; | ||
132 | |||
133 | vpda_reg: LDO6 { | ||
134 | regulator-name = "VCC_1.8V_PDA"; | ||
135 | regulator-min-microvolt = <1800000>; | ||
136 | regulator-max-microvolt = <1800000>; | ||
137 | regulator-always-on; | ||
138 | }; | ||
139 | |||
140 | vcam_reg: LDO7 { | ||
141 | regulator-name = "CAM_ISP_1.8V"; | ||
142 | regulator-min-microvolt = <1800000>; | ||
143 | regulator-max-microvolt = <1800000>; | ||
144 | }; | ||
145 | |||
146 | vusbdac_reg: LDO8 { | ||
147 | regulator-name = "VUSB/VDAC_3.3V_C210"; | ||
148 | regulator-min-microvolt = <3300000>; | ||
149 | regulator-max-microvolt = <3300000>; | ||
150 | }; | ||
151 | |||
152 | vccpda_reg: LDO9 { | ||
153 | regulator-name = "VCC_2.8V_PDA"; | ||
154 | regulator-min-microvolt = <2800000>; | ||
155 | regulator-max-microvolt = <2800000>; | ||
156 | regulator-always-on; | ||
157 | }; | ||
158 | |||
159 | vpll_reg: LDO10 { | ||
160 | regulator-name = "VPLL_1.1V_C210"; | ||
161 | regulator-min-microvolt = <1100000>; | ||
162 | regulator-max-microvolt = <1100000>; | ||
163 | regulator-always-on; | ||
164 | }; | ||
165 | |||
166 | vcclcd_reg: LDO13 { | ||
167 | regulator-name = "VCC_3.3V_LCD"; | ||
168 | regulator-min-microvolt = <3300000>; | ||
169 | regulator-max-microvolt = <3300000>; | ||
170 | }; | ||
171 | |||
172 | vlcd_reg: LDO15 { | ||
173 | regulator-name = "VLCD_2.2V"; | ||
174 | regulator-min-microvolt = <2200000>; | ||
175 | regulator-max-microvolt = <2200000>; | ||
176 | }; | ||
177 | |||
178 | camsensor_reg: LDO16 { | ||
179 | regulator-name = "CAM_SENSOR_IO_1.8V"; | ||
180 | regulator-min-microvolt = <1800000>; | ||
181 | regulator-max-microvolt = <1800000>; | ||
182 | }; | ||
183 | |||
184 | vddq_reg: LDO21 { | ||
185 | regulator-name = "VDDQ_M1M2_1.2V"; | ||
186 | regulator-min-microvolt = <1200000>; | ||
187 | regulator-max-microvolt = <1200000>; | ||
188 | regulator-always-on; | ||
189 | }; | ||
190 | |||
191 | varm_breg: BUCK1 { | ||
192 | regulator-name = "VARM_1.2V_C210"; | ||
193 | regulator-min-microvolt = <900000>; | ||
194 | regulator-max-microvolt = <1350000>; | ||
195 | regulator-always-on; | ||
196 | }; | ||
197 | |||
198 | vint_breg: BUCK2 { | ||
199 | regulator-name = "VINT_1.1V_C210"; | ||
200 | regulator-min-microvolt = <900000>; | ||
201 | regulator-max-microvolt = <1100000>; | ||
202 | regulator-always-on; | ||
203 | }; | ||
204 | |||
205 | camisp_breg: BUCK4 { | ||
206 | regulator-name = "CAM_ISP_CORE_1.2V"; | ||
207 | regulator-min-microvolt = <1200000>; | ||
208 | regulator-max-microvolt = <1200000>; | ||
209 | }; | ||
210 | |||
211 | vmem_breg: BUCK5 { | ||
212 | regulator-name = "VMEM_1.2V_C210"; | ||
213 | regulator-min-microvolt = <1200000>; | ||
214 | regulator-max-microvolt = <1200000>; | ||
215 | regulator-always-on; | ||
216 | }; | ||
217 | |||
218 | vccsub_breg: BUCK7 { | ||
219 | regulator-name = "VCC_SUB_2.0V"; | ||
220 | regulator-min-microvolt = <2000000>; | ||
221 | regulator-max-microvolt = <2000000>; | ||
222 | regulator-always-on; | ||
223 | }; | ||
224 | |||
225 | safe1_sreg: ESAFEOUT1 { | ||
226 | regulator-name = "SAFEOUT1"; | ||
227 | regulator-always-on; | ||
228 | }; | ||
229 | |||
230 | safe2_sreg: ESAFEOUT2 { | ||
231 | regulator-name = "SAFEOUT2"; | ||
232 | regulator-boot-on; | ||
233 | }; | ||
234 | }; | ||
235 | }; | ||
236 | }; | ||
237 | }; | ||
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi index 02891fe876e4..214c557eda7f 100644 --- a/arch/arm/boot/dts/exynos4210.dtsi +++ b/arch/arm/boot/dts/exynos4210.dtsi | |||
@@ -19,199 +19,60 @@ | |||
19 | * published by the Free Software Foundation. | 19 | * published by the Free Software Foundation. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /include/ "skeleton.dtsi" | 22 | /include/ "exynos4.dtsi" |
23 | /include/ "exynos4210-pinctrl.dtsi" | ||
23 | 24 | ||
24 | / { | 25 | / { |
25 | compatible = "samsung,exynos4210"; | 26 | compatible = "samsung,exynos4210"; |
26 | interrupt-parent = <&gic>; | ||
27 | 27 | ||
28 | aliases { | 28 | aliases { |
29 | spi0 = &spi_0; | 29 | pinctrl0 = &pinctrl_0; |
30 | spi1 = &spi_1; | 30 | pinctrl1 = &pinctrl_1; |
31 | spi2 = &spi_2; | 31 | pinctrl2 = &pinctrl_2; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | gic:interrupt-controller@10490000 { | 34 | gic:interrupt-controller@10490000 { |
35 | compatible = "arm,cortex-a9-gic"; | ||
36 | #interrupt-cells = <3>; | ||
37 | interrupt-controller; | ||
38 | cpu-offset = <0x8000>; | 35 | cpu-offset = <0x8000>; |
39 | reg = <0x10490000 0x1000>, <0x10480000 0x100>; | ||
40 | }; | 36 | }; |
41 | 37 | ||
42 | combiner:interrupt-controller@10440000 { | 38 | combiner:interrupt-controller@10440000 { |
43 | compatible = "samsung,exynos4210-combiner"; | ||
44 | #interrupt-cells = <2>; | ||
45 | interrupt-controller; | ||
46 | reg = <0x10440000 0x1000>; | ||
47 | interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>, | 39 | interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>, |
48 | <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>, | 40 | <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>, |
49 | <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>, | 41 | <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>, |
50 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; | 42 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; |
51 | }; | 43 | }; |
52 | 44 | ||
53 | watchdog@10060000 { | 45 | pinctrl_0: pinctrl@11400000 { |
54 | compatible = "samsung,s3c2410-wdt"; | 46 | compatible = "samsung,pinctrl-exynos4210"; |
55 | reg = <0x10060000 0x100>; | 47 | reg = <0x11400000 0x1000>; |
56 | interrupts = <0 43 0>; | 48 | interrupts = <0 47 0>; |
57 | }; | 49 | interrupt-controller; |
58 | 50 | #interrupt-cells = <2>; | |
59 | rtc@10070000 { | ||
60 | compatible = "samsung,s3c6410-rtc"; | ||
61 | reg = <0x10070000 0x100>; | ||
62 | interrupts = <0 44 0>, <0 45 0>; | ||
63 | }; | ||
64 | |||
65 | keypad@100A0000 { | ||
66 | compatible = "samsung,s5pv210-keypad"; | ||
67 | reg = <0x100A0000 0x100>; | ||
68 | interrupts = <0 109 0>; | ||
69 | }; | ||
70 | |||
71 | sdhci@12510000 { | ||
72 | compatible = "samsung,exynos4210-sdhci"; | ||
73 | reg = <0x12510000 0x100>; | ||
74 | interrupts = <0 73 0>; | ||
75 | }; | ||
76 | |||
77 | sdhci@12520000 { | ||
78 | compatible = "samsung,exynos4210-sdhci"; | ||
79 | reg = <0x12520000 0x100>; | ||
80 | interrupts = <0 74 0>; | ||
81 | }; | ||
82 | |||
83 | sdhci@12530000 { | ||
84 | compatible = "samsung,exynos4210-sdhci"; | ||
85 | reg = <0x12530000 0x100>; | ||
86 | interrupts = <0 75 0>; | ||
87 | }; | ||
88 | |||
89 | sdhci@12540000 { | ||
90 | compatible = "samsung,exynos4210-sdhci"; | ||
91 | reg = <0x12540000 0x100>; | ||
92 | interrupts = <0 76 0>; | ||
93 | }; | ||
94 | |||
95 | serial@13800000 { | ||
96 | compatible = "samsung,exynos4210-uart"; | ||
97 | reg = <0x13800000 0x100>; | ||
98 | interrupts = <0 52 0>; | ||
99 | }; | ||
100 | |||
101 | serial@13810000 { | ||
102 | compatible = "samsung,exynos4210-uart"; | ||
103 | reg = <0x13810000 0x100>; | ||
104 | interrupts = <0 53 0>; | ||
105 | }; | ||
106 | |||
107 | serial@13820000 { | ||
108 | compatible = "samsung,exynos4210-uart"; | ||
109 | reg = <0x13820000 0x100>; | ||
110 | interrupts = <0 54 0>; | ||
111 | }; | ||
112 | |||
113 | serial@13830000 { | ||
114 | compatible = "samsung,exynos4210-uart"; | ||
115 | reg = <0x13830000 0x100>; | ||
116 | interrupts = <0 55 0>; | ||
117 | }; | ||
118 | |||
119 | i2c@13860000 { | ||
120 | compatible = "samsung,s3c2440-i2c"; | ||
121 | reg = <0x13860000 0x100>; | ||
122 | interrupts = <0 58 0>; | ||
123 | }; | ||
124 | |||
125 | i2c@13870000 { | ||
126 | compatible = "samsung,s3c2440-i2c"; | ||
127 | reg = <0x13870000 0x100>; | ||
128 | interrupts = <0 59 0>; | ||
129 | }; | ||
130 | |||
131 | i2c@13880000 { | ||
132 | compatible = "samsung,s3c2440-i2c"; | ||
133 | reg = <0x13880000 0x100>; | ||
134 | interrupts = <0 60 0>; | ||
135 | }; | ||
136 | |||
137 | i2c@13890000 { | ||
138 | compatible = "samsung,s3c2440-i2c"; | ||
139 | reg = <0x13890000 0x100>; | ||
140 | interrupts = <0 61 0>; | ||
141 | }; | ||
142 | |||
143 | i2c@138A0000 { | ||
144 | compatible = "samsung,s3c2440-i2c"; | ||
145 | reg = <0x138A0000 0x100>; | ||
146 | interrupts = <0 62 0>; | ||
147 | }; | ||
148 | |||
149 | i2c@138B0000 { | ||
150 | compatible = "samsung,s3c2440-i2c"; | ||
151 | reg = <0x138B0000 0x100>; | ||
152 | interrupts = <0 63 0>; | ||
153 | }; | ||
154 | |||
155 | i2c@138C0000 { | ||
156 | compatible = "samsung,s3c2440-i2c"; | ||
157 | reg = <0x138C0000 0x100>; | ||
158 | interrupts = <0 64 0>; | ||
159 | }; | ||
160 | |||
161 | i2c@138D0000 { | ||
162 | compatible = "samsung,s3c2440-i2c"; | ||
163 | reg = <0x138D0000 0x100>; | ||
164 | interrupts = <0 65 0>; | ||
165 | }; | ||
166 | |||
167 | spi_0: spi@13920000 { | ||
168 | compatible = "samsung,exynos4210-spi"; | ||
169 | reg = <0x13920000 0x100>; | ||
170 | interrupts = <0 66 0>; | ||
171 | tx-dma-channel = <&pdma0 7>; /* preliminary */ | ||
172 | rx-dma-channel = <&pdma0 6>; /* preliminary */ | ||
173 | #address-cells = <1>; | ||
174 | #size-cells = <0>; | ||
175 | }; | ||
176 | |||
177 | spi_1: spi@13930000 { | ||
178 | compatible = "samsung,exynos4210-spi"; | ||
179 | reg = <0x13930000 0x100>; | ||
180 | interrupts = <0 67 0>; | ||
181 | tx-dma-channel = <&pdma1 7>; /* preliminary */ | ||
182 | rx-dma-channel = <&pdma1 6>; /* preliminary */ | ||
183 | #address-cells = <1>; | ||
184 | #size-cells = <0>; | ||
185 | }; | ||
186 | |||
187 | spi_2: spi@13940000 { | ||
188 | compatible = "samsung,exynos4210-spi"; | ||
189 | reg = <0x13940000 0x100>; | ||
190 | interrupts = <0 68 0>; | ||
191 | tx-dma-channel = <&pdma0 9>; /* preliminary */ | ||
192 | rx-dma-channel = <&pdma0 8>; /* preliminary */ | ||
193 | #address-cells = <1>; | ||
194 | #size-cells = <0>; | ||
195 | }; | 51 | }; |
196 | 52 | ||
197 | amba { | 53 | pinctrl_1: pinctrl@11000000 { |
198 | #address-cells = <1>; | 54 | compatible = "samsung,pinctrl-exynos4210"; |
199 | #size-cells = <1>; | 55 | reg = <0x11000000 0x1000>; |
200 | compatible = "arm,amba-bus"; | 56 | interrupts = <0 46 0>; |
201 | interrupt-parent = <&gic>; | 57 | interrupt-controller; |
202 | ranges; | 58 | #interrupt-cells = <2>; |
203 | 59 | ||
204 | pdma0: pdma@12680000 { | 60 | wakup_eint: wakeup-interrupt-controller { |
205 | compatible = "arm,pl330", "arm,primecell"; | 61 | compatible = "samsung,exynos4210-wakeup-eint"; |
206 | reg = <0x12680000 0x1000>; | 62 | interrupt-parent = <&gic>; |
207 | interrupts = <0 35 0>; | 63 | interrupt-controller; |
64 | #interrupt-cells = <2>; | ||
65 | interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>, | ||
66 | <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>, | ||
67 | <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>, | ||
68 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>, | ||
69 | <0 32 0>; | ||
208 | }; | 70 | }; |
71 | }; | ||
209 | 72 | ||
210 | pdma1: pdma@12690000 { | 73 | pinctrl_2: pinctrl@03860000 { |
211 | compatible = "arm,pl330", "arm,primecell"; | 74 | compatible = "samsung,pinctrl-exynos4210"; |
212 | reg = <0x12690000 0x1000>; | 75 | reg = <0x03860000 0x1000>; |
213 | interrupts = <0 36 0>; | ||
214 | }; | ||
215 | }; | 76 | }; |
216 | 77 | ||
217 | gpio-controllers { | 78 | gpio-controllers { |
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 8a5e348793c7..a352df403b7a 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts | |||
@@ -16,12 +16,19 @@ | |||
16 | model = "SAMSUNG SMDK5250 board based on EXYNOS5250"; | 16 | model = "SAMSUNG SMDK5250 board based on EXYNOS5250"; |
17 | compatible = "samsung,smdk5250", "samsung,exynos5250"; | 17 | compatible = "samsung,smdk5250", "samsung,exynos5250"; |
18 | 18 | ||
19 | aliases { | ||
20 | mshc0 = &dwmmc_0; | ||
21 | mshc1 = &dwmmc_1; | ||
22 | mshc2 = &dwmmc_2; | ||
23 | mshc3 = &dwmmc_3; | ||
24 | }; | ||
25 | |||
19 | memory { | 26 | memory { |
20 | reg = <0x40000000 0x80000000>; | 27 | reg = <0x40000000 0x80000000>; |
21 | }; | 28 | }; |
22 | 29 | ||
23 | chosen { | 30 | chosen { |
24 | bootargs = "root=/dev/ram0 rw ramdisk=8192 console=ttySAC1,115200"; | 31 | bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; |
25 | }; | 32 | }; |
26 | 33 | ||
27 | i2c@12C60000 { | 34 | i2c@12C60000 { |
@@ -72,6 +79,56 @@ | |||
72 | status = "disabled"; | 79 | status = "disabled"; |
73 | }; | 80 | }; |
74 | 81 | ||
82 | dwmmc_0: dwmmc0@12200000 { | ||
83 | num-slots = <1>; | ||
84 | supports-highspeed; | ||
85 | broken-cd; | ||
86 | fifo-depth = <0x80>; | ||
87 | card-detect-delay = <200>; | ||
88 | samsung,dw-mshc-ciu-div = <3>; | ||
89 | samsung,dw-mshc-sdr-timing = <2 3 3>; | ||
90 | samsung,dw-mshc-ddr-timing = <1 2 3>; | ||
91 | |||
92 | slot@0 { | ||
93 | reg = <0>; | ||
94 | bus-width = <8>; | ||
95 | gpios = <&gpc0 0 2 0 3>, <&gpc0 1 2 0 3>, | ||
96 | <&gpc1 0 2 3 3>, <&gpc1 1 2 3 3>, | ||
97 | <&gpc1 2 2 3 3>, <&gpc1 3 2 3 3>, | ||
98 | <&gpc0 3 2 3 3>, <&gpc0 4 2 3 3>, | ||
99 | <&gpc0 5 2 3 3>, <&gpc0 6 2 3 3>; | ||
100 | }; | ||
101 | }; | ||
102 | |||
103 | dwmmc_1: dwmmc1@12210000 { | ||
104 | status = "disabled"; | ||
105 | }; | ||
106 | |||
107 | dwmmc_2: dwmmc2@12220000 { | ||
108 | num-slots = <1>; | ||
109 | supports-highspeed; | ||
110 | fifo-depth = <0x80>; | ||
111 | card-detect-delay = <200>; | ||
112 | samsung,dw-mshc-ciu-div = <3>; | ||
113 | samsung,dw-mshc-sdr-timing = <2 3 3>; | ||
114 | samsung,dw-mshc-ddr-timing = <1 2 3>; | ||
115 | |||
116 | slot@0 { | ||
117 | reg = <0>; | ||
118 | bus-width = <4>; | ||
119 | samsung,cd-pinmux-gpio = <&gpc3 2 2 3 3>; | ||
120 | gpios = <&gpc3 0 2 0 3>, <&gpc3 1 2 0 3>, | ||
121 | <&gpc3 3 2 3 3>, <&gpc3 4 2 3 3>, | ||
122 | <&gpc3 5 2 3 3>, <&gpc3 6 2 3 3>, | ||
123 | <&gpc4 3 3 3 3>, <&gpc4 3 3 3 3>, | ||
124 | <&gpc4 5 3 3 3>, <&gpc4 6 3 3 3>; | ||
125 | }; | ||
126 | }; | ||
127 | |||
128 | dwmmc_3: dwmmc3@12230000 { | ||
129 | status = "disabled"; | ||
130 | }; | ||
131 | |||
75 | spi_0: spi@12d20000 { | 132 | spi_0: spi@12d20000 { |
76 | status = "disabled"; | 133 | status = "disabled"; |
77 | }; | 134 | }; |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 004aaa8d123c..dddfd6e444dc 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -27,6 +27,10 @@ | |||
27 | spi0 = &spi_0; | 27 | spi0 = &spi_0; |
28 | spi1 = &spi_1; | 28 | spi1 = &spi_1; |
29 | spi2 = &spi_2; | 29 | spi2 = &spi_2; |
30 | gsc0 = &gsc_0; | ||
31 | gsc1 = &gsc_1; | ||
32 | gsc2 = &gsc_2; | ||
33 | gsc3 = &gsc_3; | ||
30 | }; | 34 | }; |
31 | 35 | ||
32 | gic:interrupt-controller@10481000 { | 36 | gic:interrupt-controller@10481000 { |
@@ -182,6 +186,38 @@ | |||
182 | #size-cells = <0>; | 186 | #size-cells = <0>; |
183 | }; | 187 | }; |
184 | 188 | ||
189 | dwmmc0@12200000 { | ||
190 | compatible = "samsung,exynos5250-dw-mshc"; | ||
191 | reg = <0x12200000 0x1000>; | ||
192 | interrupts = <0 75 0>; | ||
193 | #address-cells = <1>; | ||
194 | #size-cells = <0>; | ||
195 | }; | ||
196 | |||
197 | dwmmc1@12210000 { | ||
198 | compatible = "samsung,exynos5250-dw-mshc"; | ||
199 | reg = <0x12210000 0x1000>; | ||
200 | interrupts = <0 76 0>; | ||
201 | #address-cells = <1>; | ||
202 | #size-cells = <0>; | ||
203 | }; | ||
204 | |||
205 | dwmmc2@12220000 { | ||
206 | compatible = "samsung,exynos5250-dw-mshc"; | ||
207 | reg = <0x12220000 0x1000>; | ||
208 | interrupts = <0 77 0>; | ||
209 | #address-cells = <1>; | ||
210 | #size-cells = <0>; | ||
211 | }; | ||
212 | |||
213 | dwmmc3@12230000 { | ||
214 | compatible = "samsung,exynos5250-dw-mshc"; | ||
215 | reg = <0x12230000 0x1000>; | ||
216 | interrupts = <0 78 0>; | ||
217 | #address-cells = <1>; | ||
218 | #size-cells = <0>; | ||
219 | }; | ||
220 | |||
185 | amba { | 221 | amba { |
186 | #address-cells = <1>; | 222 | #address-cells = <1>; |
187 | #size-cells = <1>; | 223 | #size-cells = <1>; |
@@ -460,4 +496,28 @@ | |||
460 | #gpio-cells = <4>; | 496 | #gpio-cells = <4>; |
461 | }; | 497 | }; |
462 | }; | 498 | }; |
499 | |||
500 | gsc_0: gsc@0x13e00000 { | ||
501 | compatible = "samsung,exynos5-gsc"; | ||
502 | reg = <0x13e00000 0x1000>; | ||
503 | interrupts = <0 85 0>; | ||
504 | }; | ||
505 | |||
506 | gsc_1: gsc@0x13e10000 { | ||
507 | compatible = "samsung,exynos5-gsc"; | ||
508 | reg = <0x13e10000 0x1000>; | ||
509 | interrupts = <0 86 0>; | ||
510 | }; | ||
511 | |||
512 | gsc_2: gsc@0x13e20000 { | ||
513 | compatible = "samsung,exynos5-gsc"; | ||
514 | reg = <0x13e20000 0x1000>; | ||
515 | interrupts = <0 87 0>; | ||
516 | }; | ||
517 | |||
518 | gsc_3: gsc@0x13e30000 { | ||
519 | compatible = "samsung,exynos5-gsc"; | ||
520 | reg = <0x13e30000 0x1000>; | ||
521 | interrupts = <0 88 0>; | ||
522 | }; | ||
463 | }; | 523 | }; |
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts index 9fecf1ae777b..0c6fc34821f9 100644 --- a/arch/arm/boot/dts/highbank.dts +++ b/arch/arm/boot/dts/highbank.dts | |||
@@ -121,6 +121,10 @@ | |||
121 | compatible = "calxeda,hb-ahci"; | 121 | compatible = "calxeda,hb-ahci"; |
122 | reg = <0xffe08000 0x10000>; | 122 | reg = <0xffe08000 0x10000>; |
123 | interrupts = <0 83 4>; | 123 | interrupts = <0 83 4>; |
124 | calxeda,port-phys = <&combophy5 0 &combophy0 0 | ||
125 | &combophy0 1 &combophy0 2 | ||
126 | &combophy0 3>; | ||
127 | dma-coherent; | ||
124 | }; | 128 | }; |
125 | 129 | ||
126 | sdhci@ffe0e000 { | 130 | sdhci@ffe0e000 { |
@@ -306,5 +310,19 @@ | |||
306 | reg = <0xfff51000 0x1000>; | 310 | reg = <0xfff51000 0x1000>; |
307 | interrupts = <0 80 4 0 81 4 0 82 4>; | 311 | interrupts = <0 80 4 0 81 4 0 82 4>; |
308 | }; | 312 | }; |
313 | |||
314 | combophy0: combo-phy@fff58000 { | ||
315 | compatible = "calxeda,hb-combophy"; | ||
316 | #phy-cells = <1>; | ||
317 | reg = <0xfff58000 0x1000>; | ||
318 | phydev = <5>; | ||
319 | }; | ||
320 | |||
321 | combophy5: combo-phy@fff5d000 { | ||
322 | compatible = "calxeda,hb-combophy"; | ||
323 | #phy-cells = <1>; | ||
324 | reg = <0xfff5d000 0x1000>; | ||
325 | phydev = <31>; | ||
326 | }; | ||
309 | }; | 327 | }; |
310 | }; | 328 | }; |
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts new file mode 100644 index 000000000000..2131d77dc9c9 --- /dev/null +++ b/arch/arm/boot/dts/hrefv60plus.dts | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright 2012 ST-Ericsson AB | ||
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 | /dts-v1/; | ||
13 | /include/ "dbx5x0.dtsi" | ||
14 | |||
15 | / { | ||
16 | model = "ST-Ericsson HREF platform with Device Tree"; | ||
17 | compatible = "st-ericsson,hrefv60+"; | ||
18 | |||
19 | memory { | ||
20 | reg = <0x00000000 0x20000000>; | ||
21 | }; | ||
22 | |||
23 | soc-u9500 { | ||
24 | uart@80120000 { | ||
25 | status = "okay"; | ||
26 | }; | ||
27 | |||
28 | uart@80121000 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
32 | uart@80007000 { | ||
33 | status = "okay"; | ||
34 | }; | ||
35 | |||
36 | i2c@80004000 { | ||
37 | tc3589x@42 { | ||
38 | compatible = "tc3589x"; | ||
39 | reg = <0x42>; | ||
40 | interrupt-parent = <&gpio6>; | ||
41 | interrupts = <25 0x1>; | ||
42 | |||
43 | interrupt-controller; | ||
44 | #interrupt-cells = <2>; | ||
45 | |||
46 | tc3589x_gpio: tc3589x_gpio { | ||
47 | compatible = "tc3589x-gpio"; | ||
48 | interrupts = <0 0x1>; | ||
49 | |||
50 | interrupt-controller; | ||
51 | #interrupt-cells = <2>; | ||
52 | gpio-controller; | ||
53 | #gpio-cells = <2>; | ||
54 | }; | ||
55 | }; | ||
56 | |||
57 | tps61052@33 { | ||
58 | compatible = "tps61052"; | ||
59 | reg = <0x33>; | ||
60 | }; | ||
61 | }; | ||
62 | |||
63 | i2c@80128000 { | ||
64 | lp5521@0x33 { | ||
65 | compatible = "lp5521"; | ||
66 | reg = <0x33>; | ||
67 | }; | ||
68 | |||
69 | lp5521@0x34 { | ||
70 | compatible = "lp5521"; | ||
71 | reg = <0x34>; | ||
72 | }; | ||
73 | |||
74 | bh1780@0x29 { | ||
75 | compatible = "rohm,bh1780gli"; | ||
76 | reg = <0x33>; | ||
77 | }; | ||
78 | }; | ||
79 | |||
80 | sound { | ||
81 | compatible = "stericsson,snd-soc-mop500"; | ||
82 | |||
83 | stericsson,cpu-dai = <&msp1 &msp3>; | ||
84 | stericsson,audio-codec = <&codec>; | ||
85 | }; | ||
86 | |||
87 | msp1: msp@80124000 { | ||
88 | status = "okay"; | ||
89 | }; | ||
90 | |||
91 | msp3: msp@80125000 { | ||
92 | status = "okay"; | ||
93 | }; | ||
94 | }; | ||
95 | }; | ||
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index 3f3b6fc229b3..9ca4ca70c1bc 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi | |||
@@ -43,7 +43,7 @@ | |||
43 | ranges; | 43 | ranges; |
44 | 44 | ||
45 | icoll: interrupt-controller@80000000 { | 45 | icoll: interrupt-controller@80000000 { |
46 | compatible = "fsl,imx23-icoll", "fsl,mxs-icoll"; | 46 | compatible = "fsl,imx23-icoll", "fsl,icoll"; |
47 | interrupt-controller; | 47 | interrupt-controller; |
48 | #interrupt-cells = <1>; | 48 | #interrupt-cells = <1>; |
49 | reg = <0x80000000 0x2000>; | 49 | reg = <0x80000000 0x2000>; |
@@ -407,8 +407,9 @@ | |||
407 | }; | 407 | }; |
408 | 408 | ||
409 | timrot@80068000 { | 409 | timrot@80068000 { |
410 | compatible = "fsl,imx23-timrot", "fsl,timrot"; | ||
410 | reg = <0x80068000 0x2000>; | 411 | reg = <0x80068000 0x2000>; |
411 | status = "disabled"; | 412 | interrupts = <28 29 30 31>; |
412 | }; | 413 | }; |
413 | 414 | ||
414 | auart0: serial@8006c000 { | 415 | auart0: serial@8006c000 { |
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 724147eab84b..59fbfba23df8 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi | |||
@@ -52,7 +52,7 @@ | |||
52 | ranges; | 52 | ranges; |
53 | 53 | ||
54 | icoll: interrupt-controller@80000000 { | 54 | icoll: interrupt-controller@80000000 { |
55 | compatible = "fsl,imx28-icoll", "fsl,mxs-icoll"; | 55 | compatible = "fsl,imx28-icoll", "fsl,icoll"; |
56 | interrupt-controller; | 56 | interrupt-controller; |
57 | #interrupt-cells = <1>; | 57 | #interrupt-cells = <1>; |
58 | reg = <0x80000000 0x2000>; | 58 | reg = <0x80000000 0x2000>; |
@@ -787,8 +787,9 @@ | |||
787 | }; | 787 | }; |
788 | 788 | ||
789 | timrot@80068000 { | 789 | timrot@80068000 { |
790 | compatible = "fsl,imx28-timrot", "fsl,timrot"; | ||
790 | reg = <0x80068000 0x2000>; | 791 | reg = <0x80068000 0x2000>; |
791 | status = "disabled"; | 792 | interrupts = <48 49 50 51>; |
792 | }; | 793 | }; |
793 | 794 | ||
794 | auart0: serial@8006a000 { | 795 | auart0: serial@8006a000 { |
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index 35e5895ba3df..f3990b04fecf 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi | |||
@@ -400,8 +400,8 @@ | |||
400 | #clock-cells = <1>; | 400 | #clock-cells = <1>; |
401 | }; | 401 | }; |
402 | 402 | ||
403 | anatop@020c8000 { | 403 | anatop: anatop@020c8000 { |
404 | compatible = "fsl,imx6q-anatop"; | 404 | compatible = "fsl,imx6q-anatop", "syscon", "simple-bus"; |
405 | reg = <0x020c8000 0x1000>; | 405 | reg = <0x020c8000 0x1000>; |
406 | interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>; | 406 | interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>; |
407 | 407 | ||
@@ -531,6 +531,11 @@ | |||
531 | interrupts = <0 89 0x04 0 90 0x04>; | 531 | interrupts = <0 89 0x04 0 90 0x04>; |
532 | }; | 532 | }; |
533 | 533 | ||
534 | gpr: iomuxc-gpr@020e0000 { | ||
535 | compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; | ||
536 | reg = <0x020e0000 0x38>; | ||
537 | }; | ||
538 | |||
534 | iomuxc@020e0000 { | 539 | iomuxc@020e0000 { |
535 | compatible = "fsl,imx6q-iomuxc"; | 540 | compatible = "fsl,imx6q-iomuxc"; |
536 | reg = <0x020e0000 0x4000>; | 541 | reg = <0x020e0000 0x4000>; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 5d1c48459e6e..3883f94fdbd0 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -430,5 +430,13 @@ | |||
430 | hw-caps-ll-interface; | 430 | hw-caps-ll-interface; |
431 | hw-caps-temp-alert; | 431 | hw-caps-temp-alert; |
432 | }; | 432 | }; |
433 | |||
434 | ocp2scp { | ||
435 | compatible = "ti,omap-ocp2scp"; | ||
436 | #address-cells = <1>; | ||
437 | #size-cells = <1>; | ||
438 | ranges; | ||
439 | ti,hwmods = "ocp2scp_usb_phy"; | ||
440 | }; | ||
433 | }; | 441 | }; |
434 | }; | 442 | }; |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index 9ac75b37c992..5db33f481a33 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
@@ -33,9 +33,21 @@ | |||
33 | cpus { | 33 | cpus { |
34 | cpu@0 { | 34 | cpu@0 { |
35 | compatible = "arm,cortex-a15"; | 35 | compatible = "arm,cortex-a15"; |
36 | timer { | ||
37 | compatible = "arm,armv7-timer"; | ||
38 | /* 14th PPI IRQ, active low level-sensitive */ | ||
39 | interrupts = <1 14 0x308>; | ||
40 | clock-frequency = <6144000>; | ||
41 | }; | ||
36 | }; | 42 | }; |
37 | cpu@1 { | 43 | cpu@1 { |
38 | compatible = "arm,cortex-a15"; | 44 | compatible = "arm,cortex-a15"; |
45 | timer { | ||
46 | compatible = "arm,armv7-timer"; | ||
47 | /* 14th PPI IRQ, active low level-sensitive */ | ||
48 | interrupts = <1 14 0x308>; | ||
49 | clock-frequency = <6144000>; | ||
50 | }; | ||
39 | }; | 51 | }; |
40 | }; | 52 | }; |
41 | 53 | ||
diff --git a/arch/arm/boot/dts/phy3250.dts b/arch/arm/boot/dts/phy3250.dts index a7ad85e4b8f9..90fdbd77f274 100644 --- a/arch/arm/boot/dts/phy3250.dts +++ b/arch/arm/boot/dts/phy3250.dts | |||
@@ -189,16 +189,14 @@ | |||
189 | leds { | 189 | leds { |
190 | compatible = "gpio-leds"; | 190 | compatible = "gpio-leds"; |
191 | 191 | ||
192 | led0 { | 192 | led0 { /* red */ |
193 | gpios = <&gpio 5 1 1>; /* GPO_P3 1, GPIO 80, active low */ | 193 | gpios = <&gpio 5 1 0>; /* GPO_P3 1, GPIO 80, active high */ |
194 | linux,default-trigger = "heartbeat"; | ||
195 | default-state = "off"; | 194 | default-state = "off"; |
196 | }; | 195 | }; |
197 | 196 | ||
198 | led1 { | 197 | led1 { /* green */ |
199 | gpios = <&gpio 5 14 1>; /* GPO_P3 14, GPIO 93, active low */ | 198 | gpios = <&gpio 5 14 0>; /* GPO_P3 14, GPIO 93, active high */ |
200 | linux,default-trigger = "timer"; | 199 | linux,default-trigger = "heartbeat"; |
201 | default-state = "off"; | ||
202 | }; | 200 | }; |
203 | }; | 201 | }; |
204 | }; | 202 | }; |
diff --git a/arch/arm/boot/dts/pxa910-dkb.dts b/arch/arm/boot/dts/pxa910-dkb.dts index e92be5a474e7..595492aa5053 100644 --- a/arch/arm/boot/dts/pxa910-dkb.dts +++ b/arch/arm/boot/dts/pxa910-dkb.dts | |||
@@ -29,6 +29,143 @@ | |||
29 | }; | 29 | }; |
30 | twsi1: i2c@d4011000 { | 30 | twsi1: i2c@d4011000 { |
31 | status = "okay"; | 31 | status = "okay"; |
32 | |||
33 | pmic: 88pm860x@34 { | ||
34 | compatible = "marvell,88pm860x"; | ||
35 | reg = <0x34>; | ||
36 | interrupts = <4>; | ||
37 | interrupt-parent = <&intc>; | ||
38 | interrupt-controller; | ||
39 | #interrupt-cells = <1>; | ||
40 | |||
41 | marvell,88pm860x-irq-read-clr; | ||
42 | marvell,88pm860x-slave-addr = <0x11>; | ||
43 | |||
44 | regulators { | ||
45 | BUCK1 { | ||
46 | regulator-min-microvolt = <1000000>; | ||
47 | regulator-max-microvolt = <1500000>; | ||
48 | regulator-boot-on; | ||
49 | regulator-always-on; | ||
50 | }; | ||
51 | BUCK2 { | ||
52 | regulator-min-microvolt = <1000000>; | ||
53 | regulator-max-microvolt = <1500000>; | ||
54 | regulator-boot-on; | ||
55 | regulator-always-on; | ||
56 | }; | ||
57 | BUCK3 { | ||
58 | regulator-min-microvolt = <1000000>; | ||
59 | regulator-max-microvolt = <3000000>; | ||
60 | regulator-boot-on; | ||
61 | regulator-always-on; | ||
62 | }; | ||
63 | LDO1 { | ||
64 | regulator-min-microvolt = <1200000>; | ||
65 | regulator-max-microvolt = <2800000>; | ||
66 | regulator-boot-on; | ||
67 | regulator-always-on; | ||
68 | }; | ||
69 | LDO2 { | ||
70 | regulator-min-microvolt = <1800000>; | ||
71 | regulator-max-microvolt = <3300000>; | ||
72 | regulator-boot-on; | ||
73 | regulator-always-on; | ||
74 | }; | ||
75 | LDO3 { | ||
76 | regulator-min-microvolt = <1800000>; | ||
77 | regulator-max-microvolt = <3300000>; | ||
78 | regulator-boot-on; | ||
79 | regulator-always-on; | ||
80 | }; | ||
81 | LDO4 { | ||
82 | regulator-min-microvolt = <1800000>; | ||
83 | regulator-max-microvolt = <3300000>; | ||
84 | regulator-always-on; | ||
85 | }; | ||
86 | LDO5 { | ||
87 | regulator-min-microvolt = <2900000>; | ||
88 | regulator-max-microvolt = <3300000>; | ||
89 | regulator-boot-on; | ||
90 | regulator-always-on; | ||
91 | }; | ||
92 | LDO6 { | ||
93 | regulator-min-microvolt = <1800000>; | ||
94 | regulator-max-microvolt = <3300000>; | ||
95 | regulator-boot-on; | ||
96 | regulator-always-on; | ||
97 | }; | ||
98 | LDO7 { | ||
99 | regulator-min-microvolt = <1800000>; | ||
100 | regulator-max-microvolt = <2900000>; | ||
101 | regulator-boot-on; | ||
102 | regulator-always-on; | ||
103 | }; | ||
104 | LDO8 { | ||
105 | regulator-min-microvolt = <1800000>; | ||
106 | regulator-max-microvolt = <2900000>; | ||
107 | regulator-boot-on; | ||
108 | regulator-always-on; | ||
109 | }; | ||
110 | LDO9 { | ||
111 | regulator-min-microvolt = <1800000>; | ||
112 | regulator-max-microvolt = <3300000>; | ||
113 | regulator-boot-on; | ||
114 | regulator-always-on; | ||
115 | }; | ||
116 | LDO10 { | ||
117 | regulator-min-microvolt = <1200000>; | ||
118 | regulator-max-microvolt = <3300000>; | ||
119 | regulator-boot-on; | ||
120 | regulator-always-on; | ||
121 | }; | ||
122 | LDO12 { | ||
123 | regulator-min-microvolt = <1200000>; | ||
124 | regulator-max-microvolt = <3300000>; | ||
125 | regulator-always-on; | ||
126 | }; | ||
127 | LDO13 { | ||
128 | regulator-min-microvolt = <1200000>; | ||
129 | regulator-max-microvolt = <3300000>; | ||
130 | regulator-always-on; | ||
131 | }; | ||
132 | LDO14 { | ||
133 | regulator-min-microvolt = <1800000>; | ||
134 | regulator-max-microvolt = <3300000>; | ||
135 | regulator-always-on; | ||
136 | }; | ||
137 | }; | ||
138 | rtc { | ||
139 | marvell,88pm860x-vrtc = <1>; | ||
140 | }; | ||
141 | touch { | ||
142 | marvell,88pm860x-gpadc-prebias = <1>; | ||
143 | marvell,88pm860x-gpadc-slot-cycle = <1>; | ||
144 | marvell,88pm860x-tsi-prebias = <6>; | ||
145 | marvell,88pm860x-pen-prebias = <16>; | ||
146 | marvell,88pm860x-pen-prechg = <2>; | ||
147 | marvell,88pm860x-resistor-X = <300>; | ||
148 | }; | ||
149 | backlights { | ||
150 | backlight-0 { | ||
151 | marvell,88pm860x-iset = <4>; | ||
152 | marvell,88pm860x-pwm = <3>; | ||
153 | }; | ||
154 | backlight-2 { | ||
155 | }; | ||
156 | }; | ||
157 | leds { | ||
158 | led0-red { | ||
159 | marvell,88pm860x-iset = <12>; | ||
160 | }; | ||
161 | led0-green { | ||
162 | marvell,88pm860x-iset = <12>; | ||
163 | }; | ||
164 | led0-blue { | ||
165 | marvell,88pm860x-iset = <12>; | ||
166 | }; | ||
167 | }; | ||
168 | }; | ||
32 | }; | 169 | }; |
33 | rtc: rtc@d4010000 { | 170 | rtc: rtc@d4010000 { |
34 | status = "okay"; | 171 | status = "okay"; |
diff --git a/arch/arm/boot/dts/pxa910.dtsi b/arch/arm/boot/dts/pxa910.dtsi index a3be44d86bcd..825aaca33034 100644 --- a/arch/arm/boot/dts/pxa910.dtsi +++ b/arch/arm/boot/dts/pxa910.dtsi | |||
@@ -120,6 +120,8 @@ | |||
120 | 120 | ||
121 | twsi1: i2c@d4011000 { | 121 | twsi1: i2c@d4011000 { |
122 | compatible = "mrvl,mmp-twsi"; | 122 | compatible = "mrvl,mmp-twsi"; |
123 | #address-cells = <1>; | ||
124 | #size-cells = <0>; | ||
123 | reg = <0xd4011000 0x1000>; | 125 | reg = <0xd4011000 0x1000>; |
124 | interrupts = <7>; | 126 | interrupts = <7>; |
125 | mrvl,i2c-fast-mode; | 127 | mrvl,i2c-fast-mode; |
@@ -128,6 +130,8 @@ | |||
128 | 130 | ||
129 | twsi2: i2c@d4037000 { | 131 | twsi2: i2c@d4037000 { |
130 | compatible = "mrvl,mmp-twsi"; | 132 | compatible = "mrvl,mmp-twsi"; |
133 | #address-cells = <1>; | ||
134 | #size-cells = <0>; | ||
131 | reg = <0xd4037000 0x1000>; | 135 | reg = <0xd4037000 0x1000>; |
132 | interrupts = <54>; | 136 | interrupts = <54>; |
133 | status = "disabled"; | 137 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts index 7e334d4cae21..702c0baa6004 100644 --- a/arch/arm/boot/dts/snowball.dts +++ b/arch/arm/boot/dts/snowball.dts | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | /dts-v1/; | 12 | /dts-v1/; |
13 | /include/ "db8500.dtsi" | 13 | /include/ "dbx5x0.dtsi" |
14 | 14 | ||
15 | / { | 15 | / { |
16 | model = "Calao Systems Snowball platform with device tree"; | 16 | model = "Calao Systems Snowball platform with device tree"; |
@@ -83,6 +83,22 @@ | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | soc-u9500 { | 85 | soc-u9500 { |
86 | |||
87 | sound { | ||
88 | compatible = "stericsson,snd-soc-mop500"; | ||
89 | |||
90 | stericsson,cpu-dai = <&msp1 &msp3>; | ||
91 | stericsson,audio-codec = <&codec>; | ||
92 | }; | ||
93 | |||
94 | msp1: msp@80124000 { | ||
95 | status = "okay"; | ||
96 | }; | ||
97 | |||
98 | msp3: msp@80125000 { | ||
99 | status = "okay"; | ||
100 | }; | ||
101 | |||
86 | external-bus@50000000 { | 102 | external-bus@50000000 { |
87 | status = "okay"; | 103 | status = "okay"; |
88 | 104 | ||
@@ -111,7 +127,6 @@ | |||
111 | mmc-cap-mmc-highspeed; | 127 | mmc-cap-mmc-highspeed; |
112 | vmmc-supply = <&ab8500_ldo_aux3_reg>; | 128 | vmmc-supply = <&ab8500_ldo_aux3_reg>; |
113 | 129 | ||
114 | #gpio-cells = <1>; | ||
115 | cd-gpios = <&gpio6 26 0x4>; // 218 | 130 | cd-gpios = <&gpio6 26 0x4>; // 218 |
116 | cd-inverted; | 131 | cd-inverted; |
117 | 132 | ||
diff --git a/arch/arm/boot/dts/vt8500-bv07.dts b/arch/arm/boot/dts/vt8500-bv07.dts new file mode 100644 index 000000000000..567cf4e8ab84 --- /dev/null +++ b/arch/arm/boot/dts/vt8500-bv07.dts | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * vt8500-bv07.dts - Device tree file for Benign BV07 Netbook | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /dts-v1/; | ||
10 | /include/ "vt8500.dtsi" | ||
11 | |||
12 | / { | ||
13 | model = "Benign BV07 Netbook"; | ||
14 | |||
15 | /* | ||
16 | * Display node is based on Sascha Hauer's patch on dri-devel. | ||
17 | * Added a bpp property to calculate the size of the framebuffer | ||
18 | * until the binding is formalized. | ||
19 | */ | ||
20 | display: display@0 { | ||
21 | modes { | ||
22 | mode0: mode@0 { | ||
23 | hactive = <800>; | ||
24 | vactive = <480>; | ||
25 | hback-porch = <88>; | ||
26 | hfront-porch = <40>; | ||
27 | hsync-len = <0>; | ||
28 | vback-porch = <32>; | ||
29 | vfront-porch = <11>; | ||
30 | vsync-len = <1>; | ||
31 | clock = <0>; /* unused but required */ | ||
32 | bpp = <16>; /* non-standard but required */ | ||
33 | }; | ||
34 | }; | ||
35 | }; | ||
36 | }; | ||
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi new file mode 100644 index 000000000000..d8645e990b21 --- /dev/null +++ b/arch/arm/boot/dts/vt8500.dtsi | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * vt8500.dtsi - Device tree file for VIA VT8500 SoC | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /include/ "skeleton.dtsi" | ||
10 | |||
11 | / { | ||
12 | compatible = "via,vt8500"; | ||
13 | |||
14 | soc { | ||
15 | #address-cells = <1>; | ||
16 | #size-cells = <1>; | ||
17 | compatible = "simple-bus"; | ||
18 | ranges; | ||
19 | interrupt-parent = <&intc>; | ||
20 | |||
21 | intc: interrupt-controller@d8140000 { | ||
22 | compatible = "via,vt8500-intc"; | ||
23 | interrupt-controller; | ||
24 | reg = <0xd8140000 0x10000>; | ||
25 | #interrupt-cells = <1>; | ||
26 | }; | ||
27 | |||
28 | gpio: gpio-controller@d8110000 { | ||
29 | compatible = "via,vt8500-gpio"; | ||
30 | gpio-controller; | ||
31 | reg = <0xd8110000 0x10000>; | ||
32 | #gpio-cells = <3>; | ||
33 | }; | ||
34 | |||
35 | pmc@d8130000 { | ||
36 | compatible = "via,vt8500-pmc"; | ||
37 | reg = <0xd8130000 0x1000>; | ||
38 | |||
39 | clocks { | ||
40 | #address-cells = <1>; | ||
41 | #size-cells = <0>; | ||
42 | |||
43 | ref24: ref24M { | ||
44 | #clock-cells = <0>; | ||
45 | compatible = "fixed-clock"; | ||
46 | clock-frequency = <24000000>; | ||
47 | }; | ||
48 | }; | ||
49 | }; | ||
50 | |||
51 | timer@d8130100 { | ||
52 | compatible = "via,vt8500-timer"; | ||
53 | reg = <0xd8130100 0x28>; | ||
54 | interrupts = <36>; | ||
55 | }; | ||
56 | |||
57 | ehci@d8007900 { | ||
58 | compatible = "via,vt8500-ehci"; | ||
59 | reg = <0xd8007900 0x200>; | ||
60 | interrupts = <43>; | ||
61 | }; | ||
62 | |||
63 | uhci@d8007b00 { | ||
64 | compatible = "platform-uhci"; | ||
65 | reg = <0xd8007b00 0x200>; | ||
66 | interrupts = <43>; | ||
67 | }; | ||
68 | |||
69 | fb@d800e400 { | ||
70 | compatible = "via,vt8500-fb"; | ||
71 | reg = <0xd800e400 0x400>; | ||
72 | interrupts = <12>; | ||
73 | display = <&display>; | ||
74 | default-mode = <&mode0>; | ||
75 | }; | ||
76 | |||
77 | ge_rops@d8050400 { | ||
78 | compatible = "wm,prizm-ge-rops"; | ||
79 | reg = <0xd8050400 0x100>; | ||
80 | }; | ||
81 | |||
82 | uart@d8200000 { | ||
83 | compatible = "via,vt8500-uart"; | ||
84 | reg = <0xd8200000 0x1040>; | ||
85 | interrupts = <32>; | ||
86 | clocks = <&ref24>; | ||
87 | }; | ||
88 | |||
89 | uart@d82b0000 { | ||
90 | compatible = "via,vt8500-uart"; | ||
91 | reg = <0xd82b0000 0x1040>; | ||
92 | interrupts = <33>; | ||
93 | clocks = <&ref24>; | ||
94 | }; | ||
95 | |||
96 | uart@d8210000 { | ||
97 | compatible = "via,vt8500-uart"; | ||
98 | reg = <0xd8210000 0x1040>; | ||
99 | interrupts = <47>; | ||
100 | clocks = <&ref24>; | ||
101 | }; | ||
102 | |||
103 | uart@d82c0000 { | ||
104 | compatible = "via,vt8500-uart"; | ||
105 | reg = <0xd82c0000 0x1040>; | ||
106 | interrupts = <50>; | ||
107 | clocks = <&ref24>; | ||
108 | }; | ||
109 | |||
110 | rtc@d8100000 { | ||
111 | compatible = "via,vt8500-rtc"; | ||
112 | reg = <0xd8100000 0x10000>; | ||
113 | interrupts = <48>; | ||
114 | }; | ||
115 | }; | ||
116 | }; | ||
diff --git a/arch/arm/boot/dts/wm8505-ref.dts b/arch/arm/boot/dts/wm8505-ref.dts new file mode 100644 index 000000000000..fd4e248074c6 --- /dev/null +++ b/arch/arm/boot/dts/wm8505-ref.dts | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * wm8505-ref.dts - Device tree file for Wondermedia WM8505 reference netbook | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /dts-v1/; | ||
10 | /include/ "wm8505.dtsi" | ||
11 | |||
12 | / { | ||
13 | model = "Wondermedia WM8505 Netbook"; | ||
14 | |||
15 | /* | ||
16 | * Display node is based on Sascha Hauer's patch on dri-devel. | ||
17 | * Added a bpp property to calculate the size of the framebuffer | ||
18 | * until the binding is formalized. | ||
19 | */ | ||
20 | display: display@0 { | ||
21 | modes { | ||
22 | mode0: mode@0 { | ||
23 | hactive = <800>; | ||
24 | vactive = <480>; | ||
25 | hback-porch = <88>; | ||
26 | hfront-porch = <40>; | ||
27 | hsync-len = <0>; | ||
28 | vback-porch = <32>; | ||
29 | vfront-porch = <11>; | ||
30 | vsync-len = <1>; | ||
31 | clock = <0>; /* unused but required */ | ||
32 | bpp = <32>; /* non-standard but required */ | ||
33 | }; | ||
34 | }; | ||
35 | }; | ||
36 | }; | ||
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi new file mode 100644 index 000000000000..b459691655ab --- /dev/null +++ b/arch/arm/boot/dts/wm8505.dtsi | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * wm8505.dtsi - Device tree file for Wondermedia WM8505 SoC | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /include/ "skeleton.dtsi" | ||
10 | |||
11 | / { | ||
12 | compatible = "wm,wm8505"; | ||
13 | |||
14 | cpus { | ||
15 | cpu@0 { | ||
16 | compatible = "arm,arm926ejs"; | ||
17 | }; | ||
18 | }; | ||
19 | |||
20 | soc { | ||
21 | #address-cells = <1>; | ||
22 | #size-cells = <1>; | ||
23 | compatible = "simple-bus"; | ||
24 | ranges; | ||
25 | interrupt-parent = <&intc0>; | ||
26 | |||
27 | intc0: interrupt-controller@d8140000 { | ||
28 | compatible = "via,vt8500-intc"; | ||
29 | interrupt-controller; | ||
30 | reg = <0xd8140000 0x10000>; | ||
31 | #interrupt-cells = <1>; | ||
32 | }; | ||
33 | |||
34 | /* Secondary IC cascaded to intc0 */ | ||
35 | intc1: interrupt-controller@d8150000 { | ||
36 | compatible = "via,vt8500-intc"; | ||
37 | interrupt-controller; | ||
38 | #interrupt-cells = <1>; | ||
39 | reg = <0xD8150000 0x10000>; | ||
40 | interrupts = <56 57 58 59 60 61 62 63>; | ||
41 | }; | ||
42 | |||
43 | gpio: gpio-controller@d8110000 { | ||
44 | compatible = "wm,wm8505-gpio"; | ||
45 | gpio-controller; | ||
46 | reg = <0xd8110000 0x10000>; | ||
47 | #gpio-cells = <3>; | ||
48 | }; | ||
49 | |||
50 | pmc@d8130000 { | ||
51 | compatible = "via,vt8500-pmc"; | ||
52 | reg = <0xd8130000 0x1000>; | ||
53 | clocks { | ||
54 | #address-cells = <1>; | ||
55 | #size-cells = <0>; | ||
56 | |||
57 | ref24: ref24M { | ||
58 | #clock-cells = <0>; | ||
59 | compatible = "fixed-clock"; | ||
60 | clock-frequency = <24000000>; | ||
61 | }; | ||
62 | }; | ||
63 | }; | ||
64 | |||
65 | timer@d8130100 { | ||
66 | compatible = "via,vt8500-timer"; | ||
67 | reg = <0xd8130100 0x28>; | ||
68 | interrupts = <36>; | ||
69 | }; | ||
70 | |||
71 | ehci@d8007100 { | ||
72 | compatible = "via,vt8500-ehci"; | ||
73 | reg = <0xd8007100 0x200>; | ||
74 | interrupts = <43>; | ||
75 | }; | ||
76 | |||
77 | uhci@d8007300 { | ||
78 | compatible = "platform-uhci"; | ||
79 | reg = <0xd8007300 0x200>; | ||
80 | interrupts = <43>; | ||
81 | }; | ||
82 | |||
83 | fb@d8050800 { | ||
84 | compatible = "wm,wm8505-fb"; | ||
85 | reg = <0xd8050800 0x200>; | ||
86 | display = <&display>; | ||
87 | default-mode = <&mode0>; | ||
88 | }; | ||
89 | |||
90 | ge_rops@d8050400 { | ||
91 | compatible = "wm,prizm-ge-rops"; | ||
92 | reg = <0xd8050400 0x100>; | ||
93 | }; | ||
94 | |||
95 | uart@d8200000 { | ||
96 | compatible = "via,vt8500-uart"; | ||
97 | reg = <0xd8200000 0x1040>; | ||
98 | interrupts = <32>; | ||
99 | clocks = <&ref24>; | ||
100 | }; | ||
101 | |||
102 | uart@d82b0000 { | ||
103 | compatible = "via,vt8500-uart"; | ||
104 | reg = <0xd82b0000 0x1040>; | ||
105 | interrupts = <33>; | ||
106 | clocks = <&ref24>; | ||
107 | }; | ||
108 | |||
109 | uart@d8210000 { | ||
110 | compatible = "via,vt8500-uart"; | ||
111 | reg = <0xd8210000 0x1040>; | ||
112 | interrupts = <47>; | ||
113 | clocks = <&ref24>; | ||
114 | }; | ||
115 | |||
116 | uart@d82c0000 { | ||
117 | compatible = "via,vt8500-uart"; | ||
118 | reg = <0xd82c0000 0x1040>; | ||
119 | interrupts = <50>; | ||
120 | clocks = <&ref24>; | ||
121 | }; | ||
122 | |||
123 | uart@d8370000 { | ||
124 | compatible = "via,vt8500-uart"; | ||
125 | reg = <0xd8370000 0x1040>; | ||
126 | interrupts = <31>; | ||
127 | clocks = <&ref24>; | ||
128 | }; | ||
129 | |||
130 | uart@d8380000 { | ||
131 | compatible = "via,vt8500-uart"; | ||
132 | reg = <0xd8380000 0x1040>; | ||
133 | interrupts = <30>; | ||
134 | clocks = <&ref24>; | ||
135 | }; | ||
136 | |||
137 | rtc@d8100000 { | ||
138 | compatible = "via,vt8500-rtc"; | ||
139 | reg = <0xd8100000 0x10000>; | ||
140 | interrupts = <48>; | ||
141 | }; | ||
142 | }; | ||
143 | }; | ||
diff --git a/arch/arm/boot/dts/wm8650-mid.dts b/arch/arm/boot/dts/wm8650-mid.dts new file mode 100644 index 000000000000..cefd938f842f --- /dev/null +++ b/arch/arm/boot/dts/wm8650-mid.dts | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * wm8650-mid.dts - Device tree file for Wondermedia WM8650-MID Tablet | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /dts-v1/; | ||
10 | /include/ "wm8650.dtsi" | ||
11 | |||
12 | / { | ||
13 | model = "Wondermedia WM8650-MID Tablet"; | ||
14 | |||
15 | /* | ||
16 | * Display node is based on Sascha Hauer's patch on dri-devel. | ||
17 | * Added a bpp property to calculate the size of the framebuffer | ||
18 | * until the binding is formalized. | ||
19 | */ | ||
20 | display: display@0 { | ||
21 | modes { | ||
22 | mode0: mode@0 { | ||
23 | hactive = <800>; | ||
24 | vactive = <480>; | ||
25 | hback-porch = <88>; | ||
26 | hfront-porch = <40>; | ||
27 | hsync-len = <0>; | ||
28 | vback-porch = <32>; | ||
29 | vfront-porch = <11>; | ||
30 | vsync-len = <1>; | ||
31 | clock = <0>; /* unused but required */ | ||
32 | bpp = <16>; /* non-standard but required */ | ||
33 | }; | ||
34 | }; | ||
35 | }; | ||
36 | }; | ||
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi new file mode 100644 index 000000000000..83b9467559bb --- /dev/null +++ b/arch/arm/boot/dts/wm8650.dtsi | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * wm8650.dtsi - Device tree file for Wondermedia WM8650 SoC | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * Licensed under GPLv2 or later | ||
7 | */ | ||
8 | |||
9 | /include/ "skeleton.dtsi" | ||
10 | |||
11 | / { | ||
12 | compatible = "wm,wm8650"; | ||
13 | |||
14 | soc { | ||
15 | #address-cells = <1>; | ||
16 | #size-cells = <1>; | ||
17 | compatible = "simple-bus"; | ||
18 | ranges; | ||
19 | interrupt-parent = <&intc0>; | ||
20 | |||
21 | intc0: interrupt-controller@d8140000 { | ||
22 | compatible = "via,vt8500-intc"; | ||
23 | interrupt-controller; | ||
24 | reg = <0xd8140000 0x10000>; | ||
25 | #interrupt-cells = <1>; | ||
26 | }; | ||
27 | |||
28 | /* Secondary IC cascaded to intc0 */ | ||
29 | intc1: interrupt-controller@d8150000 { | ||
30 | compatible = "via,vt8500-intc"; | ||
31 | interrupt-controller; | ||
32 | #interrupt-cells = <1>; | ||
33 | reg = <0xD8150000 0x10000>; | ||
34 | interrupts = <56 57 58 59 60 61 62 63>; | ||
35 | }; | ||
36 | |||
37 | gpio: gpio-controller@d8110000 { | ||
38 | compatible = "wm,wm8650-gpio"; | ||
39 | gpio-controller; | ||
40 | reg = <0xd8110000 0x10000>; | ||
41 | #gpio-cells = <3>; | ||
42 | }; | ||
43 | |||
44 | pmc@d8130000 { | ||
45 | compatible = "via,vt8500-pmc"; | ||
46 | reg = <0xd8130000 0x1000>; | ||
47 | |||
48 | clocks { | ||
49 | #address-cells = <1>; | ||
50 | #size-cells = <0>; | ||
51 | |||
52 | ref25: ref25M { | ||
53 | #clock-cells = <0>; | ||
54 | compatible = "fixed-clock"; | ||
55 | clock-frequency = <25000000>; | ||
56 | }; | ||
57 | |||
58 | ref24: ref24M { | ||
59 | #clock-cells = <0>; | ||
60 | compatible = "fixed-clock"; | ||
61 | clock-frequency = <24000000>; | ||
62 | }; | ||
63 | |||
64 | plla: plla { | ||
65 | #clock-cells = <0>; | ||
66 | compatible = "wm,wm8650-pll-clock"; | ||
67 | clocks = <&ref25>; | ||
68 | reg = <0x200>; | ||
69 | }; | ||
70 | |||
71 | pllb: pllb { | ||
72 | #clock-cells = <0>; | ||
73 | compatible = "wm,wm8650-pll-clock"; | ||
74 | clocks = <&ref25>; | ||
75 | reg = <0x204>; | ||
76 | }; | ||
77 | |||
78 | arm: arm { | ||
79 | #clock-cells = <0>; | ||
80 | compatible = "via,vt8500-device-clock"; | ||
81 | clocks = <&plla>; | ||
82 | divisor-reg = <0x300>; | ||
83 | }; | ||
84 | |||
85 | sdhc: sdhc { | ||
86 | #clock-cells = <0>; | ||
87 | compatible = "via,vt8500-device-clock"; | ||
88 | clocks = <&pllb>; | ||
89 | divisor-reg = <0x328>; | ||
90 | divisor-mask = <0x3f>; | ||
91 | enable-reg = <0x254>; | ||
92 | enable-bit = <18>; | ||
93 | }; | ||
94 | }; | ||
95 | }; | ||
96 | |||
97 | timer@d8130100 { | ||
98 | compatible = "via,vt8500-timer"; | ||
99 | reg = <0xd8130100 0x28>; | ||
100 | interrupts = <36>; | ||
101 | }; | ||
102 | |||
103 | ehci@d8007900 { | ||
104 | compatible = "via,vt8500-ehci"; | ||
105 | reg = <0xd8007900 0x200>; | ||
106 | interrupts = <43>; | ||
107 | }; | ||
108 | |||
109 | uhci@d8007b00 { | ||
110 | compatible = "platform-uhci"; | ||
111 | reg = <0xd8007b00 0x200>; | ||
112 | interrupts = <43>; | ||
113 | }; | ||
114 | |||
115 | fb@d8050800 { | ||
116 | compatible = "wm,wm8505-fb"; | ||
117 | reg = <0xd8050800 0x200>; | ||
118 | display = <&display>; | ||
119 | default-mode = <&mode0>; | ||
120 | }; | ||
121 | |||
122 | ge_rops@d8050400 { | ||
123 | compatible = "wm,prizm-ge-rops"; | ||
124 | reg = <0xd8050400 0x100>; | ||
125 | }; | ||
126 | |||
127 | uart@d8200000 { | ||
128 | compatible = "via,vt8500-uart"; | ||
129 | reg = <0xd8200000 0x1040>; | ||
130 | interrupts = <32>; | ||
131 | clocks = <&ref24>; | ||
132 | }; | ||
133 | |||
134 | uart@d82b0000 { | ||
135 | compatible = "via,vt8500-uart"; | ||
136 | reg = <0xd82b0000 0x1040>; | ||
137 | interrupts = <33>; | ||
138 | clocks = <&ref24>; | ||
139 | }; | ||
140 | |||
141 | rtc@d8100000 { | ||
142 | compatible = "via,vt8500-rtc"; | ||
143 | reg = <0xd8100000 0x10000>; | ||
144 | interrupts = <48>; | ||
145 | }; | ||
146 | }; | ||
147 | }; | ||
diff --git a/arch/arm/boot/dts/xenvm-4.2.dts b/arch/arm/boot/dts/xenvm-4.2.dts new file mode 100644 index 000000000000..ec3f9528e180 --- /dev/null +++ b/arch/arm/boot/dts/xenvm-4.2.dts | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Xen Virtual Machine for unprivileged guests | ||
3 | * | ||
4 | * Based on ARM Ltd. Versatile Express CoreTile Express (single CPU) | ||
5 | * Cortex-A15 MPCore (V2P-CA15) | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | /dts-v1/; | ||
10 | |||
11 | / { | ||
12 | model = "XENVM-4.2"; | ||
13 | compatible = "xen,xenvm-4.2", "xen,xenvm"; | ||
14 | interrupt-parent = <&gic>; | ||
15 | #address-cells = <2>; | ||
16 | #size-cells = <2>; | ||
17 | |||
18 | chosen { | ||
19 | /* this field is going to be adjusted by the hypervisor */ | ||
20 | bootargs = "console=hvc0 root=/dev/xvda"; | ||
21 | }; | ||
22 | |||
23 | cpus { | ||
24 | #address-cells = <1>; | ||
25 | #size-cells = <0>; | ||
26 | |||
27 | cpu@0 { | ||
28 | device_type = "cpu"; | ||
29 | compatible = "arm,cortex-a15"; | ||
30 | reg = <0>; | ||
31 | }; | ||
32 | }; | ||
33 | |||
34 | memory@80000000 { | ||
35 | device_type = "memory"; | ||
36 | /* this field is going to be adjusted by the hypervisor */ | ||
37 | reg = <0 0x80000000 0 0x08000000>; | ||
38 | }; | ||
39 | |||
40 | gic: interrupt-controller@2c001000 { | ||
41 | compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; | ||
42 | #interrupt-cells = <3>; | ||
43 | #address-cells = <0>; | ||
44 | interrupt-controller; | ||
45 | reg = <0 0x2c001000 0 0x1000>, | ||
46 | <0 0x2c002000 0 0x100>; | ||
47 | }; | ||
48 | |||
49 | timer { | ||
50 | compatible = "arm,armv7-timer"; | ||
51 | interrupts = <1 13 0xf08>, | ||
52 | <1 14 0xf08>, | ||
53 | <1 11 0xf08>, | ||
54 | <1 10 0xf08>; | ||
55 | }; | ||
56 | |||
57 | hypervisor { | ||
58 | compatible = "xen,xen-4.2", "xen,xen"; | ||
59 | /* this field is going to be adjusted by the hypervisor */ | ||
60 | reg = <0 0xb0000000 0 0x20000>; | ||
61 | /* this field is going to be adjusted by the hypervisor */ | ||
62 | interrupts = <1 15 0xf08>; | ||
63 | }; | ||
64 | |||
65 | motherboard { | ||
66 | arm,v2m-memory-map = "rs1"; | ||
67 | }; | ||
68 | }; | ||
diff --git a/arch/arm/configs/afeb9260_defconfig b/arch/arm/configs/afeb9260_defconfig index 2afdf67c2127..c285a9d777d9 100644 --- a/arch/arm/configs/afeb9260_defconfig +++ b/arch/arm/configs/afeb9260_defconfig | |||
@@ -39,7 +39,6 @@ CONFIG_MTD_BLOCK=y | |||
39 | CONFIG_MTD_DATAFLASH=y | 39 | CONFIG_MTD_DATAFLASH=y |
40 | CONFIG_MTD_NAND=y | 40 | CONFIG_MTD_NAND=y |
41 | CONFIG_MTD_NAND_ATMEL=y | 41 | CONFIG_MTD_NAND_ATMEL=y |
42 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
43 | CONFIG_BLK_DEV_RAM=y | 42 | CONFIG_BLK_DEV_RAM=y |
44 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 43 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
45 | CONFIG_ATMEL_SSC=y | 44 | CONFIG_ATMEL_SSC=y |
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig index 90610c7030f7..f78d259f8d23 100644 --- a/arch/arm/configs/armadillo800eva_defconfig +++ b/arch/arm/configs/armadillo800eva_defconfig | |||
@@ -85,6 +85,7 @@ CONFIG_SERIAL_SH_SCI_NR_UARTS=8 | |||
85 | CONFIG_SERIAL_SH_SCI_CONSOLE=y | 85 | CONFIG_SERIAL_SH_SCI_CONSOLE=y |
86 | # CONFIG_HW_RANDOM is not set | 86 | # CONFIG_HW_RANDOM is not set |
87 | CONFIG_I2C=y | 87 | CONFIG_I2C=y |
88 | CONFIG_I2C_GPIO=y | ||
88 | CONFIG_I2C_SH_MOBILE=y | 89 | CONFIG_I2C_SH_MOBILE=y |
89 | # CONFIG_HWMON is not set | 90 | # CONFIG_HWMON is not set |
90 | CONFIG_MEDIA_SUPPORT=y | 91 | CONFIG_MEDIA_SUPPORT=y |
@@ -120,6 +121,8 @@ CONFIG_USB_ETH=m | |||
120 | CONFIG_MMC=y | 121 | CONFIG_MMC=y |
121 | CONFIG_MMC_SDHI=y | 122 | CONFIG_MMC_SDHI=y |
122 | CONFIG_MMC_SH_MMCIF=y | 123 | CONFIG_MMC_SH_MMCIF=y |
124 | CONFIG_RTC_CLASS=y | ||
125 | CONFIG_RTC_DRV_S35390A=y | ||
123 | CONFIG_DMADEVICES=y | 126 | CONFIG_DMADEVICES=y |
124 | CONFIG_SH_DMAE=y | 127 | CONFIG_SH_DMAE=y |
125 | CONFIG_UIO=y | 128 | CONFIG_UIO=y |
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig index d54e2acd3ab1..4ae57a34a582 100644 --- a/arch/arm/configs/at91rm9200_defconfig +++ b/arch/arm/configs/at91rm9200_defconfig | |||
@@ -232,7 +232,7 @@ CONFIG_USB_GADGET=y | |||
232 | CONFIG_USB_ETH=m | 232 | CONFIG_USB_ETH=m |
233 | CONFIG_USB_MASS_STORAGE=m | 233 | CONFIG_USB_MASS_STORAGE=m |
234 | CONFIG_MMC=y | 234 | CONFIG_MMC=y |
235 | CONFIG_MMC_AT91=y | 235 | CONFIG_MMC_ATMELMCI=y |
236 | CONFIG_NEW_LEDS=y | 236 | CONFIG_NEW_LEDS=y |
237 | CONFIG_LEDS_CLASS=y | 237 | CONFIG_LEDS_CLASS=y |
238 | CONFIG_LEDS_GPIO=y | 238 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/at91sam9261_defconfig b/arch/arm/configs/at91sam9261_defconfig index ade6b2f23116..1e8712ef062e 100644 --- a/arch/arm/configs/at91sam9261_defconfig +++ b/arch/arm/configs/at91sam9261_defconfig | |||
@@ -128,7 +128,7 @@ CONFIG_USB_GADGETFS=m | |||
128 | CONFIG_USB_FILE_STORAGE=m | 128 | CONFIG_USB_FILE_STORAGE=m |
129 | CONFIG_USB_G_SERIAL=m | 129 | CONFIG_USB_G_SERIAL=m |
130 | CONFIG_MMC=y | 130 | CONFIG_MMC=y |
131 | CONFIG_MMC_AT91=m | 131 | CONFIG_MMC_ATMELMCI=m |
132 | CONFIG_NEW_LEDS=y | 132 | CONFIG_NEW_LEDS=y |
133 | CONFIG_LEDS_CLASS=y | 133 | CONFIG_LEDS_CLASS=y |
134 | CONFIG_LEDS_GPIO=y | 134 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig index 1cf96264cba1..d2050cada82d 100644 --- a/arch/arm/configs/at91sam9263_defconfig +++ b/arch/arm/configs/at91sam9263_defconfig | |||
@@ -61,7 +61,6 @@ CONFIG_MTD_DATAFLASH=y | |||
61 | CONFIG_MTD_BLOCK2MTD=y | 61 | CONFIG_MTD_BLOCK2MTD=y |
62 | CONFIG_MTD_NAND=y | 62 | CONFIG_MTD_NAND=y |
63 | CONFIG_MTD_NAND_ATMEL=y | 63 | CONFIG_MTD_NAND_ATMEL=y |
64 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
65 | CONFIG_MTD_UBI=y | 64 | CONFIG_MTD_UBI=y |
66 | CONFIG_MTD_UBI_GLUEBI=y | 65 | CONFIG_MTD_UBI_GLUEBI=y |
67 | CONFIG_BLK_DEV_LOOP=y | 66 | CONFIG_BLK_DEV_LOOP=y |
@@ -138,7 +137,7 @@ CONFIG_USB_FILE_STORAGE=m | |||
138 | CONFIG_USB_G_SERIAL=m | 137 | CONFIG_USB_G_SERIAL=m |
139 | CONFIG_MMC=y | 138 | CONFIG_MMC=y |
140 | CONFIG_SDIO_UART=m | 139 | CONFIG_SDIO_UART=m |
141 | CONFIG_MMC_AT91=m | 140 | CONFIG_MMC_ATMELMCI=m |
142 | CONFIG_NEW_LEDS=y | 141 | CONFIG_NEW_LEDS=y |
143 | CONFIG_LEDS_CLASS=y | 142 | CONFIG_LEDS_CLASS=y |
144 | CONFIG_LEDS_ATMEL_PWM=y | 143 | CONFIG_LEDS_ATMEL_PWM=y |
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig index 994d331b2319..e1b0e80b54a5 100644 --- a/arch/arm/configs/at91sam9g20_defconfig +++ b/arch/arm/configs/at91sam9g20_defconfig | |||
@@ -99,7 +99,7 @@ CONFIG_USB_GADGETFS=m | |||
99 | CONFIG_USB_FILE_STORAGE=m | 99 | CONFIG_USB_FILE_STORAGE=m |
100 | CONFIG_USB_G_SERIAL=m | 100 | CONFIG_USB_G_SERIAL=m |
101 | CONFIG_MMC=y | 101 | CONFIG_MMC=y |
102 | CONFIG_MMC_AT91=m | 102 | CONFIG_MMC_ATMELMCI=m |
103 | CONFIG_NEW_LEDS=y | 103 | CONFIG_NEW_LEDS=y |
104 | CONFIG_LEDS_CLASS=y | 104 | CONFIG_LEDS_CLASS=y |
105 | CONFIG_LEDS_GPIO=y | 105 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig index ad562ee64209..7cf87856d63c 100644 --- a/arch/arm/configs/at91sam9rl_defconfig +++ b/arch/arm/configs/at91sam9rl_defconfig | |||
@@ -60,7 +60,7 @@ CONFIG_AT91SAM9X_WATCHDOG=y | |||
60 | CONFIG_FB=y | 60 | CONFIG_FB=y |
61 | CONFIG_FB_ATMEL=y | 61 | CONFIG_FB_ATMEL=y |
62 | CONFIG_MMC=y | 62 | CONFIG_MMC=y |
63 | CONFIG_MMC_AT91=m | 63 | CONFIG_MMC_ATMELMCI=m |
64 | CONFIG_RTC_CLASS=y | 64 | CONFIG_RTC_CLASS=y |
65 | CONFIG_RTC_DRV_AT91SAM9=y | 65 | CONFIG_RTC_DRV_AT91SAM9=y |
66 | CONFIG_EXT2_FS=y | 66 | CONFIG_EXT2_FS=y |
diff --git a/arch/arm/configs/bcmring_defconfig b/arch/arm/configs/bcmring_defconfig deleted file mode 100644 index 9e6a8fe13164..000000000000 --- a/arch/arm/configs/bcmring_defconfig +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | # CONFIG_LOCALVERSION_AUTO is not set | ||
3 | # CONFIG_SWAP is not set | ||
4 | CONFIG_SYSVIPC=y | ||
5 | CONFIG_EXPERT=y | ||
6 | CONFIG_KALLSYMS_EXTRA_PASS=y | ||
7 | # CONFIG_HOTPLUG is not set | ||
8 | # CONFIG_ELF_CORE is not set | ||
9 | # CONFIG_EPOLL is not set | ||
10 | # CONFIG_SIGNALFD is not set | ||
11 | # CONFIG_TIMERFD is not set | ||
12 | # CONFIG_EVENTFD is not set | ||
13 | # CONFIG_AIO is not set | ||
14 | CONFIG_PERF_EVENTS=y | ||
15 | # CONFIG_VM_EVENT_COUNTERS is not set | ||
16 | # CONFIG_SLUB_DEBUG is not set | ||
17 | # CONFIG_COMPAT_BRK is not set | ||
18 | CONFIG_MODULES=y | ||
19 | CONFIG_MODULE_UNLOAD=y | ||
20 | # CONFIG_BLK_DEV_BSG is not set | ||
21 | # CONFIG_IOSCHED_DEADLINE is not set | ||
22 | # CONFIG_IOSCHED_CFQ is not set | ||
23 | CONFIG_ARCH_BCMRING=y | ||
24 | CONFIG_BCM_ZRELADDR=0x8000 | ||
25 | CONFIG_CPU_32v6K=y | ||
26 | CONFIG_NO_HZ=y | ||
27 | CONFIG_PREEMPT=y | ||
28 | CONFIG_AEABI=y | ||
29 | # CONFIG_OABI_COMPAT is not set | ||
30 | CONFIG_UACCESS_WITH_MEMCPY=y | ||
31 | CONFIG_ZBOOT_ROM_TEXT=0x0e000000 | ||
32 | CONFIG_ZBOOT_ROM_BSS=0x0ea00000 | ||
33 | CONFIG_ZBOOT_ROM=y | ||
34 | CONFIG_NET=y | ||
35 | # CONFIG_WIRELESS is not set | ||
36 | CONFIG_MTD=y | ||
37 | CONFIG_MTD_CONCAT=y | ||
38 | CONFIG_MTD_PARTITIONS=y | ||
39 | CONFIG_MTD_CMDLINE_PARTS=y | ||
40 | CONFIG_MTD_CHAR=y | ||
41 | CONFIG_MTD_BLOCK=y | ||
42 | CONFIG_MTD_CFI=y | ||
43 | CONFIG_MTD_CFI_ADV_OPTIONS=y | ||
44 | CONFIG_MTD_CFI_GEOMETRY=y | ||
45 | # CONFIG_MTD_CFI_I2 is not set | ||
46 | CONFIG_MTD_NAND=y | ||
47 | CONFIG_MTD_NAND_VERIFY_WRITE=y | ||
48 | CONFIG_MTD_NAND_BCM_UMI=y | ||
49 | CONFIG_MTD_NAND_BCM_UMI_HWCS=y | ||
50 | # CONFIG_MISC_DEVICES is not set | ||
51 | # CONFIG_INPUT_MOUSEDEV is not set | ||
52 | # CONFIG_INPUT_KEYBOARD is not set | ||
53 | # CONFIG_INPUT_MOUSE is not set | ||
54 | # CONFIG_SERIO is not set | ||
55 | # CONFIG_CONSOLE_TRANSLATIONS is not set | ||
56 | # CONFIG_DEVKMEM is not set | ||
57 | CONFIG_SERIAL_AMBA_PL011=y | ||
58 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | ||
59 | CONFIG_LEGACY_PTY_COUNT=64 | ||
60 | # CONFIG_HW_RANDOM is not set | ||
61 | # CONFIG_HWMON is not set | ||
62 | # CONFIG_VGA_CONSOLE is not set | ||
63 | # CONFIG_HID_SUPPORT is not set | ||
64 | # CONFIG_USB_SUPPORT is not set | ||
65 | # CONFIG_FILE_LOCKING is not set | ||
66 | # CONFIG_DNOTIFY is not set | ||
67 | # CONFIG_INOTIFY_USER is not set | ||
68 | # CONFIG_PROC_PAGE_MONITOR is not set | ||
69 | CONFIG_TMPFS=y | ||
70 | CONFIG_JFFS2_FS=y | ||
71 | CONFIG_JFFS2_SUMMARY=y | ||
72 | CONFIG_JFFS2_FS_XATTR=y | ||
73 | # CONFIG_JFFS2_FS_SECURITY is not set | ||
74 | # CONFIG_NETWORK_FILESYSTEMS is not set | ||
75 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | ||
76 | CONFIG_MAGIC_SYSRQ=y | ||
77 | CONFIG_HEADERS_CHECK=y | ||
78 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
79 | # CONFIG_ARM_UNWIND is not set | ||
diff --git a/arch/arm/configs/cpu9260_defconfig b/arch/arm/configs/cpu9260_defconfig index bbf729e2fb6f..921480c23b98 100644 --- a/arch/arm/configs/cpu9260_defconfig +++ b/arch/arm/configs/cpu9260_defconfig | |||
@@ -82,7 +82,7 @@ CONFIG_USB_STORAGE=y | |||
82 | CONFIG_USB_GADGET=y | 82 | CONFIG_USB_GADGET=y |
83 | CONFIG_USB_ETH=m | 83 | CONFIG_USB_ETH=m |
84 | CONFIG_MMC=y | 84 | CONFIG_MMC=y |
85 | CONFIG_MMC_AT91=m | 85 | CONFIG_MMC_ATMELMCI=m |
86 | CONFIG_NEW_LEDS=y | 86 | CONFIG_NEW_LEDS=y |
87 | CONFIG_LEDS_CLASS=y | 87 | CONFIG_LEDS_CLASS=y |
88 | CONFIG_LEDS_GPIO=y | 88 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/cpu9g20_defconfig b/arch/arm/configs/cpu9g20_defconfig index e7d7942927f3..ea116cbdffa1 100644 --- a/arch/arm/configs/cpu9g20_defconfig +++ b/arch/arm/configs/cpu9g20_defconfig | |||
@@ -82,7 +82,7 @@ CONFIG_USB_STORAGE=y | |||
82 | CONFIG_USB_GADGET=y | 82 | CONFIG_USB_GADGET=y |
83 | CONFIG_USB_ETH=m | 83 | CONFIG_USB_ETH=m |
84 | CONFIG_MMC=y | 84 | CONFIG_MMC=y |
85 | CONFIG_MMC_AT91=m | 85 | CONFIG_MMC_ATMELMCI=m |
86 | CONFIG_NEW_LEDS=y | 86 | CONFIG_NEW_LEDS=y |
87 | CONFIG_LEDS_CLASS=y | 87 | CONFIG_LEDS_CLASS=y |
88 | CONFIG_LEDS_GPIO=y | 88 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 565132d02105..66aa7a6db884 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -40,7 +40,6 @@ CONFIG_VMSPLIT_2G=y | |||
40 | CONFIG_PREEMPT_VOLUNTARY=y | 40 | CONFIG_PREEMPT_VOLUNTARY=y |
41 | CONFIG_AEABI=y | 41 | CONFIG_AEABI=y |
42 | # CONFIG_OABI_COMPAT is not set | 42 | # CONFIG_OABI_COMPAT is not set |
43 | CONFIG_DEFAULT_MMAP_MIN_ADDR=32768 | ||
44 | CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" | 43 | CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" |
45 | CONFIG_VFP=y | 44 | CONFIG_VFP=y |
46 | CONFIG_NEON=y | 45 | CONFIG_NEON=y |
@@ -177,6 +176,9 @@ CONFIG_SND_SOC_IMX_MC13783=y | |||
177 | CONFIG_USB=y | 176 | CONFIG_USB=y |
178 | CONFIG_USB_EHCI_HCD=y | 177 | CONFIG_USB_EHCI_HCD=y |
179 | CONFIG_USB_EHCI_MXC=y | 178 | CONFIG_USB_EHCI_MXC=y |
179 | CONFIG_USB_CHIPIDEA=y | ||
180 | CONFIG_USB_CHIPIDEA_HOST=y | ||
181 | CONFIG_USB_MXS_PHY=y | ||
180 | CONFIG_USB_STORAGE=y | 182 | CONFIG_USB_STORAGE=y |
181 | CONFIG_MMC=y | 183 | CONFIG_MMC=y |
182 | CONFIG_MMC_SDHCI=y | 184 | CONFIG_MMC_SDHCI=y |
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig index 5d0c66708960..c88b57886e79 100644 --- a/arch/arm/configs/kzm9g_defconfig +++ b/arch/arm/configs/kzm9g_defconfig | |||
@@ -23,7 +23,6 @@ CONFIG_MODULE_UNLOAD=y | |||
23 | # CONFIG_IOSCHED_DEADLINE is not set | 23 | # CONFIG_IOSCHED_DEADLINE is not set |
24 | # CONFIG_IOSCHED_CFQ is not set | 24 | # CONFIG_IOSCHED_CFQ is not set |
25 | CONFIG_ARCH_SHMOBILE=y | 25 | CONFIG_ARCH_SHMOBILE=y |
26 | CONFIG_KEYBOARD_GPIO_POLLED=y | ||
27 | CONFIG_ARCH_SH73A0=y | 26 | CONFIG_ARCH_SH73A0=y |
28 | CONFIG_MACH_KZM9G=y | 27 | CONFIG_MACH_KZM9G=y |
29 | CONFIG_MEMORY_START=0x41000000 | 28 | CONFIG_MEMORY_START=0x41000000 |
@@ -71,6 +70,7 @@ CONFIG_INPUT_SPARSEKMAP=y | |||
71 | # CONFIG_INPUT_MOUSEDEV is not set | 70 | # CONFIG_INPUT_MOUSEDEV is not set |
72 | CONFIG_INPUT_EVDEV=y | 71 | CONFIG_INPUT_EVDEV=y |
73 | # CONFIG_KEYBOARD_ATKBD is not set | 72 | # CONFIG_KEYBOARD_ATKBD is not set |
73 | CONFIG_KEYBOARD_GPIO=y | ||
74 | # CONFIG_INPUT_MOUSE is not set | 74 | # CONFIG_INPUT_MOUSE is not set |
75 | CONFIG_INPUT_TOUCHSCREEN=y | 75 | CONFIG_INPUT_TOUCHSCREEN=y |
76 | CONFIG_TOUCHSCREEN_ST1232=y | 76 | CONFIG_TOUCHSCREEN_ST1232=y |
diff --git a/arch/arm/configs/lpc32xx_defconfig b/arch/arm/configs/lpc32xx_defconfig index e42a0e3d4c3a..92386b20bd09 100644 --- a/arch/arm/configs/lpc32xx_defconfig +++ b/arch/arm/configs/lpc32xx_defconfig | |||
@@ -133,7 +133,6 @@ CONFIG_SND_DEBUG_VERBOSE=y | |||
133 | # CONFIG_SND_ARM is not set | 133 | # CONFIG_SND_ARM is not set |
134 | # CONFIG_SND_SPI is not set | 134 | # CONFIG_SND_SPI is not set |
135 | CONFIG_SND_SOC=y | 135 | CONFIG_SND_SOC=y |
136 | # CONFIG_HID_SUPPORT is not set | ||
137 | CONFIG_USB=y | 136 | CONFIG_USB=y |
138 | CONFIG_USB_OHCI_HCD=y | 137 | CONFIG_USB_OHCI_HCD=y |
139 | CONFIG_USB_STORAGE=y | 138 | CONFIG_USB_STORAGE=y |
@@ -149,6 +148,7 @@ CONFIG_LEDS_CLASS=y | |||
149 | CONFIG_LEDS_PCA9532=y | 148 | CONFIG_LEDS_PCA9532=y |
150 | CONFIG_LEDS_PCA9532_GPIO=y | 149 | CONFIG_LEDS_PCA9532_GPIO=y |
151 | CONFIG_LEDS_GPIO=y | 150 | CONFIG_LEDS_GPIO=y |
151 | CONFIG_LEDS_PWM=y | ||
152 | CONFIG_LEDS_TRIGGERS=y | 152 | CONFIG_LEDS_TRIGGERS=y |
153 | CONFIG_LEDS_TRIGGER_TIMER=y | 153 | CONFIG_LEDS_TRIGGER_TIMER=y |
154 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | 154 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y |
@@ -161,10 +161,13 @@ CONFIG_RTC_DRV_DS1374=y | |||
161 | CONFIG_RTC_DRV_PCF8563=y | 161 | CONFIG_RTC_DRV_PCF8563=y |
162 | CONFIG_RTC_DRV_LPC32XX=y | 162 | CONFIG_RTC_DRV_LPC32XX=y |
163 | CONFIG_DMADEVICES=y | 163 | CONFIG_DMADEVICES=y |
164 | CONFIG_AMBA_PL08X=y | ||
164 | CONFIG_STAGING=y | 165 | CONFIG_STAGING=y |
165 | CONFIG_LPC32XX_ADC=y | 166 | CONFIG_LPC32XX_ADC=y |
166 | CONFIG_MAX517=y | ||
167 | CONFIG_IIO=y | 167 | CONFIG_IIO=y |
168 | CONFIG_MAX517=y | ||
169 | CONFIG_PWM=y | ||
170 | CONFIG_PWM_LPC32XX=y | ||
168 | CONFIG_EXT2_FS=y | 171 | CONFIG_EXT2_FS=y |
169 | CONFIG_AUTOFS4_FS=y | 172 | CONFIG_AUTOFS4_FS=y |
170 | CONFIG_MSDOS_FS=y | 173 | CONFIG_MSDOS_FS=y |
diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig index 864f9a5c39dd..53382b6c8bb4 100644 --- a/arch/arm/configs/marzen_defconfig +++ b/arch/arm/configs/marzen_defconfig | |||
@@ -1,13 +1,14 @@ | |||
1 | # CONFIG_ARM_PATCH_PHYS_VIRT is not set | 1 | # CONFIG_ARM_PATCH_PHYS_VIRT is not set |
2 | CONFIG_EXPERIMENTAL=y | 2 | CONFIG_EXPERIMENTAL=y |
3 | CONFIG_KERNEL_LZMA=y | 3 | CONFIG_KERNEL_LZMA=y |
4 | CONFIG_NO_HZ=y | ||
4 | CONFIG_IKCONFIG=y | 5 | CONFIG_IKCONFIG=y |
5 | CONFIG_IKCONFIG_PROC=y | 6 | CONFIG_IKCONFIG_PROC=y |
6 | CONFIG_LOG_BUF_SHIFT=16 | 7 | CONFIG_LOG_BUF_SHIFT=16 |
7 | CONFIG_SYSCTL_SYSCALL=y | 8 | CONFIG_SYSCTL_SYSCALL=y |
8 | CONFIG_EMBEDDED=y | 9 | CONFIG_EMBEDDED=y |
9 | CONFIG_SLAB=y | 10 | CONFIG_SLAB=y |
10 | # CONFIG_BLOCK is not set | 11 | # CONFIG_IOSCHED_CFQ is not set |
11 | CONFIG_ARCH_SHMOBILE=y | 12 | CONFIG_ARCH_SHMOBILE=y |
12 | CONFIG_ARCH_R8A7779=y | 13 | CONFIG_ARCH_R8A7779=y |
13 | CONFIG_MACH_MARZEN=y | 14 | CONFIG_MACH_MARZEN=y |
@@ -21,7 +22,6 @@ CONFIG_ARM_ERRATA_458693=y | |||
21 | CONFIG_ARM_ERRATA_460075=y | 22 | CONFIG_ARM_ERRATA_460075=y |
22 | CONFIG_ARM_ERRATA_743622=y | 23 | CONFIG_ARM_ERRATA_743622=y |
23 | CONFIG_ARM_ERRATA_754322=y | 24 | CONFIG_ARM_ERRATA_754322=y |
24 | CONFIG_NO_HZ=y | ||
25 | CONFIG_SMP=y | 25 | CONFIG_SMP=y |
26 | # CONFIG_ARM_CPU_TOPOLOGY is not set | 26 | # CONFIG_ARM_CPU_TOPOLOGY is not set |
27 | CONFIG_AEABI=y | 27 | CONFIG_AEABI=y |
@@ -29,13 +29,16 @@ CONFIG_AEABI=y | |||
29 | CONFIG_HIGHMEM=y | 29 | CONFIG_HIGHMEM=y |
30 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 30 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
31 | CONFIG_ZBOOT_ROM_BSS=0x0 | 31 | CONFIG_ZBOOT_ROM_BSS=0x0 |
32 | CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel" | 32 | CONFIG_CMDLINE="console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on" |
33 | CONFIG_CMDLINE_FORCE=y | 33 | CONFIG_CMDLINE_FORCE=y |
34 | CONFIG_KEXEC=y | 34 | CONFIG_KEXEC=y |
35 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 35 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
36 | CONFIG_PM_RUNTIME=y | 36 | CONFIG_PM_RUNTIME=y |
37 | CONFIG_NET=y | 37 | CONFIG_NET=y |
38 | CONFIG_UNIX=y | ||
38 | CONFIG_INET=y | 39 | CONFIG_INET=y |
40 | CONFIG_IP_PNP=y | ||
41 | CONFIG_IP_PNP_DHCP=y | ||
39 | # CONFIG_IPV6 is not set | 42 | # CONFIG_IPV6 is not set |
40 | # CONFIG_WIRELESS is not set | 43 | # CONFIG_WIRELESS is not set |
41 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 44 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
@@ -68,17 +71,21 @@ CONFIG_SERIAL_SH_SCI_CONSOLE=y | |||
68 | # CONFIG_HW_RANDOM is not set | 71 | # CONFIG_HW_RANDOM is not set |
69 | CONFIG_GPIO_SYSFS=y | 72 | CONFIG_GPIO_SYSFS=y |
70 | # CONFIG_HWMON is not set | 73 | # CONFIG_HWMON is not set |
74 | CONFIG_THERMAL=y | ||
75 | CONFIG_RCAR_THERMAL=y | ||
71 | CONFIG_SSB=y | 76 | CONFIG_SSB=y |
72 | # CONFIG_HID_SUPPORT is not set | ||
73 | # CONFIG_USB_SUPPORT is not set | 77 | # CONFIG_USB_SUPPORT is not set |
78 | CONFIG_MMC=y | ||
79 | CONFIG_MMC_SDHI=y | ||
74 | CONFIG_UIO=y | 80 | CONFIG_UIO=y |
75 | CONFIG_UIO_PDRV_GENIRQ=y | 81 | CONFIG_UIO_PDRV_GENIRQ=y |
76 | # CONFIG_IOMMU_SUPPORT is not set | 82 | # CONFIG_IOMMU_SUPPORT is not set |
77 | # CONFIG_FILE_LOCKING is not set | ||
78 | # CONFIG_DNOTIFY is not set | 83 | # CONFIG_DNOTIFY is not set |
79 | # CONFIG_INOTIFY_USER is not set | 84 | # CONFIG_INOTIFY_USER is not set |
80 | CONFIG_TMPFS=y | 85 | CONFIG_TMPFS=y |
81 | # CONFIG_MISC_FILESYSTEMS is not set | 86 | # CONFIG_MISC_FILESYSTEMS is not set |
87 | CONFIG_NFS_FS=y | ||
88 | CONFIG_ROOT_NFS=y | ||
82 | CONFIG_MAGIC_SYSRQ=y | 89 | CONFIG_MAGIC_SYSRQ=y |
83 | CONFIG_DEBUG_INFO=y | 90 | CONFIG_DEBUG_INFO=y |
84 | CONFIG_DEBUG_INFO_REDUCED=y | 91 | CONFIG_DEBUG_INFO_REDUCED=y |
diff --git a/arch/arm/configs/mmp2_defconfig b/arch/arm/configs/mmp2_defconfig index 5a584520db2f..f1cb95e58af0 100644 --- a/arch/arm/configs/mmp2_defconfig +++ b/arch/arm/configs/mmp2_defconfig | |||
@@ -16,7 +16,7 @@ CONFIG_PREEMPT=y | |||
16 | CONFIG_AEABI=y | 16 | CONFIG_AEABI=y |
17 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 17 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
18 | CONFIG_ZBOOT_ROM_BSS=0x0 | 18 | CONFIG_ZBOOT_ROM_BSS=0x0 |
19 | CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS2,38400 mem=128M user_debug=255" | 19 | CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on console=ttyS2,38400 mem=128M user_debug=255 earlyprintk" |
20 | CONFIG_VFP=y | 20 | CONFIG_VFP=y |
21 | CONFIG_NET=y | 21 | CONFIG_NET=y |
22 | CONFIG_PACKET=y | 22 | CONFIG_PACKET=y |
@@ -90,6 +90,9 @@ CONFIG_DEBUG_INFO=y | |||
90 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 90 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set |
91 | # CONFIG_DYNAMIC_DEBUG is not set | 91 | # CONFIG_DYNAMIC_DEBUG is not set |
92 | CONFIG_DEBUG_USER=y | 92 | CONFIG_DEBUG_USER=y |
93 | CONFIG_DEBUG_LL=y | ||
94 | CONFIG_DEBUG_MMP_UART3=y | ||
95 | CONFIG_EARLY_PRINTK=y | ||
93 | CONFIG_DEBUG_ERRORS=y | 96 | CONFIG_DEBUG_ERRORS=y |
94 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | 97 | # CONFIG_CRYPTO_ANSI_CPRNG is not set |
95 | CONFIG_CRC_CCITT=y | 98 | CONFIG_CRC_CCITT=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig new file mode 100644 index 000000000000..159f75fc4377 --- /dev/null +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -0,0 +1,57 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_NO_HZ=y | ||
3 | CONFIG_HIGH_RES_TIMERS=y | ||
4 | CONFIG_ARCH_MVEBU=y | ||
5 | CONFIG_MACH_ARMADA_370=y | ||
6 | CONFIG_MACH_ARMADA_XP=y | ||
7 | CONFIG_ARCH_HIGHBANK=y | ||
8 | CONFIG_ARCH_SOCFPGA=y | ||
9 | # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set | ||
10 | CONFIG_ARM_ERRATA_754322=y | ||
11 | CONFIG_SMP=y | ||
12 | CONFIG_ARM_ARCH_TIMER=y | ||
13 | CONFIG_AEABI=y | ||
14 | CONFIG_HIGHMEM=y | ||
15 | CONFIG_HIGHPTE=y | ||
16 | CONFIG_ARM_APPENDED_DTB=y | ||
17 | CONFIG_VFP=y | ||
18 | CONFIG_NEON=y | ||
19 | CONFIG_NET=y | ||
20 | CONFIG_ATA=y | ||
21 | CONFIG_SATA_HIGHBANK=y | ||
22 | CONFIG_NETDEVICES=y | ||
23 | CONFIG_NET_CALXEDA_XGMAC=y | ||
24 | CONFIG_SMSC911X=y | ||
25 | CONFIG_STMMAC_ETH=y | ||
26 | CONFIG_SERIO_AMBAKMI=y | ||
27 | CONFIG_SERIAL_8250=y | ||
28 | CONFIG_SERIAL_8250_CONSOLE=y | ||
29 | CONFIG_SERIAL_8250_DW=y | ||
30 | CONFIG_SERIAL_AMBA_PL011=y | ||
31 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | ||
32 | CONFIG_SERIAL_OF_PLATFORM=y | ||
33 | CONFIG_IPMI_HANDLER=y | ||
34 | CONFIG_IPMI_SI=y | ||
35 | CONFIG_I2C=y | ||
36 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
37 | CONFIG_SPI=y | ||
38 | CONFIG_SPI_PL022=y | ||
39 | CONFIG_GPIOLIB=y | ||
40 | CONFIG_FB=y | ||
41 | CONFIG_FB_ARMCLCD=y | ||
42 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
43 | CONFIG_USB=y | ||
44 | CONFIG_USB_ISP1760_HCD=y | ||
45 | CONFIG_USB_STORAGE=y | ||
46 | CONFIG_MMC=y | ||
47 | CONFIG_MMC_ARMMMCI=y | ||
48 | CONFIG_MMC_SDHCI=y | ||
49 | CONFIG_MMC_SDHCI_PLTFM=y | ||
50 | CONFIG_EDAC=y | ||
51 | CONFIG_EDAC_MM_EDAC=y | ||
52 | CONFIG_EDAC_HIGHBANK_MC=y | ||
53 | CONFIG_EDAC_HIGHBANK_L2=y | ||
54 | CONFIG_RTC_CLASS=y | ||
55 | CONFIG_RTC_DRV_PL031=y | ||
56 | CONFIG_DMADEVICES=y | ||
57 | CONFIG_PL330_DMA=y | ||
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig index 36d60dda310c..048aaca60814 100644 --- a/arch/arm/configs/mxs_defconfig +++ b/arch/arm/configs/mxs_defconfig | |||
@@ -53,6 +53,9 @@ CONFIG_DEVTMPFS=y | |||
53 | # CONFIG_FIRMWARE_IN_KERNEL is not set | 53 | # CONFIG_FIRMWARE_IN_KERNEL is not set |
54 | # CONFIG_BLK_DEV is not set | 54 | # CONFIG_BLK_DEV is not set |
55 | CONFIG_MTD=y | 55 | CONFIG_MTD=y |
56 | CONFIG_MTD_CHAR=y | ||
57 | CONFIG_MTD_DATAFLASH=y | ||
58 | CONFIG_MTD_M25P80 | ||
56 | CONFIG_MTD_NAND=y | 59 | CONFIG_MTD_NAND=y |
57 | CONFIG_MTD_NAND_GPMI_NAND=y | 60 | CONFIG_MTD_NAND_GPMI_NAND=y |
58 | CONFIG_NETDEVICES=y | 61 | CONFIG_NETDEVICES=y |
@@ -82,13 +85,13 @@ CONFIG_I2C_CHARDEV=y | |||
82 | CONFIG_I2C_MXS=y | 85 | CONFIG_I2C_MXS=y |
83 | CONFIG_SPI=y | 86 | CONFIG_SPI=y |
84 | CONFIG_SPI_GPIO=m | 87 | CONFIG_SPI_GPIO=m |
88 | CONFIG_SPI_MXS=y | ||
85 | CONFIG_DEBUG_GPIO=y | 89 | CONFIG_DEBUG_GPIO=y |
86 | CONFIG_GPIO_SYSFS=y | 90 | CONFIG_GPIO_SYSFS=y |
87 | # CONFIG_HWMON is not set | 91 | # CONFIG_HWMON is not set |
88 | # CONFIG_MFD_SUPPORT is not set | 92 | # CONFIG_MFD_SUPPORT is not set |
89 | CONFIG_DISPLAY_SUPPORT=m | 93 | CONFIG_DISPLAY_SUPPORT=m |
90 | # CONFIG_HID_SUPPORT is not set | 94 | # CONFIG_HID_SUPPORT is not set |
91 | # CONFIG_USB_SUPPORT is not set | ||
92 | CONFIG_SOUND=y | 95 | CONFIG_SOUND=y |
93 | CONFIG_SND=y | 96 | CONFIG_SND=y |
94 | CONFIG_SND_TIMER=y | 97 | CONFIG_SND_TIMER=y |
@@ -103,14 +106,45 @@ CONFIG_SND_SOC_I2C_AND_SPI=y | |||
103 | CONFIG_SND_SOC_SGTL5000=y | 106 | CONFIG_SND_SOC_SGTL5000=y |
104 | CONFIG_REGULATOR=y | 107 | CONFIG_REGULATOR=y |
105 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 108 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
109 | CONFIG_FB=y | ||
110 | CONFIG_FB_MXS=y | ||
111 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
112 | CONFIG_LCD_CLASS_DEVICE=y | ||
113 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
114 | CONFIG_BACKLIGHT_PWM=y | ||
115 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
116 | CONFIG_FONTS=y | ||
117 | CONFIG_LOGO=y | ||
118 | CONFIG_USB=y | ||
119 | CONFIG_USB_CHIPIDEA=y | ||
120 | CONFIG_USB_CHIPIDEA_HOST=y | ||
121 | CONFIG_USB_STORAGE=y | ||
122 | CONFIG_USB_MXS_PHY=y | ||
123 | CONFIG_SCSI=y | ||
124 | CONFIG_BLK_DEV_SD=y | ||
106 | CONFIG_MMC=y | 125 | CONFIG_MMC=y |
107 | CONFIG_MMC_MXS=y | 126 | CONFIG_MMC_MXS=y |
127 | CONFIG_NEW_LEDS=y | ||
128 | CONFIG_LEDS_CLASS=y | ||
129 | CONFIG_LEDS_GPIO=y | ||
130 | CONFIG_LEDS_TRIGGERS=y | ||
131 | CONFIG_LEDS_TRIGGER_TIMER=y | ||
132 | CONFIG_LEDS_TRIGGER_ONESHOT=y | ||
133 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
134 | CONFIG_LEDS_TRIGGER_BACKLIGHT=y | ||
135 | CONFIG_LEDS_TRIGGER_GPIO=y | ||
108 | CONFIG_RTC_CLASS=y | 136 | CONFIG_RTC_CLASS=y |
109 | CONFIG_RTC_DRV_DS1307=m | 137 | CONFIG_RTC_DRV_DS1307=m |
110 | CONFIG_RTC_DRV_STMP=y | 138 | CONFIG_RTC_DRV_STMP=y |
111 | CONFIG_DMADEVICES=y | 139 | CONFIG_DMADEVICES=y |
112 | CONFIG_MXS_DMA=y | 140 | CONFIG_MXS_DMA=y |
141 | CONFIG_STAGING=y | ||
142 | CONFIG_MXS_LRADC=y | ||
143 | CONFIG_IIO_SYSFS_TRIGGER=y | ||
113 | CONFIG_COMMON_CLK_DEBUG=y | 144 | CONFIG_COMMON_CLK_DEBUG=y |
145 | CONFIG_IIO=y | ||
146 | CONFIG_PWM=y | ||
147 | CONFIG_PWM_MXS=y | ||
114 | CONFIG_EXT3_FS=y | 148 | CONFIG_EXT3_FS=y |
115 | # CONFIG_DNOTIFY is not set | 149 | # CONFIG_DNOTIFY is not set |
116 | CONFIG_FSCACHE=m | 150 | CONFIG_FSCACHE=m |
diff --git a/arch/arm/configs/pxa910_defconfig b/arch/arm/configs/pxa910_defconfig index 1cd381e1d47d..191118caa5c0 100644 --- a/arch/arm/configs/pxa910_defconfig +++ b/arch/arm/configs/pxa910_defconfig | |||
@@ -17,7 +17,7 @@ CONFIG_PREEMPT=y | |||
17 | CONFIG_AEABI=y | 17 | CONFIG_AEABI=y |
18 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 18 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
19 | CONFIG_ZBOOT_ROM_BSS=0x0 | 19 | CONFIG_ZBOOT_ROM_BSS=0x0 |
20 | CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.2.100:/nfsroot/ ip=192.168.2.101:192.168.2.100::255.255.255.0::eth0:on console=ttyS0,115200 mem=128M" | 20 | CONFIG_CMDLINE="root=/dev/nfs rootfstype=nfs nfsroot=192.168.2.100:/nfsroot/ ip=192.168.2.101:192.168.2.100::255.255.255.0::eth0:on console=ttyS0,115200 mem=128M earlyprintk" |
21 | CONFIG_FPE_NWFPE=y | 21 | CONFIG_FPE_NWFPE=y |
22 | CONFIG_NET=y | 22 | CONFIG_NET=y |
23 | CONFIG_PACKET=y | 23 | CONFIG_PACKET=y |
@@ -66,5 +66,7 @@ CONFIG_DEBUG_INFO=y | |||
66 | CONFIG_DEBUG_USER=y | 66 | CONFIG_DEBUG_USER=y |
67 | CONFIG_DEBUG_ERRORS=y | 67 | CONFIG_DEBUG_ERRORS=y |
68 | CONFIG_DEBUG_LL=y | 68 | CONFIG_DEBUG_LL=y |
69 | CONFIG_DEBUG_MMP_UART2=y | ||
70 | CONFIG_EARLY_PRINTK=y | ||
69 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | 71 | # CONFIG_CRYPTO_ANSI_CPRNG is not set |
70 | CONFIG_CRC_CCITT=y | 72 | CONFIG_CRC_CCITT=y |
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig index 9160f3b7751f..42d5db1876ab 100644 --- a/arch/arm/configs/qil-a9260_defconfig +++ b/arch/arm/configs/qil-a9260_defconfig | |||
@@ -50,7 +50,6 @@ CONFIG_MTD_BLOCK=y | |||
50 | CONFIG_MTD_DATAFLASH=y | 50 | CONFIG_MTD_DATAFLASH=y |
51 | CONFIG_MTD_NAND=y | 51 | CONFIG_MTD_NAND=y |
52 | CONFIG_MTD_NAND_ATMEL=y | 52 | CONFIG_MTD_NAND_ATMEL=y |
53 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
54 | CONFIG_BLK_DEV_LOOP=y | 53 | CONFIG_BLK_DEV_LOOP=y |
55 | # CONFIG_MISC_DEVICES is not set | 54 | # CONFIG_MISC_DEVICES is not set |
56 | CONFIG_SCSI=y | 55 | CONFIG_SCSI=y |
@@ -87,7 +86,7 @@ CONFIG_USB_STORAGE=y | |||
87 | CONFIG_USB_GADGET=y | 86 | CONFIG_USB_GADGET=y |
88 | CONFIG_USB_ETH=m | 87 | CONFIG_USB_ETH=m |
89 | CONFIG_MMC=y | 88 | CONFIG_MMC=y |
90 | CONFIG_MMC_AT91=m | 89 | CONFIG_MMC_ATMELMCI=m |
91 | CONFIG_NEW_LEDS=y | 90 | CONFIG_NEW_LEDS=y |
92 | CONFIG_LEDS_CLASS=y | 91 | CONFIG_LEDS_CLASS=y |
93 | CONFIG_LEDS_GPIO=y | 92 | CONFIG_LEDS_GPIO=y |
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig index ba6a515086b5..3a186d653dac 100644 --- a/arch/arm/configs/s3c6400_defconfig +++ b/arch/arm/configs/s3c6400_defconfig | |||
@@ -9,11 +9,14 @@ CONFIG_ARCH_S3C64XX=y | |||
9 | CONFIG_S3C_BOOT_ERROR_RESET=y | 9 | CONFIG_S3C_BOOT_ERROR_RESET=y |
10 | CONFIG_MACH_SMDK6400=y | 10 | CONFIG_MACH_SMDK6400=y |
11 | CONFIG_MACH_ANW6410=y | 11 | CONFIG_MACH_ANW6410=y |
12 | CONFIG_MACH_MINI6410=y | ||
13 | CONFIG_MACH_REAL6410=y | ||
12 | CONFIG_MACH_SMDK6410=y | 14 | CONFIG_MACH_SMDK6410=y |
13 | CONFIG_MACH_NCP=y | 15 | CONFIG_MACH_NCP=y |
14 | CONFIG_MACH_HMT=y | 16 | CONFIG_MACH_HMT=y |
15 | CONFIG_MACH_SMARTQ5=y | 17 | CONFIG_MACH_SMARTQ5=y |
16 | CONFIG_MACH_SMARTQ7=y | 18 | CONFIG_MACH_SMARTQ7=y |
19 | CONFIG_MACH_WLF_CRAGG_6410=y | ||
17 | CONFIG_CPU_32v6K=y | 20 | CONFIG_CPU_32v6K=y |
18 | CONFIG_AEABI=y | 21 | CONFIG_AEABI=y |
19 | CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/linuxrc initrd=0x51000000,6M ramdisk_size=6144" | 22 | CONFIG_CMDLINE="console=ttySAC0,115200 root=/dev/ram init=/linuxrc initrd=0x51000000,6M ramdisk_size=6144" |
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig index ecf2531523a1..b4384af1bea6 100644 --- a/arch/arm/configs/sam9_l9260_defconfig +++ b/arch/arm/configs/sam9_l9260_defconfig | |||
@@ -39,7 +39,7 @@ CONFIG_MTD_NAND=y | |||
39 | CONFIG_MTD_NAND_ATMEL=y | 39 | CONFIG_MTD_NAND_ATMEL=y |
40 | CONFIG_MTD_NAND_PLATFORM=y | 40 | CONFIG_MTD_NAND_PLATFORM=y |
41 | CONFIG_MTD_UBI=y | 41 | CONFIG_MTD_UBI=y |
42 | CONFIG_MTD_UBI_BEB_RESERVE=3 | 42 | CONFIG_MTD_UBI_BEB_LIMIT=25 |
43 | CONFIG_MTD_UBI_GLUEBI=y | 43 | CONFIG_MTD_UBI_GLUEBI=y |
44 | CONFIG_BLK_DEV_LOOP=y | 44 | CONFIG_BLK_DEV_LOOP=y |
45 | CONFIG_BLK_DEV_RAM=y | 45 | CONFIG_BLK_DEV_RAM=y |
diff --git a/arch/arm/configs/stamp9g20_defconfig b/arch/arm/configs/stamp9g20_defconfig index d5e260b8b160..52f1488591c7 100644 --- a/arch/arm/configs/stamp9g20_defconfig +++ b/arch/arm/configs/stamp9g20_defconfig | |||
@@ -100,7 +100,6 @@ CONFIG_USB_ETH=m | |||
100 | CONFIG_USB_FILE_STORAGE=m | 100 | CONFIG_USB_FILE_STORAGE=m |
101 | CONFIG_USB_G_SERIAL=m | 101 | CONFIG_USB_G_SERIAL=m |
102 | CONFIG_MMC=y | 102 | CONFIG_MMC=y |
103 | # CONFIG_MMC_AT91 is not set | ||
104 | CONFIG_MMC_ATMELMCI=y | 103 | CONFIG_MMC_ATMELMCI=y |
105 | CONFIG_NEW_LEDS=y | 104 | CONFIG_NEW_LEDS=y |
106 | CONFIG_LEDS_CLASS=y | 105 | CONFIG_LEDS_CLASS=y |
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index 0d6bb738c6de..e2184f6c20b3 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig | |||
@@ -24,11 +24,11 @@ CONFIG_EFI_PARTITION=y | |||
24 | # CONFIG_IOSCHED_DEADLINE is not set | 24 | # CONFIG_IOSCHED_DEADLINE is not set |
25 | # CONFIG_IOSCHED_CFQ is not set | 25 | # CONFIG_IOSCHED_CFQ is not set |
26 | CONFIG_ARCH_TEGRA=y | 26 | CONFIG_ARCH_TEGRA=y |
27 | CONFIG_GPIO_PCA953X=y | ||
27 | CONFIG_ARCH_TEGRA_2x_SOC=y | 28 | CONFIG_ARCH_TEGRA_2x_SOC=y |
28 | CONFIG_ARCH_TEGRA_3x_SOC=y | 29 | CONFIG_ARCH_TEGRA_3x_SOC=y |
29 | CONFIG_MACH_HARMONY=y | 30 | CONFIG_TEGRA_PCI=y |
30 | CONFIG_MACH_PAZ00=y | 31 | CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA=y |
31 | CONFIG_MACH_TRIMSLICE=y | ||
32 | CONFIG_TEGRA_EMC_SCALING_ENABLE=y | 32 | CONFIG_TEGRA_EMC_SCALING_ENABLE=y |
33 | CONFIG_SMP=y | 33 | CONFIG_SMP=y |
34 | CONFIG_PREEMPT=y | 34 | CONFIG_PREEMPT=y |
@@ -67,7 +67,18 @@ CONFIG_INET6_IPCOMP=y | |||
67 | CONFIG_IPV6_MIP6=y | 67 | CONFIG_IPV6_MIP6=y |
68 | CONFIG_IPV6_TUNNEL=y | 68 | CONFIG_IPV6_TUNNEL=y |
69 | CONFIG_IPV6_MULTIPLE_TABLES=y | 69 | CONFIG_IPV6_MULTIPLE_TABLES=y |
70 | # CONFIG_WIRELESS is not set | 70 | CONFIG_BT=y |
71 | CONFIG_BT_RFCOMM=y | ||
72 | CONFIG_BT_BNEP=y | ||
73 | CONFIG_BT_HIDP=y | ||
74 | CONFIG_BT_HCIBTUSB=m | ||
75 | CONFIG_CFG80211=y | ||
76 | CONFIG_MAC80211=y | ||
77 | CONFIG_RFKILL=y | ||
78 | CONFIG_RFKILL_INPUT=y | ||
79 | CONFIG_RFKILL_GPIO=y | ||
80 | CONFIG_DEVTMPFS=y | ||
81 | CONFIG_DEVTMPFS_MOUNT=y | ||
71 | # CONFIG_FIRMWARE_IN_KERNEL is not set | 82 | # CONFIG_FIRMWARE_IN_KERNEL is not set |
72 | CONFIG_PROC_DEVICETREE=y | 83 | CONFIG_PROC_DEVICETREE=y |
73 | CONFIG_BLK_DEV_LOOP=y | 84 | CONFIG_BLK_DEV_LOOP=y |
@@ -87,7 +98,8 @@ CONFIG_USB_PEGASUS=y | |||
87 | CONFIG_USB_USBNET=y | 98 | CONFIG_USB_USBNET=y |
88 | CONFIG_USB_NET_SMSC75XX=y | 99 | CONFIG_USB_NET_SMSC75XX=y |
89 | CONFIG_USB_NET_SMSC95XX=y | 100 | CONFIG_USB_NET_SMSC95XX=y |
90 | # CONFIG_WLAN is not set | 101 | CONFIG_RT2X00=y |
102 | CONFIG_RT2800USB=m | ||
91 | CONFIG_INPUT_EVDEV=y | 103 | CONFIG_INPUT_EVDEV=y |
92 | CONFIG_INPUT_MISC=y | 104 | CONFIG_INPUT_MISC=y |
93 | CONFIG_INPUT_MPU3050=y | 105 | CONFIG_INPUT_MPU3050=y |
@@ -105,25 +117,31 @@ CONFIG_I2C_MUX_PINCTRL=y | |||
105 | CONFIG_I2C_TEGRA=y | 117 | CONFIG_I2C_TEGRA=y |
106 | CONFIG_SPI=y | 118 | CONFIG_SPI=y |
107 | CONFIG_SPI_TEGRA=y | 119 | CONFIG_SPI_TEGRA=y |
108 | CONFIG_GPIO_TPS65910=y | 120 | CONFIG_GPIO_PCA953X_IRQ=y |
109 | CONFIG_GPIO_TPS6586X=y | 121 | CONFIG_GPIO_TPS6586X=y |
122 | CONFIG_GPIO_TPS65910=y | ||
110 | CONFIG_POWER_SUPPLY=y | 123 | CONFIG_POWER_SUPPLY=y |
111 | CONFIG_BATTERY_SBS=y | 124 | CONFIG_BATTERY_SBS=y |
112 | CONFIG_SENSORS_LM90=y | 125 | CONFIG_SENSORS_LM90=y |
113 | CONFIG_MFD_TPS6586X=y | 126 | CONFIG_MFD_TPS6586X=y |
114 | CONFIG_MFD_TPS65910=y | 127 | CONFIG_MFD_TPS65910=y |
128 | CONFIG_MFD_MAX8907=y | ||
115 | CONFIG_REGULATOR=y | 129 | CONFIG_REGULATOR=y |
116 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 130 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
117 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y | 131 | CONFIG_REGULATOR_VIRTUAL_CONSUMER=y |
118 | CONFIG_REGULATOR_GPIO=y | 132 | CONFIG_REGULATOR_GPIO=y |
133 | CONFIG_REGULATOR_MAX8907=y | ||
119 | CONFIG_REGULATOR_TPS62360=y | 134 | CONFIG_REGULATOR_TPS62360=y |
120 | CONFIG_REGULATOR_TPS6586X=y | 135 | CONFIG_REGULATOR_TPS6586X=y |
121 | CONFIG_REGULATOR_TPS65910=y | 136 | CONFIG_REGULATOR_TPS65910=y |
137 | CONFIG_MEDIA_SUPPORT=y | ||
138 | CONFIG_MEDIA_CAMERA_SUPPORT=y | ||
139 | CONFIG_MEDIA_USB_SUPPORT=y | ||
140 | CONFIG_USB_VIDEO_CLASS=m | ||
122 | CONFIG_SOUND=y | 141 | CONFIG_SOUND=y |
123 | CONFIG_SND=y | 142 | CONFIG_SND=y |
124 | # CONFIG_SND_SUPPORT_OLD_API is not set | 143 | # CONFIG_SND_SUPPORT_OLD_API is not set |
125 | # CONFIG_SND_DRIVERS is not set | 144 | # CONFIG_SND_DRIVERS is not set |
126 | # CONFIG_SND_PCI is not set | ||
127 | # CONFIG_SND_ARM is not set | 145 | # CONFIG_SND_ARM is not set |
128 | # CONFIG_SND_SPI is not set | 146 | # CONFIG_SND_SPI is not set |
129 | # CONFIG_SND_USB is not set | 147 | # CONFIG_SND_USB is not set |
@@ -136,13 +154,25 @@ CONFIG_SND_SOC_TEGRA_ALC5632=y | |||
136 | CONFIG_USB=y | 154 | CONFIG_USB=y |
137 | CONFIG_USB_EHCI_HCD=y | 155 | CONFIG_USB_EHCI_HCD=y |
138 | CONFIG_USB_EHCI_TEGRA=y | 156 | CONFIG_USB_EHCI_TEGRA=y |
157 | CONFIG_USB_ACM=y | ||
158 | CONFIG_USB_WDM=y | ||
139 | CONFIG_USB_STORAGE=y | 159 | CONFIG_USB_STORAGE=y |
140 | CONFIG_MMC=y | 160 | CONFIG_MMC=y |
141 | CONFIG_MMC_BLOCK_MINORS=16 | 161 | CONFIG_MMC_BLOCK_MINORS=16 |
142 | CONFIG_MMC_SDHCI=y | 162 | CONFIG_MMC_SDHCI=y |
143 | CONFIG_MMC_SDHCI_PLTFM=y | 163 | CONFIG_MMC_SDHCI_PLTFM=y |
144 | CONFIG_MMC_SDHCI_TEGRA=y | 164 | CONFIG_MMC_SDHCI_TEGRA=y |
165 | CONFIG_NEW_LEDS=y | ||
166 | CONFIG_LEDS_CLASS=y | ||
167 | CONFIG_LEDS_GPIO=y | ||
168 | CONFIG_LEDS_TRIGGERS=y | ||
169 | CONFIG_LEDS_TRIGGER_GPIO=y | ||
145 | CONFIG_RTC_CLASS=y | 170 | CONFIG_RTC_CLASS=y |
171 | CONFIG_RTC_INTF_SYSFS=y | ||
172 | CONFIG_RTC_INTF_PROC=y | ||
173 | CONFIG_RTC_INTF_DEV=y | ||
174 | CONFIG_RTC_DRV_MAX8907=y | ||
175 | CONFIG_RTC_DRV_TPS65910=y | ||
146 | CONFIG_RTC_DRV_EM3027=y | 176 | CONFIG_RTC_DRV_EM3027=y |
147 | CONFIG_RTC_DRV_TEGRA=y | 177 | CONFIG_RTC_DRV_TEGRA=y |
148 | CONFIG_DMADEVICES=y | 178 | CONFIG_DMADEVICES=y |
@@ -154,10 +184,14 @@ CONFIG_SENSORS_AK8975=y | |||
154 | CONFIG_MFD_NVEC=y | 184 | CONFIG_MFD_NVEC=y |
155 | CONFIG_KEYBOARD_NVEC=y | 185 | CONFIG_KEYBOARD_NVEC=y |
156 | CONFIG_SERIO_NVEC_PS2=y | 186 | CONFIG_SERIO_NVEC_PS2=y |
187 | CONFIG_NVEC_POWER=y | ||
188 | CONFIG_NVEC_PAZ00=y | ||
157 | CONFIG_TEGRA_IOMMU_GART=y | 189 | CONFIG_TEGRA_IOMMU_GART=y |
158 | CONFIG_TEGRA_IOMMU_SMMU=y | 190 | CONFIG_TEGRA_IOMMU_SMMU=y |
159 | CONFIG_MEMORY=y | 191 | CONFIG_MEMORY=y |
160 | CONFIG_IIO=y | 192 | CONFIG_IIO=y |
193 | CONFIG_PWM=y | ||
194 | CONFIG_PWM_TEGRA=y | ||
161 | CONFIG_EXT2_FS=y | 195 | CONFIG_EXT2_FS=y |
162 | CONFIG_EXT2_FS_XATTR=y | 196 | CONFIG_EXT2_FS_XATTR=y |
163 | CONFIG_EXT2_FS_POSIX_ACL=y | 197 | CONFIG_EXT2_FS_POSIX_ACL=y |
@@ -170,6 +204,7 @@ CONFIG_EXT4_FS=y | |||
170 | # CONFIG_DNOTIFY is not set | 204 | # CONFIG_DNOTIFY is not set |
171 | CONFIG_VFAT_FS=y | 205 | CONFIG_VFAT_FS=y |
172 | CONFIG_TMPFS=y | 206 | CONFIG_TMPFS=y |
207 | CONFIG_TMPFS_POSIX_ACL=y | ||
173 | CONFIG_NFS_FS=y | 208 | CONFIG_NFS_FS=y |
174 | CONFIG_ROOT_NFS=y | 209 | CONFIG_ROOT_NFS=y |
175 | CONFIG_NLS_CODEPAGE_437=y | 210 | CONFIG_NLS_CODEPAGE_437=y |
@@ -188,8 +223,6 @@ CONFIG_DEBUG_VM=y | |||
188 | CONFIG_DEBUG_SG=y | 223 | CONFIG_DEBUG_SG=y |
189 | CONFIG_DEBUG_LL=y | 224 | CONFIG_DEBUG_LL=y |
190 | CONFIG_EARLY_PRINTK=y | 225 | CONFIG_EARLY_PRINTK=y |
191 | CONFIG_CRYPTO_ECB=y | ||
192 | CONFIG_CRYPTO_ARC4=y | ||
193 | CONFIG_CRYPTO_TWOFISH=y | 226 | CONFIG_CRYPTO_TWOFISH=y |
194 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | 227 | # CONFIG_CRYPTO_ANSI_CPRNG is not set |
195 | CONFIG_CRYPTO_DEV_TEGRA_AES=y | 228 | CONFIG_CRYPTO_DEV_TEGRA_AES=y |
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig index 2e39f38b9627..a1501e1e1a90 100644 --- a/arch/arm/configs/usb-a9260_defconfig +++ b/arch/arm/configs/usb-a9260_defconfig | |||
@@ -49,7 +49,6 @@ CONFIG_MTD_BLOCK=y | |||
49 | CONFIG_MTD_DATAFLASH=y | 49 | CONFIG_MTD_DATAFLASH=y |
50 | CONFIG_MTD_NAND=y | 50 | CONFIG_MTD_NAND=y |
51 | CONFIG_MTD_NAND_ATMEL=y | 51 | CONFIG_MTD_NAND_ATMEL=y |
52 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
53 | CONFIG_BLK_DEV_LOOP=y | 52 | CONFIG_BLK_DEV_LOOP=y |
54 | # CONFIG_MISC_DEVICES is not set | 53 | # CONFIG_MISC_DEVICES is not set |
55 | CONFIG_SCSI=y | 54 | CONFIG_SCSI=y |
diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile new file mode 100644 index 000000000000..a2c83851bc90 --- /dev/null +++ b/arch/arm/crypto/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | # | ||
2 | # Arch-specific CryptoAPI modules. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_CRYPTO_AES_ARM) += aes-arm.o | ||
6 | obj-$(CONFIG_CRYPTO_SHA1_ARM) += sha1-arm.o | ||
7 | |||
8 | aes-arm-y := aes-armv4.o aes_glue.o | ||
9 | sha1-arm-y := sha1-armv4-large.o sha1_glue.o | ||
diff --git a/arch/arm/crypto/aes-armv4.S b/arch/arm/crypto/aes-armv4.S new file mode 100644 index 000000000000..e59b1d505d6c --- /dev/null +++ b/arch/arm/crypto/aes-armv4.S | |||
@@ -0,0 +1,1112 @@ | |||
1 | #define __ARM_ARCH__ __LINUX_ARM_ARCH__ | ||
2 | @ ==================================================================== | ||
3 | @ Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
4 | @ project. The module is, however, dual licensed under OpenSSL and | ||
5 | @ CRYPTOGAMS licenses depending on where you obtain it. For further | ||
6 | @ details see http://www.openssl.org/~appro/cryptogams/. | ||
7 | @ ==================================================================== | ||
8 | |||
9 | @ AES for ARMv4 | ||
10 | |||
11 | @ January 2007. | ||
12 | @ | ||
13 | @ Code uses single 1K S-box and is >2 times faster than code generated | ||
14 | @ by gcc-3.4.1. This is thanks to unique feature of ARMv4 ISA, which | ||
15 | @ allows to merge logical or arithmetic operation with shift or rotate | ||
16 | @ in one instruction and emit combined result every cycle. The module | ||
17 | @ is endian-neutral. The performance is ~42 cycles/byte for 128-bit | ||
18 | @ key [on single-issue Xscale PXA250 core]. | ||
19 | |||
20 | @ May 2007. | ||
21 | @ | ||
22 | @ AES_set_[en|de]crypt_key is added. | ||
23 | |||
24 | @ July 2010. | ||
25 | @ | ||
26 | @ Rescheduling for dual-issue pipeline resulted in 12% improvement on | ||
27 | @ Cortex A8 core and ~25 cycles per byte processed with 128-bit key. | ||
28 | |||
29 | @ February 2011. | ||
30 | @ | ||
31 | @ Profiler-assisted and platform-specific optimization resulted in 16% | ||
32 | @ improvement on Cortex A8 core and ~21.5 cycles per byte. | ||
33 | |||
34 | @ A little glue here to select the correct code below for the ARM CPU | ||
35 | @ that is being targetted. | ||
36 | |||
37 | .text | ||
38 | .code 32 | ||
39 | |||
40 | .type AES_Te,%object | ||
41 | .align 5 | ||
42 | AES_Te: | ||
43 | .word 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d | ||
44 | .word 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554 | ||
45 | .word 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d | ||
46 | .word 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a | ||
47 | .word 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87 | ||
48 | .word 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b | ||
49 | .word 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea | ||
50 | .word 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b | ||
51 | .word 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a | ||
52 | .word 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f | ||
53 | .word 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108 | ||
54 | .word 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f | ||
55 | .word 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e | ||
56 | .word 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5 | ||
57 | .word 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d | ||
58 | .word 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f | ||
59 | .word 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e | ||
60 | .word 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb | ||
61 | .word 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce | ||
62 | .word 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497 | ||
63 | .word 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c | ||
64 | .word 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed | ||
65 | .word 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b | ||
66 | .word 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a | ||
67 | .word 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16 | ||
68 | .word 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594 | ||
69 | .word 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81 | ||
70 | .word 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3 | ||
71 | .word 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a | ||
72 | .word 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504 | ||
73 | .word 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163 | ||
74 | .word 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d | ||
75 | .word 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f | ||
76 | .word 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739 | ||
77 | .word 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47 | ||
78 | .word 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395 | ||
79 | .word 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f | ||
80 | .word 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883 | ||
81 | .word 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c | ||
82 | .word 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76 | ||
83 | .word 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e | ||
84 | .word 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4 | ||
85 | .word 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6 | ||
86 | .word 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b | ||
87 | .word 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7 | ||
88 | .word 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0 | ||
89 | .word 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25 | ||
90 | .word 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818 | ||
91 | .word 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72 | ||
92 | .word 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651 | ||
93 | .word 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21 | ||
94 | .word 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85 | ||
95 | .word 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa | ||
96 | .word 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12 | ||
97 | .word 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0 | ||
98 | .word 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9 | ||
99 | .word 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133 | ||
100 | .word 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7 | ||
101 | .word 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920 | ||
102 | .word 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a | ||
103 | .word 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17 | ||
104 | .word 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8 | ||
105 | .word 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11 | ||
106 | .word 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a | ||
107 | @ Te4[256] | ||
108 | .byte 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5 | ||
109 | .byte 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76 | ||
110 | .byte 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0 | ||
111 | .byte 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0 | ||
112 | .byte 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc | ||
113 | .byte 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15 | ||
114 | .byte 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a | ||
115 | .byte 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75 | ||
116 | .byte 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0 | ||
117 | .byte 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84 | ||
118 | .byte 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b | ||
119 | .byte 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf | ||
120 | .byte 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85 | ||
121 | .byte 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8 | ||
122 | .byte 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5 | ||
123 | .byte 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2 | ||
124 | .byte 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17 | ||
125 | .byte 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73 | ||
126 | .byte 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88 | ||
127 | .byte 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb | ||
128 | .byte 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c | ||
129 | .byte 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79 | ||
130 | .byte 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9 | ||
131 | .byte 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08 | ||
132 | .byte 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6 | ||
133 | .byte 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a | ||
134 | .byte 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e | ||
135 | .byte 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e | ||
136 | .byte 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94 | ||
137 | .byte 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf | ||
138 | .byte 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68 | ||
139 | .byte 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 | ||
140 | @ rcon[] | ||
141 | .word 0x01000000, 0x02000000, 0x04000000, 0x08000000 | ||
142 | .word 0x10000000, 0x20000000, 0x40000000, 0x80000000 | ||
143 | .word 0x1B000000, 0x36000000, 0, 0, 0, 0, 0, 0 | ||
144 | .size AES_Te,.-AES_Te | ||
145 | |||
146 | @ void AES_encrypt(const unsigned char *in, unsigned char *out, | ||
147 | @ const AES_KEY *key) { | ||
148 | .global AES_encrypt | ||
149 | .type AES_encrypt,%function | ||
150 | .align 5 | ||
151 | AES_encrypt: | ||
152 | sub r3,pc,#8 @ AES_encrypt | ||
153 | stmdb sp!,{r1,r4-r12,lr} | ||
154 | mov r12,r0 @ inp | ||
155 | mov r11,r2 | ||
156 | sub r10,r3,#AES_encrypt-AES_Te @ Te | ||
157 | #if __ARM_ARCH__<7 | ||
158 | ldrb r0,[r12,#3] @ load input data in endian-neutral | ||
159 | ldrb r4,[r12,#2] @ manner... | ||
160 | ldrb r5,[r12,#1] | ||
161 | ldrb r6,[r12,#0] | ||
162 | orr r0,r0,r4,lsl#8 | ||
163 | ldrb r1,[r12,#7] | ||
164 | orr r0,r0,r5,lsl#16 | ||
165 | ldrb r4,[r12,#6] | ||
166 | orr r0,r0,r6,lsl#24 | ||
167 | ldrb r5,[r12,#5] | ||
168 | ldrb r6,[r12,#4] | ||
169 | orr r1,r1,r4,lsl#8 | ||
170 | ldrb r2,[r12,#11] | ||
171 | orr r1,r1,r5,lsl#16 | ||
172 | ldrb r4,[r12,#10] | ||
173 | orr r1,r1,r6,lsl#24 | ||
174 | ldrb r5,[r12,#9] | ||
175 | ldrb r6,[r12,#8] | ||
176 | orr r2,r2,r4,lsl#8 | ||
177 | ldrb r3,[r12,#15] | ||
178 | orr r2,r2,r5,lsl#16 | ||
179 | ldrb r4,[r12,#14] | ||
180 | orr r2,r2,r6,lsl#24 | ||
181 | ldrb r5,[r12,#13] | ||
182 | ldrb r6,[r12,#12] | ||
183 | orr r3,r3,r4,lsl#8 | ||
184 | orr r3,r3,r5,lsl#16 | ||
185 | orr r3,r3,r6,lsl#24 | ||
186 | #else | ||
187 | ldr r0,[r12,#0] | ||
188 | ldr r1,[r12,#4] | ||
189 | ldr r2,[r12,#8] | ||
190 | ldr r3,[r12,#12] | ||
191 | #ifdef __ARMEL__ | ||
192 | rev r0,r0 | ||
193 | rev r1,r1 | ||
194 | rev r2,r2 | ||
195 | rev r3,r3 | ||
196 | #endif | ||
197 | #endif | ||
198 | bl _armv4_AES_encrypt | ||
199 | |||
200 | ldr r12,[sp],#4 @ pop out | ||
201 | #if __ARM_ARCH__>=7 | ||
202 | #ifdef __ARMEL__ | ||
203 | rev r0,r0 | ||
204 | rev r1,r1 | ||
205 | rev r2,r2 | ||
206 | rev r3,r3 | ||
207 | #endif | ||
208 | str r0,[r12,#0] | ||
209 | str r1,[r12,#4] | ||
210 | str r2,[r12,#8] | ||
211 | str r3,[r12,#12] | ||
212 | #else | ||
213 | mov r4,r0,lsr#24 @ write output in endian-neutral | ||
214 | mov r5,r0,lsr#16 @ manner... | ||
215 | mov r6,r0,lsr#8 | ||
216 | strb r4,[r12,#0] | ||
217 | strb r5,[r12,#1] | ||
218 | mov r4,r1,lsr#24 | ||
219 | strb r6,[r12,#2] | ||
220 | mov r5,r1,lsr#16 | ||
221 | strb r0,[r12,#3] | ||
222 | mov r6,r1,lsr#8 | ||
223 | strb r4,[r12,#4] | ||
224 | strb r5,[r12,#5] | ||
225 | mov r4,r2,lsr#24 | ||
226 | strb r6,[r12,#6] | ||
227 | mov r5,r2,lsr#16 | ||
228 | strb r1,[r12,#7] | ||
229 | mov r6,r2,lsr#8 | ||
230 | strb r4,[r12,#8] | ||
231 | strb r5,[r12,#9] | ||
232 | mov r4,r3,lsr#24 | ||
233 | strb r6,[r12,#10] | ||
234 | mov r5,r3,lsr#16 | ||
235 | strb r2,[r12,#11] | ||
236 | mov r6,r3,lsr#8 | ||
237 | strb r4,[r12,#12] | ||
238 | strb r5,[r12,#13] | ||
239 | strb r6,[r12,#14] | ||
240 | strb r3,[r12,#15] | ||
241 | #endif | ||
242 | #if __ARM_ARCH__>=5 | ||
243 | ldmia sp!,{r4-r12,pc} | ||
244 | #else | ||
245 | ldmia sp!,{r4-r12,lr} | ||
246 | tst lr,#1 | ||
247 | moveq pc,lr @ be binary compatible with V4, yet | ||
248 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) | ||
249 | #endif | ||
250 | .size AES_encrypt,.-AES_encrypt | ||
251 | |||
252 | .type _armv4_AES_encrypt,%function | ||
253 | .align 2 | ||
254 | _armv4_AES_encrypt: | ||
255 | str lr,[sp,#-4]! @ push lr | ||
256 | ldmia r11!,{r4-r7} | ||
257 | eor r0,r0,r4 | ||
258 | ldr r12,[r11,#240-16] | ||
259 | eor r1,r1,r5 | ||
260 | eor r2,r2,r6 | ||
261 | eor r3,r3,r7 | ||
262 | sub r12,r12,#1 | ||
263 | mov lr,#255 | ||
264 | |||
265 | and r7,lr,r0 | ||
266 | and r8,lr,r0,lsr#8 | ||
267 | and r9,lr,r0,lsr#16 | ||
268 | mov r0,r0,lsr#24 | ||
269 | .Lenc_loop: | ||
270 | ldr r4,[r10,r7,lsl#2] @ Te3[s0>>0] | ||
271 | and r7,lr,r1,lsr#16 @ i0 | ||
272 | ldr r5,[r10,r8,lsl#2] @ Te2[s0>>8] | ||
273 | and r8,lr,r1 | ||
274 | ldr r6,[r10,r9,lsl#2] @ Te1[s0>>16] | ||
275 | and r9,lr,r1,lsr#8 | ||
276 | ldr r0,[r10,r0,lsl#2] @ Te0[s0>>24] | ||
277 | mov r1,r1,lsr#24 | ||
278 | |||
279 | ldr r7,[r10,r7,lsl#2] @ Te1[s1>>16] | ||
280 | ldr r8,[r10,r8,lsl#2] @ Te3[s1>>0] | ||
281 | ldr r9,[r10,r9,lsl#2] @ Te2[s1>>8] | ||
282 | eor r0,r0,r7,ror#8 | ||
283 | ldr r1,[r10,r1,lsl#2] @ Te0[s1>>24] | ||
284 | and r7,lr,r2,lsr#8 @ i0 | ||
285 | eor r5,r5,r8,ror#8 | ||
286 | and r8,lr,r2,lsr#16 @ i1 | ||
287 | eor r6,r6,r9,ror#8 | ||
288 | and r9,lr,r2 | ||
289 | ldr r7,[r10,r7,lsl#2] @ Te2[s2>>8] | ||
290 | eor r1,r1,r4,ror#24 | ||
291 | ldr r8,[r10,r8,lsl#2] @ Te1[s2>>16] | ||
292 | mov r2,r2,lsr#24 | ||
293 | |||
294 | ldr r9,[r10,r9,lsl#2] @ Te3[s2>>0] | ||
295 | eor r0,r0,r7,ror#16 | ||
296 | ldr r2,[r10,r2,lsl#2] @ Te0[s2>>24] | ||
297 | and r7,lr,r3 @ i0 | ||
298 | eor r1,r1,r8,ror#8 | ||
299 | and r8,lr,r3,lsr#8 @ i1 | ||
300 | eor r6,r6,r9,ror#16 | ||
301 | and r9,lr,r3,lsr#16 @ i2 | ||
302 | ldr r7,[r10,r7,lsl#2] @ Te3[s3>>0] | ||
303 | eor r2,r2,r5,ror#16 | ||
304 | ldr r8,[r10,r8,lsl#2] @ Te2[s3>>8] | ||
305 | mov r3,r3,lsr#24 | ||
306 | |||
307 | ldr r9,[r10,r9,lsl#2] @ Te1[s3>>16] | ||
308 | eor r0,r0,r7,ror#24 | ||
309 | ldr r7,[r11],#16 | ||
310 | eor r1,r1,r8,ror#16 | ||
311 | ldr r3,[r10,r3,lsl#2] @ Te0[s3>>24] | ||
312 | eor r2,r2,r9,ror#8 | ||
313 | ldr r4,[r11,#-12] | ||
314 | eor r3,r3,r6,ror#8 | ||
315 | |||
316 | ldr r5,[r11,#-8] | ||
317 | eor r0,r0,r7 | ||
318 | ldr r6,[r11,#-4] | ||
319 | and r7,lr,r0 | ||
320 | eor r1,r1,r4 | ||
321 | and r8,lr,r0,lsr#8 | ||
322 | eor r2,r2,r5 | ||
323 | and r9,lr,r0,lsr#16 | ||
324 | eor r3,r3,r6 | ||
325 | mov r0,r0,lsr#24 | ||
326 | |||
327 | subs r12,r12,#1 | ||
328 | bne .Lenc_loop | ||
329 | |||
330 | add r10,r10,#2 | ||
331 | |||
332 | ldrb r4,[r10,r7,lsl#2] @ Te4[s0>>0] | ||
333 | and r7,lr,r1,lsr#16 @ i0 | ||
334 | ldrb r5,[r10,r8,lsl#2] @ Te4[s0>>8] | ||
335 | and r8,lr,r1 | ||
336 | ldrb r6,[r10,r9,lsl#2] @ Te4[s0>>16] | ||
337 | and r9,lr,r1,lsr#8 | ||
338 | ldrb r0,[r10,r0,lsl#2] @ Te4[s0>>24] | ||
339 | mov r1,r1,lsr#24 | ||
340 | |||
341 | ldrb r7,[r10,r7,lsl#2] @ Te4[s1>>16] | ||
342 | ldrb r8,[r10,r8,lsl#2] @ Te4[s1>>0] | ||
343 | ldrb r9,[r10,r9,lsl#2] @ Te4[s1>>8] | ||
344 | eor r0,r7,r0,lsl#8 | ||
345 | ldrb r1,[r10,r1,lsl#2] @ Te4[s1>>24] | ||
346 | and r7,lr,r2,lsr#8 @ i0 | ||
347 | eor r5,r8,r5,lsl#8 | ||
348 | and r8,lr,r2,lsr#16 @ i1 | ||
349 | eor r6,r9,r6,lsl#8 | ||
350 | and r9,lr,r2 | ||
351 | ldrb r7,[r10,r7,lsl#2] @ Te4[s2>>8] | ||
352 | eor r1,r4,r1,lsl#24 | ||
353 | ldrb r8,[r10,r8,lsl#2] @ Te4[s2>>16] | ||
354 | mov r2,r2,lsr#24 | ||
355 | |||
356 | ldrb r9,[r10,r9,lsl#2] @ Te4[s2>>0] | ||
357 | eor r0,r7,r0,lsl#8 | ||
358 | ldrb r2,[r10,r2,lsl#2] @ Te4[s2>>24] | ||
359 | and r7,lr,r3 @ i0 | ||
360 | eor r1,r1,r8,lsl#16 | ||
361 | and r8,lr,r3,lsr#8 @ i1 | ||
362 | eor r6,r9,r6,lsl#8 | ||
363 | and r9,lr,r3,lsr#16 @ i2 | ||
364 | ldrb r7,[r10,r7,lsl#2] @ Te4[s3>>0] | ||
365 | eor r2,r5,r2,lsl#24 | ||
366 | ldrb r8,[r10,r8,lsl#2] @ Te4[s3>>8] | ||
367 | mov r3,r3,lsr#24 | ||
368 | |||
369 | ldrb r9,[r10,r9,lsl#2] @ Te4[s3>>16] | ||
370 | eor r0,r7,r0,lsl#8 | ||
371 | ldr r7,[r11,#0] | ||
372 | ldrb r3,[r10,r3,lsl#2] @ Te4[s3>>24] | ||
373 | eor r1,r1,r8,lsl#8 | ||
374 | ldr r4,[r11,#4] | ||
375 | eor r2,r2,r9,lsl#16 | ||
376 | ldr r5,[r11,#8] | ||
377 | eor r3,r6,r3,lsl#24 | ||
378 | ldr r6,[r11,#12] | ||
379 | |||
380 | eor r0,r0,r7 | ||
381 | eor r1,r1,r4 | ||
382 | eor r2,r2,r5 | ||
383 | eor r3,r3,r6 | ||
384 | |||
385 | sub r10,r10,#2 | ||
386 | ldr pc,[sp],#4 @ pop and return | ||
387 | .size _armv4_AES_encrypt,.-_armv4_AES_encrypt | ||
388 | |||
389 | .global private_AES_set_encrypt_key | ||
390 | .type private_AES_set_encrypt_key,%function | ||
391 | .align 5 | ||
392 | private_AES_set_encrypt_key: | ||
393 | _armv4_AES_set_encrypt_key: | ||
394 | sub r3,pc,#8 @ AES_set_encrypt_key | ||
395 | teq r0,#0 | ||
396 | moveq r0,#-1 | ||
397 | beq .Labrt | ||
398 | teq r2,#0 | ||
399 | moveq r0,#-1 | ||
400 | beq .Labrt | ||
401 | |||
402 | teq r1,#128 | ||
403 | beq .Lok | ||
404 | teq r1,#192 | ||
405 | beq .Lok | ||
406 | teq r1,#256 | ||
407 | movne r0,#-1 | ||
408 | bne .Labrt | ||
409 | |||
410 | .Lok: stmdb sp!,{r4-r12,lr} | ||
411 | sub r10,r3,#_armv4_AES_set_encrypt_key-AES_Te-1024 @ Te4 | ||
412 | |||
413 | mov r12,r0 @ inp | ||
414 | mov lr,r1 @ bits | ||
415 | mov r11,r2 @ key | ||
416 | |||
417 | #if __ARM_ARCH__<7 | ||
418 | ldrb r0,[r12,#3] @ load input data in endian-neutral | ||
419 | ldrb r4,[r12,#2] @ manner... | ||
420 | ldrb r5,[r12,#1] | ||
421 | ldrb r6,[r12,#0] | ||
422 | orr r0,r0,r4,lsl#8 | ||
423 | ldrb r1,[r12,#7] | ||
424 | orr r0,r0,r5,lsl#16 | ||
425 | ldrb r4,[r12,#6] | ||
426 | orr r0,r0,r6,lsl#24 | ||
427 | ldrb r5,[r12,#5] | ||
428 | ldrb r6,[r12,#4] | ||
429 | orr r1,r1,r4,lsl#8 | ||
430 | ldrb r2,[r12,#11] | ||
431 | orr r1,r1,r5,lsl#16 | ||
432 | ldrb r4,[r12,#10] | ||
433 | orr r1,r1,r6,lsl#24 | ||
434 | ldrb r5,[r12,#9] | ||
435 | ldrb r6,[r12,#8] | ||
436 | orr r2,r2,r4,lsl#8 | ||
437 | ldrb r3,[r12,#15] | ||
438 | orr r2,r2,r5,lsl#16 | ||
439 | ldrb r4,[r12,#14] | ||
440 | orr r2,r2,r6,lsl#24 | ||
441 | ldrb r5,[r12,#13] | ||
442 | ldrb r6,[r12,#12] | ||
443 | orr r3,r3,r4,lsl#8 | ||
444 | str r0,[r11],#16 | ||
445 | orr r3,r3,r5,lsl#16 | ||
446 | str r1,[r11,#-12] | ||
447 | orr r3,r3,r6,lsl#24 | ||
448 | str r2,[r11,#-8] | ||
449 | str r3,[r11,#-4] | ||
450 | #else | ||
451 | ldr r0,[r12,#0] | ||
452 | ldr r1,[r12,#4] | ||
453 | ldr r2,[r12,#8] | ||
454 | ldr r3,[r12,#12] | ||
455 | #ifdef __ARMEL__ | ||
456 | rev r0,r0 | ||
457 | rev r1,r1 | ||
458 | rev r2,r2 | ||
459 | rev r3,r3 | ||
460 | #endif | ||
461 | str r0,[r11],#16 | ||
462 | str r1,[r11,#-12] | ||
463 | str r2,[r11,#-8] | ||
464 | str r3,[r11,#-4] | ||
465 | #endif | ||
466 | |||
467 | teq lr,#128 | ||
468 | bne .Lnot128 | ||
469 | mov r12,#10 | ||
470 | str r12,[r11,#240-16] | ||
471 | add r6,r10,#256 @ rcon | ||
472 | mov lr,#255 | ||
473 | |||
474 | .L128_loop: | ||
475 | and r5,lr,r3,lsr#24 | ||
476 | and r7,lr,r3,lsr#16 | ||
477 | ldrb r5,[r10,r5] | ||
478 | and r8,lr,r3,lsr#8 | ||
479 | ldrb r7,[r10,r7] | ||
480 | and r9,lr,r3 | ||
481 | ldrb r8,[r10,r8] | ||
482 | orr r5,r5,r7,lsl#24 | ||
483 | ldrb r9,[r10,r9] | ||
484 | orr r5,r5,r8,lsl#16 | ||
485 | ldr r4,[r6],#4 @ rcon[i++] | ||
486 | orr r5,r5,r9,lsl#8 | ||
487 | eor r5,r5,r4 | ||
488 | eor r0,r0,r5 @ rk[4]=rk[0]^... | ||
489 | eor r1,r1,r0 @ rk[5]=rk[1]^rk[4] | ||
490 | str r0,[r11],#16 | ||
491 | eor r2,r2,r1 @ rk[6]=rk[2]^rk[5] | ||
492 | str r1,[r11,#-12] | ||
493 | eor r3,r3,r2 @ rk[7]=rk[3]^rk[6] | ||
494 | str r2,[r11,#-8] | ||
495 | subs r12,r12,#1 | ||
496 | str r3,[r11,#-4] | ||
497 | bne .L128_loop | ||
498 | sub r2,r11,#176 | ||
499 | b .Ldone | ||
500 | |||
501 | .Lnot128: | ||
502 | #if __ARM_ARCH__<7 | ||
503 | ldrb r8,[r12,#19] | ||
504 | ldrb r4,[r12,#18] | ||
505 | ldrb r5,[r12,#17] | ||
506 | ldrb r6,[r12,#16] | ||
507 | orr r8,r8,r4,lsl#8 | ||
508 | ldrb r9,[r12,#23] | ||
509 | orr r8,r8,r5,lsl#16 | ||
510 | ldrb r4,[r12,#22] | ||
511 | orr r8,r8,r6,lsl#24 | ||
512 | ldrb r5,[r12,#21] | ||
513 | ldrb r6,[r12,#20] | ||
514 | orr r9,r9,r4,lsl#8 | ||
515 | orr r9,r9,r5,lsl#16 | ||
516 | str r8,[r11],#8 | ||
517 | orr r9,r9,r6,lsl#24 | ||
518 | str r9,[r11,#-4] | ||
519 | #else | ||
520 | ldr r8,[r12,#16] | ||
521 | ldr r9,[r12,#20] | ||
522 | #ifdef __ARMEL__ | ||
523 | rev r8,r8 | ||
524 | rev r9,r9 | ||
525 | #endif | ||
526 | str r8,[r11],#8 | ||
527 | str r9,[r11,#-4] | ||
528 | #endif | ||
529 | |||
530 | teq lr,#192 | ||
531 | bne .Lnot192 | ||
532 | mov r12,#12 | ||
533 | str r12,[r11,#240-24] | ||
534 | add r6,r10,#256 @ rcon | ||
535 | mov lr,#255 | ||
536 | mov r12,#8 | ||
537 | |||
538 | .L192_loop: | ||
539 | and r5,lr,r9,lsr#24 | ||
540 | and r7,lr,r9,lsr#16 | ||
541 | ldrb r5,[r10,r5] | ||
542 | and r8,lr,r9,lsr#8 | ||
543 | ldrb r7,[r10,r7] | ||
544 | and r9,lr,r9 | ||
545 | ldrb r8,[r10,r8] | ||
546 | orr r5,r5,r7,lsl#24 | ||
547 | ldrb r9,[r10,r9] | ||
548 | orr r5,r5,r8,lsl#16 | ||
549 | ldr r4,[r6],#4 @ rcon[i++] | ||
550 | orr r5,r5,r9,lsl#8 | ||
551 | eor r9,r5,r4 | ||
552 | eor r0,r0,r9 @ rk[6]=rk[0]^... | ||
553 | eor r1,r1,r0 @ rk[7]=rk[1]^rk[6] | ||
554 | str r0,[r11],#24 | ||
555 | eor r2,r2,r1 @ rk[8]=rk[2]^rk[7] | ||
556 | str r1,[r11,#-20] | ||
557 | eor r3,r3,r2 @ rk[9]=rk[3]^rk[8] | ||
558 | str r2,[r11,#-16] | ||
559 | subs r12,r12,#1 | ||
560 | str r3,[r11,#-12] | ||
561 | subeq r2,r11,#216 | ||
562 | beq .Ldone | ||
563 | |||
564 | ldr r7,[r11,#-32] | ||
565 | ldr r8,[r11,#-28] | ||
566 | eor r7,r7,r3 @ rk[10]=rk[4]^rk[9] | ||
567 | eor r9,r8,r7 @ rk[11]=rk[5]^rk[10] | ||
568 | str r7,[r11,#-8] | ||
569 | str r9,[r11,#-4] | ||
570 | b .L192_loop | ||
571 | |||
572 | .Lnot192: | ||
573 | #if __ARM_ARCH__<7 | ||
574 | ldrb r8,[r12,#27] | ||
575 | ldrb r4,[r12,#26] | ||
576 | ldrb r5,[r12,#25] | ||
577 | ldrb r6,[r12,#24] | ||
578 | orr r8,r8,r4,lsl#8 | ||
579 | ldrb r9,[r12,#31] | ||
580 | orr r8,r8,r5,lsl#16 | ||
581 | ldrb r4,[r12,#30] | ||
582 | orr r8,r8,r6,lsl#24 | ||
583 | ldrb r5,[r12,#29] | ||
584 | ldrb r6,[r12,#28] | ||
585 | orr r9,r9,r4,lsl#8 | ||
586 | orr r9,r9,r5,lsl#16 | ||
587 | str r8,[r11],#8 | ||
588 | orr r9,r9,r6,lsl#24 | ||
589 | str r9,[r11,#-4] | ||
590 | #else | ||
591 | ldr r8,[r12,#24] | ||
592 | ldr r9,[r12,#28] | ||
593 | #ifdef __ARMEL__ | ||
594 | rev r8,r8 | ||
595 | rev r9,r9 | ||
596 | #endif | ||
597 | str r8,[r11],#8 | ||
598 | str r9,[r11,#-4] | ||
599 | #endif | ||
600 | |||
601 | mov r12,#14 | ||
602 | str r12,[r11,#240-32] | ||
603 | add r6,r10,#256 @ rcon | ||
604 | mov lr,#255 | ||
605 | mov r12,#7 | ||
606 | |||
607 | .L256_loop: | ||
608 | and r5,lr,r9,lsr#24 | ||
609 | and r7,lr,r9,lsr#16 | ||
610 | ldrb r5,[r10,r5] | ||
611 | and r8,lr,r9,lsr#8 | ||
612 | ldrb r7,[r10,r7] | ||
613 | and r9,lr,r9 | ||
614 | ldrb r8,[r10,r8] | ||
615 | orr r5,r5,r7,lsl#24 | ||
616 | ldrb r9,[r10,r9] | ||
617 | orr r5,r5,r8,lsl#16 | ||
618 | ldr r4,[r6],#4 @ rcon[i++] | ||
619 | orr r5,r5,r9,lsl#8 | ||
620 | eor r9,r5,r4 | ||
621 | eor r0,r0,r9 @ rk[8]=rk[0]^... | ||
622 | eor r1,r1,r0 @ rk[9]=rk[1]^rk[8] | ||
623 | str r0,[r11],#32 | ||
624 | eor r2,r2,r1 @ rk[10]=rk[2]^rk[9] | ||
625 | str r1,[r11,#-28] | ||
626 | eor r3,r3,r2 @ rk[11]=rk[3]^rk[10] | ||
627 | str r2,[r11,#-24] | ||
628 | subs r12,r12,#1 | ||
629 | str r3,[r11,#-20] | ||
630 | subeq r2,r11,#256 | ||
631 | beq .Ldone | ||
632 | |||
633 | and r5,lr,r3 | ||
634 | and r7,lr,r3,lsr#8 | ||
635 | ldrb r5,[r10,r5] | ||
636 | and r8,lr,r3,lsr#16 | ||
637 | ldrb r7,[r10,r7] | ||
638 | and r9,lr,r3,lsr#24 | ||
639 | ldrb r8,[r10,r8] | ||
640 | orr r5,r5,r7,lsl#8 | ||
641 | ldrb r9,[r10,r9] | ||
642 | orr r5,r5,r8,lsl#16 | ||
643 | ldr r4,[r11,#-48] | ||
644 | orr r5,r5,r9,lsl#24 | ||
645 | |||
646 | ldr r7,[r11,#-44] | ||
647 | ldr r8,[r11,#-40] | ||
648 | eor r4,r4,r5 @ rk[12]=rk[4]^... | ||
649 | ldr r9,[r11,#-36] | ||
650 | eor r7,r7,r4 @ rk[13]=rk[5]^rk[12] | ||
651 | str r4,[r11,#-16] | ||
652 | eor r8,r8,r7 @ rk[14]=rk[6]^rk[13] | ||
653 | str r7,[r11,#-12] | ||
654 | eor r9,r9,r8 @ rk[15]=rk[7]^rk[14] | ||
655 | str r8,[r11,#-8] | ||
656 | str r9,[r11,#-4] | ||
657 | b .L256_loop | ||
658 | |||
659 | .Ldone: mov r0,#0 | ||
660 | ldmia sp!,{r4-r12,lr} | ||
661 | .Labrt: tst lr,#1 | ||
662 | moveq pc,lr @ be binary compatible with V4, yet | ||
663 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) | ||
664 | .size private_AES_set_encrypt_key,.-private_AES_set_encrypt_key | ||
665 | |||
666 | .global private_AES_set_decrypt_key | ||
667 | .type private_AES_set_decrypt_key,%function | ||
668 | .align 5 | ||
669 | private_AES_set_decrypt_key: | ||
670 | str lr,[sp,#-4]! @ push lr | ||
671 | #if 0 | ||
672 | @ kernel does both of these in setkey so optimise this bit out by | ||
673 | @ expecting the key to already have the enc_key work done (see aes_glue.c) | ||
674 | bl _armv4_AES_set_encrypt_key | ||
675 | #else | ||
676 | mov r0,#0 | ||
677 | #endif | ||
678 | teq r0,#0 | ||
679 | ldrne lr,[sp],#4 @ pop lr | ||
680 | bne .Labrt | ||
681 | |||
682 | stmdb sp!,{r4-r12} | ||
683 | |||
684 | ldr r12,[r2,#240] @ AES_set_encrypt_key preserves r2, | ||
685 | mov r11,r2 @ which is AES_KEY *key | ||
686 | mov r7,r2 | ||
687 | add r8,r2,r12,lsl#4 | ||
688 | |||
689 | .Linv: ldr r0,[r7] | ||
690 | ldr r1,[r7,#4] | ||
691 | ldr r2,[r7,#8] | ||
692 | ldr r3,[r7,#12] | ||
693 | ldr r4,[r8] | ||
694 | ldr r5,[r8,#4] | ||
695 | ldr r6,[r8,#8] | ||
696 | ldr r9,[r8,#12] | ||
697 | str r0,[r8],#-16 | ||
698 | str r1,[r8,#16+4] | ||
699 | str r2,[r8,#16+8] | ||
700 | str r3,[r8,#16+12] | ||
701 | str r4,[r7],#16 | ||
702 | str r5,[r7,#-12] | ||
703 | str r6,[r7,#-8] | ||
704 | str r9,[r7,#-4] | ||
705 | teq r7,r8 | ||
706 | bne .Linv | ||
707 | ldr r0,[r11,#16]! @ prefetch tp1 | ||
708 | mov r7,#0x80 | ||
709 | mov r8,#0x1b | ||
710 | orr r7,r7,#0x8000 | ||
711 | orr r8,r8,#0x1b00 | ||
712 | orr r7,r7,r7,lsl#16 | ||
713 | orr r8,r8,r8,lsl#16 | ||
714 | sub r12,r12,#1 | ||
715 | mvn r9,r7 | ||
716 | mov r12,r12,lsl#2 @ (rounds-1)*4 | ||
717 | |||
718 | .Lmix: and r4,r0,r7 | ||
719 | and r1,r0,r9 | ||
720 | sub r4,r4,r4,lsr#7 | ||
721 | and r4,r4,r8 | ||
722 | eor r1,r4,r1,lsl#1 @ tp2 | ||
723 | |||
724 | and r4,r1,r7 | ||
725 | and r2,r1,r9 | ||
726 | sub r4,r4,r4,lsr#7 | ||
727 | and r4,r4,r8 | ||
728 | eor r2,r4,r2,lsl#1 @ tp4 | ||
729 | |||
730 | and r4,r2,r7 | ||
731 | and r3,r2,r9 | ||
732 | sub r4,r4,r4,lsr#7 | ||
733 | and r4,r4,r8 | ||
734 | eor r3,r4,r3,lsl#1 @ tp8 | ||
735 | |||
736 | eor r4,r1,r2 | ||
737 | eor r5,r0,r3 @ tp9 | ||
738 | eor r4,r4,r3 @ tpe | ||
739 | eor r4,r4,r1,ror#24 | ||
740 | eor r4,r4,r5,ror#24 @ ^= ROTATE(tpb=tp9^tp2,8) | ||
741 | eor r4,r4,r2,ror#16 | ||
742 | eor r4,r4,r5,ror#16 @ ^= ROTATE(tpd=tp9^tp4,16) | ||
743 | eor r4,r4,r5,ror#8 @ ^= ROTATE(tp9,24) | ||
744 | |||
745 | ldr r0,[r11,#4] @ prefetch tp1 | ||
746 | str r4,[r11],#4 | ||
747 | subs r12,r12,#1 | ||
748 | bne .Lmix | ||
749 | |||
750 | mov r0,#0 | ||
751 | #if __ARM_ARCH__>=5 | ||
752 | ldmia sp!,{r4-r12,pc} | ||
753 | #else | ||
754 | ldmia sp!,{r4-r12,lr} | ||
755 | tst lr,#1 | ||
756 | moveq pc,lr @ be binary compatible with V4, yet | ||
757 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) | ||
758 | #endif | ||
759 | .size private_AES_set_decrypt_key,.-private_AES_set_decrypt_key | ||
760 | |||
761 | .type AES_Td,%object | ||
762 | .align 5 | ||
763 | AES_Td: | ||
764 | .word 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96 | ||
765 | .word 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393 | ||
766 | .word 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25 | ||
767 | .word 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f | ||
768 | .word 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1 | ||
769 | .word 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6 | ||
770 | .word 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da | ||
771 | .word 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844 | ||
772 | .word 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd | ||
773 | .word 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4 | ||
774 | .word 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45 | ||
775 | .word 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94 | ||
776 | .word 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7 | ||
777 | .word 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a | ||
778 | .word 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5 | ||
779 | .word 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c | ||
780 | .word 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1 | ||
781 | .word 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a | ||
782 | .word 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75 | ||
783 | .word 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051 | ||
784 | .word 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46 | ||
785 | .word 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff | ||
786 | .word 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77 | ||
787 | .word 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb | ||
788 | .word 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000 | ||
789 | .word 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e | ||
790 | .word 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927 | ||
791 | .word 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a | ||
792 | .word 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e | ||
793 | .word 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16 | ||
794 | .word 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d | ||
795 | .word 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8 | ||
796 | .word 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd | ||
797 | .word 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34 | ||
798 | .word 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163 | ||
799 | .word 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120 | ||
800 | .word 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d | ||
801 | .word 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0 | ||
802 | .word 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422 | ||
803 | .word 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef | ||
804 | .word 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36 | ||
805 | .word 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4 | ||
806 | .word 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662 | ||
807 | .word 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5 | ||
808 | .word 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3 | ||
809 | .word 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b | ||
810 | .word 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8 | ||
811 | .word 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6 | ||
812 | .word 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6 | ||
813 | .word 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0 | ||
814 | .word 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815 | ||
815 | .word 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f | ||
816 | .word 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df | ||
817 | .word 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f | ||
818 | .word 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e | ||
819 | .word 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713 | ||
820 | .word 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89 | ||
821 | .word 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c | ||
822 | .word 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf | ||
823 | .word 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86 | ||
824 | .word 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f | ||
825 | .word 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541 | ||
826 | .word 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190 | ||
827 | .word 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742 | ||
828 | @ Td4[256] | ||
829 | .byte 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38 | ||
830 | .byte 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb | ||
831 | .byte 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87 | ||
832 | .byte 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb | ||
833 | .byte 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d | ||
834 | .byte 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e | ||
835 | .byte 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2 | ||
836 | .byte 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25 | ||
837 | .byte 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16 | ||
838 | .byte 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92 | ||
839 | .byte 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda | ||
840 | .byte 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84 | ||
841 | .byte 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a | ||
842 | .byte 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06 | ||
843 | .byte 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02 | ||
844 | .byte 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b | ||
845 | .byte 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea | ||
846 | .byte 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73 | ||
847 | .byte 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85 | ||
848 | .byte 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e | ||
849 | .byte 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89 | ||
850 | .byte 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b | ||
851 | .byte 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20 | ||
852 | .byte 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4 | ||
853 | .byte 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31 | ||
854 | .byte 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f | ||
855 | .byte 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d | ||
856 | .byte 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef | ||
857 | .byte 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0 | ||
858 | .byte 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 | ||
859 | .byte 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26 | ||
860 | .byte 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d | ||
861 | .size AES_Td,.-AES_Td | ||
862 | |||
863 | @ void AES_decrypt(const unsigned char *in, unsigned char *out, | ||
864 | @ const AES_KEY *key) { | ||
865 | .global AES_decrypt | ||
866 | .type AES_decrypt,%function | ||
867 | .align 5 | ||
868 | AES_decrypt: | ||
869 | sub r3,pc,#8 @ AES_decrypt | ||
870 | stmdb sp!,{r1,r4-r12,lr} | ||
871 | mov r12,r0 @ inp | ||
872 | mov r11,r2 | ||
873 | sub r10,r3,#AES_decrypt-AES_Td @ Td | ||
874 | #if __ARM_ARCH__<7 | ||
875 | ldrb r0,[r12,#3] @ load input data in endian-neutral | ||
876 | ldrb r4,[r12,#2] @ manner... | ||
877 | ldrb r5,[r12,#1] | ||
878 | ldrb r6,[r12,#0] | ||
879 | orr r0,r0,r4,lsl#8 | ||
880 | ldrb r1,[r12,#7] | ||
881 | orr r0,r0,r5,lsl#16 | ||
882 | ldrb r4,[r12,#6] | ||
883 | orr r0,r0,r6,lsl#24 | ||
884 | ldrb r5,[r12,#5] | ||
885 | ldrb r6,[r12,#4] | ||
886 | orr r1,r1,r4,lsl#8 | ||
887 | ldrb r2,[r12,#11] | ||
888 | orr r1,r1,r5,lsl#16 | ||
889 | ldrb r4,[r12,#10] | ||
890 | orr r1,r1,r6,lsl#24 | ||
891 | ldrb r5,[r12,#9] | ||
892 | ldrb r6,[r12,#8] | ||
893 | orr r2,r2,r4,lsl#8 | ||
894 | ldrb r3,[r12,#15] | ||
895 | orr r2,r2,r5,lsl#16 | ||
896 | ldrb r4,[r12,#14] | ||
897 | orr r2,r2,r6,lsl#24 | ||
898 | ldrb r5,[r12,#13] | ||
899 | ldrb r6,[r12,#12] | ||
900 | orr r3,r3,r4,lsl#8 | ||
901 | orr r3,r3,r5,lsl#16 | ||
902 | orr r3,r3,r6,lsl#24 | ||
903 | #else | ||
904 | ldr r0,[r12,#0] | ||
905 | ldr r1,[r12,#4] | ||
906 | ldr r2,[r12,#8] | ||
907 | ldr r3,[r12,#12] | ||
908 | #ifdef __ARMEL__ | ||
909 | rev r0,r0 | ||
910 | rev r1,r1 | ||
911 | rev r2,r2 | ||
912 | rev r3,r3 | ||
913 | #endif | ||
914 | #endif | ||
915 | bl _armv4_AES_decrypt | ||
916 | |||
917 | ldr r12,[sp],#4 @ pop out | ||
918 | #if __ARM_ARCH__>=7 | ||
919 | #ifdef __ARMEL__ | ||
920 | rev r0,r0 | ||
921 | rev r1,r1 | ||
922 | rev r2,r2 | ||
923 | rev r3,r3 | ||
924 | #endif | ||
925 | str r0,[r12,#0] | ||
926 | str r1,[r12,#4] | ||
927 | str r2,[r12,#8] | ||
928 | str r3,[r12,#12] | ||
929 | #else | ||
930 | mov r4,r0,lsr#24 @ write output in endian-neutral | ||
931 | mov r5,r0,lsr#16 @ manner... | ||
932 | mov r6,r0,lsr#8 | ||
933 | strb r4,[r12,#0] | ||
934 | strb r5,[r12,#1] | ||
935 | mov r4,r1,lsr#24 | ||
936 | strb r6,[r12,#2] | ||
937 | mov r5,r1,lsr#16 | ||
938 | strb r0,[r12,#3] | ||
939 | mov r6,r1,lsr#8 | ||
940 | strb r4,[r12,#4] | ||
941 | strb r5,[r12,#5] | ||
942 | mov r4,r2,lsr#24 | ||
943 | strb r6,[r12,#6] | ||
944 | mov r5,r2,lsr#16 | ||
945 | strb r1,[r12,#7] | ||
946 | mov r6,r2,lsr#8 | ||
947 | strb r4,[r12,#8] | ||
948 | strb r5,[r12,#9] | ||
949 | mov r4,r3,lsr#24 | ||
950 | strb r6,[r12,#10] | ||
951 | mov r5,r3,lsr#16 | ||
952 | strb r2,[r12,#11] | ||
953 | mov r6,r3,lsr#8 | ||
954 | strb r4,[r12,#12] | ||
955 | strb r5,[r12,#13] | ||
956 | strb r6,[r12,#14] | ||
957 | strb r3,[r12,#15] | ||
958 | #endif | ||
959 | #if __ARM_ARCH__>=5 | ||
960 | ldmia sp!,{r4-r12,pc} | ||
961 | #else | ||
962 | ldmia sp!,{r4-r12,lr} | ||
963 | tst lr,#1 | ||
964 | moveq pc,lr @ be binary compatible with V4, yet | ||
965 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) | ||
966 | #endif | ||
967 | .size AES_decrypt,.-AES_decrypt | ||
968 | |||
969 | .type _armv4_AES_decrypt,%function | ||
970 | .align 2 | ||
971 | _armv4_AES_decrypt: | ||
972 | str lr,[sp,#-4]! @ push lr | ||
973 | ldmia r11!,{r4-r7} | ||
974 | eor r0,r0,r4 | ||
975 | ldr r12,[r11,#240-16] | ||
976 | eor r1,r1,r5 | ||
977 | eor r2,r2,r6 | ||
978 | eor r3,r3,r7 | ||
979 | sub r12,r12,#1 | ||
980 | mov lr,#255 | ||
981 | |||
982 | and r7,lr,r0,lsr#16 | ||
983 | and r8,lr,r0,lsr#8 | ||
984 | and r9,lr,r0 | ||
985 | mov r0,r0,lsr#24 | ||
986 | .Ldec_loop: | ||
987 | ldr r4,[r10,r7,lsl#2] @ Td1[s0>>16] | ||
988 | and r7,lr,r1 @ i0 | ||
989 | ldr r5,[r10,r8,lsl#2] @ Td2[s0>>8] | ||
990 | and r8,lr,r1,lsr#16 | ||
991 | ldr r6,[r10,r9,lsl#2] @ Td3[s0>>0] | ||
992 | and r9,lr,r1,lsr#8 | ||
993 | ldr r0,[r10,r0,lsl#2] @ Td0[s0>>24] | ||
994 | mov r1,r1,lsr#24 | ||
995 | |||
996 | ldr r7,[r10,r7,lsl#2] @ Td3[s1>>0] | ||
997 | ldr r8,[r10,r8,lsl#2] @ Td1[s1>>16] | ||
998 | ldr r9,[r10,r9,lsl#2] @ Td2[s1>>8] | ||
999 | eor r0,r0,r7,ror#24 | ||
1000 | ldr r1,[r10,r1,lsl#2] @ Td0[s1>>24] | ||
1001 | and r7,lr,r2,lsr#8 @ i0 | ||
1002 | eor r5,r8,r5,ror#8 | ||
1003 | and r8,lr,r2 @ i1 | ||
1004 | eor r6,r9,r6,ror#8 | ||
1005 | and r9,lr,r2,lsr#16 | ||
1006 | ldr r7,[r10,r7,lsl#2] @ Td2[s2>>8] | ||
1007 | eor r1,r1,r4,ror#8 | ||
1008 | ldr r8,[r10,r8,lsl#2] @ Td3[s2>>0] | ||
1009 | mov r2,r2,lsr#24 | ||
1010 | |||
1011 | ldr r9,[r10,r9,lsl#2] @ Td1[s2>>16] | ||
1012 | eor r0,r0,r7,ror#16 | ||
1013 | ldr r2,[r10,r2,lsl#2] @ Td0[s2>>24] | ||
1014 | and r7,lr,r3,lsr#16 @ i0 | ||
1015 | eor r1,r1,r8,ror#24 | ||
1016 | and r8,lr,r3,lsr#8 @ i1 | ||
1017 | eor r6,r9,r6,ror#8 | ||
1018 | and r9,lr,r3 @ i2 | ||
1019 | ldr r7,[r10,r7,lsl#2] @ Td1[s3>>16] | ||
1020 | eor r2,r2,r5,ror#8 | ||
1021 | ldr r8,[r10,r8,lsl#2] @ Td2[s3>>8] | ||
1022 | mov r3,r3,lsr#24 | ||
1023 | |||
1024 | ldr r9,[r10,r9,lsl#2] @ Td3[s3>>0] | ||
1025 | eor r0,r0,r7,ror#8 | ||
1026 | ldr r7,[r11],#16 | ||
1027 | eor r1,r1,r8,ror#16 | ||
1028 | ldr r3,[r10,r3,lsl#2] @ Td0[s3>>24] | ||
1029 | eor r2,r2,r9,ror#24 | ||
1030 | |||
1031 | ldr r4,[r11,#-12] | ||
1032 | eor r0,r0,r7 | ||
1033 | ldr r5,[r11,#-8] | ||
1034 | eor r3,r3,r6,ror#8 | ||
1035 | ldr r6,[r11,#-4] | ||
1036 | and r7,lr,r0,lsr#16 | ||
1037 | eor r1,r1,r4 | ||
1038 | and r8,lr,r0,lsr#8 | ||
1039 | eor r2,r2,r5 | ||
1040 | and r9,lr,r0 | ||
1041 | eor r3,r3,r6 | ||
1042 | mov r0,r0,lsr#24 | ||
1043 | |||
1044 | subs r12,r12,#1 | ||
1045 | bne .Ldec_loop | ||
1046 | |||
1047 | add r10,r10,#1024 | ||
1048 | |||
1049 | ldr r5,[r10,#0] @ prefetch Td4 | ||
1050 | ldr r6,[r10,#32] | ||
1051 | ldr r4,[r10,#64] | ||
1052 | ldr r5,[r10,#96] | ||
1053 | ldr r6,[r10,#128] | ||
1054 | ldr r4,[r10,#160] | ||
1055 | ldr r5,[r10,#192] | ||
1056 | ldr r6,[r10,#224] | ||
1057 | |||
1058 | ldrb r0,[r10,r0] @ Td4[s0>>24] | ||
1059 | ldrb r4,[r10,r7] @ Td4[s0>>16] | ||
1060 | and r7,lr,r1 @ i0 | ||
1061 | ldrb r5,[r10,r8] @ Td4[s0>>8] | ||
1062 | and r8,lr,r1,lsr#16 | ||
1063 | ldrb r6,[r10,r9] @ Td4[s0>>0] | ||
1064 | and r9,lr,r1,lsr#8 | ||
1065 | |||
1066 | ldrb r7,[r10,r7] @ Td4[s1>>0] | ||
1067 | ldrb r1,[r10,r1,lsr#24] @ Td4[s1>>24] | ||
1068 | ldrb r8,[r10,r8] @ Td4[s1>>16] | ||
1069 | eor r0,r7,r0,lsl#24 | ||
1070 | ldrb r9,[r10,r9] @ Td4[s1>>8] | ||
1071 | eor r1,r4,r1,lsl#8 | ||
1072 | and r7,lr,r2,lsr#8 @ i0 | ||
1073 | eor r5,r5,r8,lsl#8 | ||
1074 | and r8,lr,r2 @ i1 | ||
1075 | ldrb r7,[r10,r7] @ Td4[s2>>8] | ||
1076 | eor r6,r6,r9,lsl#8 | ||
1077 | ldrb r8,[r10,r8] @ Td4[s2>>0] | ||
1078 | and r9,lr,r2,lsr#16 | ||
1079 | |||
1080 | ldrb r2,[r10,r2,lsr#24] @ Td4[s2>>24] | ||
1081 | eor r0,r0,r7,lsl#8 | ||
1082 | ldrb r9,[r10,r9] @ Td4[s2>>16] | ||
1083 | eor r1,r8,r1,lsl#16 | ||
1084 | and r7,lr,r3,lsr#16 @ i0 | ||
1085 | eor r2,r5,r2,lsl#16 | ||
1086 | and r8,lr,r3,lsr#8 @ i1 | ||
1087 | ldrb r7,[r10,r7] @ Td4[s3>>16] | ||
1088 | eor r6,r6,r9,lsl#16 | ||
1089 | ldrb r8,[r10,r8] @ Td4[s3>>8] | ||
1090 | and r9,lr,r3 @ i2 | ||
1091 | |||
1092 | ldrb r9,[r10,r9] @ Td4[s3>>0] | ||
1093 | ldrb r3,[r10,r3,lsr#24] @ Td4[s3>>24] | ||
1094 | eor r0,r0,r7,lsl#16 | ||
1095 | ldr r7,[r11,#0] | ||
1096 | eor r1,r1,r8,lsl#8 | ||
1097 | ldr r4,[r11,#4] | ||
1098 | eor r2,r9,r2,lsl#8 | ||
1099 | ldr r5,[r11,#8] | ||
1100 | eor r3,r6,r3,lsl#24 | ||
1101 | ldr r6,[r11,#12] | ||
1102 | |||
1103 | eor r0,r0,r7 | ||
1104 | eor r1,r1,r4 | ||
1105 | eor r2,r2,r5 | ||
1106 | eor r3,r3,r6 | ||
1107 | |||
1108 | sub r10,r10,#1024 | ||
1109 | ldr pc,[sp],#4 @ pop and return | ||
1110 | .size _armv4_AES_decrypt,.-_armv4_AES_decrypt | ||
1111 | .asciz "AES for ARMv4, CRYPTOGAMS by <appro@openssl.org>" | ||
1112 | .align 2 | ||
diff --git a/arch/arm/crypto/aes_glue.c b/arch/arm/crypto/aes_glue.c new file mode 100644 index 000000000000..59f7877ead6a --- /dev/null +++ b/arch/arm/crypto/aes_glue.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * Glue Code for the asm optimized version of the AES Cipher Algorithm | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <linux/crypto.h> | ||
7 | #include <crypto/aes.h> | ||
8 | |||
9 | #define AES_MAXNR 14 | ||
10 | |||
11 | typedef struct { | ||
12 | unsigned int rd_key[4 *(AES_MAXNR + 1)]; | ||
13 | int rounds; | ||
14 | } AES_KEY; | ||
15 | |||
16 | struct AES_CTX { | ||
17 | AES_KEY enc_key; | ||
18 | AES_KEY dec_key; | ||
19 | }; | ||
20 | |||
21 | asmlinkage void AES_encrypt(const u8 *in, u8 *out, AES_KEY *ctx); | ||
22 | asmlinkage void AES_decrypt(const u8 *in, u8 *out, AES_KEY *ctx); | ||
23 | asmlinkage int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); | ||
24 | asmlinkage int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key); | ||
25 | |||
26 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
27 | { | ||
28 | struct AES_CTX *ctx = crypto_tfm_ctx(tfm); | ||
29 | AES_encrypt(src, dst, &ctx->enc_key); | ||
30 | } | ||
31 | |||
32 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | ||
33 | { | ||
34 | struct AES_CTX *ctx = crypto_tfm_ctx(tfm); | ||
35 | AES_decrypt(src, dst, &ctx->dec_key); | ||
36 | } | ||
37 | |||
38 | static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, | ||
39 | unsigned int key_len) | ||
40 | { | ||
41 | struct AES_CTX *ctx = crypto_tfm_ctx(tfm); | ||
42 | |||
43 | switch (key_len) { | ||
44 | case AES_KEYSIZE_128: | ||
45 | key_len = 128; | ||
46 | break; | ||
47 | case AES_KEYSIZE_192: | ||
48 | key_len = 192; | ||
49 | break; | ||
50 | case AES_KEYSIZE_256: | ||
51 | key_len = 256; | ||
52 | break; | ||
53 | default: | ||
54 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
55 | return -EINVAL; | ||
56 | } | ||
57 | |||
58 | if (private_AES_set_encrypt_key(in_key, key_len, &ctx->enc_key) == -1) { | ||
59 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
60 | return -EINVAL; | ||
61 | } | ||
62 | /* private_AES_set_decrypt_key expects an encryption key as input */ | ||
63 | ctx->dec_key = ctx->enc_key; | ||
64 | if (private_AES_set_decrypt_key(in_key, key_len, &ctx->dec_key) == -1) { | ||
65 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
66 | return -EINVAL; | ||
67 | } | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static struct crypto_alg aes_alg = { | ||
72 | .cra_name = "aes", | ||
73 | .cra_driver_name = "aes-asm", | ||
74 | .cra_priority = 200, | ||
75 | .cra_flags = CRYPTO_ALG_TYPE_CIPHER, | ||
76 | .cra_blocksize = AES_BLOCK_SIZE, | ||
77 | .cra_ctxsize = sizeof(struct AES_CTX), | ||
78 | .cra_module = THIS_MODULE, | ||
79 | .cra_list = LIST_HEAD_INIT(aes_alg.cra_list), | ||
80 | .cra_u = { | ||
81 | .cipher = { | ||
82 | .cia_min_keysize = AES_MIN_KEY_SIZE, | ||
83 | .cia_max_keysize = AES_MAX_KEY_SIZE, | ||
84 | .cia_setkey = aes_set_key, | ||
85 | .cia_encrypt = aes_encrypt, | ||
86 | .cia_decrypt = aes_decrypt | ||
87 | } | ||
88 | } | ||
89 | }; | ||
90 | |||
91 | static int __init aes_init(void) | ||
92 | { | ||
93 | return crypto_register_alg(&aes_alg); | ||
94 | } | ||
95 | |||
96 | static void __exit aes_fini(void) | ||
97 | { | ||
98 | crypto_unregister_alg(&aes_alg); | ||
99 | } | ||
100 | |||
101 | module_init(aes_init); | ||
102 | module_exit(aes_fini); | ||
103 | |||
104 | MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm (ASM)"); | ||
105 | MODULE_LICENSE("GPL"); | ||
106 | MODULE_ALIAS("aes"); | ||
107 | MODULE_ALIAS("aes-asm"); | ||
108 | MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>"); | ||
diff --git a/arch/arm/crypto/sha1-armv4-large.S b/arch/arm/crypto/sha1-armv4-large.S new file mode 100644 index 000000000000..7050ab133b9d --- /dev/null +++ b/arch/arm/crypto/sha1-armv4-large.S | |||
@@ -0,0 +1,503 @@ | |||
1 | #define __ARM_ARCH__ __LINUX_ARM_ARCH__ | ||
2 | @ ==================================================================== | ||
3 | @ Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
4 | @ project. The module is, however, dual licensed under OpenSSL and | ||
5 | @ CRYPTOGAMS licenses depending on where you obtain it. For further | ||
6 | @ details see http://www.openssl.org/~appro/cryptogams/. | ||
7 | @ ==================================================================== | ||
8 | |||
9 | @ sha1_block procedure for ARMv4. | ||
10 | @ | ||
11 | @ January 2007. | ||
12 | |||
13 | @ Size/performance trade-off | ||
14 | @ ==================================================================== | ||
15 | @ impl size in bytes comp cycles[*] measured performance | ||
16 | @ ==================================================================== | ||
17 | @ thumb 304 3212 4420 | ||
18 | @ armv4-small 392/+29% 1958/+64% 2250/+96% | ||
19 | @ armv4-compact 740/+89% 1552/+26% 1840/+22% | ||
20 | @ armv4-large 1420/+92% 1307/+19% 1370/+34%[***] | ||
21 | @ full unroll ~5100/+260% ~1260/+4% ~1300/+5% | ||
22 | @ ==================================================================== | ||
23 | @ thumb = same as 'small' but in Thumb instructions[**] and | ||
24 | @ with recurring code in two private functions; | ||
25 | @ small = detached Xload/update, loops are folded; | ||
26 | @ compact = detached Xload/update, 5x unroll; | ||
27 | @ large = interleaved Xload/update, 5x unroll; | ||
28 | @ full unroll = interleaved Xload/update, full unroll, estimated[!]; | ||
29 | @ | ||
30 | @ [*] Manually counted instructions in "grand" loop body. Measured | ||
31 | @ performance is affected by prologue and epilogue overhead, | ||
32 | @ i-cache availability, branch penalties, etc. | ||
33 | @ [**] While each Thumb instruction is twice smaller, they are not as | ||
34 | @ diverse as ARM ones: e.g., there are only two arithmetic | ||
35 | @ instructions with 3 arguments, no [fixed] rotate, addressing | ||
36 | @ modes are limited. As result it takes more instructions to do | ||
37 | @ the same job in Thumb, therefore the code is never twice as | ||
38 | @ small and always slower. | ||
39 | @ [***] which is also ~35% better than compiler generated code. Dual- | ||
40 | @ issue Cortex A8 core was measured to process input block in | ||
41 | @ ~990 cycles. | ||
42 | |||
43 | @ August 2010. | ||
44 | @ | ||
45 | @ Rescheduling for dual-issue pipeline resulted in 13% improvement on | ||
46 | @ Cortex A8 core and in absolute terms ~870 cycles per input block | ||
47 | @ [or 13.6 cycles per byte]. | ||
48 | |||
49 | @ February 2011. | ||
50 | @ | ||
51 | @ Profiler-assisted and platform-specific optimization resulted in 10% | ||
52 | @ improvement on Cortex A8 core and 12.2 cycles per byte. | ||
53 | |||
54 | .text | ||
55 | |||
56 | .global sha1_block_data_order | ||
57 | .type sha1_block_data_order,%function | ||
58 | |||
59 | .align 2 | ||
60 | sha1_block_data_order: | ||
61 | stmdb sp!,{r4-r12,lr} | ||
62 | add r2,r1,r2,lsl#6 @ r2 to point at the end of r1 | ||
63 | ldmia r0,{r3,r4,r5,r6,r7} | ||
64 | .Lloop: | ||
65 | ldr r8,.LK_00_19 | ||
66 | mov r14,sp | ||
67 | sub sp,sp,#15*4 | ||
68 | mov r5,r5,ror#30 | ||
69 | mov r6,r6,ror#30 | ||
70 | mov r7,r7,ror#30 @ [6] | ||
71 | .L_00_15: | ||
72 | #if __ARM_ARCH__<7 | ||
73 | ldrb r10,[r1,#2] | ||
74 | ldrb r9,[r1,#3] | ||
75 | ldrb r11,[r1,#1] | ||
76 | add r7,r8,r7,ror#2 @ E+=K_00_19 | ||
77 | ldrb r12,[r1],#4 | ||
78 | orr r9,r9,r10,lsl#8 | ||
79 | eor r10,r5,r6 @ F_xx_xx | ||
80 | orr r9,r9,r11,lsl#16 | ||
81 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
82 | orr r9,r9,r12,lsl#24 | ||
83 | #else | ||
84 | ldr r9,[r1],#4 @ handles unaligned | ||
85 | add r7,r8,r7,ror#2 @ E+=K_00_19 | ||
86 | eor r10,r5,r6 @ F_xx_xx | ||
87 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
88 | #ifdef __ARMEL__ | ||
89 | rev r9,r9 @ byte swap | ||
90 | #endif | ||
91 | #endif | ||
92 | and r10,r4,r10,ror#2 | ||
93 | add r7,r7,r9 @ E+=X[i] | ||
94 | eor r10,r10,r6,ror#2 @ F_00_19(B,C,D) | ||
95 | str r9,[r14,#-4]! | ||
96 | add r7,r7,r10 @ E+=F_00_19(B,C,D) | ||
97 | #if __ARM_ARCH__<7 | ||
98 | ldrb r10,[r1,#2] | ||
99 | ldrb r9,[r1,#3] | ||
100 | ldrb r11,[r1,#1] | ||
101 | add r6,r8,r6,ror#2 @ E+=K_00_19 | ||
102 | ldrb r12,[r1],#4 | ||
103 | orr r9,r9,r10,lsl#8 | ||
104 | eor r10,r4,r5 @ F_xx_xx | ||
105 | orr r9,r9,r11,lsl#16 | ||
106 | add r6,r6,r7,ror#27 @ E+=ROR(A,27) | ||
107 | orr r9,r9,r12,lsl#24 | ||
108 | #else | ||
109 | ldr r9,[r1],#4 @ handles unaligned | ||
110 | add r6,r8,r6,ror#2 @ E+=K_00_19 | ||
111 | eor r10,r4,r5 @ F_xx_xx | ||
112 | add r6,r6,r7,ror#27 @ E+=ROR(A,27) | ||
113 | #ifdef __ARMEL__ | ||
114 | rev r9,r9 @ byte swap | ||
115 | #endif | ||
116 | #endif | ||
117 | and r10,r3,r10,ror#2 | ||
118 | add r6,r6,r9 @ E+=X[i] | ||
119 | eor r10,r10,r5,ror#2 @ F_00_19(B,C,D) | ||
120 | str r9,[r14,#-4]! | ||
121 | add r6,r6,r10 @ E+=F_00_19(B,C,D) | ||
122 | #if __ARM_ARCH__<7 | ||
123 | ldrb r10,[r1,#2] | ||
124 | ldrb r9,[r1,#3] | ||
125 | ldrb r11,[r1,#1] | ||
126 | add r5,r8,r5,ror#2 @ E+=K_00_19 | ||
127 | ldrb r12,[r1],#4 | ||
128 | orr r9,r9,r10,lsl#8 | ||
129 | eor r10,r3,r4 @ F_xx_xx | ||
130 | orr r9,r9,r11,lsl#16 | ||
131 | add r5,r5,r6,ror#27 @ E+=ROR(A,27) | ||
132 | orr r9,r9,r12,lsl#24 | ||
133 | #else | ||
134 | ldr r9,[r1],#4 @ handles unaligned | ||
135 | add r5,r8,r5,ror#2 @ E+=K_00_19 | ||
136 | eor r10,r3,r4 @ F_xx_xx | ||
137 | add r5,r5,r6,ror#27 @ E+=ROR(A,27) | ||
138 | #ifdef __ARMEL__ | ||
139 | rev r9,r9 @ byte swap | ||
140 | #endif | ||
141 | #endif | ||
142 | and r10,r7,r10,ror#2 | ||
143 | add r5,r5,r9 @ E+=X[i] | ||
144 | eor r10,r10,r4,ror#2 @ F_00_19(B,C,D) | ||
145 | str r9,[r14,#-4]! | ||
146 | add r5,r5,r10 @ E+=F_00_19(B,C,D) | ||
147 | #if __ARM_ARCH__<7 | ||
148 | ldrb r10,[r1,#2] | ||
149 | ldrb r9,[r1,#3] | ||
150 | ldrb r11,[r1,#1] | ||
151 | add r4,r8,r4,ror#2 @ E+=K_00_19 | ||
152 | ldrb r12,[r1],#4 | ||
153 | orr r9,r9,r10,lsl#8 | ||
154 | eor r10,r7,r3 @ F_xx_xx | ||
155 | orr r9,r9,r11,lsl#16 | ||
156 | add r4,r4,r5,ror#27 @ E+=ROR(A,27) | ||
157 | orr r9,r9,r12,lsl#24 | ||
158 | #else | ||
159 | ldr r9,[r1],#4 @ handles unaligned | ||
160 | add r4,r8,r4,ror#2 @ E+=K_00_19 | ||
161 | eor r10,r7,r3 @ F_xx_xx | ||
162 | add r4,r4,r5,ror#27 @ E+=ROR(A,27) | ||
163 | #ifdef __ARMEL__ | ||
164 | rev r9,r9 @ byte swap | ||
165 | #endif | ||
166 | #endif | ||
167 | and r10,r6,r10,ror#2 | ||
168 | add r4,r4,r9 @ E+=X[i] | ||
169 | eor r10,r10,r3,ror#2 @ F_00_19(B,C,D) | ||
170 | str r9,[r14,#-4]! | ||
171 | add r4,r4,r10 @ E+=F_00_19(B,C,D) | ||
172 | #if __ARM_ARCH__<7 | ||
173 | ldrb r10,[r1,#2] | ||
174 | ldrb r9,[r1,#3] | ||
175 | ldrb r11,[r1,#1] | ||
176 | add r3,r8,r3,ror#2 @ E+=K_00_19 | ||
177 | ldrb r12,[r1],#4 | ||
178 | orr r9,r9,r10,lsl#8 | ||
179 | eor r10,r6,r7 @ F_xx_xx | ||
180 | orr r9,r9,r11,lsl#16 | ||
181 | add r3,r3,r4,ror#27 @ E+=ROR(A,27) | ||
182 | orr r9,r9,r12,lsl#24 | ||
183 | #else | ||
184 | ldr r9,[r1],#4 @ handles unaligned | ||
185 | add r3,r8,r3,ror#2 @ E+=K_00_19 | ||
186 | eor r10,r6,r7 @ F_xx_xx | ||
187 | add r3,r3,r4,ror#27 @ E+=ROR(A,27) | ||
188 | #ifdef __ARMEL__ | ||
189 | rev r9,r9 @ byte swap | ||
190 | #endif | ||
191 | #endif | ||
192 | and r10,r5,r10,ror#2 | ||
193 | add r3,r3,r9 @ E+=X[i] | ||
194 | eor r10,r10,r7,ror#2 @ F_00_19(B,C,D) | ||
195 | str r9,[r14,#-4]! | ||
196 | add r3,r3,r10 @ E+=F_00_19(B,C,D) | ||
197 | teq r14,sp | ||
198 | bne .L_00_15 @ [((11+4)*5+2)*3] | ||
199 | #if __ARM_ARCH__<7 | ||
200 | ldrb r10,[r1,#2] | ||
201 | ldrb r9,[r1,#3] | ||
202 | ldrb r11,[r1,#1] | ||
203 | add r7,r8,r7,ror#2 @ E+=K_00_19 | ||
204 | ldrb r12,[r1],#4 | ||
205 | orr r9,r9,r10,lsl#8 | ||
206 | eor r10,r5,r6 @ F_xx_xx | ||
207 | orr r9,r9,r11,lsl#16 | ||
208 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
209 | orr r9,r9,r12,lsl#24 | ||
210 | #else | ||
211 | ldr r9,[r1],#4 @ handles unaligned | ||
212 | add r7,r8,r7,ror#2 @ E+=K_00_19 | ||
213 | eor r10,r5,r6 @ F_xx_xx | ||
214 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
215 | #ifdef __ARMEL__ | ||
216 | rev r9,r9 @ byte swap | ||
217 | #endif | ||
218 | #endif | ||
219 | and r10,r4,r10,ror#2 | ||
220 | add r7,r7,r9 @ E+=X[i] | ||
221 | eor r10,r10,r6,ror#2 @ F_00_19(B,C,D) | ||
222 | str r9,[r14,#-4]! | ||
223 | add r7,r7,r10 @ E+=F_00_19(B,C,D) | ||
224 | ldr r9,[r14,#15*4] | ||
225 | ldr r10,[r14,#13*4] | ||
226 | ldr r11,[r14,#7*4] | ||
227 | add r6,r8,r6,ror#2 @ E+=K_xx_xx | ||
228 | ldr r12,[r14,#2*4] | ||
229 | eor r9,r9,r10 | ||
230 | eor r11,r11,r12 @ 1 cycle stall | ||
231 | eor r10,r4,r5 @ F_xx_xx | ||
232 | mov r9,r9,ror#31 | ||
233 | add r6,r6,r7,ror#27 @ E+=ROR(A,27) | ||
234 | eor r9,r9,r11,ror#31 | ||
235 | str r9,[r14,#-4]! | ||
236 | and r10,r3,r10,ror#2 @ F_xx_xx | ||
237 | @ F_xx_xx | ||
238 | add r6,r6,r9 @ E+=X[i] | ||
239 | eor r10,r10,r5,ror#2 @ F_00_19(B,C,D) | ||
240 | add r6,r6,r10 @ E+=F_00_19(B,C,D) | ||
241 | ldr r9,[r14,#15*4] | ||
242 | ldr r10,[r14,#13*4] | ||
243 | ldr r11,[r14,#7*4] | ||
244 | add r5,r8,r5,ror#2 @ E+=K_xx_xx | ||
245 | ldr r12,[r14,#2*4] | ||
246 | eor r9,r9,r10 | ||
247 | eor r11,r11,r12 @ 1 cycle stall | ||
248 | eor r10,r3,r4 @ F_xx_xx | ||
249 | mov r9,r9,ror#31 | ||
250 | add r5,r5,r6,ror#27 @ E+=ROR(A,27) | ||
251 | eor r9,r9,r11,ror#31 | ||
252 | str r9,[r14,#-4]! | ||
253 | and r10,r7,r10,ror#2 @ F_xx_xx | ||
254 | @ F_xx_xx | ||
255 | add r5,r5,r9 @ E+=X[i] | ||
256 | eor r10,r10,r4,ror#2 @ F_00_19(B,C,D) | ||
257 | add r5,r5,r10 @ E+=F_00_19(B,C,D) | ||
258 | ldr r9,[r14,#15*4] | ||
259 | ldr r10,[r14,#13*4] | ||
260 | ldr r11,[r14,#7*4] | ||
261 | add r4,r8,r4,ror#2 @ E+=K_xx_xx | ||
262 | ldr r12,[r14,#2*4] | ||
263 | eor r9,r9,r10 | ||
264 | eor r11,r11,r12 @ 1 cycle stall | ||
265 | eor r10,r7,r3 @ F_xx_xx | ||
266 | mov r9,r9,ror#31 | ||
267 | add r4,r4,r5,ror#27 @ E+=ROR(A,27) | ||
268 | eor r9,r9,r11,ror#31 | ||
269 | str r9,[r14,#-4]! | ||
270 | and r10,r6,r10,ror#2 @ F_xx_xx | ||
271 | @ F_xx_xx | ||
272 | add r4,r4,r9 @ E+=X[i] | ||
273 | eor r10,r10,r3,ror#2 @ F_00_19(B,C,D) | ||
274 | add r4,r4,r10 @ E+=F_00_19(B,C,D) | ||
275 | ldr r9,[r14,#15*4] | ||
276 | ldr r10,[r14,#13*4] | ||
277 | ldr r11,[r14,#7*4] | ||
278 | add r3,r8,r3,ror#2 @ E+=K_xx_xx | ||
279 | ldr r12,[r14,#2*4] | ||
280 | eor r9,r9,r10 | ||
281 | eor r11,r11,r12 @ 1 cycle stall | ||
282 | eor r10,r6,r7 @ F_xx_xx | ||
283 | mov r9,r9,ror#31 | ||
284 | add r3,r3,r4,ror#27 @ E+=ROR(A,27) | ||
285 | eor r9,r9,r11,ror#31 | ||
286 | str r9,[r14,#-4]! | ||
287 | and r10,r5,r10,ror#2 @ F_xx_xx | ||
288 | @ F_xx_xx | ||
289 | add r3,r3,r9 @ E+=X[i] | ||
290 | eor r10,r10,r7,ror#2 @ F_00_19(B,C,D) | ||
291 | add r3,r3,r10 @ E+=F_00_19(B,C,D) | ||
292 | |||
293 | ldr r8,.LK_20_39 @ [+15+16*4] | ||
294 | sub sp,sp,#25*4 | ||
295 | cmn sp,#0 @ [+3], clear carry to denote 20_39 | ||
296 | .L_20_39_or_60_79: | ||
297 | ldr r9,[r14,#15*4] | ||
298 | ldr r10,[r14,#13*4] | ||
299 | ldr r11,[r14,#7*4] | ||
300 | add r7,r8,r7,ror#2 @ E+=K_xx_xx | ||
301 | ldr r12,[r14,#2*4] | ||
302 | eor r9,r9,r10 | ||
303 | eor r11,r11,r12 @ 1 cycle stall | ||
304 | eor r10,r5,r6 @ F_xx_xx | ||
305 | mov r9,r9,ror#31 | ||
306 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
307 | eor r9,r9,r11,ror#31 | ||
308 | str r9,[r14,#-4]! | ||
309 | eor r10,r4,r10,ror#2 @ F_xx_xx | ||
310 | @ F_xx_xx | ||
311 | add r7,r7,r9 @ E+=X[i] | ||
312 | add r7,r7,r10 @ E+=F_20_39(B,C,D) | ||
313 | ldr r9,[r14,#15*4] | ||
314 | ldr r10,[r14,#13*4] | ||
315 | ldr r11,[r14,#7*4] | ||
316 | add r6,r8,r6,ror#2 @ E+=K_xx_xx | ||
317 | ldr r12,[r14,#2*4] | ||
318 | eor r9,r9,r10 | ||
319 | eor r11,r11,r12 @ 1 cycle stall | ||
320 | eor r10,r4,r5 @ F_xx_xx | ||
321 | mov r9,r9,ror#31 | ||
322 | add r6,r6,r7,ror#27 @ E+=ROR(A,27) | ||
323 | eor r9,r9,r11,ror#31 | ||
324 | str r9,[r14,#-4]! | ||
325 | eor r10,r3,r10,ror#2 @ F_xx_xx | ||
326 | @ F_xx_xx | ||
327 | add r6,r6,r9 @ E+=X[i] | ||
328 | add r6,r6,r10 @ E+=F_20_39(B,C,D) | ||
329 | ldr r9,[r14,#15*4] | ||
330 | ldr r10,[r14,#13*4] | ||
331 | ldr r11,[r14,#7*4] | ||
332 | add r5,r8,r5,ror#2 @ E+=K_xx_xx | ||
333 | ldr r12,[r14,#2*4] | ||
334 | eor r9,r9,r10 | ||
335 | eor r11,r11,r12 @ 1 cycle stall | ||
336 | eor r10,r3,r4 @ F_xx_xx | ||
337 | mov r9,r9,ror#31 | ||
338 | add r5,r5,r6,ror#27 @ E+=ROR(A,27) | ||
339 | eor r9,r9,r11,ror#31 | ||
340 | str r9,[r14,#-4]! | ||
341 | eor r10,r7,r10,ror#2 @ F_xx_xx | ||
342 | @ F_xx_xx | ||
343 | add r5,r5,r9 @ E+=X[i] | ||
344 | add r5,r5,r10 @ E+=F_20_39(B,C,D) | ||
345 | ldr r9,[r14,#15*4] | ||
346 | ldr r10,[r14,#13*4] | ||
347 | ldr r11,[r14,#7*4] | ||
348 | add r4,r8,r4,ror#2 @ E+=K_xx_xx | ||
349 | ldr r12,[r14,#2*4] | ||
350 | eor r9,r9,r10 | ||
351 | eor r11,r11,r12 @ 1 cycle stall | ||
352 | eor r10,r7,r3 @ F_xx_xx | ||
353 | mov r9,r9,ror#31 | ||
354 | add r4,r4,r5,ror#27 @ E+=ROR(A,27) | ||
355 | eor r9,r9,r11,ror#31 | ||
356 | str r9,[r14,#-4]! | ||
357 | eor r10,r6,r10,ror#2 @ F_xx_xx | ||
358 | @ F_xx_xx | ||
359 | add r4,r4,r9 @ E+=X[i] | ||
360 | add r4,r4,r10 @ E+=F_20_39(B,C,D) | ||
361 | ldr r9,[r14,#15*4] | ||
362 | ldr r10,[r14,#13*4] | ||
363 | ldr r11,[r14,#7*4] | ||
364 | add r3,r8,r3,ror#2 @ E+=K_xx_xx | ||
365 | ldr r12,[r14,#2*4] | ||
366 | eor r9,r9,r10 | ||
367 | eor r11,r11,r12 @ 1 cycle stall | ||
368 | eor r10,r6,r7 @ F_xx_xx | ||
369 | mov r9,r9,ror#31 | ||
370 | add r3,r3,r4,ror#27 @ E+=ROR(A,27) | ||
371 | eor r9,r9,r11,ror#31 | ||
372 | str r9,[r14,#-4]! | ||
373 | eor r10,r5,r10,ror#2 @ F_xx_xx | ||
374 | @ F_xx_xx | ||
375 | add r3,r3,r9 @ E+=X[i] | ||
376 | add r3,r3,r10 @ E+=F_20_39(B,C,D) | ||
377 | teq r14,sp @ preserve carry | ||
378 | bne .L_20_39_or_60_79 @ [+((12+3)*5+2)*4] | ||
379 | bcs .L_done @ [+((12+3)*5+2)*4], spare 300 bytes | ||
380 | |||
381 | ldr r8,.LK_40_59 | ||
382 | sub sp,sp,#20*4 @ [+2] | ||
383 | .L_40_59: | ||
384 | ldr r9,[r14,#15*4] | ||
385 | ldr r10,[r14,#13*4] | ||
386 | ldr r11,[r14,#7*4] | ||
387 | add r7,r8,r7,ror#2 @ E+=K_xx_xx | ||
388 | ldr r12,[r14,#2*4] | ||
389 | eor r9,r9,r10 | ||
390 | eor r11,r11,r12 @ 1 cycle stall | ||
391 | eor r10,r5,r6 @ F_xx_xx | ||
392 | mov r9,r9,ror#31 | ||
393 | add r7,r7,r3,ror#27 @ E+=ROR(A,27) | ||
394 | eor r9,r9,r11,ror#31 | ||
395 | str r9,[r14,#-4]! | ||
396 | and r10,r4,r10,ror#2 @ F_xx_xx | ||
397 | and r11,r5,r6 @ F_xx_xx | ||
398 | add r7,r7,r9 @ E+=X[i] | ||
399 | add r7,r7,r10 @ E+=F_40_59(B,C,D) | ||
400 | add r7,r7,r11,ror#2 | ||
401 | ldr r9,[r14,#15*4] | ||
402 | ldr r10,[r14,#13*4] | ||
403 | ldr r11,[r14,#7*4] | ||
404 | add r6,r8,r6,ror#2 @ E+=K_xx_xx | ||
405 | ldr r12,[r14,#2*4] | ||
406 | eor r9,r9,r10 | ||
407 | eor r11,r11,r12 @ 1 cycle stall | ||
408 | eor r10,r4,r5 @ F_xx_xx | ||
409 | mov r9,r9,ror#31 | ||
410 | add r6,r6,r7,ror#27 @ E+=ROR(A,27) | ||
411 | eor r9,r9,r11,ror#31 | ||
412 | str r9,[r14,#-4]! | ||
413 | and r10,r3,r10,ror#2 @ F_xx_xx | ||
414 | and r11,r4,r5 @ F_xx_xx | ||
415 | add r6,r6,r9 @ E+=X[i] | ||
416 | add r6,r6,r10 @ E+=F_40_59(B,C,D) | ||
417 | add r6,r6,r11,ror#2 | ||
418 | ldr r9,[r14,#15*4] | ||
419 | ldr r10,[r14,#13*4] | ||
420 | ldr r11,[r14,#7*4] | ||
421 | add r5,r8,r5,ror#2 @ E+=K_xx_xx | ||
422 | ldr r12,[r14,#2*4] | ||
423 | eor r9,r9,r10 | ||
424 | eor r11,r11,r12 @ 1 cycle stall | ||
425 | eor r10,r3,r4 @ F_xx_xx | ||
426 | mov r9,r9,ror#31 | ||
427 | add r5,r5,r6,ror#27 @ E+=ROR(A,27) | ||
428 | eor r9,r9,r11,ror#31 | ||
429 | str r9,[r14,#-4]! | ||
430 | and r10,r7,r10,ror#2 @ F_xx_xx | ||
431 | and r11,r3,r4 @ F_xx_xx | ||
432 | add r5,r5,r9 @ E+=X[i] | ||
433 | add r5,r5,r10 @ E+=F_40_59(B,C,D) | ||
434 | add r5,r5,r11,ror#2 | ||
435 | ldr r9,[r14,#15*4] | ||
436 | ldr r10,[r14,#13*4] | ||
437 | ldr r11,[r14,#7*4] | ||
438 | add r4,r8,r4,ror#2 @ E+=K_xx_xx | ||
439 | ldr r12,[r14,#2*4] | ||
440 | eor r9,r9,r10 | ||
441 | eor r11,r11,r12 @ 1 cycle stall | ||
442 | eor r10,r7,r3 @ F_xx_xx | ||
443 | mov r9,r9,ror#31 | ||
444 | add r4,r4,r5,ror#27 @ E+=ROR(A,27) | ||
445 | eor r9,r9,r11,ror#31 | ||
446 | str r9,[r14,#-4]! | ||
447 | and r10,r6,r10,ror#2 @ F_xx_xx | ||
448 | and r11,r7,r3 @ F_xx_xx | ||
449 | add r4,r4,r9 @ E+=X[i] | ||
450 | add r4,r4,r10 @ E+=F_40_59(B,C,D) | ||
451 | add r4,r4,r11,ror#2 | ||
452 | ldr r9,[r14,#15*4] | ||
453 | ldr r10,[r14,#13*4] | ||
454 | ldr r11,[r14,#7*4] | ||
455 | add r3,r8,r3,ror#2 @ E+=K_xx_xx | ||
456 | ldr r12,[r14,#2*4] | ||
457 | eor r9,r9,r10 | ||
458 | eor r11,r11,r12 @ 1 cycle stall | ||
459 | eor r10,r6,r7 @ F_xx_xx | ||
460 | mov r9,r9,ror#31 | ||
461 | add r3,r3,r4,ror#27 @ E+=ROR(A,27) | ||
462 | eor r9,r9,r11,ror#31 | ||
463 | str r9,[r14,#-4]! | ||
464 | and r10,r5,r10,ror#2 @ F_xx_xx | ||
465 | and r11,r6,r7 @ F_xx_xx | ||
466 | add r3,r3,r9 @ E+=X[i] | ||
467 | add r3,r3,r10 @ E+=F_40_59(B,C,D) | ||
468 | add r3,r3,r11,ror#2 | ||
469 | teq r14,sp | ||
470 | bne .L_40_59 @ [+((12+5)*5+2)*4] | ||
471 | |||
472 | ldr r8,.LK_60_79 | ||
473 | sub sp,sp,#20*4 | ||
474 | cmp sp,#0 @ set carry to denote 60_79 | ||
475 | b .L_20_39_or_60_79 @ [+4], spare 300 bytes | ||
476 | .L_done: | ||
477 | add sp,sp,#80*4 @ "deallocate" stack frame | ||
478 | ldmia r0,{r8,r9,r10,r11,r12} | ||
479 | add r3,r8,r3 | ||
480 | add r4,r9,r4 | ||
481 | add r5,r10,r5,ror#2 | ||
482 | add r6,r11,r6,ror#2 | ||
483 | add r7,r12,r7,ror#2 | ||
484 | stmia r0,{r3,r4,r5,r6,r7} | ||
485 | teq r1,r2 | ||
486 | bne .Lloop @ [+18], total 1307 | ||
487 | |||
488 | #if __ARM_ARCH__>=5 | ||
489 | ldmia sp!,{r4-r12,pc} | ||
490 | #else | ||
491 | ldmia sp!,{r4-r12,lr} | ||
492 | tst lr,#1 | ||
493 | moveq pc,lr @ be binary compatible with V4, yet | ||
494 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) | ||
495 | #endif | ||
496 | .align 2 | ||
497 | .LK_00_19: .word 0x5a827999 | ||
498 | .LK_20_39: .word 0x6ed9eba1 | ||
499 | .LK_40_59: .word 0x8f1bbcdc | ||
500 | .LK_60_79: .word 0xca62c1d6 | ||
501 | .size sha1_block_data_order,.-sha1_block_data_order | ||
502 | .asciz "SHA1 block transform for ARMv4, CRYPTOGAMS by <appro@openssl.org>" | ||
503 | .align 2 | ||
diff --git a/arch/arm/crypto/sha1_glue.c b/arch/arm/crypto/sha1_glue.c new file mode 100644 index 000000000000..76cd976230bc --- /dev/null +++ b/arch/arm/crypto/sha1_glue.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * Glue code for the SHA1 Secure Hash Algorithm assembler implementation | ||
4 | * | ||
5 | * This file is based on sha1_generic.c and sha1_ssse3_glue.c | ||
6 | * | ||
7 | * Copyright (c) Alan Smithee. | ||
8 | * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk> | ||
9 | * Copyright (c) Jean-Francois Dive <jef@linuxbe.org> | ||
10 | * Copyright (c) Mathias Krause <minipli@googlemail.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 Free | ||
14 | * Software Foundation; either version 2 of the License, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #include <crypto/internal/hash.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/cryptohash.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <crypto/sha.h> | ||
25 | #include <asm/byteorder.h> | ||
26 | |||
27 | struct SHA1_CTX { | ||
28 | uint32_t h0,h1,h2,h3,h4; | ||
29 | u64 count; | ||
30 | u8 data[SHA1_BLOCK_SIZE]; | ||
31 | }; | ||
32 | |||
33 | asmlinkage void sha1_block_data_order(struct SHA1_CTX *digest, | ||
34 | const unsigned char *data, unsigned int rounds); | ||
35 | |||
36 | |||
37 | static int sha1_init(struct shash_desc *desc) | ||
38 | { | ||
39 | struct SHA1_CTX *sctx = shash_desc_ctx(desc); | ||
40 | memset(sctx, 0, sizeof(*sctx)); | ||
41 | sctx->h0 = SHA1_H0; | ||
42 | sctx->h1 = SHA1_H1; | ||
43 | sctx->h2 = SHA1_H2; | ||
44 | sctx->h3 = SHA1_H3; | ||
45 | sctx->h4 = SHA1_H4; | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | |||
50 | static int __sha1_update(struct SHA1_CTX *sctx, const u8 *data, | ||
51 | unsigned int len, unsigned int partial) | ||
52 | { | ||
53 | unsigned int done = 0; | ||
54 | |||
55 | sctx->count += len; | ||
56 | |||
57 | if (partial) { | ||
58 | done = SHA1_BLOCK_SIZE - partial; | ||
59 | memcpy(sctx->data + partial, data, done); | ||
60 | sha1_block_data_order(sctx, sctx->data, 1); | ||
61 | } | ||
62 | |||
63 | if (len - done >= SHA1_BLOCK_SIZE) { | ||
64 | const unsigned int rounds = (len - done) / SHA1_BLOCK_SIZE; | ||
65 | sha1_block_data_order(sctx, data + done, rounds); | ||
66 | done += rounds * SHA1_BLOCK_SIZE; | ||
67 | } | ||
68 | |||
69 | memcpy(sctx->data, data + done, len - done); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | |||
74 | static int sha1_update(struct shash_desc *desc, const u8 *data, | ||
75 | unsigned int len) | ||
76 | { | ||
77 | struct SHA1_CTX *sctx = shash_desc_ctx(desc); | ||
78 | unsigned int partial = sctx->count % SHA1_BLOCK_SIZE; | ||
79 | int res; | ||
80 | |||
81 | /* Handle the fast case right here */ | ||
82 | if (partial + len < SHA1_BLOCK_SIZE) { | ||
83 | sctx->count += len; | ||
84 | memcpy(sctx->data + partial, data, len); | ||
85 | return 0; | ||
86 | } | ||
87 | res = __sha1_update(sctx, data, len, partial); | ||
88 | return res; | ||
89 | } | ||
90 | |||
91 | |||
92 | /* Add padding and return the message digest. */ | ||
93 | static int sha1_final(struct shash_desc *desc, u8 *out) | ||
94 | { | ||
95 | struct SHA1_CTX *sctx = shash_desc_ctx(desc); | ||
96 | unsigned int i, index, padlen; | ||
97 | __be32 *dst = (__be32 *)out; | ||
98 | __be64 bits; | ||
99 | static const u8 padding[SHA1_BLOCK_SIZE] = { 0x80, }; | ||
100 | |||
101 | bits = cpu_to_be64(sctx->count << 3); | ||
102 | |||
103 | /* Pad out to 56 mod 64 and append length */ | ||
104 | index = sctx->count % SHA1_BLOCK_SIZE; | ||
105 | padlen = (index < 56) ? (56 - index) : ((SHA1_BLOCK_SIZE+56) - index); | ||
106 | /* We need to fill a whole block for __sha1_update() */ | ||
107 | if (padlen <= 56) { | ||
108 | sctx->count += padlen; | ||
109 | memcpy(sctx->data + index, padding, padlen); | ||
110 | } else { | ||
111 | __sha1_update(sctx, padding, padlen, index); | ||
112 | } | ||
113 | __sha1_update(sctx, (const u8 *)&bits, sizeof(bits), 56); | ||
114 | |||
115 | /* Store state in digest */ | ||
116 | for (i = 0; i < 5; i++) | ||
117 | dst[i] = cpu_to_be32(((u32 *)sctx)[i]); | ||
118 | |||
119 | /* Wipe context */ | ||
120 | memset(sctx, 0, sizeof(*sctx)); | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | |||
125 | static int sha1_export(struct shash_desc *desc, void *out) | ||
126 | { | ||
127 | struct SHA1_CTX *sctx = shash_desc_ctx(desc); | ||
128 | memcpy(out, sctx, sizeof(*sctx)); | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | |||
133 | static int sha1_import(struct shash_desc *desc, const void *in) | ||
134 | { | ||
135 | struct SHA1_CTX *sctx = shash_desc_ctx(desc); | ||
136 | memcpy(sctx, in, sizeof(*sctx)); | ||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | |||
141 | static struct shash_alg alg = { | ||
142 | .digestsize = SHA1_DIGEST_SIZE, | ||
143 | .init = sha1_init, | ||
144 | .update = sha1_update, | ||
145 | .final = sha1_final, | ||
146 | .export = sha1_export, | ||
147 | .import = sha1_import, | ||
148 | .descsize = sizeof(struct SHA1_CTX), | ||
149 | .statesize = sizeof(struct SHA1_CTX), | ||
150 | .base = { | ||
151 | .cra_name = "sha1", | ||
152 | .cra_driver_name= "sha1-asm", | ||
153 | .cra_priority = 150, | ||
154 | .cra_flags = CRYPTO_ALG_TYPE_SHASH, | ||
155 | .cra_blocksize = SHA1_BLOCK_SIZE, | ||
156 | .cra_module = THIS_MODULE, | ||
157 | } | ||
158 | }; | ||
159 | |||
160 | |||
161 | static int __init sha1_mod_init(void) | ||
162 | { | ||
163 | return crypto_register_shash(&alg); | ||
164 | } | ||
165 | |||
166 | |||
167 | static void __exit sha1_mod_fini(void) | ||
168 | { | ||
169 | crypto_unregister_shash(&alg); | ||
170 | } | ||
171 | |||
172 | |||
173 | module_init(sha1_mod_init); | ||
174 | module_exit(sha1_mod_fini); | ||
175 | |||
176 | MODULE_LICENSE("GPL"); | ||
177 | MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm (ARM)"); | ||
178 | MODULE_ALIAS("sha1"); | ||
179 | MODULE_AUTHOR("David McCullough <ucdevel@gmail.com>"); | ||
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h index 05112380dc53..8dcd9c702d90 100644 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h | |||
@@ -44,10 +44,9 @@ | |||
44 | #define rmb() dsb() | 44 | #define rmb() dsb() |
45 | #define wmb() mb() | 45 | #define wmb() mb() |
46 | #else | 46 | #else |
47 | #include <asm/memory.h> | 47 | #define mb() barrier() |
48 | #define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) | 48 | #define rmb() barrier() |
49 | #define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) | 49 | #define wmb() barrier() |
50 | #define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) | ||
51 | #endif | 50 | #endif |
52 | 51 | ||
53 | #ifndef CONFIG_SMP | 52 | #ifndef CONFIG_SMP |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 5c44dcb0987b..23004847bb05 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #define DMA_ERROR_CODE (~0) | 14 | #define DMA_ERROR_CODE (~0) |
15 | extern struct dma_map_ops arm_dma_ops; | 15 | extern struct dma_map_ops arm_dma_ops; |
16 | extern struct dma_map_ops arm_coherent_dma_ops; | ||
16 | 17 | ||
17 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) | 18 | static inline struct dma_map_ops *get_dma_ops(struct device *dev) |
18 | { | 19 | { |
diff --git a/arch/arm/include/asm/hypervisor.h b/arch/arm/include/asm/hypervisor.h new file mode 100644 index 000000000000..b90d9e523d6f --- /dev/null +++ b/arch/arm/include/asm/hypervisor.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_ARM_HYPERVISOR_H | ||
2 | #define _ASM_ARM_HYPERVISOR_H | ||
3 | |||
4 | #include <asm/xen/hypervisor.h> | ||
5 | |||
6 | #endif | ||
diff --git a/arch/arm/include/asm/leds.h b/arch/arm/include/asm/leds.h deleted file mode 100644 index c545739f39b7..000000000000 --- a/arch/arm/include/asm/leds.h +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/include/asm/leds.h | ||
3 | * | ||
4 | * Copyright (C) 1998 Russell King | ||
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 | * Event-driven interface for LEDs on machines | ||
11 | * Added led_start and led_stop- Alex Holden, 28th Dec 1998. | ||
12 | */ | ||
13 | #ifndef ASM_ARM_LEDS_H | ||
14 | #define ASM_ARM_LEDS_H | ||
15 | |||
16 | |||
17 | typedef enum { | ||
18 | led_idle_start, | ||
19 | led_idle_end, | ||
20 | led_timer, | ||
21 | led_start, | ||
22 | led_stop, | ||
23 | led_claim, /* override idle & timer leds */ | ||
24 | led_release, /* restore idle & timer leds */ | ||
25 | led_start_timer_mode, | ||
26 | led_stop_timer_mode, | ||
27 | led_green_on, | ||
28 | led_green_off, | ||
29 | led_amber_on, | ||
30 | led_amber_off, | ||
31 | led_red_on, | ||
32 | led_red_off, | ||
33 | led_blue_on, | ||
34 | led_blue_off, | ||
35 | /* | ||
36 | * I want this between led_timer and led_start, but | ||
37 | * someone has decided to export this to user space | ||
38 | */ | ||
39 | led_halted | ||
40 | } led_event_t; | ||
41 | |||
42 | /* Use this routine to handle LEDs */ | ||
43 | |||
44 | #ifdef CONFIG_LEDS | ||
45 | extern void (*leds_event)(led_event_t); | ||
46 | #else | ||
47 | #define leds_event(e) | ||
48 | #endif | ||
49 | |||
50 | #endif | ||
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 5f6ddcc56452..73cf03aa981e 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -275,14 +275,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x) | |||
275 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 275 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
276 | #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) | 276 | #define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) |
277 | 277 | ||
278 | /* | ||
279 | * Optional coherency support. Currently used only by selected | ||
280 | * Intel XSC3-based systems. | ||
281 | */ | ||
282 | #ifndef arch_is_coherent | ||
283 | #define arch_is_coherent() 0 | ||
284 | #endif | ||
285 | |||
286 | #endif | 278 | #endif |
287 | 279 | ||
288 | #include <asm-generic/memory_model.h> | 280 | #include <asm-generic/memory_model.h> |
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index ecf901902e44..812a4944e783 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #ifndef CONFIG_MMU | 20 | #ifndef CONFIG_MMU |
21 | 21 | ||
22 | #include "page-nommu.h" | 22 | #include <asm/page-nommu.h> |
23 | 23 | ||
24 | #else | 24 | #else |
25 | 25 | ||
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 41dc31f834c3..08c12312a1f9 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #ifndef CONFIG_MMU | 16 | #ifndef CONFIG_MMU |
17 | 17 | ||
18 | #include <asm-generic/4level-fixup.h> | 18 | #include <asm-generic/4level-fixup.h> |
19 | #include "pgtable-nommu.h" | 19 | #include <asm/pgtable-nommu.h> |
20 | 20 | ||
21 | #else | 21 | #else |
22 | 22 | ||
diff --git a/arch/arm/include/asm/sync_bitops.h b/arch/arm/include/asm/sync_bitops.h new file mode 100644 index 000000000000..63479eecbf76 --- /dev/null +++ b/arch/arm/include/asm/sync_bitops.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_SYNC_BITOPS_H__ | ||
2 | #define __ASM_SYNC_BITOPS_H__ | ||
3 | |||
4 | #include <asm/bitops.h> | ||
5 | #include <asm/system.h> | ||
6 | |||
7 | /* sync_bitops functions are equivalent to the SMP implementation of the | ||
8 | * original functions, independently from CONFIG_SMP being defined. | ||
9 | * | ||
10 | * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But | ||
11 | * under Xen you might be communicating with a completely external entity | ||
12 | * who might be on another CPU (e.g. two uniprocessor guests communicating | ||
13 | * via event channels and grant tables). So we need a variant of the bit | ||
14 | * ops which are SMP safe even on a UP kernel. | ||
15 | */ | ||
16 | |||
17 | #define sync_set_bit(nr, p) _set_bit(nr, p) | ||
18 | #define sync_clear_bit(nr, p) _clear_bit(nr, p) | ||
19 | #define sync_change_bit(nr, p) _change_bit(nr, p) | ||
20 | #define sync_test_and_set_bit(nr, p) _test_and_set_bit(nr, p) | ||
21 | #define sync_test_and_clear_bit(nr, p) _test_and_clear_bit(nr, p) | ||
22 | #define sync_test_and_change_bit(nr, p) _test_and_change_bit(nr, p) | ||
23 | #define sync_test_bit(nr, addr) test_bit(nr, addr) | ||
24 | #define sync_cmpxchg cmpxchg | ||
25 | |||
26 | |||
27 | #endif | ||
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h index 0cab47d4a83f..2fde5fd1acce 100644 --- a/arch/arm/include/asm/unistd.h +++ b/arch/arm/include/asm/unistd.h | |||
@@ -404,6 +404,7 @@ | |||
404 | #define __NR_setns (__NR_SYSCALL_BASE+375) | 404 | #define __NR_setns (__NR_SYSCALL_BASE+375) |
405 | #define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) | 405 | #define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) |
406 | #define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) | 406 | #define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) |
407 | /* 378 for kcmp */ | ||
407 | 408 | ||
408 | /* | 409 | /* |
409 | * The following SWIs are ARM private. | 410 | * The following SWIs are ARM private. |
@@ -483,6 +484,7 @@ | |||
483 | */ | 484 | */ |
484 | #define __IGNORE_fadvise64_64 | 485 | #define __IGNORE_fadvise64_64 |
485 | #define __IGNORE_migrate_pages | 486 | #define __IGNORE_migrate_pages |
487 | #define __IGNORE_kcmp | ||
486 | 488 | ||
487 | #endif /* __KERNEL__ */ | 489 | #endif /* __KERNEL__ */ |
488 | #endif /* __ASM_ARM_UNISTD_H */ | 490 | #endif /* __ASM_ARM_UNISTD_H */ |
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h index 3d5fc41ae8d3..a7aadbd9a6dd 100644 --- a/arch/arm/include/asm/vfpmacros.h +++ b/arch/arm/include/asm/vfpmacros.h | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | #include <asm/hwcap.h> | 6 | #include <asm/hwcap.h> |
7 | 7 | ||
8 | #include "vfp.h" | 8 | #include <asm/vfp.h> |
9 | 9 | ||
10 | @ Macros to allow building with old toolkits (with no VFP support) | 10 | @ Macros to allow building with old toolkits (with no VFP support) |
11 | .macro VFPFMRX, rd, sysreg, cond | 11 | .macro VFPFMRX, rd, sysreg, cond |
diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h new file mode 100644 index 000000000000..94b4e9020b02 --- /dev/null +++ b/arch/arm/include/asm/xen/events.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef _ASM_ARM_XEN_EVENTS_H | ||
2 | #define _ASM_ARM_XEN_EVENTS_H | ||
3 | |||
4 | #include <asm/ptrace.h> | ||
5 | |||
6 | enum ipi_vector { | ||
7 | XEN_PLACEHOLDER_VECTOR, | ||
8 | |||
9 | /* Xen IPIs go here */ | ||
10 | XEN_NR_IPIS, | ||
11 | }; | ||
12 | |||
13 | static inline int xen_irqs_disabled(struct pt_regs *regs) | ||
14 | { | ||
15 | return raw_irqs_disabled_flags(regs->ARM_cpsr); | ||
16 | } | ||
17 | |||
18 | #endif /* _ASM_ARM_XEN_EVENTS_H */ | ||
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h new file mode 100644 index 000000000000..8a823253d775 --- /dev/null +++ b/arch/arm/include/asm/xen/hypercall.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /****************************************************************************** | ||
2 | * hypercall.h | ||
3 | * | ||
4 | * Linux-specific hypervisor handling. | ||
5 | * | ||
6 | * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | #ifndef _ASM_ARM_XEN_HYPERCALL_H | ||
34 | #define _ASM_ARM_XEN_HYPERCALL_H | ||
35 | |||
36 | #include <xen/interface/xen.h> | ||
37 | |||
38 | long privcmd_call(unsigned call, unsigned long a1, | ||
39 | unsigned long a2, unsigned long a3, | ||
40 | unsigned long a4, unsigned long a5); | ||
41 | int HYPERVISOR_xen_version(int cmd, void *arg); | ||
42 | int HYPERVISOR_console_io(int cmd, int count, char *str); | ||
43 | int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count); | ||
44 | int HYPERVISOR_sched_op(int cmd, void *arg); | ||
45 | int HYPERVISOR_event_channel_op(int cmd, void *arg); | ||
46 | unsigned long HYPERVISOR_hvm_op(int op, void *arg); | ||
47 | int HYPERVISOR_memory_op(unsigned int cmd, void *arg); | ||
48 | int HYPERVISOR_physdev_op(int cmd, void *arg); | ||
49 | |||
50 | static inline void | ||
51 | MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, | ||
52 | unsigned int new_val, unsigned long flags) | ||
53 | { | ||
54 | BUG(); | ||
55 | } | ||
56 | |||
57 | static inline void | ||
58 | MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req, | ||
59 | int count, int *success_count, domid_t domid) | ||
60 | { | ||
61 | BUG(); | ||
62 | } | ||
63 | |||
64 | static inline int | ||
65 | HYPERVISOR_multicall(void *call_list, int nr_calls) | ||
66 | { | ||
67 | BUG(); | ||
68 | } | ||
69 | #endif /* _ASM_ARM_XEN_HYPERCALL_H */ | ||
diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h new file mode 100644 index 000000000000..d7ab99a0c9eb --- /dev/null +++ b/arch/arm/include/asm/xen/hypervisor.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef _ASM_ARM_XEN_HYPERVISOR_H | ||
2 | #define _ASM_ARM_XEN_HYPERVISOR_H | ||
3 | |||
4 | extern struct shared_info *HYPERVISOR_shared_info; | ||
5 | extern struct start_info *xen_start_info; | ||
6 | |||
7 | /* Lazy mode for batching updates / context switch */ | ||
8 | enum paravirt_lazy_mode { | ||
9 | PARAVIRT_LAZY_NONE, | ||
10 | PARAVIRT_LAZY_MMU, | ||
11 | PARAVIRT_LAZY_CPU, | ||
12 | }; | ||
13 | |||
14 | static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void) | ||
15 | { | ||
16 | return PARAVIRT_LAZY_NONE; | ||
17 | } | ||
18 | |||
19 | #endif /* _ASM_ARM_XEN_HYPERVISOR_H */ | ||
diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h new file mode 100644 index 000000000000..ae05e56dd17d --- /dev/null +++ b/arch/arm/include/asm/xen/interface.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /****************************************************************************** | ||
2 | * Guest OS interface to ARM Xen. | ||
3 | * | ||
4 | * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASM_ARM_XEN_INTERFACE_H | ||
8 | #define _ASM_ARM_XEN_INTERFACE_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | |||
12 | #define uint64_aligned_t uint64_t __attribute__((aligned(8))) | ||
13 | |||
14 | #define __DEFINE_GUEST_HANDLE(name, type) \ | ||
15 | typedef struct { union { type *p; uint64_aligned_t q; }; } \ | ||
16 | __guest_handle_ ## name | ||
17 | |||
18 | #define DEFINE_GUEST_HANDLE_STRUCT(name) \ | ||
19 | __DEFINE_GUEST_HANDLE(name, struct name) | ||
20 | #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) | ||
21 | #define GUEST_HANDLE(name) __guest_handle_ ## name | ||
22 | |||
23 | #define set_xen_guest_handle(hnd, val) \ | ||
24 | do { \ | ||
25 | if (sizeof(hnd) == 8) \ | ||
26 | *(uint64_t *)&(hnd) = 0; \ | ||
27 | (hnd).p = val; \ | ||
28 | } while (0) | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | /* Explicitly size integers that represent pfns in the interface with | ||
32 | * Xen so that we can have one ABI that works for 32 and 64 bit guests. */ | ||
33 | typedef uint64_t xen_pfn_t; | ||
34 | typedef uint64_t xen_ulong_t; | ||
35 | /* Guest handles for primitive C types. */ | ||
36 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); | ||
37 | __DEFINE_GUEST_HANDLE(uint, unsigned int); | ||
38 | __DEFINE_GUEST_HANDLE(ulong, unsigned long); | ||
39 | DEFINE_GUEST_HANDLE(char); | ||
40 | DEFINE_GUEST_HANDLE(int); | ||
41 | DEFINE_GUEST_HANDLE(long); | ||
42 | DEFINE_GUEST_HANDLE(void); | ||
43 | DEFINE_GUEST_HANDLE(uint64_t); | ||
44 | DEFINE_GUEST_HANDLE(uint32_t); | ||
45 | DEFINE_GUEST_HANDLE(xen_pfn_t); | ||
46 | |||
47 | /* Maximum number of virtual CPUs in multi-processor guests. */ | ||
48 | #define MAX_VIRT_CPUS 1 | ||
49 | |||
50 | struct arch_vcpu_info { }; | ||
51 | struct arch_shared_info { }; | ||
52 | |||
53 | /* TODO: Move pvclock definitions some place arch independent */ | ||
54 | struct pvclock_vcpu_time_info { | ||
55 | u32 version; | ||
56 | u32 pad0; | ||
57 | u64 tsc_timestamp; | ||
58 | u64 system_time; | ||
59 | u32 tsc_to_system_mul; | ||
60 | s8 tsc_shift; | ||
61 | u8 flags; | ||
62 | u8 pad[2]; | ||
63 | } __attribute__((__packed__)); /* 32 bytes */ | ||
64 | |||
65 | /* It is OK to have a 12 bytes struct with no padding because it is packed */ | ||
66 | struct pvclock_wall_clock { | ||
67 | u32 version; | ||
68 | u32 sec; | ||
69 | u32 nsec; | ||
70 | } __attribute__((__packed__)); | ||
71 | #endif | ||
72 | |||
73 | #endif /* _ASM_ARM_XEN_INTERFACE_H */ | ||
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h new file mode 100644 index 000000000000..174202318dff --- /dev/null +++ b/arch/arm/include/asm/xen/page.h | |||
@@ -0,0 +1,82 @@ | |||
1 | #ifndef _ASM_ARM_XEN_PAGE_H | ||
2 | #define _ASM_ARM_XEN_PAGE_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | #include <asm/pgtable.h> | ||
6 | |||
7 | #include <linux/pfn.h> | ||
8 | #include <linux/types.h> | ||
9 | |||
10 | #include <xen/interface/grant_table.h> | ||
11 | |||
12 | #define pfn_to_mfn(pfn) (pfn) | ||
13 | #define phys_to_machine_mapping_valid (1) | ||
14 | #define mfn_to_pfn(mfn) (mfn) | ||
15 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | ||
16 | |||
17 | #define pte_mfn pte_pfn | ||
18 | #define mfn_pte pfn_pte | ||
19 | |||
20 | /* Xen machine address */ | ||
21 | typedef struct xmaddr { | ||
22 | phys_addr_t maddr; | ||
23 | } xmaddr_t; | ||
24 | |||
25 | /* Xen pseudo-physical address */ | ||
26 | typedef struct xpaddr { | ||
27 | phys_addr_t paddr; | ||
28 | } xpaddr_t; | ||
29 | |||
30 | #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) | ||
31 | #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) | ||
32 | |||
33 | static inline xmaddr_t phys_to_machine(xpaddr_t phys) | ||
34 | { | ||
35 | unsigned offset = phys.paddr & ~PAGE_MASK; | ||
36 | return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset); | ||
37 | } | ||
38 | |||
39 | static inline xpaddr_t machine_to_phys(xmaddr_t machine) | ||
40 | { | ||
41 | unsigned offset = machine.maddr & ~PAGE_MASK; | ||
42 | return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset); | ||
43 | } | ||
44 | /* VIRT <-> MACHINE conversion */ | ||
45 | #define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v)))) | ||
46 | #define virt_to_pfn(v) (PFN_DOWN(__pa(v))) | ||
47 | #define virt_to_mfn(v) (pfn_to_mfn(virt_to_pfn(v))) | ||
48 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | ||
49 | |||
50 | static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr) | ||
51 | { | ||
52 | /* TODO: assuming it is mapped in the kernel 1:1 */ | ||
53 | return virt_to_machine(vaddr); | ||
54 | } | ||
55 | |||
56 | /* TODO: this shouldn't be here but it is because the frontend drivers | ||
57 | * are using it (its rolled in headers) even though we won't hit the code path. | ||
58 | * So for right now just punt with this. | ||
59 | */ | ||
60 | static inline pte_t *lookup_address(unsigned long address, unsigned int *level) | ||
61 | { | ||
62 | BUG(); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | static inline int m2p_add_override(unsigned long mfn, struct page *page, | ||
67 | struct gnttab_map_grant_ref *kmap_op) | ||
68 | { | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | static inline int m2p_remove_override(struct page *page, bool clear_pte) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) | ||
78 | { | ||
79 | BUG(); | ||
80 | return false; | ||
81 | } | ||
82 | #endif /* _ASM_ARM_XEN_PAGE_H */ | ||
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild new file mode 100644 index 000000000000..baebb3da1d44 --- /dev/null +++ b/arch/arm/include/uapi/asm/Kbuild | |||
@@ -0,0 +1,3 @@ | |||
1 | # UAPI Header export list | ||
2 | include include/uapi/asm-generic/Kbuild.asm | ||
3 | |||
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 1c4321430737..d81f3a6d9ad8 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -21,7 +21,6 @@ obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ | |||
21 | 21 | ||
22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o | 22 | obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o |
23 | 23 | ||
24 | obj-$(CONFIG_LEDS) += leds.o | ||
25 | obj-$(CONFIG_OC_ETM) += etm.o | 24 | obj-$(CONFIG_OC_ETM) += etm.o |
26 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 25 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
27 | obj-$(CONFIG_ISA_DMA_API) += dma.o | 26 | obj-$(CONFIG_ISA_DMA_API) += dma.o |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index b244696de1a3..9b722612553d 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -271,15 +271,6 @@ static void __devinit pci_fixup_it8152(struct pci_dev *dev) | |||
271 | } | 271 | } |
272 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152); | 272 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152); |
273 | 273 | ||
274 | |||
275 | |||
276 | void __devinit pcibios_update_irq(struct pci_dev *dev, int irq) | ||
277 | { | ||
278 | if (debug_pci) | ||
279 | printk("PCI: Assigning IRQ %02d to %s\n", irq, pci_name(dev)); | ||
280 | pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); | ||
281 | } | ||
282 | |||
283 | /* | 274 | /* |
284 | * If the bus contains any of these devices, then we must not turn on | 275 | * If the bus contains any of these devices, then we must not turn on |
285 | * parity checking of any kind. Currently this is CyberPro 20x0 only. | 276 | * parity checking of any kind. Currently this is CyberPro 20x0 only. |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 463ff4a0ec8a..e337879595e5 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -387,6 +387,7 @@ | |||
387 | /* 375 */ CALL(sys_setns) | 387 | /* 375 */ CALL(sys_setns) |
388 | CALL(sys_process_vm_readv) | 388 | CALL(sys_process_vm_readv) |
389 | CALL(sys_process_vm_writev) | 389 | CALL(sys_process_vm_writev) |
390 | CALL(sys_ni_syscall) /* reserved for sys_kcmp */ | ||
390 | #ifndef syscalls_counted | 391 | #ifndef syscalls_counted |
391 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 392 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
392 | #define syscalls_counted | 393 | #define syscalls_counted |
diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c deleted file mode 100644 index 1911dae19e4f..000000000000 --- a/arch/arm/kernel/leds.c +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /* | ||
2 | * LED support code, ripped out of arch/arm/kernel/time.c | ||
3 | * | ||
4 | * Copyright (C) 1994-2001 Russell King | ||
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 | #include <linux/export.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/device.h> | ||
13 | #include <linux/syscore_ops.h> | ||
14 | #include <linux/string.h> | ||
15 | |||
16 | #include <asm/leds.h> | ||
17 | |||
18 | static void dummy_leds_event(led_event_t evt) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | void (*leds_event)(led_event_t) = dummy_leds_event; | ||
23 | |||
24 | struct leds_evt_name { | ||
25 | const char name[8]; | ||
26 | int on; | ||
27 | int off; | ||
28 | }; | ||
29 | |||
30 | static const struct leds_evt_name evt_names[] = { | ||
31 | { "amber", led_amber_on, led_amber_off }, | ||
32 | { "blue", led_blue_on, led_blue_off }, | ||
33 | { "green", led_green_on, led_green_off }, | ||
34 | { "red", led_red_on, led_red_off }, | ||
35 | }; | ||
36 | |||
37 | static ssize_t leds_store(struct device *dev, | ||
38 | struct device_attribute *attr, | ||
39 | const char *buf, size_t size) | ||
40 | { | ||
41 | int ret = -EINVAL, len = strcspn(buf, " "); | ||
42 | |||
43 | if (len > 0 && buf[len] == '\0') | ||
44 | len--; | ||
45 | |||
46 | if (strncmp(buf, "claim", len) == 0) { | ||
47 | leds_event(led_claim); | ||
48 | ret = size; | ||
49 | } else if (strncmp(buf, "release", len) == 0) { | ||
50 | leds_event(led_release); | ||
51 | ret = size; | ||
52 | } else { | ||
53 | int i; | ||
54 | |||
55 | for (i = 0; i < ARRAY_SIZE(evt_names); i++) { | ||
56 | if (strlen(evt_names[i].name) != len || | ||
57 | strncmp(buf, evt_names[i].name, len) != 0) | ||
58 | continue; | ||
59 | if (strncmp(buf+len, " on", 3) == 0) { | ||
60 | leds_event(evt_names[i].on); | ||
61 | ret = size; | ||
62 | } else if (strncmp(buf+len, " off", 4) == 0) { | ||
63 | leds_event(evt_names[i].off); | ||
64 | ret = size; | ||
65 | } | ||
66 | break; | ||
67 | } | ||
68 | } | ||
69 | return ret; | ||
70 | } | ||
71 | |||
72 | static DEVICE_ATTR(event, 0200, NULL, leds_store); | ||
73 | |||
74 | static struct bus_type leds_subsys = { | ||
75 | .name = "leds", | ||
76 | .dev_name = "leds", | ||
77 | }; | ||
78 | |||
79 | static struct device leds_device = { | ||
80 | .id = 0, | ||
81 | .bus = &leds_subsys, | ||
82 | }; | ||
83 | |||
84 | static int leds_suspend(void) | ||
85 | { | ||
86 | leds_event(led_stop); | ||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static void leds_resume(void) | ||
91 | { | ||
92 | leds_event(led_start); | ||
93 | } | ||
94 | |||
95 | static void leds_shutdown(void) | ||
96 | { | ||
97 | leds_event(led_halted); | ||
98 | } | ||
99 | |||
100 | static struct syscore_ops leds_syscore_ops = { | ||
101 | .shutdown = leds_shutdown, | ||
102 | .suspend = leds_suspend, | ||
103 | .resume = leds_resume, | ||
104 | }; | ||
105 | |||
106 | static int __init leds_init(void) | ||
107 | { | ||
108 | int ret; | ||
109 | ret = subsys_system_register(&leds_subsys, NULL); | ||
110 | if (ret == 0) | ||
111 | ret = device_register(&leds_device); | ||
112 | if (ret == 0) | ||
113 | ret = device_create_file(&leds_device, &dev_attr_event); | ||
114 | if (ret == 0) | ||
115 | register_syscore_ops(&leds_syscore_ops); | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | device_initcall(leds_init); | ||
120 | |||
121 | EXPORT_SYMBOL(leds_event); | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 693b744fd572..04eea22d7958 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -31,9 +31,9 @@ | |||
31 | #include <linux/random.h> | 31 | #include <linux/random.h> |
32 | #include <linux/hw_breakpoint.h> | 32 | #include <linux/hw_breakpoint.h> |
33 | #include <linux/cpuidle.h> | 33 | #include <linux/cpuidle.h> |
34 | #include <linux/leds.h> | ||
34 | 35 | ||
35 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
36 | #include <asm/leds.h> | ||
37 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
38 | #include <asm/thread_notify.h> | 38 | #include <asm/thread_notify.h> |
39 | #include <asm/stacktrace.h> | 39 | #include <asm/stacktrace.h> |
@@ -189,7 +189,7 @@ void cpu_idle(void) | |||
189 | while (1) { | 189 | while (1) { |
190 | tick_nohz_idle_enter(); | 190 | tick_nohz_idle_enter(); |
191 | rcu_idle_enter(); | 191 | rcu_idle_enter(); |
192 | leds_event(led_idle_start); | 192 | ledtrig_cpu(CPU_LED_IDLE_START); |
193 | while (!need_resched()) { | 193 | while (!need_resched()) { |
194 | #ifdef CONFIG_HOTPLUG_CPU | 194 | #ifdef CONFIG_HOTPLUG_CPU |
195 | if (cpu_is_offline(smp_processor_id())) | 195 | if (cpu_is_offline(smp_processor_id())) |
@@ -220,7 +220,7 @@ void cpu_idle(void) | |||
220 | } else | 220 | } else |
221 | local_irq_enable(); | 221 | local_irq_enable(); |
222 | } | 222 | } |
223 | leds_event(led_idle_end); | 223 | ledtrig_cpu(CPU_LED_IDLE_END); |
224 | rcu_idle_exit(); | 224 | rcu_idle_exit(); |
225 | tick_nohz_idle_exit(); | 225 | tick_nohz_idle_exit(); |
226 | schedule_preempt_disabled(); | 226 | schedule_preempt_disabled(); |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index aa4ffe6e5ecf..dea7a925c7e2 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
25 | #include <linux/clockchips.h> | 25 | #include <linux/clockchips.h> |
26 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
27 | #include <linux/cpufreq.h> | ||
27 | 28 | ||
28 | #include <linux/atomic.h> | 29 | #include <linux/atomic.h> |
29 | #include <asm/smp.h> | 30 | #include <asm/smp.h> |
@@ -650,3 +651,56 @@ int setup_profiling_timer(unsigned int multiplier) | |||
650 | { | 651 | { |
651 | return -EINVAL; | 652 | return -EINVAL; |
652 | } | 653 | } |
654 | |||
655 | #ifdef CONFIG_CPU_FREQ | ||
656 | |||
657 | static DEFINE_PER_CPU(unsigned long, l_p_j_ref); | ||
658 | static DEFINE_PER_CPU(unsigned long, l_p_j_ref_freq); | ||
659 | static unsigned long global_l_p_j_ref; | ||
660 | static unsigned long global_l_p_j_ref_freq; | ||
661 | |||
662 | static int cpufreq_callback(struct notifier_block *nb, | ||
663 | unsigned long val, void *data) | ||
664 | { | ||
665 | struct cpufreq_freqs *freq = data; | ||
666 | int cpu = freq->cpu; | ||
667 | |||
668 | if (freq->flags & CPUFREQ_CONST_LOOPS) | ||
669 | return NOTIFY_OK; | ||
670 | |||
671 | if (!per_cpu(l_p_j_ref, cpu)) { | ||
672 | per_cpu(l_p_j_ref, cpu) = | ||
673 | per_cpu(cpu_data, cpu).loops_per_jiffy; | ||
674 | per_cpu(l_p_j_ref_freq, cpu) = freq->old; | ||
675 | if (!global_l_p_j_ref) { | ||
676 | global_l_p_j_ref = loops_per_jiffy; | ||
677 | global_l_p_j_ref_freq = freq->old; | ||
678 | } | ||
679 | } | ||
680 | |||
681 | if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || | ||
682 | (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || | ||
683 | (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) { | ||
684 | loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, | ||
685 | global_l_p_j_ref_freq, | ||
686 | freq->new); | ||
687 | per_cpu(cpu_data, cpu).loops_per_jiffy = | ||
688 | cpufreq_scale(per_cpu(l_p_j_ref, cpu), | ||
689 | per_cpu(l_p_j_ref_freq, cpu), | ||
690 | freq->new); | ||
691 | } | ||
692 | return NOTIFY_OK; | ||
693 | } | ||
694 | |||
695 | static struct notifier_block cpufreq_notifier = { | ||
696 | .notifier_call = cpufreq_callback, | ||
697 | }; | ||
698 | |||
699 | static int __init register_cpufreq_notifier(void) | ||
700 | { | ||
701 | return cpufreq_register_notifier(&cpufreq_notifier, | ||
702 | CPUFREQ_TRANSITION_NOTIFIER); | ||
703 | } | ||
704 | core_initcall(register_cpufreq_notifier); | ||
705 | |||
706 | #endif | ||
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index fef42b21cecb..e1f906989bb8 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/cpufreq.h> | ||
15 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
16 | #include <linux/device.h> | 15 | #include <linux/device.h> |
17 | #include <linux/err.h> | 16 | #include <linux/err.h> |
@@ -96,7 +95,52 @@ static void twd_timer_stop(struct clock_event_device *clk) | |||
96 | disable_percpu_irq(clk->irq); | 95 | disable_percpu_irq(clk->irq); |
97 | } | 96 | } |
98 | 97 | ||
99 | #ifdef CONFIG_CPU_FREQ | 98 | #ifdef CONFIG_COMMON_CLK |
99 | |||
100 | /* | ||
101 | * Updates clockevent frequency when the cpu frequency changes. | ||
102 | * Called on the cpu that is changing frequency with interrupts disabled. | ||
103 | */ | ||
104 | static void twd_update_frequency(void *new_rate) | ||
105 | { | ||
106 | twd_timer_rate = *((unsigned long *) new_rate); | ||
107 | |||
108 | clockevents_update_freq(*__this_cpu_ptr(twd_evt), twd_timer_rate); | ||
109 | } | ||
110 | |||
111 | static int twd_rate_change(struct notifier_block *nb, | ||
112 | unsigned long flags, void *data) | ||
113 | { | ||
114 | struct clk_notifier_data *cnd = data; | ||
115 | |||
116 | /* | ||
117 | * The twd clock events must be reprogrammed to account for the new | ||
118 | * frequency. The timer is local to a cpu, so cross-call to the | ||
119 | * changing cpu. | ||
120 | */ | ||
121 | if (flags == POST_RATE_CHANGE) | ||
122 | smp_call_function(twd_update_frequency, | ||
123 | (void *)&cnd->new_rate, 1); | ||
124 | |||
125 | return NOTIFY_OK; | ||
126 | } | ||
127 | |||
128 | static struct notifier_block twd_clk_nb = { | ||
129 | .notifier_call = twd_rate_change, | ||
130 | }; | ||
131 | |||
132 | static int twd_clk_init(void) | ||
133 | { | ||
134 | if (twd_evt && *__this_cpu_ptr(twd_evt) && !IS_ERR(twd_clk)) | ||
135 | return clk_notifier_register(twd_clk, &twd_clk_nb); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | core_initcall(twd_clk_init); | ||
140 | |||
141 | #elif defined (CONFIG_CPU_FREQ) | ||
142 | |||
143 | #include <linux/cpufreq.h> | ||
100 | 144 | ||
101 | /* | 145 | /* |
102 | * Updates clockevent frequency when the cpu frequency changes. | 146 | * Updates clockevent frequency when the cpu frequency changes. |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index af2afb019672..09be0c3c9069 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -25,7 +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 <asm/leds.h> | ||
29 | #include <asm/thread_info.h> | 28 | #include <asm/thread_info.h> |
30 | #include <asm/sched_clock.h> | 29 | #include <asm/sched_clock.h> |
31 | #include <asm/stacktrace.h> | 30 | #include <asm/stacktrace.h> |
@@ -80,21 +79,6 @@ u32 arch_gettimeoffset(void) | |||
80 | } | 79 | } |
81 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ | 80 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ |
82 | 81 | ||
83 | #ifdef CONFIG_LEDS_TIMER | ||
84 | static inline void do_leds(void) | ||
85 | { | ||
86 | static unsigned int count = HZ/2; | ||
87 | |||
88 | if (--count == 0) { | ||
89 | count = HZ/2; | ||
90 | leds_event(led_timer); | ||
91 | } | ||
92 | } | ||
93 | #else | ||
94 | #define do_leds() | ||
95 | #endif | ||
96 | |||
97 | |||
98 | #ifndef CONFIG_GENERIC_CLOCKEVENTS | 82 | #ifndef CONFIG_GENERIC_CLOCKEVENTS |
99 | /* | 83 | /* |
100 | * Kernel system timer support. | 84 | * Kernel system timer support. |
@@ -102,7 +86,6 @@ static inline void do_leds(void) | |||
102 | void timer_tick(void) | 86 | void timer_tick(void) |
103 | { | 87 | { |
104 | profile_tick(CPU_PROFILING); | 88 | profile_tick(CPU_PROFILING); |
105 | do_leds(); | ||
106 | xtime_update(1); | 89 | xtime_update(1); |
107 | #ifndef CONFIG_SMP | 90 | #ifndef CONFIG_SMP |
108 | update_process_times(user_mode(get_irq_regs())); | 91 | update_process_times(user_mode(get_irq_regs())); |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 01fb7325fecc..9ac427a702da 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -294,9 +294,9 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {} | |||
294 | * MMC / SD | 294 | * MMC / SD |
295 | * -------------------------------------------------------------------- */ | 295 | * -------------------------------------------------------------------- */ |
296 | 296 | ||
297 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 297 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
299 | static struct at91_mmc_data mmc_data; | 299 | static struct mci_platform_data mmc_data; |
300 | 300 | ||
301 | static struct resource mmc_resources[] = { | 301 | static struct resource mmc_resources[] = { |
302 | [0] = { | 302 | [0] = { |
@@ -312,7 +312,7 @@ static struct resource mmc_resources[] = { | |||
312 | }; | 312 | }; |
313 | 313 | ||
314 | static struct platform_device at91rm9200_mmc_device = { | 314 | static struct platform_device at91rm9200_mmc_device = { |
315 | .name = "at91_mci", | 315 | .name = "atmel_mci", |
316 | .id = -1, | 316 | .id = -1, |
317 | .dev = { | 317 | .dev = { |
318 | .dma_mask = &mmc_dmamask, | 318 | .dma_mask = &mmc_dmamask, |
@@ -323,53 +323,69 @@ static struct platform_device at91rm9200_mmc_device = { | |||
323 | .num_resources = ARRAY_SIZE(mmc_resources), | 323 | .num_resources = ARRAY_SIZE(mmc_resources), |
324 | }; | 324 | }; |
325 | 325 | ||
326 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 326 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) |
327 | { | 327 | { |
328 | unsigned int i; | ||
329 | unsigned int slot_count = 0; | ||
330 | |||
328 | if (!data) | 331 | if (!data) |
329 | return; | 332 | return; |
330 | 333 | ||
331 | /* input/irq */ | 334 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { |
332 | if (gpio_is_valid(data->det_pin)) { | ||
333 | at91_set_gpio_input(data->det_pin, 1); | ||
334 | at91_set_deglitch(data->det_pin, 1); | ||
335 | } | ||
336 | if (gpio_is_valid(data->wp_pin)) | ||
337 | at91_set_gpio_input(data->wp_pin, 1); | ||
338 | if (gpio_is_valid(data->vcc_pin)) | ||
339 | at91_set_gpio_output(data->vcc_pin, 0); | ||
340 | |||
341 | /* CLK */ | ||
342 | at91_set_A_periph(AT91_PIN_PA27, 0); | ||
343 | 335 | ||
344 | if (data->slot_b) { | 336 | if (!data->slot[i].bus_width) |
345 | /* CMD */ | 337 | continue; |
346 | at91_set_B_periph(AT91_PIN_PA8, 1); | ||
347 | 338 | ||
348 | /* DAT0, maybe DAT1..DAT3 */ | 339 | /* input/irq */ |
349 | at91_set_B_periph(AT91_PIN_PA9, 1); | 340 | if (gpio_is_valid(data->slot[i].detect_pin)) { |
350 | if (data->wire4) { | 341 | at91_set_gpio_input(data->slot[i].detect_pin, 1); |
351 | at91_set_B_periph(AT91_PIN_PA10, 1); | 342 | at91_set_deglitch(data->slot[i].detect_pin, 1); |
352 | at91_set_B_periph(AT91_PIN_PA11, 1); | ||
353 | at91_set_B_periph(AT91_PIN_PA12, 1); | ||
354 | } | 343 | } |
355 | } else { | 344 | if (gpio_is_valid(data->slot[i].wp_pin)) |
356 | /* CMD */ | 345 | at91_set_gpio_input(data->slot[i].wp_pin, 1); |
357 | at91_set_A_periph(AT91_PIN_PA28, 1); | 346 | |
358 | 347 | switch (i) { | |
359 | /* DAT0, maybe DAT1..DAT3 */ | 348 | case 0: /* slot A */ |
360 | at91_set_A_periph(AT91_PIN_PA29, 1); | 349 | /* CMD */ |
361 | if (data->wire4) { | 350 | at91_set_A_periph(AT91_PIN_PA28, 1); |
362 | at91_set_B_periph(AT91_PIN_PB3, 1); | 351 | /* DAT0, maybe DAT1..DAT3 */ |
363 | at91_set_B_periph(AT91_PIN_PB4, 1); | 352 | at91_set_A_periph(AT91_PIN_PA29, 1); |
364 | at91_set_B_periph(AT91_PIN_PB5, 1); | 353 | if (data->slot[i].bus_width == 4) { |
354 | at91_set_B_periph(AT91_PIN_PB3, 1); | ||
355 | at91_set_B_periph(AT91_PIN_PB4, 1); | ||
356 | at91_set_B_periph(AT91_PIN_PB5, 1); | ||
357 | } | ||
358 | slot_count++; | ||
359 | break; | ||
360 | case 1: /* slot B */ | ||
361 | /* CMD */ | ||
362 | at91_set_B_periph(AT91_PIN_PA8, 1); | ||
363 | /* DAT0, maybe DAT1..DAT3 */ | ||
364 | at91_set_B_periph(AT91_PIN_PA9, 1); | ||
365 | if (data->slot[i].bus_width == 4) { | ||
366 | at91_set_B_periph(AT91_PIN_PA10, 1); | ||
367 | at91_set_B_periph(AT91_PIN_PA11, 1); | ||
368 | at91_set_B_periph(AT91_PIN_PA12, 1); | ||
369 | } | ||
370 | slot_count++; | ||
371 | break; | ||
372 | default: | ||
373 | printk(KERN_ERR | ||
374 | "AT91: SD/MMC slot %d not available\n", i); | ||
375 | break; | ||
376 | } | ||
377 | if (slot_count) { | ||
378 | /* CLK */ | ||
379 | at91_set_A_periph(AT91_PIN_PA27, 0); | ||
380 | |||
381 | mmc_data = *data; | ||
382 | platform_device_register(&at91rm9200_mmc_device); | ||
365 | } | 383 | } |
366 | } | 384 | } |
367 | 385 | ||
368 | mmc_data = *data; | ||
369 | platform_device_register(&at91rm9200_mmc_device); | ||
370 | } | 386 | } |
371 | #else | 387 | #else |
372 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 388 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} |
373 | #endif | 389 | #endif |
374 | 390 | ||
375 | 391 | ||
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index bce572a530ef..af50ff3281c7 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -209,92 +209,10 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {} | |||
209 | 209 | ||
210 | 210 | ||
211 | /* -------------------------------------------------------------------- | 211 | /* -------------------------------------------------------------------- |
212 | * MMC / SD | ||
213 | * -------------------------------------------------------------------- */ | ||
214 | |||
215 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | ||
216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | ||
217 | static struct at91_mmc_data mmc_data; | ||
218 | |||
219 | static struct resource mmc_resources[] = { | ||
220 | [0] = { | ||
221 | .start = AT91SAM9260_BASE_MCI, | ||
222 | .end = AT91SAM9260_BASE_MCI + SZ_16K - 1, | ||
223 | .flags = IORESOURCE_MEM, | ||
224 | }, | ||
225 | [1] = { | ||
226 | .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI, | ||
227 | .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI, | ||
228 | .flags = IORESOURCE_IRQ, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | static struct platform_device at91sam9260_mmc_device = { | ||
233 | .name = "at91_mci", | ||
234 | .id = -1, | ||
235 | .dev = { | ||
236 | .dma_mask = &mmc_dmamask, | ||
237 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
238 | .platform_data = &mmc_data, | ||
239 | }, | ||
240 | .resource = mmc_resources, | ||
241 | .num_resources = ARRAY_SIZE(mmc_resources), | ||
242 | }; | ||
243 | |||
244 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | ||
245 | { | ||
246 | if (!data) | ||
247 | return; | ||
248 | |||
249 | /* input/irq */ | ||
250 | if (gpio_is_valid(data->det_pin)) { | ||
251 | at91_set_gpio_input(data->det_pin, 1); | ||
252 | at91_set_deglitch(data->det_pin, 1); | ||
253 | } | ||
254 | if (gpio_is_valid(data->wp_pin)) | ||
255 | at91_set_gpio_input(data->wp_pin, 1); | ||
256 | if (gpio_is_valid(data->vcc_pin)) | ||
257 | at91_set_gpio_output(data->vcc_pin, 0); | ||
258 | |||
259 | /* CLK */ | ||
260 | at91_set_A_periph(AT91_PIN_PA8, 0); | ||
261 | |||
262 | if (data->slot_b) { | ||
263 | /* CMD */ | ||
264 | at91_set_B_periph(AT91_PIN_PA1, 1); | ||
265 | |||
266 | /* DAT0, maybe DAT1..DAT3 */ | ||
267 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
268 | if (data->wire4) { | ||
269 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
270 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
271 | at91_set_B_periph(AT91_PIN_PA3, 1); | ||
272 | } | ||
273 | } else { | ||
274 | /* CMD */ | ||
275 | at91_set_A_periph(AT91_PIN_PA7, 1); | ||
276 | |||
277 | /* DAT0, maybe DAT1..DAT3 */ | ||
278 | at91_set_A_periph(AT91_PIN_PA6, 1); | ||
279 | if (data->wire4) { | ||
280 | at91_set_A_periph(AT91_PIN_PA9, 1); | ||
281 | at91_set_A_periph(AT91_PIN_PA10, 1); | ||
282 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
283 | } | ||
284 | } | ||
285 | |||
286 | mmc_data = *data; | ||
287 | platform_device_register(&at91sam9260_mmc_device); | ||
288 | } | ||
289 | #else | ||
290 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | ||
291 | #endif | ||
292 | |||
293 | /* -------------------------------------------------------------------- | ||
294 | * MMC / SD Slot for Atmel MCI Driver | 212 | * MMC / SD Slot for Atmel MCI Driver |
295 | * -------------------------------------------------------------------- */ | 213 | * -------------------------------------------------------------------- */ |
296 | 214 | ||
297 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | 215 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
298 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 216 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
299 | static struct mci_platform_data mmc_data; | 217 | static struct mci_platform_data mmc_data; |
300 | 218 | ||
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index bc2590d712d0..11e9fa835cde 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -137,9 +137,9 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
137 | * MMC / SD | 137 | * MMC / SD |
138 | * -------------------------------------------------------------------- */ | 138 | * -------------------------------------------------------------------- */ |
139 | 139 | ||
140 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 140 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
141 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 141 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
142 | static struct at91_mmc_data mmc_data; | 142 | static struct mci_platform_data mmc_data; |
143 | 143 | ||
144 | static struct resource mmc_resources[] = { | 144 | static struct resource mmc_resources[] = { |
145 | [0] = { | 145 | [0] = { |
@@ -155,7 +155,7 @@ static struct resource mmc_resources[] = { | |||
155 | }; | 155 | }; |
156 | 156 | ||
157 | static struct platform_device at91sam9261_mmc_device = { | 157 | static struct platform_device at91sam9261_mmc_device = { |
158 | .name = "at91_mci", | 158 | .name = "atmel_mci", |
159 | .id = -1, | 159 | .id = -1, |
160 | .dev = { | 160 | .dev = { |
161 | .dma_mask = &mmc_dmamask, | 161 | .dma_mask = &mmc_dmamask, |
@@ -166,40 +166,40 @@ static struct platform_device at91sam9261_mmc_device = { | |||
166 | .num_resources = ARRAY_SIZE(mmc_resources), | 166 | .num_resources = ARRAY_SIZE(mmc_resources), |
167 | }; | 167 | }; |
168 | 168 | ||
169 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 169 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) |
170 | { | 170 | { |
171 | if (!data) | 171 | if (!data) |
172 | return; | 172 | return; |
173 | 173 | ||
174 | /* input/irq */ | 174 | if (data->slot[0].bus_width) { |
175 | if (gpio_is_valid(data->det_pin)) { | 175 | /* input/irq */ |
176 | at91_set_gpio_input(data->det_pin, 1); | 176 | if (gpio_is_valid(data->slot[0].detect_pin)) { |
177 | at91_set_deglitch(data->det_pin, 1); | 177 | at91_set_gpio_input(data->slot[0].detect_pin, 1); |
178 | } | 178 | at91_set_deglitch(data->slot[0].detect_pin, 1); |
179 | if (gpio_is_valid(data->wp_pin)) | 179 | } |
180 | at91_set_gpio_input(data->wp_pin, 1); | 180 | if (gpio_is_valid(data->slot[0].wp_pin)) |
181 | if (gpio_is_valid(data->vcc_pin)) | 181 | at91_set_gpio_input(data->slot[0].wp_pin, 1); |
182 | at91_set_gpio_output(data->vcc_pin, 0); | 182 | |
183 | 183 | /* CLK */ | |
184 | /* CLK */ | 184 | at91_set_B_periph(AT91_PIN_PA2, 0); |
185 | at91_set_B_periph(AT91_PIN_PA2, 0); | ||
186 | |||
187 | /* CMD */ | ||
188 | at91_set_B_periph(AT91_PIN_PA1, 1); | ||
189 | |||
190 | /* DAT0, maybe DAT1..DAT3 */ | ||
191 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
192 | if (data->wire4) { | ||
193 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
194 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
195 | at91_set_B_periph(AT91_PIN_PA6, 1); | ||
196 | } | ||
197 | 185 | ||
198 | mmc_data = *data; | 186 | /* CMD */ |
199 | platform_device_register(&at91sam9261_mmc_device); | 187 | at91_set_B_periph(AT91_PIN_PA1, 1); |
188 | |||
189 | /* DAT0, maybe DAT1..DAT3 */ | ||
190 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
191 | if (data->slot[0].bus_width == 4) { | ||
192 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
193 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
194 | at91_set_B_periph(AT91_PIN_PA6, 1); | ||
195 | } | ||
196 | |||
197 | mmc_data = *data; | ||
198 | platform_device_register(&at91sam9261_mmc_device); | ||
199 | } | ||
200 | } | 200 | } |
201 | #else | 201 | #else |
202 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 202 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | 205 | ||
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 84b38105231e..144ef5de51b6 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -188,8 +188,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
188 | CLKDEV_CON_ID("hclk", &macb_clk), | 188 | CLKDEV_CON_ID("hclk", &macb_clk), |
189 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | 189 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), |
190 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 190 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
191 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), | 191 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), |
192 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.1", &mmc1_clk), | 192 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), |
193 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 193 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), | 195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 9b6ca734f1a9..7c0898fe20fa 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -218,9 +218,9 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {} | |||
218 | * MMC / SD | 218 | * MMC / SD |
219 | * -------------------------------------------------------------------- */ | 219 | * -------------------------------------------------------------------- */ |
220 | 220 | ||
221 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 221 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
222 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 222 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
223 | static struct at91_mmc_data mmc0_data, mmc1_data; | 223 | static struct mci_platform_data mmc0_data, mmc1_data; |
224 | 224 | ||
225 | static struct resource mmc0_resources[] = { | 225 | static struct resource mmc0_resources[] = { |
226 | [0] = { | 226 | [0] = { |
@@ -236,7 +236,7 @@ static struct resource mmc0_resources[] = { | |||
236 | }; | 236 | }; |
237 | 237 | ||
238 | static struct platform_device at91sam9263_mmc0_device = { | 238 | static struct platform_device at91sam9263_mmc0_device = { |
239 | .name = "at91_mci", | 239 | .name = "atmel_mci", |
240 | .id = 0, | 240 | .id = 0, |
241 | .dev = { | 241 | .dev = { |
242 | .dma_mask = &mmc_dmamask, | 242 | .dma_mask = &mmc_dmamask, |
@@ -261,7 +261,7 @@ static struct resource mmc1_resources[] = { | |||
261 | }; | 261 | }; |
262 | 262 | ||
263 | static struct platform_device at91sam9263_mmc1_device = { | 263 | static struct platform_device at91sam9263_mmc1_device = { |
264 | .name = "at91_mci", | 264 | .name = "atmel_mci", |
265 | .id = 1, | 265 | .id = 1, |
266 | .dev = { | 266 | .dev = { |
267 | .dma_mask = &mmc_dmamask, | 267 | .dma_mask = &mmc_dmamask, |
@@ -272,85 +272,110 @@ static struct platform_device at91sam9263_mmc1_device = { | |||
272 | .num_resources = ARRAY_SIZE(mmc1_resources), | 272 | .num_resources = ARRAY_SIZE(mmc1_resources), |
273 | }; | 273 | }; |
274 | 274 | ||
275 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 275 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) |
276 | { | 276 | { |
277 | unsigned int i; | ||
278 | unsigned int slot_count = 0; | ||
279 | |||
277 | if (!data) | 280 | if (!data) |
278 | return; | 281 | return; |
279 | 282 | ||
280 | /* input/irq */ | 283 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { |
281 | if (gpio_is_valid(data->det_pin)) { | ||
282 | at91_set_gpio_input(data->det_pin, 1); | ||
283 | at91_set_deglitch(data->det_pin, 1); | ||
284 | } | ||
285 | if (gpio_is_valid(data->wp_pin)) | ||
286 | at91_set_gpio_input(data->wp_pin, 1); | ||
287 | if (gpio_is_valid(data->vcc_pin)) | ||
288 | at91_set_gpio_output(data->vcc_pin, 0); | ||
289 | 284 | ||
290 | if (mmc_id == 0) { /* MCI0 */ | 285 | if (!data->slot[i].bus_width) |
291 | /* CLK */ | 286 | continue; |
292 | at91_set_A_periph(AT91_PIN_PA12, 0); | ||
293 | 287 | ||
294 | if (data->slot_b) { | 288 | /* input/irq */ |
295 | /* CMD */ | 289 | if (gpio_is_valid(data->slot[i].detect_pin)) { |
296 | at91_set_A_periph(AT91_PIN_PA16, 1); | 290 | at91_set_gpio_input(data->slot[i].detect_pin, |
291 | 1); | ||
292 | at91_set_deglitch(data->slot[i].detect_pin, | ||
293 | 1); | ||
294 | } | ||
295 | if (gpio_is_valid(data->slot[i].wp_pin)) | ||
296 | at91_set_gpio_input(data->slot[i].wp_pin, 1); | ||
297 | |||
298 | if (mmc_id == 0) { /* MCI0 */ | ||
299 | switch (i) { | ||
300 | case 0: /* slot A */ | ||
301 | /* CMD */ | ||
302 | at91_set_A_periph(AT91_PIN_PA1, 1); | ||
303 | /* DAT0, maybe DAT1..DAT3 */ | ||
304 | at91_set_A_periph(AT91_PIN_PA0, 1); | ||
305 | if (data->slot[i].bus_width == 4) { | ||
306 | at91_set_A_periph(AT91_PIN_PA3, 1); | ||
307 | at91_set_A_periph(AT91_PIN_PA4, 1); | ||
308 | at91_set_A_periph(AT91_PIN_PA5, 1); | ||
309 | } | ||
310 | slot_count++; | ||
311 | break; | ||
312 | case 1: /* slot B */ | ||
313 | /* CMD */ | ||
314 | at91_set_A_periph(AT91_PIN_PA16, 1); | ||
315 | /* DAT0, maybe DAT1..DAT3 */ | ||
316 | at91_set_A_periph(AT91_PIN_PA17, 1); | ||
317 | if (data->slot[i].bus_width == 4) { | ||
318 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
319 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
320 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
321 | } | ||
322 | slot_count++; | ||
323 | break; | ||
324 | default: | ||
325 | printk(KERN_ERR | ||
326 | "AT91: SD/MMC slot %d not available\n", i); | ||
327 | break; | ||
328 | } | ||
329 | if (slot_count) { | ||
330 | /* CLK */ | ||
331 | at91_set_A_periph(AT91_PIN_PA12, 0); | ||
297 | 332 | ||
298 | /* DAT0, maybe DAT1..DAT3 */ | 333 | mmc0_data = *data; |
299 | at91_set_A_periph(AT91_PIN_PA17, 1); | 334 | platform_device_register(&at91sam9263_mmc0_device); |
300 | if (data->wire4) { | ||
301 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
302 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
303 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
304 | } | 335 | } |
305 | } else { | 336 | } else if (mmc_id == 1) { /* MCI1 */ |
306 | /* CMD */ | 337 | switch (i) { |
307 | at91_set_A_periph(AT91_PIN_PA1, 1); | 338 | case 0: /* slot A */ |
308 | 339 | /* CMD */ | |
309 | /* DAT0, maybe DAT1..DAT3 */ | 340 | at91_set_A_periph(AT91_PIN_PA7, 1); |
310 | at91_set_A_periph(AT91_PIN_PA0, 1); | 341 | /* DAT0, maybe DAT1..DAT3 */ |
311 | if (data->wire4) { | 342 | at91_set_A_periph(AT91_PIN_PA8, 1); |
312 | at91_set_A_periph(AT91_PIN_PA3, 1); | 343 | if (data->slot[i].bus_width == 4) { |
313 | at91_set_A_periph(AT91_PIN_PA4, 1); | 344 | at91_set_A_periph(AT91_PIN_PA9, 1); |
314 | at91_set_A_periph(AT91_PIN_PA5, 1); | 345 | at91_set_A_periph(AT91_PIN_PA10, 1); |
346 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
347 | } | ||
348 | slot_count++; | ||
349 | break; | ||
350 | case 1: /* slot B */ | ||
351 | /* CMD */ | ||
352 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
353 | /* DAT0, maybe DAT1..DAT3 */ | ||
354 | at91_set_A_periph(AT91_PIN_PA22, 1); | ||
355 | if (data->slot[i].bus_width == 4) { | ||
356 | at91_set_A_periph(AT91_PIN_PA23, 1); | ||
357 | at91_set_A_periph(AT91_PIN_PA24, 1); | ||
358 | at91_set_A_periph(AT91_PIN_PA25, 1); | ||
359 | } | ||
360 | slot_count++; | ||
361 | break; | ||
362 | default: | ||
363 | printk(KERN_ERR | ||
364 | "AT91: SD/MMC slot %d not available\n", i); | ||
365 | break; | ||
315 | } | 366 | } |
316 | } | 367 | if (slot_count) { |
368 | /* CLK */ | ||
369 | at91_set_A_periph(AT91_PIN_PA6, 0); | ||
317 | 370 | ||
318 | mmc0_data = *data; | 371 | mmc1_data = *data; |
319 | platform_device_register(&at91sam9263_mmc0_device); | 372 | platform_device_register(&at91sam9263_mmc1_device); |
320 | } else { /* MCI1 */ | ||
321 | /* CLK */ | ||
322 | at91_set_A_periph(AT91_PIN_PA6, 0); | ||
323 | |||
324 | if (data->slot_b) { | ||
325 | /* CMD */ | ||
326 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
327 | |||
328 | /* DAT0, maybe DAT1..DAT3 */ | ||
329 | at91_set_A_periph(AT91_PIN_PA22, 1); | ||
330 | if (data->wire4) { | ||
331 | at91_set_A_periph(AT91_PIN_PA23, 1); | ||
332 | at91_set_A_periph(AT91_PIN_PA24, 1); | ||
333 | at91_set_A_periph(AT91_PIN_PA25, 1); | ||
334 | } | ||
335 | } else { | ||
336 | /* CMD */ | ||
337 | at91_set_A_periph(AT91_PIN_PA7, 1); | ||
338 | |||
339 | /* DAT0, maybe DAT1..DAT3 */ | ||
340 | at91_set_A_periph(AT91_PIN_PA8, 1); | ||
341 | if (data->wire4) { | ||
342 | at91_set_A_periph(AT91_PIN_PA9, 1); | ||
343 | at91_set_A_periph(AT91_PIN_PA10, 1); | ||
344 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
345 | } | 373 | } |
346 | } | 374 | } |
347 | |||
348 | mmc1_data = *data; | ||
349 | platform_device_register(&at91sam9263_mmc1_device); | ||
350 | } | 375 | } |
351 | } | 376 | } |
352 | #else | 377 | #else |
353 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 378 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} |
354 | #endif | 379 | #endif |
355 | 380 | ||
356 | /* -------------------------------------------------------------------- | 381 | /* -------------------------------------------------------------------- |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index dcda24838b5a..deafea0e493d 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -161,9 +161,9 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {} | |||
161 | * MMC / SD | 161 | * MMC / SD |
162 | * -------------------------------------------------------------------- */ | 162 | * -------------------------------------------------------------------- */ |
163 | 163 | ||
164 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 164 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) |
165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
166 | static struct at91_mmc_data mmc_data; | 166 | static struct mci_platform_data mmc_data; |
167 | 167 | ||
168 | static struct resource mmc_resources[] = { | 168 | static struct resource mmc_resources[] = { |
169 | [0] = { | 169 | [0] = { |
@@ -179,7 +179,7 @@ static struct resource mmc_resources[] = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct platform_device at91sam9rl_mmc_device = { | 181 | static struct platform_device at91sam9rl_mmc_device = { |
182 | .name = "at91_mci", | 182 | .name = "atmel_mci", |
183 | .id = -1, | 183 | .id = -1, |
184 | .dev = { | 184 | .dev = { |
185 | .dma_mask = &mmc_dmamask, | 185 | .dma_mask = &mmc_dmamask, |
@@ -190,40 +190,40 @@ static struct platform_device at91sam9rl_mmc_device = { | |||
190 | .num_resources = ARRAY_SIZE(mmc_resources), | 190 | .num_resources = ARRAY_SIZE(mmc_resources), |
191 | }; | 191 | }; |
192 | 192 | ||
193 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | 193 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) |
194 | { | 194 | { |
195 | if (!data) | 195 | if (!data) |
196 | return; | 196 | return; |
197 | 197 | ||
198 | /* input/irq */ | 198 | if (data->slot[0].bus_width) { |
199 | if (gpio_is_valid(data->det_pin)) { | 199 | /* input/irq */ |
200 | at91_set_gpio_input(data->det_pin, 1); | 200 | if (gpio_is_valid(data->slot[0].detect_pin)) { |
201 | at91_set_deglitch(data->det_pin, 1); | 201 | at91_set_gpio_input(data->slot[0].detect_pin, 1); |
202 | } | 202 | at91_set_deglitch(data->slot[0].detect_pin, 1); |
203 | if (gpio_is_valid(data->wp_pin)) | 203 | } |
204 | at91_set_gpio_input(data->wp_pin, 1); | 204 | if (gpio_is_valid(data->slot[0].wp_pin)) |
205 | if (gpio_is_valid(data->vcc_pin)) | 205 | at91_set_gpio_input(data->slot[0].wp_pin, 1); |
206 | at91_set_gpio_output(data->vcc_pin, 0); | 206 | |
207 | 207 | /* CLK */ | |
208 | /* CLK */ | 208 | at91_set_A_periph(AT91_PIN_PA2, 0); |
209 | at91_set_A_periph(AT91_PIN_PA2, 0); | 209 | |
210 | 210 | /* CMD */ | |
211 | /* CMD */ | 211 | at91_set_A_periph(AT91_PIN_PA1, 1); |
212 | at91_set_A_periph(AT91_PIN_PA1, 1); | 212 | |
213 | 213 | /* DAT0, maybe DAT1..DAT3 */ | |
214 | /* DAT0, maybe DAT1..DAT3 */ | 214 | at91_set_A_periph(AT91_PIN_PA0, 1); |
215 | at91_set_A_periph(AT91_PIN_PA0, 1); | 215 | if (data->slot[0].bus_width == 4) { |
216 | if (data->wire4) { | 216 | at91_set_A_periph(AT91_PIN_PA3, 1); |
217 | at91_set_A_periph(AT91_PIN_PA3, 1); | 217 | at91_set_A_periph(AT91_PIN_PA4, 1); |
218 | at91_set_A_periph(AT91_PIN_PA4, 1); | 218 | at91_set_A_periph(AT91_PIN_PA5, 1); |
219 | at91_set_A_periph(AT91_PIN_PA5, 1); | 219 | } |
220 | |||
221 | mmc_data = *data; | ||
222 | platform_device_register(&at91sam9rl_mmc_device); | ||
220 | } | 223 | } |
221 | |||
222 | mmc_data = *data; | ||
223 | platform_device_register(&at91sam9rl_mmc_device); | ||
224 | } | 224 | } |
225 | #else | 225 | #else |
226 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} | 226 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} |
227 | #endif | 227 | #endif |
228 | 228 | ||
229 | 229 | ||
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c index de7be1931817..93a832f70232 100644 --- a/arch/arm/mach-at91/board-afeb-9260v1.c +++ b/arch/arm/mach-at91/board-afeb-9260v1.c | |||
@@ -133,12 +133,12 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = { | |||
133 | /* | 133 | /* |
134 | * MCI (SD/MMC) | 134 | * MCI (SD/MMC) |
135 | */ | 135 | */ |
136 | static struct at91_mmc_data __initdata afeb9260_mmc_data = { | 136 | static struct mci_platform_data __initdata afeb9260_mci0_data = { |
137 | .det_pin = AT91_PIN_PC9, | 137 | .slot[1] = { |
138 | .wp_pin = AT91_PIN_PC4, | 138 | .bus_width = 4, |
139 | .slot_b = 1, | 139 | .detect_pin = AT91_PIN_PC9, |
140 | .wire4 = 1, | 140 | .wp_pin = AT91_PIN_PC4, |
141 | .vcc_pin = -EINVAL, | 141 | }, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | 144 | ||
@@ -199,7 +199,7 @@ static void __init afeb9260_board_init(void) | |||
199 | at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ | 199 | at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ |
200 | at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ | 200 | at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ |
201 | /* MMC */ | 201 | /* MMC */ |
202 | at91_add_device_mmc(0, &afeb9260_mmc_data); | 202 | at91_add_device_mci(0, &afeb9260_mci0_data); |
203 | /* I2C */ | 203 | /* I2C */ |
204 | at91_add_device_i2c(afeb9260_i2c_devices, | 204 | at91_add_device_i2c(afeb9260_i2c_devices, |
205 | ARRAY_SIZE(afeb9260_i2c_devices)); | 205 | ARRAY_SIZE(afeb9260_i2c_devices)); |
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c index a5b002f32a61..71d8f362a1d5 100644 --- a/arch/arm/mach-at91/board-carmeva.c +++ b/arch/arm/mach-at91/board-carmeva.c | |||
@@ -71,12 +71,12 @@ static struct at91_udc_data __initdata carmeva_udc_data = { | |||
71 | // .vcc_pin = -EINVAL, | 71 | // .vcc_pin = -EINVAL, |
72 | // }; | 72 | // }; |
73 | 73 | ||
74 | static struct at91_mmc_data __initdata carmeva_mmc_data = { | 74 | static struct mci_platform_data __initdata carmeva_mci0_data = { |
75 | .slot_b = 0, | 75 | .slot[0] = { |
76 | .wire4 = 1, | 76 | .bus_width = 4, |
77 | .det_pin = AT91_PIN_PB10, | 77 | .detect_pin = AT91_PIN_PB10, |
78 | .wp_pin = AT91_PIN_PC14, | 78 | .wp_pin = AT91_PIN_PC14, |
79 | .vcc_pin = -EINVAL, | 79 | }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static struct spi_board_info carmeva_spi_devices[] = { | 82 | static struct spi_board_info carmeva_spi_devices[] = { |
@@ -150,7 +150,7 @@ static void __init carmeva_board_init(void) | |||
150 | /* Compact Flash */ | 150 | /* Compact Flash */ |
151 | // at91_add_device_cf(&carmeva_cf_data); | 151 | // at91_add_device_cf(&carmeva_cf_data); |
152 | /* MMC */ | 152 | /* MMC */ |
153 | at91_add_device_mmc(0, &carmeva_mmc_data); | 153 | at91_add_device_mci(0, &carmeva_mci0_data); |
154 | /* LEDs */ | 154 | /* LEDs */ |
155 | at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds)); | 155 | at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds)); |
156 | } | 156 | } |
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c index ecbc13b594de..e71c473316e3 100644 --- a/arch/arm/mach-at91/board-cpu9krea.c +++ b/arch/arm/mach-at91/board-cpu9krea.c | |||
@@ -254,8 +254,7 @@ static struct gpio_led cpu9krea_leds[] = { | |||
254 | 254 | ||
255 | static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = { | 255 | static struct i2c_board_info __initdata cpu9krea_i2c_devices[] = { |
256 | { | 256 | { |
257 | I2C_BOARD_INFO("rtc-ds1307", 0x68), | 257 | I2C_BOARD_INFO("ds1339", 0x68), |
258 | .type = "ds1339", | ||
259 | }, | 258 | }, |
260 | }; | 259 | }; |
261 | 260 | ||
@@ -312,12 +311,12 @@ static void __init cpu9krea_add_device_buttons(void) | |||
312 | /* | 311 | /* |
313 | * MCI (SD/MMC) | 312 | * MCI (SD/MMC) |
314 | */ | 313 | */ |
315 | static struct at91_mmc_data __initdata cpu9krea_mmc_data = { | 314 | static struct mci_platform_data __initdata cpu9krea_mci0_data = { |
316 | .slot_b = 0, | 315 | .slot[0] = { |
317 | .wire4 = 1, | 316 | .bus_width = 4, |
318 | .det_pin = AT91_PIN_PA29, | 317 | .detect_pin = AT91_PIN_PA29, |
319 | .wp_pin = -EINVAL, | 318 | .wp_pin = -EINVAL, |
320 | .vcc_pin = -EINVAL, | 319 | }, |
321 | }; | 320 | }; |
322 | 321 | ||
323 | static void __init cpu9krea_board_init(void) | 322 | static void __init cpu9krea_board_init(void) |
@@ -359,7 +358,7 @@ static void __init cpu9krea_board_init(void) | |||
359 | /* Ethernet */ | 358 | /* Ethernet */ |
360 | at91_add_device_eth(&cpu9krea_macb_data); | 359 | at91_add_device_eth(&cpu9krea_macb_data); |
361 | /* MMC */ | 360 | /* MMC */ |
362 | at91_add_device_mmc(0, &cpu9krea_mmc_data); | 361 | at91_add_device_mci(0, &cpu9krea_mci0_data); |
363 | /* I2C */ | 362 | /* I2C */ |
364 | at91_add_device_i2c(cpu9krea_i2c_devices, | 363 | at91_add_device_i2c(cpu9krea_i2c_devices, |
365 | ARRAY_SIZE(cpu9krea_i2c_devices)); | 364 | ARRAY_SIZE(cpu9krea_i2c_devices)); |
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c index 2e6d043c82f2..2cbd1a2b6c35 100644 --- a/arch/arm/mach-at91/board-cpuat91.c +++ b/arch/arm/mach-at91/board-cpuat91.c | |||
@@ -78,11 +78,12 @@ static struct at91_udc_data __initdata cpuat91_udc_data = { | |||
78 | .pullup_pin = AT91_PIN_PC14, | 78 | .pullup_pin = AT91_PIN_PC14, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { | 81 | static struct mci_platform_data __initdata cpuat91_mci0_data = { |
82 | .det_pin = AT91_PIN_PC2, | 82 | .slot[0] = { |
83 | .wire4 = 1, | 83 | .bus_width = 4, |
84 | .wp_pin = -EINVAL, | 84 | .detect_pin = AT91_PIN_PC2, |
85 | .vcc_pin = -EINVAL, | 85 | .wp_pin = -EINVAL, |
86 | }, | ||
86 | }; | 87 | }; |
87 | 88 | ||
88 | static struct physmap_flash_data cpuat91_flash_data = { | 89 | static struct physmap_flash_data cpuat91_flash_data = { |
@@ -168,7 +169,7 @@ static void __init cpuat91_board_init(void) | |||
168 | /* USB Device */ | 169 | /* USB Device */ |
169 | at91_add_device_udc(&cpuat91_udc_data); | 170 | at91_add_device_udc(&cpuat91_udc_data); |
170 | /* MMC */ | 171 | /* MMC */ |
171 | at91_add_device_mmc(0, &cpuat91_mmc_data); | 172 | at91_add_device_mci(0, &cpuat91_mci0_data); |
172 | /* I2C */ | 173 | /* I2C */ |
173 | at91_add_device_i2c(NULL, 0); | 174 | at91_add_device_i2c(NULL, 0); |
174 | /* Platform devices */ | 175 | /* Platform devices */ |
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index 462bc319cbc5..3e37437a7a61 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -87,12 +87,12 @@ static struct at91_cf_data __initdata csb337_cf_data = { | |||
87 | .rst_pin = AT91_PIN_PD2, | 87 | .rst_pin = AT91_PIN_PD2, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static struct at91_mmc_data __initdata csb337_mmc_data = { | 90 | static struct mci_platform_data __initdata csb337_mci0_data = { |
91 | .det_pin = AT91_PIN_PD5, | 91 | .slot[0] = { |
92 | .slot_b = 0, | 92 | .bus_width = 4, |
93 | .wire4 = 1, | 93 | .detect_pin = AT91_PIN_PD5, |
94 | .wp_pin = AT91_PIN_PD6, | 94 | .wp_pin = AT91_PIN_PD6, |
95 | .vcc_pin = -EINVAL, | 95 | }, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static struct spi_board_info csb337_spi_devices[] = { | 98 | static struct spi_board_info csb337_spi_devices[] = { |
@@ -220,8 +220,6 @@ static struct gpio_led csb_leds[] = { | |||
220 | 220 | ||
221 | static void __init csb337_board_init(void) | 221 | static void __init csb337_board_init(void) |
222 | { | 222 | { |
223 | /* Setup the LEDs */ | ||
224 | at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); | ||
225 | /* Serial */ | 223 | /* Serial */ |
226 | /* DBGU on ttyS0 */ | 224 | /* DBGU on ttyS0 */ |
227 | at91_register_uart(0, 0, 0); | 225 | at91_register_uart(0, 0, 0); |
@@ -240,7 +238,7 @@ static void __init csb337_board_init(void) | |||
240 | /* SPI */ | 238 | /* SPI */ |
241 | at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices)); | 239 | at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices)); |
242 | /* MMC */ | 240 | /* MMC */ |
243 | at91_add_device_mmc(0, &csb337_mmc_data); | 241 | at91_add_device_mci(0, &csb337_mci0_data); |
244 | /* NOR flash */ | 242 | /* NOR flash */ |
245 | platform_device_register(&csb_flash); | 243 | platform_device_register(&csb_flash); |
246 | /* LEDs */ | 244 | /* LEDs */ |
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c index d1e1f3fc0a47..0cfac16ee9d5 100644 --- a/arch/arm/mach-at91/board-eb9200.c +++ b/arch/arm/mach-at91/board-eb9200.c | |||
@@ -70,12 +70,12 @@ static struct at91_cf_data __initdata eb9200_cf_data = { | |||
70 | .rst_pin = AT91_PIN_PC5, | 70 | .rst_pin = AT91_PIN_PC5, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static struct at91_mmc_data __initdata eb9200_mmc_data = { | 73 | static struct mci_platform_data __initdata eb9200_mci0_data = { |
74 | .slot_b = 0, | 74 | .slot[0] = { |
75 | .wire4 = 1, | 75 | .bus_width = 4, |
76 | .det_pin = -EINVAL, | 76 | .detect_pin = -EINVAL, |
77 | .wp_pin = -EINVAL, | 77 | .wp_pin = -EINVAL, |
78 | .vcc_pin = -EINVAL, | 78 | }, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { | 81 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { |
@@ -113,7 +113,7 @@ static void __init eb9200_board_init(void) | |||
113 | at91_add_device_spi(NULL, 0); | 113 | at91_add_device_spi(NULL, 0); |
114 | /* MMC */ | 114 | /* MMC */ |
115 | /* only supports 1 or 4 bit interface, not wired through to SPI */ | 115 | /* only supports 1 or 4 bit interface, not wired through to SPI */ |
116 | at91_add_device_mmc(0, &eb9200_mmc_data); | 116 | at91_add_device_mci(0, &eb9200_mci0_data); |
117 | } | 117 | } |
118 | 118 | ||
119 | MACHINE_START(ATEB9200, "Embest ATEB9200") | 119 | MACHINE_START(ATEB9200, "Embest ATEB9200") |
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c index 9c24cb25707c..3d931ffac4bf 100644 --- a/arch/arm/mach-at91/board-ecbat91.c +++ b/arch/arm/mach-at91/board-ecbat91.c | |||
@@ -64,12 +64,12 @@ static struct at91_usbh_data __initdata ecb_at91usbh_data = { | |||
64 | .overcurrent_pin= {-EINVAL, -EINVAL}, | 64 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static struct at91_mmc_data __initdata ecb_at91mmc_data = { | 67 | static struct mci_platform_data __initdata ecbat91_mci0_data = { |
68 | .slot_b = 0, | 68 | .slot[0] = { |
69 | .wire4 = 1, | 69 | .bus_width = 4, |
70 | .det_pin = -EINVAL, | 70 | .detect_pin = -EINVAL, |
71 | .wp_pin = -EINVAL, | 71 | .wp_pin = -EINVAL, |
72 | .vcc_pin = -EINVAL, | 72 | }, |
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
@@ -138,11 +138,20 @@ static struct spi_board_info __initdata ecb_at91spi_devices[] = { | |||
138 | }, | 138 | }, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | /* | ||
142 | * LEDs | ||
143 | */ | ||
144 | static struct gpio_led ecb_leds[] = { | ||
145 | { /* D1 */ | ||
146 | .name = "led1", | ||
147 | .gpio = AT91_PIN_PC7, | ||
148 | .active_low = 1, | ||
149 | .default_trigger = "heartbeat", | ||
150 | } | ||
151 | }; | ||
152 | |||
141 | static void __init ecb_at91board_init(void) | 153 | static void __init ecb_at91board_init(void) |
142 | { | 154 | { |
143 | /* Setup the LEDs */ | ||
144 | at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7); | ||
145 | |||
146 | /* Serial */ | 155 | /* Serial */ |
147 | /* DBGU on ttyS0. (Rx & Tx only) */ | 156 | /* DBGU on ttyS0. (Rx & Tx only) */ |
148 | at91_register_uart(0, 0, 0); | 157 | at91_register_uart(0, 0, 0); |
@@ -161,10 +170,13 @@ static void __init ecb_at91board_init(void) | |||
161 | at91_add_device_i2c(NULL, 0); | 170 | at91_add_device_i2c(NULL, 0); |
162 | 171 | ||
163 | /* MMC */ | 172 | /* MMC */ |
164 | at91_add_device_mmc(0, &ecb_at91mmc_data); | 173 | at91_add_device_mci(0, &ecbat91_mci0_data); |
165 | 174 | ||
166 | /* SPI */ | 175 | /* SPI */ |
167 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); | 176 | at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); |
177 | |||
178 | /* LEDs */ | ||
179 | at91_gpio_leds(ecb_leds, ARRAY_SIZE(ecb_leds)); | ||
168 | } | 180 | } |
169 | 181 | ||
170 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") | 182 | MACHINE_START(ECBAT91, "emQbit's ECB_AT91") |
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c index 82bdfde3405f..d93658a2b128 100644 --- a/arch/arm/mach-at91/board-eco920.c +++ b/arch/arm/mach-at91/board-eco920.c | |||
@@ -56,12 +56,12 @@ static struct at91_udc_data __initdata eco920_udc_data = { | |||
56 | .pullup_pin = AT91_PIN_PB13, | 56 | .pullup_pin = AT91_PIN_PB13, |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static struct at91_mmc_data __initdata eco920_mmc_data = { | 59 | static struct mci_platform_data __initdata eco920_mci0_data = { |
60 | .slot_b = 0, | 60 | .slot[0] = { |
61 | .wire4 = 0, | 61 | .bus_width = 1, |
62 | .det_pin = -EINVAL, | 62 | .detect_pin = -EINVAL, |
63 | .wp_pin = -EINVAL, | 63 | .wp_pin = -EINVAL, |
64 | .vcc_pin = -EINVAL, | 64 | }, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static struct physmap_flash_data eco920_flash_data = { | 67 | static struct physmap_flash_data eco920_flash_data = { |
@@ -93,10 +93,26 @@ static struct spi_board_info eco920_spi_devices[] = { | |||
93 | }, | 93 | }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /* | ||
97 | * LEDs | ||
98 | */ | ||
99 | static struct gpio_led eco920_leds[] = { | ||
100 | { /* D1 */ | ||
101 | .name = "led1", | ||
102 | .gpio = AT91_PIN_PB0, | ||
103 | .active_low = 1, | ||
104 | .default_trigger = "heartbeat", | ||
105 | }, | ||
106 | { /* D2 */ | ||
107 | .name = "led2", | ||
108 | .gpio = AT91_PIN_PB1, | ||
109 | .active_low = 1, | ||
110 | .default_trigger = "timer", | ||
111 | } | ||
112 | }; | ||
113 | |||
96 | static void __init eco920_board_init(void) | 114 | static void __init eco920_board_init(void) |
97 | { | 115 | { |
98 | /* Setup the LEDs */ | ||
99 | at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1); | ||
100 | /* DBGU on ttyS0. (Rx & Tx only */ | 116 | /* DBGU on ttyS0. (Rx & Tx only */ |
101 | at91_register_uart(0, 0, 0); | 117 | at91_register_uart(0, 0, 0); |
102 | at91_add_device_serial(); | 118 | at91_add_device_serial(); |
@@ -104,7 +120,7 @@ static void __init eco920_board_init(void) | |||
104 | at91_add_device_usbh(&eco920_usbh_data); | 120 | at91_add_device_usbh(&eco920_usbh_data); |
105 | at91_add_device_udc(&eco920_udc_data); | 121 | at91_add_device_udc(&eco920_udc_data); |
106 | 122 | ||
107 | at91_add_device_mmc(0, &eco920_mmc_data); | 123 | at91_add_device_mci(0, &eco920_mci0_data); |
108 | platform_device_register(&eco920_flash); | 124 | platform_device_register(&eco920_flash); |
109 | 125 | ||
110 | at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) | 126 | at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) |
@@ -127,6 +143,8 @@ static void __init eco920_board_init(void) | |||
127 | ); | 143 | ); |
128 | 144 | ||
129 | at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); | 145 | at91_add_device_spi(eco920_spi_devices, ARRAY_SIZE(eco920_spi_devices)); |
146 | /* LEDs */ | ||
147 | at91_gpio_leds(eco920_leds, ARRAY_SIZE(eco920_leds)); | ||
130 | } | 148 | } |
131 | 149 | ||
132 | MACHINE_START(ECO920, "eco920") | 150 | MACHINE_START(ECO920, "eco920") |
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c index 6cc83a87d77c..fa98abacb1ba 100644 --- a/arch/arm/mach-at91/board-flexibity.c +++ b/arch/arm/mach-at91/board-flexibity.c | |||
@@ -75,12 +75,12 @@ static struct spi_board_info flexibity_spi_devices[] = { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | /* MCI (SD/MMC) */ | 77 | /* MCI (SD/MMC) */ |
78 | static struct at91_mmc_data __initdata flexibity_mmc_data = { | 78 | static struct mci_platform_data __initdata flexibity_mci0_data = { |
79 | .slot_b = 0, | 79 | .slot[0] = { |
80 | .wire4 = 1, | 80 | .bus_width = 4, |
81 | .det_pin = AT91_PIN_PC9, | 81 | .detect_pin = AT91_PIN_PC9, |
82 | .wp_pin = AT91_PIN_PC4, | 82 | .wp_pin = AT91_PIN_PC4, |
83 | .vcc_pin = -EINVAL, | 83 | }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /* LEDs */ | 86 | /* LEDs */ |
@@ -152,7 +152,7 @@ static void __init flexibity_board_init(void) | |||
152 | at91_add_device_spi(flexibity_spi_devices, | 152 | at91_add_device_spi(flexibity_spi_devices, |
153 | ARRAY_SIZE(flexibity_spi_devices)); | 153 | ARRAY_SIZE(flexibity_spi_devices)); |
154 | /* MMC */ | 154 | /* MMC */ |
155 | at91_add_device_mmc(0, &flexibity_mmc_data); | 155 | at91_add_device_mci(0, &flexibity_mci0_data); |
156 | /* LEDs */ | 156 | /* LEDs */ |
157 | at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); | 157 | at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); |
158 | } | 158 | } |
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c index 69ab1247ef81..6e47071d8206 100644 --- a/arch/arm/mach-at91/board-foxg20.c +++ b/arch/arm/mach-at91/board-foxg20.c | |||
@@ -86,7 +86,7 @@ static struct at91_udc_data __initdata foxg20_udc_data = { | |||
86 | * SPI devices. | 86 | * SPI devices. |
87 | */ | 87 | */ |
88 | static struct spi_board_info foxg20_spi_devices[] = { | 88 | static struct spi_board_info foxg20_spi_devices[] = { |
89 | #if !defined(CONFIG_MMC_AT91) | 89 | #if !IS_ENABLED(CONFIG_MMC_ATMELMCI) |
90 | { | 90 | { |
91 | .modalias = "mtd_dataflash", | 91 | .modalias = "mtd_dataflash", |
92 | .chip_select = 1, | 92 | .chip_select = 1, |
@@ -109,12 +109,12 @@ static struct macb_platform_data __initdata foxg20_macb_data = { | |||
109 | * MCI (SD/MMC) | 109 | * MCI (SD/MMC) |
110 | * det_pin, wp_pin and vcc_pin are not connected | 110 | * det_pin, wp_pin and vcc_pin are not connected |
111 | */ | 111 | */ |
112 | static struct at91_mmc_data __initdata foxg20_mmc_data = { | 112 | static struct mci_platform_data __initdata foxg20_mci0_data = { |
113 | .slot_b = 1, | 113 | .slot[1] = { |
114 | .wire4 = 1, | 114 | .bus_width = 4, |
115 | .det_pin = -EINVAL, | 115 | .detect_pin = -EINVAL, |
116 | .wp_pin = -EINVAL, | 116 | .wp_pin = -EINVAL, |
117 | .vcc_pin = -EINVAL, | 117 | }, |
118 | }; | 118 | }; |
119 | 119 | ||
120 | 120 | ||
@@ -247,7 +247,7 @@ static void __init foxg20_board_init(void) | |||
247 | /* Ethernet */ | 247 | /* Ethernet */ |
248 | at91_add_device_eth(&foxg20_macb_data); | 248 | at91_add_device_eth(&foxg20_macb_data); |
249 | /* MMC */ | 249 | /* MMC */ |
250 | at91_add_device_mmc(0, &foxg20_mmc_data); | 250 | at91_add_device_mci(0, &foxg20_mci0_data); |
251 | /* I2C */ | 251 | /* I2C */ |
252 | at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices)); | 252 | at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices)); |
253 | /* LEDs */ | 253 | /* LEDs */ |
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c index 64c1dbf88a07..86050da3ba53 100644 --- a/arch/arm/mach-at91/board-kafa.c +++ b/arch/arm/mach-at91/board-kafa.c | |||
@@ -66,11 +66,20 @@ static struct at91_udc_data __initdata kafa_udc_data = { | |||
66 | .pullup_pin = AT91_PIN_PB7, | 66 | .pullup_pin = AT91_PIN_PB7, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /* | ||
70 | * LEDs | ||
71 | */ | ||
72 | static struct gpio_led kafa_leds[] = { | ||
73 | { /* D1 */ | ||
74 | .name = "led1", | ||
75 | .gpio = AT91_PIN_PB4, | ||
76 | .active_low = 1, | ||
77 | .default_trigger = "heartbeat", | ||
78 | }, | ||
79 | }; | ||
80 | |||
69 | static void __init kafa_board_init(void) | 81 | static void __init kafa_board_init(void) |
70 | { | 82 | { |
71 | /* Set up the LEDs */ | ||
72 | at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4); | ||
73 | |||
74 | /* Serial */ | 83 | /* Serial */ |
75 | /* DBGU on ttyS0. (Rx & Tx only) */ | 84 | /* DBGU on ttyS0. (Rx & Tx only) */ |
76 | at91_register_uart(0, 0, 0); | 85 | at91_register_uart(0, 0, 0); |
@@ -88,6 +97,8 @@ static void __init kafa_board_init(void) | |||
88 | at91_add_device_i2c(NULL, 0); | 97 | at91_add_device_i2c(NULL, 0); |
89 | /* SPI */ | 98 | /* SPI */ |
90 | at91_add_device_spi(NULL, 0); | 99 | at91_add_device_spi(NULL, 0); |
100 | /* LEDs */ | ||
101 | at91_gpio_leds(kafa_leds, ARRAY_SIZE(kafa_leds)); | ||
91 | } | 102 | } |
92 | 103 | ||
93 | MACHINE_START(KAFA, "Sperry-Sun KAFA") | 104 | MACHINE_START(KAFA, "Sperry-Sun KAFA") |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index 5d96cb85175f..abe9fed7a3e0 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
@@ -69,12 +69,12 @@ static struct at91_udc_data __initdata kb9202_udc_data = { | |||
69 | .pullup_pin = AT91_PIN_PB22, | 69 | .pullup_pin = AT91_PIN_PB22, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct at91_mmc_data __initdata kb9202_mmc_data = { | 72 | static struct mci_platform_data __initdata kb9202_mci0_data = { |
73 | .det_pin = AT91_PIN_PB2, | 73 | .slot[0] = { |
74 | .slot_b = 0, | 74 | .bus_width = 4, |
75 | .wire4 = 1, | 75 | .detect_pin = AT91_PIN_PB2, |
76 | .wp_pin = -EINVAL, | 76 | .wp_pin = -EINVAL, |
77 | .vcc_pin = -EINVAL, | 77 | }, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static struct mtd_partition __initdata kb9202_nand_partition[] = { | 80 | static struct mtd_partition __initdata kb9202_nand_partition[] = { |
@@ -96,11 +96,26 @@ static struct atmel_nand_data __initdata kb9202_nand_data = { | |||
96 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), | 96 | .num_parts = ARRAY_SIZE(kb9202_nand_partition), |
97 | }; | 97 | }; |
98 | 98 | ||
99 | /* | ||
100 | * LEDs | ||
101 | */ | ||
102 | static struct gpio_led kb9202_leds[] = { | ||
103 | { /* D1 */ | ||
104 | .name = "led1", | ||
105 | .gpio = AT91_PIN_PC19, | ||
106 | .active_low = 1, | ||
107 | .default_trigger = "heartbeat", | ||
108 | }, | ||
109 | { /* D2 */ | ||
110 | .name = "led2", | ||
111 | .gpio = AT91_PIN_PC18, | ||
112 | .active_low = 1, | ||
113 | .default_trigger = "timer", | ||
114 | } | ||
115 | }; | ||
116 | |||
99 | static void __init kb9202_board_init(void) | 117 | static void __init kb9202_board_init(void) |
100 | { | 118 | { |
101 | /* Set up the LEDs */ | ||
102 | at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18); | ||
103 | |||
104 | /* Serial */ | 119 | /* Serial */ |
105 | /* DBGU on ttyS0. (Rx & Tx only) */ | 120 | /* DBGU on ttyS0. (Rx & Tx only) */ |
106 | at91_register_uart(0, 0, 0); | 121 | at91_register_uart(0, 0, 0); |
@@ -121,13 +136,15 @@ static void __init kb9202_board_init(void) | |||
121 | /* USB Device */ | 136 | /* USB Device */ |
122 | at91_add_device_udc(&kb9202_udc_data); | 137 | at91_add_device_udc(&kb9202_udc_data); |
123 | /* MMC */ | 138 | /* MMC */ |
124 | at91_add_device_mmc(0, &kb9202_mmc_data); | 139 | at91_add_device_mci(0, &kb9202_mci0_data); |
125 | /* I2C */ | 140 | /* I2C */ |
126 | at91_add_device_i2c(NULL, 0); | 141 | at91_add_device_i2c(NULL, 0); |
127 | /* SPI */ | 142 | /* SPI */ |
128 | at91_add_device_spi(NULL, 0); | 143 | at91_add_device_spi(NULL, 0); |
129 | /* NAND */ | 144 | /* NAND */ |
130 | at91_add_device_nand(&kb9202_nand_data); | 145 | at91_add_device_nand(&kb9202_nand_data); |
146 | /* LEDs */ | ||
147 | at91_gpio_leds(kb9202_leds, ARRAY_SIZE(kb9202_leds)); | ||
131 | } | 148 | } |
132 | 149 | ||
133 | MACHINE_START(KB9200, "KB920x") | 150 | MACHINE_START(KB9200, "KB920x") |
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c index 18103c5d993c..9cda3fd346ae 100644 --- a/arch/arm/mach-at91/board-neocore926.c +++ b/arch/arm/mach-at91/board-neocore926.c | |||
@@ -138,11 +138,12 @@ static struct spi_board_info neocore926_spi_devices[] = { | |||
138 | /* | 138 | /* |
139 | * MCI (SD/MMC) | 139 | * MCI (SD/MMC) |
140 | */ | 140 | */ |
141 | static struct at91_mmc_data __initdata neocore926_mmc_data = { | 141 | static struct mci_platform_data __initdata neocore926_mci0_data = { |
142 | .wire4 = 1, | 142 | .slot[0] = { |
143 | .det_pin = AT91_PIN_PE18, | 143 | .bus_width = 4, |
144 | .wp_pin = AT91_PIN_PE19, | 144 | .detect_pin = AT91_PIN_PE18, |
145 | .vcc_pin = -EINVAL, | 145 | .wp_pin = AT91_PIN_PE19, |
146 | }, | ||
146 | }; | 147 | }; |
147 | 148 | ||
148 | 149 | ||
@@ -354,7 +355,7 @@ static void __init neocore926_board_init(void) | |||
354 | neocore926_add_device_ts(); | 355 | neocore926_add_device_ts(); |
355 | 356 | ||
356 | /* MMC */ | 357 | /* MMC */ |
357 | at91_add_device_mmc(1, &neocore926_mmc_data); | 358 | at91_add_device_mci(0, &neocore926_mci0_data); |
358 | 359 | ||
359 | /* Ethernet */ | 360 | /* Ethernet */ |
360 | at91_add_device_eth(&neocore926_macb_data); | 361 | at91_add_device_eth(&neocore926_macb_data); |
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c index 127065504508..f83e1de699e6 100644 --- a/arch/arm/mach-at91/board-picotux200.c +++ b/arch/arm/mach-at91/board-picotux200.c | |||
@@ -62,12 +62,12 @@ static struct at91_usbh_data __initdata picotux200_usbh_data = { | |||
62 | .overcurrent_pin= {-EINVAL, -EINVAL}, | 62 | .overcurrent_pin= {-EINVAL, -EINVAL}, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct at91_mmc_data __initdata picotux200_mmc_data = { | 65 | static struct mci_platform_data __initdata picotux200_mci0_data = { |
66 | .det_pin = AT91_PIN_PB27, | 66 | .slot[0] = { |
67 | .slot_b = 0, | 67 | .bus_width = 4, |
68 | .wire4 = 1, | 68 | .detect_pin = AT91_PIN_PB27, |
69 | .wp_pin = AT91_PIN_PA17, | 69 | .wp_pin = AT91_PIN_PA17, |
70 | .vcc_pin = -EINVAL, | 70 | }, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 | 73 | #define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 |
@@ -112,7 +112,7 @@ static void __init picotux200_board_init(void) | |||
112 | at91_add_device_i2c(NULL, 0); | 112 | at91_add_device_i2c(NULL, 0); |
113 | /* MMC */ | 113 | /* MMC */ |
114 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ | 114 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ |
115 | at91_add_device_mmc(0, &picotux200_mmc_data); | 115 | at91_add_device_mci(0, &picotux200_mci0_data); |
116 | /* NOR Flash */ | 116 | /* NOR Flash */ |
117 | platform_device_register(&picotux200_flash); | 117 | platform_device_register(&picotux200_flash); |
118 | } | 118 | } |
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c index bf351e285422..799f214edebe 100644 --- a/arch/arm/mach-at91/board-qil-a9260.c +++ b/arch/arm/mach-at91/board-qil-a9260.c | |||
@@ -156,12 +156,12 @@ static void __init ek_add_device_nand(void) | |||
156 | /* | 156 | /* |
157 | * MCI (SD/MMC) | 157 | * MCI (SD/MMC) |
158 | */ | 158 | */ |
159 | static struct at91_mmc_data __initdata ek_mmc_data = { | 159 | static struct mci_platform_data __initdata ek_mci0_data = { |
160 | .slot_b = 0, | 160 | .slot[0] = { |
161 | .wire4 = 1, | 161 | .bus_width = 4, |
162 | .det_pin = -EINVAL, | 162 | .detect_pin = -EINVAL, |
163 | .wp_pin = -EINVAL, | 163 | .wp_pin = -EINVAL, |
164 | .vcc_pin = -EINVAL, | 164 | }, |
165 | }; | 165 | }; |
166 | 166 | ||
167 | /* | 167 | /* |
@@ -245,7 +245,7 @@ static void __init ek_board_init(void) | |||
245 | /* Ethernet */ | 245 | /* Ethernet */ |
246 | at91_add_device_eth(&ek_macb_data); | 246 | at91_add_device_eth(&ek_macb_data); |
247 | /* MMC */ | 247 | /* MMC */ |
248 | at91_add_device_mmc(0, &ek_mmc_data); | 248 | at91_add_device_mci(0, &ek_mci0_data); |
249 | /* Push Buttons */ | 249 | /* Push Buttons */ |
250 | ek_add_device_buttons(); | 250 | ek_add_device_buttons(); |
251 | /* LEDs */ | 251 | /* LEDs */ |
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c index cc2bf9796073..66338e7ebfba 100644 --- a/arch/arm/mach-at91/board-rm9200dk.c +++ b/arch/arm/mach-at91/board-rm9200dk.c | |||
@@ -77,12 +77,12 @@ static struct at91_cf_data __initdata dk_cf_data = { | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD | 79 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD |
80 | static struct at91_mmc_data __initdata dk_mmc_data = { | 80 | static struct mci_platform_data __initdata dk_mci0_data = { |
81 | .slot_b = 0, | 81 | .slot[0] = { |
82 | .wire4 = 1, | 82 | .bus_width = 4, |
83 | .det_pin = -EINVAL, | 83 | .detect_pin = -EINVAL, |
84 | .wp_pin = -EINVAL, | 84 | .wp_pin = -EINVAL, |
85 | .vcc_pin = -EINVAL, | 85 | }, |
86 | }; | 86 | }; |
87 | #endif | 87 | #endif |
88 | 88 | ||
@@ -177,9 +177,6 @@ static struct gpio_led dk_leds[] = { | |||
177 | 177 | ||
178 | static void __init dk_board_init(void) | 178 | static void __init dk_board_init(void) |
179 | { | 179 | { |
180 | /* Setup the LEDs */ | ||
181 | at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2); | ||
182 | |||
183 | /* Serial */ | 180 | /* Serial */ |
184 | /* DBGU on ttyS0. (Rx & Tx only) */ | 181 | /* DBGU on ttyS0. (Rx & Tx only) */ |
185 | at91_register_uart(0, 0, 0); | 182 | at91_register_uart(0, 0, 0); |
@@ -208,7 +205,7 @@ static void __init dk_board_init(void) | |||
208 | #else | 205 | #else |
209 | /* MMC */ | 206 | /* MMC */ |
210 | at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ | 207 | at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ |
211 | at91_add_device_mmc(0, &dk_mmc_data); | 208 | at91_add_device_mci(0, &dk_mci0_data); |
212 | #endif | 209 | #endif |
213 | /* NAND */ | 210 | /* NAND */ |
214 | at91_add_device_nand(&dk_nand_data); | 211 | at91_add_device_nand(&dk_nand_data); |
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c index 62e19e64c9d3..5d1b5729dc69 100644 --- a/arch/arm/mach-at91/board-rm9200ek.c +++ b/arch/arm/mach-at91/board-rm9200ek.c | |||
@@ -70,12 +70,12 @@ static struct at91_udc_data __initdata ek_udc_data = { | |||
70 | }; | 70 | }; |
71 | 71 | ||
72 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD | 72 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD |
73 | static struct at91_mmc_data __initdata ek_mmc_data = { | 73 | static struct mci_platform_data __initdata ek_mci0_data = { |
74 | .det_pin = AT91_PIN_PB27, | 74 | .slot[0] = { |
75 | .slot_b = 0, | 75 | .bus_width = 4, |
76 | .wire4 = 1, | 76 | .detect_pin = AT91_PIN_PB27, |
77 | .wp_pin = AT91_PIN_PA17, | 77 | .wp_pin = AT91_PIN_PA17, |
78 | .vcc_pin = -EINVAL, | 78 | } |
79 | }; | 79 | }; |
80 | #endif | 80 | #endif |
81 | 81 | ||
@@ -148,9 +148,6 @@ static struct gpio_led ek_leds[] = { | |||
148 | 148 | ||
149 | static void __init ek_board_init(void) | 149 | static void __init ek_board_init(void) |
150 | { | 150 | { |
151 | /* Setup the LEDs */ | ||
152 | at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2); | ||
153 | |||
154 | /* Serial */ | 151 | /* Serial */ |
155 | /* DBGU on ttyS0. (Rx & Tx only) */ | 152 | /* DBGU on ttyS0. (Rx & Tx only) */ |
156 | at91_register_uart(0, 0, 0); | 153 | at91_register_uart(0, 0, 0); |
@@ -177,7 +174,7 @@ static void __init ek_board_init(void) | |||
177 | #else | 174 | #else |
178 | /* MMC */ | 175 | /* MMC */ |
179 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ | 176 | at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ |
180 | at91_add_device_mmc(0, &ek_mmc_data); | 177 | at91_add_device_mci(0, &ek_mci0_data); |
181 | #endif | 178 | #endif |
182 | /* NOR Flash */ | 179 | /* NOR Flash */ |
183 | platform_device_register(&ek_flash); | 180 | platform_device_register(&ek_flash); |
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c index c3b43aefdb75..a0ecf04e9ae3 100644 --- a/arch/arm/mach-at91/board-rsi-ews.c +++ b/arch/arm/mach-at91/board-rsi-ews.c | |||
@@ -58,11 +58,12 @@ static struct at91_usbh_data rsi_ews_usbh_data __initdata = { | |||
58 | /* | 58 | /* |
59 | * SD/MC | 59 | * SD/MC |
60 | */ | 60 | */ |
61 | static struct at91_mmc_data rsi_ews_mmc_data __initdata = { | 61 | static struct mci_platform_data __initdata rsi_ews_mci0_data = { |
62 | .slot_b = 0, | 62 | .slot[0] = { |
63 | .wire4 = 1, | 63 | .bus_width = 4, |
64 | .det_pin = AT91_PIN_PB27, | 64 | .detect_pin = AT91_PIN_PB27, |
65 | .wp_pin = AT91_PIN_PB29, | 65 | .wp_pin = AT91_PIN_PB29, |
66 | }, | ||
66 | }; | 67 | }; |
67 | 68 | ||
68 | /* | 69 | /* |
@@ -185,9 +186,6 @@ static struct platform_device rsiews_nor_flash = { | |||
185 | */ | 186 | */ |
186 | static void __init rsi_ews_board_init(void) | 187 | static void __init rsi_ews_board_init(void) |
187 | { | 188 | { |
188 | /* Setup the LEDs */ | ||
189 | at91_init_leds(AT91_PIN_PB6, AT91_PIN_PB9); | ||
190 | |||
191 | /* Serial */ | 189 | /* Serial */ |
192 | /* DBGU on ttyS0. (Rx & Tx only) */ | 190 | /* DBGU on ttyS0. (Rx & Tx only) */ |
193 | /* This one is for debugging */ | 191 | /* This one is for debugging */ |
@@ -215,7 +213,7 @@ static void __init rsi_ews_board_init(void) | |||
215 | at91_add_device_spi(rsi_ews_spi_devices, | 213 | at91_add_device_spi(rsi_ews_spi_devices, |
216 | ARRAY_SIZE(rsi_ews_spi_devices)); | 214 | ARRAY_SIZE(rsi_ews_spi_devices)); |
217 | /* MMC */ | 215 | /* MMC */ |
218 | at91_add_device_mmc(0, &rsi_ews_mmc_data); | 216 | at91_add_device_mci(0, &rsi_ews_mci0_data); |
219 | /* NOR Flash */ | 217 | /* NOR Flash */ |
220 | platform_device_register(&rsiews_nor_flash); | 218 | platform_device_register(&rsiews_nor_flash); |
221 | /* LEDs */ | 219 | /* LEDs */ |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 7bf6da70d7d5..c5f01acce3c0 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
@@ -73,7 +73,7 @@ static struct at91_udc_data __initdata ek_udc_data = { | |||
73 | * SPI devices. | 73 | * SPI devices. |
74 | */ | 74 | */ |
75 | static struct spi_board_info ek_spi_devices[] = { | 75 | static struct spi_board_info ek_spi_devices[] = { |
76 | #if !defined(CONFIG_MMC_AT91) | 76 | #if !IS_ENABLED(CONFIG_MMC_ATMELMCI) |
77 | { /* DataFlash chip */ | 77 | { /* DataFlash chip */ |
78 | .modalias = "mtd_dataflash", | 78 | .modalias = "mtd_dataflash", |
79 | .chip_select = 1, | 79 | .chip_select = 1, |
@@ -158,19 +158,34 @@ static void __init ek_add_device_nand(void) | |||
158 | /* | 158 | /* |
159 | * MCI (SD/MMC) | 159 | * MCI (SD/MMC) |
160 | */ | 160 | */ |
161 | static struct at91_mmc_data __initdata ek_mmc_data = { | 161 | static struct mci_platform_data __initdata ek_mci0_data = { |
162 | .slot_b = 1, | 162 | .slot[1] = { |
163 | .wire4 = 1, | 163 | .bus_width = 4, |
164 | .det_pin = AT91_PIN_PC8, | 164 | .detect_pin = AT91_PIN_PC8, |
165 | .wp_pin = AT91_PIN_PC4, | 165 | .wp_pin = AT91_PIN_PC4, |
166 | .vcc_pin = -EINVAL, | 166 | }, |
167 | }; | ||
168 | |||
169 | /* | ||
170 | * LEDs | ||
171 | */ | ||
172 | static struct gpio_led ek_leds[] = { | ||
173 | { /* D1 */ | ||
174 | .name = "led1", | ||
175 | .gpio = AT91_PIN_PA9, | ||
176 | .active_low = 1, | ||
177 | .default_trigger = "heartbeat", | ||
178 | }, | ||
179 | { /* D2 */ | ||
180 | .name = "led2", | ||
181 | .gpio = AT91_PIN_PA6, | ||
182 | .active_low = 1, | ||
183 | .default_trigger = "timer", | ||
184 | } | ||
167 | }; | 185 | }; |
168 | 186 | ||
169 | static void __init ek_board_init(void) | 187 | static void __init ek_board_init(void) |
170 | { | 188 | { |
171 | /* Setup the LEDs */ | ||
172 | at91_init_leds(AT91_PIN_PA9, AT91_PIN_PA6); | ||
173 | |||
174 | /* Serial */ | 189 | /* Serial */ |
175 | /* DBGU on ttyS0. (Rx & Tx only) */ | 190 | /* DBGU on ttyS0. (Rx & Tx only) */ |
176 | at91_register_uart(0, 0, 0); | 191 | at91_register_uart(0, 0, 0); |
@@ -194,9 +209,11 @@ static void __init ek_board_init(void) | |||
194 | /* Ethernet */ | 209 | /* Ethernet */ |
195 | at91_add_device_eth(&ek_macb_data); | 210 | at91_add_device_eth(&ek_macb_data); |
196 | /* MMC */ | 211 | /* MMC */ |
197 | at91_add_device_mmc(0, &ek_mmc_data); | 212 | at91_add_device_mci(0, &ek_mci0_data); |
198 | /* I2C */ | 213 | /* I2C */ |
199 | at91_add_device_i2c(NULL, 0); | 214 | at91_add_device_i2c(NULL, 0); |
215 | /* LEDs */ | ||
216 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
200 | } | 217 | } |
201 | 218 | ||
202 | MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") | 219 | MACHINE_START(SAM9_L9260, "Olimex SAM9-L9260") |
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c index 889c1bf71eb5..8cd6e679fbe0 100644 --- a/arch/arm/mach-at91/board-sam9260ek.c +++ b/arch/arm/mach-at91/board-sam9260ek.c | |||
@@ -108,7 +108,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info) {} | |||
108 | * SPI devices. | 108 | * SPI devices. |
109 | */ | 109 | */ |
110 | static struct spi_board_info ek_spi_devices[] = { | 110 | static struct spi_board_info ek_spi_devices[] = { |
111 | #if !defined(CONFIG_MMC_AT91) | 111 | #if !IS_ENABLED(CONFIG_MMC_ATMELMCI) |
112 | { /* DataFlash chip */ | 112 | { /* DataFlash chip */ |
113 | .modalias = "mtd_dataflash", | 113 | .modalias = "mtd_dataflash", |
114 | .chip_select = 1, | 114 | .chip_select = 1, |
@@ -211,12 +211,12 @@ static void __init ek_add_device_nand(void) | |||
211 | /* | 211 | /* |
212 | * MCI (SD/MMC) | 212 | * MCI (SD/MMC) |
213 | */ | 213 | */ |
214 | static struct at91_mmc_data __initdata ek_mmc_data = { | 214 | static struct mci_platform_data __initdata ek_mci0_data = { |
215 | .slot_b = 1, | 215 | .slot[1] = { |
216 | .wire4 = 1, | 216 | .bus_width = 4, |
217 | .det_pin = -EINVAL, | 217 | .detect_pin = -EINVAL, |
218 | .wp_pin = -EINVAL, | 218 | .wp_pin = -EINVAL, |
219 | .vcc_pin = -EINVAL, | 219 | }, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | 222 | ||
@@ -329,7 +329,7 @@ static void __init ek_board_init(void) | |||
329 | /* Ethernet */ | 329 | /* Ethernet */ |
330 | at91_add_device_eth(&ek_macb_data); | 330 | at91_add_device_eth(&ek_macb_data); |
331 | /* MMC */ | 331 | /* MMC */ |
332 | at91_add_device_mmc(0, &ek_mmc_data); | 332 | at91_add_device_mci(0, &ek_mci0_data); |
333 | /* I2C */ | 333 | /* I2C */ |
334 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); | 334 | at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); |
335 | /* SSC (to AT73C213) */ | 335 | /* SSC (to AT73C213) */ |
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index 2269be5fa384..27b3af1a3047 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -340,11 +340,12 @@ static struct spi_board_info ek_spi_devices[] = { | |||
340 | * MCI (SD/MMC) | 340 | * MCI (SD/MMC) |
341 | * det_pin, wp_pin and vcc_pin are not connected | 341 | * det_pin, wp_pin and vcc_pin are not connected |
342 | */ | 342 | */ |
343 | static struct at91_mmc_data __initdata ek_mmc_data = { | 343 | static struct mci_platform_data __initdata mci0_data = { |
344 | .wire4 = 1, | 344 | .slot[0] = { |
345 | .det_pin = -EINVAL, | 345 | .bus_width = 4, |
346 | .wp_pin = -EINVAL, | 346 | .detect_pin = -EINVAL, |
347 | .vcc_pin = -EINVAL, | 347 | .wp_pin = -EINVAL, |
348 | }, | ||
348 | }; | 349 | }; |
349 | 350 | ||
350 | #endif /* CONFIG_SPI_ATMEL_* */ | 351 | #endif /* CONFIG_SPI_ATMEL_* */ |
@@ -569,9 +570,6 @@ static struct gpio_led ek_leds[] = { | |||
569 | 570 | ||
570 | static void __init ek_board_init(void) | 571 | static void __init ek_board_init(void) |
571 | { | 572 | { |
572 | /* Setup the LEDs */ | ||
573 | at91_init_leds(AT91_PIN_PA13, AT91_PIN_PA14); | ||
574 | |||
575 | /* Serial */ | 573 | /* Serial */ |
576 | /* DBGU on ttyS0. (Rx & Tx only) */ | 574 | /* DBGU on ttyS0. (Rx & Tx only) */ |
577 | at91_register_uart(0, 0, 0); | 575 | at91_register_uart(0, 0, 0); |
@@ -598,7 +596,7 @@ static void __init ek_board_init(void) | |||
598 | at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); | 596 | at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); |
599 | #else | 597 | #else |
600 | /* MMC */ | 598 | /* MMC */ |
601 | at91_add_device_mmc(0, &ek_mmc_data); | 599 | at91_add_device_mci(0, &mci0_data); |
602 | #endif | 600 | #endif |
603 | /* LCD Controller */ | 601 | /* LCD Controller */ |
604 | at91_add_device_lcdc(&ek_lcdc_data); | 602 | at91_add_device_lcdc(&ek_lcdc_data); |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index 82adf581afc2..073e17403d98 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -141,11 +141,12 @@ static struct spi_board_info ek_spi_devices[] = { | |||
141 | /* | 141 | /* |
142 | * MCI (SD/MMC) | 142 | * MCI (SD/MMC) |
143 | */ | 143 | */ |
144 | static struct at91_mmc_data __initdata ek_mmc_data = { | 144 | static struct mci_platform_data __initdata mci1_data = { |
145 | .wire4 = 1, | 145 | .slot[0] = { |
146 | .det_pin = AT91_PIN_PE18, | 146 | .bus_width = 4, |
147 | .wp_pin = AT91_PIN_PE19, | 147 | .detect_pin = AT91_PIN_PE18, |
148 | .vcc_pin = -EINVAL, | 148 | .wp_pin = AT91_PIN_PE19, |
149 | }, | ||
149 | }; | 150 | }; |
150 | 151 | ||
151 | 152 | ||
@@ -420,7 +421,7 @@ static void __init ek_board_init(void) | |||
420 | /* Touchscreen */ | 421 | /* Touchscreen */ |
421 | ek_add_device_ts(); | 422 | ek_add_device_ts(); |
422 | /* MMC */ | 423 | /* MMC */ |
423 | at91_add_device_mmc(1, &ek_mmc_data); | 424 | at91_add_device_mci(1, &mci1_data); |
424 | /* Ethernet */ | 425 | /* Ethernet */ |
425 | at91_add_device_eth(&ek_macb_data); | 426 | at91_add_device_eth(&ek_macb_data); |
426 | /* NAND */ | 427 | /* NAND */ |
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index 4ea4ee00364b..3ab2b86a3762 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
@@ -92,7 +92,7 @@ static struct at91_udc_data __initdata ek_udc_data = { | |||
92 | * SPI devices. | 92 | * SPI devices. |
93 | */ | 93 | */ |
94 | static struct spi_board_info ek_spi_devices[] = { | 94 | static struct spi_board_info ek_spi_devices[] = { |
95 | #if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91)) | 95 | #if !IS_ENABLED(CONFIG_MMC_ATMELMCI) |
96 | { /* DataFlash chip */ | 96 | { /* DataFlash chip */ |
97 | .modalias = "mtd_dataflash", | 97 | .modalias = "mtd_dataflash", |
98 | .chip_select = 1, | 98 | .chip_select = 1, |
@@ -199,7 +199,6 @@ static void __init ek_add_device_nand(void) | |||
199 | * MCI (SD/MMC) | 199 | * MCI (SD/MMC) |
200 | * wp_pin and vcc_pin are not connected | 200 | * wp_pin and vcc_pin are not connected |
201 | */ | 201 | */ |
202 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
203 | static struct mci_platform_data __initdata ek_mmc_data = { | 202 | static struct mci_platform_data __initdata ek_mmc_data = { |
204 | .slot[1] = { | 203 | .slot[1] = { |
205 | .bus_width = 4, | 204 | .bus_width = 4, |
@@ -208,28 +207,15 @@ static struct mci_platform_data __initdata ek_mmc_data = { | |||
208 | }, | 207 | }, |
209 | 208 | ||
210 | }; | 209 | }; |
211 | #else | ||
212 | static struct at91_mmc_data __initdata ek_mmc_data = { | ||
213 | .slot_b = 1, /* Only one slot so use slot B */ | ||
214 | .wire4 = 1, | ||
215 | .det_pin = AT91_PIN_PC9, | ||
216 | .wp_pin = -EINVAL, | ||
217 | .vcc_pin = -EINVAL, | ||
218 | }; | ||
219 | #endif | ||
220 | 210 | ||
221 | static void __init ek_add_device_mmc(void) | 211 | static void __init ek_add_device_mmc(void) |
222 | { | 212 | { |
223 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
224 | if (ek_have_2mmc()) { | 213 | if (ek_have_2mmc()) { |
225 | ek_mmc_data.slot[0].bus_width = 4; | 214 | ek_mmc_data.slot[0].bus_width = 4; |
226 | ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; | 215 | ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; |
227 | ek_mmc_data.slot[0].wp_pin = -1; | 216 | ek_mmc_data.slot[0].wp_pin = -1; |
228 | } | 217 | } |
229 | at91_add_device_mci(0, &ek_mmc_data); | 218 | at91_add_device_mci(0, &ek_mmc_data); |
230 | #else | ||
231 | at91_add_device_mmc(0, &ek_mmc_data); | ||
232 | #endif | ||
233 | } | 219 | } |
234 | 220 | ||
235 | /* | 221 | /* |
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index e7dc3ead7045..fb89ea92e3f2 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -56,11 +56,12 @@ static struct usba_platform_data __initdata ek_usba_udc_data = { | |||
56 | /* | 56 | /* |
57 | * MCI (SD/MMC) | 57 | * MCI (SD/MMC) |
58 | */ | 58 | */ |
59 | static struct at91_mmc_data __initdata ek_mmc_data = { | 59 | static struct mci_platform_data __initdata mci0_data = { |
60 | .wire4 = 1, | 60 | .slot[0] = { |
61 | .det_pin = AT91_PIN_PA15, | 61 | .bus_width = 4, |
62 | .wp_pin = -EINVAL, | 62 | .detect_pin = AT91_PIN_PA15, |
63 | .vcc_pin = -EINVAL, | 63 | .wp_pin = -EINVAL, |
64 | }, | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | 67 | ||
@@ -303,7 +304,7 @@ static void __init ek_board_init(void) | |||
303 | /* SPI */ | 304 | /* SPI */ |
304 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); | 305 | at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); |
305 | /* MMC */ | 306 | /* MMC */ |
306 | at91_add_device_mmc(0, &ek_mmc_data); | 307 | at91_add_device_mci(0, &mci0_data); |
307 | /* LCD Controller */ | 308 | /* LCD Controller */ |
308 | at91_add_device_lcdc(&ek_lcdc_data); | 309 | at91_add_device_lcdc(&ek_lcdc_data); |
309 | /* AC97 */ | 310 | /* AC97 */ |
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index 29eae1626bf7..c3fb31d5116e 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
@@ -83,7 +83,6 @@ static void __init add_device_nand(void) | |||
83 | * MCI (SD/MMC) | 83 | * MCI (SD/MMC) |
84 | * det_pin, wp_pin and vcc_pin are not connected | 84 | * det_pin, wp_pin and vcc_pin are not connected |
85 | */ | 85 | */ |
86 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
87 | static struct mci_platform_data __initdata mmc_data = { | 86 | static struct mci_platform_data __initdata mmc_data = { |
88 | .slot[0] = { | 87 | .slot[0] = { |
89 | .bus_width = 4, | 88 | .bus_width = 4, |
@@ -91,15 +90,6 @@ static struct mci_platform_data __initdata mmc_data = { | |||
91 | .wp_pin = -1, | 90 | .wp_pin = -1, |
92 | }, | 91 | }, |
93 | }; | 92 | }; |
94 | #else | ||
95 | static struct at91_mmc_data __initdata mmc_data = { | ||
96 | .slot_b = 0, | ||
97 | .wire4 = 1, | ||
98 | .det_pin = -EINVAL, | ||
99 | .wp_pin = -EINVAL, | ||
100 | .vcc_pin = -EINVAL, | ||
101 | }; | ||
102 | #endif | ||
103 | 93 | ||
104 | 94 | ||
105 | /* | 95 | /* |
@@ -223,11 +213,7 @@ void __init stamp9g20_board_init(void) | |||
223 | /* NAND */ | 213 | /* NAND */ |
224 | add_device_nand(); | 214 | add_device_nand(); |
225 | /* MMC */ | 215 | /* MMC */ |
226 | #if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) | ||
227 | at91_add_device_mci(0, &mmc_data); | 216 | at91_add_device_mci(0, &mmc_data); |
228 | #else | ||
229 | at91_add_device_mmc(0, &mmc_data); | ||
230 | #endif | ||
231 | /* W1 */ | 217 | /* W1 */ |
232 | add_w1(); | 218 | add_w1(); |
233 | } | 219 | } |
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c index c1476b9fe7b9..6ea069b57335 100644 --- a/arch/arm/mach-at91/board-usb-a926x.c +++ b/arch/arm/mach-at91/board-usb-a926x.c | |||
@@ -109,14 +109,12 @@ static struct mmc_spi_platform_data at91_mmc_spi_pdata = { | |||
109 | * SPI devices. | 109 | * SPI devices. |
110 | */ | 110 | */ |
111 | static struct spi_board_info usb_a9263_spi_devices[] = { | 111 | static struct spi_board_info usb_a9263_spi_devices[] = { |
112 | #if !defined(CONFIG_MMC_AT91) | ||
113 | { /* DataFlash chip */ | 112 | { /* DataFlash chip */ |
114 | .modalias = "mtd_dataflash", | 113 | .modalias = "mtd_dataflash", |
115 | .chip_select = 0, | 114 | .chip_select = 0, |
116 | .max_speed_hz = 15 * 1000 * 1000, | 115 | .max_speed_hz = 15 * 1000 * 1000, |
117 | .bus_num = 0, | 116 | .bus_num = 0, |
118 | } | 117 | } |
119 | #endif | ||
120 | }; | 118 | }; |
121 | 119 | ||
122 | static struct spi_board_info usb_a9g20_spi_devices[] = { | 120 | static struct spi_board_info usb_a9g20_spi_devices[] = { |
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c index 516d340549d8..f162fdfd66eb 100644 --- a/arch/arm/mach-at91/board-yl-9200.c +++ b/arch/arm/mach-at91/board-yl-9200.c | |||
@@ -119,11 +119,12 @@ static struct at91_udc_data __initdata yl9200_udc_data = { | |||
119 | /* | 119 | /* |
120 | * MMC | 120 | * MMC |
121 | */ | 121 | */ |
122 | static struct at91_mmc_data __initdata yl9200_mmc_data = { | 122 | static struct mci_platform_data __initdata yl9200_mci0_data = { |
123 | .det_pin = AT91_PIN_PB9, | 123 | .slot[0] = { |
124 | .wire4 = 1, | 124 | .bus_width = 4, |
125 | .wp_pin = -EINVAL, | 125 | .detect_pin = AT91_PIN_PB9, |
126 | .vcc_pin = -EINVAL, | 126 | .wp_pin = -EINVAL, |
127 | }, | ||
127 | }; | 128 | }; |
128 | 129 | ||
129 | /* | 130 | /* |
@@ -541,9 +542,6 @@ void __init yl9200_add_device_video(void) {} | |||
541 | 542 | ||
542 | static void __init yl9200_board_init(void) | 543 | static void __init yl9200_board_init(void) |
543 | { | 544 | { |
544 | /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */ | ||
545 | at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17); | ||
546 | |||
547 | /* Serial */ | 545 | /* Serial */ |
548 | /* DBGU on ttyS0. (Rx & Tx only) */ | 546 | /* DBGU on ttyS0. (Rx & Tx only) */ |
549 | at91_register_uart(0, 0, 0); | 547 | at91_register_uart(0, 0, 0); |
@@ -568,7 +566,7 @@ static void __init yl9200_board_init(void) | |||
568 | /* I2C */ | 566 | /* I2C */ |
569 | at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices)); | 567 | at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices)); |
570 | /* MMC */ | 568 | /* MMC */ |
571 | at91_add_device_mmc(0, &yl9200_mmc_data); | 569 | at91_add_device_mci(0, &yl9200_mci0_data); |
572 | /* NAND */ | 570 | /* NAND */ |
573 | at91_add_device_nand(&yl9200_nand_data); | 571 | at91_add_device_nand(&yl9200_nand_data); |
574 | /* NOR Flash */ | 572 | /* NOR Flash */ |
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 188c82971ebd..33361505c0cd 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -625,7 +625,7 @@ fail: | |||
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
628 | static struct clk *const standard_pmc_clocks[] __initdata = { | 628 | static struct clk *const standard_pmc_clocks[] __initconst = { |
629 | /* four primary clocks */ | 629 | /* four primary clocks */ |
630 | &clk32k, | 630 | &clk32k, |
631 | &main_clk, | 631 | &main_clk, |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 369afc2ffc5b..c55a4364ffb4 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -187,7 +187,6 @@ struct at91_can_data { | |||
187 | extern void __init at91_add_device_can(struct at91_can_data *data); | 187 | extern void __init at91_add_device_can(struct at91_can_data *data); |
188 | 188 | ||
189 | /* LEDs */ | 189 | /* LEDs */ |
190 | extern void __init at91_init_leds(u8 cpu_led, u8 timer_led); | ||
191 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); | 190 | extern void __init at91_gpio_leds(struct gpio_led *leds, int nr); |
192 | extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); | 191 | extern void __init at91_pwm_leds(struct gpio_led *leds, int nr); |
193 | 192 | ||
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c index 8dfafe76ffe6..1b1e62b5f41b 100644 --- a/arch/arm/mach-at91/leds.c +++ b/arch/arm/mach-at91/leds.c | |||
@@ -90,108 +90,3 @@ void __init at91_pwm_leds(struct gpio_led *leds, int nr) | |||
90 | #else | 90 | #else |
91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} | 91 | void __init at91_pwm_leds(struct gpio_led *leds, int nr){} |
92 | #endif | 92 | #endif |
93 | |||
94 | |||
95 | /* ------------------------------------------------------------------------- */ | ||
96 | |||
97 | #if defined(CONFIG_LEDS) | ||
98 | |||
99 | #include <asm/leds.h> | ||
100 | |||
101 | /* | ||
102 | * Old ARM-specific LED framework; not fully functional when generic time is | ||
103 | * in use. | ||
104 | */ | ||
105 | |||
106 | static u8 at91_leds_cpu; | ||
107 | static u8 at91_leds_timer; | ||
108 | |||
109 | static inline void at91_led_on(unsigned int led) | ||
110 | { | ||
111 | at91_set_gpio_value(led, 0); | ||
112 | } | ||
113 | |||
114 | static inline void at91_led_off(unsigned int led) | ||
115 | { | ||
116 | at91_set_gpio_value(led, 1); | ||
117 | } | ||
118 | |||
119 | static inline void at91_led_toggle(unsigned int led) | ||
120 | { | ||
121 | unsigned long is_off = at91_get_gpio_value(led); | ||
122 | if (is_off) | ||
123 | at91_led_on(led); | ||
124 | else | ||
125 | at91_led_off(led); | ||
126 | } | ||
127 | |||
128 | |||
129 | /* | ||
130 | * Handle LED events. | ||
131 | */ | ||
132 | static void at91_leds_event(led_event_t evt) | ||
133 | { | ||
134 | unsigned long flags; | ||
135 | |||
136 | local_irq_save(flags); | ||
137 | |||
138 | switch(evt) { | ||
139 | case led_start: /* System startup */ | ||
140 | at91_led_on(at91_leds_cpu); | ||
141 | break; | ||
142 | |||
143 | case led_stop: /* System stop / suspend */ | ||
144 | at91_led_off(at91_leds_cpu); | ||
145 | break; | ||
146 | |||
147 | #ifdef CONFIG_LEDS_TIMER | ||
148 | case led_timer: /* Every 50 timer ticks */ | ||
149 | at91_led_toggle(at91_leds_timer); | ||
150 | break; | ||
151 | #endif | ||
152 | |||
153 | #ifdef CONFIG_LEDS_CPU | ||
154 | case led_idle_start: /* Entering idle state */ | ||
155 | at91_led_off(at91_leds_cpu); | ||
156 | break; | ||
157 | |||
158 | case led_idle_end: /* Exit idle state */ | ||
159 | at91_led_on(at91_leds_cpu); | ||
160 | break; | ||
161 | #endif | ||
162 | |||
163 | default: | ||
164 | break; | ||
165 | } | ||
166 | |||
167 | local_irq_restore(flags); | ||
168 | } | ||
169 | |||
170 | |||
171 | static int __init leds_init(void) | ||
172 | { | ||
173 | if (!at91_leds_timer || !at91_leds_cpu) | ||
174 | return -ENODEV; | ||
175 | |||
176 | leds_event = at91_leds_event; | ||
177 | |||
178 | leds_event(led_start); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | __initcall(leds_init); | ||
183 | |||
184 | |||
185 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | ||
186 | { | ||
187 | /* Enable GPIO to access the LEDs */ | ||
188 | at91_set_gpio_output(cpu_led, 1); | ||
189 | at91_set_gpio_output(timer_led, 1); | ||
190 | |||
191 | at91_leds_cpu = cpu_led; | ||
192 | at91_leds_timer = timer_led; | ||
193 | } | ||
194 | |||
195 | #else | ||
196 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | ||
197 | #endif | ||
diff --git a/arch/arm/mach-bcmring/Kconfig b/arch/arm/mach-bcmring/Kconfig deleted file mode 100644 index 9170d16dca50..000000000000 --- a/arch/arm/mach-bcmring/Kconfig +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | choice | ||
2 | prompt "Processor selection in BCMRING family of devices" | ||
3 | depends on ARCH_BCMRING | ||
4 | default ARCH_BCM11107 | ||
5 | |||
6 | config ARCH_FPGA11107 | ||
7 | bool "FPGA11107" | ||
8 | |||
9 | config ARCH_BCM11107 | ||
10 | bool "BCM11107" | ||
11 | endchoice | ||
12 | |||
13 | menu "BCMRING Options" | ||
14 | depends on ARCH_BCMRING | ||
15 | |||
16 | config BCM_ZRELADDR | ||
17 | hex "Compressed ZREL ADDR" | ||
18 | |||
19 | endmenu | ||
diff --git a/arch/arm/mach-bcmring/Makefile b/arch/arm/mach-bcmring/Makefile deleted file mode 100644 index f8d9fcedf917..000000000000 --- a/arch/arm/mach-bcmring/Makefile +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | # Object file lists. | ||
6 | |||
7 | obj-y := arch.o mm.o irq.o clock.o core.o timer.o dma.o | ||
8 | obj-y += csp/ | ||
diff --git a/arch/arm/mach-bcmring/Makefile.boot b/arch/arm/mach-bcmring/Makefile.boot deleted file mode 100644 index aef2467757fa..000000000000 --- a/arch/arm/mach-bcmring/Makefile.boot +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # Address where decompressor will be written and eventually executed. | ||
2 | # | ||
3 | # default to SDRAM | ||
4 | zreladdr-y += $(CONFIG_BCM_ZRELADDR) | ||
5 | params_phys-y := 0x00000800 | ||
6 | |||
diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c deleted file mode 100644 index c18a5048b6c5..000000000000 --- a/arch/arm/mach-bcmring/arch.c +++ /dev/null | |||
@@ -1,198 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/module.h> | ||
24 | |||
25 | #include <linux/proc_fs.h> | ||
26 | #include <linux/sysctl.h> | ||
27 | |||
28 | #include <asm/irq.h> | ||
29 | #include <asm/setup.h> | ||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/mach/time.h> | ||
32 | |||
33 | #include <asm/mach/arch.h> | ||
34 | #include <mach/dma.h> | ||
35 | #include <mach/hardware.h> | ||
36 | #include <mach/csp/mm_io.h> | ||
37 | #include <mach/csp/chipcHw_def.h> | ||
38 | #include <mach/csp/chipcHw_inline.h> | ||
39 | |||
40 | #include <mach/cfg_global.h> | ||
41 | |||
42 | #include "core.h" | ||
43 | |||
44 | HW_DECLARE_SPINLOCK(arch) | ||
45 | HW_DECLARE_SPINLOCK(gpio) | ||
46 | #if defined(CONFIG_DEBUG_SPINLOCK) | ||
47 | EXPORT_SYMBOL(bcmring_gpio_reg_lock); | ||
48 | #endif | ||
49 | |||
50 | /* sysctl */ | ||
51 | static int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */ | ||
52 | |||
53 | static void bcmring_restart(char mode, const char *cmd) | ||
54 | { | ||
55 | printk("arch_reset:%c %x\n", mode, bcmring_arch_warm_reboot); | ||
56 | |||
57 | if (mode == 'h') { | ||
58 | /* Reboot configured in proc entry */ | ||
59 | if (bcmring_arch_warm_reboot) { | ||
60 | printk("warm reset\n"); | ||
61 | /* Issue Warm reset (do not reset ethernet switch, keep alive) */ | ||
62 | chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_WARM); | ||
63 | } else { | ||
64 | /* Force reset of everything */ | ||
65 | printk("force reset\n"); | ||
66 | chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT); | ||
67 | } | ||
68 | } else { | ||
69 | /* Force reset of everything */ | ||
70 | printk("force reset\n"); | ||
71 | chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | static struct ctl_table_header *bcmring_sysctl_header; | ||
76 | |||
77 | static struct ctl_table bcmring_sysctl_warm_reboot[] = { | ||
78 | { | ||
79 | .procname = "warm", | ||
80 | .data = &bcmring_arch_warm_reboot, | ||
81 | .maxlen = sizeof(int), | ||
82 | .mode = 0644, | ||
83 | .proc_handler = proc_dointvec}, | ||
84 | {} | ||
85 | }; | ||
86 | |||
87 | static struct ctl_table bcmring_sysctl_reboot[] = { | ||
88 | { | ||
89 | .procname = "reboot", | ||
90 | .mode = 0555, | ||
91 | .child = bcmring_sysctl_warm_reboot}, | ||
92 | {} | ||
93 | }; | ||
94 | |||
95 | static struct resource nand_resource[] = { | ||
96 | [0] = { | ||
97 | .start = MM_ADDR_IO_NAND, | ||
98 | .end = MM_ADDR_IO_NAND + 0x1000 - 1, | ||
99 | .flags = IORESOURCE_MEM, | ||
100 | }, | ||
101 | }; | ||
102 | |||
103 | static struct platform_device nand_device = { | ||
104 | .name = "bcm-nand", | ||
105 | .id = -1, | ||
106 | .resource = nand_resource, | ||
107 | .num_resources = ARRAY_SIZE(nand_resource), | ||
108 | }; | ||
109 | |||
110 | static struct resource pmu_resource = { | ||
111 | .start = IRQ_PMUIRQ, | ||
112 | .end = IRQ_PMUIRQ, | ||
113 | .flags = IORESOURCE_IRQ, | ||
114 | }; | ||
115 | |||
116 | static struct platform_device pmu_device = { | ||
117 | .name = "arm-pmu", | ||
118 | .id = -1, | ||
119 | .resource = &pmu_resource, | ||
120 | .num_resources = 1, | ||
121 | }; | ||
122 | |||
123 | |||
124 | static struct platform_device *devices[] __initdata = { | ||
125 | &nand_device, | ||
126 | &pmu_device, | ||
127 | }; | ||
128 | |||
129 | /**************************************************************************** | ||
130 | * | ||
131 | * Called from the customize_machine function in arch/arm/kernel/setup.c | ||
132 | * | ||
133 | * The customize_machine function is tagged as an arch_initcall | ||
134 | * (see include/linux/init.h for the order that the various init sections | ||
135 | * are called in. | ||
136 | * | ||
137 | *****************************************************************************/ | ||
138 | static void __init bcmring_init_machine(void) | ||
139 | { | ||
140 | |||
141 | bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot); | ||
142 | |||
143 | /* Enable spread spectrum */ | ||
144 | chipcHw_enableSpreadSpectrum(); | ||
145 | |||
146 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
147 | |||
148 | bcmring_amba_init(); | ||
149 | |||
150 | dma_init(); | ||
151 | } | ||
152 | |||
153 | /**************************************************************************** | ||
154 | * | ||
155 | * Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags | ||
156 | * passed in by the boot loader. | ||
157 | * | ||
158 | *****************************************************************************/ | ||
159 | |||
160 | static void __init bcmring_fixup(struct tag *t, char **cmdline, | ||
161 | struct meminfo *mi) { | ||
162 | #ifdef CONFIG_BLK_DEV_INITRD | ||
163 | printk(KERN_NOTICE "bcmring_fixup\n"); | ||
164 | t->hdr.tag = ATAG_CORE; | ||
165 | t->hdr.size = tag_size(tag_core); | ||
166 | t->u.core.flags = 0; | ||
167 | t->u.core.pagesize = PAGE_SIZE; | ||
168 | t->u.core.rootdev = 31 << 8 | 0; | ||
169 | t = tag_next(t); | ||
170 | |||
171 | t->hdr.tag = ATAG_MEM; | ||
172 | t->hdr.size = tag_size(tag_mem32); | ||
173 | t->u.mem.start = CFG_GLOBAL_RAM_BASE; | ||
174 | t->u.mem.size = CFG_GLOBAL_RAM_SIZE; | ||
175 | |||
176 | t = tag_next(t); | ||
177 | |||
178 | t->hdr.tag = ATAG_NONE; | ||
179 | t->hdr.size = 0; | ||
180 | #endif | ||
181 | } | ||
182 | |||
183 | /**************************************************************************** | ||
184 | * | ||
185 | * Machine Description | ||
186 | * | ||
187 | *****************************************************************************/ | ||
188 | |||
189 | MACHINE_START(BCMRING, "BCMRING") | ||
190 | /* Maintainer: Broadcom Corporation */ | ||
191 | .fixup = bcmring_fixup, | ||
192 | .map_io = bcmring_map_io, | ||
193 | .init_early = bcmring_init_early, | ||
194 | .init_irq = bcmring_init_irq, | ||
195 | .timer = &bcmring_timer, | ||
196 | .init_machine = bcmring_init_machine, | ||
197 | .restart = bcmring_restart, | ||
198 | MACHINE_END | ||
diff --git a/arch/arm/mach-bcmring/clock.c b/arch/arm/mach-bcmring/clock.c deleted file mode 100644 index ad237a42d265..000000000000 --- a/arch/arm/mach-bcmring/clock.c +++ /dev/null | |||
@@ -1,223 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2001 - 2009 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/list.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/spinlock.h> | ||
24 | #include <linux/clkdev.h> | ||
25 | #include <mach/csp/hw_cfg.h> | ||
26 | #include <mach/csp/chipcHw_def.h> | ||
27 | #include <mach/csp/chipcHw_reg.h> | ||
28 | #include <mach/csp/chipcHw_inline.h> | ||
29 | |||
30 | #include "clock.h" | ||
31 | |||
32 | #define clk_is_primary(x) ((x)->type & CLK_TYPE_PRIMARY) | ||
33 | #define clk_is_pll1(x) ((x)->type & CLK_TYPE_PLL1) | ||
34 | #define clk_is_pll2(x) ((x)->type & CLK_TYPE_PLL2) | ||
35 | #define clk_is_programmable(x) ((x)->type & CLK_TYPE_PROGRAMMABLE) | ||
36 | #define clk_is_bypassable(x) ((x)->type & CLK_TYPE_BYPASSABLE) | ||
37 | |||
38 | #define clk_is_using_xtal(x) ((x)->mode & CLK_MODE_XTAL) | ||
39 | |||
40 | static DEFINE_SPINLOCK(clk_lock); | ||
41 | |||
42 | static void __clk_enable(struct clk *clk) | ||
43 | { | ||
44 | if (!clk) | ||
45 | return; | ||
46 | |||
47 | /* enable parent clock first */ | ||
48 | if (clk->parent) | ||
49 | __clk_enable(clk->parent); | ||
50 | |||
51 | if (clk->use_cnt++ == 0) { | ||
52 | if (clk_is_pll1(clk)) { /* PLL1 */ | ||
53 | chipcHw_pll1Enable(clk->rate_hz, 0); | ||
54 | } else if (clk_is_pll2(clk)) { /* PLL2 */ | ||
55 | chipcHw_pll2Enable(clk->rate_hz); | ||
56 | } else if (clk_is_using_xtal(clk)) { /* source is crystal */ | ||
57 | if (!clk_is_primary(clk)) | ||
58 | chipcHw_bypassClockEnable(clk->csp_id); | ||
59 | } else { /* source is PLL */ | ||
60 | chipcHw_setClockEnable(clk->csp_id); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | int clk_enable(struct clk *clk) | ||
66 | { | ||
67 | unsigned long flags; | ||
68 | |||
69 | if (!clk) | ||
70 | return -EINVAL; | ||
71 | |||
72 | spin_lock_irqsave(&clk_lock, flags); | ||
73 | __clk_enable(clk); | ||
74 | spin_unlock_irqrestore(&clk_lock, flags); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | EXPORT_SYMBOL(clk_enable); | ||
79 | |||
80 | static void __clk_disable(struct clk *clk) | ||
81 | { | ||
82 | if (!clk) | ||
83 | return; | ||
84 | |||
85 | BUG_ON(clk->use_cnt == 0); | ||
86 | |||
87 | if (--clk->use_cnt == 0) { | ||
88 | if (clk_is_pll1(clk)) { /* PLL1 */ | ||
89 | chipcHw_pll1Disable(); | ||
90 | } else if (clk_is_pll2(clk)) { /* PLL2 */ | ||
91 | chipcHw_pll2Disable(); | ||
92 | } else if (clk_is_using_xtal(clk)) { /* source is crystal */ | ||
93 | if (!clk_is_primary(clk)) | ||
94 | chipcHw_bypassClockDisable(clk->csp_id); | ||
95 | } else { /* source is PLL */ | ||
96 | chipcHw_setClockDisable(clk->csp_id); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | if (clk->parent) | ||
101 | __clk_disable(clk->parent); | ||
102 | } | ||
103 | |||
104 | void clk_disable(struct clk *clk) | ||
105 | { | ||
106 | unsigned long flags; | ||
107 | |||
108 | if (!clk) | ||
109 | return; | ||
110 | |||
111 | spin_lock_irqsave(&clk_lock, flags); | ||
112 | __clk_disable(clk); | ||
113 | spin_unlock_irqrestore(&clk_lock, flags); | ||
114 | } | ||
115 | EXPORT_SYMBOL(clk_disable); | ||
116 | |||
117 | unsigned long clk_get_rate(struct clk *clk) | ||
118 | { | ||
119 | if (!clk) | ||
120 | return 0; | ||
121 | |||
122 | return clk->rate_hz; | ||
123 | } | ||
124 | EXPORT_SYMBOL(clk_get_rate); | ||
125 | |||
126 | long clk_round_rate(struct clk *clk, unsigned long rate) | ||
127 | { | ||
128 | unsigned long flags; | ||
129 | unsigned long actual; | ||
130 | unsigned long rate_hz; | ||
131 | |||
132 | if (!clk) | ||
133 | return -EINVAL; | ||
134 | |||
135 | if (!clk_is_programmable(clk)) | ||
136 | return -EINVAL; | ||
137 | |||
138 | if (clk->use_cnt) | ||
139 | return -EBUSY; | ||
140 | |||
141 | spin_lock_irqsave(&clk_lock, flags); | ||
142 | actual = clk->parent->rate_hz; | ||
143 | rate_hz = min(actual, rate); | ||
144 | spin_unlock_irqrestore(&clk_lock, flags); | ||
145 | |||
146 | return rate_hz; | ||
147 | } | ||
148 | EXPORT_SYMBOL(clk_round_rate); | ||
149 | |||
150 | int clk_set_rate(struct clk *clk, unsigned long rate) | ||
151 | { | ||
152 | unsigned long flags; | ||
153 | unsigned long actual; | ||
154 | unsigned long rate_hz; | ||
155 | |||
156 | if (!clk) | ||
157 | return -EINVAL; | ||
158 | |||
159 | if (!clk_is_programmable(clk)) | ||
160 | return -EINVAL; | ||
161 | |||
162 | if (clk->use_cnt) | ||
163 | return -EBUSY; | ||
164 | |||
165 | spin_lock_irqsave(&clk_lock, flags); | ||
166 | actual = clk->parent->rate_hz; | ||
167 | rate_hz = min(actual, rate); | ||
168 | rate_hz = chipcHw_setClockFrequency(clk->csp_id, rate_hz); | ||
169 | clk->rate_hz = rate_hz; | ||
170 | spin_unlock_irqrestore(&clk_lock, flags); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | EXPORT_SYMBOL(clk_set_rate); | ||
175 | |||
176 | struct clk *clk_get_parent(struct clk *clk) | ||
177 | { | ||
178 | if (!clk) | ||
179 | return NULL; | ||
180 | |||
181 | return clk->parent; | ||
182 | } | ||
183 | EXPORT_SYMBOL(clk_get_parent); | ||
184 | |||
185 | int clk_set_parent(struct clk *clk, struct clk *parent) | ||
186 | { | ||
187 | unsigned long flags; | ||
188 | struct clk *old_parent; | ||
189 | |||
190 | if (!clk || !parent) | ||
191 | return -EINVAL; | ||
192 | |||
193 | if (!clk_is_primary(parent) || !clk_is_bypassable(clk)) | ||
194 | return -EINVAL; | ||
195 | |||
196 | /* if more than one user, parent is not allowed */ | ||
197 | if (clk->use_cnt > 1) | ||
198 | return -EBUSY; | ||
199 | |||
200 | if (clk->parent == parent) | ||
201 | return 0; | ||
202 | |||
203 | spin_lock_irqsave(&clk_lock, flags); | ||
204 | old_parent = clk->parent; | ||
205 | clk->parent = parent; | ||
206 | if (clk_is_using_xtal(parent)) | ||
207 | clk->mode |= CLK_MODE_XTAL; | ||
208 | else | ||
209 | clk->mode &= (~CLK_MODE_XTAL); | ||
210 | |||
211 | /* if clock is active */ | ||
212 | if (clk->use_cnt != 0) { | ||
213 | clk->use_cnt--; | ||
214 | /* enable clock with the new parent */ | ||
215 | __clk_enable(clk); | ||
216 | /* disable the old parent */ | ||
217 | __clk_disable(old_parent); | ||
218 | } | ||
219 | spin_unlock_irqrestore(&clk_lock, flags); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | EXPORT_SYMBOL(clk_set_parent); | ||
diff --git a/arch/arm/mach-bcmring/clock.h b/arch/arm/mach-bcmring/clock.h deleted file mode 100644 index 5e0b98138973..000000000000 --- a/arch/arm/mach-bcmring/clock.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2001 - 2009 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | #include <mach/csp/chipcHw_def.h> | ||
15 | |||
16 | #define CLK_TYPE_PRIMARY 1 /* primary clock must NOT have a parent */ | ||
17 | #define CLK_TYPE_PLL1 2 /* PPL1 */ | ||
18 | #define CLK_TYPE_PLL2 4 /* PPL2 */ | ||
19 | #define CLK_TYPE_PROGRAMMABLE 8 /* programmable clock rate */ | ||
20 | #define CLK_TYPE_BYPASSABLE 16 /* parent can be changed */ | ||
21 | |||
22 | #define CLK_MODE_XTAL 1 /* clock source is from crystal */ | ||
23 | |||
24 | struct clk { | ||
25 | const char *name; /* clock name */ | ||
26 | unsigned int type; /* clock type */ | ||
27 | unsigned int mode; /* current mode */ | ||
28 | volatile int use_bypass; /* indicate if it's in bypass mode */ | ||
29 | chipcHw_CLOCK_e csp_id; /* clock ID for CSP CHIPC */ | ||
30 | unsigned long rate_hz; /* clock rate in Hz */ | ||
31 | unsigned int use_cnt; /* usage count */ | ||
32 | struct clk *parent; /* parent clock */ | ||
33 | }; | ||
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c deleted file mode 100644 index 4b50228a6771..000000000000 --- a/arch/arm/mach-bcmring/core.c +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | /* | ||
2 | * derived from linux/arch/arm/mach-versatile/core.c | ||
3 | * linux/arch/arm/mach-bcmring/core.c | ||
4 | * | ||
5 | * Copyright (C) 1999 - 2003 ARM Limited | ||
6 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
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 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | /* Portions copyright Broadcom 2008 */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/device.h> | ||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/amba/bus.h> | ||
30 | #include <linux/clkdev.h> | ||
31 | |||
32 | #include <mach/csp/mm_addr.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <linux/io.h> | ||
35 | #include <asm/irq.h> | ||
36 | #include <asm/hardware/arm_timer.h> | ||
37 | #include <asm/hardware/timer-sp.h> | ||
38 | #include <asm/mach-types.h> | ||
39 | |||
40 | #include <asm/mach/arch.h> | ||
41 | #include <asm/mach/flash.h> | ||
42 | #include <asm/mach/irq.h> | ||
43 | #include <asm/mach/time.h> | ||
44 | #include <asm/mach/map.h> | ||
45 | |||
46 | #include <mach/cfg_global.h> | ||
47 | |||
48 | #include "clock.h" | ||
49 | |||
50 | #include <mach/csp/secHw_def.h> | ||
51 | #include <mach/csp/chipcHw_inline.h> | ||
52 | #include <mach/csp/tmrHw_reg.h> | ||
53 | |||
54 | static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL); | ||
55 | static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL); | ||
56 | |||
57 | static struct clk pll1_clk = { | ||
58 | .name = "PLL1", | ||
59 | .type = CLK_TYPE_PRIMARY | CLK_TYPE_PLL1, | ||
60 | .rate_hz = 2000000000, | ||
61 | .use_cnt = 7, | ||
62 | }; | ||
63 | |||
64 | static struct clk uart_clk = { | ||
65 | .name = "UART", | ||
66 | .type = CLK_TYPE_PROGRAMMABLE, | ||
67 | .csp_id = chipcHw_CLOCK_UART, | ||
68 | .rate_hz = HW_CFG_UART_CLK_HZ, | ||
69 | .parent = &pll1_clk, | ||
70 | }; | ||
71 | |||
72 | static struct clk dummy_apb_pclk = { | ||
73 | .name = "BUSCLK", | ||
74 | .type = CLK_TYPE_PRIMARY, | ||
75 | .mode = CLK_MODE_XTAL, | ||
76 | }; | ||
77 | |||
78 | /* Timer 0 - 25 MHz, Timer3 at bus clock rate, typically 150-166 MHz */ | ||
79 | #if defined(CONFIG_ARCH_FPGA11107) | ||
80 | /* fpga cpu/bus are currently 30 times slower so scale frequency as well to */ | ||
81 | /* slow down Linux's sense of time */ | ||
82 | #define TIMER0_FREQUENCY_MHZ (tmrHw_LOW_FREQUENCY_MHZ * 30) | ||
83 | #define TIMER1_FREQUENCY_MHZ (tmrHw_LOW_FREQUENCY_MHZ * 30) | ||
84 | #define TIMER3_FREQUENCY_MHZ (tmrHw_HIGH_FREQUENCY_MHZ * 30) | ||
85 | #define TIMER3_FREQUENCY_KHZ (tmrHw_HIGH_FREQUENCY_HZ / 1000 * 30) | ||
86 | #else | ||
87 | #define TIMER0_FREQUENCY_MHZ tmrHw_LOW_FREQUENCY_MHZ | ||
88 | #define TIMER1_FREQUENCY_MHZ tmrHw_LOW_FREQUENCY_MHZ | ||
89 | #define TIMER3_FREQUENCY_MHZ tmrHw_HIGH_FREQUENCY_MHZ | ||
90 | #define TIMER3_FREQUENCY_KHZ (tmrHw_HIGH_FREQUENCY_HZ / 1000) | ||
91 | #endif | ||
92 | |||
93 | static struct clk sp804_timer012_clk = { | ||
94 | .name = "sp804-timer-0,1,2", | ||
95 | .type = CLK_TYPE_PRIMARY, | ||
96 | .mode = CLK_MODE_XTAL, | ||
97 | .rate_hz = TIMER1_FREQUENCY_MHZ * 1000000, | ||
98 | }; | ||
99 | |||
100 | static struct clk sp804_timer3_clk = { | ||
101 | .name = "sp804-timer-3", | ||
102 | .type = CLK_TYPE_PRIMARY, | ||
103 | .mode = CLK_MODE_XTAL, | ||
104 | .rate_hz = TIMER3_FREQUENCY_KHZ * 1000, | ||
105 | }; | ||
106 | |||
107 | static struct clk_lookup lookups[] = { | ||
108 | { /* Bus clock */ | ||
109 | .con_id = "apb_pclk", | ||
110 | .clk = &dummy_apb_pclk, | ||
111 | }, { /* UART0 */ | ||
112 | .dev_id = "uarta", | ||
113 | .clk = &uart_clk, | ||
114 | }, { /* UART1 */ | ||
115 | .dev_id = "uartb", | ||
116 | .clk = &uart_clk, | ||
117 | }, { /* SP804 timer 0 */ | ||
118 | .dev_id = "sp804", | ||
119 | .con_id = "timer0", | ||
120 | .clk = &sp804_timer012_clk, | ||
121 | }, { /* SP804 timer 1 */ | ||
122 | .dev_id = "sp804", | ||
123 | .con_id = "timer1", | ||
124 | .clk = &sp804_timer012_clk, | ||
125 | }, { /* SP804 timer 3 */ | ||
126 | .dev_id = "sp804", | ||
127 | .con_id = "timer3", | ||
128 | .clk = &sp804_timer3_clk, | ||
129 | } | ||
130 | }; | ||
131 | |||
132 | static struct amba_device *amba_devs[] __initdata = { | ||
133 | &uartA_device, | ||
134 | &uartB_device, | ||
135 | }; | ||
136 | |||
137 | void __init bcmring_amba_init(void) | ||
138 | { | ||
139 | int i; | ||
140 | u32 bus_clock; | ||
141 | |||
142 | /* Linux is run initially in non-secure mode. Secure peripherals */ | ||
143 | /* generate FIQ, and must be handled in secure mode. Until we have */ | ||
144 | /* a linux security monitor implementation, keep everything in */ | ||
145 | /* non-secure mode. */ | ||
146 | chipcHw_busInterfaceClockEnable(chipcHw_REG_BUS_CLOCK_SPU); | ||
147 | secHw_setUnsecure(secHw_BLK_MASK_CHIP_CONTROL | | ||
148 | secHw_BLK_MASK_KEY_SCAN | | ||
149 | secHw_BLK_MASK_TOUCH_SCREEN | | ||
150 | secHw_BLK_MASK_UART0 | | ||
151 | secHw_BLK_MASK_UART1 | | ||
152 | secHw_BLK_MASK_WATCHDOG | | ||
153 | secHw_BLK_MASK_SPUM | | ||
154 | secHw_BLK_MASK_DDR2 | | ||
155 | secHw_BLK_MASK_SPU | | ||
156 | secHw_BLK_MASK_PKA | | ||
157 | secHw_BLK_MASK_RNG | | ||
158 | secHw_BLK_MASK_RTC | | ||
159 | secHw_BLK_MASK_OTP | | ||
160 | secHw_BLK_MASK_BOOT | | ||
161 | secHw_BLK_MASK_MPU | | ||
162 | secHw_BLK_MASK_TZCTRL | secHw_BLK_MASK_INTR); | ||
163 | |||
164 | /* Only the devices attached to the AMBA bus are enabled just before the bus is */ | ||
165 | /* scanned and the drivers are loaded. The clocks need to be on for the AMBA bus */ | ||
166 | /* driver to access these blocks. The bus is probed, and the drivers are loaded. */ | ||
167 | /* FIXME Need to remove enable of PIF once CLCD clock enable used properly in FPGA. */ | ||
168 | bus_clock = chipcHw_REG_BUS_CLOCK_GE | ||
169 | | chipcHw_REG_BUS_CLOCK_SDIO0 | chipcHw_REG_BUS_CLOCK_SDIO1; | ||
170 | |||
171 | chipcHw_busInterfaceClockEnable(bus_clock); | ||
172 | |||
173 | for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { | ||
174 | struct amba_device *d = amba_devs[i]; | ||
175 | amba_device_register(d, &iomem_resource); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | /* | ||
180 | * Where is the timer (VA)? | ||
181 | */ | ||
182 | #define TIMER0_VA_BASE ((void __iomem *)MM_IO_BASE_TMR) | ||
183 | #define TIMER1_VA_BASE ((void __iomem *)(MM_IO_BASE_TMR + 0x20)) | ||
184 | #define TIMER2_VA_BASE ((void __iomem *)(MM_IO_BASE_TMR + 0x40)) | ||
185 | #define TIMER3_VA_BASE ((void __iomem *)(MM_IO_BASE_TMR + 0x60)) | ||
186 | |||
187 | static int __init bcmring_clocksource_init(void) | ||
188 | { | ||
189 | /* setup timer1 as free-running clocksource */ | ||
190 | sp804_clocksource_init(TIMER1_VA_BASE, "timer1"); | ||
191 | |||
192 | /* setup timer3 as free-running clocksource */ | ||
193 | sp804_clocksource_init(TIMER3_VA_BASE, "timer3"); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * Set up timer interrupt, and return the current time in seconds. | ||
200 | */ | ||
201 | void __init bcmring_init_timer(void) | ||
202 | { | ||
203 | printk(KERN_INFO "bcmring_init_timer\n"); | ||
204 | /* | ||
205 | * Initialise to a known state (all timers off) | ||
206 | */ | ||
207 | writel(0, TIMER0_VA_BASE + TIMER_CTRL); | ||
208 | writel(0, TIMER1_VA_BASE + TIMER_CTRL); | ||
209 | writel(0, TIMER2_VA_BASE + TIMER_CTRL); | ||
210 | writel(0, TIMER3_VA_BASE + TIMER_CTRL); | ||
211 | |||
212 | /* | ||
213 | * Make irqs happen for the system timer | ||
214 | */ | ||
215 | bcmring_clocksource_init(); | ||
216 | |||
217 | sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMER0, "timer0"); | ||
218 | } | ||
219 | |||
220 | struct sys_timer bcmring_timer = { | ||
221 | .init = bcmring_init_timer, | ||
222 | }; | ||
223 | |||
224 | void __init bcmring_init_early(void) | ||
225 | { | ||
226 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | ||
227 | } | ||
diff --git a/arch/arm/mach-bcmring/core.h b/arch/arm/mach-bcmring/core.h deleted file mode 100644 index e0e02c48f9b1..000000000000 --- a/arch/arm/mach-bcmring/core.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-versatile/core.h | ||
3 | * | ||
4 | * Copyright (C) 2004 ARM Limited | ||
5 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | /* Portions copyright Broadcom 2008 */ | ||
22 | #ifndef __ASM_ARCH_BCMRING_H | ||
23 | #define __ASM_ARCH_BCMRING_H | ||
24 | |||
25 | void __init bcmring_amba_init(void); | ||
26 | void __init bcmring_map_io(void); | ||
27 | void __init bcmring_init_irq(void); | ||
28 | void __init bcmring_init_early(void); | ||
29 | |||
30 | extern struct sys_timer bcmring_timer; | ||
31 | #endif | ||
diff --git a/arch/arm/mach-bcmring/csp/Makefile b/arch/arm/mach-bcmring/csp/Makefile deleted file mode 100644 index 648c0377530e..000000000000 --- a/arch/arm/mach-bcmring/csp/Makefile +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | obj-y += dmac/ | ||
2 | obj-y += tmr/ | ||
3 | obj-y += chipc/ | ||
diff --git a/arch/arm/mach-bcmring/csp/chipc/Makefile b/arch/arm/mach-bcmring/csp/chipc/Makefile deleted file mode 100644 index 673952768ee5..000000000000 --- a/arch/arm/mach-bcmring/csp/chipc/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-y += chipcHw.o chipcHw_str.o chipcHw_reset.o chipcHw_init.o | ||
diff --git a/arch/arm/mach-bcmring/csp/chipc/chipcHw.c b/arch/arm/mach-bcmring/csp/chipc/chipcHw.c deleted file mode 100644 index 5050833817b7..000000000000 --- a/arch/arm/mach-bcmring/csp/chipc/chipcHw.c +++ /dev/null | |||
@@ -1,779 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file chipcHw.c | ||
18 | * | ||
19 | * @brief Low level Various CHIP clock controlling routines | ||
20 | * | ||
21 | * @note | ||
22 | * | ||
23 | * These routines provide basic clock controlling functionality only. | ||
24 | */ | ||
25 | /****************************************************************************/ | ||
26 | |||
27 | /* ---- Include Files ---------------------------------------------------- */ | ||
28 | |||
29 | #include <linux/errno.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/export.h> | ||
32 | |||
33 | #include <mach/csp/chipcHw_def.h> | ||
34 | #include <mach/csp/chipcHw_inline.h> | ||
35 | |||
36 | #include <mach/csp/reg.h> | ||
37 | #include <linux/delay.h> | ||
38 | |||
39 | /* ---- Private Constants and Types --------------------------------------- */ | ||
40 | |||
41 | /* VPM alignment algorithm uses this */ | ||
42 | #define MAX_PHASE_ADJUST_COUNT 0xFFFF /* Max number of times allowed to adjust the phase */ | ||
43 | #define MAX_PHASE_ALIGN_ATTEMPTS 10 /* Max number of attempt to align the phase */ | ||
44 | |||
45 | /* Local definition of clock type */ | ||
46 | #define PLL_CLOCK 1 /* PLL Clock */ | ||
47 | #define NON_PLL_CLOCK 2 /* Divider clock */ | ||
48 | |||
49 | static int chipcHw_divide(int num, int denom) | ||
50 | __attribute__ ((section(".aramtext"))); | ||
51 | |||
52 | /****************************************************************************/ | ||
53 | /** | ||
54 | * @brief Set clock fequency for miscellaneous configurable clocks | ||
55 | * | ||
56 | * This function sets clock frequency | ||
57 | * | ||
58 | * @return Configured clock frequency in hertz | ||
59 | * | ||
60 | */ | ||
61 | /****************************************************************************/ | ||
62 | chipcHw_freq chipcHw_getClockFrequency(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
63 | ) { | ||
64 | uint32_t __iomem *pPLLReg = NULL; | ||
65 | uint32_t __iomem *pClockCtrl = NULL; | ||
66 | uint32_t __iomem *pDependentClock = NULL; | ||
67 | uint32_t vcoFreqPll1Hz = 0; /* Effective VCO frequency for PLL1 in Hz */ | ||
68 | uint32_t vcoFreqPll2Hz = 0; /* Effective VCO frequency for PLL2 in Hz */ | ||
69 | uint32_t dependentClockType = 0; | ||
70 | uint32_t vcoHz = 0; | ||
71 | |||
72 | /* Get VCO frequencies */ | ||
73 | if ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASK) != chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER) { | ||
74 | uint64_t adjustFreq = 0; | ||
75 | |||
76 | vcoFreqPll1Hz = chipcHw_XTAL_FREQ_Hz * | ||
77 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
78 | ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
79 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
80 | |||
81 | /* Adjusted frequency due to chipcHw_REG_PLL_DIVIDER_NDIV_f_SS */ | ||
82 | adjustFreq = (uint64_t) chipcHw_XTAL_FREQ_Hz * | ||
83 | (uint64_t) chipcHw_REG_PLL_DIVIDER_NDIV_f_SS * | ||
84 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, (chipcHw_REG_PLL_PREDIVIDER_P2 * (uint64_t) chipcHw_REG_PLL_DIVIDER_FRAC)); | ||
85 | vcoFreqPll1Hz += (uint32_t) adjustFreq; | ||
86 | } else { | ||
87 | vcoFreqPll1Hz = chipcHw_XTAL_FREQ_Hz * | ||
88 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
89 | ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
90 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
91 | } | ||
92 | vcoFreqPll2Hz = | ||
93 | chipcHw_XTAL_FREQ_Hz * | ||
94 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
95 | ((readl(&pChipcHw->PLLPreDivider2) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
96 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
97 | |||
98 | switch (clock) { | ||
99 | case chipcHw_CLOCK_DDR: | ||
100 | pPLLReg = &pChipcHw->DDRClock; | ||
101 | vcoHz = vcoFreqPll1Hz; | ||
102 | break; | ||
103 | case chipcHw_CLOCK_ARM: | ||
104 | pPLLReg = &pChipcHw->ARMClock; | ||
105 | vcoHz = vcoFreqPll1Hz; | ||
106 | break; | ||
107 | case chipcHw_CLOCK_ESW: | ||
108 | pPLLReg = &pChipcHw->ESWClock; | ||
109 | vcoHz = vcoFreqPll1Hz; | ||
110 | break; | ||
111 | case chipcHw_CLOCK_VPM: | ||
112 | pPLLReg = &pChipcHw->VPMClock; | ||
113 | vcoHz = vcoFreqPll1Hz; | ||
114 | break; | ||
115 | case chipcHw_CLOCK_ESW125: | ||
116 | pPLLReg = &pChipcHw->ESW125Clock; | ||
117 | vcoHz = vcoFreqPll1Hz; | ||
118 | break; | ||
119 | case chipcHw_CLOCK_UART: | ||
120 | pPLLReg = &pChipcHw->UARTClock; | ||
121 | vcoHz = vcoFreqPll1Hz; | ||
122 | break; | ||
123 | case chipcHw_CLOCK_SDIO0: | ||
124 | pPLLReg = &pChipcHw->SDIO0Clock; | ||
125 | vcoHz = vcoFreqPll1Hz; | ||
126 | break; | ||
127 | case chipcHw_CLOCK_SDIO1: | ||
128 | pPLLReg = &pChipcHw->SDIO1Clock; | ||
129 | vcoHz = vcoFreqPll1Hz; | ||
130 | break; | ||
131 | case chipcHw_CLOCK_SPI: | ||
132 | pPLLReg = &pChipcHw->SPIClock; | ||
133 | vcoHz = vcoFreqPll1Hz; | ||
134 | break; | ||
135 | case chipcHw_CLOCK_ETM: | ||
136 | pPLLReg = &pChipcHw->ETMClock; | ||
137 | vcoHz = vcoFreqPll1Hz; | ||
138 | break; | ||
139 | case chipcHw_CLOCK_USB: | ||
140 | pPLLReg = &pChipcHw->USBClock; | ||
141 | vcoHz = vcoFreqPll2Hz; | ||
142 | break; | ||
143 | case chipcHw_CLOCK_LCD: | ||
144 | pPLLReg = &pChipcHw->LCDClock; | ||
145 | vcoHz = vcoFreqPll2Hz; | ||
146 | break; | ||
147 | case chipcHw_CLOCK_APM: | ||
148 | pPLLReg = &pChipcHw->APMClock; | ||
149 | vcoHz = vcoFreqPll2Hz; | ||
150 | break; | ||
151 | case chipcHw_CLOCK_BUS: | ||
152 | pClockCtrl = &pChipcHw->ACLKClock; | ||
153 | pDependentClock = &pChipcHw->ARMClock; | ||
154 | vcoHz = vcoFreqPll1Hz; | ||
155 | dependentClockType = PLL_CLOCK; | ||
156 | break; | ||
157 | case chipcHw_CLOCK_OTP: | ||
158 | pClockCtrl = &pChipcHw->OTPClock; | ||
159 | break; | ||
160 | case chipcHw_CLOCK_I2C: | ||
161 | pClockCtrl = &pChipcHw->I2CClock; | ||
162 | break; | ||
163 | case chipcHw_CLOCK_I2S0: | ||
164 | pClockCtrl = &pChipcHw->I2S0Clock; | ||
165 | break; | ||
166 | case chipcHw_CLOCK_RTBUS: | ||
167 | pClockCtrl = &pChipcHw->RTBUSClock; | ||
168 | pDependentClock = &pChipcHw->ACLKClock; | ||
169 | dependentClockType = NON_PLL_CLOCK; | ||
170 | break; | ||
171 | case chipcHw_CLOCK_APM100: | ||
172 | pClockCtrl = &pChipcHw->APM100Clock; | ||
173 | pDependentClock = &pChipcHw->APMClock; | ||
174 | vcoHz = vcoFreqPll2Hz; | ||
175 | dependentClockType = PLL_CLOCK; | ||
176 | break; | ||
177 | case chipcHw_CLOCK_TSC: | ||
178 | pClockCtrl = &pChipcHw->TSCClock; | ||
179 | break; | ||
180 | case chipcHw_CLOCK_LED: | ||
181 | pClockCtrl = &pChipcHw->LEDClock; | ||
182 | break; | ||
183 | case chipcHw_CLOCK_I2S1: | ||
184 | pClockCtrl = &pChipcHw->I2S1Clock; | ||
185 | break; | ||
186 | } | ||
187 | |||
188 | if (pPLLReg) { | ||
189 | /* Obtain PLL clock frequency */ | ||
190 | if (readl(pPLLReg) & chipcHw_REG_PLL_CLOCK_BYPASS_SELECT) { | ||
191 | /* Return crystal clock frequency when bypassed */ | ||
192 | return chipcHw_XTAL_FREQ_Hz; | ||
193 | } else if (clock == chipcHw_CLOCK_DDR) { | ||
194 | /* DDR frequency is configured in PLLDivider register */ | ||
195 | return chipcHw_divide (vcoHz, (((readl(&pChipcHw->PLLDivider) & 0xFF000000) >> 24) ? ((readl(&pChipcHw->PLLDivider) & 0xFF000000) >> 24) : 256)); | ||
196 | } else { | ||
197 | /* From chip revision number B0, LCD clock is internally divided by 2 */ | ||
198 | if ((pPLLReg == &pChipcHw->LCDClock) && (chipcHw_getChipRevisionNumber() != chipcHw_REV_NUMBER_A0)) { | ||
199 | vcoHz >>= 1; | ||
200 | } | ||
201 | /* Obtain PLL clock frequency using VCO dividers */ | ||
202 | return chipcHw_divide(vcoHz, ((readl(pPLLReg) & chipcHw_REG_PLL_CLOCK_MDIV_MASK) ? (readl(pPLLReg) & chipcHw_REG_PLL_CLOCK_MDIV_MASK) : 256)); | ||
203 | } | ||
204 | } else if (pClockCtrl) { | ||
205 | /* Obtain divider clock frequency */ | ||
206 | uint32_t div; | ||
207 | uint32_t freq = 0; | ||
208 | |||
209 | if (readl(pClockCtrl) & chipcHw_REG_DIV_CLOCK_BYPASS_SELECT) { | ||
210 | /* Return crystal clock frequency when bypassed */ | ||
211 | return chipcHw_XTAL_FREQ_Hz; | ||
212 | } else if (pDependentClock) { | ||
213 | /* Identify the dependent clock frequency */ | ||
214 | switch (dependentClockType) { | ||
215 | case PLL_CLOCK: | ||
216 | if (readl(pDependentClock) & chipcHw_REG_PLL_CLOCK_BYPASS_SELECT) { | ||
217 | /* Use crystal clock frequency when dependent PLL clock is bypassed */ | ||
218 | freq = chipcHw_XTAL_FREQ_Hz; | ||
219 | } else { | ||
220 | /* Obtain PLL clock frequency using VCO dividers */ | ||
221 | div = readl(pDependentClock) & chipcHw_REG_PLL_CLOCK_MDIV_MASK; | ||
222 | freq = div ? chipcHw_divide(vcoHz, div) : 0; | ||
223 | } | ||
224 | break; | ||
225 | case NON_PLL_CLOCK: | ||
226 | if (pDependentClock == &pChipcHw->ACLKClock) { | ||
227 | freq = chipcHw_getClockFrequency (chipcHw_CLOCK_BUS); | ||
228 | } else { | ||
229 | if (readl(pDependentClock) & chipcHw_REG_DIV_CLOCK_BYPASS_SELECT) { | ||
230 | /* Use crystal clock frequency when dependent divider clock is bypassed */ | ||
231 | freq = chipcHw_XTAL_FREQ_Hz; | ||
232 | } else { | ||
233 | /* Obtain divider clock frequency using XTAL dividers */ | ||
234 | div = readl(pDependentClock) & chipcHw_REG_DIV_CLOCK_DIV_MASK; | ||
235 | freq = chipcHw_divide (chipcHw_XTAL_FREQ_Hz, (div ? div : 256)); | ||
236 | } | ||
237 | } | ||
238 | break; | ||
239 | } | ||
240 | } else { | ||
241 | /* Dependent on crystal clock */ | ||
242 | freq = chipcHw_XTAL_FREQ_Hz; | ||
243 | } | ||
244 | |||
245 | div = readl(pClockCtrl) & chipcHw_REG_DIV_CLOCK_DIV_MASK; | ||
246 | return chipcHw_divide(freq, (div ? div : 256)); | ||
247 | } | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | /****************************************************************************/ | ||
252 | /** | ||
253 | * @brief Set clock fequency for miscellaneous configurable clocks | ||
254 | * | ||
255 | * This function sets clock frequency | ||
256 | * | ||
257 | * @return Configured clock frequency in Hz | ||
258 | * | ||
259 | */ | ||
260 | /****************************************************************************/ | ||
261 | chipcHw_freq chipcHw_setClockFrequency(chipcHw_CLOCK_e clock, /* [ IN ] Configurable clock */ | ||
262 | uint32_t freq /* [ IN ] Clock frequency in Hz */ | ||
263 | ) { | ||
264 | uint32_t __iomem *pPLLReg = NULL; | ||
265 | uint32_t __iomem *pClockCtrl = NULL; | ||
266 | uint32_t __iomem *pDependentClock = NULL; | ||
267 | uint32_t vcoFreqPll1Hz = 0; /* Effective VCO frequency for PLL1 in Hz */ | ||
268 | uint32_t desVcoFreqPll1Hz = 0; /* Desired VCO frequency for PLL1 in Hz */ | ||
269 | uint32_t vcoFreqPll2Hz = 0; /* Effective VCO frequency for PLL2 in Hz */ | ||
270 | uint32_t dependentClockType = 0; | ||
271 | uint32_t vcoHz = 0; | ||
272 | uint32_t desVcoHz = 0; | ||
273 | |||
274 | /* Get VCO frequencies */ | ||
275 | if ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASK) != chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER) { | ||
276 | uint64_t adjustFreq = 0; | ||
277 | |||
278 | vcoFreqPll1Hz = chipcHw_XTAL_FREQ_Hz * | ||
279 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
280 | ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
281 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
282 | |||
283 | /* Adjusted frequency due to chipcHw_REG_PLL_DIVIDER_NDIV_f_SS */ | ||
284 | adjustFreq = (uint64_t) chipcHw_XTAL_FREQ_Hz * | ||
285 | (uint64_t) chipcHw_REG_PLL_DIVIDER_NDIV_f_SS * | ||
286 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, (chipcHw_REG_PLL_PREDIVIDER_P2 * (uint64_t) chipcHw_REG_PLL_DIVIDER_FRAC)); | ||
287 | vcoFreqPll1Hz += (uint32_t) adjustFreq; | ||
288 | |||
289 | /* Desired VCO frequency */ | ||
290 | desVcoFreqPll1Hz = chipcHw_XTAL_FREQ_Hz * | ||
291 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
292 | (((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
293 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT) + 1); | ||
294 | } else { | ||
295 | vcoFreqPll1Hz = desVcoFreqPll1Hz = chipcHw_XTAL_FREQ_Hz * | ||
296 | chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
297 | ((readl(&pChipcHw->PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
298 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
299 | } | ||
300 | vcoFreqPll2Hz = chipcHw_XTAL_FREQ_Hz * chipcHw_divide(chipcHw_REG_PLL_PREDIVIDER_P1, chipcHw_REG_PLL_PREDIVIDER_P2) * | ||
301 | ((readl(&pChipcHw->PLLPreDivider2) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK) >> | ||
302 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT); | ||
303 | |||
304 | switch (clock) { | ||
305 | case chipcHw_CLOCK_DDR: | ||
306 | /* Configure the DDR_ctrl:BUS ratio settings */ | ||
307 | { | ||
308 | REG_LOCAL_IRQ_SAVE; | ||
309 | /* Dvide DDR_phy by two to obtain DDR_ctrl clock */ | ||
310 | writel((readl(&pChipcHw->DDRClock) & ~chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_MASK) | ((((freq / 2) / chipcHw_getClockFrequency(chipcHw_CLOCK_BUS)) - 1) << chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_SHIFT), &pChipcHw->DDRClock); | ||
311 | REG_LOCAL_IRQ_RESTORE; | ||
312 | } | ||
313 | pPLLReg = &pChipcHw->DDRClock; | ||
314 | vcoHz = vcoFreqPll1Hz; | ||
315 | desVcoHz = desVcoFreqPll1Hz; | ||
316 | break; | ||
317 | case chipcHw_CLOCK_ARM: | ||
318 | pPLLReg = &pChipcHw->ARMClock; | ||
319 | vcoHz = vcoFreqPll1Hz; | ||
320 | desVcoHz = desVcoFreqPll1Hz; | ||
321 | break; | ||
322 | case chipcHw_CLOCK_ESW: | ||
323 | pPLLReg = &pChipcHw->ESWClock; | ||
324 | vcoHz = vcoFreqPll1Hz; | ||
325 | desVcoHz = desVcoFreqPll1Hz; | ||
326 | break; | ||
327 | case chipcHw_CLOCK_VPM: | ||
328 | /* Configure the VPM:BUS ratio settings */ | ||
329 | { | ||
330 | REG_LOCAL_IRQ_SAVE; | ||
331 | writel((readl(&pChipcHw->VPMClock) & ~chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_MASK) | ((chipcHw_divide (freq, chipcHw_getClockFrequency(chipcHw_CLOCK_BUS)) - 1) << chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_SHIFT), &pChipcHw->VPMClock); | ||
332 | REG_LOCAL_IRQ_RESTORE; | ||
333 | } | ||
334 | pPLLReg = &pChipcHw->VPMClock; | ||
335 | vcoHz = vcoFreqPll1Hz; | ||
336 | desVcoHz = desVcoFreqPll1Hz; | ||
337 | break; | ||
338 | case chipcHw_CLOCK_ESW125: | ||
339 | pPLLReg = &pChipcHw->ESW125Clock; | ||
340 | vcoHz = vcoFreqPll1Hz; | ||
341 | desVcoHz = desVcoFreqPll1Hz; | ||
342 | break; | ||
343 | case chipcHw_CLOCK_UART: | ||
344 | pPLLReg = &pChipcHw->UARTClock; | ||
345 | vcoHz = vcoFreqPll1Hz; | ||
346 | desVcoHz = desVcoFreqPll1Hz; | ||
347 | break; | ||
348 | case chipcHw_CLOCK_SDIO0: | ||
349 | pPLLReg = &pChipcHw->SDIO0Clock; | ||
350 | vcoHz = vcoFreqPll1Hz; | ||
351 | desVcoHz = desVcoFreqPll1Hz; | ||
352 | break; | ||
353 | case chipcHw_CLOCK_SDIO1: | ||
354 | pPLLReg = &pChipcHw->SDIO1Clock; | ||
355 | vcoHz = vcoFreqPll1Hz; | ||
356 | desVcoHz = desVcoFreqPll1Hz; | ||
357 | break; | ||
358 | case chipcHw_CLOCK_SPI: | ||
359 | pPLLReg = &pChipcHw->SPIClock; | ||
360 | vcoHz = vcoFreqPll1Hz; | ||
361 | desVcoHz = desVcoFreqPll1Hz; | ||
362 | break; | ||
363 | case chipcHw_CLOCK_ETM: | ||
364 | pPLLReg = &pChipcHw->ETMClock; | ||
365 | vcoHz = vcoFreqPll1Hz; | ||
366 | desVcoHz = desVcoFreqPll1Hz; | ||
367 | break; | ||
368 | case chipcHw_CLOCK_USB: | ||
369 | pPLLReg = &pChipcHw->USBClock; | ||
370 | vcoHz = vcoFreqPll2Hz; | ||
371 | desVcoHz = vcoFreqPll2Hz; | ||
372 | break; | ||
373 | case chipcHw_CLOCK_LCD: | ||
374 | pPLLReg = &pChipcHw->LCDClock; | ||
375 | vcoHz = vcoFreqPll2Hz; | ||
376 | desVcoHz = vcoFreqPll2Hz; | ||
377 | break; | ||
378 | case chipcHw_CLOCK_APM: | ||
379 | pPLLReg = &pChipcHw->APMClock; | ||
380 | vcoHz = vcoFreqPll2Hz; | ||
381 | desVcoHz = vcoFreqPll2Hz; | ||
382 | break; | ||
383 | case chipcHw_CLOCK_BUS: | ||
384 | pClockCtrl = &pChipcHw->ACLKClock; | ||
385 | pDependentClock = &pChipcHw->ARMClock; | ||
386 | vcoHz = vcoFreqPll1Hz; | ||
387 | desVcoHz = desVcoFreqPll1Hz; | ||
388 | dependentClockType = PLL_CLOCK; | ||
389 | break; | ||
390 | case chipcHw_CLOCK_OTP: | ||
391 | pClockCtrl = &pChipcHw->OTPClock; | ||
392 | break; | ||
393 | case chipcHw_CLOCK_I2C: | ||
394 | pClockCtrl = &pChipcHw->I2CClock; | ||
395 | break; | ||
396 | case chipcHw_CLOCK_I2S0: | ||
397 | pClockCtrl = &pChipcHw->I2S0Clock; | ||
398 | break; | ||
399 | case chipcHw_CLOCK_RTBUS: | ||
400 | pClockCtrl = &pChipcHw->RTBUSClock; | ||
401 | pDependentClock = &pChipcHw->ACLKClock; | ||
402 | dependentClockType = NON_PLL_CLOCK; | ||
403 | break; | ||
404 | case chipcHw_CLOCK_APM100: | ||
405 | pClockCtrl = &pChipcHw->APM100Clock; | ||
406 | pDependentClock = &pChipcHw->APMClock; | ||
407 | vcoHz = vcoFreqPll2Hz; | ||
408 | desVcoHz = vcoFreqPll2Hz; | ||
409 | dependentClockType = PLL_CLOCK; | ||
410 | break; | ||
411 | case chipcHw_CLOCK_TSC: | ||
412 | pClockCtrl = &pChipcHw->TSCClock; | ||
413 | break; | ||
414 | case chipcHw_CLOCK_LED: | ||
415 | pClockCtrl = &pChipcHw->LEDClock; | ||
416 | break; | ||
417 | case chipcHw_CLOCK_I2S1: | ||
418 | pClockCtrl = &pChipcHw->I2S1Clock; | ||
419 | break; | ||
420 | } | ||
421 | |||
422 | if (pPLLReg) { | ||
423 | /* Select XTAL as bypass source */ | ||
424 | reg32_modify_and(pPLLReg, ~chipcHw_REG_PLL_CLOCK_SOURCE_GPIO); | ||
425 | reg32_modify_or(pPLLReg, chipcHw_REG_PLL_CLOCK_BYPASS_SELECT); | ||
426 | /* For DDR settings use only the PLL divider clock */ | ||
427 | if (pPLLReg == &pChipcHw->DDRClock) { | ||
428 | /* Set M1DIV for PLL1, which controls the DDR clock */ | ||
429 | reg32_write(&pChipcHw->PLLDivider, (readl(&pChipcHw->PLLDivider) & 0x00FFFFFF) | ((chipcHw_REG_PLL_DIVIDER_MDIV (desVcoHz, freq)) << 24)); | ||
430 | /* Calculate expected frequency */ | ||
431 | freq = chipcHw_divide(vcoHz, (((readl(&pChipcHw->PLLDivider) & 0xFF000000) >> 24) ? ((readl(&pChipcHw->PLLDivider) & 0xFF000000) >> 24) : 256)); | ||
432 | } else { | ||
433 | /* From chip revision number B0, LCD clock is internally divided by 2 */ | ||
434 | if ((pPLLReg == &pChipcHw->LCDClock) && (chipcHw_getChipRevisionNumber() != chipcHw_REV_NUMBER_A0)) { | ||
435 | desVcoHz >>= 1; | ||
436 | vcoHz >>= 1; | ||
437 | } | ||
438 | /* Set MDIV to change the frequency */ | ||
439 | reg32_modify_and(pPLLReg, ~(chipcHw_REG_PLL_CLOCK_MDIV_MASK)); | ||
440 | reg32_modify_or(pPLLReg, chipcHw_REG_PLL_DIVIDER_MDIV(desVcoHz, freq)); | ||
441 | /* Calculate expected frequency */ | ||
442 | freq = chipcHw_divide(vcoHz, ((readl(pPLLReg) & chipcHw_REG_PLL_CLOCK_MDIV_MASK) ? (readl(pPLLReg) & chipcHw_REG_PLL_CLOCK_MDIV_MASK) : 256)); | ||
443 | } | ||
444 | /* Wait for for atleast 200ns as per the protocol to change frequency */ | ||
445 | udelay(1); | ||
446 | /* Do not bypass */ | ||
447 | reg32_modify_and(pPLLReg, ~chipcHw_REG_PLL_CLOCK_BYPASS_SELECT); | ||
448 | /* Return the configured frequency */ | ||
449 | return freq; | ||
450 | } else if (pClockCtrl) { | ||
451 | uint32_t divider = 0; | ||
452 | |||
453 | /* Divider clock should not be bypassed */ | ||
454 | reg32_modify_and(pClockCtrl, | ||
455 | ~chipcHw_REG_DIV_CLOCK_BYPASS_SELECT); | ||
456 | |||
457 | /* Identify the clock source */ | ||
458 | if (pDependentClock) { | ||
459 | switch (dependentClockType) { | ||
460 | case PLL_CLOCK: | ||
461 | divider = chipcHw_divide(chipcHw_divide (desVcoHz, (readl(pDependentClock) & chipcHw_REG_PLL_CLOCK_MDIV_MASK)), freq); | ||
462 | break; | ||
463 | case NON_PLL_CLOCK: | ||
464 | { | ||
465 | uint32_t sourceClock = 0; | ||
466 | |||
467 | if (pDependentClock == &pChipcHw->ACLKClock) { | ||
468 | sourceClock = chipcHw_getClockFrequency (chipcHw_CLOCK_BUS); | ||
469 | } else { | ||
470 | uint32_t div = readl(pDependentClock) & chipcHw_REG_DIV_CLOCK_DIV_MASK; | ||
471 | sourceClock = chipcHw_divide (chipcHw_XTAL_FREQ_Hz, ((div) ? div : 256)); | ||
472 | } | ||
473 | divider = chipcHw_divide(sourceClock, freq); | ||
474 | } | ||
475 | break; | ||
476 | } | ||
477 | } else { | ||
478 | divider = chipcHw_divide(chipcHw_XTAL_FREQ_Hz, freq); | ||
479 | } | ||
480 | |||
481 | if (divider) { | ||
482 | REG_LOCAL_IRQ_SAVE; | ||
483 | /* Set the divider to obtain the required frequency */ | ||
484 | writel((readl(pClockCtrl) & (~chipcHw_REG_DIV_CLOCK_DIV_MASK)) | (((divider > 256) ? chipcHw_REG_DIV_CLOCK_DIV_256 : divider) & chipcHw_REG_DIV_CLOCK_DIV_MASK), pClockCtrl); | ||
485 | REG_LOCAL_IRQ_RESTORE; | ||
486 | return freq; | ||
487 | } | ||
488 | } | ||
489 | |||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | EXPORT_SYMBOL(chipcHw_setClockFrequency); | ||
494 | |||
495 | /****************************************************************************/ | ||
496 | /** | ||
497 | * @brief Set VPM clock in sync with BUS clock for Chip Rev #A0 | ||
498 | * | ||
499 | * This function does the phase adjustment between VPM and BUS clock | ||
500 | * | ||
501 | * @return >= 0 : On success (# of adjustment required) | ||
502 | * -1 : On failure | ||
503 | * | ||
504 | */ | ||
505 | /****************************************************************************/ | ||
506 | static int vpmPhaseAlignA0(void) | ||
507 | { | ||
508 | uint32_t phaseControl; | ||
509 | uint32_t phaseValue; | ||
510 | uint32_t prevPhaseComp; | ||
511 | int iter = 0; | ||
512 | int adjustCount = 0; | ||
513 | int count = 0; | ||
514 | |||
515 | for (iter = 0; (iter < MAX_PHASE_ALIGN_ATTEMPTS) && (adjustCount < MAX_PHASE_ADJUST_COUNT); iter++) { | ||
516 | phaseControl = (readl(&pChipcHw->VPMClock) & chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK) >> chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT; | ||
517 | phaseValue = 0; | ||
518 | prevPhaseComp = 0; | ||
519 | |||
520 | /* Step 1: Look for falling PH_COMP transition */ | ||
521 | |||
522 | /* Read the contents of VPM Clock resgister */ | ||
523 | phaseValue = readl(&pChipcHw->VPMClock); | ||
524 | do { | ||
525 | /* Store previous value of phase comparator */ | ||
526 | prevPhaseComp = phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP; | ||
527 | /* Change the value of PH_CTRL. */ | ||
528 | reg32_write(&pChipcHw->VPMClock, | ||
529 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
530 | /* Wait atleast 20 ns */ | ||
531 | udelay(1); | ||
532 | /* Toggle the LOAD_CH after phase control is written. */ | ||
533 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
534 | /* Read the contents of VPM Clock resgister. */ | ||
535 | phaseValue = readl(&pChipcHw->VPMClock); | ||
536 | |||
537 | if ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) == 0x0) { | ||
538 | phaseControl = (0x3F & (phaseControl - 1)); | ||
539 | } else { | ||
540 | /* Increment to the Phase count value for next write, if Phase is not stable. */ | ||
541 | phaseControl = (0x3F & (phaseControl + 1)); | ||
542 | } | ||
543 | /* Count number of adjustment made */ | ||
544 | adjustCount++; | ||
545 | } while (((prevPhaseComp == (phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP)) || /* Look for a transition */ | ||
546 | ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) != 0x0)) && /* Look for a falling edge */ | ||
547 | (adjustCount < MAX_PHASE_ADJUST_COUNT) /* Do not exceed the limit while trying */ | ||
548 | ); | ||
549 | |||
550 | if (adjustCount >= MAX_PHASE_ADJUST_COUNT) { | ||
551 | /* Failed to align VPM phase after MAX_PHASE_ADJUST_COUNT tries */ | ||
552 | return -1; | ||
553 | } | ||
554 | |||
555 | /* Step 2: Keep moving forward to make sure falling PH_COMP transition was valid */ | ||
556 | |||
557 | for (count = 0; (count < 5) && ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) == 0); count++) { | ||
558 | phaseControl = (0x3F & (phaseControl + 1)); | ||
559 | reg32_write(&pChipcHw->VPMClock, | ||
560 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
561 | /* Wait atleast 20 ns */ | ||
562 | udelay(1); | ||
563 | /* Toggle the LOAD_CH after phase control is written. */ | ||
564 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
565 | phaseValue = readl(&pChipcHw->VPMClock); | ||
566 | /* Count number of adjustment made */ | ||
567 | adjustCount++; | ||
568 | } | ||
569 | |||
570 | if (adjustCount >= MAX_PHASE_ADJUST_COUNT) { | ||
571 | /* Failed to align VPM phase after MAX_PHASE_ADJUST_COUNT tries */ | ||
572 | return -1; | ||
573 | } | ||
574 | |||
575 | if (count != 5) { | ||
576 | /* Detected false transition */ | ||
577 | continue; | ||
578 | } | ||
579 | |||
580 | /* Step 3: Keep moving backward to make sure falling PH_COMP transition was stable */ | ||
581 | |||
582 | for (count = 0; (count < 3) && ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) == 0); count++) { | ||
583 | phaseControl = (0x3F & (phaseControl - 1)); | ||
584 | reg32_write(&pChipcHw->VPMClock, | ||
585 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
586 | /* Wait atleast 20 ns */ | ||
587 | udelay(1); | ||
588 | /* Toggle the LOAD_CH after phase control is written. */ | ||
589 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
590 | phaseValue = readl(&pChipcHw->VPMClock); | ||
591 | /* Count number of adjustment made */ | ||
592 | adjustCount++; | ||
593 | } | ||
594 | |||
595 | if (adjustCount >= MAX_PHASE_ADJUST_COUNT) { | ||
596 | /* Failed to align VPM phase after MAX_PHASE_ADJUST_COUNT tries */ | ||
597 | return -1; | ||
598 | } | ||
599 | |||
600 | if (count != 3) { | ||
601 | /* Detected noisy transition */ | ||
602 | continue; | ||
603 | } | ||
604 | |||
605 | /* Step 4: Keep moving backward before the original transition took place. */ | ||
606 | |||
607 | for (count = 0; (count < 5); count++) { | ||
608 | phaseControl = (0x3F & (phaseControl - 1)); | ||
609 | reg32_write(&pChipcHw->VPMClock, | ||
610 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
611 | /* Wait atleast 20 ns */ | ||
612 | udelay(1); | ||
613 | /* Toggle the LOAD_CH after phase control is written. */ | ||
614 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
615 | phaseValue = readl(&pChipcHw->VPMClock); | ||
616 | /* Count number of adjustment made */ | ||
617 | adjustCount++; | ||
618 | } | ||
619 | |||
620 | if (adjustCount >= MAX_PHASE_ADJUST_COUNT) { | ||
621 | /* Failed to align VPM phase after MAX_PHASE_ADJUST_COUNT tries */ | ||
622 | return -1; | ||
623 | } | ||
624 | |||
625 | if ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) == 0) { | ||
626 | /* Detected false transition */ | ||
627 | continue; | ||
628 | } | ||
629 | |||
630 | /* Step 5: Re discover the valid transition */ | ||
631 | |||
632 | do { | ||
633 | /* Store previous value of phase comparator */ | ||
634 | prevPhaseComp = phaseValue; | ||
635 | /* Change the value of PH_CTRL. */ | ||
636 | reg32_write(&pChipcHw->VPMClock, | ||
637 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
638 | /* Wait atleast 20 ns */ | ||
639 | udelay(1); | ||
640 | /* Toggle the LOAD_CH after phase control is written. */ | ||
641 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
642 | /* Read the contents of VPM Clock resgister. */ | ||
643 | phaseValue = readl(&pChipcHw->VPMClock); | ||
644 | |||
645 | if ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) == 0x0) { | ||
646 | phaseControl = (0x3F & (phaseControl - 1)); | ||
647 | } else { | ||
648 | /* Increment to the Phase count value for next write, if Phase is not stable. */ | ||
649 | phaseControl = (0x3F & (phaseControl + 1)); | ||
650 | } | ||
651 | |||
652 | /* Count number of adjustment made */ | ||
653 | adjustCount++; | ||
654 | } while (((prevPhaseComp == (phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP)) || ((phaseValue & chipcHw_REG_PLL_CLOCK_PHASE_COMP) != 0x0)) && (adjustCount < MAX_PHASE_ADJUST_COUNT)); | ||
655 | |||
656 | if (adjustCount >= MAX_PHASE_ADJUST_COUNT) { | ||
657 | /* Failed to align VPM phase after MAX_PHASE_ADJUST_COUNT tries */ | ||
658 | return -1; | ||
659 | } else { | ||
660 | /* Valid phase must have detected */ | ||
661 | break; | ||
662 | } | ||
663 | } | ||
664 | |||
665 | /* For VPM Phase should be perfectly aligned. */ | ||
666 | phaseControl = (((readl(&pChipcHw->VPMClock) >> chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT) - 1) & 0x3F); | ||
667 | { | ||
668 | REG_LOCAL_IRQ_SAVE; | ||
669 | |||
670 | writel((readl(&pChipcHw->VPMClock) & ~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT), &pChipcHw->VPMClock); | ||
671 | /* Load new phase value */ | ||
672 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
673 | |||
674 | REG_LOCAL_IRQ_RESTORE; | ||
675 | } | ||
676 | /* Return the status */ | ||
677 | return (int)adjustCount; | ||
678 | } | ||
679 | |||
680 | /****************************************************************************/ | ||
681 | /** | ||
682 | * @brief Set VPM clock in sync with BUS clock | ||
683 | * | ||
684 | * This function does the phase adjustment between VPM and BUS clock | ||
685 | * | ||
686 | * @return >= 0 : On success (# of adjustment required) | ||
687 | * -1 : On failure | ||
688 | * | ||
689 | */ | ||
690 | /****************************************************************************/ | ||
691 | int chipcHw_vpmPhaseAlign(void) | ||
692 | { | ||
693 | |||
694 | if (chipcHw_getChipRevisionNumber() == chipcHw_REV_NUMBER_A0) { | ||
695 | return vpmPhaseAlignA0(); | ||
696 | } else { | ||
697 | uint32_t phaseControl = chipcHw_getVpmPhaseControl(); | ||
698 | uint32_t phaseValue = 0; | ||
699 | int adjustCount = 0; | ||
700 | |||
701 | /* Disable VPM access */ | ||
702 | writel(readl(&pChipcHw->Spare1) & ~chipcHw_REG_SPARE1_VPM_BUS_ACCESS_ENABLE, &pChipcHw->Spare1); | ||
703 | /* Disable HW VPM phase alignment */ | ||
704 | chipcHw_vpmHwPhaseAlignDisable(); | ||
705 | /* Enable SW VPM phase alignment */ | ||
706 | chipcHw_vpmSwPhaseAlignEnable(); | ||
707 | /* Adjust VPM phase */ | ||
708 | while (adjustCount < MAX_PHASE_ADJUST_COUNT) { | ||
709 | phaseValue = chipcHw_getVpmHwPhaseAlignStatus(); | ||
710 | |||
711 | /* Adjust phase control value */ | ||
712 | if (phaseValue > 0xF) { | ||
713 | /* Increment phase control value */ | ||
714 | phaseControl++; | ||
715 | } else if (phaseValue < 0xF) { | ||
716 | /* Decrement phase control value */ | ||
717 | phaseControl--; | ||
718 | } else { | ||
719 | /* Enable VPM access */ | ||
720 | writel(readl(&pChipcHw->Spare1) | chipcHw_REG_SPARE1_VPM_BUS_ACCESS_ENABLE, &pChipcHw->Spare1); | ||
721 | /* Return adjust count */ | ||
722 | return adjustCount; | ||
723 | } | ||
724 | /* Change the value of PH_CTRL. */ | ||
725 | reg32_write(&pChipcHw->VPMClock, | ||
726 | (readl(&pChipcHw->VPMClock) & (~chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK)) | (phaseControl << chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT)); | ||
727 | /* Wait atleast 20 ns */ | ||
728 | udelay(1); | ||
729 | /* Toggle the LOAD_CH after phase control is written. */ | ||
730 | writel(readl(&pChipcHw->VPMClock) ^ chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE, &pChipcHw->VPMClock); | ||
731 | /* Count adjustment */ | ||
732 | adjustCount++; | ||
733 | } | ||
734 | } | ||
735 | |||
736 | /* Disable VPM access */ | ||
737 | writel(readl(&pChipcHw->Spare1) & ~chipcHw_REG_SPARE1_VPM_BUS_ACCESS_ENABLE, &pChipcHw->Spare1); | ||
738 | return -1; | ||
739 | } | ||
740 | |||
741 | /****************************************************************************/ | ||
742 | /** | ||
743 | * @brief Local Divide function | ||
744 | * | ||
745 | * This function does the divide | ||
746 | * | ||
747 | * @return divide value | ||
748 | * | ||
749 | */ | ||
750 | /****************************************************************************/ | ||
751 | static int chipcHw_divide(int num, int denom) | ||
752 | { | ||
753 | int r; | ||
754 | int t = 1; | ||
755 | |||
756 | /* Shift denom and t up to the largest value to optimize algorithm */ | ||
757 | /* t contains the units of each divide */ | ||
758 | while ((denom & 0x40000000) == 0) { /* fails if denom=0 */ | ||
759 | denom = denom << 1; | ||
760 | t = t << 1; | ||
761 | } | ||
762 | |||
763 | /* Initialize the result */ | ||
764 | r = 0; | ||
765 | |||
766 | do { | ||
767 | /* Determine if there exists a positive remainder */ | ||
768 | if ((num - denom) >= 0) { | ||
769 | /* Accumlate t to the result and calculate a new remainder */ | ||
770 | num = num - denom; | ||
771 | r = r + t; | ||
772 | } | ||
773 | /* Continue to shift denom and shift t down to 0 */ | ||
774 | denom = denom >> 1; | ||
775 | t = t >> 1; | ||
776 | } while (t != 0); | ||
777 | |||
778 | return r; | ||
779 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c b/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c deleted file mode 100644 index 8377d8054168..000000000000 --- a/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c +++ /dev/null | |||
@@ -1,283 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file chipcHw_init.c | ||
18 | * | ||
19 | * @brief Low level CHIPC PLL configuration functions | ||
20 | * | ||
21 | * @note | ||
22 | * | ||
23 | * These routines provide basic PLL controlling functionality only. | ||
24 | */ | ||
25 | /****************************************************************************/ | ||
26 | |||
27 | /* ---- Include Files ---------------------------------------------------- */ | ||
28 | |||
29 | #include <linux/errno.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/export.h> | ||
32 | |||
33 | #include <mach/csp/chipcHw_def.h> | ||
34 | #include <mach/csp/chipcHw_inline.h> | ||
35 | |||
36 | #include <mach/csp/reg.h> | ||
37 | #include <linux/delay.h> | ||
38 | /* ---- Private Constants and Types --------------------------------------- */ | ||
39 | |||
40 | /* | ||
41 | Calculation for NDIV_i to obtain VCO frequency | ||
42 | ----------------------------------------------- | ||
43 | |||
44 | Freq_vco = Freq_ref * (P2 / P1) * (PLL_NDIV_i + PLL_NDIV_f) | ||
45 | for Freq_vco = VCO_FREQ_MHz | ||
46 | Freq_ref = chipcHw_XTAL_FREQ_Hz | ||
47 | PLL_P1 = PLL_P2 = 1 | ||
48 | and | ||
49 | PLL_NDIV_f = 0 | ||
50 | |||
51 | We get: | ||
52 | PLL_NDIV_i = Freq_vco / Freq_ref = VCO_FREQ_MHz / chipcHw_XTAL_FREQ_Hz | ||
53 | |||
54 | Calculation for PLL MDIV to obtain frequency Freq_x for channel x | ||
55 | ----------------------------------------------------------------- | ||
56 | Freq_x = chipcHw_XTAL_FREQ_Hz * PLL_NDIV_i / PLL_MDIV_x = VCO_FREQ_MHz / PLL_MDIV_x | ||
57 | |||
58 | PLL_MDIV_x = VCO_FREQ_MHz / Freq_x | ||
59 | */ | ||
60 | |||
61 | /* ---- Private Variables ------------------------------------------------- */ | ||
62 | /****************************************************************************/ | ||
63 | /** | ||
64 | * @brief Initializes the PLL2 | ||
65 | * | ||
66 | * This function initializes the PLL2 | ||
67 | * | ||
68 | */ | ||
69 | /****************************************************************************/ | ||
70 | void chipcHw_pll2Enable(uint32_t vcoFreqHz) | ||
71 | { | ||
72 | uint32_t pllPreDivider2 = 0; | ||
73 | |||
74 | { | ||
75 | REG_LOCAL_IRQ_SAVE; | ||
76 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | | ||
77 | chipcHw_REG_PLL_CONFIG_A_RESET, | ||
78 | &pChipcHw->PLLConfig2); | ||
79 | |||
80 | pllPreDivider2 = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN | | ||
81 | chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER | | ||
82 | (chipcHw_REG_PLL_PREDIVIDER_NDIV_i(vcoFreqHz) << | ||
83 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT) | | ||
84 | (chipcHw_REG_PLL_PREDIVIDER_P1 << | ||
85 | chipcHw_REG_PLL_PREDIVIDER_P1_SHIFT) | | ||
86 | (chipcHw_REG_PLL_PREDIVIDER_P2 << | ||
87 | chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT); | ||
88 | |||
89 | /* Enable CHIPC registers to control the PLL */ | ||
90 | writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus); | ||
91 | |||
92 | /* Set pre divider to get desired VCO frequency */ | ||
93 | writel(pllPreDivider2, &pChipcHw->PLLPreDivider2); | ||
94 | /* Set NDIV Frac */ | ||
95 | writel(chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider2); | ||
96 | |||
97 | /* This has to be removed once the default values are fixed for PLL2. */ | ||
98 | writel(0x38000700, &pChipcHw->PLLControl12); | ||
99 | writel(0x00000015, &pChipcHw->PLLControl22); | ||
100 | |||
101 | /* Reset PLL2 */ | ||
102 | if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { | ||
103 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | | ||
104 | chipcHw_REG_PLL_CONFIG_A_RESET | | ||
105 | chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | | ||
106 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, | ||
107 | &pChipcHw->PLLConfig2); | ||
108 | } else { | ||
109 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | | ||
110 | chipcHw_REG_PLL_CONFIG_A_RESET | | ||
111 | chipcHw_REG_PLL_CONFIG_VCO_800_1600 | | ||
112 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, | ||
113 | &pChipcHw->PLLConfig2); | ||
114 | } | ||
115 | REG_LOCAL_IRQ_RESTORE; | ||
116 | } | ||
117 | |||
118 | /* Insert certain amount of delay before deasserting ARESET. */ | ||
119 | udelay(1); | ||
120 | |||
121 | { | ||
122 | REG_LOCAL_IRQ_SAVE; | ||
123 | /* Remove analog reset and Power on the PLL */ | ||
124 | writel(readl(&pChipcHw->PLLConfig2) & | ||
125 | ~(chipcHw_REG_PLL_CONFIG_A_RESET | | ||
126 | chipcHw_REG_PLL_CONFIG_POWER_DOWN), | ||
127 | &pChipcHw->PLLConfig2); | ||
128 | |||
129 | REG_LOCAL_IRQ_RESTORE; | ||
130 | |||
131 | } | ||
132 | |||
133 | /* Wait until PLL is locked */ | ||
134 | while (!(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED)) | ||
135 | ; | ||
136 | |||
137 | { | ||
138 | REG_LOCAL_IRQ_SAVE; | ||
139 | /* Remove digital reset */ | ||
140 | writel(readl(&pChipcHw->PLLConfig2) & | ||
141 | ~chipcHw_REG_PLL_CONFIG_D_RESET, | ||
142 | &pChipcHw->PLLConfig2); | ||
143 | |||
144 | REG_LOCAL_IRQ_RESTORE; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | EXPORT_SYMBOL(chipcHw_pll2Enable); | ||
149 | |||
150 | /****************************************************************************/ | ||
151 | /** | ||
152 | * @brief Initializes the PLL1 | ||
153 | * | ||
154 | * This function initializes the PLL1 | ||
155 | * | ||
156 | */ | ||
157 | /****************************************************************************/ | ||
158 | void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport) | ||
159 | { | ||
160 | uint32_t pllPreDivider = 0; | ||
161 | |||
162 | { | ||
163 | REG_LOCAL_IRQ_SAVE; | ||
164 | |||
165 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | | ||
166 | chipcHw_REG_PLL_CONFIG_A_RESET, | ||
167 | &pChipcHw->PLLConfig); | ||
168 | /* Setting VCO frequency */ | ||
169 | if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { | ||
170 | pllPreDivider = | ||
171 | chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASH_1_8 | | ||
172 | ((chipcHw_REG_PLL_PREDIVIDER_NDIV_i(vcoFreqHz) - | ||
173 | 1) << chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT) | | ||
174 | (chipcHw_REG_PLL_PREDIVIDER_P1 << | ||
175 | chipcHw_REG_PLL_PREDIVIDER_P1_SHIFT) | | ||
176 | (chipcHw_REG_PLL_PREDIVIDER_P2 << | ||
177 | chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT); | ||
178 | } else { | ||
179 | pllPreDivider = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN | | ||
180 | chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER | | ||
181 | (chipcHw_REG_PLL_PREDIVIDER_NDIV_i(vcoFreqHz) << | ||
182 | chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT) | | ||
183 | (chipcHw_REG_PLL_PREDIVIDER_P1 << | ||
184 | chipcHw_REG_PLL_PREDIVIDER_P1_SHIFT) | | ||
185 | (chipcHw_REG_PLL_PREDIVIDER_P2 << | ||
186 | chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT); | ||
187 | } | ||
188 | |||
189 | /* Enable CHIPC registers to control the PLL */ | ||
190 | writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus); | ||
191 | |||
192 | /* Set pre divider to get desired VCO frequency */ | ||
193 | writel(pllPreDivider, &pChipcHw->PLLPreDivider); | ||
194 | /* Set NDIV Frac */ | ||
195 | if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { | ||
196 | writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f_SS, &pChipcHw->PLLDivider); | ||
197 | } else { | ||
198 | writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider); | ||
199 | } | ||
200 | |||
201 | /* Reset PLL1 */ | ||
202 | if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { | ||
203 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig); | ||
204 | } else { | ||
205 | writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_800_1600 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig); | ||
206 | } | ||
207 | |||
208 | REG_LOCAL_IRQ_RESTORE; | ||
209 | |||
210 | /* Insert certain amount of delay before deasserting ARESET. */ | ||
211 | udelay(1); | ||
212 | |||
213 | { | ||
214 | REG_LOCAL_IRQ_SAVE; | ||
215 | /* Remove analog reset and Power on the PLL */ | ||
216 | writel(readl(&pChipcHw->PLLConfig) & ~(chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_POWER_DOWN), &pChipcHw->PLLConfig); | ||
217 | REG_LOCAL_IRQ_RESTORE; | ||
218 | } | ||
219 | |||
220 | /* Wait until PLL is locked */ | ||
221 | while (!(readl(&pChipcHw->PLLStatus) & chipcHw_REG_PLL_STATUS_LOCKED) | ||
222 | || !(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED)) | ||
223 | ; | ||
224 | |||
225 | /* Remove digital reset */ | ||
226 | { | ||
227 | REG_LOCAL_IRQ_SAVE; | ||
228 | writel(readl(&pChipcHw->PLLConfig) & ~chipcHw_REG_PLL_CONFIG_D_RESET, &pChipcHw->PLLConfig); | ||
229 | REG_LOCAL_IRQ_RESTORE; | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | |||
234 | EXPORT_SYMBOL(chipcHw_pll1Enable); | ||
235 | |||
236 | /****************************************************************************/ | ||
237 | /** | ||
238 | * @brief Initializes the chipc module | ||
239 | * | ||
240 | * This function initializes the PLLs and core system clocks | ||
241 | * | ||
242 | */ | ||
243 | /****************************************************************************/ | ||
244 | |||
245 | void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initialization parameter */ | ||
246 | ) { | ||
247 | #if !(defined(__KERNEL__) && !defined(STANDALONE)) | ||
248 | delay_init(); | ||
249 | #endif | ||
250 | |||
251 | /* Do not program PLL, when warm reset */ | ||
252 | if (!(chipcHw_getStickyBits() & chipcHw_REG_STICKY_CHIP_WARM_RESET)) { | ||
253 | chipcHw_pll1Enable(initParam->pllVcoFreqHz, | ||
254 | initParam->ssSupport); | ||
255 | chipcHw_pll2Enable(initParam->pll2VcoFreqHz); | ||
256 | } else { | ||
257 | /* Clear sticky bits */ | ||
258 | chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_WARM_RESET); | ||
259 | } | ||
260 | /* Clear sticky bits */ | ||
261 | chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_SOFT_RESET); | ||
262 | |||
263 | /* Before configuring the ARM clock, atleast we need to make sure BUS clock maintains the proper ratio with ARM clock */ | ||
264 | writel((readl(&pChipcHw->ACLKClock) & ~chipcHw_REG_ACLKClock_CLK_DIV_MASK) | (initParam-> armBusRatio & chipcHw_REG_ACLKClock_CLK_DIV_MASK), &pChipcHw->ACLKClock); | ||
265 | |||
266 | /* Set various core component frequencies. The order in which this is done is important for some. */ | ||
267 | /* The RTBUS (DDR PHY) is derived from the BUS, and the BUS from the ARM, and VPM needs to know BUS */ | ||
268 | /* frequency to find its ratio with the BUS. Hence we must set the ARM first, followed by the BUS, */ | ||
269 | /* then VPM and RTBUS. */ | ||
270 | |||
271 | chipcHw_setClockFrequency(chipcHw_CLOCK_ARM, | ||
272 | initParam->busClockFreqHz * | ||
273 | initParam->armBusRatio); | ||
274 | chipcHw_setClockFrequency(chipcHw_CLOCK_BUS, initParam->busClockFreqHz); | ||
275 | chipcHw_setClockFrequency(chipcHw_CLOCK_VPM, | ||
276 | initParam->busClockFreqHz * | ||
277 | initParam->vpmBusRatio); | ||
278 | chipcHw_setClockFrequency(chipcHw_CLOCK_DDR, | ||
279 | initParam->busClockFreqHz * | ||
280 | initParam->ddrBusRatio); | ||
281 | chipcHw_setClockFrequency(chipcHw_CLOCK_RTBUS, | ||
282 | initParam->busClockFreqHz / 2); | ||
283 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/chipc/chipcHw_reset.c b/arch/arm/mach-bcmring/csp/chipc/chipcHw_reset.c deleted file mode 100644 index f95ce913fa1e..000000000000 --- a/arch/arm/mach-bcmring/csp/chipc/chipcHw_reset.c +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /* ---- Include Files ---------------------------------------------------- */ | ||
16 | #include <linux/types.h> | ||
17 | #include <mach/csp/chipcHw_def.h> | ||
18 | #include <mach/csp/chipcHw_inline.h> | ||
19 | #include <mach/csp/intcHw_reg.h> | ||
20 | #include <asm/cacheflush.h> | ||
21 | |||
22 | /* ---- Private Constants and Types --------------------------------------- */ | ||
23 | /* ---- Private Variables ------------------------------------------------- */ | ||
24 | void chipcHw_reset_run_from_aram(void); | ||
25 | |||
26 | typedef void (*RUNFUNC) (void); | ||
27 | |||
28 | /****************************************************************************/ | ||
29 | /** | ||
30 | * @brief warmReset | ||
31 | * | ||
32 | * @note warmReset configures the clocks which are not reset back to the state | ||
33 | * required to execute on reset. To do so we need to copy the code into internal | ||
34 | * memory to change the ARM clock while we are not executing from DDR. | ||
35 | */ | ||
36 | /****************************************************************************/ | ||
37 | void chipcHw_reset(uint32_t mask) | ||
38 | { | ||
39 | int i = 0; | ||
40 | RUNFUNC runFunc = (RUNFUNC) (unsigned long)MM_ADDR_IO_ARAM; | ||
41 | |||
42 | /* Disable all interrupts */ | ||
43 | intcHw_irq_disable(INTCHW_INTC0, 0xffffffff); | ||
44 | intcHw_irq_disable(INTCHW_INTC1, 0xffffffff); | ||
45 | intcHw_irq_disable(INTCHW_SINTC, 0xffffffff); | ||
46 | |||
47 | { | ||
48 | REG_LOCAL_IRQ_SAVE; | ||
49 | if (mask & chipcHw_REG_SOFT_RESET_CHIP_SOFT) { | ||
50 | chipcHw_softReset(chipcHw_REG_SOFT_RESET_CHIP_SOFT); | ||
51 | } | ||
52 | /* Bypass the PLL clocks before reboot */ | ||
53 | writel(readl(&pChipcHw->UARTClock) | chipcHw_REG_PLL_CLOCK_BYPASS_SELECT, | ||
54 | &pChipcHw->UARTClock); | ||
55 | writel(readl(&pChipcHw->SPIClock) | chipcHw_REG_PLL_CLOCK_BYPASS_SELECT, | ||
56 | &pChipcHw->SPIClock); | ||
57 | |||
58 | /* Copy the chipcHw_warmReset_run_from_aram function into ARAM */ | ||
59 | do { | ||
60 | writel(((uint32_t *) &chipcHw_reset_run_from_aram)[i], ((uint32_t __iomem *) MM_IO_BASE_ARAM) + i); | ||
61 | i++; | ||
62 | } while (readl(((uint32_t __iomem*) MM_IO_BASE_ARAM) + i - 1) != 0xe1a0f00f); /* 0xe1a0f00f == asm ("mov r15, r15"); */ | ||
63 | |||
64 | flush_cache_all(); | ||
65 | |||
66 | /* run the function from ARAM */ | ||
67 | runFunc(); | ||
68 | |||
69 | /* Code will never get here, but include it to balance REG_LOCAL_IRQ_SAVE above */ | ||
70 | REG_LOCAL_IRQ_RESTORE; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | /* This function must run from internal memory */ | ||
75 | void chipcHw_reset_run_from_aram(void) | ||
76 | { | ||
77 | /* Make sure, pipeline is filled with instructions coming from ARAM */ | ||
78 | __asm (" nop \n\t" | ||
79 | " nop \n\t" | ||
80 | #if defined(__KERNEL__) && !defined(STANDALONE) | ||
81 | " MRC p15,#0x0,r0,c1,c0,#0 \n\t" | ||
82 | " BIC r0,r0,#0xd \n\t" | ||
83 | " MCR p15,#0x0,r0,c1,c0,#0 \n\t" | ||
84 | " nop \n\t" | ||
85 | " nop \n\t" | ||
86 | " nop \n\t" | ||
87 | " nop \n\t" | ||
88 | " nop \n\t" | ||
89 | " nop \n\t" | ||
90 | #endif | ||
91 | " nop \n\t" | ||
92 | " nop \n\t" | ||
93 | /* Bypass the ARM clock and switch to XTAL clock */ | ||
94 | " MOV r2,#0x80000000 \n\t" | ||
95 | " LDR r3,[r2,#8] \n\t" | ||
96 | " ORR r3,r3,#0x20000 \n\t" | ||
97 | " STR r3,[r2,#8] \n\t" | ||
98 | |||
99 | " nop \n\t" | ||
100 | " nop \n\t" | ||
101 | " nop \n\t" | ||
102 | " nop \n\t" | ||
103 | " nop \n\t" | ||
104 | " nop \n\t" | ||
105 | " nop \n\t" | ||
106 | " nop \n\t" | ||
107 | " nop \n\t" | ||
108 | " nop \n\t" | ||
109 | " nop \n\t" | ||
110 | " nop \n\t" | ||
111 | " nop \n\t" | ||
112 | " nop \n\t" | ||
113 | " nop \n\t" | ||
114 | " nop \n\t" | ||
115 | " nop \n\t" | ||
116 | " nop \n\t" | ||
117 | " nop \n\t" | ||
118 | " nop \n\t" | ||
119 | /* Issue reset */ | ||
120 | " MOV r3,#0x2 \n\t" | ||
121 | " STR r3,[r2,#0x80] \n\t" | ||
122 | /* End here */ | ||
123 | " MOV pc,pc \n\t"); | ||
124 | /* 0xe1a0f00f == asm ("mov r15, r15"); */ | ||
125 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/chipc/chipcHw_str.c b/arch/arm/mach-bcmring/csp/chipc/chipcHw_str.c deleted file mode 100644 index 54ad964fe94c..000000000000 --- a/arch/arm/mach-bcmring/csp/chipc/chipcHw_str.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | /****************************************************************************/ | ||
15 | /** | ||
16 | * @file chipcHw_str.c | ||
17 | * | ||
18 | * @brief Contains strings which are useful to linux and csp | ||
19 | * | ||
20 | * @note | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | |||
24 | /* ---- Include Files ---------------------------------------------------- */ | ||
25 | |||
26 | #include <mach/csp/chipcHw_inline.h> | ||
27 | |||
28 | /* ---- Private Constants and Types --------------------------------------- */ | ||
29 | |||
30 | static const char *gMuxStr[] = { | ||
31 | "GPIO", /* 0 */ | ||
32 | "KeyPad", /* 1 */ | ||
33 | "I2C-Host", /* 2 */ | ||
34 | "SPI", /* 3 */ | ||
35 | "Uart", /* 4 */ | ||
36 | "LED-Mtx-P", /* 5 */ | ||
37 | "LED-Mtx-S", /* 6 */ | ||
38 | "SDIO-0", /* 7 */ | ||
39 | "SDIO-1", /* 8 */ | ||
40 | "PCM", /* 9 */ | ||
41 | "I2S", /* 10 */ | ||
42 | "ETM", /* 11 */ | ||
43 | "Debug", /* 12 */ | ||
44 | "Misc", /* 13 */ | ||
45 | "0xE", /* 14 */ | ||
46 | "0xF", /* 15 */ | ||
47 | }; | ||
48 | |||
49 | /****************************************************************************/ | ||
50 | /** | ||
51 | * @brief Retrieves a string representation of the mux setting for a pin. | ||
52 | * | ||
53 | * @return Pointer to a character string. | ||
54 | */ | ||
55 | /****************************************************************************/ | ||
56 | |||
57 | const char *chipcHw_getGpioPinFunctionStr(int pin) | ||
58 | { | ||
59 | if ((pin < 0) || (pin >= chipcHw_GPIO_COUNT)) { | ||
60 | return ""; | ||
61 | } | ||
62 | |||
63 | return gMuxStr[chipcHw_getGpioPinFunction(pin)]; | ||
64 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/dmac/Makefile b/arch/arm/mach-bcmring/csp/dmac/Makefile deleted file mode 100644 index fb1104fe56b2..000000000000 --- a/arch/arm/mach-bcmring/csp/dmac/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-y += dmacHw.o dmacHw_extra.o \ No newline at end of file | ||
diff --git a/arch/arm/mach-bcmring/csp/dmac/dmacHw.c b/arch/arm/mach-bcmring/csp/dmac/dmacHw.c deleted file mode 100644 index 547f746c7ff4..000000000000 --- a/arch/arm/mach-bcmring/csp/dmac/dmacHw.c +++ /dev/null | |||
@@ -1,916 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dmacHw.c | ||
18 | * | ||
19 | * @brief Low level DMA controller driver routines | ||
20 | * | ||
21 | * @note | ||
22 | * | ||
23 | * These routines provide basic DMA functionality only. | ||
24 | */ | ||
25 | /****************************************************************************/ | ||
26 | |||
27 | /* ---- Include Files ---------------------------------------------------- */ | ||
28 | #include <linux/types.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/stddef.h> | ||
31 | |||
32 | #include <mach/csp/dmacHw.h> | ||
33 | #include <mach/csp/dmacHw_reg.h> | ||
34 | #include <mach/csp/dmacHw_priv.h> | ||
35 | #include <mach/csp/chipcHw_inline.h> | ||
36 | |||
37 | /* ---- External Function Prototypes ------------------------------------- */ | ||
38 | |||
39 | /* Allocate DMA control blocks */ | ||
40 | dmacHw_CBLK_t dmacHw_gCblk[dmacHw_MAX_CHANNEL_COUNT]; | ||
41 | |||
42 | uint32_t dmaChannelCount_0 = dmacHw_MAX_CHANNEL_COUNT / 2; | ||
43 | uint32_t dmaChannelCount_1 = dmacHw_MAX_CHANNEL_COUNT / 2; | ||
44 | |||
45 | /****************************************************************************/ | ||
46 | /** | ||
47 | * @brief Get maximum FIFO for a DMA channel | ||
48 | * | ||
49 | * @return Maximum allowable FIFO size | ||
50 | * | ||
51 | * | ||
52 | */ | ||
53 | /****************************************************************************/ | ||
54 | static uint32_t GetFifoSize(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
55 | ) { | ||
56 | uint32_t val = 0; | ||
57 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
58 | dmacHw_MISC_t __iomem *pMiscReg = (void __iomem *)dmacHw_REG_MISC_BASE(pCblk->module); | ||
59 | |||
60 | switch (pCblk->channel) { | ||
61 | case 0: | ||
62 | val = (readl(&pMiscReg->CompParm2.lo) & 0x70000000) >> 28; | ||
63 | break; | ||
64 | case 1: | ||
65 | val = (readl(&pMiscReg->CompParm3.hi) & 0x70000000) >> 28; | ||
66 | break; | ||
67 | case 2: | ||
68 | val = (readl(&pMiscReg->CompParm3.lo) & 0x70000000) >> 28; | ||
69 | break; | ||
70 | case 3: | ||
71 | val = (readl(&pMiscReg->CompParm4.hi) & 0x70000000) >> 28; | ||
72 | break; | ||
73 | case 4: | ||
74 | val = (readl(&pMiscReg->CompParm4.lo) & 0x70000000) >> 28; | ||
75 | break; | ||
76 | case 5: | ||
77 | val = (readl(&pMiscReg->CompParm5.hi) & 0x70000000) >> 28; | ||
78 | break; | ||
79 | case 6: | ||
80 | val = (readl(&pMiscReg->CompParm5.lo) & 0x70000000) >> 28; | ||
81 | break; | ||
82 | case 7: | ||
83 | val = (readl(&pMiscReg->CompParm6.hi) & 0x70000000) >> 28; | ||
84 | break; | ||
85 | } | ||
86 | |||
87 | if (val <= 0x4) { | ||
88 | return 8 << val; | ||
89 | } else { | ||
90 | dmacHw_ASSERT(0); | ||
91 | } | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | /****************************************************************************/ | ||
96 | /** | ||
97 | * @brief Program channel register to initiate transfer | ||
98 | * | ||
99 | * @return void | ||
100 | * | ||
101 | * | ||
102 | * @note | ||
103 | * - Descriptor buffer MUST ALWAYS be flushed before calling this function | ||
104 | * - This function should also be called from ISR to program the channel with | ||
105 | * pending descriptors | ||
106 | */ | ||
107 | /****************************************************************************/ | ||
108 | void dmacHw_initiateTransfer(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
109 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
110 | void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
111 | ) { | ||
112 | dmacHw_DESC_RING_t *pRing; | ||
113 | dmacHw_DESC_t *pProg; | ||
114 | dmacHw_CBLK_t *pCblk; | ||
115 | |||
116 | pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
117 | pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
118 | |||
119 | if (CHANNEL_BUSY(pCblk->module, pCblk->channel)) { | ||
120 | /* Not safe yet to program the channel */ | ||
121 | return; | ||
122 | } | ||
123 | |||
124 | if (pCblk->varDataStarted) { | ||
125 | if (pCblk->descUpdated) { | ||
126 | pCblk->descUpdated = 0; | ||
127 | pProg = | ||
128 | (dmacHw_DESC_t *) ((uint32_t) | ||
129 | dmacHw_REG_LLP(pCblk->module, | ||
130 | pCblk->channel) + | ||
131 | pRing->virt2PhyOffset); | ||
132 | |||
133 | /* Load descriptor if not loaded */ | ||
134 | if (!(pProg->ctl.hi & dmacHw_REG_CTL_DONE)) { | ||
135 | dmacHw_SET_SAR(pCblk->module, pCblk->channel, | ||
136 | pProg->sar); | ||
137 | dmacHw_SET_DAR(pCblk->module, pCblk->channel, | ||
138 | pProg->dar); | ||
139 | dmacHw_REG_CTL_LO(pCblk->module, | ||
140 | pCblk->channel) = | ||
141 | pProg->ctl.lo; | ||
142 | dmacHw_REG_CTL_HI(pCblk->module, | ||
143 | pCblk->channel) = | ||
144 | pProg->ctl.hi; | ||
145 | } else if (pProg == (dmacHw_DESC_t *) pRing->pEnd->llp) { | ||
146 | /* Return as end descriptor is processed */ | ||
147 | return; | ||
148 | } else { | ||
149 | dmacHw_ASSERT(0); | ||
150 | } | ||
151 | } else { | ||
152 | return; | ||
153 | } | ||
154 | } else { | ||
155 | if (pConfig->transferMode == dmacHw_TRANSFER_MODE_PERIODIC) { | ||
156 | /* Do not make a single chain, rather process one descriptor at a time */ | ||
157 | pProg = pRing->pHead; | ||
158 | /* Point to the next descriptor for next iteration */ | ||
159 | dmacHw_NEXT_DESC(pRing, pHead); | ||
160 | } else { | ||
161 | /* Return if no more pending descriptor */ | ||
162 | if (pRing->pEnd == NULL) { | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | pProg = pRing->pProg; | ||
167 | if (pConfig->transferMode == | ||
168 | dmacHw_TRANSFER_MODE_CONTINUOUS) { | ||
169 | /* Make sure a complete ring can be formed */ | ||
170 | dmacHw_ASSERT((dmacHw_DESC_t *) pRing->pEnd-> | ||
171 | llp == pRing->pProg); | ||
172 | /* Make sure pProg pointing to the pHead */ | ||
173 | dmacHw_ASSERT((dmacHw_DESC_t *) pRing->pProg == | ||
174 | pRing->pHead); | ||
175 | /* Make a complete ring */ | ||
176 | do { | ||
177 | pRing->pProg->ctl.lo |= | ||
178 | (dmacHw_REG_CTL_LLP_DST_EN | | ||
179 | dmacHw_REG_CTL_LLP_SRC_EN); | ||
180 | pRing->pProg = | ||
181 | (dmacHw_DESC_t *) pRing->pProg->llp; | ||
182 | } while (pRing->pProg != pRing->pHead); | ||
183 | } else { | ||
184 | /* Make a single long chain */ | ||
185 | while (pRing->pProg != pRing->pEnd) { | ||
186 | pRing->pProg->ctl.lo |= | ||
187 | (dmacHw_REG_CTL_LLP_DST_EN | | ||
188 | dmacHw_REG_CTL_LLP_SRC_EN); | ||
189 | pRing->pProg = | ||
190 | (dmacHw_DESC_t *) pRing->pProg->llp; | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | |||
195 | /* Program the channel registers */ | ||
196 | dmacHw_SET_SAR(pCblk->module, pCblk->channel, pProg->sar); | ||
197 | dmacHw_SET_DAR(pCblk->module, pCblk->channel, pProg->dar); | ||
198 | dmacHw_SET_LLP(pCblk->module, pCblk->channel, | ||
199 | (uint32_t) pProg - pRing->virt2PhyOffset); | ||
200 | dmacHw_REG_CTL_LO(pCblk->module, pCblk->channel) = | ||
201 | pProg->ctl.lo; | ||
202 | dmacHw_REG_CTL_HI(pCblk->module, pCblk->channel) = | ||
203 | pProg->ctl.hi; | ||
204 | if (pRing->pEnd) { | ||
205 | /* Remember the descriptor to use next */ | ||
206 | pRing->pProg = (dmacHw_DESC_t *) pRing->pEnd->llp; | ||
207 | } | ||
208 | /* Indicate no more pending descriptor */ | ||
209 | pRing->pEnd = (dmacHw_DESC_t *) NULL; | ||
210 | } | ||
211 | /* Start DMA operation */ | ||
212 | dmacHw_DMA_START(pCblk->module, pCblk->channel); | ||
213 | } | ||
214 | |||
215 | /****************************************************************************/ | ||
216 | /** | ||
217 | * @brief Initializes DMA | ||
218 | * | ||
219 | * This function initializes DMA CSP driver | ||
220 | * | ||
221 | * @note | ||
222 | * Must be called before using any DMA channel | ||
223 | */ | ||
224 | /****************************************************************************/ | ||
225 | void dmacHw_initDma(void) | ||
226 | { | ||
227 | |||
228 | uint32_t i = 0; | ||
229 | |||
230 | dmaChannelCount_0 = dmacHw_GET_NUM_CHANNEL(0); | ||
231 | dmaChannelCount_1 = dmacHw_GET_NUM_CHANNEL(1); | ||
232 | |||
233 | /* Enable access to the DMA block */ | ||
234 | chipcHw_busInterfaceClockEnable(chipcHw_REG_BUS_CLOCK_DMAC0); | ||
235 | chipcHw_busInterfaceClockEnable(chipcHw_REG_BUS_CLOCK_DMAC1); | ||
236 | |||
237 | if ((dmaChannelCount_0 + dmaChannelCount_1) > dmacHw_MAX_CHANNEL_COUNT) { | ||
238 | dmacHw_ASSERT(0); | ||
239 | } | ||
240 | |||
241 | memset((void *)dmacHw_gCblk, 0, | ||
242 | sizeof(dmacHw_CBLK_t) * (dmaChannelCount_0 + dmaChannelCount_1)); | ||
243 | for (i = 0; i < dmaChannelCount_0; i++) { | ||
244 | dmacHw_gCblk[i].module = 0; | ||
245 | dmacHw_gCblk[i].channel = i; | ||
246 | } | ||
247 | for (i = 0; i < dmaChannelCount_1; i++) { | ||
248 | dmacHw_gCblk[i + dmaChannelCount_0].module = 1; | ||
249 | dmacHw_gCblk[i + dmaChannelCount_0].channel = i; | ||
250 | } | ||
251 | } | ||
252 | |||
253 | /****************************************************************************/ | ||
254 | /** | ||
255 | * @brief Exit function for DMA | ||
256 | * | ||
257 | * This function isolates DMA from the system | ||
258 | * | ||
259 | */ | ||
260 | /****************************************************************************/ | ||
261 | void dmacHw_exitDma(void) | ||
262 | { | ||
263 | /* Disable access to the DMA block */ | ||
264 | chipcHw_busInterfaceClockDisable(chipcHw_REG_BUS_CLOCK_DMAC0); | ||
265 | chipcHw_busInterfaceClockDisable(chipcHw_REG_BUS_CLOCK_DMAC1); | ||
266 | } | ||
267 | |||
268 | /****************************************************************************/ | ||
269 | /** | ||
270 | * @brief Gets a handle to a DMA channel | ||
271 | * | ||
272 | * This function returns a handle, representing a control block of a particular DMA channel | ||
273 | * | ||
274 | * @return -1 - On Failure | ||
275 | * handle - On Success, representing a channel control block | ||
276 | * | ||
277 | * @note | ||
278 | * None Channel ID must be created using "dmacHw_MAKE_CHANNEL_ID" macro | ||
279 | */ | ||
280 | /****************************************************************************/ | ||
281 | dmacHw_HANDLE_t dmacHw_getChannelHandle(dmacHw_ID_t channelId /* [ IN ] DMA Channel Id */ | ||
282 | ) { | ||
283 | int idx; | ||
284 | |||
285 | switch ((channelId >> 8)) { | ||
286 | case 0: | ||
287 | dmacHw_ASSERT((channelId & 0xff) < dmaChannelCount_0); | ||
288 | idx = (channelId & 0xff); | ||
289 | break; | ||
290 | case 1: | ||
291 | dmacHw_ASSERT((channelId & 0xff) < dmaChannelCount_1); | ||
292 | idx = dmaChannelCount_0 + (channelId & 0xff); | ||
293 | break; | ||
294 | default: | ||
295 | dmacHw_ASSERT(0); | ||
296 | return (dmacHw_HANDLE_t) -1; | ||
297 | } | ||
298 | |||
299 | return dmacHw_CBLK_TO_HANDLE(&dmacHw_gCblk[idx]); | ||
300 | } | ||
301 | |||
302 | /****************************************************************************/ | ||
303 | /** | ||
304 | * @brief Initializes a DMA channel for use | ||
305 | * | ||
306 | * This function initializes and resets a DMA channel for use | ||
307 | * | ||
308 | * @return -1 - On Failure | ||
309 | * 0 - On Success | ||
310 | * | ||
311 | * @note | ||
312 | * None | ||
313 | */ | ||
314 | /****************************************************************************/ | ||
315 | int dmacHw_initChannel(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
316 | ) { | ||
317 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
318 | int module = pCblk->module; | ||
319 | int channel = pCblk->channel; | ||
320 | |||
321 | /* Reinitialize the control block */ | ||
322 | memset((void *)pCblk, 0, sizeof(dmacHw_CBLK_t)); | ||
323 | pCblk->module = module; | ||
324 | pCblk->channel = channel; | ||
325 | |||
326 | /* Enable DMA controller */ | ||
327 | dmacHw_DMA_ENABLE(pCblk->module); | ||
328 | /* Reset DMA channel */ | ||
329 | dmacHw_RESET_CONTROL_LO(pCblk->module, pCblk->channel); | ||
330 | dmacHw_RESET_CONTROL_HI(pCblk->module, pCblk->channel); | ||
331 | dmacHw_RESET_CONFIG_LO(pCblk->module, pCblk->channel); | ||
332 | dmacHw_RESET_CONFIG_HI(pCblk->module, pCblk->channel); | ||
333 | |||
334 | /* Clear all raw interrupt status */ | ||
335 | dmacHw_TRAN_INT_CLEAR(pCblk->module, pCblk->channel); | ||
336 | dmacHw_BLOCK_INT_CLEAR(pCblk->module, pCblk->channel); | ||
337 | dmacHw_ERROR_INT_CLEAR(pCblk->module, pCblk->channel); | ||
338 | |||
339 | /* Mask event specific interrupts */ | ||
340 | dmacHw_TRAN_INT_DISABLE(pCblk->module, pCblk->channel); | ||
341 | dmacHw_BLOCK_INT_DISABLE(pCblk->module, pCblk->channel); | ||
342 | dmacHw_STRAN_INT_DISABLE(pCblk->module, pCblk->channel); | ||
343 | dmacHw_DTRAN_INT_DISABLE(pCblk->module, pCblk->channel); | ||
344 | dmacHw_ERROR_INT_DISABLE(pCblk->module, pCblk->channel); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | /****************************************************************************/ | ||
350 | /** | ||
351 | * @brief Finds amount of memory required to form a descriptor ring | ||
352 | * | ||
353 | * | ||
354 | * @return Number of bytes required to form a descriptor ring | ||
355 | * | ||
356 | * | ||
357 | */ | ||
358 | /****************************************************************************/ | ||
359 | uint32_t dmacHw_descriptorLen(uint32_t descCnt /* [ IN ] Number of descriptor in the ring */ | ||
360 | ) { | ||
361 | /* Need extra 4 byte to ensure 32 bit alignment */ | ||
362 | return (descCnt * sizeof(dmacHw_DESC_t)) + sizeof(dmacHw_DESC_RING_t) + | ||
363 | sizeof(uint32_t); | ||
364 | } | ||
365 | |||
366 | /****************************************************************************/ | ||
367 | /** | ||
368 | * @brief Initializes descriptor ring | ||
369 | * | ||
370 | * This function will initializes the descriptor ring of a DMA channel | ||
371 | * | ||
372 | * | ||
373 | * @return -1 - On failure | ||
374 | * 0 - On success | ||
375 | * @note | ||
376 | * - "len" parameter should be obtained from "dmacHw_descriptorLen" | ||
377 | * - Descriptor buffer MUST be 32 bit aligned and uncached as it is | ||
378 | * accessed by ARM and DMA | ||
379 | */ | ||
380 | /****************************************************************************/ | ||
381 | int dmacHw_initDescriptor(void *pDescriptorVirt, /* [ IN ] Virtual address of uncahced buffer allocated to form descriptor ring */ | ||
382 | uint32_t descriptorPhyAddr, /* [ IN ] Physical address of pDescriptorVirt (descriptor buffer) */ | ||
383 | uint32_t len, /* [ IN ] Size of the pBuf */ | ||
384 | uint32_t num /* [ IN ] Number of descriptor in the ring */ | ||
385 | ) { | ||
386 | uint32_t i; | ||
387 | dmacHw_DESC_RING_t *pRing; | ||
388 | dmacHw_DESC_t *pDesc; | ||
389 | |||
390 | /* Check the alignment of the descriptor */ | ||
391 | if ((uint32_t) pDescriptorVirt & 0x00000003) { | ||
392 | dmacHw_ASSERT(0); | ||
393 | return -1; | ||
394 | } | ||
395 | |||
396 | /* Check if enough space has been allocated for descriptor ring */ | ||
397 | if (len < dmacHw_descriptorLen(num)) { | ||
398 | return -1; | ||
399 | } | ||
400 | |||
401 | pRing = dmacHw_GET_DESC_RING(pDescriptorVirt); | ||
402 | pRing->pHead = | ||
403 | (dmacHw_DESC_t *) ((uint32_t) pRing + sizeof(dmacHw_DESC_RING_t)); | ||
404 | pRing->pFree = pRing->pTail = pRing->pEnd = pRing->pHead; | ||
405 | pRing->pProg = dmacHw_DESC_INIT; | ||
406 | /* Initialize link item chain, starting from the head */ | ||
407 | pDesc = pRing->pHead; | ||
408 | /* Find the offset between virtual to physical address */ | ||
409 | pRing->virt2PhyOffset = (uint32_t) pDescriptorVirt - descriptorPhyAddr; | ||
410 | |||
411 | /* Form the descriptor ring */ | ||
412 | for (i = 0; i < num - 1; i++) { | ||
413 | /* Clear link list item */ | ||
414 | memset((void *)pDesc, 0, sizeof(dmacHw_DESC_t)); | ||
415 | /* Point to the next item in the physical address */ | ||
416 | pDesc->llpPhy = (uint32_t) (pDesc + 1) - pRing->virt2PhyOffset; | ||
417 | /* Point to the next item in the virtual address */ | ||
418 | pDesc->llp = (uint32_t) (pDesc + 1); | ||
419 | /* Mark descriptor is ready to use */ | ||
420 | pDesc->ctl.hi = dmacHw_DESC_FREE; | ||
421 | /* Look into next link list item */ | ||
422 | pDesc++; | ||
423 | } | ||
424 | |||
425 | /* Clear last link list item */ | ||
426 | memset((void *)pDesc, 0, sizeof(dmacHw_DESC_t)); | ||
427 | /* Last item pointing to the first item in the | ||
428 | physical address to complete the ring */ | ||
429 | pDesc->llpPhy = (uint32_t) pRing->pHead - pRing->virt2PhyOffset; | ||
430 | /* Last item pointing to the first item in the | ||
431 | virtual address to complete the ring | ||
432 | */ | ||
433 | pDesc->llp = (uint32_t) pRing->pHead; | ||
434 | /* Mark descriptor is ready to use */ | ||
435 | pDesc->ctl.hi = dmacHw_DESC_FREE; | ||
436 | /* Set the number of descriptors in the ring */ | ||
437 | pRing->num = num; | ||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | /****************************************************************************/ | ||
442 | /** | ||
443 | * @brief Configure DMA channel | ||
444 | * | ||
445 | * @return 0 : On success | ||
446 | * -1 : On failure | ||
447 | */ | ||
448 | /****************************************************************************/ | ||
449 | int dmacHw_configChannel(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
450 | dmacHw_CONFIG_t *pConfig /* [ IN ] Configuration settings */ | ||
451 | ) { | ||
452 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
453 | uint32_t cfgHigh = 0; | ||
454 | int srcTrSize; | ||
455 | int dstTrSize; | ||
456 | |||
457 | pCblk->varDataStarted = 0; | ||
458 | pCblk->userData = NULL; | ||
459 | |||
460 | /* Configure | ||
461 | - Burst transaction when enough data in available in FIFO | ||
462 | - AHB Access protection 1 | ||
463 | - Source and destination peripheral ports | ||
464 | */ | ||
465 | cfgHigh = | ||
466 | dmacHw_REG_CFG_HI_FIFO_ENOUGH | dmacHw_REG_CFG_HI_AHB_HPROT_1 | | ||
467 | dmacHw_SRC_PERI_INTF(pConfig-> | ||
468 | srcPeripheralPort) | | ||
469 | dmacHw_DST_PERI_INTF(pConfig->dstPeripheralPort); | ||
470 | /* Set priority */ | ||
471 | dmacHw_SET_CHANNEL_PRIORITY(pCblk->module, pCblk->channel, | ||
472 | pConfig->channelPriority); | ||
473 | |||
474 | if (pConfig->dstStatusRegisterAddress != 0) { | ||
475 | /* Destination status update enable */ | ||
476 | cfgHigh |= dmacHw_REG_CFG_HI_UPDATE_DST_STAT; | ||
477 | /* Configure status registers */ | ||
478 | dmacHw_SET_DSTATAR(pCblk->module, pCblk->channel, | ||
479 | pConfig->dstStatusRegisterAddress); | ||
480 | } | ||
481 | |||
482 | if (pConfig->srcStatusRegisterAddress != 0) { | ||
483 | /* Source status update enable */ | ||
484 | cfgHigh |= dmacHw_REG_CFG_HI_UPDATE_SRC_STAT; | ||
485 | /* Source status update enable */ | ||
486 | dmacHw_SET_SSTATAR(pCblk->module, pCblk->channel, | ||
487 | pConfig->srcStatusRegisterAddress); | ||
488 | } | ||
489 | /* Configure the config high register */ | ||
490 | dmacHw_GET_CONFIG_HI(pCblk->module, pCblk->channel) = cfgHigh; | ||
491 | |||
492 | /* Clear all raw interrupt status */ | ||
493 | dmacHw_TRAN_INT_CLEAR(pCblk->module, pCblk->channel); | ||
494 | dmacHw_BLOCK_INT_CLEAR(pCblk->module, pCblk->channel); | ||
495 | dmacHw_ERROR_INT_CLEAR(pCblk->module, pCblk->channel); | ||
496 | |||
497 | /* Configure block interrupt */ | ||
498 | if (pConfig->blockTransferInterrupt == dmacHw_INTERRUPT_ENABLE) { | ||
499 | dmacHw_BLOCK_INT_ENABLE(pCblk->module, pCblk->channel); | ||
500 | } else { | ||
501 | dmacHw_BLOCK_INT_DISABLE(pCblk->module, pCblk->channel); | ||
502 | } | ||
503 | /* Configure complete transfer interrupt */ | ||
504 | if (pConfig->completeTransferInterrupt == dmacHw_INTERRUPT_ENABLE) { | ||
505 | dmacHw_TRAN_INT_ENABLE(pCblk->module, pCblk->channel); | ||
506 | } else { | ||
507 | dmacHw_TRAN_INT_DISABLE(pCblk->module, pCblk->channel); | ||
508 | } | ||
509 | /* Configure error interrupt */ | ||
510 | if (pConfig->errorInterrupt == dmacHw_INTERRUPT_ENABLE) { | ||
511 | dmacHw_ERROR_INT_ENABLE(pCblk->module, pCblk->channel); | ||
512 | } else { | ||
513 | dmacHw_ERROR_INT_DISABLE(pCblk->module, pCblk->channel); | ||
514 | } | ||
515 | /* Configure gather register */ | ||
516 | if (pConfig->srcGatherWidth) { | ||
517 | srcTrSize = | ||
518 | dmacHw_GetTrWidthInBytes(pConfig->srcMaxTransactionWidth); | ||
519 | if (! | ||
520 | ((pConfig->srcGatherWidth % srcTrSize) | ||
521 | && (pConfig->srcGatherJump % srcTrSize))) { | ||
522 | dmacHw_REG_SGR_LO(pCblk->module, pCblk->channel) = | ||
523 | ((pConfig->srcGatherWidth / | ||
524 | srcTrSize) << 20) | (pConfig->srcGatherJump / | ||
525 | srcTrSize); | ||
526 | } else { | ||
527 | return -1; | ||
528 | } | ||
529 | } | ||
530 | /* Configure scatter register */ | ||
531 | if (pConfig->dstScatterWidth) { | ||
532 | dstTrSize = | ||
533 | dmacHw_GetTrWidthInBytes(pConfig->dstMaxTransactionWidth); | ||
534 | if (! | ||
535 | ((pConfig->dstScatterWidth % dstTrSize) | ||
536 | && (pConfig->dstScatterJump % dstTrSize))) { | ||
537 | dmacHw_REG_DSR_LO(pCblk->module, pCblk->channel) = | ||
538 | ((pConfig->dstScatterWidth / | ||
539 | dstTrSize) << 20) | (pConfig->dstScatterJump / | ||
540 | dstTrSize); | ||
541 | } else { | ||
542 | return -1; | ||
543 | } | ||
544 | } | ||
545 | return 0; | ||
546 | } | ||
547 | |||
548 | /****************************************************************************/ | ||
549 | /** | ||
550 | * @brief Indicates whether DMA transfer is in progress or completed | ||
551 | * | ||
552 | * @return DMA transfer status | ||
553 | * dmacHw_TRANSFER_STATUS_BUSY: DMA Transfer ongoing | ||
554 | * dmacHw_TRANSFER_STATUS_DONE: DMA Transfer completed | ||
555 | * dmacHw_TRANSFER_STATUS_ERROR: DMA Transfer error | ||
556 | * | ||
557 | */ | ||
558 | /****************************************************************************/ | ||
559 | dmacHw_TRANSFER_STATUS_e dmacHw_transferCompleted(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
560 | ) { | ||
561 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
562 | |||
563 | if (CHANNEL_BUSY(pCblk->module, pCblk->channel)) { | ||
564 | return dmacHw_TRANSFER_STATUS_BUSY; | ||
565 | } else if (dmacHw_REG_INT_RAW_ERROR(pCblk->module) & | ||
566 | (0x00000001 << pCblk->channel)) { | ||
567 | return dmacHw_TRANSFER_STATUS_ERROR; | ||
568 | } | ||
569 | |||
570 | return dmacHw_TRANSFER_STATUS_DONE; | ||
571 | } | ||
572 | |||
573 | /****************************************************************************/ | ||
574 | /** | ||
575 | * @brief Set descriptors for known data length | ||
576 | * | ||
577 | * When DMA has to work as a flow controller, this function prepares the | ||
578 | * descriptor chain to transfer data | ||
579 | * | ||
580 | * from: | ||
581 | * - Memory to memory | ||
582 | * - Peripheral to memory | ||
583 | * - Memory to Peripheral | ||
584 | * - Peripheral to Peripheral | ||
585 | * | ||
586 | * @return -1 - On failure | ||
587 | * 0 - On success | ||
588 | * | ||
589 | */ | ||
590 | /****************************************************************************/ | ||
591 | int dmacHw_setDataDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
592 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
593 | void *pSrcAddr, /* [ IN ] Source (Peripheral/Memory) address */ | ||
594 | void *pDstAddr, /* [ IN ] Destination (Peripheral/Memory) address */ | ||
595 | size_t dataLen /* [ IN ] Data length in bytes */ | ||
596 | ) { | ||
597 | dmacHw_TRANSACTION_WIDTH_e dstTrWidth; | ||
598 | dmacHw_TRANSACTION_WIDTH_e srcTrWidth; | ||
599 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
600 | dmacHw_DESC_t *pStart; | ||
601 | dmacHw_DESC_t *pProg; | ||
602 | int srcTs = 0; | ||
603 | int blkTs = 0; | ||
604 | int oddSize = 0; | ||
605 | int descCount = 0; | ||
606 | int count = 0; | ||
607 | int dstTrSize = 0; | ||
608 | int srcTrSize = 0; | ||
609 | uint32_t maxBlockSize = dmacHw_MAX_BLOCKSIZE; | ||
610 | |||
611 | dstTrSize = dmacHw_GetTrWidthInBytes(pConfig->dstMaxTransactionWidth); | ||
612 | srcTrSize = dmacHw_GetTrWidthInBytes(pConfig->srcMaxTransactionWidth); | ||
613 | |||
614 | /* Skip Tx if buffer is NULL or length is unknown */ | ||
615 | if ((pSrcAddr == NULL) || (pDstAddr == NULL) || (dataLen == 0)) { | ||
616 | /* Do not initiate transfer */ | ||
617 | return -1; | ||
618 | } | ||
619 | |||
620 | /* Ensure scatter and gather are transaction aligned */ | ||
621 | if ((pConfig->srcGatherWidth % srcTrSize) | ||
622 | || (pConfig->dstScatterWidth % dstTrSize)) { | ||
623 | return -2; | ||
624 | } | ||
625 | |||
626 | /* | ||
627 | Background 1: DMAC can not perform DMA if source and destination addresses are | ||
628 | not properly aligned with the channel's transaction width. So, for successful | ||
629 | DMA transfer, transaction width must be set according to the alignment of the | ||
630 | source and destination address. | ||
631 | */ | ||
632 | |||
633 | /* Adjust destination transaction width if destination address is not aligned properly */ | ||
634 | dstTrWidth = pConfig->dstMaxTransactionWidth; | ||
635 | while (dmacHw_ADDRESS_MASK(dstTrSize) & (uint32_t) pDstAddr) { | ||
636 | dstTrWidth = dmacHw_GetNextTrWidth(dstTrWidth); | ||
637 | dstTrSize = dmacHw_GetTrWidthInBytes(dstTrWidth); | ||
638 | } | ||
639 | |||
640 | /* Adjust source transaction width if source address is not aligned properly */ | ||
641 | srcTrWidth = pConfig->srcMaxTransactionWidth; | ||
642 | while (dmacHw_ADDRESS_MASK(srcTrSize) & (uint32_t) pSrcAddr) { | ||
643 | srcTrWidth = dmacHw_GetNextTrWidth(srcTrWidth); | ||
644 | srcTrSize = dmacHw_GetTrWidthInBytes(srcTrWidth); | ||
645 | } | ||
646 | |||
647 | /* Find the maximum transaction per descriptor */ | ||
648 | if (pConfig->maxDataPerBlock | ||
649 | && ((pConfig->maxDataPerBlock / srcTrSize) < | ||
650 | dmacHw_MAX_BLOCKSIZE)) { | ||
651 | maxBlockSize = pConfig->maxDataPerBlock / srcTrSize; | ||
652 | } | ||
653 | |||
654 | /* Find number of source transactions needed to complete the DMA transfer */ | ||
655 | srcTs = dataLen / srcTrSize; | ||
656 | /* Find the odd number of bytes that need to be transferred as single byte transaction width */ | ||
657 | if (srcTs && (dstTrSize > srcTrSize)) { | ||
658 | oddSize = dataLen % dstTrSize; | ||
659 | /* Adjust source transaction count due to "oddSize" */ | ||
660 | srcTs = srcTs - (oddSize / srcTrSize); | ||
661 | } else { | ||
662 | oddSize = dataLen % srcTrSize; | ||
663 | } | ||
664 | /* Adjust "descCount" due to "oddSize" */ | ||
665 | if (oddSize) { | ||
666 | descCount++; | ||
667 | } | ||
668 | /* Find the number of descriptor needed for total "srcTs" */ | ||
669 | if (srcTs) { | ||
670 | descCount += ((srcTs - 1) / maxBlockSize) + 1; | ||
671 | } | ||
672 | |||
673 | /* Check the availability of "descCount" discriptors in the ring */ | ||
674 | pProg = pRing->pHead; | ||
675 | for (count = 0; (descCount <= pRing->num) && (count < descCount); | ||
676 | count++) { | ||
677 | if ((pProg->ctl.hi & dmacHw_DESC_FREE) == 0) { | ||
678 | /* Sufficient descriptors are not available */ | ||
679 | return -3; | ||
680 | } | ||
681 | pProg = (dmacHw_DESC_t *) pProg->llp; | ||
682 | } | ||
683 | |||
684 | /* Remember the link list item to program the channel registers */ | ||
685 | pStart = pProg = pRing->pHead; | ||
686 | /* Make a link list with "descCount(=count)" number of descriptors */ | ||
687 | while (count) { | ||
688 | /* Reset channel control information */ | ||
689 | pProg->ctl.lo = 0; | ||
690 | /* Enable source gather if configured */ | ||
691 | if (pConfig->srcGatherWidth) { | ||
692 | pProg->ctl.lo |= dmacHw_REG_CTL_SG_ENABLE; | ||
693 | } | ||
694 | /* Enable destination scatter if configured */ | ||
695 | if (pConfig->dstScatterWidth) { | ||
696 | pProg->ctl.lo |= dmacHw_REG_CTL_DS_ENABLE; | ||
697 | } | ||
698 | /* Set source and destination address */ | ||
699 | pProg->sar = (uint32_t) pSrcAddr; | ||
700 | pProg->dar = (uint32_t) pDstAddr; | ||
701 | /* Use "devCtl" to mark that user memory need to be freed later if needed */ | ||
702 | if (pProg == pRing->pHead) { | ||
703 | pProg->devCtl = dmacHw_FREE_USER_MEMORY; | ||
704 | } else { | ||
705 | pProg->devCtl = 0; | ||
706 | } | ||
707 | |||
708 | blkTs = srcTs; | ||
709 | |||
710 | /* Special treatmeant for last descriptor */ | ||
711 | if (count == 1) { | ||
712 | /* Mark the last descriptor */ | ||
713 | pProg->ctl.lo &= | ||
714 | ~(dmacHw_REG_CTL_LLP_DST_EN | | ||
715 | dmacHw_REG_CTL_LLP_SRC_EN); | ||
716 | /* Treatment for odd data bytes */ | ||
717 | if (oddSize) { | ||
718 | /* Adjust for single byte transaction width */ | ||
719 | switch (pConfig->transferType) { | ||
720 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM: | ||
721 | dstTrWidth = | ||
722 | dmacHw_DST_TRANSACTION_WIDTH_8; | ||
723 | blkTs = | ||
724 | (oddSize / srcTrSize) + | ||
725 | ((oddSize % srcTrSize) ? 1 : 0); | ||
726 | break; | ||
727 | case dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL: | ||
728 | srcTrWidth = | ||
729 | dmacHw_SRC_TRANSACTION_WIDTH_8; | ||
730 | blkTs = oddSize; | ||
731 | break; | ||
732 | case dmacHw_TRANSFER_TYPE_MEM_TO_MEM: | ||
733 | srcTrWidth = | ||
734 | dmacHw_SRC_TRANSACTION_WIDTH_8; | ||
735 | dstTrWidth = | ||
736 | dmacHw_DST_TRANSACTION_WIDTH_8; | ||
737 | blkTs = oddSize; | ||
738 | break; | ||
739 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL: | ||
740 | /* Do not adjust the transaction width */ | ||
741 | break; | ||
742 | } | ||
743 | } else { | ||
744 | srcTs -= blkTs; | ||
745 | } | ||
746 | } else { | ||
747 | if (srcTs / maxBlockSize) { | ||
748 | blkTs = maxBlockSize; | ||
749 | } | ||
750 | /* Remaining source transactions for next iteration */ | ||
751 | srcTs -= blkTs; | ||
752 | } | ||
753 | /* Must have a valid source transactions */ | ||
754 | dmacHw_ASSERT(blkTs > 0); | ||
755 | /* Set control information */ | ||
756 | if (pConfig->flowControler == dmacHw_FLOW_CONTROL_DMA) { | ||
757 | pProg->ctl.lo |= pConfig->transferType | | ||
758 | pConfig->srcUpdate | | ||
759 | pConfig->dstUpdate | | ||
760 | srcTrWidth | | ||
761 | dstTrWidth | | ||
762 | pConfig->srcMaxBurstWidth | | ||
763 | pConfig->dstMaxBurstWidth | | ||
764 | pConfig->srcMasterInterface | | ||
765 | pConfig->dstMasterInterface | dmacHw_REG_CTL_INT_EN; | ||
766 | } else { | ||
767 | uint32_t transferType = 0; | ||
768 | switch (pConfig->transferType) { | ||
769 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM: | ||
770 | transferType = dmacHw_REG_CTL_TTFC_PM_PERI; | ||
771 | break; | ||
772 | case dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL: | ||
773 | transferType = dmacHw_REG_CTL_TTFC_MP_PERI; | ||
774 | break; | ||
775 | default: | ||
776 | dmacHw_ASSERT(0); | ||
777 | } | ||
778 | pProg->ctl.lo |= transferType | | ||
779 | pConfig->srcUpdate | | ||
780 | pConfig->dstUpdate | | ||
781 | srcTrWidth | | ||
782 | dstTrWidth | | ||
783 | pConfig->srcMaxBurstWidth | | ||
784 | pConfig->dstMaxBurstWidth | | ||
785 | pConfig->srcMasterInterface | | ||
786 | pConfig->dstMasterInterface | dmacHw_REG_CTL_INT_EN; | ||
787 | } | ||
788 | |||
789 | /* Set block transaction size */ | ||
790 | pProg->ctl.hi = blkTs & dmacHw_REG_CTL_BLOCK_TS_MASK; | ||
791 | /* Look for next descriptor */ | ||
792 | if (count > 1) { | ||
793 | /* Point to the next descriptor */ | ||
794 | pProg = (dmacHw_DESC_t *) pProg->llp; | ||
795 | |||
796 | /* Update source and destination address for next iteration */ | ||
797 | switch (pConfig->transferType) { | ||
798 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM: | ||
799 | if (pConfig->dstScatterWidth) { | ||
800 | pDstAddr = | ||
801 | (char *)pDstAddr + | ||
802 | blkTs * srcTrSize + | ||
803 | (((blkTs * srcTrSize) / | ||
804 | pConfig->dstScatterWidth) * | ||
805 | pConfig->dstScatterJump); | ||
806 | } else { | ||
807 | pDstAddr = | ||
808 | (char *)pDstAddr + | ||
809 | blkTs * srcTrSize; | ||
810 | } | ||
811 | break; | ||
812 | case dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL: | ||
813 | if (pConfig->srcGatherWidth) { | ||
814 | pSrcAddr = | ||
815 | (char *)pDstAddr + | ||
816 | blkTs * srcTrSize + | ||
817 | (((blkTs * srcTrSize) / | ||
818 | pConfig->srcGatherWidth) * | ||
819 | pConfig->srcGatherJump); | ||
820 | } else { | ||
821 | pSrcAddr = | ||
822 | (char *)pSrcAddr + | ||
823 | blkTs * srcTrSize; | ||
824 | } | ||
825 | break; | ||
826 | case dmacHw_TRANSFER_TYPE_MEM_TO_MEM: | ||
827 | if (pConfig->dstScatterWidth) { | ||
828 | pDstAddr = | ||
829 | (char *)pDstAddr + | ||
830 | blkTs * srcTrSize + | ||
831 | (((blkTs * srcTrSize) / | ||
832 | pConfig->dstScatterWidth) * | ||
833 | pConfig->dstScatterJump); | ||
834 | } else { | ||
835 | pDstAddr = | ||
836 | (char *)pDstAddr + | ||
837 | blkTs * srcTrSize; | ||
838 | } | ||
839 | |||
840 | if (pConfig->srcGatherWidth) { | ||
841 | pSrcAddr = | ||
842 | (char *)pDstAddr + | ||
843 | blkTs * srcTrSize + | ||
844 | (((blkTs * srcTrSize) / | ||
845 | pConfig->srcGatherWidth) * | ||
846 | pConfig->srcGatherJump); | ||
847 | } else { | ||
848 | pSrcAddr = | ||
849 | (char *)pSrcAddr + | ||
850 | blkTs * srcTrSize; | ||
851 | } | ||
852 | break; | ||
853 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL: | ||
854 | /* Do not adjust the address */ | ||
855 | break; | ||
856 | default: | ||
857 | dmacHw_ASSERT(0); | ||
858 | } | ||
859 | } else { | ||
860 | /* At the end of transfer "srcTs" must be zero */ | ||
861 | dmacHw_ASSERT(srcTs == 0); | ||
862 | } | ||
863 | count--; | ||
864 | } | ||
865 | |||
866 | /* Remember the descriptor to initialize the registers */ | ||
867 | if (pRing->pProg == dmacHw_DESC_INIT) { | ||
868 | pRing->pProg = pStart; | ||
869 | } | ||
870 | /* Indicate that the descriptor is updated */ | ||
871 | pRing->pEnd = pProg; | ||
872 | /* Head pointing to the next descriptor */ | ||
873 | pRing->pHead = (dmacHw_DESC_t *) pProg->llp; | ||
874 | /* Update Tail pointer if destination is a peripheral, | ||
875 | because no one is going to read from the pTail | ||
876 | */ | ||
877 | if (!dmacHw_DST_IS_MEMORY(pConfig->transferType)) { | ||
878 | pRing->pTail = pRing->pHead; | ||
879 | } | ||
880 | return 0; | ||
881 | } | ||
882 | |||
883 | /****************************************************************************/ | ||
884 | /** | ||
885 | * @brief Provides DMA controller attributes | ||
886 | * | ||
887 | * | ||
888 | * @return DMA controller attributes | ||
889 | * | ||
890 | * @note | ||
891 | * None | ||
892 | */ | ||
893 | /****************************************************************************/ | ||
894 | uint32_t dmacHw_getDmaControllerAttribute(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
895 | dmacHw_CONTROLLER_ATTRIB_e attr /* [ IN ] DMA Controller attribute of type dmacHw_CONTROLLER_ATTRIB_e */ | ||
896 | ) { | ||
897 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
898 | |||
899 | switch (attr) { | ||
900 | case dmacHw_CONTROLLER_ATTRIB_CHANNEL_NUM: | ||
901 | return dmacHw_GET_NUM_CHANNEL(pCblk->module); | ||
902 | case dmacHw_CONTROLLER_ATTRIB_CHANNEL_MAX_BLOCK_SIZE: | ||
903 | return (1 << | ||
904 | (dmacHw_GET_MAX_BLOCK_SIZE | ||
905 | (pCblk->module, pCblk->module) + 2)) - 8; | ||
906 | case dmacHw_CONTROLLER_ATTRIB_MASTER_INTF_NUM: | ||
907 | return dmacHw_GET_NUM_INTERFACE(pCblk->module); | ||
908 | case dmacHw_CONTROLLER_ATTRIB_CHANNEL_BUS_WIDTH: | ||
909 | return 32 << dmacHw_GET_CHANNEL_DATA_WIDTH(pCblk->module, | ||
910 | pCblk->channel); | ||
911 | case dmacHw_CONTROLLER_ATTRIB_CHANNEL_FIFO_SIZE: | ||
912 | return GetFifoSize(handle); | ||
913 | } | ||
914 | dmacHw_ASSERT(0); | ||
915 | return 0; | ||
916 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c b/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c deleted file mode 100644 index fe438699d11e..000000000000 --- a/arch/arm/mach-bcmring/csp/dmac/dmacHw_extra.c +++ /dev/null | |||
@@ -1,1017 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dmacHw_extra.c | ||
18 | * | ||
19 | * @brief Extra Low level DMA controller driver routines | ||
20 | * | ||
21 | * @note | ||
22 | * | ||
23 | * These routines provide basic DMA functionality only. | ||
24 | */ | ||
25 | /****************************************************************************/ | ||
26 | |||
27 | /* ---- Include Files ---------------------------------------------------- */ | ||
28 | |||
29 | #include <linux/types.h> | ||
30 | #include <linux/stddef.h> | ||
31 | |||
32 | #include <mach/csp/dmacHw.h> | ||
33 | #include <mach/csp/dmacHw_reg.h> | ||
34 | #include <mach/csp/dmacHw_priv.h> | ||
35 | |||
36 | extern dmacHw_CBLK_t dmacHw_gCblk[dmacHw_MAX_CHANNEL_COUNT]; /* Declared in dmacHw.c */ | ||
37 | |||
38 | /* ---- External Function Prototypes ------------------------------------- */ | ||
39 | |||
40 | /* ---- Internal Use Function Prototypes --------------------------------- */ | ||
41 | /****************************************************************************/ | ||
42 | /** | ||
43 | * @brief Overwrites data length in the descriptor | ||
44 | * | ||
45 | * This function overwrites data length in the descriptor | ||
46 | * | ||
47 | * | ||
48 | * @return void | ||
49 | * | ||
50 | * @note | ||
51 | * This is only used for PCM channel | ||
52 | */ | ||
53 | /****************************************************************************/ | ||
54 | void dmacHw_setDataLength(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
55 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
56 | size_t dataLen /* [ IN ] Data length in bytes */ | ||
57 | ); | ||
58 | |||
59 | /****************************************************************************/ | ||
60 | /** | ||
61 | * @brief Helper function to display DMA registers | ||
62 | * | ||
63 | * @return void | ||
64 | * | ||
65 | * | ||
66 | * @note | ||
67 | * None | ||
68 | */ | ||
69 | /****************************************************************************/ | ||
70 | static void DisplayRegisterContents(int module, /* [ IN ] DMA Controller unit (0-1) */ | ||
71 | int channel, /* [ IN ] DMA Channel (0-7) / -1(all) */ | ||
72 | int (*fpPrint) (const char *, ...) /* [ IN ] Callback to the print function */ | ||
73 | ) { | ||
74 | int chan; | ||
75 | |||
76 | (*fpPrint) ("Displaying register content \n\n"); | ||
77 | (*fpPrint) ("Module %d: Interrupt raw transfer 0x%X\n", | ||
78 | module, (uint32_t) (dmacHw_REG_INT_RAW_TRAN(module))); | ||
79 | (*fpPrint) ("Module %d: Interrupt raw block 0x%X\n", | ||
80 | module, (uint32_t) (dmacHw_REG_INT_RAW_BLOCK(module))); | ||
81 | (*fpPrint) ("Module %d: Interrupt raw src transfer 0x%X\n", | ||
82 | module, (uint32_t) (dmacHw_REG_INT_RAW_STRAN(module))); | ||
83 | (*fpPrint) ("Module %d: Interrupt raw dst transfer 0x%X\n", | ||
84 | module, (uint32_t) (dmacHw_REG_INT_RAW_DTRAN(module))); | ||
85 | (*fpPrint) ("Module %d: Interrupt raw error 0x%X\n", | ||
86 | module, (uint32_t) (dmacHw_REG_INT_RAW_ERROR(module))); | ||
87 | (*fpPrint) ("--------------------------------------------------\n"); | ||
88 | (*fpPrint) ("Module %d: Interrupt stat transfer 0x%X\n", | ||
89 | module, (uint32_t) (dmacHw_REG_INT_STAT_TRAN(module))); | ||
90 | (*fpPrint) ("Module %d: Interrupt stat block 0x%X\n", | ||
91 | module, (uint32_t) (dmacHw_REG_INT_STAT_BLOCK(module))); | ||
92 | (*fpPrint) ("Module %d: Interrupt stat src transfer 0x%X\n", | ||
93 | module, (uint32_t) (dmacHw_REG_INT_STAT_STRAN(module))); | ||
94 | (*fpPrint) ("Module %d: Interrupt stat dst transfer 0x%X\n", | ||
95 | module, (uint32_t) (dmacHw_REG_INT_STAT_DTRAN(module))); | ||
96 | (*fpPrint) ("Module %d: Interrupt stat error 0x%X\n", | ||
97 | module, (uint32_t) (dmacHw_REG_INT_STAT_ERROR(module))); | ||
98 | (*fpPrint) ("--------------------------------------------------\n"); | ||
99 | (*fpPrint) ("Module %d: Interrupt mask transfer 0x%X\n", | ||
100 | module, (uint32_t) (dmacHw_REG_INT_MASK_TRAN(module))); | ||
101 | (*fpPrint) ("Module %d: Interrupt mask block 0x%X\n", | ||
102 | module, (uint32_t) (dmacHw_REG_INT_MASK_BLOCK(module))); | ||
103 | (*fpPrint) ("Module %d: Interrupt mask src transfer 0x%X\n", | ||
104 | module, (uint32_t) (dmacHw_REG_INT_MASK_STRAN(module))); | ||
105 | (*fpPrint) ("Module %d: Interrupt mask dst transfer 0x%X\n", | ||
106 | module, (uint32_t) (dmacHw_REG_INT_MASK_DTRAN(module))); | ||
107 | (*fpPrint) ("Module %d: Interrupt mask error 0x%X\n", | ||
108 | module, (uint32_t) (dmacHw_REG_INT_MASK_ERROR(module))); | ||
109 | (*fpPrint) ("--------------------------------------------------\n"); | ||
110 | (*fpPrint) ("Module %d: Interrupt clear transfer 0x%X\n", | ||
111 | module, (uint32_t) (dmacHw_REG_INT_CLEAR_TRAN(module))); | ||
112 | (*fpPrint) ("Module %d: Interrupt clear block 0x%X\n", | ||
113 | module, (uint32_t) (dmacHw_REG_INT_CLEAR_BLOCK(module))); | ||
114 | (*fpPrint) ("Module %d: Interrupt clear src transfer 0x%X\n", | ||
115 | module, (uint32_t) (dmacHw_REG_INT_CLEAR_STRAN(module))); | ||
116 | (*fpPrint) ("Module %d: Interrupt clear dst transfer 0x%X\n", | ||
117 | module, (uint32_t) (dmacHw_REG_INT_CLEAR_DTRAN(module))); | ||
118 | (*fpPrint) ("Module %d: Interrupt clear error 0x%X\n", | ||
119 | module, (uint32_t) (dmacHw_REG_INT_CLEAR_ERROR(module))); | ||
120 | (*fpPrint) ("--------------------------------------------------\n"); | ||
121 | (*fpPrint) ("Module %d: SW source req 0x%X\n", | ||
122 | module, (uint32_t) (dmacHw_REG_SW_HS_SRC_REQ(module))); | ||
123 | (*fpPrint) ("Module %d: SW dest req 0x%X\n", | ||
124 | module, (uint32_t) (dmacHw_REG_SW_HS_DST_REQ(module))); | ||
125 | (*fpPrint) ("Module %d: SW source signal 0x%X\n", | ||
126 | module, (uint32_t) (dmacHw_REG_SW_HS_SRC_SGL_REQ(module))); | ||
127 | (*fpPrint) ("Module %d: SW dest signal 0x%X\n", | ||
128 | module, (uint32_t) (dmacHw_REG_SW_HS_DST_SGL_REQ(module))); | ||
129 | (*fpPrint) ("Module %d: SW source last 0x%X\n", | ||
130 | module, (uint32_t) (dmacHw_REG_SW_HS_SRC_LST_REQ(module))); | ||
131 | (*fpPrint) ("Module %d: SW dest last 0x%X\n", | ||
132 | module, (uint32_t) (dmacHw_REG_SW_HS_DST_LST_REQ(module))); | ||
133 | (*fpPrint) ("--------------------------------------------------\n"); | ||
134 | (*fpPrint) ("Module %d: misc config 0x%X\n", | ||
135 | module, (uint32_t) (dmacHw_REG_MISC_CFG(module))); | ||
136 | (*fpPrint) ("Module %d: misc channel enable 0x%X\n", | ||
137 | module, (uint32_t) (dmacHw_REG_MISC_CH_ENABLE(module))); | ||
138 | (*fpPrint) ("Module %d: misc ID 0x%X\n", | ||
139 | module, (uint32_t) (dmacHw_REG_MISC_ID(module))); | ||
140 | (*fpPrint) ("Module %d: misc test 0x%X\n", | ||
141 | module, (uint32_t) (dmacHw_REG_MISC_TEST(module))); | ||
142 | |||
143 | if (channel == -1) { | ||
144 | for (chan = 0; chan < 8; chan++) { | ||
145 | (*fpPrint) | ||
146 | ("--------------------------------------------------\n"); | ||
147 | (*fpPrint) | ||
148 | ("Module %d: Channel %d Source 0x%X\n", | ||
149 | module, chan, | ||
150 | (uint32_t) (dmacHw_REG_SAR(module, chan))); | ||
151 | (*fpPrint) | ||
152 | ("Module %d: Channel %d Destination 0x%X\n", | ||
153 | module, chan, | ||
154 | (uint32_t) (dmacHw_REG_DAR(module, chan))); | ||
155 | (*fpPrint) | ||
156 | ("Module %d: Channel %d LLP 0x%X\n", | ||
157 | module, chan, | ||
158 | (uint32_t) (dmacHw_REG_LLP(module, chan))); | ||
159 | (*fpPrint) | ||
160 | ("Module %d: Channel %d Control (LO) 0x%X\n", | ||
161 | module, chan, | ||
162 | (uint32_t) (dmacHw_REG_CTL_LO(module, chan))); | ||
163 | (*fpPrint) | ||
164 | ("Module %d: Channel %d Control (HI) 0x%X\n", | ||
165 | module, chan, | ||
166 | (uint32_t) (dmacHw_REG_CTL_HI(module, chan))); | ||
167 | (*fpPrint) | ||
168 | ("Module %d: Channel %d Source Stats 0x%X\n", | ||
169 | module, chan, | ||
170 | (uint32_t) (dmacHw_REG_SSTAT(module, chan))); | ||
171 | (*fpPrint) | ||
172 | ("Module %d: Channel %d Dest Stats 0x%X\n", | ||
173 | module, chan, | ||
174 | (uint32_t) (dmacHw_REG_DSTAT(module, chan))); | ||
175 | (*fpPrint) | ||
176 | ("Module %d: Channel %d Source Stats Addr 0x%X\n", | ||
177 | module, chan, | ||
178 | (uint32_t) (dmacHw_REG_SSTATAR(module, chan))); | ||
179 | (*fpPrint) | ||
180 | ("Module %d: Channel %d Dest Stats Addr 0x%X\n", | ||
181 | module, chan, | ||
182 | (uint32_t) (dmacHw_REG_DSTATAR(module, chan))); | ||
183 | (*fpPrint) | ||
184 | ("Module %d: Channel %d Config (LO) 0x%X\n", | ||
185 | module, chan, | ||
186 | (uint32_t) (dmacHw_REG_CFG_LO(module, chan))); | ||
187 | (*fpPrint) | ||
188 | ("Module %d: Channel %d Config (HI) 0x%X\n", | ||
189 | module, chan, | ||
190 | (uint32_t) (dmacHw_REG_CFG_HI(module, chan))); | ||
191 | } | ||
192 | } else { | ||
193 | chan = channel; | ||
194 | (*fpPrint) | ||
195 | ("--------------------------------------------------\n"); | ||
196 | (*fpPrint) | ||
197 | ("Module %d: Channel %d Source 0x%X\n", | ||
198 | module, chan, (uint32_t) (dmacHw_REG_SAR(module, chan))); | ||
199 | (*fpPrint) | ||
200 | ("Module %d: Channel %d Destination 0x%X\n", | ||
201 | module, chan, (uint32_t) (dmacHw_REG_DAR(module, chan))); | ||
202 | (*fpPrint) | ||
203 | ("Module %d: Channel %d LLP 0x%X\n", | ||
204 | module, chan, (uint32_t) (dmacHw_REG_LLP(module, chan))); | ||
205 | (*fpPrint) | ||
206 | ("Module %d: Channel %d Control (LO) 0x%X\n", | ||
207 | module, chan, | ||
208 | (uint32_t) (dmacHw_REG_CTL_LO(module, chan))); | ||
209 | (*fpPrint) | ||
210 | ("Module %d: Channel %d Control (HI) 0x%X\n", | ||
211 | module, chan, | ||
212 | (uint32_t) (dmacHw_REG_CTL_HI(module, chan))); | ||
213 | (*fpPrint) | ||
214 | ("Module %d: Channel %d Source Stats 0x%X\n", | ||
215 | module, chan, (uint32_t) (dmacHw_REG_SSTAT(module, chan))); | ||
216 | (*fpPrint) | ||
217 | ("Module %d: Channel %d Dest Stats 0x%X\n", | ||
218 | module, chan, (uint32_t) (dmacHw_REG_DSTAT(module, chan))); | ||
219 | (*fpPrint) | ||
220 | ("Module %d: Channel %d Source Stats Addr 0x%X\n", | ||
221 | module, chan, | ||
222 | (uint32_t) (dmacHw_REG_SSTATAR(module, chan))); | ||
223 | (*fpPrint) | ||
224 | ("Module %d: Channel %d Dest Stats Addr 0x%X\n", | ||
225 | module, chan, | ||
226 | (uint32_t) (dmacHw_REG_DSTATAR(module, chan))); | ||
227 | (*fpPrint) | ||
228 | ("Module %d: Channel %d Config (LO) 0x%X\n", | ||
229 | module, chan, | ||
230 | (uint32_t) (dmacHw_REG_CFG_LO(module, chan))); | ||
231 | (*fpPrint) | ||
232 | ("Module %d: Channel %d Config (HI) 0x%X\n", | ||
233 | module, chan, | ||
234 | (uint32_t) (dmacHw_REG_CFG_HI(module, chan))); | ||
235 | } | ||
236 | } | ||
237 | |||
238 | /****************************************************************************/ | ||
239 | /** | ||
240 | * @brief Helper function to display descriptor ring | ||
241 | * | ||
242 | * @return void | ||
243 | * | ||
244 | * | ||
245 | * @note | ||
246 | * None | ||
247 | */ | ||
248 | /****************************************************************************/ | ||
249 | static void DisplayDescRing(void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
250 | int (*fpPrint) (const char *, ...) /* [ IN ] Callback to the print function */ | ||
251 | ) { | ||
252 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
253 | dmacHw_DESC_t *pStart; | ||
254 | |||
255 | if (pRing->pHead == NULL) { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | pStart = pRing->pHead; | ||
260 | |||
261 | while ((dmacHw_DESC_t *) pStart->llp != pRing->pHead) { | ||
262 | if (pStart == pRing->pHead) { | ||
263 | (*fpPrint) ("Head\n"); | ||
264 | } | ||
265 | if (pStart == pRing->pTail) { | ||
266 | (*fpPrint) ("Tail\n"); | ||
267 | } | ||
268 | if (pStart == pRing->pProg) { | ||
269 | (*fpPrint) ("Prog\n"); | ||
270 | } | ||
271 | if (pStart == pRing->pEnd) { | ||
272 | (*fpPrint) ("End\n"); | ||
273 | } | ||
274 | if (pStart == pRing->pFree) { | ||
275 | (*fpPrint) ("Free\n"); | ||
276 | } | ||
277 | (*fpPrint) ("0x%X:\n", (uint32_t) pStart); | ||
278 | (*fpPrint) ("sar 0x%0X\n", pStart->sar); | ||
279 | (*fpPrint) ("dar 0x%0X\n", pStart->dar); | ||
280 | (*fpPrint) ("llp 0x%0X\n", pStart->llp); | ||
281 | (*fpPrint) ("ctl.lo 0x%0X\n", pStart->ctl.lo); | ||
282 | (*fpPrint) ("ctl.hi 0x%0X\n", pStart->ctl.hi); | ||
283 | (*fpPrint) ("sstat 0x%0X\n", pStart->sstat); | ||
284 | (*fpPrint) ("dstat 0x%0X\n", pStart->dstat); | ||
285 | (*fpPrint) ("devCtl 0x%0X\n", pStart->devCtl); | ||
286 | |||
287 | pStart = (dmacHw_DESC_t *) pStart->llp; | ||
288 | } | ||
289 | if (pStart == pRing->pHead) { | ||
290 | (*fpPrint) ("Head\n"); | ||
291 | } | ||
292 | if (pStart == pRing->pTail) { | ||
293 | (*fpPrint) ("Tail\n"); | ||
294 | } | ||
295 | if (pStart == pRing->pProg) { | ||
296 | (*fpPrint) ("Prog\n"); | ||
297 | } | ||
298 | if (pStart == pRing->pEnd) { | ||
299 | (*fpPrint) ("End\n"); | ||
300 | } | ||
301 | if (pStart == pRing->pFree) { | ||
302 | (*fpPrint) ("Free\n"); | ||
303 | } | ||
304 | (*fpPrint) ("0x%X:\n", (uint32_t) pStart); | ||
305 | (*fpPrint) ("sar 0x%0X\n", pStart->sar); | ||
306 | (*fpPrint) ("dar 0x%0X\n", pStart->dar); | ||
307 | (*fpPrint) ("llp 0x%0X\n", pStart->llp); | ||
308 | (*fpPrint) ("ctl.lo 0x%0X\n", pStart->ctl.lo); | ||
309 | (*fpPrint) ("ctl.hi 0x%0X\n", pStart->ctl.hi); | ||
310 | (*fpPrint) ("sstat 0x%0X\n", pStart->sstat); | ||
311 | (*fpPrint) ("dstat 0x%0X\n", pStart->dstat); | ||
312 | (*fpPrint) ("devCtl 0x%0X\n", pStart->devCtl); | ||
313 | } | ||
314 | |||
315 | /****************************************************************************/ | ||
316 | /** | ||
317 | * @brief Check if DMA channel is the flow controller | ||
318 | * | ||
319 | * @return 1 : If DMA is a flow controller | ||
320 | * 0 : Peripheral is the flow controller | ||
321 | * | ||
322 | * @note | ||
323 | * None | ||
324 | */ | ||
325 | /****************************************************************************/ | ||
326 | static inline int DmaIsFlowController(void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
327 | ) { | ||
328 | uint32_t ttfc = | ||
329 | (dmacHw_GET_DESC_RING(pDescriptor))->pTail->ctl. | ||
330 | lo & dmacHw_REG_CTL_TTFC_MASK; | ||
331 | |||
332 | switch (ttfc) { | ||
333 | case dmacHw_REG_CTL_TTFC_MM_DMAC: | ||
334 | case dmacHw_REG_CTL_TTFC_MP_DMAC: | ||
335 | case dmacHw_REG_CTL_TTFC_PM_DMAC: | ||
336 | case dmacHw_REG_CTL_TTFC_PP_DMAC: | ||
337 | return 1; | ||
338 | } | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | /****************************************************************************/ | ||
344 | /** | ||
345 | * @brief Overwrites data length in the descriptor | ||
346 | * | ||
347 | * This function overwrites data length in the descriptor | ||
348 | * | ||
349 | * | ||
350 | * @return void | ||
351 | * | ||
352 | * @note | ||
353 | * This is only used for PCM channel | ||
354 | */ | ||
355 | /****************************************************************************/ | ||
356 | void dmacHw_setDataLength(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
357 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
358 | size_t dataLen /* [ IN ] Data length in bytes */ | ||
359 | ) { | ||
360 | dmacHw_DESC_t *pProg; | ||
361 | dmacHw_DESC_t *pHead; | ||
362 | int srcTs = 0; | ||
363 | int srcTrSize = 0; | ||
364 | |||
365 | pHead = (dmacHw_GET_DESC_RING(pDescriptor))->pHead; | ||
366 | pProg = pHead; | ||
367 | |||
368 | srcTrSize = dmacHw_GetTrWidthInBytes(pConfig->srcMaxTransactionWidth); | ||
369 | srcTs = dataLen / srcTrSize; | ||
370 | do { | ||
371 | pProg->ctl.hi = srcTs & dmacHw_REG_CTL_BLOCK_TS_MASK; | ||
372 | pProg = (dmacHw_DESC_t *) pProg->llp; | ||
373 | } while (pProg != pHead); | ||
374 | } | ||
375 | |||
376 | /****************************************************************************/ | ||
377 | /** | ||
378 | * @brief Clears the interrupt | ||
379 | * | ||
380 | * This function clears the DMA channel specific interrupt | ||
381 | * | ||
382 | * | ||
383 | * @return void | ||
384 | * | ||
385 | * @note | ||
386 | * Must be called under the context of ISR | ||
387 | */ | ||
388 | /****************************************************************************/ | ||
389 | void dmacHw_clearInterrupt(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
390 | ) { | ||
391 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
392 | |||
393 | dmacHw_TRAN_INT_CLEAR(pCblk->module, pCblk->channel); | ||
394 | dmacHw_BLOCK_INT_CLEAR(pCblk->module, pCblk->channel); | ||
395 | dmacHw_ERROR_INT_CLEAR(pCblk->module, pCblk->channel); | ||
396 | } | ||
397 | |||
398 | /****************************************************************************/ | ||
399 | /** | ||
400 | * @brief Returns the cause of channel specific DMA interrupt | ||
401 | * | ||
402 | * This function returns the cause of interrupt | ||
403 | * | ||
404 | * @return Interrupt status, each bit representing a specific type of interrupt | ||
405 | * | ||
406 | * @note | ||
407 | * Should be called under the context of ISR | ||
408 | */ | ||
409 | /****************************************************************************/ | ||
410 | dmacHw_INTERRUPT_STATUS_e dmacHw_getInterruptStatus(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
411 | ) { | ||
412 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
413 | dmacHw_INTERRUPT_STATUS_e status = dmacHw_INTERRUPT_STATUS_NONE; | ||
414 | |||
415 | if (dmacHw_REG_INT_STAT_TRAN(pCblk->module) & | ||
416 | ((0x00000001 << pCblk->channel))) { | ||
417 | status |= dmacHw_INTERRUPT_STATUS_TRANS; | ||
418 | } | ||
419 | if (dmacHw_REG_INT_STAT_BLOCK(pCblk->module) & | ||
420 | ((0x00000001 << pCblk->channel))) { | ||
421 | status |= dmacHw_INTERRUPT_STATUS_BLOCK; | ||
422 | } | ||
423 | if (dmacHw_REG_INT_STAT_ERROR(pCblk->module) & | ||
424 | ((0x00000001 << pCblk->channel))) { | ||
425 | status |= dmacHw_INTERRUPT_STATUS_ERROR; | ||
426 | } | ||
427 | |||
428 | return status; | ||
429 | } | ||
430 | |||
431 | /****************************************************************************/ | ||
432 | /** | ||
433 | * @brief Indentifies a DMA channel causing interrupt | ||
434 | * | ||
435 | * This functions returns a channel causing interrupt of type dmacHw_INTERRUPT_STATUS_e | ||
436 | * | ||
437 | * @return NULL : No channel causing DMA interrupt | ||
438 | * ! NULL : Handle to a channel causing DMA interrupt | ||
439 | * @note | ||
440 | * dmacHw_clearInterrupt() must be called with a valid handle after calling this function | ||
441 | */ | ||
442 | /****************************************************************************/ | ||
443 | dmacHw_HANDLE_t dmacHw_getInterruptSource(void) | ||
444 | { | ||
445 | uint32_t i; | ||
446 | |||
447 | for (i = 0; i < dmaChannelCount_0 + dmaChannelCount_1; i++) { | ||
448 | if ((dmacHw_REG_INT_STAT_TRAN(dmacHw_gCblk[i].module) & | ||
449 | ((0x00000001 << dmacHw_gCblk[i].channel))) | ||
450 | || (dmacHw_REG_INT_STAT_BLOCK(dmacHw_gCblk[i].module) & | ||
451 | ((0x00000001 << dmacHw_gCblk[i].channel))) | ||
452 | || (dmacHw_REG_INT_STAT_ERROR(dmacHw_gCblk[i].module) & | ||
453 | ((0x00000001 << dmacHw_gCblk[i].channel))) | ||
454 | ) { | ||
455 | return dmacHw_CBLK_TO_HANDLE(&dmacHw_gCblk[i]); | ||
456 | } | ||
457 | } | ||
458 | return dmacHw_CBLK_TO_HANDLE(NULL); | ||
459 | } | ||
460 | |||
461 | /****************************************************************************/ | ||
462 | /** | ||
463 | * @brief Estimates number of descriptor needed to perform certain DMA transfer | ||
464 | * | ||
465 | * | ||
466 | * @return On failure : -1 | ||
467 | * On success : Number of descriptor count | ||
468 | * | ||
469 | * | ||
470 | */ | ||
471 | /****************************************************************************/ | ||
472 | int dmacHw_calculateDescriptorCount(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
473 | void *pSrcAddr, /* [ IN ] Source (Peripheral/Memory) address */ | ||
474 | void *pDstAddr, /* [ IN ] Destination (Peripheral/Memory) address */ | ||
475 | size_t dataLen /* [ IN ] Data length in bytes */ | ||
476 | ) { | ||
477 | int srcTs = 0; | ||
478 | int oddSize = 0; | ||
479 | int descCount = 0; | ||
480 | int dstTrSize = 0; | ||
481 | int srcTrSize = 0; | ||
482 | uint32_t maxBlockSize = dmacHw_MAX_BLOCKSIZE; | ||
483 | dmacHw_TRANSACTION_WIDTH_e dstTrWidth; | ||
484 | dmacHw_TRANSACTION_WIDTH_e srcTrWidth; | ||
485 | |||
486 | dstTrSize = dmacHw_GetTrWidthInBytes(pConfig->dstMaxTransactionWidth); | ||
487 | srcTrSize = dmacHw_GetTrWidthInBytes(pConfig->srcMaxTransactionWidth); | ||
488 | |||
489 | /* Skip Tx if buffer is NULL or length is unknown */ | ||
490 | if ((pSrcAddr == NULL) || (pDstAddr == NULL) || (dataLen == 0)) { | ||
491 | /* Do not initiate transfer */ | ||
492 | return -1; | ||
493 | } | ||
494 | |||
495 | /* Ensure scatter and gather are transaction aligned */ | ||
496 | if (pConfig->srcGatherWidth % srcTrSize | ||
497 | || pConfig->dstScatterWidth % dstTrSize) { | ||
498 | return -1; | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | Background 1: DMAC can not perform DMA if source and destination addresses are | ||
503 | not properly aligned with the channel's transaction width. So, for successful | ||
504 | DMA transfer, transaction width must be set according to the alignment of the | ||
505 | source and destination address. | ||
506 | */ | ||
507 | |||
508 | /* Adjust destination transaction width if destination address is not aligned properly */ | ||
509 | dstTrWidth = pConfig->dstMaxTransactionWidth; | ||
510 | while (dmacHw_ADDRESS_MASK(dstTrSize) & (uint32_t) pDstAddr) { | ||
511 | dstTrWidth = dmacHw_GetNextTrWidth(dstTrWidth); | ||
512 | dstTrSize = dmacHw_GetTrWidthInBytes(dstTrWidth); | ||
513 | } | ||
514 | |||
515 | /* Adjust source transaction width if source address is not aligned properly */ | ||
516 | srcTrWidth = pConfig->srcMaxTransactionWidth; | ||
517 | while (dmacHw_ADDRESS_MASK(srcTrSize) & (uint32_t) pSrcAddr) { | ||
518 | srcTrWidth = dmacHw_GetNextTrWidth(srcTrWidth); | ||
519 | srcTrSize = dmacHw_GetTrWidthInBytes(srcTrWidth); | ||
520 | } | ||
521 | |||
522 | /* Find the maximum transaction per descriptor */ | ||
523 | if (pConfig->maxDataPerBlock | ||
524 | && ((pConfig->maxDataPerBlock / srcTrSize) < | ||
525 | dmacHw_MAX_BLOCKSIZE)) { | ||
526 | maxBlockSize = pConfig->maxDataPerBlock / srcTrSize; | ||
527 | } | ||
528 | |||
529 | /* Find number of source transactions needed to complete the DMA transfer */ | ||
530 | srcTs = dataLen / srcTrSize; | ||
531 | /* Find the odd number of bytes that need to be transferred as single byte transaction width */ | ||
532 | if (srcTs && (dstTrSize > srcTrSize)) { | ||
533 | oddSize = dataLen % dstTrSize; | ||
534 | /* Adjust source transaction count due to "oddSize" */ | ||
535 | srcTs = srcTs - (oddSize / srcTrSize); | ||
536 | } else { | ||
537 | oddSize = dataLen % srcTrSize; | ||
538 | } | ||
539 | /* Adjust "descCount" due to "oddSize" */ | ||
540 | if (oddSize) { | ||
541 | descCount++; | ||
542 | } | ||
543 | |||
544 | /* Find the number of descriptor needed for total "srcTs" */ | ||
545 | if (srcTs) { | ||
546 | descCount += ((srcTs - 1) / maxBlockSize) + 1; | ||
547 | } | ||
548 | |||
549 | return descCount; | ||
550 | } | ||
551 | |||
552 | /****************************************************************************/ | ||
553 | /** | ||
554 | * @brief Check the existence of pending descriptor | ||
555 | * | ||
556 | * This function confirmes if there is any pending descriptor in the chain | ||
557 | * to program the channel | ||
558 | * | ||
559 | * @return 1 : Channel need to be programmed with pending descriptor | ||
560 | * 0 : No more pending descriptor to programe the channel | ||
561 | * | ||
562 | * @note | ||
563 | * - This function should be called from ISR in case there are pending | ||
564 | * descriptor to program the channel. | ||
565 | * | ||
566 | * Example: | ||
567 | * | ||
568 | * dmac_isr () | ||
569 | * { | ||
570 | * ... | ||
571 | * if (dmacHw_descriptorPending (handle)) | ||
572 | * { | ||
573 | * dmacHw_initiateTransfer (handle); | ||
574 | * } | ||
575 | * } | ||
576 | * | ||
577 | */ | ||
578 | /****************************************************************************/ | ||
579 | uint32_t dmacHw_descriptorPending(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
580 | void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
581 | ) { | ||
582 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
583 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
584 | |||
585 | /* Make sure channel is not busy */ | ||
586 | if (!CHANNEL_BUSY(pCblk->module, pCblk->channel)) { | ||
587 | /* Check if pEnd is not processed */ | ||
588 | if (pRing->pEnd) { | ||
589 | /* Something left for processing */ | ||
590 | return 1; | ||
591 | } | ||
592 | } | ||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | /****************************************************************************/ | ||
597 | /** | ||
598 | * @brief Program channel register to stop transfer | ||
599 | * | ||
600 | * Ensures the channel is not doing any transfer after calling this function | ||
601 | * | ||
602 | * @return void | ||
603 | * | ||
604 | */ | ||
605 | /****************************************************************************/ | ||
606 | void dmacHw_stopTransfer(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
607 | ) { | ||
608 | dmacHw_CBLK_t *pCblk; | ||
609 | |||
610 | pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
611 | |||
612 | /* Stop the channel */ | ||
613 | dmacHw_DMA_STOP(pCblk->module, pCblk->channel); | ||
614 | } | ||
615 | |||
616 | /****************************************************************************/ | ||
617 | /** | ||
618 | * @brief Deallocates source or destination memory, allocated | ||
619 | * | ||
620 | * This function can be called to deallocate data memory that was DMAed successfully | ||
621 | * | ||
622 | * @return On failure : -1 | ||
623 | * On success : Number of buffer freed | ||
624 | * | ||
625 | * @note | ||
626 | * This function will be called ONLY, when source OR destination address is pointing | ||
627 | * to dynamic memory | ||
628 | */ | ||
629 | /****************************************************************************/ | ||
630 | int dmacHw_freeMem(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
631 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
632 | void (*fpFree) (void *) /* [ IN ] Function pointer to free data memory */ | ||
633 | ) { | ||
634 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
635 | uint32_t count = 0; | ||
636 | |||
637 | if (fpFree == NULL) { | ||
638 | return -1; | ||
639 | } | ||
640 | |||
641 | while ((pRing->pFree != pRing->pTail) | ||
642 | && (pRing->pFree->ctl.lo & dmacHw_DESC_FREE)) { | ||
643 | if (pRing->pFree->devCtl == dmacHw_FREE_USER_MEMORY) { | ||
644 | /* Identify, which memory to free */ | ||
645 | if (dmacHw_DST_IS_MEMORY(pConfig->transferType)) { | ||
646 | (*fpFree) ((void *)pRing->pFree->dar); | ||
647 | } else { | ||
648 | /* Destination was a peripheral */ | ||
649 | (*fpFree) ((void *)pRing->pFree->sar); | ||
650 | } | ||
651 | /* Unmark user memory to indicate it is freed */ | ||
652 | pRing->pFree->devCtl = ~dmacHw_FREE_USER_MEMORY; | ||
653 | } | ||
654 | dmacHw_NEXT_DESC(pRing, pFree); | ||
655 | |||
656 | count++; | ||
657 | } | ||
658 | |||
659 | return count; | ||
660 | } | ||
661 | |||
662 | /****************************************************************************/ | ||
663 | /** | ||
664 | * @brief Prepares descriptor ring, when source peripheral working as a flow controller | ||
665 | * | ||
666 | * This function will update the discriptor ring by allocating buffers, when source peripheral | ||
667 | * has to work as a flow controller to transfer data from: | ||
668 | * - Peripheral to memory. | ||
669 | * | ||
670 | * @return On failure : -1 | ||
671 | * On success : Number of descriptor updated | ||
672 | * | ||
673 | * | ||
674 | * @note | ||
675 | * Channel must be configured for peripheral to memory transfer | ||
676 | * | ||
677 | */ | ||
678 | /****************************************************************************/ | ||
679 | int dmacHw_setVariableDataDescriptor(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
680 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
681 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
682 | uint32_t srcAddr, /* [ IN ] Source peripheral address */ | ||
683 | void *(*fpAlloc) (int len), /* [ IN ] Function pointer that provides destination memory */ | ||
684 | int len, /* [ IN ] Number of bytes "fpAlloc" will allocate for destination */ | ||
685 | int num /* [ IN ] Number of descriptor to set */ | ||
686 | ) { | ||
687 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
688 | dmacHw_DESC_t *pProg = NULL; | ||
689 | dmacHw_DESC_t *pLast = NULL; | ||
690 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
691 | uint32_t dstAddr; | ||
692 | uint32_t controlParam; | ||
693 | int i; | ||
694 | |||
695 | dmacHw_ASSERT(pConfig->transferType == | ||
696 | dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM); | ||
697 | |||
698 | if (num > pRing->num) { | ||
699 | return -1; | ||
700 | } | ||
701 | |||
702 | pLast = pRing->pEnd; /* Last descriptor updated */ | ||
703 | pProg = pRing->pHead; /* First descriptor in the new list */ | ||
704 | |||
705 | controlParam = pConfig->srcUpdate | | ||
706 | pConfig->dstUpdate | | ||
707 | pConfig->srcMaxTransactionWidth | | ||
708 | pConfig->dstMaxTransactionWidth | | ||
709 | pConfig->srcMasterInterface | | ||
710 | pConfig->dstMasterInterface | | ||
711 | pConfig->srcMaxBurstWidth | | ||
712 | pConfig->dstMaxBurstWidth | | ||
713 | dmacHw_REG_CTL_TTFC_PM_PERI | | ||
714 | dmacHw_REG_CTL_LLP_DST_EN | | ||
715 | dmacHw_REG_CTL_LLP_SRC_EN | dmacHw_REG_CTL_INT_EN; | ||
716 | |||
717 | for (i = 0; i < num; i++) { | ||
718 | /* Allocate Rx buffer only for idle descriptor */ | ||
719 | if (((pRing->pHead->ctl.hi & dmacHw_DESC_FREE) == 0) || | ||
720 | ((dmacHw_DESC_t *) pRing->pHead->llp == pRing->pTail) | ||
721 | ) { | ||
722 | /* Rx descriptor is not idle */ | ||
723 | break; | ||
724 | } | ||
725 | /* Set source address */ | ||
726 | pRing->pHead->sar = srcAddr; | ||
727 | if (fpAlloc) { | ||
728 | /* Allocate memory for buffer in descriptor */ | ||
729 | dstAddr = (uint32_t) (*fpAlloc) (len); | ||
730 | /* Check the destination address */ | ||
731 | if (dstAddr == 0) { | ||
732 | if (i == 0) { | ||
733 | /* Not a single descriptor is available */ | ||
734 | return -1; | ||
735 | } | ||
736 | break; | ||
737 | } | ||
738 | /* Set destination address */ | ||
739 | pRing->pHead->dar = dstAddr; | ||
740 | } | ||
741 | /* Set control information */ | ||
742 | pRing->pHead->ctl.lo = controlParam; | ||
743 | /* Use "devCtl" to mark the memory that need to be freed later */ | ||
744 | pRing->pHead->devCtl = dmacHw_FREE_USER_MEMORY; | ||
745 | /* Descriptor is now owned by the channel */ | ||
746 | pRing->pHead->ctl.hi = 0; | ||
747 | /* Remember the descriptor last updated */ | ||
748 | pRing->pEnd = pRing->pHead; | ||
749 | /* Update next descriptor */ | ||
750 | dmacHw_NEXT_DESC(pRing, pHead); | ||
751 | } | ||
752 | |||
753 | /* Mark the end of the list */ | ||
754 | pRing->pEnd->ctl.lo &= | ||
755 | ~(dmacHw_REG_CTL_LLP_DST_EN | dmacHw_REG_CTL_LLP_SRC_EN); | ||
756 | /* Connect the list */ | ||
757 | if (pLast != pProg) { | ||
758 | pLast->ctl.lo |= | ||
759 | dmacHw_REG_CTL_LLP_DST_EN | dmacHw_REG_CTL_LLP_SRC_EN; | ||
760 | } | ||
761 | /* Mark the descriptors are updated */ | ||
762 | pCblk->descUpdated = 1; | ||
763 | if (!pCblk->varDataStarted) { | ||
764 | /* LLP must be pointing to the first descriptor */ | ||
765 | dmacHw_SET_LLP(pCblk->module, pCblk->channel, | ||
766 | (uint32_t) pProg - pRing->virt2PhyOffset); | ||
767 | /* Channel, handling variable data started */ | ||
768 | pCblk->varDataStarted = 1; | ||
769 | } | ||
770 | |||
771 | return i; | ||
772 | } | ||
773 | |||
774 | /****************************************************************************/ | ||
775 | /** | ||
776 | * @brief Read data DMAed to memory | ||
777 | * | ||
778 | * This function will read data that has been DMAed to memory while transferring from: | ||
779 | * - Memory to memory | ||
780 | * - Peripheral to memory | ||
781 | * | ||
782 | * @param handle - | ||
783 | * @param ppBbuf - | ||
784 | * @param pLen - | ||
785 | * | ||
786 | * @return 0 - No more data is available to read | ||
787 | * 1 - More data might be available to read | ||
788 | * | ||
789 | */ | ||
790 | /****************************************************************************/ | ||
791 | int dmacHw_readTransferredData(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
792 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
793 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
794 | void **ppBbuf, /* [ OUT ] Data received */ | ||
795 | size_t *pLlen /* [ OUT ] Length of the data received */ | ||
796 | ) { | ||
797 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
798 | |||
799 | (void)handle; | ||
800 | |||
801 | if (pConfig->transferMode != dmacHw_TRANSFER_MODE_CONTINUOUS) { | ||
802 | if (((pRing->pTail->ctl.hi & dmacHw_DESC_FREE) == 0) || | ||
803 | (pRing->pTail == pRing->pHead) | ||
804 | ) { | ||
805 | /* No receive data available */ | ||
806 | *ppBbuf = (char *)NULL; | ||
807 | *pLlen = 0; | ||
808 | |||
809 | return 0; | ||
810 | } | ||
811 | } | ||
812 | |||
813 | /* Return read buffer and length */ | ||
814 | *ppBbuf = (char *)pRing->pTail->dar; | ||
815 | |||
816 | /* Extract length of the received data */ | ||
817 | if (DmaIsFlowController(pDescriptor)) { | ||
818 | uint32_t srcTrSize = 0; | ||
819 | |||
820 | switch (pRing->pTail->ctl.lo & dmacHw_REG_CTL_SRC_TR_WIDTH_MASK) { | ||
821 | case dmacHw_REG_CTL_SRC_TR_WIDTH_8: | ||
822 | srcTrSize = 1; | ||
823 | break; | ||
824 | case dmacHw_REG_CTL_SRC_TR_WIDTH_16: | ||
825 | srcTrSize = 2; | ||
826 | break; | ||
827 | case dmacHw_REG_CTL_SRC_TR_WIDTH_32: | ||
828 | srcTrSize = 4; | ||
829 | break; | ||
830 | case dmacHw_REG_CTL_SRC_TR_WIDTH_64: | ||
831 | srcTrSize = 8; | ||
832 | break; | ||
833 | default: | ||
834 | dmacHw_ASSERT(0); | ||
835 | } | ||
836 | /* Calculate length from the block size */ | ||
837 | *pLlen = | ||
838 | (pRing->pTail->ctl.hi & dmacHw_REG_CTL_BLOCK_TS_MASK) * | ||
839 | srcTrSize; | ||
840 | } else { | ||
841 | /* Extract length from the source peripheral */ | ||
842 | *pLlen = pRing->pTail->sstat; | ||
843 | } | ||
844 | |||
845 | /* Advance tail to next descriptor */ | ||
846 | dmacHw_NEXT_DESC(pRing, pTail); | ||
847 | |||
848 | return 1; | ||
849 | } | ||
850 | |||
851 | /****************************************************************************/ | ||
852 | /** | ||
853 | * @brief Set descriptor carrying control information | ||
854 | * | ||
855 | * This function will be used to send specific control information to the device | ||
856 | * using the DMA channel | ||
857 | * | ||
858 | * | ||
859 | * @return -1 - On failure | ||
860 | * 0 - On success | ||
861 | * | ||
862 | * @note | ||
863 | * None | ||
864 | */ | ||
865 | /****************************************************************************/ | ||
866 | int dmacHw_setControlDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
867 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
868 | uint32_t ctlAddress, /* [ IN ] Address of the device control register */ | ||
869 | uint32_t control /* [ IN ] Device control information */ | ||
870 | ) { | ||
871 | dmacHw_DESC_RING_t *pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
872 | |||
873 | if (ctlAddress == 0) { | ||
874 | return -1; | ||
875 | } | ||
876 | |||
877 | /* Check the availability of descriptors in the ring */ | ||
878 | if ((pRing->pHead->ctl.hi & dmacHw_DESC_FREE) == 0) { | ||
879 | return -1; | ||
880 | } | ||
881 | /* Set control information */ | ||
882 | pRing->pHead->devCtl = control; | ||
883 | /* Set source and destination address */ | ||
884 | pRing->pHead->sar = (uint32_t) &pRing->pHead->devCtl; | ||
885 | pRing->pHead->dar = ctlAddress; | ||
886 | /* Set control parameters */ | ||
887 | if (pConfig->flowControler == dmacHw_FLOW_CONTROL_DMA) { | ||
888 | pRing->pHead->ctl.lo = pConfig->transferType | | ||
889 | dmacHw_SRC_ADDRESS_UPDATE_MODE_INC | | ||
890 | dmacHw_DST_ADDRESS_UPDATE_MODE_INC | | ||
891 | dmacHw_SRC_TRANSACTION_WIDTH_32 | | ||
892 | pConfig->dstMaxTransactionWidth | | ||
893 | dmacHw_SRC_BURST_WIDTH_0 | | ||
894 | dmacHw_DST_BURST_WIDTH_0 | | ||
895 | pConfig->srcMasterInterface | | ||
896 | pConfig->dstMasterInterface | dmacHw_REG_CTL_INT_EN; | ||
897 | } else { | ||
898 | uint32_t transferType = 0; | ||
899 | switch (pConfig->transferType) { | ||
900 | case dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM: | ||
901 | transferType = dmacHw_REG_CTL_TTFC_PM_PERI; | ||
902 | break; | ||
903 | case dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL: | ||
904 | transferType = dmacHw_REG_CTL_TTFC_MP_PERI; | ||
905 | break; | ||
906 | default: | ||
907 | dmacHw_ASSERT(0); | ||
908 | } | ||
909 | pRing->pHead->ctl.lo = transferType | | ||
910 | dmacHw_SRC_ADDRESS_UPDATE_MODE_INC | | ||
911 | dmacHw_DST_ADDRESS_UPDATE_MODE_INC | | ||
912 | dmacHw_SRC_TRANSACTION_WIDTH_32 | | ||
913 | pConfig->dstMaxTransactionWidth | | ||
914 | dmacHw_SRC_BURST_WIDTH_0 | | ||
915 | dmacHw_DST_BURST_WIDTH_0 | | ||
916 | pConfig->srcMasterInterface | | ||
917 | pConfig->dstMasterInterface | | ||
918 | pConfig->flowControler | dmacHw_REG_CTL_INT_EN; | ||
919 | } | ||
920 | |||
921 | /* Set block transaction size to one 32 bit transaction */ | ||
922 | pRing->pHead->ctl.hi = dmacHw_REG_CTL_BLOCK_TS_MASK & 1; | ||
923 | |||
924 | /* Remember the descriptor to initialize the registers */ | ||
925 | if (pRing->pProg == dmacHw_DESC_INIT) { | ||
926 | pRing->pProg = pRing->pHead; | ||
927 | } | ||
928 | pRing->pEnd = pRing->pHead; | ||
929 | |||
930 | /* Advance the descriptor */ | ||
931 | dmacHw_NEXT_DESC(pRing, pHead); | ||
932 | |||
933 | /* Update Tail pointer if destination is a peripheral */ | ||
934 | if (!dmacHw_DST_IS_MEMORY(pConfig->transferType)) { | ||
935 | pRing->pTail = pRing->pHead; | ||
936 | } | ||
937 | return 0; | ||
938 | } | ||
939 | |||
940 | /****************************************************************************/ | ||
941 | /** | ||
942 | * @brief Sets channel specific user data | ||
943 | * | ||
944 | * This function associates user data to a specific DMA channel | ||
945 | * | ||
946 | */ | ||
947 | /****************************************************************************/ | ||
948 | void dmacHw_setChannelUserData(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
949 | void *userData /* [ IN ] User data */ | ||
950 | ) { | ||
951 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
952 | |||
953 | pCblk->userData = userData; | ||
954 | } | ||
955 | |||
956 | /****************************************************************************/ | ||
957 | /** | ||
958 | * @brief Gets channel specific user data | ||
959 | * | ||
960 | * This function returns user data specific to a DMA channel | ||
961 | * | ||
962 | * @return user data | ||
963 | */ | ||
964 | /****************************************************************************/ | ||
965 | void *dmacHw_getChannelUserData(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
966 | ) { | ||
967 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
968 | |||
969 | return pCblk->userData; | ||
970 | } | ||
971 | |||
972 | /****************************************************************************/ | ||
973 | /** | ||
974 | * @brief Resets descriptor control information | ||
975 | * | ||
976 | * @return void | ||
977 | */ | ||
978 | /****************************************************************************/ | ||
979 | void dmacHw_resetDescriptorControl(void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
980 | ) { | ||
981 | int i; | ||
982 | dmacHw_DESC_RING_t *pRing; | ||
983 | dmacHw_DESC_t *pDesc; | ||
984 | |||
985 | pRing = dmacHw_GET_DESC_RING(pDescriptor); | ||
986 | pDesc = pRing->pHead; | ||
987 | |||
988 | for (i = 0; i < pRing->num; i++) { | ||
989 | /* Mark descriptor is ready to use */ | ||
990 | pDesc->ctl.hi = dmacHw_DESC_FREE; | ||
991 | /* Look into next link list item */ | ||
992 | pDesc++; | ||
993 | } | ||
994 | pRing->pFree = pRing->pTail = pRing->pEnd = pRing->pHead; | ||
995 | pRing->pProg = dmacHw_DESC_INIT; | ||
996 | } | ||
997 | |||
998 | /****************************************************************************/ | ||
999 | /** | ||
1000 | * @brief Displays channel specific registers and other control parameters | ||
1001 | * | ||
1002 | * @return void | ||
1003 | * | ||
1004 | * | ||
1005 | * @note | ||
1006 | * None | ||
1007 | */ | ||
1008 | /****************************************************************************/ | ||
1009 | void dmacHw_printDebugInfo(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
1010 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
1011 | int (*fpPrint) (const char *, ...) /* [ IN ] Print callback function */ | ||
1012 | ) { | ||
1013 | dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); | ||
1014 | |||
1015 | DisplayRegisterContents(pCblk->module, pCblk->channel, fpPrint); | ||
1016 | DisplayDescRing(pDescriptor, fpPrint); | ||
1017 | } | ||
diff --git a/arch/arm/mach-bcmring/csp/tmr/Makefile b/arch/arm/mach-bcmring/csp/tmr/Makefile deleted file mode 100644 index 244a61ab7697..000000000000 --- a/arch/arm/mach-bcmring/csp/tmr/Makefile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | obj-y += tmrHw.o | ||
diff --git a/arch/arm/mach-bcmring/csp/tmr/tmrHw.c b/arch/arm/mach-bcmring/csp/tmr/tmrHw.c deleted file mode 100644 index dc4137ff75ca..000000000000 --- a/arch/arm/mach-bcmring/csp/tmr/tmrHw.c +++ /dev/null | |||
@@ -1,576 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file tmrHw.c | ||
18 | * | ||
19 | * @brief Low level Timer driver routines | ||
20 | * | ||
21 | * @note | ||
22 | * | ||
23 | * These routines provide basic timer functionality only. | ||
24 | */ | ||
25 | /****************************************************************************/ | ||
26 | |||
27 | /* ---- Include Files ---------------------------------------------------- */ | ||
28 | |||
29 | #include <linux/errno.h> | ||
30 | #include <linux/types.h> | ||
31 | |||
32 | #include <mach/csp/tmrHw.h> | ||
33 | #include <mach/csp/tmrHw_reg.h> | ||
34 | |||
35 | #define tmrHw_ASSERT(a) if (!(a)) *(char *)0 = 0 | ||
36 | #define tmrHw_MILLISEC_PER_SEC (1000) | ||
37 | |||
38 | #define tmrHw_LOW_1_RESOLUTION_COUNT (tmrHw_LOW_RESOLUTION_CLOCK / tmrHw_MILLISEC_PER_SEC) | ||
39 | #define tmrHw_LOW_1_MAX_MILLISEC (0xFFFFFFFF / tmrHw_LOW_1_RESOLUTION_COUNT) | ||
40 | #define tmrHw_LOW_16_RESOLUTION_COUNT (tmrHw_LOW_1_RESOLUTION_COUNT / 16) | ||
41 | #define tmrHw_LOW_16_MAX_MILLISEC (0xFFFFFFFF / tmrHw_LOW_16_RESOLUTION_COUNT) | ||
42 | #define tmrHw_LOW_256_RESOLUTION_COUNT (tmrHw_LOW_1_RESOLUTION_COUNT / 256) | ||
43 | #define tmrHw_LOW_256_MAX_MILLISEC (0xFFFFFFFF / tmrHw_LOW_256_RESOLUTION_COUNT) | ||
44 | |||
45 | #define tmrHw_HIGH_1_RESOLUTION_COUNT (tmrHw_HIGH_RESOLUTION_CLOCK / tmrHw_MILLISEC_PER_SEC) | ||
46 | #define tmrHw_HIGH_1_MAX_MILLISEC (0xFFFFFFFF / tmrHw_HIGH_1_RESOLUTION_COUNT) | ||
47 | #define tmrHw_HIGH_16_RESOLUTION_COUNT (tmrHw_HIGH_1_RESOLUTION_COUNT / 16) | ||
48 | #define tmrHw_HIGH_16_MAX_MILLISEC (0xFFFFFFFF / tmrHw_HIGH_16_RESOLUTION_COUNT) | ||
49 | #define tmrHw_HIGH_256_RESOLUTION_COUNT (tmrHw_HIGH_1_RESOLUTION_COUNT / 256) | ||
50 | #define tmrHw_HIGH_256_MAX_MILLISEC (0xFFFFFFFF / tmrHw_HIGH_256_RESOLUTION_COUNT) | ||
51 | |||
52 | static void ResetTimer(tmrHw_ID_t timerId) | ||
53 | __attribute__ ((section(".aramtext"))); | ||
54 | static int tmrHw_divide(int num, int denom) | ||
55 | __attribute__ ((section(".aramtext"))); | ||
56 | |||
57 | /****************************************************************************/ | ||
58 | /** | ||
59 | * @brief Get timer capability | ||
60 | * | ||
61 | * This function returns various capabilities/attributes of a timer | ||
62 | * | ||
63 | * @return Capability | ||
64 | * | ||
65 | */ | ||
66 | /****************************************************************************/ | ||
67 | uint32_t tmrHw_getTimerCapability(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
68 | tmrHw_CAPABILITY_e capability /* [ IN ] Timer capability */ | ||
69 | ) { | ||
70 | switch (capability) { | ||
71 | case tmrHw_CAPABILITY_CLOCK: | ||
72 | return (timerId <= | ||
73 | 1) ? tmrHw_LOW_RESOLUTION_CLOCK : | ||
74 | tmrHw_HIGH_RESOLUTION_CLOCK; | ||
75 | case tmrHw_CAPABILITY_RESOLUTION: | ||
76 | return 32; | ||
77 | default: | ||
78 | return 0; | ||
79 | } | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | /****************************************************************************/ | ||
84 | /** | ||
85 | * @brief Resets a timer | ||
86 | * | ||
87 | * This function initializes timer | ||
88 | * | ||
89 | * @return void | ||
90 | * | ||
91 | */ | ||
92 | /****************************************************************************/ | ||
93 | static void ResetTimer(tmrHw_ID_t timerId /* [ IN ] Timer Id */ | ||
94 | ) { | ||
95 | /* Reset timer */ | ||
96 | pTmrHw[timerId].LoadValue = 0; | ||
97 | pTmrHw[timerId].CurrentValue = 0xFFFFFFFF; | ||
98 | pTmrHw[timerId].Control = 0; | ||
99 | pTmrHw[timerId].BackgroundLoad = 0; | ||
100 | /* Always configure as a 32 bit timer */ | ||
101 | pTmrHw[timerId].Control |= tmrHw_CONTROL_32BIT; | ||
102 | /* Clear interrupt only if raw status interrupt is set */ | ||
103 | if (pTmrHw[timerId].RawInterruptStatus) { | ||
104 | pTmrHw[timerId].InterruptClear = 0xFFFFFFFF; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /****************************************************************************/ | ||
109 | /** | ||
110 | * @brief Sets counter value for an interval in ms | ||
111 | * | ||
112 | * @return On success: Effective counter value set | ||
113 | * On failure: 0 | ||
114 | * | ||
115 | */ | ||
116 | /****************************************************************************/ | ||
117 | static tmrHw_INTERVAL_t SetTimerPeriod(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
118 | tmrHw_INTERVAL_t msec /* [ IN ] Interval in milli-second */ | ||
119 | ) { | ||
120 | uint32_t scale = 0; | ||
121 | uint32_t count = 0; | ||
122 | |||
123 | if (timerId == 0 || timerId == 1) { | ||
124 | if (msec <= tmrHw_LOW_1_MAX_MILLISEC) { | ||
125 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1; | ||
126 | scale = tmrHw_LOW_1_RESOLUTION_COUNT; | ||
127 | } else if (msec <= tmrHw_LOW_16_MAX_MILLISEC) { | ||
128 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16; | ||
129 | scale = tmrHw_LOW_16_RESOLUTION_COUNT; | ||
130 | } else if (msec <= tmrHw_LOW_256_MAX_MILLISEC) { | ||
131 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256; | ||
132 | scale = tmrHw_LOW_256_RESOLUTION_COUNT; | ||
133 | } else { | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | count = msec * scale; | ||
138 | /* Set counter value */ | ||
139 | pTmrHw[timerId].LoadValue = count; | ||
140 | pTmrHw[timerId].BackgroundLoad = count; | ||
141 | |||
142 | } else if (timerId == 2 || timerId == 3) { | ||
143 | if (msec <= tmrHw_HIGH_1_MAX_MILLISEC) { | ||
144 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1; | ||
145 | scale = tmrHw_HIGH_1_RESOLUTION_COUNT; | ||
146 | } else if (msec <= tmrHw_HIGH_16_MAX_MILLISEC) { | ||
147 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16; | ||
148 | scale = tmrHw_HIGH_16_RESOLUTION_COUNT; | ||
149 | } else if (msec <= tmrHw_HIGH_256_MAX_MILLISEC) { | ||
150 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256; | ||
151 | scale = tmrHw_HIGH_256_RESOLUTION_COUNT; | ||
152 | } else { | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | count = msec * scale; | ||
157 | /* Set counter value */ | ||
158 | pTmrHw[timerId].LoadValue = count; | ||
159 | pTmrHw[timerId].BackgroundLoad = count; | ||
160 | } | ||
161 | return count / scale; | ||
162 | } | ||
163 | |||
164 | /****************************************************************************/ | ||
165 | /** | ||
166 | * @brief Configures a periodic timer in terms of timer interrupt rate | ||
167 | * | ||
168 | * This function initializes a periodic timer to generate specific number of | ||
169 | * timer interrupt per second | ||
170 | * | ||
171 | * @return On success: Effective timer frequency | ||
172 | * On failure: 0 | ||
173 | * | ||
174 | */ | ||
175 | /****************************************************************************/ | ||
176 | tmrHw_RATE_t tmrHw_setPeriodicTimerRate(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
177 | tmrHw_RATE_t rate /* [ IN ] Number of timer interrupt per second */ | ||
178 | ) { | ||
179 | uint32_t resolution = 0; | ||
180 | uint32_t count = 0; | ||
181 | ResetTimer(timerId); | ||
182 | |||
183 | /* Set timer mode periodic */ | ||
184 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC; | ||
185 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT; | ||
186 | /* Set timer in highest resolution */ | ||
187 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1; | ||
188 | |||
189 | if (rate && (timerId == 0 || timerId == 1)) { | ||
190 | if (rate > tmrHw_LOW_RESOLUTION_CLOCK) { | ||
191 | return 0; | ||
192 | } | ||
193 | resolution = tmrHw_LOW_RESOLUTION_CLOCK; | ||
194 | } else if (rate && (timerId == 2 || timerId == 3)) { | ||
195 | if (rate > tmrHw_HIGH_RESOLUTION_CLOCK) { | ||
196 | return 0; | ||
197 | } else { | ||
198 | resolution = tmrHw_HIGH_RESOLUTION_CLOCK; | ||
199 | } | ||
200 | } else { | ||
201 | return 0; | ||
202 | } | ||
203 | /* Find the counter value */ | ||
204 | count = resolution / rate; | ||
205 | /* Set counter value */ | ||
206 | pTmrHw[timerId].LoadValue = count; | ||
207 | pTmrHw[timerId].BackgroundLoad = count; | ||
208 | |||
209 | return resolution / count; | ||
210 | } | ||
211 | |||
212 | /****************************************************************************/ | ||
213 | /** | ||
214 | * @brief Configures a periodic timer to generate timer interrupt after | ||
215 | * certain time interval | ||
216 | * | ||
217 | * This function initializes a periodic timer to generate timer interrupt | ||
218 | * after every time interval in millisecond | ||
219 | * | ||
220 | * @return On success: Effective interval set in milli-second | ||
221 | * On failure: 0 | ||
222 | * | ||
223 | */ | ||
224 | /****************************************************************************/ | ||
225 | tmrHw_INTERVAL_t tmrHw_setPeriodicTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
226 | tmrHw_INTERVAL_t msec /* [ IN ] Interval in milli-second */ | ||
227 | ) { | ||
228 | ResetTimer(timerId); | ||
229 | |||
230 | /* Set timer mode periodic */ | ||
231 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC; | ||
232 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT; | ||
233 | |||
234 | return SetTimerPeriod(timerId, msec); | ||
235 | } | ||
236 | |||
237 | /****************************************************************************/ | ||
238 | /** | ||
239 | * @brief Configures a periodic timer to generate timer interrupt just once | ||
240 | * after certain time interval | ||
241 | * | ||
242 | * This function initializes a periodic timer to generate a single ticks after | ||
243 | * certain time interval in millisecond | ||
244 | * | ||
245 | * @return On success: Effective interval set in milli-second | ||
246 | * On failure: 0 | ||
247 | * | ||
248 | */ | ||
249 | /****************************************************************************/ | ||
250 | tmrHw_INTERVAL_t tmrHw_setOneshotTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
251 | tmrHw_INTERVAL_t msec /* [ IN ] Interval in milli-second */ | ||
252 | ) { | ||
253 | ResetTimer(timerId); | ||
254 | |||
255 | /* Set timer mode oneshot */ | ||
256 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PERIODIC; | ||
257 | pTmrHw[timerId].Control |= tmrHw_CONTROL_ONESHOT; | ||
258 | |||
259 | return SetTimerPeriod(timerId, msec); | ||
260 | } | ||
261 | |||
262 | /****************************************************************************/ | ||
263 | /** | ||
264 | * @brief Configures a timer to run as a free running timer | ||
265 | * | ||
266 | * This function initializes a timer to run as a free running timer | ||
267 | * | ||
268 | * @return Timer resolution (count / sec) | ||
269 | * | ||
270 | */ | ||
271 | /****************************************************************************/ | ||
272 | tmrHw_RATE_t tmrHw_setFreeRunningTimer(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
273 | uint32_t divider /* [ IN ] Dividing the clock frequency */ | ||
274 | ) { | ||
275 | uint32_t scale = 0; | ||
276 | |||
277 | ResetTimer(timerId); | ||
278 | /* Set timer as free running mode */ | ||
279 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_PERIODIC; | ||
280 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_ONESHOT; | ||
281 | |||
282 | if (divider >= 64) { | ||
283 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_256; | ||
284 | scale = 256; | ||
285 | } else if (divider >= 8) { | ||
286 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_16; | ||
287 | scale = 16; | ||
288 | } else { | ||
289 | pTmrHw[timerId].Control |= tmrHw_CONTROL_PRESCALE_1; | ||
290 | scale = 1; | ||
291 | } | ||
292 | |||
293 | if (timerId == 0 || timerId == 1) { | ||
294 | return tmrHw_divide(tmrHw_LOW_RESOLUTION_CLOCK, scale); | ||
295 | } else if (timerId == 2 || timerId == 3) { | ||
296 | return tmrHw_divide(tmrHw_HIGH_RESOLUTION_CLOCK, scale); | ||
297 | } | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | /****************************************************************************/ | ||
303 | /** | ||
304 | * @brief Starts a timer | ||
305 | * | ||
306 | * This function starts a preconfigured timer | ||
307 | * | ||
308 | * @return -1 - On Failure | ||
309 | * 0 - On Success | ||
310 | * | ||
311 | */ | ||
312 | /****************************************************************************/ | ||
313 | int tmrHw_startTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
314 | ) { | ||
315 | pTmrHw[timerId].Control |= tmrHw_CONTROL_TIMER_ENABLE; | ||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | /****************************************************************************/ | ||
320 | /** | ||
321 | * @brief Stops a timer | ||
322 | * | ||
323 | * This function stops a running timer | ||
324 | * | ||
325 | * @return -1 - On Failure | ||
326 | * 0 - On Success | ||
327 | * | ||
328 | */ | ||
329 | /****************************************************************************/ | ||
330 | int tmrHw_stopTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
331 | ) { | ||
332 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_TIMER_ENABLE; | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | /****************************************************************************/ | ||
337 | /** | ||
338 | * @brief Gets current timer count | ||
339 | * | ||
340 | * This function returns the current timer value | ||
341 | * | ||
342 | * @return Current downcounting timer value | ||
343 | * | ||
344 | */ | ||
345 | /****************************************************************************/ | ||
346 | uint32_t tmrHw_GetCurrentCount(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
347 | ) { | ||
348 | /* return 32 bit timer value */ | ||
349 | switch (pTmrHw[timerId].Control & tmrHw_CONTROL_MODE_MASK) { | ||
350 | case tmrHw_CONTROL_FREE_RUNNING: | ||
351 | if (pTmrHw[timerId].CurrentValue) { | ||
352 | return tmrHw_MAX_COUNT - pTmrHw[timerId].CurrentValue; | ||
353 | } | ||
354 | break; | ||
355 | case tmrHw_CONTROL_PERIODIC: | ||
356 | case tmrHw_CONTROL_ONESHOT: | ||
357 | return pTmrHw[timerId].BackgroundLoad - | ||
358 | pTmrHw[timerId].CurrentValue; | ||
359 | } | ||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | /****************************************************************************/ | ||
364 | /** | ||
365 | * @brief Gets timer count rate | ||
366 | * | ||
367 | * This function returns the number of counts per second | ||
368 | * | ||
369 | * @return Count rate | ||
370 | * | ||
371 | */ | ||
372 | /****************************************************************************/ | ||
373 | tmrHw_RATE_t tmrHw_getCountRate(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
374 | ) { | ||
375 | uint32_t divider = 0; | ||
376 | |||
377 | switch (pTmrHw[timerId].Control & tmrHw_CONTROL_PRESCALE_MASK) { | ||
378 | case tmrHw_CONTROL_PRESCALE_1: | ||
379 | divider = 1; | ||
380 | break; | ||
381 | case tmrHw_CONTROL_PRESCALE_16: | ||
382 | divider = 16; | ||
383 | break; | ||
384 | case tmrHw_CONTROL_PRESCALE_256: | ||
385 | divider = 256; | ||
386 | break; | ||
387 | default: | ||
388 | tmrHw_ASSERT(0); | ||
389 | } | ||
390 | |||
391 | if (timerId == 0 || timerId == 1) { | ||
392 | return tmrHw_divide(tmrHw_LOW_RESOLUTION_CLOCK, divider); | ||
393 | } else { | ||
394 | return tmrHw_divide(tmrHw_HIGH_RESOLUTION_CLOCK, divider); | ||
395 | } | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | /****************************************************************************/ | ||
400 | /** | ||
401 | * @brief Enables timer interrupt | ||
402 | * | ||
403 | * This function enables the timer interrupt | ||
404 | * | ||
405 | * @return N/A | ||
406 | * | ||
407 | */ | ||
408 | /****************************************************************************/ | ||
409 | void tmrHw_enableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
410 | ) { | ||
411 | pTmrHw[timerId].Control |= tmrHw_CONTROL_INTERRUPT_ENABLE; | ||
412 | } | ||
413 | |||
414 | /****************************************************************************/ | ||
415 | /** | ||
416 | * @brief Disables timer interrupt | ||
417 | * | ||
418 | * This function disable the timer interrupt | ||
419 | * | ||
420 | * @return N/A | ||
421 | * | ||
422 | */ | ||
423 | /****************************************************************************/ | ||
424 | void tmrHw_disableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
425 | ) { | ||
426 | pTmrHw[timerId].Control &= ~tmrHw_CONTROL_INTERRUPT_ENABLE; | ||
427 | } | ||
428 | |||
429 | /****************************************************************************/ | ||
430 | /** | ||
431 | * @brief Clears the interrupt | ||
432 | * | ||
433 | * This function clears the timer interrupt | ||
434 | * | ||
435 | * @return N/A | ||
436 | * | ||
437 | * @note | ||
438 | * Must be called under the context of ISR | ||
439 | */ | ||
440 | /****************************************************************************/ | ||
441 | void tmrHw_clearInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
442 | ) { | ||
443 | pTmrHw[timerId].InterruptClear = 0x1; | ||
444 | } | ||
445 | |||
446 | /****************************************************************************/ | ||
447 | /** | ||
448 | * @brief Gets the interrupt status | ||
449 | * | ||
450 | * This function returns timer interrupt status | ||
451 | * | ||
452 | * @return Interrupt status | ||
453 | */ | ||
454 | /****************************************************************************/ | ||
455 | tmrHw_INTERRUPT_STATUS_e tmrHw_getInterruptStatus(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
456 | ) { | ||
457 | if (pTmrHw[timerId].InterruptStatus) { | ||
458 | return tmrHw_INTERRUPT_STATUS_SET; | ||
459 | } else { | ||
460 | return tmrHw_INTERRUPT_STATUS_UNSET; | ||
461 | } | ||
462 | } | ||
463 | |||
464 | /****************************************************************************/ | ||
465 | /** | ||
466 | * @brief Indentifies a timer causing interrupt | ||
467 | * | ||
468 | * This functions returns a timer causing interrupt | ||
469 | * | ||
470 | * @return 0xFFFFFFFF : No timer causing an interrupt | ||
471 | * ! 0xFFFFFFFF : timer causing an interrupt | ||
472 | * @note | ||
473 | * tmrHw_clearIntrrupt() must be called with a valid timer id after calling this function | ||
474 | */ | ||
475 | /****************************************************************************/ | ||
476 | tmrHw_ID_t tmrHw_getInterruptSource(void /* void */ | ||
477 | ) { | ||
478 | int i; | ||
479 | |||
480 | for (i = 0; i < tmrHw_TIMER_NUM_COUNT; i++) { | ||
481 | if (pTmrHw[i].InterruptStatus) { | ||
482 | return i; | ||
483 | } | ||
484 | } | ||
485 | |||
486 | return 0xFFFFFFFF; | ||
487 | } | ||
488 | |||
489 | /****************************************************************************/ | ||
490 | /** | ||
491 | * @brief Displays specific timer registers | ||
492 | * | ||
493 | * | ||
494 | * @return void | ||
495 | * | ||
496 | */ | ||
497 | /****************************************************************************/ | ||
498 | void tmrHw_printDebugInfo(tmrHw_ID_t timerId, /* [ IN ] Timer id */ | ||
499 | int (*fpPrint) (const char *, ...) /* [ IN ] Print callback function */ | ||
500 | ) { | ||
501 | (*fpPrint) ("Displaying register contents \n\n"); | ||
502 | (*fpPrint) ("Timer %d: Load value 0x%X\n", timerId, | ||
503 | pTmrHw[timerId].LoadValue); | ||
504 | (*fpPrint) ("Timer %d: Background load value 0x%X\n", timerId, | ||
505 | pTmrHw[timerId].BackgroundLoad); | ||
506 | (*fpPrint) ("Timer %d: Control 0x%X\n", timerId, | ||
507 | pTmrHw[timerId].Control); | ||
508 | (*fpPrint) ("Timer %d: Interrupt clear 0x%X\n", timerId, | ||
509 | pTmrHw[timerId].InterruptClear); | ||
510 | (*fpPrint) ("Timer %d: Interrupt raw interrupt 0x%X\n", timerId, | ||
511 | pTmrHw[timerId].RawInterruptStatus); | ||
512 | (*fpPrint) ("Timer %d: Interrupt status 0x%X\n", timerId, | ||
513 | pTmrHw[timerId].InterruptStatus); | ||
514 | } | ||
515 | |||
516 | /****************************************************************************/ | ||
517 | /** | ||
518 | * @brief Use a timer to perform a busy wait delay for a number of usecs. | ||
519 | * | ||
520 | * @return N/A | ||
521 | */ | ||
522 | /****************************************************************************/ | ||
523 | void tmrHw_udelay(tmrHw_ID_t timerId, /* [ IN ] Timer id */ | ||
524 | unsigned long usecs /* [ IN ] usec to delay */ | ||
525 | ) { | ||
526 | tmrHw_RATE_t usec_tick_rate; | ||
527 | tmrHw_COUNT_t start_time; | ||
528 | tmrHw_COUNT_t delta_time; | ||
529 | |||
530 | start_time = tmrHw_GetCurrentCount(timerId); | ||
531 | usec_tick_rate = tmrHw_divide(tmrHw_getCountRate(timerId), 1000000); | ||
532 | delta_time = usecs * usec_tick_rate; | ||
533 | |||
534 | /* Busy wait */ | ||
535 | while (delta_time > (tmrHw_GetCurrentCount(timerId) - start_time)) | ||
536 | ; | ||
537 | } | ||
538 | |||
539 | /****************************************************************************/ | ||
540 | /** | ||
541 | * @brief Local Divide function | ||
542 | * | ||
543 | * This function does the divide | ||
544 | * | ||
545 | * @return divide value | ||
546 | * | ||
547 | */ | ||
548 | /****************************************************************************/ | ||
549 | static int tmrHw_divide(int num, int denom) | ||
550 | { | ||
551 | int r; | ||
552 | int t = 1; | ||
553 | |||
554 | /* Shift denom and t up to the largest value to optimize algorithm */ | ||
555 | /* t contains the units of each divide */ | ||
556 | while ((denom & 0x40000000) == 0) { /* fails if denom=0 */ | ||
557 | denom = denom << 1; | ||
558 | t = t << 1; | ||
559 | } | ||
560 | |||
561 | /* Initialize the result */ | ||
562 | r = 0; | ||
563 | |||
564 | do { | ||
565 | /* Determine if there exists a positive remainder */ | ||
566 | if ((num - denom) >= 0) { | ||
567 | /* Accumlate t to the result and calculate a new remainder */ | ||
568 | num = num - denom; | ||
569 | r = r + t; | ||
570 | } | ||
571 | /* Continue to shift denom and shift t down to 0 */ | ||
572 | denom = denom >> 1; | ||
573 | t = t >> 1; | ||
574 | } while (t != 0); | ||
575 | return r; | ||
576 | } | ||
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c deleted file mode 100644 index e5fd241fccdc..000000000000 --- a/arch/arm/mach-bcmring/dma.c +++ /dev/null | |||
@@ -1,1518 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dma.c | ||
18 | * | ||
19 | * @brief Implements the DMA interface. | ||
20 | */ | ||
21 | /****************************************************************************/ | ||
22 | |||
23 | /* ---- Include Files ---------------------------------------------------- */ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/dma-mapping.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/sched.h> | ||
30 | #include <linux/irqreturn.h> | ||
31 | #include <linux/proc_fs.h> | ||
32 | #include <linux/slab.h> | ||
33 | |||
34 | #include <mach/timer.h> | ||
35 | |||
36 | #include <linux/pfn.h> | ||
37 | #include <linux/atomic.h> | ||
38 | #include <mach/dma.h> | ||
39 | |||
40 | /* ---- Public Variables ------------------------------------------------- */ | ||
41 | |||
42 | /* ---- Private Constants and Types -------------------------------------- */ | ||
43 | |||
44 | #define MAKE_HANDLE(controllerIdx, channelIdx) (((controllerIdx) << 4) | (channelIdx)) | ||
45 | |||
46 | #define CONTROLLER_FROM_HANDLE(handle) (((handle) >> 4) & 0x0f) | ||
47 | #define CHANNEL_FROM_HANDLE(handle) ((handle) & 0x0f) | ||
48 | |||
49 | |||
50 | /* ---- Private Variables ------------------------------------------------ */ | ||
51 | |||
52 | static DMA_Global_t gDMA; | ||
53 | static struct proc_dir_entry *gDmaDir; | ||
54 | |||
55 | #include "dma_device.c" | ||
56 | |||
57 | /* ---- Private Function Prototypes -------------------------------------- */ | ||
58 | |||
59 | /* ---- Functions ------------------------------------------------------- */ | ||
60 | |||
61 | /****************************************************************************/ | ||
62 | /** | ||
63 | * Displays information for /proc/dma/channels | ||
64 | */ | ||
65 | /****************************************************************************/ | ||
66 | |||
67 | static int dma_proc_read_channels(char *buf, char **start, off_t offset, | ||
68 | int count, int *eof, void *data) | ||
69 | { | ||
70 | int controllerIdx; | ||
71 | int channelIdx; | ||
72 | int limit = count - 200; | ||
73 | int len = 0; | ||
74 | DMA_Channel_t *channel; | ||
75 | |||
76 | if (down_interruptible(&gDMA.lock) < 0) { | ||
77 | return -ERESTARTSYS; | ||
78 | } | ||
79 | |||
80 | for (controllerIdx = 0; controllerIdx < DMA_NUM_CONTROLLERS; | ||
81 | controllerIdx++) { | ||
82 | for (channelIdx = 0; channelIdx < DMA_NUM_CHANNELS; | ||
83 | channelIdx++) { | ||
84 | if (len >= limit) { | ||
85 | break; | ||
86 | } | ||
87 | |||
88 | channel = | ||
89 | &gDMA.controller[controllerIdx].channel[channelIdx]; | ||
90 | |||
91 | len += | ||
92 | sprintf(buf + len, "%d:%d ", controllerIdx, | ||
93 | channelIdx); | ||
94 | |||
95 | if ((channel->flags & DMA_CHANNEL_FLAG_IS_DEDICATED) != | ||
96 | 0) { | ||
97 | len += | ||
98 | sprintf(buf + len, "Dedicated for %s ", | ||
99 | DMA_gDeviceAttribute[channel-> | ||
100 | devType].name); | ||
101 | } else { | ||
102 | len += sprintf(buf + len, "Shared "); | ||
103 | } | ||
104 | |||
105 | if ((channel->flags & DMA_CHANNEL_FLAG_NO_ISR) != 0) { | ||
106 | len += sprintf(buf + len, "No ISR "); | ||
107 | } | ||
108 | |||
109 | if ((channel->flags & DMA_CHANNEL_FLAG_LARGE_FIFO) != 0) { | ||
110 | len += sprintf(buf + len, "Fifo: 128 "); | ||
111 | } else { | ||
112 | len += sprintf(buf + len, "Fifo: 64 "); | ||
113 | } | ||
114 | |||
115 | if ((channel->flags & DMA_CHANNEL_FLAG_IN_USE) != 0) { | ||
116 | len += | ||
117 | sprintf(buf + len, "InUse by %s", | ||
118 | DMA_gDeviceAttribute[channel-> | ||
119 | devType].name); | ||
120 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
121 | len += | ||
122 | sprintf(buf + len, " (%s:%d)", | ||
123 | channel->fileName, | ||
124 | channel->lineNum); | ||
125 | #endif | ||
126 | } else { | ||
127 | len += sprintf(buf + len, "Avail "); | ||
128 | } | ||
129 | |||
130 | if (channel->lastDevType != DMA_DEVICE_NONE) { | ||
131 | len += | ||
132 | sprintf(buf + len, "Last use: %s ", | ||
133 | DMA_gDeviceAttribute[channel-> | ||
134 | lastDevType]. | ||
135 | name); | ||
136 | } | ||
137 | |||
138 | len += sprintf(buf + len, "\n"); | ||
139 | } | ||
140 | } | ||
141 | up(&gDMA.lock); | ||
142 | *eof = 1; | ||
143 | |||
144 | return len; | ||
145 | } | ||
146 | |||
147 | /****************************************************************************/ | ||
148 | /** | ||
149 | * Displays information for /proc/dma/devices | ||
150 | */ | ||
151 | /****************************************************************************/ | ||
152 | |||
153 | static int dma_proc_read_devices(char *buf, char **start, off_t offset, | ||
154 | int count, int *eof, void *data) | ||
155 | { | ||
156 | int limit = count - 200; | ||
157 | int len = 0; | ||
158 | int devIdx; | ||
159 | |||
160 | if (down_interruptible(&gDMA.lock) < 0) { | ||
161 | return -ERESTARTSYS; | ||
162 | } | ||
163 | |||
164 | for (devIdx = 0; devIdx < DMA_NUM_DEVICE_ENTRIES; devIdx++) { | ||
165 | DMA_DeviceAttribute_t *devAttr = &DMA_gDeviceAttribute[devIdx]; | ||
166 | |||
167 | if (devAttr->name == NULL) { | ||
168 | continue; | ||
169 | } | ||
170 | |||
171 | if (len >= limit) { | ||
172 | break; | ||
173 | } | ||
174 | |||
175 | len += sprintf(buf + len, "%-12s ", devAttr->name); | ||
176 | |||
177 | if ((devAttr->flags & DMA_DEVICE_FLAG_IS_DEDICATED) != 0) { | ||
178 | len += | ||
179 | sprintf(buf + len, "Dedicated %d:%d ", | ||
180 | devAttr->dedicatedController, | ||
181 | devAttr->dedicatedChannel); | ||
182 | } else { | ||
183 | len += sprintf(buf + len, "Shared DMA:"); | ||
184 | if ((devAttr->flags & DMA_DEVICE_FLAG_ON_DMA0) != 0) { | ||
185 | len += sprintf(buf + len, "0"); | ||
186 | } | ||
187 | if ((devAttr->flags & DMA_DEVICE_FLAG_ON_DMA1) != 0) { | ||
188 | len += sprintf(buf + len, "1"); | ||
189 | } | ||
190 | len += sprintf(buf + len, " "); | ||
191 | } | ||
192 | if ((devAttr->flags & DMA_DEVICE_FLAG_NO_ISR) != 0) { | ||
193 | len += sprintf(buf + len, "NoISR "); | ||
194 | } | ||
195 | if ((devAttr->flags & DMA_DEVICE_FLAG_ALLOW_LARGE_FIFO) != 0) { | ||
196 | len += sprintf(buf + len, "Allow-128 "); | ||
197 | } | ||
198 | |||
199 | len += | ||
200 | sprintf(buf + len, | ||
201 | "Xfer #: %Lu Ticks: %Lu Bytes: %Lu DescLen: %u\n", | ||
202 | devAttr->numTransfers, devAttr->transferTicks, | ||
203 | devAttr->transferBytes, | ||
204 | devAttr->ring.bytesAllocated); | ||
205 | |||
206 | } | ||
207 | |||
208 | up(&gDMA.lock); | ||
209 | *eof = 1; | ||
210 | |||
211 | return len; | ||
212 | } | ||
213 | |||
214 | /****************************************************************************/ | ||
215 | /** | ||
216 | * Determines if a DMA_Device_t is "valid". | ||
217 | * | ||
218 | * @return | ||
219 | * TRUE - dma device is valid | ||
220 | * FALSE - dma device isn't valid | ||
221 | */ | ||
222 | /****************************************************************************/ | ||
223 | |||
224 | static inline int IsDeviceValid(DMA_Device_t device) | ||
225 | { | ||
226 | return (device >= 0) && (device < DMA_NUM_DEVICE_ENTRIES); | ||
227 | } | ||
228 | |||
229 | /****************************************************************************/ | ||
230 | /** | ||
231 | * Translates a DMA handle into a pointer to a channel. | ||
232 | * | ||
233 | * @return | ||
234 | * non-NULL - pointer to DMA_Channel_t | ||
235 | * NULL - DMA Handle was invalid | ||
236 | */ | ||
237 | /****************************************************************************/ | ||
238 | |||
239 | static inline DMA_Channel_t *HandleToChannel(DMA_Handle_t handle) | ||
240 | { | ||
241 | int controllerIdx; | ||
242 | int channelIdx; | ||
243 | |||
244 | controllerIdx = CONTROLLER_FROM_HANDLE(handle); | ||
245 | channelIdx = CHANNEL_FROM_HANDLE(handle); | ||
246 | |||
247 | if ((controllerIdx > DMA_NUM_CONTROLLERS) | ||
248 | || (channelIdx > DMA_NUM_CHANNELS)) { | ||
249 | return NULL; | ||
250 | } | ||
251 | return &gDMA.controller[controllerIdx].channel[channelIdx]; | ||
252 | } | ||
253 | |||
254 | /****************************************************************************/ | ||
255 | /** | ||
256 | * Interrupt handler which is called to process DMA interrupts. | ||
257 | */ | ||
258 | /****************************************************************************/ | ||
259 | |||
260 | static irqreturn_t dma_interrupt_handler(int irq, void *dev_id) | ||
261 | { | ||
262 | DMA_Channel_t *channel; | ||
263 | DMA_DeviceAttribute_t *devAttr; | ||
264 | int irqStatus; | ||
265 | |||
266 | channel = (DMA_Channel_t *) dev_id; | ||
267 | |||
268 | /* Figure out why we were called, and knock down the interrupt */ | ||
269 | |||
270 | irqStatus = dmacHw_getInterruptStatus(channel->dmacHwHandle); | ||
271 | dmacHw_clearInterrupt(channel->dmacHwHandle); | ||
272 | |||
273 | if ((channel->devType < 0) | ||
274 | || (channel->devType > DMA_NUM_DEVICE_ENTRIES)) { | ||
275 | printk(KERN_ERR "dma_interrupt_handler: Invalid devType: %d\n", | ||
276 | channel->devType); | ||
277 | return IRQ_NONE; | ||
278 | } | ||
279 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
280 | |||
281 | /* Update stats */ | ||
282 | |||
283 | if ((irqStatus & dmacHw_INTERRUPT_STATUS_TRANS) != 0) { | ||
284 | devAttr->transferTicks += | ||
285 | (timer_get_tick_count() - devAttr->transferStartTime); | ||
286 | } | ||
287 | |||
288 | if ((irqStatus & dmacHw_INTERRUPT_STATUS_ERROR) != 0) { | ||
289 | printk(KERN_ERR | ||
290 | "dma_interrupt_handler: devType :%d DMA error (%s)\n", | ||
291 | channel->devType, devAttr->name); | ||
292 | } else { | ||
293 | devAttr->numTransfers++; | ||
294 | devAttr->transferBytes += devAttr->numBytes; | ||
295 | } | ||
296 | |||
297 | /* Call any installed handler */ | ||
298 | |||
299 | if (devAttr->devHandler != NULL) { | ||
300 | devAttr->devHandler(channel->devType, irqStatus, | ||
301 | devAttr->userData); | ||
302 | } | ||
303 | |||
304 | return IRQ_HANDLED; | ||
305 | } | ||
306 | |||
307 | /****************************************************************************/ | ||
308 | /** | ||
309 | * Allocates memory to hold a descriptor ring. The descriptor ring then | ||
310 | * needs to be populated by making one or more calls to | ||
311 | * dna_add_descriptors. | ||
312 | * | ||
313 | * The returned descriptor ring will be automatically initialized. | ||
314 | * | ||
315 | * @return | ||
316 | * 0 Descriptor ring was allocated successfully | ||
317 | * -EINVAL Invalid parameters passed in | ||
318 | * -ENOMEM Unable to allocate memory for the desired number of descriptors. | ||
319 | */ | ||
320 | /****************************************************************************/ | ||
321 | |||
322 | int dma_alloc_descriptor_ring(DMA_DescriptorRing_t *ring, /* Descriptor ring to populate */ | ||
323 | int numDescriptors /* Number of descriptors that need to be allocated. */ | ||
324 | ) { | ||
325 | size_t bytesToAlloc = dmacHw_descriptorLen(numDescriptors); | ||
326 | |||
327 | if ((ring == NULL) || (numDescriptors <= 0)) { | ||
328 | return -EINVAL; | ||
329 | } | ||
330 | |||
331 | ring->physAddr = 0; | ||
332 | ring->descriptorsAllocated = 0; | ||
333 | ring->bytesAllocated = 0; | ||
334 | |||
335 | ring->virtAddr = dma_alloc_writecombine(NULL, | ||
336 | bytesToAlloc, | ||
337 | &ring->physAddr, | ||
338 | GFP_KERNEL); | ||
339 | if (ring->virtAddr == NULL) { | ||
340 | return -ENOMEM; | ||
341 | } | ||
342 | |||
343 | ring->bytesAllocated = bytesToAlloc; | ||
344 | ring->descriptorsAllocated = numDescriptors; | ||
345 | |||
346 | return dma_init_descriptor_ring(ring, numDescriptors); | ||
347 | } | ||
348 | |||
349 | EXPORT_SYMBOL(dma_alloc_descriptor_ring); | ||
350 | |||
351 | /****************************************************************************/ | ||
352 | /** | ||
353 | * Releases the memory which was previously allocated for a descriptor ring. | ||
354 | */ | ||
355 | /****************************************************************************/ | ||
356 | |||
357 | void dma_free_descriptor_ring(DMA_DescriptorRing_t *ring /* Descriptor to release */ | ||
358 | ) { | ||
359 | if (ring->virtAddr != NULL) { | ||
360 | dma_free_writecombine(NULL, | ||
361 | ring->bytesAllocated, | ||
362 | ring->virtAddr, ring->physAddr); | ||
363 | } | ||
364 | |||
365 | ring->bytesAllocated = 0; | ||
366 | ring->descriptorsAllocated = 0; | ||
367 | ring->virtAddr = NULL; | ||
368 | ring->physAddr = 0; | ||
369 | } | ||
370 | |||
371 | EXPORT_SYMBOL(dma_free_descriptor_ring); | ||
372 | |||
373 | /****************************************************************************/ | ||
374 | /** | ||
375 | * Initializes a descriptor ring, so that descriptors can be added to it. | ||
376 | * Once a descriptor ring has been allocated, it may be reinitialized for | ||
377 | * use with additional/different regions of memory. | ||
378 | * | ||
379 | * Note that if 7 descriptors are allocated, it's perfectly acceptable to | ||
380 | * initialize the ring with a smaller number of descriptors. The amount | ||
381 | * of memory allocated for the descriptor ring will not be reduced, and | ||
382 | * the descriptor ring may be reinitialized later | ||
383 | * | ||
384 | * @return | ||
385 | * 0 Descriptor ring was initialized successfully | ||
386 | * -ENOMEM The descriptor which was passed in has insufficient space | ||
387 | * to hold the desired number of descriptors. | ||
388 | */ | ||
389 | /****************************************************************************/ | ||
390 | |||
391 | int dma_init_descriptor_ring(DMA_DescriptorRing_t *ring, /* Descriptor ring to initialize */ | ||
392 | int numDescriptors /* Number of descriptors to initialize. */ | ||
393 | ) { | ||
394 | if (ring->virtAddr == NULL) { | ||
395 | return -EINVAL; | ||
396 | } | ||
397 | if (dmacHw_initDescriptor(ring->virtAddr, | ||
398 | ring->physAddr, | ||
399 | ring->bytesAllocated, numDescriptors) < 0) { | ||
400 | printk(KERN_ERR | ||
401 | "dma_init_descriptor_ring: dmacHw_initDescriptor failed\n"); | ||
402 | return -ENOMEM; | ||
403 | } | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | EXPORT_SYMBOL(dma_init_descriptor_ring); | ||
409 | |||
410 | /****************************************************************************/ | ||
411 | /** | ||
412 | * Determines the number of descriptors which would be required for a | ||
413 | * transfer of the indicated memory region. | ||
414 | * | ||
415 | * This function also needs to know which DMA device this transfer will | ||
416 | * be destined for, so that the appropriate DMA configuration can be retrieved. | ||
417 | * DMA parameters such as transfer width, and whether this is a memory-to-memory | ||
418 | * or memory-to-peripheral, etc can all affect the actual number of descriptors | ||
419 | * required. | ||
420 | * | ||
421 | * @return | ||
422 | * > 0 Returns the number of descriptors required for the indicated transfer | ||
423 | * -ENODEV - Device handed in is invalid. | ||
424 | * -EINVAL Invalid parameters | ||
425 | * -ENOMEM Memory exhausted | ||
426 | */ | ||
427 | /****************************************************************************/ | ||
428 | |||
429 | int dma_calculate_descriptor_count(DMA_Device_t device, /* DMA Device that this will be associated with */ | ||
430 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
431 | dma_addr_t dstData, /* Pointer to device data address */ | ||
432 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
433 | ) { | ||
434 | int numDescriptors; | ||
435 | DMA_DeviceAttribute_t *devAttr; | ||
436 | |||
437 | if (!IsDeviceValid(device)) { | ||
438 | return -ENODEV; | ||
439 | } | ||
440 | devAttr = &DMA_gDeviceAttribute[device]; | ||
441 | |||
442 | numDescriptors = dmacHw_calculateDescriptorCount(&devAttr->config, | ||
443 | (void *)srcData, | ||
444 | (void *)dstData, | ||
445 | numBytes); | ||
446 | if (numDescriptors < 0) { | ||
447 | printk(KERN_ERR | ||
448 | "dma_calculate_descriptor_count: dmacHw_calculateDescriptorCount failed\n"); | ||
449 | return -EINVAL; | ||
450 | } | ||
451 | |||
452 | return numDescriptors; | ||
453 | } | ||
454 | |||
455 | EXPORT_SYMBOL(dma_calculate_descriptor_count); | ||
456 | |||
457 | /****************************************************************************/ | ||
458 | /** | ||
459 | * Adds a region of memory to the descriptor ring. Note that it may take | ||
460 | * multiple descriptors for each region of memory. It is the callers | ||
461 | * responsibility to allocate a sufficiently large descriptor ring. | ||
462 | * | ||
463 | * @return | ||
464 | * 0 Descriptors were added successfully | ||
465 | * -ENODEV Device handed in is invalid. | ||
466 | * -EINVAL Invalid parameters | ||
467 | * -ENOMEM Memory exhausted | ||
468 | */ | ||
469 | /****************************************************************************/ | ||
470 | |||
471 | int dma_add_descriptors(DMA_DescriptorRing_t *ring, /* Descriptor ring to add descriptors to */ | ||
472 | DMA_Device_t device, /* DMA Device that descriptors are for */ | ||
473 | dma_addr_t srcData, /* Place to get data (memory or device) */ | ||
474 | dma_addr_t dstData, /* Place to put data (memory or device) */ | ||
475 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
476 | ) { | ||
477 | int rc; | ||
478 | DMA_DeviceAttribute_t *devAttr; | ||
479 | |||
480 | if (!IsDeviceValid(device)) { | ||
481 | return -ENODEV; | ||
482 | } | ||
483 | devAttr = &DMA_gDeviceAttribute[device]; | ||
484 | |||
485 | rc = dmacHw_setDataDescriptor(&devAttr->config, | ||
486 | ring->virtAddr, | ||
487 | (void *)srcData, | ||
488 | (void *)dstData, numBytes); | ||
489 | if (rc < 0) { | ||
490 | printk(KERN_ERR | ||
491 | "dma_add_descriptors: dmacHw_setDataDescriptor failed with code: %d\n", | ||
492 | rc); | ||
493 | return -ENOMEM; | ||
494 | } | ||
495 | |||
496 | return 0; | ||
497 | } | ||
498 | |||
499 | EXPORT_SYMBOL(dma_add_descriptors); | ||
500 | |||
501 | /****************************************************************************/ | ||
502 | /** | ||
503 | * Sets the descriptor ring associated with a device. | ||
504 | * | ||
505 | * Once set, the descriptor ring will be associated with the device, even | ||
506 | * across channel request/free calls. Passing in a NULL descriptor ring | ||
507 | * will release any descriptor ring currently associated with the device. | ||
508 | * | ||
509 | * Note: If you call dma_transfer, or one of the other dma_alloc_ functions | ||
510 | * the descriptor ring may be released and reallocated. | ||
511 | * | ||
512 | * Note: This function will release the descriptor memory for any current | ||
513 | * descriptor ring associated with this device. | ||
514 | * | ||
515 | * @return | ||
516 | * 0 Descriptors were added successfully | ||
517 | * -ENODEV Device handed in is invalid. | ||
518 | */ | ||
519 | /****************************************************************************/ | ||
520 | |||
521 | int dma_set_device_descriptor_ring(DMA_Device_t device, /* Device to update the descriptor ring for. */ | ||
522 | DMA_DescriptorRing_t *ring /* Descriptor ring to add descriptors to */ | ||
523 | ) { | ||
524 | DMA_DeviceAttribute_t *devAttr; | ||
525 | |||
526 | if (!IsDeviceValid(device)) { | ||
527 | return -ENODEV; | ||
528 | } | ||
529 | devAttr = &DMA_gDeviceAttribute[device]; | ||
530 | |||
531 | /* Free the previously allocated descriptor ring */ | ||
532 | |||
533 | dma_free_descriptor_ring(&devAttr->ring); | ||
534 | |||
535 | if (ring != NULL) { | ||
536 | /* Copy in the new one */ | ||
537 | |||
538 | devAttr->ring = *ring; | ||
539 | } | ||
540 | |||
541 | /* Set things up so that if dma_transfer is called then this descriptor */ | ||
542 | /* ring will get freed. */ | ||
543 | |||
544 | devAttr->prevSrcData = 0; | ||
545 | devAttr->prevDstData = 0; | ||
546 | devAttr->prevNumBytes = 0; | ||
547 | |||
548 | return 0; | ||
549 | } | ||
550 | |||
551 | EXPORT_SYMBOL(dma_set_device_descriptor_ring); | ||
552 | |||
553 | /****************************************************************************/ | ||
554 | /** | ||
555 | * Retrieves the descriptor ring associated with a device. | ||
556 | * | ||
557 | * @return | ||
558 | * 0 Descriptors were added successfully | ||
559 | * -ENODEV Device handed in is invalid. | ||
560 | */ | ||
561 | /****************************************************************************/ | ||
562 | |||
563 | int dma_get_device_descriptor_ring(DMA_Device_t device, /* Device to retrieve the descriptor ring for. */ | ||
564 | DMA_DescriptorRing_t *ring /* Place to store retrieved ring */ | ||
565 | ) { | ||
566 | DMA_DeviceAttribute_t *devAttr; | ||
567 | |||
568 | memset(ring, 0, sizeof(*ring)); | ||
569 | |||
570 | if (!IsDeviceValid(device)) { | ||
571 | return -ENODEV; | ||
572 | } | ||
573 | devAttr = &DMA_gDeviceAttribute[device]; | ||
574 | |||
575 | *ring = devAttr->ring; | ||
576 | |||
577 | return 0; | ||
578 | } | ||
579 | |||
580 | EXPORT_SYMBOL(dma_get_device_descriptor_ring); | ||
581 | |||
582 | /****************************************************************************/ | ||
583 | /** | ||
584 | * Configures a DMA channel. | ||
585 | * | ||
586 | * @return | ||
587 | * >= 0 - Initialization was successful. | ||
588 | * | ||
589 | * -EBUSY - Device is currently being used. | ||
590 | * -ENODEV - Device handed in is invalid. | ||
591 | */ | ||
592 | /****************************************************************************/ | ||
593 | |||
594 | static int ConfigChannel(DMA_Handle_t handle) | ||
595 | { | ||
596 | DMA_Channel_t *channel; | ||
597 | DMA_DeviceAttribute_t *devAttr; | ||
598 | int controllerIdx; | ||
599 | |||
600 | channel = HandleToChannel(handle); | ||
601 | if (channel == NULL) { | ||
602 | return -ENODEV; | ||
603 | } | ||
604 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
605 | controllerIdx = CONTROLLER_FROM_HANDLE(handle); | ||
606 | |||
607 | if ((devAttr->flags & DMA_DEVICE_FLAG_PORT_PER_DMAC) != 0) { | ||
608 | if (devAttr->config.transferType == | ||
609 | dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL) { | ||
610 | devAttr->config.dstPeripheralPort = | ||
611 | devAttr->dmacPort[controllerIdx]; | ||
612 | } else if (devAttr->config.transferType == | ||
613 | dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM) { | ||
614 | devAttr->config.srcPeripheralPort = | ||
615 | devAttr->dmacPort[controllerIdx]; | ||
616 | } | ||
617 | } | ||
618 | |||
619 | if (dmacHw_configChannel(channel->dmacHwHandle, &devAttr->config) != 0) { | ||
620 | printk(KERN_ERR "ConfigChannel: dmacHw_configChannel failed\n"); | ||
621 | return -EIO; | ||
622 | } | ||
623 | |||
624 | return 0; | ||
625 | } | ||
626 | |||
627 | /****************************************************************************/ | ||
628 | /** | ||
629 | * Initializes all of the data structures associated with the DMA. | ||
630 | * @return | ||
631 | * >= 0 - Initialization was successful. | ||
632 | * | ||
633 | * -EBUSY - Device is currently being used. | ||
634 | * -ENODEV - Device handed in is invalid. | ||
635 | */ | ||
636 | /****************************************************************************/ | ||
637 | |||
638 | int dma_init(void) | ||
639 | { | ||
640 | int rc = 0; | ||
641 | int controllerIdx; | ||
642 | int channelIdx; | ||
643 | DMA_Device_t devIdx; | ||
644 | DMA_Channel_t *channel; | ||
645 | DMA_Handle_t dedicatedHandle; | ||
646 | |||
647 | memset(&gDMA, 0, sizeof(gDMA)); | ||
648 | |||
649 | sema_init(&gDMA.lock, 0); | ||
650 | init_waitqueue_head(&gDMA.freeChannelQ); | ||
651 | |||
652 | /* Initialize the Hardware */ | ||
653 | |||
654 | dmacHw_initDma(); | ||
655 | |||
656 | /* Start off by marking all of the DMA channels as shared. */ | ||
657 | |||
658 | for (controllerIdx = 0; controllerIdx < DMA_NUM_CONTROLLERS; | ||
659 | controllerIdx++) { | ||
660 | for (channelIdx = 0; channelIdx < DMA_NUM_CHANNELS; | ||
661 | channelIdx++) { | ||
662 | channel = | ||
663 | &gDMA.controller[controllerIdx].channel[channelIdx]; | ||
664 | |||
665 | channel->flags = 0; | ||
666 | channel->devType = DMA_DEVICE_NONE; | ||
667 | channel->lastDevType = DMA_DEVICE_NONE; | ||
668 | |||
669 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
670 | channel->fileName = ""; | ||
671 | channel->lineNum = 0; | ||
672 | #endif | ||
673 | |||
674 | channel->dmacHwHandle = | ||
675 | dmacHw_getChannelHandle(dmacHw_MAKE_CHANNEL_ID | ||
676 | (controllerIdx, | ||
677 | channelIdx)); | ||
678 | dmacHw_initChannel(channel->dmacHwHandle); | ||
679 | } | ||
680 | } | ||
681 | |||
682 | /* Record any special attributes that channels may have */ | ||
683 | |||
684 | gDMA.controller[0].channel[0].flags |= DMA_CHANNEL_FLAG_LARGE_FIFO; | ||
685 | gDMA.controller[0].channel[1].flags |= DMA_CHANNEL_FLAG_LARGE_FIFO; | ||
686 | gDMA.controller[1].channel[0].flags |= DMA_CHANNEL_FLAG_LARGE_FIFO; | ||
687 | gDMA.controller[1].channel[1].flags |= DMA_CHANNEL_FLAG_LARGE_FIFO; | ||
688 | |||
689 | /* Now walk through and record the dedicated channels. */ | ||
690 | |||
691 | for (devIdx = 0; devIdx < DMA_NUM_DEVICE_ENTRIES; devIdx++) { | ||
692 | DMA_DeviceAttribute_t *devAttr = &DMA_gDeviceAttribute[devIdx]; | ||
693 | |||
694 | if (((devAttr->flags & DMA_DEVICE_FLAG_NO_ISR) != 0) | ||
695 | && ((devAttr->flags & DMA_DEVICE_FLAG_IS_DEDICATED) == 0)) { | ||
696 | printk(KERN_ERR | ||
697 | "DMA Device: %s Can only request NO_ISR for dedicated devices\n", | ||
698 | devAttr->name); | ||
699 | rc = -EINVAL; | ||
700 | goto out; | ||
701 | } | ||
702 | |||
703 | if ((devAttr->flags & DMA_DEVICE_FLAG_IS_DEDICATED) != 0) { | ||
704 | /* This is a dedicated device. Mark the channel as being reserved. */ | ||
705 | |||
706 | if (devAttr->dedicatedController >= DMA_NUM_CONTROLLERS) { | ||
707 | printk(KERN_ERR | ||
708 | "DMA Device: %s DMA Controller %d is out of range\n", | ||
709 | devAttr->name, | ||
710 | devAttr->dedicatedController); | ||
711 | rc = -EINVAL; | ||
712 | goto out; | ||
713 | } | ||
714 | |||
715 | if (devAttr->dedicatedChannel >= DMA_NUM_CHANNELS) { | ||
716 | printk(KERN_ERR | ||
717 | "DMA Device: %s DMA Channel %d is out of range\n", | ||
718 | devAttr->name, | ||
719 | devAttr->dedicatedChannel); | ||
720 | rc = -EINVAL; | ||
721 | goto out; | ||
722 | } | ||
723 | |||
724 | dedicatedHandle = | ||
725 | MAKE_HANDLE(devAttr->dedicatedController, | ||
726 | devAttr->dedicatedChannel); | ||
727 | channel = HandleToChannel(dedicatedHandle); | ||
728 | |||
729 | if ((channel->flags & DMA_CHANNEL_FLAG_IS_DEDICATED) != | ||
730 | 0) { | ||
731 | printk | ||
732 | ("DMA Device: %s attempting to use same DMA Controller:Channel (%d:%d) as %s\n", | ||
733 | devAttr->name, | ||
734 | devAttr->dedicatedController, | ||
735 | devAttr->dedicatedChannel, | ||
736 | DMA_gDeviceAttribute[channel->devType]. | ||
737 | name); | ||
738 | rc = -EBUSY; | ||
739 | goto out; | ||
740 | } | ||
741 | |||
742 | channel->flags |= DMA_CHANNEL_FLAG_IS_DEDICATED; | ||
743 | channel->devType = devIdx; | ||
744 | |||
745 | if (devAttr->flags & DMA_DEVICE_FLAG_NO_ISR) { | ||
746 | channel->flags |= DMA_CHANNEL_FLAG_NO_ISR; | ||
747 | } | ||
748 | |||
749 | /* For dedicated channels, we can go ahead and configure the DMA channel now */ | ||
750 | /* as well. */ | ||
751 | |||
752 | ConfigChannel(dedicatedHandle); | ||
753 | } | ||
754 | } | ||
755 | |||
756 | /* Go through and register the interrupt handlers */ | ||
757 | |||
758 | for (controllerIdx = 0; controllerIdx < DMA_NUM_CONTROLLERS; | ||
759 | controllerIdx++) { | ||
760 | for (channelIdx = 0; channelIdx < DMA_NUM_CHANNELS; | ||
761 | channelIdx++) { | ||
762 | channel = | ||
763 | &gDMA.controller[controllerIdx].channel[channelIdx]; | ||
764 | |||
765 | if ((channel->flags & DMA_CHANNEL_FLAG_NO_ISR) == 0) { | ||
766 | snprintf(channel->name, sizeof(channel->name), | ||
767 | "dma %d:%d %s", controllerIdx, | ||
768 | channelIdx, | ||
769 | channel->devType == | ||
770 | DMA_DEVICE_NONE ? "" : | ||
771 | DMA_gDeviceAttribute[channel->devType]. | ||
772 | name); | ||
773 | |||
774 | rc = | ||
775 | request_irq(IRQ_DMA0C0 + | ||
776 | (controllerIdx * | ||
777 | DMA_NUM_CHANNELS) + | ||
778 | channelIdx, | ||
779 | dma_interrupt_handler, | ||
780 | IRQF_DISABLED, channel->name, | ||
781 | channel); | ||
782 | if (rc != 0) { | ||
783 | printk(KERN_ERR | ||
784 | "request_irq for IRQ_DMA%dC%d failed\n", | ||
785 | controllerIdx, channelIdx); | ||
786 | } | ||
787 | } | ||
788 | } | ||
789 | } | ||
790 | |||
791 | /* Create /proc/dma/channels and /proc/dma/devices */ | ||
792 | |||
793 | gDmaDir = proc_mkdir("dma", NULL); | ||
794 | |||
795 | if (gDmaDir == NULL) { | ||
796 | printk(KERN_ERR "Unable to create /proc/dma\n"); | ||
797 | } else { | ||
798 | create_proc_read_entry("channels", 0, gDmaDir, | ||
799 | dma_proc_read_channels, NULL); | ||
800 | create_proc_read_entry("devices", 0, gDmaDir, | ||
801 | dma_proc_read_devices, NULL); | ||
802 | } | ||
803 | |||
804 | out: | ||
805 | |||
806 | up(&gDMA.lock); | ||
807 | |||
808 | return rc; | ||
809 | } | ||
810 | |||
811 | /****************************************************************************/ | ||
812 | /** | ||
813 | * Reserves a channel for use with @a dev. If the device is setup to use | ||
814 | * a shared channel, then this function will block until a free channel | ||
815 | * becomes available. | ||
816 | * | ||
817 | * @return | ||
818 | * >= 0 - A valid DMA Handle. | ||
819 | * -EBUSY - Device is currently being used. | ||
820 | * -ENODEV - Device handed in is invalid. | ||
821 | */ | ||
822 | /****************************************************************************/ | ||
823 | |||
824 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
825 | DMA_Handle_t dma_request_channel_dbg | ||
826 | (DMA_Device_t dev, const char *fileName, int lineNum) | ||
827 | #else | ||
828 | DMA_Handle_t dma_request_channel(DMA_Device_t dev) | ||
829 | #endif | ||
830 | { | ||
831 | DMA_Handle_t handle; | ||
832 | DMA_DeviceAttribute_t *devAttr; | ||
833 | DMA_Channel_t *channel; | ||
834 | int controllerIdx; | ||
835 | int controllerIdx2; | ||
836 | int channelIdx; | ||
837 | |||
838 | if (down_interruptible(&gDMA.lock) < 0) { | ||
839 | return -ERESTARTSYS; | ||
840 | } | ||
841 | |||
842 | if ((dev < 0) || (dev >= DMA_NUM_DEVICE_ENTRIES)) { | ||
843 | handle = -ENODEV; | ||
844 | goto out; | ||
845 | } | ||
846 | devAttr = &DMA_gDeviceAttribute[dev]; | ||
847 | |||
848 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
849 | { | ||
850 | char *s; | ||
851 | |||
852 | s = strrchr(fileName, '/'); | ||
853 | if (s != NULL) { | ||
854 | fileName = s + 1; | ||
855 | } | ||
856 | } | ||
857 | #endif | ||
858 | if ((devAttr->flags & DMA_DEVICE_FLAG_IN_USE) != 0) { | ||
859 | /* This device has already been requested and not been freed */ | ||
860 | |||
861 | printk(KERN_ERR "%s: device %s is already requested\n", | ||
862 | __func__, devAttr->name); | ||
863 | handle = -EBUSY; | ||
864 | goto out; | ||
865 | } | ||
866 | |||
867 | if ((devAttr->flags & DMA_DEVICE_FLAG_IS_DEDICATED) != 0) { | ||
868 | /* This device has a dedicated channel. */ | ||
869 | |||
870 | channel = | ||
871 | &gDMA.controller[devAttr->dedicatedController]. | ||
872 | channel[devAttr->dedicatedChannel]; | ||
873 | if ((channel->flags & DMA_CHANNEL_FLAG_IN_USE) != 0) { | ||
874 | handle = -EBUSY; | ||
875 | goto out; | ||
876 | } | ||
877 | |||
878 | channel->flags |= DMA_CHANNEL_FLAG_IN_USE; | ||
879 | devAttr->flags |= DMA_DEVICE_FLAG_IN_USE; | ||
880 | |||
881 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
882 | channel->fileName = fileName; | ||
883 | channel->lineNum = lineNum; | ||
884 | #endif | ||
885 | handle = | ||
886 | MAKE_HANDLE(devAttr->dedicatedController, | ||
887 | devAttr->dedicatedChannel); | ||
888 | goto out; | ||
889 | } | ||
890 | |||
891 | /* This device needs to use one of the shared channels. */ | ||
892 | |||
893 | handle = DMA_INVALID_HANDLE; | ||
894 | while (handle == DMA_INVALID_HANDLE) { | ||
895 | /* Scan through the shared channels and see if one is available */ | ||
896 | |||
897 | for (controllerIdx2 = 0; controllerIdx2 < DMA_NUM_CONTROLLERS; | ||
898 | controllerIdx2++) { | ||
899 | /* Check to see if we should try on controller 1 first. */ | ||
900 | |||
901 | controllerIdx = controllerIdx2; | ||
902 | if ((devAttr-> | ||
903 | flags & DMA_DEVICE_FLAG_ALLOC_DMA1_FIRST) != 0) { | ||
904 | controllerIdx = 1 - controllerIdx; | ||
905 | } | ||
906 | |||
907 | /* See if the device is available on the controller being tested */ | ||
908 | |||
909 | if ((devAttr-> | ||
910 | flags & (DMA_DEVICE_FLAG_ON_DMA0 << controllerIdx)) | ||
911 | != 0) { | ||
912 | for (channelIdx = 0; | ||
913 | channelIdx < DMA_NUM_CHANNELS; | ||
914 | channelIdx++) { | ||
915 | channel = | ||
916 | &gDMA.controller[controllerIdx]. | ||
917 | channel[channelIdx]; | ||
918 | |||
919 | if (((channel-> | ||
920 | flags & | ||
921 | DMA_CHANNEL_FLAG_IS_DEDICATED) == | ||
922 | 0) | ||
923 | && | ||
924 | ((channel-> | ||
925 | flags & DMA_CHANNEL_FLAG_IN_USE) | ||
926 | == 0)) { | ||
927 | if (((channel-> | ||
928 | flags & | ||
929 | DMA_CHANNEL_FLAG_LARGE_FIFO) | ||
930 | != 0) | ||
931 | && | ||
932 | ((devAttr-> | ||
933 | flags & | ||
934 | DMA_DEVICE_FLAG_ALLOW_LARGE_FIFO) | ||
935 | == 0)) { | ||
936 | /* This channel is a large fifo - don't tie it up */ | ||
937 | /* with devices that we don't want using it. */ | ||
938 | |||
939 | continue; | ||
940 | } | ||
941 | |||
942 | channel->flags |= | ||
943 | DMA_CHANNEL_FLAG_IN_USE; | ||
944 | channel->devType = dev; | ||
945 | devAttr->flags |= | ||
946 | DMA_DEVICE_FLAG_IN_USE; | ||
947 | |||
948 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
949 | channel->fileName = fileName; | ||
950 | channel->lineNum = lineNum; | ||
951 | #endif | ||
952 | handle = | ||
953 | MAKE_HANDLE(controllerIdx, | ||
954 | channelIdx); | ||
955 | |||
956 | /* Now that we've reserved the channel - we can go ahead and configure it */ | ||
957 | |||
958 | if (ConfigChannel(handle) != 0) { | ||
959 | handle = -EIO; | ||
960 | printk(KERN_ERR | ||
961 | "dma_request_channel: ConfigChannel failed\n"); | ||
962 | } | ||
963 | goto out; | ||
964 | } | ||
965 | } | ||
966 | } | ||
967 | } | ||
968 | |||
969 | /* No channels are currently available. Let's wait for one to free up. */ | ||
970 | |||
971 | { | ||
972 | DEFINE_WAIT(wait); | ||
973 | |||
974 | prepare_to_wait(&gDMA.freeChannelQ, &wait, | ||
975 | TASK_INTERRUPTIBLE); | ||
976 | up(&gDMA.lock); | ||
977 | schedule(); | ||
978 | finish_wait(&gDMA.freeChannelQ, &wait); | ||
979 | |||
980 | if (signal_pending(current)) { | ||
981 | /* We don't currently hold gDMA.lock, so we return directly */ | ||
982 | |||
983 | return -ERESTARTSYS; | ||
984 | } | ||
985 | } | ||
986 | |||
987 | if (down_interruptible(&gDMA.lock)) { | ||
988 | return -ERESTARTSYS; | ||
989 | } | ||
990 | } | ||
991 | |||
992 | out: | ||
993 | up(&gDMA.lock); | ||
994 | |||
995 | return handle; | ||
996 | } | ||
997 | |||
998 | /* Create both _dbg and non _dbg functions for modules. */ | ||
999 | |||
1000 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
1001 | #undef dma_request_channel | ||
1002 | DMA_Handle_t dma_request_channel(DMA_Device_t dev) | ||
1003 | { | ||
1004 | return dma_request_channel_dbg(dev, __FILE__, __LINE__); | ||
1005 | } | ||
1006 | |||
1007 | EXPORT_SYMBOL(dma_request_channel_dbg); | ||
1008 | #endif | ||
1009 | EXPORT_SYMBOL(dma_request_channel); | ||
1010 | |||
1011 | /****************************************************************************/ | ||
1012 | /** | ||
1013 | * Frees a previously allocated DMA Handle. | ||
1014 | */ | ||
1015 | /****************************************************************************/ | ||
1016 | |||
1017 | int dma_free_channel(DMA_Handle_t handle /* DMA handle. */ | ||
1018 | ) { | ||
1019 | int rc = 0; | ||
1020 | DMA_Channel_t *channel; | ||
1021 | DMA_DeviceAttribute_t *devAttr; | ||
1022 | |||
1023 | if (down_interruptible(&gDMA.lock) < 0) { | ||
1024 | return -ERESTARTSYS; | ||
1025 | } | ||
1026 | |||
1027 | channel = HandleToChannel(handle); | ||
1028 | if (channel == NULL) { | ||
1029 | rc = -EINVAL; | ||
1030 | goto out; | ||
1031 | } | ||
1032 | |||
1033 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
1034 | |||
1035 | if ((channel->flags & DMA_CHANNEL_FLAG_IS_DEDICATED) == 0) { | ||
1036 | channel->lastDevType = channel->devType; | ||
1037 | channel->devType = DMA_DEVICE_NONE; | ||
1038 | } | ||
1039 | channel->flags &= ~DMA_CHANNEL_FLAG_IN_USE; | ||
1040 | devAttr->flags &= ~DMA_DEVICE_FLAG_IN_USE; | ||
1041 | |||
1042 | out: | ||
1043 | up(&gDMA.lock); | ||
1044 | |||
1045 | wake_up_interruptible(&gDMA.freeChannelQ); | ||
1046 | |||
1047 | return rc; | ||
1048 | } | ||
1049 | |||
1050 | EXPORT_SYMBOL(dma_free_channel); | ||
1051 | |||
1052 | /****************************************************************************/ | ||
1053 | /** | ||
1054 | * Determines if a given device has been configured as using a shared | ||
1055 | * channel. | ||
1056 | * | ||
1057 | * @return | ||
1058 | * 0 Device uses a dedicated channel | ||
1059 | * > zero Device uses a shared channel | ||
1060 | * < zero Error code | ||
1061 | */ | ||
1062 | /****************************************************************************/ | ||
1063 | |||
1064 | int dma_device_is_channel_shared(DMA_Device_t device /* Device to check. */ | ||
1065 | ) { | ||
1066 | DMA_DeviceAttribute_t *devAttr; | ||
1067 | |||
1068 | if (!IsDeviceValid(device)) { | ||
1069 | return -ENODEV; | ||
1070 | } | ||
1071 | devAttr = &DMA_gDeviceAttribute[device]; | ||
1072 | |||
1073 | return ((devAttr->flags & DMA_DEVICE_FLAG_IS_DEDICATED) == 0); | ||
1074 | } | ||
1075 | |||
1076 | EXPORT_SYMBOL(dma_device_is_channel_shared); | ||
1077 | |||
1078 | /****************************************************************************/ | ||
1079 | /** | ||
1080 | * Allocates buffers for the descriptors. This is normally done automatically | ||
1081 | * but needs to be done explicitly when initiating a dma from interrupt | ||
1082 | * context. | ||
1083 | * | ||
1084 | * @return | ||
1085 | * 0 Descriptors were allocated successfully | ||
1086 | * -EINVAL Invalid device type for this kind of transfer | ||
1087 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
1088 | * -ENOMEM Memory exhausted | ||
1089 | */ | ||
1090 | /****************************************************************************/ | ||
1091 | |||
1092 | int dma_alloc_descriptors(DMA_Handle_t handle, /* DMA Handle */ | ||
1093 | dmacHw_TRANSFER_TYPE_e transferType, /* Type of transfer being performed */ | ||
1094 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
1095 | dma_addr_t dstData, /* Pointer to device data address */ | ||
1096 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
1097 | ) { | ||
1098 | DMA_Channel_t *channel; | ||
1099 | DMA_DeviceAttribute_t *devAttr; | ||
1100 | int numDescriptors; | ||
1101 | size_t ringBytesRequired; | ||
1102 | int rc = 0; | ||
1103 | |||
1104 | channel = HandleToChannel(handle); | ||
1105 | if (channel == NULL) { | ||
1106 | return -ENODEV; | ||
1107 | } | ||
1108 | |||
1109 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
1110 | |||
1111 | if (devAttr->config.transferType != transferType) { | ||
1112 | return -EINVAL; | ||
1113 | } | ||
1114 | |||
1115 | /* Figure out how many descriptors we need. */ | ||
1116 | |||
1117 | /* printk("srcData: 0x%08x dstData: 0x%08x, numBytes: %d\n", */ | ||
1118 | /* srcData, dstData, numBytes); */ | ||
1119 | |||
1120 | numDescriptors = dmacHw_calculateDescriptorCount(&devAttr->config, | ||
1121 | (void *)srcData, | ||
1122 | (void *)dstData, | ||
1123 | numBytes); | ||
1124 | if (numDescriptors < 0) { | ||
1125 | printk(KERN_ERR "%s: dmacHw_calculateDescriptorCount failed\n", | ||
1126 | __func__); | ||
1127 | return -EINVAL; | ||
1128 | } | ||
1129 | |||
1130 | /* Check to see if we can reuse the existing descriptor ring, or if we need to allocate */ | ||
1131 | /* a new one. */ | ||
1132 | |||
1133 | ringBytesRequired = dmacHw_descriptorLen(numDescriptors); | ||
1134 | |||
1135 | /* printk("ringBytesRequired: %d\n", ringBytesRequired); */ | ||
1136 | |||
1137 | if (ringBytesRequired > devAttr->ring.bytesAllocated) { | ||
1138 | /* Make sure that this code path is never taken from interrupt context. */ | ||
1139 | /* It's OK for an interrupt to initiate a DMA transfer, but the descriptor */ | ||
1140 | /* allocation needs to have already been done. */ | ||
1141 | |||
1142 | might_sleep(); | ||
1143 | |||
1144 | /* Free the old descriptor ring and allocate a new one. */ | ||
1145 | |||
1146 | dma_free_descriptor_ring(&devAttr->ring); | ||
1147 | |||
1148 | /* And allocate a new one. */ | ||
1149 | |||
1150 | rc = | ||
1151 | dma_alloc_descriptor_ring(&devAttr->ring, | ||
1152 | numDescriptors); | ||
1153 | if (rc < 0) { | ||
1154 | printk(KERN_ERR | ||
1155 | "%s: dma_alloc_descriptor_ring(%d) failed\n", | ||
1156 | __func__, numDescriptors); | ||
1157 | return rc; | ||
1158 | } | ||
1159 | /* Setup the descriptor for this transfer */ | ||
1160 | |||
1161 | if (dmacHw_initDescriptor(devAttr->ring.virtAddr, | ||
1162 | devAttr->ring.physAddr, | ||
1163 | devAttr->ring.bytesAllocated, | ||
1164 | numDescriptors) < 0) { | ||
1165 | printk(KERN_ERR "%s: dmacHw_initDescriptor failed\n", | ||
1166 | __func__); | ||
1167 | return -EINVAL; | ||
1168 | } | ||
1169 | } else { | ||
1170 | /* We've already got enough ring buffer allocated. All we need to do is reset */ | ||
1171 | /* any control information, just in case the previous DMA was stopped. */ | ||
1172 | |||
1173 | dmacHw_resetDescriptorControl(devAttr->ring.virtAddr); | ||
1174 | } | ||
1175 | |||
1176 | /* dma_alloc/free both set the prevSrc/DstData to 0. If they happen to be the same */ | ||
1177 | /* as last time, then we don't need to call setDataDescriptor again. */ | ||
1178 | |||
1179 | if (dmacHw_setDataDescriptor(&devAttr->config, | ||
1180 | devAttr->ring.virtAddr, | ||
1181 | (void *)srcData, | ||
1182 | (void *)dstData, numBytes) < 0) { | ||
1183 | printk(KERN_ERR "%s: dmacHw_setDataDescriptor failed\n", | ||
1184 | __func__); | ||
1185 | return -EINVAL; | ||
1186 | } | ||
1187 | |||
1188 | /* Remember the critical information for this transfer so that we can eliminate */ | ||
1189 | /* another call to dma_alloc_descriptors if the caller reuses the same buffers */ | ||
1190 | |||
1191 | devAttr->prevSrcData = srcData; | ||
1192 | devAttr->prevDstData = dstData; | ||
1193 | devAttr->prevNumBytes = numBytes; | ||
1194 | |||
1195 | return 0; | ||
1196 | } | ||
1197 | |||
1198 | EXPORT_SYMBOL(dma_alloc_descriptors); | ||
1199 | |||
1200 | /****************************************************************************/ | ||
1201 | /** | ||
1202 | * Allocates and sets up descriptors for a double buffered circular buffer. | ||
1203 | * | ||
1204 | * This is primarily intended to be used for things like the ingress samples | ||
1205 | * from a microphone. | ||
1206 | * | ||
1207 | * @return | ||
1208 | * > 0 Number of descriptors actually allocated. | ||
1209 | * -EINVAL Invalid device type for this kind of transfer | ||
1210 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
1211 | * -ENOMEM Memory exhausted | ||
1212 | */ | ||
1213 | /****************************************************************************/ | ||
1214 | |||
1215 | int dma_alloc_double_dst_descriptors(DMA_Handle_t handle, /* DMA Handle */ | ||
1216 | dma_addr_t srcData, /* Physical address of source data */ | ||
1217 | dma_addr_t dstData1, /* Physical address of first destination buffer */ | ||
1218 | dma_addr_t dstData2, /* Physical address of second destination buffer */ | ||
1219 | size_t numBytes /* Number of bytes in each destination buffer */ | ||
1220 | ) { | ||
1221 | DMA_Channel_t *channel; | ||
1222 | DMA_DeviceAttribute_t *devAttr; | ||
1223 | int numDst1Descriptors; | ||
1224 | int numDst2Descriptors; | ||
1225 | int numDescriptors; | ||
1226 | size_t ringBytesRequired; | ||
1227 | int rc = 0; | ||
1228 | |||
1229 | channel = HandleToChannel(handle); | ||
1230 | if (channel == NULL) { | ||
1231 | return -ENODEV; | ||
1232 | } | ||
1233 | |||
1234 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
1235 | |||
1236 | /* Figure out how many descriptors we need. */ | ||
1237 | |||
1238 | /* printk("srcData: 0x%08x dstData: 0x%08x, numBytes: %d\n", */ | ||
1239 | /* srcData, dstData, numBytes); */ | ||
1240 | |||
1241 | numDst1Descriptors = | ||
1242 | dmacHw_calculateDescriptorCount(&devAttr->config, (void *)srcData, | ||
1243 | (void *)dstData1, numBytes); | ||
1244 | if (numDst1Descriptors < 0) { | ||
1245 | return -EINVAL; | ||
1246 | } | ||
1247 | numDst2Descriptors = | ||
1248 | dmacHw_calculateDescriptorCount(&devAttr->config, (void *)srcData, | ||
1249 | (void *)dstData2, numBytes); | ||
1250 | if (numDst2Descriptors < 0) { | ||
1251 | return -EINVAL; | ||
1252 | } | ||
1253 | numDescriptors = numDst1Descriptors + numDst2Descriptors; | ||
1254 | /* printk("numDescriptors: %d\n", numDescriptors); */ | ||
1255 | |||
1256 | /* Check to see if we can reuse the existing descriptor ring, or if we need to allocate */ | ||
1257 | /* a new one. */ | ||
1258 | |||
1259 | ringBytesRequired = dmacHw_descriptorLen(numDescriptors); | ||
1260 | |||
1261 | /* printk("ringBytesRequired: %d\n", ringBytesRequired); */ | ||
1262 | |||
1263 | if (ringBytesRequired > devAttr->ring.bytesAllocated) { | ||
1264 | /* Make sure that this code path is never taken from interrupt context. */ | ||
1265 | /* It's OK for an interrupt to initiate a DMA transfer, but the descriptor */ | ||
1266 | /* allocation needs to have already been done. */ | ||
1267 | |||
1268 | might_sleep(); | ||
1269 | |||
1270 | /* Free the old descriptor ring and allocate a new one. */ | ||
1271 | |||
1272 | dma_free_descriptor_ring(&devAttr->ring); | ||
1273 | |||
1274 | /* And allocate a new one. */ | ||
1275 | |||
1276 | rc = | ||
1277 | dma_alloc_descriptor_ring(&devAttr->ring, | ||
1278 | numDescriptors); | ||
1279 | if (rc < 0) { | ||
1280 | printk(KERN_ERR | ||
1281 | "%s: dma_alloc_descriptor_ring(%d) failed\n", | ||
1282 | __func__, ringBytesRequired); | ||
1283 | return rc; | ||
1284 | } | ||
1285 | } | ||
1286 | |||
1287 | /* Setup the descriptor for this transfer. Since this function is used with */ | ||
1288 | /* CONTINUOUS DMA operations, we need to reinitialize every time, otherwise */ | ||
1289 | /* setDataDescriptor will keep trying to append onto the end. */ | ||
1290 | |||
1291 | if (dmacHw_initDescriptor(devAttr->ring.virtAddr, | ||
1292 | devAttr->ring.physAddr, | ||
1293 | devAttr->ring.bytesAllocated, | ||
1294 | numDescriptors) < 0) { | ||
1295 | printk(KERN_ERR "%s: dmacHw_initDescriptor failed\n", __func__); | ||
1296 | return -EINVAL; | ||
1297 | } | ||
1298 | |||
1299 | /* dma_alloc/free both set the prevSrc/DstData to 0. If they happen to be the same */ | ||
1300 | /* as last time, then we don't need to call setDataDescriptor again. */ | ||
1301 | |||
1302 | if (dmacHw_setDataDescriptor(&devAttr->config, | ||
1303 | devAttr->ring.virtAddr, | ||
1304 | (void *)srcData, | ||
1305 | (void *)dstData1, numBytes) < 0) { | ||
1306 | printk(KERN_ERR "%s: dmacHw_setDataDescriptor 1 failed\n", | ||
1307 | __func__); | ||
1308 | return -EINVAL; | ||
1309 | } | ||
1310 | if (dmacHw_setDataDescriptor(&devAttr->config, | ||
1311 | devAttr->ring.virtAddr, | ||
1312 | (void *)srcData, | ||
1313 | (void *)dstData2, numBytes) < 0) { | ||
1314 | printk(KERN_ERR "%s: dmacHw_setDataDescriptor 2 failed\n", | ||
1315 | __func__); | ||
1316 | return -EINVAL; | ||
1317 | } | ||
1318 | |||
1319 | /* You should use dma_start_transfer rather than dma_transfer_xxx so we don't */ | ||
1320 | /* try to make the 'prev' variables right. */ | ||
1321 | |||
1322 | devAttr->prevSrcData = 0; | ||
1323 | devAttr->prevDstData = 0; | ||
1324 | devAttr->prevNumBytes = 0; | ||
1325 | |||
1326 | return numDescriptors; | ||
1327 | } | ||
1328 | |||
1329 | EXPORT_SYMBOL(dma_alloc_double_dst_descriptors); | ||
1330 | |||
1331 | /****************************************************************************/ | ||
1332 | /** | ||
1333 | * Initiates a transfer when the descriptors have already been setup. | ||
1334 | * | ||
1335 | * This is a special case, and normally, the dma_transfer_xxx functions should | ||
1336 | * be used. | ||
1337 | * | ||
1338 | * @return | ||
1339 | * 0 Transfer was started successfully | ||
1340 | * -ENODEV Invalid handle | ||
1341 | */ | ||
1342 | /****************************************************************************/ | ||
1343 | |||
1344 | int dma_start_transfer(DMA_Handle_t handle) | ||
1345 | { | ||
1346 | DMA_Channel_t *channel; | ||
1347 | DMA_DeviceAttribute_t *devAttr; | ||
1348 | |||
1349 | channel = HandleToChannel(handle); | ||
1350 | if (channel == NULL) { | ||
1351 | return -ENODEV; | ||
1352 | } | ||
1353 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
1354 | |||
1355 | dmacHw_initiateTransfer(channel->dmacHwHandle, &devAttr->config, | ||
1356 | devAttr->ring.virtAddr); | ||
1357 | |||
1358 | /* Since we got this far, everything went successfully */ | ||
1359 | |||
1360 | return 0; | ||
1361 | } | ||
1362 | |||
1363 | EXPORT_SYMBOL(dma_start_transfer); | ||
1364 | |||
1365 | /****************************************************************************/ | ||
1366 | /** | ||
1367 | * Stops a previously started DMA transfer. | ||
1368 | * | ||
1369 | * @return | ||
1370 | * 0 Transfer was stopped successfully | ||
1371 | * -ENODEV Invalid handle | ||
1372 | */ | ||
1373 | /****************************************************************************/ | ||
1374 | |||
1375 | int dma_stop_transfer(DMA_Handle_t handle) | ||
1376 | { | ||
1377 | DMA_Channel_t *channel; | ||
1378 | |||
1379 | channel = HandleToChannel(handle); | ||
1380 | if (channel == NULL) { | ||
1381 | return -ENODEV; | ||
1382 | } | ||
1383 | |||
1384 | dmacHw_stopTransfer(channel->dmacHwHandle); | ||
1385 | |||
1386 | return 0; | ||
1387 | } | ||
1388 | |||
1389 | EXPORT_SYMBOL(dma_stop_transfer); | ||
1390 | |||
1391 | /****************************************************************************/ | ||
1392 | /** | ||
1393 | * Waits for a DMA to complete by polling. This function is only intended | ||
1394 | * to be used for testing. Interrupts should be used for most DMA operations. | ||
1395 | */ | ||
1396 | /****************************************************************************/ | ||
1397 | |||
1398 | int dma_wait_transfer_done(DMA_Handle_t handle) | ||
1399 | { | ||
1400 | DMA_Channel_t *channel; | ||
1401 | dmacHw_TRANSFER_STATUS_e status; | ||
1402 | |||
1403 | channel = HandleToChannel(handle); | ||
1404 | if (channel == NULL) { | ||
1405 | return -ENODEV; | ||
1406 | } | ||
1407 | |||
1408 | while ((status = | ||
1409 | dmacHw_transferCompleted(channel->dmacHwHandle)) == | ||
1410 | dmacHw_TRANSFER_STATUS_BUSY) { | ||
1411 | ; | ||
1412 | } | ||
1413 | |||
1414 | if (status == dmacHw_TRANSFER_STATUS_ERROR) { | ||
1415 | printk(KERN_ERR "%s: DMA transfer failed\n", __func__); | ||
1416 | return -EIO; | ||
1417 | } | ||
1418 | return 0; | ||
1419 | } | ||
1420 | |||
1421 | EXPORT_SYMBOL(dma_wait_transfer_done); | ||
1422 | |||
1423 | /****************************************************************************/ | ||
1424 | /** | ||
1425 | * Initiates a DMA, allocating the descriptors as required. | ||
1426 | * | ||
1427 | * @return | ||
1428 | * 0 Transfer was started successfully | ||
1429 | * -EINVAL Invalid device type for this kind of transfer | ||
1430 | * (i.e. the device is _DEV_TO_MEM and not _MEM_TO_DEV) | ||
1431 | */ | ||
1432 | /****************************************************************************/ | ||
1433 | |||
1434 | int dma_transfer(DMA_Handle_t handle, /* DMA Handle */ | ||
1435 | dmacHw_TRANSFER_TYPE_e transferType, /* Type of transfer being performed */ | ||
1436 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
1437 | dma_addr_t dstData, /* Pointer to device data address */ | ||
1438 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
1439 | ) { | ||
1440 | DMA_Channel_t *channel; | ||
1441 | DMA_DeviceAttribute_t *devAttr; | ||
1442 | int rc = 0; | ||
1443 | |||
1444 | channel = HandleToChannel(handle); | ||
1445 | if (channel == NULL) { | ||
1446 | return -ENODEV; | ||
1447 | } | ||
1448 | |||
1449 | devAttr = &DMA_gDeviceAttribute[channel->devType]; | ||
1450 | |||
1451 | if (devAttr->config.transferType != transferType) { | ||
1452 | return -EINVAL; | ||
1453 | } | ||
1454 | |||
1455 | /* We keep track of the information about the previous request for this */ | ||
1456 | /* device, and if the attributes match, then we can use the descriptors we setup */ | ||
1457 | /* the last time, and not have to reinitialize everything. */ | ||
1458 | |||
1459 | { | ||
1460 | rc = | ||
1461 | dma_alloc_descriptors(handle, transferType, srcData, | ||
1462 | dstData, numBytes); | ||
1463 | if (rc != 0) { | ||
1464 | return rc; | ||
1465 | } | ||
1466 | } | ||
1467 | |||
1468 | /* And kick off the transfer */ | ||
1469 | |||
1470 | devAttr->numBytes = numBytes; | ||
1471 | devAttr->transferStartTime = timer_get_tick_count(); | ||
1472 | |||
1473 | dmacHw_initiateTransfer(channel->dmacHwHandle, &devAttr->config, | ||
1474 | devAttr->ring.virtAddr); | ||
1475 | |||
1476 | /* Since we got this far, everything went successfully */ | ||
1477 | |||
1478 | return 0; | ||
1479 | } | ||
1480 | |||
1481 | EXPORT_SYMBOL(dma_transfer); | ||
1482 | |||
1483 | /****************************************************************************/ | ||
1484 | /** | ||
1485 | * Set the callback function which will be called when a transfer completes. | ||
1486 | * If a NULL callback function is set, then no callback will occur. | ||
1487 | * | ||
1488 | * @note @a devHandler will be called from IRQ context. | ||
1489 | * | ||
1490 | * @return | ||
1491 | * 0 - Success | ||
1492 | * -ENODEV - Device handed in is invalid. | ||
1493 | */ | ||
1494 | /****************************************************************************/ | ||
1495 | |||
1496 | int dma_set_device_handler(DMA_Device_t dev, /* Device to set the callback for. */ | ||
1497 | DMA_DeviceHandler_t devHandler, /* Function to call when the DMA completes */ | ||
1498 | void *userData /* Pointer which will be passed to devHandler. */ | ||
1499 | ) { | ||
1500 | DMA_DeviceAttribute_t *devAttr; | ||
1501 | unsigned long flags; | ||
1502 | |||
1503 | if (!IsDeviceValid(dev)) { | ||
1504 | return -ENODEV; | ||
1505 | } | ||
1506 | devAttr = &DMA_gDeviceAttribute[dev]; | ||
1507 | |||
1508 | local_irq_save(flags); | ||
1509 | |||
1510 | devAttr->userData = userData; | ||
1511 | devAttr->devHandler = devHandler; | ||
1512 | |||
1513 | local_irq_restore(flags); | ||
1514 | |||
1515 | return 0; | ||
1516 | } | ||
1517 | |||
1518 | EXPORT_SYMBOL(dma_set_device_handler); | ||
diff --git a/arch/arm/mach-bcmring/dma_device.c b/arch/arm/mach-bcmring/dma_device.c deleted file mode 100644 index ca0ad736870b..000000000000 --- a/arch/arm/mach-bcmring/dma_device.c +++ /dev/null | |||
@@ -1,593 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dma_device.c | ||
18 | * | ||
19 | * @brief private array of DMA_DeviceAttribute_t | ||
20 | */ | ||
21 | /****************************************************************************/ | ||
22 | |||
23 | DMA_DeviceAttribute_t DMA_gDeviceAttribute[DMA_NUM_DEVICE_ENTRIES] = { | ||
24 | [DMA_DEVICE_MEM_TO_MEM] = /* MEM 2 MEM */ | ||
25 | { | ||
26 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
27 | .name = "mem-to-mem", | ||
28 | .config = { | ||
29 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
30 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
31 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_MEM, | ||
32 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
33 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
34 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
35 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
36 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
37 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
38 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
39 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
40 | |||
41 | }, | ||
42 | }, | ||
43 | [DMA_DEVICE_VPM_MEM_TO_MEM] = /* VPM */ | ||
44 | { | ||
45 | .flags = DMA_DEVICE_FLAG_IS_DEDICATED | DMA_DEVICE_FLAG_NO_ISR, | ||
46 | .name = "vpm", | ||
47 | .dedicatedController = 0, | ||
48 | .dedicatedChannel = 0, | ||
49 | /* reserve DMA0:0 for VPM */ | ||
50 | }, | ||
51 | [DMA_DEVICE_NAND_MEM_TO_MEM] = /* NAND */ | ||
52 | { | ||
53 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
54 | .name = "nand", | ||
55 | .config = { | ||
56 | .srcPeripheralPort = 0, | ||
57 | .dstPeripheralPort = 0, | ||
58 | .srcStatusRegisterAddress = 0x00000000, | ||
59 | .dstStatusRegisterAddress = 0x00000000, | ||
60 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_MEM, | ||
61 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
62 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
63 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
64 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
65 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
66 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
67 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
68 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
69 | .channelPriority = dmacHw_CHANNEL_PRIORITY_6, | ||
70 | }, | ||
71 | }, | ||
72 | [DMA_DEVICE_PIF_MEM_TO_DEV] = /* PIF TX */ | ||
73 | { | ||
74 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1 | ||
75 | | DMA_DEVICE_FLAG_ALLOW_LARGE_FIFO | ||
76 | | DMA_DEVICE_FLAG_ALLOC_DMA1_FIRST | DMA_DEVICE_FLAG_PORT_PER_DMAC, | ||
77 | .name = "pif_tx", | ||
78 | .dmacPort = {14, 5}, | ||
79 | .config = { | ||
80 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
81 | /* dstPeripheralPort = 5 or 14 */ | ||
82 | .srcStatusRegisterAddress = 0x00000000, | ||
83 | .dstStatusRegisterAddress = 0x00000000, | ||
84 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
85 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
86 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
87 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
88 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
89 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
90 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
91 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
92 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
93 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
94 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
95 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
96 | .maxDataPerBlock = 16256, | ||
97 | }, | ||
98 | }, | ||
99 | [DMA_DEVICE_PIF_DEV_TO_MEM] = /* PIF RX */ | ||
100 | { | ||
101 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1 | ||
102 | | DMA_DEVICE_FLAG_ALLOW_LARGE_FIFO | ||
103 | /* DMA_DEVICE_FLAG_ALLOC_DMA1_FIRST */ | ||
104 | | DMA_DEVICE_FLAG_PORT_PER_DMAC, | ||
105 | .name = "pif_rx", | ||
106 | .dmacPort = {14, 5}, | ||
107 | .config = { | ||
108 | /* srcPeripheralPort = 5 or 14 */ | ||
109 | .dstPeripheralPort = 0, /* DST: memory */ | ||
110 | .srcStatusRegisterAddress = 0x00000000, | ||
111 | .dstStatusRegisterAddress = 0x00000000, | ||
112 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
113 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
114 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
115 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
116 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
117 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
118 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
119 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
120 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
121 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
122 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
123 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
124 | .maxDataPerBlock = 16256, | ||
125 | }, | ||
126 | }, | ||
127 | [DMA_DEVICE_I2S0_DEV_TO_MEM] = /* I2S RX */ | ||
128 | { | ||
129 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
130 | .name = "i2s0_rx", | ||
131 | .config = { | ||
132 | .srcPeripheralPort = 0, /* SRC: I2S0 */ | ||
133 | .dstPeripheralPort = 0, /* DST: memory */ | ||
134 | .srcStatusRegisterAddress = 0, | ||
135 | .dstStatusRegisterAddress = 0, | ||
136 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
137 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
138 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
139 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_16, | ||
140 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
141 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
142 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_0, | ||
143 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
144 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
145 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
146 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
147 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
148 | }, | ||
149 | }, | ||
150 | [DMA_DEVICE_I2S0_MEM_TO_DEV] = /* I2S TX */ | ||
151 | { | ||
152 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
153 | .name = "i2s0_tx", | ||
154 | .config = { | ||
155 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
156 | .dstPeripheralPort = 1, /* DST: I2S0 */ | ||
157 | .srcStatusRegisterAddress = 0, | ||
158 | .dstStatusRegisterAddress = 0, | ||
159 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
160 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
161 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
162 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
163 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_16, | ||
164 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_0, | ||
165 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
166 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
167 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
168 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
169 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
170 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
171 | }, | ||
172 | }, | ||
173 | [DMA_DEVICE_I2S1_DEV_TO_MEM] = /* I2S1 RX */ | ||
174 | { | ||
175 | .flags = DMA_DEVICE_FLAG_ON_DMA1, | ||
176 | .name = "i2s1_rx", | ||
177 | .config = { | ||
178 | .srcPeripheralPort = 2, /* SRC: I2S1 */ | ||
179 | .dstPeripheralPort = 0, /* DST: memory */ | ||
180 | .srcStatusRegisterAddress = 0, | ||
181 | .dstStatusRegisterAddress = 0, | ||
182 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
183 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
184 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
185 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_16, | ||
186 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
187 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
188 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_0, | ||
189 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
190 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
191 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
192 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
193 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
194 | }, | ||
195 | }, | ||
196 | [DMA_DEVICE_I2S1_MEM_TO_DEV] = /* I2S1 TX */ | ||
197 | { | ||
198 | .flags = DMA_DEVICE_FLAG_ON_DMA1, | ||
199 | .name = "i2s1_tx", | ||
200 | .config = { | ||
201 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
202 | .dstPeripheralPort = 3, /* DST: I2S1 */ | ||
203 | .srcStatusRegisterAddress = 0, | ||
204 | .dstStatusRegisterAddress = 0, | ||
205 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
206 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
207 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
208 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
209 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_16, | ||
210 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_0, | ||
211 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
212 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
213 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
214 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
215 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
216 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
217 | }, | ||
218 | }, | ||
219 | [DMA_DEVICE_ESW_MEM_TO_DEV] = /* ESW TX */ | ||
220 | { | ||
221 | .name = "esw_tx", | ||
222 | .flags = DMA_DEVICE_FLAG_IS_DEDICATED, | ||
223 | .dedicatedController = 1, | ||
224 | .dedicatedChannel = 3, | ||
225 | .config = { | ||
226 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
227 | .dstPeripheralPort = 1, /* DST: ESW (MTP) */ | ||
228 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
229 | .errorInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
230 | /* DMAx_AHB_SSTATARy */ | ||
231 | .srcStatusRegisterAddress = 0x00000000, | ||
232 | /* DMAx_AHB_DSTATARy */ | ||
233 | .dstStatusRegisterAddress = 0x30490010, | ||
234 | /* DMAx_AHB_CFGy */ | ||
235 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
236 | /* DMAx_AHB_CTLy */ | ||
237 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
238 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
239 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
240 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_0, | ||
241 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
242 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
243 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
244 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
245 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
246 | }, | ||
247 | }, | ||
248 | [DMA_DEVICE_ESW_DEV_TO_MEM] = /* ESW RX */ | ||
249 | { | ||
250 | .name = "esw_rx", | ||
251 | .flags = DMA_DEVICE_FLAG_IS_DEDICATED, | ||
252 | .dedicatedController = 1, | ||
253 | .dedicatedChannel = 2, | ||
254 | .config = { | ||
255 | .srcPeripheralPort = 0, /* SRC: ESW (PTM) */ | ||
256 | .dstPeripheralPort = 0, /* DST: memory */ | ||
257 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
258 | .errorInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
259 | /* DMAx_AHB_SSTATARy */ | ||
260 | .srcStatusRegisterAddress = 0x30480010, | ||
261 | /* DMAx_AHB_DSTATARy */ | ||
262 | .dstStatusRegisterAddress = 0x00000000, | ||
263 | /* DMAx_AHB_CFGy */ | ||
264 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
265 | /* DMAx_AHB_CTLy */ | ||
266 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
267 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
268 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
269 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
270 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_0, | ||
271 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
272 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
273 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
274 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
275 | }, | ||
276 | }, | ||
277 | [DMA_DEVICE_APM_CODEC_A_DEV_TO_MEM] = /* APM Codec A Ingress */ | ||
278 | { | ||
279 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
280 | .name = "apm_a_rx", | ||
281 | .config = { | ||
282 | .srcPeripheralPort = 2, /* SRC: Codec A Ingress FIFO */ | ||
283 | .dstPeripheralPort = 0, /* DST: memory */ | ||
284 | .srcStatusRegisterAddress = 0x00000000, | ||
285 | .dstStatusRegisterAddress = 0x00000000, | ||
286 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
287 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
288 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
289 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
290 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
291 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
292 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
293 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
294 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
295 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
296 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
297 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
298 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
299 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
300 | }, | ||
301 | }, | ||
302 | [DMA_DEVICE_APM_CODEC_A_MEM_TO_DEV] = /* APM Codec A Egress */ | ||
303 | { | ||
304 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
305 | .name = "apm_a_tx", | ||
306 | .config = { | ||
307 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
308 | .dstPeripheralPort = 3, /* DST: Codec A Egress FIFO */ | ||
309 | .srcStatusRegisterAddress = 0x00000000, | ||
310 | .dstStatusRegisterAddress = 0x00000000, | ||
311 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
312 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
313 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
314 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
315 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
316 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
317 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
318 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
319 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
320 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
321 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
322 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
323 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
324 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
325 | }, | ||
326 | }, | ||
327 | [DMA_DEVICE_APM_CODEC_B_DEV_TO_MEM] = /* APM Codec B Ingress */ | ||
328 | { | ||
329 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
330 | .name = "apm_b_rx", | ||
331 | .config = { | ||
332 | .srcPeripheralPort = 4, /* SRC: Codec B Ingress FIFO */ | ||
333 | .dstPeripheralPort = 0, /* DST: memory */ | ||
334 | .srcStatusRegisterAddress = 0x00000000, | ||
335 | .dstStatusRegisterAddress = 0x00000000, | ||
336 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
337 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
338 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
339 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
340 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
341 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
342 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
343 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
344 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
345 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
346 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
347 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
348 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
349 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
350 | }, | ||
351 | }, | ||
352 | [DMA_DEVICE_APM_CODEC_B_MEM_TO_DEV] = /* APM Codec B Egress */ | ||
353 | { | ||
354 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
355 | .name = "apm_b_tx", | ||
356 | .config = { | ||
357 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
358 | .dstPeripheralPort = 5, /* DST: Codec B Egress FIFO */ | ||
359 | .srcStatusRegisterAddress = 0x00000000, | ||
360 | .dstStatusRegisterAddress = 0x00000000, | ||
361 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
362 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
363 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
364 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
365 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
366 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
367 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
368 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
369 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
370 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
371 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
372 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
373 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
374 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
375 | }, | ||
376 | }, | ||
377 | [DMA_DEVICE_APM_CODEC_C_DEV_TO_MEM] = /* APM Codec C Ingress */ | ||
378 | { | ||
379 | .flags = DMA_DEVICE_FLAG_ON_DMA1, | ||
380 | .name = "apm_c_rx", | ||
381 | .config = { | ||
382 | .srcPeripheralPort = 4, /* SRC: Codec C Ingress FIFO */ | ||
383 | .dstPeripheralPort = 0, /* DST: memory */ | ||
384 | .srcStatusRegisterAddress = 0x00000000, | ||
385 | .dstStatusRegisterAddress = 0x00000000, | ||
386 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
387 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
388 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
389 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
390 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
391 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
392 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
393 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
394 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
395 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
396 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
397 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
398 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
399 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
400 | }, | ||
401 | }, | ||
402 | [DMA_DEVICE_APM_PCM0_DEV_TO_MEM] = /* PCM0 RX */ | ||
403 | { | ||
404 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
405 | .name = "pcm0_rx", | ||
406 | .config = { | ||
407 | .srcPeripheralPort = 12, /* SRC: PCM0 */ | ||
408 | .dstPeripheralPort = 0, /* DST: memory */ | ||
409 | .srcStatusRegisterAddress = 0, | ||
410 | .dstStatusRegisterAddress = 0, | ||
411 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
412 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
413 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
414 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
415 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
416 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
417 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
418 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
419 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
420 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
421 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
422 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
423 | }, | ||
424 | }, | ||
425 | [DMA_DEVICE_APM_PCM0_MEM_TO_DEV] = /* PCM0 TX */ | ||
426 | { | ||
427 | .flags = DMA_DEVICE_FLAG_ON_DMA0, | ||
428 | .name = "pcm0_tx", | ||
429 | .config = { | ||
430 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
431 | .dstPeripheralPort = 13, /* DST: PCM0 */ | ||
432 | .srcStatusRegisterAddress = 0, | ||
433 | .dstStatusRegisterAddress = 0, | ||
434 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
435 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
436 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
437 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
438 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
439 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
440 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
441 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
442 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
443 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
444 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
445 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
446 | }, | ||
447 | }, | ||
448 | [DMA_DEVICE_APM_PCM1_DEV_TO_MEM] = /* PCM1 RX */ | ||
449 | { | ||
450 | .flags = DMA_DEVICE_FLAG_ON_DMA1, | ||
451 | .name = "pcm1_rx", | ||
452 | .config = { | ||
453 | .srcPeripheralPort = 14, /* SRC: PCM1 */ | ||
454 | .dstPeripheralPort = 0, /* DST: memory */ | ||
455 | .srcStatusRegisterAddress = 0, | ||
456 | .dstStatusRegisterAddress = 0, | ||
457 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
458 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
459 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
460 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
461 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
462 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
463 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_4, | ||
464 | .blockTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
465 | .completeTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
466 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
467 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
468 | .transferMode = dmacHw_TRANSFER_MODE_CONTINUOUS, | ||
469 | }, | ||
470 | }, | ||
471 | [DMA_DEVICE_APM_PCM1_MEM_TO_DEV] = /* PCM1 TX */ | ||
472 | { | ||
473 | .flags = DMA_DEVICE_FLAG_ON_DMA1, | ||
474 | .name = "pcm1_tx", | ||
475 | .config = { | ||
476 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
477 | .dstPeripheralPort = 15, /* DST: PCM1 */ | ||
478 | .srcStatusRegisterAddress = 0, | ||
479 | .dstStatusRegisterAddress = 0, | ||
480 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
481 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
482 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
483 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
484 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
485 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_4, | ||
486 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
487 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
488 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
489 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
490 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
491 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
492 | }, | ||
493 | }, | ||
494 | [DMA_DEVICE_SPUM_DEV_TO_MEM] = /* SPUM RX */ | ||
495 | { | ||
496 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
497 | .name = "spum_rx", | ||
498 | .config = { | ||
499 | .srcPeripheralPort = 6, /* SRC: Codec A Ingress FIFO */ | ||
500 | .dstPeripheralPort = 0, /* DST: memory */ | ||
501 | .srcStatusRegisterAddress = 0x00000000, | ||
502 | .dstStatusRegisterAddress = 0x00000000, | ||
503 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
504 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
505 | .transferType = dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
506 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
507 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
508 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
509 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
510 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
511 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
512 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
513 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
514 | /* Busrt size **MUST** be 16 for SPUM to work */ | ||
515 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_16, | ||
516 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_16, | ||
517 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
518 | /* on the RX side, SPU needs to be the flow controller */ | ||
519 | .flowControler = dmacHw_FLOW_CONTROL_PERIPHERAL, | ||
520 | }, | ||
521 | }, | ||
522 | [DMA_DEVICE_SPUM_MEM_TO_DEV] = /* SPUM TX */ | ||
523 | { | ||
524 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
525 | .name = "spum_tx", | ||
526 | .config = { | ||
527 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
528 | .dstPeripheralPort = 7, /* DST: SPUM */ | ||
529 | .srcStatusRegisterAddress = 0x00000000, | ||
530 | .dstStatusRegisterAddress = 0x00000000, | ||
531 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
532 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
533 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
534 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
535 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
536 | .blockTransferInterrupt = dmacHw_INTERRUPT_DISABLE, | ||
537 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
538 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
539 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
540 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_32, | ||
541 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_32, | ||
542 | /* Busrt size **MUST** be 16 for SPUM to work */ | ||
543 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_16, | ||
544 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_16, | ||
545 | .transferMode = dmacHw_TRANSFER_MODE_PERREQUEST, | ||
546 | }, | ||
547 | }, | ||
548 | [DMA_DEVICE_MEM_TO_VRAM] = /* MEM 2 VRAM */ | ||
549 | { | ||
550 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
551 | .name = "mem-to-vram", | ||
552 | .config = { | ||
553 | .srcPeripheralPort = 0, /* SRC: memory */ | ||
554 | .srcStatusRegisterAddress = 0x00000000, | ||
555 | .dstStatusRegisterAddress = 0x00000000, | ||
556 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
557 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
558 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_MEM, | ||
559 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_1, | ||
560 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_2, | ||
561 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
562 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
563 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
564 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
565 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
566 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
567 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
568 | }, | ||
569 | }, | ||
570 | [DMA_DEVICE_VRAM_TO_MEM] = /* VRAM 2 MEM */ | ||
571 | { | ||
572 | .flags = DMA_DEVICE_FLAG_ON_DMA0 | DMA_DEVICE_FLAG_ON_DMA1, | ||
573 | .name = "vram-to-mem", | ||
574 | .config = { | ||
575 | .dstPeripheralPort = 0, /* DST: memory */ | ||
576 | .srcStatusRegisterAddress = 0x00000000, | ||
577 | .dstStatusRegisterAddress = 0x00000000, | ||
578 | .srcUpdate = dmacHw_SRC_ADDRESS_UPDATE_MODE_INC, | ||
579 | .dstUpdate = dmacHw_DST_ADDRESS_UPDATE_MODE_INC, | ||
580 | .transferType = dmacHw_TRANSFER_TYPE_MEM_TO_MEM, | ||
581 | .srcMasterInterface = dmacHw_SRC_MASTER_INTERFACE_2, | ||
582 | .dstMasterInterface = dmacHw_DST_MASTER_INTERFACE_1, | ||
583 | .completeTransferInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
584 | .errorInterrupt = dmacHw_INTERRUPT_ENABLE, | ||
585 | .channelPriority = dmacHw_CHANNEL_PRIORITY_7, | ||
586 | .srcMaxTransactionWidth = dmacHw_SRC_TRANSACTION_WIDTH_64, | ||
587 | .dstMaxTransactionWidth = dmacHw_DST_TRANSACTION_WIDTH_64, | ||
588 | .srcMaxBurstWidth = dmacHw_SRC_BURST_WIDTH_8, | ||
589 | .dstMaxBurstWidth = dmacHw_DST_BURST_WIDTH_8, | ||
590 | }, | ||
591 | }, | ||
592 | }; | ||
593 | EXPORT_SYMBOL(DMA_gDeviceAttribute); /* primarily for dma-test.c */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/cfg_global.h b/arch/arm/mach-bcmring/include/mach/cfg_global.h deleted file mode 100644 index 449133eacdf5..000000000000 --- a/arch/arm/mach-bcmring/include/mach/cfg_global.h +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2006 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef CFG_GLOBAL_DEFINES_H | ||
16 | #define CFG_GLOBAL_DEFINES_H | ||
17 | |||
18 | /* CHIP */ | ||
19 | #define BCM1103 1 | ||
20 | |||
21 | #define BCM1191 4 | ||
22 | #define BCM2153 5 | ||
23 | #define BCM2820 6 | ||
24 | |||
25 | #define BCM2826 8 | ||
26 | #define FPGA11107 9 | ||
27 | #define BCM11107 10 | ||
28 | #define BCM11109 11 | ||
29 | #define BCM11170 12 | ||
30 | #define BCM11110 13 | ||
31 | #define BCM11211 14 | ||
32 | |||
33 | /* CFG_GLOBAL_CHIP_FAMILY types */ | ||
34 | #define CFG_GLOBAL_CHIP_FAMILY_NONE 0 | ||
35 | #define CFG_GLOBAL_CHIP_FAMILY_BCM116X 2 | ||
36 | #define CFG_GLOBAL_CHIP_FAMILY_BCMRING 4 | ||
37 | #define CFG_GLOBAL_CHIP_FAMILY_BCM1103 8 | ||
38 | |||
39 | #define IMAGE_HEADER_SIZE_CHECKSUM 4 | ||
40 | #endif | ||
41 | #ifndef _CFG_GLOBAL_H_ | ||
42 | #define _CFG_GLOBAL_H_ | ||
43 | |||
44 | #define CFG_GLOBAL_CHIP BCM11107 | ||
45 | #define CFG_GLOBAL_CHIP_FAMILY CFG_GLOBAL_CHIP_FAMILY_BCMRING | ||
46 | #define CFG_GLOBAL_CHIP_REV 0xB0 | ||
47 | #define CFG_GLOBAL_RAM_SIZE 0x10000000 | ||
48 | #define CFG_GLOBAL_RAM_BASE 0x00000000 | ||
49 | #define CFG_GLOBAL_RAM_RESERVED_SIZE 0x000000 | ||
50 | |||
51 | #endif /* _CFG_GLOBAL_H_ */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/cap.h b/arch/arm/mach-bcmring/include/mach/csp/cap.h deleted file mode 100644 index 30fa2d540630..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/cap.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2009 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef CAP_H | ||
16 | #define CAP_H | ||
17 | |||
18 | /* ---- Include Files ---------------------------------------------------- */ | ||
19 | /* ---- Public Constants and Types --------------------------------------- */ | ||
20 | typedef enum { | ||
21 | CAP_NOT_PRESENT = 0, | ||
22 | CAP_PRESENT | ||
23 | } CAP_RC_T; | ||
24 | |||
25 | typedef enum { | ||
26 | CAP_VPM, | ||
27 | CAP_ETH_PHY, | ||
28 | CAP_ETH_GMII, | ||
29 | CAP_ETH_SGMII, | ||
30 | CAP_USB, | ||
31 | CAP_TSC, | ||
32 | CAP_EHSS, | ||
33 | CAP_SDIO, | ||
34 | CAP_UARTB, | ||
35 | CAP_KEYPAD, | ||
36 | CAP_CLCD, | ||
37 | CAP_GE, | ||
38 | CAP_LEDM, | ||
39 | CAP_BBL, | ||
40 | CAP_VDEC, | ||
41 | CAP_PIF, | ||
42 | CAP_APM, | ||
43 | CAP_SPU, | ||
44 | CAP_PKA, | ||
45 | CAP_RNG, | ||
46 | } CAP_CAPABILITY_T; | ||
47 | |||
48 | typedef enum { | ||
49 | CAP_LCD_WVGA = 0, | ||
50 | CAP_LCD_VGA = 0x1, | ||
51 | CAP_LCD_WQVGA = 0x2, | ||
52 | CAP_LCD_QVGA = 0x3 | ||
53 | } CAP_LCD_RES_T; | ||
54 | |||
55 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
56 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
57 | |||
58 | static inline CAP_RC_T cap_isPresent(CAP_CAPABILITY_T capability, int index); | ||
59 | static inline uint32_t cap_getMaxArmSpeedHz(void); | ||
60 | static inline uint32_t cap_getMaxVpmSpeedHz(void); | ||
61 | static inline CAP_LCD_RES_T cap_getMaxLcdRes(void); | ||
62 | |||
63 | #endif | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/cap_inline.h b/arch/arm/mach-bcmring/include/mach/csp/cap_inline.h deleted file mode 100644 index 0a89e0c63419..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/cap_inline.h +++ /dev/null | |||
@@ -1,409 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2009 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef CAP_INLINE_H | ||
16 | #define CAP_INLINE_H | ||
17 | |||
18 | /* ---- Include Files ---------------------------------------------------- */ | ||
19 | #include <mach/csp/cap.h> | ||
20 | #include <mach/cfg_global.h> | ||
21 | |||
22 | /* ---- Public Constants and Types --------------------------------------- */ | ||
23 | #define CAP_CONFIG0_VPM_DIS 0x00000001 | ||
24 | #define CAP_CONFIG0_ETH_PHY0_DIS 0x00000002 | ||
25 | #define CAP_CONFIG0_ETH_PHY1_DIS 0x00000004 | ||
26 | #define CAP_CONFIG0_ETH_GMII0_DIS 0x00000008 | ||
27 | #define CAP_CONFIG0_ETH_GMII1_DIS 0x00000010 | ||
28 | #define CAP_CONFIG0_ETH_SGMII0_DIS 0x00000020 | ||
29 | #define CAP_CONFIG0_ETH_SGMII1_DIS 0x00000040 | ||
30 | #define CAP_CONFIG0_USB0_DIS 0x00000080 | ||
31 | #define CAP_CONFIG0_USB1_DIS 0x00000100 | ||
32 | #define CAP_CONFIG0_TSC_DIS 0x00000200 | ||
33 | #define CAP_CONFIG0_EHSS0_DIS 0x00000400 | ||
34 | #define CAP_CONFIG0_EHSS1_DIS 0x00000800 | ||
35 | #define CAP_CONFIG0_SDIO0_DIS 0x00001000 | ||
36 | #define CAP_CONFIG0_SDIO1_DIS 0x00002000 | ||
37 | #define CAP_CONFIG0_UARTB_DIS 0x00004000 | ||
38 | #define CAP_CONFIG0_KEYPAD_DIS 0x00008000 | ||
39 | #define CAP_CONFIG0_CLCD_DIS 0x00010000 | ||
40 | #define CAP_CONFIG0_GE_DIS 0x00020000 | ||
41 | #define CAP_CONFIG0_LEDM_DIS 0x00040000 | ||
42 | #define CAP_CONFIG0_BBL_DIS 0x00080000 | ||
43 | #define CAP_CONFIG0_VDEC_DIS 0x00100000 | ||
44 | #define CAP_CONFIG0_PIF_DIS 0x00200000 | ||
45 | #define CAP_CONFIG0_RESERVED1_DIS 0x00400000 | ||
46 | #define CAP_CONFIG0_RESERVED2_DIS 0x00800000 | ||
47 | |||
48 | #define CAP_CONFIG1_APMA_DIS 0x00000001 | ||
49 | #define CAP_CONFIG1_APMB_DIS 0x00000002 | ||
50 | #define CAP_CONFIG1_APMC_DIS 0x00000004 | ||
51 | #define CAP_CONFIG1_CLCD_RES_MASK 0x00000600 | ||
52 | #define CAP_CONFIG1_CLCD_RES_SHIFT 9 | ||
53 | #define CAP_CONFIG1_CLCD_RES_WVGA (CAP_LCD_WVGA << CAP_CONFIG1_CLCD_RES_SHIFT) | ||
54 | #define CAP_CONFIG1_CLCD_RES_VGA (CAP_LCD_VGA << CAP_CONFIG1_CLCD_RES_SHIFT) | ||
55 | #define CAP_CONFIG1_CLCD_RES_WQVGA (CAP_LCD_WQVGA << CAP_CONFIG1_CLCD_RES_SHIFT) | ||
56 | #define CAP_CONFIG1_CLCD_RES_QVGA (CAP_LCD_QVGA << CAP_CONFIG1_CLCD_RES_SHIFT) | ||
57 | |||
58 | #define CAP_CONFIG2_SPU_DIS 0x00000010 | ||
59 | #define CAP_CONFIG2_PKA_DIS 0x00000020 | ||
60 | #define CAP_CONFIG2_RNG_DIS 0x00000080 | ||
61 | |||
62 | #if (CFG_GLOBAL_CHIP == BCM11107) | ||
63 | #define capConfig0 0 | ||
64 | #define capConfig1 CAP_CONFIG1_CLCD_RES_WVGA | ||
65 | #define capConfig2 0 | ||
66 | #define CAP_APM_MAX_NUM_CHANS 3 | ||
67 | #elif (CFG_GLOBAL_CHIP == FPGA11107) | ||
68 | #define capConfig0 0 | ||
69 | #define capConfig1 CAP_CONFIG1_CLCD_RES_WVGA | ||
70 | #define capConfig2 0 | ||
71 | #define CAP_APM_MAX_NUM_CHANS 3 | ||
72 | #elif (CFG_GLOBAL_CHIP == BCM11109) | ||
73 | #define capConfig0 (CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS) | ||
74 | #define capConfig1 (CAP_CONFIG1_APMC_DIS | CAP_CONFIG1_CLCD_RES_WQVGA) | ||
75 | #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS) | ||
76 | #define CAP_APM_MAX_NUM_CHANS 2 | ||
77 | #elif (CFG_GLOBAL_CHIP == BCM11170) | ||
78 | #define capConfig0 (CAP_CONFIG0_ETH_GMII0_DIS | CAP_CONFIG0_ETH_GMII1_DIS | CAP_CONFIG0_USB0_DIS | CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_TSC_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO0_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_UARTB_DIS | CAP_CONFIG0_CLCD_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS) | ||
79 | #define capConfig1 (CAP_CONFIG1_APMC_DIS | CAP_CONFIG1_CLCD_RES_WQVGA) | ||
80 | #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS) | ||
81 | #define CAP_APM_MAX_NUM_CHANS 2 | ||
82 | #elif (CFG_GLOBAL_CHIP == BCM11110) | ||
83 | #define capConfig0 (CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_TSC_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO0_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_UARTB_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS) | ||
84 | #define capConfig1 CAP_CONFIG1_APMC_DIS | ||
85 | #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS) | ||
86 | #define CAP_APM_MAX_NUM_CHANS 2 | ||
87 | #elif (CFG_GLOBAL_CHIP == BCM11211) | ||
88 | #define capConfig0 (CAP_CONFIG0_ETH_PHY0_DIS | CAP_CONFIG0_ETH_GMII0_DIS | CAP_CONFIG0_ETH_GMII1_DIS | CAP_CONFIG0_ETH_SGMII0_DIS | CAP_CONFIG0_ETH_SGMII1_DIS | CAP_CONFIG0_CLCD_DIS) | ||
89 | #define capConfig1 CAP_CONFIG1_APMC_DIS | ||
90 | #define capConfig2 0 | ||
91 | #define CAP_APM_MAX_NUM_CHANS 2 | ||
92 | #else | ||
93 | #error CFG_GLOBAL_CHIP type capabilities not defined | ||
94 | #endif | ||
95 | |||
96 | #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == FPGA11107)) | ||
97 | #define CAP_HW_CFG_ARM_CLK_HZ 500000000 | ||
98 | #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110)) | ||
99 | #define CAP_HW_CFG_ARM_CLK_HZ 300000000 | ||
100 | #elif (CFG_GLOBAL_CHIP == BCM11211) | ||
101 | #define CAP_HW_CFG_ARM_CLK_HZ 666666666 | ||
102 | #else | ||
103 | #error CFG_GLOBAL_CHIP type capabilities not defined | ||
104 | #endif | ||
105 | |||
106 | #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == BCM11211) || (CFG_GLOBAL_CHIP == FPGA11107)) | ||
107 | #define CAP_HW_CFG_VPM_CLK_HZ 333333333 | ||
108 | #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110)) | ||
109 | #define CAP_HW_CFG_VPM_CLK_HZ 200000000 | ||
110 | #else | ||
111 | #error CFG_GLOBAL_CHIP type capabilities not defined | ||
112 | #endif | ||
113 | |||
114 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
115 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
116 | |||
117 | /**************************************************************************** | ||
118 | * cap_isPresent - | ||
119 | * | ||
120 | * PURPOSE: | ||
121 | * Determines if the chip has a certain capability present | ||
122 | * | ||
123 | * PARAMETERS: | ||
124 | * capability - type of capability to determine if present | ||
125 | * | ||
126 | * RETURNS: | ||
127 | * CAP_PRESENT or CAP_NOT_PRESENT | ||
128 | ****************************************************************************/ | ||
129 | static inline CAP_RC_T cap_isPresent(CAP_CAPABILITY_T capability, int index) | ||
130 | { | ||
131 | CAP_RC_T returnVal = CAP_NOT_PRESENT; | ||
132 | |||
133 | switch (capability) { | ||
134 | case CAP_VPM: | ||
135 | { | ||
136 | if (!(capConfig0 & CAP_CONFIG0_VPM_DIS)) { | ||
137 | returnVal = CAP_PRESENT; | ||
138 | } | ||
139 | } | ||
140 | break; | ||
141 | |||
142 | case CAP_ETH_PHY: | ||
143 | { | ||
144 | if ((index == 0) | ||
145 | && (!(capConfig0 & CAP_CONFIG0_ETH_PHY0_DIS))) { | ||
146 | returnVal = CAP_PRESENT; | ||
147 | } | ||
148 | if ((index == 1) | ||
149 | && (!(capConfig0 & CAP_CONFIG0_ETH_PHY1_DIS))) { | ||
150 | returnVal = CAP_PRESENT; | ||
151 | } | ||
152 | } | ||
153 | break; | ||
154 | |||
155 | case CAP_ETH_GMII: | ||
156 | { | ||
157 | if ((index == 0) | ||
158 | && (!(capConfig0 & CAP_CONFIG0_ETH_GMII0_DIS))) { | ||
159 | returnVal = CAP_PRESENT; | ||
160 | } | ||
161 | if ((index == 1) | ||
162 | && (!(capConfig0 & CAP_CONFIG0_ETH_GMII1_DIS))) { | ||
163 | returnVal = CAP_PRESENT; | ||
164 | } | ||
165 | } | ||
166 | break; | ||
167 | |||
168 | case CAP_ETH_SGMII: | ||
169 | { | ||
170 | if ((index == 0) | ||
171 | && (!(capConfig0 & CAP_CONFIG0_ETH_SGMII0_DIS))) { | ||
172 | returnVal = CAP_PRESENT; | ||
173 | } | ||
174 | if ((index == 1) | ||
175 | && (!(capConfig0 & CAP_CONFIG0_ETH_SGMII1_DIS))) { | ||
176 | returnVal = CAP_PRESENT; | ||
177 | } | ||
178 | } | ||
179 | break; | ||
180 | |||
181 | case CAP_USB: | ||
182 | { | ||
183 | if ((index == 0) | ||
184 | && (!(capConfig0 & CAP_CONFIG0_USB0_DIS))) { | ||
185 | returnVal = CAP_PRESENT; | ||
186 | } | ||
187 | if ((index == 1) | ||
188 | && (!(capConfig0 & CAP_CONFIG0_USB1_DIS))) { | ||
189 | returnVal = CAP_PRESENT; | ||
190 | } | ||
191 | } | ||
192 | break; | ||
193 | |||
194 | case CAP_TSC: | ||
195 | { | ||
196 | if (!(capConfig0 & CAP_CONFIG0_TSC_DIS)) { | ||
197 | returnVal = CAP_PRESENT; | ||
198 | } | ||
199 | } | ||
200 | break; | ||
201 | |||
202 | case CAP_EHSS: | ||
203 | { | ||
204 | if ((index == 0) | ||
205 | && (!(capConfig0 & CAP_CONFIG0_EHSS0_DIS))) { | ||
206 | returnVal = CAP_PRESENT; | ||
207 | } | ||
208 | if ((index == 1) | ||
209 | && (!(capConfig0 & CAP_CONFIG0_EHSS1_DIS))) { | ||
210 | returnVal = CAP_PRESENT; | ||
211 | } | ||
212 | } | ||
213 | break; | ||
214 | |||
215 | case CAP_SDIO: | ||
216 | { | ||
217 | if ((index == 0) | ||
218 | && (!(capConfig0 & CAP_CONFIG0_SDIO0_DIS))) { | ||
219 | returnVal = CAP_PRESENT; | ||
220 | } | ||
221 | if ((index == 1) | ||
222 | && (!(capConfig0 & CAP_CONFIG0_SDIO1_DIS))) { | ||
223 | returnVal = CAP_PRESENT; | ||
224 | } | ||
225 | } | ||
226 | break; | ||
227 | |||
228 | case CAP_UARTB: | ||
229 | { | ||
230 | if (!(capConfig0 & CAP_CONFIG0_UARTB_DIS)) { | ||
231 | returnVal = CAP_PRESENT; | ||
232 | } | ||
233 | } | ||
234 | break; | ||
235 | |||
236 | case CAP_KEYPAD: | ||
237 | { | ||
238 | if (!(capConfig0 & CAP_CONFIG0_KEYPAD_DIS)) { | ||
239 | returnVal = CAP_PRESENT; | ||
240 | } | ||
241 | } | ||
242 | break; | ||
243 | |||
244 | case CAP_CLCD: | ||
245 | { | ||
246 | if (!(capConfig0 & CAP_CONFIG0_CLCD_DIS)) { | ||
247 | returnVal = CAP_PRESENT; | ||
248 | } | ||
249 | } | ||
250 | break; | ||
251 | |||
252 | case CAP_GE: | ||
253 | { | ||
254 | if (!(capConfig0 & CAP_CONFIG0_GE_DIS)) { | ||
255 | returnVal = CAP_PRESENT; | ||
256 | } | ||
257 | } | ||
258 | break; | ||
259 | |||
260 | case CAP_LEDM: | ||
261 | { | ||
262 | if (!(capConfig0 & CAP_CONFIG0_LEDM_DIS)) { | ||
263 | returnVal = CAP_PRESENT; | ||
264 | } | ||
265 | } | ||
266 | break; | ||
267 | |||
268 | case CAP_BBL: | ||
269 | { | ||
270 | if (!(capConfig0 & CAP_CONFIG0_BBL_DIS)) { | ||
271 | returnVal = CAP_PRESENT; | ||
272 | } | ||
273 | } | ||
274 | break; | ||
275 | |||
276 | case CAP_VDEC: | ||
277 | { | ||
278 | if (!(capConfig0 & CAP_CONFIG0_VDEC_DIS)) { | ||
279 | returnVal = CAP_PRESENT; | ||
280 | } | ||
281 | } | ||
282 | break; | ||
283 | |||
284 | case CAP_PIF: | ||
285 | { | ||
286 | if (!(capConfig0 & CAP_CONFIG0_PIF_DIS)) { | ||
287 | returnVal = CAP_PRESENT; | ||
288 | } | ||
289 | } | ||
290 | break; | ||
291 | |||
292 | case CAP_APM: | ||
293 | { | ||
294 | if ((index == 0) | ||
295 | && (!(capConfig1 & CAP_CONFIG1_APMA_DIS))) { | ||
296 | returnVal = CAP_PRESENT; | ||
297 | } | ||
298 | if ((index == 1) | ||
299 | && (!(capConfig1 & CAP_CONFIG1_APMB_DIS))) { | ||
300 | returnVal = CAP_PRESENT; | ||
301 | } | ||
302 | if ((index == 2) | ||
303 | && (!(capConfig1 & CAP_CONFIG1_APMC_DIS))) { | ||
304 | returnVal = CAP_PRESENT; | ||
305 | } | ||
306 | } | ||
307 | break; | ||
308 | |||
309 | case CAP_SPU: | ||
310 | { | ||
311 | if (!(capConfig2 & CAP_CONFIG2_SPU_DIS)) { | ||
312 | returnVal = CAP_PRESENT; | ||
313 | } | ||
314 | } | ||
315 | break; | ||
316 | |||
317 | case CAP_PKA: | ||
318 | { | ||
319 | if (!(capConfig2 & CAP_CONFIG2_PKA_DIS)) { | ||
320 | returnVal = CAP_PRESENT; | ||
321 | } | ||
322 | } | ||
323 | break; | ||
324 | |||
325 | case CAP_RNG: | ||
326 | { | ||
327 | if (!(capConfig2 & CAP_CONFIG2_RNG_DIS)) { | ||
328 | returnVal = CAP_PRESENT; | ||
329 | } | ||
330 | } | ||
331 | break; | ||
332 | |||
333 | default: | ||
334 | { | ||
335 | } | ||
336 | break; | ||
337 | } | ||
338 | return returnVal; | ||
339 | } | ||
340 | |||
341 | /**************************************************************************** | ||
342 | * cap_getMaxArmSpeedHz - | ||
343 | * | ||
344 | * PURPOSE: | ||
345 | * Determines the maximum speed of the ARM CPU | ||
346 | * | ||
347 | * PARAMETERS: | ||
348 | * none | ||
349 | * | ||
350 | * RETURNS: | ||
351 | * clock speed in Hz that the ARM processor is able to run at | ||
352 | ****************************************************************************/ | ||
353 | static inline uint32_t cap_getMaxArmSpeedHz(void) | ||
354 | { | ||
355 | #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == FPGA11107)) | ||
356 | return 500000000; | ||
357 | #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110)) | ||
358 | return 300000000; | ||
359 | #elif (CFG_GLOBAL_CHIP == BCM11211) | ||
360 | return 666666666; | ||
361 | #else | ||
362 | #error CFG_GLOBAL_CHIP type capabilities not defined | ||
363 | #endif | ||
364 | } | ||
365 | |||
366 | /**************************************************************************** | ||
367 | * cap_getMaxVpmSpeedHz - | ||
368 | * | ||
369 | * PURPOSE: | ||
370 | * Determines the maximum speed of the VPM | ||
371 | * | ||
372 | * PARAMETERS: | ||
373 | * none | ||
374 | * | ||
375 | * RETURNS: | ||
376 | * clock speed in Hz that the VPM is able to run at | ||
377 | ****************************************************************************/ | ||
378 | static inline uint32_t cap_getMaxVpmSpeedHz(void) | ||
379 | { | ||
380 | #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == BCM11211) || (CFG_GLOBAL_CHIP == FPGA11107)) | ||
381 | return 333333333; | ||
382 | #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110)) | ||
383 | return 200000000; | ||
384 | #else | ||
385 | #error CFG_GLOBAL_CHIP type capabilities not defined | ||
386 | #endif | ||
387 | } | ||
388 | |||
389 | /**************************************************************************** | ||
390 | * cap_getMaxLcdRes - | ||
391 | * | ||
392 | * PURPOSE: | ||
393 | * Determines the maximum LCD resolution capabilities | ||
394 | * | ||
395 | * PARAMETERS: | ||
396 | * none | ||
397 | * | ||
398 | * RETURNS: | ||
399 | * CAP_LCD_WVGA, CAP_LCD_VGA, CAP_LCD_WQVGA or CAP_LCD_QVGA | ||
400 | * | ||
401 | ****************************************************************************/ | ||
402 | static inline CAP_LCD_RES_T cap_getMaxLcdRes(void) | ||
403 | { | ||
404 | return (CAP_LCD_RES_T) | ||
405 | ((capConfig1 & CAP_CONFIG1_CLCD_RES_MASK) >> | ||
406 | CAP_CONFIG1_CLCD_RES_SHIFT); | ||
407 | } | ||
408 | |||
409 | #endif | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h deleted file mode 100644 index 39f09cb89208..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_def.h +++ /dev/null | |||
@@ -1,1123 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef CHIPC_DEF_H | ||
16 | #define CHIPC_DEF_H | ||
17 | |||
18 | /* ---- Include Files ----------------------------------------------------- */ | ||
19 | |||
20 | #include <linux/types.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <mach/csp/reg.h> | ||
23 | #include <mach/csp/chipcHw_reg.h> | ||
24 | |||
25 | /* ---- Public Constants and Types ---------------------------------------- */ | ||
26 | |||
27 | /* Set 1 to configure DDR/VPM phase alignment by HW */ | ||
28 | #define chipcHw_DDR_HW_PHASE_ALIGN 0 | ||
29 | #define chipcHw_VPM_HW_PHASE_ALIGN 0 | ||
30 | |||
31 | typedef uint32_t chipcHw_freq; | ||
32 | |||
33 | /* Configurable miscellaneous clocks */ | ||
34 | typedef enum { | ||
35 | chipcHw_CLOCK_DDR, /* DDR PHY Clock */ | ||
36 | chipcHw_CLOCK_ARM, /* ARM Clock */ | ||
37 | chipcHw_CLOCK_ESW, /* Ethernet Switch Clock */ | ||
38 | chipcHw_CLOCK_VPM, /* VPM Clock */ | ||
39 | chipcHw_CLOCK_ESW125, /* Ethernet MII Clock */ | ||
40 | chipcHw_CLOCK_UART, /* UART Clock */ | ||
41 | chipcHw_CLOCK_SDIO0, /* SDIO 0 Clock */ | ||
42 | chipcHw_CLOCK_SDIO1, /* SDIO 1 Clock */ | ||
43 | chipcHw_CLOCK_SPI, /* SPI Clock */ | ||
44 | chipcHw_CLOCK_ETM, /* ARM ETM Clock */ | ||
45 | |||
46 | chipcHw_CLOCK_BUS, /* BUS Clock */ | ||
47 | chipcHw_CLOCK_OTP, /* OTP Clock */ | ||
48 | chipcHw_CLOCK_I2C, /* I2C Host Clock */ | ||
49 | chipcHw_CLOCK_I2S0, /* I2S 0 Host Clock */ | ||
50 | chipcHw_CLOCK_RTBUS, /* DDR PHY Configuration Clock */ | ||
51 | chipcHw_CLOCK_APM100, /* APM100 Clock */ | ||
52 | chipcHw_CLOCK_TSC, /* Touch screen Clock */ | ||
53 | chipcHw_CLOCK_LED, /* LED Clock */ | ||
54 | |||
55 | chipcHw_CLOCK_USB, /* USB Clock */ | ||
56 | chipcHw_CLOCK_LCD, /* LCD CLock */ | ||
57 | chipcHw_CLOCK_APM, /* APM Clock */ | ||
58 | |||
59 | chipcHw_CLOCK_I2S1, /* I2S 1 Host Clock */ | ||
60 | } chipcHw_CLOCK_e; | ||
61 | |||
62 | /* System booting strap options */ | ||
63 | typedef enum { | ||
64 | chipcHw_BOOT_DEVICE_UART = chipcHw_STRAPS_BOOT_DEVICE_UART, | ||
65 | chipcHw_BOOT_DEVICE_SERIAL_FLASH = | ||
66 | chipcHw_STRAPS_BOOT_DEVICE_SERIAL_FLASH, | ||
67 | chipcHw_BOOT_DEVICE_NOR_FLASH_16 = | ||
68 | chipcHw_STRAPS_BOOT_DEVICE_NOR_FLASH_16, | ||
69 | chipcHw_BOOT_DEVICE_NAND_FLASH_8 = | ||
70 | chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_8, | ||
71 | chipcHw_BOOT_DEVICE_NAND_FLASH_16 = | ||
72 | chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_16 | ||
73 | } chipcHw_BOOT_DEVICE_e; | ||
74 | |||
75 | /* System booting modes */ | ||
76 | typedef enum { | ||
77 | chipcHw_BOOT_MODE_NORMAL = chipcHw_STRAPS_BOOT_MODE_NORMAL, | ||
78 | chipcHw_BOOT_MODE_DBG_SW = chipcHw_STRAPS_BOOT_MODE_DBG_SW, | ||
79 | chipcHw_BOOT_MODE_DBG_BOOT = chipcHw_STRAPS_BOOT_MODE_DBG_BOOT, | ||
80 | chipcHw_BOOT_MODE_NORMAL_QUIET = chipcHw_STRAPS_BOOT_MODE_NORMAL_QUIET | ||
81 | } chipcHw_BOOT_MODE_e; | ||
82 | |||
83 | /* NAND Flash page size strap options */ | ||
84 | typedef enum { | ||
85 | chipcHw_NAND_PAGESIZE_512 = chipcHw_STRAPS_NAND_PAGESIZE_512, | ||
86 | chipcHw_NAND_PAGESIZE_2048 = chipcHw_STRAPS_NAND_PAGESIZE_2048, | ||
87 | chipcHw_NAND_PAGESIZE_4096 = chipcHw_STRAPS_NAND_PAGESIZE_4096, | ||
88 | chipcHw_NAND_PAGESIZE_EXT = chipcHw_STRAPS_NAND_PAGESIZE_EXT | ||
89 | } chipcHw_NAND_PAGESIZE_e; | ||
90 | |||
91 | /* GPIO Pin function */ | ||
92 | typedef enum { | ||
93 | chipcHw_GPIO_FUNCTION_KEYPAD = chipcHw_REG_GPIO_MUX_KEYPAD, | ||
94 | chipcHw_GPIO_FUNCTION_I2CH = chipcHw_REG_GPIO_MUX_I2CH, | ||
95 | chipcHw_GPIO_FUNCTION_SPI = chipcHw_REG_GPIO_MUX_SPI, | ||
96 | chipcHw_GPIO_FUNCTION_UART = chipcHw_REG_GPIO_MUX_UART, | ||
97 | chipcHw_GPIO_FUNCTION_LEDMTXP = chipcHw_REG_GPIO_MUX_LEDMTXP, | ||
98 | chipcHw_GPIO_FUNCTION_LEDMTXS = chipcHw_REG_GPIO_MUX_LEDMTXS, | ||
99 | chipcHw_GPIO_FUNCTION_SDIO0 = chipcHw_REG_GPIO_MUX_SDIO0, | ||
100 | chipcHw_GPIO_FUNCTION_SDIO1 = chipcHw_REG_GPIO_MUX_SDIO1, | ||
101 | chipcHw_GPIO_FUNCTION_PCM = chipcHw_REG_GPIO_MUX_PCM, | ||
102 | chipcHw_GPIO_FUNCTION_I2S = chipcHw_REG_GPIO_MUX_I2S, | ||
103 | chipcHw_GPIO_FUNCTION_ETM = chipcHw_REG_GPIO_MUX_ETM, | ||
104 | chipcHw_GPIO_FUNCTION_DEBUG = chipcHw_REG_GPIO_MUX_DEBUG, | ||
105 | chipcHw_GPIO_FUNCTION_MISC = chipcHw_REG_GPIO_MUX_MISC, | ||
106 | chipcHw_GPIO_FUNCTION_GPIO = chipcHw_REG_GPIO_MUX_GPIO | ||
107 | } chipcHw_GPIO_FUNCTION_e; | ||
108 | |||
109 | /* PIN Output slew rate */ | ||
110 | typedef enum { | ||
111 | chipcHw_PIN_SLEW_RATE_HIGH = chipcHw_REG_SLEW_RATE_HIGH, | ||
112 | chipcHw_PIN_SLEW_RATE_NORMAL = chipcHw_REG_SLEW_RATE_NORMAL | ||
113 | } chipcHw_PIN_SLEW_RATE_e; | ||
114 | |||
115 | /* PIN Current drive strength */ | ||
116 | typedef enum { | ||
117 | chipcHw_PIN_CURRENT_STRENGTH_2mA = chipcHw_REG_CURRENT_STRENGTH_2mA, | ||
118 | chipcHw_PIN_CURRENT_STRENGTH_4mA = chipcHw_REG_CURRENT_STRENGTH_4mA, | ||
119 | chipcHw_PIN_CURRENT_STRENGTH_6mA = chipcHw_REG_CURRENT_STRENGTH_6mA, | ||
120 | chipcHw_PIN_CURRENT_STRENGTH_8mA = chipcHw_REG_CURRENT_STRENGTH_8mA, | ||
121 | chipcHw_PIN_CURRENT_STRENGTH_10mA = chipcHw_REG_CURRENT_STRENGTH_10mA, | ||
122 | chipcHw_PIN_CURRENT_STRENGTH_12mA = chipcHw_REG_CURRENT_STRENGTH_12mA | ||
123 | } chipcHw_PIN_CURRENT_STRENGTH_e; | ||
124 | |||
125 | /* PIN Pull up register settings */ | ||
126 | typedef enum { | ||
127 | chipcHw_PIN_PULL_NONE = chipcHw_REG_PULL_NONE, | ||
128 | chipcHw_PIN_PULL_UP = chipcHw_REG_PULL_UP, | ||
129 | chipcHw_PIN_PULL_DOWN = chipcHw_REG_PULL_DOWN | ||
130 | } chipcHw_PIN_PULL_e; | ||
131 | |||
132 | /* PIN input type settings */ | ||
133 | typedef enum { | ||
134 | chipcHw_PIN_INPUTTYPE_CMOS = chipcHw_REG_INPUTTYPE_CMOS, | ||
135 | chipcHw_PIN_INPUTTYPE_ST = chipcHw_REG_INPUTTYPE_ST | ||
136 | } chipcHw_PIN_INPUTTYPE_e; | ||
137 | |||
138 | /* Allow/Disalow the support of spread spectrum */ | ||
139 | typedef enum { | ||
140 | chipcHw_SPREAD_SPECTRUM_DISALLOW, /* Spread spectrum support is not allowed */ | ||
141 | chipcHw_SPREAD_SPECTRUM_ALLOW /* Spread spectrum support is allowed */ | ||
142 | } chipcHw_SPREAD_SPECTRUM_e; | ||
143 | |||
144 | typedef struct { | ||
145 | chipcHw_SPREAD_SPECTRUM_e ssSupport; /* Allow/Disalow to support spread spectrum. | ||
146 | If supported, call chipcHw_enableSpreadSpectrum () | ||
147 | to activate the spread spectrum with desired spread. */ | ||
148 | uint32_t pllVcoFreqHz; /* PLL VCO frequency in Hz */ | ||
149 | uint32_t pll2VcoFreqHz; /* PLL2 VCO frequency in Hz */ | ||
150 | uint32_t busClockFreqHz; /* Bus clock frequency in Hz */ | ||
151 | uint32_t armBusRatio; /* ARM clock : Bus clock */ | ||
152 | uint32_t vpmBusRatio; /* VPM clock : Bus clock */ | ||
153 | uint32_t ddrBusRatio; /* DDR clock : Bus clock */ | ||
154 | } chipcHw_INIT_PARAM_t; | ||
155 | |||
156 | /* CHIP revision number */ | ||
157 | typedef enum { | ||
158 | chipcHw_REV_NUMBER_A0 = chipcHw_REG_REV_A0, | ||
159 | chipcHw_REV_NUMBER_B0 = chipcHw_REG_REV_B0 | ||
160 | } chipcHw_REV_NUMBER_e; | ||
161 | |||
162 | typedef enum { | ||
163 | chipcHw_VPM_HW_PHASE_INTR_DISABLE = chipcHw_REG_VPM_INTR_DISABLE, | ||
164 | chipcHw_VPM_HW_PHASE_INTR_FAST = chipcHw_REG_VPM_INTR_FAST, | ||
165 | chipcHw_VPM_HW_PHASE_INTR_MEDIUM = chipcHw_REG_VPM_INTR_MEDIUM, | ||
166 | chipcHw_VPM_HW_PHASE_INTR_SLOW = chipcHw_REG_VPM_INTR_SLOW | ||
167 | } chipcHw_VPM_HW_PHASE_INTR_e; | ||
168 | |||
169 | typedef enum { | ||
170 | chipcHw_DDR_HW_PHASE_MARGIN_STRICT, /* Strict margin for DDR phase align condition */ | ||
171 | chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for DDR phase align condition */ | ||
172 | chipcHw_DDR_HW_PHASE_MARGIN_WIDE /* Wider margin for DDR phase align condition */ | ||
173 | } chipcHw_DDR_HW_PHASE_MARGIN_e; | ||
174 | |||
175 | typedef enum { | ||
176 | chipcHw_VPM_HW_PHASE_MARGIN_STRICT, /* Strict margin for VPM phase align condition */ | ||
177 | chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM, /* Medium margin for VPM phase align condition */ | ||
178 | chipcHw_VPM_HW_PHASE_MARGIN_WIDE /* Wider margin for VPM phase align condition */ | ||
179 | } chipcHw_VPM_HW_PHASE_MARGIN_e; | ||
180 | |||
181 | #define chipcHw_XTAL_FREQ_Hz 25000000 /* Reference clock frequency in Hz */ | ||
182 | |||
183 | /* Programmable pin defines */ | ||
184 | #define chipcHw_PIN_GPIO(n) ((((n) >= 0) && ((n) < (chipcHw_GPIO_COUNT))) ? (n) : 0xFFFFFFFF) | ||
185 | /* GPIO pin 0 - 60 */ | ||
186 | #define chipcHw_PIN_UARTTXD (chipcHw_GPIO_COUNT + 0) /* UART Transmit */ | ||
187 | #define chipcHw_PIN_NVI_A (chipcHw_GPIO_COUNT + 1) /* NVI Interface */ | ||
188 | #define chipcHw_PIN_NVI_D (chipcHw_GPIO_COUNT + 2) /* NVI Interface */ | ||
189 | #define chipcHw_PIN_NVI_OEB (chipcHw_GPIO_COUNT + 3) /* NVI Interface */ | ||
190 | #define chipcHw_PIN_NVI_WEB (chipcHw_GPIO_COUNT + 4) /* NVI Interface */ | ||
191 | #define chipcHw_PIN_NVI_CS (chipcHw_GPIO_COUNT + 5) /* NVI Interface */ | ||
192 | #define chipcHw_PIN_NVI_NAND_CSB (chipcHw_GPIO_COUNT + 6) /* NVI Interface */ | ||
193 | #define chipcHw_PIN_NVI_FLASHWP (chipcHw_GPIO_COUNT + 7) /* NVI Interface */ | ||
194 | #define chipcHw_PIN_NVI_NAND_RDYB (chipcHw_GPIO_COUNT + 8) /* NVI Interface */ | ||
195 | #define chipcHw_PIN_CL_DATA_0_17 (chipcHw_GPIO_COUNT + 9) /* LCD Data 0 - 17 */ | ||
196 | #define chipcHw_PIN_CL_DATA_18_20 (chipcHw_GPIO_COUNT + 10) /* LCD Data 18 - 20 */ | ||
197 | #define chipcHw_PIN_CL_DATA_21_23 (chipcHw_GPIO_COUNT + 11) /* LCD Data 21 - 23 */ | ||
198 | #define chipcHw_PIN_CL_POWER (chipcHw_GPIO_COUNT + 12) /* LCD Power */ | ||
199 | #define chipcHw_PIN_CL_ACK (chipcHw_GPIO_COUNT + 13) /* LCD Ack */ | ||
200 | #define chipcHw_PIN_CL_FP (chipcHw_GPIO_COUNT + 14) /* LCD FP */ | ||
201 | #define chipcHw_PIN_CL_LP (chipcHw_GPIO_COUNT + 15) /* LCD LP */ | ||
202 | #define chipcHw_PIN_UARTRXD (chipcHw_GPIO_COUNT + 16) /* UART Receive */ | ||
203 | |||
204 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
205 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
206 | |||
207 | /****************************************************************************/ | ||
208 | /** | ||
209 | * @brief Initializes the clock module | ||
210 | * | ||
211 | */ | ||
212 | /****************************************************************************/ | ||
213 | void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initialization parameter */ | ||
214 | ) __attribute__ ((section(".aramtext"))); | ||
215 | |||
216 | /****************************************************************************/ | ||
217 | /** | ||
218 | * @brief Enables the PLL1 | ||
219 | * | ||
220 | * This function enables the PLL1 | ||
221 | * | ||
222 | */ | ||
223 | /****************************************************************************/ | ||
224 | void chipcHw_pll1Enable(uint32_t vcoFreqHz, /* [ IN ] VCO frequency in Hz */ | ||
225 | chipcHw_SPREAD_SPECTRUM_e ssSupport /* [ IN ] SS status */ | ||
226 | ) __attribute__ ((section(".aramtext"))); | ||
227 | |||
228 | /****************************************************************************/ | ||
229 | /** | ||
230 | * @brief Enables the PLL2 | ||
231 | * | ||
232 | * This function enables the PLL2 | ||
233 | * | ||
234 | */ | ||
235 | /****************************************************************************/ | ||
236 | void chipcHw_pll2Enable(uint32_t vcoFreqHz /* [ IN ] VCO frequency in Hz */ | ||
237 | ) __attribute__ ((section(".aramtext"))); | ||
238 | |||
239 | /****************************************************************************/ | ||
240 | /** | ||
241 | * @brief Disable the PLL1 | ||
242 | * | ||
243 | */ | ||
244 | /****************************************************************************/ | ||
245 | static inline void chipcHw_pll1Disable(void); | ||
246 | |||
247 | /****************************************************************************/ | ||
248 | /** | ||
249 | * @brief Disable the PLL2 | ||
250 | * | ||
251 | */ | ||
252 | /****************************************************************************/ | ||
253 | static inline void chipcHw_pll2Disable(void); | ||
254 | |||
255 | /****************************************************************************/ | ||
256 | /** | ||
257 | * @brief Set clock fequency for miscellaneous configurable clocks | ||
258 | * | ||
259 | * This function sets clock frequency | ||
260 | * | ||
261 | * @return Configured clock frequency in KHz | ||
262 | * | ||
263 | */ | ||
264 | /****************************************************************************/ | ||
265 | chipcHw_freq chipcHw_getClockFrequency(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
266 | ) __attribute__ ((section(".aramtext"))); | ||
267 | |||
268 | /****************************************************************************/ | ||
269 | /** | ||
270 | * @brief Set clock fequency for miscellaneous configurable clocks | ||
271 | * | ||
272 | * This function sets clock frequency | ||
273 | * | ||
274 | * @return Configured clock frequency in Hz | ||
275 | * | ||
276 | */ | ||
277 | /****************************************************************************/ | ||
278 | chipcHw_freq chipcHw_setClockFrequency(chipcHw_CLOCK_e clock, /* [ IN ] Configurable clock */ | ||
279 | uint32_t freq /* [ IN ] Clock frequency in Hz */ | ||
280 | ) __attribute__ ((section(".aramtext"))); | ||
281 | |||
282 | /****************************************************************************/ | ||
283 | /** | ||
284 | * @brief Set VPM clock in sync with BUS clock | ||
285 | * | ||
286 | * This function does the phase adjustment between VPM and BUS clock | ||
287 | * | ||
288 | * @return >= 0 : On success ( # of adjustment required ) | ||
289 | * -1 : On failure | ||
290 | */ | ||
291 | /****************************************************************************/ | ||
292 | int chipcHw_vpmPhaseAlign(void); | ||
293 | |||
294 | /****************************************************************************/ | ||
295 | /** | ||
296 | * @brief Enables core a clock of a certain device | ||
297 | * | ||
298 | * This function enables a core clock | ||
299 | * | ||
300 | * @return void | ||
301 | * | ||
302 | * @note Doesnot affect the bus interface clock | ||
303 | */ | ||
304 | /****************************************************************************/ | ||
305 | static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
306 | ); | ||
307 | |||
308 | /****************************************************************************/ | ||
309 | /** | ||
310 | * @brief Disabled a core clock of a certain device | ||
311 | * | ||
312 | * This function disables a core clock | ||
313 | * | ||
314 | * @return void | ||
315 | * | ||
316 | * @note Doesnot affect the bus interface clock | ||
317 | */ | ||
318 | /****************************************************************************/ | ||
319 | static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
320 | ); | ||
321 | |||
322 | /****************************************************************************/ | ||
323 | /** | ||
324 | * @brief Enables bypass clock of a certain device | ||
325 | * | ||
326 | * This function enables bypass clock | ||
327 | * | ||
328 | * @note Doesnot affect the bus interface clock | ||
329 | */ | ||
330 | /****************************************************************************/ | ||
331 | static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
332 | ); | ||
333 | |||
334 | /****************************************************************************/ | ||
335 | /** | ||
336 | * @brief Disabled bypass clock of a certain device | ||
337 | * | ||
338 | * This function disables bypass clock | ||
339 | * | ||
340 | * @note Doesnot affect the bus interface clock | ||
341 | */ | ||
342 | /****************************************************************************/ | ||
343 | static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock /* [ IN ] Configurable clock */ | ||
344 | ); | ||
345 | |||
346 | /****************************************************************************/ | ||
347 | /** | ||
348 | * @brief Get Numeric Chip ID | ||
349 | * | ||
350 | * This function returns Chip ID that includes the revison number | ||
351 | * | ||
352 | * @return Complete numeric Chip ID | ||
353 | * | ||
354 | */ | ||
355 | /****************************************************************************/ | ||
356 | static inline uint32_t chipcHw_getChipId(void); | ||
357 | |||
358 | /****************************************************************************/ | ||
359 | /** | ||
360 | * @brief Get Chip Product ID | ||
361 | * | ||
362 | * This function returns Chip Product ID | ||
363 | * | ||
364 | * @return Chip Product ID | ||
365 | */ | ||
366 | /****************************************************************************/ | ||
367 | static inline uint32_t chipcHw_getChipProductId(void); | ||
368 | |||
369 | /****************************************************************************/ | ||
370 | /** | ||
371 | * @brief Get revision number | ||
372 | * | ||
373 | * This function returns revision number of the chip | ||
374 | * | ||
375 | * @return Revision number | ||
376 | */ | ||
377 | /****************************************************************************/ | ||
378 | static inline chipcHw_REV_NUMBER_e chipcHw_getChipRevisionNumber(void); | ||
379 | |||
380 | /****************************************************************************/ | ||
381 | /** | ||
382 | * @brief Enables bus interface clock | ||
383 | * | ||
384 | * Enables bus interface clock of various device | ||
385 | * | ||
386 | * @return void | ||
387 | * | ||
388 | * @note use chipcHw_REG_BUS_CLOCK_XXXX | ||
389 | */ | ||
390 | /****************************************************************************/ | ||
391 | static inline void chipcHw_busInterfaceClockEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */ | ||
392 | ); | ||
393 | |||
394 | /****************************************************************************/ | ||
395 | /** | ||
396 | * @brief Disables bus interface clock | ||
397 | * | ||
398 | * Disables bus interface clock of various device | ||
399 | * | ||
400 | * @return void | ||
401 | * | ||
402 | * @note use chipcHw_REG_BUS_CLOCK_XXXX | ||
403 | */ | ||
404 | /****************************************************************************/ | ||
405 | static inline void chipcHw_busInterfaceClockDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_BUS_CLOCK_XXXXX */ | ||
406 | ); | ||
407 | |||
408 | /****************************************************************************/ | ||
409 | /** | ||
410 | * @brief Enables various audio channels | ||
411 | * | ||
412 | * Enables audio channel | ||
413 | * | ||
414 | * @return void | ||
415 | * | ||
416 | * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX | ||
417 | */ | ||
418 | /****************************************************************************/ | ||
419 | static inline void chipcHw_audioChannelEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */ | ||
420 | ); | ||
421 | |||
422 | /****************************************************************************/ | ||
423 | /** | ||
424 | * @brief Disables various audio channels | ||
425 | * | ||
426 | * Disables audio channel | ||
427 | * | ||
428 | * @return void | ||
429 | * | ||
430 | * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX | ||
431 | */ | ||
432 | /****************************************************************************/ | ||
433 | static inline void chipcHw_audioChannelDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_AUDIO_CHANNEL_XXXXXX */ | ||
434 | ); | ||
435 | |||
436 | /****************************************************************************/ | ||
437 | /** | ||
438 | * @brief Soft resets devices | ||
439 | * | ||
440 | * Soft resets various devices | ||
441 | * | ||
442 | * @return void | ||
443 | * | ||
444 | * @note use chipcHw_REG_SOFT_RESET_XXXXXX defines | ||
445 | */ | ||
446 | /****************************************************************************/ | ||
447 | static inline void chipcHw_softReset(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */ | ||
448 | ); | ||
449 | |||
450 | static inline void chipcHw_softResetDisable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */ | ||
451 | ); | ||
452 | |||
453 | static inline void chipcHw_softResetEnable(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_SOFT_RESET_XXXXXX */ | ||
454 | ); | ||
455 | |||
456 | /****************************************************************************/ | ||
457 | /** | ||
458 | * @brief Configures misc CHIP functionality | ||
459 | * | ||
460 | * Configures CHIP functionality | ||
461 | * | ||
462 | * @return void | ||
463 | * | ||
464 | * @note use chipcHw_REG_MISC_CTRL_XXXXXX | ||
465 | */ | ||
466 | /****************************************************************************/ | ||
467 | static inline void chipcHw_miscControl(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */ | ||
468 | ); | ||
469 | |||
470 | static inline void chipcHw_miscControlDisable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */ | ||
471 | ); | ||
472 | |||
473 | static inline void chipcHw_miscControlEnable(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_MISC_CTRL_XXXXXX */ | ||
474 | ); | ||
475 | |||
476 | /****************************************************************************/ | ||
477 | /** | ||
478 | * @brief Set OTP options | ||
479 | * | ||
480 | * Set OTP options | ||
481 | * | ||
482 | * @return void | ||
483 | * | ||
484 | * @note use chipcHw_REG_OTP_XXXXXX | ||
485 | */ | ||
486 | /****************************************************************************/ | ||
487 | static inline void chipcHw_setOTPOption(uint64_t mask /* [ IN ] Bit map of type chipcHw_REG_OTP_XXXXXX */ | ||
488 | ); | ||
489 | |||
490 | /****************************************************************************/ | ||
491 | /** | ||
492 | * @brief Get sticky bits | ||
493 | * | ||
494 | * @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX | ||
495 | * | ||
496 | */ | ||
497 | /****************************************************************************/ | ||
498 | static inline uint32_t chipcHw_getStickyBits(void); | ||
499 | |||
500 | /****************************************************************************/ | ||
501 | /** | ||
502 | * @brief Set sticky bits | ||
503 | * | ||
504 | * @return void | ||
505 | * | ||
506 | * @note use chipcHw_REG_STICKY_XXXXXX | ||
507 | */ | ||
508 | /****************************************************************************/ | ||
509 | static inline void chipcHw_setStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */ | ||
510 | ); | ||
511 | |||
512 | /****************************************************************************/ | ||
513 | /** | ||
514 | * @brief Clear sticky bits | ||
515 | * | ||
516 | * @return void | ||
517 | * | ||
518 | * @note use chipcHw_REG_STICKY_XXXXXX | ||
519 | */ | ||
520 | /****************************************************************************/ | ||
521 | static inline void chipcHw_clearStickyBits(uint32_t mask /* [ IN ] Bit map of type chipcHw_REG_STICKY_XXXXXX */ | ||
522 | ); | ||
523 | |||
524 | /****************************************************************************/ | ||
525 | /** | ||
526 | * @brief Get software override strap options | ||
527 | * | ||
528 | * Retrieves software override strap options | ||
529 | * | ||
530 | * @return Software override strap value | ||
531 | * | ||
532 | */ | ||
533 | /****************************************************************************/ | ||
534 | static inline uint32_t chipcHw_getSoftStraps(void); | ||
535 | |||
536 | /****************************************************************************/ | ||
537 | /** | ||
538 | * @brief Set software override strap options | ||
539 | * | ||
540 | * set software override strap options | ||
541 | * | ||
542 | * @return nothing | ||
543 | * | ||
544 | */ | ||
545 | /****************************************************************************/ | ||
546 | static inline void chipcHw_setSoftStraps(uint32_t strapOptions); | ||
547 | |||
548 | /****************************************************************************/ | ||
549 | /** | ||
550 | * @brief Get pin strap options | ||
551 | * | ||
552 | * Retrieves pin strap options | ||
553 | * | ||
554 | * @return Pin strap value | ||
555 | * | ||
556 | */ | ||
557 | /****************************************************************************/ | ||
558 | static inline uint32_t chipcHw_getPinStraps(void); | ||
559 | |||
560 | /****************************************************************************/ | ||
561 | /** | ||
562 | * @brief Get valid pin strap options | ||
563 | * | ||
564 | * Retrieves valid pin strap options | ||
565 | * | ||
566 | * @return valid Pin strap value | ||
567 | * | ||
568 | */ | ||
569 | /****************************************************************************/ | ||
570 | static inline uint32_t chipcHw_getValidStraps(void); | ||
571 | |||
572 | /****************************************************************************/ | ||
573 | /** | ||
574 | * @brief Initialize valid pin strap options | ||
575 | * | ||
576 | * Retrieves valid pin strap options by copying HW strap options to soft register | ||
577 | * (if chipcHw_STRAPS_SOFT_OVERRIDE not set) | ||
578 | * | ||
579 | * @return nothing | ||
580 | * | ||
581 | */ | ||
582 | /****************************************************************************/ | ||
583 | static inline void chipcHw_initValidStraps(void); | ||
584 | |||
585 | /****************************************************************************/ | ||
586 | /** | ||
587 | * @brief Get status (enabled/disabled) of bus interface clock | ||
588 | * | ||
589 | * This function returns the status of devices' bus interface clock | ||
590 | * | ||
591 | * @return Bus interface clock | ||
592 | * | ||
593 | */ | ||
594 | /****************************************************************************/ | ||
595 | static inline uint32_t chipcHw_getBusInterfaceClockStatus(void); | ||
596 | |||
597 | /****************************************************************************/ | ||
598 | /** | ||
599 | * @brief Get boot device | ||
600 | * | ||
601 | * This function returns the device type used in booting the system | ||
602 | * | ||
603 | * @return Boot device of type chipcHw_BOOT_DEVICE_e | ||
604 | * | ||
605 | */ | ||
606 | /****************************************************************************/ | ||
607 | static inline chipcHw_BOOT_DEVICE_e chipcHw_getBootDevice(void); | ||
608 | |||
609 | /****************************************************************************/ | ||
610 | /** | ||
611 | * @brief Get boot mode | ||
612 | * | ||
613 | * This function returns the way the system was booted | ||
614 | * | ||
615 | * @return Boot mode of type chipcHw_BOOT_MODE_e | ||
616 | * | ||
617 | */ | ||
618 | /****************************************************************************/ | ||
619 | static inline chipcHw_BOOT_MODE_e chipcHw_getBootMode(void); | ||
620 | |||
621 | /****************************************************************************/ | ||
622 | /** | ||
623 | * @brief Get NAND flash page size | ||
624 | * | ||
625 | * This function returns the NAND device page size | ||
626 | * | ||
627 | * @return Boot NAND device page size | ||
628 | * | ||
629 | */ | ||
630 | /****************************************************************************/ | ||
631 | static inline chipcHw_NAND_PAGESIZE_e chipcHw_getNandPageSize(void); | ||
632 | |||
633 | /****************************************************************************/ | ||
634 | /** | ||
635 | * @brief Get NAND flash address cycle configuration | ||
636 | * | ||
637 | * This function returns the NAND flash address cycle configuration | ||
638 | * | ||
639 | * @return 0 = Do not extra address cycle, 1 = Add extra cycle | ||
640 | * | ||
641 | */ | ||
642 | /****************************************************************************/ | ||
643 | static inline int chipcHw_getNandExtraCycle(void); | ||
644 | |||
645 | /****************************************************************************/ | ||
646 | /** | ||
647 | * @brief Activates PIF interface | ||
648 | * | ||
649 | * This function activates PIF interface by taking control of LCD pins | ||
650 | * | ||
651 | * @note | ||
652 | * When activated, LCD pins will be defined as follows for PIF operation | ||
653 | * | ||
654 | * CLD[17:0] = pif_data[17:0] | ||
655 | * CLD[23:18] = pif_address[5:0] | ||
656 | * CLPOWER = pif_wr_str | ||
657 | * CLCP = pif_rd_str | ||
658 | * CLAC = pif_hat1 | ||
659 | * CLFP = pif_hrdy1 | ||
660 | * CLLP = pif_hat2 | ||
661 | * GPIO[42] = pif_hrdy2 | ||
662 | * | ||
663 | * In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin | ||
664 | * | ||
665 | */ | ||
666 | /****************************************************************************/ | ||
667 | static inline void chipcHw_activatePifInterface(void); | ||
668 | |||
669 | /****************************************************************************/ | ||
670 | /** | ||
671 | * @brief Activates LCD interface | ||
672 | * | ||
673 | * This function activates LCD interface | ||
674 | * | ||
675 | * @note | ||
676 | * When activated, LCD pins will be defined as follows | ||
677 | * | ||
678 | * CLD[17:0] = LCD data | ||
679 | * CLD[23:18] = LCD data | ||
680 | * CLPOWER = LCD power | ||
681 | * CLCP = | ||
682 | * CLAC = LCD ack | ||
683 | * CLFP = | ||
684 | * CLLP = | ||
685 | */ | ||
686 | /****************************************************************************/ | ||
687 | static inline void chipcHw_activateLcdInterface(void); | ||
688 | |||
689 | /****************************************************************************/ | ||
690 | /** | ||
691 | * @brief Deactivates PIF/LCD interface | ||
692 | * | ||
693 | * This function deactivates PIF/LCD interface | ||
694 | * | ||
695 | * @note | ||
696 | * When deactivated LCD pins will be in rti-stated | ||
697 | * | ||
698 | */ | ||
699 | /****************************************************************************/ | ||
700 | static inline void chipcHw_deactivatePifLcdInterface(void); | ||
701 | |||
702 | /****************************************************************************/ | ||
703 | /** | ||
704 | * @brief Get to know the configuration of GPIO pin | ||
705 | * | ||
706 | */ | ||
707 | /****************************************************************************/ | ||
708 | static inline chipcHw_GPIO_FUNCTION_e chipcHw_getGpioPinFunction(int pin /* GPIO Pin number */ | ||
709 | ); | ||
710 | |||
711 | /****************************************************************************/ | ||
712 | /** | ||
713 | * @brief Configure GPIO pin function | ||
714 | * | ||
715 | */ | ||
716 | /****************************************************************************/ | ||
717 | static inline void chipcHw_setGpioPinFunction(int pin, /* GPIO Pin number */ | ||
718 | chipcHw_GPIO_FUNCTION_e func /* Configuration function */ | ||
719 | ); | ||
720 | |||
721 | /****************************************************************************/ | ||
722 | /** | ||
723 | * @brief Set Pin slew rate | ||
724 | * | ||
725 | * This function sets the slew of individual pin | ||
726 | * | ||
727 | */ | ||
728 | /****************************************************************************/ | ||
729 | static inline void chipcHw_setPinSlewRate(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */ | ||
730 | chipcHw_PIN_SLEW_RATE_e slewRate /* Pin slew rate */ | ||
731 | ); | ||
732 | |||
733 | /****************************************************************************/ | ||
734 | /** | ||
735 | * @brief Set Pin output drive current | ||
736 | * | ||
737 | * This function sets output drive current of individual pin | ||
738 | * | ||
739 | * Note: Avoid the use of the word 'current' since linux headers define this | ||
740 | * to be the current task. | ||
741 | */ | ||
742 | /****************************************************************************/ | ||
743 | static inline void chipcHw_setPinOutputCurrent(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */ | ||
744 | chipcHw_PIN_CURRENT_STRENGTH_e curr /* Pin current rating */ | ||
745 | ); | ||
746 | |||
747 | /****************************************************************************/ | ||
748 | /** | ||
749 | * @brief Set Pin pullup register | ||
750 | * | ||
751 | * This function sets pullup register of individual pin | ||
752 | * | ||
753 | */ | ||
754 | /****************************************************************************/ | ||
755 | static inline void chipcHw_setPinPullup(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */ | ||
756 | chipcHw_PIN_PULL_e pullup /* Pullup register settings */ | ||
757 | ); | ||
758 | |||
759 | /****************************************************************************/ | ||
760 | /** | ||
761 | * @brief Set Pin input type | ||
762 | * | ||
763 | * This function sets input type of individual Pin | ||
764 | * | ||
765 | */ | ||
766 | /****************************************************************************/ | ||
767 | static inline void chipcHw_setPinInputType(uint32_t pin, /* Pin of type chipcHw_PIN_XXXXX */ | ||
768 | chipcHw_PIN_INPUTTYPE_e inputType /* Pin input type */ | ||
769 | ); | ||
770 | |||
771 | /****************************************************************************/ | ||
772 | /** | ||
773 | * @brief Retrieves a string representation of the mux setting for a pin. | ||
774 | * | ||
775 | * @return Pointer to a character string. | ||
776 | */ | ||
777 | /****************************************************************************/ | ||
778 | |||
779 | const char *chipcHw_getGpioPinFunctionStr(int pin); | ||
780 | |||
781 | /****************************************************************************/ | ||
782 | /** @brief issue warmReset | ||
783 | */ | ||
784 | /****************************************************************************/ | ||
785 | void chipcHw_reset(uint32_t mask); | ||
786 | |||
787 | /****************************************************************************/ | ||
788 | /** @brief clock reconfigure | ||
789 | */ | ||
790 | /****************************************************************************/ | ||
791 | void chipcHw_clockReconfig(uint32_t busHz, uint32_t armRatio, uint32_t vpmRatio, | ||
792 | uint32_t ddrRatio); | ||
793 | |||
794 | /****************************************************************************/ | ||
795 | /** | ||
796 | * @brief Enable Spread Spectrum | ||
797 | * | ||
798 | * @note chipcHw_Init() must be called earlier | ||
799 | */ | ||
800 | /****************************************************************************/ | ||
801 | static inline void chipcHw_enableSpreadSpectrum(void); | ||
802 | |||
803 | /****************************************************************************/ | ||
804 | /** | ||
805 | * @brief Disable Spread Spectrum | ||
806 | * | ||
807 | */ | ||
808 | /****************************************************************************/ | ||
809 | static inline void chipcHw_disableSpreadSpectrum(void); | ||
810 | |||
811 | /****************************************************************************/ | ||
812 | /** @brief Checks if software strap is enabled | ||
813 | * | ||
814 | * @return 1 : When enable | ||
815 | * 0 : When disable | ||
816 | */ | ||
817 | /****************************************************************************/ | ||
818 | static inline int chipcHw_isSoftwareStrapsEnable(void); | ||
819 | |||
820 | /****************************************************************************/ | ||
821 | /** @brief Enable software strap | ||
822 | */ | ||
823 | /****************************************************************************/ | ||
824 | static inline void chipcHw_softwareStrapsEnable(void); | ||
825 | |||
826 | /****************************************************************************/ | ||
827 | /** @brief Disable software strap | ||
828 | */ | ||
829 | /****************************************************************************/ | ||
830 | static inline void chipcHw_softwareStrapsDisable(void); | ||
831 | |||
832 | /****************************************************************************/ | ||
833 | /** @brief PLL test enable | ||
834 | */ | ||
835 | /****************************************************************************/ | ||
836 | static inline void chipcHw_pllTestEnable(void); | ||
837 | |||
838 | /****************************************************************************/ | ||
839 | /** @brief PLL2 test enable | ||
840 | */ | ||
841 | /****************************************************************************/ | ||
842 | static inline void chipcHw_pll2TestEnable(void); | ||
843 | |||
844 | /****************************************************************************/ | ||
845 | /** @brief PLL test disable | ||
846 | */ | ||
847 | /****************************************************************************/ | ||
848 | static inline void chipcHw_pllTestDisable(void); | ||
849 | |||
850 | /****************************************************************************/ | ||
851 | /** @brief PLL2 test disable | ||
852 | */ | ||
853 | /****************************************************************************/ | ||
854 | static inline void chipcHw_pll2TestDisable(void); | ||
855 | |||
856 | /****************************************************************************/ | ||
857 | /** @brief Get PLL test status | ||
858 | */ | ||
859 | /****************************************************************************/ | ||
860 | static inline int chipcHw_isPllTestEnable(void); | ||
861 | |||
862 | /****************************************************************************/ | ||
863 | /** @brief Get PLL2 test status | ||
864 | */ | ||
865 | /****************************************************************************/ | ||
866 | static inline int chipcHw_isPll2TestEnable(void); | ||
867 | |||
868 | /****************************************************************************/ | ||
869 | /** @brief PLL test select | ||
870 | */ | ||
871 | /****************************************************************************/ | ||
872 | static inline void chipcHw_pllTestSelect(uint32_t val); | ||
873 | |||
874 | /****************************************************************************/ | ||
875 | /** @brief PLL2 test select | ||
876 | */ | ||
877 | /****************************************************************************/ | ||
878 | static inline void chipcHw_pll2TestSelect(uint32_t val); | ||
879 | |||
880 | /****************************************************************************/ | ||
881 | /** @brief Get PLL test selected option | ||
882 | */ | ||
883 | /****************************************************************************/ | ||
884 | static inline uint8_t chipcHw_getPllTestSelected(void); | ||
885 | |||
886 | /****************************************************************************/ | ||
887 | /** @brief Get PLL2 test selected option | ||
888 | */ | ||
889 | /****************************************************************************/ | ||
890 | static inline uint8_t chipcHw_getPll2TestSelected(void); | ||
891 | |||
892 | /****************************************************************************/ | ||
893 | /** | ||
894 | * @brief Enables DDR SW phase alignment interrupt | ||
895 | */ | ||
896 | /****************************************************************************/ | ||
897 | static inline void chipcHw_ddrPhaseAlignInterruptEnable(void); | ||
898 | |||
899 | /****************************************************************************/ | ||
900 | /** | ||
901 | * @brief Disables DDR SW phase alignment interrupt | ||
902 | */ | ||
903 | /****************************************************************************/ | ||
904 | static inline void chipcHw_ddrPhaseAlignInterruptDisable(void); | ||
905 | |||
906 | /****************************************************************************/ | ||
907 | /** | ||
908 | * @brief Set VPM SW phase alignment interrupt mode | ||
909 | * | ||
910 | * This function sets VPM phase alignment interrupt | ||
911 | * | ||
912 | */ | ||
913 | /****************************************************************************/ | ||
914 | static inline void | ||
915 | chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode); | ||
916 | |||
917 | /****************************************************************************/ | ||
918 | /** | ||
919 | * @brief Enable DDR phase alignment in software | ||
920 | * | ||
921 | */ | ||
922 | /****************************************************************************/ | ||
923 | static inline void chipcHw_ddrSwPhaseAlignEnable(void); | ||
924 | |||
925 | /****************************************************************************/ | ||
926 | /** | ||
927 | * @brief Disable DDR phase alignment in software | ||
928 | * | ||
929 | */ | ||
930 | /****************************************************************************/ | ||
931 | static inline void chipcHw_ddrSwPhaseAlignDisable(void); | ||
932 | |||
933 | /****************************************************************************/ | ||
934 | /** | ||
935 | * @brief Enable DDR phase alignment in hardware | ||
936 | * | ||
937 | */ | ||
938 | /****************************************************************************/ | ||
939 | static inline void chipcHw_ddrHwPhaseAlignEnable(void); | ||
940 | |||
941 | /****************************************************************************/ | ||
942 | /** | ||
943 | * @brief Disable DDR phase alignment in hardware | ||
944 | * | ||
945 | */ | ||
946 | /****************************************************************************/ | ||
947 | static inline void chipcHw_ddrHwPhaseAlignDisable(void); | ||
948 | |||
949 | /****************************************************************************/ | ||
950 | /** | ||
951 | * @brief Enable VPM phase alignment in software | ||
952 | * | ||
953 | */ | ||
954 | /****************************************************************************/ | ||
955 | static inline void chipcHw_vpmSwPhaseAlignEnable(void); | ||
956 | |||
957 | /****************************************************************************/ | ||
958 | /** | ||
959 | * @brief Disable VPM phase alignment in software | ||
960 | * | ||
961 | */ | ||
962 | /****************************************************************************/ | ||
963 | static inline void chipcHw_vpmSwPhaseAlignDisable(void); | ||
964 | |||
965 | /****************************************************************************/ | ||
966 | /** | ||
967 | * @brief Enable VPM phase alignment in hardware | ||
968 | * | ||
969 | */ | ||
970 | /****************************************************************************/ | ||
971 | static inline void chipcHw_vpmHwPhaseAlignEnable(void); | ||
972 | |||
973 | /****************************************************************************/ | ||
974 | /** | ||
975 | * @brief Disable VPM phase alignment in hardware | ||
976 | * | ||
977 | */ | ||
978 | /****************************************************************************/ | ||
979 | static inline void chipcHw_vpmHwPhaseAlignDisable(void); | ||
980 | |||
981 | /****************************************************************************/ | ||
982 | /** | ||
983 | * @brief Set DDR phase alignment margin in hardware | ||
984 | * | ||
985 | */ | ||
986 | /****************************************************************************/ | ||
987 | static inline void chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin /* Margin alinging DDR phase */ | ||
988 | ); | ||
989 | |||
990 | /****************************************************************************/ | ||
991 | /** | ||
992 | * @brief Set VPM phase alignment margin in hardware | ||
993 | * | ||
994 | */ | ||
995 | /****************************************************************************/ | ||
996 | static inline void chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin /* Margin alinging VPM phase */ | ||
997 | ); | ||
998 | |||
999 | /****************************************************************************/ | ||
1000 | /** | ||
1001 | * @brief Checks DDR phase aligned status done by HW | ||
1002 | * | ||
1003 | * @return 1: When aligned | ||
1004 | * 0: When not aligned | ||
1005 | */ | ||
1006 | /****************************************************************************/ | ||
1007 | static inline uint32_t chipcHw_isDdrHwPhaseAligned(void); | ||
1008 | |||
1009 | /****************************************************************************/ | ||
1010 | /** | ||
1011 | * @brief Checks VPM phase aligned status done by HW | ||
1012 | * | ||
1013 | * @return 1: When aligned | ||
1014 | * 0: When not aligned | ||
1015 | */ | ||
1016 | /****************************************************************************/ | ||
1017 | static inline uint32_t chipcHw_isVpmHwPhaseAligned(void); | ||
1018 | |||
1019 | /****************************************************************************/ | ||
1020 | /** | ||
1021 | * @brief Get DDR phase aligned status done by HW | ||
1022 | * | ||
1023 | */ | ||
1024 | /****************************************************************************/ | ||
1025 | static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void); | ||
1026 | |||
1027 | /****************************************************************************/ | ||
1028 | /** | ||
1029 | * @brief Get VPM phase aligned status done by HW | ||
1030 | * | ||
1031 | */ | ||
1032 | /****************************************************************************/ | ||
1033 | static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void); | ||
1034 | |||
1035 | /****************************************************************************/ | ||
1036 | /** | ||
1037 | * @brief Get DDR phase control value | ||
1038 | * | ||
1039 | */ | ||
1040 | /****************************************************************************/ | ||
1041 | static inline uint32_t chipcHw_getDdrPhaseControl(void); | ||
1042 | |||
1043 | /****************************************************************************/ | ||
1044 | /** | ||
1045 | * @brief Get VPM phase control value | ||
1046 | * | ||
1047 | */ | ||
1048 | /****************************************************************************/ | ||
1049 | static inline uint32_t chipcHw_getVpmPhaseControl(void); | ||
1050 | |||
1051 | /****************************************************************************/ | ||
1052 | /** | ||
1053 | * @brief DDR phase alignment timeout count | ||
1054 | * | ||
1055 | * @note If HW fails to perform the phase alignment, it will trigger | ||
1056 | * a DDR phase alignment timeout interrupt. | ||
1057 | */ | ||
1058 | /****************************************************************************/ | ||
1059 | static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */ | ||
1060 | ); | ||
1061 | |||
1062 | /****************************************************************************/ | ||
1063 | /** | ||
1064 | * @brief VPM phase alignment timeout count | ||
1065 | * | ||
1066 | * @note If HW fails to perform the phase alignment, it will trigger | ||
1067 | * a VPM phase alignment timeout interrupt. | ||
1068 | */ | ||
1069 | /****************************************************************************/ | ||
1070 | static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle /* Timeout in bus cycle */ | ||
1071 | ); | ||
1072 | |||
1073 | /****************************************************************************/ | ||
1074 | /** | ||
1075 | * @brief DDR phase alignment timeout interrupt enable | ||
1076 | * | ||
1077 | */ | ||
1078 | /****************************************************************************/ | ||
1079 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void); | ||
1080 | |||
1081 | /****************************************************************************/ | ||
1082 | /** | ||
1083 | * @brief VPM phase alignment timeout interrupt enable | ||
1084 | * | ||
1085 | */ | ||
1086 | /****************************************************************************/ | ||
1087 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void); | ||
1088 | |||
1089 | /****************************************************************************/ | ||
1090 | /** | ||
1091 | * @brief DDR phase alignment timeout interrupt disable | ||
1092 | * | ||
1093 | */ | ||
1094 | /****************************************************************************/ | ||
1095 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void); | ||
1096 | |||
1097 | /****************************************************************************/ | ||
1098 | /** | ||
1099 | * @brief VPM phase alignment timeout interrupt disable | ||
1100 | * | ||
1101 | */ | ||
1102 | /****************************************************************************/ | ||
1103 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void); | ||
1104 | |||
1105 | /****************************************************************************/ | ||
1106 | /** | ||
1107 | * @brief Clear DDR phase alignment timeout interrupt | ||
1108 | * | ||
1109 | */ | ||
1110 | /****************************************************************************/ | ||
1111 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void); | ||
1112 | |||
1113 | /****************************************************************************/ | ||
1114 | /** | ||
1115 | * @brief Clear VPM phase alignment timeout interrupt | ||
1116 | * | ||
1117 | */ | ||
1118 | /****************************************************************************/ | ||
1119 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void); | ||
1120 | |||
1121 | /* ---- Private Constants and Types -------------------------------------- */ | ||
1122 | |||
1123 | #endif /* CHIPC_DEF_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h deleted file mode 100644 index a66f3f7abb86..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_inline.h +++ /dev/null | |||
@@ -1,1682 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef CHIPC_INLINE_H | ||
16 | #define CHIPC_INLINE_H | ||
17 | |||
18 | /* ---- Include Files ----------------------------------------------------- */ | ||
19 | |||
20 | #include <linux/errno.h> | ||
21 | #include <mach/csp/reg.h> | ||
22 | #include <mach/csp/chipcHw_reg.h> | ||
23 | #include <mach/csp/chipcHw_def.h> | ||
24 | |||
25 | /* ---- Private Constants and Types --------------------------------------- */ | ||
26 | typedef enum { | ||
27 | chipcHw_OPTYPE_BYPASS, /* Bypass operation */ | ||
28 | chipcHw_OPTYPE_OUTPUT /* Output operation */ | ||
29 | } chipcHw_OPTYPE_e; | ||
30 | |||
31 | /* ---- Public Constants and Types ---------------------------------------- */ | ||
32 | /* ---- Public Variable Externs ------------------------------------------- */ | ||
33 | /* ---- Public Function Prototypes ---------------------------------------- */ | ||
34 | /* ---- Private Function Prototypes --------------------------------------- */ | ||
35 | static inline void chipcHw_setClock(chipcHw_CLOCK_e clock, | ||
36 | chipcHw_OPTYPE_e type, int mode); | ||
37 | |||
38 | /****************************************************************************/ | ||
39 | /** | ||
40 | * @brief Get Numeric Chip ID | ||
41 | * | ||
42 | * This function returns Chip ID that includes the revison number | ||
43 | * | ||
44 | * @return Complete numeric Chip ID | ||
45 | * | ||
46 | */ | ||
47 | /****************************************************************************/ | ||
48 | static inline uint32_t chipcHw_getChipId(void) | ||
49 | { | ||
50 | return readl(&pChipcHw->ChipId); | ||
51 | } | ||
52 | |||
53 | /****************************************************************************/ | ||
54 | /** | ||
55 | * @brief Enable Spread Spectrum | ||
56 | * | ||
57 | * @note chipcHw_Init() must be called earlier | ||
58 | */ | ||
59 | /****************************************************************************/ | ||
60 | static inline void chipcHw_enableSpreadSpectrum(void) | ||
61 | { | ||
62 | if ((readl(&pChipcHw-> | ||
63 | PLLPreDivider) & chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASK) != | ||
64 | chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER) { | ||
65 | writel((0xFFFF << ddrcReg_PHY_ADDR_SS_CFG_NDIV_AMPLITUDE_SHIFT) | | ||
66 | (ddrcReg_PHY_ADDR_SS_CFG_MIN_CYCLE_PER_TICK << | ||
67 | ddrcReg_PHY_ADDR_SS_CFG_CYCLE_PER_TICK_SHIFT), | ||
68 | &ddrcReg_PHY_ADDR_CTL_REGP->ssCfg); | ||
69 | writel(readl(&ddrcReg_PHY_ADDR_CTL_REGP->ssCtl) | | ||
70 | ddrcReg_PHY_ADDR_SS_CTRL_ENABLE, | ||
71 | &ddrcReg_PHY_ADDR_CTL_REGP->ssCtl); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | /****************************************************************************/ | ||
76 | /** | ||
77 | * @brief Disable Spread Spectrum | ||
78 | * | ||
79 | */ | ||
80 | /****************************************************************************/ | ||
81 | static inline void chipcHw_disableSpreadSpectrum(void) | ||
82 | { | ||
83 | ddrcReg_PHY_ADDR_CTL_REGP->ssCtl &= ~ddrcReg_PHY_ADDR_SS_CTRL_ENABLE; | ||
84 | } | ||
85 | |||
86 | /****************************************************************************/ | ||
87 | /** | ||
88 | * @brief Get Chip Product ID | ||
89 | * | ||
90 | * This function returns Chip Product ID | ||
91 | * | ||
92 | * @return Chip Product ID | ||
93 | */ | ||
94 | /****************************************************************************/ | ||
95 | static inline uint32_t chipcHw_getChipProductId(void) | ||
96 | { | ||
97 | return (readl(&pChipcHw-> | ||
98 | ChipId) & chipcHw_REG_CHIPID_BASE_MASK) >> | ||
99 | chipcHw_REG_CHIPID_BASE_SHIFT; | ||
100 | } | ||
101 | |||
102 | /****************************************************************************/ | ||
103 | /** | ||
104 | * @brief Get revision number | ||
105 | * | ||
106 | * This function returns revision number of the chip | ||
107 | * | ||
108 | * @return Revision number | ||
109 | */ | ||
110 | /****************************************************************************/ | ||
111 | static inline chipcHw_REV_NUMBER_e chipcHw_getChipRevisionNumber(void) | ||
112 | { | ||
113 | return readl(&pChipcHw->ChipId) & chipcHw_REG_CHIPID_REV_MASK; | ||
114 | } | ||
115 | |||
116 | /****************************************************************************/ | ||
117 | /** | ||
118 | * @brief Enables bus interface clock | ||
119 | * | ||
120 | * Enables bus interface clock of various device | ||
121 | * | ||
122 | * @return void | ||
123 | * | ||
124 | * @note use chipcHw_REG_BUS_CLOCK_XXXX for mask | ||
125 | */ | ||
126 | /****************************************************************************/ | ||
127 | static inline void chipcHw_busInterfaceClockEnable(uint32_t mask) | ||
128 | { | ||
129 | reg32_modify_or(&pChipcHw->BusIntfClock, mask); | ||
130 | } | ||
131 | |||
132 | /****************************************************************************/ | ||
133 | /** | ||
134 | * @brief Disables bus interface clock | ||
135 | * | ||
136 | * Disables bus interface clock of various device | ||
137 | * | ||
138 | * @return void | ||
139 | * | ||
140 | * @note use chipcHw_REG_BUS_CLOCK_XXXX | ||
141 | */ | ||
142 | /****************************************************************************/ | ||
143 | static inline void chipcHw_busInterfaceClockDisable(uint32_t mask) | ||
144 | { | ||
145 | reg32_modify_and(&pChipcHw->BusIntfClock, ~mask); | ||
146 | } | ||
147 | |||
148 | /****************************************************************************/ | ||
149 | /** | ||
150 | * @brief Get status (enabled/disabled) of bus interface clock | ||
151 | * | ||
152 | * This function returns the status of devices' bus interface clock | ||
153 | * | ||
154 | * @return Bus interface clock | ||
155 | * | ||
156 | */ | ||
157 | /****************************************************************************/ | ||
158 | static inline uint32_t chipcHw_getBusInterfaceClockStatus(void) | ||
159 | { | ||
160 | return readl(&pChipcHw->BusIntfClock); | ||
161 | } | ||
162 | |||
163 | /****************************************************************************/ | ||
164 | /** | ||
165 | * @brief Enables various audio channels | ||
166 | * | ||
167 | * Enables audio channel | ||
168 | * | ||
169 | * @return void | ||
170 | * | ||
171 | * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX | ||
172 | */ | ||
173 | /****************************************************************************/ | ||
174 | static inline void chipcHw_audioChannelEnable(uint32_t mask) | ||
175 | { | ||
176 | reg32_modify_or(&pChipcHw->AudioEnable, mask); | ||
177 | } | ||
178 | |||
179 | /****************************************************************************/ | ||
180 | /** | ||
181 | * @brief Disables various audio channels | ||
182 | * | ||
183 | * Disables audio channel | ||
184 | * | ||
185 | * @return void | ||
186 | * | ||
187 | * @note use chipcHw_REG_AUDIO_CHANNEL_XXXXXX | ||
188 | */ | ||
189 | /****************************************************************************/ | ||
190 | static inline void chipcHw_audioChannelDisable(uint32_t mask) | ||
191 | { | ||
192 | reg32_modify_and(&pChipcHw->AudioEnable, ~mask); | ||
193 | } | ||
194 | |||
195 | /****************************************************************************/ | ||
196 | /** | ||
197 | * @brief Soft resets devices | ||
198 | * | ||
199 | * Soft resets various devices | ||
200 | * | ||
201 | * @return void | ||
202 | * | ||
203 | * @note use chipcHw_REG_SOFT_RESET_XXXXXX defines | ||
204 | */ | ||
205 | /****************************************************************************/ | ||
206 | static inline void chipcHw_softReset(uint64_t mask) | ||
207 | { | ||
208 | chipcHw_softResetEnable(mask); | ||
209 | chipcHw_softResetDisable(mask); | ||
210 | } | ||
211 | |||
212 | static inline void chipcHw_softResetDisable(uint64_t mask) | ||
213 | { | ||
214 | uint32_t ctrl1 = (uint32_t) mask; | ||
215 | uint32_t ctrl2 = (uint32_t) (mask >> 32); | ||
216 | |||
217 | /* Deassert module soft reset */ | ||
218 | REG_LOCAL_IRQ_SAVE; | ||
219 | writel(readl(&pChipcHw->SoftReset1) ^ ctrl1, &pChipcHw->SoftReset1); | ||
220 | writel(readl(&pChipcHw->SoftReset2) ^ (ctrl2 & | ||
221 | (~chipcHw_REG_SOFT_RESET_UNHOLD_MASK)), &pChipcHw->SoftReset2); | ||
222 | REG_LOCAL_IRQ_RESTORE; | ||
223 | } | ||
224 | |||
225 | static inline void chipcHw_softResetEnable(uint64_t mask) | ||
226 | { | ||
227 | uint32_t ctrl1 = (uint32_t) mask; | ||
228 | uint32_t ctrl2 = (uint32_t) (mask >> 32); | ||
229 | uint32_t unhold = 0; | ||
230 | |||
231 | REG_LOCAL_IRQ_SAVE; | ||
232 | writel(readl(&pChipcHw->SoftReset1) | ctrl1, &pChipcHw->SoftReset1); | ||
233 | /* Mask out unhold request bits */ | ||
234 | writel(readl(&pChipcHw->SoftReset2) | (ctrl2 & | ||
235 | (~chipcHw_REG_SOFT_RESET_UNHOLD_MASK)), &pChipcHw->SoftReset2); | ||
236 | |||
237 | /* Process unhold requests */ | ||
238 | if (ctrl2 & chipcHw_REG_SOFT_RESET_VPM_GLOBAL_UNHOLD) { | ||
239 | unhold = chipcHw_REG_SOFT_RESET_VPM_GLOBAL_HOLD; | ||
240 | } | ||
241 | |||
242 | if (ctrl2 & chipcHw_REG_SOFT_RESET_VPM_UNHOLD) { | ||
243 | unhold |= chipcHw_REG_SOFT_RESET_VPM_HOLD; | ||
244 | } | ||
245 | |||
246 | if (ctrl2 & chipcHw_REG_SOFT_RESET_ARM_UNHOLD) { | ||
247 | unhold |= chipcHw_REG_SOFT_RESET_ARM_HOLD; | ||
248 | } | ||
249 | |||
250 | if (unhold) { | ||
251 | /* Make sure unhold request is effective */ | ||
252 | writel(readl(&pChipcHw->SoftReset1) & ~unhold, &pChipcHw->SoftReset1); | ||
253 | } | ||
254 | REG_LOCAL_IRQ_RESTORE; | ||
255 | } | ||
256 | |||
257 | /****************************************************************************/ | ||
258 | /** | ||
259 | * @brief Configures misc CHIP functionality | ||
260 | * | ||
261 | * Configures CHIP functionality | ||
262 | * | ||
263 | * @return void | ||
264 | * | ||
265 | * @note use chipcHw_REG_MISC_CTRL_XXXXXX | ||
266 | */ | ||
267 | /****************************************************************************/ | ||
268 | static inline void chipcHw_miscControl(uint32_t mask) | ||
269 | { | ||
270 | reg32_write(&pChipcHw->MiscCtrl, mask); | ||
271 | } | ||
272 | |||
273 | static inline void chipcHw_miscControlDisable(uint32_t mask) | ||
274 | { | ||
275 | reg32_modify_and(&pChipcHw->MiscCtrl, ~mask); | ||
276 | } | ||
277 | |||
278 | static inline void chipcHw_miscControlEnable(uint32_t mask) | ||
279 | { | ||
280 | reg32_modify_or(&pChipcHw->MiscCtrl, mask); | ||
281 | } | ||
282 | |||
283 | /****************************************************************************/ | ||
284 | /** | ||
285 | * @brief Set OTP options | ||
286 | * | ||
287 | * Set OTP options | ||
288 | * | ||
289 | * @return void | ||
290 | * | ||
291 | * @note use chipcHw_REG_OTP_XXXXXX | ||
292 | */ | ||
293 | /****************************************************************************/ | ||
294 | static inline void chipcHw_setOTPOption(uint64_t mask) | ||
295 | { | ||
296 | uint32_t ctrl1 = (uint32_t) mask; | ||
297 | uint32_t ctrl2 = (uint32_t) (mask >> 32); | ||
298 | |||
299 | reg32_modify_or(&pChipcHw->SoftOTP1, ctrl1); | ||
300 | reg32_modify_or(&pChipcHw->SoftOTP2, ctrl2); | ||
301 | } | ||
302 | |||
303 | /****************************************************************************/ | ||
304 | /** | ||
305 | * @brief Get sticky bits | ||
306 | * | ||
307 | * @return Sticky bit options of type chipcHw_REG_STICKY_XXXXXX | ||
308 | * | ||
309 | */ | ||
310 | /****************************************************************************/ | ||
311 | static inline uint32_t chipcHw_getStickyBits(void) | ||
312 | { | ||
313 | return readl(&pChipcHw->Sticky); | ||
314 | } | ||
315 | |||
316 | /****************************************************************************/ | ||
317 | /** | ||
318 | * @brief Set sticky bits | ||
319 | * | ||
320 | * @return void | ||
321 | * | ||
322 | * @note use chipcHw_REG_STICKY_XXXXXX | ||
323 | */ | ||
324 | /****************************************************************************/ | ||
325 | static inline void chipcHw_setStickyBits(uint32_t mask) | ||
326 | { | ||
327 | uint32_t bits = 0; | ||
328 | |||
329 | REG_LOCAL_IRQ_SAVE; | ||
330 | if (mask & chipcHw_REG_STICKY_POR_BROM) { | ||
331 | bits |= chipcHw_REG_STICKY_POR_BROM; | ||
332 | } else { | ||
333 | uint32_t sticky; | ||
334 | sticky = readl(pChipcHw->Sticky); | ||
335 | |||
336 | if ((mask & chipcHw_REG_STICKY_BOOT_DONE) | ||
337 | && (sticky & chipcHw_REG_STICKY_BOOT_DONE) == 0) { | ||
338 | bits |= chipcHw_REG_STICKY_BOOT_DONE; | ||
339 | } | ||
340 | if ((mask & chipcHw_REG_STICKY_GENERAL_1) | ||
341 | && (sticky & chipcHw_REG_STICKY_GENERAL_1) == 0) { | ||
342 | bits |= chipcHw_REG_STICKY_GENERAL_1; | ||
343 | } | ||
344 | if ((mask & chipcHw_REG_STICKY_GENERAL_2) | ||
345 | && (sticky & chipcHw_REG_STICKY_GENERAL_2) == 0) { | ||
346 | bits |= chipcHw_REG_STICKY_GENERAL_2; | ||
347 | } | ||
348 | if ((mask & chipcHw_REG_STICKY_GENERAL_3) | ||
349 | && (sticky & chipcHw_REG_STICKY_GENERAL_3) == 0) { | ||
350 | bits |= chipcHw_REG_STICKY_GENERAL_3; | ||
351 | } | ||
352 | if ((mask & chipcHw_REG_STICKY_GENERAL_4) | ||
353 | && (sticky & chipcHw_REG_STICKY_GENERAL_4) == 0) { | ||
354 | bits |= chipcHw_REG_STICKY_GENERAL_4; | ||
355 | } | ||
356 | if ((mask & chipcHw_REG_STICKY_GENERAL_5) | ||
357 | && (sticky & chipcHw_REG_STICKY_GENERAL_5) == 0) { | ||
358 | bits |= chipcHw_REG_STICKY_GENERAL_5; | ||
359 | } | ||
360 | } | ||
361 | writel(bits, pChipcHw->Sticky); | ||
362 | REG_LOCAL_IRQ_RESTORE; | ||
363 | } | ||
364 | |||
365 | /****************************************************************************/ | ||
366 | /** | ||
367 | * @brief Clear sticky bits | ||
368 | * | ||
369 | * @return void | ||
370 | * | ||
371 | * @note use chipcHw_REG_STICKY_XXXXXX | ||
372 | */ | ||
373 | /****************************************************************************/ | ||
374 | static inline void chipcHw_clearStickyBits(uint32_t mask) | ||
375 | { | ||
376 | uint32_t bits = 0; | ||
377 | |||
378 | REG_LOCAL_IRQ_SAVE; | ||
379 | if (mask & | ||
380 | (chipcHw_REG_STICKY_BOOT_DONE | chipcHw_REG_STICKY_GENERAL_1 | | ||
381 | chipcHw_REG_STICKY_GENERAL_2 | chipcHw_REG_STICKY_GENERAL_3 | | ||
382 | chipcHw_REG_STICKY_GENERAL_4 | chipcHw_REG_STICKY_GENERAL_5)) { | ||
383 | uint32_t sticky = readl(&pChipcHw->Sticky); | ||
384 | |||
385 | if ((mask & chipcHw_REG_STICKY_BOOT_DONE) | ||
386 | && (sticky & chipcHw_REG_STICKY_BOOT_DONE)) { | ||
387 | bits = chipcHw_REG_STICKY_BOOT_DONE; | ||
388 | mask &= ~chipcHw_REG_STICKY_BOOT_DONE; | ||
389 | } | ||
390 | if ((mask & chipcHw_REG_STICKY_GENERAL_1) | ||
391 | && (sticky & chipcHw_REG_STICKY_GENERAL_1)) { | ||
392 | bits |= chipcHw_REG_STICKY_GENERAL_1; | ||
393 | mask &= ~chipcHw_REG_STICKY_GENERAL_1; | ||
394 | } | ||
395 | if ((mask & chipcHw_REG_STICKY_GENERAL_2) | ||
396 | && (sticky & chipcHw_REG_STICKY_GENERAL_2)) { | ||
397 | bits |= chipcHw_REG_STICKY_GENERAL_2; | ||
398 | mask &= ~chipcHw_REG_STICKY_GENERAL_2; | ||
399 | } | ||
400 | if ((mask & chipcHw_REG_STICKY_GENERAL_3) | ||
401 | && (sticky & chipcHw_REG_STICKY_GENERAL_3)) { | ||
402 | bits |= chipcHw_REG_STICKY_GENERAL_3; | ||
403 | mask &= ~chipcHw_REG_STICKY_GENERAL_3; | ||
404 | } | ||
405 | if ((mask & chipcHw_REG_STICKY_GENERAL_4) | ||
406 | && (sticky & chipcHw_REG_STICKY_GENERAL_4)) { | ||
407 | bits |= chipcHw_REG_STICKY_GENERAL_4; | ||
408 | mask &= ~chipcHw_REG_STICKY_GENERAL_4; | ||
409 | } | ||
410 | if ((mask & chipcHw_REG_STICKY_GENERAL_5) | ||
411 | && (sticky & chipcHw_REG_STICKY_GENERAL_5)) { | ||
412 | bits |= chipcHw_REG_STICKY_GENERAL_5; | ||
413 | mask &= ~chipcHw_REG_STICKY_GENERAL_5; | ||
414 | } | ||
415 | } | ||
416 | writel(bits | mask, &pChipcHw->Sticky); | ||
417 | REG_LOCAL_IRQ_RESTORE; | ||
418 | } | ||
419 | |||
420 | /****************************************************************************/ | ||
421 | /** | ||
422 | * @brief Get software strap value | ||
423 | * | ||
424 | * Retrieves software strap value | ||
425 | * | ||
426 | * @return Software strap value | ||
427 | * | ||
428 | */ | ||
429 | /****************************************************************************/ | ||
430 | static inline uint32_t chipcHw_getSoftStraps(void) | ||
431 | { | ||
432 | return readl(&pChipcHw->SoftStraps); | ||
433 | } | ||
434 | |||
435 | /****************************************************************************/ | ||
436 | /** | ||
437 | * @brief Set software override strap options | ||
438 | * | ||
439 | * set software override strap options | ||
440 | * | ||
441 | * @return nothing | ||
442 | * | ||
443 | */ | ||
444 | /****************************************************************************/ | ||
445 | static inline void chipcHw_setSoftStraps(uint32_t strapOptions) | ||
446 | { | ||
447 | reg32_write(&pChipcHw->SoftStraps, strapOptions); | ||
448 | } | ||
449 | |||
450 | /****************************************************************************/ | ||
451 | /** | ||
452 | * @brief Get Pin Strap Options | ||
453 | * | ||
454 | * This function returns the raw boot strap options | ||
455 | * | ||
456 | * @return strap options | ||
457 | * | ||
458 | */ | ||
459 | /****************************************************************************/ | ||
460 | static inline uint32_t chipcHw_getPinStraps(void) | ||
461 | { | ||
462 | return readl(&pChipcHw->PinStraps); | ||
463 | } | ||
464 | |||
465 | /****************************************************************************/ | ||
466 | /** | ||
467 | * @brief Get Valid Strap Options | ||
468 | * | ||
469 | * This function returns the valid raw boot strap options | ||
470 | * | ||
471 | * @return strap options | ||
472 | * | ||
473 | */ | ||
474 | /****************************************************************************/ | ||
475 | static inline uint32_t chipcHw_getValidStraps(void) | ||
476 | { | ||
477 | uint32_t softStraps; | ||
478 | |||
479 | /* | ||
480 | ** Always return the SoftStraps - bootROM calls chipcHw_initValidStraps | ||
481 | ** which copies HW straps to soft straps if there is no override | ||
482 | */ | ||
483 | softStraps = chipcHw_getSoftStraps(); | ||
484 | |||
485 | return softStraps; | ||
486 | } | ||
487 | |||
488 | /****************************************************************************/ | ||
489 | /** | ||
490 | * @brief Initialize valid pin strap options | ||
491 | * | ||
492 | * Retrieves valid pin strap options by copying HW strap options to soft register | ||
493 | * (if chipcHw_STRAPS_SOFT_OVERRIDE not set) | ||
494 | * | ||
495 | * @return nothing | ||
496 | * | ||
497 | */ | ||
498 | /****************************************************************************/ | ||
499 | static inline void chipcHw_initValidStraps(void) | ||
500 | { | ||
501 | uint32_t softStraps; | ||
502 | |||
503 | REG_LOCAL_IRQ_SAVE; | ||
504 | softStraps = chipcHw_getSoftStraps(); | ||
505 | |||
506 | if ((softStraps & chipcHw_STRAPS_SOFT_OVERRIDE) == 0) { | ||
507 | /* Copy HW straps to software straps */ | ||
508 | chipcHw_setSoftStraps(chipcHw_getPinStraps()); | ||
509 | } | ||
510 | REG_LOCAL_IRQ_RESTORE; | ||
511 | } | ||
512 | |||
513 | /****************************************************************************/ | ||
514 | /** | ||
515 | * @brief Get boot device | ||
516 | * | ||
517 | * This function returns the device type used in booting the system | ||
518 | * | ||
519 | * @return Boot device of type chipcHw_BOOT_DEVICE | ||
520 | * | ||
521 | */ | ||
522 | /****************************************************************************/ | ||
523 | static inline chipcHw_BOOT_DEVICE_e chipcHw_getBootDevice(void) | ||
524 | { | ||
525 | return chipcHw_getValidStraps() & chipcHw_STRAPS_BOOT_DEVICE_MASK; | ||
526 | } | ||
527 | |||
528 | /****************************************************************************/ | ||
529 | /** | ||
530 | * @brief Get boot mode | ||
531 | * | ||
532 | * This function returns the way the system was booted | ||
533 | * | ||
534 | * @return Boot mode of type chipcHw_BOOT_MODE | ||
535 | * | ||
536 | */ | ||
537 | /****************************************************************************/ | ||
538 | static inline chipcHw_BOOT_MODE_e chipcHw_getBootMode(void) | ||
539 | { | ||
540 | return chipcHw_getValidStraps() & chipcHw_STRAPS_BOOT_MODE_MASK; | ||
541 | } | ||
542 | |||
543 | /****************************************************************************/ | ||
544 | /** | ||
545 | * @brief Get NAND flash page size | ||
546 | * | ||
547 | * This function returns the NAND device page size | ||
548 | * | ||
549 | * @return Boot NAND device page size | ||
550 | * | ||
551 | */ | ||
552 | /****************************************************************************/ | ||
553 | static inline chipcHw_NAND_PAGESIZE_e chipcHw_getNandPageSize(void) | ||
554 | { | ||
555 | return chipcHw_getValidStraps() & chipcHw_STRAPS_NAND_PAGESIZE_MASK; | ||
556 | } | ||
557 | |||
558 | /****************************************************************************/ | ||
559 | /** | ||
560 | * @brief Get NAND flash address cycle configuration | ||
561 | * | ||
562 | * This function returns the NAND flash address cycle configuration | ||
563 | * | ||
564 | * @return 0 = Do not extra address cycle, 1 = Add extra cycle | ||
565 | * | ||
566 | */ | ||
567 | /****************************************************************************/ | ||
568 | static inline int chipcHw_getNandExtraCycle(void) | ||
569 | { | ||
570 | if (chipcHw_getValidStraps() & chipcHw_STRAPS_NAND_EXTRA_CYCLE) { | ||
571 | return 1; | ||
572 | } else { | ||
573 | return 0; | ||
574 | } | ||
575 | } | ||
576 | |||
577 | /****************************************************************************/ | ||
578 | /** | ||
579 | * @brief Activates PIF interface | ||
580 | * | ||
581 | * This function activates PIF interface by taking control of LCD pins | ||
582 | * | ||
583 | * @note | ||
584 | * When activated, LCD pins will be defined as follows for PIF operation | ||
585 | * | ||
586 | * CLD[17:0] = pif_data[17:0] | ||
587 | * CLD[23:18] = pif_address[5:0] | ||
588 | * CLPOWER = pif_wr_str | ||
589 | * CLCP = pif_rd_str | ||
590 | * CLAC = pif_hat1 | ||
591 | * CLFP = pif_hrdy1 | ||
592 | * CLLP = pif_hat2 | ||
593 | * GPIO[42] = pif_hrdy2 | ||
594 | * | ||
595 | * In PIF mode, "pif_hrdy2" overrides other shared function for GPIO[42] pin | ||
596 | * | ||
597 | */ | ||
598 | /****************************************************************************/ | ||
599 | static inline void chipcHw_activatePifInterface(void) | ||
600 | { | ||
601 | reg32_write(&pChipcHw->LcdPifMode, chipcHw_REG_PIF_PIN_ENABLE); | ||
602 | } | ||
603 | |||
604 | /****************************************************************************/ | ||
605 | /** | ||
606 | * @brief Activates LCD interface | ||
607 | * | ||
608 | * This function activates LCD interface | ||
609 | * | ||
610 | * @note | ||
611 | * When activated, LCD pins will be defined as follows | ||
612 | * | ||
613 | * CLD[17:0] = LCD data | ||
614 | * CLD[23:18] = LCD data | ||
615 | * CLPOWER = LCD power | ||
616 | * CLCP = | ||
617 | * CLAC = LCD ack | ||
618 | * CLFP = | ||
619 | * CLLP = | ||
620 | */ | ||
621 | /****************************************************************************/ | ||
622 | static inline void chipcHw_activateLcdInterface(void) | ||
623 | { | ||
624 | reg32_write(&pChipcHw->LcdPifMode, chipcHw_REG_LCD_PIN_ENABLE); | ||
625 | } | ||
626 | |||
627 | /****************************************************************************/ | ||
628 | /** | ||
629 | * @brief Deactivates PIF/LCD interface | ||
630 | * | ||
631 | * This function deactivates PIF/LCD interface | ||
632 | * | ||
633 | * @note | ||
634 | * When deactivated LCD pins will be in rti-stated | ||
635 | * | ||
636 | */ | ||
637 | /****************************************************************************/ | ||
638 | static inline void chipcHw_deactivatePifLcdInterface(void) | ||
639 | { | ||
640 | reg32_write(&pChipcHw->LcdPifMode, 0); | ||
641 | } | ||
642 | |||
643 | /****************************************************************************/ | ||
644 | /** | ||
645 | * @brief Select GE2 | ||
646 | * | ||
647 | * This function select GE2 as the graphic engine | ||
648 | * | ||
649 | */ | ||
650 | /****************************************************************************/ | ||
651 | static inline void chipcHw_selectGE2(void) | ||
652 | { | ||
653 | reg32_modify_and(&pChipcHw->MiscCtrl, ~chipcHw_REG_MISC_CTRL_GE_SEL); | ||
654 | } | ||
655 | |||
656 | /****************************************************************************/ | ||
657 | /** | ||
658 | * @brief Select GE3 | ||
659 | * | ||
660 | * This function select GE3 as the graphic engine | ||
661 | * | ||
662 | */ | ||
663 | /****************************************************************************/ | ||
664 | static inline void chipcHw_selectGE3(void) | ||
665 | { | ||
666 | reg32_modify_or(&pChipcHw->MiscCtrl, chipcHw_REG_MISC_CTRL_GE_SEL); | ||
667 | } | ||
668 | |||
669 | /****************************************************************************/ | ||
670 | /** | ||
671 | * @brief Get to know the configuration of GPIO pin | ||
672 | * | ||
673 | */ | ||
674 | /****************************************************************************/ | ||
675 | static inline chipcHw_GPIO_FUNCTION_e chipcHw_getGpioPinFunction(int pin) | ||
676 | { | ||
677 | return (readl(chipcHw_REG_GPIO_MUX(pin))) & | ||
678 | (chipcHw_REG_GPIO_MUX_MASK << | ||
679 | chipcHw_REG_GPIO_MUX_POSITION(pin)) >> | ||
680 | chipcHw_REG_GPIO_MUX_POSITION(pin); | ||
681 | } | ||
682 | |||
683 | /****************************************************************************/ | ||
684 | /** | ||
685 | * @brief Configure GPIO pin function | ||
686 | * | ||
687 | */ | ||
688 | /****************************************************************************/ | ||
689 | static inline void chipcHw_setGpioPinFunction(int pin, | ||
690 | chipcHw_GPIO_FUNCTION_e func) | ||
691 | { | ||
692 | REG_LOCAL_IRQ_SAVE; | ||
693 | *((uint32_t *) chipcHw_REG_GPIO_MUX(pin)) &= | ||
694 | ~(chipcHw_REG_GPIO_MUX_MASK << chipcHw_REG_GPIO_MUX_POSITION(pin)); | ||
695 | *((uint32_t *) chipcHw_REG_GPIO_MUX(pin)) |= | ||
696 | func << chipcHw_REG_GPIO_MUX_POSITION(pin); | ||
697 | REG_LOCAL_IRQ_RESTORE; | ||
698 | } | ||
699 | |||
700 | /****************************************************************************/ | ||
701 | /** | ||
702 | * @brief Set Pin slew rate | ||
703 | * | ||
704 | * This function sets the slew of individual pin | ||
705 | * | ||
706 | */ | ||
707 | /****************************************************************************/ | ||
708 | static inline void chipcHw_setPinSlewRate(uint32_t pin, | ||
709 | chipcHw_PIN_SLEW_RATE_e slewRate) | ||
710 | { | ||
711 | REG_LOCAL_IRQ_SAVE; | ||
712 | *((uint32_t *) chipcHw_REG_SLEW_RATE(pin)) &= | ||
713 | ~(chipcHw_REG_SLEW_RATE_MASK << | ||
714 | chipcHw_REG_SLEW_RATE_POSITION(pin)); | ||
715 | *((uint32_t *) chipcHw_REG_SLEW_RATE(pin)) |= | ||
716 | (uint32_t) slewRate << chipcHw_REG_SLEW_RATE_POSITION(pin); | ||
717 | REG_LOCAL_IRQ_RESTORE; | ||
718 | } | ||
719 | |||
720 | /****************************************************************************/ | ||
721 | /** | ||
722 | * @brief Set Pin output drive current | ||
723 | * | ||
724 | * This function sets output drive current of individual pin | ||
725 | * | ||
726 | * Note: Avoid the use of the word 'current' since linux headers define this | ||
727 | * to be the current task. | ||
728 | */ | ||
729 | /****************************************************************************/ | ||
730 | static inline void chipcHw_setPinOutputCurrent(uint32_t pin, | ||
731 | chipcHw_PIN_CURRENT_STRENGTH_e | ||
732 | curr) | ||
733 | { | ||
734 | REG_LOCAL_IRQ_SAVE; | ||
735 | *((uint32_t *) chipcHw_REG_CURRENT(pin)) &= | ||
736 | ~(chipcHw_REG_CURRENT_MASK << chipcHw_REG_CURRENT_POSITION(pin)); | ||
737 | *((uint32_t *) chipcHw_REG_CURRENT(pin)) |= | ||
738 | (uint32_t) curr << chipcHw_REG_CURRENT_POSITION(pin); | ||
739 | REG_LOCAL_IRQ_RESTORE; | ||
740 | } | ||
741 | |||
742 | /****************************************************************************/ | ||
743 | /** | ||
744 | * @brief Set Pin pullup register | ||
745 | * | ||
746 | * This function sets pullup register of individual pin | ||
747 | * | ||
748 | */ | ||
749 | /****************************************************************************/ | ||
750 | static inline void chipcHw_setPinPullup(uint32_t pin, chipcHw_PIN_PULL_e pullup) | ||
751 | { | ||
752 | REG_LOCAL_IRQ_SAVE; | ||
753 | *((uint32_t *) chipcHw_REG_PULLUP(pin)) &= | ||
754 | ~(chipcHw_REG_PULLUP_MASK << chipcHw_REG_PULLUP_POSITION(pin)); | ||
755 | *((uint32_t *) chipcHw_REG_PULLUP(pin)) |= | ||
756 | (uint32_t) pullup << chipcHw_REG_PULLUP_POSITION(pin); | ||
757 | REG_LOCAL_IRQ_RESTORE; | ||
758 | } | ||
759 | |||
760 | /****************************************************************************/ | ||
761 | /** | ||
762 | * @brief Set Pin input type | ||
763 | * | ||
764 | * This function sets input type of individual pin | ||
765 | * | ||
766 | */ | ||
767 | /****************************************************************************/ | ||
768 | static inline void chipcHw_setPinInputType(uint32_t pin, | ||
769 | chipcHw_PIN_INPUTTYPE_e inputType) | ||
770 | { | ||
771 | REG_LOCAL_IRQ_SAVE; | ||
772 | *((uint32_t *) chipcHw_REG_INPUTTYPE(pin)) &= | ||
773 | ~(chipcHw_REG_INPUTTYPE_MASK << | ||
774 | chipcHw_REG_INPUTTYPE_POSITION(pin)); | ||
775 | *((uint32_t *) chipcHw_REG_INPUTTYPE(pin)) |= | ||
776 | (uint32_t) inputType << chipcHw_REG_INPUTTYPE_POSITION(pin); | ||
777 | REG_LOCAL_IRQ_RESTORE; | ||
778 | } | ||
779 | |||
780 | /****************************************************************************/ | ||
781 | /** | ||
782 | * @brief Power up the USB PHY | ||
783 | * | ||
784 | * This function powers up the USB PHY | ||
785 | * | ||
786 | */ | ||
787 | /****************************************************************************/ | ||
788 | static inline void chipcHw_powerUpUsbPhy(void) | ||
789 | { | ||
790 | reg32_modify_and(&pChipcHw->MiscCtrl, | ||
791 | chipcHw_REG_MISC_CTRL_USB_POWERON); | ||
792 | } | ||
793 | |||
794 | /****************************************************************************/ | ||
795 | /** | ||
796 | * @brief Power down the USB PHY | ||
797 | * | ||
798 | * This function powers down the USB PHY | ||
799 | * | ||
800 | */ | ||
801 | /****************************************************************************/ | ||
802 | static inline void chipcHw_powerDownUsbPhy(void) | ||
803 | { | ||
804 | reg32_modify_or(&pChipcHw->MiscCtrl, | ||
805 | chipcHw_REG_MISC_CTRL_USB_POWEROFF); | ||
806 | } | ||
807 | |||
808 | /****************************************************************************/ | ||
809 | /** | ||
810 | * @brief Set the 2nd USB as host | ||
811 | * | ||
812 | * This function sets the 2nd USB as host | ||
813 | * | ||
814 | */ | ||
815 | /****************************************************************************/ | ||
816 | static inline void chipcHw_setUsbHost(void) | ||
817 | { | ||
818 | reg32_modify_or(&pChipcHw->MiscCtrl, | ||
819 | chipcHw_REG_MISC_CTRL_USB_MODE_HOST); | ||
820 | } | ||
821 | |||
822 | /****************************************************************************/ | ||
823 | /** | ||
824 | * @brief Set the 2nd USB as device | ||
825 | * | ||
826 | * This function sets the 2nd USB as device | ||
827 | * | ||
828 | */ | ||
829 | /****************************************************************************/ | ||
830 | static inline void chipcHw_setUsbDevice(void) | ||
831 | { | ||
832 | reg32_modify_and(&pChipcHw->MiscCtrl, | ||
833 | chipcHw_REG_MISC_CTRL_USB_MODE_DEVICE); | ||
834 | } | ||
835 | |||
836 | /****************************************************************************/ | ||
837 | /** | ||
838 | * @brief Lower layer function to enable/disable a clock of a certain device | ||
839 | * | ||
840 | * This function enables/disables a core clock | ||
841 | * | ||
842 | */ | ||
843 | /****************************************************************************/ | ||
844 | static inline void chipcHw_setClock(chipcHw_CLOCK_e clock, | ||
845 | chipcHw_OPTYPE_e type, int mode) | ||
846 | { | ||
847 | uint32_t __iomem *pPLLReg = NULL; | ||
848 | uint32_t __iomem *pClockCtrl = NULL; | ||
849 | |||
850 | switch (clock) { | ||
851 | case chipcHw_CLOCK_DDR: | ||
852 | pPLLReg = &pChipcHw->DDRClock; | ||
853 | break; | ||
854 | case chipcHw_CLOCK_ARM: | ||
855 | pPLLReg = &pChipcHw->ARMClock; | ||
856 | break; | ||
857 | case chipcHw_CLOCK_ESW: | ||
858 | pPLLReg = &pChipcHw->ESWClock; | ||
859 | break; | ||
860 | case chipcHw_CLOCK_VPM: | ||
861 | pPLLReg = &pChipcHw->VPMClock; | ||
862 | break; | ||
863 | case chipcHw_CLOCK_ESW125: | ||
864 | pPLLReg = &pChipcHw->ESW125Clock; | ||
865 | break; | ||
866 | case chipcHw_CLOCK_UART: | ||
867 | pPLLReg = &pChipcHw->UARTClock; | ||
868 | break; | ||
869 | case chipcHw_CLOCK_SDIO0: | ||
870 | pPLLReg = &pChipcHw->SDIO0Clock; | ||
871 | break; | ||
872 | case chipcHw_CLOCK_SDIO1: | ||
873 | pPLLReg = &pChipcHw->SDIO1Clock; | ||
874 | break; | ||
875 | case chipcHw_CLOCK_SPI: | ||
876 | pPLLReg = &pChipcHw->SPIClock; | ||
877 | break; | ||
878 | case chipcHw_CLOCK_ETM: | ||
879 | pPLLReg = &pChipcHw->ETMClock; | ||
880 | break; | ||
881 | case chipcHw_CLOCK_USB: | ||
882 | pPLLReg = &pChipcHw->USBClock; | ||
883 | if (type == chipcHw_OPTYPE_OUTPUT) { | ||
884 | if (mode) { | ||
885 | reg32_modify_and(pPLLReg, | ||
886 | ~chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
887 | } else { | ||
888 | reg32_modify_or(pPLLReg, | ||
889 | chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
890 | } | ||
891 | } | ||
892 | break; | ||
893 | case chipcHw_CLOCK_LCD: | ||
894 | pPLLReg = &pChipcHw->LCDClock; | ||
895 | if (type == chipcHw_OPTYPE_OUTPUT) { | ||
896 | if (mode) { | ||
897 | reg32_modify_and(pPLLReg, | ||
898 | ~chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
899 | } else { | ||
900 | reg32_modify_or(pPLLReg, | ||
901 | chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
902 | } | ||
903 | } | ||
904 | break; | ||
905 | case chipcHw_CLOCK_APM: | ||
906 | pPLLReg = &pChipcHw->APMClock; | ||
907 | if (type == chipcHw_OPTYPE_OUTPUT) { | ||
908 | if (mode) { | ||
909 | reg32_modify_and(pPLLReg, | ||
910 | ~chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
911 | } else { | ||
912 | reg32_modify_or(pPLLReg, | ||
913 | chipcHw_REG_PLL_CLOCK_POWER_DOWN); | ||
914 | } | ||
915 | } | ||
916 | break; | ||
917 | case chipcHw_CLOCK_BUS: | ||
918 | pClockCtrl = &pChipcHw->ACLKClock; | ||
919 | break; | ||
920 | case chipcHw_CLOCK_OTP: | ||
921 | pClockCtrl = &pChipcHw->OTPClock; | ||
922 | break; | ||
923 | case chipcHw_CLOCK_I2C: | ||
924 | pClockCtrl = &pChipcHw->I2CClock; | ||
925 | break; | ||
926 | case chipcHw_CLOCK_I2S0: | ||
927 | pClockCtrl = &pChipcHw->I2S0Clock; | ||
928 | break; | ||
929 | case chipcHw_CLOCK_RTBUS: | ||
930 | pClockCtrl = &pChipcHw->RTBUSClock; | ||
931 | break; | ||
932 | case chipcHw_CLOCK_APM100: | ||
933 | pClockCtrl = &pChipcHw->APM100Clock; | ||
934 | break; | ||
935 | case chipcHw_CLOCK_TSC: | ||
936 | pClockCtrl = &pChipcHw->TSCClock; | ||
937 | break; | ||
938 | case chipcHw_CLOCK_LED: | ||
939 | pClockCtrl = &pChipcHw->LEDClock; | ||
940 | break; | ||
941 | case chipcHw_CLOCK_I2S1: | ||
942 | pClockCtrl = &pChipcHw->I2S1Clock; | ||
943 | break; | ||
944 | } | ||
945 | |||
946 | if (pPLLReg) { | ||
947 | switch (type) { | ||
948 | case chipcHw_OPTYPE_OUTPUT: | ||
949 | /* PLL clock output enable/disable */ | ||
950 | if (mode) { | ||
951 | if (clock == chipcHw_CLOCK_DDR) { | ||
952 | /* DDR clock enable is inverted */ | ||
953 | reg32_modify_and(pPLLReg, | ||
954 | ~chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE); | ||
955 | } else { | ||
956 | reg32_modify_or(pPLLReg, | ||
957 | chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE); | ||
958 | } | ||
959 | } else { | ||
960 | if (clock == chipcHw_CLOCK_DDR) { | ||
961 | /* DDR clock disable is inverted */ | ||
962 | reg32_modify_or(pPLLReg, | ||
963 | chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE); | ||
964 | } else { | ||
965 | reg32_modify_and(pPLLReg, | ||
966 | ~chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE); | ||
967 | } | ||
968 | } | ||
969 | break; | ||
970 | case chipcHw_OPTYPE_BYPASS: | ||
971 | /* PLL clock bypass enable/disable */ | ||
972 | if (mode) { | ||
973 | reg32_modify_or(pPLLReg, | ||
974 | chipcHw_REG_PLL_CLOCK_BYPASS_SELECT); | ||
975 | } else { | ||
976 | reg32_modify_and(pPLLReg, | ||
977 | ~chipcHw_REG_PLL_CLOCK_BYPASS_SELECT); | ||
978 | } | ||
979 | break; | ||
980 | } | ||
981 | } else if (pClockCtrl) { | ||
982 | switch (type) { | ||
983 | case chipcHw_OPTYPE_OUTPUT: | ||
984 | if (mode) { | ||
985 | reg32_modify_or(pClockCtrl, | ||
986 | chipcHw_REG_DIV_CLOCK_OUTPUT_ENABLE); | ||
987 | } else { | ||
988 | reg32_modify_and(pClockCtrl, | ||
989 | ~chipcHw_REG_DIV_CLOCK_OUTPUT_ENABLE); | ||
990 | } | ||
991 | break; | ||
992 | case chipcHw_OPTYPE_BYPASS: | ||
993 | if (mode) { | ||
994 | reg32_modify_or(pClockCtrl, | ||
995 | chipcHw_REG_DIV_CLOCK_BYPASS_SELECT); | ||
996 | } else { | ||
997 | reg32_modify_and(pClockCtrl, | ||
998 | ~chipcHw_REG_DIV_CLOCK_BYPASS_SELECT); | ||
999 | } | ||
1000 | break; | ||
1001 | } | ||
1002 | } | ||
1003 | } | ||
1004 | |||
1005 | /****************************************************************************/ | ||
1006 | /** | ||
1007 | * @brief Disables a core clock of a certain device | ||
1008 | * | ||
1009 | * This function disables a core clock | ||
1010 | * | ||
1011 | * @note no change in power consumption | ||
1012 | */ | ||
1013 | /****************************************************************************/ | ||
1014 | static inline void chipcHw_setClockDisable(chipcHw_CLOCK_e clock) | ||
1015 | { | ||
1016 | |||
1017 | /* Disable output of the clock */ | ||
1018 | chipcHw_setClock(clock, chipcHw_OPTYPE_OUTPUT, 0); | ||
1019 | } | ||
1020 | |||
1021 | /****************************************************************************/ | ||
1022 | /** | ||
1023 | * @brief Enable a core clock of a certain device | ||
1024 | * | ||
1025 | * This function enables a core clock | ||
1026 | * | ||
1027 | * @note no change in power consumption | ||
1028 | */ | ||
1029 | /****************************************************************************/ | ||
1030 | static inline void chipcHw_setClockEnable(chipcHw_CLOCK_e clock) | ||
1031 | { | ||
1032 | |||
1033 | /* Enable output of the clock */ | ||
1034 | chipcHw_setClock(clock, chipcHw_OPTYPE_OUTPUT, 1); | ||
1035 | } | ||
1036 | |||
1037 | /****************************************************************************/ | ||
1038 | /** | ||
1039 | * @brief Enables bypass clock of a certain device | ||
1040 | * | ||
1041 | * This function enables bypass clock | ||
1042 | * | ||
1043 | * @note Doesnot affect the bus interface clock | ||
1044 | */ | ||
1045 | /****************************************************************************/ | ||
1046 | static inline void chipcHw_bypassClockEnable(chipcHw_CLOCK_e clock) | ||
1047 | { | ||
1048 | /* Enable bypass clock */ | ||
1049 | chipcHw_setClock(clock, chipcHw_OPTYPE_BYPASS, 1); | ||
1050 | } | ||
1051 | |||
1052 | /****************************************************************************/ | ||
1053 | /** | ||
1054 | * @brief Disabled bypass clock of a certain device | ||
1055 | * | ||
1056 | * This function disables bypass clock | ||
1057 | * | ||
1058 | * @note Doesnot affect the bus interface clock | ||
1059 | */ | ||
1060 | /****************************************************************************/ | ||
1061 | static inline void chipcHw_bypassClockDisable(chipcHw_CLOCK_e clock) | ||
1062 | { | ||
1063 | /* Disable bypass clock */ | ||
1064 | chipcHw_setClock(clock, chipcHw_OPTYPE_BYPASS, 0); | ||
1065 | |||
1066 | } | ||
1067 | |||
1068 | /****************************************************************************/ | ||
1069 | /** @brief Checks if software strap is enabled | ||
1070 | * | ||
1071 | * @return 1 : When enable | ||
1072 | * 0 : When disable | ||
1073 | */ | ||
1074 | /****************************************************************************/ | ||
1075 | static inline int chipcHw_isSoftwareStrapsEnable(void) | ||
1076 | { | ||
1077 | return readl(&pChipcHw->SoftStraps) & 0x00000001; | ||
1078 | } | ||
1079 | |||
1080 | /****************************************************************************/ | ||
1081 | /** @brief Enable software strap | ||
1082 | */ | ||
1083 | /****************************************************************************/ | ||
1084 | static inline void chipcHw_softwareStrapsEnable(void) | ||
1085 | { | ||
1086 | reg32_modify_or(&pChipcHw->SoftStraps, 0x00000001); | ||
1087 | } | ||
1088 | |||
1089 | /****************************************************************************/ | ||
1090 | /** @brief Disable software strap | ||
1091 | */ | ||
1092 | /****************************************************************************/ | ||
1093 | static inline void chipcHw_softwareStrapsDisable(void) | ||
1094 | { | ||
1095 | reg32_modify_and(&pChipcHw->SoftStraps, (~0x00000001)); | ||
1096 | } | ||
1097 | |||
1098 | /****************************************************************************/ | ||
1099 | /** @brief PLL test enable | ||
1100 | */ | ||
1101 | /****************************************************************************/ | ||
1102 | static inline void chipcHw_pllTestEnable(void) | ||
1103 | { | ||
1104 | reg32_modify_or(&pChipcHw->PLLConfig, | ||
1105 | chipcHw_REG_PLL_CONFIG_TEST_ENABLE); | ||
1106 | } | ||
1107 | |||
1108 | /****************************************************************************/ | ||
1109 | /** @brief PLL2 test enable | ||
1110 | */ | ||
1111 | /****************************************************************************/ | ||
1112 | static inline void chipcHw_pll2TestEnable(void) | ||
1113 | { | ||
1114 | reg32_modify_or(&pChipcHw->PLLConfig2, | ||
1115 | chipcHw_REG_PLL_CONFIG_TEST_ENABLE); | ||
1116 | } | ||
1117 | |||
1118 | /****************************************************************************/ | ||
1119 | /** @brief PLL test disable | ||
1120 | */ | ||
1121 | /****************************************************************************/ | ||
1122 | static inline void chipcHw_pllTestDisable(void) | ||
1123 | { | ||
1124 | reg32_modify_and(&pChipcHw->PLLConfig, | ||
1125 | ~chipcHw_REG_PLL_CONFIG_TEST_ENABLE); | ||
1126 | } | ||
1127 | |||
1128 | /****************************************************************************/ | ||
1129 | /** @brief PLL2 test disable | ||
1130 | */ | ||
1131 | /****************************************************************************/ | ||
1132 | static inline void chipcHw_pll2TestDisable(void) | ||
1133 | { | ||
1134 | reg32_modify_and(&pChipcHw->PLLConfig2, | ||
1135 | ~chipcHw_REG_PLL_CONFIG_TEST_ENABLE); | ||
1136 | } | ||
1137 | |||
1138 | /****************************************************************************/ | ||
1139 | /** @brief Get PLL test status | ||
1140 | */ | ||
1141 | /****************************************************************************/ | ||
1142 | static inline int chipcHw_isPllTestEnable(void) | ||
1143 | { | ||
1144 | return readl(&pChipcHw->PLLConfig) & chipcHw_REG_PLL_CONFIG_TEST_ENABLE; | ||
1145 | } | ||
1146 | |||
1147 | /****************************************************************************/ | ||
1148 | /** @brief Get PLL2 test status | ||
1149 | */ | ||
1150 | /****************************************************************************/ | ||
1151 | static inline int chipcHw_isPll2TestEnable(void) | ||
1152 | { | ||
1153 | return readl(&pChipcHw->PLLConfig2) & chipcHw_REG_PLL_CONFIG_TEST_ENABLE; | ||
1154 | } | ||
1155 | |||
1156 | /****************************************************************************/ | ||
1157 | /** @brief PLL test select | ||
1158 | */ | ||
1159 | /****************************************************************************/ | ||
1160 | static inline void chipcHw_pllTestSelect(uint32_t val) | ||
1161 | { | ||
1162 | REG_LOCAL_IRQ_SAVE; | ||
1163 | pChipcHw->PLLConfig &= ~chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK; | ||
1164 | pChipcHw->PLLConfig |= | ||
1165 | (val) << chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT; | ||
1166 | REG_LOCAL_IRQ_RESTORE; | ||
1167 | } | ||
1168 | |||
1169 | /****************************************************************************/ | ||
1170 | /** @brief PLL2 test select | ||
1171 | */ | ||
1172 | /****************************************************************************/ | ||
1173 | static inline void chipcHw_pll2TestSelect(uint32_t val) | ||
1174 | { | ||
1175 | |||
1176 | REG_LOCAL_IRQ_SAVE; | ||
1177 | pChipcHw->PLLConfig2 &= ~chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK; | ||
1178 | pChipcHw->PLLConfig2 |= | ||
1179 | (val) << chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT; | ||
1180 | REG_LOCAL_IRQ_RESTORE; | ||
1181 | } | ||
1182 | |||
1183 | /****************************************************************************/ | ||
1184 | /** @brief Get PLL test selected option | ||
1185 | */ | ||
1186 | /****************************************************************************/ | ||
1187 | static inline uint8_t chipcHw_getPllTestSelected(void) | ||
1188 | { | ||
1189 | return (uint8_t) ((readl(&pChipcHw-> | ||
1190 | PLLConfig) & chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK) | ||
1191 | >> chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT); | ||
1192 | } | ||
1193 | |||
1194 | /****************************************************************************/ | ||
1195 | /** @brief Get PLL2 test selected option | ||
1196 | */ | ||
1197 | /****************************************************************************/ | ||
1198 | static inline uint8_t chipcHw_getPll2TestSelected(void) | ||
1199 | { | ||
1200 | return (uint8_t) ((readl(&pChipcHw-> | ||
1201 | PLLConfig2) & chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK) | ||
1202 | >> chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT); | ||
1203 | } | ||
1204 | |||
1205 | /****************************************************************************/ | ||
1206 | /** | ||
1207 | * @brief Disable the PLL1 | ||
1208 | * | ||
1209 | */ | ||
1210 | /****************************************************************************/ | ||
1211 | static inline void chipcHw_pll1Disable(void) | ||
1212 | { | ||
1213 | REG_LOCAL_IRQ_SAVE; | ||
1214 | writel(readl(&pChipcHw->PLLConfig) | chipcHw_REG_PLL_CONFIG_POWER_DOWN, | ||
1215 | &pChipcHw->PLLConfig); | ||
1216 | REG_LOCAL_IRQ_RESTORE; | ||
1217 | } | ||
1218 | |||
1219 | /****************************************************************************/ | ||
1220 | /** | ||
1221 | * @brief Disable the PLL2 | ||
1222 | * | ||
1223 | */ | ||
1224 | /****************************************************************************/ | ||
1225 | static inline void chipcHw_pll2Disable(void) | ||
1226 | { | ||
1227 | REG_LOCAL_IRQ_SAVE; | ||
1228 | writel(readl(&pChipcHw->PLLConfig2) | chipcHw_REG_PLL_CONFIG_POWER_DOWN, | ||
1229 | &pChipcHw->PLLConfig2); | ||
1230 | REG_LOCAL_IRQ_RESTORE; | ||
1231 | } | ||
1232 | |||
1233 | /****************************************************************************/ | ||
1234 | /** | ||
1235 | * @brief Enables DDR SW phase alignment interrupt | ||
1236 | */ | ||
1237 | /****************************************************************************/ | ||
1238 | static inline void chipcHw_ddrPhaseAlignInterruptEnable(void) | ||
1239 | { | ||
1240 | REG_LOCAL_IRQ_SAVE; | ||
1241 | writel(readl(&pChipcHw->Spare1) | chipcHw_REG_SPARE1_DDR_PHASE_INTR_ENABLE, | ||
1242 | &pChipcHw->Spare1); | ||
1243 | REG_LOCAL_IRQ_RESTORE; | ||
1244 | } | ||
1245 | |||
1246 | /****************************************************************************/ | ||
1247 | /** | ||
1248 | * @brief Disables DDR SW phase alignment interrupt | ||
1249 | */ | ||
1250 | /****************************************************************************/ | ||
1251 | static inline void chipcHw_ddrPhaseAlignInterruptDisable(void) | ||
1252 | { | ||
1253 | REG_LOCAL_IRQ_SAVE; | ||
1254 | writel(readl(&pChipcHw->Spare1) & ~chipcHw_REG_SPARE1_DDR_PHASE_INTR_ENABLE, | ||
1255 | &pChipcHw->Spare1); | ||
1256 | REG_LOCAL_IRQ_RESTORE; | ||
1257 | } | ||
1258 | |||
1259 | /****************************************************************************/ | ||
1260 | /** | ||
1261 | * @brief Set VPM SW phase alignment interrupt mode | ||
1262 | * | ||
1263 | * This function sets VPM phase alignment interrupt | ||
1264 | */ | ||
1265 | /****************************************************************************/ | ||
1266 | static inline void | ||
1267 | chipcHw_vpmPhaseAlignInterruptMode(chipcHw_VPM_HW_PHASE_INTR_e mode) | ||
1268 | { | ||
1269 | REG_LOCAL_IRQ_SAVE; | ||
1270 | if (mode == chipcHw_VPM_HW_PHASE_INTR_DISABLE) { | ||
1271 | pChipcHw->Spare1 &= ~chipcHw_REG_SPARE1_VPM_PHASE_INTR_ENABLE; | ||
1272 | } else { | ||
1273 | pChipcHw->Spare1 |= chipcHw_REG_SPARE1_VPM_PHASE_INTR_ENABLE; | ||
1274 | } | ||
1275 | pChipcHw->VPMPhaseCtrl2 = | ||
1276 | (pChipcHw-> | ||
1277 | VPMPhaseCtrl2 & ~(chipcHw_REG_VPM_INTR_SELECT_MASK << | ||
1278 | chipcHw_REG_VPM_INTR_SELECT_SHIFT)) | mode; | ||
1279 | REG_LOCAL_IRQ_RESTORE; | ||
1280 | } | ||
1281 | |||
1282 | /****************************************************************************/ | ||
1283 | /** | ||
1284 | * @brief Enable DDR phase alignment in software | ||
1285 | * | ||
1286 | */ | ||
1287 | /****************************************************************************/ | ||
1288 | static inline void chipcHw_ddrSwPhaseAlignEnable(void) | ||
1289 | { | ||
1290 | REG_LOCAL_IRQ_SAVE; | ||
1291 | pChipcHw->DDRPhaseCtrl1 |= chipcHw_REG_DDR_SW_PHASE_CTRL_ENABLE; | ||
1292 | REG_LOCAL_IRQ_RESTORE; | ||
1293 | } | ||
1294 | |||
1295 | /****************************************************************************/ | ||
1296 | /** | ||
1297 | * @brief Disable DDR phase alignment in software | ||
1298 | * | ||
1299 | */ | ||
1300 | /****************************************************************************/ | ||
1301 | static inline void chipcHw_ddrSwPhaseAlignDisable(void) | ||
1302 | { | ||
1303 | REG_LOCAL_IRQ_SAVE; | ||
1304 | pChipcHw->DDRPhaseCtrl1 &= ~chipcHw_REG_DDR_SW_PHASE_CTRL_ENABLE; | ||
1305 | REG_LOCAL_IRQ_RESTORE; | ||
1306 | } | ||
1307 | |||
1308 | /****************************************************************************/ | ||
1309 | /** | ||
1310 | * @brief Enable DDR phase alignment in hardware | ||
1311 | * | ||
1312 | */ | ||
1313 | /****************************************************************************/ | ||
1314 | static inline void chipcHw_ddrHwPhaseAlignEnable(void) | ||
1315 | { | ||
1316 | REG_LOCAL_IRQ_SAVE; | ||
1317 | pChipcHw->DDRPhaseCtrl1 |= chipcHw_REG_DDR_HW_PHASE_CTRL_ENABLE; | ||
1318 | REG_LOCAL_IRQ_RESTORE; | ||
1319 | } | ||
1320 | |||
1321 | /****************************************************************************/ | ||
1322 | /** | ||
1323 | * @brief Disable DDR phase alignment in hardware | ||
1324 | * | ||
1325 | */ | ||
1326 | /****************************************************************************/ | ||
1327 | static inline void chipcHw_ddrHwPhaseAlignDisable(void) | ||
1328 | { | ||
1329 | REG_LOCAL_IRQ_SAVE; | ||
1330 | pChipcHw->DDRPhaseCtrl1 &= ~chipcHw_REG_DDR_HW_PHASE_CTRL_ENABLE; | ||
1331 | REG_LOCAL_IRQ_RESTORE; | ||
1332 | } | ||
1333 | |||
1334 | /****************************************************************************/ | ||
1335 | /** | ||
1336 | * @brief Enable VPM phase alignment in software | ||
1337 | * | ||
1338 | */ | ||
1339 | /****************************************************************************/ | ||
1340 | static inline void chipcHw_vpmSwPhaseAlignEnable(void) | ||
1341 | { | ||
1342 | REG_LOCAL_IRQ_SAVE; | ||
1343 | writel(readl(&pChipcHw->VPMPhaseCtrl1) | chipcHw_REG_VPM_SW_PHASE_CTRL_ENABLE, | ||
1344 | &pChipcHw->VPMPhaseCtrl1); | ||
1345 | REG_LOCAL_IRQ_RESTORE; | ||
1346 | } | ||
1347 | |||
1348 | /****************************************************************************/ | ||
1349 | /** | ||
1350 | * @brief Disable VPM phase alignment in software | ||
1351 | * | ||
1352 | */ | ||
1353 | /****************************************************************************/ | ||
1354 | static inline void chipcHw_vpmSwPhaseAlignDisable(void) | ||
1355 | { | ||
1356 | REG_LOCAL_IRQ_SAVE; | ||
1357 | pChipcHw->VPMPhaseCtrl1 &= ~chipcHw_REG_VPM_SW_PHASE_CTRL_ENABLE; | ||
1358 | REG_LOCAL_IRQ_RESTORE; | ||
1359 | } | ||
1360 | |||
1361 | /****************************************************************************/ | ||
1362 | /** | ||
1363 | * @brief Enable VPM phase alignment in hardware | ||
1364 | * | ||
1365 | */ | ||
1366 | /****************************************************************************/ | ||
1367 | static inline void chipcHw_vpmHwPhaseAlignEnable(void) | ||
1368 | { | ||
1369 | REG_LOCAL_IRQ_SAVE; | ||
1370 | pChipcHw->VPMPhaseCtrl1 |= chipcHw_REG_VPM_HW_PHASE_CTRL_ENABLE; | ||
1371 | REG_LOCAL_IRQ_RESTORE; | ||
1372 | } | ||
1373 | |||
1374 | /****************************************************************************/ | ||
1375 | /** | ||
1376 | * @brief Disable VPM phase alignment in hardware | ||
1377 | * | ||
1378 | */ | ||
1379 | /****************************************************************************/ | ||
1380 | static inline void chipcHw_vpmHwPhaseAlignDisable(void) | ||
1381 | { | ||
1382 | REG_LOCAL_IRQ_SAVE; | ||
1383 | writel(readl(&pChipcHw->VPMPhaseCtrl1) & ~chipcHw_REG_VPM_HW_PHASE_CTRL_ENABLE, | ||
1384 | &pChipcHw->VPMPhaseCtrl1); | ||
1385 | REG_LOCAL_IRQ_RESTORE; | ||
1386 | } | ||
1387 | |||
1388 | /****************************************************************************/ | ||
1389 | /** | ||
1390 | * @brief Set DDR phase alignment margin in hardware | ||
1391 | * | ||
1392 | */ | ||
1393 | /****************************************************************************/ | ||
1394 | static inline void | ||
1395 | chipcHw_setDdrHwPhaseAlignMargin(chipcHw_DDR_HW_PHASE_MARGIN_e margin) | ||
1396 | { | ||
1397 | uint32_t ge = 0; | ||
1398 | uint32_t le = 0; | ||
1399 | |||
1400 | switch (margin) { | ||
1401 | case chipcHw_DDR_HW_PHASE_MARGIN_STRICT: | ||
1402 | ge = 0x0F; | ||
1403 | le = 0x0F; | ||
1404 | break; | ||
1405 | case chipcHw_DDR_HW_PHASE_MARGIN_MEDIUM: | ||
1406 | ge = 0x03; | ||
1407 | le = 0x3F; | ||
1408 | break; | ||
1409 | case chipcHw_DDR_HW_PHASE_MARGIN_WIDE: | ||
1410 | ge = 0x01; | ||
1411 | le = 0x7F; | ||
1412 | break; | ||
1413 | } | ||
1414 | |||
1415 | { | ||
1416 | REG_LOCAL_IRQ_SAVE; | ||
1417 | |||
1418 | pChipcHw->DDRPhaseCtrl1 &= | ||
1419 | ~((chipcHw_REG_DDR_PHASE_VALUE_GE_MASK << | ||
1420 | chipcHw_REG_DDR_PHASE_VALUE_GE_SHIFT) | ||
1421 | || (chipcHw_REG_DDR_PHASE_VALUE_LE_MASK << | ||
1422 | chipcHw_REG_DDR_PHASE_VALUE_LE_SHIFT)); | ||
1423 | |||
1424 | pChipcHw->DDRPhaseCtrl1 |= | ||
1425 | ((ge << chipcHw_REG_DDR_PHASE_VALUE_GE_SHIFT) | ||
1426 | || (le << chipcHw_REG_DDR_PHASE_VALUE_LE_SHIFT)); | ||
1427 | |||
1428 | REG_LOCAL_IRQ_RESTORE; | ||
1429 | } | ||
1430 | } | ||
1431 | |||
1432 | /****************************************************************************/ | ||
1433 | /** | ||
1434 | * @brief Set VPM phase alignment margin in hardware | ||
1435 | * | ||
1436 | */ | ||
1437 | /****************************************************************************/ | ||
1438 | static inline void | ||
1439 | chipcHw_setVpmHwPhaseAlignMargin(chipcHw_VPM_HW_PHASE_MARGIN_e margin) | ||
1440 | { | ||
1441 | uint32_t ge = 0; | ||
1442 | uint32_t le = 0; | ||
1443 | |||
1444 | switch (margin) { | ||
1445 | case chipcHw_VPM_HW_PHASE_MARGIN_STRICT: | ||
1446 | ge = 0x0F; | ||
1447 | le = 0x0F; | ||
1448 | break; | ||
1449 | case chipcHw_VPM_HW_PHASE_MARGIN_MEDIUM: | ||
1450 | ge = 0x03; | ||
1451 | le = 0x3F; | ||
1452 | break; | ||
1453 | case chipcHw_VPM_HW_PHASE_MARGIN_WIDE: | ||
1454 | ge = 0x01; | ||
1455 | le = 0x7F; | ||
1456 | break; | ||
1457 | } | ||
1458 | |||
1459 | { | ||
1460 | REG_LOCAL_IRQ_SAVE; | ||
1461 | |||
1462 | pChipcHw->VPMPhaseCtrl1 &= | ||
1463 | ~((chipcHw_REG_VPM_PHASE_VALUE_GE_MASK << | ||
1464 | chipcHw_REG_VPM_PHASE_VALUE_GE_SHIFT) | ||
1465 | || (chipcHw_REG_VPM_PHASE_VALUE_LE_MASK << | ||
1466 | chipcHw_REG_VPM_PHASE_VALUE_LE_SHIFT)); | ||
1467 | |||
1468 | pChipcHw->VPMPhaseCtrl1 |= | ||
1469 | ((ge << chipcHw_REG_VPM_PHASE_VALUE_GE_SHIFT) | ||
1470 | || (le << chipcHw_REG_VPM_PHASE_VALUE_LE_SHIFT)); | ||
1471 | |||
1472 | REG_LOCAL_IRQ_RESTORE; | ||
1473 | } | ||
1474 | } | ||
1475 | |||
1476 | /****************************************************************************/ | ||
1477 | /** | ||
1478 | * @brief Checks DDR phase aligned status done by HW | ||
1479 | * | ||
1480 | * @return 1: When aligned | ||
1481 | * 0: When not aligned | ||
1482 | */ | ||
1483 | /****************************************************************************/ | ||
1484 | static inline uint32_t chipcHw_isDdrHwPhaseAligned(void) | ||
1485 | { | ||
1486 | return (readl(&pChipcHw-> | ||
1487 | PhaseAlignStatus) & chipcHw_REG_DDR_PHASE_ALIGNED) ? 1 : 0; | ||
1488 | } | ||
1489 | |||
1490 | /****************************************************************************/ | ||
1491 | /** | ||
1492 | * @brief Checks VPM phase aligned status done by HW | ||
1493 | * | ||
1494 | * @return 1: When aligned | ||
1495 | * 0: When not aligned | ||
1496 | */ | ||
1497 | /****************************************************************************/ | ||
1498 | static inline uint32_t chipcHw_isVpmHwPhaseAligned(void) | ||
1499 | { | ||
1500 | return (readl(&pChipcHw-> | ||
1501 | PhaseAlignStatus) & chipcHw_REG_VPM_PHASE_ALIGNED) ? 1 : 0; | ||
1502 | } | ||
1503 | |||
1504 | /****************************************************************************/ | ||
1505 | /** | ||
1506 | * @brief Get DDR phase aligned status done by HW | ||
1507 | * | ||
1508 | */ | ||
1509 | /****************************************************************************/ | ||
1510 | static inline uint32_t chipcHw_getDdrHwPhaseAlignStatus(void) | ||
1511 | { | ||
1512 | return (readl(&pChipcHw-> | ||
1513 | PhaseAlignStatus) & chipcHw_REG_DDR_PHASE_STATUS_MASK) >> | ||
1514 | chipcHw_REG_DDR_PHASE_STATUS_SHIFT; | ||
1515 | } | ||
1516 | |||
1517 | /****************************************************************************/ | ||
1518 | /** | ||
1519 | * @brief Get VPM phase aligned status done by HW | ||
1520 | * | ||
1521 | */ | ||
1522 | /****************************************************************************/ | ||
1523 | static inline uint32_t chipcHw_getVpmHwPhaseAlignStatus(void) | ||
1524 | { | ||
1525 | return (readl(&pChipcHw-> | ||
1526 | PhaseAlignStatus) & chipcHw_REG_VPM_PHASE_STATUS_MASK) >> | ||
1527 | chipcHw_REG_VPM_PHASE_STATUS_SHIFT; | ||
1528 | } | ||
1529 | |||
1530 | /****************************************************************************/ | ||
1531 | /** | ||
1532 | * @brief Get DDR phase control value | ||
1533 | * | ||
1534 | */ | ||
1535 | /****************************************************************************/ | ||
1536 | static inline uint32_t chipcHw_getDdrPhaseControl(void) | ||
1537 | { | ||
1538 | return (readl(&pChipcHw-> | ||
1539 | PhaseAlignStatus) & chipcHw_REG_DDR_PHASE_CTRL_MASK) >> | ||
1540 | chipcHw_REG_DDR_PHASE_CTRL_SHIFT; | ||
1541 | } | ||
1542 | |||
1543 | /****************************************************************************/ | ||
1544 | /** | ||
1545 | * @brief Get VPM phase control value | ||
1546 | * | ||
1547 | */ | ||
1548 | /****************************************************************************/ | ||
1549 | static inline uint32_t chipcHw_getVpmPhaseControl(void) | ||
1550 | { | ||
1551 | return (readl(&pChipcHw-> | ||
1552 | PhaseAlignStatus) & chipcHw_REG_VPM_PHASE_CTRL_MASK) >> | ||
1553 | chipcHw_REG_VPM_PHASE_CTRL_SHIFT; | ||
1554 | } | ||
1555 | |||
1556 | /****************************************************************************/ | ||
1557 | /** | ||
1558 | * @brief DDR phase alignment timeout count | ||
1559 | * | ||
1560 | * @note If HW fails to perform the phase alignment, it will trigger | ||
1561 | * a DDR phase alignment timeout interrupt. | ||
1562 | */ | ||
1563 | /****************************************************************************/ | ||
1564 | static inline void chipcHw_ddrHwPhaseAlignTimeout(uint32_t busCycle) | ||
1565 | { | ||
1566 | REG_LOCAL_IRQ_SAVE; | ||
1567 | pChipcHw->DDRPhaseCtrl2 &= | ||
1568 | ~(chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_MASK << | ||
1569 | chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_SHIFT); | ||
1570 | pChipcHw->DDRPhaseCtrl2 |= | ||
1571 | (busCycle & chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_MASK) << | ||
1572 | chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_SHIFT; | ||
1573 | REG_LOCAL_IRQ_RESTORE; | ||
1574 | } | ||
1575 | |||
1576 | /****************************************************************************/ | ||
1577 | /** | ||
1578 | * @brief VPM phase alignment timeout count | ||
1579 | * | ||
1580 | * @note If HW fails to perform the phase alignment, it will trigger | ||
1581 | * a VPM phase alignment timeout interrupt. | ||
1582 | */ | ||
1583 | /****************************************************************************/ | ||
1584 | static inline void chipcHw_vpmHwPhaseAlignTimeout(uint32_t busCycle) | ||
1585 | { | ||
1586 | REG_LOCAL_IRQ_SAVE; | ||
1587 | pChipcHw->VPMPhaseCtrl2 &= | ||
1588 | ~(chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_MASK << | ||
1589 | chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_SHIFT); | ||
1590 | pChipcHw->VPMPhaseCtrl2 |= | ||
1591 | (busCycle & chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_MASK) << | ||
1592 | chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_SHIFT; | ||
1593 | REG_LOCAL_IRQ_RESTORE; | ||
1594 | } | ||
1595 | |||
1596 | /****************************************************************************/ | ||
1597 | /** | ||
1598 | * @brief Clear DDR phase alignment timeout interrupt | ||
1599 | * | ||
1600 | */ | ||
1601 | /****************************************************************************/ | ||
1602 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(void) | ||
1603 | { | ||
1604 | REG_LOCAL_IRQ_SAVE; | ||
1605 | /* Clear timeout interrupt service bit */ | ||
1606 | pChipcHw->DDRPhaseCtrl2 |= chipcHw_REG_DDR_INTR_SERVICED; | ||
1607 | pChipcHw->DDRPhaseCtrl2 &= ~chipcHw_REG_DDR_INTR_SERVICED; | ||
1608 | REG_LOCAL_IRQ_RESTORE; | ||
1609 | } | ||
1610 | |||
1611 | /****************************************************************************/ | ||
1612 | /** | ||
1613 | * @brief Clear VPM phase alignment timeout interrupt | ||
1614 | * | ||
1615 | */ | ||
1616 | /****************************************************************************/ | ||
1617 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(void) | ||
1618 | { | ||
1619 | REG_LOCAL_IRQ_SAVE; | ||
1620 | /* Clear timeout interrupt service bit */ | ||
1621 | pChipcHw->VPMPhaseCtrl2 |= chipcHw_REG_VPM_INTR_SERVICED; | ||
1622 | pChipcHw->VPMPhaseCtrl2 &= ~chipcHw_REG_VPM_INTR_SERVICED; | ||
1623 | REG_LOCAL_IRQ_RESTORE; | ||
1624 | } | ||
1625 | |||
1626 | /****************************************************************************/ | ||
1627 | /** | ||
1628 | * @brief DDR phase alignment timeout interrupt enable | ||
1629 | * | ||
1630 | */ | ||
1631 | /****************************************************************************/ | ||
1632 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptEnable(void) | ||
1633 | { | ||
1634 | REG_LOCAL_IRQ_SAVE; | ||
1635 | chipcHw_ddrHwPhaseAlignTimeoutInterruptClear(); /* Recommended */ | ||
1636 | /* Enable timeout interrupt */ | ||
1637 | pChipcHw->DDRPhaseCtrl2 |= chipcHw_REG_DDR_TIMEOUT_INTR_ENABLE; | ||
1638 | REG_LOCAL_IRQ_RESTORE; | ||
1639 | } | ||
1640 | |||
1641 | /****************************************************************************/ | ||
1642 | /** | ||
1643 | * @brief VPM phase alignment timeout interrupt enable | ||
1644 | * | ||
1645 | */ | ||
1646 | /****************************************************************************/ | ||
1647 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptEnable(void) | ||
1648 | { | ||
1649 | REG_LOCAL_IRQ_SAVE; | ||
1650 | chipcHw_vpmHwPhaseAlignTimeoutInterruptClear(); /* Recommended */ | ||
1651 | /* Enable timeout interrupt */ | ||
1652 | pChipcHw->VPMPhaseCtrl2 |= chipcHw_REG_VPM_TIMEOUT_INTR_ENABLE; | ||
1653 | REG_LOCAL_IRQ_RESTORE; | ||
1654 | } | ||
1655 | |||
1656 | /****************************************************************************/ | ||
1657 | /** | ||
1658 | * @brief DDR phase alignment timeout interrupt disable | ||
1659 | * | ||
1660 | */ | ||
1661 | /****************************************************************************/ | ||
1662 | static inline void chipcHw_ddrHwPhaseAlignTimeoutInterruptDisable(void) | ||
1663 | { | ||
1664 | REG_LOCAL_IRQ_SAVE; | ||
1665 | pChipcHw->DDRPhaseCtrl2 &= ~chipcHw_REG_DDR_TIMEOUT_INTR_ENABLE; | ||
1666 | REG_LOCAL_IRQ_RESTORE; | ||
1667 | } | ||
1668 | |||
1669 | /****************************************************************************/ | ||
1670 | /** | ||
1671 | * @brief VPM phase alignment timeout interrupt disable | ||
1672 | * | ||
1673 | */ | ||
1674 | /****************************************************************************/ | ||
1675 | static inline void chipcHw_vpmHwPhaseAlignTimeoutInterruptDisable(void) | ||
1676 | { | ||
1677 | REG_LOCAL_IRQ_SAVE; | ||
1678 | pChipcHw->VPMPhaseCtrl2 &= ~chipcHw_REG_VPM_TIMEOUT_INTR_ENABLE; | ||
1679 | REG_LOCAL_IRQ_RESTORE; | ||
1680 | } | ||
1681 | |||
1682 | #endif /* CHIPC_INLINE_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_reg.h b/arch/arm/mach-bcmring/include/mach/csp/chipcHw_reg.h deleted file mode 100644 index 26f5d0e4e1dd..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/chipcHw_reg.h +++ /dev/null | |||
@@ -1,530 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file chipcHw_reg.h | ||
18 | * | ||
19 | * @brief Definitions for low level chip control registers | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | #ifndef CHIPCHW_REG_H | ||
24 | #define CHIPCHW_REG_H | ||
25 | |||
26 | #include <mach/csp/mm_io.h> | ||
27 | #include <mach/csp/reg.h> | ||
28 | #include <mach/csp/ddrcReg.h> | ||
29 | |||
30 | #define chipcHw_BASE_ADDRESS MM_IO_BASE_CHIPC | ||
31 | |||
32 | typedef struct { | ||
33 | uint32_t ChipId; /* Chip ID */ | ||
34 | uint32_t DDRClock; /* PLL1 Channel 1 for DDR clock */ | ||
35 | uint32_t ARMClock; /* PLL1 Channel 2 for ARM clock */ | ||
36 | uint32_t ESWClock; /* PLL1 Channel 3 for ESW system clock */ | ||
37 | uint32_t VPMClock; /* PLL1 Channel 4 for VPM clock */ | ||
38 | uint32_t ESW125Clock; /* PLL1 Channel 5 for ESW 125MHz clock */ | ||
39 | uint32_t UARTClock; /* PLL1 Channel 6 for UART clock */ | ||
40 | uint32_t SDIO0Clock; /* PLL1 Channel 7 for SDIO 0 clock */ | ||
41 | uint32_t SDIO1Clock; /* PLL1 Channel 8 for SDIO 1 clock */ | ||
42 | uint32_t SPIClock; /* PLL1 Channel 9 for SPI master Clock */ | ||
43 | uint32_t ETMClock; /* PLL1 Channel 10 for ARM ETM Clock */ | ||
44 | |||
45 | uint32_t ACLKClock; /* ACLK Clock (Divider) */ | ||
46 | uint32_t OTPClock; /* OTP Clock (Divider) */ | ||
47 | uint32_t I2CClock; /* I2C Clock (CK_13m) (Divider) */ | ||
48 | uint32_t I2S0Clock; /* I2S0 Clock (Divider) */ | ||
49 | uint32_t RTBUSClock; /* RTBUS (DDR PHY Config.) Clock (Divider) */ | ||
50 | uint32_t pad1; | ||
51 | uint32_t APM100Clock; /* APM 100MHz CLK Clock (Divider) */ | ||
52 | uint32_t TSCClock; /* TSC Clock (Divider) */ | ||
53 | uint32_t LEDClock; /* LED Clock (Divider) */ | ||
54 | |||
55 | uint32_t USBClock; /* PLL2 Channel 1 for USB clock */ | ||
56 | uint32_t LCDClock; /* PLL2 Channel 2 for LCD clock */ | ||
57 | uint32_t APMClock; /* PLL2 Channel 3 for APM 200 MHz clock */ | ||
58 | |||
59 | uint32_t BusIntfClock; /* Bus interface clock */ | ||
60 | |||
61 | uint32_t PLLStatus; /* PLL status register (PLL1) */ | ||
62 | uint32_t PLLConfig; /* PLL configuration register (PLL1) */ | ||
63 | uint32_t PLLPreDivider; /* PLL pre-divider control register (PLL1) */ | ||
64 | uint32_t PLLDivider; /* PLL divider control register (PLL1) */ | ||
65 | uint32_t PLLControl1; /* PLL analog control register #1 (PLL1) */ | ||
66 | uint32_t PLLControl2; /* PLL analog control register #2 (PLL1) */ | ||
67 | |||
68 | uint32_t I2S1Clock; /* I2S1 Clock */ | ||
69 | uint32_t AudioEnable; /* Enable/ disable audio channel */ | ||
70 | uint32_t SoftReset1; /* Reset blocks */ | ||
71 | uint32_t SoftReset2; /* Reset blocks */ | ||
72 | uint32_t Spare1; /* Phase align interrupts */ | ||
73 | uint32_t Sticky; /* Sticky bits */ | ||
74 | uint32_t MiscCtrl; /* Misc. control */ | ||
75 | uint32_t pad3[3]; | ||
76 | |||
77 | uint32_t PLLStatus2; /* PLL status register (PLL2) */ | ||
78 | uint32_t PLLConfig2; /* PLL configuration register (PLL2) */ | ||
79 | uint32_t PLLPreDivider2; /* PLL pre-divider control register (PLL2) */ | ||
80 | uint32_t PLLDivider2; /* PLL divider control register (PLL2) */ | ||
81 | uint32_t PLLControl12; /* PLL analog control register #1 (PLL2) */ | ||
82 | uint32_t PLLControl22; /* PLL analog control register #2 (PLL2) */ | ||
83 | |||
84 | uint32_t DDRPhaseCtrl1; /* DDR Clock Phase Alignment control1 */ | ||
85 | uint32_t VPMPhaseCtrl1; /* VPM Clock Phase Alignment control1 */ | ||
86 | uint32_t PhaseAlignStatus; /* DDR/VPM Clock Phase Alignment Status */ | ||
87 | uint32_t PhaseCtrlStatus; /* DDR/VPM Clock HW DDR/VPM ph_ctrl and load_ch Status */ | ||
88 | uint32_t DDRPhaseCtrl2; /* DDR Clock Phase Alignment control2 */ | ||
89 | uint32_t VPMPhaseCtrl2; /* VPM Clock Phase Alignment control2 */ | ||
90 | uint32_t pad4[9]; | ||
91 | |||
92 | uint32_t SoftOTP1; /* Software OTP control */ | ||
93 | uint32_t SoftOTP2; /* Software OTP control */ | ||
94 | uint32_t SoftStraps; /* Software strap */ | ||
95 | uint32_t PinStraps; /* Pin Straps */ | ||
96 | uint32_t DiffOscCtrl; /* Diff oscillator control */ | ||
97 | uint32_t DiagsCtrl; /* Diagnostic control */ | ||
98 | uint32_t DiagsOutputCtrl; /* Diagnostic output enable */ | ||
99 | uint32_t DiagsReadBackCtrl; /* Diagnostic read back control */ | ||
100 | |||
101 | uint32_t LcdPifMode; /* LCD/PIF Pin Sharing MUX Mode */ | ||
102 | |||
103 | uint32_t GpioMux_0_7; /* Pin Sharing MUX0 Control */ | ||
104 | uint32_t GpioMux_8_15; /* Pin Sharing MUX1 Control */ | ||
105 | uint32_t GpioMux_16_23; /* Pin Sharing MUX2 Control */ | ||
106 | uint32_t GpioMux_24_31; /* Pin Sharing MUX3 Control */ | ||
107 | uint32_t GpioMux_32_39; /* Pin Sharing MUX4 Control */ | ||
108 | uint32_t GpioMux_40_47; /* Pin Sharing MUX5 Control */ | ||
109 | uint32_t GpioMux_48_55; /* Pin Sharing MUX6 Control */ | ||
110 | uint32_t GpioMux_56_63; /* Pin Sharing MUX7 Control */ | ||
111 | |||
112 | uint32_t GpioSR_0_7; /* Slew rate for GPIO 0 - 7 */ | ||
113 | uint32_t GpioSR_8_15; /* Slew rate for GPIO 8 - 15 */ | ||
114 | uint32_t GpioSR_16_23; /* Slew rate for GPIO 16 - 23 */ | ||
115 | uint32_t GpioSR_24_31; /* Slew rate for GPIO 24 - 31 */ | ||
116 | uint32_t GpioSR_32_39; /* Slew rate for GPIO 32 - 39 */ | ||
117 | uint32_t GpioSR_40_47; /* Slew rate for GPIO 40 - 47 */ | ||
118 | uint32_t GpioSR_48_55; /* Slew rate for GPIO 48 - 55 */ | ||
119 | uint32_t GpioSR_56_63; /* Slew rate for GPIO 56 - 63 */ | ||
120 | uint32_t MiscSR_0_7; /* Slew rate for MISC 0 - 7 */ | ||
121 | uint32_t MiscSR_8_15; /* Slew rate for MISC 8 - 15 */ | ||
122 | |||
123 | uint32_t GpioPull_0_15; /* Pull up registers for GPIO 0 - 15 */ | ||
124 | uint32_t GpioPull_16_31; /* Pull up registers for GPIO 16 - 31 */ | ||
125 | uint32_t GpioPull_32_47; /* Pull up registers for GPIO 32 - 47 */ | ||
126 | uint32_t GpioPull_48_63; /* Pull up registers for GPIO 48 - 63 */ | ||
127 | uint32_t MiscPull_0_15; /* Pull up registers for MISC 0 - 15 */ | ||
128 | |||
129 | uint32_t GpioInput_0_31; /* Input type for GPIO 0 - 31 */ | ||
130 | uint32_t GpioInput_32_63; /* Input type for GPIO 32 - 63 */ | ||
131 | uint32_t MiscInput_0_15; /* Input type for MISC 0 - 16 */ | ||
132 | } chipcHw_REG_t; | ||
133 | |||
134 | #define pChipcHw ((chipcHw_REG_t __iomem *) chipcHw_BASE_ADDRESS) | ||
135 | #define pChipcPhysical (MM_ADDR_IO_CHIPC) | ||
136 | |||
137 | #define chipcHw_REG_CHIPID_BASE_MASK 0xFFFFF000 | ||
138 | #define chipcHw_REG_CHIPID_BASE_SHIFT 12 | ||
139 | #define chipcHw_REG_CHIPID_REV_MASK 0x00000FFF | ||
140 | #define chipcHw_REG_REV_A0 0xA00 | ||
141 | #define chipcHw_REG_REV_B0 0x0B0 | ||
142 | |||
143 | #define chipcHw_REG_PLL_STATUS_CONTROL_ENABLE 0x80000000 /* Allow controlling PLL registers */ | ||
144 | #define chipcHw_REG_PLL_STATUS_LOCKED 0x00000001 /* PLL is settled */ | ||
145 | #define chipcHw_REG_PLL_CONFIG_D_RESET 0x00000008 /* Digital reset */ | ||
146 | #define chipcHw_REG_PLL_CONFIG_A_RESET 0x00000004 /* Analog reset */ | ||
147 | #define chipcHw_REG_PLL_CONFIG_BYPASS_ENABLE 0x00000020 /* Bypass enable */ | ||
148 | #define chipcHw_REG_PLL_CONFIG_OUTPUT_ENABLE 0x00000010 /* Output enable */ | ||
149 | #define chipcHw_REG_PLL_CONFIG_POWER_DOWN 0x00000001 /* Power down */ | ||
150 | #define chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ 1600000000 /* 1.6GHz VCO split frequency */ | ||
151 | #define chipcHw_REG_PLL_CONFIG_VCO_800_1600 0x00000000 /* VCO range 800-1600 MHz */ | ||
152 | #define chipcHw_REG_PLL_CONFIG_VCO_1601_3200 0x00000080 /* VCO range 1601-3200 MHz */ | ||
153 | #define chipcHw_REG_PLL_CONFIG_TEST_ENABLE 0x00010000 /* PLL test output enable */ | ||
154 | #define chipcHw_REG_PLL_CONFIG_TEST_SELECT_MASK 0x003E0000 /* Mask to set test values */ | ||
155 | #define chipcHw_REG_PLL_CONFIG_TEST_SELECT_SHIFT 17 | ||
156 | |||
157 | #define chipcHw_REG_PLL_CLOCK_PHASE_COMP 0x00800000 /* Phase comparator output */ | ||
158 | #define chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_MASK 0x00300000 /* Clock to bus ratio mask */ | ||
159 | #define chipcHw_REG_PLL_CLOCK_TO_BUS_RATIO_SHIFT 20 /* Number of bits to be shifted */ | ||
160 | #define chipcHw_REG_PLL_CLOCK_POWER_DOWN 0x00080000 /* PLL channel power down */ | ||
161 | #define chipcHw_REG_PLL_CLOCK_SOURCE_GPIO 0x00040000 /* Use GPIO as source */ | ||
162 | #define chipcHw_REG_PLL_CLOCK_BYPASS_SELECT 0x00020000 /* Select bypass clock */ | ||
163 | #define chipcHw_REG_PLL_CLOCK_OUTPUT_ENABLE 0x00010000 /* Clock gated ON */ | ||
164 | #define chipcHw_REG_PLL_CLOCK_PHASE_UPDATE_ENABLE 0x00008000 /* Clock phase update enable */ | ||
165 | #define chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_SHIFT 8 /* Number of bits to be shifted */ | ||
166 | #define chipcHw_REG_PLL_CLOCK_PHASE_CONTROL_MASK 0x00003F00 /* Phase control mask */ | ||
167 | #define chipcHw_REG_PLL_CLOCK_MDIV_MASK 0x000000FF /* Clock post divider mask | ||
168 | |||
169 | 00000000 = divide-by-256 | ||
170 | 00000001 = divide-by-1 | ||
171 | 00000010 = divide-by-2 | ||
172 | 00000011 = divide-by-3 | ||
173 | 00000100 = divide-by-4 | ||
174 | 00000101 = divide-by-5 | ||
175 | 00000110 = divide-by-6 | ||
176 | . | ||
177 | . | ||
178 | 11111011 = divide-by-251 | ||
179 | 11111100 = divide-by-252 | ||
180 | 11111101 = divide-by-253 | ||
181 | 11111110 = divide-by-254 | ||
182 | */ | ||
183 | |||
184 | #define chipcHw_REG_DIV_CLOCK_SOURCE_OTHER 0x00040000 /* NON-PLL clock source select */ | ||
185 | #define chipcHw_REG_DIV_CLOCK_BYPASS_SELECT 0x00020000 /* NON-PLL clock bypass enable */ | ||
186 | #define chipcHw_REG_DIV_CLOCK_OUTPUT_ENABLE 0x00010000 /* NON-PLL clock output enable */ | ||
187 | #define chipcHw_REG_DIV_CLOCK_DIV_MASK 0x000000FF /* NON-PLL clock post-divide mask */ | ||
188 | #define chipcHw_REG_DIV_CLOCK_DIV_256 0x00000000 /* NON-PLL clock post-divide by 256 */ | ||
189 | |||
190 | #define chipcHw_REG_PLL_PREDIVIDER_P1_SHIFT 0 | ||
191 | #define chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT 4 | ||
192 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_SHIFT 8 | ||
193 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MASK 0x0001FF00 | ||
194 | #define chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN 0x02000000 | ||
195 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASK 0x00700000 /* Divider mask */ | ||
196 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER 0x00000000 /* Integer-N Mode */ | ||
197 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASH_UNIT 0x00100000 /* MASH Sigma-Delta Modulator Unit Mode */ | ||
198 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MFB_UNIT 0x00200000 /* MFB Sigma-Delta Modulator Unit Mode */ | ||
199 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MASH_1_8 0x00300000 /* MASH Sigma-Delta Modulator 1/8 Mode */ | ||
200 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_MFB_1_8 0x00400000 /* MFB Sigma-Delta Modulator 1/8 Mode */ | ||
201 | |||
202 | #define chipcHw_REG_PLL_PREDIVIDER_NDIV_i(vco) ((vco) / chipcHw_XTAL_FREQ_Hz) | ||
203 | #define chipcHw_REG_PLL_PREDIVIDER_P1 1 | ||
204 | #define chipcHw_REG_PLL_PREDIVIDER_P2 1 | ||
205 | |||
206 | #define chipcHw_REG_PLL_DIVIDER_M1DIV 0x03000000 | ||
207 | #define chipcHw_REG_PLL_DIVIDER_FRAC 0x00FFFFFF /* Fractional divider */ | ||
208 | |||
209 | #define chipcHw_REG_PLL_DIVIDER_NDIV_f_SS (0x00FFFFFF) /* To attain spread with max frequency */ | ||
210 | |||
211 | #define chipcHw_REG_PLL_DIVIDER_NDIV_f 0 /* ndiv_frac = chipcHw_REG_PLL_DIVIDER_NDIV_f / | ||
212 | chipcHw_REG_PLL_DIVIDER_FRAC | ||
213 | = 0, when SS is disable | ||
214 | */ | ||
215 | |||
216 | #define chipcHw_REG_PLL_DIVIDER_MDIV(vco, Hz) ((chipcHw_divide((vco), (Hz)) > 255) ? 0 : chipcHw_divide((vco), (Hz))) | ||
217 | |||
218 | #define chipcHw_REG_ACLKClock_CLK_DIV_MASK 0x3 | ||
219 | |||
220 | /* System booting strap options */ | ||
221 | #define chipcHw_STRAPS_SOFT_OVERRIDE 0x00000001 /* Software Strap Override */ | ||
222 | |||
223 | #define chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_8 0x00000000 /* 8 bit NAND FLASH Boot */ | ||
224 | #define chipcHw_STRAPS_BOOT_DEVICE_NOR_FLASH_16 0x00000002 /* 16 bit NOR FLASH Boot */ | ||
225 | #define chipcHw_STRAPS_BOOT_DEVICE_SERIAL_FLASH 0x00000004 /* Serial FLASH Boot */ | ||
226 | #define chipcHw_STRAPS_BOOT_DEVICE_NAND_FLASH_16 0x00000006 /* 16 bit NAND FLASH Boot */ | ||
227 | #define chipcHw_STRAPS_BOOT_DEVICE_UART 0x00000008 /* UART Boot */ | ||
228 | #define chipcHw_STRAPS_BOOT_DEVICE_MASK 0x0000000E /* Mask */ | ||
229 | |||
230 | /* System boot option */ | ||
231 | #define chipcHw_STRAPS_BOOT_OPTION_BROM 0x00000000 /* Boot from Boot ROM */ | ||
232 | #define chipcHw_STRAPS_BOOT_OPTION_ARAM 0x00000020 /* Boot from ARAM */ | ||
233 | #define chipcHw_STRAPS_BOOT_OPTION_NOR 0x00000030 /* Boot from NOR flash */ | ||
234 | |||
235 | /* NAND Flash page size strap options */ | ||
236 | #define chipcHw_STRAPS_NAND_PAGESIZE_512 0x00000000 /* NAND FLASH page size of 512 bytes */ | ||
237 | #define chipcHw_STRAPS_NAND_PAGESIZE_2048 0x00000040 /* NAND FLASH page size of 2048 bytes */ | ||
238 | #define chipcHw_STRAPS_NAND_PAGESIZE_4096 0x00000080 /* NAND FLASH page size of 4096 bytes */ | ||
239 | #define chipcHw_STRAPS_NAND_PAGESIZE_EXT 0x000000C0 /* NAND FLASH page of extened size */ | ||
240 | #define chipcHw_STRAPS_NAND_PAGESIZE_MASK 0x000000C0 /* Mask */ | ||
241 | |||
242 | #define chipcHw_STRAPS_NAND_EXTRA_CYCLE 0x00000400 /* NAND FLASH address cycle configuration */ | ||
243 | #define chipcHw_STRAPS_REBOOT_TO_UART 0x00000800 /* Reboot to UART on error */ | ||
244 | |||
245 | /* Secure boot mode strap options */ | ||
246 | #define chipcHw_STRAPS_BOOT_MODE_NORMAL 0x00000000 /* Normal Boot */ | ||
247 | #define chipcHw_STRAPS_BOOT_MODE_DBG_SW 0x00000100 /* Software debugging Boot */ | ||
248 | #define chipcHw_STRAPS_BOOT_MODE_DBG_BOOT 0x00000200 /* Boot rom debugging Boot */ | ||
249 | #define chipcHw_STRAPS_BOOT_MODE_NORMAL_QUIET 0x00000300 /* Normal Boot (Quiet BootRom) */ | ||
250 | #define chipcHw_STRAPS_BOOT_MODE_MASK 0x00000300 /* Mask */ | ||
251 | |||
252 | /* Slave Mode straps */ | ||
253 | #define chipcHw_STRAPS_I2CS 0x02000000 /* I2C Slave */ | ||
254 | #define chipcHw_STRAPS_SPIS 0x01000000 /* SPI Slave */ | ||
255 | |||
256 | /* Strap pin options */ | ||
257 | #define chipcHw_REG_SW_STRAPS ((pChipcHw->PinStraps & 0x0000FC00) >> 10) | ||
258 | |||
259 | /* PIF/LCD pin sharing defines */ | ||
260 | #define chipcHw_REG_LCD_PIN_ENABLE 0x00000001 /* LCD Controller is used and the pins have LCD functions */ | ||
261 | #define chipcHw_REG_PIF_PIN_ENABLE 0x00000002 /* LCD pins are used to perform PIF functions */ | ||
262 | |||
263 | #define chipcHw_GPIO_COUNT 61 /* Number of GPIO pin accessible thorugh CHIPC */ | ||
264 | |||
265 | /* NOTE: Any changes to these constants will require a corresponding change to chipcHw_str.c */ | ||
266 | #define chipcHw_REG_GPIO_MUX_KEYPAD 0x00000001 /* GPIO mux for Keypad */ | ||
267 | #define chipcHw_REG_GPIO_MUX_I2CH 0x00000002 /* GPIO mux for I2CH */ | ||
268 | #define chipcHw_REG_GPIO_MUX_SPI 0x00000003 /* GPIO mux for SPI */ | ||
269 | #define chipcHw_REG_GPIO_MUX_UART 0x00000004 /* GPIO mux for UART */ | ||
270 | #define chipcHw_REG_GPIO_MUX_LEDMTXP 0x00000005 /* GPIO mux for LEDMTXP */ | ||
271 | #define chipcHw_REG_GPIO_MUX_LEDMTXS 0x00000006 /* GPIO mux for LEDMTXS */ | ||
272 | #define chipcHw_REG_GPIO_MUX_SDIO0 0x00000007 /* GPIO mux for SDIO0 */ | ||
273 | #define chipcHw_REG_GPIO_MUX_SDIO1 0x00000008 /* GPIO mux for SDIO1 */ | ||
274 | #define chipcHw_REG_GPIO_MUX_PCM 0x00000009 /* GPIO mux for PCM */ | ||
275 | #define chipcHw_REG_GPIO_MUX_I2S 0x0000000A /* GPIO mux for I2S */ | ||
276 | #define chipcHw_REG_GPIO_MUX_ETM 0x0000000B /* GPIO mux for ETM */ | ||
277 | #define chipcHw_REG_GPIO_MUX_DEBUG 0x0000000C /* GPIO mux for DEBUG */ | ||
278 | #define chipcHw_REG_GPIO_MUX_MISC 0x0000000D /* GPIO mux for MISC */ | ||
279 | #define chipcHw_REG_GPIO_MUX_GPIO 0x00000000 /* GPIO mux for GPIO */ | ||
280 | #define chipcHw_REG_GPIO_MUX(pin) (&pChipcHw->GpioMux_0_7 + ((pin) >> 3)) | ||
281 | #define chipcHw_REG_GPIO_MUX_POSITION(pin) (((pin) & 0x00000007) << 2) | ||
282 | #define chipcHw_REG_GPIO_MUX_MASK 0x0000000F /* Mask */ | ||
283 | |||
284 | #define chipcHw_REG_SLEW_RATE_HIGH 0x00000000 /* High speed slew rate */ | ||
285 | #define chipcHw_REG_SLEW_RATE_NORMAL 0x00000008 /* Normal slew rate */ | ||
286 | /* Pins beyond 42 are defined by skipping 8 bits within the register */ | ||
287 | #define chipcHw_REG_SLEW_RATE(pin) (((pin) > 42) ? (&pChipcHw->GpioSR_0_7 + (((pin) + 2) >> 3)) : (&pChipcHw->GpioSR_0_7 + ((pin) >> 3))) | ||
288 | #define chipcHw_REG_SLEW_RATE_POSITION(pin) (((pin) > 42) ? ((((pin) + 2) & 0x00000007) << 2) : (((pin) & 0x00000007) << 2)) | ||
289 | #define chipcHw_REG_SLEW_RATE_MASK 0x00000008 /* Mask */ | ||
290 | |||
291 | #define chipcHw_REG_CURRENT_STRENGTH_2mA 0x00000001 /* Current driving strength 2 milli ampere */ | ||
292 | #define chipcHw_REG_CURRENT_STRENGTH_4mA 0x00000002 /* Current driving strength 4 milli ampere */ | ||
293 | #define chipcHw_REG_CURRENT_STRENGTH_6mA 0x00000004 /* Current driving strength 6 milli ampere */ | ||
294 | #define chipcHw_REG_CURRENT_STRENGTH_8mA 0x00000005 /* Current driving strength 8 milli ampere */ | ||
295 | #define chipcHw_REG_CURRENT_STRENGTH_10mA 0x00000006 /* Current driving strength 10 milli ampere */ | ||
296 | #define chipcHw_REG_CURRENT_STRENGTH_12mA 0x00000007 /* Current driving strength 12 milli ampere */ | ||
297 | #define chipcHw_REG_CURRENT_MASK 0x00000007 /* Mask */ | ||
298 | /* Pins beyond 42 are defined by skipping 8 bits */ | ||
299 | #define chipcHw_REG_CURRENT(pin) (((pin) > 42) ? (&pChipcHw->GpioSR_0_7 + (((pin) + 2) >> 3)) : (&pChipcHw->GpioSR_0_7 + ((pin) >> 3))) | ||
300 | #define chipcHw_REG_CURRENT_POSITION(pin) (((pin) > 42) ? ((((pin) + 2) & 0x00000007) << 2) : (((pin) & 0x00000007) << 2)) | ||
301 | |||
302 | #define chipcHw_REG_PULL_NONE 0x00000000 /* No pull up register */ | ||
303 | #define chipcHw_REG_PULL_UP 0x00000001 /* Pull up register enable */ | ||
304 | #define chipcHw_REG_PULL_DOWN 0x00000002 /* Pull down register enable */ | ||
305 | #define chipcHw_REG_PULLUP_MASK 0x00000003 /* Mask */ | ||
306 | /* Pins beyond 42 are defined by skipping 4 bits */ | ||
307 | #define chipcHw_REG_PULLUP(pin) (((pin) > 42) ? (&pChipcHw->GpioPull_0_15 + (((pin) + 2) >> 4)) : (&pChipcHw->GpioPull_0_15 + ((pin) >> 4))) | ||
308 | #define chipcHw_REG_PULLUP_POSITION(pin) (((pin) > 42) ? ((((pin) + 2) & 0x0000000F) << 1) : (((pin) & 0x0000000F) << 1)) | ||
309 | |||
310 | #define chipcHw_REG_INPUTTYPE_CMOS 0x00000000 /* Normal CMOS logic */ | ||
311 | #define chipcHw_REG_INPUTTYPE_ST 0x00000001 /* High speed Schmitt Trigger */ | ||
312 | #define chipcHw_REG_INPUTTYPE_MASK 0x00000001 /* Mask */ | ||
313 | /* Pins beyond 42 are defined by skipping 2 bits */ | ||
314 | #define chipcHw_REG_INPUTTYPE(pin) (((pin) > 42) ? (&pChipcHw->GpioInput_0_31 + (((pin) + 2) >> 5)) : (&pChipcHw->GpioInput_0_31 + ((pin) >> 5))) | ||
315 | #define chipcHw_REG_INPUTTYPE_POSITION(pin) (((pin) > 42) ? ((((pin) + 2) & 0x0000001F)) : (((pin) & 0x0000001F))) | ||
316 | |||
317 | /* Device connected to the bus clock */ | ||
318 | #define chipcHw_REG_BUS_CLOCK_ARM 0x00000001 /* Bus interface clock for ARM */ | ||
319 | #define chipcHw_REG_BUS_CLOCK_VDEC 0x00000002 /* Bus interface clock for VDEC */ | ||
320 | #define chipcHw_REG_BUS_CLOCK_ARAM 0x00000004 /* Bus interface clock for ARAM */ | ||
321 | #define chipcHw_REG_BUS_CLOCK_HPM 0x00000008 /* Bus interface clock for HPM */ | ||
322 | #define chipcHw_REG_BUS_CLOCK_DDRC 0x00000010 /* Bus interface clock for DDRC */ | ||
323 | #define chipcHw_REG_BUS_CLOCK_DMAC0 0x00000020 /* Bus interface clock for DMAC0 */ | ||
324 | #define chipcHw_REG_BUS_CLOCK_DMAC1 0x00000040 /* Bus interface clock for DMAC1 */ | ||
325 | #define chipcHw_REG_BUS_CLOCK_NVI 0x00000080 /* Bus interface clock for NVI */ | ||
326 | #define chipcHw_REG_BUS_CLOCK_ESW 0x00000100 /* Bus interface clock for ESW */ | ||
327 | #define chipcHw_REG_BUS_CLOCK_GE 0x00000200 /* Bus interface clock for GE */ | ||
328 | #define chipcHw_REG_BUS_CLOCK_I2CH 0x00000400 /* Bus interface clock for I2CH */ | ||
329 | #define chipcHw_REG_BUS_CLOCK_I2S0 0x00000800 /* Bus interface clock for I2S0 */ | ||
330 | #define chipcHw_REG_BUS_CLOCK_I2S1 0x00001000 /* Bus interface clock for I2S1 */ | ||
331 | #define chipcHw_REG_BUS_CLOCK_VRAM 0x00002000 /* Bus interface clock for VRAM */ | ||
332 | #define chipcHw_REG_BUS_CLOCK_CLCD 0x00004000 /* Bus interface clock for CLCD */ | ||
333 | #define chipcHw_REG_BUS_CLOCK_LDK 0x00008000 /* Bus interface clock for LDK */ | ||
334 | #define chipcHw_REG_BUS_CLOCK_LED 0x00010000 /* Bus interface clock for LED */ | ||
335 | #define chipcHw_REG_BUS_CLOCK_OTP 0x00020000 /* Bus interface clock for OTP */ | ||
336 | #define chipcHw_REG_BUS_CLOCK_PIF 0x00040000 /* Bus interface clock for PIF */ | ||
337 | #define chipcHw_REG_BUS_CLOCK_SPU 0x00080000 /* Bus interface clock for SPU */ | ||
338 | #define chipcHw_REG_BUS_CLOCK_SDIO0 0x00100000 /* Bus interface clock for SDIO0 */ | ||
339 | #define chipcHw_REG_BUS_CLOCK_SDIO1 0x00200000 /* Bus interface clock for SDIO1 */ | ||
340 | #define chipcHw_REG_BUS_CLOCK_SPIH 0x00400000 /* Bus interface clock for SPIH */ | ||
341 | #define chipcHw_REG_BUS_CLOCK_SPIS 0x00800000 /* Bus interface clock for SPIS */ | ||
342 | #define chipcHw_REG_BUS_CLOCK_UART0 0x01000000 /* Bus interface clock for UART0 */ | ||
343 | #define chipcHw_REG_BUS_CLOCK_UART1 0x02000000 /* Bus interface clock for UART1 */ | ||
344 | #define chipcHw_REG_BUS_CLOCK_BBL 0x04000000 /* Bus interface clock for BBL */ | ||
345 | #define chipcHw_REG_BUS_CLOCK_I2CS 0x08000000 /* Bus interface clock for I2CS */ | ||
346 | #define chipcHw_REG_BUS_CLOCK_USBH 0x10000000 /* Bus interface clock for USB Host */ | ||
347 | #define chipcHw_REG_BUS_CLOCK_USBD 0x20000000 /* Bus interface clock for USB Device */ | ||
348 | #define chipcHw_REG_BUS_CLOCK_BROM 0x40000000 /* Bus interface clock for Boot ROM */ | ||
349 | #define chipcHw_REG_BUS_CLOCK_TSC 0x80000000 /* Bus interface clock for Touch screen */ | ||
350 | |||
351 | /* Software resets defines */ | ||
352 | #define chipcHw_REG_SOFT_RESET_VPM_GLOBAL_HOLD 0x0000000080000000ULL /* Reset Global VPM and hold */ | ||
353 | #define chipcHw_REG_SOFT_RESET_VPM_HOLD 0x0000000040000000ULL /* Reset VPM and hold */ | ||
354 | #define chipcHw_REG_SOFT_RESET_VPM_GLOBAL 0x0000000020000000ULL /* Reset Global VPM */ | ||
355 | #define chipcHw_REG_SOFT_RESET_VPM 0x0000000010000000ULL /* Reset VPM */ | ||
356 | #define chipcHw_REG_SOFT_RESET_KEYPAD 0x0000000008000000ULL /* Reset Key pad */ | ||
357 | #define chipcHw_REG_SOFT_RESET_LED 0x0000000004000000ULL /* Reset LED */ | ||
358 | #define chipcHw_REG_SOFT_RESET_SPU 0x0000000002000000ULL /* Reset SPU */ | ||
359 | #define chipcHw_REG_SOFT_RESET_RNG 0x0000000001000000ULL /* Reset RNG */ | ||
360 | #define chipcHw_REG_SOFT_RESET_PKA 0x0000000000800000ULL /* Reset PKA */ | ||
361 | #define chipcHw_REG_SOFT_RESET_LCD 0x0000000000400000ULL /* Reset LCD */ | ||
362 | #define chipcHw_REG_SOFT_RESET_PIF 0x0000000000200000ULL /* Reset PIF */ | ||
363 | #define chipcHw_REG_SOFT_RESET_I2CS 0x0000000000100000ULL /* Reset I2C Slave */ | ||
364 | #define chipcHw_REG_SOFT_RESET_I2CH 0x0000000000080000ULL /* Reset I2C Host */ | ||
365 | #define chipcHw_REG_SOFT_RESET_SDIO1 0x0000000000040000ULL /* Reset SDIO 1 */ | ||
366 | #define chipcHw_REG_SOFT_RESET_SDIO0 0x0000000000020000ULL /* Reset SDIO 0 */ | ||
367 | #define chipcHw_REG_SOFT_RESET_BBL 0x0000000000010000ULL /* Reset BBL */ | ||
368 | #define chipcHw_REG_SOFT_RESET_I2S1 0x0000000000008000ULL /* Reset I2S1 */ | ||
369 | #define chipcHw_REG_SOFT_RESET_I2S0 0x0000000000004000ULL /* Reset I2S0 */ | ||
370 | #define chipcHw_REG_SOFT_RESET_SPIS 0x0000000000002000ULL /* Reset SPI Slave */ | ||
371 | #define chipcHw_REG_SOFT_RESET_SPIH 0x0000000000001000ULL /* Reset SPI Host */ | ||
372 | #define chipcHw_REG_SOFT_RESET_GPIO1 0x0000000000000800ULL /* Reset GPIO block 1 */ | ||
373 | #define chipcHw_REG_SOFT_RESET_GPIO0 0x0000000000000400ULL /* Reset GPIO block 0 */ | ||
374 | #define chipcHw_REG_SOFT_RESET_UART1 0x0000000000000200ULL /* Reset UART 1 */ | ||
375 | #define chipcHw_REG_SOFT_RESET_UART0 0x0000000000000100ULL /* Reset UART 0 */ | ||
376 | #define chipcHw_REG_SOFT_RESET_NVI 0x0000000000000080ULL /* Reset NVI */ | ||
377 | #define chipcHw_REG_SOFT_RESET_WDOG 0x0000000000000040ULL /* Reset Watch dog */ | ||
378 | #define chipcHw_REG_SOFT_RESET_TMR 0x0000000000000020ULL /* Reset Timer */ | ||
379 | #define chipcHw_REG_SOFT_RESET_ETM 0x0000000000000010ULL /* Reset ETM */ | ||
380 | #define chipcHw_REG_SOFT_RESET_ARM_HOLD 0x0000000000000008ULL /* Reset ARM and HOLD */ | ||
381 | #define chipcHw_REG_SOFT_RESET_ARM 0x0000000000000004ULL /* Reset ARM */ | ||
382 | #define chipcHw_REG_SOFT_RESET_CHIP_WARM 0x0000000000000002ULL /* Chip warm reset */ | ||
383 | #define chipcHw_REG_SOFT_RESET_CHIP_SOFT 0x0000000000000001ULL /* Chip soft reset */ | ||
384 | #define chipcHw_REG_SOFT_RESET_VDEC 0x0000100000000000ULL /* Video decoder */ | ||
385 | #define chipcHw_REG_SOFT_RESET_GE 0x0000080000000000ULL /* Graphics engine */ | ||
386 | #define chipcHw_REG_SOFT_RESET_OTP 0x0000040000000000ULL /* Reset OTP */ | ||
387 | #define chipcHw_REG_SOFT_RESET_USB2 0x0000020000000000ULL /* Reset USB2 */ | ||
388 | #define chipcHw_REG_SOFT_RESET_USB1 0x0000010000000000ULL /* Reset USB 1 */ | ||
389 | #define chipcHw_REG_SOFT_RESET_USB 0x0000008000000000ULL /* Reset USB 1 and USB2 soft reset */ | ||
390 | #define chipcHw_REG_SOFT_RESET_ESW 0x0000004000000000ULL /* Reset Ethernet switch */ | ||
391 | #define chipcHw_REG_SOFT_RESET_ESWCLK 0x0000002000000000ULL /* Reset Ethernet switch clock */ | ||
392 | #define chipcHw_REG_SOFT_RESET_DDRPHY 0x0000001000000000ULL /* Reset DDR Physical */ | ||
393 | #define chipcHw_REG_SOFT_RESET_DDR 0x0000000800000000ULL /* Reset DDR Controller */ | ||
394 | #define chipcHw_REG_SOFT_RESET_TSC 0x0000000400000000ULL /* Reset Touch screen */ | ||
395 | #define chipcHw_REG_SOFT_RESET_PCM 0x0000000200000000ULL /* Reset PCM device */ | ||
396 | #define chipcHw_REG_SOFT_RESET_APM 0x0000200100000000ULL /* Reset APM device */ | ||
397 | |||
398 | #define chipcHw_REG_SOFT_RESET_VPM_GLOBAL_UNHOLD 0x8000000000000000ULL /* Unhold Global VPM */ | ||
399 | #define chipcHw_REG_SOFT_RESET_VPM_UNHOLD 0x4000000000000000ULL /* Unhold VPM */ | ||
400 | #define chipcHw_REG_SOFT_RESET_ARM_UNHOLD 0x2000000000000000ULL /* Unhold ARM reset */ | ||
401 | #define chipcHw_REG_SOFT_RESET_UNHOLD_MASK 0xF000000000000000ULL /* Mask to handle unhold request */ | ||
402 | |||
403 | /* Audio channel control defines */ | ||
404 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_ALL 0x00000001 /* Enable all audio channel */ | ||
405 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_A 0x00000002 /* Enable channel A */ | ||
406 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_B 0x00000004 /* Enable channel B */ | ||
407 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_C 0x00000008 /* Enable channel C */ | ||
408 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_NTP_CLOCK 0x00000010 /* Enable NTP clock */ | ||
409 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_PCM0_CLOCK 0x00000020 /* Enable PCM0 clock */ | ||
410 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_PCM1_CLOCK 0x00000040 /* Enable PCM1 clock */ | ||
411 | #define chipcHw_REG_AUDIO_CHANNEL_ENABLE_APM_CLOCK 0x00000080 /* Enable APM clock */ | ||
412 | |||
413 | /* Misc. chip control defines */ | ||
414 | #define chipcHw_REG_MISC_CTRL_GE_SEL 0x00040000 /* Select GE2/GE3 */ | ||
415 | #define chipcHw_REG_MISC_CTRL_I2S1_CLOCK_ONCHIP 0x00000000 /* Use on chip clock for I2S1 */ | ||
416 | #define chipcHw_REG_MISC_CTRL_I2S1_CLOCK_GPIO 0x00020000 /* Use external clock via GPIO pin 26 for I2S1 */ | ||
417 | #define chipcHw_REG_MISC_CTRL_I2S0_CLOCK_ONCHIP 0x00000000 /* Use on chip clock for I2S0 */ | ||
418 | #define chipcHw_REG_MISC_CTRL_I2S0_CLOCK_GPIO 0x00010000 /* Use external clock via GPIO pin 45 for I2S0 */ | ||
419 | #define chipcHw_REG_MISC_CTRL_ARM_CP15_DISABLE 0x00008000 /* Disable ARM CP15 bit */ | ||
420 | #define chipcHw_REG_MISC_CTRL_RTC_DISABLE 0x00000008 /* Disable RTC registers */ | ||
421 | #define chipcHw_REG_MISC_CTRL_BBRAM_DISABLE 0x00000004 /* Disable Battery Backed RAM */ | ||
422 | #define chipcHw_REG_MISC_CTRL_USB_MODE_HOST 0x00000002 /* Set USB as host */ | ||
423 | #define chipcHw_REG_MISC_CTRL_USB_MODE_DEVICE 0xFFFFFFFD /* Set USB as device */ | ||
424 | #define chipcHw_REG_MISC_CTRL_USB_POWERON 0xFFFFFFFE /* Power up USB */ | ||
425 | #define chipcHw_REG_MISC_CTRL_USB_POWEROFF 0x00000001 /* Power down USB */ | ||
426 | |||
427 | /* OTP configuration defines */ | ||
428 | #define chipcHw_REG_OTP_SECURITY_OFF 0x0000020000000000ULL /* Security support is OFF */ | ||
429 | #define chipcHw_REG_OTP_SPU_SLOW 0x0000010000000000ULL /* Limited SPU throughput */ | ||
430 | #define chipcHw_REG_OTP_LCD_SPEED 0x0000000600000000ULL /* Set VPM speed one */ | ||
431 | #define chipcHw_REG_OTP_VPM_SPEED_1 0x0000000100000000ULL /* Set VPM speed one */ | ||
432 | #define chipcHw_REG_OTP_VPM_SPEED_0 0x0000000080000000ULL /* Set VPM speed zero */ | ||
433 | #define chipcHw_REG_OTP_AXI_SPEED 0x0000000060000000ULL /* Set maximum AXI bus speed */ | ||
434 | #define chipcHw_REG_OTP_APM_DISABLE 0x000000001F000000ULL /* Disable APM */ | ||
435 | #define chipcHw_REG_OTP_PIF_DISABLE 0x0000000000200000ULL /* Disable PIF */ | ||
436 | #define chipcHw_REG_OTP_VDEC_DISABLE 0x0000000000100000ULL /* Disable Video decoder */ | ||
437 | #define chipcHw_REG_OTP_BBL_DISABLE 0x0000000000080000ULL /* Disable RTC and BBRAM */ | ||
438 | #define chipcHw_REG_OTP_LED_DISABLE 0x0000000000040000ULL /* Disable LED */ | ||
439 | #define chipcHw_REG_OTP_GE_DISABLE 0x0000000000020000ULL /* Disable Graphics Engine */ | ||
440 | #define chipcHw_REG_OTP_LCD_DISABLE 0x0000000000010000ULL /* Disable LCD */ | ||
441 | #define chipcHw_REG_OTP_KEYPAD_DISABLE 0x0000000000008000ULL /* Disable keypad */ | ||
442 | #define chipcHw_REG_OTP_UART_DISABLE 0x0000000000004000ULL /* Disable UART */ | ||
443 | #define chipcHw_REG_OTP_SDIOH_DISABLE 0x0000000000003000ULL /* Disable SDIO host */ | ||
444 | #define chipcHw_REG_OTP_HSS_DISABLE 0x0000000000000C00ULL /* Disable HSS */ | ||
445 | #define chipcHw_REG_OTP_TSC_DISABLE 0x0000000000000200ULL /* Disable touch screen */ | ||
446 | #define chipcHw_REG_OTP_USB_DISABLE 0x0000000000000180ULL /* Disable USB */ | ||
447 | #define chipcHw_REG_OTP_SGMII_DISABLE 0x0000000000000060ULL /* Disable SGMII */ | ||
448 | #define chipcHw_REG_OTP_ETH_DISABLE 0x0000000000000018ULL /* Disable gigabit ethernet */ | ||
449 | #define chipcHw_REG_OTP_ETH_PHY_DISABLE 0x0000000000000006ULL /* Disable ethernet PHY */ | ||
450 | #define chipcHw_REG_OTP_VPM_DISABLE 0x0000000000000001ULL /* Disable VPM */ | ||
451 | |||
452 | /* Sticky bit defines */ | ||
453 | #define chipcHw_REG_STICKY_BOOT_DONE 0x00000001 /* Boot done */ | ||
454 | #define chipcHw_REG_STICKY_SOFT_RESET 0x00000002 /* ARM soft reset */ | ||
455 | #define chipcHw_REG_STICKY_GENERAL_1 0x00000004 /* General purpose bit 1 */ | ||
456 | #define chipcHw_REG_STICKY_GENERAL_2 0x00000008 /* General purpose bit 2 */ | ||
457 | #define chipcHw_REG_STICKY_GENERAL_3 0x00000010 /* General purpose bit 3 */ | ||
458 | #define chipcHw_REG_STICKY_GENERAL_4 0x00000020 /* General purpose bit 4 */ | ||
459 | #define chipcHw_REG_STICKY_GENERAL_5 0x00000040 /* General purpose bit 5 */ | ||
460 | #define chipcHw_REG_STICKY_POR_BROM 0x00000080 /* Special sticky bit for security - set in BROM to avoid other modes being entered */ | ||
461 | #define chipcHw_REG_STICKY_ARM_RESET 0x00000100 /* ARM reset */ | ||
462 | #define chipcHw_REG_STICKY_CHIP_SOFT_RESET 0x00000200 /* Chip soft reset */ | ||
463 | #define chipcHw_REG_STICKY_CHIP_WARM_RESET 0x00000400 /* Chip warm reset */ | ||
464 | #define chipcHw_REG_STICKY_WDOG_RESET 0x00000800 /* Watchdog reset */ | ||
465 | #define chipcHw_REG_STICKY_OTP_RESET 0x00001000 /* OTP reset */ | ||
466 | |||
467 | /* HW phase alignment defines *//* Spare1 register definitions */ | ||
468 | #define chipcHw_REG_SPARE1_DDR_PHASE_INTR_ENABLE 0x80000000 /* Enable DDR phase align panic interrupt */ | ||
469 | #define chipcHw_REG_SPARE1_VPM_PHASE_INTR_ENABLE 0x40000000 /* Enable VPM phase align panic interrupt */ | ||
470 | #define chipcHw_REG_SPARE1_VPM_BUS_ACCESS_ENABLE 0x00000002 /* Enable access to VPM using system BUS */ | ||
471 | #define chipcHw_REG_SPARE1_DDR_BUS_ACCESS_ENABLE 0x00000001 /* Enable access to DDR using system BUS */ | ||
472 | /* DDRPhaseCtrl1 register definitions */ | ||
473 | #define chipcHw_REG_DDR_SW_PHASE_CTRL_ENABLE 0x80000000 /* Enable DDR SW phase alignment */ | ||
474 | #define chipcHw_REG_DDR_HW_PHASE_CTRL_ENABLE 0x40000000 /* Enable DDR HW phase alignment */ | ||
475 | #define chipcHw_REG_DDR_PHASE_VALUE_GE_MASK 0x0000007F /* DDR lower threshold for phase alignment */ | ||
476 | #define chipcHw_REG_DDR_PHASE_VALUE_GE_SHIFT 23 | ||
477 | #define chipcHw_REG_DDR_PHASE_VALUE_LE_MASK 0x0000007F /* DDR upper threshold for phase alignment */ | ||
478 | #define chipcHw_REG_DDR_PHASE_VALUE_LE_SHIFT 16 | ||
479 | #define chipcHw_REG_DDR_PHASE_ALIGN_WAIT_CYCLE_MASK 0x0000FFFF /* BUS Cycle to wait to run next DDR phase alignment */ | ||
480 | #define chipcHw_REG_DDR_PHASE_ALIGN_WAIT_CYCLE_SHIFT 0 | ||
481 | /* VPMPhaseCtrl1 register definitions */ | ||
482 | #define chipcHw_REG_VPM_SW_PHASE_CTRL_ENABLE 0x80000000 /* Enable VPM SW phase alignment */ | ||
483 | #define chipcHw_REG_VPM_HW_PHASE_CTRL_ENABLE 0x40000000 /* Enable VPM HW phase alignment */ | ||
484 | #define chipcHw_REG_VPM_PHASE_VALUE_GE_MASK 0x0000007F /* VPM lower threshold for phase alignment */ | ||
485 | #define chipcHw_REG_VPM_PHASE_VALUE_GE_SHIFT 23 | ||
486 | #define chipcHw_REG_VPM_PHASE_VALUE_LE_MASK 0x0000007F /* VPM upper threshold for phase alignment */ | ||
487 | #define chipcHw_REG_VPM_PHASE_VALUE_LE_SHIFT 16 | ||
488 | #define chipcHw_REG_VPM_PHASE_ALIGN_WAIT_CYCLE_MASK 0x0000FFFF /* BUS Cycle to wait to complete the VPM phase alignment */ | ||
489 | #define chipcHw_REG_VPM_PHASE_ALIGN_WAIT_CYCLE_SHIFT 0 | ||
490 | /* PhaseAlignStatus register definitions */ | ||
491 | #define chipcHw_REG_DDR_TIMEOUT_INTR_STATUS 0x80000000 /* DDR time out interrupt status */ | ||
492 | #define chipcHw_REG_DDR_PHASE_STATUS_MASK 0x0000007F /* DDR phase status value */ | ||
493 | #define chipcHw_REG_DDR_PHASE_STATUS_SHIFT 24 | ||
494 | #define chipcHw_REG_DDR_PHASE_ALIGNED 0x00800000 /* DDR Phase aligned status */ | ||
495 | #define chipcHw_REG_DDR_LOAD 0x00400000 /* Load DDR phase status */ | ||
496 | #define chipcHw_REG_DDR_PHASE_CTRL_MASK 0x0000003F /* DDR phase control value */ | ||
497 | #define chipcHw_REG_DDR_PHASE_CTRL_SHIFT 16 | ||
498 | #define chipcHw_REG_VPM_TIMEOUT_INTR_STATUS 0x80000000 /* VPM time out interrupt status */ | ||
499 | #define chipcHw_REG_VPM_PHASE_STATUS_MASK 0x0000007F /* VPM phase status value */ | ||
500 | #define chipcHw_REG_VPM_PHASE_STATUS_SHIFT 8 | ||
501 | #define chipcHw_REG_VPM_PHASE_ALIGNED 0x00000080 /* VPM Phase aligned status */ | ||
502 | #define chipcHw_REG_VPM_LOAD 0x00000040 /* Load VPM phase status */ | ||
503 | #define chipcHw_REG_VPM_PHASE_CTRL_MASK 0x0000003F /* VPM phase control value */ | ||
504 | #define chipcHw_REG_VPM_PHASE_CTRL_SHIFT 0 | ||
505 | /* DDRPhaseCtrl2 register definitions */ | ||
506 | #define chipcHw_REG_DDR_INTR_SERVICED 0x02000000 /* Acknowledge that interrupt was serviced */ | ||
507 | #define chipcHw_REG_DDR_TIMEOUT_INTR_ENABLE 0x01000000 /* Enable time out interrupt */ | ||
508 | #define chipcHw_REG_DDR_LOAD_COUNT_PHASE_CTRL_MASK 0x0000000F /* Wait before toggling load_ch */ | ||
509 | #define chipcHw_REG_DDR_LOAD_COUNT_PHASE_CTRL_SHIFT 20 | ||
510 | #define chipcHw_REG_DDR_TOTAL_LOAD_COUNT_CTRL_MASK 0x0000000F /* Total wait to settle ph_ctrl and load_ch */ | ||
511 | #define chipcHw_REG_DDR_TOTAL_LOAD_COUNT_CTRL_SHIFT 16 | ||
512 | #define chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_MASK 0x0000FFFF /* Time out value for DDR HW phase alignment */ | ||
513 | #define chipcHw_REG_DDR_PHASE_TIMEOUT_COUNT_SHIFT 0 | ||
514 | /* VPMPhaseCtrl2 register definitions */ | ||
515 | #define chipcHw_REG_VPM_INTR_SELECT_MASK 0x00000003 /* Interrupt select */ | ||
516 | #define chipcHw_REG_VPM_INTR_SELECT_SHIFT 26 | ||
517 | #define chipcHw_REG_VPM_INTR_DISABLE 0x00000000 | ||
518 | #define chipcHw_REG_VPM_INTR_FAST (0x1 << chipcHw_REG_VPM_INTR_SELECT_SHIFT) | ||
519 | #define chipcHw_REG_VPM_INTR_MEDIUM (0x2 << chipcHw_REG_VPM_INTR_SELECT_SHIFT) | ||
520 | #define chipcHw_REG_VPM_INTR_SLOW (0x3 << chipcHw_REG_VPM_INTR_SELECT_SHIFT) | ||
521 | #define chipcHw_REG_VPM_INTR_SERVICED 0x02000000 /* Acknowledge that interrupt was serviced */ | ||
522 | #define chipcHw_REG_VPM_TIMEOUT_INTR_ENABLE 0x01000000 /* Enable time out interrupt */ | ||
523 | #define chipcHw_REG_VPM_LOAD_COUNT_PHASE_CTRL_MASK 0x0000000F /* Wait before toggling load_ch */ | ||
524 | #define chipcHw_REG_VPM_LOAD_COUNT_PHASE_CTRL_SHIFT 20 | ||
525 | #define chipcHw_REG_VPM_TOTAL_LOAD_COUNT_CTRL_MASK 0x0000000F /* Total wait cycle to settle ph_ctrl and load_ch */ | ||
526 | #define chipcHw_REG_VPM_TOTAL_LOAD_COUNT_CTRL_SHIFT 16 | ||
527 | #define chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_MASK 0x0000FFFF /* Time out value for VPM HW phase alignment */ | ||
528 | #define chipcHw_REG_VPM_PHASE_TIMEOUT_COUNT_SHIFT 0 | ||
529 | |||
530 | #endif /* CHIPCHW_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/ddrcReg.h b/arch/arm/mach-bcmring/include/mach/csp/ddrcReg.h deleted file mode 100644 index 39da2c1fdafb..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/ddrcReg.h +++ /dev/null | |||
@@ -1,872 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file ddrcReg.h | ||
18 | * | ||
19 | * @brief Register definitions for BCMRING DDR2 Controller and PHY | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | |||
24 | #ifndef DDRC_REG_H | ||
25 | #define DDRC_REG_H | ||
26 | |||
27 | #ifdef __cplusplus | ||
28 | extern "C" { | ||
29 | #endif | ||
30 | |||
31 | /* ---- Include Files ---------------------------------------------------- */ | ||
32 | |||
33 | #include <mach/csp/reg.h> | ||
34 | #include <linux/types.h> | ||
35 | |||
36 | #include <mach/csp/mm_io.h> | ||
37 | |||
38 | /* ---- Public Constants and Types --------------------------------------- */ | ||
39 | |||
40 | /*********************************************************************/ | ||
41 | /* DDR2 Controller (ARM PL341) register definitions */ | ||
42 | /*********************************************************************/ | ||
43 | |||
44 | /* -------------------------------------------------------------------- */ | ||
45 | /* -------------------------------------------------------------------- */ | ||
46 | /* ARM PL341 DDR2 configuration registers, offset 0x000 */ | ||
47 | /* -------------------------------------------------------------------- */ | ||
48 | /* -------------------------------------------------------------------- */ | ||
49 | |||
50 | typedef struct { | ||
51 | uint32_t memcStatus; | ||
52 | uint32_t memcCmd; | ||
53 | uint32_t directCmd; | ||
54 | uint32_t memoryCfg; | ||
55 | uint32_t refreshPrd; | ||
56 | uint32_t casLatency; | ||
57 | uint32_t writeLatency; | ||
58 | uint32_t tMrd; | ||
59 | uint32_t tRas; | ||
60 | uint32_t tRc; | ||
61 | uint32_t tRcd; | ||
62 | uint32_t tRfc; | ||
63 | uint32_t tRp; | ||
64 | uint32_t tRrd; | ||
65 | uint32_t tWr; | ||
66 | uint32_t tWtr; | ||
67 | uint32_t tXp; | ||
68 | uint32_t tXsr; | ||
69 | uint32_t tEsr; | ||
70 | uint32_t memoryCfg2; | ||
71 | uint32_t memoryCfg3; | ||
72 | uint32_t tFaw; | ||
73 | } ddrcReg_CTLR_MEMC_REG_t; | ||
74 | |||
75 | #define ddrcReg_CTLR_MEMC_REG_OFFSET 0x0000 | ||
76 | #define ddrcReg_CTLR_MEMC_REGP ((volatile ddrcReg_CTLR_MEMC_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_CTLR_MEMC_REG_OFFSET)) | ||
77 | |||
78 | /* ----------------------------------------------------- */ | ||
79 | |||
80 | #define ddrcReg_CTLR_MEMC_STATUS_BANKS_MASK (0x3 << 12) | ||
81 | #define ddrcReg_CTLR_MEMC_STATUS_BANKS_4 (0x0 << 12) | ||
82 | #define ddrcReg_CTLR_MEMC_STATUS_BANKS_8 (0x3 << 12) | ||
83 | |||
84 | #define ddrcReg_CTLR_MEMC_STATUS_MONITORS_MASK (0x3 << 10) | ||
85 | #define ddrcReg_CTLR_MEMC_STATUS_MONITORS_0 (0x0 << 10) | ||
86 | #define ddrcReg_CTLR_MEMC_STATUS_MONITORS_1 (0x1 << 10) | ||
87 | #define ddrcReg_CTLR_MEMC_STATUS_MONITORS_2 (0x2 << 10) | ||
88 | #define ddrcReg_CTLR_MEMC_STATUS_MONITORS_4 (0x3 << 10) | ||
89 | |||
90 | #define ddrcReg_CTLR_MEMC_STATUS_CHIPS_MASK (0x3 << 7) | ||
91 | #define ddrcReg_CTLR_MEMC_STATUS_CHIPS_1 (0x0 << 7) | ||
92 | #define ddrcReg_CTLR_MEMC_STATUS_CHIPS_2 (0x1 << 7) | ||
93 | #define ddrcReg_CTLR_MEMC_STATUS_CHIPS_3 (0x2 << 7) | ||
94 | #define ddrcReg_CTLR_MEMC_STATUS_CHIPS_4 (0x3 << 7) | ||
95 | |||
96 | #define ddrcReg_CTLR_MEMC_STATUS_TYPE_MASK (0x7 << 4) | ||
97 | #define ddrcReg_CTLR_MEMC_STATUS_TYPE_DDR2 (0x5 << 4) | ||
98 | |||
99 | #define ddrcReg_CTLR_MEMC_STATUS_WIDTH_MASK (0x3 << 2) | ||
100 | #define ddrcReg_CTLR_MEMC_STATUS_WIDTH_16 (0x0 << 2) | ||
101 | #define ddrcReg_CTLR_MEMC_STATUS_WIDTH_32 (0x1 << 2) | ||
102 | #define ddrcReg_CTLR_MEMC_STATUS_WIDTH_64 (0x2 << 2) | ||
103 | #define ddrcReg_CTLR_MEMC_STATUS_WIDTH_128 (0x3 << 2) | ||
104 | |||
105 | #define ddrcReg_CTLR_MEMC_STATUS_STATE_MASK (0x3 << 0) | ||
106 | #define ddrcReg_CTLR_MEMC_STATUS_STATE_CONFIG (0x0 << 0) | ||
107 | #define ddrcReg_CTLR_MEMC_STATUS_STATE_READY (0x1 << 0) | ||
108 | #define ddrcReg_CTLR_MEMC_STATUS_STATE_PAUSED (0x2 << 0) | ||
109 | #define ddrcReg_CTLR_MEMC_STATUS_STATE_LOWPWR (0x3 << 0) | ||
110 | |||
111 | /* ----------------------------------------------------- */ | ||
112 | |||
113 | #define ddrcReg_CTLR_MEMC_CMD_MASK (0x7 << 0) | ||
114 | #define ddrcReg_CTLR_MEMC_CMD_GO (0x0 << 0) | ||
115 | #define ddrcReg_CTLR_MEMC_CMD_SLEEP (0x1 << 0) | ||
116 | #define ddrcReg_CTLR_MEMC_CMD_WAKEUP (0x2 << 0) | ||
117 | #define ddrcReg_CTLR_MEMC_CMD_PAUSE (0x3 << 0) | ||
118 | #define ddrcReg_CTLR_MEMC_CMD_CONFIGURE (0x4 << 0) | ||
119 | #define ddrcReg_CTLR_MEMC_CMD_ACTIVE_PAUSE (0x7 << 0) | ||
120 | |||
121 | /* ----------------------------------------------------- */ | ||
122 | |||
123 | #define ddrcReg_CTLR_DIRECT_CMD_CHIP_SHIFT 20 | ||
124 | #define ddrcReg_CTLR_DIRECT_CMD_CHIP_MASK (0x3 << ddrcReg_CTLR_DIRECT_CMD_CHIP_SHIFT) | ||
125 | |||
126 | #define ddrcReg_CTLR_DIRECT_CMD_TYPE_PRECHARGEALL (0x0 << 18) | ||
127 | #define ddrcReg_CTLR_DIRECT_CMD_TYPE_AUTOREFRESH (0x1 << 18) | ||
128 | #define ddrcReg_CTLR_DIRECT_CMD_TYPE_MODEREG (0x2 << 18) | ||
129 | #define ddrcReg_CTLR_DIRECT_CMD_TYPE_NOP (0x3 << 18) | ||
130 | |||
131 | #define ddrcReg_CTLR_DIRECT_CMD_BANK_SHIFT 16 | ||
132 | #define ddrcReg_CTLR_DIRECT_CMD_BANK_MASK (0x3 << ddrcReg_CTLR_DIRECT_CMD_BANK_SHIFT) | ||
133 | |||
134 | #define ddrcReg_CTLR_DIRECT_CMD_ADDR_SHIFT 0 | ||
135 | #define ddrcReg_CTLR_DIRECT_CMD_ADDR_MASK (0x1ffff << ddrcReg_CTLR_DIRECT_CMD_ADDR_SHIFT) | ||
136 | |||
137 | /* ----------------------------------------------------- */ | ||
138 | |||
139 | #define ddrcReg_CTLR_MEMORY_CFG_CHIP_CNT_MASK (0x3 << 21) | ||
140 | #define ddrcReg_CTLR_MEMORY_CFG_CHIP_CNT_1 (0x0 << 21) | ||
141 | #define ddrcReg_CTLR_MEMORY_CFG_CHIP_CNT_2 (0x1 << 21) | ||
142 | #define ddrcReg_CTLR_MEMORY_CFG_CHIP_CNT_3 (0x2 << 21) | ||
143 | #define ddrcReg_CTLR_MEMORY_CFG_CHIP_CNT_4 (0x3 << 21) | ||
144 | |||
145 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_MASK (0x7 << 18) | ||
146 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_3_0 (0x0 << 18) | ||
147 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_4_1 (0x1 << 18) | ||
148 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_5_2 (0x2 << 18) | ||
149 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_6_3 (0x3 << 18) | ||
150 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_7_4 (0x4 << 18) | ||
151 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_8_5 (0x5 << 18) | ||
152 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_9_6 (0x6 << 18) | ||
153 | #define ddrcReg_CTLR_MEMORY_CFG_QOS_ARID_10_7 (0x7 << 18) | ||
154 | |||
155 | #define ddrcReg_CTLR_MEMORY_CFG_BURST_LEN_MASK (0x7 << 15) | ||
156 | #define ddrcReg_CTLR_MEMORY_CFG_BURST_LEN_4 (0x2 << 15) | ||
157 | #define ddrcReg_CTLR_MEMORY_CFG_BURST_LEN_8 (0x3 << 15) /* @note Not supported in PL341 */ | ||
158 | |||
159 | #define ddrcReg_CTLR_MEMORY_CFG_PWRDOWN_ENABLE (0x1 << 13) | ||
160 | |||
161 | #define ddrcReg_CTLR_MEMORY_CFG_PWRDOWN_CYCLES_SHIFT 7 | ||
162 | #define ddrcReg_CTLR_MEMORY_CFG_PWRDOWN_CYCLES_MASK (0x3f << ddrcReg_CTLR_MEMORY_CFG_PWRDOWN_CYCLES_SHIFT) | ||
163 | |||
164 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_MASK (0x7 << 3) | ||
165 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_11 (0x0 << 3) | ||
166 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_12 (0x1 << 3) | ||
167 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_13 (0x2 << 3) | ||
168 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_14 (0x3 << 3) | ||
169 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_15 (0x4 << 3) | ||
170 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_ROW_BITS_16 (0x5 << 3) | ||
171 | |||
172 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_COL_BITS_MASK (0x7 << 0) | ||
173 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_COL_BITS_9 (0x1 << 0) | ||
174 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_COL_BITS_10 (0x2 << 0) | ||
175 | #define ddrcReg_CTLR_MEMORY_CFG_AXI_COL_BITS_11 (0x3 << 0) | ||
176 | |||
177 | /* ----------------------------------------------------- */ | ||
178 | |||
179 | #define ddrcReg_CTLR_REFRESH_PRD_SHIFT 0 | ||
180 | #define ddrcReg_CTLR_REFRESH_PRD_MASK (0x7fff << ddrcReg_CTLR_REFRESH_PRD_SHIFT) | ||
181 | |||
182 | /* ----------------------------------------------------- */ | ||
183 | |||
184 | #define ddrcReg_CTLR_CAS_LATENCY_SHIFT 1 | ||
185 | #define ddrcReg_CTLR_CAS_LATENCY_MASK (0x7 << ddrcReg_CTLR_CAS_LATENCY_SHIFT) | ||
186 | |||
187 | /* ----------------------------------------------------- */ | ||
188 | |||
189 | #define ddrcReg_CTLR_WRITE_LATENCY_SHIFT 0 | ||
190 | #define ddrcReg_CTLR_WRITE_LATENCY_MASK (0x7 << ddrcReg_CTLR_WRITE_LATENCY_SHIFT) | ||
191 | |||
192 | /* ----------------------------------------------------- */ | ||
193 | |||
194 | #define ddrcReg_CTLR_T_MRD_SHIFT 0 | ||
195 | #define ddrcReg_CTLR_T_MRD_MASK (0x7f << ddrcReg_CTLR_T_MRD_SHIFT) | ||
196 | |||
197 | /* ----------------------------------------------------- */ | ||
198 | |||
199 | #define ddrcReg_CTLR_T_RAS_SHIFT 0 | ||
200 | #define ddrcReg_CTLR_T_RAS_MASK (0x1f << ddrcReg_CTLR_T_RAS_SHIFT) | ||
201 | |||
202 | /* ----------------------------------------------------- */ | ||
203 | |||
204 | #define ddrcReg_CTLR_T_RC_SHIFT 0 | ||
205 | #define ddrcReg_CTLR_T_RC_MASK (0x1f << ddrcReg_CTLR_T_RC_SHIFT) | ||
206 | |||
207 | /* ----------------------------------------------------- */ | ||
208 | |||
209 | #define ddrcReg_CTLR_T_RCD_SCHEDULE_DELAY_SHIFT 8 | ||
210 | #define ddrcReg_CTLR_T_RCD_SCHEDULE_DELAY_MASK (0x7 << ddrcReg_CTLR_T_RCD_SCHEDULE_DELAY_SHIFT) | ||
211 | |||
212 | #define ddrcReg_CTLR_T_RCD_SHIFT 0 | ||
213 | #define ddrcReg_CTLR_T_RCD_MASK (0x7 << ddrcReg_CTLR_T_RCD_SHIFT) | ||
214 | |||
215 | /* ----------------------------------------------------- */ | ||
216 | |||
217 | #define ddrcReg_CTLR_T_RFC_SCHEDULE_DELAY_SHIFT 8 | ||
218 | #define ddrcReg_CTLR_T_RFC_SCHEDULE_DELAY_MASK (0x7f << ddrcReg_CTLR_T_RFC_SCHEDULE_DELAY_SHIFT) | ||
219 | |||
220 | #define ddrcReg_CTLR_T_RFC_SHIFT 0 | ||
221 | #define ddrcReg_CTLR_T_RFC_MASK (0x7f << ddrcReg_CTLR_T_RFC_SHIFT) | ||
222 | |||
223 | /* ----------------------------------------------------- */ | ||
224 | |||
225 | #define ddrcReg_CTLR_T_RP_SCHEDULE_DELAY_SHIFT 8 | ||
226 | #define ddrcReg_CTLR_T_RP_SCHEDULE_DELAY_MASK (0x7 << ddrcReg_CTLR_T_RP_SCHEDULE_DELAY_SHIFT) | ||
227 | |||
228 | #define ddrcReg_CTLR_T_RP_SHIFT 0 | ||
229 | #define ddrcReg_CTLR_T_RP_MASK (0xf << ddrcReg_CTLR_T_RP_SHIFT) | ||
230 | |||
231 | /* ----------------------------------------------------- */ | ||
232 | |||
233 | #define ddrcReg_CTLR_T_RRD_SHIFT 0 | ||
234 | #define ddrcReg_CTLR_T_RRD_MASK (0xf << ddrcReg_CTLR_T_RRD_SHIFT) | ||
235 | |||
236 | /* ----------------------------------------------------- */ | ||
237 | |||
238 | #define ddrcReg_CTLR_T_WR_SHIFT 0 | ||
239 | #define ddrcReg_CTLR_T_WR_MASK (0x7 << ddrcReg_CTLR_T_WR_SHIFT) | ||
240 | |||
241 | /* ----------------------------------------------------- */ | ||
242 | |||
243 | #define ddrcReg_CTLR_T_WTR_SHIFT 0 | ||
244 | #define ddrcReg_CTLR_T_WTR_MASK (0x7 << ddrcReg_CTLR_T_WTR_SHIFT) | ||
245 | |||
246 | /* ----------------------------------------------------- */ | ||
247 | |||
248 | #define ddrcReg_CTLR_T_XP_SHIFT 0 | ||
249 | #define ddrcReg_CTLR_T_XP_MASK (0xff << ddrcReg_CTLR_T_XP_SHIFT) | ||
250 | |||
251 | /* ----------------------------------------------------- */ | ||
252 | |||
253 | #define ddrcReg_CTLR_T_XSR_SHIFT 0 | ||
254 | #define ddrcReg_CTLR_T_XSR_MASK (0xff << ddrcReg_CTLR_T_XSR_SHIFT) | ||
255 | |||
256 | /* ----------------------------------------------------- */ | ||
257 | |||
258 | #define ddrcReg_CTLR_T_ESR_SHIFT 0 | ||
259 | #define ddrcReg_CTLR_T_ESR_MASK (0xff << ddrcReg_CTLR_T_ESR_SHIFT) | ||
260 | |||
261 | /* ----------------------------------------------------- */ | ||
262 | |||
263 | #define ddrcReg_CTLR_MEMORY_CFG2_WIDTH_MASK (0x3 << 6) | ||
264 | #define ddrcReg_CTLR_MEMORY_CFG2_WIDTH_16BITS (0 << 6) | ||
265 | #define ddrcReg_CTLR_MEMORY_CFG2_WIDTH_32BITS (1 << 6) | ||
266 | #define ddrcReg_CTLR_MEMORY_CFG2_WIDTH_64BITS (2 << 6) | ||
267 | |||
268 | #define ddrcReg_CTLR_MEMORY_CFG2_AXI_BANK_BITS_MASK (0x3 << 4) | ||
269 | #define ddrcReg_CTLR_MEMORY_CFG2_AXI_BANK_BITS_2 (0 << 4) | ||
270 | #define ddrcReg_CTLR_MEMORY_CFG2_AXI_BANK_BITS_3 (3 << 4) | ||
271 | |||
272 | #define ddrcReg_CTLR_MEMORY_CFG2_CKE_INIT_STATE_LOW (0 << 3) | ||
273 | #define ddrcReg_CTLR_MEMORY_CFG2_CKE_INIT_STATE_HIGH (1 << 3) | ||
274 | |||
275 | #define ddrcReg_CTLR_MEMORY_CFG2_DQM_INIT_STATE_LOW (0 << 2) | ||
276 | #define ddrcReg_CTLR_MEMORY_CFG2_DQM_INIT_STATE_HIGH (1 << 2) | ||
277 | |||
278 | #define ddrcReg_CTLR_MEMORY_CFG2_CLK_MASK (0x3 << 0) | ||
279 | #define ddrcReg_CTLR_MEMORY_CFG2_CLK_ASYNC (0 << 0) | ||
280 | #define ddrcReg_CTLR_MEMORY_CFG2_CLK_SYNC_A_LE_M (1 << 0) | ||
281 | #define ddrcReg_CTLR_MEMORY_CFG2_CLK_SYNC_A_GT_M (3 << 0) | ||
282 | |||
283 | /* ----------------------------------------------------- */ | ||
284 | |||
285 | #define ddrcReg_CTLR_MEMORY_CFG3_REFRESH_TO_SHIFT 0 | ||
286 | #define ddrcReg_CTLR_MEMORY_CFG3_REFRESH_TO_MASK (0x7 << ddrcReg_CTLR_MEMORY_CFG3_REFRESH_TO_SHIFT) | ||
287 | |||
288 | /* ----------------------------------------------------- */ | ||
289 | |||
290 | #define ddrcReg_CTLR_T_FAW_SCHEDULE_DELAY_SHIFT 8 | ||
291 | #define ddrcReg_CTLR_T_FAW_SCHEDULE_DELAY_MASK (0x1f << ddrcReg_CTLR_T_FAW_SCHEDULE_DELAY_SHIFT) | ||
292 | |||
293 | #define ddrcReg_CTLR_T_FAW_PERIOD_SHIFT 0 | ||
294 | #define ddrcReg_CTLR_T_FAW_PERIOD_MASK (0x1f << ddrcReg_CTLR_T_FAW_PERIOD_SHIFT) | ||
295 | |||
296 | /* -------------------------------------------------------------------- */ | ||
297 | /* -------------------------------------------------------------------- */ | ||
298 | /* ARM PL341 AXI ID QOS configuration registers, offset 0x100 */ | ||
299 | /* -------------------------------------------------------------------- */ | ||
300 | /* -------------------------------------------------------------------- */ | ||
301 | |||
302 | #define ddrcReg_CTLR_QOS_CNT 16 | ||
303 | #define ddrcReg_CTLR_QOS_MAX (ddrcReg_CTLR_QOS_CNT - 1) | ||
304 | |||
305 | typedef struct { | ||
306 | uint32_t cfg[ddrcReg_CTLR_QOS_CNT]; | ||
307 | } ddrcReg_CTLR_QOS_REG_t; | ||
308 | |||
309 | #define ddrcReg_CTLR_QOS_REG_OFFSET 0x100 | ||
310 | #define ddrcReg_CTLR_QOS_REGP ((volatile ddrcReg_CTLR_QOS_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_CTLR_QOS_REG_OFFSET)) | ||
311 | |||
312 | /* ----------------------------------------------------- */ | ||
313 | |||
314 | #define ddrcReg_CTLR_QOS_CFG_MAX_SHIFT 2 | ||
315 | #define ddrcReg_CTLR_QOS_CFG_MAX_MASK (0xff << ddrcReg_CTLR_QOS_CFG_MAX_SHIFT) | ||
316 | |||
317 | #define ddrcReg_CTLR_QOS_CFG_MIN_SHIFT 1 | ||
318 | #define ddrcReg_CTLR_QOS_CFG_MIN_MASK (1 << ddrcReg_CTLR_QOS_CFG_MIN_SHIFT) | ||
319 | |||
320 | #define ddrcReg_CTLR_QOS_CFG_ENABLE (1 << 0) | ||
321 | |||
322 | /* -------------------------------------------------------------------- */ | ||
323 | /* -------------------------------------------------------------------- */ | ||
324 | /* ARM PL341 Memory chip configuration registers, offset 0x200 */ | ||
325 | /* -------------------------------------------------------------------- */ | ||
326 | /* -------------------------------------------------------------------- */ | ||
327 | |||
328 | #define ddrcReg_CTLR_CHIP_CNT 4 | ||
329 | #define ddrcReg_CTLR_CHIP_MAX (ddrcReg_CTLR_CHIP_CNT - 1) | ||
330 | |||
331 | typedef struct { | ||
332 | uint32_t cfg[ddrcReg_CTLR_CHIP_CNT]; | ||
333 | } ddrcReg_CTLR_CHIP_REG_t; | ||
334 | |||
335 | #define ddrcReg_CTLR_CHIP_REG_OFFSET 0x200 | ||
336 | #define ddrcReg_CTLR_CHIP_REGP ((volatile ddrcReg_CTLR_CHIP_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_CTLR_CHIP_REG_OFFSET)) | ||
337 | |||
338 | /* ----------------------------------------------------- */ | ||
339 | |||
340 | #define ddrcReg_CTLR_CHIP_CFG_MEM_ORG_MASK (1 << 16) | ||
341 | #define ddrcReg_CTLR_CHIP_CFG_MEM_ORG_ROW_BANK_COL (0 << 16) | ||
342 | #define ddrcReg_CTLR_CHIP_CFG_MEM_ORG_BANK_ROW_COL (1 << 16) | ||
343 | |||
344 | #define ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MATCH_SHIFT 8 | ||
345 | #define ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MATCH_MASK (0xff << ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MATCH_SHIFT) | ||
346 | |||
347 | #define ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MASK_SHIFT 0 | ||
348 | #define ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MASK_MASK (0xff << ddrcReg_CTLR_CHIP_CFG_AXI_ADDR_MASK_SHIFT) | ||
349 | |||
350 | /* -------------------------------------------------------------------- */ | ||
351 | /* -------------------------------------------------------------------- */ | ||
352 | /* ARM PL341 User configuration registers, offset 0x300 */ | ||
353 | /* -------------------------------------------------------------------- */ | ||
354 | /* -------------------------------------------------------------------- */ | ||
355 | |||
356 | #define ddrcReg_CTLR_USER_OUTPUT_CNT 2 | ||
357 | |||
358 | typedef struct { | ||
359 | uint32_t input; | ||
360 | uint32_t output[ddrcReg_CTLR_USER_OUTPUT_CNT]; | ||
361 | uint32_t feature; | ||
362 | } ddrcReg_CTLR_USER_REG_t; | ||
363 | |||
364 | #define ddrcReg_CTLR_USER_REG_OFFSET 0x300 | ||
365 | #define ddrcReg_CTLR_USER_REGP ((volatile ddrcReg_CTLR_USER_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_CTLR_USER_REG_OFFSET)) | ||
366 | |||
367 | /* ----------------------------------------------------- */ | ||
368 | |||
369 | #define ddrcReg_CTLR_USER_INPUT_STATUS_SHIFT 0 | ||
370 | #define ddrcReg_CTLR_USER_INPUT_STATUS_MASK (0xff << ddrcReg_CTLR_USER_INPUT_STATUS_SHIFT) | ||
371 | |||
372 | /* ----------------------------------------------------- */ | ||
373 | |||
374 | #define ddrcReg_CTLR_USER_OUTPUT_CFG_SHIFT 0 | ||
375 | #define ddrcReg_CTLR_USER_OUTPUT_CFG_MASK (0xff << ddrcReg_CTLR_USER_OUTPUT_CFG_SHIFT) | ||
376 | |||
377 | #define ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_SHIFT 1 | ||
378 | #define ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_MASK (1 << ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_SHIFT) | ||
379 | #define ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_BP134 (0 << ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_SHIFT) | ||
380 | #define ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_PL301 (1 << ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_SHIFT) | ||
381 | #define ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_REGISTERED ddrcReg_CTLR_USER_OUTPUT_0_CFG_SYNC_BRIDGE_PL301 | ||
382 | |||
383 | /* ----------------------------------------------------- */ | ||
384 | |||
385 | #define ddrcReg_CTLR_FEATURE_WRITE_BLOCK_DISABLE (1 << 2) | ||
386 | #define ddrcReg_CTLR_FEATURE_EARLY_BURST_RSP_DISABLE (1 << 0) | ||
387 | |||
388 | /*********************************************************************/ | ||
389 | /* Broadcom DDR23 PHY register definitions */ | ||
390 | /*********************************************************************/ | ||
391 | |||
392 | /* -------------------------------------------------------------------- */ | ||
393 | /* -------------------------------------------------------------------- */ | ||
394 | /* Broadcom DDR23 PHY Address and Control register definitions */ | ||
395 | /* -------------------------------------------------------------------- */ | ||
396 | /* -------------------------------------------------------------------- */ | ||
397 | |||
398 | typedef struct { | ||
399 | uint32_t revision; | ||
400 | uint32_t pmCtl; | ||
401 | REG32_RSVD(0x0008, 0x0010); | ||
402 | uint32_t pllStatus; | ||
403 | uint32_t pllCfg; | ||
404 | uint32_t pllPreDiv; | ||
405 | uint32_t pllDiv; | ||
406 | uint32_t pllCtl1; | ||
407 | uint32_t pllCtl2; | ||
408 | uint32_t ssCtl; | ||
409 | uint32_t ssCfg; | ||
410 | uint32_t vdlStatic; | ||
411 | uint32_t vdlDynamic; | ||
412 | uint32_t padIdle; | ||
413 | uint32_t pvtComp; | ||
414 | uint32_t padDrive; | ||
415 | uint32_t clkRgltrCtl; | ||
416 | } ddrcReg_PHY_ADDR_CTL_REG_t; | ||
417 | |||
418 | #define ddrcReg_PHY_ADDR_CTL_REG_OFFSET 0x0400 | ||
419 | #define ddrcReg_PHY_ADDR_CTL_REGP ((volatile ddrcReg_PHY_ADDR_CTL_REG_t __iomem*) (MM_IO_BASE_DDRC + ddrcReg_PHY_ADDR_CTL_REG_OFFSET)) | ||
420 | |||
421 | /* @todo These SS definitions are duplicates of ones below */ | ||
422 | |||
423 | #define ddrcReg_PHY_ADDR_SS_CTRL_ENABLE 0x00000001 | ||
424 | #define ddrcReg_PHY_ADDR_SS_CFG_CYCLE_PER_TICK_MASK 0xFFFF0000 | ||
425 | #define ddrcReg_PHY_ADDR_SS_CFG_CYCLE_PER_TICK_SHIFT 16 | ||
426 | #define ddrcReg_PHY_ADDR_SS_CFG_MIN_CYCLE_PER_TICK 10 /* Higher the value, lower the SS modulation frequency */ | ||
427 | #define ddrcReg_PHY_ADDR_SS_CFG_NDIV_AMPLITUDE_MASK 0x0000FFFF | ||
428 | #define ddrcReg_PHY_ADDR_SS_CFG_NDIV_AMPLITUDE_SHIFT 0 | ||
429 | |||
430 | /* ----------------------------------------------------- */ | ||
431 | |||
432 | #define ddrcReg_PHY_ADDR_CTL_REVISION_MAJOR_SHIFT 8 | ||
433 | #define ddrcReg_PHY_ADDR_CTL_REVISION_MAJOR_MASK (0xff << ddrcReg_PHY_ADDR_CTL_REVISION_MAJOR_SHIFT) | ||
434 | |||
435 | #define ddrcReg_PHY_ADDR_CTL_REVISION_MINOR_SHIFT 0 | ||
436 | #define ddrcReg_PHY_ADDR_CTL_REVISION_MINOR_MASK (0xff << ddrcReg_PHY_ADDR_CTL_REVISION_MINOR_SHIFT) | ||
437 | |||
438 | /* ----------------------------------------------------- */ | ||
439 | |||
440 | #define ddrcReg_PHY_ADDR_CTL_CLK_PM_CTL_DDR_CLK_DISABLE (1 << 0) | ||
441 | |||
442 | /* ----------------------------------------------------- */ | ||
443 | |||
444 | #define ddrcReg_PHY_ADDR_CTL_PLL_STATUS_LOCKED (1 << 0) | ||
445 | |||
446 | /* ----------------------------------------------------- */ | ||
447 | |||
448 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_DIV2_CLK_RESET (1 << 31) | ||
449 | |||
450 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_TEST_SEL_SHIFT 17 | ||
451 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_TEST_SEL_MASK (0x1f << ddrcReg_PHY_ADDR_CTL_PLL_CFG_TEST_SEL_SHIFT) | ||
452 | |||
453 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_TEST_ENABLE (1 << 16) | ||
454 | |||
455 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_BGAP_ADJ_SHIFT 12 | ||
456 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_BGAP_ADJ_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PLL_CFG_BGAP_ADJ_SHIFT) | ||
457 | |||
458 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_VCO_RNG (1 << 7) | ||
459 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_CH1_PWRDWN (1 << 6) | ||
460 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_BYPASS_ENABLE (1 << 5) | ||
461 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_CLKOUT_ENABLE (1 << 4) | ||
462 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_D_RESET (1 << 3) | ||
463 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_A_RESET (1 << 2) | ||
464 | #define ddrcReg_PHY_ADDR_CTL_PLL_CFG_PWRDWN (1 << 0) | ||
465 | |||
466 | /* ----------------------------------------------------- */ | ||
467 | |||
468 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_DITHER_MFB (1 << 26) | ||
469 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_PWRDWN (1 << 25) | ||
470 | |||
471 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_MODE_SHIFT 20 | ||
472 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_MODE_MASK (0x7 << ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_MODE_SHIFT) | ||
473 | |||
474 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_INT_SHIFT 8 | ||
475 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_INT_MASK (0x1ff << ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_INT_SHIFT) | ||
476 | |||
477 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P2_SHIFT 4 | ||
478 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P2_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P2_SHIFT) | ||
479 | |||
480 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P1_SHIFT 0 | ||
481 | #define ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P1_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PLL_PRE_DIV_P1_SHIFT) | ||
482 | |||
483 | /* ----------------------------------------------------- */ | ||
484 | |||
485 | #define ddrcReg_PHY_ADDR_CTL_PLL_DIV_M1_SHIFT 24 | ||
486 | #define ddrcReg_PHY_ADDR_CTL_PLL_DIV_M1_MASK (0xff << ddrcReg_PHY_ADDR_CTL_PLL_DIV_M1_SHIFT) | ||
487 | |||
488 | #define ddrcReg_PHY_ADDR_CTL_PLL_DIV_FRAC_SHIFT 0 | ||
489 | #define ddrcReg_PHY_ADDR_CTL_PLL_DIV_FRAC_MASK (0xffffff << ddrcReg_PHY_ADDR_CTL_PLL_DIV_FRAC_SHIFT) | ||
490 | |||
491 | /* ----------------------------------------------------- */ | ||
492 | |||
493 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_TESTA_SHIFT 30 | ||
494 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_TESTA_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_TESTA_SHIFT) | ||
495 | |||
496 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XS_SHIFT 27 | ||
497 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XS_MASK (0x7 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XS_SHIFT) | ||
498 | |||
499 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XF_SHIFT 24 | ||
500 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XF_MASK (0x7 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_KVCO_XF_SHIFT) | ||
501 | |||
502 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_LPF_BW_SHIFT 22 | ||
503 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_LPF_BW_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_LPF_BW_SHIFT) | ||
504 | |||
505 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_LF_ORDER (0x1 << 21) | ||
506 | |||
507 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CN_SHIFT 19 | ||
508 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CN_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CN_SHIFT) | ||
509 | |||
510 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RN_SHIFT 17 | ||
511 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RN_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RN_SHIFT) | ||
512 | |||
513 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CP_SHIFT 15 | ||
514 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CP_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CP_SHIFT) | ||
515 | |||
516 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CZ_SHIFT 13 | ||
517 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CZ_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_CZ_SHIFT) | ||
518 | |||
519 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RZ_SHIFT 10 | ||
520 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RZ_MASK (0x7 << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_RZ_SHIFT) | ||
521 | |||
522 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICPX_SHIFT 5 | ||
523 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICPX_MASK (0x1f << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICPX_SHIFT) | ||
524 | |||
525 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICP_OFF_SHIFT 0 | ||
526 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICP_OFF_MASK (0x1f << ddrcReg_PHY_ADDR_CTL_PLL_CTL1_ICP_OFF_SHIFT) | ||
527 | |||
528 | /* ----------------------------------------------------- */ | ||
529 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_PTAP_ADJ_SHIFT 4 | ||
530 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_PTAP_ADJ_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL2_PTAP_ADJ_SHIFT) | ||
531 | |||
532 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_CTAP_ADJ_SHIFT 2 | ||
533 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_CTAP_ADJ_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_PLL_CTL2_CTAP_ADJ_SHIFT) | ||
534 | |||
535 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_LOWCUR_ENABLE (0x1 << 1) | ||
536 | #define ddrcReg_PHY_ADDR_CTL_PLL_CTL2_BIASIN_ENABLE (0x1 << 0) | ||
537 | |||
538 | /* ----------------------------------------------------- */ | ||
539 | |||
540 | #define ddrcReg_PHY_ADDR_CTL_PLL_SS_EN_ENABLE (0x1 << 0) | ||
541 | |||
542 | /* ----------------------------------------------------- */ | ||
543 | |||
544 | #define ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_CYC_PER_TICK_SHIFT 16 | ||
545 | #define ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_CYC_PER_TICK_MASK (0xffff << ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_CYC_PER_TICK_SHIFT) | ||
546 | |||
547 | #define ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_NDIV_AMP_SHIFT 0 | ||
548 | #define ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_NDIV_AMP_MASK (0xffff << ddrcReg_PHY_ADDR_CTL_PLL_SS_CFG_NDIV_AMP_SHIFT) | ||
549 | |||
550 | /* ----------------------------------------------------- */ | ||
551 | |||
552 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_FORCE (1 << 20) | ||
553 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_ENABLE (1 << 16) | ||
554 | |||
555 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_FALL_SHIFT 12 | ||
556 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_FALL_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_FALL_SHIFT) | ||
557 | |||
558 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_RISE_SHIFT 8 | ||
559 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_RISE_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_RISE_SHIFT) | ||
560 | |||
561 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_STEP_SHIFT 0 | ||
562 | #define ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_STEP_MASK (0x3f << ddrcReg_PHY_ADDR_CTL_VDL_STATIC_OVR_STEP_SHIFT) | ||
563 | |||
564 | /* ----------------------------------------------------- */ | ||
565 | |||
566 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_ENABLE (1 << 16) | ||
567 | |||
568 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_FALL_SHIFT 12 | ||
569 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_FALL_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_FALL_SHIFT) | ||
570 | |||
571 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_RISE_SHIFT 8 | ||
572 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_RISE_MASK (0x3 << ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_RISE_SHIFT) | ||
573 | |||
574 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_STEP_SHIFT 0 | ||
575 | #define ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_STEP_MASK (0x3f << ddrcReg_PHY_ADDR_CTL_VDL_DYNAMIC_OVR_STEP_SHIFT) | ||
576 | |||
577 | /* ----------------------------------------------------- */ | ||
578 | |||
579 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_ENABLE (1u << 31) | ||
580 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_RXENB_DISABLE (1 << 8) | ||
581 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CTL_IDDQ_DISABLE (1 << 6) | ||
582 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CTL_REB_DISABLE (1 << 5) | ||
583 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CTL_OEB_DISABLE (1 << 4) | ||
584 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CKE_IDDQ_DISABLE (1 << 2) | ||
585 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CKE_REB_DISABLE (1 << 1) | ||
586 | #define ddrcReg_PHY_ADDR_CTL_PAD_IDLE_CKE_OEB_DISABLE (1 << 0) | ||
587 | |||
588 | /* ----------------------------------------------------- */ | ||
589 | |||
590 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_PD_DONE (1 << 30) | ||
591 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ND_DONE (1 << 29) | ||
592 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_SAMPLE_DONE (1 << 28) | ||
593 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_SAMPLE_AUTO_ENABLE (1 << 27) | ||
594 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_SAMPLE_ENABLE (1 << 26) | ||
595 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_OVR_ENABLE (1 << 25) | ||
596 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_OVR_ENABLE (1 << 24) | ||
597 | |||
598 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_PD_SHIFT 20 | ||
599 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_PD_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_PD_SHIFT) | ||
600 | |||
601 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ND_SHIFT 16 | ||
602 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ND_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_ND_SHIFT) | ||
603 | |||
604 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_PD_SHIFT 12 | ||
605 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_PD_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_PD_SHIFT) | ||
606 | |||
607 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_ND_SHIFT 8 | ||
608 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_ND_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_ADDR_ND_SHIFT) | ||
609 | |||
610 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_PD_SHIFT 4 | ||
611 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_PD_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_PD_SHIFT) | ||
612 | |||
613 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_ND_SHIFT 0 | ||
614 | #define ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_ND_MASK (0xf << ddrcReg_PHY_ADDR_CTL_PVT_COMP_DQ_ND_SHIFT) | ||
615 | |||
616 | /* ----------------------------------------------------- */ | ||
617 | |||
618 | #define ddrcReg_PHY_ADDR_CTL_PAD_DRIVE_RT60B (1 << 4) | ||
619 | #define ddrcReg_PHY_ADDR_CTL_PAD_DRIVE_SEL_SSTL18 (1 << 3) | ||
620 | #define ddrcReg_PHY_ADDR_CTL_PAD_DRIVE_SELTXDRV_CI (1 << 2) | ||
621 | #define ddrcReg_PHY_ADDR_CTL_PAD_DRIVE_SELRXDRV (1 << 1) | ||
622 | #define ddrcReg_PHY_ADDR_CTL_PAD_DRIVE_SLEW (1 << 0) | ||
623 | |||
624 | /* ----------------------------------------------------- */ | ||
625 | |||
626 | #define ddrcReg_PHY_ADDR_CTL_CLK_RGLTR_CTL_PWR_HALF (1 << 1) | ||
627 | #define ddrcReg_PHY_ADDR_CTL_CLK_RGLTR_CTL_PWR_OFF (1 << 0) | ||
628 | |||
629 | /* -------------------------------------------------------------------- */ | ||
630 | /* -------------------------------------------------------------------- */ | ||
631 | /* Broadcom DDR23 PHY Byte Lane register definitions */ | ||
632 | /* -------------------------------------------------------------------- */ | ||
633 | /* -------------------------------------------------------------------- */ | ||
634 | |||
635 | #define ddrcReg_PHY_BYTE_LANE_CNT 2 | ||
636 | #define ddrcReg_PHY_BYTE_LANE_MAX (ddrcReg_CTLR_BYTE_LANE_CNT - 1) | ||
637 | |||
638 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_CNT 8 | ||
639 | |||
640 | typedef struct { | ||
641 | uint32_t revision; | ||
642 | uint32_t vdlCalibrate; | ||
643 | uint32_t vdlStatus; | ||
644 | REG32_RSVD(0x000c, 0x0010); | ||
645 | uint32_t vdlOverride[ddrcReg_PHY_BYTE_LANE_VDL_OVR_CNT]; | ||
646 | uint32_t readCtl; | ||
647 | uint32_t readStatus; | ||
648 | uint32_t readClear; | ||
649 | uint32_t padIdleCtl; | ||
650 | uint32_t padDriveCtl; | ||
651 | uint32_t padClkCtl; | ||
652 | uint32_t writeCtl; | ||
653 | uint32_t clkRegCtl; | ||
654 | } ddrcReg_PHY_BYTE_LANE_REG_t; | ||
655 | |||
656 | /* There are 2 instances of the byte Lane registers, one for each byte lane. */ | ||
657 | #define ddrcReg_PHY_BYTE_LANE_1_REG_OFFSET 0x0500 | ||
658 | #define ddrcReg_PHY_BYTE_LANE_2_REG_OFFSET 0x0600 | ||
659 | |||
660 | #define ddrcReg_PHY_BYTE_LANE_1_REGP ((volatile ddrcReg_PHY_BYTE_LANE_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_PHY_BYTE_LANE_1_REG_OFFSET)) | ||
661 | #define ddrcReg_PHY_BYTE_LANE_2_REGP ((volatile ddrcReg_PHY_BYTE_LANE_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_PHY_BYTE_LANE_2_REG_OFFSET)) | ||
662 | |||
663 | /* ----------------------------------------------------- */ | ||
664 | |||
665 | #define ddrcReg_PHY_BYTE_LANE_REVISION_MAJOR_SHIFT 8 | ||
666 | #define ddrcReg_PHY_BYTE_LANE_REVISION_MAJOR_MASK (0xff << ddrcReg_PHY_BYTE_LANE_REVISION_MAJOR_SHIFT) | ||
667 | |||
668 | #define ddrcReg_PHY_BYTE_LANE_REVISION_MINOR_SHIFT 0 | ||
669 | #define ddrcReg_PHY_BYTE_LANE_REVISION_MINOR_MASK (0xff << ddrcReg_PHY_BYTE_LANE_REVISION_MINOR_SHIFT) | ||
670 | |||
671 | /* ----------------------------------------------------- */ | ||
672 | |||
673 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_CLK_2CYCLE (1 << 4) | ||
674 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_CLK_1CYCLE (0 << 4) | ||
675 | |||
676 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_TEST (1 << 3) | ||
677 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_ALWAYS (1 << 2) | ||
678 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_ONCE (1 << 1) | ||
679 | #define ddrcReg_PHY_BYTE_LANE_VDL_CALIB_FAST (1 << 0) | ||
680 | |||
681 | /* ----------------------------------------------------- */ | ||
682 | |||
683 | /* The byte lane VDL status calibTotal[9:0] is comprised of [9:4] step value, [3:2] fine fall */ | ||
684 | /* and [1:0] fine rise. Note that calibTotal[9:0] is located at bit 4 in the VDL status */ | ||
685 | /* register. The fine rise and fall are no longer used, so add some definitions for just */ | ||
686 | /* the step setting to simplify things. */ | ||
687 | |||
688 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_STEP_SHIFT 8 | ||
689 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_STEP_MASK (0x3f << ddrcReg_PHY_BYTE_LANE_VDL_STATUS_STEP_SHIFT) | ||
690 | |||
691 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_TOTAL_SHIFT 4 | ||
692 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_TOTAL_MASK (0x3ff << ddrcReg_PHY_BYTE_LANE_VDL_STATUS_TOTAL_SHIFT) | ||
693 | |||
694 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_LOCK (1 << 1) | ||
695 | #define ddrcReg_PHY_BYTE_LANE_VDL_STATUS_IDLE (1 << 0) | ||
696 | |||
697 | /* ----------------------------------------------------- */ | ||
698 | |||
699 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_ENABLE (1 << 16) | ||
700 | |||
701 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_FALL_SHIFT 12 | ||
702 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_FALL_MASK (0x3 << ddrcReg_PHY_BYTE_LANE_VDL_OVR_FALL_SHIFT) | ||
703 | |||
704 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_RISE_SHIFT 8 | ||
705 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_RISE_MASK (0x3 << ddrcReg_PHY_BYTE_LANE_VDL_OVR_RISE_SHIFT) | ||
706 | |||
707 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_STEP_SHIFT 0 | ||
708 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_STEP_MASK (0x3f << ddrcReg_PHY_BYTE_LANE_VDL_OVR_STEP_SHIFT) | ||
709 | |||
710 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_STATIC_READ_DQS_P 0 | ||
711 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_STATIC_READ_DQS_N 1 | ||
712 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_STATIC_READ_EN 2 | ||
713 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_STATIC_WRITE_DQ_DQM 3 | ||
714 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_DYNAMIC_READ_DQS_P 4 | ||
715 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_DYNAMIC_READ_DQS_N 5 | ||
716 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_DYNAMIC_READ_EN 6 | ||
717 | #define ddrcReg_PHY_BYTE_LANE_VDL_OVR_IDX_DYNAMIC_WRITE_DQ_DQM 7 | ||
718 | |||
719 | /* ----------------------------------------------------- */ | ||
720 | |||
721 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_DELAY_SHIFT 8 | ||
722 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_DELAY_MASK (0x3 << ddrcReg_PHY_BYTE_LANE_READ_CTL_DELAY_SHIFT) | ||
723 | |||
724 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_DQ_ODT_ENABLE (1 << 3) | ||
725 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_DQ_ODT_ADJUST (1 << 2) | ||
726 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_RD_ODT_ENABLE (1 << 1) | ||
727 | #define ddrcReg_PHY_BYTE_LANE_READ_CTL_RD_ODT_ADJUST (1 << 0) | ||
728 | |||
729 | /* ----------------------------------------------------- */ | ||
730 | |||
731 | #define ddrcReg_PHY_BYTE_LANE_READ_STATUS_ERROR_SHIFT 0 | ||
732 | #define ddrcReg_PHY_BYTE_LANE_READ_STATUS_ERROR_MASK (0xf << ddrcReg_PHY_BYTE_LANE_READ_STATUS_ERROR_SHIFT) | ||
733 | |||
734 | /* ----------------------------------------------------- */ | ||
735 | |||
736 | #define ddrcReg_PHY_BYTE_LANE_READ_CLEAR_STATUS (1 << 0) | ||
737 | |||
738 | /* ----------------------------------------------------- */ | ||
739 | |||
740 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_ENABLE (1u << 31) | ||
741 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DM_RXENB_DISABLE (1 << 19) | ||
742 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DM_IDDQ_DISABLE (1 << 18) | ||
743 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DM_REB_DISABLE (1 << 17) | ||
744 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DM_OEB_DISABLE (1 << 16) | ||
745 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQ_RXENB_DISABLE (1 << 15) | ||
746 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQ_IDDQ_DISABLE (1 << 14) | ||
747 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQ_REB_DISABLE (1 << 13) | ||
748 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQ_OEB_DISABLE (1 << 12) | ||
749 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_READ_ENB_RXENB_DISABLE (1 << 11) | ||
750 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_READ_ENB_IDDQ_DISABLE (1 << 10) | ||
751 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_READ_ENB_REB_DISABLE (1 << 9) | ||
752 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_READ_ENB_OEB_DISABLE (1 << 8) | ||
753 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQS_RXENB_DISABLE (1 << 7) | ||
754 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQS_IDDQ_DISABLE (1 << 6) | ||
755 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQS_REB_DISABLE (1 << 5) | ||
756 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_DQS_OEB_DISABLE (1 << 4) | ||
757 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_CLK_RXENB_DISABLE (1 << 3) | ||
758 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_CLK_IDDQ_DISABLE (1 << 2) | ||
759 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_CLK_REB_DISABLE (1 << 1) | ||
760 | #define ddrcReg_PHY_BYTE_LANE_PAD_IDLE_CTL_CLK_OEB_DISABLE (1 << 0) | ||
761 | |||
762 | /* ----------------------------------------------------- */ | ||
763 | |||
764 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_RT60B_DDR_READ_ENB (1 << 5) | ||
765 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_RT60B (1 << 4) | ||
766 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_SEL_SSTL18 (1 << 3) | ||
767 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_SELTXDRV_CI (1 << 2) | ||
768 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_SELRXDRV (1 << 1) | ||
769 | #define ddrcReg_PHY_BYTE_LANE_PAD_DRIVE_CTL_SLEW (1 << 0) | ||
770 | |||
771 | /* ----------------------------------------------------- */ | ||
772 | |||
773 | #define ddrcReg_PHY_BYTE_LANE_PAD_CLK_CTL_DISABLE (1 << 0) | ||
774 | |||
775 | /* ----------------------------------------------------- */ | ||
776 | |||
777 | #define ddrcReg_PHY_BYTE_LANE_WRITE_CTL_PREAMBLE_DDR3 (1 << 0) | ||
778 | |||
779 | /* ----------------------------------------------------- */ | ||
780 | |||
781 | #define ddrcReg_PHY_BYTE_LANE_CLK_REG_CTL_PWR_HALF (1 << 1) | ||
782 | #define ddrcReg_PHY_BYTE_LANE_CLK_REG_CTL_PWR_OFF (1 << 0) | ||
783 | |||
784 | /*********************************************************************/ | ||
785 | /* ARM PL341 DDRC to Broadcom DDR23 PHY glue register definitions */ | ||
786 | /*********************************************************************/ | ||
787 | |||
788 | typedef struct { | ||
789 | uint32_t cfg; | ||
790 | uint32_t actMonCnt; | ||
791 | uint32_t ctl; | ||
792 | uint32_t lbistCtl; | ||
793 | uint32_t lbistSeed; | ||
794 | uint32_t lbistStatus; | ||
795 | uint32_t tieOff; | ||
796 | uint32_t actMonClear; | ||
797 | uint32_t status; | ||
798 | uint32_t user; | ||
799 | } ddrcReg_CTLR_PHY_GLUE_REG_t; | ||
800 | |||
801 | #define ddrcReg_CTLR_PHY_GLUE_OFFSET 0x0700 | ||
802 | #define ddrcReg_CTLR_PHY_GLUE_REGP ((volatile ddrcReg_CTLR_PHY_GLUE_REG_t *) (MM_IO_BASE_DDRC + ddrcReg_CTLR_PHY_GLUE_OFFSET)) | ||
803 | |||
804 | /* ----------------------------------------------------- */ | ||
805 | |||
806 | /* DDR2 / AXI block phase alignment interrupt control */ | ||
807 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT 18 | ||
808 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_MASK (0x3 << ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT) | ||
809 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_OFF (0 << ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT) | ||
810 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_ON_TIGHT (1 << ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT) | ||
811 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_ON_MEDIUM (2 << ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT) | ||
812 | #define ddrcReg_CTLR_PHY_GLUE_CFG_INT_ON_LOOSE (3 << ddrcReg_CTLR_PHY_GLUE_CFG_INT_SHIFT) | ||
813 | |||
814 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_SHIFT 17 | ||
815 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_MASK (1 << ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_SHIFT) | ||
816 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_DIFFERENTIAL (0 << ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_SHIFT) | ||
817 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_CMOS (1 << ddrcReg_CTLR_PHY_GLUE_CFG_PLL_REFCLK_SHIFT) | ||
818 | |||
819 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHIFT 16 | ||
820 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_MASK (1 << ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHIFT) | ||
821 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_DEEP (0 << ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHIFT) | ||
822 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHALLOW (1 << ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHIFT) | ||
823 | #define ddrcReg_CTLR_PHY_GLUE_CFG_HW_FIXED_ALIGNMENT_DISABLED ddrcReg_CTLR_PHY_GLUE_CFG_DIV2CLK_TREE_SHALLOW | ||
824 | |||
825 | #define ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_SHIFT 15 | ||
826 | #define ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_MASK (1 << ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_SHIFT) | ||
827 | #define ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_BP134 (0 << ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_SHIFT) | ||
828 | #define ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_PL301 (1 << ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_SHIFT) | ||
829 | #define ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_REGISTERED ddrcReg_CTLR_PHY_GLUE_CFG_SYNC_BRIDGE_PL301 | ||
830 | |||
831 | /* Software control of PHY VDL updates from control register settings. Bit 13 enables the use of Bit 14. */ | ||
832 | /* If software control is not enabled, then updates occur when a refresh command is issued by the hardware */ | ||
833 | /* controller. If 2 chips selects are being used, then software control must be enabled. */ | ||
834 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PHY_VDL_UPDATE_SW_CTL_LOAD (1 << 14) | ||
835 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PHY_VDL_UPDATE_SW_CTL_ENABLE (1 << 13) | ||
836 | |||
837 | /* Use these to bypass a pipeline stage. By default the ADDR is off but the BYTE LANE in / out are on. */ | ||
838 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PHY_ADDR_CTL_IN_BYPASS_PIPELINE_STAGE (1 << 12) | ||
839 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PHY_BYTE_LANE_IN_BYPASS_PIPELINE_STAGE (1 << 11) | ||
840 | #define ddrcReg_CTLR_PHY_GLUE_CFG_PHY_BYTE_LANE_OUT_BYPASS_PIPELINE_STAGE (1 << 10) | ||
841 | |||
842 | /* Chip select count */ | ||
843 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_SHIFT 9 | ||
844 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_MASK (1 << ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_SHIFT) | ||
845 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_1 (0 << ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_SHIFT) | ||
846 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_2 (1 << ddrcReg_CTLR_PHY_GLUE_CFG_CS_CNT_SHIFT) | ||
847 | |||
848 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CLK_SHIFT 8 | ||
849 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CLK_ASYNC (0 << ddrcReg_CTLR_PHY_GLUE_CFG_CLK_SHIFT) | ||
850 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CLK_SYNC (1 << ddrcReg_CTLR_PHY_GLUE_CFG_CLK_SHIFT) | ||
851 | |||
852 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CKE_INIT_SHIFT 7 | ||
853 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CKE_INIT_LOW (0 << ddrcReg_CTLR_PHY_GLUE_CFG_CKE_INIT_SHIFT) | ||
854 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CKE_INIT_HIGH (1 << ddrcReg_CTLR_PHY_GLUE_CFG_CKE_INIT_SHIFT) | ||
855 | |||
856 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DQM_INIT_SHIFT 6 | ||
857 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DQM_INIT_LOW (0 << ddrcReg_CTLR_PHY_GLUE_CFG_DQM_INIT_SHIFT) | ||
858 | #define ddrcReg_CTLR_PHY_GLUE_CFG_DQM_INIT_HIGH (1 << ddrcReg_CTLR_PHY_GLUE_CFG_DQM_INIT_SHIFT) | ||
859 | |||
860 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CAS_LATENCY_SHIFT 0 | ||
861 | #define ddrcReg_CTLR_PHY_GLUE_CFG_CAS_LATENCY_MASK (0x7 << ddrcReg_CTLR_PHY_GLUE_CFG_CAS_LATENCY_SHIFT) | ||
862 | |||
863 | /* ----------------------------------------------------- */ | ||
864 | #define ddrcReg_CTLR_PHY_GLUE_STATUS_PHASE_SHIFT 0 | ||
865 | #define ddrcReg_CTLR_PHY_GLUE_STATUS_PHASE_MASK (0x7f << ddrcReg_CTLR_PHY_GLUE_STATUS_PHASE_SHIFT) | ||
866 | |||
867 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
868 | |||
869 | #ifdef __cplusplus | ||
870 | } /* end extern "C" */ | ||
871 | #endif | ||
872 | #endif /* DDRC_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/dmacHw.h b/arch/arm/mach-bcmring/include/mach/csp/dmacHw.h deleted file mode 100644 index 9dc90f46a84d..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/dmacHw.h +++ /dev/null | |||
@@ -1,596 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dmacHw.h | ||
18 | * | ||
19 | * @brief API definitions for low level DMA controller driver | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | #ifndef _DMACHW_H | ||
24 | #define _DMACHW_H | ||
25 | |||
26 | #include <linux/stddef.h> | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <mach/csp/dmacHw_reg.h> | ||
30 | |||
31 | /* Define DMA Channel ID using DMA controller number (m) and channel number (c). | ||
32 | |||
33 | System specific channel ID should be defined as follows | ||
34 | |||
35 | For example: | ||
36 | |||
37 | #include <dmacHw.h> | ||
38 | ... | ||
39 | #define systemHw_LCD_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,5) | ||
40 | #define systemHw_SWITCH_RX_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,0) | ||
41 | #define systemHw_SWITCH_TX_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,1) | ||
42 | #define systemHw_APM_RX_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,3) | ||
43 | #define systemHw_APM_TX_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,4) | ||
44 | ... | ||
45 | #define systemHw_SHARED1_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(1,4) | ||
46 | #define systemHw_SHARED2_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(1,5) | ||
47 | #define systemHw_SHARED3_CHANNEL_ID dmacHw_MAKE_CHANNEL_ID(0,6) | ||
48 | ... | ||
49 | */ | ||
50 | #define dmacHw_MAKE_CHANNEL_ID(m, c) (m << 8 | c) | ||
51 | |||
52 | typedef enum { | ||
53 | dmacHw_CHANNEL_PRIORITY_0 = dmacHw_REG_CFG_LO_CH_PRIORITY_0, /* Channel priority 0. Lowest priority DMA channel */ | ||
54 | dmacHw_CHANNEL_PRIORITY_1 = dmacHw_REG_CFG_LO_CH_PRIORITY_1, /* Channel priority 1 */ | ||
55 | dmacHw_CHANNEL_PRIORITY_2 = dmacHw_REG_CFG_LO_CH_PRIORITY_2, /* Channel priority 2 */ | ||
56 | dmacHw_CHANNEL_PRIORITY_3 = dmacHw_REG_CFG_LO_CH_PRIORITY_3, /* Channel priority 3 */ | ||
57 | dmacHw_CHANNEL_PRIORITY_4 = dmacHw_REG_CFG_LO_CH_PRIORITY_4, /* Channel priority 4 */ | ||
58 | dmacHw_CHANNEL_PRIORITY_5 = dmacHw_REG_CFG_LO_CH_PRIORITY_5, /* Channel priority 5 */ | ||
59 | dmacHw_CHANNEL_PRIORITY_6 = dmacHw_REG_CFG_LO_CH_PRIORITY_6, /* Channel priority 6 */ | ||
60 | dmacHw_CHANNEL_PRIORITY_7 = dmacHw_REG_CFG_LO_CH_PRIORITY_7 /* Channel priority 7. Highest priority DMA channel */ | ||
61 | } dmacHw_CHANNEL_PRIORITY_e; | ||
62 | |||
63 | /* Source destination master interface */ | ||
64 | typedef enum { | ||
65 | dmacHw_SRC_MASTER_INTERFACE_1 = dmacHw_REG_CTL_SMS_1, /* Source DMA master interface 1 */ | ||
66 | dmacHw_SRC_MASTER_INTERFACE_2 = dmacHw_REG_CTL_SMS_2, /* Source DMA master interface 2 */ | ||
67 | dmacHw_DST_MASTER_INTERFACE_1 = dmacHw_REG_CTL_DMS_1, /* Destination DMA master interface 1 */ | ||
68 | dmacHw_DST_MASTER_INTERFACE_2 = dmacHw_REG_CTL_DMS_2 /* Destination DMA master interface 2 */ | ||
69 | } dmacHw_MASTER_INTERFACE_e; | ||
70 | |||
71 | typedef enum { | ||
72 | dmacHw_SRC_TRANSACTION_WIDTH_8 = dmacHw_REG_CTL_SRC_TR_WIDTH_8, /* Source 8 bit (1 byte) per transaction */ | ||
73 | dmacHw_SRC_TRANSACTION_WIDTH_16 = dmacHw_REG_CTL_SRC_TR_WIDTH_16, /* Source 16 bit (2 byte) per transaction */ | ||
74 | dmacHw_SRC_TRANSACTION_WIDTH_32 = dmacHw_REG_CTL_SRC_TR_WIDTH_32, /* Source 32 bit (4 byte) per transaction */ | ||
75 | dmacHw_SRC_TRANSACTION_WIDTH_64 = dmacHw_REG_CTL_SRC_TR_WIDTH_64, /* Source 64 bit (8 byte) per transaction */ | ||
76 | dmacHw_DST_TRANSACTION_WIDTH_8 = dmacHw_REG_CTL_DST_TR_WIDTH_8, /* Destination 8 bit (1 byte) per transaction */ | ||
77 | dmacHw_DST_TRANSACTION_WIDTH_16 = dmacHw_REG_CTL_DST_TR_WIDTH_16, /* Destination 16 bit (2 byte) per transaction */ | ||
78 | dmacHw_DST_TRANSACTION_WIDTH_32 = dmacHw_REG_CTL_DST_TR_WIDTH_32, /* Destination 32 bit (4 byte) per transaction */ | ||
79 | dmacHw_DST_TRANSACTION_WIDTH_64 = dmacHw_REG_CTL_DST_TR_WIDTH_64 /* Destination 64 bit (8 byte) per transaction */ | ||
80 | } dmacHw_TRANSACTION_WIDTH_e; | ||
81 | |||
82 | typedef enum { | ||
83 | dmacHw_SRC_BURST_WIDTH_0 = dmacHw_REG_CTL_SRC_MSIZE_0, /* Source No burst */ | ||
84 | dmacHw_SRC_BURST_WIDTH_4 = dmacHw_REG_CTL_SRC_MSIZE_4, /* Source 4 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
85 | dmacHw_SRC_BURST_WIDTH_8 = dmacHw_REG_CTL_SRC_MSIZE_8, /* Source 8 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
86 | dmacHw_SRC_BURST_WIDTH_16 = dmacHw_REG_CTL_SRC_MSIZE_16, /* Source 16 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
87 | dmacHw_DST_BURST_WIDTH_0 = dmacHw_REG_CTL_DST_MSIZE_0, /* Destination No burst */ | ||
88 | dmacHw_DST_BURST_WIDTH_4 = dmacHw_REG_CTL_DST_MSIZE_4, /* Destination 4 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
89 | dmacHw_DST_BURST_WIDTH_8 = dmacHw_REG_CTL_DST_MSIZE_8, /* Destination 8 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
90 | dmacHw_DST_BURST_WIDTH_16 = dmacHw_REG_CTL_DST_MSIZE_16 /* Destination 16 X dmacHw_TRANSACTION_WIDTH_xxx bytes per burst */ | ||
91 | } dmacHw_BURST_WIDTH_e; | ||
92 | |||
93 | typedef enum { | ||
94 | dmacHw_TRANSFER_TYPE_MEM_TO_MEM = dmacHw_REG_CTL_TTFC_MM_DMAC, /* Memory to memory transfer */ | ||
95 | dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM = dmacHw_REG_CTL_TTFC_PM_DMAC, /* Peripheral to memory transfer */ | ||
96 | dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL = dmacHw_REG_CTL_TTFC_MP_DMAC, /* Memory to peripheral transfer */ | ||
97 | dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_PERIPHERAL = dmacHw_REG_CTL_TTFC_PP_DMAC /* Peripheral to peripheral transfer */ | ||
98 | } dmacHw_TRANSFER_TYPE_e; | ||
99 | |||
100 | typedef enum { | ||
101 | dmacHw_TRANSFER_MODE_PERREQUEST, /* Block transfer per DMA request */ | ||
102 | dmacHw_TRANSFER_MODE_CONTINUOUS, /* Continuous transfer of streaming data */ | ||
103 | dmacHw_TRANSFER_MODE_PERIODIC /* Periodic transfer of streaming data */ | ||
104 | } dmacHw_TRANSFER_MODE_e; | ||
105 | |||
106 | typedef enum { | ||
107 | dmacHw_SRC_ADDRESS_UPDATE_MODE_INC = dmacHw_REG_CTL_SINC_INC, /* Increment source address after every transaction */ | ||
108 | dmacHw_SRC_ADDRESS_UPDATE_MODE_DEC = dmacHw_REG_CTL_SINC_DEC, /* Decrement source address after every transaction */ | ||
109 | dmacHw_DST_ADDRESS_UPDATE_MODE_INC = dmacHw_REG_CTL_DINC_INC, /* Increment destination address after every transaction */ | ||
110 | dmacHw_DST_ADDRESS_UPDATE_MODE_DEC = dmacHw_REG_CTL_DINC_DEC, /* Decrement destination address after every transaction */ | ||
111 | dmacHw_SRC_ADDRESS_UPDATE_MODE_NC = dmacHw_REG_CTL_SINC_NC, /* No change in source address after every transaction */ | ||
112 | dmacHw_DST_ADDRESS_UPDATE_MODE_NC = dmacHw_REG_CTL_DINC_NC /* No change in destination address after every transaction */ | ||
113 | } dmacHw_ADDRESS_UPDATE_MODE_e; | ||
114 | |||
115 | typedef enum { | ||
116 | dmacHw_FLOW_CONTROL_DMA, /* DMA working as flow controller (default) */ | ||
117 | dmacHw_FLOW_CONTROL_PERIPHERAL /* Peripheral working as flow controller */ | ||
118 | } dmacHw_FLOW_CONTROL_e; | ||
119 | |||
120 | typedef enum { | ||
121 | dmacHw_TRANSFER_STATUS_BUSY, /* DMA Transfer ongoing */ | ||
122 | dmacHw_TRANSFER_STATUS_DONE, /* DMA Transfer completed */ | ||
123 | dmacHw_TRANSFER_STATUS_ERROR /* DMA Transfer error */ | ||
124 | } dmacHw_TRANSFER_STATUS_e; | ||
125 | |||
126 | typedef enum { | ||
127 | dmacHw_INTERRUPT_DISABLE, /* Interrupt disable */ | ||
128 | dmacHw_INTERRUPT_ENABLE /* Interrupt enable */ | ||
129 | } dmacHw_INTERRUPT_e; | ||
130 | |||
131 | typedef enum { | ||
132 | dmacHw_INTERRUPT_STATUS_NONE = 0x0, /* No DMA interrupt */ | ||
133 | dmacHw_INTERRUPT_STATUS_TRANS = 0x1, /* End of DMA transfer interrupt */ | ||
134 | dmacHw_INTERRUPT_STATUS_BLOCK = 0x2, /* End of block transfer interrupt */ | ||
135 | dmacHw_INTERRUPT_STATUS_ERROR = 0x4 /* Error interrupt */ | ||
136 | } dmacHw_INTERRUPT_STATUS_e; | ||
137 | |||
138 | typedef enum { | ||
139 | dmacHw_CONTROLLER_ATTRIB_CHANNEL_NUM, /* Number of DMA channel */ | ||
140 | dmacHw_CONTROLLER_ATTRIB_CHANNEL_MAX_BLOCK_SIZE, /* Maximum channel burst size */ | ||
141 | dmacHw_CONTROLLER_ATTRIB_MASTER_INTF_NUM, /* Number of DMA master interface */ | ||
142 | dmacHw_CONTROLLER_ATTRIB_CHANNEL_BUS_WIDTH, /* Channel Data bus width */ | ||
143 | dmacHw_CONTROLLER_ATTRIB_CHANNEL_FIFO_SIZE /* Channel FIFO size */ | ||
144 | } dmacHw_CONTROLLER_ATTRIB_e; | ||
145 | |||
146 | typedef unsigned long dmacHw_HANDLE_t; /* DMA channel handle */ | ||
147 | typedef uint32_t dmacHw_ID_t; /* DMA channel Id. Must be created using | ||
148 | "dmacHw_MAKE_CHANNEL_ID" macro | ||
149 | */ | ||
150 | /* DMA channel configuration parameters */ | ||
151 | typedef struct { | ||
152 | uint32_t srcPeripheralPort; /* Source peripheral port */ | ||
153 | uint32_t dstPeripheralPort; /* Destination peripheral port */ | ||
154 | uint32_t srcStatusRegisterAddress; /* Source status register address */ | ||
155 | uint32_t dstStatusRegisterAddress; /* Destination status register address of type */ | ||
156 | |||
157 | uint32_t srcGatherWidth; /* Number of bytes gathered before successive gather opearation */ | ||
158 | uint32_t srcGatherJump; /* Number of bytes jumpped before successive gather opearation */ | ||
159 | uint32_t dstScatterWidth; /* Number of bytes sacattered before successive scatter opearation */ | ||
160 | uint32_t dstScatterJump; /* Number of bytes jumpped before successive scatter opearation */ | ||
161 | uint32_t maxDataPerBlock; /* Maximum number of bytes to be transferred per block/descrptor. | ||
162 | 0 = Maximum possible. | ||
163 | */ | ||
164 | |||
165 | dmacHw_ADDRESS_UPDATE_MODE_e srcUpdate; /* Source address update mode */ | ||
166 | dmacHw_ADDRESS_UPDATE_MODE_e dstUpdate; /* Destination address update mode */ | ||
167 | dmacHw_TRANSFER_TYPE_e transferType; /* DMA transfer type */ | ||
168 | dmacHw_TRANSFER_MODE_e transferMode; /* DMA transfer mode */ | ||
169 | dmacHw_MASTER_INTERFACE_e srcMasterInterface; /* DMA source interface */ | ||
170 | dmacHw_MASTER_INTERFACE_e dstMasterInterface; /* DMA destination interface */ | ||
171 | dmacHw_TRANSACTION_WIDTH_e srcMaxTransactionWidth; /* Source transaction width */ | ||
172 | dmacHw_TRANSACTION_WIDTH_e dstMaxTransactionWidth; /* Destination transaction width */ | ||
173 | dmacHw_BURST_WIDTH_e srcMaxBurstWidth; /* Source burst width */ | ||
174 | dmacHw_BURST_WIDTH_e dstMaxBurstWidth; /* Destination burst width */ | ||
175 | dmacHw_INTERRUPT_e blockTransferInterrupt; /* Block trsnafer interrupt */ | ||
176 | dmacHw_INTERRUPT_e completeTransferInterrupt; /* Complete DMA trsnafer interrupt */ | ||
177 | dmacHw_INTERRUPT_e errorInterrupt; /* Error interrupt */ | ||
178 | dmacHw_CHANNEL_PRIORITY_e channelPriority; /* Channel priority */ | ||
179 | dmacHw_FLOW_CONTROL_e flowControler; /* Data flow controller */ | ||
180 | } dmacHw_CONFIG_t; | ||
181 | |||
182 | /****************************************************************************/ | ||
183 | /** | ||
184 | * @brief Initializes DMA | ||
185 | * | ||
186 | * This function initializes DMA CSP driver | ||
187 | * | ||
188 | * @note | ||
189 | * Must be called before using any DMA channel | ||
190 | */ | ||
191 | /****************************************************************************/ | ||
192 | void dmacHw_initDma(void); | ||
193 | |||
194 | /****************************************************************************/ | ||
195 | /** | ||
196 | * @brief Exit function for DMA | ||
197 | * | ||
198 | * This function isolates DMA from the system | ||
199 | * | ||
200 | */ | ||
201 | /****************************************************************************/ | ||
202 | void dmacHw_exitDma(void); | ||
203 | |||
204 | /****************************************************************************/ | ||
205 | /** | ||
206 | * @brief Gets a handle to a DMA channel | ||
207 | * | ||
208 | * This function returns a handle, representing a control block of a particular DMA channel | ||
209 | * | ||
210 | * @return -1 - On Failure | ||
211 | * handle - On Success, representing a channel control block | ||
212 | * | ||
213 | * @note | ||
214 | * None Channel ID must be created using "dmacHw_MAKE_CHANNEL_ID" macro | ||
215 | */ | ||
216 | /****************************************************************************/ | ||
217 | dmacHw_HANDLE_t dmacHw_getChannelHandle(dmacHw_ID_t channelId /* [ IN ] DMA Channel Id */ | ||
218 | ); | ||
219 | |||
220 | /****************************************************************************/ | ||
221 | /** | ||
222 | * @brief Initializes a DMA channel for use | ||
223 | * | ||
224 | * This function initializes and resets a DMA channel for use | ||
225 | * | ||
226 | * @return -1 - On Failure | ||
227 | * 0 - On Success | ||
228 | * | ||
229 | * @note | ||
230 | * None | ||
231 | */ | ||
232 | /****************************************************************************/ | ||
233 | int dmacHw_initChannel(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
234 | ); | ||
235 | |||
236 | /****************************************************************************/ | ||
237 | /** | ||
238 | * @brief Estimates number of descriptor needed to perform certain DMA transfer | ||
239 | * | ||
240 | * | ||
241 | * @return On failure : -1 | ||
242 | * On success : Number of descriptor count | ||
243 | * | ||
244 | * | ||
245 | */ | ||
246 | /****************************************************************************/ | ||
247 | int dmacHw_calculateDescriptorCount(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
248 | void *pSrcAddr, /* [ IN ] Source (Peripheral/Memory) address */ | ||
249 | void *pDstAddr, /* [ IN ] Destination (Peripheral/Memory) address */ | ||
250 | size_t dataLen /* [ IN ] Data length in bytes */ | ||
251 | ); | ||
252 | |||
253 | /****************************************************************************/ | ||
254 | /** | ||
255 | * @brief Initializes descriptor ring | ||
256 | * | ||
257 | * This function will initializes the descriptor ring of a DMA channel | ||
258 | * | ||
259 | * | ||
260 | * @return -1 - On failure | ||
261 | * 0 - On success | ||
262 | * @note | ||
263 | * - "len" parameter should be obtained from "dmacHw_descriptorLen" | ||
264 | * - Descriptor buffer MUST be 32 bit aligned and uncached as it | ||
265 | * is accessed by ARM and DMA | ||
266 | */ | ||
267 | /****************************************************************************/ | ||
268 | int dmacHw_initDescriptor(void *pDescriptorVirt, /* [ IN ] Virtual address of uncahced buffer allocated to form descriptor ring */ | ||
269 | uint32_t descriptorPhyAddr, /* [ IN ] Physical address of pDescriptorVirt (descriptor buffer) */ | ||
270 | uint32_t len, /* [ IN ] Size of the pBuf */ | ||
271 | uint32_t num /* [ IN ] Number of descriptor in the ring */ | ||
272 | ); | ||
273 | |||
274 | /****************************************************************************/ | ||
275 | /** | ||
276 | * @brief Finds amount of memory required to form a descriptor ring | ||
277 | * | ||
278 | * | ||
279 | * @return Number of bytes required to form a descriptor ring | ||
280 | * | ||
281 | * | ||
282 | * @note | ||
283 | * None | ||
284 | */ | ||
285 | /****************************************************************************/ | ||
286 | uint32_t dmacHw_descriptorLen(uint32_t descCnt /* [ IN ] Number of descriptor in the ring */ | ||
287 | ); | ||
288 | |||
289 | /****************************************************************************/ | ||
290 | /** | ||
291 | * @brief Configure DMA channel | ||
292 | * | ||
293 | * @return 0 : On success | ||
294 | * -1 : On failure | ||
295 | */ | ||
296 | /****************************************************************************/ | ||
297 | int dmacHw_configChannel(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
298 | dmacHw_CONFIG_t *pConfig /* [ IN ] Configuration settings */ | ||
299 | ); | ||
300 | |||
301 | /****************************************************************************/ | ||
302 | /** | ||
303 | * @brief Set descriptors for known data length | ||
304 | * | ||
305 | * When DMA has to work as a flow controller, this function prepares the | ||
306 | * descriptor chain to transfer data | ||
307 | * | ||
308 | * from: | ||
309 | * - Memory to memory | ||
310 | * - Peripheral to memory | ||
311 | * - Memory to Peripheral | ||
312 | * - Peripheral to Peripheral | ||
313 | * | ||
314 | * @return -1 - On failure | ||
315 | * 0 - On success | ||
316 | * | ||
317 | */ | ||
318 | /****************************************************************************/ | ||
319 | int dmacHw_setDataDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
320 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
321 | void *pSrcAddr, /* [ IN ] Source (Peripheral/Memory) address */ | ||
322 | void *pDstAddr, /* [ IN ] Destination (Peripheral/Memory) address */ | ||
323 | size_t dataLen /* [ IN ] Length in bytes */ | ||
324 | ); | ||
325 | |||
326 | /****************************************************************************/ | ||
327 | /** | ||
328 | * @brief Indicates whether DMA transfer is in progress or completed | ||
329 | * | ||
330 | * @return DMA transfer status | ||
331 | * dmacHw_TRANSFER_STATUS_BUSY: DMA Transfer ongoing | ||
332 | * dmacHw_TRANSFER_STATUS_DONE: DMA Transfer completed | ||
333 | * dmacHw_TRANSFER_STATUS_ERROR: DMA Transfer error | ||
334 | * | ||
335 | */ | ||
336 | /****************************************************************************/ | ||
337 | dmacHw_TRANSFER_STATUS_e dmacHw_transferCompleted(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
338 | ); | ||
339 | |||
340 | /****************************************************************************/ | ||
341 | /** | ||
342 | * @brief Set descriptor carrying control information | ||
343 | * | ||
344 | * This function will be used to send specific control information to the device | ||
345 | * using the DMA channel | ||
346 | * | ||
347 | * | ||
348 | * @return -1 - On failure | ||
349 | * 0 - On success | ||
350 | * | ||
351 | * @note | ||
352 | * None | ||
353 | */ | ||
354 | /****************************************************************************/ | ||
355 | int dmacHw_setControlDescriptor(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
356 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
357 | uint32_t ctlAddress, /* [ IN ] Address of the device control register */ | ||
358 | uint32_t control /* [ IN ] Device control information */ | ||
359 | ); | ||
360 | |||
361 | /****************************************************************************/ | ||
362 | /** | ||
363 | * @brief Read data DMA transferred to memory | ||
364 | * | ||
365 | * This function will read data that has been DMAed to memory while transferring from: | ||
366 | * - Memory to memory | ||
367 | * - Peripheral to memory | ||
368 | * | ||
369 | * @return 0 - No more data is available to read | ||
370 | * 1 - More data might be available to read | ||
371 | * | ||
372 | */ | ||
373 | /****************************************************************************/ | ||
374 | int dmacHw_readTransferredData(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
375 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
376 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
377 | void **ppBbuf, /* [ OUT ] Data received */ | ||
378 | size_t *pLlen /* [ OUT ] Length of the data received */ | ||
379 | ); | ||
380 | |||
381 | /****************************************************************************/ | ||
382 | /** | ||
383 | * @brief Prepares descriptor ring, when source peripheral working as a flow controller | ||
384 | * | ||
385 | * This function will form the descriptor ring by allocating buffers, when source peripheral | ||
386 | * has to work as a flow controller to transfer data from: | ||
387 | * - Peripheral to memory. | ||
388 | * | ||
389 | * @return -1 - On failure | ||
390 | * 0 - On success | ||
391 | * | ||
392 | * | ||
393 | * @note | ||
394 | * None | ||
395 | */ | ||
396 | /****************************************************************************/ | ||
397 | int dmacHw_setVariableDataDescriptor(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
398 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
399 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
400 | uint32_t srcAddr, /* [ IN ] Source peripheral address */ | ||
401 | void *(*fpAlloc) (int len), /* [ IN ] Function pointer that provides destination memory */ | ||
402 | int len, /* [ IN ] Number of bytes "fpAlloc" will allocate for destination */ | ||
403 | int num /* [ IN ] Number of descriptor to set */ | ||
404 | ); | ||
405 | |||
406 | /****************************************************************************/ | ||
407 | /** | ||
408 | * @brief Program channel register to initiate transfer | ||
409 | * | ||
410 | * @return void | ||
411 | * | ||
412 | * | ||
413 | * @note | ||
414 | * - Descriptor buffer MUST ALWAYS be flushed before calling this function | ||
415 | * - This function should also be called from ISR to program the channel with | ||
416 | * pending descriptors | ||
417 | */ | ||
418 | /****************************************************************************/ | ||
419 | void dmacHw_initiateTransfer(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
420 | dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
421 | void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
422 | ); | ||
423 | |||
424 | /****************************************************************************/ | ||
425 | /** | ||
426 | * @brief Resets descriptor control information | ||
427 | * | ||
428 | * @return void | ||
429 | */ | ||
430 | /****************************************************************************/ | ||
431 | void dmacHw_resetDescriptorControl(void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
432 | ); | ||
433 | |||
434 | /****************************************************************************/ | ||
435 | /** | ||
436 | * @brief Program channel register to stop transfer | ||
437 | * | ||
438 | * Ensures the channel is not doing any transfer after calling this function | ||
439 | * | ||
440 | * @return void | ||
441 | * | ||
442 | */ | ||
443 | /****************************************************************************/ | ||
444 | void dmacHw_stopTransfer(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
445 | ); | ||
446 | |||
447 | /****************************************************************************/ | ||
448 | /** | ||
449 | * @brief Check the existence of pending descriptor | ||
450 | * | ||
451 | * This function confirmes if there is any pending descriptor in the chain | ||
452 | * to program the channel | ||
453 | * | ||
454 | * @return 1 : Channel need to be programmed with pending descriptor | ||
455 | * 0 : No more pending descriptor to programe the channel | ||
456 | * | ||
457 | * @note | ||
458 | * - This function should be called from ISR in case there are pending | ||
459 | * descriptor to program the channel. | ||
460 | * | ||
461 | * Example: | ||
462 | * | ||
463 | * dmac_isr () | ||
464 | * { | ||
465 | * ... | ||
466 | * if (dmacHw_descriptorPending (handle)) | ||
467 | * { | ||
468 | * dmacHw_initiateTransfer (handle); | ||
469 | * } | ||
470 | * } | ||
471 | * | ||
472 | */ | ||
473 | /****************************************************************************/ | ||
474 | uint32_t dmacHw_descriptorPending(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
475 | void *pDescriptor /* [ IN ] Descriptor buffer */ | ||
476 | ); | ||
477 | |||
478 | /****************************************************************************/ | ||
479 | /** | ||
480 | * @brief Deallocates source or destination memory, allocated | ||
481 | * | ||
482 | * This function can be called to deallocate data memory that was DMAed successfully | ||
483 | * | ||
484 | * @return -1 - On failure | ||
485 | * 0 - On success | ||
486 | * | ||
487 | * @note | ||
488 | * This function will be called ONLY, when source OR destination address is pointing | ||
489 | * to dynamic memory | ||
490 | */ | ||
491 | /****************************************************************************/ | ||
492 | int dmacHw_freeMem(dmacHw_CONFIG_t *pConfig, /* [ IN ] Configuration settings */ | ||
493 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
494 | void (*fpFree) (void *) /* [ IN ] Function pointer to free data memory */ | ||
495 | ); | ||
496 | |||
497 | /****************************************************************************/ | ||
498 | /** | ||
499 | * @brief Clears the interrupt | ||
500 | * | ||
501 | * This function clears the DMA channel specific interrupt | ||
502 | * | ||
503 | * @return N/A | ||
504 | * | ||
505 | * @note | ||
506 | * Must be called under the context of ISR | ||
507 | */ | ||
508 | /****************************************************************************/ | ||
509 | void dmacHw_clearInterrupt(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
510 | ); | ||
511 | |||
512 | /****************************************************************************/ | ||
513 | /** | ||
514 | * @brief Returns the cause of channel specific DMA interrupt | ||
515 | * | ||
516 | * This function returns the cause of interrupt | ||
517 | * | ||
518 | * @return Interrupt status, each bit representing a specific type of interrupt | ||
519 | * of type dmacHw_INTERRUPT_STATUS_e | ||
520 | * @note | ||
521 | * This function should be called under the context of ISR | ||
522 | */ | ||
523 | /****************************************************************************/ | ||
524 | dmacHw_INTERRUPT_STATUS_e dmacHw_getInterruptStatus(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
525 | ); | ||
526 | |||
527 | /****************************************************************************/ | ||
528 | /** | ||
529 | * @brief Indentifies a DMA channel causing interrupt | ||
530 | * | ||
531 | * This functions returns a channel causing interrupt of type dmacHw_INTERRUPT_STATUS_e | ||
532 | * | ||
533 | * @return NULL : No channel causing DMA interrupt | ||
534 | * ! NULL : Handle to a channel causing DMA interrupt | ||
535 | * @note | ||
536 | * dmacHw_clearInterrupt() must be called with a valid handle after calling this function | ||
537 | */ | ||
538 | /****************************************************************************/ | ||
539 | dmacHw_HANDLE_t dmacHw_getInterruptSource(void); | ||
540 | |||
541 | /****************************************************************************/ | ||
542 | /** | ||
543 | * @brief Sets channel specific user data | ||
544 | * | ||
545 | * This function associates user data to a specific DMA channel | ||
546 | * | ||
547 | */ | ||
548 | /****************************************************************************/ | ||
549 | void dmacHw_setChannelUserData(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
550 | void *userData /* [ IN ] User data */ | ||
551 | ); | ||
552 | |||
553 | /****************************************************************************/ | ||
554 | /** | ||
555 | * @brief Gets channel specific user data | ||
556 | * | ||
557 | * This function returns user data specific to a DMA channel | ||
558 | * | ||
559 | * @return user data | ||
560 | */ | ||
561 | /****************************************************************************/ | ||
562 | void *dmacHw_getChannelUserData(dmacHw_HANDLE_t handle /* [ IN ] DMA Channel handle */ | ||
563 | ); | ||
564 | |||
565 | /****************************************************************************/ | ||
566 | /** | ||
567 | * @brief Displays channel specific registers and other control parameters | ||
568 | * | ||
569 | * | ||
570 | * @return void | ||
571 | * | ||
572 | * @note | ||
573 | * None | ||
574 | */ | ||
575 | /****************************************************************************/ | ||
576 | void dmacHw_printDebugInfo(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
577 | void *pDescriptor, /* [ IN ] Descriptor buffer */ | ||
578 | int (*fpPrint) (const char *, ...) /* [ IN ] Print callback function */ | ||
579 | ); | ||
580 | |||
581 | /****************************************************************************/ | ||
582 | /** | ||
583 | * @brief Provides DMA controller attributes | ||
584 | * | ||
585 | * | ||
586 | * @return DMA controller attributes | ||
587 | * | ||
588 | * @note | ||
589 | * None | ||
590 | */ | ||
591 | /****************************************************************************/ | ||
592 | uint32_t dmacHw_getDmaControllerAttribute(dmacHw_HANDLE_t handle, /* [ IN ] DMA Channel handle */ | ||
593 | dmacHw_CONTROLLER_ATTRIB_e attr /* [ IN ] DMA Controller attribute of type dmacHw_CONTROLLER_ATTRIB_e */ | ||
594 | ); | ||
595 | |||
596 | #endif /* _DMACHW_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/dmacHw_priv.h b/arch/arm/mach-bcmring/include/mach/csp/dmacHw_priv.h deleted file mode 100644 index 9d9455e0c391..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/dmacHw_priv.h +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dmacHw_priv.h | ||
18 | * | ||
19 | * @brief Private Definitions for low level DMA driver | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | |||
24 | #ifndef _DMACHW_PRIV_H | ||
25 | #define _DMACHW_PRIV_H | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | |||
29 | /* Data type for DMA Link List Item */ | ||
30 | typedef struct { | ||
31 | uint32_t sar; /* Source Address Register. | ||
32 | Address must be aligned to CTLx.SRC_TR_WIDTH. */ | ||
33 | uint32_t dar; /* Destination Address Register. | ||
34 | Address must be aligned to CTLx.DST_TR_WIDTH. */ | ||
35 | uint32_t llpPhy; /* LLP contains the physical address of the next descriptor for block chaining using linked lists. | ||
36 | Address MUST be aligned to a 32-bit boundary. */ | ||
37 | dmacHw_REG64_t ctl; /* Control Register. 64 bits */ | ||
38 | uint32_t sstat; /* Source Status Register */ | ||
39 | uint32_t dstat; /* Destination Status Register */ | ||
40 | uint32_t devCtl; /* Device specific control information */ | ||
41 | uint32_t llp; /* LLP contains the virtual address of the next descriptor for block chaining using linked lists. */ | ||
42 | } dmacHw_DESC_t; | ||
43 | |||
44 | /* | ||
45 | * Descriptor ring pointers | ||
46 | */ | ||
47 | typedef struct { | ||
48 | int num; /* Number of link items */ | ||
49 | dmacHw_DESC_t *pHead; /* Head of descriptor ring (for writing) */ | ||
50 | dmacHw_DESC_t *pTail; /* Tail of descriptor ring (for reading) */ | ||
51 | dmacHw_DESC_t *pProg; /* Descriptor to program the channel (for programming the channel register) */ | ||
52 | dmacHw_DESC_t *pEnd; /* End of current descriptor chain */ | ||
53 | dmacHw_DESC_t *pFree; /* Descriptor to free memory (freeing dynamic memory) */ | ||
54 | uint32_t virt2PhyOffset; /* Virtual to physical address offset for the descriptor ring */ | ||
55 | } dmacHw_DESC_RING_t; | ||
56 | |||
57 | /* | ||
58 | * DMA channel control block | ||
59 | */ | ||
60 | typedef struct { | ||
61 | uint32_t module; /* DMA controller module (0-1) */ | ||
62 | uint32_t channel; /* DMA channel (0-7) */ | ||
63 | volatile uint32_t varDataStarted; /* Flag indicating variable data channel is enabled */ | ||
64 | volatile uint32_t descUpdated; /* Flag to indicate descriptor update is complete */ | ||
65 | void *userData; /* Channel specifc user data */ | ||
66 | } dmacHw_CBLK_t; | ||
67 | |||
68 | #define dmacHw_ASSERT(a) if (!(a)) while (1) | ||
69 | #define dmacHw_MAX_CHANNEL_COUNT 16 | ||
70 | #define dmacHw_FREE_USER_MEMORY 0xFFFFFFFF | ||
71 | #define dmacHw_DESC_FREE dmacHw_REG_CTL_DONE | ||
72 | #define dmacHw_DESC_INIT ((dmacHw_DESC_t *) 0xFFFFFFFF) | ||
73 | #define dmacHw_MAX_BLOCKSIZE 4064 | ||
74 | #define dmacHw_GET_DESC_RING(addr) (dmacHw_DESC_RING_t *)(addr) | ||
75 | #define dmacHw_ADDRESS_MASK(byte) ((byte) - 1) | ||
76 | #define dmacHw_NEXT_DESC(rp, dp) ((rp)->dp = (dmacHw_DESC_t *)(rp)->dp->llp) | ||
77 | #define dmacHw_HANDLE_TO_CBLK(handle) ((dmacHw_CBLK_t *) (handle)) | ||
78 | #define dmacHw_CBLK_TO_HANDLE(cblkp) ((dmacHw_HANDLE_t) (cblkp)) | ||
79 | #define dmacHw_DST_IS_MEMORY(tt) (((tt) == dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM) || ((tt) == dmacHw_TRANSFER_TYPE_MEM_TO_MEM)) ? 1 : 0 | ||
80 | |||
81 | /****************************************************************************/ | ||
82 | /** | ||
83 | * @brief Get next available transaction width | ||
84 | * | ||
85 | * | ||
86 | * @return On success : Next available transaction width | ||
87 | * On failure : dmacHw_TRANSACTION_WIDTH_8 | ||
88 | * | ||
89 | * @note | ||
90 | * None | ||
91 | */ | ||
92 | /****************************************************************************/ | ||
93 | static inline dmacHw_TRANSACTION_WIDTH_e dmacHw_GetNextTrWidth(dmacHw_TRANSACTION_WIDTH_e tw /* [ IN ] Current transaction width */ | ||
94 | ) { | ||
95 | if (tw & dmacHw_REG_CTL_SRC_TR_WIDTH_MASK) { | ||
96 | return ((tw >> dmacHw_REG_CTL_SRC_TR_WIDTH_SHIFT) - | ||
97 | 1) << dmacHw_REG_CTL_SRC_TR_WIDTH_SHIFT; | ||
98 | } else if (tw & dmacHw_REG_CTL_DST_TR_WIDTH_MASK) { | ||
99 | return ((tw >> dmacHw_REG_CTL_DST_TR_WIDTH_SHIFT) - | ||
100 | 1) << dmacHw_REG_CTL_DST_TR_WIDTH_SHIFT; | ||
101 | } | ||
102 | |||
103 | /* Default return */ | ||
104 | return dmacHw_SRC_TRANSACTION_WIDTH_8; | ||
105 | } | ||
106 | |||
107 | /****************************************************************************/ | ||
108 | /** | ||
109 | * @brief Get number of bytes per transaction | ||
110 | * | ||
111 | * @return Number of bytes per transaction | ||
112 | * | ||
113 | * | ||
114 | * @note | ||
115 | * None | ||
116 | */ | ||
117 | /****************************************************************************/ | ||
118 | static inline int dmacHw_GetTrWidthInBytes(dmacHw_TRANSACTION_WIDTH_e tw /* [ IN ] Transaction width */ | ||
119 | ) { | ||
120 | int width = 1; | ||
121 | switch (tw) { | ||
122 | case dmacHw_SRC_TRANSACTION_WIDTH_8: | ||
123 | width = 1; | ||
124 | break; | ||
125 | case dmacHw_SRC_TRANSACTION_WIDTH_16: | ||
126 | case dmacHw_DST_TRANSACTION_WIDTH_16: | ||
127 | width = 2; | ||
128 | break; | ||
129 | case dmacHw_SRC_TRANSACTION_WIDTH_32: | ||
130 | case dmacHw_DST_TRANSACTION_WIDTH_32: | ||
131 | width = 4; | ||
132 | break; | ||
133 | case dmacHw_SRC_TRANSACTION_WIDTH_64: | ||
134 | case dmacHw_DST_TRANSACTION_WIDTH_64: | ||
135 | width = 8; | ||
136 | break; | ||
137 | default: | ||
138 | dmacHw_ASSERT(0); | ||
139 | } | ||
140 | |||
141 | /* Default transaction width */ | ||
142 | return width; | ||
143 | } | ||
144 | |||
145 | #endif /* _DMACHW_PRIV_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/dmacHw_reg.h b/arch/arm/mach-bcmring/include/mach/csp/dmacHw_reg.h deleted file mode 100644 index 7cd0aafa6f6e..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/dmacHw_reg.h +++ /dev/null | |||
@@ -1,406 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dmacHw_reg.h | ||
18 | * | ||
19 | * @brief Definitions for low level DMA registers | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | |||
24 | #ifndef _DMACHW_REG_H | ||
25 | #define _DMACHW_REG_H | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <mach/csp/mm_io.h> | ||
29 | |||
30 | /* Data type for 64 bit little endian register */ | ||
31 | typedef struct { | ||
32 | volatile uint32_t lo; /* Lower 32 bit in little endian mode */ | ||
33 | volatile uint32_t hi; /* Upper 32 bit in little endian mode */ | ||
34 | } dmacHw_REG64_t; | ||
35 | |||
36 | /* Data type representing DMA channel registers */ | ||
37 | typedef struct { | ||
38 | dmacHw_REG64_t ChannelSar; /* Source Address Register. 64 bits (upper 32 bits are reserved) | ||
39 | Address must be aligned to CTLx.SRC_TR_WIDTH. | ||
40 | */ | ||
41 | dmacHw_REG64_t ChannelDar; /* Destination Address Register.64 bits (upper 32 bits are reserved) | ||
42 | Address must be aligned to CTLx.DST_TR_WIDTH. | ||
43 | */ | ||
44 | dmacHw_REG64_t ChannelLlp; /* Link List Pointer.64 bits (upper 32 bits are reserved) | ||
45 | LLP contains the pointer to the next LLI for block chaining using linked lists. | ||
46 | If LLPis set to 0x0, then transfers using linked lists are not enabled. | ||
47 | Address MUST be aligned to a 32-bit boundary. | ||
48 | */ | ||
49 | dmacHw_REG64_t ChannelCtl; /* Control Register. 64 bits */ | ||
50 | dmacHw_REG64_t ChannelSstat; /* Source Status Register */ | ||
51 | dmacHw_REG64_t ChannelDstat; /* Destination Status Register */ | ||
52 | dmacHw_REG64_t ChannelSstatAddr; /* Source Status Address Register */ | ||
53 | dmacHw_REG64_t ChannelDstatAddr; /* Destination Status Address Register */ | ||
54 | dmacHw_REG64_t ChannelConfig; /* Channel Configuration Register */ | ||
55 | dmacHw_REG64_t SrcGather; /* Source gather register */ | ||
56 | dmacHw_REG64_t DstScatter; /* Destination scatter register */ | ||
57 | } dmacHw_CH_REG_t; | ||
58 | |||
59 | /* Data type for RAW interrupt status registers */ | ||
60 | typedef struct { | ||
61 | dmacHw_REG64_t RawTfr; /* Raw Status for IntTfr Interrupt */ | ||
62 | dmacHw_REG64_t RawBlock; /* Raw Status for IntBlock Interrupt */ | ||
63 | dmacHw_REG64_t RawSrcTran; /* Raw Status for IntSrcTran Interrupt */ | ||
64 | dmacHw_REG64_t RawDstTran; /* Raw Status for IntDstTran Interrupt */ | ||
65 | dmacHw_REG64_t RawErr; /* Raw Status for IntErr Interrupt */ | ||
66 | } dmacHw_INT_RAW_t; | ||
67 | |||
68 | /* Data type for interrupt status registers */ | ||
69 | typedef struct { | ||
70 | dmacHw_REG64_t StatusTfr; /* Status for IntTfr Interrupt */ | ||
71 | dmacHw_REG64_t StatusBlock; /* Status for IntBlock Interrupt */ | ||
72 | dmacHw_REG64_t StatusSrcTran; /* Status for IntSrcTran Interrupt */ | ||
73 | dmacHw_REG64_t StatusDstTran; /* Status for IntDstTran Interrupt */ | ||
74 | dmacHw_REG64_t StatusErr; /* Status for IntErr Interrupt */ | ||
75 | } dmacHw_INT_STATUS_t; | ||
76 | |||
77 | /* Data type for interrupt mask registers*/ | ||
78 | typedef struct { | ||
79 | dmacHw_REG64_t MaskTfr; /* Mask for IntTfr Interrupt */ | ||
80 | dmacHw_REG64_t MaskBlock; /* Mask for IntBlock Interrupt */ | ||
81 | dmacHw_REG64_t MaskSrcTran; /* Mask for IntSrcTran Interrupt */ | ||
82 | dmacHw_REG64_t MaskDstTran; /* Mask for IntDstTran Interrupt */ | ||
83 | dmacHw_REG64_t MaskErr; /* Mask for IntErr Interrupt */ | ||
84 | } dmacHw_INT_MASK_t; | ||
85 | |||
86 | /* Data type for interrupt clear registers */ | ||
87 | typedef struct { | ||
88 | dmacHw_REG64_t ClearTfr; /* Clear for IntTfr Interrupt */ | ||
89 | dmacHw_REG64_t ClearBlock; /* Clear for IntBlock Interrupt */ | ||
90 | dmacHw_REG64_t ClearSrcTran; /* Clear for IntSrcTran Interrupt */ | ||
91 | dmacHw_REG64_t ClearDstTran; /* Clear for IntDstTran Interrupt */ | ||
92 | dmacHw_REG64_t ClearErr; /* Clear for IntErr Interrupt */ | ||
93 | dmacHw_REG64_t StatusInt; /* Status for each interrupt type */ | ||
94 | } dmacHw_INT_CLEAR_t; | ||
95 | |||
96 | /* Data type for software handshaking registers */ | ||
97 | typedef struct { | ||
98 | dmacHw_REG64_t ReqSrcReg; /* Source Software Transaction Request Register */ | ||
99 | dmacHw_REG64_t ReqDstReg; /* Destination Software Transaction Request Register */ | ||
100 | dmacHw_REG64_t SglReqSrcReg; /* Single Source Transaction Request Register */ | ||
101 | dmacHw_REG64_t SglReqDstReg; /* Single Destination Transaction Request Register */ | ||
102 | dmacHw_REG64_t LstSrcReg; /* Last Source Transaction Request Register */ | ||
103 | dmacHw_REG64_t LstDstReg; /* Last Destination Transaction Request Register */ | ||
104 | } dmacHw_SW_HANDSHAKE_t; | ||
105 | |||
106 | /* Data type for misc. registers */ | ||
107 | typedef struct { | ||
108 | dmacHw_REG64_t DmaCfgReg; /* DMA Configuration Register */ | ||
109 | dmacHw_REG64_t ChEnReg; /* DMA Channel Enable Register */ | ||
110 | dmacHw_REG64_t DmaIdReg; /* DMA ID Register */ | ||
111 | dmacHw_REG64_t DmaTestReg; /* DMA Test Register */ | ||
112 | dmacHw_REG64_t Reserved0; /* Reserved */ | ||
113 | dmacHw_REG64_t Reserved1; /* Reserved */ | ||
114 | dmacHw_REG64_t CompParm6; /* Component Parameter 6 */ | ||
115 | dmacHw_REG64_t CompParm5; /* Component Parameter 5 */ | ||
116 | dmacHw_REG64_t CompParm4; /* Component Parameter 4 */ | ||
117 | dmacHw_REG64_t CompParm3; /* Component Parameter 3 */ | ||
118 | dmacHw_REG64_t CompParm2; /* Component Parameter 2 */ | ||
119 | dmacHw_REG64_t CompParm1; /* Component Parameter 1 */ | ||
120 | dmacHw_REG64_t CompId; /* Compoent ID */ | ||
121 | } dmacHw_MISC_t; | ||
122 | |||
123 | /* Base registers */ | ||
124 | #define dmacHw_0_MODULE_BASE_ADDR (char __iomem*) MM_IO_BASE_DMA0 /* DMAC 0 module's base address */ | ||
125 | #define dmacHw_1_MODULE_BASE_ADDR (char __iomem*) MM_IO_BASE_DMA1 /* DMAC 1 module's base address */ | ||
126 | |||
127 | extern uint32_t dmaChannelCount_0; | ||
128 | extern uint32_t dmaChannelCount_1; | ||
129 | |||
130 | /* Define channel specific registers */ | ||
131 | #define dmacHw_CHAN_BASE(module, chan) ((dmacHw_CH_REG_t __iomem*) ((char __iomem*)((module) ? dmacHw_1_MODULE_BASE_ADDR : dmacHw_0_MODULE_BASE_ADDR) + ((chan) * sizeof(dmacHw_CH_REG_t)))) | ||
132 | |||
133 | /* Raw interrupt status registers */ | ||
134 | #define dmacHw_REG_INT_RAW_BASE(module) ((char __iomem *)dmacHw_CHAN_BASE((module), ((module) ? dmaChannelCount_1 : dmaChannelCount_0))) | ||
135 | #define dmacHw_REG_INT_RAW_TRAN(module) (((dmacHw_INT_RAW_t __iomem *) dmacHw_REG_INT_RAW_BASE((module)))->RawTfr.lo) | ||
136 | #define dmacHw_REG_INT_RAW_BLOCK(module) (((dmacHw_INT_RAW_t __iomem *) dmacHw_REG_INT_RAW_BASE((module)))->RawBlock.lo) | ||
137 | #define dmacHw_REG_INT_RAW_STRAN(module) (((dmacHw_INT_RAW_t __iomem *) dmacHw_REG_INT_RAW_BASE((module)))->RawSrcTran.lo) | ||
138 | #define dmacHw_REG_INT_RAW_DTRAN(module) (((dmacHw_INT_RAW_t __iomem *) dmacHw_REG_INT_RAW_BASE((module)))->RawDstTran.lo) | ||
139 | #define dmacHw_REG_INT_RAW_ERROR(module) (((dmacHw_INT_RAW_t __iomem *) dmacHw_REG_INT_RAW_BASE((module)))->RawErr.lo) | ||
140 | |||
141 | /* Interrupt status registers */ | ||
142 | #define dmacHw_REG_INT_STAT_BASE(module) ((char __iomem*)(dmacHw_REG_INT_RAW_BASE((module)) + sizeof(dmacHw_INT_RAW_t))) | ||
143 | #define dmacHw_REG_INT_STAT_TRAN(module) (((dmacHw_INT_STATUS_t __iomem *) dmacHw_REG_INT_STAT_BASE((module)))->StatusTfr.lo) | ||
144 | #define dmacHw_REG_INT_STAT_BLOCK(module) (((dmacHw_INT_STATUS_t __iomem *) dmacHw_REG_INT_STAT_BASE((module)))->StatusBlock.lo) | ||
145 | #define dmacHw_REG_INT_STAT_STRAN(module) (((dmacHw_INT_STATUS_t __iomem *) dmacHw_REG_INT_STAT_BASE((module)))->StatusSrcTran.lo) | ||
146 | #define dmacHw_REG_INT_STAT_DTRAN(module) (((dmacHw_INT_STATUS_t __iomem *) dmacHw_REG_INT_STAT_BASE((module)))->StatusDstTran.lo) | ||
147 | #define dmacHw_REG_INT_STAT_ERROR(module) (((dmacHw_INT_STATUS_t __iomem *) dmacHw_REG_INT_STAT_BASE((module)))->StatusErr.lo) | ||
148 | |||
149 | /* Interrupt status registers */ | ||
150 | #define dmacHw_REG_INT_MASK_BASE(module) ((char __iomem*)(dmacHw_REG_INT_STAT_BASE((module)) + sizeof(dmacHw_INT_STATUS_t))) | ||
151 | #define dmacHw_REG_INT_MASK_TRAN(module) (((dmacHw_INT_MASK_t __iomem *) dmacHw_REG_INT_MASK_BASE((module)))->MaskTfr.lo) | ||
152 | #define dmacHw_REG_INT_MASK_BLOCK(module) (((dmacHw_INT_MASK_t __iomem *) dmacHw_REG_INT_MASK_BASE((module)))->MaskBlock.lo) | ||
153 | #define dmacHw_REG_INT_MASK_STRAN(module) (((dmacHw_INT_MASK_t __iomem *) dmacHw_REG_INT_MASK_BASE((module)))->MaskSrcTran.lo) | ||
154 | #define dmacHw_REG_INT_MASK_DTRAN(module) (((dmacHw_INT_MASK_t __iomem *) dmacHw_REG_INT_MASK_BASE((module)))->MaskDstTran.lo) | ||
155 | #define dmacHw_REG_INT_MASK_ERROR(module) (((dmacHw_INT_MASK_t __iomem *) dmacHw_REG_INT_MASK_BASE((module)))->MaskErr.lo) | ||
156 | |||
157 | /* Interrupt clear registers */ | ||
158 | #define dmacHw_REG_INT_CLEAR_BASE(module) ((char __iomem*)(dmacHw_REG_INT_MASK_BASE((module)) + sizeof(dmacHw_INT_MASK_t))) | ||
159 | #define dmacHw_REG_INT_CLEAR_TRAN(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->ClearTfr.lo) | ||
160 | #define dmacHw_REG_INT_CLEAR_BLOCK(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->ClearBlock.lo) | ||
161 | #define dmacHw_REG_INT_CLEAR_STRAN(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->ClearSrcTran.lo) | ||
162 | #define dmacHw_REG_INT_CLEAR_DTRAN(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->ClearDstTran.lo) | ||
163 | #define dmacHw_REG_INT_CLEAR_ERROR(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->ClearErr.lo) | ||
164 | #define dmacHw_REG_INT_STATUS(module) (((dmacHw_INT_CLEAR_t __iomem *) dmacHw_REG_INT_CLEAR_BASE((module)))->StatusInt.lo) | ||
165 | |||
166 | /* Software handshaking registers */ | ||
167 | #define dmacHw_REG_SW_HS_BASE(module) ((char __iomem*)(dmacHw_REG_INT_CLEAR_BASE((module)) + sizeof(dmacHw_INT_CLEAR_t))) | ||
168 | #define dmacHw_REG_SW_HS_SRC_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->ReqSrcReg.lo) | ||
169 | #define dmacHw_REG_SW_HS_DST_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->ReqDstReg.lo) | ||
170 | #define dmacHw_REG_SW_HS_SRC_SGL_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->SglReqSrcReg.lo) | ||
171 | #define dmacHw_REG_SW_HS_DST_SGL_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->SglReqDstReg.lo) | ||
172 | #define dmacHw_REG_SW_HS_SRC_LST_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->LstSrcReg.lo) | ||
173 | #define dmacHw_REG_SW_HS_DST_LST_REQ(module) (((dmacHw_SW_HANDSHAKE_t __iomem *) dmacHw_REG_SW_HS_BASE((module)))->LstDstReg.lo) | ||
174 | |||
175 | /* Miscellaneous registers */ | ||
176 | #define dmacHw_REG_MISC_BASE(module) ((char __iomem*)(dmacHw_REG_SW_HS_BASE((module)) + sizeof(dmacHw_SW_HANDSHAKE_t))) | ||
177 | #define dmacHw_REG_MISC_CFG(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->DmaCfgReg.lo) | ||
178 | #define dmacHw_REG_MISC_CH_ENABLE(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->ChEnReg.lo) | ||
179 | #define dmacHw_REG_MISC_ID(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->DmaIdReg.lo) | ||
180 | #define dmacHw_REG_MISC_TEST(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->DmaTestReg.lo) | ||
181 | #define dmacHw_REG_MISC_COMP_PARAM1_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm1.lo) | ||
182 | #define dmacHw_REG_MISC_COMP_PARAM1_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm1.hi) | ||
183 | #define dmacHw_REG_MISC_COMP_PARAM2_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm2.lo) | ||
184 | #define dmacHw_REG_MISC_COMP_PARAM2_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm2.hi) | ||
185 | #define dmacHw_REG_MISC_COMP_PARAM3_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm3.lo) | ||
186 | #define dmacHw_REG_MISC_COMP_PARAM3_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm3.hi) | ||
187 | #define dmacHw_REG_MISC_COMP_PARAM4_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm4.lo) | ||
188 | #define dmacHw_REG_MISC_COMP_PARAM4_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm4.hi) | ||
189 | #define dmacHw_REG_MISC_COMP_PARAM5_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm5.lo) | ||
190 | #define dmacHw_REG_MISC_COMP_PARAM5_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm5.hi) | ||
191 | #define dmacHw_REG_MISC_COMP_PARAM6_LO(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm6.lo) | ||
192 | #define dmacHw_REG_MISC_COMP_PARAM6_HI(module) (((dmacHw_MISC_t __iomem*) dmacHw_REG_MISC_BASE((module)))->CompParm6.hi) | ||
193 | |||
194 | /* Channel control registers */ | ||
195 | #define dmacHw_REG_SAR(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelSar.lo) | ||
196 | #define dmacHw_REG_DAR(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelDar.lo) | ||
197 | #define dmacHw_REG_LLP(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelLlp.lo) | ||
198 | |||
199 | #define dmacHw_REG_CTL_LO(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelCtl.lo) | ||
200 | #define dmacHw_REG_CTL_HI(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelCtl.hi) | ||
201 | |||
202 | #define dmacHw_REG_SSTAT(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelSstat.lo) | ||
203 | #define dmacHw_REG_DSTAT(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelDstat.lo) | ||
204 | #define dmacHw_REG_SSTATAR(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelSstatAddr.lo) | ||
205 | #define dmacHw_REG_DSTATAR(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelDstatAddr.lo) | ||
206 | |||
207 | #define dmacHw_REG_CFG_LO(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelConfig.lo) | ||
208 | #define dmacHw_REG_CFG_HI(module, chan) (dmacHw_CHAN_BASE((module), (chan))->ChannelConfig.hi) | ||
209 | |||
210 | #define dmacHw_REG_SGR_LO(module, chan) (dmacHw_CHAN_BASE((module), (chan))->SrcGather.lo) | ||
211 | #define dmacHw_REG_SGR_HI(module, chan) (dmacHw_CHAN_BASE((module), (chan))->SrcGather.hi) | ||
212 | |||
213 | #define dmacHw_REG_DSR_LO(module, chan) (dmacHw_CHAN_BASE((module), (chan))->DstScatter.lo) | ||
214 | #define dmacHw_REG_DSR_HI(module, chan) (dmacHw_CHAN_BASE((module), (chan))->DstScatter.hi) | ||
215 | |||
216 | #define INT_STATUS_MASK(channel) (0x00000001 << (channel)) | ||
217 | #define CHANNEL_BUSY(mod, channel) (dmacHw_REG_MISC_CH_ENABLE((mod)) & (0x00000001 << (channel))) | ||
218 | |||
219 | /* Bit mask for REG_DMACx_CTL_LO */ | ||
220 | |||
221 | #define dmacHw_REG_CTL_INT_EN 0x00000001 /* Channel interrupt enable */ | ||
222 | |||
223 | #define dmacHw_REG_CTL_DST_TR_WIDTH_MASK 0x0000000E /* Destination transaction width mask */ | ||
224 | #define dmacHw_REG_CTL_DST_TR_WIDTH_SHIFT 1 | ||
225 | #define dmacHw_REG_CTL_DST_TR_WIDTH_8 0x00000000 /* Destination transaction width 8 bit */ | ||
226 | #define dmacHw_REG_CTL_DST_TR_WIDTH_16 0x00000002 /* Destination transaction width 16 bit */ | ||
227 | #define dmacHw_REG_CTL_DST_TR_WIDTH_32 0x00000004 /* Destination transaction width 32 bit */ | ||
228 | #define dmacHw_REG_CTL_DST_TR_WIDTH_64 0x00000006 /* Destination transaction width 64 bit */ | ||
229 | |||
230 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_MASK 0x00000070 /* Source transaction width mask */ | ||
231 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_SHIFT 4 | ||
232 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_8 0x00000000 /* Source transaction width 8 bit */ | ||
233 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_16 0x00000010 /* Source transaction width 16 bit */ | ||
234 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_32 0x00000020 /* Source transaction width 32 bit */ | ||
235 | #define dmacHw_REG_CTL_SRC_TR_WIDTH_64 0x00000030 /* Source transaction width 64 bit */ | ||
236 | |||
237 | #define dmacHw_REG_CTL_DS_ENABLE 0x00040000 /* Destination scatter enable */ | ||
238 | #define dmacHw_REG_CTL_SG_ENABLE 0x00020000 /* Source gather enable */ | ||
239 | |||
240 | #define dmacHw_REG_CTL_DINC_MASK 0x00000180 /* Destination address inc/dec mask */ | ||
241 | #define dmacHw_REG_CTL_DINC_INC 0x00000000 /* Destination address increment */ | ||
242 | #define dmacHw_REG_CTL_DINC_DEC 0x00000080 /* Destination address decrement */ | ||
243 | #define dmacHw_REG_CTL_DINC_NC 0x00000100 /* Destination address no change */ | ||
244 | |||
245 | #define dmacHw_REG_CTL_SINC_MASK 0x00000600 /* Source address inc/dec mask */ | ||
246 | #define dmacHw_REG_CTL_SINC_INC 0x00000000 /* Source address increment */ | ||
247 | #define dmacHw_REG_CTL_SINC_DEC 0x00000200 /* Source address decrement */ | ||
248 | #define dmacHw_REG_CTL_SINC_NC 0x00000400 /* Source address no change */ | ||
249 | |||
250 | #define dmacHw_REG_CTL_DST_MSIZE_MASK 0x00003800 /* Destination burst transaction length */ | ||
251 | #define dmacHw_REG_CTL_DST_MSIZE_0 0x00000000 /* No Destination burst */ | ||
252 | #define dmacHw_REG_CTL_DST_MSIZE_4 0x00000800 /* Destination burst transaction length 4 */ | ||
253 | #define dmacHw_REG_CTL_DST_MSIZE_8 0x00001000 /* Destination burst transaction length 8 */ | ||
254 | #define dmacHw_REG_CTL_DST_MSIZE_16 0x00001800 /* Destination burst transaction length 16 */ | ||
255 | |||
256 | #define dmacHw_REG_CTL_SRC_MSIZE_MASK 0x0001C000 /* Source burst transaction length */ | ||
257 | #define dmacHw_REG_CTL_SRC_MSIZE_0 0x00000000 /* No Source burst */ | ||
258 | #define dmacHw_REG_CTL_SRC_MSIZE_4 0x00004000 /* Source burst transaction length 4 */ | ||
259 | #define dmacHw_REG_CTL_SRC_MSIZE_8 0x00008000 /* Source burst transaction length 8 */ | ||
260 | #define dmacHw_REG_CTL_SRC_MSIZE_16 0x0000C000 /* Source burst transaction length 16 */ | ||
261 | |||
262 | #define dmacHw_REG_CTL_TTFC_MASK 0x00700000 /* Transfer type and flow controller */ | ||
263 | #define dmacHw_REG_CTL_TTFC_MM_DMAC 0x00000000 /* Memory to Memory with DMAC as flow controller */ | ||
264 | #define dmacHw_REG_CTL_TTFC_MP_DMAC 0x00100000 /* Memory to Peripheral with DMAC as flow controller */ | ||
265 | #define dmacHw_REG_CTL_TTFC_PM_DMAC 0x00200000 /* Peripheral to Memory with DMAC as flow controller */ | ||
266 | #define dmacHw_REG_CTL_TTFC_PP_DMAC 0x00300000 /* Peripheral to Peripheral with DMAC as flow controller */ | ||
267 | #define dmacHw_REG_CTL_TTFC_PM_PERI 0x00400000 /* Peripheral to Memory with Peripheral as flow controller */ | ||
268 | #define dmacHw_REG_CTL_TTFC_PP_SPERI 0x00500000 /* Peripheral to Peripheral with Source Peripheral as flow controller */ | ||
269 | #define dmacHw_REG_CTL_TTFC_MP_PERI 0x00600000 /* Memory to Peripheral with Peripheral as flow controller */ | ||
270 | #define dmacHw_REG_CTL_TTFC_PP_DPERI 0x00700000 /* Peripheral to Peripheral with Destination Peripheral as flow controller */ | ||
271 | |||
272 | #define dmacHw_REG_CTL_DMS_MASK 0x01800000 /* Destination AHB master interface */ | ||
273 | #define dmacHw_REG_CTL_DMS_1 0x00000000 /* Destination AHB master interface 1 */ | ||
274 | #define dmacHw_REG_CTL_DMS_2 0x00800000 /* Destination AHB master interface 2 */ | ||
275 | |||
276 | #define dmacHw_REG_CTL_SMS_MASK 0x06000000 /* Source AHB master interface */ | ||
277 | #define dmacHw_REG_CTL_SMS_1 0x00000000 /* Source AHB master interface 1 */ | ||
278 | #define dmacHw_REG_CTL_SMS_2 0x02000000 /* Source AHB master interface 2 */ | ||
279 | |||
280 | #define dmacHw_REG_CTL_LLP_DST_EN 0x08000000 /* Block chaining enable for destination side */ | ||
281 | #define dmacHw_REG_CTL_LLP_SRC_EN 0x10000000 /* Block chaining enable for source side */ | ||
282 | |||
283 | /* Bit mask for REG_DMACx_CTL_HI */ | ||
284 | #define dmacHw_REG_CTL_BLOCK_TS_MASK 0x00000FFF /* Block transfer size */ | ||
285 | #define dmacHw_REG_CTL_DONE 0x00001000 /* Block trasnfer done */ | ||
286 | |||
287 | /* Bit mask for REG_DMACx_CFG_LO */ | ||
288 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_SHIFT 5 /* Channel priority shift */ | ||
289 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_MASK 0x000000E0 /* Channel priority mask */ | ||
290 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_0 0x00000000 /* Channel priority 0 */ | ||
291 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_1 0x00000020 /* Channel priority 1 */ | ||
292 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_2 0x00000040 /* Channel priority 2 */ | ||
293 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_3 0x00000060 /* Channel priority 3 */ | ||
294 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_4 0x00000080 /* Channel priority 4 */ | ||
295 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_5 0x000000A0 /* Channel priority 5 */ | ||
296 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_6 0x000000C0 /* Channel priority 6 */ | ||
297 | #define dmacHw_REG_CFG_LO_CH_PRIORITY_7 0x000000E0 /* Channel priority 7 */ | ||
298 | |||
299 | #define dmacHw_REG_CFG_LO_CH_SUSPEND 0x00000100 /* Channel suspend */ | ||
300 | #define dmacHw_REG_CFG_LO_CH_FIFO_EMPTY 0x00000200 /* Channel FIFO empty */ | ||
301 | #define dmacHw_REG_CFG_LO_DST_CH_SW_HS 0x00000400 /* Destination channel SW handshaking */ | ||
302 | #define dmacHw_REG_CFG_LO_SRC_CH_SW_HS 0x00000800 /* Source channel SW handshaking */ | ||
303 | |||
304 | #define dmacHw_REG_CFG_LO_CH_LOCK_MASK 0x00003000 /* Channel locking mask */ | ||
305 | #define dmacHw_REG_CFG_LO_CH_LOCK_DMA 0x00000000 /* Channel lock over the entire DMA transfer operation */ | ||
306 | #define dmacHw_REG_CFG_LO_CH_LOCK_BLOCK 0x00001000 /* Channel lock over the block transfer operation */ | ||
307 | #define dmacHw_REG_CFG_LO_CH_LOCK_TRANS 0x00002000 /* Channel lock over the transaction */ | ||
308 | #define dmacHw_REG_CFG_LO_CH_LOCK_ENABLE 0x00010000 /* Channel lock enable */ | ||
309 | |||
310 | #define dmacHw_REG_CFG_LO_BUS_LOCK_MASK 0x0000C000 /* Bus locking mask */ | ||
311 | #define dmacHw_REG_CFG_LO_BUS_LOCK_DMA 0x00000000 /* Bus lock over the entire DMA transfer operation */ | ||
312 | #define dmacHw_REG_CFG_LO_BUS_LOCK_BLOCK 0x00004000 /* Bus lock over the block transfer operation */ | ||
313 | #define dmacHw_REG_CFG_LO_BUS_LOCK_TRANS 0x00008000 /* Bus lock over the transaction */ | ||
314 | #define dmacHw_REG_CFG_LO_BUS_LOCK_ENABLE 0x00020000 /* Bus lock enable */ | ||
315 | |||
316 | #define dmacHw_REG_CFG_LO_DST_HS_POLARITY_LOW 0x00040000 /* Destination channel handshaking signal polarity low */ | ||
317 | #define dmacHw_REG_CFG_LO_SRC_HS_POLARITY_LOW 0x00080000 /* Source channel handshaking signal polarity low */ | ||
318 | |||
319 | #define dmacHw_REG_CFG_LO_MAX_AMBA_BURST_LEN_MASK 0x3FF00000 /* Maximum AMBA burst length */ | ||
320 | |||
321 | #define dmacHw_REG_CFG_LO_AUTO_RELOAD_SRC 0x40000000 /* Source address auto reload */ | ||
322 | #define dmacHw_REG_CFG_LO_AUTO_RELOAD_DST 0x80000000 /* Destination address auto reload */ | ||
323 | |||
324 | /* Bit mask for REG_DMACx_CFG_HI */ | ||
325 | #define dmacHw_REG_CFG_HI_FC_DST_READY 0x00000001 /* Source transaction request is serviced when destination is ready */ | ||
326 | #define dmacHw_REG_CFG_HI_FIFO_ENOUGH 0x00000002 /* Initiate burst transaction when enough data in available in FIFO */ | ||
327 | |||
328 | #define dmacHw_REG_CFG_HI_AHB_HPROT_MASK 0x0000001C /* AHB protection mask */ | ||
329 | #define dmacHw_REG_CFG_HI_AHB_HPROT_1 0x00000004 /* AHB protection 1 */ | ||
330 | #define dmacHw_REG_CFG_HI_AHB_HPROT_2 0x00000008 /* AHB protection 2 */ | ||
331 | #define dmacHw_REG_CFG_HI_AHB_HPROT_3 0x00000010 /* AHB protection 3 */ | ||
332 | |||
333 | #define dmacHw_REG_CFG_HI_UPDATE_DST_STAT 0x00000020 /* Destination status update enable */ | ||
334 | #define dmacHw_REG_CFG_HI_UPDATE_SRC_STAT 0x00000040 /* Source status update enable */ | ||
335 | |||
336 | #define dmacHw_REG_CFG_HI_SRC_PERI_INTF_MASK 0x00000780 /* Source peripheral hardware interface mask */ | ||
337 | #define dmacHw_REG_CFG_HI_DST_PERI_INTF_MASK 0x00007800 /* Destination peripheral hardware interface mask */ | ||
338 | |||
339 | /* DMA Configuration Parameters */ | ||
340 | #define dmacHw_REG_COMP_PARAM_NUM_CHANNELS 0x00000700 /* Number of channels */ | ||
341 | #define dmacHw_REG_COMP_PARAM_NUM_INTERFACE 0x00001800 /* Number of master interface */ | ||
342 | #define dmacHw_REG_COMP_PARAM_MAX_BLK_SIZE 0x0000000f /* Maximum brust size */ | ||
343 | #define dmacHw_REG_COMP_PARAM_DATA_WIDTH 0x00006000 /* Data transfer width */ | ||
344 | |||
345 | /* Define GET/SET macros to program the registers */ | ||
346 | #define dmacHw_SET_SAR(module, channel, addr) (dmacHw_REG_SAR((module), (channel)) = (uint32_t) (addr)) | ||
347 | #define dmacHw_SET_DAR(module, channel, addr) (dmacHw_REG_DAR((module), (channel)) = (uint32_t) (addr)) | ||
348 | #define dmacHw_SET_LLP(module, channel, ptr) (dmacHw_REG_LLP((module), (channel)) = (uint32_t) (ptr)) | ||
349 | |||
350 | #define dmacHw_GET_SSTAT(module, channel) (dmacHw_REG_SSTAT((module), (channel))) | ||
351 | #define dmacHw_GET_DSTAT(module, channel) (dmacHw_REG_DSTAT((module), (channel))) | ||
352 | |||
353 | #define dmacHw_SET_SSTATAR(module, channel, addr) (dmacHw_REG_SSTATAR((module), (channel)) = (uint32_t) (addr)) | ||
354 | #define dmacHw_SET_DSTATAR(module, channel, addr) (dmacHw_REG_DSTATAR((module), (channel)) = (uint32_t) (addr)) | ||
355 | |||
356 | #define dmacHw_SET_CONTROL_LO(module, channel, ctl) (dmacHw_REG_CTL_LO((module), (channel)) |= (ctl)) | ||
357 | #define dmacHw_RESET_CONTROL_LO(module, channel) (dmacHw_REG_CTL_LO((module), (channel)) = 0) | ||
358 | #define dmacHw_GET_CONTROL_LO(module, channel) (dmacHw_REG_CTL_LO((module), (channel))) | ||
359 | |||
360 | #define dmacHw_SET_CONTROL_HI(module, channel, ctl) (dmacHw_REG_CTL_HI((module), (channel)) |= (ctl)) | ||
361 | #define dmacHw_RESET_CONTROL_HI(module, channel) (dmacHw_REG_CTL_HI((module), (channel)) = 0) | ||
362 | #define dmacHw_GET_CONTROL_HI(module, channel) (dmacHw_REG_CTL_HI((module), (channel))) | ||
363 | |||
364 | #define dmacHw_GET_BLOCK_SIZE(module, channel) (dmacHw_REG_CTL_HI((module), (channel)) & dmacHw_REG_CTL_BLOCK_TS_MASK) | ||
365 | #define dmacHw_DMA_COMPLETE(module, channel) (dmacHw_REG_CTL_HI((module), (channel)) & dmacHw_REG_CTL_DONE) | ||
366 | |||
367 | #define dmacHw_SET_CONFIG_LO(module, channel, cfg) (dmacHw_REG_CFG_LO((module), (channel)) |= (cfg)) | ||
368 | #define dmacHw_RESET_CONFIG_LO(module, channel) (dmacHw_REG_CFG_LO((module), (channel)) = 0) | ||
369 | #define dmacHw_GET_CONFIG_LO(module, channel) (dmacHw_REG_CFG_LO((module), (channel))) | ||
370 | #define dmacHw_SET_AMBA_BUSRT_LEN(module, channel, len) (dmacHw_REG_CFG_LO((module), (channel)) = (dmacHw_REG_CFG_LO((module), (channel)) & ~(dmacHw_REG_CFG_LO_MAX_AMBA_BURST_LEN_MASK)) | (((len) << 20) & dmacHw_REG_CFG_LO_MAX_AMBA_BURST_LEN_MASK)) | ||
371 | #define dmacHw_SET_CHANNEL_PRIORITY(module, channel, prio) (dmacHw_REG_CFG_LO((module), (channel)) = (dmacHw_REG_CFG_LO((module), (channel)) & ~(dmacHw_REG_CFG_LO_CH_PRIORITY_MASK)) | (prio)) | ||
372 | #define dmacHw_SET_AHB_HPROT(module, channel, protect) (dmacHw_REG_CFG_HI(module, channel) = (dmacHw_REG_CFG_HI((module), (channel)) & ~(dmacHw_REG_CFG_HI_AHB_HPROT_MASK)) | (protect)) | ||
373 | |||
374 | #define dmacHw_SET_CONFIG_HI(module, channel, cfg) (dmacHw_REG_CFG_HI((module), (channel)) |= (cfg)) | ||
375 | #define dmacHw_RESET_CONFIG_HI(module, channel) (dmacHw_REG_CFG_HI((module), (channel)) = 0) | ||
376 | #define dmacHw_GET_CONFIG_HI(module, channel) (dmacHw_REG_CFG_HI((module), (channel))) | ||
377 | #define dmacHw_SET_SRC_PERI_INTF(module, channel, intf) (dmacHw_REG_CFG_HI((module), (channel)) = (dmacHw_REG_CFG_HI((module), (channel)) & ~(dmacHw_REG_CFG_HI_SRC_PERI_INTF_MASK)) | (((intf) << 7) & dmacHw_REG_CFG_HI_SRC_PERI_INTF_MASK)) | ||
378 | #define dmacHw_SRC_PERI_INTF(intf) (((intf) << 7) & dmacHw_REG_CFG_HI_SRC_PERI_INTF_MASK) | ||
379 | #define dmacHw_SET_DST_PERI_INTF(module, channel, intf) (dmacHw_REG_CFG_HI((module), (channel)) = (dmacHw_REG_CFG_HI((module), (channel)) & ~(dmacHw_REG_CFG_HI_DST_PERI_INTF_MASK)) | (((intf) << 11) & dmacHw_REG_CFG_HI_DST_PERI_INTF_MASK)) | ||
380 | #define dmacHw_DST_PERI_INTF(intf) (((intf) << 11) & dmacHw_REG_CFG_HI_DST_PERI_INTF_MASK) | ||
381 | |||
382 | #define dmacHw_DMA_START(module, channel) (dmacHw_REG_MISC_CH_ENABLE((module)) = (0x00000001 << ((channel) + 8)) | (0x00000001 << (channel))) | ||
383 | #define dmacHw_DMA_STOP(module, channel) (dmacHw_REG_MISC_CH_ENABLE((module)) = (0x00000001 << ((channel) + 8))) | ||
384 | #define dmacHw_DMA_ENABLE(module) (dmacHw_REG_MISC_CFG((module)) = 1) | ||
385 | #define dmacHw_DMA_DISABLE(module) (dmacHw_REG_MISC_CFG((module)) = 0) | ||
386 | |||
387 | #define dmacHw_TRAN_INT_ENABLE(module, channel) (dmacHw_REG_INT_MASK_TRAN((module)) = (0x00000001 << ((channel) + 8)) | (0x00000001 << (channel))) | ||
388 | #define dmacHw_BLOCK_INT_ENABLE(module, channel) (dmacHw_REG_INT_MASK_BLOCK((module)) = (0x00000001 << ((channel) + 8)) | (0x00000001 << (channel))) | ||
389 | #define dmacHw_ERROR_INT_ENABLE(module, channel) (dmacHw_REG_INT_MASK_ERROR((module)) = (0x00000001 << ((channel) + 8)) | (0x00000001 << (channel))) | ||
390 | |||
391 | #define dmacHw_TRAN_INT_DISABLE(module, channel) (dmacHw_REG_INT_MASK_TRAN((module)) = (0x00000001 << ((channel) + 8))) | ||
392 | #define dmacHw_BLOCK_INT_DISABLE(module, channel) (dmacHw_REG_INT_MASK_BLOCK((module)) = (0x00000001 << ((channel) + 8))) | ||
393 | #define dmacHw_ERROR_INT_DISABLE(module, channel) (dmacHw_REG_INT_MASK_ERROR((module)) = (0x00000001 << ((channel) + 8))) | ||
394 | #define dmacHw_STRAN_INT_DISABLE(module, channel) (dmacHw_REG_INT_MASK_STRAN((module)) = (0x00000001 << ((channel) + 8))) | ||
395 | #define dmacHw_DTRAN_INT_DISABLE(module, channel) (dmacHw_REG_INT_MASK_DTRAN((module)) = (0x00000001 << ((channel) + 8))) | ||
396 | |||
397 | #define dmacHw_TRAN_INT_CLEAR(module, channel) (dmacHw_REG_INT_CLEAR_TRAN((module)) = (0x00000001 << (channel))) | ||
398 | #define dmacHw_BLOCK_INT_CLEAR(module, channel) (dmacHw_REG_INT_CLEAR_BLOCK((module)) = (0x00000001 << (channel))) | ||
399 | #define dmacHw_ERROR_INT_CLEAR(module, channel) (dmacHw_REG_INT_CLEAR_ERROR((module)) = (0x00000001 << (channel))) | ||
400 | |||
401 | #define dmacHw_GET_NUM_CHANNEL(module) (((dmacHw_REG_MISC_COMP_PARAM1_HI((module)) & dmacHw_REG_COMP_PARAM_NUM_CHANNELS) >> 8) + 1) | ||
402 | #define dmacHw_GET_NUM_INTERFACE(module) (((dmacHw_REG_MISC_COMP_PARAM1_HI((module)) & dmacHw_REG_COMP_PARAM_NUM_INTERFACE) >> 11) + 1) | ||
403 | #define dmacHw_GET_MAX_BLOCK_SIZE(module, channel) ((dmacHw_REG_MISC_COMP_PARAM1_LO((module)) >> (4 * (channel))) & dmacHw_REG_COMP_PARAM_MAX_BLK_SIZE) | ||
404 | #define dmacHw_GET_CHANNEL_DATA_WIDTH(module, channel) ((dmacHw_REG_MISC_COMP_PARAM1_HI((module)) & dmacHw_REG_COMP_PARAM_DATA_WIDTH) >> 13) | ||
405 | |||
406 | #endif /* _DMACHW_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/hw_cfg.h b/arch/arm/mach-bcmring/include/mach/csp/hw_cfg.h deleted file mode 100644 index 27f59dd27792..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/hw_cfg.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | |||
16 | #ifndef CSP_HW_CFG_H | ||
17 | #define CSP_HW_CFG_H | ||
18 | |||
19 | /* ---- Include Files ---------------------------------------------------- */ | ||
20 | |||
21 | #include <mach/cfg_global.h> | ||
22 | #include <mach/csp/cap_inline.h> | ||
23 | |||
24 | #if defined(__KERNEL__) | ||
25 | #include <mach/memory_settings.h> | ||
26 | #else | ||
27 | #include <hw_cfg.h> | ||
28 | #endif | ||
29 | |||
30 | /* Some items that can be defined externally, but will be set to default values */ | ||
31 | /* if they are not defined. */ | ||
32 | /* HW_CFG_PLL_SPREAD_SPECTRUM_DISABLE Default undefined and SS is enabled. */ | ||
33 | /* HW_CFG_SDRAM_CAS_LATENCY 5 Default 5, Values [3..6] */ | ||
34 | /* HW_CFG_SDRAM_CHIP_SELECT_CNT 1 Default 1, Vaules [1..2] */ | ||
35 | /* HW_CFG_SDRAM_SPEED_GRADE 667 Default 667, Values [400,533,667,800] */ | ||
36 | /* HW_CFG_SDRAM_WIDTH_BITS 16 Default 16, Vaules [8,16] */ | ||
37 | /* HW_CFG_SDRAM_ADDR_BRC Default undefined and Row-Bank-Col (RBC) addressing used. Define to use Bank-Row-Col (BRC). */ | ||
38 | /* HW_CFG_SDRAM_CLK_ASYNC Default undefined and DDR clock is synchronous with AXI BUS clock. Define for ASYNC mode. */ | ||
39 | |||
40 | #if defined(CFG_GLOBAL_CHIP) | ||
41 | #if (CFG_GLOBAL_CHIP == FPGA11107) | ||
42 | #define HW_CFG_BUS_CLK_HZ 5000000 | ||
43 | #define HW_CFG_DDR_CTLR_CLK_HZ 10000000 | ||
44 | #define HW_CFG_DDR_PHY_OMIT | ||
45 | #define HW_CFG_UART_CLK_HZ 7500000 | ||
46 | #else | ||
47 | #define HW_CFG_PLL_VCO_HZ 2000000000 | ||
48 | #define HW_CFG_PLL2_VCO_HZ 1800000000 | ||
49 | #define HW_CFG_ARM_CLK_HZ CAP_HW_CFG_ARM_CLK_HZ | ||
50 | #define HW_CFG_BUS_CLK_HZ 166666666 | ||
51 | #define HW_CFG_DDR_CTLR_CLK_HZ 333333333 | ||
52 | #define HW_CFG_DDR_PHY_CLK_HZ (2 * HW_CFG_DDR_CTLR_CLK_HZ) | ||
53 | #define HW_CFG_UART_CLK_HZ 142857142 | ||
54 | #define HW_CFG_VPM_CLK_HZ CAP_HW_CFG_VPM_CLK_HZ | ||
55 | #endif | ||
56 | #else | ||
57 | #define HW_CFG_PLL_VCO_HZ 1800000000 | ||
58 | #define HW_CFG_PLL2_VCO_HZ 1800000000 | ||
59 | #define HW_CFG_ARM_CLK_HZ 450000000 | ||
60 | #define HW_CFG_BUS_CLK_HZ 150000000 | ||
61 | #define HW_CFG_DDR_CTLR_CLK_HZ 300000000 | ||
62 | #define HW_CFG_DDR_PHY_CLK_HZ (2 * HW_CFG_DDR_CTLR_CLK_HZ) | ||
63 | #define HW_CFG_UART_CLK_HZ 150000000 | ||
64 | #define HW_CFG_VPM_CLK_HZ 300000000 | ||
65 | #endif | ||
66 | |||
67 | /* ---- Public Constants and Types --------------------------------------- */ | ||
68 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
69 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
70 | |||
71 | |||
72 | #endif /* CSP_HW_CFG_H */ | ||
73 | |||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h b/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h deleted file mode 100644 index f59db25b5632..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/intcHw_reg.h +++ /dev/null | |||
@@ -1,246 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file intcHw_reg.h | ||
18 | * | ||
19 | * @brief platform specific interrupt controller bit assignments | ||
20 | * | ||
21 | * @note | ||
22 | * None | ||
23 | */ | ||
24 | /****************************************************************************/ | ||
25 | |||
26 | #ifndef _INTCHW_REG_H | ||
27 | #define _INTCHW_REG_H | ||
28 | |||
29 | /* ---- Include Files ---------------------------------------------------- */ | ||
30 | #include <linux/types.h> | ||
31 | #include <mach/csp/reg.h> | ||
32 | #include <mach/csp/mm_io.h> | ||
33 | |||
34 | /* ---- Public Constants and Types --------------------------------------- */ | ||
35 | |||
36 | #define INTCHW_NUM_IRQ_PER_INTC 32 /* Maximum number of interrupt controllers */ | ||
37 | #define INTCHW_NUM_INTC 3 | ||
38 | |||
39 | /* Defines for interrupt controllers. This simplifies and cleans up the function calls. */ | ||
40 | #define INTCHW_INTC0 (MM_IO_BASE_INTC0) | ||
41 | #define INTCHW_INTC1 (MM_IO_BASE_INTC1) | ||
42 | #define INTCHW_SINTC (MM_IO_BASE_SINTC) | ||
43 | |||
44 | /* INTC0 - interrupt controller 0 */ | ||
45 | #define INTCHW_INTC0_PIF_BITNUM 31 /* Peripheral interface interrupt */ | ||
46 | #define INTCHW_INTC0_CLCD_BITNUM 30 /* LCD Controller interrupt */ | ||
47 | #define INTCHW_INTC0_GE_BITNUM 29 /* Graphic engine interrupt */ | ||
48 | #define INTCHW_INTC0_APM_BITNUM 28 /* Audio process module interrupt */ | ||
49 | #define INTCHW_INTC0_ESW_BITNUM 27 /* Ethernet switch interrupt */ | ||
50 | #define INTCHW_INTC0_SPIH_BITNUM 26 /* SPI host interrupt */ | ||
51 | #define INTCHW_INTC0_TIMER3_BITNUM 25 /* Timer3 interrupt */ | ||
52 | #define INTCHW_INTC0_TIMER2_BITNUM 24 /* Timer2 interrupt */ | ||
53 | #define INTCHW_INTC0_TIMER1_BITNUM 23 /* Timer1 interrupt */ | ||
54 | #define INTCHW_INTC0_TIMER0_BITNUM 22 /* Timer0 interrupt */ | ||
55 | #define INTCHW_INTC0_SDIOH1_BITNUM 21 /* SDIO1 host interrupt */ | ||
56 | #define INTCHW_INTC0_SDIOH0_BITNUM 20 /* SDIO0 host interrupt */ | ||
57 | #define INTCHW_INTC0_USBD_BITNUM 19 /* USB device interrupt */ | ||
58 | #define INTCHW_INTC0_USBH1_BITNUM 18 /* USB1 host interrupt */ | ||
59 | #define INTCHW_INTC0_USBHD2_BITNUM 17 /* USB host2/device2 interrupt */ | ||
60 | #define INTCHW_INTC0_VPM_BITNUM 16 /* Voice process module interrupt */ | ||
61 | #define INTCHW_INTC0_DMA1C7_BITNUM 15 /* DMA1 channel 7 interrupt */ | ||
62 | #define INTCHW_INTC0_DMA1C6_BITNUM 14 /* DMA1 channel 6 interrupt */ | ||
63 | #define INTCHW_INTC0_DMA1C5_BITNUM 13 /* DMA1 channel 5 interrupt */ | ||
64 | #define INTCHW_INTC0_DMA1C4_BITNUM 12 /* DMA1 channel 4 interrupt */ | ||
65 | #define INTCHW_INTC0_DMA1C3_BITNUM 11 /* DMA1 channel 3 interrupt */ | ||
66 | #define INTCHW_INTC0_DMA1C2_BITNUM 10 /* DMA1 channel 2 interrupt */ | ||
67 | #define INTCHW_INTC0_DMA1C1_BITNUM 9 /* DMA1 channel 1 interrupt */ | ||
68 | #define INTCHW_INTC0_DMA1C0_BITNUM 8 /* DMA1 channel 0 interrupt */ | ||
69 | #define INTCHW_INTC0_DMA0C7_BITNUM 7 /* DMA0 channel 7 interrupt */ | ||
70 | #define INTCHW_INTC0_DMA0C6_BITNUM 6 /* DMA0 channel 6 interrupt */ | ||
71 | #define INTCHW_INTC0_DMA0C5_BITNUM 5 /* DMA0 channel 5 interrupt */ | ||
72 | #define INTCHW_INTC0_DMA0C4_BITNUM 4 /* DMA0 channel 4 interrupt */ | ||
73 | #define INTCHW_INTC0_DMA0C3_BITNUM 3 /* DMA0 channel 3 interrupt */ | ||
74 | #define INTCHW_INTC0_DMA0C2_BITNUM 2 /* DMA0 channel 2 interrupt */ | ||
75 | #define INTCHW_INTC0_DMA0C1_BITNUM 1 /* DMA0 channel 1 interrupt */ | ||
76 | #define INTCHW_INTC0_DMA0C0_BITNUM 0 /* DMA0 channel 0 interrupt */ | ||
77 | |||
78 | #define INTCHW_INTC0_PIF (1<<INTCHW_INTC0_PIF_BITNUM) | ||
79 | #define INTCHW_INTC0_CLCD (1<<INTCHW_INTC0_CLCD_BITNUM) | ||
80 | #define INTCHW_INTC0_GE (1<<INTCHW_INTC0_GE_BITNUM) | ||
81 | #define INTCHW_INTC0_APM (1<<INTCHW_INTC0_APM_BITNUM) | ||
82 | #define INTCHW_INTC0_ESW (1<<INTCHW_INTC0_ESW_BITNUM) | ||
83 | #define INTCHW_INTC0_SPIH (1<<INTCHW_INTC0_SPIH_BITNUM) | ||
84 | #define INTCHW_INTC0_TIMER3 (1<<INTCHW_INTC0_TIMER3_BITNUM) | ||
85 | #define INTCHW_INTC0_TIMER2 (1<<INTCHW_INTC0_TIMER2_BITNUM) | ||
86 | #define INTCHW_INTC0_TIMER1 (1<<INTCHW_INTC0_TIMER1_BITNUM) | ||
87 | #define INTCHW_INTC0_TIMER0 (1<<INTCHW_INTC0_TIMER0_BITNUM) | ||
88 | #define INTCHW_INTC0_SDIOH1 (1<<INTCHW_INTC0_SDIOH1_BITNUM) | ||
89 | #define INTCHW_INTC0_SDIOH0 (1<<INTCHW_INTC0_SDIOH0_BITNUM) | ||
90 | #define INTCHW_INTC0_USBD (1<<INTCHW_INTC0_USBD_BITNUM) | ||
91 | #define INTCHW_INTC0_USBH1 (1<<INTCHW_INTC0_USBH1_BITNUM) | ||
92 | #define INTCHW_INTC0_USBHD2 (1<<INTCHW_INTC0_USBHD2_BITNUM) | ||
93 | #define INTCHW_INTC0_VPM (1<<INTCHW_INTC0_VPM_BITNUM) | ||
94 | #define INTCHW_INTC0_DMA1C7 (1<<INTCHW_INTC0_DMA1C7_BITNUM) | ||
95 | #define INTCHW_INTC0_DMA1C6 (1<<INTCHW_INTC0_DMA1C6_BITNUM) | ||
96 | #define INTCHW_INTC0_DMA1C5 (1<<INTCHW_INTC0_DMA1C5_BITNUM) | ||
97 | #define INTCHW_INTC0_DMA1C4 (1<<INTCHW_INTC0_DMA1C4_BITNUM) | ||
98 | #define INTCHW_INTC0_DMA1C3 (1<<INTCHW_INTC0_DMA1C3_BITNUM) | ||
99 | #define INTCHW_INTC0_DMA1C2 (1<<INTCHW_INTC0_DMA1C2_BITNUM) | ||
100 | #define INTCHW_INTC0_DMA1C1 (1<<INTCHW_INTC0_DMA1C1_BITNUM) | ||
101 | #define INTCHW_INTC0_DMA1C0 (1<<INTCHW_INTC0_DMA1C0_BITNUM) | ||
102 | #define INTCHW_INTC0_DMA0C7 (1<<INTCHW_INTC0_DMA0C7_BITNUM) | ||
103 | #define INTCHW_INTC0_DMA0C6 (1<<INTCHW_INTC0_DMA0C6_BITNUM) | ||
104 | #define INTCHW_INTC0_DMA0C5 (1<<INTCHW_INTC0_DMA0C5_BITNUM) | ||
105 | #define INTCHW_INTC0_DMA0C4 (1<<INTCHW_INTC0_DMA0C4_BITNUM) | ||
106 | #define INTCHW_INTC0_DMA0C3 (1<<INTCHW_INTC0_DMA0C3_BITNUM) | ||
107 | #define INTCHW_INTC0_DMA0C2 (1<<INTCHW_INTC0_DMA0C2_BITNUM) | ||
108 | #define INTCHW_INTC0_DMA0C1 (1<<INTCHW_INTC0_DMA0C1_BITNUM) | ||
109 | #define INTCHW_INTC0_DMA0C0 (1<<INTCHW_INTC0_DMA0C0_BITNUM) | ||
110 | |||
111 | /* INTC1 - interrupt controller 1 */ | ||
112 | #define INTCHW_INTC1_DDRVPMP_BITNUM 27 /* DDR and VPM PLL clock phase relationship interrupt (Not for A0) */ | ||
113 | #define INTCHW_INTC1_DDRVPMT_BITNUM 26 /* DDR and VPM HW phase align timeout interrupt (Not for A0) */ | ||
114 | #define INTCHW_INTC1_DDRP_BITNUM 26 /* DDR and PLL clock phase relationship interrupt (For A0 only)) */ | ||
115 | #define INTCHW_INTC1_RTC2_BITNUM 25 /* Real time clock tamper interrupt */ | ||
116 | #define INTCHW_INTC1_VDEC_BITNUM 24 /* Hantro Video Decoder interrupt */ | ||
117 | /* Bits 13-23 are non-secure versions of the corresponding secure bits in SINTC bits 0-10. */ | ||
118 | #define INTCHW_INTC1_SPUM_BITNUM 23 /* Secure process module interrupt */ | ||
119 | #define INTCHW_INTC1_RTC1_BITNUM 22 /* Real time clock one-shot interrupt */ | ||
120 | #define INTCHW_INTC1_RTC0_BITNUM 21 /* Real time clock periodic interrupt */ | ||
121 | #define INTCHW_INTC1_RNG_BITNUM 20 /* Random number generator interrupt */ | ||
122 | #define INTCHW_INTC1_FMPU_BITNUM 19 /* Flash memory parition unit interrupt */ | ||
123 | #define INTCHW_INTC1_VMPU_BITNUM 18 /* VRAM memory partition interrupt */ | ||
124 | #define INTCHW_INTC1_DMPU_BITNUM 17 /* DDR2 memory partition interrupt */ | ||
125 | #define INTCHW_INTC1_KEYC_BITNUM 16 /* Key pad controller interrupt */ | ||
126 | #define INTCHW_INTC1_TSC_BITNUM 15 /* Touch screen controller interrupt */ | ||
127 | #define INTCHW_INTC1_UART0_BITNUM 14 /* UART 0 */ | ||
128 | #define INTCHW_INTC1_WDOG_BITNUM 13 /* Watchdog timer interrupt */ | ||
129 | |||
130 | #define INTCHW_INTC1_UART1_BITNUM 12 /* UART 1 */ | ||
131 | #define INTCHW_INTC1_PMUIRQ_BITNUM 11 /* ARM performance monitor interrupt */ | ||
132 | #define INTCHW_INTC1_COMMRX_BITNUM 10 /* ARM DDC receive interrupt */ | ||
133 | #define INTCHW_INTC1_COMMTX_BITNUM 9 /* ARM DDC transmit interrupt */ | ||
134 | #define INTCHW_INTC1_FLASHC_BITNUM 8 /* Flash controller interrupt */ | ||
135 | #define INTCHW_INTC1_GPHY_BITNUM 7 /* Gigabit Phy interrupt */ | ||
136 | #define INTCHW_INTC1_SPIS_BITNUM 6 /* SPI slave interrupt */ | ||
137 | #define INTCHW_INTC1_I2CS_BITNUM 5 /* I2C slave interrupt */ | ||
138 | #define INTCHW_INTC1_I2CH_BITNUM 4 /* I2C host interrupt */ | ||
139 | #define INTCHW_INTC1_I2S1_BITNUM 3 /* I2S1 interrupt */ | ||
140 | #define INTCHW_INTC1_I2S0_BITNUM 2 /* I2S0 interrupt */ | ||
141 | #define INTCHW_INTC1_GPIO1_BITNUM 1 /* GPIO bit 64//32 combined interrupt */ | ||
142 | #define INTCHW_INTC1_GPIO0_BITNUM 0 /* GPIO bit 31//0 combined interrupt */ | ||
143 | |||
144 | #define INTCHW_INTC1_DDRVPMT (1<<INTCHW_INTC1_DDRVPMT_BITNUM) | ||
145 | #define INTCHW_INTC1_DDRVPMP (1<<INTCHW_INTC1_DDRVPMP_BITNUM) | ||
146 | #define INTCHW_INTC1_DDRP (1<<INTCHW_INTC1_DDRP_BITNUM) | ||
147 | #define INTCHW_INTC1_VDEC (1<<INTCHW_INTC1_VDEC_BITNUM) | ||
148 | #define INTCHW_INTC1_SPUM (1<<INTCHW_INTC1_SPUM_BITNUM) | ||
149 | #define INTCHW_INTC1_RTC2 (1<<INTCHW_INTC1_RTC2_BITNUM) | ||
150 | #define INTCHW_INTC1_RTC1 (1<<INTCHW_INTC1_RTC1_BITNUM) | ||
151 | #define INTCHW_INTC1_RTC0 (1<<INTCHW_INTC1_RTC0_BITNUM) | ||
152 | #define INTCHW_INTC1_RNG (1<<INTCHW_INTC1_RNG_BITNUM) | ||
153 | #define INTCHW_INTC1_FMPU (1<<INTCHW_INTC1_FMPU_BITNUM) | ||
154 | #define INTCHW_INTC1_IMPU (1<<INTCHW_INTC1_IMPU_BITNUM) | ||
155 | #define INTCHW_INTC1_DMPU (1<<INTCHW_INTC1_DMPU_BITNUM) | ||
156 | #define INTCHW_INTC1_KEYC (1<<INTCHW_INTC1_KEYC_BITNUM) | ||
157 | #define INTCHW_INTC1_TSC (1<<INTCHW_INTC1_TSC_BITNUM) | ||
158 | #define INTCHW_INTC1_UART0 (1<<INTCHW_INTC1_UART0_BITNUM) | ||
159 | #define INTCHW_INTC1_WDOG (1<<INTCHW_INTC1_WDOG_BITNUM) | ||
160 | #define INTCHW_INTC1_UART1 (1<<INTCHW_INTC1_UART1_BITNUM) | ||
161 | #define INTCHW_INTC1_PMUIRQ (1<<INTCHW_INTC1_PMUIRQ_BITNUM) | ||
162 | #define INTCHW_INTC1_COMMRX (1<<INTCHW_INTC1_COMMRX_BITNUM) | ||
163 | #define INTCHW_INTC1_COMMTX (1<<INTCHW_INTC1_COMMTX_BITNUM) | ||
164 | #define INTCHW_INTC1_FLASHC (1<<INTCHW_INTC1_FLASHC_BITNUM) | ||
165 | #define INTCHW_INTC1_GPHY (1<<INTCHW_INTC1_GPHY_BITNUM) | ||
166 | #define INTCHW_INTC1_SPIS (1<<INTCHW_INTC1_SPIS_BITNUM) | ||
167 | #define INTCHW_INTC1_I2CS (1<<INTCHW_INTC1_I2CS_BITNUM) | ||
168 | #define INTCHW_INTC1_I2CH (1<<INTCHW_INTC1_I2CH_BITNUM) | ||
169 | #define INTCHW_INTC1_I2S1 (1<<INTCHW_INTC1_I2S1_BITNUM) | ||
170 | #define INTCHW_INTC1_I2S0 (1<<INTCHW_INTC1_I2S0_BITNUM) | ||
171 | #define INTCHW_INTC1_GPIO1 (1<<INTCHW_INTC1_GPIO1_BITNUM) | ||
172 | #define INTCHW_INTC1_GPIO0 (1<<INTCHW_INTC1_GPIO0_BITNUM) | ||
173 | |||
174 | /* SINTC secure int controller */ | ||
175 | #define INTCHW_SINTC_RTC2_BITNUM 15 /* Real time clock tamper interrupt */ | ||
176 | #define INTCHW_SINTC_TIMER3_BITNUM 14 /* Secure timer3 interrupt */ | ||
177 | #define INTCHW_SINTC_TIMER2_BITNUM 13 /* Secure timer2 interrupt */ | ||
178 | #define INTCHW_SINTC_TIMER1_BITNUM 12 /* Secure timer1 interrupt */ | ||
179 | #define INTCHW_SINTC_TIMER0_BITNUM 11 /* Secure timer0 interrupt */ | ||
180 | #define INTCHW_SINTC_SPUM_BITNUM 10 /* Secure process module interrupt */ | ||
181 | #define INTCHW_SINTC_RTC1_BITNUM 9 /* Real time clock one-shot interrupt */ | ||
182 | #define INTCHW_SINTC_RTC0_BITNUM 8 /* Real time clock periodic interrupt */ | ||
183 | #define INTCHW_SINTC_RNG_BITNUM 7 /* Random number generator interrupt */ | ||
184 | #define INTCHW_SINTC_FMPU_BITNUM 6 /* Flash memory parition unit interrupt */ | ||
185 | #define INTCHW_SINTC_VMPU_BITNUM 5 /* VRAM memory partition interrupt */ | ||
186 | #define INTCHW_SINTC_DMPU_BITNUM 4 /* DDR2 memory partition interrupt */ | ||
187 | #define INTCHW_SINTC_KEYC_BITNUM 3 /* Key pad controller interrupt */ | ||
188 | #define INTCHW_SINTC_TSC_BITNUM 2 /* Touch screen controller interrupt */ | ||
189 | #define INTCHW_SINTC_UART0_BITNUM 1 /* UART0 interrupt */ | ||
190 | #define INTCHW_SINTC_WDOG_BITNUM 0 /* Watchdog timer interrupt */ | ||
191 | |||
192 | #define INTCHW_SINTC_TIMER3 (1<<INTCHW_SINTC_TIMER3_BITNUM) | ||
193 | #define INTCHW_SINTC_TIMER2 (1<<INTCHW_SINTC_TIMER2_BITNUM) | ||
194 | #define INTCHW_SINTC_TIMER1 (1<<INTCHW_SINTC_TIMER1_BITNUM) | ||
195 | #define INTCHW_SINTC_TIMER0 (1<<INTCHW_SINTC_TIMER0_BITNUM) | ||
196 | #define INTCHW_SINTC_SPUM (1<<INTCHW_SINTC_SPUM_BITNUM) | ||
197 | #define INTCHW_SINTC_RTC2 (1<<INTCHW_SINTC_RTC2_BITNUM) | ||
198 | #define INTCHW_SINTC_RTC1 (1<<INTCHW_SINTC_RTC1_BITNUM) | ||
199 | #define INTCHW_SINTC_RTC0 (1<<INTCHW_SINTC_RTC0_BITNUM) | ||
200 | #define INTCHW_SINTC_RNG (1<<INTCHW_SINTC_RNG_BITNUM) | ||
201 | #define INTCHW_SINTC_FMPU (1<<INTCHW_SINTC_FMPU_BITNUM) | ||
202 | #define INTCHW_SINTC_IMPU (1<<INTCHW_SINTC_IMPU_BITNUM) | ||
203 | #define INTCHW_SINTC_DMPU (1<<INTCHW_SINTC_DMPU_BITNUM) | ||
204 | #define INTCHW_SINTC_KEYC (1<<INTCHW_SINTC_KEYC_BITNUM) | ||
205 | #define INTCHW_SINTC_TSC (1<<INTCHW_SINTC_TSC_BITNUM) | ||
206 | #define INTCHW_SINTC_UART0 (1<<INTCHW_SINTC_UART0_BITNUM) | ||
207 | #define INTCHW_SINTC_WDOG (1<<INTCHW_SINTC_WDOG_BITNUM) | ||
208 | |||
209 | /* PL192 Vectored Interrupt Controller (VIC) layout */ | ||
210 | #define INTCHW_IRQSTATUS 0x00 /* IRQ status register */ | ||
211 | #define INTCHW_FIQSTATUS 0x04 /* FIQ status register */ | ||
212 | #define INTCHW_RAWINTR 0x08 /* Raw Interrupt Status register */ | ||
213 | #define INTCHW_INTSELECT 0x0c /* Interrupt Select Register */ | ||
214 | #define INTCHW_INTENABLE 0x10 /* Interrupt Enable Register */ | ||
215 | #define INTCHW_INTENCLEAR 0x14 /* Interrupt Enable Clear Register */ | ||
216 | #define INTCHW_SOFTINT 0x18 /* Soft Interrupt Register */ | ||
217 | #define INTCHW_SOFTINTCLEAR 0x1c /* Soft Interrupt Clear Register */ | ||
218 | #define INTCHW_PROTECTION 0x20 /* Protection Enable Register */ | ||
219 | #define INTCHW_SWPRIOMASK 0x24 /* Software Priority Mask Register */ | ||
220 | #define INTCHW_PRIODAISY 0x28 /* Priority Daisy Chain Register */ | ||
221 | #define INTCHW_VECTADDR0 0x100 /* Vector Address Registers */ | ||
222 | #define INTCHW_VECTPRIO0 0x200 /* Vector Priority Registers 0-31 */ | ||
223 | #define INTCHW_ADDRESS 0xf00 /* Vector Address Register 0-31 */ | ||
224 | #define INTCHW_PID 0xfe0 /* Peripheral ID Register 0-3 */ | ||
225 | #define INTCHW_PCELLID 0xff0 /* PrimeCell ID Register 0-3 */ | ||
226 | |||
227 | /* Example Usage: intcHw_irq_enable(INTCHW_INTC0, INTCHW_INTC0_TIMER0); */ | ||
228 | /* intcHw_irq_clear(INTCHW_INTC0, INTCHW_INTC0_TIMER0); */ | ||
229 | /* uint32_t bits = intcHw_irq_status(INTCHW_INTC0); */ | ||
230 | /* uint32_t bits = intcHw_irq_raw_status(INTCHW_INTC0); */ | ||
231 | |||
232 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
233 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
234 | /* Clear one or more IRQ interrupts. */ | ||
235 | static inline void intcHw_irq_disable(void __iomem *basep, uint32_t mask) | ||
236 | { | ||
237 | writel(mask, basep + INTCHW_INTENCLEAR); | ||
238 | } | ||
239 | |||
240 | /* Enables one or more IRQ interrupts. */ | ||
241 | static inline void intcHw_irq_enable(void __iomem *basep, uint32_t mask) | ||
242 | { | ||
243 | writel(mask, basep + INTCHW_INTENABLE); | ||
244 | } | ||
245 | |||
246 | #endif /* _INTCHW_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/mm_addr.h b/arch/arm/mach-bcmring/include/mach/csp/mm_addr.h deleted file mode 100644 index d571962f2904..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/mm_addr.h +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file mm_addr.h | ||
18 | * | ||
19 | * @brief Memory Map address definitions | ||
20 | * | ||
21 | * @note | ||
22 | * None | ||
23 | */ | ||
24 | /****************************************************************************/ | ||
25 | |||
26 | #ifndef _MM_ADDR_H | ||
27 | #define _MM_ADDR_H | ||
28 | |||
29 | /* ---- Include Files ---------------------------------------------------- */ | ||
30 | |||
31 | #if !defined(CSP_SIMULATION) | ||
32 | #include <mach/cfg_global.h> | ||
33 | #endif | ||
34 | |||
35 | /* ---- Public Constants and Types --------------------------------------- */ | ||
36 | |||
37 | /* Memory Map address definitions */ | ||
38 | |||
39 | #define MM_ADDR_DDR 0x00000000 | ||
40 | |||
41 | #define MM_ADDR_IO_VPM_EXTMEM_RSVD 0x0F000000 /* 16 MB - Reserved external memory for VPM use */ | ||
42 | |||
43 | #define MM_ADDR_IO_FLASHC 0x20000000 | ||
44 | #define MM_ADDR_IO_BROM 0x30000000 | ||
45 | #define MM_ADDR_IO_ARAM 0x30100000 /* 64 KB - extra cycle latency - WS switch */ | ||
46 | #define MM_ADDR_IO_DMA0 0x30200000 | ||
47 | #define MM_ADDR_IO_DMA1 0x30300000 | ||
48 | #define MM_ADDR_IO_ESW 0x30400000 | ||
49 | #define MM_ADDR_IO_CLCD 0x30500000 | ||
50 | #define MM_ADDR_IO_PIF 0x30580000 | ||
51 | #define MM_ADDR_IO_APM 0x30600000 | ||
52 | #define MM_ADDR_IO_SPUM 0x30700000 | ||
53 | #define MM_ADDR_IO_VPM_PROG 0x30800000 | ||
54 | #define MM_ADDR_IO_VPM_DATA 0x30A00000 | ||
55 | #define MM_ADDR_IO_VRAM 0x40000000 /* 64 KB - security block in front of it */ | ||
56 | #define MM_ADDR_IO_CHIPC 0x80000000 | ||
57 | #define MM_ADDR_IO_UMI 0x80001000 | ||
58 | #define MM_ADDR_IO_NAND 0x80001800 | ||
59 | #define MM_ADDR_IO_LEDM 0x80002000 | ||
60 | #define MM_ADDR_IO_PWM 0x80002040 | ||
61 | #define MM_ADDR_IO_VINTC 0x80003000 | ||
62 | #define MM_ADDR_IO_GPIO0 0x80004000 | ||
63 | #define MM_ADDR_IO_GPIO1 0x80004800 | ||
64 | #define MM_ADDR_IO_I2CS 0x80005000 | ||
65 | #define MM_ADDR_IO_SPIS 0x80006000 | ||
66 | #define MM_ADDR_IO_HPM 0x80007400 | ||
67 | #define MM_ADDR_IO_HPM_REMAP 0x80007800 | ||
68 | #define MM_ADDR_IO_TZPC 0x80008000 | ||
69 | #define MM_ADDR_IO_MPU 0x80009000 | ||
70 | #define MM_ADDR_IO_SPUMP 0x8000a000 | ||
71 | #define MM_ADDR_IO_PKA 0x8000b000 | ||
72 | #define MM_ADDR_IO_RNG 0x8000c000 | ||
73 | #define MM_ADDR_IO_KEYC 0x8000d000 | ||
74 | #define MM_ADDR_IO_BBL 0x8000e000 | ||
75 | #define MM_ADDR_IO_OTP 0x8000f000 | ||
76 | #define MM_ADDR_IO_I2S0 0x80010000 | ||
77 | #define MM_ADDR_IO_I2S1 0x80011000 | ||
78 | #define MM_ADDR_IO_UARTA 0x80012000 | ||
79 | #define MM_ADDR_IO_UARTB 0x80013000 | ||
80 | #define MM_ADDR_IO_I2CH 0x80014020 | ||
81 | #define MM_ADDR_IO_SPIH 0x80015000 | ||
82 | #define MM_ADDR_IO_TSC 0x80016000 | ||
83 | #define MM_ADDR_IO_TMR 0x80017000 | ||
84 | #define MM_ADDR_IO_WATCHDOG 0x80017800 | ||
85 | #define MM_ADDR_IO_ETM 0x80018000 | ||
86 | #define MM_ADDR_IO_DDRC 0x80019000 | ||
87 | #define MM_ADDR_IO_SINTC 0x80100000 | ||
88 | #define MM_ADDR_IO_INTC0 0x80200000 | ||
89 | #define MM_ADDR_IO_INTC1 0x80201000 | ||
90 | #define MM_ADDR_IO_GE 0x80300000 | ||
91 | #define MM_ADDR_IO_USB_CTLR0 0x80400000 | ||
92 | #define MM_ADDR_IO_USB_CTLR1 0x80410000 | ||
93 | #define MM_ADDR_IO_USB_PHY 0x80420000 | ||
94 | #define MM_ADDR_IO_SDIOH0 0x80500000 | ||
95 | #define MM_ADDR_IO_SDIOH1 0x80600000 | ||
96 | #define MM_ADDR_IO_VDEC 0x80700000 | ||
97 | |||
98 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
99 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
100 | |||
101 | #endif /* _MM_ADDR_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/mm_io.h b/arch/arm/mach-bcmring/include/mach/csp/mm_io.h deleted file mode 100644 index 47450c23685a..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/mm_io.h +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file mm_io.h | ||
18 | * | ||
19 | * @brief Memory Map I/O definitions | ||
20 | * | ||
21 | * @note | ||
22 | * None | ||
23 | */ | ||
24 | /****************************************************************************/ | ||
25 | |||
26 | #ifndef _MM_IO_H | ||
27 | #define _MM_IO_H | ||
28 | |||
29 | /* ---- Include Files ---------------------------------------------------- */ | ||
30 | #include <mach/csp/mm_addr.h> | ||
31 | |||
32 | #if !defined(CSP_SIMULATION) | ||
33 | #include <mach/cfg_global.h> | ||
34 | #endif | ||
35 | |||
36 | /* ---- Public Constants and Types --------------------------------------- */ | ||
37 | |||
38 | #if defined(CONFIG_MMU) | ||
39 | |||
40 | /* This macro is referenced in <mach/io.h> | ||
41 | * Phys to Virtual 0xNyxxxxxx => 0xFNxxxxxx | ||
42 | * This macro is referenced in <asm/arch/io.h> | ||
43 | * | ||
44 | * Assume VPM address is the last x MB of memory. For VPM, map to | ||
45 | * 0xf0000000 and up. | ||
46 | */ | ||
47 | |||
48 | #ifndef MM_IO_PHYS_TO_VIRT | ||
49 | #ifdef __ASSEMBLY__ | ||
50 | #define MM_IO_PHYS_TO_VIRT(phys) (0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF)) | ||
51 | #else | ||
52 | #define MM_IO_PHYS_TO_VIRT(phys) (void __iomem *)(((phys) == MM_ADDR_IO_VPM_EXTMEM_RSVD) ? 0xF0000000 : \ | ||
53 | (0xF0000000 | (((phys) >> 4) & 0x0F000000) | ((phys) & 0xFFFFFF))) | ||
54 | #endif | ||
55 | #endif | ||
56 | |||
57 | /* Virtual to Physical 0xFNxxxxxx => 0xN0xxxxxx */ | ||
58 | |||
59 | #ifndef MM_IO_VIRT_TO_PHYS | ||
60 | #ifdef __ASSEMBLY__ | ||
61 | #define MM_IO_VIRT_TO_PHYS(virt) ((((virt) & 0x0F000000) << 4) | ((virt) & 0xFFFFFF)) | ||
62 | #else | ||
63 | #define MM_IO_VIRT_TO_PHYS(virt) (((unsigned long)(virt) == 0xF0000000) ? MM_ADDR_IO_VPM_EXTMEM_RSVD : \ | ||
64 | ((((unsigned long)(virt) & 0x0F000000) << 4) | ((unsigned long)(virt) & 0xFFFFFF))) | ||
65 | #endif | ||
66 | #endif | ||
67 | |||
68 | #else | ||
69 | |||
70 | #ifndef MM_IO_PHYS_TO_VIRT | ||
71 | #define MM_IO_PHYS_TO_VIRT(phys) (phys) | ||
72 | #endif | ||
73 | |||
74 | #ifndef MM_IO_VIRT_TO_PHYS | ||
75 | #define MM_IO_VIRT_TO_PHYS(virt) (virt) | ||
76 | #endif | ||
77 | |||
78 | #endif | ||
79 | |||
80 | /* Registers in 0xExxxxxxx that should be moved to 0xFxxxxxxx */ | ||
81 | #define MM_IO_BASE_FLASHC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_FLASHC) | ||
82 | #define MM_IO_BASE_NAND MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_NAND) | ||
83 | #define MM_IO_BASE_UMI MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_UMI) | ||
84 | |||
85 | #define MM_IO_START MM_ADDR_IO_FLASHC /* Physical beginning of IO mapped memory */ | ||
86 | #define MM_IO_BASE MM_IO_BASE_FLASHC /* Virtual beginning of IO mapped memory */ | ||
87 | |||
88 | #define MM_IO_BASE_BROM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_BROM) | ||
89 | #define MM_IO_BASE_ARAM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_ARAM) | ||
90 | #define MM_IO_BASE_DMA0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_DMA0) | ||
91 | #define MM_IO_BASE_DMA1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_DMA1) | ||
92 | #define MM_IO_BASE_ESW MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_ESW) | ||
93 | #define MM_IO_BASE_CLCD MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_CLCD) | ||
94 | #define MM_IO_BASE_PIF MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_PIF) | ||
95 | #define MM_IO_BASE_APM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_APM) | ||
96 | #define MM_IO_BASE_SPUM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SPUM) | ||
97 | #define MM_IO_BASE_VPM_PROG MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VPM_PROG) | ||
98 | #define MM_IO_BASE_VPM_DATA MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VPM_DATA) | ||
99 | |||
100 | #define MM_IO_BASE_VRAM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VRAM) | ||
101 | |||
102 | #define MM_IO_BASE_CHIPC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_CHIPC) | ||
103 | #define MM_IO_BASE_DDRC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_DDRC) | ||
104 | #define MM_IO_BASE_LEDM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_LEDM) | ||
105 | #define MM_IO_BASE_PWM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_PWM) | ||
106 | #define MM_IO_BASE_VINTC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VINTC) | ||
107 | #define MM_IO_BASE_GPIO0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_GPIO0) | ||
108 | #define MM_IO_BASE_GPIO1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_GPIO1) | ||
109 | #define MM_IO_BASE_TMR MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_TMR) | ||
110 | #define MM_IO_BASE_WATCHDOG MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_WATCHDOG) | ||
111 | #define MM_IO_BASE_ETM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_ETM) | ||
112 | #define MM_IO_BASE_HPM MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_HPM) | ||
113 | #define MM_IO_BASE_HPM_REMAP MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_HPM_REMAP) | ||
114 | #define MM_IO_BASE_TZPC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_TZPC) | ||
115 | #define MM_IO_BASE_MPU MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_MPU) | ||
116 | #define MM_IO_BASE_SPUMP MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SPUMP) | ||
117 | #define MM_IO_BASE_PKA MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_PKA) | ||
118 | #define MM_IO_BASE_RNG MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_RNG) | ||
119 | #define MM_IO_BASE_KEYC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_KEYC) | ||
120 | #define MM_IO_BASE_BBL MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_BBL) | ||
121 | #define MM_IO_BASE_OTP MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_OTP) | ||
122 | #define MM_IO_BASE_I2S0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_I2S0) | ||
123 | #define MM_IO_BASE_I2S1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_I2S1) | ||
124 | #define MM_IO_BASE_UARTA MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_UARTA) | ||
125 | #define MM_IO_BASE_UARTB MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_UARTB) | ||
126 | #define MM_IO_BASE_I2CH MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_I2CH) | ||
127 | #define MM_IO_BASE_SPIH MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SPIH) | ||
128 | #define MM_IO_BASE_TSC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_TSC) | ||
129 | #define MM_IO_BASE_I2CS MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_I2CS) | ||
130 | #define MM_IO_BASE_SPIS MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SPIS) | ||
131 | #define MM_IO_BASE_SINTC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SINTC) | ||
132 | #define MM_IO_BASE_INTC0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_INTC0) | ||
133 | #define MM_IO_BASE_INTC1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_INTC1) | ||
134 | #define MM_IO_BASE_GE MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_GE) | ||
135 | #define MM_IO_BASE_USB_CTLR0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_USB_CTLR0) | ||
136 | #define MM_IO_BASE_USB_CTLR1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_USB_CTLR1) | ||
137 | #define MM_IO_BASE_USB_PHY MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_USB_PHY) | ||
138 | #define MM_IO_BASE_SDIOH0 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SDIOH0) | ||
139 | #define MM_IO_BASE_SDIOH1 MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_SDIOH1) | ||
140 | #define MM_IO_BASE_VDEC MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VDEC) | ||
141 | |||
142 | #define MM_IO_BASE_VPM_EXTMEM_RSVD MM_IO_PHYS_TO_VIRT(MM_ADDR_IO_VPM_EXTMEM_RSVD) | ||
143 | |||
144 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
145 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
146 | |||
147 | #endif /* _MM_IO_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/reg.h b/arch/arm/mach-bcmring/include/mach/csp/reg.h deleted file mode 100644 index d9cbdca8cd25..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/reg.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file reg.h | ||
18 | * | ||
19 | * @brief Generic register definitions used in CSP | ||
20 | */ | ||
21 | /****************************************************************************/ | ||
22 | |||
23 | #ifndef CSP_REG_H | ||
24 | #define CSP_REG_H | ||
25 | |||
26 | /* ---- Include Files ---------------------------------------------------- */ | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | /* ---- Public Constants and Types --------------------------------------- */ | ||
32 | |||
33 | #define __REG32(x) (*((volatile uint32_t __iomem *)(x))) | ||
34 | #define __REG16(x) (*((volatile uint16_t __iomem *)(x))) | ||
35 | #define __REG8(x) (*((volatile uint8_t __iomem *) (x))) | ||
36 | |||
37 | /* Macros used to define a sequence of reserved registers. The start / end */ | ||
38 | /* are byte offsets in the particular register definition, with the "end" */ | ||
39 | /* being the offset of the next un-reserved register. E.g. if offsets */ | ||
40 | /* 0x10 through to 0x1f are reserved, then this reserved area could be */ | ||
41 | /* specified as follows. */ | ||
42 | /* typedef struct */ | ||
43 | /* { */ | ||
44 | /* uint32_t reg1; offset 0x00 */ | ||
45 | /* uint32_t reg2; offset 0x04 */ | ||
46 | /* uint32_t reg3; offset 0x08 */ | ||
47 | /* uint32_t reg4; offset 0x0c */ | ||
48 | /* REG32_RSVD(0x10, 0x20); */ | ||
49 | /* uint32_t reg5; offset 0x20 */ | ||
50 | /* ... */ | ||
51 | /* } EXAMPLE_REG_t; */ | ||
52 | #define REG8_RSVD(start, end) uint8_t rsvd_##start[(end - start) / sizeof(uint8_t)] | ||
53 | #define REG16_RSVD(start, end) uint16_t rsvd_##start[(end - start) / sizeof(uint16_t)] | ||
54 | #define REG32_RSVD(start, end) uint32_t rsvd_##start[(end - start) / sizeof(uint32_t)] | ||
55 | |||
56 | /* ---- Public Variable Externs ------------------------------------------ */ | ||
57 | /* ---- Public Function Prototypes --------------------------------------- */ | ||
58 | |||
59 | /* Note: When protecting multiple statements, the REG_LOCAL_IRQ_SAVE and */ | ||
60 | /* REG_LOCAL_IRQ_RESTORE must be enclosed in { } to allow the */ | ||
61 | /* flags variable to be declared locally. */ | ||
62 | /* e.g. */ | ||
63 | /* statement1; */ | ||
64 | /* { */ | ||
65 | /* REG_LOCAL_IRQ_SAVE; */ | ||
66 | /* <multiple statements here> */ | ||
67 | /* REG_LOCAL_IRQ_RESTORE; */ | ||
68 | /* } */ | ||
69 | /* statement2; */ | ||
70 | /* */ | ||
71 | |||
72 | #if defined(__KERNEL__) && !defined(STANDALONE) | ||
73 | #include <mach/hardware.h> | ||
74 | #include <linux/interrupt.h> | ||
75 | |||
76 | #define REG_LOCAL_IRQ_SAVE HW_DECLARE_SPINLOCK(reg32) \ | ||
77 | unsigned long flags; HW_IRQ_SAVE(reg32, flags) | ||
78 | |||
79 | #define REG_LOCAL_IRQ_RESTORE HW_IRQ_RESTORE(reg32, flags) | ||
80 | |||
81 | #else | ||
82 | |||
83 | #define REG_LOCAL_IRQ_SAVE | ||
84 | #define REG_LOCAL_IRQ_RESTORE | ||
85 | |||
86 | #endif | ||
87 | |||
88 | static inline void reg32_modify_and(volatile uint32_t __iomem *reg, uint32_t value) | ||
89 | { | ||
90 | REG_LOCAL_IRQ_SAVE; | ||
91 | __raw_writel(__raw_readl(reg) & value, reg); | ||
92 | REG_LOCAL_IRQ_RESTORE; | ||
93 | } | ||
94 | |||
95 | static inline void reg32_modify_or(volatile uint32_t __iomem *reg, uint32_t value) | ||
96 | { | ||
97 | REG_LOCAL_IRQ_SAVE; | ||
98 | __raw_writel(__raw_readl(reg) | value, reg); | ||
99 | REG_LOCAL_IRQ_RESTORE; | ||
100 | } | ||
101 | |||
102 | static inline void reg32_modify_mask(volatile uint32_t __iomem *reg, uint32_t mask, | ||
103 | uint32_t value) | ||
104 | { | ||
105 | REG_LOCAL_IRQ_SAVE; | ||
106 | __raw_writel((__raw_readl(reg) & mask) | value, reg); | ||
107 | REG_LOCAL_IRQ_RESTORE; | ||
108 | } | ||
109 | |||
110 | static inline void reg32_write(volatile uint32_t __iomem *reg, uint32_t value) | ||
111 | { | ||
112 | __raw_writel(value, reg); | ||
113 | } | ||
114 | |||
115 | #endif /* CSP_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/secHw_def.h b/arch/arm/mach-bcmring/include/mach/csp/secHw_def.h deleted file mode 100644 index d15f5f3ec2d8..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/secHw_def.h +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file secHw_def.h | ||
18 | * | ||
19 | * @brief Definitions for configuring/testing secure blocks | ||
20 | * | ||
21 | * @note | ||
22 | * None | ||
23 | */ | ||
24 | /****************************************************************************/ | ||
25 | |||
26 | #ifndef SECHW_DEF_H | ||
27 | #define SECHW_DEF_H | ||
28 | |||
29 | #include <mach/csp/mm_io.h> | ||
30 | |||
31 | /* Bit mask for various secure device */ | ||
32 | #define secHw_BLK_MASK_CHIP_CONTROL 0x00000001 | ||
33 | #define secHw_BLK_MASK_KEY_SCAN 0x00000002 | ||
34 | #define secHw_BLK_MASK_TOUCH_SCREEN 0x00000004 | ||
35 | #define secHw_BLK_MASK_UART0 0x00000008 | ||
36 | #define secHw_BLK_MASK_UART1 0x00000010 | ||
37 | #define secHw_BLK_MASK_WATCHDOG 0x00000020 | ||
38 | #define secHw_BLK_MASK_SPUM 0x00000040 | ||
39 | #define secHw_BLK_MASK_DDR2 0x00000080 | ||
40 | #define secHw_BLK_MASK_EXT_MEM 0x00000100 | ||
41 | #define secHw_BLK_MASK_ESW 0x00000200 | ||
42 | #define secHw_BLK_MASK_SPU 0x00010000 | ||
43 | #define secHw_BLK_MASK_PKA 0x00020000 | ||
44 | #define secHw_BLK_MASK_RNG 0x00040000 | ||
45 | #define secHw_BLK_MASK_RTC 0x00080000 | ||
46 | #define secHw_BLK_MASK_OTP 0x00100000 | ||
47 | #define secHw_BLK_MASK_BOOT 0x00200000 | ||
48 | #define secHw_BLK_MASK_MPU 0x00400000 | ||
49 | #define secHw_BLK_MASK_TZCTRL 0x00800000 | ||
50 | #define secHw_BLK_MASK_INTR 0x01000000 | ||
51 | |||
52 | /* Trustzone register set */ | ||
53 | typedef struct { | ||
54 | volatile uint32_t status; /* read only - reflects status of writes of 2 write registers */ | ||
55 | volatile uint32_t setUnsecure; /* write only. reads back as 0 */ | ||
56 | volatile uint32_t setSecure; /* write only. reads back as 0 */ | ||
57 | } secHw_TZREG_t; | ||
58 | |||
59 | /* There are 2 register sets. The first is for the lower 16 bits, the 2nd */ | ||
60 | /* is for the higher 16 bits. */ | ||
61 | |||
62 | typedef enum { | ||
63 | secHw_IDX_LS = 0, | ||
64 | secHw_IDX_MS = 1, | ||
65 | secHw_IDX_NUM | ||
66 | } secHw_IDX_e; | ||
67 | |||
68 | typedef struct { | ||
69 | volatile secHw_TZREG_t reg[secHw_IDX_NUM]; | ||
70 | } secHw_REGS_t; | ||
71 | |||
72 | /****************************************************************************/ | ||
73 | /** | ||
74 | * @brief Configures a device as a secure device | ||
75 | * | ||
76 | */ | ||
77 | /****************************************************************************/ | ||
78 | static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ | ||
79 | ); | ||
80 | |||
81 | /****************************************************************************/ | ||
82 | /** | ||
83 | * @brief Configures a device as a non-secure device | ||
84 | * | ||
85 | */ | ||
86 | /****************************************************************************/ | ||
87 | static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ | ||
88 | ); | ||
89 | |||
90 | /****************************************************************************/ | ||
91 | /** | ||
92 | * @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure | ||
93 | * | ||
94 | */ | ||
95 | /****************************************************************************/ | ||
96 | static inline uint32_t secHw_getStatus(void); | ||
97 | |||
98 | #include <mach/csp/secHw_inline.h> | ||
99 | |||
100 | #endif /* SECHW_DEF_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/secHw_inline.h b/arch/arm/mach-bcmring/include/mach/csp/secHw_inline.h deleted file mode 100644 index 55d3cd4fd1e7..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/secHw_inline.h +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file secHw_inline.h | ||
18 | * | ||
19 | * @brief Definitions for configuring/testing secure blocks | ||
20 | * | ||
21 | * @note | ||
22 | * None | ||
23 | */ | ||
24 | /****************************************************************************/ | ||
25 | |||
26 | #ifndef SECHW_INLINE_H | ||
27 | #define SECHW_INLINE_H | ||
28 | |||
29 | /****************************************************************************/ | ||
30 | /** | ||
31 | * @brief Configures a device as a secure device | ||
32 | * | ||
33 | */ | ||
34 | /****************************************************************************/ | ||
35 | static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ | ||
36 | ) { | ||
37 | secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC; | ||
38 | |||
39 | if (mask & 0x0000FFFF) { | ||
40 | regp->reg[secHw_IDX_LS].setSecure = mask & 0x0000FFFF; | ||
41 | } | ||
42 | |||
43 | if (mask & 0xFFFF0000) { | ||
44 | regp->reg[secHw_IDX_MS].setSecure = mask >> 16; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | /****************************************************************************/ | ||
49 | /** | ||
50 | * @brief Configures a device as a non-secure device | ||
51 | * | ||
52 | */ | ||
53 | /****************************************************************************/ | ||
54 | static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */ | ||
55 | ) { | ||
56 | secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC; | ||
57 | |||
58 | if (mask & 0x0000FFFF) { | ||
59 | writel(mask & 0x0000FFFF, ®p->reg[secHw_IDX_LS].setUnsecure); | ||
60 | } | ||
61 | if (mask & 0xFFFF0000) { | ||
62 | writel(mask >> 16, ®p->reg[secHw_IDX_MS].setUnsecure); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | /****************************************************************************/ | ||
67 | /** | ||
68 | * @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure | ||
69 | * | ||
70 | */ | ||
71 | /****************************************************************************/ | ||
72 | static inline uint32_t secHw_getStatus(void) | ||
73 | { | ||
74 | secHw_REGS_t __iomem *regp = MM_IO_BASE_TZPC; | ||
75 | |||
76 | return (regp->reg[1].status << 16) + regp->reg[0].status; | ||
77 | } | ||
78 | |||
79 | #endif /* SECHW_INLINE_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/tmrHw.h b/arch/arm/mach-bcmring/include/mach/csp/tmrHw.h deleted file mode 100644 index 1cc882ae60f5..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/tmrHw.h +++ /dev/null | |||
@@ -1,263 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file tmrHw.h | ||
18 | * | ||
19 | * @brief API definitions for low level Timer driver | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | #ifndef _TMRHW_H | ||
24 | #define _TMRHW_H | ||
25 | |||
26 | #include <linux/types.h> | ||
27 | |||
28 | typedef uint32_t tmrHw_ID_t; /* Timer ID */ | ||
29 | typedef uint32_t tmrHw_COUNT_t; /* Timer count */ | ||
30 | typedef uint32_t tmrHw_INTERVAL_t; /* Timer interval */ | ||
31 | typedef uint32_t tmrHw_RATE_t; /* Timer event (count/interrupt) rate */ | ||
32 | |||
33 | typedef enum { | ||
34 | tmrHw_INTERRUPT_STATUS_SET, /* Interrupted */ | ||
35 | tmrHw_INTERRUPT_STATUS_UNSET /* No Interrupt */ | ||
36 | } tmrHw_INTERRUPT_STATUS_e; | ||
37 | |||
38 | typedef enum { | ||
39 | tmrHw_CAPABILITY_CLOCK, /* Clock speed in HHz */ | ||
40 | tmrHw_CAPABILITY_RESOLUTION /* Timer resolution in bits */ | ||
41 | } tmrHw_CAPABILITY_e; | ||
42 | |||
43 | /****************************************************************************/ | ||
44 | /** | ||
45 | * @brief Get timer capability | ||
46 | * | ||
47 | * This function returns various capabilities/attributes of a timer | ||
48 | * | ||
49 | * @return Numeric capability | ||
50 | * | ||
51 | */ | ||
52 | /****************************************************************************/ | ||
53 | uint32_t tmrHw_getTimerCapability(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
54 | tmrHw_CAPABILITY_e capability /* [ IN ] Timer capability */ | ||
55 | ); | ||
56 | |||
57 | /****************************************************************************/ | ||
58 | /** | ||
59 | * @brief Configures a periodic timer in terms of timer interrupt rate | ||
60 | * | ||
61 | * This function initializes a periodic timer to generate specific number of | ||
62 | * timer interrupt per second | ||
63 | * | ||
64 | * @return On success: Effective timer frequency | ||
65 | * On failure: 0 | ||
66 | * | ||
67 | */ | ||
68 | /****************************************************************************/ | ||
69 | tmrHw_RATE_t tmrHw_setPeriodicTimerRate(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
70 | tmrHw_RATE_t rate /* [ IN ] Number of timer interrupt per second */ | ||
71 | ); | ||
72 | |||
73 | /****************************************************************************/ | ||
74 | /** | ||
75 | * @brief Configures a periodic timer to generate timer interrupt after | ||
76 | * certain time interval | ||
77 | * | ||
78 | * This function initializes a periodic timer to generate timer interrupt | ||
79 | * after every time interval in millisecond | ||
80 | * | ||
81 | * @return On success: Effective interval set in mili-second | ||
82 | * On failure: 0 | ||
83 | * | ||
84 | */ | ||
85 | /****************************************************************************/ | ||
86 | tmrHw_INTERVAL_t tmrHw_setPeriodicTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
87 | tmrHw_INTERVAL_t msec /* [ IN ] Interval in mili-second */ | ||
88 | ); | ||
89 | |||
90 | /****************************************************************************/ | ||
91 | /** | ||
92 | * @brief Configures a periodic timer to generate timer interrupt just once | ||
93 | * after certain time interval | ||
94 | * | ||
95 | * This function initializes a periodic timer to generate a single ticks after | ||
96 | * certain time interval in millisecond | ||
97 | * | ||
98 | * @return On success: Effective interval set in mili-second | ||
99 | * On failure: 0 | ||
100 | * | ||
101 | */ | ||
102 | /****************************************************************************/ | ||
103 | tmrHw_INTERVAL_t tmrHw_setOneshotTimerInterval(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
104 | tmrHw_INTERVAL_t msec /* [ IN ] Interval in mili-second */ | ||
105 | ); | ||
106 | |||
107 | /****************************************************************************/ | ||
108 | /** | ||
109 | * @brief Configures a timer to run as a free running timer | ||
110 | * | ||
111 | * This function initializes a timer to run as a free running timer | ||
112 | * | ||
113 | * @return Timer resolution (count / sec) | ||
114 | * | ||
115 | */ | ||
116 | /****************************************************************************/ | ||
117 | tmrHw_RATE_t tmrHw_setFreeRunningTimer(tmrHw_ID_t timerId, /* [ IN ] Timer Id */ | ||
118 | uint32_t divider /* [ IN ] Dividing the clock frequency */ | ||
119 | ) __attribute__ ((section(".aramtext"))); | ||
120 | |||
121 | /****************************************************************************/ | ||
122 | /** | ||
123 | * @brief Starts a timer | ||
124 | * | ||
125 | * This function starts a preconfigured timer | ||
126 | * | ||
127 | * @return -1 - On Failure | ||
128 | * 0 - On Success | ||
129 | */ | ||
130 | /****************************************************************************/ | ||
131 | int tmrHw_startTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
132 | ) __attribute__ ((section(".aramtext"))); | ||
133 | |||
134 | /****************************************************************************/ | ||
135 | /** | ||
136 | * @brief Stops a timer | ||
137 | * | ||
138 | * This function stops a running timer | ||
139 | * | ||
140 | * @return -1 - On Failure | ||
141 | * 0 - On Success | ||
142 | */ | ||
143 | /****************************************************************************/ | ||
144 | int tmrHw_stopTimer(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
145 | ); | ||
146 | |||
147 | /****************************************************************************/ | ||
148 | /** | ||
149 | * @brief Gets current timer count | ||
150 | * | ||
151 | * This function returns the current timer value | ||
152 | * | ||
153 | * @return Current downcounting timer value | ||
154 | * | ||
155 | */ | ||
156 | /****************************************************************************/ | ||
157 | tmrHw_COUNT_t tmrHw_GetCurrentCount(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
158 | ) __attribute__ ((section(".aramtext"))); | ||
159 | |||
160 | /****************************************************************************/ | ||
161 | /** | ||
162 | * @brief Gets timer count rate | ||
163 | * | ||
164 | * This function returns the number of counts per second | ||
165 | * | ||
166 | * @return Count rate | ||
167 | * | ||
168 | */ | ||
169 | /****************************************************************************/ | ||
170 | tmrHw_RATE_t tmrHw_getCountRate(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
171 | ) __attribute__ ((section(".aramtext"))); | ||
172 | |||
173 | /****************************************************************************/ | ||
174 | /** | ||
175 | * @brief Enables timer interrupt | ||
176 | * | ||
177 | * This function enables the timer interrupt | ||
178 | * | ||
179 | * @return N/A | ||
180 | * | ||
181 | */ | ||
182 | /****************************************************************************/ | ||
183 | void tmrHw_enableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
184 | ); | ||
185 | |||
186 | /****************************************************************************/ | ||
187 | /** | ||
188 | * @brief Disables timer interrupt | ||
189 | * | ||
190 | * This function disable the timer interrupt | ||
191 | * | ||
192 | * @return N/A | ||
193 | */ | ||
194 | /****************************************************************************/ | ||
195 | void tmrHw_disableInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
196 | ); | ||
197 | |||
198 | /****************************************************************************/ | ||
199 | /** | ||
200 | * @brief Clears the interrupt | ||
201 | * | ||
202 | * This function clears the timer interrupt | ||
203 | * | ||
204 | * @return N/A | ||
205 | * | ||
206 | * @note | ||
207 | * Must be called under the context of ISR | ||
208 | */ | ||
209 | /****************************************************************************/ | ||
210 | void tmrHw_clearInterrupt(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
211 | ); | ||
212 | |||
213 | /****************************************************************************/ | ||
214 | /** | ||
215 | * @brief Gets the interrupt status | ||
216 | * | ||
217 | * This function returns timer interrupt status | ||
218 | * | ||
219 | * @return Interrupt status | ||
220 | */ | ||
221 | /****************************************************************************/ | ||
222 | tmrHw_INTERRUPT_STATUS_e tmrHw_getInterruptStatus(tmrHw_ID_t timerId /* [ IN ] Timer id */ | ||
223 | ); | ||
224 | |||
225 | /****************************************************************************/ | ||
226 | /** | ||
227 | * @brief Indentifies a timer causing interrupt | ||
228 | * | ||
229 | * This functions returns a timer causing interrupt | ||
230 | * | ||
231 | * @return 0xFFFFFFFF : No timer causing an interrupt | ||
232 | * ! 0xFFFFFFFF : timer causing an interrupt | ||
233 | * @note | ||
234 | * tmrHw_clearIntrrupt() must be called with a valid timer id after calling this function | ||
235 | */ | ||
236 | /****************************************************************************/ | ||
237 | tmrHw_ID_t tmrHw_getInterruptSource(void); | ||
238 | |||
239 | /****************************************************************************/ | ||
240 | /** | ||
241 | * @brief Displays specific timer registers | ||
242 | * | ||
243 | * | ||
244 | * @return void | ||
245 | * | ||
246 | */ | ||
247 | /****************************************************************************/ | ||
248 | void tmrHw_printDebugInfo(tmrHw_ID_t timerId, /* [ IN ] Timer id */ | ||
249 | int (*fpPrint) (const char *, ...) /* [ IN ] Print callback function */ | ||
250 | ); | ||
251 | |||
252 | /****************************************************************************/ | ||
253 | /** | ||
254 | * @brief Use a timer to perform a busy wait delay for a number of usecs. | ||
255 | * | ||
256 | * @return N/A | ||
257 | */ | ||
258 | /****************************************************************************/ | ||
259 | void tmrHw_udelay(tmrHw_ID_t timerId, /* [ IN ] Timer id */ | ||
260 | unsigned long usecs /* [ IN ] usec to delay */ | ||
261 | ) __attribute__ ((section(".aramtext"))); | ||
262 | |||
263 | #endif /* _TMRHW_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/csp/tmrHw_reg.h b/arch/arm/mach-bcmring/include/mach/csp/tmrHw_reg.h deleted file mode 100644 index 3080ac7239a1..000000000000 --- a/arch/arm/mach-bcmring/include/mach/csp/tmrHw_reg.h +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file tmrHw_reg.h | ||
18 | * | ||
19 | * @brief Definitions for low level Timer registers | ||
20 | * | ||
21 | */ | ||
22 | /****************************************************************************/ | ||
23 | #ifndef _TMRHW_REG_H | ||
24 | #define _TMRHW_REG_H | ||
25 | |||
26 | #include <mach/csp/mm_io.h> | ||
27 | #include <mach/csp/hw_cfg.h> | ||
28 | /* Base address */ | ||
29 | #define tmrHw_MODULE_BASE_ADDR MM_IO_BASE_TMR | ||
30 | |||
31 | /* | ||
32 | This platform has four different timers running at different clock speed | ||
33 | |||
34 | Timer one (Timer ID 0) runs at 25 MHz | ||
35 | Timer two (Timer ID 1) runs at 25 MHz | ||
36 | Timer three (Timer ID 2) runs at 150 MHz | ||
37 | Timer four (Timer ID 3) runs at 150 MHz | ||
38 | */ | ||
39 | #define tmrHw_LOW_FREQUENCY_MHZ 25 /* Always 25MHz from XTAL */ | ||
40 | #define tmrHw_LOW_FREQUENCY_HZ 25000000 | ||
41 | |||
42 | #if defined(CFG_GLOBAL_CHIP) && (CFG_GLOBAL_CHIP == FPGA11107) | ||
43 | #define tmrHw_HIGH_FREQUENCY_MHZ 150 /* Always 150MHz for FPGA */ | ||
44 | #define tmrHw_HIGH_FREQUENCY_HZ 150000000 | ||
45 | #else | ||
46 | #define tmrHw_HIGH_FREQUENCY_HZ HW_CFG_BUS_CLK_HZ | ||
47 | #define tmrHw_HIGH_FREQUENCY_MHZ (HW_CFG_BUS_CLK_HZ / 1000000) | ||
48 | #endif | ||
49 | |||
50 | #define tmrHw_LOW_RESOLUTION_CLOCK tmrHw_LOW_FREQUENCY_HZ | ||
51 | #define tmrHw_HIGH_RESOLUTION_CLOCK tmrHw_HIGH_FREQUENCY_HZ | ||
52 | #define tmrHw_MAX_COUNT (0xFFFFFFFF) /* maximum number of count a timer can count */ | ||
53 | #define tmrHw_TIMER_NUM_COUNT (4) /* Number of timer module supported */ | ||
54 | |||
55 | typedef struct { | ||
56 | uint32_t LoadValue; /* Load value for timer */ | ||
57 | uint32_t CurrentValue; /* Current value for timer */ | ||
58 | uint32_t Control; /* Control register */ | ||
59 | uint32_t InterruptClear; /* Interrupt clear register */ | ||
60 | uint32_t RawInterruptStatus; /* Raw interrupt status */ | ||
61 | uint32_t InterruptStatus; /* Masked interrupt status */ | ||
62 | uint32_t BackgroundLoad; /* Background load value */ | ||
63 | uint32_t padding; /* Padding register */ | ||
64 | } tmrHw_REG_t; | ||
65 | |||
66 | /* Control bot masks */ | ||
67 | #define tmrHw_CONTROL_TIMER_ENABLE 0x00000080 | ||
68 | #define tmrHw_CONTROL_PERIODIC 0x00000040 | ||
69 | #define tmrHw_CONTROL_INTERRUPT_ENABLE 0x00000020 | ||
70 | #define tmrHw_CONTROL_PRESCALE_MASK 0x0000000C | ||
71 | #define tmrHw_CONTROL_PRESCALE_1 0x00000000 | ||
72 | #define tmrHw_CONTROL_PRESCALE_16 0x00000004 | ||
73 | #define tmrHw_CONTROL_PRESCALE_256 0x00000008 | ||
74 | #define tmrHw_CONTROL_32BIT 0x00000002 | ||
75 | #define tmrHw_CONTROL_ONESHOT 0x00000001 | ||
76 | #define tmrHw_CONTROL_FREE_RUNNING 0x00000000 | ||
77 | |||
78 | #define tmrHw_CONTROL_MODE_MASK (tmrHw_CONTROL_PERIODIC | tmrHw_CONTROL_ONESHOT) | ||
79 | |||
80 | #define pTmrHw ((volatile tmrHw_REG_t *)tmrHw_MODULE_BASE_ADDR) | ||
81 | |||
82 | #endif /* _TMRHW_REG_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/dma.h b/arch/arm/mach-bcmring/include/mach/dma.h deleted file mode 100644 index 13e01384d6fc..000000000000 --- a/arch/arm/mach-bcmring/include/mach/dma.h +++ /dev/null | |||
@@ -1,630 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /****************************************************************************/ | ||
16 | /** | ||
17 | * @file dma.h | ||
18 | * | ||
19 | * @brief API definitions for the linux DMA interface. | ||
20 | */ | ||
21 | /****************************************************************************/ | ||
22 | |||
23 | #if !defined(ASM_ARM_ARCH_BCMRING_DMA_H) | ||
24 | #define ASM_ARM_ARCH_BCMRING_DMA_H | ||
25 | |||
26 | /* ---- Include Files ---------------------------------------------------- */ | ||
27 | |||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/semaphore.h> | ||
30 | #include <mach/csp/dmacHw.h> | ||
31 | #include <mach/timer.h> | ||
32 | |||
33 | /* ---- Constants and Types ---------------------------------------------- */ | ||
34 | |||
35 | /* If DMA_DEBUG_TRACK_RESERVATION is set to a non-zero value, then the filename */ | ||
36 | /* and line number of the reservation request will be recorded in the channel table */ | ||
37 | |||
38 | #define DMA_DEBUG_TRACK_RESERVATION 1 | ||
39 | |||
40 | #define DMA_NUM_CONTROLLERS 2 | ||
41 | #define DMA_NUM_CHANNELS 8 /* per controller */ | ||
42 | |||
43 | typedef enum { | ||
44 | DMA_DEVICE_MEM_TO_MEM, /* For memory to memory transfers */ | ||
45 | DMA_DEVICE_I2S0_DEV_TO_MEM, | ||
46 | DMA_DEVICE_I2S0_MEM_TO_DEV, | ||
47 | DMA_DEVICE_I2S1_DEV_TO_MEM, | ||
48 | DMA_DEVICE_I2S1_MEM_TO_DEV, | ||
49 | DMA_DEVICE_APM_CODEC_A_DEV_TO_MEM, | ||
50 | DMA_DEVICE_APM_CODEC_A_MEM_TO_DEV, | ||
51 | DMA_DEVICE_APM_CODEC_B_DEV_TO_MEM, | ||
52 | DMA_DEVICE_APM_CODEC_B_MEM_TO_DEV, | ||
53 | DMA_DEVICE_APM_CODEC_C_DEV_TO_MEM, /* Additional mic input for beam-forming */ | ||
54 | DMA_DEVICE_APM_PCM0_DEV_TO_MEM, | ||
55 | DMA_DEVICE_APM_PCM0_MEM_TO_DEV, | ||
56 | DMA_DEVICE_APM_PCM1_DEV_TO_MEM, | ||
57 | DMA_DEVICE_APM_PCM1_MEM_TO_DEV, | ||
58 | DMA_DEVICE_SPUM_DEV_TO_MEM, | ||
59 | DMA_DEVICE_SPUM_MEM_TO_DEV, | ||
60 | DMA_DEVICE_SPIH_DEV_TO_MEM, | ||
61 | DMA_DEVICE_SPIH_MEM_TO_DEV, | ||
62 | DMA_DEVICE_UART_A_DEV_TO_MEM, | ||
63 | DMA_DEVICE_UART_A_MEM_TO_DEV, | ||
64 | DMA_DEVICE_UART_B_DEV_TO_MEM, | ||
65 | DMA_DEVICE_UART_B_MEM_TO_DEV, | ||
66 | DMA_DEVICE_PIF_MEM_TO_DEV, | ||
67 | DMA_DEVICE_PIF_DEV_TO_MEM, | ||
68 | DMA_DEVICE_ESW_DEV_TO_MEM, | ||
69 | DMA_DEVICE_ESW_MEM_TO_DEV, | ||
70 | DMA_DEVICE_VPM_MEM_TO_MEM, | ||
71 | DMA_DEVICE_CLCD_MEM_TO_MEM, | ||
72 | DMA_DEVICE_NAND_MEM_TO_MEM, | ||
73 | DMA_DEVICE_MEM_TO_VRAM, | ||
74 | DMA_DEVICE_VRAM_TO_MEM, | ||
75 | |||
76 | /* Add new entries before this line. */ | ||
77 | |||
78 | DMA_NUM_DEVICE_ENTRIES, | ||
79 | DMA_DEVICE_NONE = 0xff, /* Special value to indicate that no device is currently assigned. */ | ||
80 | |||
81 | } DMA_Device_t; | ||
82 | |||
83 | /**************************************************************************** | ||
84 | * | ||
85 | * The DMA_Handle_t is the primary object used by callers of the API. | ||
86 | * | ||
87 | *****************************************************************************/ | ||
88 | |||
89 | #define DMA_INVALID_HANDLE ((DMA_Handle_t) -1) | ||
90 | |||
91 | typedef int DMA_Handle_t; | ||
92 | |||
93 | /**************************************************************************** | ||
94 | * | ||
95 | * The DMA_DescriptorRing_t contains a ring of descriptors which is used | ||
96 | * to point to regions of memory. | ||
97 | * | ||
98 | *****************************************************************************/ | ||
99 | |||
100 | typedef struct { | ||
101 | void *virtAddr; /* Virtual Address of the descriptor ring */ | ||
102 | dma_addr_t physAddr; /* Physical address of the descriptor ring */ | ||
103 | int descriptorsAllocated; /* Number of descriptors allocated in the descriptor ring */ | ||
104 | size_t bytesAllocated; /* Number of bytes allocated in the descriptor ring */ | ||
105 | |||
106 | } DMA_DescriptorRing_t; | ||
107 | |||
108 | /**************************************************************************** | ||
109 | * | ||
110 | * The DMA_DeviceAttribute_t contains information which describes a | ||
111 | * particular DMA device (or peripheral). | ||
112 | * | ||
113 | * It is anticipated that the arrary of DMA_DeviceAttribute_t's will be | ||
114 | * statically initialized. | ||
115 | * | ||
116 | *****************************************************************************/ | ||
117 | |||
118 | /* The device handler is called whenever a DMA operation completes. The reaon */ | ||
119 | /* for it to be called will be a bitmask with one or more of the following bits */ | ||
120 | /* set. */ | ||
121 | |||
122 | #define DMA_HANDLER_REASON_BLOCK_COMPLETE dmacHw_INTERRUPT_STATUS_BLOCK | ||
123 | #define DMA_HANDLER_REASON_TRANSFER_COMPLETE dmacHw_INTERRUPT_STATUS_TRANS | ||
124 | #define DMA_HANDLER_REASON_ERROR dmacHw_INTERRUPT_STATUS_ERROR | ||
125 | |||
126 | typedef void (*DMA_DeviceHandler_t) (DMA_Device_t dev, int reason, | ||
127 | void *userData); | ||
128 | |||
129 | #define DMA_DEVICE_FLAG_ON_DMA0 0x00000001 | ||
130 | #define DMA_DEVICE_FLAG_ON_DMA1 0x00000002 | ||
131 | #define DMA_DEVICE_FLAG_PORT_PER_DMAC 0x00000004 /* If set, it means that the port used on DMAC0 is different from the port used on DMAC1 */ | ||
132 | #define DMA_DEVICE_FLAG_ALLOC_DMA1_FIRST 0x00000008 /* If set, allocate from DMA1 before allocating from DMA0 */ | ||
133 | #define DMA_DEVICE_FLAG_IS_DEDICATED 0x00000100 | ||
134 | #define DMA_DEVICE_FLAG_NO_ISR 0x00000200 | ||
135 | #define DMA_DEVICE_FLAG_ALLOW_LARGE_FIFO 0x00000400 | ||
136 | #define DMA_DEVICE_FLAG_IN_USE 0x00000800 /* If set, device is in use on a channel */ | ||
137 | |||
138 | /* Note: Some DMA devices can be used from multiple DMA Controllers. The bitmask is used to */ | ||
139 | /* determine which DMA controllers a given device can be used from, and the interface */ | ||
140 | /* array determeines the actual interface number to use for a given controller. */ | ||
141 | |||
142 | typedef struct { | ||
143 | uint32_t flags; /* Bitmask of DMA_DEVICE_FLAG_xxx constants */ | ||
144 | uint8_t dedicatedController; /* Controller number to use if DMA_DEVICE_FLAG_IS_DEDICATED is set. */ | ||
145 | uint8_t dedicatedChannel; /* Channel number to use if DMA_DEVICE_FLAG_IS_DEDICATED is set. */ | ||
146 | const char *name; /* Will show up in the /proc entry */ | ||
147 | |||
148 | uint32_t dmacPort[DMA_NUM_CONTROLLERS]; /* Specifies the port number when DMA_DEVICE_FLAG_PORT_PER_DMAC flag is set */ | ||
149 | |||
150 | dmacHw_CONFIG_t config; /* Configuration to use when DMA'ing using this device */ | ||
151 | |||
152 | void *userData; /* Passed to the devHandler */ | ||
153 | DMA_DeviceHandler_t devHandler; /* Called when DMA operations finish. */ | ||
154 | |||
155 | timer_tick_count_t transferStartTime; /* Time the current transfer was started */ | ||
156 | |||
157 | /* The following statistical information will be collected and presented in a proc entry. */ | ||
158 | /* Note: With a contiuous bandwidth of 1 Gb/sec, it would take 584 years to overflow */ | ||
159 | /* a 64 bit counter. */ | ||
160 | |||
161 | uint64_t numTransfers; /* Number of DMA transfers performed */ | ||
162 | uint64_t transferTicks; /* Total time spent doing DMA transfers (measured in timer_tick_count_t's) */ | ||
163 | uint64_t transferBytes; /* Total bytes transferred */ | ||
164 | uint32_t timesBlocked; /* Number of times a channel was unavailable */ | ||
165 | uint32_t numBytes; /* Last transfer size */ | ||
166 | |||
167 | /* It's not possible to free memory which is allocated for the descriptors from within */ | ||
168 | /* the ISR. So make the presumption that a given device will tend to use the */ | ||
169 | /* same sized buffers over and over again, and we keep them around. */ | ||
170 | |||
171 | DMA_DescriptorRing_t ring; /* Ring of descriptors allocated for this device */ | ||
172 | |||
173 | /* We stash away some of the information from the previous transfer. If back-to-back */ | ||
174 | /* transfers are performed from the same buffer, then we don't have to keep re-initializing */ | ||
175 | /* the descriptor buffers. */ | ||
176 | |||
177 | uint32_t prevNumBytes; | ||
178 | dma_addr_t prevSrcData; | ||
179 | dma_addr_t prevDstData; | ||
180 | |||
181 | } DMA_DeviceAttribute_t; | ||
182 | |||
183 | /**************************************************************************** | ||
184 | * | ||
185 | * DMA_Channel_t, DMA_Controller_t, and DMA_State_t are really internal | ||
186 | * data structures and don't belong in this header file, but are included | ||
187 | * merely for discussion. | ||
188 | * | ||
189 | * By the time this is implemented, these structures will be moved out into | ||
190 | * the appropriate C source file instead. | ||
191 | * | ||
192 | *****************************************************************************/ | ||
193 | |||
194 | /**************************************************************************** | ||
195 | * | ||
196 | * The DMA_Channel_t contains state information about each DMA channel. Some | ||
197 | * of the channels are dedicated. Non-dedicated channels are shared | ||
198 | * amongst the other devices. | ||
199 | * | ||
200 | *****************************************************************************/ | ||
201 | |||
202 | #define DMA_CHANNEL_FLAG_IN_USE 0x00000001 | ||
203 | #define DMA_CHANNEL_FLAG_IS_DEDICATED 0x00000002 | ||
204 | #define DMA_CHANNEL_FLAG_NO_ISR 0x00000004 | ||
205 | #define DMA_CHANNEL_FLAG_LARGE_FIFO 0x00000008 | ||
206 | |||
207 | typedef struct { | ||
208 | uint32_t flags; /* bitmask of DMA_CHANNEL_FLAG_xxx constants */ | ||
209 | DMA_Device_t devType; /* Device this channel is currently reserved for */ | ||
210 | DMA_Device_t lastDevType; /* Device type that used this previously */ | ||
211 | char name[20]; /* Name passed onto request_irq */ | ||
212 | |||
213 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
214 | const char *fileName; /* Place where channel reservation took place */ | ||
215 | int lineNum; /* Place where channel reservation took place */ | ||
216 | #endif | ||
217 | dmacHw_HANDLE_t dmacHwHandle; /* low level channel handle. */ | ||
218 | |||
219 | } DMA_Channel_t; | ||
220 | |||
221 | /**************************************************************************** | ||
222 | * | ||
223 | * The DMA_Controller_t contains state information about each DMA controller. | ||
224 | * | ||
225 | * The freeChannelQ is stored in the controller data structure rather than | ||
226 | * the channel data structure since several of the devices are accessible | ||
227 | * from multiple controllers, and there is no way to know which controller | ||
228 | * will become available first. | ||
229 | * | ||
230 | *****************************************************************************/ | ||
231 | |||
232 | typedef struct { | ||
233 | DMA_Channel_t channel[DMA_NUM_CHANNELS]; | ||
234 | |||
235 | } DMA_Controller_t; | ||
236 | |||
237 | /**************************************************************************** | ||
238 | * | ||
239 | * The DMA_Global_t contains all of the global state information used by | ||
240 | * the DMA code. | ||
241 | * | ||
242 | * Callers which need to allocate a shared channel will be queued up | ||
243 | * on the freeChannelQ until a channel becomes available. | ||
244 | * | ||
245 | *****************************************************************************/ | ||
246 | |||
247 | typedef struct { | ||
248 | struct semaphore lock; /* acquired when manipulating table entries */ | ||
249 | wait_queue_head_t freeChannelQ; | ||
250 | |||
251 | DMA_Controller_t controller[DMA_NUM_CONTROLLERS]; | ||
252 | |||
253 | } DMA_Global_t; | ||
254 | |||
255 | /* ---- Variable Externs ------------------------------------------------- */ | ||
256 | |||
257 | extern DMA_DeviceAttribute_t DMA_gDeviceAttribute[DMA_NUM_DEVICE_ENTRIES]; | ||
258 | |||
259 | /* ---- Function Prototypes ---------------------------------------------- */ | ||
260 | |||
261 | #if defined(__KERNEL__) | ||
262 | |||
263 | /****************************************************************************/ | ||
264 | /** | ||
265 | * Initializes the DMA module. | ||
266 | * | ||
267 | * @return | ||
268 | * 0 - Success | ||
269 | * < 0 - Error | ||
270 | */ | ||
271 | /****************************************************************************/ | ||
272 | |||
273 | int dma_init(void); | ||
274 | |||
275 | #if (DMA_DEBUG_TRACK_RESERVATION) | ||
276 | DMA_Handle_t dma_request_channel_dbg(DMA_Device_t dev, const char *fileName, | ||
277 | int lineNum); | ||
278 | #define dma_request_channel(dev) dma_request_channel_dbg(dev, __FILE__, __LINE__) | ||
279 | #else | ||
280 | |||
281 | /****************************************************************************/ | ||
282 | /** | ||
283 | * Reserves a channel for use with @a dev. If the device is setup to use | ||
284 | * a shared channel, then this function will block until a free channel | ||
285 | * becomes available. | ||
286 | * | ||
287 | * @return | ||
288 | * >= 0 - A valid DMA Handle. | ||
289 | * -EBUSY - Device is currently being used. | ||
290 | * -ENODEV - Device handed in is invalid. | ||
291 | */ | ||
292 | /****************************************************************************/ | ||
293 | |||
294 | DMA_Handle_t dma_request_channel(DMA_Device_t dev /* Device to use with the allocated channel. */ | ||
295 | ); | ||
296 | #endif | ||
297 | |||
298 | /****************************************************************************/ | ||
299 | /** | ||
300 | * Frees a previously allocated DMA Handle. | ||
301 | * | ||
302 | * @return | ||
303 | * 0 - DMA Handle was released successfully. | ||
304 | * -EINVAL - Invalid DMA handle | ||
305 | */ | ||
306 | /****************************************************************************/ | ||
307 | |||
308 | int dma_free_channel(DMA_Handle_t channel /* DMA handle. */ | ||
309 | ); | ||
310 | |||
311 | /****************************************************************************/ | ||
312 | /** | ||
313 | * Determines if a given device has been configured as using a shared | ||
314 | * channel. | ||
315 | * | ||
316 | * @return boolean | ||
317 | * 0 Device uses a dedicated channel | ||
318 | * non-zero Device uses a shared channel | ||
319 | */ | ||
320 | /****************************************************************************/ | ||
321 | |||
322 | int dma_device_is_channel_shared(DMA_Device_t dev /* Device to check. */ | ||
323 | ); | ||
324 | |||
325 | /****************************************************************************/ | ||
326 | /** | ||
327 | * Allocates memory to hold a descriptor ring. The descriptor ring then | ||
328 | * needs to be populated by making one or more calls to | ||
329 | * dna_add_descriptors. | ||
330 | * | ||
331 | * The returned descriptor ring will be automatically initialized. | ||
332 | * | ||
333 | * @return | ||
334 | * 0 Descriptor ring was allocated successfully | ||
335 | * -ENOMEM Unable to allocate memory for the desired number of descriptors. | ||
336 | */ | ||
337 | /****************************************************************************/ | ||
338 | |||
339 | int dma_alloc_descriptor_ring(DMA_DescriptorRing_t *ring, /* Descriptor ring to populate */ | ||
340 | int numDescriptors /* Number of descriptors that need to be allocated. */ | ||
341 | ); | ||
342 | |||
343 | /****************************************************************************/ | ||
344 | /** | ||
345 | * Releases the memory which was previously allocated for a descriptor ring. | ||
346 | */ | ||
347 | /****************************************************************************/ | ||
348 | |||
349 | void dma_free_descriptor_ring(DMA_DescriptorRing_t *ring /* Descriptor to release */ | ||
350 | ); | ||
351 | |||
352 | /****************************************************************************/ | ||
353 | /** | ||
354 | * Initializes a descriptor ring, so that descriptors can be added to it. | ||
355 | * Once a descriptor ring has been allocated, it may be reinitialized for | ||
356 | * use with additional/different regions of memory. | ||
357 | * | ||
358 | * Note that if 7 descriptors are allocated, it's perfectly acceptable to | ||
359 | * initialize the ring with a smaller number of descriptors. The amount | ||
360 | * of memory allocated for the descriptor ring will not be reduced, and | ||
361 | * the descriptor ring may be reinitialized later | ||
362 | * | ||
363 | * @return | ||
364 | * 0 Descriptor ring was initialized successfully | ||
365 | * -ENOMEM The descriptor which was passed in has insufficient space | ||
366 | * to hold the desired number of descriptors. | ||
367 | */ | ||
368 | /****************************************************************************/ | ||
369 | |||
370 | int dma_init_descriptor_ring(DMA_DescriptorRing_t *ring, /* Descriptor ring to initialize */ | ||
371 | int numDescriptors /* Number of descriptors to initialize. */ | ||
372 | ); | ||
373 | |||
374 | /****************************************************************************/ | ||
375 | /** | ||
376 | * Determines the number of descriptors which would be required for a | ||
377 | * transfer of the indicated memory region. | ||
378 | * | ||
379 | * This function also needs to know which DMA device this transfer will | ||
380 | * be destined for, so that the appropriate DMA configuration can be retrieved. | ||
381 | * DMA parameters such as transfer width, and whether this is a memory-to-memory | ||
382 | * or memory-to-peripheral, etc can all affect the actual number of descriptors | ||
383 | * required. | ||
384 | * | ||
385 | * @return | ||
386 | * > 0 Returns the number of descriptors required for the indicated transfer | ||
387 | * -EINVAL Invalid device type for this kind of transfer | ||
388 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
389 | * -ENOMEM Memory exhausted | ||
390 | */ | ||
391 | /****************************************************************************/ | ||
392 | |||
393 | int dma_calculate_descriptor_count(DMA_Device_t device, /* DMA Device that this will be associated with */ | ||
394 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
395 | dma_addr_t dstData, /* Pointer to device data address */ | ||
396 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
397 | ); | ||
398 | |||
399 | /****************************************************************************/ | ||
400 | /** | ||
401 | * Adds a region of memory to the descriptor ring. Note that it may take | ||
402 | * multiple descriptors for each region of memory. It is the callers | ||
403 | * responsibility to allocate a sufficiently large descriptor ring. | ||
404 | * | ||
405 | * @return | ||
406 | * 0 Descriptors were added successfully | ||
407 | * -EINVAL Invalid device type for this kind of transfer | ||
408 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
409 | * -ENOMEM Memory exhausted | ||
410 | */ | ||
411 | /****************************************************************************/ | ||
412 | |||
413 | int dma_add_descriptors(DMA_DescriptorRing_t *ring, /* Descriptor ring to add descriptors to */ | ||
414 | DMA_Device_t device, /* DMA Device that descriptors are for */ | ||
415 | dma_addr_t srcData, /* Place to get data (memory or device) */ | ||
416 | dma_addr_t dstData, /* Place to put data (memory or device) */ | ||
417 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
418 | ); | ||
419 | |||
420 | /****************************************************************************/ | ||
421 | /** | ||
422 | * Sets the descriptor ring associated with a device. | ||
423 | * | ||
424 | * Once set, the descriptor ring will be associated with the device, even | ||
425 | * across channel request/free calls. Passing in a NULL descriptor ring | ||
426 | * will release any descriptor ring currently associated with the device. | ||
427 | * | ||
428 | * Note: If you call dma_transfer, or one of the other dma_alloc_ functions | ||
429 | * the descriptor ring may be released and reallocated. | ||
430 | * | ||
431 | * Note: This function will release the descriptor memory for any current | ||
432 | * descriptor ring associated with this device. | ||
433 | */ | ||
434 | /****************************************************************************/ | ||
435 | |||
436 | int dma_set_device_descriptor_ring(DMA_Device_t device, /* Device to update the descriptor ring for. */ | ||
437 | DMA_DescriptorRing_t *ring /* Descriptor ring to add descriptors to */ | ||
438 | ); | ||
439 | |||
440 | /****************************************************************************/ | ||
441 | /** | ||
442 | * Retrieves the descriptor ring associated with a device. | ||
443 | */ | ||
444 | /****************************************************************************/ | ||
445 | |||
446 | int dma_get_device_descriptor_ring(DMA_Device_t device, /* Device to retrieve the descriptor ring for. */ | ||
447 | DMA_DescriptorRing_t *ring /* Place to store retrieved ring */ | ||
448 | ); | ||
449 | |||
450 | /****************************************************************************/ | ||
451 | /** | ||
452 | * Allocates buffers for the descriptors. This is normally done automatically | ||
453 | * but needs to be done explicitly when initiating a dma from interrupt | ||
454 | * context. | ||
455 | * | ||
456 | * @return | ||
457 | * 0 Descriptors were allocated successfully | ||
458 | * -EINVAL Invalid device type for this kind of transfer | ||
459 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
460 | * -ENOMEM Memory exhausted | ||
461 | */ | ||
462 | /****************************************************************************/ | ||
463 | |||
464 | int dma_alloc_descriptors(DMA_Handle_t handle, /* DMA Handle */ | ||
465 | dmacHw_TRANSFER_TYPE_e transferType, /* Type of transfer being performed */ | ||
466 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
467 | dma_addr_t dstData, /* Pointer to device data address */ | ||
468 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
469 | ); | ||
470 | |||
471 | /****************************************************************************/ | ||
472 | /** | ||
473 | * Allocates and sets up descriptors for a double buffered circular buffer. | ||
474 | * | ||
475 | * This is primarily intended to be used for things like the ingress samples | ||
476 | * from a microphone. | ||
477 | * | ||
478 | * @return | ||
479 | * > 0 Number of descriptors actually allocated. | ||
480 | * -EINVAL Invalid device type for this kind of transfer | ||
481 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
482 | * -ENOMEM Memory exhausted | ||
483 | */ | ||
484 | /****************************************************************************/ | ||
485 | |||
486 | int dma_alloc_double_dst_descriptors(DMA_Handle_t handle, /* DMA Handle */ | ||
487 | dma_addr_t srcData, /* Physical address of source data */ | ||
488 | dma_addr_t dstData1, /* Physical address of first destination buffer */ | ||
489 | dma_addr_t dstData2, /* Physical address of second destination buffer */ | ||
490 | size_t numBytes /* Number of bytes in each destination buffer */ | ||
491 | ); | ||
492 | |||
493 | /****************************************************************************/ | ||
494 | /** | ||
495 | * Initiates a transfer when the descriptors have already been setup. | ||
496 | * | ||
497 | * This is a special case, and normally, the dma_transfer_xxx functions should | ||
498 | * be used. | ||
499 | * | ||
500 | * @return | ||
501 | * 0 Transfer was started successfully | ||
502 | * -ENODEV Invalid handle | ||
503 | */ | ||
504 | /****************************************************************************/ | ||
505 | |||
506 | int dma_start_transfer(DMA_Handle_t handle); | ||
507 | |||
508 | /****************************************************************************/ | ||
509 | /** | ||
510 | * Stops a previously started DMA transfer. | ||
511 | * | ||
512 | * @return | ||
513 | * 0 Transfer was stopped successfully | ||
514 | * -ENODEV Invalid handle | ||
515 | */ | ||
516 | /****************************************************************************/ | ||
517 | |||
518 | int dma_stop_transfer(DMA_Handle_t handle); | ||
519 | |||
520 | /****************************************************************************/ | ||
521 | /** | ||
522 | * Waits for a DMA to complete by polling. This function is only intended | ||
523 | * to be used for testing. Interrupts should be used for most DMA operations. | ||
524 | */ | ||
525 | /****************************************************************************/ | ||
526 | |||
527 | int dma_wait_transfer_done(DMA_Handle_t handle); | ||
528 | |||
529 | /****************************************************************************/ | ||
530 | /** | ||
531 | * Initiates a DMA transfer | ||
532 | * | ||
533 | * @return | ||
534 | * 0 Transfer was started successfully | ||
535 | * -EINVAL Invalid device type for this kind of transfer | ||
536 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
537 | */ | ||
538 | /****************************************************************************/ | ||
539 | |||
540 | int dma_transfer(DMA_Handle_t handle, /* DMA Handle */ | ||
541 | dmacHw_TRANSFER_TYPE_e transferType, /* Type of transfer being performed */ | ||
542 | dma_addr_t srcData, /* Place to get data to write to device */ | ||
543 | dma_addr_t dstData, /* Pointer to device data address */ | ||
544 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
545 | ); | ||
546 | |||
547 | /****************************************************************************/ | ||
548 | /** | ||
549 | * Initiates a transfer from memory to a device. | ||
550 | * | ||
551 | * @return | ||
552 | * 0 Transfer was started successfully | ||
553 | * -EINVAL Invalid device type for this kind of transfer | ||
554 | * (i.e. the device is _DEV_TO_MEM and not _MEM_TO_DEV) | ||
555 | */ | ||
556 | /****************************************************************************/ | ||
557 | |||
558 | static inline int dma_transfer_to_device(DMA_Handle_t handle, /* DMA Handle */ | ||
559 | dma_addr_t srcData, /* Place to get data to write to device (physical address) */ | ||
560 | dma_addr_t dstData, /* Pointer to device data address (physical address) */ | ||
561 | size_t numBytes /* Number of bytes to transfer to the device */ | ||
562 | ) { | ||
563 | return dma_transfer(handle, | ||
564 | dmacHw_TRANSFER_TYPE_MEM_TO_PERIPHERAL, | ||
565 | srcData, dstData, numBytes); | ||
566 | } | ||
567 | |||
568 | /****************************************************************************/ | ||
569 | /** | ||
570 | * Initiates a transfer from a device to memory. | ||
571 | * | ||
572 | * @return | ||
573 | * 0 Transfer was started successfully | ||
574 | * -EINVAL Invalid device type for this kind of transfer | ||
575 | * (i.e. the device is _MEM_TO_DEV and not _DEV_TO_MEM) | ||
576 | */ | ||
577 | /****************************************************************************/ | ||
578 | |||
579 | static inline int dma_transfer_from_device(DMA_Handle_t handle, /* DMA Handle */ | ||
580 | dma_addr_t srcData, /* Pointer to the device data address (physical address) */ | ||
581 | dma_addr_t dstData, /* Place to store data retrieved from the device (physical address) */ | ||
582 | size_t numBytes /* Number of bytes to retrieve from the device */ | ||
583 | ) { | ||
584 | return dma_transfer(handle, | ||
585 | dmacHw_TRANSFER_TYPE_PERIPHERAL_TO_MEM, | ||
586 | srcData, dstData, numBytes); | ||
587 | } | ||
588 | |||
589 | /****************************************************************************/ | ||
590 | /** | ||
591 | * Initiates a memory to memory transfer. | ||
592 | * | ||
593 | * @return | ||
594 | * 0 Transfer was started successfully | ||
595 | * -EINVAL Invalid device type for this kind of transfer | ||
596 | * (i.e. the device wasn't DMA_DEVICE_MEM_TO_MEM) | ||
597 | */ | ||
598 | /****************************************************************************/ | ||
599 | |||
600 | static inline int dma_transfer_mem_to_mem(DMA_Handle_t handle, /* DMA Handle */ | ||
601 | dma_addr_t srcData, /* Place to transfer data from (physical address) */ | ||
602 | dma_addr_t dstData, /* Place to transfer data to (physical address) */ | ||
603 | size_t numBytes /* Number of bytes to transfer */ | ||
604 | ) { | ||
605 | return dma_transfer(handle, | ||
606 | dmacHw_TRANSFER_TYPE_MEM_TO_MEM, | ||
607 | srcData, dstData, numBytes); | ||
608 | } | ||
609 | |||
610 | /****************************************************************************/ | ||
611 | /** | ||
612 | * Set the callback function which will be called when a transfer completes. | ||
613 | * If a NULL callback function is set, then no callback will occur. | ||
614 | * | ||
615 | * @note @a devHandler will be called from IRQ context. | ||
616 | * | ||
617 | * @return | ||
618 | * 0 - Success | ||
619 | * -ENODEV - Device handed in is invalid. | ||
620 | */ | ||
621 | /****************************************************************************/ | ||
622 | |||
623 | int dma_set_device_handler(DMA_Device_t dev, /* Device to set the callback for. */ | ||
624 | DMA_DeviceHandler_t devHandler, /* Function to call when the DMA completes */ | ||
625 | void *userData /* Pointer which will be passed to devHandler. */ | ||
626 | ); | ||
627 | |||
628 | #endif | ||
629 | |||
630 | #endif /* ASM_ARM_ARCH_BCMRING_DMA_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/entry-macro.S b/arch/arm/mach-bcmring/include/mach/entry-macro.S deleted file mode 100644 index 2f316f0e6e69..000000000000 --- a/arch/arm/mach-bcmring/include/mach/entry-macro.S +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2006 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /* | ||
16 | * | ||
17 | * Low-level IRQ helper macros for BCMRing-based platforms | ||
18 | * | ||
19 | */ | ||
20 | #include <mach/irqs.h> | ||
21 | #include <mach/hardware.h> | ||
22 | #include <mach/csp/mm_io.h> | ||
23 | |||
24 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
25 | ldr \base, =(MM_IO_BASE_INTC0) | ||
26 | ldr \irqstat, [\base, #0] @ get status | ||
27 | ldr \irqnr, [\base, #0x10] @ mask with enable register | ||
28 | ands \irqstat, \irqstat, \irqnr | ||
29 | mov \irqnr, #IRQ_INTC0_START | ||
30 | cmp \irqstat, #0 | ||
31 | bne 1001f | ||
32 | |||
33 | ldr \base, =(MM_IO_BASE_INTC1) | ||
34 | ldr \irqstat, [\base, #0] @ get status | ||
35 | ldr \irqnr, [\base, #0x10] @ mask with enable register | ||
36 | ands \irqstat, \irqstat, \irqnr | ||
37 | mov \irqnr, #IRQ_INTC1_START | ||
38 | cmp \irqstat, #0 | ||
39 | bne 1001f | ||
40 | |||
41 | ldr \base, =(MM_IO_BASE_SINTC) | ||
42 | ldr \irqstat, [\base, #0] @ get status | ||
43 | ldr \irqnr, [\base, #0x10] @ mask with enable register | ||
44 | ands \irqstat, \irqstat, \irqnr | ||
45 | mov \irqnr, #0xffffffff @ code meaning no interrupt bits set | ||
46 | cmp \irqstat, #0 | ||
47 | beq 1002f | ||
48 | |||
49 | mov \irqnr, #IRQ_SINTC_START @ something is set, so fixup return value | ||
50 | |||
51 | 1001: | ||
52 | movs \tmp, \irqstat, lsl #16 | ||
53 | movne \irqstat, \tmp | ||
54 | addeq \irqnr, \irqnr, #16 | ||
55 | |||
56 | movs \tmp, \irqstat, lsl #8 | ||
57 | movne \irqstat, \tmp | ||
58 | addeq \irqnr, \irqnr, #8 | ||
59 | |||
60 | movs \tmp, \irqstat, lsl #4 | ||
61 | movne \irqstat, \tmp | ||
62 | addeq \irqnr, \irqnr, #4 | ||
63 | |||
64 | movs \tmp, \irqstat, lsl #2 | ||
65 | movne \irqstat, \tmp | ||
66 | addeq \irqnr, \irqnr, #2 | ||
67 | |||
68 | movs \tmp, \irqstat, lsl #1 | ||
69 | addeq \irqnr, \irqnr, #1 | ||
70 | orrs \base, \base, #1 | ||
71 | |||
72 | 1002: @ irqnr will be set to 0xffffffff if no irq bits are set | ||
73 | .endm | ||
74 | |||
75 | .macro get_irqnr_preamble, base, tmp | ||
76 | .endm | ||
diff --git a/arch/arm/mach-bcmring/include/mach/hardware.h b/arch/arm/mach-bcmring/include/mach/hardware.h deleted file mode 100644 index a0c92b4b8c60..000000000000 --- a/arch/arm/mach-bcmring/include/mach/hardware.h +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * This file contains the hardware definitions of the BCMRing. | ||
4 | * | ||
5 | * Copyright (C) 1999 ARM Limited. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | #ifndef __ASM_ARCH_HARDWARE_H | ||
22 | #define __ASM_ARCH_HARDWARE_H | ||
23 | |||
24 | #include <asm/sizes.h> | ||
25 | #include <mach/cfg_global.h> | ||
26 | #include <mach/csp/mm_io.h> | ||
27 | |||
28 | /* Hardware addresses of major areas. | ||
29 | * *_START is the physical address | ||
30 | * *_SIZE is the size of the region | ||
31 | * *_BASE is the virtual address | ||
32 | */ | ||
33 | #define RAM_START PHYS_OFFSET | ||
34 | |||
35 | #define RAM_SIZE (CFG_GLOBAL_RAM_SIZE-CFG_GLOBAL_RAM_SIZE_RESERVED) | ||
36 | #define RAM_BASE PAGE_OFFSET | ||
37 | |||
38 | /* Macros to make managing spinlocks a bit more controlled in terms of naming. */ | ||
39 | /* See reg_gpio.h, reg_irq.h, arch.c, gpio.c for example usage. */ | ||
40 | #if defined(__KERNEL__) | ||
41 | #define HW_DECLARE_SPINLOCK(name) DEFINE_SPINLOCK(bcmring_##name##_reg_lock); | ||
42 | #define HW_EXTERN_SPINLOCK(name) extern spinlock_t bcmring_##name##_reg_lock; | ||
43 | #define HW_IRQ_SAVE(name, val) spin_lock_irqsave(&bcmring_##name##_reg_lock, (val)) | ||
44 | #define HW_IRQ_RESTORE(name, val) spin_unlock_irqrestore(&bcmring_##name##_reg_lock, (val)) | ||
45 | #else | ||
46 | #define HW_DECLARE_SPINLOCK(name) | ||
47 | #define HW_EXTERN_SPINLOCK(name) | ||
48 | #define HW_IRQ_SAVE(name, val) {(void)(name); (void)(val); } | ||
49 | #define HW_IRQ_RESTORE(name, val) {(void)(name); (void)(val); } | ||
50 | #endif | ||
51 | |||
52 | #ifndef HW_IO_PHYS_TO_VIRT | ||
53 | #define HW_IO_PHYS_TO_VIRT MM_IO_PHYS_TO_VIRT | ||
54 | #endif | ||
55 | #define HW_IO_VIRT_TO_PHYS MM_IO_VIRT_TO_PHYS | ||
56 | |||
57 | #endif | ||
diff --git a/arch/arm/mach-bcmring/include/mach/irqs.h b/arch/arm/mach-bcmring/include/mach/irqs.h deleted file mode 100644 index b279b825d4a7..000000000000 --- a/arch/arm/mach-bcmring/include/mach/irqs.h +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 Broadcom | ||
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 | |||
20 | #if !defined(ARCH_BCMRING_IRQS_H) | ||
21 | #define ARCH_BCMRING_IRQS_H | ||
22 | |||
23 | /* INTC0 - interrupt controller 0 */ | ||
24 | #define IRQ_INTC0_START 0 | ||
25 | #define IRQ_DMA0C0 0 /* DMA0 channel 0 interrupt */ | ||
26 | #define IRQ_DMA0C1 1 /* DMA0 channel 1 interrupt */ | ||
27 | #define IRQ_DMA0C2 2 /* DMA0 channel 2 interrupt */ | ||
28 | #define IRQ_DMA0C3 3 /* DMA0 channel 3 interrupt */ | ||
29 | #define IRQ_DMA0C4 4 /* DMA0 channel 4 interrupt */ | ||
30 | #define IRQ_DMA0C5 5 /* DMA0 channel 5 interrupt */ | ||
31 | #define IRQ_DMA0C6 6 /* DMA0 channel 6 interrupt */ | ||
32 | #define IRQ_DMA0C7 7 /* DMA0 channel 7 interrupt */ | ||
33 | #define IRQ_DMA1C0 8 /* DMA1 channel 0 interrupt */ | ||
34 | #define IRQ_DMA1C1 9 /* DMA1 channel 1 interrupt */ | ||
35 | #define IRQ_DMA1C2 10 /* DMA1 channel 2 interrupt */ | ||
36 | #define IRQ_DMA1C3 11 /* DMA1 channel 3 interrupt */ | ||
37 | #define IRQ_DMA1C4 12 /* DMA1 channel 4 interrupt */ | ||
38 | #define IRQ_DMA1C5 13 /* DMA1 channel 5 interrupt */ | ||
39 | #define IRQ_DMA1C6 14 /* DMA1 channel 6 interrupt */ | ||
40 | #define IRQ_DMA1C7 15 /* DMA1 channel 7 interrupt */ | ||
41 | #define IRQ_VPM 16 /* Voice process module interrupt */ | ||
42 | #define IRQ_USBHD2 17 /* USB host2/device2 interrupt */ | ||
43 | #define IRQ_USBH1 18 /* USB1 host interrupt */ | ||
44 | #define IRQ_USBD 19 /* USB device interrupt */ | ||
45 | #define IRQ_SDIOH0 20 /* SDIO0 host interrupt */ | ||
46 | #define IRQ_SDIOH1 21 /* SDIO1 host interrupt */ | ||
47 | #define IRQ_TIMER0 22 /* Timer0 interrupt */ | ||
48 | #define IRQ_TIMER1 23 /* Timer1 interrupt */ | ||
49 | #define IRQ_TIMER2 24 /* Timer2 interrupt */ | ||
50 | #define IRQ_TIMER3 25 /* Timer3 interrupt */ | ||
51 | #define IRQ_SPIH 26 /* SPI host interrupt */ | ||
52 | #define IRQ_ESW 27 /* Ethernet switch interrupt */ | ||
53 | #define IRQ_APM 28 /* Audio process module interrupt */ | ||
54 | #define IRQ_GE 29 /* Graphic engine interrupt */ | ||
55 | #define IRQ_CLCD 30 /* LCD Controller interrupt */ | ||
56 | #define IRQ_PIF 31 /* Peripheral interface interrupt */ | ||
57 | #define IRQ_INTC0_END 31 | ||
58 | |||
59 | /* INTC1 - interrupt controller 1 */ | ||
60 | #define IRQ_INTC1_START 32 | ||
61 | #define IRQ_GPIO0 32 /* 0 GPIO bit 31//0 combined interrupt */ | ||
62 | #define IRQ_GPIO1 33 /* 1 GPIO bit 64//32 combined interrupt */ | ||
63 | #define IRQ_I2S0 34 /* 2 I2S0 interrupt */ | ||
64 | #define IRQ_I2S1 35 /* 3 I2S1 interrupt */ | ||
65 | #define IRQ_I2CH 36 /* 4 I2C host interrupt */ | ||
66 | #define IRQ_I2CS 37 /* 5 I2C slave interrupt */ | ||
67 | #define IRQ_SPIS 38 /* 6 SPI slave interrupt */ | ||
68 | #define IRQ_GPHY 39 /* 7 Gigabit Phy interrupt */ | ||
69 | #define IRQ_FLASHC 40 /* 8 Flash controller interrupt */ | ||
70 | #define IRQ_COMMTX 41 /* 9 ARM DDC transmit interrupt */ | ||
71 | #define IRQ_COMMRX 42 /* 10 ARM DDC receive interrupt */ | ||
72 | #define IRQ_PMUIRQ 43 /* 11 ARM performance monitor interrupt */ | ||
73 | #define IRQ_UARTB 44 /* 12 UARTB */ | ||
74 | #define IRQ_WATCHDOG 45 /* 13 Watchdog timer interrupt */ | ||
75 | #define IRQ_UARTA 46 /* 14 UARTA */ | ||
76 | #define IRQ_TSC 47 /* 15 Touch screen controller interrupt */ | ||
77 | #define IRQ_KEYC 48 /* 16 Key pad controller interrupt */ | ||
78 | #define IRQ_DMPU 49 /* 17 DDR2 memory partition interrupt */ | ||
79 | #define IRQ_VMPU 50 /* 18 VRAM memory partition interrupt */ | ||
80 | #define IRQ_FMPU 51 /* 19 Flash memory parition unit interrupt */ | ||
81 | #define IRQ_RNG 52 /* 20 Random number generator interrupt */ | ||
82 | #define IRQ_RTC0 53 /* 21 Real time clock periodic interrupt */ | ||
83 | #define IRQ_RTC1 54 /* 22 Real time clock one-shot interrupt */ | ||
84 | #define IRQ_SPUM 55 /* 23 Secure process module interrupt */ | ||
85 | #define IRQ_VDEC 56 /* 24 Hantro video decoder interrupt */ | ||
86 | #define IRQ_RTC2 57 /* 25 Real time clock tamper interrupt */ | ||
87 | #define IRQ_DDRP 58 /* 26 DDR Panic interrupt */ | ||
88 | #define IRQ_INTC1_END 58 | ||
89 | |||
90 | /* SINTC secure int controller */ | ||
91 | #define IRQ_SINTC_START 59 | ||
92 | #define IRQ_SEC_WATCHDOG 59 /* 0 Watchdog timer interrupt */ | ||
93 | #define IRQ_SEC_UARTA 60 /* 1 UARTA interrupt */ | ||
94 | #define IRQ_SEC_TSC 61 /* 2 Touch screen controller interrupt */ | ||
95 | #define IRQ_SEC_KEYC 62 /* 3 Key pad controller interrupt */ | ||
96 | #define IRQ_SEC_DMPU 63 /* 4 DDR2 memory partition interrupt */ | ||
97 | #define IRQ_SEC_VMPU 64 /* 5 VRAM memory partition interrupt */ | ||
98 | #define IRQ_SEC_FMPU 65 /* 6 Flash memory parition unit interrupt */ | ||
99 | #define IRQ_SEC_RNG 66 /* 7 Random number generator interrupt */ | ||
100 | #define IRQ_SEC_RTC0 67 /* 8 Real time clock periodic interrupt */ | ||
101 | #define IRQ_SEC_RTC1 68 /* 9 Real time clock one-shot interrupt */ | ||
102 | #define IRQ_SEC_SPUM 69 /* 10 Secure process module interrupt */ | ||
103 | #define IRQ_SEC_TIMER0 70 /* 11 Secure timer0 interrupt */ | ||
104 | #define IRQ_SEC_TIMER1 71 /* 12 Secure timer1 interrupt */ | ||
105 | #define IRQ_SEC_TIMER2 72 /* 13 Secure timer2 interrupt */ | ||
106 | #define IRQ_SEC_TIMER3 73 /* 14 Secure timer3 interrupt */ | ||
107 | #define IRQ_SEC_RTC2 74 /* 15 Real time clock tamper interrupt */ | ||
108 | |||
109 | #define IRQ_SINTC_END 74 | ||
110 | |||
111 | /* Note: there are 3 INTC registers of 32 bits each. So internal IRQs could go from 0-95 */ | ||
112 | /* Since IRQs are typically viewed in decimal, we start the gpio based IRQs off at 100 */ | ||
113 | /* to make the mapping easy for humans to decipher. */ | ||
114 | |||
115 | #define IRQ_GPIO_0 100 | ||
116 | |||
117 | #define NUM_INTERNAL_IRQS (IRQ_SINTC_END+1) | ||
118 | |||
119 | /* I couldn't get the gpioHw_reg.h file to be included cleanly, so I hardcoded it */ | ||
120 | /* define NUM_GPIO_IRQS GPIOHW_TOTAL_NUM_PINS */ | ||
121 | #define NUM_GPIO_IRQS 62 | ||
122 | |||
123 | #define NR_IRQS (IRQ_GPIO_0 + NUM_GPIO_IRQS) | ||
124 | |||
125 | #define IRQ_UNKNOWN -1 | ||
126 | |||
127 | /* Tune these bits to preclude noisy or unsupported interrupt sources as required. */ | ||
128 | #define IRQ_INTC0_VALID_MASK 0xffffffff | ||
129 | #define IRQ_INTC1_VALID_MASK 0x07ffffff | ||
130 | #define IRQ_SINTC_VALID_MASK 0x0000ffff | ||
131 | |||
132 | #endif /* ARCH_BCMRING_IRQS_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/memory_settings.h b/arch/arm/mach-bcmring/include/mach/memory_settings.h deleted file mode 100644 index ce5cd16f2ac4..000000000000 --- a/arch/arm/mach-bcmring/include/mach/memory_settings.h +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #ifndef MEMORY_SETTINGS_H | ||
16 | #define MEMORY_SETTINGS_H | ||
17 | |||
18 | /* ---- Include Files ---------------------------------------- */ | ||
19 | /* ---- Constants and Types ---------------------------------- */ | ||
20 | |||
21 | /* Memory devices */ | ||
22 | /* NAND Flash timing for 166 MHz setting */ | ||
23 | #define HW_CFG_NAND_tBTA (5 << 16) /* Bus turnaround cycle (n) 0-7 (30 ns) */ | ||
24 | #define HW_CFG_NAND_tWP (4 << 11) /* Write pulse width cycle (n+1) 0-31 (25 ns) */ | ||
25 | #define HW_CFG_NAND_tWR (1 << 9) /* Write recovery cycle (n+1) 0-3 (10 ns) */ | ||
26 | #define HW_CFG_NAND_tAS (0 << 7) /* Write address setup cycle (n+1) 0-3 ( 0 ns) */ | ||
27 | #define HW_CFG_NAND_tOE (3 << 5) /* Output enable delay cycle (n) 0-3 (15 ns) */ | ||
28 | #define HW_CFG_NAND_tRC (7 << 0) /* Read access cycle (n+2) 0-31 (50 ns) */ | ||
29 | |||
30 | #define HW_CFG_NAND_TCR (HW_CFG_NAND_tBTA \ | ||
31 | | HW_CFG_NAND_tWP \ | ||
32 | | HW_CFG_NAND_tWR \ | ||
33 | | HW_CFG_NAND_tAS \ | ||
34 | | HW_CFG_NAND_tOE \ | ||
35 | | HW_CFG_NAND_tRC) | ||
36 | |||
37 | /* NOR Flash timing for 166 MHz setting */ | ||
38 | #define HW_CFG_NOR_TPRC_TWLC (0 << 19) /* Page read access cycle / Burst write latency (n+2 / n+1) (max 25ns) */ | ||
39 | #define HW_CFG_NOR_TBTA (0 << 16) /* Bus turnaround cycle (n) (DNA) */ | ||
40 | #define HW_CFG_NOR_TWP (6 << 11) /* Write pulse width cycle (n+1) (35ns) */ | ||
41 | #define HW_CFG_NOR_TWR (0 << 9) /* Write recovery cycle (n+1) (0ns) */ | ||
42 | #define HW_CFG_NOR_TAS (0 << 7) /* Write address setup cycle (n+1) (0ns) */ | ||
43 | #define HW_CFG_NOR_TOE (0 << 5) /* Output enable delay cycle (n) (max 25ns) */ | ||
44 | #define HW_CFG_NOR_TRC_TLC (0x10 << 0) /* Read access cycle / Burst read latency (n+2 / n+1) (100ns) */ | ||
45 | |||
46 | #define HW_CFG_FLASH0_TCR (HW_CFG_NOR_TPRC_TWLC \ | ||
47 | | HW_CFG_NOR_TBTA \ | ||
48 | | HW_CFG_NOR_TWP \ | ||
49 | | HW_CFG_NOR_TWR \ | ||
50 | | HW_CFG_NOR_TAS \ | ||
51 | | HW_CFG_NOR_TOE \ | ||
52 | | HW_CFG_NOR_TRC_TLC) | ||
53 | |||
54 | #define HW_CFG_FLASH1_TCR HW_CFG_FLASH0_TCR | ||
55 | #define HW_CFG_FLASH2_TCR HW_CFG_FLASH0_TCR | ||
56 | |||
57 | /* SDRAM Settings */ | ||
58 | /* #define HW_CFG_SDRAM_CAS_LATENCY 5 Default 5, Values [3..6] */ | ||
59 | /* #define HW_CFG_SDRAM_CHIP_SELECT_CNT 1 Default 1, Vaules [1..2] */ | ||
60 | /* #define HW_CFG_SDRAM_SPEED_GRADE 667 Default 667, Values [400,533,667,800] */ | ||
61 | /* #define HW_CFG_SDRAM_WIDTH_BITS 16 Default 16, Vaules [8,16] */ | ||
62 | #define HW_CFG_SDRAM_SIZE_BYTES 0x10000000 /* Total memory, not per device size */ | ||
63 | |||
64 | /* ---- Variable Externs ------------------------------------- */ | ||
65 | /* ---- Function Prototypes ---------------------------------- */ | ||
66 | |||
67 | #endif /* MEMORY_SETTINGS_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/reg_nand.h b/arch/arm/mach-bcmring/include/mach/reg_nand.h deleted file mode 100644 index f8d51a8b0b15..000000000000 --- a/arch/arm/mach-bcmring/include/mach/reg_nand.h +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2001 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /* | ||
16 | * | ||
17 | ***************************************************************************** | ||
18 | * | ||
19 | * REG_NAND.h | ||
20 | * | ||
21 | * PURPOSE: | ||
22 | * | ||
23 | * This file contains definitions for the nand registers: | ||
24 | * | ||
25 | * NOTES: | ||
26 | * | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #if !defined(__ASM_ARCH_REG_NAND_H) | ||
30 | #define __ASM_ARCH_REG_NAND_H | ||
31 | |||
32 | /* ---- Include Files ---------------------------------------------------- */ | ||
33 | #include <mach/csp/reg.h> | ||
34 | #include <mach/reg_umi.h> | ||
35 | |||
36 | /* ---- Constants and Types ---------------------------------------------- */ | ||
37 | |||
38 | #define HW_NAND_BASE MM_IO_BASE_NAND /* NAND Flash */ | ||
39 | |||
40 | /* DMA accesses by the bootstrap need hard nonvirtual addresses */ | ||
41 | #define REG_NAND_CMD __REG16(HW_NAND_BASE + 0) | ||
42 | #define REG_NAND_ADDR __REG16(HW_NAND_BASE + 4) | ||
43 | |||
44 | #define REG_NAND_PHYS_DATA16 (HW_NAND_BASE + 8) | ||
45 | #define REG_NAND_PHYS_DATA8 (HW_NAND_BASE + 8) | ||
46 | #define REG_NAND_DATA16 __REG16(REG_NAND_PHYS_DATA16) | ||
47 | #define REG_NAND_DATA8 __REG8(REG_NAND_PHYS_DATA8) | ||
48 | |||
49 | /* use appropriate offset to make sure it start at the 1K boundary */ | ||
50 | #define REG_NAND_PHYS_DATA_DMA (HW_NAND_BASE + 0x400) | ||
51 | #define REG_NAND_DATA_DMA __REG32(REG_NAND_PHYS_DATA_DMA) | ||
52 | |||
53 | /* Linux DMA requires physical address of the data register */ | ||
54 | #define REG_NAND_DATA16_PADDR HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA16) | ||
55 | #define REG_NAND_DATA8_PADDR HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA8) | ||
56 | #define REG_NAND_DATA_PADDR HW_IO_VIRT_TO_PHYS(REG_NAND_PHYS_DATA_DMA) | ||
57 | |||
58 | #define NAND_BUS_16BIT() (0) | ||
59 | #define NAND_BUS_8BIT() (!NAND_BUS_16BIT()) | ||
60 | |||
61 | /* Register offsets */ | ||
62 | #define REG_NAND_CMD_OFFSET (0) | ||
63 | #define REG_NAND_ADDR_OFFSET (4) | ||
64 | #define REG_NAND_DATA8_OFFSET (8) | ||
65 | |||
66 | #endif | ||
diff --git a/arch/arm/mach-bcmring/include/mach/reg_umi.h b/arch/arm/mach-bcmring/include/mach/reg_umi.h deleted file mode 100644 index 56dd9de7d83f..000000000000 --- a/arch/arm/mach-bcmring/include/mach/reg_umi.h +++ /dev/null | |||
@@ -1,237 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2005 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /* | ||
16 | * | ||
17 | ***************************************************************************** | ||
18 | * | ||
19 | * REG_UMI.h | ||
20 | * | ||
21 | * PURPOSE: | ||
22 | * | ||
23 | * This file contains definitions for the nand registers: | ||
24 | * | ||
25 | * NOTES: | ||
26 | * | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #if !defined(__ASM_ARCH_REG_UMI_H) | ||
30 | #define __ASM_ARCH_REG_UMI_H | ||
31 | |||
32 | /* ---- Include Files ---------------------------------------------------- */ | ||
33 | #include <mach/csp/reg.h> | ||
34 | #include <mach/csp/mm_io.h> | ||
35 | |||
36 | /* ---- Constants and Types ---------------------------------------------- */ | ||
37 | |||
38 | /* Unified Memory Interface Ctrl Register */ | ||
39 | #define HW_UMI_BASE MM_IO_BASE_UMI | ||
40 | |||
41 | /* Flash bank 0 timing and control register */ | ||
42 | #define REG_UMI_FLASH0_TCR __REG32(HW_UMI_BASE + 0x00) | ||
43 | /* Flash bank 1 timing and control register */ | ||
44 | #define REG_UMI_FLASH1_TCR __REG32(HW_UMI_BASE + 0x04) | ||
45 | /* Flash bank 2 timing and control register */ | ||
46 | #define REG_UMI_FLASH2_TCR __REG32(HW_UMI_BASE + 0x08) | ||
47 | /* MMD interface and control register */ | ||
48 | #define REG_UMI_MMD_ICR __REG32(HW_UMI_BASE + 0x0c) | ||
49 | /* NAND timing and control register */ | ||
50 | #define REG_UMI_NAND_TCR __REG32(HW_UMI_BASE + 0x18) | ||
51 | /* NAND ready/chip select register */ | ||
52 | #define REG_UMI_NAND_RCSR __REG32(HW_UMI_BASE + 0x1c) | ||
53 | /* NAND ECC control & status register */ | ||
54 | #define REG_UMI_NAND_ECC_CSR __REG32(HW_UMI_BASE + 0x20) | ||
55 | /* NAND ECC data register XXB2B1B0 */ | ||
56 | #define REG_UMI_NAND_ECC_DATA __REG32(HW_UMI_BASE + 0x24) | ||
57 | /* BCH ECC Parameter N */ | ||
58 | #define REG_UMI_BCH_N __REG32(HW_UMI_BASE + 0x40) | ||
59 | /* BCH ECC Parameter T */ | ||
60 | #define REG_UMI_BCH_K __REG32(HW_UMI_BASE + 0x44) | ||
61 | /* BCH ECC Parameter K */ | ||
62 | #define REG_UMI_BCH_T __REG32(HW_UMI_BASE + 0x48) | ||
63 | /* BCH ECC Contro Status */ | ||
64 | #define REG_UMI_BCH_CTRL_STATUS __REG32(HW_UMI_BASE + 0x4C) | ||
65 | /* BCH WR ECC 31:0 */ | ||
66 | #define REG_UMI_BCH_WR_ECC_0 __REG32(HW_UMI_BASE + 0x50) | ||
67 | /* BCH WR ECC 63:32 */ | ||
68 | #define REG_UMI_BCH_WR_ECC_1 __REG32(HW_UMI_BASE + 0x54) | ||
69 | /* BCH WR ECC 95:64 */ | ||
70 | #define REG_UMI_BCH_WR_ECC_2 __REG32(HW_UMI_BASE + 0x58) | ||
71 | /* BCH WR ECC 127:96 */ | ||
72 | #define REG_UMI_BCH_WR_ECC_3 __REG32(HW_UMI_BASE + 0x5c) | ||
73 | /* BCH WR ECC 155:128 */ | ||
74 | #define REG_UMI_BCH_WR_ECC_4 __REG32(HW_UMI_BASE + 0x60) | ||
75 | /* BCH Read Error Location 1,0 */ | ||
76 | #define REG_UMI_BCH_RD_ERR_LOC_1_0 __REG32(HW_UMI_BASE + 0x64) | ||
77 | /* BCH Read Error Location 3,2 */ | ||
78 | #define REG_UMI_BCH_RD_ERR_LOC_3_2 __REG32(HW_UMI_BASE + 0x68) | ||
79 | /* BCH Read Error Location 5,4 */ | ||
80 | #define REG_UMI_BCH_RD_ERR_LOC_5_4 __REG32(HW_UMI_BASE + 0x6c) | ||
81 | /* BCH Read Error Location 7,6 */ | ||
82 | #define REG_UMI_BCH_RD_ERR_LOC_7_6 __REG32(HW_UMI_BASE + 0x70) | ||
83 | /* BCH Read Error Location 9,8 */ | ||
84 | #define REG_UMI_BCH_RD_ERR_LOC_9_8 __REG32(HW_UMI_BASE + 0x74) | ||
85 | /* BCH Read Error Location 11,10 */ | ||
86 | #define REG_UMI_BCH_RD_ERR_LOC_B_A __REG32(HW_UMI_BASE + 0x78) | ||
87 | |||
88 | /* REG_UMI_FLASH0/1/2_TCR, REG_UMI_SRAM0/1_TCR bits */ | ||
89 | /* Enable wait pin during burst write or read */ | ||
90 | #define REG_UMI_TCR_WAITEN 0x80000000 | ||
91 | /* Enable mem ctrlr to work with ext mem of lower freq than AHB clk */ | ||
92 | #define REG_UMI_TCR_LOWFREQ 0x40000000 | ||
93 | /* 1=synch write, 0=async write */ | ||
94 | #define REG_UMI_TCR_MEMTYPE_SYNCWRITE 0x20000000 | ||
95 | /* 1=synch read, 0=async read */ | ||
96 | #define REG_UMI_TCR_MEMTYPE_SYNCREAD 0x10000000 | ||
97 | /* 1=page mode read, 0=normal mode read */ | ||
98 | #define REG_UMI_TCR_MEMTYPE_PAGEREAD 0x08000000 | ||
99 | /* page size/burst size (wrap only) */ | ||
100 | #define REG_UMI_TCR_MEMTYPE_PGSZ_MASK 0x07000000 | ||
101 | /* 4 word */ | ||
102 | #define REG_UMI_TCR_MEMTYPE_PGSZ_4 0x00000000 | ||
103 | /* 8 word */ | ||
104 | #define REG_UMI_TCR_MEMTYPE_PGSZ_8 0x01000000 | ||
105 | /* 16 word */ | ||
106 | #define REG_UMI_TCR_MEMTYPE_PGSZ_16 0x02000000 | ||
107 | /* 32 word */ | ||
108 | #define REG_UMI_TCR_MEMTYPE_PGSZ_32 0x03000000 | ||
109 | /* 64 word */ | ||
110 | #define REG_UMI_TCR_MEMTYPE_PGSZ_64 0x04000000 | ||
111 | /* 128 word */ | ||
112 | #define REG_UMI_TCR_MEMTYPE_PGSZ_128 0x05000000 | ||
113 | /* 256 word */ | ||
114 | #define REG_UMI_TCR_MEMTYPE_PGSZ_256 0x06000000 | ||
115 | /* 512 word */ | ||
116 | #define REG_UMI_TCR_MEMTYPE_PGSZ_512 0x07000000 | ||
117 | /* Page read access cycle / Burst write latency (n+2 / n+1) */ | ||
118 | #define REG_UMI_TCR_TPRC_TWLC_MASK 0x00f80000 | ||
119 | /* Bus turnaround cycle (n) */ | ||
120 | #define REG_UMI_TCR_TBTA_MASK 0x00070000 | ||
121 | /* Write pulse width cycle (n+1) */ | ||
122 | #define REG_UMI_TCR_TWP_MASK 0x0000f800 | ||
123 | /* Write recovery cycle (n+1) */ | ||
124 | #define REG_UMI_TCR_TWR_MASK 0x00000600 | ||
125 | /* Write address setup cycle (n+1) */ | ||
126 | #define REG_UMI_TCR_TAS_MASK 0x00000180 | ||
127 | /* Output enable delay cycle (n) */ | ||
128 | #define REG_UMI_TCR_TOE_MASK 0x00000060 | ||
129 | /* Read access cycle / Burst read latency (n+2 / n+1) */ | ||
130 | #define REG_UMI_TCR_TRC_TLC_MASK 0x0000001f | ||
131 | |||
132 | /* REG_UMI_MMD_ICR bits */ | ||
133 | /* Flash write protection pin control */ | ||
134 | #define REG_UMI_MMD_ICR_FLASH_WP 0x8000 | ||
135 | /* Extend hold time for sram0, sram1 csn (39 MHz operation) */ | ||
136 | #define REG_UMI_MMD_ICR_XHCS 0x4000 | ||
137 | /* Enable SDRAM 2 interface control */ | ||
138 | #define REG_UMI_MMD_ICR_SDRAM2EN 0x2000 | ||
139 | /* Enable merge of flash banks 0/1 to 512 MBit bank */ | ||
140 | #define REG_UMI_MMD_ICR_INST512 0x1000 | ||
141 | /* Enable merge of flash banks 1/2 to 512 MBit bank */ | ||
142 | #define REG_UMI_MMD_ICR_DATA512 0x0800 | ||
143 | /* Enable SDRAM interface control */ | ||
144 | #define REG_UMI_MMD_ICR_SDRAMEN 0x0400 | ||
145 | /* Polarity of busy state of Burst Wait Signal */ | ||
146 | #define REG_UMI_MMD_ICR_WAITPOL 0x0200 | ||
147 | /* Enable burst clock stopped when not accessing external burst flash/sram */ | ||
148 | #define REG_UMI_MMD_ICR_BCLKSTOP 0x0100 | ||
149 | /* Enable the peri1_csn to replace flash1_csn in 512 Mb flash mode */ | ||
150 | #define REG_UMI_MMD_ICR_PERI1EN 0x0080 | ||
151 | /* Enable the peri2_csn to replace sdram_csn */ | ||
152 | #define REG_UMI_MMD_ICR_PERI2EN 0x0040 | ||
153 | /* Enable the peri3_csn to replace sdram2_csn */ | ||
154 | #define REG_UMI_MMD_ICR_PERI3EN 0x0020 | ||
155 | /* Enable sram bank1 for H/W controlled MRS */ | ||
156 | #define REG_UMI_MMD_ICR_MRSB1 0x0010 | ||
157 | /* Enable sram bank0 for H/W controlled MRS */ | ||
158 | #define REG_UMI_MMD_ICR_MRSB0 0x0008 | ||
159 | /* Polarity for assert3ed state of H/W controlled MRS */ | ||
160 | #define REG_UMI_MMD_ICR_MRSPOL 0x0004 | ||
161 | /* 0: S/W controllable ZZ/MRS/CRE/P-Mode pin */ | ||
162 | /* 1: H/W controlled ZZ/MRS/CRE/P-Mode, same timing as CS */ | ||
163 | #define REG_UMI_MMD_ICR_MRSMODE 0x0002 | ||
164 | /* MRS state for S/W controlled mode */ | ||
165 | #define REG_UMI_MMD_ICR_MRSSTATE 0x0001 | ||
166 | |||
167 | /* REG_UMI_NAND_TCR bits */ | ||
168 | /* Enable software to control CS */ | ||
169 | #define REG_UMI_NAND_TCR_CS_SWCTRL 0x80000000 | ||
170 | /* 16-bit nand wordsize if set */ | ||
171 | #define REG_UMI_NAND_TCR_WORD16 0x40000000 | ||
172 | /* Bus turnaround cycle (n) */ | ||
173 | #define REG_UMI_NAND_TCR_TBTA_MASK 0x00070000 | ||
174 | /* Write pulse width cycle (n+1) */ | ||
175 | #define REG_UMI_NAND_TCR_TWP_MASK 0x0000f800 | ||
176 | /* Write recovery cycle (n+1) */ | ||
177 | #define REG_UMI_NAND_TCR_TWR_MASK 0x00000600 | ||
178 | /* Write address setup cycle (n+1) */ | ||
179 | #define REG_UMI_NAND_TCR_TAS_MASK 0x00000180 | ||
180 | /* Output enable delay cycle (n) */ | ||
181 | #define REG_UMI_NAND_TCR_TOE_MASK 0x00000060 | ||
182 | /* Read access cycle (n+2) */ | ||
183 | #define REG_UMI_NAND_TCR_TRC_TLC_MASK 0x0000001f | ||
184 | |||
185 | /* REG_UMI_NAND_RCSR bits */ | ||
186 | /* Status: Ready=1, Busy=0 */ | ||
187 | #define REG_UMI_NAND_RCSR_RDY 0x02 | ||
188 | /* Keep CS asserted during operation */ | ||
189 | #define REG_UMI_NAND_RCSR_CS_ASSERTED 0x01 | ||
190 | |||
191 | /* REG_UMI_NAND_ECC_CSR bits */ | ||
192 | /* Interrupt status - read-only */ | ||
193 | #define REG_UMI_NAND_ECC_CSR_NANDINT 0x80000000 | ||
194 | /* Read: Status of ECC done, Write: clear ECC interrupt */ | ||
195 | #define REG_UMI_NAND_ECC_CSR_ECCINT_RAW 0x00800000 | ||
196 | /* Read: Status of R/B, Write: clear R/B interrupt */ | ||
197 | #define REG_UMI_NAND_ECC_CSR_RBINT_RAW 0x00400000 | ||
198 | /* 1 = Enable ECC Interrupt */ | ||
199 | #define REG_UMI_NAND_ECC_CSR_ECCINT_ENABLE 0x00008000 | ||
200 | /* 1 = Assert interrupt at rising edge of R/B_ */ | ||
201 | #define REG_UMI_NAND_ECC_CSR_RBINT_ENABLE 0x00004000 | ||
202 | /* Calculate ECC by 0=512 bytes, 1=256 bytes */ | ||
203 | #define REG_UMI_NAND_ECC_CSR_256BYTE 0x00000080 | ||
204 | /* Enable ECC in hardware */ | ||
205 | #define REG_UMI_NAND_ECC_CSR_ECC_ENABLE 0x00000001 | ||
206 | |||
207 | /* REG_UMI_BCH_CTRL_STATUS bits */ | ||
208 | /* Shift to Indicate Number of correctable errors detected */ | ||
209 | #define REG_UMI_BCH_CTRL_STATUS_NB_CORR_ERROR_SHIFT 20 | ||
210 | /* Indicate Number of correctable errors detected */ | ||
211 | #define REG_UMI_BCH_CTRL_STATUS_NB_CORR_ERROR 0x00F00000 | ||
212 | /* Indicate Errors detected during read but uncorrectable */ | ||
213 | #define REG_UMI_BCH_CTRL_STATUS_UNCORR_ERR 0x00080000 | ||
214 | /* Indicate Errors detected during read and are correctable */ | ||
215 | #define REG_UMI_BCH_CTRL_STATUS_CORR_ERR 0x00040000 | ||
216 | /* Flag indicates BCH's ECC status of read process are valid */ | ||
217 | #define REG_UMI_BCH_CTRL_STATUS_RD_ECC_VALID 0x00020000 | ||
218 | /* Flag indicates BCH's ECC status of write process are valid */ | ||
219 | #define REG_UMI_BCH_CTRL_STATUS_WR_ECC_VALID 0x00010000 | ||
220 | /* Pause ECC calculation */ | ||
221 | #define REG_UMI_BCH_CTRL_STATUS_PAUSE_ECC_DEC 0x00000010 | ||
222 | /* Enable Interrupt */ | ||
223 | #define REG_UMI_BCH_CTRL_STATUS_INT_EN 0x00000004 | ||
224 | /* Enable ECC during read */ | ||
225 | #define REG_UMI_BCH_CTRL_STATUS_ECC_RD_EN 0x00000002 | ||
226 | /* Enable ECC during write */ | ||
227 | #define REG_UMI_BCH_CTRL_STATUS_ECC_WR_EN 0x00000001 | ||
228 | /* Mask for location */ | ||
229 | #define REG_UMI_BCH_ERR_LOC_MASK 0x00001FFF | ||
230 | /* location within a byte */ | ||
231 | #define REG_UMI_BCH_ERR_LOC_BYTE 0x00000007 | ||
232 | /* location within a word */ | ||
233 | #define REG_UMI_BCH_ERR_LOC_WORD 0x00000018 | ||
234 | /* location within a page (512 byte) */ | ||
235 | #define REG_UMI_BCH_ERR_LOC_PAGE 0x00001FE0 | ||
236 | #define REG_UMI_BCH_ERR_LOC_ADDR(index) (readl(HW_UMI_BASE + 0x64 + (index / 2)*4) >> ((index % 2) * 16)) | ||
237 | #endif | ||
diff --git a/arch/arm/mach-bcmring/include/mach/timer.h b/arch/arm/mach-bcmring/include/mach/timer.h deleted file mode 100644 index 5a94bbb032b6..000000000000 --- a/arch/arm/mach-bcmring/include/mach/timer.h +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2004 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | /* | ||
16 | * | ||
17 | ***************************************************************************** | ||
18 | * | ||
19 | * timer.h | ||
20 | * | ||
21 | * PURPOSE: | ||
22 | * | ||
23 | * | ||
24 | * | ||
25 | * NOTES: | ||
26 | * | ||
27 | *****************************************************************************/ | ||
28 | |||
29 | #if !defined(BCM_LINUX_TIMER_H) | ||
30 | #define BCM_LINUX_TIMER_H | ||
31 | |||
32 | #if defined(__KERNEL__) | ||
33 | |||
34 | /* ---- Include Files ---------------------------------------------------- */ | ||
35 | /* ---- Constants and Types ---------------------------------------------- */ | ||
36 | |||
37 | typedef unsigned int timer_tick_count_t; | ||
38 | typedef unsigned int timer_tick_rate_t; | ||
39 | typedef unsigned int timer_msec_t; | ||
40 | |||
41 | /* ---- Variable Externs ------------------------------------------------- */ | ||
42 | /* ---- Function Prototypes ---------------------------------------------- */ | ||
43 | |||
44 | /**************************************************************************** | ||
45 | * | ||
46 | * timer_get_tick_count | ||
47 | * | ||
48 | * | ||
49 | ***************************************************************************/ | ||
50 | timer_tick_count_t timer_get_tick_count(void); | ||
51 | |||
52 | /**************************************************************************** | ||
53 | * | ||
54 | * timer_get_tick_rate | ||
55 | * | ||
56 | * | ||
57 | ***************************************************************************/ | ||
58 | timer_tick_rate_t timer_get_tick_rate(void); | ||
59 | |||
60 | /**************************************************************************** | ||
61 | * | ||
62 | * timer_get_msec | ||
63 | * | ||
64 | * | ||
65 | ***************************************************************************/ | ||
66 | timer_msec_t timer_get_msec(void); | ||
67 | |||
68 | /**************************************************************************** | ||
69 | * | ||
70 | * timer_ticks_to_msec | ||
71 | * | ||
72 | * | ||
73 | ***************************************************************************/ | ||
74 | timer_msec_t timer_ticks_to_msec(timer_tick_count_t ticks); | ||
75 | |||
76 | #endif /* __KERNEL__ */ | ||
77 | #endif /* BCM_LINUX_TIMER_H */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/timex.h b/arch/arm/mach-bcmring/include/mach/timex.h deleted file mode 100644 index 40d033ec5892..000000000000 --- a/arch/arm/mach-bcmring/include/mach/timex.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Integrator architecture timex specifications | ||
4 | * | ||
5 | * Copyright (C) 1999 ARM Limited | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * Specifies the number of ticks per second | ||
24 | */ | ||
25 | #define CLOCK_TICK_RATE 100000 /* REG_SMT_TICKS_PER_SEC */ | ||
diff --git a/arch/arm/mach-bcmring/include/mach/uncompress.h b/arch/arm/mach-bcmring/include/mach/uncompress.h deleted file mode 100644 index 9c9821b77977..000000000000 --- a/arch/arm/mach-bcmring/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2005 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | #include <mach/csp/mm_addr.h> | ||
15 | |||
16 | #define BCMRING_UART_0_DR (*(volatile unsigned int *)MM_ADDR_IO_UARTA) | ||
17 | #define BCMRING_UART_0_FR (*(volatile unsigned int *)(MM_ADDR_IO_UARTA + 0x18)) | ||
18 | /* | ||
19 | * This does not append a newline | ||
20 | */ | ||
21 | static inline void putc(int c) | ||
22 | { | ||
23 | /* Send out UARTA */ | ||
24 | while (BCMRING_UART_0_FR & (1 << 5)) | ||
25 | ; | ||
26 | |||
27 | BCMRING_UART_0_DR = c; | ||
28 | } | ||
29 | |||
30 | |||
31 | static inline void flush(void) | ||
32 | { | ||
33 | /* Wait for the tx fifo to be empty */ | ||
34 | while ((BCMRING_UART_0_FR & (1 << 7)) == 0) | ||
35 | ; | ||
36 | |||
37 | /* Wait for the final character to be sent on the txd line */ | ||
38 | while (BCMRING_UART_0_FR & (1 << 3)) | ||
39 | ; | ||
40 | } | ||
41 | |||
42 | #define arch_decomp_setup() | ||
43 | #define arch_decomp_wdog() | ||
diff --git a/arch/arm/mach-bcmring/irq.c b/arch/arm/mach-bcmring/irq.c deleted file mode 100644 index 437fa683bcb2..000000000000 --- a/arch/arm/mach-bcmring/irq.c +++ /dev/null | |||
@@ -1,126 +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 | #include <linux/init.h> | ||
20 | #include <linux/stddef.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/timer.h> | ||
23 | #include <linux/io.h> | ||
24 | |||
25 | #include <mach/hardware.h> | ||
26 | #include <asm/irq.h> | ||
27 | |||
28 | #include <asm/mach/irq.h> | ||
29 | #include <mach/csp/intcHw_reg.h> | ||
30 | #include <mach/csp/mm_io.h> | ||
31 | |||
32 | static void bcmring_mask_irq0(struct irq_data *d) | ||
33 | { | ||
34 | writel(1 << (d->irq - IRQ_INTC0_START), | ||
35 | MM_IO_BASE_INTC0 + INTCHW_INTENCLEAR); | ||
36 | } | ||
37 | |||
38 | static void bcmring_unmask_irq0(struct irq_data *d) | ||
39 | { | ||
40 | writel(1 << (d->irq - IRQ_INTC0_START), | ||
41 | MM_IO_BASE_INTC0 + INTCHW_INTENABLE); | ||
42 | } | ||
43 | |||
44 | static void bcmring_mask_irq1(struct irq_data *d) | ||
45 | { | ||
46 | writel(1 << (d->irq - IRQ_INTC1_START), | ||
47 | MM_IO_BASE_INTC1 + INTCHW_INTENCLEAR); | ||
48 | } | ||
49 | |||
50 | static void bcmring_unmask_irq1(struct irq_data *d) | ||
51 | { | ||
52 | writel(1 << (d->irq - IRQ_INTC1_START), | ||
53 | MM_IO_BASE_INTC1 + INTCHW_INTENABLE); | ||
54 | } | ||
55 | |||
56 | static void bcmring_mask_irq2(struct irq_data *d) | ||
57 | { | ||
58 | writel(1 << (d->irq - IRQ_SINTC_START), | ||
59 | MM_IO_BASE_SINTC + INTCHW_INTENCLEAR); | ||
60 | } | ||
61 | |||
62 | static void bcmring_unmask_irq2(struct irq_data *d) | ||
63 | { | ||
64 | writel(1 << (d->irq - IRQ_SINTC_START), | ||
65 | MM_IO_BASE_SINTC + INTCHW_INTENABLE); | ||
66 | } | ||
67 | |||
68 | static struct irq_chip bcmring_irq0_chip = { | ||
69 | .name = "ARM-INTC0", | ||
70 | .irq_ack = bcmring_mask_irq0, | ||
71 | .irq_mask = bcmring_mask_irq0, /* mask a specific interrupt, blocking its delivery. */ | ||
72 | .irq_unmask = bcmring_unmask_irq0, /* unmaks an interrupt */ | ||
73 | }; | ||
74 | |||
75 | static struct irq_chip bcmring_irq1_chip = { | ||
76 | .name = "ARM-INTC1", | ||
77 | .irq_ack = bcmring_mask_irq1, | ||
78 | .irq_mask = bcmring_mask_irq1, | ||
79 | .irq_unmask = bcmring_unmask_irq1, | ||
80 | }; | ||
81 | |||
82 | static struct irq_chip bcmring_irq2_chip = { | ||
83 | .name = "ARM-SINTC", | ||
84 | .irq_ack = bcmring_mask_irq2, | ||
85 | .irq_mask = bcmring_mask_irq2, | ||
86 | .irq_unmask = bcmring_unmask_irq2, | ||
87 | }; | ||
88 | |||
89 | static void vic_init(void __iomem *base, struct irq_chip *chip, | ||
90 | unsigned int irq_start, unsigned int vic_sources) | ||
91 | { | ||
92 | unsigned int i; | ||
93 | for (i = 0; i < 32; i++) { | ||
94 | unsigned int irq = irq_start + i; | ||
95 | irq_set_chip(irq, chip); | ||
96 | irq_set_chip_data(irq, base); | ||
97 | |||
98 | if (vic_sources & (1 << i)) { | ||
99 | irq_set_handler(irq, handle_level_irq); | ||
100 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
101 | } | ||
102 | } | ||
103 | writel(0, base + INTCHW_INTSELECT); | ||
104 | writel(0, base + INTCHW_INTENABLE); | ||
105 | writel(~0, base + INTCHW_INTENCLEAR); | ||
106 | writel(0, base + INTCHW_IRQSTATUS); | ||
107 | writel(~0, base + INTCHW_SOFTINTCLEAR); | ||
108 | } | ||
109 | |||
110 | void __init bcmring_init_irq(void) | ||
111 | { | ||
112 | vic_init((void __iomem *)MM_IO_BASE_INTC0, &bcmring_irq0_chip, | ||
113 | IRQ_INTC0_START, IRQ_INTC0_VALID_MASK); | ||
114 | vic_init((void __iomem *)MM_IO_BASE_INTC1, &bcmring_irq1_chip, | ||
115 | IRQ_INTC1_START, IRQ_INTC1_VALID_MASK); | ||
116 | vic_init((void __iomem *)MM_IO_BASE_SINTC, &bcmring_irq2_chip, | ||
117 | IRQ_SINTC_START, IRQ_SINTC_VALID_MASK); | ||
118 | |||
119 | /* special cases */ | ||
120 | if (INTCHW_INTC1_GPIO0 & IRQ_INTC1_VALID_MASK) { | ||
121 | irq_set_handler(IRQ_GPIO0, handle_simple_irq); | ||
122 | } | ||
123 | if (INTCHW_INTC1_GPIO1 & IRQ_INTC1_VALID_MASK) { | ||
124 | irq_set_handler(IRQ_GPIO1, handle_simple_irq); | ||
125 | } | ||
126 | } | ||
diff --git a/arch/arm/mach-bcmring/mm.c b/arch/arm/mach-bcmring/mm.c deleted file mode 100644 index 33824a81cac4..000000000000 --- a/arch/arm/mach-bcmring/mm.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/dma-mapping.h> | ||
17 | #include <asm/page.h> | ||
18 | #include <asm/mach/map.h> | ||
19 | |||
20 | #include <mach/hardware.h> | ||
21 | #include <mach/csp/mm_io.h> | ||
22 | |||
23 | #define IO_DESC(va, sz) { .virtual = (unsigned long)va, \ | ||
24 | .pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \ | ||
25 | .length = sz, \ | ||
26 | .type = MT_DEVICE } | ||
27 | |||
28 | #define MEM_DESC(va, sz) { .virtual = (unsigned long)va, \ | ||
29 | .pfn = __phys_to_pfn(HW_IO_VIRT_TO_PHYS(va)), \ | ||
30 | .length = sz, \ | ||
31 | .type = MT_MEMORY } | ||
32 | |||
33 | static struct map_desc bcmring_io_desc[] __initdata = { | ||
34 | IO_DESC(MM_IO_BASE_NAND, SZ_64K), /* phys:0x28000000-0x28000FFF virt:0xE8000000-0xE8000FFF size:0x00010000 */ | ||
35 | IO_DESC(MM_IO_BASE_UMI, SZ_64K), /* phys:0x2C000000-0x2C000FFF virt:0xEC000000-0xEC000FFF size:0x00010000 */ | ||
36 | |||
37 | IO_DESC(MM_IO_BASE_BROM, SZ_64K), /* phys:0x30000000-0x3000FFFF virt:0xF3000000-0xF300FFFF size:0x00010000 */ | ||
38 | MEM_DESC(MM_IO_BASE_ARAM, SZ_1M), /* phys:0x31000000-0x31FFFFFF virt:0xF3100000-0xF31FFFFF size:0x01000000 */ | ||
39 | IO_DESC(MM_IO_BASE_DMA0, SZ_1M), /* phys:0x32000000-0x32FFFFFF virt:0xF3200000-0xF32FFFFF size:0x01000000 */ | ||
40 | IO_DESC(MM_IO_BASE_DMA1, SZ_1M), /* phys:0x33000000-0x33FFFFFF virt:0xF3300000-0xF33FFFFF size:0x01000000 */ | ||
41 | IO_DESC(MM_IO_BASE_ESW, SZ_1M), /* phys:0x34000000-0x34FFFFFF virt:0xF3400000-0xF34FFFFF size:0x01000000 */ | ||
42 | IO_DESC(MM_IO_BASE_CLCD, SZ_1M), /* phys:0x35000000-0x35FFFFFF virt:0xF3500000-0xF35FFFFF size:0x01000000 */ | ||
43 | IO_DESC(MM_IO_BASE_APM, SZ_1M), /* phys:0x36000000-0x36FFFFFF virt:0xF3600000-0xF36FFFFF size:0x01000000 */ | ||
44 | IO_DESC(MM_IO_BASE_SPUM, SZ_1M), /* phys:0x37000000-0x37FFFFFF virt:0xF3700000-0xF37FFFFF size:0x01000000 */ | ||
45 | IO_DESC(MM_IO_BASE_VPM_PROG, SZ_1M), /* phys:0x38000000-0x38FFFFFF virt:0xF3800000-0xF38FFFFF size:0x01000000 */ | ||
46 | IO_DESC(MM_IO_BASE_VPM_DATA, SZ_1M), /* phys:0x3A000000-0x3AFFFFFF virt:0xF3A00000-0xF3AFFFFF size:0x01000000 */ | ||
47 | |||
48 | IO_DESC(MM_IO_BASE_VRAM, SZ_64K), /* phys:0x40000000-0x4000FFFF virt:0xF4000000-0xF400FFFF size:0x00010000 */ | ||
49 | IO_DESC(MM_IO_BASE_CHIPC, SZ_16M), /* phys:0x80000000-0x80FFFFFF virt:0xF8000000-0xF8FFFFFF size:0x01000000 */ | ||
50 | IO_DESC(MM_IO_BASE_VPM_EXTMEM_RSVD, | ||
51 | SZ_16M), /* phys:0x0F000000-0x0FFFFFFF virt:0xF0000000-0xF0FFFFFF size:0x01000000 */ | ||
52 | }; | ||
53 | |||
54 | void __init bcmring_map_io(void) | ||
55 | { | ||
56 | |||
57 | iotable_init(bcmring_io_desc, ARRAY_SIZE(bcmring_io_desc)); | ||
58 | /* Maximum DMA memory allowed is 14M */ | ||
59 | init_consistent_dma_size(14 << 20); | ||
60 | } | ||
diff --git a/arch/arm/mach-bcmring/timer.c b/arch/arm/mach-bcmring/timer.c deleted file mode 100644 index 59412903466e..000000000000 --- a/arch/arm/mach-bcmring/timer.c +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. | ||
3 | * | ||
4 | * Unless you and Broadcom execute a separate written software license | ||
5 | * agreement governing use of this software, this software is licensed to you | ||
6 | * under the terms of the GNU General Public License version 2, available at | ||
7 | * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). | ||
8 | * | ||
9 | * Notwithstanding the above, under no circumstances may you combine this | ||
10 | * software in any way with any other Broadcom software provided under a | ||
11 | * license other than the GPL, without Broadcom's express prior written | ||
12 | * consent. | ||
13 | *****************************************************************************/ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <mach/csp/tmrHw.h> | ||
18 | |||
19 | #include <mach/timer.h> | ||
20 | /* The core.c file initializes timers 1 and 3 as a linux clocksource. */ | ||
21 | /* The real time clock should probably be the real linux clocksource. */ | ||
22 | /* In the meantime, this file should agree with core.c as to the */ | ||
23 | /* profiling timer. If the clocksource is moved to rtc later, then */ | ||
24 | /* we can init the profiling timer here instead. */ | ||
25 | |||
26 | /* Timer 1 provides 25MHz resolution syncrhonized to scheduling and APM timing */ | ||
27 | /* Timer 3 provides bus freqeuncy sychronized to ACLK, but spread spectrum will */ | ||
28 | /* affect synchronization with scheduling and APM timing. */ | ||
29 | |||
30 | #define PROF_TIMER 1 | ||
31 | |||
32 | timer_tick_rate_t timer_get_tick_rate(void) | ||
33 | { | ||
34 | return tmrHw_getCountRate(PROF_TIMER); | ||
35 | } | ||
36 | |||
37 | timer_tick_count_t timer_get_tick_count(void) | ||
38 | { | ||
39 | return tmrHw_GetCurrentCount(PROF_TIMER); /* change downcounter to upcounter */ | ||
40 | } | ||
41 | |||
42 | timer_msec_t timer_ticks_to_msec(timer_tick_count_t ticks) | ||
43 | { | ||
44 | static int tickRateMsec; | ||
45 | |||
46 | if (tickRateMsec == 0) { | ||
47 | tickRateMsec = timer_get_tick_rate() / 1000; | ||
48 | } | ||
49 | |||
50 | return ticks / tickRateMsec; | ||
51 | } | ||
52 | |||
53 | timer_msec_t timer_get_msec(void) | ||
54 | { | ||
55 | return timer_ticks_to_msec(timer_get_tick_count()); | ||
56 | } | ||
57 | |||
58 | EXPORT_SYMBOL(timer_get_tick_count); | ||
59 | EXPORT_SYMBOL(timer_ticks_to_msec); | ||
60 | EXPORT_SYMBOL(timer_get_tick_rate); | ||
61 | EXPORT_SYMBOL(timer_get_msec); | ||
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index ea036d621581..e6135363765a 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig | |||
@@ -16,12 +16,6 @@ config ARCH_CDB89712 | |||
16 | The board includes 2 serial ports, Ethernet, IRDA, and expansion | 16 | The board includes 2 serial ports, Ethernet, IRDA, and expansion |
17 | headers. It comes with 16 MB SDRAM and 8 MB flash ROM. | 17 | headers. It comes with 16 MB SDRAM and 8 MB flash ROM. |
18 | 18 | ||
19 | config ARCH_CEIVA | ||
20 | bool "CEIVA" | ||
21 | help | ||
22 | Say Y here if you intend to run this kernel on the Ceiva/Polaroid | ||
23 | PhotoMax Digital Picture Frame. | ||
24 | |||
25 | config ARCH_CLEP7312 | 19 | config ARCH_CLEP7312 |
26 | bool "CLEP7312" | 20 | bool "CLEP7312" |
27 | help | 21 | help |
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index f2f0256232e3..6da6940b3656 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile | |||
@@ -9,12 +9,9 @@ obj-m := | |||
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
11 | 11 | ||
12 | obj-$(CONFIG_ARCH_CEIVA) += ceiva.o | ||
13 | obj-$(CONFIG_ARCH_AUTCPU12) += autcpu12.o | 12 | obj-$(CONFIG_ARCH_AUTCPU12) += autcpu12.o |
14 | obj-$(CONFIG_ARCH_CDB89712) += cdb89712.o | 13 | obj-$(CONFIG_ARCH_CDB89712) += cdb89712.o |
15 | obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o | 14 | obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o |
16 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o | 15 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o |
17 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o | 16 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o |
18 | obj-$(CONFIG_ARCH_P720T) += p720t.o | 17 | obj-$(CONFIG_ARCH_P720T) += p720t.o |
19 | leds-$(CONFIG_ARCH_P720T) += p720t-leds.o | ||
20 | obj-$(CONFIG_LEDS) += $(leds-y) | ||
diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c deleted file mode 100644 index a70147e347ac..000000000000 --- a/arch/arm/mach-clps711x/ceiva.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-clps711x/arch-ceiva.c | ||
3 | * | ||
4 | * Copyright (C) 2002, Rob Scott <rscott@mtrob.fdns.net> | ||
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 | #include <linux/init.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/string.h> | ||
23 | |||
24 | #include <asm/setup.h> | ||
25 | #include <asm/mach-types.h> | ||
26 | #include <asm/mach/arch.h> | ||
27 | |||
28 | #include <linux/kernel.h> | ||
29 | |||
30 | #include <mach/hardware.h> | ||
31 | #include <asm/page.h> | ||
32 | #include <asm/pgtable.h> | ||
33 | #include <asm/sizes.h> | ||
34 | |||
35 | #include <asm/mach/map.h> | ||
36 | |||
37 | #include "common.h" | ||
38 | |||
39 | static struct map_desc ceiva_io_desc[] __initdata = { | ||
40 | /* SED1355 controlled video RAM & registers */ | ||
41 | { | ||
42 | .virtual = CEIVA_VIRT_SED1355, | ||
43 | .pfn = __phys_to_pfn(CEIVA_PHYS_SED1355), | ||
44 | .length = SZ_2M, | ||
45 | .type = MT_DEVICE | ||
46 | } | ||
47 | }; | ||
48 | |||
49 | |||
50 | static void __init ceiva_map_io(void) | ||
51 | { | ||
52 | clps711x_map_io(); | ||
53 | iotable_init(ceiva_io_desc, ARRAY_SIZE(ceiva_io_desc)); | ||
54 | } | ||
55 | |||
56 | |||
57 | MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") | ||
58 | /* Maintainer: Rob Scott */ | ||
59 | .atag_offset = 0x100, | ||
60 | .map_io = ceiva_map_io, | ||
61 | .init_irq = clps711x_init_irq, | ||
62 | .timer = &clps711x_timer, | ||
63 | .restart = clps711x_restart, | ||
64 | MACHINE_END | ||
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c index f15293bd7974..509243d89a32 100644 --- a/arch/arm/mach-clps711x/common.c +++ b/arch/arm/mach-clps711x/common.c | |||
@@ -19,24 +19,25 @@ | |||
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | #include <linux/kernel.h> | 22 | #include <linux/io.h> |
23 | #include <linux/mm.h> | ||
24 | #include <linux/init.h> | 23 | #include <linux/init.h> |
25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
26 | #include <linux/io.h> | ||
27 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
28 | #include <linux/sched.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/clkdev.h> | ||
28 | #include <linux/clk-provider.h> | ||
29 | 29 | ||
30 | #include <asm/sizes.h> | 30 | #include <asm/sizes.h> |
31 | #include <mach/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/leds.h> | ||
34 | #include <asm/pgtable.h> | ||
35 | #include <asm/page.h> | ||
36 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
37 | #include <asm/mach/time.h> | 32 | #include <asm/mach/time.h> |
38 | #include <asm/system_misc.h> | 33 | #include <asm/system_misc.h> |
39 | 34 | ||
35 | #include <mach/hardware.h> | ||
36 | |||
37 | static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh, | ||
38 | *clk_tint, *clk_spi; | ||
39 | static unsigned long latch; | ||
40 | |||
40 | /* | 41 | /* |
41 | * This maps the generic CLPS711x registers | 42 | * This maps the generic CLPS711x registers |
42 | */ | 43 | */ |
@@ -166,8 +167,8 @@ void __init clps711x_init_irq(void) | |||
166 | static unsigned long clps711x_gettimeoffset(void) | 167 | static unsigned long clps711x_gettimeoffset(void) |
167 | { | 168 | { |
168 | unsigned long hwticks; | 169 | unsigned long hwticks; |
169 | hwticks = LATCH - (clps_readl(TC2D) & 0xffff); /* since last underflow */ | 170 | hwticks = latch - (clps_readl(TC2D) & 0xffff); |
170 | return (hwticks * (tick_nsec / 1000)) / LATCH; | 171 | return (hwticks * (tick_nsec / 1000)) / latch; |
171 | } | 172 | } |
172 | 173 | ||
173 | /* | 174 | /* |
@@ -185,15 +186,71 @@ static struct irqaction clps711x_timer_irq = { | |||
185 | .handler = p720t_timer_interrupt, | 186 | .handler = p720t_timer_interrupt, |
186 | }; | 187 | }; |
187 | 188 | ||
189 | static void add_fixed_clk(struct clk *clk, const char *name, int rate) | ||
190 | { | ||
191 | clk = clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate); | ||
192 | clk_register_clkdev(clk, name, NULL); | ||
193 | } | ||
194 | |||
188 | static void __init clps711x_timer_init(void) | 195 | static void __init clps711x_timer_init(void) |
189 | { | 196 | { |
190 | unsigned int syscon; | 197 | int osc, ext, pll, cpu, bus, timl, timh, uart, spi; |
198 | u32 tmp; | ||
199 | |||
200 | osc = 3686400; | ||
201 | ext = 13000000; | ||
202 | |||
203 | tmp = clps_readl(PLLR) >> 24; | ||
204 | if (tmp) | ||
205 | pll = (osc * tmp) / 2; | ||
206 | else | ||
207 | pll = 73728000; /* Default value */ | ||
208 | |||
209 | tmp = clps_readl(SYSFLG2); | ||
210 | if (tmp & SYSFLG2_CKMODE) { | ||
211 | cpu = ext; | ||
212 | bus = cpu; | ||
213 | spi = 135400; | ||
214 | } else { | ||
215 | cpu = pll; | ||
216 | if (cpu >= 36864000) | ||
217 | bus = cpu / 2; | ||
218 | else | ||
219 | bus = 36864000 / 2; | ||
220 | spi = cpu / 576; | ||
221 | } | ||
222 | |||
223 | uart = bus / 10; | ||
224 | |||
225 | if (tmp & SYSFLG2_CKMODE) { | ||
226 | tmp = clps_readl(SYSCON2); | ||
227 | if (tmp & SYSCON2_OSTB) | ||
228 | timh = ext / 26; | ||
229 | else | ||
230 | timh = 541440; | ||
231 | } else | ||
232 | timh = cpu / 144; | ||
233 | |||
234 | timl = timh / 256; | ||
235 | |||
236 | /* All clocks are fixed */ | ||
237 | add_fixed_clk(clk_pll, "pll", pll); | ||
238 | add_fixed_clk(clk_bus, "bus", bus); | ||
239 | add_fixed_clk(clk_uart, "uart", uart); | ||
240 | add_fixed_clk(clk_timerl, "timer_lf", timl); | ||
241 | add_fixed_clk(clk_timerh, "timer_hf", timh); | ||
242 | add_fixed_clk(clk_tint, "tint", 64); | ||
243 | add_fixed_clk(clk_spi, "spi", spi); | ||
244 | |||
245 | pr_info("CPU frequency set at %i Hz.\n", cpu); | ||
246 | |||
247 | latch = (timh + HZ / 2) / HZ; | ||
191 | 248 | ||
192 | syscon = clps_readl(SYSCON1); | 249 | tmp = clps_readl(SYSCON1); |
193 | syscon |= SYSCON1_TC2S | SYSCON1_TC2M; | 250 | tmp |= SYSCON1_TC2S | SYSCON1_TC2M; |
194 | clps_writel(syscon, SYSCON1); | 251 | clps_writel(tmp, SYSCON1); |
195 | 252 | ||
196 | clps_writel(LATCH-1, TC2D); /* 512kHz / 100Hz - 1 */ | 253 | clps_writel(latch - 1, TC2D); |
197 | 254 | ||
198 | setup_irq(IRQ_TC2OI, &clps711x_timer_irq); | 255 | setup_irq(IRQ_TC2OI, &clps711x_timer_irq); |
199 | } | 256 | } |
diff --git a/arch/arm/mach-clps711x/include/mach/clps711x.h b/arch/arm/mach-clps711x/include/mach/clps711x.h index 1dd806f2847e..c82e21ca49c7 100644 --- a/arch/arm/mach-clps711x/include/mach/clps711x.h +++ b/arch/arm/mach-clps711x/include/mach/clps711x.h | |||
@@ -31,8 +31,8 @@ | |||
31 | #define PBDDR (0x0041) | 31 | #define PBDDR (0x0041) |
32 | #define PCDDR (0x0042) | 32 | #define PCDDR (0x0042) |
33 | #define PDDDR (0x0043) | 33 | #define PDDDR (0x0043) |
34 | #define PEDR (0x0080) | 34 | #define PEDR (0x0083) |
35 | #define PEDDR (0x00c0) | 35 | #define PEDDR (0x00c3) |
36 | #define SYSCON1 (0x0100) | 36 | #define SYSCON1 (0x0100) |
37 | #define SYSFLG1 (0x0140) | 37 | #define SYSFLG1 (0x0140) |
38 | #define MEMCFG1 (0x0180) | 38 | #define MEMCFG1 (0x0180) |
@@ -77,7 +77,7 @@ | |||
77 | #define KBDEOI (0x1700) | 77 | #define KBDEOI (0x1700) |
78 | 78 | ||
79 | #define DAIR (0x2000) | 79 | #define DAIR (0x2000) |
80 | #define DAIR0 (0x2040) | 80 | #define DAIDR0 (0x2040) |
81 | #define DAIDR1 (0x2080) | 81 | #define DAIDR1 (0x2080) |
82 | #define DAIDR2 (0x20c0) | 82 | #define DAIDR2 (0x20c0) |
83 | #define DAISR (0x2100) | 83 | #define DAISR (0x2100) |
@@ -191,8 +191,7 @@ | |||
191 | #define UBRLCR_WRDLEN8 (3 << 17) | 191 | #define UBRLCR_WRDLEN8 (3 << 17) |
192 | #define UBRLCR_WRDLEN_MASK (3 << 17) | 192 | #define UBRLCR_WRDLEN_MASK (3 << 17) |
193 | 193 | ||
194 | #define SYNCIO_FRMLEN(x) (((x) & 0x3f) << 7) | 194 | #define SYNCIO_FRMLEN(x) (((x) & 0x1f) << 8) |
195 | #define SYNCIO_CFGLEN(x) ((x) & 0x7f) | ||
196 | #define SYNCIO_SMCKEN (1 << 13) | 195 | #define SYNCIO_SMCKEN (1 << 13) |
197 | #define SYNCIO_TXFRMEN (1 << 14) | 196 | #define SYNCIO_TXFRMEN (1 << 14) |
198 | 197 | ||
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S index 118b3d930573..cb3684f8dae0 100644 --- a/arch/arm/mach-clps711x/include/mach/debug-macro.S +++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S | |||
@@ -28,17 +28,11 @@ | |||
28 | .endm | 28 | .endm |
29 | 29 | ||
30 | .macro waituart,rd,rx | 30 | .macro waituart,rd,rx |
31 | 1001: ldr \rd, [\rx, #0x0140] @ SYSFLGx | ||
32 | tst \rd, #1 << 11 @ UBUSYx | ||
33 | bne 1001b | ||
34 | .endm | 31 | .endm |
35 | 32 | ||
36 | .macro busyuart,rd,rx | 33 | .macro busyuart,rd,rx |
37 | tst \rx, #0x1000 @ UART2 does not have CTS here | ||
38 | bne 1002f | ||
39 | 1001: ldr \rd, [\rx, #0x0140] @ SYSFLGx | 34 | 1001: ldr \rd, [\rx, #0x0140] @ SYSFLGx |
40 | tst \rd, #1 << 8 @ CTS | 35 | tst \rd, #1 << 11 @ UBUSYx |
41 | bne 1001b | 36 | bne 1001b |
42 | 1002: | ||
43 | .endm | 37 | .endm |
44 | 38 | ||
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h index 13a64fcd7dd1..8497775d6ee5 100644 --- a/arch/arm/mach-clps711x/include/mach/hardware.h +++ b/arch/arm/mach-clps711x/include/mach/hardware.h | |||
@@ -116,7 +116,6 @@ | |||
116 | 116 | ||
117 | #endif /* CONFIG_ARCH_EDB7211 */ | 117 | #endif /* CONFIG_ARCH_EDB7211 */ |
118 | 118 | ||
119 | |||
120 | /* | 119 | /* |
121 | * Relevant bits in port D, which controls power to the various parts of | 120 | * Relevant bits in port D, which controls power to the various parts of |
122 | * the LCD on the EDB7211. | 121 | * the LCD on the EDB7211. |
@@ -125,51 +124,4 @@ | |||
125 | #define EDB_PD2_LCDEN (1<<2) | 124 | #define EDB_PD2_LCDEN (1<<2) |
126 | #define EDB_PD3_LCDBL (1<<3) | 125 | #define EDB_PD3_LCDBL (1<<3) |
127 | 126 | ||
128 | |||
129 | #if defined (CONFIG_ARCH_CEIVA) | ||
130 | |||
131 | /* | ||
132 | * The two flash banks are wired to chip selects 0 and 1. This is the mapping | ||
133 | * for them. | ||
134 | * | ||
135 | * nCS0 and nCS1 are at 0x70000000 and 0x60000000, respectively, when running | ||
136 | * in jumpered boot mode. | ||
137 | */ | ||
138 | #define CEIVA_PHYS_FLASH1 CS0_PHYS_BASE /* physical */ | ||
139 | #define CEIVA_PHYS_FLASH2 CS1_PHYS_BASE /* physical */ | ||
140 | |||
141 | #define CEIVA_VIRT_FLASH1 (0xfa000000) /* virtual */ | ||
142 | #define CEIVA_VIRT_FLASH2 (0xfb000000) /* virtual */ | ||
143 | |||
144 | #define CEIVA_FLASH_SIZE 0x100000 | ||
145 | #define CEIVA_FLASH_WIDTH 2 | ||
146 | |||
147 | /* | ||
148 | * SED1355 LCD controller | ||
149 | */ | ||
150 | #define CEIVA_PHYS_SED1355 CS2_PHYS_BASE | ||
151 | #define CEIVA_VIRT_SED1355 (0xfc000000) | ||
152 | |||
153 | /* | ||
154 | * Relevant bits in port D, which controls power to the various parts of | ||
155 | * the LCD on the Ceiva Photo Max, and reset to the LCD controller. | ||
156 | */ | ||
157 | |||
158 | // Reset line to SED1355 (must be high to operate) | ||
159 | #define CEIVA_PD1_LCDRST (1<<1) | ||
160 | // LCD panel enable (set to one, to enable LCD) | ||
161 | #define CEIVA_PD4_LCDEN (1<<4) | ||
162 | // Backlight (set to one, to turn on backlight | ||
163 | #define CEIVA_PD5_LCDBL (1<<5) | ||
164 | |||
165 | /* | ||
166 | * Relevant bits in port B, which report the status of the buttons. | ||
167 | */ | ||
168 | |||
169 | // White button | ||
170 | #define CEIVA_PB4_WHT_BTN (1<<4) | ||
171 | // Black button | ||
172 | #define CEIVA_PB0_BLK_BTN (1<<0) | ||
173 | #endif // #if defined (CONFIG_ARCH_CEIVA) | ||
174 | |||
175 | #endif | 127 | #endif |
diff --git a/arch/arm/mach-clps711x/include/mach/timex.h b/arch/arm/mach-clps711x/include/mach/timex.h index ac8823ccff93..de6fd192d1c3 100644 --- a/arch/arm/mach-clps711x/include/mach/timex.h +++ b/arch/arm/mach-clps711x/include/mach/timex.h | |||
@@ -1,23 +1,2 @@ | |||
1 | /* | 1 | /* Bogus value */ |
2 | * arch/arm/mach-clps711x/include/mach/timex.h | ||
3 | * | ||
4 | * Prospector 720T architecture timex specifications | ||
5 | * | ||
6 | * Copyright (C) 2000 Deep Blue Solutions Ltd. | ||
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 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #define CLOCK_TICK_RATE 512000 | 2 | #define CLOCK_TICK_RATE 512000 |
diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c deleted file mode 100644 index bbc449fbe14a..000000000000 --- a/arch/arm/mach-clps711x/p720t-leds.c +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-clps711x/leds.c | ||
3 | * | ||
4 | * Integrator LED control routines | ||
5 | * | ||
6 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
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 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <mach/hardware.h> | ||
27 | #include <asm/leds.h> | ||
28 | #include <asm/mach-types.h> | ||
29 | |||
30 | static void p720t_leds_event(led_event_t ledevt) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | u32 pddr; | ||
34 | |||
35 | local_irq_save(flags); | ||
36 | switch(ledevt) { | ||
37 | case led_idle_start: | ||
38 | break; | ||
39 | |||
40 | case led_idle_end: | ||
41 | break; | ||
42 | |||
43 | case led_timer: | ||
44 | pddr = clps_readb(PDDR); | ||
45 | clps_writeb(pddr ^ 1, PDDR); | ||
46 | break; | ||
47 | |||
48 | default: | ||
49 | break; | ||
50 | } | ||
51 | |||
52 | local_irq_restore(flags); | ||
53 | } | ||
54 | |||
55 | static int __init leds_init(void) | ||
56 | { | ||
57 | if (machine_is_p720t()) | ||
58 | leds_event = p720t_leds_event; | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | arch_initcall(leds_init); | ||
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index f266d90b9efc..b752b586fc2f 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/slab.h> | ||
27 | #include <linux/leds.h> | ||
26 | 28 | ||
27 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
28 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
@@ -34,6 +36,8 @@ | |||
34 | #include <asm/mach/map.h> | 36 | #include <asm/mach/map.h> |
35 | #include <mach/syspld.h> | 37 | #include <mach/syspld.h> |
36 | 38 | ||
39 | #include <asm/hardware/clps7111.h> | ||
40 | |||
37 | #include "common.h" | 41 | #include "common.h" |
38 | 42 | ||
39 | /* | 43 | /* |
@@ -107,6 +111,64 @@ static void __init p720t_init_early(void) | |||
107 | } | 111 | } |
108 | } | 112 | } |
109 | 113 | ||
114 | /* | ||
115 | * LED controled by CPLD | ||
116 | */ | ||
117 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
118 | static void p720t_led_set(struct led_classdev *cdev, | ||
119 | enum led_brightness b) | ||
120 | { | ||
121 | u8 reg = clps_readb(PDDR); | ||
122 | |||
123 | if (b != LED_OFF) | ||
124 | reg |= 0x1; | ||
125 | else | ||
126 | reg &= ~0x1; | ||
127 | |||
128 | clps_writeb(reg, PDDR); | ||
129 | } | ||
130 | |||
131 | static enum led_brightness p720t_led_get(struct led_classdev *cdev) | ||
132 | { | ||
133 | u8 reg = clps_readb(PDDR); | ||
134 | |||
135 | return (reg & 0x1) ? LED_FULL : LED_OFF; | ||
136 | } | ||
137 | |||
138 | static int __init p720t_leds_init(void) | ||
139 | { | ||
140 | |||
141 | struct led_classdev *cdev; | ||
142 | int ret; | ||
143 | |||
144 | if (!machine_is_p720t()) | ||
145 | return -ENODEV; | ||
146 | |||
147 | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); | ||
148 | if (!cdev) | ||
149 | return -ENOMEM; | ||
150 | |||
151 | cdev->name = "p720t:0"; | ||
152 | cdev->brightness_set = p720t_led_set; | ||
153 | cdev->brightness_get = p720t_led_get; | ||
154 | cdev->default_trigger = "heartbeat"; | ||
155 | |||
156 | ret = led_classdev_register(NULL, cdev); | ||
157 | if (ret < 0) { | ||
158 | kfree(cdev); | ||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * Since we may have triggers on any subsystem, defer registration | ||
167 | * until after subsystem_init. | ||
168 | */ | ||
169 | fs_initcall(p720t_leds_init); | ||
170 | #endif | ||
171 | |||
110 | MACHINE_START(P720T, "ARM-Prospector720T") | 172 | MACHINE_START(P720T, "ARM-Prospector720T") |
111 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ | 173 | /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ |
112 | .atag_offset = 0x100, | 174 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c index ac4e003ad863..be3099733b1f 100644 --- a/arch/arm/mach-davinci/board-tnetv107x-evm.c +++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c | |||
@@ -88,7 +88,7 @@ static struct davinci_mmc_config mmc_config = { | |||
88 | .version = MMC_CTLR_VERSION_1, | 88 | .version = MMC_CTLR_VERSION_1, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | static const short sdio1_pins[] __initdata = { | 91 | static const short sdio1_pins[] __initconst = { |
92 | TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1, | 92 | TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1, |
93 | TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1, | 93 | TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1, |
94 | TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1, | 94 | TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1, |
@@ -96,12 +96,12 @@ static const short sdio1_pins[] __initdata = { | |||
96 | -1 | 96 | -1 |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static const short uart1_pins[] __initdata = { | 99 | static const short uart1_pins[] __initconst = { |
100 | TNETV107X_UART1_RD, TNETV107X_UART1_TD, | 100 | TNETV107X_UART1_RD, TNETV107X_UART1_TD, |
101 | -1 | 101 | -1 |
102 | }; | 102 | }; |
103 | 103 | ||
104 | static const short ssp_pins[] __initdata = { | 104 | static const short ssp_pins[] __initconst = { |
105 | TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2, | 105 | TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2, |
106 | TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2, | 106 | TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2, |
107 | TNETV107X_SSP1_3, -1 | 107 | TNETV107X_SSP1_3, -1 |
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index deee5c2da754..510648e0394b 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c | |||
@@ -838,7 +838,7 @@ static const struct mux_config da830_pins[] = { | |||
838 | #endif | 838 | #endif |
839 | }; | 839 | }; |
840 | 840 | ||
841 | const short da830_emif25_pins[] __initdata = { | 841 | const short da830_emif25_pins[] __initconst = { |
842 | DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3, | 842 | DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3, |
843 | DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7, | 843 | DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7, |
844 | DA830_EMA_D_8, DA830_EMA_D_9, DA830_EMA_D_10, DA830_EMA_D_11, | 844 | DA830_EMA_D_8, DA830_EMA_D_9, DA830_EMA_D_10, DA830_EMA_D_11, |
@@ -853,19 +853,19 @@ const short da830_emif25_pins[] __initdata = { | |||
853 | -1 | 853 | -1 |
854 | }; | 854 | }; |
855 | 855 | ||
856 | const short da830_spi0_pins[] __initdata = { | 856 | const short da830_spi0_pins[] __initconst = { |
857 | DA830_SPI0_SOMI_0, DA830_SPI0_SIMO_0, DA830_SPI0_CLK, DA830_NSPI0_ENA, | 857 | DA830_SPI0_SOMI_0, DA830_SPI0_SIMO_0, DA830_SPI0_CLK, DA830_NSPI0_ENA, |
858 | DA830_NSPI0_SCS_0, | 858 | DA830_NSPI0_SCS_0, |
859 | -1 | 859 | -1 |
860 | }; | 860 | }; |
861 | 861 | ||
862 | const short da830_spi1_pins[] __initdata = { | 862 | const short da830_spi1_pins[] __initconst = { |
863 | DA830_SPI1_SOMI_0, DA830_SPI1_SIMO_0, DA830_SPI1_CLK, DA830_NSPI1_ENA, | 863 | DA830_SPI1_SOMI_0, DA830_SPI1_SIMO_0, DA830_SPI1_CLK, DA830_NSPI1_ENA, |
864 | DA830_NSPI1_SCS_0, | 864 | DA830_NSPI1_SCS_0, |
865 | -1 | 865 | -1 |
866 | }; | 866 | }; |
867 | 867 | ||
868 | const short da830_mmc_sd_pins[] __initdata = { | 868 | const short da830_mmc_sd_pins[] __initconst = { |
869 | DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2, | 869 | DA830_MMCSD_DAT_0, DA830_MMCSD_DAT_1, DA830_MMCSD_DAT_2, |
870 | DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5, | 870 | DA830_MMCSD_DAT_3, DA830_MMCSD_DAT_4, DA830_MMCSD_DAT_5, |
871 | DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK, | 871 | DA830_MMCSD_DAT_6, DA830_MMCSD_DAT_7, DA830_MMCSD_CLK, |
@@ -873,32 +873,32 @@ const short da830_mmc_sd_pins[] __initdata = { | |||
873 | -1 | 873 | -1 |
874 | }; | 874 | }; |
875 | 875 | ||
876 | const short da830_uart0_pins[] __initdata = { | 876 | const short da830_uart0_pins[] __initconst = { |
877 | DA830_NUART0_CTS, DA830_NUART0_RTS, DA830_UART0_RXD, DA830_UART0_TXD, | 877 | DA830_NUART0_CTS, DA830_NUART0_RTS, DA830_UART0_RXD, DA830_UART0_TXD, |
878 | -1 | 878 | -1 |
879 | }; | 879 | }; |
880 | 880 | ||
881 | const short da830_uart1_pins[] __initdata = { | 881 | const short da830_uart1_pins[] __initconst = { |
882 | DA830_UART1_RXD, DA830_UART1_TXD, | 882 | DA830_UART1_RXD, DA830_UART1_TXD, |
883 | -1 | 883 | -1 |
884 | }; | 884 | }; |
885 | 885 | ||
886 | const short da830_uart2_pins[] __initdata = { | 886 | const short da830_uart2_pins[] __initconst = { |
887 | DA830_UART2_RXD, DA830_UART2_TXD, | 887 | DA830_UART2_RXD, DA830_UART2_TXD, |
888 | -1 | 888 | -1 |
889 | }; | 889 | }; |
890 | 890 | ||
891 | const short da830_usb20_pins[] __initdata = { | 891 | const short da830_usb20_pins[] __initconst = { |
892 | DA830_USB0_DRVVBUS, DA830_USB_REFCLKIN, | 892 | DA830_USB0_DRVVBUS, DA830_USB_REFCLKIN, |
893 | -1 | 893 | -1 |
894 | }; | 894 | }; |
895 | 895 | ||
896 | const short da830_usb11_pins[] __initdata = { | 896 | const short da830_usb11_pins[] __initconst = { |
897 | DA830_USB_REFCLKIN, | 897 | DA830_USB_REFCLKIN, |
898 | -1 | 898 | -1 |
899 | }; | 899 | }; |
900 | 900 | ||
901 | const short da830_uhpi_pins[] __initdata = { | 901 | const short da830_uhpi_pins[] __initconst = { |
902 | DA830_UHPI_HD_0, DA830_UHPI_HD_1, DA830_UHPI_HD_2, DA830_UHPI_HD_3, | 902 | DA830_UHPI_HD_0, DA830_UHPI_HD_1, DA830_UHPI_HD_2, DA830_UHPI_HD_3, |
903 | DA830_UHPI_HD_4, DA830_UHPI_HD_5, DA830_UHPI_HD_6, DA830_UHPI_HD_7, | 903 | DA830_UHPI_HD_4, DA830_UHPI_HD_5, DA830_UHPI_HD_6, DA830_UHPI_HD_7, |
904 | DA830_UHPI_HD_8, DA830_UHPI_HD_9, DA830_UHPI_HD_10, DA830_UHPI_HD_11, | 904 | DA830_UHPI_HD_8, DA830_UHPI_HD_9, DA830_UHPI_HD_10, DA830_UHPI_HD_11, |
@@ -909,14 +909,14 @@ const short da830_uhpi_pins[] __initdata = { | |||
909 | -1 | 909 | -1 |
910 | }; | 910 | }; |
911 | 911 | ||
912 | const short da830_cpgmac_pins[] __initdata = { | 912 | const short da830_cpgmac_pins[] __initconst = { |
913 | DA830_RMII_TXD_0, DA830_RMII_TXD_1, DA830_RMII_TXEN, DA830_RMII_CRS_DV, | 913 | DA830_RMII_TXD_0, DA830_RMII_TXD_1, DA830_RMII_TXEN, DA830_RMII_CRS_DV, |
914 | DA830_RMII_RXD_0, DA830_RMII_RXD_1, DA830_RMII_RXER, DA830_MDIO_CLK, | 914 | DA830_RMII_RXD_0, DA830_RMII_RXD_1, DA830_RMII_RXER, DA830_MDIO_CLK, |
915 | DA830_MDIO_D, | 915 | DA830_MDIO_D, |
916 | -1 | 916 | -1 |
917 | }; | 917 | }; |
918 | 918 | ||
919 | const short da830_emif3c_pins[] __initdata = { | 919 | const short da830_emif3c_pins[] __initconst = { |
920 | DA830_EMB_SDCKE, DA830_EMB_CLK_GLUE, DA830_EMB_CLK, DA830_NEMB_CS_0, | 920 | DA830_EMB_SDCKE, DA830_EMB_CLK_GLUE, DA830_EMB_CLK, DA830_NEMB_CS_0, |
921 | DA830_NEMB_CAS, DA830_NEMB_RAS, DA830_NEMB_WE, DA830_EMB_BA_1, | 921 | DA830_NEMB_CAS, DA830_NEMB_RAS, DA830_NEMB_WE, DA830_EMB_BA_1, |
922 | DA830_EMB_BA_0, DA830_EMB_A_0, DA830_EMB_A_1, DA830_EMB_A_2, | 922 | DA830_EMB_BA_0, DA830_EMB_A_0, DA830_EMB_A_1, DA830_EMB_A_2, |
@@ -935,7 +935,7 @@ const short da830_emif3c_pins[] __initdata = { | |||
935 | -1 | 935 | -1 |
936 | }; | 936 | }; |
937 | 937 | ||
938 | const short da830_mcasp0_pins[] __initdata = { | 938 | const short da830_mcasp0_pins[] __initconst = { |
939 | DA830_AHCLKX0, DA830_ACLKX0, DA830_AFSX0, | 939 | DA830_AHCLKX0, DA830_ACLKX0, DA830_AFSX0, |
940 | DA830_AHCLKR0, DA830_ACLKR0, DA830_AFSR0, DA830_AMUTE0, | 940 | DA830_AHCLKR0, DA830_ACLKR0, DA830_AFSR0, DA830_AMUTE0, |
941 | DA830_AXR0_0, DA830_AXR0_1, DA830_AXR0_2, DA830_AXR0_3, | 941 | DA830_AXR0_0, DA830_AXR0_1, DA830_AXR0_2, DA830_AXR0_3, |
@@ -945,7 +945,7 @@ const short da830_mcasp0_pins[] __initdata = { | |||
945 | -1 | 945 | -1 |
946 | }; | 946 | }; |
947 | 947 | ||
948 | const short da830_mcasp1_pins[] __initdata = { | 948 | const short da830_mcasp1_pins[] __initconst = { |
949 | DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, | 949 | DA830_AHCLKX1, DA830_ACLKX1, DA830_AFSX1, |
950 | DA830_AHCLKR1, DA830_ACLKR1, DA830_AFSR1, DA830_AMUTE1, | 950 | DA830_AHCLKR1, DA830_ACLKR1, DA830_AFSR1, DA830_AMUTE1, |
951 | DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_3, | 951 | DA830_AXR1_0, DA830_AXR1_1, DA830_AXR1_2, DA830_AXR1_3, |
@@ -954,24 +954,24 @@ const short da830_mcasp1_pins[] __initdata = { | |||
954 | -1 | 954 | -1 |
955 | }; | 955 | }; |
956 | 956 | ||
957 | const short da830_mcasp2_pins[] __initdata = { | 957 | const short da830_mcasp2_pins[] __initconst = { |
958 | DA830_AHCLKX2, DA830_ACLKX2, DA830_AFSX2, | 958 | DA830_AHCLKX2, DA830_ACLKX2, DA830_AFSX2, |
959 | DA830_AHCLKR2, DA830_ACLKR2, DA830_AFSR2, DA830_AMUTE2, | 959 | DA830_AHCLKR2, DA830_ACLKR2, DA830_AFSR2, DA830_AMUTE2, |
960 | DA830_AXR2_0, DA830_AXR2_1, DA830_AXR2_2, DA830_AXR2_3, | 960 | DA830_AXR2_0, DA830_AXR2_1, DA830_AXR2_2, DA830_AXR2_3, |
961 | -1 | 961 | -1 |
962 | }; | 962 | }; |
963 | 963 | ||
964 | const short da830_i2c0_pins[] __initdata = { | 964 | const short da830_i2c0_pins[] __initconst = { |
965 | DA830_I2C0_SDA, DA830_I2C0_SCL, | 965 | DA830_I2C0_SDA, DA830_I2C0_SCL, |
966 | -1 | 966 | -1 |
967 | }; | 967 | }; |
968 | 968 | ||
969 | const short da830_i2c1_pins[] __initdata = { | 969 | const short da830_i2c1_pins[] __initconst = { |
970 | DA830_I2C1_SCL, DA830_I2C1_SDA, | 970 | DA830_I2C1_SCL, DA830_I2C1_SDA, |
971 | -1 | 971 | -1 |
972 | }; | 972 | }; |
973 | 973 | ||
974 | const short da830_lcdcntl_pins[] __initdata = { | 974 | const short da830_lcdcntl_pins[] __initconst = { |
975 | DA830_LCD_D_0, DA830_LCD_D_1, DA830_LCD_D_2, DA830_LCD_D_3, | 975 | DA830_LCD_D_0, DA830_LCD_D_1, DA830_LCD_D_2, DA830_LCD_D_3, |
976 | DA830_LCD_D_4, DA830_LCD_D_5, DA830_LCD_D_6, DA830_LCD_D_7, | 976 | DA830_LCD_D_4, DA830_LCD_D_5, DA830_LCD_D_6, DA830_LCD_D_7, |
977 | DA830_LCD_D_8, DA830_LCD_D_9, DA830_LCD_D_10, DA830_LCD_D_11, | 977 | DA830_LCD_D_8, DA830_LCD_D_9, DA830_LCD_D_10, DA830_LCD_D_11, |
@@ -981,34 +981,34 @@ const short da830_lcdcntl_pins[] __initdata = { | |||
981 | -1 | 981 | -1 |
982 | }; | 982 | }; |
983 | 983 | ||
984 | const short da830_pwm_pins[] __initdata = { | 984 | const short da830_pwm_pins[] __initconst = { |
985 | DA830_ECAP0_APWM0, DA830_ECAP1_APWM1, DA830_EPWM0B, DA830_EPWM0A, | 985 | DA830_ECAP0_APWM0, DA830_ECAP1_APWM1, DA830_EPWM0B, DA830_EPWM0A, |
986 | DA830_EPWMSYNCI, DA830_EPWMSYNC0, DA830_ECAP2_APWM2, DA830_EHRPWMGLUETZ, | 986 | DA830_EPWMSYNCI, DA830_EPWMSYNC0, DA830_ECAP2_APWM2, DA830_EHRPWMGLUETZ, |
987 | DA830_EPWM2B, DA830_EPWM2A, DA830_EPWM1B, DA830_EPWM1A, | 987 | DA830_EPWM2B, DA830_EPWM2A, DA830_EPWM1B, DA830_EPWM1A, |
988 | -1 | 988 | -1 |
989 | }; | 989 | }; |
990 | 990 | ||
991 | const short da830_ecap0_pins[] __initdata = { | 991 | const short da830_ecap0_pins[] __initconst = { |
992 | DA830_ECAP0_APWM0, | 992 | DA830_ECAP0_APWM0, |
993 | -1 | 993 | -1 |
994 | }; | 994 | }; |
995 | 995 | ||
996 | const short da830_ecap1_pins[] __initdata = { | 996 | const short da830_ecap1_pins[] __initconst = { |
997 | DA830_ECAP1_APWM1, | 997 | DA830_ECAP1_APWM1, |
998 | -1 | 998 | -1 |
999 | }; | 999 | }; |
1000 | 1000 | ||
1001 | const short da830_ecap2_pins[] __initdata = { | 1001 | const short da830_ecap2_pins[] __initconst = { |
1002 | DA830_ECAP2_APWM2, | 1002 | DA830_ECAP2_APWM2, |
1003 | -1 | 1003 | -1 |
1004 | }; | 1004 | }; |
1005 | 1005 | ||
1006 | const short da830_eqep0_pins[] __initdata = { | 1006 | const short da830_eqep0_pins[] __initconst = { |
1007 | DA830_EQEP0I, DA830_EQEP0S, DA830_EQEP0A, DA830_EQEP0B, | 1007 | DA830_EQEP0I, DA830_EQEP0S, DA830_EQEP0A, DA830_EQEP0B, |
1008 | -1 | 1008 | -1 |
1009 | }; | 1009 | }; |
1010 | 1010 | ||
1011 | const short da830_eqep1_pins[] __initdata = { | 1011 | const short da830_eqep1_pins[] __initconst = { |
1012 | DA830_EQEP1I, DA830_EQEP1S, DA830_EQEP1A, DA830_EQEP1B, | 1012 | DA830_EQEP1I, DA830_EQEP1S, DA830_EQEP1A, DA830_EQEP1B, |
1013 | -1 | 1013 | -1 |
1014 | }; | 1014 | }; |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index b44dc844e15e..6676dee7104e 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -576,17 +576,17 @@ static const struct mux_config da850_pins[] = { | |||
576 | #endif | 576 | #endif |
577 | }; | 577 | }; |
578 | 578 | ||
579 | const short da850_i2c0_pins[] __initdata = { | 579 | const short da850_i2c0_pins[] __initconst = { |
580 | DA850_I2C0_SDA, DA850_I2C0_SCL, | 580 | DA850_I2C0_SDA, DA850_I2C0_SCL, |
581 | -1 | 581 | -1 |
582 | }; | 582 | }; |
583 | 583 | ||
584 | const short da850_i2c1_pins[] __initdata = { | 584 | const short da850_i2c1_pins[] __initconst = { |
585 | DA850_I2C1_SCL, DA850_I2C1_SDA, | 585 | DA850_I2C1_SCL, DA850_I2C1_SDA, |
586 | -1 | 586 | -1 |
587 | }; | 587 | }; |
588 | 588 | ||
589 | const short da850_lcdcntl_pins[] __initdata = { | 589 | const short da850_lcdcntl_pins[] __initconst = { |
590 | DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, | 590 | DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, |
591 | DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, | 591 | DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, |
592 | DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, | 592 | DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11, |
diff --git a/arch/arm/mach-ebsa110/Makefile b/arch/arm/mach-ebsa110/Makefile index 6520ac835802..935e4af01a27 100644 --- a/arch/arm/mach-ebsa110/Makefile +++ b/arch/arm/mach-ebsa110/Makefile | |||
@@ -4,9 +4,7 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y := core.o io.o | 7 | obj-y := core.o io.o leds.o |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
11 | |||
12 | obj-$(CONFIG_LEDS) += leds.o | ||
diff --git a/arch/arm/mach-ebsa110/leds.c b/arch/arm/mach-ebsa110/leds.c index 99e14e362500..0398258c20cd 100644 --- a/arch/arm/mach-ebsa110/leds.c +++ b/arch/arm/mach-ebsa110/leds.c | |||
@@ -1,52 +1,71 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-ebsa110/leds.c | 2 | * Driver for the LED found on the EBSA110 machine |
3 | * Based on Versatile and RealView machine LED code | ||
3 | * | 4 | * |
4 | * Copyright (C) 1998 Russell King | 5 | * License terms: GNU General Public License (GPL) version 2 |
5 | * | 6 | * Author: Bryan Wu <bryan.wu@canonical.com> |
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 | * EBSA-110 LED control routines. We use the led as follows: | ||
11 | * | ||
12 | * - Red - toggles state every 50 timer interrupts | ||
13 | */ | 7 | */ |
14 | #include <linux/module.h> | 8 | #include <linux/kernel.h> |
15 | #include <linux/spinlock.h> | ||
16 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/io.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/leds.h> | ||
17 | 13 | ||
18 | #include <mach/hardware.h> | ||
19 | #include <asm/leds.h> | ||
20 | #include <asm/mach-types.h> | 14 | #include <asm/mach-types.h> |
21 | 15 | ||
22 | #include "core.h" | 16 | #include "core.h" |
23 | 17 | ||
24 | static spinlock_t leds_lock; | 18 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
25 | 19 | static void ebsa110_led_set(struct led_classdev *cdev, | |
26 | static void ebsa110_leds_event(led_event_t ledevt) | 20 | enum led_brightness b) |
27 | { | 21 | { |
28 | unsigned long flags; | 22 | u8 reg = __raw_readb(SOFT_BASE); |
29 | 23 | ||
30 | spin_lock_irqsave(&leds_lock, flags); | 24 | if (b != LED_OFF) |
25 | reg |= 0x80; | ||
26 | else | ||
27 | reg &= ~0x80; | ||
31 | 28 | ||
32 | switch(ledevt) { | 29 | __raw_writeb(reg, SOFT_BASE); |
33 | case led_timer: | 30 | } |
34 | *(volatile unsigned char *)SOFT_BASE ^= 128; | ||
35 | break; | ||
36 | 31 | ||
37 | default: | 32 | static enum led_brightness ebsa110_led_get(struct led_classdev *cdev) |
38 | break; | 33 | { |
39 | } | 34 | u8 reg = __raw_readb(SOFT_BASE); |
40 | 35 | ||
41 | spin_unlock_irqrestore(&leds_lock, flags); | 36 | return (reg & 0x80) ? LED_FULL : LED_OFF; |
42 | } | 37 | } |
43 | 38 | ||
44 | static int __init leds_init(void) | 39 | static int __init ebsa110_leds_init(void) |
45 | { | 40 | { |
46 | if (machine_is_ebsa110()) | 41 | |
47 | leds_event = ebsa110_leds_event; | 42 | struct led_classdev *cdev; |
43 | int ret; | ||
44 | |||
45 | if (!machine_is_ebsa110()) | ||
46 | return -ENODEV; | ||
47 | |||
48 | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); | ||
49 | if (!cdev) | ||
50 | return -ENOMEM; | ||
51 | |||
52 | cdev->name = "ebsa110:0"; | ||
53 | cdev->brightness_set = ebsa110_led_set; | ||
54 | cdev->brightness_get = ebsa110_led_get; | ||
55 | cdev->default_trigger = "heartbeat"; | ||
56 | |||
57 | ret = led_classdev_register(NULL, cdev); | ||
58 | if (ret < 0) { | ||
59 | kfree(cdev); | ||
60 | return ret; | ||
61 | } | ||
48 | 62 | ||
49 | return 0; | 63 | return 0; |
50 | } | 64 | } |
51 | 65 | ||
52 | __initcall(leds_init); | 66 | /* |
67 | * Since we may have triggers on any subsystem, defer registration | ||
68 | * until after subsystem_init. | ||
69 | */ | ||
70 | fs_initcall(ebsa110_leds_init); | ||
71 | #endif | ||
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c index a472777e9eba..41383bf03d4b 100644 --- a/arch/arm/mach-ep93xx/adssphere.c +++ b/arch/arm/mach-ep93xx/adssphere.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/sizes.h> | ||
16 | 17 | ||
17 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
18 | 19 | ||
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c index 437c34111155..7fd705b5efe4 100644 --- a/arch/arm/mach-ep93xx/gesbc9312.c +++ b/arch/arm/mach-ep93xx/gesbc9312.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/sizes.h> | ||
16 | 17 | ||
17 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
18 | 19 | ||
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index 75cab2d7ec73..3c4c233391dc 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | 22 | ||
23 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
24 | #include <mach/ts72xx.h> | ||
25 | 24 | ||
26 | #include <asm/hardware/vic.h> | 25 | #include <asm/hardware/vic.h> |
27 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
@@ -29,30 +28,31 @@ | |||
29 | #include <asm/mach/arch.h> | 28 | #include <asm/mach/arch.h> |
30 | 29 | ||
31 | #include "soc.h" | 30 | #include "soc.h" |
31 | #include "ts72xx.h" | ||
32 | 32 | ||
33 | static struct map_desc ts72xx_io_desc[] __initdata = { | 33 | static struct map_desc ts72xx_io_desc[] __initdata = { |
34 | { | 34 | { |
35 | .virtual = TS72XX_MODEL_VIRT_BASE, | 35 | .virtual = (unsigned long)TS72XX_MODEL_VIRT_BASE, |
36 | .pfn = __phys_to_pfn(TS72XX_MODEL_PHYS_BASE), | 36 | .pfn = __phys_to_pfn(TS72XX_MODEL_PHYS_BASE), |
37 | .length = TS72XX_MODEL_SIZE, | 37 | .length = TS72XX_MODEL_SIZE, |
38 | .type = MT_DEVICE, | 38 | .type = MT_DEVICE, |
39 | }, { | 39 | }, { |
40 | .virtual = TS72XX_OPTIONS_VIRT_BASE, | 40 | .virtual = (unsigned long)TS72XX_OPTIONS_VIRT_BASE, |
41 | .pfn = __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE), | 41 | .pfn = __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE), |
42 | .length = TS72XX_OPTIONS_SIZE, | 42 | .length = TS72XX_OPTIONS_SIZE, |
43 | .type = MT_DEVICE, | 43 | .type = MT_DEVICE, |
44 | }, { | 44 | }, { |
45 | .virtual = TS72XX_OPTIONS2_VIRT_BASE, | 45 | .virtual = (unsigned long)TS72XX_OPTIONS2_VIRT_BASE, |
46 | .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), | 46 | .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), |
47 | .length = TS72XX_OPTIONS2_SIZE, | 47 | .length = TS72XX_OPTIONS2_SIZE, |
48 | .type = MT_DEVICE, | 48 | .type = MT_DEVICE, |
49 | }, { | 49 | }, { |
50 | .virtual = TS72XX_RTC_INDEX_VIRT_BASE, | 50 | .virtual = (unsigned long)TS72XX_RTC_INDEX_VIRT_BASE, |
51 | .pfn = __phys_to_pfn(TS72XX_RTC_INDEX_PHYS_BASE), | 51 | .pfn = __phys_to_pfn(TS72XX_RTC_INDEX_PHYS_BASE), |
52 | .length = TS72XX_RTC_INDEX_SIZE, | 52 | .length = TS72XX_RTC_INDEX_SIZE, |
53 | .type = MT_DEVICE, | 53 | .type = MT_DEVICE, |
54 | }, { | 54 | }, { |
55 | .virtual = TS72XX_RTC_DATA_VIRT_BASE, | 55 | .virtual = (unsigned long)TS72XX_RTC_DATA_VIRT_BASE, |
56 | .pfn = __phys_to_pfn(TS72XX_RTC_DATA_PHYS_BASE), | 56 | .pfn = __phys_to_pfn(TS72XX_RTC_DATA_PHYS_BASE), |
57 | .length = TS72XX_RTC_DATA_SIZE, | 57 | .length = TS72XX_RTC_DATA_SIZE, |
58 | .type = MT_DEVICE, | 58 | .type = MT_DEVICE, |
diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/ts72xx.h index f1397a13e76b..071feaa30adc 100644 --- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h +++ b/arch/arm/mach-ep93xx/ts72xx.h | |||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #define TS72XX_MODEL_PHYS_BASE 0x22000000 | 16 | #define TS72XX_MODEL_PHYS_BASE 0x22000000 |
17 | #define TS72XX_MODEL_VIRT_BASE 0xfebff000 | 17 | #define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000) |
18 | #define TS72XX_MODEL_SIZE 0x00001000 | 18 | #define TS72XX_MODEL_SIZE 0x00001000 |
19 | 19 | ||
20 | #define TS72XX_MODEL_TS7200 0x00 | 20 | #define TS72XX_MODEL_TS7200 0x00 |
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | #define TS72XX_OPTIONS_PHYS_BASE 0x22400000 | 28 | #define TS72XX_OPTIONS_PHYS_BASE 0x22400000 |
29 | #define TS72XX_OPTIONS_VIRT_BASE 0xfebfe000 | 29 | #define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000) |
30 | #define TS72XX_OPTIONS_SIZE 0x00001000 | 30 | #define TS72XX_OPTIONS_SIZE 0x00001000 |
31 | 31 | ||
32 | #define TS72XX_OPTIONS_COM2_RS485 0x02 | 32 | #define TS72XX_OPTIONS_COM2_RS485 0x02 |
@@ -34,18 +34,18 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | #define TS72XX_OPTIONS2_PHYS_BASE 0x22800000 | 36 | #define TS72XX_OPTIONS2_PHYS_BASE 0x22800000 |
37 | #define TS72XX_OPTIONS2_VIRT_BASE 0xfebfd000 | 37 | #define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000) |
38 | #define TS72XX_OPTIONS2_SIZE 0x00001000 | 38 | #define TS72XX_OPTIONS2_SIZE 0x00001000 |
39 | 39 | ||
40 | #define TS72XX_OPTIONS2_TS9420 0x04 | 40 | #define TS72XX_OPTIONS2_TS9420 0x04 |
41 | #define TS72XX_OPTIONS2_TS9420_BOOT 0x02 | 41 | #define TS72XX_OPTIONS2_TS9420_BOOT 0x02 |
42 | 42 | ||
43 | 43 | ||
44 | #define TS72XX_RTC_INDEX_VIRT_BASE 0xfebf9000 | 44 | #define TS72XX_RTC_INDEX_VIRT_BASE IOMEM(0xfebf9000) |
45 | #define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000 | 45 | #define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000 |
46 | #define TS72XX_RTC_INDEX_SIZE 0x00001000 | 46 | #define TS72XX_RTC_INDEX_SIZE 0x00001000 |
47 | 47 | ||
48 | #define TS72XX_RTC_DATA_VIRT_BASE 0xfebf8000 | 48 | #define TS72XX_RTC_DATA_VIRT_BASE IOMEM(0xfebf8000) |
49 | #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 | 49 | #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 |
50 | #define TS72XX_RTC_DATA_SIZE 0x00001000 | 50 | #define TS72XX_RTC_DATA_SIZE 0x00001000 |
51 | 51 | ||
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index b5b4c8c9db11..4372075c551f 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -221,6 +221,7 @@ config MACH_SMDKV310 | |||
221 | select EXYNOS4_SETUP_KEYPAD | 221 | select EXYNOS4_SETUP_KEYPAD |
222 | select EXYNOS4_SETUP_SDHCI | 222 | select EXYNOS4_SETUP_SDHCI |
223 | select EXYNOS4_SETUP_USB_PHY | 223 | select EXYNOS4_SETUP_USB_PHY |
224 | select S3C24XX_PWM | ||
224 | help | 225 | help |
225 | Machine support for Samsung SMDKV310 | 226 | Machine support for Samsung SMDKV310 |
226 | 227 | ||
@@ -348,6 +349,7 @@ config MACH_ORIGEN | |||
348 | select EXYNOS4_SETUP_FIMD0 | 349 | select EXYNOS4_SETUP_FIMD0 |
349 | select EXYNOS4_SETUP_SDHCI | 350 | select EXYNOS4_SETUP_SDHCI |
350 | select EXYNOS4_SETUP_USB_PHY | 351 | select EXYNOS4_SETUP_USB_PHY |
352 | select S3C24XX_PWM | ||
351 | help | 353 | help |
352 | Machine support for ORIGEN based on Samsung EXYNOS4210 | 354 | Machine support for ORIGEN based on Samsung EXYNOS4210 |
353 | 355 | ||
@@ -383,6 +385,7 @@ config MACH_SMDK4212 | |||
383 | select EXYNOS4_SETUP_KEYPAD | 385 | select EXYNOS4_SETUP_KEYPAD |
384 | select EXYNOS4_SETUP_SDHCI | 386 | select EXYNOS4_SETUP_SDHCI |
385 | select EXYNOS4_SETUP_USB_PHY | 387 | select EXYNOS4_SETUP_USB_PHY |
388 | select S3C24XX_PWM | ||
386 | help | 389 | help |
387 | Machine support for Samsung SMDK4212 | 390 | Machine support for Samsung SMDK4212 |
388 | 391 | ||
@@ -405,6 +408,8 @@ config MACH_EXYNOS4_DT | |||
405 | select USE_OF | 408 | select USE_OF |
406 | select ARM_AMBA | 409 | select ARM_AMBA |
407 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD | 410 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD |
411 | select PINCTRL | ||
412 | select PINCTRL_EXYNOS4 | ||
408 | help | 413 | help |
409 | Machine support for Samsung Exynos4 machine with device tree enabled. | 414 | Machine support for Samsung Exynos4 machine with device tree enabled. |
410 | Select this if a fdt blob is available for the Exynos4 SoC based board. | 415 | Select this if a fdt blob is available for the Exynos4 SoC based board. |
@@ -418,8 +423,8 @@ config MACH_EXYNOS5_DT | |||
418 | select USE_OF | 423 | select USE_OF |
419 | select ARM_AMBA | 424 | select ARM_AMBA |
420 | help | 425 | help |
421 | Machine support for Samsung Exynos4 machine with device tree enabled. | 426 | Machine support for Samsung EXYNOS5 machine with device tree enabled. |
422 | Select this if a fdt blob is available for the EXYNOS4 SoC based board. | 427 | Select this if a fdt blob is available for the EXYNOS5 SoC based board. |
423 | 428 | ||
424 | if ARCH_EXYNOS4 | 429 | if ARCH_EXYNOS4 |
425 | 430 | ||
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c index 2f51293c1875..6a45c9a9abe9 100644 --- a/arch/arm/mach-exynos/clock-exynos4.c +++ b/arch/arm/mach-exynos/clock-exynos4.c | |||
@@ -501,6 +501,10 @@ static struct clk exynos4_init_clocks_off[] = { | |||
501 | .enable = exynos4_clk_ip_cam_ctrl, | 501 | .enable = exynos4_clk_ip_cam_ctrl, |
502 | .ctrlbit = (1 << 3), | 502 | .ctrlbit = (1 << 3), |
503 | }, { | 503 | }, { |
504 | .name = "tsi", | ||
505 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
506 | .ctrlbit = (1 << 4), | ||
507 | }, { | ||
504 | .name = "hsmmc", | 508 | .name = "hsmmc", |
505 | .devname = "exynos4-sdhci.0", | 509 | .devname = "exynos4-sdhci.0", |
506 | .parent = &exynos4_clk_aclk_133.clk, | 510 | .parent = &exynos4_clk_aclk_133.clk, |
@@ -530,6 +534,14 @@ static struct clk exynos4_init_clocks_off[] = { | |||
530 | .enable = exynos4_clk_ip_fsys_ctrl, | 534 | .enable = exynos4_clk_ip_fsys_ctrl, |
531 | .ctrlbit = (1 << 9), | 535 | .ctrlbit = (1 << 9), |
532 | }, { | 536 | }, { |
537 | .name = "onenand", | ||
538 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
539 | .ctrlbit = (1 << 15), | ||
540 | }, { | ||
541 | .name = "nfcon", | ||
542 | .enable = exynos4_clk_ip_fsys_ctrl, | ||
543 | .ctrlbit = (1 << 16), | ||
544 | }, { | ||
533 | .name = "dac", | 545 | .name = "dac", |
534 | .devname = "s5p-sdo", | 546 | .devname = "s5p-sdo", |
535 | .enable = exynos4_clk_ip_tv_ctrl, | 547 | .enable = exynos4_clk_ip_tv_ctrl, |
@@ -615,6 +627,25 @@ static struct clk exynos4_init_clocks_off[] = { | |||
615 | .enable = exynos4_clk_ip_peril_ctrl, | 627 | .enable = exynos4_clk_ip_peril_ctrl, |
616 | .ctrlbit = (1 << 21), | 628 | .ctrlbit = (1 << 21), |
617 | }, { | 629 | }, { |
630 | .name = "pcm", | ||
631 | .devname = "samsung-pcm.1", | ||
632 | .enable = exynos4_clk_ip_peril_ctrl, | ||
633 | .ctrlbit = (1 << 22), | ||
634 | }, { | ||
635 | .name = "pcm", | ||
636 | .devname = "samsung-pcm.2", | ||
637 | .enable = exynos4_clk_ip_peril_ctrl, | ||
638 | .ctrlbit = (1 << 23), | ||
639 | }, { | ||
640 | .name = "slimbus", | ||
641 | .enable = exynos4_clk_ip_peril_ctrl, | ||
642 | .ctrlbit = (1 << 25), | ||
643 | }, { | ||
644 | .name = "spdif", | ||
645 | .devname = "samsung-spdif", | ||
646 | .enable = exynos4_clk_ip_peril_ctrl, | ||
647 | .ctrlbit = (1 << 26), | ||
648 | }, { | ||
618 | .name = "ac97", | 649 | .name = "ac97", |
619 | .devname = "samsung-ac97", | 650 | .devname = "samsung-ac97", |
620 | .enable = exynos4_clk_ip_peril_ctrl, | 651 | .enable = exynos4_clk_ip_peril_ctrl, |
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c index 3b00e299b624..c44ca1ee1b8d 100644 --- a/arch/arm/mach-exynos/clock-exynos5.c +++ b/arch/arm/mach-exynos/clock-exynos5.c | |||
@@ -547,6 +547,68 @@ static struct clksrc_clk exynos5_clk_aclk_66 = { | |||
547 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 }, | 547 | .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 }, |
548 | }; | 548 | }; |
549 | 549 | ||
550 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid = { | ||
551 | .clk = { | ||
552 | .name = "mout_aclk_300_gscl_mid", | ||
553 | }, | ||
554 | .sources = &exynos5_clkset_aclk, | ||
555 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 24, .size = 1 }, | ||
556 | }; | ||
557 | |||
558 | static struct clk *exynos5_clkset_aclk_300_mid1_list[] = { | ||
559 | [0] = &exynos5_clk_sclk_vpll.clk, | ||
560 | [1] = &exynos5_clk_mout_cpll.clk, | ||
561 | }; | ||
562 | |||
563 | static struct clksrc_sources exynos5_clkset_aclk_300_gscl_mid1 = { | ||
564 | .sources = exynos5_clkset_aclk_300_mid1_list, | ||
565 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_mid1_list), | ||
566 | }; | ||
567 | |||
568 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl_mid1 = { | ||
569 | .clk = { | ||
570 | .name = "mout_aclk_300_gscl_mid1", | ||
571 | }, | ||
572 | .sources = &exynos5_clkset_aclk_300_gscl_mid1, | ||
573 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP1, .shift = 12, .size = 1 }, | ||
574 | }; | ||
575 | |||
576 | static struct clk *exynos5_clkset_aclk_300_gscl_list[] = { | ||
577 | [0] = &exynos5_clk_mout_aclk_300_gscl_mid.clk, | ||
578 | [1] = &exynos5_clk_mout_aclk_300_gscl_mid1.clk, | ||
579 | }; | ||
580 | |||
581 | static struct clksrc_sources exynos5_clkset_aclk_300_gscl = { | ||
582 | .sources = exynos5_clkset_aclk_300_gscl_list, | ||
583 | .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_300_gscl_list), | ||
584 | }; | ||
585 | |||
586 | static struct clksrc_clk exynos5_clk_mout_aclk_300_gscl = { | ||
587 | .clk = { | ||
588 | .name = "mout_aclk_300_gscl", | ||
589 | }, | ||
590 | .sources = &exynos5_clkset_aclk_300_gscl, | ||
591 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 25, .size = 1 }, | ||
592 | }; | ||
593 | |||
594 | static struct clk *exynos5_clk_src_gscl_300_list[] = { | ||
595 | [0] = &clk_ext_xtal_mux, | ||
596 | [1] = &exynos5_clk_mout_aclk_300_gscl.clk, | ||
597 | }; | ||
598 | |||
599 | static struct clksrc_sources exynos5_clk_src_gscl_300 = { | ||
600 | .sources = exynos5_clk_src_gscl_300_list, | ||
601 | .nr_sources = ARRAY_SIZE(exynos5_clk_src_gscl_300_list), | ||
602 | }; | ||
603 | |||
604 | static struct clksrc_clk exynos5_clk_aclk_300_gscl = { | ||
605 | .clk = { | ||
606 | .name = "aclk_300_gscl", | ||
607 | }, | ||
608 | .sources = &exynos5_clk_src_gscl_300, | ||
609 | .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 10, .size = 1 }, | ||
610 | }; | ||
611 | |||
550 | static struct clk exynos5_init_clocks_off[] = { | 612 | static struct clk exynos5_init_clocks_off[] = { |
551 | { | 613 | { |
552 | .name = "timers", | 614 | .name = "timers", |
@@ -564,35 +626,30 @@ static struct clk exynos5_init_clocks_off[] = { | |||
564 | .enable = exynos5_clk_ip_peris_ctrl, | 626 | .enable = exynos5_clk_ip_peris_ctrl, |
565 | .ctrlbit = (1 << 19), | 627 | .ctrlbit = (1 << 19), |
566 | }, { | 628 | }, { |
567 | .name = "hsmmc", | 629 | .name = "biu", /* bus interface unit clock */ |
568 | .devname = "exynos4-sdhci.0", | 630 | .devname = "dw_mmc.0", |
569 | .parent = &exynos5_clk_aclk_200.clk, | 631 | .parent = &exynos5_clk_aclk_200.clk, |
570 | .enable = exynos5_clk_ip_fsys_ctrl, | 632 | .enable = exynos5_clk_ip_fsys_ctrl, |
571 | .ctrlbit = (1 << 12), | 633 | .ctrlbit = (1 << 12), |
572 | }, { | 634 | }, { |
573 | .name = "hsmmc", | 635 | .name = "biu", |
574 | .devname = "exynos4-sdhci.1", | 636 | .devname = "dw_mmc.1", |
575 | .parent = &exynos5_clk_aclk_200.clk, | 637 | .parent = &exynos5_clk_aclk_200.clk, |
576 | .enable = exynos5_clk_ip_fsys_ctrl, | 638 | .enable = exynos5_clk_ip_fsys_ctrl, |
577 | .ctrlbit = (1 << 13), | 639 | .ctrlbit = (1 << 13), |
578 | }, { | 640 | }, { |
579 | .name = "hsmmc", | 641 | .name = "biu", |
580 | .devname = "exynos4-sdhci.2", | 642 | .devname = "dw_mmc.2", |
581 | .parent = &exynos5_clk_aclk_200.clk, | 643 | .parent = &exynos5_clk_aclk_200.clk, |
582 | .enable = exynos5_clk_ip_fsys_ctrl, | 644 | .enable = exynos5_clk_ip_fsys_ctrl, |
583 | .ctrlbit = (1 << 14), | 645 | .ctrlbit = (1 << 14), |
584 | }, { | 646 | }, { |
585 | .name = "hsmmc", | 647 | .name = "biu", |
586 | .devname = "exynos4-sdhci.3", | 648 | .devname = "dw_mmc.3", |
587 | .parent = &exynos5_clk_aclk_200.clk, | 649 | .parent = &exynos5_clk_aclk_200.clk, |
588 | .enable = exynos5_clk_ip_fsys_ctrl, | 650 | .enable = exynos5_clk_ip_fsys_ctrl, |
589 | .ctrlbit = (1 << 15), | 651 | .ctrlbit = (1 << 15), |
590 | }, { | 652 | }, { |
591 | .name = "dwmci", | ||
592 | .parent = &exynos5_clk_aclk_200.clk, | ||
593 | .enable = exynos5_clk_ip_fsys_ctrl, | ||
594 | .ctrlbit = (1 << 16), | ||
595 | }, { | ||
596 | .name = "sata", | 653 | .name = "sata", |
597 | .devname = "ahci", | 654 | .devname = "ahci", |
598 | .enable = exynos5_clk_ip_fsys_ctrl, | 655 | .enable = exynos5_clk_ip_fsys_ctrl, |
@@ -755,6 +812,26 @@ static struct clk exynos5_init_clocks_off[] = { | |||
755 | .enable = exynos5_clk_ip_peric_ctrl, | 812 | .enable = exynos5_clk_ip_peric_ctrl, |
756 | .ctrlbit = (1 << 18), | 813 | .ctrlbit = (1 << 18), |
757 | }, { | 814 | }, { |
815 | .name = "gscl", | ||
816 | .devname = "exynos-gsc.0", | ||
817 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
818 | .ctrlbit = (1 << 0), | ||
819 | }, { | ||
820 | .name = "gscl", | ||
821 | .devname = "exynos-gsc.1", | ||
822 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
823 | .ctrlbit = (1 << 1), | ||
824 | }, { | ||
825 | .name = "gscl", | ||
826 | .devname = "exynos-gsc.2", | ||
827 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
828 | .ctrlbit = (1 << 2), | ||
829 | }, { | ||
830 | .name = "gscl", | ||
831 | .devname = "exynos-gsc.3", | ||
832 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
833 | .ctrlbit = (1 << 3), | ||
834 | }, { | ||
758 | .name = SYSMMU_CLOCK_NAME, | 835 | .name = SYSMMU_CLOCK_NAME, |
759 | .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), | 836 | .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), |
760 | .enable = &exynos5_clk_ip_mfc_ctrl, | 837 | .enable = &exynos5_clk_ip_mfc_ctrl, |
@@ -882,6 +959,13 @@ static struct clk exynos5_clk_mdma1 = { | |||
882 | .ctrlbit = (1 << 4), | 959 | .ctrlbit = (1 << 4), |
883 | }; | 960 | }; |
884 | 961 | ||
962 | static struct clk exynos5_clk_fimd1 = { | ||
963 | .name = "fimd", | ||
964 | .devname = "exynos5-fb.1", | ||
965 | .enable = exynos5_clk_ip_disp1_ctrl, | ||
966 | .ctrlbit = (1 << 0), | ||
967 | }; | ||
968 | |||
885 | struct clk *exynos5_clkset_group_list[] = { | 969 | struct clk *exynos5_clkset_group_list[] = { |
886 | [0] = &clk_ext_xtal_mux, | 970 | [0] = &clk_ext_xtal_mux, |
887 | [1] = NULL, | 971 | [1] = NULL, |
@@ -1006,8 +1090,8 @@ static struct clksrc_clk exynos5_clk_sclk_uart3 = { | |||
1006 | 1090 | ||
1007 | static struct clksrc_clk exynos5_clk_sclk_mmc0 = { | 1091 | static struct clksrc_clk exynos5_clk_sclk_mmc0 = { |
1008 | .clk = { | 1092 | .clk = { |
1009 | .name = "sclk_mmc", | 1093 | .name = "ciu", /* card interface unit clock */ |
1010 | .devname = "exynos4-sdhci.0", | 1094 | .devname = "dw_mmc.0", |
1011 | .parent = &exynos5_clk_dout_mmc0.clk, | 1095 | .parent = &exynos5_clk_dout_mmc0.clk, |
1012 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 1096 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
1013 | .ctrlbit = (1 << 0), | 1097 | .ctrlbit = (1 << 0), |
@@ -1017,8 +1101,8 @@ static struct clksrc_clk exynos5_clk_sclk_mmc0 = { | |||
1017 | 1101 | ||
1018 | static struct clksrc_clk exynos5_clk_sclk_mmc1 = { | 1102 | static struct clksrc_clk exynos5_clk_sclk_mmc1 = { |
1019 | .clk = { | 1103 | .clk = { |
1020 | .name = "sclk_mmc", | 1104 | .name = "ciu", |
1021 | .devname = "exynos4-sdhci.1", | 1105 | .devname = "dw_mmc.1", |
1022 | .parent = &exynos5_clk_dout_mmc1.clk, | 1106 | .parent = &exynos5_clk_dout_mmc1.clk, |
1023 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 1107 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
1024 | .ctrlbit = (1 << 4), | 1108 | .ctrlbit = (1 << 4), |
@@ -1028,8 +1112,8 @@ static struct clksrc_clk exynos5_clk_sclk_mmc1 = { | |||
1028 | 1112 | ||
1029 | static struct clksrc_clk exynos5_clk_sclk_mmc2 = { | 1113 | static struct clksrc_clk exynos5_clk_sclk_mmc2 = { |
1030 | .clk = { | 1114 | .clk = { |
1031 | .name = "sclk_mmc", | 1115 | .name = "ciu", |
1032 | .devname = "exynos4-sdhci.2", | 1116 | .devname = "dw_mmc.2", |
1033 | .parent = &exynos5_clk_dout_mmc2.clk, | 1117 | .parent = &exynos5_clk_dout_mmc2.clk, |
1034 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 1118 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
1035 | .ctrlbit = (1 << 8), | 1119 | .ctrlbit = (1 << 8), |
@@ -1039,8 +1123,8 @@ static struct clksrc_clk exynos5_clk_sclk_mmc2 = { | |||
1039 | 1123 | ||
1040 | static struct clksrc_clk exynos5_clk_sclk_mmc3 = { | 1124 | static struct clksrc_clk exynos5_clk_sclk_mmc3 = { |
1041 | .clk = { | 1125 | .clk = { |
1042 | .name = "sclk_mmc", | 1126 | .name = "ciu", |
1043 | .devname = "exynos4-sdhci.3", | 1127 | .devname = "dw_mmc.3", |
1044 | .parent = &exynos5_clk_dout_mmc3.clk, | 1128 | .parent = &exynos5_clk_dout_mmc3.clk, |
1045 | .enable = exynos5_clksrc_mask_fsys_ctrl, | 1129 | .enable = exynos5_clksrc_mask_fsys_ctrl, |
1046 | .ctrlbit = (1 << 12), | 1130 | .ctrlbit = (1 << 12), |
@@ -1111,27 +1195,21 @@ static struct clksrc_clk exynos5_clk_sclk_spi2 = { | |||
1111 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 }, | 1195 | .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC2, .shift = 8, .size = 8 }, |
1112 | }; | 1196 | }; |
1113 | 1197 | ||
1198 | struct clksrc_clk exynos5_clk_sclk_fimd1 = { | ||
1199 | .clk = { | ||
1200 | .name = "sclk_fimd", | ||
1201 | .devname = "exynos5-fb.1", | ||
1202 | .enable = exynos5_clksrc_mask_disp1_0_ctrl, | ||
1203 | .ctrlbit = (1 << 0), | ||
1204 | }, | ||
1205 | .sources = &exynos5_clkset_group, | ||
1206 | .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 }, | ||
1207 | .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 }, | ||
1208 | }; | ||
1209 | |||
1114 | static struct clksrc_clk exynos5_clksrcs[] = { | 1210 | static struct clksrc_clk exynos5_clksrcs[] = { |
1115 | { | 1211 | { |
1116 | .clk = { | 1212 | .clk = { |
1117 | .name = "sclk_dwmci", | ||
1118 | .parent = &exynos5_clk_dout_mmc4.clk, | ||
1119 | .enable = exynos5_clksrc_mask_fsys_ctrl, | ||
1120 | .ctrlbit = (1 << 16), | ||
1121 | }, | ||
1122 | .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 8, .size = 8 }, | ||
1123 | }, { | ||
1124 | .clk = { | ||
1125 | .name = "sclk_fimd", | ||
1126 | .devname = "s3cfb.1", | ||
1127 | .enable = exynos5_clksrc_mask_disp1_0_ctrl, | ||
1128 | .ctrlbit = (1 << 0), | ||
1129 | }, | ||
1130 | .sources = &exynos5_clkset_group, | ||
1131 | .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 }, | ||
1132 | .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 }, | ||
1133 | }, { | ||
1134 | .clk = { | ||
1135 | .name = "aclk_266_gscl", | 1213 | .name = "aclk_266_gscl", |
1136 | }, | 1214 | }, |
1137 | .sources = &clk_src_gscl_266, | 1215 | .sources = &clk_src_gscl_266, |
@@ -1216,6 +1294,10 @@ static struct clksrc_clk *exynos5_sysclks[] = { | |||
1216 | &exynos5_clk_aclk_266, | 1294 | &exynos5_clk_aclk_266, |
1217 | &exynos5_clk_aclk_200, | 1295 | &exynos5_clk_aclk_200, |
1218 | &exynos5_clk_aclk_166, | 1296 | &exynos5_clk_aclk_166, |
1297 | &exynos5_clk_aclk_300_gscl, | ||
1298 | &exynos5_clk_mout_aclk_300_gscl, | ||
1299 | &exynos5_clk_mout_aclk_300_gscl_mid, | ||
1300 | &exynos5_clk_mout_aclk_300_gscl_mid1, | ||
1219 | &exynos5_clk_aclk_66_pre, | 1301 | &exynos5_clk_aclk_66_pre, |
1220 | &exynos5_clk_aclk_66, | 1302 | &exynos5_clk_aclk_66, |
1221 | &exynos5_clk_dout_mmc0, | 1303 | &exynos5_clk_dout_mmc0, |
@@ -1231,12 +1313,14 @@ static struct clksrc_clk *exynos5_sysclks[] = { | |||
1231 | &exynos5_clk_mdout_spi0, | 1313 | &exynos5_clk_mdout_spi0, |
1232 | &exynos5_clk_mdout_spi1, | 1314 | &exynos5_clk_mdout_spi1, |
1233 | &exynos5_clk_mdout_spi2, | 1315 | &exynos5_clk_mdout_spi2, |
1316 | &exynos5_clk_sclk_fimd1, | ||
1234 | }; | 1317 | }; |
1235 | 1318 | ||
1236 | static struct clk *exynos5_clk_cdev[] = { | 1319 | static struct clk *exynos5_clk_cdev[] = { |
1237 | &exynos5_clk_pdma0, | 1320 | &exynos5_clk_pdma0, |
1238 | &exynos5_clk_pdma1, | 1321 | &exynos5_clk_pdma1, |
1239 | &exynos5_clk_mdma1, | 1322 | &exynos5_clk_mdma1, |
1323 | &exynos5_clk_fimd1, | ||
1240 | }; | 1324 | }; |
1241 | 1325 | ||
1242 | static struct clksrc_clk *exynos5_clksrc_cdev[] = { | 1326 | static struct clksrc_clk *exynos5_clksrc_cdev[] = { |
@@ -1265,6 +1349,7 @@ static struct clk_lookup exynos5_clk_lookup[] = { | |||
1265 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), | 1349 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0), |
1266 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), | 1350 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1), |
1267 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), | 1351 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1), |
1352 | CLKDEV_INIT("exynos5-fb.1", "lcd", &exynos5_clk_fimd1), | ||
1268 | }; | 1353 | }; |
1269 | 1354 | ||
1270 | static unsigned long exynos5_epll_get_rate(struct clk *clk) | 1355 | static unsigned long exynos5_epll_get_rate(struct clk *clk) |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 4eb39cdf75ea..715b690e5009 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -980,6 +980,32 @@ static int __init exynos_init_irq_eint(void) | |||
980 | { | 980 | { |
981 | int irq; | 981 | int irq; |
982 | 982 | ||
983 | #ifdef CONFIG_PINCTRL_SAMSUNG | ||
984 | /* | ||
985 | * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf | ||
986 | * functionality along with support for external gpio and wakeup | ||
987 | * interrupts. If the samsung pinctrl driver is enabled and includes | ||
988 | * the wakeup interrupt support, then the setting up external wakeup | ||
989 | * interrupts here can be skipped. This check here is temporary to | ||
990 | * allow exynos4 platforms that do not use Samsung pinctrl driver to | ||
991 | * co-exist with platforms that do. When all of the Samsung Exynos4 | ||
992 | * platforms switch over to using the pinctrl driver, the wakeup | ||
993 | * interrupt support code here can be completely removed. | ||
994 | */ | ||
995 | struct device_node *pctrl_np, *wkup_np; | ||
996 | const char *pctrl_compat = "samsung,pinctrl-exynos4210"; | ||
997 | const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; | ||
998 | |||
999 | for_each_compatible_node(pctrl_np, NULL, pctrl_compat) { | ||
1000 | if (of_device_is_available(pctrl_np)) { | ||
1001 | wkup_np = of_find_compatible_node(pctrl_np, NULL, | ||
1002 | wkup_compat); | ||
1003 | if (wkup_np) | ||
1004 | return -ENODEV; | ||
1005 | } | ||
1006 | } | ||
1007 | #endif | ||
1008 | |||
983 | if (soc_is_exynos5250()) | 1009 | if (soc_is_exynos5250()) |
984 | exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K); | 1010 | exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K); |
985 | else | 1011 | else |
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 9d1f3ac86db2..8480849affb9 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -89,7 +89,7 @@ | |||
89 | #define EXYNOS4_PA_L2CC 0x10502000 | 89 | #define EXYNOS4_PA_L2CC 0x10502000 |
90 | 90 | ||
91 | #define EXYNOS4_PA_MDMA0 0x10810000 | 91 | #define EXYNOS4_PA_MDMA0 0x10810000 |
92 | #define EXYNOS4_PA_MDMA1 0x12840000 | 92 | #define EXYNOS4_PA_MDMA1 0x12850000 |
93 | #define EXYNOS4_PA_PDMA0 0x12680000 | 93 | #define EXYNOS4_PA_PDMA0 0x12680000 |
94 | #define EXYNOS4_PA_PDMA1 0x12690000 | 94 | #define EXYNOS4_PA_PDMA1 0x12690000 |
95 | #define EXYNOS5_PA_MDMA0 0x10800000 | 95 | #define EXYNOS5_PA_MDMA0 0x10800000 |
@@ -121,6 +121,11 @@ | |||
121 | #define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000 | 121 | #define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000 |
122 | #define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000 | 122 | #define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000 |
123 | 123 | ||
124 | #define EXYNOS5_PA_GSC0 0x13E00000 | ||
125 | #define EXYNOS5_PA_GSC1 0x13E10000 | ||
126 | #define EXYNOS5_PA_GSC2 0x13E20000 | ||
127 | #define EXYNOS5_PA_GSC3 0x13E30000 | ||
128 | |||
124 | #define EXYNOS5_PA_SYSMMU_MDMA1 0x10A40000 | 129 | #define EXYNOS5_PA_SYSMMU_MDMA1 0x10A40000 |
125 | #define EXYNOS5_PA_SYSMMU_SSS 0x10A50000 | 130 | #define EXYNOS5_PA_SYSMMU_SSS 0x10A50000 |
126 | #define EXYNOS5_PA_SYSMMU_2D 0x10A60000 | 131 | #define EXYNOS5_PA_SYSMMU_2D 0x10A60000 |
@@ -172,6 +177,10 @@ | |||
172 | 177 | ||
173 | #define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) | 178 | #define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) |
174 | #define EXYNOS4_PA_DWMCI 0x12550000 | 179 | #define EXYNOS4_PA_DWMCI 0x12550000 |
180 | #define EXYNOS5_PA_DWMCI0 0x12200000 | ||
181 | #define EXYNOS5_PA_DWMCI1 0x12210000 | ||
182 | #define EXYNOS5_PA_DWMCI2 0x12220000 | ||
183 | #define EXYNOS5_PA_DWMCI3 0x12230000 | ||
175 | 184 | ||
176 | #define EXYNOS4_PA_HSOTG 0x12480000 | 185 | #define EXYNOS4_PA_HSOTG 0x12480000 |
177 | #define EXYNOS4_PA_USB_HSPHY 0x125B0000 | 186 | #define EXYNOS4_PA_USB_HSPHY 0x125B0000 |
diff --git a/arch/arm/mach-exynos/include/mach/sysmmu.h b/arch/arm/mach-exynos/include/mach/sysmmu.h index 998daf2add92..88a4543b0001 100644 --- a/arch/arm/mach-exynos/include/mach/sysmmu.h +++ b/arch/arm/mach-exynos/include/mach/sysmmu.h | |||
@@ -58,7 +58,7 @@ static inline void platform_set_sysmmu( | |||
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #else /* !CONFIG_EXYNOS_DEV_SYSMMU */ | 60 | #else /* !CONFIG_EXYNOS_DEV_SYSMMU */ |
61 | #define platform_set_sysmmu(dev, sysmmu) do { } while (0) | 61 | #define platform_set_sysmmu(sysmmu, dev) do { } while (0) |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #define SYSMMU_CLOCK_DEVNAME(ipname, id) (SYSMMU_DEVNAME_BASE "." #id) | 64 | #define SYSMMU_CLOCK_DEVNAME(ipname, id) (SYSMMU_DEVNAME_BASE "." #id) |
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c index b2b5d5faa748..e58d786faf78 100644 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Samsung's Exynos4210 flattened device tree enabled machine | 2 | * Samsung's EXYNOS4 flattened device tree enabled machine |
3 | * | 3 | * |
4 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. | 4 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
5 | * http://www.samsung.com | 5 | * http://www.samsung.com |
@@ -36,7 +36,7 @@ | |||
36 | * at some point, the drivers should be capable of parsing all the platform | 36 | * at some point, the drivers should be capable of parsing all the platform |
37 | * data from the device tree. | 37 | * data from the device tree. |
38 | */ | 38 | */ |
39 | static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { | 39 | static const struct of_dev_auxdata exynos4_auxdata_lookup[] __initconst = { |
40 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0, | 40 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0, |
41 | "exynos4210-uart.0", NULL), | 41 | "exynos4210-uart.0", NULL), |
42 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1, | 42 | OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1, |
@@ -55,6 +55,20 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { | |||
55 | "exynos4-sdhci.3", NULL), | 55 | "exynos4-sdhci.3", NULL), |
56 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0), | 56 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(0), |
57 | "s3c2440-i2c.0", NULL), | 57 | "s3c2440-i2c.0", NULL), |
58 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(1), | ||
59 | "s3c2440-i2c.1", NULL), | ||
60 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(2), | ||
61 | "s3c2440-i2c.2", NULL), | ||
62 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(3), | ||
63 | "s3c2440-i2c.3", NULL), | ||
64 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(4), | ||
65 | "s3c2440-i2c.4", NULL), | ||
66 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(5), | ||
67 | "s3c2440-i2c.5", NULL), | ||
68 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(6), | ||
69 | "s3c2440-i2c.6", NULL), | ||
70 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS4_PA_IIC(7), | ||
71 | "s3c2440-i2c.7", NULL), | ||
58 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0, | 72 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI0, |
59 | "exynos4210-spi.0", NULL), | 73 | "exynos4210-spi.0", NULL), |
60 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1, | 74 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS4_PA_SPI1, |
@@ -66,19 +80,19 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { | |||
66 | {}, | 80 | {}, |
67 | }; | 81 | }; |
68 | 82 | ||
69 | static void __init exynos4210_dt_map_io(void) | 83 | static void __init exynos4_dt_map_io(void) |
70 | { | 84 | { |
71 | exynos_init_io(NULL, 0); | 85 | exynos_init_io(NULL, 0); |
72 | s3c24xx_init_clocks(24000000); | 86 | s3c24xx_init_clocks(24000000); |
73 | } | 87 | } |
74 | 88 | ||
75 | static void __init exynos4210_dt_machine_init(void) | 89 | static void __init exynos4_dt_machine_init(void) |
76 | { | 90 | { |
77 | of_platform_populate(NULL, of_default_bus_match_table, | 91 | of_platform_populate(NULL, of_default_bus_match_table, |
78 | exynos4210_auxdata_lookup, NULL); | 92 | exynos4_auxdata_lookup, NULL); |
79 | } | 93 | } |
80 | 94 | ||
81 | static char const *exynos4210_dt_compat[] __initdata = { | 95 | static char const *exynos4_dt_compat[] __initdata = { |
82 | "samsung,exynos4210", | 96 | "samsung,exynos4210", |
83 | NULL | 97 | NULL |
84 | }; | 98 | }; |
@@ -86,11 +100,11 @@ static char const *exynos4210_dt_compat[] __initdata = { | |||
86 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") | 100 | DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") |
87 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ | 101 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ |
88 | .init_irq = exynos4_init_irq, | 102 | .init_irq = exynos4_init_irq, |
89 | .map_io = exynos4210_dt_map_io, | 103 | .map_io = exynos4_dt_map_io, |
90 | .handle_irq = gic_handle_irq, | 104 | .handle_irq = gic_handle_irq, |
91 | .init_machine = exynos4210_dt_machine_init, | 105 | .init_machine = exynos4_dt_machine_init, |
92 | .init_late = exynos_init_late, | 106 | .init_late = exynos_init_late, |
93 | .timer = &exynos4_timer, | 107 | .timer = &exynos4_timer, |
94 | .dt_compat = exynos4210_dt_compat, | 108 | .dt_compat = exynos4_dt_compat, |
95 | .restart = exynos4_restart, | 109 | .restart = exynos4_restart, |
96 | MACHINE_END | 110 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index 8833060f77e9..db1cd8eacf28 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -47,6 +47,14 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { | |||
47 | "s3c2440-i2c.0", NULL), | 47 | "s3c2440-i2c.0", NULL), |
48 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), | 48 | OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1), |
49 | "s3c2440-i2c.1", NULL), | 49 | "s3c2440-i2c.1", NULL), |
50 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0, | ||
51 | "dw_mmc.0", NULL), | ||
52 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1, | ||
53 | "dw_mmc.1", NULL), | ||
54 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2, | ||
55 | "dw_mmc.2", NULL), | ||
56 | OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3, | ||
57 | "dw_mmc.3", NULL), | ||
50 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0, | 58 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0, |
51 | "exynos4210-spi.0", NULL), | 59 | "exynos4210-spi.0", NULL), |
52 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1, | 60 | OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1, |
@@ -56,6 +64,14 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { | |||
56 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), | 64 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), |
57 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), | 65 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL), |
58 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), | 66 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), |
67 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0, | ||
68 | "exynos-gsc.0", NULL), | ||
69 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1, | ||
70 | "exynos-gsc.1", NULL), | ||
71 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2, | ||
72 | "exynos-gsc.2", NULL), | ||
73 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, | ||
74 | "exynos-gsc.3", NULL), | ||
59 | {}, | 75 | {}, |
60 | }; | 76 | }; |
61 | 77 | ||
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c index fc23f74ade81..67b50bb89c0f 100644 --- a/arch/arm/mach-exynos/mach-origen.c +++ b/arch/arm/mach-exynos/mach-origen.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/input.h> | 17 | #include <linux/input.h> |
18 | #include <linux/pwm.h> | ||
18 | #include <linux/pwm_backlight.h> | 19 | #include <linux/pwm_backlight.h> |
19 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
20 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
@@ -614,6 +615,10 @@ static struct platform_device origen_lcd_hv070wsa = { | |||
614 | .dev.platform_data = &origen_lcd_hv070wsa_data, | 615 | .dev.platform_data = &origen_lcd_hv070wsa_data, |
615 | }; | 616 | }; |
616 | 617 | ||
618 | static struct pwm_lookup origen_pwm_lookup[] = { | ||
619 | PWM_LOOKUP("s3c24xx-pwm.0", 0, "pwm-backlight.0", NULL), | ||
620 | }; | ||
621 | |||
617 | #ifdef CONFIG_DRM_EXYNOS | 622 | #ifdef CONFIG_DRM_EXYNOS |
618 | static struct exynos_drm_fimd_pdata drm_fimd_pdata = { | 623 | static struct exynos_drm_fimd_pdata drm_fimd_pdata = { |
619 | .panel = { | 624 | .panel = { |
@@ -798,6 +803,7 @@ static void __init origen_machine_init(void) | |||
798 | 803 | ||
799 | platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); | 804 | platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices)); |
800 | 805 | ||
806 | pwm_add_table(origen_pwm_lookup, ARRAY_SIZE(origen_pwm_lookup)); | ||
801 | samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); | 807 | samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data); |
802 | 808 | ||
803 | origen_bt_setup(); | 809 | origen_bt_setup(); |
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c index 589f1db140f0..7a265d1a82d3 100644 --- a/arch/arm/mach-exynos/mach-smdk4x12.c +++ b/arch/arm/mach-exynos/mach-smdk4x12.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/mfd/max8997.h> | 17 | #include <linux/mfd/max8997.h> |
18 | #include <linux/mmc/host.h> | 18 | #include <linux/mmc/host.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/pwm.h> | ||
20 | #include <linux/pwm_backlight.h> | 21 | #include <linux/pwm_backlight.h> |
21 | #include <linux/regulator/machine.h> | 22 | #include <linux/regulator/machine.h> |
22 | #include <linux/serial_core.h> | 23 | #include <linux/serial_core.h> |
@@ -222,6 +223,10 @@ static struct platform_pwm_backlight_data smdk4x12_bl_data = { | |||
222 | .pwm_period_ns = 1000, | 223 | .pwm_period_ns = 1000, |
223 | }; | 224 | }; |
224 | 225 | ||
226 | static struct pwm_lookup smdk4x12_pwm_lookup[] = { | ||
227 | PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL), | ||
228 | }; | ||
229 | |||
225 | static uint32_t smdk4x12_keymap[] __initdata = { | 230 | static uint32_t smdk4x12_keymap[] __initdata = { |
226 | /* KEY(row, col, keycode) */ | 231 | /* KEY(row, col, keycode) */ |
227 | KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3), | 232 | KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3), |
@@ -349,6 +354,7 @@ static void __init smdk4x12_machine_init(void) | |||
349 | ARRAY_SIZE(smdk4x12_i2c_devs7)); | 354 | ARRAY_SIZE(smdk4x12_i2c_devs7)); |
350 | 355 | ||
351 | samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data); | 356 | samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data); |
357 | pwm_add_table(smdk4x12_pwm_lookup, ARRAY_SIZE(smdk4x12_pwm_lookup)); | ||
352 | 358 | ||
353 | samsung_keypad_set_platdata(&smdk4x12_keypad_data); | 359 | samsung_keypad_set_platdata(&smdk4x12_keypad_data); |
354 | 360 | ||
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c index 6e52cbd0b3e0..c15d2238ceb0 100644 --- a/arch/arm/mach-exynos/mach-smdkv310.c +++ b/arch/arm/mach-exynos/mach-smdkv310.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/input.h> | 20 | #include <linux/input.h> |
21 | #include <linux/pwm.h> | ||
21 | #include <linux/pwm_backlight.h> | 22 | #include <linux/pwm_backlight.h> |
22 | #include <linux/platform_data/s3c-hsotg.h> | 23 | #include <linux/platform_data/s3c-hsotg.h> |
23 | 24 | ||
@@ -360,6 +361,10 @@ static struct i2c_board_info hdmiphy_info = { | |||
360 | I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38), | 361 | I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38), |
361 | }; | 362 | }; |
362 | 363 | ||
364 | static struct pwm_lookup smdkv310_pwm_lookup[] = { | ||
365 | PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL), | ||
366 | }; | ||
367 | |||
363 | static void s5p_tv_setup(void) | 368 | static void s5p_tv_setup(void) |
364 | { | 369 | { |
365 | /* direct HPD to HDMI chip */ | 370 | /* direct HPD to HDMI chip */ |
@@ -399,6 +404,8 @@ static void __init smdkv310_machine_init(void) | |||
399 | samsung_keypad_set_platdata(&smdkv310_keypad_data); | 404 | samsung_keypad_set_platdata(&smdkv310_keypad_data); |
400 | 405 | ||
401 | samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data); | 406 | samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data); |
407 | pwm_add_table(smdkv310_pwm_lookup, ARRAY_SIZE(smdkv310_pwm_lookup)); | ||
408 | |||
402 | #ifdef CONFIG_DRM_EXYNOS | 409 | #ifdef CONFIG_DRM_EXYNOS |
403 | s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata; | 410 | s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata; |
404 | exynos4_fimd0_gpio_setup_24bpp(); | 411 | exynos4_fimd0_gpio_setup_24bpp(); |
diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile index 3afb1b25946f..0b64dd430d61 100644 --- a/arch/arm/mach-footbridge/Makefile +++ b/arch/arm/mach-footbridge/Makefile | |||
@@ -14,15 +14,11 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o | |||
14 | pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o | 14 | pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o |
15 | pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o | 15 | pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o |
16 | 16 | ||
17 | leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o | ||
18 | leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o | ||
19 | |||
20 | obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o | 17 | obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o |
21 | obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o | 18 | obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o |
22 | obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o | 19 | obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o |
23 | obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o | 20 | obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o |
24 | 21 | ||
25 | obj-$(CONFIG_PCI) +=$(pci-y) | 22 | obj-$(CONFIG_PCI) +=$(pci-y) |
26 | obj-$(CONFIG_LEDS) +=$(leds-y) | ||
27 | 23 | ||
28 | obj-$(CONFIG_ISA) += isa.o isa-rtc.o | 24 | obj-$(CONFIG_ISA) += isa.o isa-rtc.o |
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c deleted file mode 100644 index 5bd266754b95..000000000000 --- a/arch/arm/mach-footbridge/ebsa285-leds.c +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-footbridge/ebsa285-leds.c | ||
3 | * | ||
4 | * Copyright (C) 1998-1999 Russell King | ||
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 | * EBSA-285 control routines. | ||
10 | * | ||
11 | * The EBSA-285 uses the leds as follows: | ||
12 | * - Green - toggles state every 50 timer interrupts | ||
13 | * - Amber - On if system is not idle | ||
14 | * - Red - currently unused | ||
15 | * | ||
16 | * Changelog: | ||
17 | * 02-05-1999 RMK Various cleanups | ||
18 | */ | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <asm/leds.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | |||
28 | #define LED_STATE_ENABLED 1 | ||
29 | #define LED_STATE_CLAIMED 2 | ||
30 | static char led_state; | ||
31 | static char hw_led_state; | ||
32 | |||
33 | static DEFINE_SPINLOCK(leds_lock); | ||
34 | |||
35 | static void ebsa285_leds_event(led_event_t evt) | ||
36 | { | ||
37 | unsigned long flags; | ||
38 | |||
39 | spin_lock_irqsave(&leds_lock, flags); | ||
40 | |||
41 | switch (evt) { | ||
42 | case led_start: | ||
43 | hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN; | ||
44 | #ifndef CONFIG_LEDS_CPU | ||
45 | hw_led_state |= XBUS_LED_AMBER; | ||
46 | #endif | ||
47 | led_state |= LED_STATE_ENABLED; | ||
48 | break; | ||
49 | |||
50 | case led_stop: | ||
51 | led_state &= ~LED_STATE_ENABLED; | ||
52 | break; | ||
53 | |||
54 | case led_claim: | ||
55 | led_state |= LED_STATE_CLAIMED; | ||
56 | hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER; | ||
57 | break; | ||
58 | |||
59 | case led_release: | ||
60 | led_state &= ~LED_STATE_CLAIMED; | ||
61 | hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER; | ||
62 | break; | ||
63 | |||
64 | #ifdef CONFIG_LEDS_TIMER | ||
65 | case led_timer: | ||
66 | if (!(led_state & LED_STATE_CLAIMED)) | ||
67 | hw_led_state ^= XBUS_LED_GREEN; | ||
68 | break; | ||
69 | #endif | ||
70 | |||
71 | #ifdef CONFIG_LEDS_CPU | ||
72 | case led_idle_start: | ||
73 | if (!(led_state & LED_STATE_CLAIMED)) | ||
74 | hw_led_state |= XBUS_LED_AMBER; | ||
75 | break; | ||
76 | |||
77 | case led_idle_end: | ||
78 | if (!(led_state & LED_STATE_CLAIMED)) | ||
79 | hw_led_state &= ~XBUS_LED_AMBER; | ||
80 | break; | ||
81 | #endif | ||
82 | |||
83 | case led_halted: | ||
84 | if (!(led_state & LED_STATE_CLAIMED)) | ||
85 | hw_led_state &= ~XBUS_LED_RED; | ||
86 | break; | ||
87 | |||
88 | case led_green_on: | ||
89 | if (led_state & LED_STATE_CLAIMED) | ||
90 | hw_led_state &= ~XBUS_LED_GREEN; | ||
91 | break; | ||
92 | |||
93 | case led_green_off: | ||
94 | if (led_state & LED_STATE_CLAIMED) | ||
95 | hw_led_state |= XBUS_LED_GREEN; | ||
96 | break; | ||
97 | |||
98 | case led_amber_on: | ||
99 | if (led_state & LED_STATE_CLAIMED) | ||
100 | hw_led_state &= ~XBUS_LED_AMBER; | ||
101 | break; | ||
102 | |||
103 | case led_amber_off: | ||
104 | if (led_state & LED_STATE_CLAIMED) | ||
105 | hw_led_state |= XBUS_LED_AMBER; | ||
106 | break; | ||
107 | |||
108 | case led_red_on: | ||
109 | if (led_state & LED_STATE_CLAIMED) | ||
110 | hw_led_state &= ~XBUS_LED_RED; | ||
111 | break; | ||
112 | |||
113 | case led_red_off: | ||
114 | if (led_state & LED_STATE_CLAIMED) | ||
115 | hw_led_state |= XBUS_LED_RED; | ||
116 | break; | ||
117 | |||
118 | default: | ||
119 | break; | ||
120 | } | ||
121 | |||
122 | if (led_state & LED_STATE_ENABLED) | ||
123 | *XBUS_LEDS = hw_led_state; | ||
124 | |||
125 | spin_unlock_irqrestore(&leds_lock, flags); | ||
126 | } | ||
127 | |||
128 | static int __init leds_init(void) | ||
129 | { | ||
130 | if (machine_is_ebsa285()) | ||
131 | leds_event = ebsa285_leds_event; | ||
132 | |||
133 | leds_event(led_start); | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | __initcall(leds_init); | ||
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index 27716a7e5fc1..b09551ef89ca 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -5,6 +5,8 @@ | |||
5 | */ | 5 | */ |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
8 | #include <linux/slab.h> | ||
9 | #include <linux/leds.h> | ||
8 | 10 | ||
9 | #include <asm/hardware/dec21285.h> | 11 | #include <asm/hardware/dec21285.h> |
10 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
@@ -13,6 +15,85 @@ | |||
13 | 15 | ||
14 | #include "common.h" | 16 | #include "common.h" |
15 | 17 | ||
18 | /* LEDs */ | ||
19 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
20 | struct ebsa285_led { | ||
21 | struct led_classdev cdev; | ||
22 | u8 mask; | ||
23 | }; | ||
24 | |||
25 | /* | ||
26 | * The triggers lines up below will only be used if the | ||
27 | * LED triggers are compiled in. | ||
28 | */ | ||
29 | static const struct { | ||
30 | const char *name; | ||
31 | const char *trigger; | ||
32 | } ebsa285_leds[] = { | ||
33 | { "ebsa285:amber", "heartbeat", }, | ||
34 | { "ebsa285:green", "cpu0", }, | ||
35 | { "ebsa285:red",}, | ||
36 | }; | ||
37 | |||
38 | static void ebsa285_led_set(struct led_classdev *cdev, | ||
39 | enum led_brightness b) | ||
40 | { | ||
41 | struct ebsa285_led *led = container_of(cdev, | ||
42 | struct ebsa285_led, cdev); | ||
43 | |||
44 | if (b != LED_OFF) | ||
45 | *XBUS_LEDS |= led->mask; | ||
46 | else | ||
47 | *XBUS_LEDS &= ~led->mask; | ||
48 | } | ||
49 | |||
50 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | ||
51 | { | ||
52 | struct ebsa285_led *led = container_of(cdev, | ||
53 | struct ebsa285_led, cdev); | ||
54 | |||
55 | return (*XBUS_LEDS & led->mask) ? LED_FULL : LED_OFF; | ||
56 | } | ||
57 | |||
58 | static int __init ebsa285_leds_init(void) | ||
59 | { | ||
60 | int i; | ||
61 | |||
62 | if (machine_is_ebsa285()) | ||
63 | return -ENODEV; | ||
64 | |||
65 | /* 3 LEDS All ON */ | ||
66 | *XBUS_LEDS |= XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; | ||
67 | |||
68 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { | ||
69 | struct ebsa285_led *led; | ||
70 | |||
71 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
72 | if (!led) | ||
73 | break; | ||
74 | |||
75 | led->cdev.name = ebsa285_leds[i].name; | ||
76 | led->cdev.brightness_set = ebsa285_led_set; | ||
77 | led->cdev.brightness_get = ebsa285_led_get; | ||
78 | led->cdev.default_trigger = ebsa285_leds[i].trigger; | ||
79 | led->mask = BIT(i); | ||
80 | |||
81 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
82 | kfree(led); | ||
83 | break; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | /* | ||
91 | * Since we may have triggers on any subsystem, defer registration | ||
92 | * until after subsystem_init. | ||
93 | */ | ||
94 | fs_initcall(ebsa285_leds_init); | ||
95 | #endif | ||
96 | |||
16 | MACHINE_START(EBSA285, "EBSA285") | 97 | MACHINE_START(EBSA285, "EBSA285") |
17 | /* Maintainer: Russell King */ | 98 | /* Maintainer: Russell King */ |
18 | .atag_offset = 0x100, | 99 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c index cac9f67e7da7..d2d14339c6c4 100644 --- a/arch/arm/mach-footbridge/netwinder-hw.c +++ b/arch/arm/mach-footbridge/netwinder-hw.c | |||
@@ -12,9 +12,10 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
15 | #include <linux/slab.h> | ||
16 | #include <linux/leds.h> | ||
15 | 17 | ||
16 | #include <asm/hardware/dec21285.h> | 18 | #include <asm/hardware/dec21285.h> |
17 | #include <asm/leds.h> | ||
18 | #include <asm/mach-types.h> | 19 | #include <asm/mach-types.h> |
19 | #include <asm/setup.h> | 20 | #include <asm/setup.h> |
20 | #include <asm/system_misc.h> | 21 | #include <asm/system_misc.h> |
@@ -27,13 +28,6 @@ | |||
27 | #define GP1_IO_BASE 0x338 | 28 | #define GP1_IO_BASE 0x338 |
28 | #define GP2_IO_BASE 0x33a | 29 | #define GP2_IO_BASE 0x33a |
29 | 30 | ||
30 | |||
31 | #ifdef CONFIG_LEDS | ||
32 | #define DEFAULT_LEDS 0 | ||
33 | #else | ||
34 | #define DEFAULT_LEDS GPIO_GREEN_LED | ||
35 | #endif | ||
36 | |||
37 | /* | 31 | /* |
38 | * Winbond WB83977F accessibility stuff | 32 | * Winbond WB83977F accessibility stuff |
39 | */ | 33 | */ |
@@ -611,15 +605,9 @@ static void __init rwa010_init(void) | |||
611 | static int __init nw_hw_init(void) | 605 | static int __init nw_hw_init(void) |
612 | { | 606 | { |
613 | if (machine_is_netwinder()) { | 607 | if (machine_is_netwinder()) { |
614 | unsigned long flags; | ||
615 | |||
616 | wb977_init(); | 608 | wb977_init(); |
617 | cpld_init(); | 609 | cpld_init(); |
618 | rwa010_init(); | 610 | rwa010_init(); |
619 | |||
620 | raw_spin_lock_irqsave(&nw_gpio_lock, flags); | ||
621 | nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS); | ||
622 | raw_spin_unlock_irqrestore(&nw_gpio_lock, flags); | ||
623 | } | 611 | } |
624 | return 0; | 612 | return 0; |
625 | } | 613 | } |
@@ -672,6 +660,102 @@ static void netwinder_restart(char mode, const char *cmd) | |||
672 | } | 660 | } |
673 | } | 661 | } |
674 | 662 | ||
663 | /* LEDs */ | ||
664 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
665 | struct netwinder_led { | ||
666 | struct led_classdev cdev; | ||
667 | u8 mask; | ||
668 | }; | ||
669 | |||
670 | /* | ||
671 | * The triggers lines up below will only be used if the | ||
672 | * LED triggers are compiled in. | ||
673 | */ | ||
674 | static const struct { | ||
675 | const char *name; | ||
676 | const char *trigger; | ||
677 | } netwinder_leds[] = { | ||
678 | { "netwinder:green", "heartbeat", }, | ||
679 | { "netwinder:red", "cpu0", }, | ||
680 | }; | ||
681 | |||
682 | /* | ||
683 | * The LED control in Netwinder is reversed: | ||
684 | * - setting bit means turn off LED | ||
685 | * - clearing bit means turn on LED | ||
686 | */ | ||
687 | static void netwinder_led_set(struct led_classdev *cdev, | ||
688 | enum led_brightness b) | ||
689 | { | ||
690 | struct netwinder_led *led = container_of(cdev, | ||
691 | struct netwinder_led, cdev); | ||
692 | unsigned long flags; | ||
693 | u32 reg; | ||
694 | |||
695 | spin_lock_irqsave(&nw_gpio_lock, flags); | ||
696 | reg = nw_gpio_read(); | ||
697 | if (b != LED_OFF) | ||
698 | reg &= ~led->mask; | ||
699 | else | ||
700 | reg |= led->mask; | ||
701 | nw_gpio_modify_op(led->mask, reg); | ||
702 | spin_unlock_irqrestore(&nw_gpio_lock, flags); | ||
703 | } | ||
704 | |||
705 | static enum led_brightness netwinder_led_get(struct led_classdev *cdev) | ||
706 | { | ||
707 | struct netwinder_led *led = container_of(cdev, | ||
708 | struct netwinder_led, cdev); | ||
709 | unsigned long flags; | ||
710 | u32 reg; | ||
711 | |||
712 | spin_lock_irqsave(&nw_gpio_lock, flags); | ||
713 | reg = nw_gpio_read(); | ||
714 | spin_unlock_irqrestore(&nw_gpio_lock, flags); | ||
715 | |||
716 | return (reg & led->mask) ? LED_OFF : LED_FULL; | ||
717 | } | ||
718 | |||
719 | static int __init netwinder_leds_init(void) | ||
720 | { | ||
721 | int i; | ||
722 | |||
723 | if (!machine_is_netwinder()) | ||
724 | return -ENODEV; | ||
725 | |||
726 | for (i = 0; i < ARRAY_SIZE(netwinder_leds); i++) { | ||
727 | struct netwinder_led *led; | ||
728 | |||
729 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
730 | if (!led) | ||
731 | break; | ||
732 | |||
733 | led->cdev.name = netwinder_leds[i].name; | ||
734 | led->cdev.brightness_set = netwinder_led_set; | ||
735 | led->cdev.brightness_get = netwinder_led_get; | ||
736 | led->cdev.default_trigger = netwinder_leds[i].trigger; | ||
737 | |||
738 | if (i == 0) | ||
739 | led->mask = GPIO_GREEN_LED; | ||
740 | else | ||
741 | led->mask = GPIO_RED_LED; | ||
742 | |||
743 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
744 | kfree(led); | ||
745 | break; | ||
746 | } | ||
747 | } | ||
748 | |||
749 | return 0; | ||
750 | } | ||
751 | |||
752 | /* | ||
753 | * Since we may have triggers on any subsystem, defer registration | ||
754 | * until after subsystem_init. | ||
755 | */ | ||
756 | fs_initcall(netwinder_leds_init); | ||
757 | #endif | ||
758 | |||
675 | MACHINE_START(NETWINDER, "Rebel-NetWinder") | 759 | MACHINE_START(NETWINDER, "Rebel-NetWinder") |
676 | /* Maintainer: Russell King/Rebel.com */ | 760 | /* Maintainer: Russell King/Rebel.com */ |
677 | .atag_offset = 0x100, | 761 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c deleted file mode 100644 index 5a2bd89cbdca..000000000000 --- a/arch/arm/mach-footbridge/netwinder-leds.c +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-footbridge/netwinder-leds.c | ||
3 | * | ||
4 | * Copyright (C) 1998-1999 Russell King | ||
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 | * NetWinder LED control routines. | ||
11 | * | ||
12 | * The Netwinder uses the leds as follows: | ||
13 | * - Green - toggles state every 50 timer interrupts | ||
14 | * - Red - On if the system is not idle | ||
15 | * | ||
16 | * Changelog: | ||
17 | * 02-05-1999 RMK Various cleanups | ||
18 | */ | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <asm/leds.h> | ||
26 | #include <asm/mach-types.h> | ||
27 | |||
28 | #define LED_STATE_ENABLED 1 | ||
29 | #define LED_STATE_CLAIMED 2 | ||
30 | static char led_state; | ||
31 | static char hw_led_state; | ||
32 | |||
33 | static DEFINE_RAW_SPINLOCK(leds_lock); | ||
34 | |||
35 | static void netwinder_leds_event(led_event_t evt) | ||
36 | { | ||
37 | unsigned long flags; | ||
38 | |||
39 | raw_spin_lock_irqsave(&leds_lock, flags); | ||
40 | |||
41 | switch (evt) { | ||
42 | case led_start: | ||
43 | led_state |= LED_STATE_ENABLED; | ||
44 | hw_led_state = GPIO_GREEN_LED; | ||
45 | break; | ||
46 | |||
47 | case led_stop: | ||
48 | led_state &= ~LED_STATE_ENABLED; | ||
49 | break; | ||
50 | |||
51 | case led_claim: | ||
52 | led_state |= LED_STATE_CLAIMED; | ||
53 | hw_led_state = 0; | ||
54 | break; | ||
55 | |||
56 | case led_release: | ||
57 | led_state &= ~LED_STATE_CLAIMED; | ||
58 | hw_led_state = 0; | ||
59 | break; | ||
60 | |||
61 | #ifdef CONFIG_LEDS_TIMER | ||
62 | case led_timer: | ||
63 | if (!(led_state & LED_STATE_CLAIMED)) | ||
64 | hw_led_state ^= GPIO_GREEN_LED; | ||
65 | break; | ||
66 | #endif | ||
67 | |||
68 | #ifdef CONFIG_LEDS_CPU | ||
69 | case led_idle_start: | ||
70 | if (!(led_state & LED_STATE_CLAIMED)) | ||
71 | hw_led_state &= ~GPIO_RED_LED; | ||
72 | break; | ||
73 | |||
74 | case led_idle_end: | ||
75 | if (!(led_state & LED_STATE_CLAIMED)) | ||
76 | hw_led_state |= GPIO_RED_LED; | ||
77 | break; | ||
78 | #endif | ||
79 | |||
80 | case led_halted: | ||
81 | if (!(led_state & LED_STATE_CLAIMED)) | ||
82 | hw_led_state |= GPIO_RED_LED; | ||
83 | break; | ||
84 | |||
85 | case led_green_on: | ||
86 | if (led_state & LED_STATE_CLAIMED) | ||
87 | hw_led_state |= GPIO_GREEN_LED; | ||
88 | break; | ||
89 | |||
90 | case led_green_off: | ||
91 | if (led_state & LED_STATE_CLAIMED) | ||
92 | hw_led_state &= ~GPIO_GREEN_LED; | ||
93 | break; | ||
94 | |||
95 | case led_amber_on: | ||
96 | if (led_state & LED_STATE_CLAIMED) | ||
97 | hw_led_state |= GPIO_GREEN_LED | GPIO_RED_LED; | ||
98 | break; | ||
99 | |||
100 | case led_amber_off: | ||
101 | if (led_state & LED_STATE_CLAIMED) | ||
102 | hw_led_state &= ~(GPIO_GREEN_LED | GPIO_RED_LED); | ||
103 | break; | ||
104 | |||
105 | case led_red_on: | ||
106 | if (led_state & LED_STATE_CLAIMED) | ||
107 | hw_led_state |= GPIO_RED_LED; | ||
108 | break; | ||
109 | |||
110 | case led_red_off: | ||
111 | if (led_state & LED_STATE_CLAIMED) | ||
112 | hw_led_state &= ~GPIO_RED_LED; | ||
113 | break; | ||
114 | |||
115 | default: | ||
116 | break; | ||
117 | } | ||
118 | |||
119 | raw_spin_unlock_irqrestore(&leds_lock, flags); | ||
120 | |||
121 | if (led_state & LED_STATE_ENABLED) { | ||
122 | raw_spin_lock_irqsave(&nw_gpio_lock, flags); | ||
123 | nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state); | ||
124 | raw_spin_unlock_irqrestore(&nw_gpio_lock, flags); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | static int __init leds_init(void) | ||
129 | { | ||
130 | if (machine_is_netwinder()) | ||
131 | leds_event = netwinder_leds_event; | ||
132 | |||
133 | leds_event(led_start); | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | __initcall(leds_init); | ||
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index af1da34ccf9d..40e36a50304c 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/clkdev.h> | 17 | #include <linux/clkdev.h> |
18 | #include <linux/dma-mapping.h> | ||
18 | #include <linux/io.h> | 19 | #include <linux/io.h> |
19 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
20 | #include <linux/irqdomain.h> | 21 | #include <linux/irqdomain.h> |
@@ -23,6 +24,7 @@ | |||
23 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
24 | #include <linux/of_address.h> | 25 | #include <linux/of_address.h> |
25 | #include <linux/smp.h> | 26 | #include <linux/smp.h> |
27 | #include <linux/amba/bus.h> | ||
26 | 28 | ||
27 | #include <asm/cacheflush.h> | 29 | #include <asm/cacheflush.h> |
28 | #include <asm/smp_plat.h> | 30 | #include <asm/smp_plat.h> |
@@ -149,11 +151,61 @@ static void highbank_power_off(void) | |||
149 | cpu_do_idle(); | 151 | cpu_do_idle(); |
150 | } | 152 | } |
151 | 153 | ||
154 | static int highbank_platform_notifier(struct notifier_block *nb, | ||
155 | unsigned long event, void *__dev) | ||
156 | { | ||
157 | struct resource *res; | ||
158 | int reg = -1; | ||
159 | struct device *dev = __dev; | ||
160 | |||
161 | if (event != BUS_NOTIFY_ADD_DEVICE) | ||
162 | return NOTIFY_DONE; | ||
163 | |||
164 | if (of_device_is_compatible(dev->of_node, "calxeda,hb-ahci")) | ||
165 | reg = 0xc; | ||
166 | else if (of_device_is_compatible(dev->of_node, "calxeda,hb-sdhci")) | ||
167 | reg = 0x18; | ||
168 | else if (of_device_is_compatible(dev->of_node, "arm,pl330")) | ||
169 | reg = 0x20; | ||
170 | else if (of_device_is_compatible(dev->of_node, "calxeda,hb-xgmac")) { | ||
171 | res = platform_get_resource(to_platform_device(dev), | ||
172 | IORESOURCE_MEM, 0); | ||
173 | if (res) { | ||
174 | if (res->start == 0xfff50000) | ||
175 | reg = 0; | ||
176 | else if (res->start == 0xfff51000) | ||
177 | reg = 4; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | if (reg < 0) | ||
182 | return NOTIFY_DONE; | ||
183 | |||
184 | if (of_property_read_bool(dev->of_node, "dma-coherent")) { | ||
185 | writel(0xff31, sregs_base + reg); | ||
186 | set_dma_ops(dev, &arm_coherent_dma_ops); | ||
187 | } else | ||
188 | writel(0, sregs_base + reg); | ||
189 | |||
190 | return NOTIFY_OK; | ||
191 | } | ||
192 | |||
193 | static struct notifier_block highbank_amba_nb = { | ||
194 | .notifier_call = highbank_platform_notifier, | ||
195 | }; | ||
196 | |||
197 | static struct notifier_block highbank_platform_nb = { | ||
198 | .notifier_call = highbank_platform_notifier, | ||
199 | }; | ||
200 | |||
152 | static void __init highbank_init(void) | 201 | static void __init highbank_init(void) |
153 | { | 202 | { |
154 | pm_power_off = highbank_power_off; | 203 | pm_power_off = highbank_power_off; |
155 | highbank_pm_init(); | 204 | highbank_pm_init(); |
156 | 205 | ||
206 | bus_register_notifier(&platform_bus_type, &highbank_platform_nb); | ||
207 | bus_register_notifier(&amba_bustype, &highbank_amba_nb); | ||
208 | |||
157 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 209 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
158 | } | 210 | } |
159 | 211 | ||
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 7ca5fe45945f..32197c117afe 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -298,6 +298,7 @@ config MACH_MX27_3DS | |||
298 | select IMX_HAVE_PLATFORM_IMX_FB | 298 | select IMX_HAVE_PLATFORM_IMX_FB |
299 | select IMX_HAVE_PLATFORM_IMX_I2C | 299 | select IMX_HAVE_PLATFORM_IMX_I2C |
300 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | 300 | select IMX_HAVE_PLATFORM_IMX_KEYPAD |
301 | select IMX_HAVE_PLATFORM_IMX_SSI | ||
301 | select IMX_HAVE_PLATFORM_IMX_UART | 302 | select IMX_HAVE_PLATFORM_IMX_UART |
302 | select IMX_HAVE_PLATFORM_MX2_CAMERA | 303 | select IMX_HAVE_PLATFORM_MX2_CAMERA |
303 | select IMX_HAVE_PLATFORM_MXC_EHCI | 304 | select IMX_HAVE_PLATFORM_MXC_EHCI |
@@ -757,7 +758,7 @@ config SOC_IMX6Q | |||
757 | select HAVE_IMX_MMDC | 758 | select HAVE_IMX_MMDC |
758 | select HAVE_IMX_SRC | 759 | select HAVE_IMX_SRC |
759 | select HAVE_SMP | 760 | select HAVE_SMP |
760 | select MFD_ANATOP | 761 | select MFD_SYSCON |
761 | select PINCTRL | 762 | select PINCTRL |
762 | select PINCTRL_IMX6Q | 763 | select PINCTRL_IMX6Q |
763 | 764 | ||
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index 4431a62fff5b..d20d4795f4ea 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c | |||
@@ -241,6 +241,6 @@ int __init mx25_clocks_init(void) | |||
241 | clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); | 241 | clk_register_clkdev(clk[sdma_ahb], "ahb", "imx35-sdma"); |
242 | clk_register_clkdev(clk[iim_ipg], "iim", NULL); | 242 | clk_register_clkdev(clk[iim_ipg], "iim", NULL); |
243 | 243 | ||
244 | mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); | 244 | mxc_timer_init(MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), MX25_INT_GPT1); |
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index f69ca4680049..3b6b640eed24 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c | |||
@@ -239,8 +239,8 @@ int __init mx27_clocks_init(unsigned long fref) | |||
239 | clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); | 239 | clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); |
240 | clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); | 240 | clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); |
241 | clk_register_clkdev(clk[nfc_baud_gate], NULL, "mxc_nand.0"); | 241 | clk_register_clkdev(clk[nfc_baud_gate], NULL, "mxc_nand.0"); |
242 | clk_register_clkdev(clk[vpu_baud_gate], "per", "imx-vpu"); | 242 | clk_register_clkdev(clk[vpu_baud_gate], "per", "coda-imx27.0"); |
243 | clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "imx-vpu"); | 243 | clk_register_clkdev(clk[vpu_ahb_gate], "ahb", "coda-imx27.0"); |
244 | clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma"); | 244 | clk_register_clkdev(clk[dma_ahb_gate], "ahb", "imx-dma"); |
245 | clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma"); | 245 | clk_register_clkdev(clk[dma_ipg_gate], "ipg", "imx-dma"); |
246 | clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0"); | 246 | clk_register_clkdev(clk[fec_ipg_gate], "ipg", "imx27-fec.0"); |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 436c5720fe6a..04822932cdd1 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -17,6 +17,10 @@ extern const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data; | |||
17 | #define imx27_add_fsl_usb2_udc(pdata) \ | 17 | #define imx27_add_fsl_usb2_udc(pdata) \ |
18 | imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata) | 18 | imx_add_fsl_usb2_udc(&imx27_fsl_usb2_udc_data, pdata) |
19 | 19 | ||
20 | extern const struct imx_imx27_coda_data imx27_coda_data; | ||
21 | #define imx27_add_coda() \ | ||
22 | imx_add_imx27_coda(&imx27_coda_data) | ||
23 | |||
20 | extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data; | 24 | extern const struct imx_imx2_wdt_data imx27_imx2_wdt_data; |
21 | #define imx27_add_imx2_wdt() \ | 25 | #define imx27_add_imx2_wdt() \ |
22 | imx_add_imx2_wdt(&imx27_imx2_wdt_data) | 26 | imx_add_imx2_wdt(&imx27_imx2_wdt_data) |
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index 2c6ab3273f9e..5985ed1b8c98 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c | |||
@@ -526,7 +526,8 @@ static void __init armadillo5x0_init(void) | |||
526 | imx31_add_mxc_nand(&armadillo5x0_nand_board_info); | 526 | imx31_add_mxc_nand(&armadillo5x0_nand_board_info); |
527 | 527 | ||
528 | /* set NAND page size to 2k if not configured via boot mode pins */ | 528 | /* set NAND page size to 2k if not configured via boot mode pins */ |
529 | __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR); | 529 | __raw_writel(__raw_readl(mx3_ccm_base + MXC_CCM_RCSR) | |
530 | (1 << 30), mx3_ccm_base + MXC_CCM_RCSR); | ||
530 | 531 | ||
531 | /* RTC */ | 532 | /* RTC */ |
532 | /* Get RTC IRQ and register the chip */ | 533 | /* Get RTC IRQ and register the chip */ |
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index f264ddddd47c..821d6aac411c 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c | |||
@@ -32,13 +32,13 @@ | |||
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
34 | #include <linux/leds.h> | 34 | #include <linux/leds.h> |
35 | #include <linux/memblock.h> | ||
36 | #include <media/soc_camera.h> | 35 | #include <media/soc_camera.h> |
37 | #include <sound/tlv320aic32x4.h> | 36 | #include <sound/tlv320aic32x4.h> |
38 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
39 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
40 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
41 | #include <asm/system_info.h> | 40 | #include <asm/system_info.h> |
41 | #include <asm/memblock.h> | ||
42 | #include <mach/common.h> | 42 | #include <mach/common.h> |
43 | #include <mach/hardware.h> | 43 | #include <mach/hardware.h> |
44 | #include <mach/iomux-mx27.h> | 44 | #include <mach/iomux-mx27.h> |
@@ -233,10 +233,8 @@ static void __init visstrim_camera_init(void) | |||
233 | static void __init visstrim_reserve(void) | 233 | static void __init visstrim_reserve(void) |
234 | { | 234 | { |
235 | /* reserve 4 MiB for mx2-camera */ | 235 | /* reserve 4 MiB for mx2-camera */ |
236 | mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE, | 236 | mx2_camera_base = arm_memblock_steal(3 * MX2_CAMERA_BUF_SIZE, |
237 | MX2_CAMERA_BUF_SIZE); | 237 | MX2_CAMERA_BUF_SIZE); |
238 | memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE); | ||
239 | memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE); | ||
240 | } | 238 | } |
241 | 239 | ||
242 | /* GPIOs used as events for applications */ | 240 | /* GPIOs used as events for applications */ |
@@ -405,6 +403,47 @@ static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = { | |||
405 | .flags = IMX_SSI_DMA | IMX_SSI_SYN, | 403 | .flags = IMX_SSI_DMA | IMX_SSI_SYN, |
406 | }; | 404 | }; |
407 | 405 | ||
406 | /* coda */ | ||
407 | |||
408 | static void __init visstrim_coda_init(void) | ||
409 | { | ||
410 | struct platform_device *pdev; | ||
411 | int dma; | ||
412 | |||
413 | pdev = imx27_add_coda(); | ||
414 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
415 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, | ||
416 | mx2_camera_base + MX2_CAMERA_BUF_SIZE, | ||
417 | MX2_CAMERA_BUF_SIZE, | ||
418 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
419 | if (!(dma & DMA_MEMORY_MAP)) | ||
420 | return; | ||
421 | } | ||
422 | |||
423 | /* DMA deinterlace */ | ||
424 | static struct platform_device visstrim_deinterlace = { | ||
425 | .name = "m2m-deinterlace", | ||
426 | .id = 0, | ||
427 | }; | ||
428 | |||
429 | static void __init visstrim_deinterlace_init(void) | ||
430 | { | ||
431 | int ret = -ENOMEM; | ||
432 | struct platform_device *pdev = &visstrim_deinterlace; | ||
433 | int dma; | ||
434 | |||
435 | ret = platform_device_register(pdev); | ||
436 | |||
437 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
438 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, | ||
439 | mx2_camera_base + 2 * MX2_CAMERA_BUF_SIZE, | ||
440 | MX2_CAMERA_BUF_SIZE, | ||
441 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
442 | if (!(dma & DMA_MEMORY_MAP)) | ||
443 | return; | ||
444 | } | ||
445 | |||
446 | |||
408 | static void __init visstrim_m10_revision(void) | 447 | static void __init visstrim_m10_revision(void) |
409 | { | 448 | { |
410 | int exp_version = 0; | 449 | int exp_version = 0; |
@@ -467,7 +506,9 @@ static void __init visstrim_m10_board_init(void) | |||
467 | platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, | 506 | platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, |
468 | &iclink_tvp5150, sizeof(iclink_tvp5150)); | 507 | &iclink_tvp5150, sizeof(iclink_tvp5150)); |
469 | gpio_led_register_device(0, &visstrim_m10_led_data); | 508 | gpio_led_register_device(0, &visstrim_m10_led_data); |
509 | visstrim_deinterlace_init(); | ||
470 | visstrim_camera_init(); | 510 | visstrim_camera_init(); |
511 | visstrim_coda_init(); | ||
471 | } | 512 | } |
472 | 513 | ||
473 | static void __init visstrim_m10_timer_init(void) | 514 | static void __init visstrim_m10_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 36979d3dfe34..47c91f7185d2 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
@@ -23,8 +23,9 @@ | |||
23 | #include <linux/of_irq.h> | 23 | #include <linux/of_irq.h> |
24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
25 | #include <linux/phy.h> | 25 | #include <linux/phy.h> |
26 | #include <linux/regmap.h> | ||
26 | #include <linux/micrel_phy.h> | 27 | #include <linux/micrel_phy.h> |
27 | #include <linux/mfd/anatop.h> | 28 | #include <linux/mfd/syscon.h> |
28 | #include <asm/cpuidle.h> | 29 | #include <asm/cpuidle.h> |
29 | #include <asm/smp_twd.h> | 30 | #include <asm/smp_twd.h> |
30 | #include <asm/hardware/cache-l2x0.h> | 31 | #include <asm/hardware/cache-l2x0.h> |
@@ -118,20 +119,7 @@ static void __init imx6q_sabrelite_init(void) | |||
118 | 119 | ||
119 | static void __init imx6q_usb_init(void) | 120 | static void __init imx6q_usb_init(void) |
120 | { | 121 | { |
121 | struct device_node *np; | 122 | struct regmap *anatop; |
122 | struct platform_device *pdev = NULL; | ||
123 | struct anatop *adata = NULL; | ||
124 | |||
125 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); | ||
126 | if (np) | ||
127 | pdev = of_find_device_by_node(np); | ||
128 | if (pdev) | ||
129 | adata = platform_get_drvdata(pdev); | ||
130 | if (!adata) { | ||
131 | if (np) | ||
132 | of_node_put(np); | ||
133 | return; | ||
134 | } | ||
135 | 123 | ||
136 | #define HW_ANADIG_USB1_CHRG_DETECT 0x000001b0 | 124 | #define HW_ANADIG_USB1_CHRG_DETECT 0x000001b0 |
137 | #define HW_ANADIG_USB2_CHRG_DETECT 0x00000210 | 125 | #define HW_ANADIG_USB2_CHRG_DETECT 0x00000210 |
@@ -139,20 +127,21 @@ static void __init imx6q_usb_init(void) | |||
139 | #define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x00100000 | 127 | #define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x00100000 |
140 | #define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x00080000 | 128 | #define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x00080000 |
141 | 129 | ||
142 | /* | 130 | anatop = syscon_regmap_lookup_by_compatible("fsl,imx6q-anatop"); |
143 | * The external charger detector needs to be disabled, | 131 | if (!IS_ERR(anatop)) { |
144 | * or the signal at DP will be poor | 132 | /* |
145 | */ | 133 | * The external charger detector needs to be disabled, |
146 | anatop_write_reg(adata, HW_ANADIG_USB1_CHRG_DETECT, | 134 | * or the signal at DP will be poor |
147 | BM_ANADIG_USB_CHRG_DETECT_EN_B | 135 | */ |
148 | | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, | 136 | regmap_write(anatop, HW_ANADIG_USB1_CHRG_DETECT, |
149 | ~0); | 137 | BM_ANADIG_USB_CHRG_DETECT_EN_B |
150 | anatop_write_reg(adata, HW_ANADIG_USB2_CHRG_DETECT, | 138 | | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); |
151 | BM_ANADIG_USB_CHRG_DETECT_EN_B | | 139 | regmap_write(anatop, HW_ANADIG_USB2_CHRG_DETECT, |
152 | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B, | 140 | BM_ANADIG_USB_CHRG_DETECT_EN_B | |
153 | ~0); | 141 | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B); |
154 | 142 | } else { | |
155 | of_node_put(np); | 143 | pr_warn("failed to find fsl,imx6q-anatop regmap\n"); |
144 | } | ||
156 | } | 145 | } |
157 | 146 | ||
158 | static void __init imx6q_init_machine(void) | 147 | static void __init imx6q_init_machine(void) |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 58c24c1a7ab7..05996f39005c 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -158,6 +158,11 @@ static const int mx27pdk_pins[] __initconst = { | |||
158 | PB21_PF_CSI_HSYNC, | 158 | PB21_PF_CSI_HSYNC, |
159 | CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, | 159 | CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, |
160 | CSI_RESET | GPIO_GPIO | GPIO_OUT, | 160 | CSI_RESET | GPIO_GPIO | GPIO_OUT, |
161 | /* SSI4 */ | ||
162 | PC16_PF_SSI4_FS, | ||
163 | PC17_PF_SSI4_RXD, | ||
164 | PC18_PF_SSI4_TXD, | ||
165 | PC19_PF_SSI4_CLK, | ||
161 | }; | 166 | }; |
162 | 167 | ||
163 | static struct gpio mx27_3ds_camera_gpios[] = { | 168 | static struct gpio mx27_3ds_camera_gpios[] = { |
@@ -329,13 +334,24 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
329 | }; | 334 | }; |
330 | 335 | ||
331 | /* MC13783 */ | 336 | /* MC13783 */ |
337 | static struct mc13xxx_codec_platform_data mx27_3ds_codec = { | ||
338 | .dac_ssi_port = MC13783_SSI1_PORT, | ||
339 | .adc_ssi_port = MC13783_SSI1_PORT, | ||
340 | }; | ||
341 | |||
332 | static struct mc13xxx_platform_data mc13783_pdata = { | 342 | static struct mc13xxx_platform_data mc13783_pdata = { |
333 | .regulators = { | 343 | .regulators = { |
334 | .regulators = mx27_3ds_regulators, | 344 | .regulators = mx27_3ds_regulators, |
335 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), | 345 | .num_regulators = ARRAY_SIZE(mx27_3ds_regulators), |
336 | 346 | ||
337 | }, | 347 | }, |
338 | .flags = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC, | 348 | .flags = MC13XXX_USE_TOUCHSCREEN | MC13XXX_USE_RTC | |
349 | MC13XXX_USE_CODEC, | ||
350 | .codec = &mx27_3ds_codec, | ||
351 | }; | ||
352 | |||
353 | static struct imx_ssi_platform_data mx27_3ds_ssi_pdata = { | ||
354 | .flags = IMX_SSI_DMA | IMX_SSI_NET, | ||
339 | }; | 355 | }; |
340 | 356 | ||
341 | /* SPI */ | 357 | /* SPI */ |
@@ -512,6 +528,9 @@ static void __init mx27pdk_init(void) | |||
512 | } | 528 | } |
513 | 529 | ||
514 | imx27_add_mx2_camera(&mx27_3ds_cam_pdata); | 530 | imx27_add_mx2_camera(&mx27_3ds_cam_pdata); |
531 | imx27_add_imx_ssi(0, &mx27_3ds_ssi_pdata); | ||
532 | |||
533 | imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0); | ||
515 | } | 534 | } |
516 | 535 | ||
517 | static void __init mx27pdk_timer_init(void) | 536 | static void __init mx27pdk_timer_init(void) |
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile index ebeef966e1f5..5521d18bf19a 100644 --- a/arch/arm/mach-integrator/Makefile +++ b/arch/arm/mach-integrator/Makefile | |||
@@ -4,11 +4,10 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y := core.o lm.o | 7 | obj-y := core.o lm.o leds.o |
8 | obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o | 8 | obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o |
9 | obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o | 9 | obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o |
10 | 10 | ||
11 | obj-$(CONFIG_LEDS) += leds.o | ||
12 | obj-$(CONFIG_PCI) += pci_v3.o pci.o | 11 | obj-$(CONFIG_PCI) += pci_v3.o pci.o |
13 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o | 12 | obj-$(CONFIG_CPU_FREQ_INTEGRATOR) += cpu.o |
14 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o | 13 | obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o |
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index a432d4325f89..dad3cb74ed31 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <mach/cm.h> | 28 | #include <mach/cm.h> |
29 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
30 | 30 | ||
31 | #include <asm/leds.h> | ||
32 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
33 | #include <asm/mach/time.h> | 32 | #include <asm/mach/time.h> |
34 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
@@ -128,8 +127,6 @@ static struct amba_pl010_data integrator_uart_data = { | |||
128 | .set_mctrl = integrator_uart_set_mctrl, | 127 | .set_mctrl = integrator_uart_set_mctrl, |
129 | }; | 128 | }; |
130 | 129 | ||
131 | #define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL) | ||
132 | |||
133 | static DEFINE_RAW_SPINLOCK(cm_lock); | 130 | static DEFINE_RAW_SPINLOCK(cm_lock); |
134 | 131 | ||
135 | /** | 132 | /** |
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/include/mach/cm.h index 445d57adb043..1a78692e32a4 100644 --- a/arch/arm/mach-integrator/include/mach/cm.h +++ b/arch/arm/mach-integrator/include/mach/cm.h | |||
@@ -3,6 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | void cm_control(u32, u32); | 4 | void cm_control(u32, u32); |
5 | 5 | ||
6 | #define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL) | ||
7 | |||
6 | #define CM_CTRL_LED (1 << 0) | 8 | #define CM_CTRL_LED (1 << 0) |
7 | #define CM_CTRL_nMBDET (1 << 1) | 9 | #define CM_CTRL_nMBDET (1 << 1) |
8 | #define CM_CTRL_REMAP (1 << 2) | 10 | #define CM_CTRL_REMAP (1 << 2) |
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c index 466defa97842..7a7f6d3273bf 100644 --- a/arch/arm/mach-integrator/leds.c +++ b/arch/arm/mach-integrator/leds.c | |||
@@ -1,90 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-integrator/leds.c | 2 | * Driver for the 4 user LEDs found on the Integrator AP/CP baseboard |
3 | * Based on Versatile and RealView machine LED code | ||
3 | * | 4 | * |
4 | * Integrator/AP and Integrator/CP LED control routines | 5 | * License terms: GNU General Public License (GPL) version 2 |
5 | * | 6 | * Author: Bryan Wu <bryan.wu@canonical.com> |
6 | * Copyright (C) 1999 ARM Limited | ||
7 | * Copyright (C) 2000 Deep Blue Solutions Ltd | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | 7 | */ |
23 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
24 | #include <linux/init.h> | 9 | #include <linux/init.h> |
25 | #include <linux/smp.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/io.h> | 10 | #include <linux/io.h> |
11 | #include <linux/slab.h> | ||
12 | #include <linux/leds.h> | ||
28 | 13 | ||
14 | #include <mach/cm.h> | ||
29 | #include <mach/hardware.h> | 15 | #include <mach/hardware.h> |
30 | #include <mach/platform.h> | 16 | #include <mach/platform.h> |
31 | #include <asm/leds.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | #include <mach/cm.h> | ||
34 | 17 | ||
35 | static int saved_leds; | 18 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
19 | |||
20 | #define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE) | ||
21 | #define LEDREG (__io_address(INTEGRATOR_DBG_BASE) + INTEGRATOR_DBG_LEDS_OFFSET) | ||
36 | 22 | ||
37 | static void integrator_leds_event(led_event_t ledevt) | 23 | struct integrator_led { |
24 | struct led_classdev cdev; | ||
25 | u8 mask; | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * The triggers lines up below will only be used if the | ||
30 | * LED triggers are compiled in. | ||
31 | */ | ||
32 | static const struct { | ||
33 | const char *name; | ||
34 | const char *trigger; | ||
35 | } integrator_leds[] = { | ||
36 | { "integrator:green0", "heartbeat", }, | ||
37 | { "integrator:yellow", }, | ||
38 | { "integrator:red", }, | ||
39 | { "integrator:green1", }, | ||
40 | { "integrator:core_module", "cpu0", }, | ||
41 | }; | ||
42 | |||
43 | static void integrator_led_set(struct led_classdev *cdev, | ||
44 | enum led_brightness b) | ||
38 | { | 45 | { |
39 | unsigned long flags; | 46 | struct integrator_led *led = container_of(cdev, |
40 | const unsigned int dbg_base = IO_ADDRESS(INTEGRATOR_DBG_BASE); | 47 | struct integrator_led, cdev); |
41 | unsigned int update_alpha_leds; | 48 | u32 reg = __raw_readl(LEDREG); |
42 | 49 | ||
43 | // yup, change the LEDs | 50 | if (b != LED_OFF) |
44 | local_irq_save(flags); | 51 | reg |= led->mask; |
45 | update_alpha_leds = 0; | 52 | else |
53 | reg &= ~led->mask; | ||
46 | 54 | ||
47 | switch(ledevt) { | 55 | while (__raw_readl(ALPHA_REG) & 1) |
48 | case led_idle_start: | 56 | cpu_relax(); |
49 | cm_control(CM_CTRL_LED, 0); | ||
50 | break; | ||
51 | 57 | ||
52 | case led_idle_end: | 58 | __raw_writel(reg, LEDREG); |
53 | cm_control(CM_CTRL_LED, CM_CTRL_LED); | 59 | } |
54 | break; | ||
55 | 60 | ||
56 | case led_timer: | 61 | static enum led_brightness integrator_led_get(struct led_classdev *cdev) |
57 | saved_leds ^= GREEN_LED; | 62 | { |
58 | update_alpha_leds = 1; | 63 | struct integrator_led *led = container_of(cdev, |
59 | break; | 64 | struct integrator_led, cdev); |
65 | u32 reg = __raw_readl(LEDREG); | ||
60 | 66 | ||
61 | case led_red_on: | 67 | return (reg & led->mask) ? LED_FULL : LED_OFF; |
62 | saved_leds |= RED_LED; | 68 | } |
63 | update_alpha_leds = 1; | ||
64 | break; | ||
65 | 69 | ||
66 | case led_red_off: | 70 | static void cm_led_set(struct led_classdev *cdev, |
67 | saved_leds &= ~RED_LED; | 71 | enum led_brightness b) |
68 | update_alpha_leds = 1; | 72 | { |
69 | break; | 73 | if (b != LED_OFF) |
74 | cm_control(CM_CTRL_LED, CM_CTRL_LED); | ||
75 | else | ||
76 | cm_control(CM_CTRL_LED, 0); | ||
77 | } | ||
70 | 78 | ||
71 | default: | 79 | static enum led_brightness cm_led_get(struct led_classdev *cdev) |
72 | break; | 80 | { |
73 | } | 81 | u32 reg = readl(CM_CTRL); |
74 | 82 | ||
75 | if (update_alpha_leds) { | 83 | return (reg & CM_CTRL_LED) ? LED_FULL : LED_OFF; |
76 | while (__raw_readl(dbg_base + INTEGRATOR_DBG_ALPHA_OFFSET) & 1); | ||
77 | __raw_writel(saved_leds, dbg_base + INTEGRATOR_DBG_LEDS_OFFSET); | ||
78 | } | ||
79 | local_irq_restore(flags); | ||
80 | } | 84 | } |
81 | 85 | ||
82 | static int __init leds_init(void) | 86 | static int __init integrator_leds_init(void) |
83 | { | 87 | { |
84 | if (machine_is_integrator() || machine_is_cintegrator()) | 88 | int i; |
85 | leds_event = integrator_leds_event; | 89 | |
90 | for (i = 0; i < ARRAY_SIZE(integrator_leds); i++) { | ||
91 | struct integrator_led *led; | ||
92 | |||
93 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
94 | if (!led) | ||
95 | break; | ||
96 | |||
97 | |||
98 | led->cdev.name = integrator_leds[i].name; | ||
99 | |||
100 | if (i == 4) { /* Setting for LED in core module */ | ||
101 | led->cdev.brightness_set = cm_led_set; | ||
102 | led->cdev.brightness_get = cm_led_get; | ||
103 | } else { | ||
104 | led->cdev.brightness_set = integrator_led_set; | ||
105 | led->cdev.brightness_get = integrator_led_get; | ||
106 | } | ||
107 | |||
108 | led->cdev.default_trigger = integrator_leds[i].trigger; | ||
109 | led->mask = BIT(i); | ||
110 | |||
111 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
112 | kfree(led); | ||
113 | break; | ||
114 | } | ||
115 | } | ||
86 | 116 | ||
87 | return 0; | 117 | return 0; |
88 | } | 118 | } |
89 | 119 | ||
90 | core_initcall(leds_init); | 120 | /* |
121 | * Since we may have triggers on any subsystem, defer registration | ||
122 | * until after subsystem_init. | ||
123 | */ | ||
124 | fs_initcall(integrator_leds_init); | ||
125 | #endif | ||
diff --git a/arch/arm/mach-ks8695/Kconfig b/arch/arm/mach-ks8695/Kconfig index f5c39a8c2b00..a545976bdbd6 100644 --- a/arch/arm/mach-ks8695/Kconfig +++ b/arch/arm/mach-ks8695/Kconfig | |||
@@ -21,6 +21,67 @@ config MACH_ACS5K | |||
21 | say 'Y' here if you want your kernel to run on the Brivo | 21 | say 'Y' here if you want your kernel to run on the Brivo |
22 | Systems LLC, ACS-5000 Master board. | 22 | Systems LLC, ACS-5000 Master board. |
23 | 23 | ||
24 | config MACH_LITE300 | ||
25 | bool "SecureComputing SG300" | ||
26 | help | ||
27 | Say 'Y' here if you want your kernel to support the | ||
28 | SecureComputing / SnapGear SG300 VPN Internet Router. | ||
29 | See http://www.securecomputing.com for more details. | ||
30 | |||
31 | config MACH_SG310 | ||
32 | bool "McAfee SG310" | ||
33 | help | ||
34 | Say 'Y' here if you want your kernel to support the | ||
35 | McAfee / SnapGear SG310 VPN Internet Router. | ||
36 | See http://www.mcafee.com for more details. | ||
37 | |||
38 | config MACH_SE4200 | ||
39 | bool "SecureComputing SE4200" | ||
40 | help | ||
41 | Say 'Y' here if you want your kernel to support the | ||
42 | SecureComputing / SnapGear SE4200 Secure Wireless VPN | ||
43 | Internet Router. | ||
44 | See http://www.securecomputing.com for more details. | ||
45 | |||
46 | config MACH_CM4002 | ||
47 | bool "OpenGear CM4002" | ||
48 | help | ||
49 | Say 'Y' here if you want your kernel to support the OpenGear | ||
50 | CM4002 Secure Access Server. See http://www.opengear.com for | ||
51 | more details. | ||
52 | |||
53 | config MACH_CM4008 | ||
54 | bool "OpenGear CM4008" | ||
55 | select MIGHT_HAVE_PCI | ||
56 | help | ||
57 | Say 'Y' here if you want your kernel to support the OpenGear | ||
58 | CM4008 Console Server. See http://www.opengear.com for more | ||
59 | details. | ||
60 | |||
61 | config MACH_CM41xx | ||
62 | bool "OpenGear CM41xx" | ||
63 | select MIGHT_HAVE_PCI | ||
64 | help | ||
65 | Say 'Y' here if you want your kernel to support the OpenGear | ||
66 | CM4016 or CM4048 Console Servers. See http://www.opengear.com for | ||
67 | more details. | ||
68 | |||
69 | config MACH_IM4004 | ||
70 | bool "OpenGear IM4004" | ||
71 | select MIGHT_HAVE_PCI | ||
72 | help | ||
73 | Say 'Y' here if you want your kernel to support the OpenGear | ||
74 | IM4004 Secure Access Server. See http://www.opengear.com for | ||
75 | more details. | ||
76 | |||
77 | config MACH_IM42xx | ||
78 | bool "OpenGear IM42xx" | ||
79 | select MIGHT_HAVE_PCI | ||
80 | help | ||
81 | Say 'Y' here if you want your kernel to support the OpenGear | ||
82 | IM4216 or IM4248 Console Servers. See http://www.opengear.com for | ||
83 | more details. | ||
84 | |||
24 | endmenu | 85 | endmenu |
25 | 86 | ||
26 | endif | 87 | endif |
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile index 853efd9133c6..e370caf0c91b 100644 --- a/arch/arm/mach-ks8695/Makefile +++ b/arch/arm/mach-ks8695/Makefile | |||
@@ -11,10 +11,15 @@ obj- := | |||
11 | # PCI support is optional | 11 | # PCI support is optional |
12 | obj-$(CONFIG_PCI) += pci.o | 12 | obj-$(CONFIG_PCI) += pci.o |
13 | 13 | ||
14 | # LEDs | ||
15 | obj-$(CONFIG_LEDS) += leds.o | ||
16 | |||
17 | # Board-specific support | 14 | # Board-specific support |
18 | obj-$(CONFIG_MACH_KS8695) += board-micrel.o | 15 | obj-$(CONFIG_MACH_KS8695) += board-micrel.o |
19 | obj-$(CONFIG_MACH_DSM320) += board-dsm320.o | 16 | obj-$(CONFIG_MACH_DSM320) += board-dsm320.o |
20 | obj-$(CONFIG_MACH_ACS5K) += board-acs5k.o | 17 | obj-$(CONFIG_MACH_ACS5K) += board-acs5k.o |
18 | obj-$(CONFIG_MACH_LITE300) += board-sg.o | ||
19 | obj-$(CONFIG_MACH_SG310) += board-sg.o | ||
20 | obj-$(CONFIG_MACH_SE4200) += board-sg.o | ||
21 | obj-$(CONFIG_MACH_CM4002) += board-og.o | ||
22 | obj-$(CONFIG_MACH_CM4008) += board-og.o | ||
23 | obj-$(CONFIG_MACH_CM41xx) += board-og.o | ||
24 | obj-$(CONFIG_MACH_IM4004) += board-og.o | ||
25 | obj-$(CONFIG_MACH_IM42xx) += board-og.o | ||
diff --git a/arch/arm/mach-ks8695/board-og.c b/arch/arm/mach-ks8695/board-og.c new file mode 100644 index 000000000000..1623ba461e47 --- /dev/null +++ b/arch/arm/mach-ks8695/board-og.c | |||
@@ -0,0 +1,199 @@ | |||
1 | /* | ||
2 | * board-og.c -- support for the OpenGear KS8695 based boards. | ||
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 | #include <linux/kernel.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/serial_8250.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <asm/mach-types.h> | ||
19 | #include <asm/mach/arch.h> | ||
20 | #include <asm/mach/map.h> | ||
21 | #include <mach/devices.h> | ||
22 | #include <mach/regs-gpio.h> | ||
23 | #include <mach/gpio-ks8695.h> | ||
24 | #include "generic.h" | ||
25 | |||
26 | static int og_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
27 | { | ||
28 | if (machine_is_im4004() && (slot == 8)) | ||
29 | return KS8695_IRQ_EXTERN1; | ||
30 | return KS8695_IRQ_EXTERN0; | ||
31 | } | ||
32 | |||
33 | static struct ks8695_pci_cfg __initdata og_pci = { | ||
34 | .mode = KS8695_MODE_PCI, | ||
35 | .map_irq = og_pci_map_irq, | ||
36 | }; | ||
37 | |||
38 | static void __init og_register_pci(void) | ||
39 | { | ||
40 | /* Initialize the GPIO lines for interrupt mode */ | ||
41 | ks8695_gpio_interrupt(KS8695_GPIO_0, IRQ_TYPE_LEVEL_LOW); | ||
42 | |||
43 | /* Cardbus Slot */ | ||
44 | if (machine_is_im4004()) | ||
45 | ks8695_gpio_interrupt(KS8695_GPIO_1, IRQ_TYPE_LEVEL_LOW); | ||
46 | |||
47 | ks8695_init_pci(&og_pci); | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * The PCI bus reset is driven by a dedicated GPIO line. Toggle it here | ||
52 | * and bring the PCI bus out of reset. | ||
53 | */ | ||
54 | static void __init og_pci_bus_reset(void) | ||
55 | { | ||
56 | unsigned int rstline = 1; | ||
57 | |||
58 | /* Some boards use a different GPIO as the PCI reset line */ | ||
59 | if (machine_is_im4004()) | ||
60 | rstline = 2; | ||
61 | else if (machine_is_im42xx()) | ||
62 | rstline = 0; | ||
63 | |||
64 | gpio_request(rstline, "PCI reset"); | ||
65 | gpio_direction_output(rstline, 0); | ||
66 | |||
67 | /* Drive a reset on the PCI reset line */ | ||
68 | gpio_set_value(rstline, 1); | ||
69 | gpio_set_value(rstline, 0); | ||
70 | mdelay(100); | ||
71 | gpio_set_value(rstline, 1); | ||
72 | mdelay(100); | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * Direct connect serial ports (non-PCI that is). | ||
77 | */ | ||
78 | #define S8250_PHYS 0x03800000 | ||
79 | #define S8250_VIRT 0xf4000000 | ||
80 | #define S8250_SIZE 0x00100000 | ||
81 | |||
82 | static struct __initdata map_desc og_io_desc[] = { | ||
83 | { | ||
84 | .virtual = S8250_VIRT, | ||
85 | .pfn = __phys_to_pfn(S8250_PHYS), | ||
86 | .length = S8250_SIZE, | ||
87 | .type = MT_DEVICE, | ||
88 | } | ||
89 | }; | ||
90 | |||
91 | static struct resource og_uart_resources[] = { | ||
92 | { | ||
93 | .start = S8250_VIRT, | ||
94 | .end = S8250_VIRT + S8250_SIZE, | ||
95 | .flags = IORESOURCE_MEM | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct plat_serial8250_port og_uart_data[] = { | ||
100 | { | ||
101 | .mapbase = S8250_VIRT, | ||
102 | .membase = (char *) S8250_VIRT, | ||
103 | .irq = 3, | ||
104 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | ||
105 | .iotype = UPIO_MEM, | ||
106 | .regshift = 2, | ||
107 | .uartclk = 115200 * 16, | ||
108 | }, | ||
109 | { }, | ||
110 | }; | ||
111 | |||
112 | static struct platform_device og_uart = { | ||
113 | .name = "serial8250", | ||
114 | .id = 0, | ||
115 | .dev.platform_data = og_uart_data, | ||
116 | .num_resources = 1, | ||
117 | .resource = og_uart_resources | ||
118 | }; | ||
119 | |||
120 | static struct platform_device *og_devices[] __initdata = { | ||
121 | &og_uart | ||
122 | }; | ||
123 | |||
124 | static void __init og_init(void) | ||
125 | { | ||
126 | ks8695_register_gpios(); | ||
127 | |||
128 | if (machine_is_cm4002()) { | ||
129 | ks8695_gpio_interrupt(KS8695_GPIO_1, IRQ_TYPE_LEVEL_HIGH); | ||
130 | iotable_init(og_io_desc, ARRAY_SIZE(og_io_desc)); | ||
131 | platform_add_devices(og_devices, ARRAY_SIZE(og_devices)); | ||
132 | } else { | ||
133 | og_pci_bus_reset(); | ||
134 | og_register_pci(); | ||
135 | } | ||
136 | |||
137 | ks8695_add_device_lan(); | ||
138 | ks8695_add_device_wan(); | ||
139 | } | ||
140 | |||
141 | #ifdef CONFIG_MACH_CM4002 | ||
142 | MACHINE_START(CM4002, "OpenGear/CM4002") | ||
143 | /* OpenGear Inc. */ | ||
144 | .atag_offset = 0x100, | ||
145 | .map_io = ks8695_map_io, | ||
146 | .init_irq = ks8695_init_irq, | ||
147 | .init_machine = og_init, | ||
148 | .timer = &ks8695_timer, | ||
149 | .restart = ks8695_restart, | ||
150 | MACHINE_END | ||
151 | #endif | ||
152 | |||
153 | #ifdef CONFIG_MACH_CM4008 | ||
154 | MACHINE_START(CM4008, "OpenGear/CM4008") | ||
155 | /* OpenGear Inc. */ | ||
156 | .atag_offset = 0x100, | ||
157 | .map_io = ks8695_map_io, | ||
158 | .init_irq = ks8695_init_irq, | ||
159 | .init_machine = og_init, | ||
160 | .timer = &ks8695_timer, | ||
161 | .restart = ks8695_restart, | ||
162 | MACHINE_END | ||
163 | #endif | ||
164 | |||
165 | #ifdef CONFIG_MACH_CM41xx | ||
166 | MACHINE_START(CM41XX, "OpenGear/CM41xx") | ||
167 | /* OpenGear Inc. */ | ||
168 | .atag_offset = 0x100, | ||
169 | .map_io = ks8695_map_io, | ||
170 | .init_irq = ks8695_init_irq, | ||
171 | .init_machine = og_init, | ||
172 | .timer = &ks8695_timer, | ||
173 | .restart = ks8695_restart, | ||
174 | MACHINE_END | ||
175 | #endif | ||
176 | |||
177 | #ifdef CONFIG_MACH_IM4004 | ||
178 | MACHINE_START(IM4004, "OpenGear/IM4004") | ||
179 | /* OpenGear Inc. */ | ||
180 | .atag_offset = 0x100, | ||
181 | .map_io = ks8695_map_io, | ||
182 | .init_irq = ks8695_init_irq, | ||
183 | .init_machine = og_init, | ||
184 | .timer = &ks8695_timer, | ||
185 | .restart = ks8695_restart, | ||
186 | MACHINE_END | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_MACH_IM42xx | ||
190 | MACHINE_START(IM42XX, "OpenGear/IM42xx") | ||
191 | /* OpenGear Inc. */ | ||
192 | .atag_offset = 0x100, | ||
193 | .map_io = ks8695_map_io, | ||
194 | .init_irq = ks8695_init_irq, | ||
195 | .init_machine = og_init, | ||
196 | .timer = &ks8695_timer, | ||
197 | .restart = ks8695_restart, | ||
198 | MACHINE_END | ||
199 | #endif | ||
diff --git a/arch/arm/mach-ks8695/board-sg.c b/arch/arm/mach-ks8695/board-sg.c new file mode 100644 index 000000000000..f35b98b5bf37 --- /dev/null +++ b/arch/arm/mach-ks8695/board-sg.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * board-sg.c -- support for the SnapGear KS8695 based boards | ||
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 | #include <linux/kernel.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/mtd/mtd.h> | ||
14 | #include <linux/mtd/map.h> | ||
15 | #include <linux/mtd/physmap.h> | ||
16 | #include <linux/mtd/partitions.h> | ||
17 | #include <asm/mach-types.h> | ||
18 | #include <asm/mach/arch.h> | ||
19 | #include <mach/devices.h> | ||
20 | #include "generic.h" | ||
21 | |||
22 | /* | ||
23 | * The SG310 machine type is fitted with a conventional 8MB Strataflash | ||
24 | * device. Define its partitioning. | ||
25 | */ | ||
26 | #define FL_BASE 0x02000000 | ||
27 | #define FL_SIZE SZ_8M | ||
28 | |||
29 | static struct mtd_partition sg_mtd_partitions[] = { | ||
30 | [0] = { | ||
31 | .name = "SnapGear Boot Loader", | ||
32 | .size = SZ_128K, | ||
33 | }, | ||
34 | [1] = { | ||
35 | .name = "SnapGear non-volatile configuration", | ||
36 | .size = SZ_512K, | ||
37 | .offset = SZ_256K, | ||
38 | }, | ||
39 | [2] = { | ||
40 | .name = "SnapGear image", | ||
41 | .offset = SZ_512K + SZ_256K, | ||
42 | }, | ||
43 | [3] = { | ||
44 | .name = "SnapGear StrataFlash", | ||
45 | }, | ||
46 | [4] = { | ||
47 | .name = "SnapGear Boot Tags", | ||
48 | .size = SZ_128K, | ||
49 | .offset = SZ_128K, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct physmap_flash_data sg_mtd_pdata = { | ||
54 | .width = 1, | ||
55 | .nr_parts = ARRAY_SIZE(sg_mtd_partitions), | ||
56 | .parts = sg_mtd_partitions, | ||
57 | }; | ||
58 | |||
59 | |||
60 | static struct resource sg_mtd_resource[] = { | ||
61 | [0] = { | ||
62 | .start = FL_BASE, | ||
63 | .end = FL_BASE + FL_SIZE - 1, | ||
64 | .flags = IORESOURCE_MEM, | ||
65 | }, | ||
66 | }; | ||
67 | |||
68 | static struct platform_device sg_mtd_device = { | ||
69 | .name = "physmap-flash", | ||
70 | .id = 0, | ||
71 | .num_resources = ARRAY_SIZE(sg_mtd_resource), | ||
72 | .resource = sg_mtd_resource, | ||
73 | .dev = { | ||
74 | .platform_data = &sg_mtd_pdata, | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static void __init sg_init(void) | ||
79 | { | ||
80 | ks8695_add_device_lan(); | ||
81 | ks8695_add_device_wan(); | ||
82 | |||
83 | if (machine_is_sg310()) | ||
84 | platform_device_register(&sg_mtd_device); | ||
85 | } | ||
86 | |||
87 | #ifdef CONFIG_MACH_LITE300 | ||
88 | MACHINE_START(LITE300, "SecureComputing/SG300") | ||
89 | /* SnapGear */ | ||
90 | .atag_offset = 0x100, | ||
91 | .map_io = ks8695_map_io, | ||
92 | .init_irq = ks8695_init_irq, | ||
93 | .init_machine = sg_init, | ||
94 | .timer = &ks8695_timer, | ||
95 | .restart = ks8695_restart, | ||
96 | MACHINE_END | ||
97 | #endif | ||
98 | |||
99 | #ifdef CONFIG_MACH_SG310 | ||
100 | MACHINE_START(SG310, "McAfee/SG310") | ||
101 | /* SnapGear */ | ||
102 | .atag_offset = 0x100, | ||
103 | .map_io = ks8695_map_io, | ||
104 | .init_irq = ks8695_init_irq, | ||
105 | .init_machine = sg_init, | ||
106 | .timer = &ks8695_timer, | ||
107 | .restart = ks8695_restart, | ||
108 | MACHINE_END | ||
109 | #endif | ||
110 | |||
111 | #ifdef CONFIG_MACH_SE4200 | ||
112 | MACHINE_START(SE4200, "SecureComputing/SE4200") | ||
113 | /* SnapGear */ | ||
114 | .atag_offset = 0x100, | ||
115 | .map_io = ks8695_map_io, | ||
116 | .init_irq = ks8695_init_irq, | ||
117 | .init_machine = sg_init, | ||
118 | .timer = &ks8695_timer, | ||
119 | .restart = ks8695_restart, | ||
120 | MACHINE_END | ||
121 | #endif | ||
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c index 73bd63812878..47399bc3c024 100644 --- a/arch/arm/mach-ks8695/devices.c +++ b/arch/arm/mach-ks8695/devices.c | |||
@@ -182,27 +182,6 @@ static void __init ks8695_add_device_watchdog(void) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | /* -------------------------------------------------------------------- | ||
186 | * LEDs | ||
187 | * -------------------------------------------------------------------- */ | ||
188 | |||
189 | #if defined(CONFIG_LEDS) | ||
190 | short ks8695_leds_cpu = -1; | ||
191 | short ks8695_leds_timer = -1; | ||
192 | |||
193 | void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) | ||
194 | { | ||
195 | /* Enable GPIO to access the LEDs */ | ||
196 | gpio_direction_output(cpu_led, 1); | ||
197 | gpio_direction_output(timer_led, 1); | ||
198 | |||
199 | ks8695_leds_cpu = cpu_led; | ||
200 | ks8695_leds_timer = timer_led; | ||
201 | } | ||
202 | #else | ||
203 | void __init ks8695_init_leds(u8 cpu_led, u8 timer_led) {} | ||
204 | #endif | ||
205 | |||
206 | /* -------------------------------------------------------------------- */ | 185 | /* -------------------------------------------------------------------- */ |
207 | 186 | ||
208 | /* | 187 | /* |
diff --git a/arch/arm/mach-ks8695/include/mach/devices.h b/arch/arm/mach-ks8695/include/mach/devices.h index 85a3c9aa7d13..1e6594a0f297 100644 --- a/arch/arm/mach-ks8695/include/mach/devices.h +++ b/arch/arm/mach-ks8695/include/mach/devices.h | |||
@@ -18,11 +18,6 @@ extern void __init ks8695_add_device_wan(void); | |||
18 | extern void __init ks8695_add_device_lan(void); | 18 | extern void __init ks8695_add_device_lan(void); |
19 | extern void __init ks8695_add_device_hpna(void); | 19 | extern void __init ks8695_add_device_hpna(void); |
20 | 20 | ||
21 | /* LEDs */ | ||
22 | extern short ks8695_leds_cpu; | ||
23 | extern short ks8695_leds_timer; | ||
24 | extern void __init ks8695_init_leds(u8 cpu_led, u8 timer_led); | ||
25 | |||
26 | /* PCI */ | 21 | /* PCI */ |
27 | #define KS8695_MODE_PCI 0 | 22 | #define KS8695_MODE_PCI 0 |
28 | #define KS8695_MODE_MINIPCI 1 | 23 | #define KS8695_MODE_MINIPCI 1 |
diff --git a/arch/arm/mach-ks8695/leds.c b/arch/arm/mach-ks8695/leds.c deleted file mode 100644 index 4bd707547293..000000000000 --- a/arch/arm/mach-ks8695/leds.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* | ||
2 | * LED driver for KS8695-based boards. | ||
3 | * | ||
4 | * Copyright (C) Andrew Victor | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #include <linux/gpio.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <asm/leds.h> | ||
16 | #include <mach/devices.h> | ||
17 | |||
18 | |||
19 | static inline void ks8695_led_on(unsigned int led) | ||
20 | { | ||
21 | gpio_set_value(led, 0); | ||
22 | } | ||
23 | |||
24 | static inline void ks8695_led_off(unsigned int led) | ||
25 | { | ||
26 | gpio_set_value(led, 1); | ||
27 | } | ||
28 | |||
29 | static inline void ks8695_led_toggle(unsigned int led) | ||
30 | { | ||
31 | unsigned long is_off = gpio_get_value(led); | ||
32 | if (is_off) | ||
33 | ks8695_led_on(led); | ||
34 | else | ||
35 | ks8695_led_off(led); | ||
36 | } | ||
37 | |||
38 | |||
39 | /* | ||
40 | * Handle LED events. | ||
41 | */ | ||
42 | static void ks8695_leds_event(led_event_t evt) | ||
43 | { | ||
44 | unsigned long flags; | ||
45 | |||
46 | local_irq_save(flags); | ||
47 | |||
48 | switch(evt) { | ||
49 | case led_start: /* System startup */ | ||
50 | ks8695_led_on(ks8695_leds_cpu); | ||
51 | break; | ||
52 | |||
53 | case led_stop: /* System stop / suspend */ | ||
54 | ks8695_led_off(ks8695_leds_cpu); | ||
55 | break; | ||
56 | |||
57 | #ifdef CONFIG_LEDS_TIMER | ||
58 | case led_timer: /* Every 50 timer ticks */ | ||
59 | ks8695_led_toggle(ks8695_leds_timer); | ||
60 | break; | ||
61 | #endif | ||
62 | |||
63 | #ifdef CONFIG_LEDS_CPU | ||
64 | case led_idle_start: /* Entering idle state */ | ||
65 | ks8695_led_off(ks8695_leds_cpu); | ||
66 | break; | ||
67 | |||
68 | case led_idle_end: /* Exit idle state */ | ||
69 | ks8695_led_on(ks8695_leds_cpu); | ||
70 | break; | ||
71 | #endif | ||
72 | |||
73 | default: | ||
74 | break; | ||
75 | } | ||
76 | |||
77 | local_irq_restore(flags); | ||
78 | } | ||
79 | |||
80 | |||
81 | static int __init leds_init(void) | ||
82 | { | ||
83 | if ((ks8695_leds_timer == -1) || (ks8695_leds_cpu == -1)) | ||
84 | return -ENODEV; | ||
85 | |||
86 | leds_event = ks8695_leds_event; | ||
87 | |||
88 | leds_event(led_start); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | __initcall(leds_init); | ||
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h index 1816e22a3479..a544e962a818 100644 --- a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h +++ b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #define LPC32XX_GPIO_P1_MAX 24 | 30 | #define LPC32XX_GPIO_P1_MAX 24 |
31 | #define LPC32XX_GPIO_P2_MAX 13 | 31 | #define LPC32XX_GPIO_P2_MAX 13 |
32 | #define LPC32XX_GPIO_P3_MAX 6 | 32 | #define LPC32XX_GPIO_P3_MAX 6 |
33 | #define LPC32XX_GPI_P3_MAX 28 | 33 | #define LPC32XX_GPI_P3_MAX 29 |
34 | #define LPC32XX_GPO_P3_MAX 24 | 34 | #define LPC32XX_GPO_P3_MAX 24 |
35 | 35 | ||
36 | #define LPC32XX_GPIO_P0_GRP 0 | 36 | #define LPC32XX_GPIO_P0_GRP 0 |
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c index 8f2a2f8712d7..e8ff4c3f0566 100644 --- a/arch/arm/mach-lpc32xx/phy3250.c +++ b/arch/arm/mach-lpc32xx/phy3250.c | |||
@@ -24,12 +24,9 @@ | |||
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/spi/spi.h> | ||
28 | #include <linux/spi/eeprom.h> | ||
29 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
30 | #include <linux/amba/bus.h> | 28 | #include <linux/amba/bus.h> |
31 | #include <linux/amba/clcd.h> | 29 | #include <linux/amba/clcd.h> |
32 | #include <linux/amba/pl022.h> | ||
33 | #include <linux/amba/pl08x.h> | 30 | #include <linux/amba/pl08x.h> |
34 | #include <linux/amba/mmci.h> | 31 | #include <linux/amba/mmci.h> |
35 | #include <linux/of.h> | 32 | #include <linux/of.h> |
@@ -158,21 +155,6 @@ static struct clcd_board lpc32xx_clcd_data = { | |||
158 | .remove = lpc32xx_clcd_remove, | 155 | .remove = lpc32xx_clcd_remove, |
159 | }; | 156 | }; |
160 | 157 | ||
161 | /* | ||
162 | * AMBA SSP (SPI) | ||
163 | */ | ||
164 | static struct pl022_ssp_controller lpc32xx_ssp0_data = { | ||
165 | .bus_id = 0, | ||
166 | .num_chipselect = 1, | ||
167 | .enable_dma = 0, | ||
168 | }; | ||
169 | |||
170 | static struct pl022_ssp_controller lpc32xx_ssp1_data = { | ||
171 | .bus_id = 1, | ||
172 | .num_chipselect = 1, | ||
173 | .enable_dma = 0, | ||
174 | }; | ||
175 | |||
176 | static struct pl08x_channel_data pl08x_slave_channels[] = { | 158 | static struct pl08x_channel_data pl08x_slave_channels[] = { |
177 | { | 159 | { |
178 | .bus_id = "nand-slc", | 160 | .bus_id = "nand-slc", |
@@ -234,8 +216,8 @@ static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = { | |||
234 | }; | 216 | }; |
235 | 217 | ||
236 | static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = { | 218 | static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = { |
237 | OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", &lpc32xx_ssp0_data), | 219 | OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL), |
238 | OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", &lpc32xx_ssp1_data), | 220 | OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL), |
239 | OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data), | 221 | OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data), |
240 | OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd), | 222 | OF_DEV_AUXDATA("arm,pl080", 0x31000000, "pl08xdmac", &pl08x_pd), |
241 | OF_DEV_AUXDATA("arm,pl18x", 0x20098000, "20098000.sd", | 223 | OF_DEV_AUXDATA("arm,pl18x", 0x20098000, "20098000.sd", |
diff --git a/arch/arm/mach-mmp/include/mach/debug-macro.S b/arch/arm/mach-mmp/include/mach/debug-macro.S index b6f14d203c25..5c3cc29688ab 100644 --- a/arch/arm/mach-mmp/include/mach/debug-macro.S +++ b/arch/arm/mach-mmp/include/mach/debug-macro.S | |||
@@ -9,13 +9,21 @@ | |||
9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #if defined(CONFIG_DEBUG_MMP_UART2) | ||
13 | #define MMP_UART_OFFSET 0x00017000 | ||
14 | #elif defined(CONFIG_DEBUG_MMP_UART3) | ||
15 | #define MMP_UART_OFFSET 0x00018000 | ||
16 | #else | ||
17 | #error "Select uart for DEBUG_LL" | ||
18 | #endif | ||
19 | |||
12 | #include <mach/addr-map.h> | 20 | #include <mach/addr-map.h> |
13 | 21 | ||
14 | .macro addruart, rp, rv, tmp | 22 | .macro addruart, rp, rv, tmp |
15 | ldr \rp, =APB_PHYS_BASE @ physical | 23 | ldr \rp, =APB_PHYS_BASE @ physical |
16 | ldr \rv, =APB_VIRT_BASE @ virtual | 24 | ldr \rv, =APB_VIRT_BASE @ virtual |
17 | orr \rp, \rp, #0x00017000 | 25 | orr \rp, \rp, #MMP_UART_OFFSET |
18 | orr \rv, \rv, #0x00017000 | 26 | orr \rv, \rv, #MMP_UART_OFFSET |
19 | .endm | 27 | .endm |
20 | 28 | ||
21 | #define UART_SHIFT 2 | 29 | #define UART_SHIFT 2 |
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 7a7de2b12a62..ce55fd8821c4 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c | |||
@@ -177,12 +177,22 @@ static struct mv_usb_platform_data ttc_usb_pdata = { | |||
177 | #endif | 177 | #endif |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | #ifdef CONFIG_MTD_NAND_PXA3xx | ||
181 | static struct pxa3xx_nand_platform_data dkb_nand_info = { | ||
182 | .enable_arbiter = 1, | ||
183 | .num_cs = 1, | ||
184 | }; | ||
185 | #endif | ||
186 | |||
180 | static void __init ttc_dkb_init(void) | 187 | static void __init ttc_dkb_init(void) |
181 | { | 188 | { |
182 | mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); | 189 | mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config)); |
183 | 190 | ||
184 | /* on-chip devices */ | 191 | /* on-chip devices */ |
185 | pxa910_add_uart(1); | 192 | pxa910_add_uart(1); |
193 | #ifdef CONFIG_MTD_NAND_PXA3xx | ||
194 | pxa910_add_nand(&dkb_nand_info); | ||
195 | #endif | ||
186 | 196 | ||
187 | /* off-chip devices */ | 197 | /* off-chip devices */ |
188 | pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); | 198 | pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); |
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index b2740c800e8c..7902de151cc5 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
@@ -1,8 +1,12 @@ | |||
1 | if ARCH_MSM | 1 | if ARCH_MSM |
2 | 2 | ||
3 | comment "Qualcomm MSM SoC Type" | ||
4 | depends on (ARCH_MSM8X60 || ARCH_MSM8960) | ||
5 | |||
3 | choice | 6 | choice |
4 | prompt "Qualcomm MSM SoC Type" | 7 | prompt "Qualcomm MSM SoC Type" |
5 | default ARCH_MSM7X00A | 8 | default ARCH_MSM7X00A |
9 | depends on !(ARCH_MSM8X60 || ARCH_MSM8960) | ||
6 | 10 | ||
7 | config ARCH_MSM7X00A | 11 | config ARCH_MSM7X00A |
8 | bool "MSM7x00A / MSM7x01A" | 12 | bool "MSM7x00A / MSM7x01A" |
@@ -36,6 +40,8 @@ config ARCH_QSD8X50 | |||
36 | select GPIO_MSM_V1 | 40 | select GPIO_MSM_V1 |
37 | select MSM_PROC_COMM | 41 | select MSM_PROC_COMM |
38 | 42 | ||
43 | endchoice | ||
44 | |||
39 | config ARCH_MSM8X60 | 45 | config ARCH_MSM8X60 |
40 | bool "MSM8X60" | 46 | bool "MSM8X60" |
41 | select ARCH_MSM_SCORPIONMP | 47 | select ARCH_MSM_SCORPIONMP |
@@ -57,8 +63,6 @@ config ARCH_MSM8960 | |||
57 | select MSM_SCM if SMP | 63 | select MSM_SCM if SMP |
58 | select USE_OF | 64 | select USE_OF |
59 | 65 | ||
60 | endchoice | ||
61 | |||
62 | config MSM_HAS_DEBUG_UART_HS | 66 | config MSM_HAS_DEBUG_UART_HS |
63 | bool | 67 | bool |
64 | 68 | ||
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c index a344a373928b..2448fcf09eb1 100644 --- a/arch/arm/mach-msm/board-qsd8x50.c +++ b/arch/arm/mach-msm/board-qsd8x50.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #include "devices.h" | 37 | #include "devices.h" |
38 | #include "common.h" | 38 | #include "common.h" |
39 | 39 | ||
40 | static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300; | 40 | static const resource_size_t qsd8x50_surf_smc91x_base __initconst = 0x70000300; |
41 | static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156; | 41 | static const unsigned qsd8x50_surf_smc91x_gpio __initconst = 156; |
42 | 42 | ||
43 | /* Leave smc91x resources empty here, as we'll fill them in | 43 | /* Leave smc91x resources empty here, as we'll fill them in |
44 | * at run-time: they vary from board to board, and the true | 44 | * at run-time: they vary from board to board, and the true |
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 c6d38f1d0c98..199372e62def 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | |||
@@ -41,21 +41,10 @@ | |||
41 | #define MSM8X60_QGIC_CPU_PHYS 0x02081000 | 41 | #define MSM8X60_QGIC_CPU_PHYS 0x02081000 |
42 | #define MSM8X60_QGIC_CPU_SIZE SZ_4K | 42 | #define MSM8X60_QGIC_CPU_SIZE SZ_4K |
43 | 43 | ||
44 | #define MSM_ACC_BASE IOMEM(0xF0002000) | ||
45 | #define MSM_ACC_PHYS 0x02001000 | ||
46 | #define MSM_ACC_SIZE SZ_4K | ||
47 | |||
48 | #define MSM_GCC_BASE IOMEM(0xF0003000) | ||
49 | #define MSM_GCC_PHYS 0x02082000 | ||
50 | #define MSM_GCC_SIZE SZ_4K | ||
51 | |||
52 | #define MSM_TLMM_BASE IOMEM(0xF0004000) | 44 | #define MSM_TLMM_BASE IOMEM(0xF0004000) |
53 | #define MSM_TLMM_PHYS 0x00800000 | 45 | #define MSM_TLMM_PHYS 0x00800000 |
54 | #define MSM_TLMM_SIZE SZ_16K | 46 | #define MSM_TLMM_SIZE SZ_16K |
55 | 47 | ||
56 | #define MSM_SHARED_RAM_BASE IOMEM(0xF0100000) | ||
57 | #define MSM_SHARED_RAM_SIZE SZ_1M | ||
58 | |||
59 | #define MSM8X60_TMR_PHYS 0x02000000 | 48 | #define MSM8X60_TMR_PHYS 0x02000000 |
60 | #define MSM8X60_TMR_SIZE SZ_4K | 49 | #define MSM8X60_TMR_SIZE SZ_4K |
61 | 50 | ||
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h index 00afdfb8c38f..2ab7cf0919b3 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap.h | |||
@@ -41,12 +41,11 @@ | |||
41 | #include "msm_iomap-7x30.h" | 41 | #include "msm_iomap-7x30.h" |
42 | #elif defined(CONFIG_ARCH_QSD8X50) | 42 | #elif defined(CONFIG_ARCH_QSD8X50) |
43 | #include "msm_iomap-8x50.h" | 43 | #include "msm_iomap-8x50.h" |
44 | #elif defined(CONFIG_ARCH_MSM8X60) | ||
45 | #include "msm_iomap-8x60.h" | ||
46 | #else | 44 | #else |
47 | #include "msm_iomap-7x00.h" | 45 | #include "msm_iomap-7x00.h" |
48 | #endif | 46 | #endif |
49 | 47 | ||
48 | #include "msm_iomap-8x60.h" | ||
50 | #include "msm_iomap-8960.h" | 49 | #include "msm_iomap-8960.h" |
51 | 50 | ||
52 | #define MSM_DEBUG_UART_SIZE SZ_4K | 51 | #define MSM_DEBUG_UART_SIZE SZ_4K |
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index 3854f6f20ce2..123ef9cbce1b 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c | |||
@@ -111,8 +111,6 @@ static struct map_desc msm8x60_io_desc[] __initdata = { | |||
111 | MSM_CHIP_DEVICE(QGIC_CPU, MSM8X60), | 111 | MSM_CHIP_DEVICE(QGIC_CPU, MSM8X60), |
112 | MSM_CHIP_DEVICE(TMR, MSM8X60), | 112 | MSM_CHIP_DEVICE(TMR, MSM8X60), |
113 | MSM_CHIP_DEVICE(TMR0, MSM8X60), | 113 | MSM_CHIP_DEVICE(TMR0, MSM8X60), |
114 | MSM_DEVICE(ACC), | ||
115 | MSM_DEVICE(GCC), | ||
116 | #ifdef CONFIG_DEBUG_MSM8660_UART | 114 | #ifdef CONFIG_DEBUG_MSM8660_UART |
117 | MSM_DEVICE(DEBUG_UART), | 115 | MSM_DEVICE(DEBUG_UART), |
118 | #endif | 116 | #endif |
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c index 23ca9d083b2c..8fb23af154b3 100644 --- a/arch/arm/mach-mxs/icoll.c +++ b/arch/arm/mach-mxs/icoll.c | |||
@@ -19,20 +19,27 @@ | |||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/irqdomain.h> | ||
22 | #include <linux/io.h> | 23 | #include <linux/io.h> |
23 | 24 | #include <linux/of.h> | |
25 | #include <linux/of_irq.h> | ||
26 | #include <asm/exception.h> | ||
24 | #include <mach/mxs.h> | 27 | #include <mach/mxs.h> |
25 | #include <mach/common.h> | 28 | #include <mach/common.h> |
26 | 29 | ||
27 | #define HW_ICOLL_VECTOR 0x0000 | 30 | #define HW_ICOLL_VECTOR 0x0000 |
28 | #define HW_ICOLL_LEVELACK 0x0010 | 31 | #define HW_ICOLL_LEVELACK 0x0010 |
29 | #define HW_ICOLL_CTRL 0x0020 | 32 | #define HW_ICOLL_CTRL 0x0020 |
33 | #define HW_ICOLL_STAT_OFFSET 0x0070 | ||
30 | #define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) | 34 | #define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) |
31 | #define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) | 35 | #define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) |
32 | #define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 | 36 | #define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 |
33 | #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 | 37 | #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 |
34 | 38 | ||
39 | #define ICOLL_NUM_IRQS 128 | ||
40 | |||
35 | static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR); | 41 | static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR); |
42 | static struct irq_domain *icoll_domain; | ||
36 | 43 | ||
37 | static void icoll_ack_irq(struct irq_data *d) | 44 | static void icoll_ack_irq(struct irq_data *d) |
38 | { | 45 | { |
@@ -48,13 +55,13 @@ static void icoll_ack_irq(struct irq_data *d) | |||
48 | static void icoll_mask_irq(struct irq_data *d) | 55 | static void icoll_mask_irq(struct irq_data *d) |
49 | { | 56 | { |
50 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | 57 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, |
51 | icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->irq)); | 58 | icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq)); |
52 | } | 59 | } |
53 | 60 | ||
54 | static void icoll_unmask_irq(struct irq_data *d) | 61 | static void icoll_unmask_irq(struct irq_data *d) |
55 | { | 62 | { |
56 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | 63 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, |
57 | icoll_base + HW_ICOLL_INTERRUPTn_SET(d->irq)); | 64 | icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq)); |
58 | } | 65 | } |
59 | 66 | ||
60 | static struct irq_chip mxs_icoll_chip = { | 67 | static struct irq_chip mxs_icoll_chip = { |
@@ -63,18 +70,56 @@ static struct irq_chip mxs_icoll_chip = { | |||
63 | .irq_unmask = icoll_unmask_irq, | 70 | .irq_unmask = icoll_unmask_irq, |
64 | }; | 71 | }; |
65 | 72 | ||
66 | void __init icoll_init_irq(void) | 73 | asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) |
67 | { | 74 | { |
68 | int i; | 75 | u32 irqnr; |
76 | |||
77 | do { | ||
78 | irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); | ||
79 | if (irqnr != 0x7f) { | ||
80 | __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); | ||
81 | irqnr = irq_find_mapping(icoll_domain, irqnr); | ||
82 | handle_IRQ(irqnr, regs); | ||
83 | continue; | ||
84 | } | ||
85 | break; | ||
86 | } while (1); | ||
87 | } | ||
88 | |||
89 | static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq, | ||
90 | irq_hw_number_t hw) | ||
91 | { | ||
92 | irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq); | ||
93 | set_irq_flags(virq, IRQF_VALID); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
69 | 97 | ||
98 | static struct irq_domain_ops icoll_irq_domain_ops = { | ||
99 | .map = icoll_irq_domain_map, | ||
100 | .xlate = irq_domain_xlate_onecell, | ||
101 | }; | ||
102 | |||
103 | void __init icoll_of_init(struct device_node *np, | ||
104 | struct device_node *interrupt_parent) | ||
105 | { | ||
70 | /* | 106 | /* |
71 | * Interrupt Collector reset, which initializes the priority | 107 | * Interrupt Collector reset, which initializes the priority |
72 | * for each irq to level 0. | 108 | * for each irq to level 0. |
73 | */ | 109 | */ |
74 | mxs_reset_block(icoll_base + HW_ICOLL_CTRL); | 110 | mxs_reset_block(icoll_base + HW_ICOLL_CTRL); |
75 | 111 | ||
76 | for (i = 0; i < MXS_INTERNAL_IRQS; i++) { | 112 | icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, |
77 | irq_set_chip_and_handler(i, &mxs_icoll_chip, handle_level_irq); | 113 | &icoll_irq_domain_ops, NULL); |
78 | set_irq_flags(i, IRQF_VALID); | 114 | WARN_ON(!icoll_domain); |
79 | } | 115 | } |
116 | |||
117 | static const struct of_device_id icoll_of_match[] __initconst = { | ||
118 | {.compatible = "fsl,icoll", .data = icoll_of_init}, | ||
119 | { /* sentinel */ } | ||
120 | }; | ||
121 | |||
122 | void __init icoll_init_irq(void) | ||
123 | { | ||
124 | of_irq_init(icoll_of_match); | ||
80 | } | 125 | } |
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h index 4dec79563f19..be5a9c93cb2a 100644 --- a/arch/arm/mach-mxs/include/mach/common.h +++ b/arch/arm/mach-mxs/include/mach/common.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | extern const u32 *mxs_get_ocotp(void); | 14 | extern const u32 *mxs_get_ocotp(void); |
15 | extern int mxs_reset_block(void __iomem *); | 15 | extern int mxs_reset_block(void __iomem *); |
16 | extern void mxs_timer_init(int); | 16 | extern void mxs_timer_init(void); |
17 | extern void mxs_restart(char, const char *); | 17 | extern void mxs_restart(char, const char *); |
18 | extern int mxs_saif_clkmux_select(unsigned int clkmux); | 18 | extern int mxs_saif_clkmux_select(unsigned int clkmux); |
19 | 19 | ||
@@ -24,5 +24,6 @@ extern int mx28_clocks_init(void); | |||
24 | extern void mx28_map_io(void); | 24 | extern void mx28_map_io(void); |
25 | 25 | ||
26 | extern void icoll_init_irq(void); | 26 | extern void icoll_init_irq(void); |
27 | extern void icoll_handle_irq(struct pt_regs *); | ||
27 | 28 | ||
28 | #endif /* __MACH_MXS_COMMON_H__ */ | 29 | #endif /* __MACH_MXS_COMMON_H__ */ |
diff --git a/arch/arm/mach-mxs/include/mach/entry-macro.S b/arch/arm/mach-mxs/include/mach/entry-macro.S deleted file mode 100644 index 0c14259705b9..000000000000 --- a/arch/arm/mach-mxs/include/mach/entry-macro.S +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Low-level IRQ helper macros for Freescale MXS-based | ||
3 | * | ||
4 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
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 along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | #include <mach/mxs.h> | ||
22 | |||
23 | #define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR) | ||
24 | #define HW_ICOLL_STAT_OFFSET 0x70 | ||
25 | |||
26 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
27 | ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET] | ||
28 | cmp \irqnr, #0x7F | ||
29 | strne \irqnr, [\base] | ||
30 | moveqs \irqnr, #0 | ||
31 | .endm | ||
32 | |||
33 | .macro get_irqnr_preamble, base, tmp | ||
34 | ldr \base, =MXS_ICOLL_VBASE | ||
35 | .endm | ||
diff --git a/arch/arm/mach-mxs/include/mach/irqs.h b/arch/arm/mach-mxs/include/mach/irqs.h deleted file mode 100644 index f771039b814a..000000000000 --- a/arch/arm/mach-mxs/include/mach/irqs.h +++ /dev/null | |||
@@ -1,32 +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_IRQS_H__ | ||
12 | #define __MACH_MXS_IRQS_H__ | ||
13 | |||
14 | #define MXS_INTERNAL_IRQS 128 | ||
15 | |||
16 | #define MXS_GPIO_IRQ_START MXS_INTERNAL_IRQS | ||
17 | |||
18 | /* the maximum for MXS-based */ | ||
19 | #define MXS_GPIO_IRQS (32 * 5) | ||
20 | |||
21 | /* | ||
22 | * The next 16 interrupts are for board specific purposes. Since | ||
23 | * the kernel can only run on one machine at a time, we can re-use | ||
24 | * these. If you need more, increase MXS_BOARD_IRQS, but keep it | ||
25 | * within sensible limits. | ||
26 | */ | ||
27 | #define MXS_BOARD_IRQ_START (MXS_GPIO_IRQ_START + MXS_GPIO_IRQS) | ||
28 | #define MXS_BOARD_IRQS 16 | ||
29 | |||
30 | #define NR_IRQS (MXS_BOARD_IRQ_START + MXS_BOARD_IRQS) | ||
31 | |||
32 | #endif /* __MACH_MXS_IRQS_H__ */ | ||
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 433af893ad8a..4748ec551a68 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c | |||
@@ -17,10 +17,8 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/irqdomain.h> | ||
21 | #include <linux/micrel_phy.h> | 20 | #include <linux/micrel_phy.h> |
22 | #include <linux/mxsfb.h> | 21 | #include <linux/mxsfb.h> |
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
25 | #include <linux/phy.h> | 23 | #include <linux/phy.h> |
26 | #include <linux/pinctrl/consumer.h> | 24 | #include <linux/pinctrl/consumer.h> |
@@ -141,37 +139,6 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = { | |||
141 | { /* sentinel */ } | 139 | { /* sentinel */ } |
142 | }; | 140 | }; |
143 | 141 | ||
144 | static int __init mxs_icoll_add_irq_domain(struct device_node *np, | ||
145 | struct device_node *interrupt_parent) | ||
146 | { | ||
147 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static int __init mxs_gpio_add_irq_domain(struct device_node *np, | ||
153 | struct device_node *interrupt_parent) | ||
154 | { | ||
155 | static int gpio_irq_base = MXS_GPIO_IRQ_START; | ||
156 | |||
157 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); | ||
158 | gpio_irq_base += 32; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static const struct of_device_id mxs_irq_match[] __initconst = { | ||
164 | { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, }, | ||
165 | { .compatible = "fsl,mxs-gpio", .data = mxs_gpio_add_irq_domain, }, | ||
166 | { /* sentinel */ } | ||
167 | }; | ||
168 | |||
169 | static void __init mxs_dt_init_irq(void) | ||
170 | { | ||
171 | icoll_init_irq(); | ||
172 | of_irq_init(mxs_irq_match); | ||
173 | } | ||
174 | |||
175 | static void __init imx23_timer_init(void) | 142 | static void __init imx23_timer_init(void) |
176 | { | 143 | { |
177 | mx23_clocks_init(); | 144 | mx23_clocks_init(); |
@@ -305,7 +272,7 @@ static void __init apx4devkit_init(void) | |||
305 | enable_clk_enet_out(); | 272 | enable_clk_enet_out(); |
306 | 273 | ||
307 | if (IS_BUILTIN(CONFIG_PHYLIB)) | 274 | if (IS_BUILTIN(CONFIG_PHYLIB)) |
308 | phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, | 275 | phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK, |
309 | apx4devkit_phy_fixup); | 276 | apx4devkit_phy_fixup); |
310 | 277 | ||
311 | mxsfb_pdata.mode_list = apx4devkit_video_modes; | 278 | mxsfb_pdata.mode_list = apx4devkit_video_modes; |
@@ -421,7 +388,8 @@ static const char *imx28_dt_compat[] __initdata = { | |||
421 | 388 | ||
422 | DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") | 389 | DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") |
423 | .map_io = mx23_map_io, | 390 | .map_io = mx23_map_io, |
424 | .init_irq = mxs_dt_init_irq, | 391 | .init_irq = icoll_init_irq, |
392 | .handle_irq = icoll_handle_irq, | ||
425 | .timer = &imx23_timer, | 393 | .timer = &imx23_timer, |
426 | .init_machine = mxs_machine_init, | 394 | .init_machine = mxs_machine_init, |
427 | .dt_compat = imx23_dt_compat, | 395 | .dt_compat = imx23_dt_compat, |
@@ -430,7 +398,8 @@ MACHINE_END | |||
430 | 398 | ||
431 | DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)") | 399 | DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)") |
432 | .map_io = mx28_map_io, | 400 | .map_io = mx28_map_io, |
433 | .init_irq = mxs_dt_init_irq, | 401 | .init_irq = icoll_init_irq, |
402 | .handle_irq = icoll_handle_irq, | ||
434 | .timer = &imx28_timer, | 403 | .timer = &imx28_timer, |
435 | .init_machine = mxs_machine_init, | 404 | .init_machine = mxs_machine_init, |
436 | .dt_compat = imx28_dt_compat, | 405 | .dt_compat = imx28_dt_compat, |
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c index 02d36de9c4e8..7c3792613392 100644 --- a/arch/arm/mach-mxs/timer.c +++ b/arch/arm/mach-mxs/timer.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/clockchips.h> | 26 | #include <linux/clockchips.h> |
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/of.h> | ||
29 | #include <linux/of_irq.h> | ||
28 | 30 | ||
29 | #include <asm/mach/time.h> | 31 | #include <asm/mach/time.h> |
30 | #include <mach/mxs.h> | 32 | #include <mach/mxs.h> |
@@ -244,9 +246,17 @@ static int __init mxs_clocksource_init(struct clk *timer_clk) | |||
244 | return 0; | 246 | return 0; |
245 | } | 247 | } |
246 | 248 | ||
247 | void __init mxs_timer_init(int irq) | 249 | void __init mxs_timer_init(void) |
248 | { | 250 | { |
251 | struct device_node *np; | ||
249 | struct clk *timer_clk; | 252 | struct clk *timer_clk; |
253 | int irq; | ||
254 | |||
255 | np = of_find_compatible_node(NULL, NULL, "fsl,timrot"); | ||
256 | if (!np) { | ||
257 | pr_err("%s: failed find timrot node\n", __func__); | ||
258 | return; | ||
259 | } | ||
250 | 260 | ||
251 | timer_clk = clk_get_sys("timrot", NULL); | 261 | timer_clk = clk_get_sys("timrot", NULL); |
252 | if (IS_ERR(timer_clk)) { | 262 | if (IS_ERR(timer_clk)) { |
@@ -295,5 +305,6 @@ void __init mxs_timer_init(int irq) | |||
295 | mxs_clockevent_init(timer_clk); | 305 | mxs_clockevent_init(timer_clk); |
296 | 306 | ||
297 | /* Make irqs happen */ | 307 | /* Make irqs happen */ |
308 | irq = irq_of_parse_and_map(np, 0); | ||
298 | setup_irq(irq, &mxs_timer_irq); | 309 | setup_irq(irq, &mxs_timer_irq); |
299 | } | 310 | } |
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 381c08027df4..bfa1eab91f41 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mtd/partitions.h> | 23 | #include <linux/mtd/partitions.h> |
24 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/pinctrl/machine.h> | ||
26 | #include <asm/hardware/vic.h> | 27 | #include <asm/hardware/vic.h> |
27 | #include <asm/sizes.h> | 28 | #include <asm/sizes.h> |
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
@@ -33,6 +34,7 @@ | |||
33 | 34 | ||
34 | #include <plat/gpio-nomadik.h> | 35 | #include <plat/gpio-nomadik.h> |
35 | #include <plat/mtu.h> | 36 | #include <plat/mtu.h> |
37 | #include <plat/pincfg.h> | ||
36 | 38 | ||
37 | #include <linux/platform_data/mtd-nomadik-nand.h> | 39 | #include <linux/platform_data/mtd-nomadik-nand.h> |
38 | #include <mach/fsmc.h> | 40 | #include <mach/fsmc.h> |
@@ -112,8 +114,7 @@ static struct mtd_partition nhk8815_partitions[] = { | |||
112 | static struct nomadik_nand_platform_data nhk8815_nand_data = { | 114 | static struct nomadik_nand_platform_data nhk8815_nand_data = { |
113 | .parts = nhk8815_partitions, | 115 | .parts = nhk8815_partitions, |
114 | .nparts = ARRAY_SIZE(nhk8815_partitions), | 116 | .nparts = ARRAY_SIZE(nhk8815_partitions), |
115 | .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING \ | 117 | .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING, |
116 | | NAND_NO_READRDY, | ||
117 | .init = nhk8815_nand_init, | 118 | .init = nhk8815_nand_init, |
118 | }; | 119 | }; |
119 | 120 | ||
@@ -291,8 +292,42 @@ static struct i2c_board_info __initdata nhk8815_i2c2_devices[] = { | |||
291 | }, | 292 | }, |
292 | }; | 293 | }; |
293 | 294 | ||
295 | static unsigned long out_low[] = { PIN_OUTPUT_LOW }; | ||
296 | static unsigned long out_high[] = { PIN_OUTPUT_HIGH }; | ||
297 | static unsigned long in_nopull[] = { PIN_INPUT_NOPULL }; | ||
298 | static unsigned long in_pullup[] = { PIN_INPUT_PULLUP }; | ||
299 | |||
300 | static struct pinctrl_map __initdata nhk8815_pinmap[] = { | ||
301 | PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-stn8815", "u0_a_1", "u0"), | ||
302 | PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl-stn8815", "u1_a_1", "u1"), | ||
303 | /* Hog in MMC/SD card mux */ | ||
304 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-stn8815", "mmcsd_a_1", "mmcsd"), | ||
305 | /* MCCLK */ | ||
306 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO8_B10", out_low), | ||
307 | /* MCCMD */ | ||
308 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO9_A10", in_pullup), | ||
309 | /* MCCMDDIR */ | ||
310 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO10_C11", out_high), | ||
311 | /* MCDAT3-0 */ | ||
312 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO11_B11", in_pullup), | ||
313 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO12_A11", in_pullup), | ||
314 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO13_C12", in_pullup), | ||
315 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO14_B12", in_pullup), | ||
316 | /* MCDAT0DIR */ | ||
317 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO15_A12", out_high), | ||
318 | /* MCDAT31DIR */ | ||
319 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO16_C13", out_high), | ||
320 | /* MCMSFBCLK */ | ||
321 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO24_C15", in_pullup), | ||
322 | /* CD input GPIO */ | ||
323 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO111_H21", in_nopull), | ||
324 | /* CD bias drive */ | ||
325 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO112_J21", out_low), | ||
326 | }; | ||
327 | |||
294 | static void __init nhk8815_platform_init(void) | 328 | static void __init nhk8815_platform_init(void) |
295 | { | 329 | { |
330 | pinctrl_register_mappings(nhk8815_pinmap, ARRAY_SIZE(nhk8815_pinmap)); | ||
296 | cpu8815_platform_init(); | 331 | cpu8815_platform_init(); |
297 | nhk8815_onenand_init(); | 332 | nhk8815_onenand_init(); |
298 | platform_add_devices(nhk8815_platform_devices, | 333 | platform_add_devices(nhk8815_platform_devices, |
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 6fd8e46567a4..b617eaed0ce5 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c | |||
@@ -83,6 +83,18 @@ void cpu8815_add_gpios(resource_size_t *base, int num, int irq, | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | static inline void | ||
87 | cpu8815_add_pinctrl(struct device *parent, const char *name) | ||
88 | { | ||
89 | struct platform_device_info pdevinfo = { | ||
90 | .parent = parent, | ||
91 | .name = name, | ||
92 | .id = -1, | ||
93 | }; | ||
94 | |||
95 | platform_device_register_full(&pdevinfo); | ||
96 | } | ||
97 | |||
86 | static int __init cpu8815_init(void) | 98 | static int __init cpu8815_init(void) |
87 | { | 99 | { |
88 | struct nmk_gpio_platform_data pdata = { | 100 | struct nmk_gpio_platform_data pdata = { |
@@ -91,6 +103,7 @@ static int __init cpu8815_init(void) | |||
91 | 103 | ||
92 | cpu8815_add_gpios(cpu8815_gpio_base, ARRAY_SIZE(cpu8815_gpio_base), | 104 | cpu8815_add_gpios(cpu8815_gpio_base, ARRAY_SIZE(cpu8815_gpio_base), |
93 | IRQ_GPIO0, &pdata); | 105 | IRQ_GPIO0, &pdata); |
106 | cpu8815_add_pinctrl(NULL, "pinctrl-stn8815"); | ||
94 | amba_apb_device_add(NULL, "rng", NOMADIK_RNG_BASE, SZ_4K, 0, 0, NULL, 0); | 107 | amba_apb_device_add(NULL, "rng", NOMADIK_RNG_BASE, SZ_4K, 0, 0, NULL, 0); |
95 | amba_apb_device_add(NULL, "rtc-pl031", NOMADIK_RTC_BASE, SZ_4K, IRQ_RTC_RTT, 0, NULL, 0); | 108 | amba_apb_device_add(NULL, "rtc-pl031", NOMADIK_RTC_BASE, SZ_4K, IRQ_RTC_RTT, 0, NULL, 0); |
96 | return 0; | 109 | return 0; |
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index 398e9e53e189..cd169c386161 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile | |||
@@ -61,14 +61,6 @@ obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o | |||
61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o | 61 | obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o |
62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o | 62 | obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o |
63 | 63 | ||
64 | # LEDs support | ||
65 | led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o | ||
66 | led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o | ||
67 | led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o | ||
68 | led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o | ||
69 | led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o | ||
70 | obj-$(CONFIG_LEDS) += $(led-y) | ||
71 | |||
72 | ifneq ($(CONFIG_FB_OMAP),) | 64 | ifneq ($(CONFIG_FB_OMAP),) |
73 | obj-y += lcd_dma.o | 65 | obj-y += lcd_dma.o |
74 | endif | 66 | endif |
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index af283a2bc7c7..376f7f29ef77 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/platform_data/gpio-omap.h> | 34 | #include <linux/platform_data/gpio-omap.h> |
35 | #include <linux/leds.h> | ||
35 | 36 | ||
36 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
37 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
@@ -307,12 +308,39 @@ static struct platform_device h2_irda_device = { | |||
307 | .resource = h2_irda_resources, | 308 | .resource = h2_irda_resources, |
308 | }; | 309 | }; |
309 | 310 | ||
311 | static struct gpio_led h2_gpio_led_pins[] = { | ||
312 | { | ||
313 | .name = "h2:red", | ||
314 | .default_trigger = "heartbeat", | ||
315 | .gpio = 3, | ||
316 | }, | ||
317 | { | ||
318 | .name = "h2:green", | ||
319 | .default_trigger = "cpu0", | ||
320 | .gpio = OMAP_MPUIO(4), | ||
321 | }, | ||
322 | }; | ||
323 | |||
324 | static struct gpio_led_platform_data h2_gpio_led_data = { | ||
325 | .leds = h2_gpio_led_pins, | ||
326 | .num_leds = ARRAY_SIZE(h2_gpio_led_pins), | ||
327 | }; | ||
328 | |||
329 | static struct platform_device h2_gpio_leds = { | ||
330 | .name = "leds-gpio", | ||
331 | .id = -1, | ||
332 | .dev = { | ||
333 | .platform_data = &h2_gpio_led_data, | ||
334 | }, | ||
335 | }; | ||
336 | |||
310 | static struct platform_device *h2_devices[] __initdata = { | 337 | static struct platform_device *h2_devices[] __initdata = { |
311 | &h2_nor_device, | 338 | &h2_nor_device, |
312 | &h2_nand_device, | 339 | &h2_nand_device, |
313 | &h2_smc91x_device, | 340 | &h2_smc91x_device, |
314 | &h2_irda_device, | 341 | &h2_irda_device, |
315 | &h2_kp_device, | 342 | &h2_kp_device, |
343 | &h2_gpio_leds, | ||
316 | }; | 344 | }; |
317 | 345 | ||
318 | static void __init h2_init_smc91x(void) | 346 | static void __init h2_init_smc91x(void) |
@@ -407,6 +435,10 @@ static void __init h2_init(void) | |||
407 | omap_cfg_reg(E19_1610_KBR4); | 435 | omap_cfg_reg(E19_1610_KBR4); |
408 | omap_cfg_reg(N19_1610_KBR5); | 436 | omap_cfg_reg(N19_1610_KBR5); |
409 | 437 | ||
438 | /* GPIO based LEDs */ | ||
439 | omap_cfg_reg(P18_1610_GPIO3); | ||
440 | omap_cfg_reg(MPUIO4); | ||
441 | |||
410 | h2_smc91x_resources[1].start = gpio_to_irq(0); | 442 | h2_smc91x_resources[1].start = gpio_to_irq(0); |
411 | h2_smc91x_resources[1].end = gpio_to_irq(0); | 443 | h2_smc91x_resources[1].end = gpio_to_irq(0); |
412 | platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); | 444 | platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index 06d11b1ee9c6..ededdb7ef28c 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/smc91x.h> | 32 | #include <linux/smc91x.h> |
33 | #include <linux/omapfb.h> | 33 | #include <linux/omapfb.h> |
34 | #include <linux/platform_data/gpio-omap.h> | 34 | #include <linux/platform_data/gpio-omap.h> |
35 | #include <linux/leds.h> | ||
35 | 36 | ||
36 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
37 | #include <asm/page.h> | 38 | #include <asm/page.h> |
@@ -325,6 +326,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = { | |||
325 | }, | 326 | }, |
326 | }; | 327 | }; |
327 | 328 | ||
329 | static struct gpio_led h3_gpio_led_pins[] = { | ||
330 | { | ||
331 | .name = "h3:red", | ||
332 | .default_trigger = "heartbeat", | ||
333 | .gpio = 3, | ||
334 | }, | ||
335 | { | ||
336 | .name = "h3:green", | ||
337 | .default_trigger = "cpu0", | ||
338 | .gpio = OMAP_MPUIO(4), | ||
339 | }, | ||
340 | }; | ||
341 | |||
342 | static struct gpio_led_platform_data h3_gpio_led_data = { | ||
343 | .leds = h3_gpio_led_pins, | ||
344 | .num_leds = ARRAY_SIZE(h3_gpio_led_pins), | ||
345 | }; | ||
346 | |||
347 | static struct platform_device h3_gpio_leds = { | ||
348 | .name = "leds-gpio", | ||
349 | .id = -1, | ||
350 | .dev = { | ||
351 | .platform_data = &h3_gpio_led_data, | ||
352 | }, | ||
353 | }; | ||
354 | |||
328 | static struct platform_device *devices[] __initdata = { | 355 | static struct platform_device *devices[] __initdata = { |
329 | &nor_device, | 356 | &nor_device, |
330 | &nand_device, | 357 | &nand_device, |
@@ -332,6 +359,7 @@ static struct platform_device *devices[] __initdata = { | |||
332 | &intlat_device, | 359 | &intlat_device, |
333 | &h3_kp_device, | 360 | &h3_kp_device, |
334 | &h3_lcd_device, | 361 | &h3_lcd_device, |
362 | &h3_gpio_leds, | ||
335 | }; | 363 | }; |
336 | 364 | ||
337 | static struct omap_usb_config h3_usb_config __initdata = { | 365 | static struct omap_usb_config h3_usb_config __initdata = { |
@@ -399,6 +427,10 @@ static void __init h3_init(void) | |||
399 | omap_cfg_reg(E19_1610_KBR4); | 427 | omap_cfg_reg(E19_1610_KBR4); |
400 | omap_cfg_reg(N19_1610_KBR5); | 428 | omap_cfg_reg(N19_1610_KBR5); |
401 | 429 | ||
430 | /* GPIO based LEDs */ | ||
431 | omap_cfg_reg(P18_1610_GPIO3); | ||
432 | omap_cfg_reg(MPUIO4); | ||
433 | |||
402 | smc91x_resources[1].start = gpio_to_irq(40); | 434 | smc91x_resources[1].start = gpio_to_irq(40); |
403 | smc91x_resources[1].end = gpio_to_irq(40); | 435 | smc91x_resources[1].end = gpio_to_irq(40); |
404 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 436 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 2f1f9b967576..5973945a8741 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -382,10 +382,37 @@ static struct platform_device osk5912_lcd_device = { | |||
382 | .id = -1, | 382 | .id = -1, |
383 | }; | 383 | }; |
384 | 384 | ||
385 | static struct gpio_led mistral_gpio_led_pins[] = { | ||
386 | { | ||
387 | .name = "mistral:red", | ||
388 | .default_trigger = "heartbeat", | ||
389 | .gpio = 3, | ||
390 | }, | ||
391 | { | ||
392 | .name = "mistral:green", | ||
393 | .default_trigger = "cpu0", | ||
394 | .gpio = OMAP_MPUIO(4), | ||
395 | }, | ||
396 | }; | ||
397 | |||
398 | static struct gpio_led_platform_data mistral_gpio_led_data = { | ||
399 | .leds = mistral_gpio_led_pins, | ||
400 | .num_leds = ARRAY_SIZE(mistral_gpio_led_pins), | ||
401 | }; | ||
402 | |||
403 | static struct platform_device mistral_gpio_leds = { | ||
404 | .name = "leds-gpio", | ||
405 | .id = -1, | ||
406 | .dev = { | ||
407 | .platform_data = &mistral_gpio_led_data, | ||
408 | }, | ||
409 | }; | ||
410 | |||
385 | static struct platform_device *mistral_devices[] __initdata = { | 411 | static struct platform_device *mistral_devices[] __initdata = { |
386 | &osk5912_kp_device, | 412 | &osk5912_kp_device, |
387 | &mistral_bl_device, | 413 | &mistral_bl_device, |
388 | &osk5912_lcd_device, | 414 | &osk5912_lcd_device, |
415 | &mistral_gpio_leds, | ||
389 | }; | 416 | }; |
390 | 417 | ||
391 | static int mistral_get_pendown_state(void) | 418 | static int mistral_get_pendown_state(void) |
@@ -510,6 +537,12 @@ static void __init osk_mistral_init(void) | |||
510 | if (gpio_request(2, "lcd_pwr") == 0) | 537 | if (gpio_request(2, "lcd_pwr") == 0) |
511 | gpio_direction_output(2, 1); | 538 | gpio_direction_output(2, 1); |
512 | 539 | ||
540 | /* | ||
541 | * GPIO based LEDs | ||
542 | */ | ||
543 | omap_cfg_reg(P18_1610_GPIO3); | ||
544 | omap_cfg_reg(MPUIO4); | ||
545 | |||
513 | i2c_register_board_info(1, mistral_i2c_board_info, | 546 | i2c_register_board_info(1, mistral_i2c_board_info, |
514 | ARRAY_SIZE(mistral_i2c_board_info)); | 547 | ARRAY_SIZE(mistral_i2c_board_info)); |
515 | 548 | ||
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c deleted file mode 100644 index 6f958aec9459..000000000000 --- a/arch/arm/mach-omap1/leds-h2p2-debug.c +++ /dev/null | |||
@@ -1,169 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-h2p2-debug.c | ||
3 | * | ||
4 | * Copyright 2003 by Texas Instruments Incorporated | ||
5 | * | ||
6 | * There are 16 LEDs on the debug board (all green); four may be used | ||
7 | * for logical 'green', 'amber', 'red', and 'blue' (after "claiming"). | ||
8 | * | ||
9 | * The "surfer" expansion board and H2 sample board also have two-color | ||
10 | * green+red LEDs (in parallel), used here for timer and idle indicators. | ||
11 | */ | ||
12 | #include <linux/gpio.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel_stat.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/platform_data/gpio-omap.h> | ||
18 | |||
19 | #include <mach/hardware.h> | ||
20 | #include <asm/leds.h> | ||
21 | #include <asm/mach-types.h> | ||
22 | |||
23 | #include <plat/fpga.h> | ||
24 | |||
25 | #include "leds.h" | ||
26 | |||
27 | |||
28 | #define GPIO_LED_RED 3 | ||
29 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
30 | |||
31 | |||
32 | #define LED_STATE_ENABLED 0x01 | ||
33 | #define LED_STATE_CLAIMED 0x02 | ||
34 | #define LED_TIMER_ON 0x04 | ||
35 | |||
36 | #define GPIO_IDLE GPIO_LED_GREEN | ||
37 | #define GPIO_TIMER GPIO_LED_RED | ||
38 | |||
39 | |||
40 | void h2p2_dbg_leds_event(led_event_t evt) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | |||
44 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
45 | static u16 led_state, hw_led_state; | ||
46 | |||
47 | local_irq_save(flags); | ||
48 | |||
49 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
50 | goto done; | ||
51 | |||
52 | switch (evt) { | ||
53 | case led_start: | ||
54 | if (!fpga) | ||
55 | fpga = ioremap(H2P2_DBG_FPGA_START, | ||
56 | H2P2_DBG_FPGA_SIZE); | ||
57 | if (fpga) { | ||
58 | led_state |= LED_STATE_ENABLED; | ||
59 | __raw_writew(~0, &fpga->leds); | ||
60 | } | ||
61 | break; | ||
62 | |||
63 | case led_stop: | ||
64 | case led_halted: | ||
65 | /* all leds off during suspend or shutdown */ | ||
66 | |||
67 | if (! machine_is_omap_perseus2()) { | ||
68 | gpio_set_value(GPIO_TIMER, 0); | ||
69 | gpio_set_value(GPIO_IDLE, 0); | ||
70 | } | ||
71 | |||
72 | led_state &= ~LED_STATE_ENABLED; | ||
73 | if (fpga) { | ||
74 | __raw_writew(~0, &fpga->leds); | ||
75 | if (evt == led_halted) { | ||
76 | iounmap(fpga); | ||
77 | fpga = NULL; | ||
78 | } | ||
79 | } | ||
80 | |||
81 | goto done; | ||
82 | |||
83 | case led_claim: | ||
84 | led_state |= LED_STATE_CLAIMED; | ||
85 | hw_led_state = 0; | ||
86 | break; | ||
87 | |||
88 | case led_release: | ||
89 | led_state &= ~LED_STATE_CLAIMED; | ||
90 | break; | ||
91 | |||
92 | #ifdef CONFIG_LEDS_TIMER | ||
93 | case led_timer: | ||
94 | led_state ^= LED_TIMER_ON; | ||
95 | |||
96 | if (machine_is_omap_perseus2()) | ||
97 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
98 | else { | ||
99 | gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON); | ||
100 | goto done; | ||
101 | } | ||
102 | |||
103 | break; | ||
104 | #endif | ||
105 | |||
106 | #ifdef CONFIG_LEDS_CPU | ||
107 | case led_idle_start: | ||
108 | if (machine_is_omap_perseus2()) | ||
109 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
110 | else { | ||
111 | gpio_set_value(GPIO_IDLE, 1); | ||
112 | goto done; | ||
113 | } | ||
114 | |||
115 | break; | ||
116 | |||
117 | case led_idle_end: | ||
118 | if (machine_is_omap_perseus2()) | ||
119 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
120 | else { | ||
121 | gpio_set_value(GPIO_IDLE, 0); | ||
122 | goto done; | ||
123 | } | ||
124 | |||
125 | break; | ||
126 | #endif | ||
127 | |||
128 | case led_green_on: | ||
129 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
130 | break; | ||
131 | case led_green_off: | ||
132 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
133 | break; | ||
134 | |||
135 | case led_amber_on: | ||
136 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
137 | break; | ||
138 | case led_amber_off: | ||
139 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
140 | break; | ||
141 | |||
142 | case led_red_on: | ||
143 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
144 | break; | ||
145 | case led_red_off: | ||
146 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
147 | break; | ||
148 | |||
149 | case led_blue_on: | ||
150 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
151 | break; | ||
152 | case led_blue_off: | ||
153 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
154 | break; | ||
155 | |||
156 | default: | ||
157 | break; | ||
158 | } | ||
159 | |||
160 | |||
161 | /* | ||
162 | * Actually burn the LEDs | ||
163 | */ | ||
164 | if (led_state & LED_STATE_ENABLED && fpga) | ||
165 | __raw_writew(~hw_led_state, &fpga->leds); | ||
166 | |||
167 | done: | ||
168 | local_irq_restore(flags); | ||
169 | } | ||
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c deleted file mode 100644 index 3a066ee8d02c..000000000000 --- a/arch/arm/mach-omap1/leds-innovator.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-innovator.c | ||
3 | */ | ||
4 | #include <linux/init.h> | ||
5 | |||
6 | #include <mach/hardware.h> | ||
7 | #include <asm/leds.h> | ||
8 | |||
9 | #include "leds.h" | ||
10 | |||
11 | |||
12 | #define LED_STATE_ENABLED 1 | ||
13 | #define LED_STATE_CLAIMED 2 | ||
14 | |||
15 | static unsigned int led_state; | ||
16 | static unsigned int hw_led_state; | ||
17 | |||
18 | void innovator_leds_event(led_event_t evt) | ||
19 | { | ||
20 | unsigned long flags; | ||
21 | |||
22 | local_irq_save(flags); | ||
23 | |||
24 | switch (evt) { | ||
25 | case led_start: | ||
26 | hw_led_state = 0; | ||
27 | led_state = LED_STATE_ENABLED; | ||
28 | break; | ||
29 | |||
30 | case led_stop: | ||
31 | led_state &= ~LED_STATE_ENABLED; | ||
32 | hw_led_state = 0; | ||
33 | break; | ||
34 | |||
35 | case led_claim: | ||
36 | led_state |= LED_STATE_CLAIMED; | ||
37 | hw_led_state = 0; | ||
38 | break; | ||
39 | |||
40 | case led_release: | ||
41 | led_state &= ~LED_STATE_CLAIMED; | ||
42 | hw_led_state = 0; | ||
43 | break; | ||
44 | |||
45 | #ifdef CONFIG_LEDS_TIMER | ||
46 | case led_timer: | ||
47 | if (!(led_state & LED_STATE_CLAIMED)) | ||
48 | hw_led_state ^= 0; | ||
49 | break; | ||
50 | #endif | ||
51 | |||
52 | #ifdef CONFIG_LEDS_CPU | ||
53 | case led_idle_start: | ||
54 | if (!(led_state & LED_STATE_CLAIMED)) | ||
55 | hw_led_state |= 0; | ||
56 | break; | ||
57 | |||
58 | case led_idle_end: | ||
59 | if (!(led_state & LED_STATE_CLAIMED)) | ||
60 | hw_led_state &= ~0; | ||
61 | break; | ||
62 | #endif | ||
63 | |||
64 | case led_halted: | ||
65 | break; | ||
66 | |||
67 | case led_green_on: | ||
68 | if (led_state & LED_STATE_CLAIMED) | ||
69 | hw_led_state &= ~0; | ||
70 | break; | ||
71 | |||
72 | case led_green_off: | ||
73 | if (led_state & LED_STATE_CLAIMED) | ||
74 | hw_led_state |= 0; | ||
75 | break; | ||
76 | |||
77 | case led_amber_on: | ||
78 | break; | ||
79 | |||
80 | case led_amber_off: | ||
81 | break; | ||
82 | |||
83 | case led_red_on: | ||
84 | if (led_state & LED_STATE_CLAIMED) | ||
85 | hw_led_state &= ~0; | ||
86 | break; | ||
87 | |||
88 | case led_red_off: | ||
89 | if (led_state & LED_STATE_CLAIMED) | ||
90 | hw_led_state |= 0; | ||
91 | break; | ||
92 | |||
93 | default: | ||
94 | break; | ||
95 | } | ||
96 | |||
97 | local_irq_restore(flags); | ||
98 | } | ||
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c deleted file mode 100644 index 936ed426b84f..000000000000 --- a/arch/arm/mach-omap1/leds-osk.c +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-osk.c | ||
3 | * | ||
4 | * LED driver for OSK with optional Mistral QVGA board | ||
5 | */ | ||
6 | #include <linux/gpio.h> | ||
7 | #include <linux/init.h> | ||
8 | |||
9 | #include <mach/hardware.h> | ||
10 | #include <asm/leds.h> | ||
11 | |||
12 | #include "leds.h" | ||
13 | |||
14 | |||
15 | #define LED_STATE_ENABLED (1 << 0) | ||
16 | #define LED_STATE_CLAIMED (1 << 1) | ||
17 | static u8 led_state; | ||
18 | |||
19 | #define TIMER_LED (1 << 3) /* Mistral board */ | ||
20 | #define IDLE_LED (1 << 4) /* Mistral board */ | ||
21 | static u8 hw_led_state; | ||
22 | |||
23 | |||
24 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
25 | |||
26 | /* For now, all system indicators require the Mistral board, since that | ||
27 | * LED can be manipulated without a task context. This LED is either red, | ||
28 | * or green, but not both; it can't give the full "disco led" effect. | ||
29 | */ | ||
30 | |||
31 | #define GPIO_LED_RED 3 | ||
32 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
33 | |||
34 | static void mistral_setled(void) | ||
35 | { | ||
36 | int red = 0; | ||
37 | int green = 0; | ||
38 | |||
39 | if (hw_led_state & TIMER_LED) | ||
40 | red = 1; | ||
41 | else if (hw_led_state & IDLE_LED) | ||
42 | green = 1; | ||
43 | /* else both sides are disabled */ | ||
44 | |||
45 | gpio_set_value(GPIO_LED_GREEN, green); | ||
46 | gpio_set_value(GPIO_LED_RED, red); | ||
47 | } | ||
48 | |||
49 | #endif | ||
50 | |||
51 | void osk_leds_event(led_event_t evt) | ||
52 | { | ||
53 | unsigned long flags; | ||
54 | u16 leds; | ||
55 | |||
56 | local_irq_save(flags); | ||
57 | |||
58 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
59 | goto done; | ||
60 | |||
61 | leds = hw_led_state; | ||
62 | switch (evt) { | ||
63 | case led_start: | ||
64 | led_state |= LED_STATE_ENABLED; | ||
65 | hw_led_state = 0; | ||
66 | leds = ~0; | ||
67 | break; | ||
68 | |||
69 | case led_halted: | ||
70 | case led_stop: | ||
71 | led_state &= ~LED_STATE_ENABLED; | ||
72 | hw_led_state = 0; | ||
73 | break; | ||
74 | |||
75 | case led_claim: | ||
76 | led_state |= LED_STATE_CLAIMED; | ||
77 | hw_led_state = 0; | ||
78 | leds = ~0; | ||
79 | break; | ||
80 | |||
81 | case led_release: | ||
82 | led_state &= ~LED_STATE_CLAIMED; | ||
83 | hw_led_state = 0; | ||
84 | break; | ||
85 | |||
86 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
87 | |||
88 | case led_timer: | ||
89 | hw_led_state ^= TIMER_LED; | ||
90 | mistral_setled(); | ||
91 | break; | ||
92 | |||
93 | case led_idle_start: /* idle == off */ | ||
94 | hw_led_state &= ~IDLE_LED; | ||
95 | mistral_setled(); | ||
96 | break; | ||
97 | |||
98 | case led_idle_end: | ||
99 | hw_led_state |= IDLE_LED; | ||
100 | mistral_setled(); | ||
101 | break; | ||
102 | |||
103 | #endif /* CONFIG_OMAP_OSK_MISTRAL */ | ||
104 | |||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | leds ^= hw_led_state; | ||
110 | |||
111 | done: | ||
112 | local_irq_restore(flags); | ||
113 | } | ||
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c deleted file mode 100644 index 4071479f7106..000000000000 --- a/arch/arm/mach-omap1/leds.c +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds.c | ||
3 | * | ||
4 | * OMAP LEDs dispatcher | ||
5 | */ | ||
6 | #include <linux/gpio.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/platform_data/gpio-omap.h> | ||
10 | |||
11 | #include <asm/leds.h> | ||
12 | #include <asm/mach-types.h> | ||
13 | |||
14 | #include <mach/mux.h> | ||
15 | |||
16 | #include "leds.h" | ||
17 | |||
18 | static int __init | ||
19 | omap_leds_init(void) | ||
20 | { | ||
21 | if (!cpu_class_is_omap1()) | ||
22 | return -ENODEV; | ||
23 | |||
24 | if (machine_is_omap_innovator()) | ||
25 | leds_event = innovator_leds_event; | ||
26 | |||
27 | else if (machine_is_omap_h2() | ||
28 | || machine_is_omap_h3() | ||
29 | || machine_is_omap_perseus2()) | ||
30 | leds_event = h2p2_dbg_leds_event; | ||
31 | |||
32 | else if (machine_is_omap_osk()) | ||
33 | leds_event = osk_leds_event; | ||
34 | |||
35 | else | ||
36 | return -1; | ||
37 | |||
38 | if (machine_is_omap_h2() | ||
39 | || machine_is_omap_h3() | ||
40 | #ifdef CONFIG_OMAP_OSK_MISTRAL | ||
41 | || machine_is_omap_osk() | ||
42 | #endif | ||
43 | ) { | ||
44 | |||
45 | /* LED1/LED2 pins can be used as GPIO (as done here), or by | ||
46 | * the LPG (works even in deep sleep!), to drive a bicolor | ||
47 | * LED on the H2 sample board, and another on the H2/P2 | ||
48 | * "surfer" expansion board. | ||
49 | * | ||
50 | * The same pins drive a LED on the OSK Mistral board, but | ||
51 | * that's a different kind of LED (just one color at a time). | ||
52 | */ | ||
53 | omap_cfg_reg(P18_1610_GPIO3); | ||
54 | if (gpio_request(3, "LED red") == 0) | ||
55 | gpio_direction_output(3, 1); | ||
56 | else | ||
57 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); | ||
58 | |||
59 | omap_cfg_reg(MPUIO4); | ||
60 | if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) | ||
61 | gpio_direction_output(OMAP_MPUIO(4), 1); | ||
62 | else | ||
63 | printk(KERN_WARNING "LED: can't get MPUIO4/green?\n"); | ||
64 | } | ||
65 | |||
66 | leds_event(led_start); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | __initcall(omap_leds_init); | ||
diff --git a/arch/arm/mach-omap1/leds.h b/arch/arm/mach-omap1/leds.h deleted file mode 100644 index a1e9fedc376c..000000000000 --- a/arch/arm/mach-omap1/leds.h +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | extern void innovator_leds_event(led_event_t evt); | ||
2 | extern void h2p2_dbg_leds_event(led_event_t evt); | ||
3 | extern void osk_leds_event(led_event_t evt); | ||
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index 4062480bfec7..4d4816fd6fc9 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/clockchips.h> | 44 | #include <linux/clockchips.h> |
45 | #include <linux/io.h> | 45 | #include <linux/io.h> |
46 | 46 | ||
47 | #include <asm/leds.h> | ||
48 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
49 | #include <asm/sched_clock.h> | 48 | #include <asm/sched_clock.h> |
50 | 49 | ||
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index eae49c3980c9..74529549130c 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/clockchips.h> | 46 | #include <linux/clockchips.h> |
47 | #include <linux/io.h> | 47 | #include <linux/io.h> |
48 | 48 | ||
49 | #include <asm/leds.h> | ||
50 | #include <asm/irq.h> | 49 | #include <asm/irq.h> |
51 | #include <asm/mach/irq.h> | 50 | #include <asm/mach/irq.h> |
52 | #include <asm/mach/time.h> | 51 | #include <asm/mach/time.h> |
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index eef99b77c40b..a6219eaf1f68 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -25,6 +25,9 @@ config ARCH_OMAP2PLUS_TYPICAL | |||
25 | config SOC_HAS_OMAP2_SDRC | 25 | config SOC_HAS_OMAP2_SDRC |
26 | bool "OMAP2 SDRAM Controller support" | 26 | bool "OMAP2 SDRAM Controller support" |
27 | 27 | ||
28 | config SOC_HAS_REALTIME_COUNTER | ||
29 | bool "Real time free running counter" | ||
30 | |||
28 | config ARCH_OMAP2 | 31 | config ARCH_OMAP2 |
29 | bool "TI OMAP2" | 32 | bool "TI OMAP2" |
30 | depends on ARCH_OMAP2PLUS | 33 | depends on ARCH_OMAP2PLUS |
@@ -45,6 +48,7 @@ config ARCH_OMAP3 | |||
45 | select ARM_CPU_SUSPEND if PM | 48 | select ARM_CPU_SUSPEND if PM |
46 | select MULTI_IRQ_HANDLER | 49 | select MULTI_IRQ_HANDLER |
47 | select SOC_HAS_OMAP2_SDRC | 50 | select SOC_HAS_OMAP2_SDRC |
51 | select OMAP_INTERCONNECT | ||
48 | 52 | ||
49 | config ARCH_OMAP4 | 53 | config ARCH_OMAP4 |
50 | bool "TI OMAP4" | 54 | bool "TI OMAP4" |
@@ -64,6 +68,7 @@ config ARCH_OMAP4 | |||
64 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 68 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
65 | select ARM_CPU_SUSPEND if PM | 69 | select ARM_CPU_SUSPEND if PM |
66 | select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP | 70 | select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP |
71 | select OMAP_INTERCONNECT | ||
67 | 72 | ||
68 | config SOC_OMAP5 | 73 | config SOC_OMAP5 |
69 | bool "TI OMAP5" | 74 | bool "TI OMAP5" |
@@ -71,6 +76,8 @@ config SOC_OMAP5 | |||
71 | select ARM_GIC | 76 | select ARM_GIC |
72 | select HAVE_SMP | 77 | select HAVE_SMP |
73 | select ARM_CPU_SUSPEND if PM | 78 | select ARM_CPU_SUSPEND if PM |
79 | select SOC_HAS_REALTIME_COUNTER | ||
80 | select ARM_ARCH_TIMER | ||
74 | 81 | ||
75 | comment "OMAP Core Type" | 82 | comment "OMAP Core Type" |
76 | depends on ARCH_OMAP2 | 83 | depends on ARCH_OMAP2 |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index b807deb0f521..fe40d9e488c9 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -181,11 +181,6 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o | |||
181 | obj-$(CONFIG_OMAP3_EMU) += emu.o | 181 | obj-$(CONFIG_OMAP3_EMU) += emu.o |
182 | obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o | 182 | obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o |
183 | 183 | ||
184 | # L3 interconnect | ||
185 | obj-$(CONFIG_ARCH_OMAP3) += omap_l3_smx.o | ||
186 | obj-$(CONFIG_ARCH_OMAP4) += omap_l3_noc.o | ||
187 | obj-$(CONFIG_SOC_OMAP5) += omap_l3_noc.o | ||
188 | |||
189 | obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o | 184 | obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o |
190 | mailbox_mach-objs := mailbox.o | 185 | mailbox_mach-objs := mailbox.o |
191 | 186 | ||
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 6fe90796d462..a88809a59ea9 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -545,6 +545,14 @@ static struct twl6040_platform_data twl6040_data = { | |||
545 | .audpwron_gpio = 127, | 545 | .audpwron_gpio = 127, |
546 | }; | 546 | }; |
547 | 547 | ||
548 | static struct i2c_board_info __initdata sdp4430_i2c_1_boardinfo[] = { | ||
549 | { | ||
550 | I2C_BOARD_INFO("twl6040", 0x4b), | ||
551 | .irq = 119 + OMAP44XX_IRQ_GIC_START, | ||
552 | .platform_data = &twl6040_data, | ||
553 | }, | ||
554 | }; | ||
555 | |||
548 | static struct twl4030_platform_data sdp4430_twldata = { | 556 | static struct twl4030_platform_data sdp4430_twldata = { |
549 | /* Regulators */ | 557 | /* Regulators */ |
550 | .vusim = &sdp4430_vusim, | 558 | .vusim = &sdp4430_vusim, |
@@ -578,8 +586,8 @@ static int __init omap4_i2c_init(void) | |||
578 | TWL_COMMON_REGULATOR_CLK32KG | | 586 | TWL_COMMON_REGULATOR_CLK32KG | |
579 | TWL_COMMON_REGULATOR_V1V8 | | 587 | TWL_COMMON_REGULATOR_V1V8 | |
580 | TWL_COMMON_REGULATOR_V2V1); | 588 | TWL_COMMON_REGULATOR_V2V1); |
581 | omap4_pmic_init("twl6030", &sdp4430_twldata, | 589 | omap4_pmic_init("twl6030", &sdp4430_twldata, sdp4430_i2c_1_boardinfo, |
582 | &twl6040_data, 119 + OMAP44XX_IRQ_GIC_START); | 590 | ARRAY_SIZE(sdp4430_i2c_1_boardinfo)); |
583 | omap_register_i2c_bus(2, 400, NULL, 0); | 591 | omap_register_i2c_bus(2, 400, NULL, 0); |
584 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, | 592 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
585 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); | 593 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 3fe5f0f69c73..c64e565bdef5 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/spi/ads7846.h> | 32 | #include <linux/spi/ads7846.h> |
33 | #include <linux/i2c/twl.h> | 33 | #include <linux/i2c/twl.h> |
34 | #include <linux/usb/otg.h> | 34 | #include <linux/usb/otg.h> |
35 | #include <linux/usb/nop-usb-xceiv.h> | ||
35 | #include <linux/smsc911x.h> | 36 | #include <linux/smsc911x.h> |
36 | 37 | ||
37 | #include <linux/wl12xx.h> | 38 | #include <linux/wl12xx.h> |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 556e777b9c40..2b012f9d6925 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -264,6 +264,14 @@ static struct twl6040_platform_data twl6040_data = { | |||
264 | .audpwron_gpio = 127, | 264 | .audpwron_gpio = 127, |
265 | }; | 265 | }; |
266 | 266 | ||
267 | static struct i2c_board_info __initdata panda_i2c_1_boardinfo[] = { | ||
268 | { | ||
269 | I2C_BOARD_INFO("twl6040", 0x4b), | ||
270 | .irq = 119 + OMAP44XX_IRQ_GIC_START, | ||
271 | .platform_data = &twl6040_data, | ||
272 | }, | ||
273 | }; | ||
274 | |||
267 | /* Panda board uses the common PMIC configuration */ | 275 | /* Panda board uses the common PMIC configuration */ |
268 | static struct twl4030_platform_data omap4_panda_twldata; | 276 | static struct twl4030_platform_data omap4_panda_twldata; |
269 | 277 | ||
@@ -291,8 +299,8 @@ static int __init omap4_panda_i2c_init(void) | |||
291 | TWL_COMMON_REGULATOR_CLK32KG | | 299 | TWL_COMMON_REGULATOR_CLK32KG | |
292 | TWL_COMMON_REGULATOR_V1V8 | | 300 | TWL_COMMON_REGULATOR_V1V8 | |
293 | TWL_COMMON_REGULATOR_V2V1); | 301 | TWL_COMMON_REGULATOR_V2V1); |
294 | omap4_pmic_init("twl6030", &omap4_panda_twldata, | 302 | omap4_pmic_init("twl6030", &omap4_panda_twldata, panda_i2c_1_boardinfo, |
295 | &twl6040_data, 119 + OMAP44XX_IRQ_GIC_START); | 303 | ARRAY_SIZE(panda_i2c_1_boardinfo)); |
296 | omap_register_i2c_bus(2, 400, NULL, 0); | 304 | omap_register_i2c_bus(2, 400, NULL, 0); |
297 | /* | 305 | /* |
298 | * Bus 3 is attached to the DVI port where devices like the pico DLP | 306 | * Bus 3 is attached to the DVI port where devices like the pico DLP |
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index 3945c5017085..ed85fb898c7f 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "common.h" | 33 | #include "common.h" |
34 | #include <plat/dma.h> | 34 | #include <plat/dma.h> |
35 | #include <plat/gpmc.h> | 35 | #include <plat/gpmc.h> |
36 | #include <plat/omap-pm.h> | ||
36 | #include "gpmc-smc91x.h" | 37 | #include "gpmc-smc91x.h" |
37 | 38 | ||
38 | #include "board-rx51.h" | 39 | #include "board-rx51.h" |
@@ -46,6 +47,10 @@ | |||
46 | #include <../drivers/staging/iio/light/tsl2563.h> | 47 | #include <../drivers/staging/iio/light/tsl2563.h> |
47 | #include <linux/lis3lv02d.h> | 48 | #include <linux/lis3lv02d.h> |
48 | 49 | ||
50 | #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) | ||
51 | #include <media/ir-rx51.h> | ||
52 | #endif | ||
53 | |||
49 | #include "mux.h" | 54 | #include "mux.h" |
50 | #include "hsmmc.h" | 55 | #include "hsmmc.h" |
51 | #include "common-board-devices.h" | 56 | #include "common-board-devices.h" |
@@ -1217,6 +1222,30 @@ static void __init rx51_init_tsc2005(void) | |||
1217 | gpio_to_irq(RX51_TSC2005_IRQ_GPIO); | 1222 | gpio_to_irq(RX51_TSC2005_IRQ_GPIO); |
1218 | } | 1223 | } |
1219 | 1224 | ||
1225 | #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) | ||
1226 | static struct lirc_rx51_platform_data rx51_lirc_data = { | ||
1227 | .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat, | ||
1228 | .pwm_timer = 9, /* Use GPT 9 for CIR */ | ||
1229 | }; | ||
1230 | |||
1231 | static struct platform_device rx51_lirc_device = { | ||
1232 | .name = "lirc_rx51", | ||
1233 | .id = -1, | ||
1234 | .dev = { | ||
1235 | .platform_data = &rx51_lirc_data, | ||
1236 | }, | ||
1237 | }; | ||
1238 | |||
1239 | static void __init rx51_init_lirc(void) | ||
1240 | { | ||
1241 | platform_device_register(&rx51_lirc_device); | ||
1242 | } | ||
1243 | #else | ||
1244 | static void __init rx51_init_lirc(void) | ||
1245 | { | ||
1246 | } | ||
1247 | #endif | ||
1248 | |||
1220 | void __init rx51_peripherals_init(void) | 1249 | void __init rx51_peripherals_init(void) |
1221 | { | 1250 | { |
1222 | rx51_i2c_init(); | 1251 | rx51_i2c_init(); |
@@ -1227,6 +1256,7 @@ void __init rx51_peripherals_init(void) | |||
1227 | rx51_init_wl1251(); | 1256 | rx51_init_wl1251(); |
1228 | rx51_init_tsc2005(); | 1257 | rx51_init_tsc2005(); |
1229 | rx51_init_si4713(); | 1258 | rx51_init_si4713(); |
1259 | rx51_init_lirc(); | ||
1230 | spi_register_board_info(rx51_peripherals_spi_board_info, | 1260 | spi_register_board_info(rx51_peripherals_spi_board_info, |
1231 | ARRAY_SIZE(rx51_peripherals_spi_board_info)); | 1261 | ARRAY_SIZE(rx51_peripherals_spi_board_info)); |
1232 | 1262 | ||
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 5a3afd2b737d..7012068ccbf6 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -76,14 +76,14 @@ struct omap_dss_hwmod_data { | |||
76 | const int id; | 76 | const int id; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initdata = { | 79 | static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = { |
80 | { "dss_core", "omapdss_dss", -1 }, | 80 | { "dss_core", "omapdss_dss", -1 }, |
81 | { "dss_dispc", "omapdss_dispc", -1 }, | 81 | { "dss_dispc", "omapdss_dispc", -1 }, |
82 | { "dss_rfbi", "omapdss_rfbi", -1 }, | 82 | { "dss_rfbi", "omapdss_rfbi", -1 }, |
83 | { "dss_venc", "omapdss_venc", -1 }, | 83 | { "dss_venc", "omapdss_venc", -1 }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = { | 86 | static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = { |
87 | { "dss_core", "omapdss_dss", -1 }, | 87 | { "dss_core", "omapdss_dss", -1 }, |
88 | { "dss_dispc", "omapdss_dispc", -1 }, | 88 | { "dss_dispc", "omapdss_dispc", -1 }, |
89 | { "dss_rfbi", "omapdss_rfbi", -1 }, | 89 | { "dss_rfbi", "omapdss_rfbi", -1 }, |
@@ -91,7 +91,7 @@ static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initdata = { | |||
91 | { "dss_dsi1", "omapdss_dsi", 0 }, | 91 | { "dss_dsi1", "omapdss_dsi", 0 }, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = { | 94 | static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = { |
95 | { "dss_core", "omapdss_dss", -1 }, | 95 | { "dss_core", "omapdss_dss", -1 }, |
96 | { "dss_dispc", "omapdss_dispc", -1 }, | 96 | { "dss_dispc", "omapdss_dispc", -1 }, |
97 | { "dss_rfbi", "omapdss_rfbi", -1 }, | 97 | { "dss_rfbi", "omapdss_rfbi", -1 }, |
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c index e7b246da02d0..d1058f16fb40 100644 --- a/arch/arm/mach-omap2/gpio.c +++ b/arch/arm/mach-omap2/gpio.c | |||
@@ -123,6 +123,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) | |||
123 | break; | 123 | break; |
124 | default: | 124 | default: |
125 | WARN(1, "Invalid gpio bank_type\n"); | 125 | WARN(1, "Invalid gpio bank_type\n"); |
126 | kfree(pdata->regs); | ||
126 | kfree(pdata); | 127 | kfree(pdata); |
127 | return -EINVAL; | 128 | return -EINVAL; |
128 | } | 129 | } |
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index b3275babf192..5d3b4f4f81ae 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c | |||
@@ -230,13 +230,7 @@ static inline void omap4_irq_save_context(void) | |||
230 | /* Save AuxBoot* registers */ | 230 | /* Save AuxBoot* registers */ |
231 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); | 231 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); |
232 | __raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); | 232 | __raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); |
233 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); | 233 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_1); |
234 | __raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); | ||
235 | |||
236 | /* Save SyncReq generation logic */ | ||
237 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); | ||
238 | __raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); | ||
239 | val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); | ||
240 | __raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); | 234 | __raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); |
241 | 235 | ||
242 | /* Save SyncReq generation logic */ | 236 | /* Save SyncReq generation logic */ |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index ae0acaf506ed..8d7a93525bc6 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -6110,6 +6110,12 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = { | |||
6110 | .pa_end = 0x4a0ab7ff, | 6110 | .pa_end = 0x4a0ab7ff, |
6111 | .flags = ADDR_TYPE_RT | 6111 | .flags = ADDR_TYPE_RT |
6112 | }, | 6112 | }, |
6113 | { | ||
6114 | /* XXX: Remove this once control module driver is in place */ | ||
6115 | .pa_start = 0x4a00233c, | ||
6116 | .pa_end = 0x4a00233f, | ||
6117 | .flags = ADDR_TYPE_RT | ||
6118 | }, | ||
6113 | { } | 6119 | { } |
6114 | }; | 6120 | }; |
6115 | 6121 | ||
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/arch/arm/mach-omap2/omap_l3_noc.c deleted file mode 100644 index f447e02102bb..000000000000 --- a/arch/arm/mach-omap2/omap_l3_noc.c +++ /dev/null | |||
@@ -1,267 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP4XXX L3 Interconnect error handling driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Corporation | ||
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
6 | * Sricharan <r.sricharan@ti.com> | ||
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 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
21 | * USA | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/slab.h> | ||
30 | |||
31 | #include "soc.h" | ||
32 | #include "omap_l3_noc.h" | ||
33 | |||
34 | /* | ||
35 | * Interrupt Handler for L3 error detection. | ||
36 | * 1) Identify the L3 clockdomain partition to which the error belongs to. | ||
37 | * 2) Identify the slave where the error information is logged | ||
38 | * 3) Print the logged information. | ||
39 | * 4) Add dump stack to provide kernel trace. | ||
40 | * | ||
41 | * Two Types of errors : | ||
42 | * 1) Custom errors in L3 : | ||
43 | * Target like DMM/FW/EMIF generates SRESP=ERR error | ||
44 | * 2) Standard L3 error: | ||
45 | * - Unsupported CMD. | ||
46 | * L3 tries to access target while it is idle | ||
47 | * - OCP disconnect. | ||
48 | * - Address hole error: | ||
49 | * If DSS/ISS/FDIF/USBHOSTFS access a target where they | ||
50 | * do not have connectivity, the error is logged in | ||
51 | * their default target which is DMM2. | ||
52 | * | ||
53 | * On High Secure devices, firewall errors are possible and those | ||
54 | * can be trapped as well. But the trapping is implemented as part | ||
55 | * secure software and hence need not be implemented here. | ||
56 | */ | ||
57 | static irqreturn_t l3_interrupt_handler(int irq, void *_l3) | ||
58 | { | ||
59 | |||
60 | struct omap4_l3 *l3 = _l3; | ||
61 | int inttype, i, k; | ||
62 | int err_src = 0; | ||
63 | u32 std_err_main, err_reg, clear, masterid; | ||
64 | void __iomem *base, *l3_targ_base; | ||
65 | char *target_name, *master_name = "UN IDENTIFIED"; | ||
66 | |||
67 | /* Get the Type of interrupt */ | ||
68 | inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; | ||
69 | |||
70 | for (i = 0; i < L3_MODULES; i++) { | ||
71 | /* | ||
72 | * Read the regerr register of the clock domain | ||
73 | * to determine the source | ||
74 | */ | ||
75 | base = l3->l3_base[i]; | ||
76 | err_reg = __raw_readl(base + l3_flagmux[i] + | ||
77 | + L3_FLAGMUX_REGERR0 + (inttype << 3)); | ||
78 | |||
79 | /* Get the corresponding error and analyse */ | ||
80 | if (err_reg) { | ||
81 | /* Identify the source from control status register */ | ||
82 | err_src = __ffs(err_reg); | ||
83 | |||
84 | /* Read the stderrlog_main_source from clk domain */ | ||
85 | l3_targ_base = base + *(l3_targ[i] + err_src); | ||
86 | std_err_main = __raw_readl(l3_targ_base + | ||
87 | L3_TARG_STDERRLOG_MAIN); | ||
88 | masterid = __raw_readl(l3_targ_base + | ||
89 | L3_TARG_STDERRLOG_MSTADDR); | ||
90 | |||
91 | switch (std_err_main & CUSTOM_ERROR) { | ||
92 | case STANDARD_ERROR: | ||
93 | target_name = | ||
94 | l3_targ_inst_name[i][err_src]; | ||
95 | WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n", | ||
96 | target_name, | ||
97 | __raw_readl(l3_targ_base + | ||
98 | L3_TARG_STDERRLOG_SLVOFSLSB)); | ||
99 | /* clear the std error log*/ | ||
100 | clear = std_err_main | CLEAR_STDERR_LOG; | ||
101 | writel(clear, l3_targ_base + | ||
102 | L3_TARG_STDERRLOG_MAIN); | ||
103 | break; | ||
104 | |||
105 | case CUSTOM_ERROR: | ||
106 | target_name = | ||
107 | l3_targ_inst_name[i][err_src]; | ||
108 | for (k = 0; k < NUM_OF_L3_MASTERS; k++) { | ||
109 | if (masterid == l3_masters[k].id) | ||
110 | master_name = | ||
111 | l3_masters[k].name; | ||
112 | } | ||
113 | WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n", | ||
114 | master_name, target_name); | ||
115 | /* clear the std error log*/ | ||
116 | clear = std_err_main | CLEAR_STDERR_LOG; | ||
117 | writel(clear, l3_targ_base + | ||
118 | L3_TARG_STDERRLOG_MAIN); | ||
119 | break; | ||
120 | |||
121 | default: | ||
122 | /* Nothing to be handled here as of now */ | ||
123 | break; | ||
124 | } | ||
125 | /* Error found so break the for loop */ | ||
126 | break; | ||
127 | } | ||
128 | } | ||
129 | return IRQ_HANDLED; | ||
130 | } | ||
131 | |||
132 | static int __devinit omap4_l3_probe(struct platform_device *pdev) | ||
133 | { | ||
134 | static struct omap4_l3 *l3; | ||
135 | struct resource *res; | ||
136 | int ret; | ||
137 | |||
138 | l3 = kzalloc(sizeof(*l3), GFP_KERNEL); | ||
139 | if (!l3) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | platform_set_drvdata(pdev, l3); | ||
143 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
144 | if (!res) { | ||
145 | dev_err(&pdev->dev, "couldn't find resource 0\n"); | ||
146 | ret = -ENODEV; | ||
147 | goto err0; | ||
148 | } | ||
149 | |||
150 | l3->l3_base[0] = ioremap(res->start, resource_size(res)); | ||
151 | if (!l3->l3_base[0]) { | ||
152 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
153 | ret = -ENOMEM; | ||
154 | goto err0; | ||
155 | } | ||
156 | |||
157 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
158 | if (!res) { | ||
159 | dev_err(&pdev->dev, "couldn't find resource 1\n"); | ||
160 | ret = -ENODEV; | ||
161 | goto err1; | ||
162 | } | ||
163 | |||
164 | l3->l3_base[1] = ioremap(res->start, resource_size(res)); | ||
165 | if (!l3->l3_base[1]) { | ||
166 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
167 | ret = -ENOMEM; | ||
168 | goto err1; | ||
169 | } | ||
170 | |||
171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 2); | ||
172 | if (!res) { | ||
173 | dev_err(&pdev->dev, "couldn't find resource 2\n"); | ||
174 | ret = -ENODEV; | ||
175 | goto err2; | ||
176 | } | ||
177 | |||
178 | l3->l3_base[2] = ioremap(res->start, resource_size(res)); | ||
179 | if (!l3->l3_base[2]) { | ||
180 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
181 | ret = -ENOMEM; | ||
182 | goto err2; | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * Setup interrupt Handlers | ||
187 | */ | ||
188 | l3->debug_irq = platform_get_irq(pdev, 0); | ||
189 | ret = request_irq(l3->debug_irq, | ||
190 | l3_interrupt_handler, | ||
191 | IRQF_DISABLED, "l3-dbg-irq", l3); | ||
192 | if (ret) { | ||
193 | pr_crit("L3: request_irq failed to register for 0x%x\n", | ||
194 | 9 + OMAP44XX_IRQ_GIC_START); | ||
195 | goto err3; | ||
196 | } | ||
197 | |||
198 | l3->app_irq = platform_get_irq(pdev, 1); | ||
199 | ret = request_irq(l3->app_irq, | ||
200 | l3_interrupt_handler, | ||
201 | IRQF_DISABLED, "l3-app-irq", l3); | ||
202 | if (ret) { | ||
203 | pr_crit("L3: request_irq failed to register for 0x%x\n", | ||
204 | 10 + OMAP44XX_IRQ_GIC_START); | ||
205 | goto err4; | ||
206 | } | ||
207 | |||
208 | return 0; | ||
209 | |||
210 | err4: | ||
211 | free_irq(l3->debug_irq, l3); | ||
212 | err3: | ||
213 | iounmap(l3->l3_base[2]); | ||
214 | err2: | ||
215 | iounmap(l3->l3_base[1]); | ||
216 | err1: | ||
217 | iounmap(l3->l3_base[0]); | ||
218 | err0: | ||
219 | kfree(l3); | ||
220 | return ret; | ||
221 | } | ||
222 | |||
223 | static int __devexit omap4_l3_remove(struct platform_device *pdev) | ||
224 | { | ||
225 | struct omap4_l3 *l3 = platform_get_drvdata(pdev); | ||
226 | |||
227 | free_irq(l3->app_irq, l3); | ||
228 | free_irq(l3->debug_irq, l3); | ||
229 | iounmap(l3->l3_base[0]); | ||
230 | iounmap(l3->l3_base[1]); | ||
231 | iounmap(l3->l3_base[2]); | ||
232 | kfree(l3); | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | #if defined(CONFIG_OF) | ||
238 | static const struct of_device_id l3_noc_match[] = { | ||
239 | {.compatible = "ti,omap4-l3-noc", }, | ||
240 | {}, | ||
241 | }; | ||
242 | MODULE_DEVICE_TABLE(of, l3_noc_match); | ||
243 | #else | ||
244 | #define l3_noc_match NULL | ||
245 | #endif | ||
246 | |||
247 | static struct platform_driver omap4_l3_driver = { | ||
248 | .probe = omap4_l3_probe, | ||
249 | .remove = __devexit_p(omap4_l3_remove), | ||
250 | .driver = { | ||
251 | .name = "omap_l3_noc", | ||
252 | .owner = THIS_MODULE, | ||
253 | .of_match_table = l3_noc_match, | ||
254 | }, | ||
255 | }; | ||
256 | |||
257 | static int __init omap4_l3_init(void) | ||
258 | { | ||
259 | return platform_driver_register(&omap4_l3_driver); | ||
260 | } | ||
261 | postcore_initcall_sync(omap4_l3_init); | ||
262 | |||
263 | static void __exit omap4_l3_exit(void) | ||
264 | { | ||
265 | platform_driver_unregister(&omap4_l3_driver); | ||
266 | } | ||
267 | module_exit(omap4_l3_exit); | ||
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h b/arch/arm/mach-omap2/omap_l3_noc.h deleted file mode 100644 index a6ce34dc4814..000000000000 --- a/arch/arm/mach-omap2/omap_l3_noc.h +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP4XXX L3 Interconnect error handling driver header | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Corporation | ||
5 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
6 | * sricharan <r.sricharan@ti.com> | ||
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 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
21 | * USA | ||
22 | */ | ||
23 | #ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H | ||
24 | #define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H | ||
25 | |||
26 | #define L3_MODULES 3 | ||
27 | #define CLEAR_STDERR_LOG (1 << 31) | ||
28 | #define CUSTOM_ERROR 0x2 | ||
29 | #define STANDARD_ERROR 0x0 | ||
30 | #define INBAND_ERROR 0x0 | ||
31 | #define L3_APPLICATION_ERROR 0x0 | ||
32 | #define L3_DEBUG_ERROR 0x1 | ||
33 | |||
34 | /* L3 TARG register offsets */ | ||
35 | #define L3_TARG_STDERRLOG_MAIN 0x48 | ||
36 | #define L3_TARG_STDERRLOG_SLVOFSLSB 0x5c | ||
37 | #define L3_TARG_STDERRLOG_MSTADDR 0x68 | ||
38 | #define L3_FLAGMUX_REGERR0 0xc | ||
39 | |||
40 | #define NUM_OF_L3_MASTERS (sizeof(l3_masters)/sizeof(l3_masters[0])) | ||
41 | |||
42 | static u32 l3_flagmux[L3_MODULES] = { | ||
43 | 0x500, | ||
44 | 0x1000, | ||
45 | 0X0200 | ||
46 | }; | ||
47 | |||
48 | /* L3 Target standard Error register offsets */ | ||
49 | static u32 l3_targ_inst_clk1[] = { | ||
50 | 0x100, /* DMM1 */ | ||
51 | 0x200, /* DMM2 */ | ||
52 | 0x300, /* ABE */ | ||
53 | 0x400, /* L4CFG */ | ||
54 | 0x600, /* CLK2 PWR DISC */ | ||
55 | 0x0, /* Host CLK1 */ | ||
56 | 0x900 /* L4 Wakeup */ | ||
57 | }; | ||
58 | |||
59 | static u32 l3_targ_inst_clk2[] = { | ||
60 | 0x500, /* CORTEX M3 */ | ||
61 | 0x300, /* DSS */ | ||
62 | 0x100, /* GPMC */ | ||
63 | 0x400, /* ISS */ | ||
64 | 0x700, /* IVAHD */ | ||
65 | 0xD00, /* missing in TRM corresponds to AES1*/ | ||
66 | 0x900, /* L4 PER0*/ | ||
67 | 0x200, /* OCMRAM */ | ||
68 | 0x100, /* missing in TRM corresponds to GPMC sERROR*/ | ||
69 | 0x600, /* SGX */ | ||
70 | 0x800, /* SL2 */ | ||
71 | 0x1600, /* C2C */ | ||
72 | 0x1100, /* missing in TRM corresponds PWR DISC CLK1*/ | ||
73 | 0xF00, /* missing in TRM corrsponds to SHA1*/ | ||
74 | 0xE00, /* missing in TRM corresponds to AES2*/ | ||
75 | 0xC00, /* L4 PER3 */ | ||
76 | 0xA00, /* L4 PER1*/ | ||
77 | 0xB00, /* L4 PER2*/ | ||
78 | 0x0, /* HOST CLK2 */ | ||
79 | 0x1800, /* CAL */ | ||
80 | 0x1700 /* LLI */ | ||
81 | }; | ||
82 | |||
83 | static u32 l3_targ_inst_clk3[] = { | ||
84 | 0x0100 /* EMUSS */, | ||
85 | 0x0300, /* DEBUGSS_CT_TBR */ | ||
86 | 0x0 /* HOST CLK3 */ | ||
87 | }; | ||
88 | |||
89 | static struct l3_masters_data { | ||
90 | u32 id; | ||
91 | char name[10]; | ||
92 | } l3_masters[] = { | ||
93 | { 0x0 , "MPU"}, | ||
94 | { 0x10, "CS_ADP"}, | ||
95 | { 0x14, "xxx"}, | ||
96 | { 0x20, "DSP"}, | ||
97 | { 0x30, "IVAHD"}, | ||
98 | { 0x40, "ISS"}, | ||
99 | { 0x44, "DucatiM3"}, | ||
100 | { 0x48, "FaceDetect"}, | ||
101 | { 0x50, "SDMA_Rd"}, | ||
102 | { 0x54, "SDMA_Wr"}, | ||
103 | { 0x58, "xxx"}, | ||
104 | { 0x5C, "xxx"}, | ||
105 | { 0x60, "SGX"}, | ||
106 | { 0x70, "DSS"}, | ||
107 | { 0x80, "C2C"}, | ||
108 | { 0x88, "xxx"}, | ||
109 | { 0x8C, "xxx"}, | ||
110 | { 0x90, "HSI"}, | ||
111 | { 0xA0, "MMC1"}, | ||
112 | { 0xA4, "MMC2"}, | ||
113 | { 0xA8, "MMC6"}, | ||
114 | { 0xB0, "UNIPRO1"}, | ||
115 | { 0xC0, "USBHOSTHS"}, | ||
116 | { 0xC4, "USBOTGHS"}, | ||
117 | { 0xC8, "USBHOSTFS"} | ||
118 | }; | ||
119 | |||
120 | static char *l3_targ_inst_name[L3_MODULES][21] = { | ||
121 | { | ||
122 | "DMM1", | ||
123 | "DMM2", | ||
124 | "ABE", | ||
125 | "L4CFG", | ||
126 | "CLK2 PWR DISC", | ||
127 | "HOST CLK1", | ||
128 | "L4 WAKEUP" | ||
129 | }, | ||
130 | { | ||
131 | "CORTEX M3" , | ||
132 | "DSS ", | ||
133 | "GPMC ", | ||
134 | "ISS ", | ||
135 | "IVAHD ", | ||
136 | "AES1", | ||
137 | "L4 PER0", | ||
138 | "OCMRAM ", | ||
139 | "GPMC sERROR", | ||
140 | "SGX ", | ||
141 | "SL2 ", | ||
142 | "C2C ", | ||
143 | "PWR DISC CLK1", | ||
144 | "SHA1", | ||
145 | "AES2", | ||
146 | "L4 PER3", | ||
147 | "L4 PER1", | ||
148 | "L4 PER2", | ||
149 | "HOST CLK2", | ||
150 | "CAL", | ||
151 | "LLI" | ||
152 | }, | ||
153 | { | ||
154 | "EMUSS", | ||
155 | "DEBUG SOURCE", | ||
156 | "HOST CLK3" | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | static u32 *l3_targ[L3_MODULES] = { | ||
161 | l3_targ_inst_clk1, | ||
162 | l3_targ_inst_clk2, | ||
163 | l3_targ_inst_clk3, | ||
164 | }; | ||
165 | |||
166 | struct omap4_l3 { | ||
167 | struct device *dev; | ||
168 | struct clk *ick; | ||
169 | |||
170 | /* memory base */ | ||
171 | void __iomem *l3_base[L3_MODULES]; | ||
172 | |||
173 | int debug_irq; | ||
174 | int app_irq; | ||
175 | }; | ||
176 | #endif | ||
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/arch/arm/mach-omap2/omap_l3_smx.c deleted file mode 100644 index acc216491b8a..000000000000 --- a/arch/arm/mach-omap2/omap_l3_smx.c +++ /dev/null | |||
@@ -1,297 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP3XXX L3 Interconnect Driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Corporation | ||
5 | * Felipe Balbi <balbi@ti.com> | ||
6 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
7 | * Sricharan <r.sricharan@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
22 | * USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/io.h> | ||
30 | #include "omap_l3_smx.h" | ||
31 | |||
32 | static inline u64 omap3_l3_readll(void __iomem *base, u16 reg) | ||
33 | { | ||
34 | return __raw_readll(base + reg); | ||
35 | } | ||
36 | |||
37 | static inline void omap3_l3_writell(void __iomem *base, u16 reg, u64 value) | ||
38 | { | ||
39 | __raw_writell(value, base + reg); | ||
40 | } | ||
41 | |||
42 | static inline enum omap3_l3_code omap3_l3_decode_error_code(u64 error) | ||
43 | { | ||
44 | return (error & 0x0f000000) >> L3_ERROR_LOG_CODE; | ||
45 | } | ||
46 | |||
47 | static inline u32 omap3_l3_decode_addr(u64 error_addr) | ||
48 | { | ||
49 | return error_addr & 0xffffffff; | ||
50 | } | ||
51 | |||
52 | static inline unsigned omap3_l3_decode_cmd(u64 error) | ||
53 | { | ||
54 | return (error & 0x07) >> L3_ERROR_LOG_CMD; | ||
55 | } | ||
56 | |||
57 | static inline enum omap3_l3_initiator_id omap3_l3_decode_initid(u64 error) | ||
58 | { | ||
59 | return (error & 0xff00) >> L3_ERROR_LOG_INITID; | ||
60 | } | ||
61 | |||
62 | static inline unsigned omap3_l3_decode_req_info(u64 error) | ||
63 | { | ||
64 | return (error >> 32) & 0xffff; | ||
65 | } | ||
66 | |||
67 | static char *omap3_l3_code_string(u8 code) | ||
68 | { | ||
69 | switch (code) { | ||
70 | case OMAP_L3_CODE_NOERROR: | ||
71 | return "No Error"; | ||
72 | case OMAP_L3_CODE_UNSUP_CMD: | ||
73 | return "Unsupported Command"; | ||
74 | case OMAP_L3_CODE_ADDR_HOLE: | ||
75 | return "Address Hole"; | ||
76 | case OMAP_L3_CODE_PROTECT_VIOLATION: | ||
77 | return "Protection Violation"; | ||
78 | case OMAP_L3_CODE_IN_BAND_ERR: | ||
79 | return "In-band Error"; | ||
80 | case OMAP_L3_CODE_REQ_TOUT_NOT_ACCEPT: | ||
81 | return "Request Timeout Not Accepted"; | ||
82 | case OMAP_L3_CODE_REQ_TOUT_NO_RESP: | ||
83 | return "Request Timeout, no response"; | ||
84 | default: | ||
85 | return "UNKNOWN error"; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | static char *omap3_l3_initiator_string(u8 initid) | ||
90 | { | ||
91 | switch (initid) { | ||
92 | case OMAP_L3_LCD: | ||
93 | return "LCD"; | ||
94 | case OMAP_L3_SAD2D: | ||
95 | return "SAD2D"; | ||
96 | case OMAP_L3_IA_MPU_SS_1: | ||
97 | case OMAP_L3_IA_MPU_SS_2: | ||
98 | case OMAP_L3_IA_MPU_SS_3: | ||
99 | case OMAP_L3_IA_MPU_SS_4: | ||
100 | case OMAP_L3_IA_MPU_SS_5: | ||
101 | return "MPU"; | ||
102 | case OMAP_L3_IA_IVA_SS_1: | ||
103 | case OMAP_L3_IA_IVA_SS_2: | ||
104 | case OMAP_L3_IA_IVA_SS_3: | ||
105 | return "IVA_SS"; | ||
106 | case OMAP_L3_IA_IVA_SS_DMA_1: | ||
107 | case OMAP_L3_IA_IVA_SS_DMA_2: | ||
108 | case OMAP_L3_IA_IVA_SS_DMA_3: | ||
109 | case OMAP_L3_IA_IVA_SS_DMA_4: | ||
110 | case OMAP_L3_IA_IVA_SS_DMA_5: | ||
111 | case OMAP_L3_IA_IVA_SS_DMA_6: | ||
112 | return "IVA_SS_DMA"; | ||
113 | case OMAP_L3_IA_SGX: | ||
114 | return "SGX"; | ||
115 | case OMAP_L3_IA_CAM_1: | ||
116 | case OMAP_L3_IA_CAM_2: | ||
117 | case OMAP_L3_IA_CAM_3: | ||
118 | return "CAM"; | ||
119 | case OMAP_L3_IA_DAP: | ||
120 | return "DAP"; | ||
121 | case OMAP_L3_SDMA_WR_1: | ||
122 | case OMAP_L3_SDMA_WR_2: | ||
123 | return "SDMA_WR"; | ||
124 | case OMAP_L3_SDMA_RD_1: | ||
125 | case OMAP_L3_SDMA_RD_2: | ||
126 | case OMAP_L3_SDMA_RD_3: | ||
127 | case OMAP_L3_SDMA_RD_4: | ||
128 | return "SDMA_RD"; | ||
129 | case OMAP_L3_USBOTG: | ||
130 | return "USB_OTG"; | ||
131 | case OMAP_L3_USBHOST: | ||
132 | return "USB_HOST"; | ||
133 | default: | ||
134 | return "UNKNOWN Initiator"; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * omap3_l3_block_irq - handles a register block's irq | ||
140 | * @l3: struct omap3_l3 * | ||
141 | * @base: register block base address | ||
142 | * @error: L3_ERROR_LOG register of our block | ||
143 | * | ||
144 | * Called in hard-irq context. Caller should take care of locking | ||
145 | * | ||
146 | * OMAP36xx TRM gives, on page 2001, Figure 9-10, the Typical Error | ||
147 | * Analysis Sequence, we are following that sequence here, please | ||
148 | * refer to that Figure for more information on the subject. | ||
149 | */ | ||
150 | static irqreturn_t omap3_l3_block_irq(struct omap3_l3 *l3, | ||
151 | u64 error, int error_addr) | ||
152 | { | ||
153 | u8 code = omap3_l3_decode_error_code(error); | ||
154 | u8 initid = omap3_l3_decode_initid(error); | ||
155 | u8 multi = error & L3_ERROR_LOG_MULTI; | ||
156 | u32 address = omap3_l3_decode_addr(error_addr); | ||
157 | |||
158 | pr_err("%s seen by %s %s at address %x\n", | ||
159 | omap3_l3_code_string(code), | ||
160 | omap3_l3_initiator_string(initid), | ||
161 | multi ? "Multiple Errors" : "", address); | ||
162 | WARN_ON(1); | ||
163 | |||
164 | return IRQ_HANDLED; | ||
165 | } | ||
166 | |||
167 | static irqreturn_t omap3_l3_app_irq(int irq, void *_l3) | ||
168 | { | ||
169 | struct omap3_l3 *l3 = _l3; | ||
170 | u64 status, clear; | ||
171 | u64 error; | ||
172 | u64 error_addr; | ||
173 | u64 err_source = 0; | ||
174 | void __iomem *base; | ||
175 | int int_type; | ||
176 | irqreturn_t ret = IRQ_NONE; | ||
177 | |||
178 | int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; | ||
179 | if (!int_type) { | ||
180 | status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_0); | ||
181 | /* | ||
182 | * if we have a timeout error, there's nothing we can | ||
183 | * do besides rebooting the board. So let's BUG on any | ||
184 | * of such errors and handle the others. timeout error | ||
185 | * is severe and not expected to occur. | ||
186 | */ | ||
187 | BUG_ON(status & L3_STATUS_0_TIMEOUT_MASK); | ||
188 | } else { | ||
189 | status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_1); | ||
190 | /* No timeout error for debug sources */ | ||
191 | } | ||
192 | |||
193 | /* identify the error source */ | ||
194 | err_source = __ffs(status); | ||
195 | |||
196 | base = l3->rt + omap3_l3_bases[int_type][err_source]; | ||
197 | error = omap3_l3_readll(base, L3_ERROR_LOG); | ||
198 | if (error) { | ||
199 | error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR); | ||
200 | ret |= omap3_l3_block_irq(l3, error, error_addr); | ||
201 | } | ||
202 | |||
203 | /* Clear the status register */ | ||
204 | clear = (L3_AGENT_STATUS_CLEAR_IA << int_type) | | ||
205 | L3_AGENT_STATUS_CLEAR_TA; | ||
206 | omap3_l3_writell(base, L3_AGENT_STATUS, clear); | ||
207 | |||
208 | /* clear the error log register */ | ||
209 | omap3_l3_writell(base, L3_ERROR_LOG, error); | ||
210 | |||
211 | return ret; | ||
212 | } | ||
213 | |||
214 | static int __init omap3_l3_probe(struct platform_device *pdev) | ||
215 | { | ||
216 | struct omap3_l3 *l3; | ||
217 | struct resource *res; | ||
218 | int ret; | ||
219 | |||
220 | l3 = kzalloc(sizeof(*l3), GFP_KERNEL); | ||
221 | if (!l3) | ||
222 | return -ENOMEM; | ||
223 | |||
224 | platform_set_drvdata(pdev, l3); | ||
225 | |||
226 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
227 | if (!res) { | ||
228 | dev_err(&pdev->dev, "couldn't find resource\n"); | ||
229 | ret = -ENODEV; | ||
230 | goto err0; | ||
231 | } | ||
232 | l3->rt = ioremap(res->start, resource_size(res)); | ||
233 | if (!l3->rt) { | ||
234 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
235 | ret = -ENOMEM; | ||
236 | goto err0; | ||
237 | } | ||
238 | |||
239 | l3->debug_irq = platform_get_irq(pdev, 0); | ||
240 | ret = request_irq(l3->debug_irq, omap3_l3_app_irq, | ||
241 | IRQF_DISABLED | IRQF_TRIGGER_RISING, | ||
242 | "l3-debug-irq", l3); | ||
243 | if (ret) { | ||
244 | dev_err(&pdev->dev, "couldn't request debug irq\n"); | ||
245 | goto err1; | ||
246 | } | ||
247 | |||
248 | l3->app_irq = platform_get_irq(pdev, 1); | ||
249 | ret = request_irq(l3->app_irq, omap3_l3_app_irq, | ||
250 | IRQF_DISABLED | IRQF_TRIGGER_RISING, | ||
251 | "l3-app-irq", l3); | ||
252 | if (ret) { | ||
253 | dev_err(&pdev->dev, "couldn't request app irq\n"); | ||
254 | goto err2; | ||
255 | } | ||
256 | |||
257 | return 0; | ||
258 | |||
259 | err2: | ||
260 | free_irq(l3->debug_irq, l3); | ||
261 | err1: | ||
262 | iounmap(l3->rt); | ||
263 | err0: | ||
264 | kfree(l3); | ||
265 | return ret; | ||
266 | } | ||
267 | |||
268 | static int __exit omap3_l3_remove(struct platform_device *pdev) | ||
269 | { | ||
270 | struct omap3_l3 *l3 = platform_get_drvdata(pdev); | ||
271 | |||
272 | free_irq(l3->app_irq, l3); | ||
273 | free_irq(l3->debug_irq, l3); | ||
274 | iounmap(l3->rt); | ||
275 | kfree(l3); | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | static struct platform_driver omap3_l3_driver = { | ||
281 | .remove = __exit_p(omap3_l3_remove), | ||
282 | .driver = { | ||
283 | .name = "omap_l3_smx", | ||
284 | }, | ||
285 | }; | ||
286 | |||
287 | static int __init omap3_l3_init(void) | ||
288 | { | ||
289 | return platform_driver_probe(&omap3_l3_driver, omap3_l3_probe); | ||
290 | } | ||
291 | postcore_initcall_sync(omap3_l3_init); | ||
292 | |||
293 | static void __exit omap3_l3_exit(void) | ||
294 | { | ||
295 | platform_driver_unregister(&omap3_l3_driver); | ||
296 | } | ||
297 | module_exit(omap3_l3_exit); | ||
diff --git a/arch/arm/mach-omap2/omap_l3_smx.h b/arch/arm/mach-omap2/omap_l3_smx.h deleted file mode 100644 index 4f3cebca4179..000000000000 --- a/arch/arm/mach-omap2/omap_l3_smx.h +++ /dev/null | |||
@@ -1,338 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP3XXX L3 Interconnect Driver header | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Corporation | ||
5 | * Felipe Balbi <balbi@ti.com> | ||
6 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
7 | * sricharan <r.sricharan@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
22 | * USA | ||
23 | */ | ||
24 | #ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H | ||
25 | #define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H | ||
26 | |||
27 | /* Register definitions. All 64-bit wide */ | ||
28 | #define L3_COMPONENT 0x000 | ||
29 | #define L3_CORE 0x018 | ||
30 | #define L3_AGENT_CONTROL 0x020 | ||
31 | #define L3_AGENT_STATUS 0x028 | ||
32 | #define L3_ERROR_LOG 0x058 | ||
33 | |||
34 | #define L3_ERROR_LOG_MULTI (1 << 31) | ||
35 | #define L3_ERROR_LOG_SECONDARY (1 << 30) | ||
36 | |||
37 | #define L3_ERROR_LOG_ADDR 0x060 | ||
38 | |||
39 | /* Register definitions for Sideband Interconnect */ | ||
40 | #define L3_SI_CONTROL 0x020 | ||
41 | #define L3_SI_FLAG_STATUS_0 0x510 | ||
42 | |||
43 | static const u64 shift = 1; | ||
44 | |||
45 | #define L3_STATUS_0_MPUIA_BRST (shift << 0) | ||
46 | #define L3_STATUS_0_MPUIA_RSP (shift << 1) | ||
47 | #define L3_STATUS_0_MPUIA_INBAND (shift << 2) | ||
48 | #define L3_STATUS_0_IVAIA_BRST (shift << 6) | ||
49 | #define L3_STATUS_0_IVAIA_RSP (shift << 7) | ||
50 | #define L3_STATUS_0_IVAIA_INBAND (shift << 8) | ||
51 | #define L3_STATUS_0_SGXIA_BRST (shift << 9) | ||
52 | #define L3_STATUS_0_SGXIA_RSP (shift << 10) | ||
53 | #define L3_STATUS_0_SGXIA_MERROR (shift << 11) | ||
54 | #define L3_STATUS_0_CAMIA_BRST (shift << 12) | ||
55 | #define L3_STATUS_0_CAMIA_RSP (shift << 13) | ||
56 | #define L3_STATUS_0_CAMIA_INBAND (shift << 14) | ||
57 | #define L3_STATUS_0_DISPIA_BRST (shift << 15) | ||
58 | #define L3_STATUS_0_DISPIA_RSP (shift << 16) | ||
59 | #define L3_STATUS_0_DMARDIA_BRST (shift << 18) | ||
60 | #define L3_STATUS_0_DMARDIA_RSP (shift << 19) | ||
61 | #define L3_STATUS_0_DMAWRIA_BRST (shift << 21) | ||
62 | #define L3_STATUS_0_DMAWRIA_RSP (shift << 22) | ||
63 | #define L3_STATUS_0_USBOTGIA_BRST (shift << 24) | ||
64 | #define L3_STATUS_0_USBOTGIA_RSP (shift << 25) | ||
65 | #define L3_STATUS_0_USBOTGIA_INBAND (shift << 26) | ||
66 | #define L3_STATUS_0_USBHOSTIA_BRST (shift << 27) | ||
67 | #define L3_STATUS_0_USBHOSTIA_INBAND (shift << 28) | ||
68 | #define L3_STATUS_0_SMSTA_REQ (shift << 48) | ||
69 | #define L3_STATUS_0_GPMCTA_REQ (shift << 49) | ||
70 | #define L3_STATUS_0_OCMRAMTA_REQ (shift << 50) | ||
71 | #define L3_STATUS_0_OCMROMTA_REQ (shift << 51) | ||
72 | #define L3_STATUS_0_IVATA_REQ (shift << 54) | ||
73 | #define L3_STATUS_0_SGXTA_REQ (shift << 55) | ||
74 | #define L3_STATUS_0_SGXTA_SERROR (shift << 56) | ||
75 | #define L3_STATUS_0_GPMCTA_SERROR (shift << 57) | ||
76 | #define L3_STATUS_0_L4CORETA_REQ (shift << 58) | ||
77 | #define L3_STATUS_0_L4PERTA_REQ (shift << 59) | ||
78 | #define L3_STATUS_0_L4EMUTA_REQ (shift << 60) | ||
79 | #define L3_STATUS_0_MAD2DTA_REQ (shift << 61) | ||
80 | |||
81 | #define L3_STATUS_0_TIMEOUT_MASK (L3_STATUS_0_MPUIA_BRST \ | ||
82 | | L3_STATUS_0_MPUIA_RSP \ | ||
83 | | L3_STATUS_0_IVAIA_BRST \ | ||
84 | | L3_STATUS_0_IVAIA_RSP \ | ||
85 | | L3_STATUS_0_SGXIA_BRST \ | ||
86 | | L3_STATUS_0_SGXIA_RSP \ | ||
87 | | L3_STATUS_0_CAMIA_BRST \ | ||
88 | | L3_STATUS_0_CAMIA_RSP \ | ||
89 | | L3_STATUS_0_DISPIA_BRST \ | ||
90 | | L3_STATUS_0_DISPIA_RSP \ | ||
91 | | L3_STATUS_0_DMARDIA_BRST \ | ||
92 | | L3_STATUS_0_DMARDIA_RSP \ | ||
93 | | L3_STATUS_0_DMAWRIA_BRST \ | ||
94 | | L3_STATUS_0_DMAWRIA_RSP \ | ||
95 | | L3_STATUS_0_USBOTGIA_BRST \ | ||
96 | | L3_STATUS_0_USBOTGIA_RSP \ | ||
97 | | L3_STATUS_0_USBHOSTIA_BRST \ | ||
98 | | L3_STATUS_0_SMSTA_REQ \ | ||
99 | | L3_STATUS_0_GPMCTA_REQ \ | ||
100 | | L3_STATUS_0_OCMRAMTA_REQ \ | ||
101 | | L3_STATUS_0_OCMROMTA_REQ \ | ||
102 | | L3_STATUS_0_IVATA_REQ \ | ||
103 | | L3_STATUS_0_SGXTA_REQ \ | ||
104 | | L3_STATUS_0_L4CORETA_REQ \ | ||
105 | | L3_STATUS_0_L4PERTA_REQ \ | ||
106 | | L3_STATUS_0_L4EMUTA_REQ \ | ||
107 | | L3_STATUS_0_MAD2DTA_REQ) | ||
108 | |||
109 | #define L3_SI_FLAG_STATUS_1 0x530 | ||
110 | |||
111 | #define L3_STATUS_1_MPU_DATAIA (1 << 0) | ||
112 | #define L3_STATUS_1_DAPIA0 (1 << 3) | ||
113 | #define L3_STATUS_1_DAPIA1 (1 << 4) | ||
114 | #define L3_STATUS_1_IVAIA (1 << 6) | ||
115 | |||
116 | #define L3_PM_ERROR_LOG 0x020 | ||
117 | #define L3_PM_CONTROL 0x028 | ||
118 | #define L3_PM_ERROR_CLEAR_SINGLE 0x030 | ||
119 | #define L3_PM_ERROR_CLEAR_MULTI 0x038 | ||
120 | #define L3_PM_REQ_INFO_PERMISSION(n) (0x048 + (0x020 * n)) | ||
121 | #define L3_PM_READ_PERMISSION(n) (0x050 + (0x020 * n)) | ||
122 | #define L3_PM_WRITE_PERMISSION(n) (0x058 + (0x020 * n)) | ||
123 | #define L3_PM_ADDR_MATCH(n) (0x060 + (0x020 * n)) | ||
124 | |||
125 | /* L3 error log bit fields. Common for IA and TA */ | ||
126 | #define L3_ERROR_LOG_CODE 24 | ||
127 | #define L3_ERROR_LOG_INITID 8 | ||
128 | #define L3_ERROR_LOG_CMD 0 | ||
129 | |||
130 | /* L3 agent status bit fields. */ | ||
131 | #define L3_AGENT_STATUS_CLEAR_IA 0x10000000 | ||
132 | #define L3_AGENT_STATUS_CLEAR_TA 0x01000000 | ||
133 | |||
134 | #define OMAP34xx_IRQ_L3_APP 10 | ||
135 | #define L3_APPLICATION_ERROR 0x0 | ||
136 | #define L3_DEBUG_ERROR 0x1 | ||
137 | |||
138 | enum omap3_l3_initiator_id { | ||
139 | /* LCD has 1 ID */ | ||
140 | OMAP_L3_LCD = 29, | ||
141 | /* SAD2D has 1 ID */ | ||
142 | OMAP_L3_SAD2D = 28, | ||
143 | /* MPU has 5 IDs */ | ||
144 | OMAP_L3_IA_MPU_SS_1 = 27, | ||
145 | OMAP_L3_IA_MPU_SS_2 = 26, | ||
146 | OMAP_L3_IA_MPU_SS_3 = 25, | ||
147 | OMAP_L3_IA_MPU_SS_4 = 24, | ||
148 | OMAP_L3_IA_MPU_SS_5 = 23, | ||
149 | /* IVA2.2 SS has 3 IDs*/ | ||
150 | OMAP_L3_IA_IVA_SS_1 = 22, | ||
151 | OMAP_L3_IA_IVA_SS_2 = 21, | ||
152 | OMAP_L3_IA_IVA_SS_3 = 20, | ||
153 | /* IVA 2.2 SS DMA has 6 IDS */ | ||
154 | OMAP_L3_IA_IVA_SS_DMA_1 = 19, | ||
155 | OMAP_L3_IA_IVA_SS_DMA_2 = 18, | ||
156 | OMAP_L3_IA_IVA_SS_DMA_3 = 17, | ||
157 | OMAP_L3_IA_IVA_SS_DMA_4 = 16, | ||
158 | OMAP_L3_IA_IVA_SS_DMA_5 = 15, | ||
159 | OMAP_L3_IA_IVA_SS_DMA_6 = 14, | ||
160 | /* SGX has 1 ID */ | ||
161 | OMAP_L3_IA_SGX = 13, | ||
162 | /* CAM has 3 ID */ | ||
163 | OMAP_L3_IA_CAM_1 = 12, | ||
164 | OMAP_L3_IA_CAM_2 = 11, | ||
165 | OMAP_L3_IA_CAM_3 = 10, | ||
166 | /* DAP has 1 ID */ | ||
167 | OMAP_L3_IA_DAP = 9, | ||
168 | /* SDMA WR has 2 IDs */ | ||
169 | OMAP_L3_SDMA_WR_1 = 8, | ||
170 | OMAP_L3_SDMA_WR_2 = 7, | ||
171 | /* SDMA RD has 4 IDs */ | ||
172 | OMAP_L3_SDMA_RD_1 = 6, | ||
173 | OMAP_L3_SDMA_RD_2 = 5, | ||
174 | OMAP_L3_SDMA_RD_3 = 4, | ||
175 | OMAP_L3_SDMA_RD_4 = 3, | ||
176 | /* HSUSB OTG has 1 ID */ | ||
177 | OMAP_L3_USBOTG = 2, | ||
178 | /* HSUSB HOST has 1 ID */ | ||
179 | OMAP_L3_USBHOST = 1, | ||
180 | }; | ||
181 | |||
182 | enum omap3_l3_code { | ||
183 | OMAP_L3_CODE_NOERROR = 0, | ||
184 | OMAP_L3_CODE_UNSUP_CMD = 1, | ||
185 | OMAP_L3_CODE_ADDR_HOLE = 2, | ||
186 | OMAP_L3_CODE_PROTECT_VIOLATION = 3, | ||
187 | OMAP_L3_CODE_IN_BAND_ERR = 4, | ||
188 | /* codes 5 and 6 are reserved */ | ||
189 | OMAP_L3_CODE_REQ_TOUT_NOT_ACCEPT = 7, | ||
190 | OMAP_L3_CODE_REQ_TOUT_NO_RESP = 8, | ||
191 | /* codes 9 - 15 are also reserved */ | ||
192 | }; | ||
193 | |||
194 | struct omap3_l3 { | ||
195 | struct device *dev; | ||
196 | struct clk *ick; | ||
197 | |||
198 | /* memory base*/ | ||
199 | void __iomem *rt; | ||
200 | |||
201 | int debug_irq; | ||
202 | int app_irq; | ||
203 | |||
204 | /* true when and inband functional error occurs */ | ||
205 | unsigned inband:1; | ||
206 | }; | ||
207 | |||
208 | /* offsets for l3 agents in order with the Flag status register */ | ||
209 | static unsigned int omap3_l3_app_bases[] = { | ||
210 | /* MPU IA */ | ||
211 | 0x1400, | ||
212 | 0x1400, | ||
213 | 0x1400, | ||
214 | /* RESERVED */ | ||
215 | 0, | ||
216 | 0, | ||
217 | 0, | ||
218 | /* IVA 2.2 IA */ | ||
219 | 0x1800, | ||
220 | 0x1800, | ||
221 | 0x1800, | ||
222 | /* SGX IA */ | ||
223 | 0x1c00, | ||
224 | 0x1c00, | ||
225 | /* RESERVED */ | ||
226 | 0, | ||
227 | /* CAMERA IA */ | ||
228 | 0x5800, | ||
229 | 0x5800, | ||
230 | 0x5800, | ||
231 | /* DISPLAY IA */ | ||
232 | 0x5400, | ||
233 | 0x5400, | ||
234 | /* RESERVED */ | ||
235 | 0, | ||
236 | /*SDMA RD IA */ | ||
237 | 0x4c00, | ||
238 | 0x4c00, | ||
239 | /* RESERVED */ | ||
240 | 0, | ||
241 | /* SDMA WR IA */ | ||
242 | 0x5000, | ||
243 | 0x5000, | ||
244 | /* RESERVED */ | ||
245 | 0, | ||
246 | /* USB OTG IA */ | ||
247 | 0x4400, | ||
248 | 0x4400, | ||
249 | 0x4400, | ||
250 | /* USB HOST IA */ | ||
251 | 0x4000, | ||
252 | 0x4000, | ||
253 | /* RESERVED */ | ||
254 | 0, | ||
255 | 0, | ||
256 | 0, | ||
257 | 0, | ||
258 | /* SAD2D IA */ | ||
259 | 0x3000, | ||
260 | 0x3000, | ||
261 | 0x3000, | ||
262 | /* RESERVED */ | ||
263 | 0, | ||
264 | 0, | ||
265 | 0, | ||
266 | 0, | ||
267 | 0, | ||
268 | 0, | ||
269 | 0, | ||
270 | 0, | ||
271 | 0, | ||
272 | 0, | ||
273 | 0, | ||
274 | 0, | ||
275 | /* SMA TA */ | ||
276 | 0x2000, | ||
277 | /* GPMC TA */ | ||
278 | 0x2400, | ||
279 | /* OCM RAM TA */ | ||
280 | 0x2800, | ||
281 | /* OCM ROM TA */ | ||
282 | 0x2C00, | ||
283 | /* L4 CORE TA */ | ||
284 | 0x6800, | ||
285 | /* L4 PER TA */ | ||
286 | 0x6c00, | ||
287 | /* IVA 2.2 TA */ | ||
288 | 0x6000, | ||
289 | /* SGX TA */ | ||
290 | 0x6400, | ||
291 | /* L4 EMU TA */ | ||
292 | 0x7000, | ||
293 | /* GPMC TA */ | ||
294 | 0x2400, | ||
295 | /* L4 CORE TA */ | ||
296 | 0x6800, | ||
297 | /* L4 PER TA */ | ||
298 | 0x6c00, | ||
299 | /* L4 EMU TA */ | ||
300 | 0x7000, | ||
301 | /* MAD2D TA */ | ||
302 | 0x3400, | ||
303 | /* RESERVED */ | ||
304 | 0, | ||
305 | 0, | ||
306 | }; | ||
307 | |||
308 | static unsigned int omap3_l3_debug_bases[] = { | ||
309 | /* MPU DATA IA */ | ||
310 | 0x1400, | ||
311 | /* RESERVED */ | ||
312 | 0, | ||
313 | 0, | ||
314 | /* DAP IA */ | ||
315 | 0x5c00, | ||
316 | 0x5c00, | ||
317 | /* RESERVED */ | ||
318 | 0, | ||
319 | /* IVA 2.2 IA */ | ||
320 | 0x1800, | ||
321 | /* REST RESERVED */ | ||
322 | }; | ||
323 | |||
324 | static u32 *omap3_l3_bases[] = { | ||
325 | omap3_l3_app_bases, | ||
326 | omap3_l3_debug_bases, | ||
327 | }; | ||
328 | |||
329 | /* | ||
330 | * REVISIT define __raw_readll/__raw_writell here, but move them to | ||
331 | * <asm/io.h> at some point | ||
332 | */ | ||
333 | #define __raw_writell(v, a) (__chk_io_ptr(a), \ | ||
334 | *(volatile u64 __force *)(a) = (v)) | ||
335 | #define __raw_readll(a) (__chk_io_ptr(a), \ | ||
336 | *(volatile u64 __force *)(a)) | ||
337 | |||
338 | #endif | ||
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c index 593eaea35cec..d992db8ff0b0 100644 --- a/arch/arm/mach-omap2/omap_phy_internal.c +++ b/arch/arm/mach-omap2/omap_phy_internal.c | |||
@@ -33,144 +33,6 @@ | |||
33 | #include "soc.h" | 33 | #include "soc.h" |
34 | #include "control.h" | 34 | #include "control.h" |
35 | 35 | ||
36 | /* OMAP control module register for UTMI PHY */ | ||
37 | #define CONTROL_DEV_CONF 0x300 | ||
38 | #define PHY_PD 0x1 | ||
39 | |||
40 | #define USBOTGHS_CONTROL 0x33c | ||
41 | #define AVALID BIT(0) | ||
42 | #define BVALID BIT(1) | ||
43 | #define VBUSVALID BIT(2) | ||
44 | #define SESSEND BIT(3) | ||
45 | #define IDDIG BIT(4) | ||
46 | |||
47 | static struct clk *phyclk, *clk48m, *clk32k; | ||
48 | static void __iomem *ctrl_base; | ||
49 | static int usbotghs_control; | ||
50 | |||
51 | int omap4430_phy_init(struct device *dev) | ||
52 | { | ||
53 | ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K); | ||
54 | if (!ctrl_base) { | ||
55 | pr_err("control module ioremap failed\n"); | ||
56 | return -ENOMEM; | ||
57 | } | ||
58 | /* Power down the phy */ | ||
59 | __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); | ||
60 | |||
61 | if (!dev) { | ||
62 | iounmap(ctrl_base); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | phyclk = clk_get(dev, "ocp2scp_usb_phy_ick"); | ||
67 | if (IS_ERR(phyclk)) { | ||
68 | dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n"); | ||
69 | iounmap(ctrl_base); | ||
70 | return PTR_ERR(phyclk); | ||
71 | } | ||
72 | |||
73 | clk48m = clk_get(dev, "ocp2scp_usb_phy_phy_48m"); | ||
74 | if (IS_ERR(clk48m)) { | ||
75 | dev_err(dev, "cannot clk_get ocp2scp_usb_phy_phy_48m\n"); | ||
76 | clk_put(phyclk); | ||
77 | iounmap(ctrl_base); | ||
78 | return PTR_ERR(clk48m); | ||
79 | } | ||
80 | |||
81 | clk32k = clk_get(dev, "usb_phy_cm_clk32k"); | ||
82 | if (IS_ERR(clk32k)) { | ||
83 | dev_err(dev, "cannot clk_get usb_phy_cm_clk32k\n"); | ||
84 | clk_put(phyclk); | ||
85 | clk_put(clk48m); | ||
86 | iounmap(ctrl_base); | ||
87 | return PTR_ERR(clk32k); | ||
88 | } | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | int omap4430_phy_set_clk(struct device *dev, int on) | ||
93 | { | ||
94 | static int state; | ||
95 | |||
96 | if (on && !state) { | ||
97 | /* Enable the phy clocks */ | ||
98 | clk_enable(phyclk); | ||
99 | clk_enable(clk48m); | ||
100 | clk_enable(clk32k); | ||
101 | state = 1; | ||
102 | } else if (state) { | ||
103 | /* Disable the phy clocks */ | ||
104 | clk_disable(phyclk); | ||
105 | clk_disable(clk48m); | ||
106 | clk_disable(clk32k); | ||
107 | state = 0; | ||
108 | } | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | int omap4430_phy_power(struct device *dev, int ID, int on) | ||
113 | { | ||
114 | if (on) { | ||
115 | if (ID) | ||
116 | /* enable VBUS valid, IDDIG groung */ | ||
117 | __raw_writel(AVALID | VBUSVALID, ctrl_base + | ||
118 | USBOTGHS_CONTROL); | ||
119 | else | ||
120 | /* | ||
121 | * Enable VBUS Valid, AValid and IDDIG | ||
122 | * high impedance | ||
123 | */ | ||
124 | __raw_writel(IDDIG | AVALID | VBUSVALID, | ||
125 | ctrl_base + USBOTGHS_CONTROL); | ||
126 | } else { | ||
127 | /* Enable session END and IDIG to high impedance. */ | ||
128 | __raw_writel(SESSEND | IDDIG, ctrl_base + | ||
129 | USBOTGHS_CONTROL); | ||
130 | } | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | int omap4430_phy_suspend(struct device *dev, int suspend) | ||
135 | { | ||
136 | if (suspend) { | ||
137 | /* Disable the clocks */ | ||
138 | omap4430_phy_set_clk(dev, 0); | ||
139 | /* Power down the phy */ | ||
140 | __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); | ||
141 | |||
142 | /* save the context */ | ||
143 | usbotghs_control = __raw_readl(ctrl_base + USBOTGHS_CONTROL); | ||
144 | } else { | ||
145 | /* Enable the internel phy clcoks */ | ||
146 | omap4430_phy_set_clk(dev, 1); | ||
147 | /* power on the phy */ | ||
148 | if (__raw_readl(ctrl_base + CONTROL_DEV_CONF) & PHY_PD) { | ||
149 | __raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF); | ||
150 | mdelay(200); | ||
151 | } | ||
152 | |||
153 | /* restore the context */ | ||
154 | __raw_writel(usbotghs_control, ctrl_base + USBOTGHS_CONTROL); | ||
155 | } | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | int omap4430_phy_exit(struct device *dev) | ||
161 | { | ||
162 | if (ctrl_base) | ||
163 | iounmap(ctrl_base); | ||
164 | if (phyclk) | ||
165 | clk_put(phyclk); | ||
166 | if (clk48m) | ||
167 | clk_put(clk48m); | ||
168 | if (clk32k) | ||
169 | clk_put(clk32k); | ||
170 | |||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | void am35x_musb_reset(void) | 36 | void am35x_musb_reset(void) |
175 | { | 37 | { |
176 | u32 regval; | 38 | u32 regval; |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 810aa1a332e1..8847d6eb2313 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <asm/smp_twd.h> | 42 | #include <asm/smp_twd.h> |
43 | #include <asm/sched_clock.h> | 43 | #include <asm/sched_clock.h> |
44 | 44 | ||
45 | #include <asm/arch_timer.h> | ||
45 | #include <plat/omap_hwmod.h> | 46 | #include <plat/omap_hwmod.h> |
46 | #include <plat/omap_device.h> | 47 | #include <plat/omap_device.h> |
47 | #include <plat/dmtimer.h> | 48 | #include <plat/dmtimer.h> |
@@ -72,6 +73,11 @@ | |||
72 | #define OMAP3_SECURE_TIMER 1 | 73 | #define OMAP3_SECURE_TIMER 1 |
73 | #endif | 74 | #endif |
74 | 75 | ||
76 | #define REALTIME_COUNTER_BASE 0x48243200 | ||
77 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 | ||
78 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 | ||
79 | #define NUMERATOR_DENUMERATOR_MASK 0xfffff000 | ||
80 | |||
75 | /* Clockevent code */ | 81 | /* Clockevent code */ |
76 | 82 | ||
77 | static struct omap_dm_timer clkev; | 83 | static struct omap_dm_timer clkev; |
@@ -349,6 +355,84 @@ static void __init omap2_clocksource_init(int gptimer_id, | |||
349 | omap2_gptimer_clocksource_init(gptimer_id, fck_source); | 355 | omap2_gptimer_clocksource_init(gptimer_id, fck_source); |
350 | } | 356 | } |
351 | 357 | ||
358 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER | ||
359 | /* | ||
360 | * The realtime counter also called master counter, is a free-running | ||
361 | * counter, which is related to real time. It produces the count used | ||
362 | * by the CPU local timer peripherals in the MPU cluster. The timer counts | ||
363 | * at a rate of 6.144 MHz. Because the device operates on different clocks | ||
364 | * in different power modes, the master counter shifts operation between | ||
365 | * clocks, adjusting the increment per clock in hardware accordingly to | ||
366 | * maintain a constant count rate. | ||
367 | */ | ||
368 | static void __init realtime_counter_init(void) | ||
369 | { | ||
370 | void __iomem *base; | ||
371 | static struct clk *sys_clk; | ||
372 | unsigned long rate; | ||
373 | unsigned int reg, num, den; | ||
374 | |||
375 | base = ioremap(REALTIME_COUNTER_BASE, SZ_32); | ||
376 | if (!base) { | ||
377 | pr_err("%s: ioremap failed\n", __func__); | ||
378 | return; | ||
379 | } | ||
380 | sys_clk = clk_get(NULL, "sys_clkin_ck"); | ||
381 | if (!sys_clk) { | ||
382 | pr_err("%s: failed to get system clock handle\n", __func__); | ||
383 | iounmap(base); | ||
384 | return; | ||
385 | } | ||
386 | |||
387 | rate = clk_get_rate(sys_clk); | ||
388 | /* Numerator/denumerator values refer TRM Realtime Counter section */ | ||
389 | switch (rate) { | ||
390 | case 1200000: | ||
391 | num = 64; | ||
392 | den = 125; | ||
393 | break; | ||
394 | case 1300000: | ||
395 | num = 768; | ||
396 | den = 1625; | ||
397 | break; | ||
398 | case 19200000: | ||
399 | num = 8; | ||
400 | den = 25; | ||
401 | break; | ||
402 | case 2600000: | ||
403 | num = 384; | ||
404 | den = 1625; | ||
405 | break; | ||
406 | case 2700000: | ||
407 | num = 256; | ||
408 | den = 1125; | ||
409 | break; | ||
410 | case 38400000: | ||
411 | default: | ||
412 | /* Program it for 38.4 MHz */ | ||
413 | num = 4; | ||
414 | den = 25; | ||
415 | break; | ||
416 | } | ||
417 | |||
418 | /* Program numerator and denumerator registers */ | ||
419 | reg = __raw_readl(base + INCREMENTER_NUMERATOR_OFFSET) & | ||
420 | NUMERATOR_DENUMERATOR_MASK; | ||
421 | reg |= num; | ||
422 | __raw_writel(reg, base + INCREMENTER_NUMERATOR_OFFSET); | ||
423 | |||
424 | reg = __raw_readl(base + INCREMENTER_NUMERATOR_OFFSET) & | ||
425 | NUMERATOR_DENUMERATOR_MASK; | ||
426 | reg |= den; | ||
427 | __raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET); | ||
428 | |||
429 | iounmap(base); | ||
430 | } | ||
431 | #else | ||
432 | static inline void __init realtime_counter_init(void) | ||
433 | {} | ||
434 | #endif | ||
435 | |||
352 | #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, \ | 436 | #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, \ |
353 | clksrc_nr, clksrc_src) \ | 437 | clksrc_nr, clksrc_src) \ |
354 | static void __init omap##name##_timer_init(void) \ | 438 | static void __init omap##name##_timer_init(void) \ |
@@ -410,7 +494,18 @@ OMAP_SYS_TIMER(4) | |||
410 | #endif | 494 | #endif |
411 | 495 | ||
412 | #ifdef CONFIG_SOC_OMAP5 | 496 | #ifdef CONFIG_SOC_OMAP5 |
413 | OMAP_SYS_TIMER_INIT(5, 1, OMAP4_CLKEV_SOURCE, 2, OMAP4_MPU_SOURCE) | 497 | static void __init omap5_timer_init(void) |
498 | { | ||
499 | int err; | ||
500 | |||
501 | omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE); | ||
502 | omap2_clocksource_init(2, OMAP4_MPU_SOURCE); | ||
503 | realtime_counter_init(); | ||
504 | |||
505 | err = arch_timer_of_register(); | ||
506 | if (err) | ||
507 | pr_err("%s: arch_timer_register failed %d\n", __func__, err); | ||
508 | } | ||
414 | OMAP_SYS_TIMER(5) | 509 | OMAP_SYS_TIMER(5) |
415 | #endif | 510 | #endif |
416 | 511 | ||
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 99be94e94547..45f77413c21d 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c | |||
@@ -40,16 +40,6 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = { | |||
40 | .flags = I2C_CLIENT_WAKE, | 40 | .flags = I2C_CLIENT_WAKE, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct i2c_board_info __initdata omap4_i2c1_board_info[] = { | ||
44 | { | ||
45 | .addr = 0x48, | ||
46 | .flags = I2C_CLIENT_WAKE, | ||
47 | }, | ||
48 | { | ||
49 | I2C_BOARD_INFO("twl6040", 0x4b), | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | 43 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
54 | static int twl_set_voltage(void *data, int target_uV) | 44 | static int twl_set_voltage(void *data, int target_uV) |
55 | { | 45 | { |
@@ -79,30 +69,25 @@ void __init omap_pmic_init(int bus, u32 clkrate, | |||
79 | 69 | ||
80 | void __init omap4_pmic_init(const char *pmic_type, | 70 | void __init omap4_pmic_init(const char *pmic_type, |
81 | struct twl4030_platform_data *pmic_data, | 71 | struct twl4030_platform_data *pmic_data, |
82 | struct twl6040_platform_data *twl6040_data, int twl6040_irq) | 72 | struct i2c_board_info *devices, int nr_devices) |
83 | { | 73 | { |
84 | /* PMIC part*/ | 74 | /* PMIC part*/ |
85 | omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); | 75 | omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); |
86 | strncpy(omap4_i2c1_board_info[0].type, pmic_type, | 76 | omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); |
87 | sizeof(omap4_i2c1_board_info[0].type)); | ||
88 | omap4_i2c1_board_info[0].irq = 7 + OMAP44XX_IRQ_GIC_START; | ||
89 | omap4_i2c1_board_info[0].platform_data = pmic_data; | ||
90 | |||
91 | /* TWL6040 audio IC part */ | ||
92 | omap4_i2c1_board_info[1].irq = twl6040_irq; | ||
93 | omap4_i2c1_board_info[1].platform_data = twl6040_data; | ||
94 | |||
95 | omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2); | ||
96 | 77 | ||
78 | /* Register additional devices on i2c1 bus if needed */ | ||
79 | if (devices) | ||
80 | i2c_register_board_info(1, devices, nr_devices); | ||
97 | } | 81 | } |
98 | 82 | ||
99 | void __init omap_pmic_late_init(void) | 83 | void __init omap_pmic_late_init(void) |
100 | { | 84 | { |
101 | /* Init the OMAP TWL parameters (if PMIC has been registered) */ | 85 | /* Init the OMAP TWL parameters (if PMIC has been registerd) */ |
102 | if (pmic_i2c_board_info.irq) | 86 | if (!pmic_i2c_board_info.irq) |
103 | omap3_twl_init(); | 87 | return; |
104 | if (omap4_i2c1_board_info[0].irq) | 88 | |
105 | omap4_twl_init(); | 89 | omap3_twl_init(); |
90 | omap4_twl_init(); | ||
106 | } | 91 | } |
107 | 92 | ||
108 | #if defined(CONFIG_ARCH_OMAP3) | 93 | #if defined(CONFIG_ARCH_OMAP3) |
@@ -252,11 +237,6 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, | |||
252 | 237 | ||
253 | #if defined(CONFIG_ARCH_OMAP4) | 238 | #if defined(CONFIG_ARCH_OMAP4) |
254 | static struct twl4030_usb_data omap4_usb_pdata = { | 239 | static struct twl4030_usb_data omap4_usb_pdata = { |
255 | .phy_init = omap4430_phy_init, | ||
256 | .phy_exit = omap4430_phy_exit, | ||
257 | .phy_power = omap4430_phy_power, | ||
258 | .phy_set_clock = omap4430_phy_set_clk, | ||
259 | .phy_suspend = omap4430_phy_suspend, | ||
260 | }; | 240 | }; |
261 | 241 | ||
262 | static struct regulator_init_data omap4_vdac_idata = { | 242 | static struct regulator_init_data omap4_vdac_idata = { |
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index d109c09ef34b..2256efe90cf1 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | struct twl4030_platform_data; | 33 | struct twl4030_platform_data; |
34 | struct twl6040_platform_data; | 34 | struct twl6040_platform_data; |
35 | struct i2c_board_info; | ||
35 | 36 | ||
36 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, | 37 | void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, |
37 | struct twl4030_platform_data *pmic_data); | 38 | struct twl4030_platform_data *pmic_data); |
@@ -51,7 +52,7 @@ static inline void omap3_pmic_init(const char *pmic_type, | |||
51 | 52 | ||
52 | void omap4_pmic_init(const char *pmic_type, | 53 | void omap4_pmic_init(const char *pmic_type, |
53 | struct twl4030_platform_data *pmic_data, | 54 | struct twl4030_platform_data *pmic_data, |
54 | struct twl6040_platform_data *audio_data, int twl6040_irq); | 55 | struct i2c_board_info *devices, int nr_devices); |
55 | 56 | ||
56 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, | 57 | void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, |
57 | u32 pdata_flags, u32 regulators_flags); | 58 | u32 pdata_flags, u32 regulators_flags); |
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index ac95daaa4702..3c434498e12e 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -33,10 +33,12 @@ | |||
33 | #ifdef CONFIG_MFD_OMAP_USB_HOST | 33 | #ifdef CONFIG_MFD_OMAP_USB_HOST |
34 | 34 | ||
35 | #define OMAP_USBHS_DEVICE "usbhs_omap" | 35 | #define OMAP_USBHS_DEVICE "usbhs_omap" |
36 | #define OMAP_USBTLL_DEVICE "usbhs_tll" | ||
36 | #define USBHS_UHH_HWMODNAME "usb_host_hs" | 37 | #define USBHS_UHH_HWMODNAME "usb_host_hs" |
37 | #define USBHS_TLL_HWMODNAME "usb_tll_hs" | 38 | #define USBHS_TLL_HWMODNAME "usb_tll_hs" |
38 | 39 | ||
39 | static struct usbhs_omap_platform_data usbhs_data; | 40 | static struct usbhs_omap_platform_data usbhs_data; |
41 | static struct usbtll_omap_platform_data usbtll_data; | ||
40 | static struct ehci_hcd_omap_platform_data ehci_data; | 42 | static struct ehci_hcd_omap_platform_data ehci_data; |
41 | static struct ohci_hcd_omap_platform_data ohci_data; | 43 | static struct ohci_hcd_omap_platform_data ohci_data; |
42 | 44 | ||
@@ -485,13 +487,14 @@ void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) | |||
485 | 487 | ||
486 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | 488 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) |
487 | { | 489 | { |
488 | struct omap_hwmod *oh[2]; | 490 | struct omap_hwmod *uhh_hwm, *tll_hwm; |
489 | struct platform_device *pdev; | 491 | struct platform_device *pdev; |
490 | int bus_id = -1; | 492 | int bus_id = -1; |
491 | int i; | 493 | int i; |
492 | 494 | ||
493 | for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { | 495 | for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { |
494 | usbhs_data.port_mode[i] = pdata->port_mode[i]; | 496 | usbhs_data.port_mode[i] = pdata->port_mode[i]; |
497 | usbtll_data.port_mode[i] = pdata->port_mode[i]; | ||
495 | ohci_data.port_mode[i] = pdata->port_mode[i]; | 498 | ohci_data.port_mode[i] = pdata->port_mode[i]; |
496 | ehci_data.port_mode[i] = pdata->port_mode[i]; | 499 | ehci_data.port_mode[i] = pdata->port_mode[i]; |
497 | ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; | 500 | ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; |
@@ -510,25 +513,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata) | |||
510 | setup_4430ohci_io_mux(pdata->port_mode); | 513 | setup_4430ohci_io_mux(pdata->port_mode); |
511 | } | 514 | } |
512 | 515 | ||
513 | oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); | 516 | uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); |
514 | if (!oh[0]) { | 517 | if (!uhh_hwm) { |
515 | pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); | 518 | pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); |
516 | return; | 519 | return; |
517 | } | 520 | } |
518 | 521 | ||
519 | oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); | 522 | tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); |
520 | if (!oh[1]) { | 523 | if (!tll_hwm) { |
521 | pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); | 524 | pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); |
522 | return; | 525 | return; |
523 | } | 526 | } |
524 | 527 | ||
525 | pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, | 528 | pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm, |
526 | (void *)&usbhs_data, sizeof(usbhs_data), | 529 | &usbtll_data, sizeof(usbtll_data), |
527 | omap_uhhtll_latency, | 530 | omap_uhhtll_latency, |
528 | ARRAY_SIZE(omap_uhhtll_latency), false); | 531 | ARRAY_SIZE(omap_uhhtll_latency), false); |
529 | if (IS_ERR(pdev)) { | 532 | if (IS_ERR(pdev)) { |
530 | pr_err("Could not build hwmod devices %s,%s\n", | 533 | pr_err("Could not build hwmod device %s\n", |
531 | USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); | 534 | USBHS_TLL_HWMODNAME); |
535 | return; | ||
536 | } | ||
537 | |||
538 | pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm, | ||
539 | &usbhs_data, sizeof(usbhs_data), | ||
540 | omap_uhhtll_latency, | ||
541 | ARRAY_SIZE(omap_uhhtll_latency), false); | ||
542 | if (IS_ERR(pdev)) { | ||
543 | pr_err("Could not build hwmod devices %s\n", | ||
544 | USBHS_UHH_HWMODNAME); | ||
532 | return; | 545 | return; |
533 | } | 546 | } |
534 | } | 547 | } |
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index 136c64bc9028..51da21cb78f1 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c | |||
@@ -116,7 +116,4 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data) | |||
116 | dev->dma_mask = &musb_dmamask; | 116 | dev->dma_mask = &musb_dmamask; |
117 | dev->coherent_dma_mask = musb_dmamask; | 117 | dev->coherent_dma_mask = musb_dmamask; |
118 | put_device(dev); | 118 | put_device(dev); |
119 | |||
120 | if (cpu_is_omap44xx()) | ||
121 | omap4430_phy_init(dev); | ||
122 | } | 119 | } |
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c index 3e07f52f2127..b3eb3da01160 100644 --- a/arch/arm/mach-orion5x/common.c +++ b/arch/arm/mach-orion5x/common.c | |||
@@ -194,6 +194,13 @@ void __init orion5x_wdt_init(void) | |||
194 | void __init orion5x_init_early(void) | 194 | void __init orion5x_init_early(void) |
195 | { | 195 | { |
196 | orion_time_set_base(TIMER_VIRT_BASE); | 196 | orion_time_set_base(TIMER_VIRT_BASE); |
197 | |||
198 | /* | ||
199 | * Some Orion5x devices allocate their coherent buffers from atomic | ||
200 | * context. Increase size of atomic coherent pool to make sure such | ||
201 | * the allocations won't fail. | ||
202 | */ | ||
203 | init_dma_coherent_pool_size(SZ_1M); | ||
197 | } | 204 | } |
198 | 205 | ||
199 | int orion5x_tclk; | 206 | int orion5x_tclk; |
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c index 78a6a11d8216..9b1c95310291 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/ethtool.h> | 18 | #include <linux/ethtool.h> |
19 | #include <net/dsa.h> | 19 | #include <net/dsa.h> |
20 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
21 | #include <asm/leds.h> | ||
22 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/pci.h> | 22 | #include <asm/mach/pci.h> |
24 | #include <mach/orion5x.h> | 23 | #include <mach/orion5x.h> |
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c index 2f5dc54cd4cd..51ba2b81a10b 100644 --- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <net/dsa.h> | 20 | #include <net/dsa.h> |
21 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
22 | #include <asm/leds.h> | ||
23 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/pci.h> | 23 | #include <asm/mach/pci.h> |
25 | #include <mach/orion5x.h> | 24 | #include <mach/orion5x.h> |
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index 399130fac0b6..0a56b9444f1b 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <linux/mv643xx_eth.h> | 19 | #include <linux/mv643xx_eth.h> |
20 | #include <linux/ata_platform.h> | 20 | #include <linux/ata_platform.h> |
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/leds.h> | ||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/leds.h> | ||
24 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/pci.h> | 25 | #include <asm/mach/pci.h> |
26 | #include <mach/orion5x.h> | 26 | #include <mach/orion5x.h> |
@@ -53,12 +53,6 @@ | |||
53 | #define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7 | 53 | #define RD88F5182_PCI_SLOT0_IRQ_A_PIN 7 |
54 | #define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6 | 54 | #define RD88F5182_PCI_SLOT0_IRQ_B_PIN 6 |
55 | 55 | ||
56 | /* | ||
57 | * GPIO Debug LED | ||
58 | */ | ||
59 | |||
60 | #define RD88F5182_GPIO_DBG_LED 0 | ||
61 | |||
62 | /***************************************************************************** | 56 | /***************************************************************************** |
63 | * 16M NOR Flash on Device bus CS1 | 57 | * 16M NOR Flash on Device bus CS1 |
64 | ****************************************************************************/ | 58 | ****************************************************************************/ |
@@ -83,55 +77,32 @@ static struct platform_device rd88f5182_nor_flash = { | |||
83 | .resource = &rd88f5182_nor_flash_resource, | 77 | .resource = &rd88f5182_nor_flash_resource, |
84 | }; | 78 | }; |
85 | 79 | ||
86 | #ifdef CONFIG_LEDS | ||
87 | |||
88 | /***************************************************************************** | 80 | /***************************************************************************** |
89 | * Use GPIO debug led as CPU active indication | 81 | * Use GPIO LED as CPU active indication |
90 | ****************************************************************************/ | 82 | ****************************************************************************/ |
91 | 83 | ||
92 | static void rd88f5182_dbgled_event(led_event_t evt) | 84 | #define RD88F5182_GPIO_LED 0 |
93 | { | ||
94 | int val; | ||
95 | |||
96 | if (evt == led_idle_end) | ||
97 | val = 1; | ||
98 | else if (evt == led_idle_start) | ||
99 | val = 0; | ||
100 | else | ||
101 | return; | ||
102 | |||
103 | gpio_set_value(RD88F5182_GPIO_DBG_LED, val); | ||
104 | } | ||
105 | |||
106 | static int __init rd88f5182_dbgled_init(void) | ||
107 | { | ||
108 | int pin; | ||
109 | |||
110 | if (machine_is_rd88f5182()) { | ||
111 | pin = RD88F5182_GPIO_DBG_LED; | ||
112 | 85 | ||
113 | if (gpio_request(pin, "DBGLED") == 0) { | 86 | static struct gpio_led rd88f5182_gpio_led_pins[] = { |
114 | if (gpio_direction_output(pin, 0) != 0) { | 87 | { |
115 | printk(KERN_ERR "rd88f5182_dbgled_init failed " | 88 | .name = "rd88f5182:cpu", |
116 | "to set output pin %d\n", pin); | 89 | .default_trigger = "cpu0", |
117 | gpio_free(pin); | 90 | .gpio = RD88F5182_GPIO_LED, |
118 | return 0; | 91 | }, |
119 | } | 92 | }; |
120 | } else { | ||
121 | printk(KERN_ERR "rd88f5182_dbgled_init failed " | ||
122 | "to request gpio %d\n", pin); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | leds_event = rd88f5182_dbgled_event; | ||
127 | } | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | 93 | ||
132 | __initcall(rd88f5182_dbgled_init); | 94 | static struct gpio_led_platform_data rd88f5182_gpio_led_data = { |
95 | .leds = rd88f5182_gpio_led_pins, | ||
96 | .num_leds = ARRAY_SIZE(rd88f5182_gpio_led_pins), | ||
97 | }; | ||
133 | 98 | ||
134 | #endif | 99 | static struct platform_device rd88f5182_gpio_leds = { |
100 | .name = "leds-gpio", | ||
101 | .id = -1, | ||
102 | .dev = { | ||
103 | .platform_data = &rd88f5182_gpio_led_data, | ||
104 | }, | ||
105 | }; | ||
135 | 106 | ||
136 | /***************************************************************************** | 107 | /***************************************************************************** |
137 | * PCI | 108 | * PCI |
@@ -298,6 +269,7 @@ static void __init rd88f5182_init(void) | |||
298 | 269 | ||
299 | orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE); | 270 | orion5x_setup_dev1_win(RD88F5182_NOR_BASE, RD88F5182_NOR_SIZE); |
300 | platform_device_register(&rd88f5182_nor_flash); | 271 | platform_device_register(&rd88f5182_nor_flash); |
272 | platform_device_register(&rd88f5182_gpio_leds); | ||
301 | 273 | ||
302 | i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); | 274 | i2c_register_board_info(0, &rd88f5182_i2c_rtc, 1); |
303 | } | 275 | } |
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c index 92df49c1b62a..ed50910b08a4 100644 --- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c +++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/ethtool.h> | 20 | #include <linux/ethtool.h> |
21 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |
22 | #include <asm/mach-types.h> | 22 | #include <asm/mach-types.h> |
23 | #include <asm/leds.h> | ||
24 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/pci.h> | 24 | #include <asm/mach/pci.h> |
26 | #include <mach/orion5x.h> | 25 | #include <mach/orion5x.h> |
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c index b4203277f3cd..b0727dcd1ef9 100644 --- a/arch/arm/mach-orion5x/ts78xx-setup.c +++ b/arch/arm/mach-orion5x/ts78xx-setup.c | |||
@@ -36,7 +36,7 @@ | |||
36 | * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE | 36 | * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE |
37 | */ | 37 | */ |
38 | #define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000 | 38 | #define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000 |
39 | #define TS78XX_FPGA_REGS_VIRT_BASE 0xff900000 | 39 | #define TS78XX_FPGA_REGS_VIRT_BASE IOMEM(0xff900000) |
40 | #define TS78XX_FPGA_REGS_SIZE SZ_1M | 40 | #define TS78XX_FPGA_REGS_SIZE SZ_1M |
41 | 41 | ||
42 | static struct ts78xx_fpga_data ts78xx_fpga = { | 42 | static struct ts78xx_fpga_data ts78xx_fpga = { |
@@ -50,7 +50,7 @@ static struct ts78xx_fpga_data ts78xx_fpga = { | |||
50 | ****************************************************************************/ | 50 | ****************************************************************************/ |
51 | static struct map_desc ts78xx_io_desc[] __initdata = { | 51 | static struct map_desc ts78xx_io_desc[] __initdata = { |
52 | { | 52 | { |
53 | .virtual = TS78XX_FPGA_REGS_VIRT_BASE, | 53 | .virtual = (unsigned long)TS78XX_FPGA_REGS_VIRT_BASE, |
54 | .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE), | 54 | .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE), |
55 | .length = TS78XX_FPGA_REGS_SIZE, | 55 | .length = TS78XX_FPGA_REGS_SIZE, |
56 | .type = MT_DEVICE, | 56 | .type = MT_DEVICE, |
@@ -80,8 +80,8 @@ static struct mv_sata_platform_data ts78xx_sata_data = { | |||
80 | /***************************************************************************** | 80 | /***************************************************************************** |
81 | * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c | 81 | * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c |
82 | ****************************************************************************/ | 82 | ****************************************************************************/ |
83 | #define TS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x808) | 83 | #define TS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE + 0x808) |
84 | #define TS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE | 0x80c) | 84 | #define TS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE + 0x80c) |
85 | 85 | ||
86 | static unsigned char ts78xx_ts_rtc_readbyte(unsigned long addr) | 86 | static unsigned char ts78xx_ts_rtc_readbyte(unsigned long addr) |
87 | { | 87 | { |
@@ -162,8 +162,8 @@ static void ts78xx_ts_rtc_unload(void) | |||
162 | /***************************************************************************** | 162 | /***************************************************************************** |
163 | * NAND Flash | 163 | * NAND Flash |
164 | ****************************************************************************/ | 164 | ****************************************************************************/ |
165 | #define TS_NAND_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x800) /* VIRT */ | 165 | #define TS_NAND_CTRL (TS78XX_FPGA_REGS_VIRT_BASE + 0x800) /* VIRT */ |
166 | #define TS_NAND_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x804) /* PHYS */ | 166 | #define TS_NAND_DATA (TS78XX_FPGA_REGS_PHYS_BASE + 0x804) /* PHYS */ |
167 | 167 | ||
168 | /* | 168 | /* |
169 | * hardware specific access to control-lines | 169 | * hardware specific access to control-lines |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 2bedc9ed076c..ee88d6eae648 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -98,12 +98,4 @@ obj-$(CONFIG_MACH_RAUMFELD_CONNECTOR) += raumfeld.o | |||
98 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o | 98 | obj-$(CONFIG_MACH_RAUMFELD_SPEAKER) += raumfeld.o |
99 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o | 99 | obj-$(CONFIG_MACH_ZIPIT2) += z2.o |
100 | 100 | ||
101 | # Support for blinky lights | ||
102 | led-y := leds.o | ||
103 | led-$(CONFIG_ARCH_LUBBOCK) += leds-lubbock.o | ||
104 | led-$(CONFIG_MACH_MAINSTONE) += leds-mainstone.o | ||
105 | led-$(CONFIG_ARCH_PXA_IDP) += leds-idp.o | ||
106 | |||
107 | obj-$(CONFIG_LEDS) += $(led-y) | ||
108 | |||
109 | obj-$(CONFIG_TOSA_BT) += tosa-bt.o | 101 | obj-$(CONFIG_TOSA_BT) += tosa-bt.o |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index c36151940d17..64507cdd2e8f 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -191,6 +191,87 @@ static void __init idp_map_io(void) | |||
191 | iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc)); | 191 | iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc)); |
192 | } | 192 | } |
193 | 193 | ||
194 | /* LEDs */ | ||
195 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
196 | struct idp_led { | ||
197 | struct led_classdev cdev; | ||
198 | u8 mask; | ||
199 | }; | ||
200 | |||
201 | /* | ||
202 | * The triggers lines up below will only be used if the | ||
203 | * LED triggers are compiled in. | ||
204 | */ | ||
205 | static const struct { | ||
206 | const char *name; | ||
207 | const char *trigger; | ||
208 | } idp_leds[] = { | ||
209 | { "idp:green", "heartbeat", }, | ||
210 | { "idp:red", "cpu0", }, | ||
211 | }; | ||
212 | |||
213 | static void idp_led_set(struct led_classdev *cdev, | ||
214 | enum led_brightness b) | ||
215 | { | ||
216 | struct idp_led *led = container_of(cdev, | ||
217 | struct idp_led, cdev); | ||
218 | u32 reg = IDP_CPLD_LED_CONTROL; | ||
219 | |||
220 | if (b != LED_OFF) | ||
221 | reg &= ~led->mask; | ||
222 | else | ||
223 | reg |= led->mask; | ||
224 | |||
225 | IDP_CPLD_LED_CONTROL = reg; | ||
226 | } | ||
227 | |||
228 | static enum led_brightness idp_led_get(struct led_classdev *cdev) | ||
229 | { | ||
230 | struct idp_led *led = container_of(cdev, | ||
231 | struct idp_led, cdev); | ||
232 | |||
233 | return (IDP_CPLD_LED_CONTROL & led->mask) ? LED_OFF : LED_FULL; | ||
234 | } | ||
235 | |||
236 | static int __init idp_leds_init(void) | ||
237 | { | ||
238 | int i; | ||
239 | |||
240 | if (!machine_is_pxa_idp()) | ||
241 | return -ENODEV; | ||
242 | |||
243 | for (i = 0; i < ARRAY_SIZE(idp_leds); i++) { | ||
244 | struct idp_led *led; | ||
245 | |||
246 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
247 | if (!led) | ||
248 | break; | ||
249 | |||
250 | led->cdev.name = idp_leds[i].name; | ||
251 | led->cdev.brightness_set = idp_led_set; | ||
252 | led->cdev.brightness_get = idp_led_get; | ||
253 | led->cdev.default_trigger = idp_leds[i].trigger; | ||
254 | |||
255 | if (i == 0) | ||
256 | led->mask = IDP_HB_LED; | ||
257 | else | ||
258 | led->mask = IDP_BUSY_LED; | ||
259 | |||
260 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
261 | kfree(led); | ||
262 | break; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * Since we may have triggers on any subsystem, defer registration | ||
271 | * until after subsystem_init. | ||
272 | */ | ||
273 | fs_initcall(idp_leds_init); | ||
274 | #endif | ||
194 | 275 | ||
195 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") | 276 | MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") |
196 | /* Maintainer: Vibren Technologies */ | 277 | /* Maintainer: Vibren Technologies */ |
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c deleted file mode 100644 index 06b060025d11..000000000000 --- a/arch/arm/mach-pxa/leds-idp.c +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds-idp.c | ||
3 | * | ||
4 | * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu> | ||
5 | * | ||
6 | * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com> | ||
7 | * | ||
8 | * Original (leds-footbridge.c) by Russell King | ||
9 | * | ||
10 | * Macros for actual LED manipulation should be in machine specific | ||
11 | * files in this 'mach' directory. | ||
12 | */ | ||
13 | |||
14 | |||
15 | #include <linux/init.h> | ||
16 | |||
17 | #include <mach/hardware.h> | ||
18 | #include <asm/leds.h> | ||
19 | |||
20 | #include <mach/pxa25x.h> | ||
21 | #include <mach/idp.h> | ||
22 | |||
23 | #include "leds.h" | ||
24 | |||
25 | #define LED_STATE_ENABLED 1 | ||
26 | #define LED_STATE_CLAIMED 2 | ||
27 | |||
28 | static unsigned int led_state; | ||
29 | static unsigned int hw_led_state; | ||
30 | |||
31 | void idp_leds_event(led_event_t evt) | ||
32 | { | ||
33 | unsigned long flags; | ||
34 | |||
35 | local_irq_save(flags); | ||
36 | |||
37 | switch (evt) { | ||
38 | case led_start: | ||
39 | hw_led_state = IDP_HB_LED | IDP_BUSY_LED; | ||
40 | led_state = LED_STATE_ENABLED; | ||
41 | break; | ||
42 | |||
43 | case led_stop: | ||
44 | led_state &= ~LED_STATE_ENABLED; | ||
45 | break; | ||
46 | |||
47 | case led_claim: | ||
48 | led_state |= LED_STATE_CLAIMED; | ||
49 | hw_led_state = IDP_HB_LED | IDP_BUSY_LED; | ||
50 | break; | ||
51 | |||
52 | case led_release: | ||
53 | led_state &= ~LED_STATE_CLAIMED; | ||
54 | hw_led_state = IDP_HB_LED | IDP_BUSY_LED; | ||
55 | break; | ||
56 | |||
57 | #ifdef CONFIG_LEDS_TIMER | ||
58 | case led_timer: | ||
59 | if (!(led_state & LED_STATE_CLAIMED)) | ||
60 | hw_led_state ^= IDP_HB_LED; | ||
61 | break; | ||
62 | #endif | ||
63 | |||
64 | #ifdef CONFIG_LEDS_CPU | ||
65 | case led_idle_start: | ||
66 | if (!(led_state & LED_STATE_CLAIMED)) | ||
67 | hw_led_state &= ~IDP_BUSY_LED; | ||
68 | break; | ||
69 | |||
70 | case led_idle_end: | ||
71 | if (!(led_state & LED_STATE_CLAIMED)) | ||
72 | hw_led_state |= IDP_BUSY_LED; | ||
73 | break; | ||
74 | #endif | ||
75 | |||
76 | case led_halted: | ||
77 | break; | ||
78 | |||
79 | case led_green_on: | ||
80 | if (led_state & LED_STATE_CLAIMED) | ||
81 | hw_led_state |= IDP_HB_LED; | ||
82 | break; | ||
83 | |||
84 | case led_green_off: | ||
85 | if (led_state & LED_STATE_CLAIMED) | ||
86 | hw_led_state &= ~IDP_HB_LED; | ||
87 | break; | ||
88 | |||
89 | case led_amber_on: | ||
90 | break; | ||
91 | |||
92 | case led_amber_off: | ||
93 | break; | ||
94 | |||
95 | case led_red_on: | ||
96 | if (led_state & LED_STATE_CLAIMED) | ||
97 | hw_led_state |= IDP_BUSY_LED; | ||
98 | break; | ||
99 | |||
100 | case led_red_off: | ||
101 | if (led_state & LED_STATE_CLAIMED) | ||
102 | hw_led_state &= ~IDP_BUSY_LED; | ||
103 | break; | ||
104 | |||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | if (led_state & LED_STATE_ENABLED) | ||
110 | IDP_CPLD_LED_CONTROL = ( (IDP_CPLD_LED_CONTROL | IDP_LEDS_MASK) & ~hw_led_state); | ||
111 | else | ||
112 | IDP_CPLD_LED_CONTROL |= IDP_LEDS_MASK; | ||
113 | |||
114 | local_irq_restore(flags); | ||
115 | } | ||
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c deleted file mode 100644 index 0bd85c884a7c..000000000000 --- a/arch/arm/mach-pxa/leds-lubbock.c +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds-lubbock.c | ||
3 | * | ||
4 | * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu> | ||
5 | * | ||
6 | * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com> | ||
7 | * | ||
8 | * Original (leds-footbridge.c) by Russell King | ||
9 | * | ||
10 | * Major surgery on April 2004 by Nicolas Pitre for less global | ||
11 | * namespace collision. Mostly adapted the Mainstone version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include <mach/hardware.h> | ||
17 | #include <asm/leds.h> | ||
18 | #include <mach/pxa25x.h> | ||
19 | #include <mach/lubbock.h> | ||
20 | |||
21 | #include "leds.h" | ||
22 | |||
23 | /* | ||
24 | * 8 discrete leds available for general use: | ||
25 | * | ||
26 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
27 | * so be sure to not monkey with them here. | ||
28 | */ | ||
29 | |||
30 | #define D28 (1 << 0) | ||
31 | #define D27 (1 << 1) | ||
32 | #define D26 (1 << 2) | ||
33 | #define D25 (1 << 3) | ||
34 | #define D24 (1 << 4) | ||
35 | #define D23 (1 << 5) | ||
36 | #define D22 (1 << 6) | ||
37 | #define D21 (1 << 7) | ||
38 | |||
39 | #define LED_STATE_ENABLED 1 | ||
40 | #define LED_STATE_CLAIMED 2 | ||
41 | |||
42 | static unsigned int led_state; | ||
43 | static unsigned int hw_led_state; | ||
44 | |||
45 | void lubbock_leds_event(led_event_t evt) | ||
46 | { | ||
47 | unsigned long flags; | ||
48 | |||
49 | local_irq_save(flags); | ||
50 | |||
51 | switch (evt) { | ||
52 | case led_start: | ||
53 | hw_led_state = 0; | ||
54 | led_state = LED_STATE_ENABLED; | ||
55 | break; | ||
56 | |||
57 | case led_stop: | ||
58 | led_state &= ~LED_STATE_ENABLED; | ||
59 | break; | ||
60 | |||
61 | case led_claim: | ||
62 | led_state |= LED_STATE_CLAIMED; | ||
63 | hw_led_state = 0; | ||
64 | break; | ||
65 | |||
66 | case led_release: | ||
67 | led_state &= ~LED_STATE_CLAIMED; | ||
68 | hw_led_state = 0; | ||
69 | break; | ||
70 | |||
71 | #ifdef CONFIG_LEDS_TIMER | ||
72 | case led_timer: | ||
73 | hw_led_state ^= D26; | ||
74 | break; | ||
75 | #endif | ||
76 | |||
77 | #ifdef CONFIG_LEDS_CPU | ||
78 | case led_idle_start: | ||
79 | hw_led_state &= ~D27; | ||
80 | break; | ||
81 | |||
82 | case led_idle_end: | ||
83 | hw_led_state |= D27; | ||
84 | break; | ||
85 | #endif | ||
86 | |||
87 | case led_halted: | ||
88 | break; | ||
89 | |||
90 | case led_green_on: | ||
91 | hw_led_state |= D21; | ||
92 | break; | ||
93 | |||
94 | case led_green_off: | ||
95 | hw_led_state &= ~D21; | ||
96 | break; | ||
97 | |||
98 | case led_amber_on: | ||
99 | hw_led_state |= D22; | ||
100 | break; | ||
101 | |||
102 | case led_amber_off: | ||
103 | hw_led_state &= ~D22; | ||
104 | break; | ||
105 | |||
106 | case led_red_on: | ||
107 | hw_led_state |= D23; | ||
108 | break; | ||
109 | |||
110 | case led_red_off: | ||
111 | hw_led_state &= ~D23; | ||
112 | break; | ||
113 | |||
114 | default: | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | if (led_state & LED_STATE_ENABLED) | ||
119 | LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state; | ||
120 | else | ||
121 | LUB_DISC_BLNK_LED |= 0xff; | ||
122 | |||
123 | local_irq_restore(flags); | ||
124 | } | ||
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c deleted file mode 100644 index 4058ab340fe6..000000000000 --- a/arch/arm/mach-pxa/leds-mainstone.c +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds-mainstone.c | ||
3 | * | ||
4 | * Author: Nicolas Pitre | ||
5 | * Created: Nov 05, 2002 | ||
6 | * Copyright: MontaVista Software Inc. | ||
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 version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <asm/leds.h> | ||
17 | |||
18 | #include <mach/pxa27x.h> | ||
19 | #include <mach/mainstone.h> | ||
20 | |||
21 | #include "leds.h" | ||
22 | |||
23 | |||
24 | /* 8 discrete leds available for general use: */ | ||
25 | #define D28 (1 << 0) | ||
26 | #define D27 (1 << 1) | ||
27 | #define D26 (1 << 2) | ||
28 | #define D25 (1 << 3) | ||
29 | #define D24 (1 << 4) | ||
30 | #define D23 (1 << 5) | ||
31 | #define D22 (1 << 6) | ||
32 | #define D21 (1 << 7) | ||
33 | |||
34 | #define LED_STATE_ENABLED 1 | ||
35 | #define LED_STATE_CLAIMED 2 | ||
36 | |||
37 | static unsigned int led_state; | ||
38 | static unsigned int hw_led_state; | ||
39 | |||
40 | void mainstone_leds_event(led_event_t evt) | ||
41 | { | ||
42 | unsigned long flags; | ||
43 | |||
44 | local_irq_save(flags); | ||
45 | |||
46 | switch (evt) { | ||
47 | case led_start: | ||
48 | hw_led_state = 0; | ||
49 | led_state = LED_STATE_ENABLED; | ||
50 | break; | ||
51 | |||
52 | case led_stop: | ||
53 | led_state &= ~LED_STATE_ENABLED; | ||
54 | break; | ||
55 | |||
56 | case led_claim: | ||
57 | led_state |= LED_STATE_CLAIMED; | ||
58 | hw_led_state = 0; | ||
59 | break; | ||
60 | |||
61 | case led_release: | ||
62 | led_state &= ~LED_STATE_CLAIMED; | ||
63 | hw_led_state = 0; | ||
64 | break; | ||
65 | |||
66 | #ifdef CONFIG_LEDS_TIMER | ||
67 | case led_timer: | ||
68 | hw_led_state ^= D26; | ||
69 | break; | ||
70 | #endif | ||
71 | |||
72 | #ifdef CONFIG_LEDS_CPU | ||
73 | case led_idle_start: | ||
74 | hw_led_state &= ~D27; | ||
75 | break; | ||
76 | |||
77 | case led_idle_end: | ||
78 | hw_led_state |= D27; | ||
79 | break; | ||
80 | #endif | ||
81 | |||
82 | case led_halted: | ||
83 | break; | ||
84 | |||
85 | case led_green_on: | ||
86 | hw_led_state |= D21; | ||
87 | break; | ||
88 | |||
89 | case led_green_off: | ||
90 | hw_led_state &= ~D21; | ||
91 | break; | ||
92 | |||
93 | case led_amber_on: | ||
94 | hw_led_state |= D22; | ||
95 | break; | ||
96 | |||
97 | case led_amber_off: | ||
98 | hw_led_state &= ~D22; | ||
99 | break; | ||
100 | |||
101 | case led_red_on: | ||
102 | hw_led_state |= D23; | ||
103 | break; | ||
104 | |||
105 | case led_red_off: | ||
106 | hw_led_state &= ~D23; | ||
107 | break; | ||
108 | |||
109 | default: | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | if (led_state & LED_STATE_ENABLED) | ||
114 | MST_LEDCTRL = (MST_LEDCTRL | 0xff) & ~hw_led_state; | ||
115 | else | ||
116 | MST_LEDCTRL |= 0xff; | ||
117 | |||
118 | local_irq_restore(flags); | ||
119 | } | ||
diff --git a/arch/arm/mach-pxa/leds.c b/arch/arm/mach-pxa/leds.c deleted file mode 100644 index bbe4d5f6afaa..000000000000 --- a/arch/arm/mach-pxa/leds.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/leds.c | ||
3 | * | ||
4 | * xscale LEDs dispatcher | ||
5 | * | ||
6 | * Copyright (C) 2001 Nicolas Pitre | ||
7 | * | ||
8 | * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc. | ||
9 | */ | ||
10 | #include <linux/compiler.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | #include <asm/leds.h> | ||
14 | #include <asm/mach-types.h> | ||
15 | |||
16 | #include "leds.h" | ||
17 | |||
18 | static int __init | ||
19 | pxa_leds_init(void) | ||
20 | { | ||
21 | if (machine_is_lubbock()) | ||
22 | leds_event = lubbock_leds_event; | ||
23 | if (machine_is_mainstone()) | ||
24 | leds_event = mainstone_leds_event; | ||
25 | if (machine_is_pxa_idp()) | ||
26 | leds_event = idp_leds_event; | ||
27 | |||
28 | leds_event(led_start); | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | core_initcall(pxa_leds_init); | ||
diff --git a/arch/arm/mach-pxa/leds.h b/arch/arm/mach-pxa/leds.h deleted file mode 100644 index 7f0dfe01345a..000000000000 --- a/arch/arm/mach-pxa/leds.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-pxa/leds.h | ||
3 | * | ||
4 | * Copyright (c) 2001 Jeff Sutherland, Accelent Systems Inc. | ||
5 | * | ||
6 | * blinky lights for various PXA-based systems: | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | extern void idp_leds_event(led_event_t evt); | ||
11 | extern void lubbock_leds_event(led_event_t evt); | ||
12 | extern void mainstone_leds_event(led_event_t evt); | ||
13 | extern void trizeps4_leds_event(led_event_t evt); | ||
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 44dd7565707e..553056d9a3c5 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/io.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/syscore_ops.h> | 20 | #include <linux/syscore_ops.h> |
20 | #include <linux/major.h> | 21 | #include <linux/major.h> |
@@ -23,6 +24,8 @@ | |||
23 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
24 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
25 | #include <linux/smc91x.h> | 26 | #include <linux/smc91x.h> |
27 | #include <linux/slab.h> | ||
28 | #include <linux/leds.h> | ||
26 | 29 | ||
27 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
28 | #include <linux/spi/ads7846.h> | 31 | #include <linux/spi/ads7846.h> |
@@ -549,6 +552,98 @@ static void __init lubbock_map_io(void) | |||
549 | PCFR |= PCFR_OPDE; | 552 | PCFR |= PCFR_OPDE; |
550 | } | 553 | } |
551 | 554 | ||
555 | /* | ||
556 | * Driver for the 8 discrete LEDs available for general use: | ||
557 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
558 | * so be sure to not monkey with them here. | ||
559 | */ | ||
560 | |||
561 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
562 | struct lubbock_led { | ||
563 | struct led_classdev cdev; | ||
564 | u8 mask; | ||
565 | }; | ||
566 | |||
567 | /* | ||
568 | * The triggers lines up below will only be used if the | ||
569 | * LED triggers are compiled in. | ||
570 | */ | ||
571 | static const struct { | ||
572 | const char *name; | ||
573 | const char *trigger; | ||
574 | } lubbock_leds[] = { | ||
575 | { "lubbock:D28", "default-on", }, | ||
576 | { "lubbock:D27", "cpu0", }, | ||
577 | { "lubbock:D26", "heartbeat" }, | ||
578 | { "lubbock:D25", }, | ||
579 | { "lubbock:D24", }, | ||
580 | { "lubbock:D23", }, | ||
581 | { "lubbock:D22", }, | ||
582 | { "lubbock:D21", }, | ||
583 | }; | ||
584 | |||
585 | static void lubbock_led_set(struct led_classdev *cdev, | ||
586 | enum led_brightness b) | ||
587 | { | ||
588 | struct lubbock_led *led = container_of(cdev, | ||
589 | struct lubbock_led, cdev); | ||
590 | u32 reg = LUB_DISC_BLNK_LED; | ||
591 | |||
592 | if (b != LED_OFF) | ||
593 | reg |= led->mask; | ||
594 | else | ||
595 | reg &= ~led->mask; | ||
596 | |||
597 | LUB_DISC_BLNK_LED = reg; | ||
598 | } | ||
599 | |||
600 | static enum led_brightness lubbock_led_get(struct led_classdev *cdev) | ||
601 | { | ||
602 | struct lubbock_led *led = container_of(cdev, | ||
603 | struct lubbock_led, cdev); | ||
604 | u32 reg = LUB_DISC_BLNK_LED; | ||
605 | |||
606 | return (reg & led->mask) ? LED_FULL : LED_OFF; | ||
607 | } | ||
608 | |||
609 | static int __init lubbock_leds_init(void) | ||
610 | { | ||
611 | int i; | ||
612 | |||
613 | if (!machine_is_lubbock()) | ||
614 | return -ENODEV; | ||
615 | |||
616 | /* All ON */ | ||
617 | LUB_DISC_BLNK_LED |= 0xff; | ||
618 | for (i = 0; i < ARRAY_SIZE(lubbock_leds); i++) { | ||
619 | struct lubbock_led *led; | ||
620 | |||
621 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
622 | if (!led) | ||
623 | break; | ||
624 | |||
625 | led->cdev.name = lubbock_leds[i].name; | ||
626 | led->cdev.brightness_set = lubbock_led_set; | ||
627 | led->cdev.brightness_get = lubbock_led_get; | ||
628 | led->cdev.default_trigger = lubbock_leds[i].trigger; | ||
629 | led->mask = BIT(i); | ||
630 | |||
631 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
632 | kfree(led); | ||
633 | break; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | /* | ||
641 | * Since we may have triggers on any subsystem, defer registration | ||
642 | * until after subsystem_init. | ||
643 | */ | ||
644 | fs_initcall(lubbock_leds_init); | ||
645 | #endif | ||
646 | |||
552 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") | 647 | MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") |
553 | /* Maintainer: MontaVista Software Inc. */ | 648 | /* Maintainer: MontaVista Software Inc. */ |
554 | .map_io = lubbock_map_io, | 649 | .map_io = lubbock_map_io, |
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 5d9475730a3f..f27a61ee7ac7 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/pwm_backlight.h> | 28 | #include <linux/pwm_backlight.h> |
29 | #include <linux/smc91x.h> | 29 | #include <linux/smc91x.h> |
30 | #include <linux/i2c/pxa-i2c.h> | 30 | #include <linux/i2c/pxa-i2c.h> |
31 | #include <linux/slab.h> | ||
32 | #include <linux/leds.h> | ||
31 | 33 | ||
32 | #include <asm/types.h> | 34 | #include <asm/types.h> |
33 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
@@ -613,6 +615,98 @@ static void __init mainstone_map_io(void) | |||
613 | PCFR = 0x66; | 615 | PCFR = 0x66; |
614 | } | 616 | } |
615 | 617 | ||
618 | /* | ||
619 | * Driver for the 8 discrete LEDs available for general use: | ||
620 | * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays | ||
621 | * so be sure to not monkey with them here. | ||
622 | */ | ||
623 | |||
624 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
625 | struct mainstone_led { | ||
626 | struct led_classdev cdev; | ||
627 | u8 mask; | ||
628 | }; | ||
629 | |||
630 | /* | ||
631 | * The triggers lines up below will only be used if the | ||
632 | * LED triggers are compiled in. | ||
633 | */ | ||
634 | static const struct { | ||
635 | const char *name; | ||
636 | const char *trigger; | ||
637 | } mainstone_leds[] = { | ||
638 | { "mainstone:D28", "default-on", }, | ||
639 | { "mainstone:D27", "cpu0", }, | ||
640 | { "mainstone:D26", "heartbeat" }, | ||
641 | { "mainstone:D25", }, | ||
642 | { "mainstone:D24", }, | ||
643 | { "mainstone:D23", }, | ||
644 | { "mainstone:D22", }, | ||
645 | { "mainstone:D21", }, | ||
646 | }; | ||
647 | |||
648 | static void mainstone_led_set(struct led_classdev *cdev, | ||
649 | enum led_brightness b) | ||
650 | { | ||
651 | struct mainstone_led *led = container_of(cdev, | ||
652 | struct mainstone_led, cdev); | ||
653 | u32 reg = MST_LEDCTRL; | ||
654 | |||
655 | if (b != LED_OFF) | ||
656 | reg |= led->mask; | ||
657 | else | ||
658 | reg &= ~led->mask; | ||
659 | |||
660 | MST_LEDCTRL = reg; | ||
661 | } | ||
662 | |||
663 | static enum led_brightness mainstone_led_get(struct led_classdev *cdev) | ||
664 | { | ||
665 | struct mainstone_led *led = container_of(cdev, | ||
666 | struct mainstone_led, cdev); | ||
667 | u32 reg = MST_LEDCTRL; | ||
668 | |||
669 | return (reg & led->mask) ? LED_FULL : LED_OFF; | ||
670 | } | ||
671 | |||
672 | static int __init mainstone_leds_init(void) | ||
673 | { | ||
674 | int i; | ||
675 | |||
676 | if (!machine_is_mainstone()) | ||
677 | return -ENODEV; | ||
678 | |||
679 | /* All ON */ | ||
680 | MST_LEDCTRL |= 0xff; | ||
681 | for (i = 0; i < ARRAY_SIZE(mainstone_leds); i++) { | ||
682 | struct mainstone_led *led; | ||
683 | |||
684 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
685 | if (!led) | ||
686 | break; | ||
687 | |||
688 | led->cdev.name = mainstone_leds[i].name; | ||
689 | led->cdev.brightness_set = mainstone_led_set; | ||
690 | led->cdev.brightness_get = mainstone_led_get; | ||
691 | led->cdev.default_trigger = mainstone_leds[i].trigger; | ||
692 | led->mask = BIT(i); | ||
693 | |||
694 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
695 | kfree(led); | ||
696 | break; | ||
697 | } | ||
698 | } | ||
699 | |||
700 | return 0; | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * Since we may have triggers on any subsystem, defer registration | ||
705 | * until after subsystem_init. | ||
706 | */ | ||
707 | fs_initcall(mainstone_leds_init); | ||
708 | #endif | ||
709 | |||
616 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 710 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |
617 | /* Maintainer: MontaVista Software Inc. */ | 711 | /* Maintainer: MontaVista Software Inc. */ |
618 | .atag_offset = 0x100, /* BLOB boot parameter setting */ | 712 | .atag_offset = 0x100, /* BLOB boot parameter setting */ |
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 9a154bad1984..5a406f794798 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -579,8 +579,8 @@ static int sharpsl_ac_check(void) | |||
579 | static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state) | 579 | static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state) |
580 | { | 580 | { |
581 | sharpsl_pm.flags |= SHARPSL_SUSPENDED; | 581 | sharpsl_pm.flags |= SHARPSL_SUSPENDED; |
582 | flush_delayed_work_sync(&toggle_charger); | 582 | flush_delayed_work(&toggle_charger); |
583 | flush_delayed_work_sync(&sharpsl_bat); | 583 | flush_delayed_work(&sharpsl_bat); |
584 | 584 | ||
585 | if (sharpsl_pm.charge_mode == CHRG_ON) | 585 | if (sharpsl_pm.charge_mode == CHRG_ON) |
586 | sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG; | 586 | sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG; |
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c index 08ea7a84a291..456560b5aad4 100644 --- a/arch/arm/mach-pxa/stargate2.c +++ b/arch/arm/mach-pxa/stargate2.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include <linux/spi/spi.h> | 52 | #include <linux/spi/spi.h> |
53 | #include <linux/spi/pxa2xx_spi.h> | 53 | #include <linux/spi/pxa2xx_spi.h> |
54 | #include <linux/mfd/da903x.h> | 54 | #include <linux/mfd/da903x.h> |
55 | #include <linux/sht15.h> | 55 | #include <linux/platform_data/sht15.h> |
56 | 56 | ||
57 | #include "devices.h" | 57 | #include "devices.h" |
58 | #include "generic.h" | 58 | #include "generic.h" |
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index ff007d15e0ec..682467480588 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
37 | #include <asm/leds.h> | ||
38 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
39 | #include <asm/hardware/arm_timer.h> | 38 | #include <asm/hardware/arm_timer.h> |
40 | #include <asm/hardware/icst.h> | 39 | #include <asm/hardware/icst.h> |
@@ -330,44 +329,6 @@ struct clcd_board clcd_plat_data = { | |||
330 | .remove = versatile_clcd_remove_dma, | 329 | .remove = versatile_clcd_remove_dma, |
331 | }; | 330 | }; |
332 | 331 | ||
333 | #ifdef CONFIG_LEDS | ||
334 | #define VA_LEDS_BASE (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET) | ||
335 | |||
336 | void realview_leds_event(led_event_t ledevt) | ||
337 | { | ||
338 | unsigned long flags; | ||
339 | u32 val; | ||
340 | u32 led = 1 << smp_processor_id(); | ||
341 | |||
342 | local_irq_save(flags); | ||
343 | val = readl(VA_LEDS_BASE); | ||
344 | |||
345 | switch (ledevt) { | ||
346 | case led_idle_start: | ||
347 | val = val & ~led; | ||
348 | break; | ||
349 | |||
350 | case led_idle_end: | ||
351 | val = val | led; | ||
352 | break; | ||
353 | |||
354 | case led_timer: | ||
355 | val = val ^ REALVIEW_SYS_LED7; | ||
356 | break; | ||
357 | |||
358 | case led_halted: | ||
359 | val = 0; | ||
360 | break; | ||
361 | |||
362 | default: | ||
363 | break; | ||
364 | } | ||
365 | |||
366 | writel(val, VA_LEDS_BASE); | ||
367 | local_irq_restore(flags); | ||
368 | } | ||
369 | #endif /* CONFIG_LEDS */ | ||
370 | |||
371 | /* | 332 | /* |
372 | * Where is the timer (VA)? | 333 | * Where is the timer (VA)? |
373 | */ | 334 | */ |
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 78cd970c80f2..602ca5ec52c5 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | 27 | ||
28 | #include <asm/setup.h> | 28 | #include <asm/setup.h> |
29 | #include <asm/leds.h> | ||
30 | 29 | ||
31 | #define APB_DEVICE(name, busid, base, plat) \ | 30 | #define APB_DEVICE(name, busid, base, plat) \ |
32 | static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat) | 31 | static AMBA_APB_DEVICE(name, busid, 0, REALVIEW_##base##_BASE, base##_IRQ, plat) |
@@ -47,7 +46,6 @@ extern void __iomem *timer1_va_base; | |||
47 | extern void __iomem *timer2_va_base; | 46 | extern void __iomem *timer2_va_base; |
48 | extern void __iomem *timer3_va_base; | 47 | extern void __iomem *timer3_va_base; |
49 | 48 | ||
50 | extern void realview_leds_event(led_event_t ledevt); | ||
51 | extern void realview_timer_init(unsigned int timer_irq); | 49 | extern void realview_timer_init(unsigned int timer_irq); |
52 | extern int realview_flash_register(struct resource *res, u32 num); | 50 | extern int realview_flash_register(struct resource *res, u32 num); |
53 | extern int realview_eth_register(const char *name, struct resource *res); | 51 | extern int realview_eth_register(const char *name, struct resource *res); |
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index ce7747692c8b..d3b3cd216d64 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
33 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
34 | #include <asm/leds.h> | ||
35 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
36 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
37 | #include <asm/hardware/gic.h> | 36 | #include <asm/hardware/gic.h> |
@@ -463,10 +462,6 @@ static void __init realview_eb_init(void) | |||
463 | struct amba_device *d = amba_devs[i]; | 462 | struct amba_device *d = amba_devs[i]; |
464 | amba_device_register(d, &iomem_resource); | 463 | amba_device_register(d, &iomem_resource); |
465 | } | 464 | } |
466 | |||
467 | #ifdef CONFIG_LEDS | ||
468 | leds_event = realview_leds_event; | ||
469 | #endif | ||
470 | } | 465 | } |
471 | 466 | ||
472 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") | 467 | MACHINE_START(REALVIEW_EB, "ARM-RealView EB") |
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c index e21711d72ee2..07d6672ddae7 100644 --- a/arch/arm/mach-realview/realview_pb1176.c +++ b/arch/arm/mach-realview/realview_pb1176.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
36 | #include <asm/leds.h> | ||
37 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
38 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
39 | #include <asm/hardware/gic.h> | 38 | #include <asm/hardware/gic.h> |
@@ -376,10 +375,6 @@ static void __init realview_pb1176_init(void) | |||
376 | struct amba_device *d = amba_devs[i]; | 375 | struct amba_device *d = amba_devs[i]; |
377 | amba_device_register(d, &iomem_resource); | 376 | amba_device_register(d, &iomem_resource); |
378 | } | 377 | } |
379 | |||
380 | #ifdef CONFIG_LEDS | ||
381 | leds_event = realview_leds_event; | ||
382 | #endif | ||
383 | } | 378 | } |
384 | 379 | ||
385 | MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") | 380 | MACHINE_START(REALVIEW_PB1176, "ARM-RealView PB1176") |
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c index a80269981dd4..7ed53d75350f 100644 --- a/arch/arm/mach-realview/realview_pb11mp.c +++ b/arch/arm/mach-realview/realview_pb11mp.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
33 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
34 | #include <asm/leds.h> | ||
35 | #include <asm/mach-types.h> | 34 | #include <asm/mach-types.h> |
36 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
37 | #include <asm/hardware/gic.h> | 36 | #include <asm/hardware/gic.h> |
@@ -358,10 +357,6 @@ static void __init realview_pb11mp_init(void) | |||
358 | struct amba_device *d = amba_devs[i]; | 357 | struct amba_device *d = amba_devs[i]; |
359 | amba_device_register(d, &iomem_resource); | 358 | amba_device_register(d, &iomem_resource); |
360 | } | 359 | } |
361 | |||
362 | #ifdef CONFIG_LEDS | ||
363 | leds_event = realview_leds_event; | ||
364 | #endif | ||
365 | } | 360 | } |
366 | 361 | ||
367 | MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") | 362 | MACHINE_START(REALVIEW_PB11MP, "ARM-RealView PB11MPCore") |
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c index 1435cd863965..9992431b8a15 100644 --- a/arch/arm/mach-realview/realview_pba8.c +++ b/arch/arm/mach-realview/realview_pba8.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/platform_data/clk-realview.h> | 30 | #include <linux/platform_data/clk-realview.h> |
31 | 31 | ||
32 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
33 | #include <asm/leds.h> | ||
34 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
35 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
36 | #include <asm/hardware/gic.h> | 35 | #include <asm/hardware/gic.h> |
@@ -300,10 +299,6 @@ static void __init realview_pba8_init(void) | |||
300 | struct amba_device *d = amba_devs[i]; | 299 | struct amba_device *d = amba_devs[i]; |
301 | amba_device_register(d, &iomem_resource); | 300 | amba_device_register(d, &iomem_resource); |
302 | } | 301 | } |
303 | |||
304 | #ifdef CONFIG_LEDS | ||
305 | leds_event = realview_leds_event; | ||
306 | #endif | ||
307 | } | 302 | } |
308 | 303 | ||
309 | MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") | 304 | MACHINE_START(REALVIEW_PBA8, "ARM-RealView PB-A8") |
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c index a4b1aa93bb5a..4f486f05108a 100644 --- a/arch/arm/mach-realview/realview_pbx.c +++ b/arch/arm/mach-realview/realview_pbx.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/platform_data/clk-realview.h> | 29 | #include <linux/platform_data/clk-realview.h> |
30 | 30 | ||
31 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
32 | #include <asm/leds.h> | ||
33 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
34 | #include <asm/smp_twd.h> | 33 | #include <asm/smp_twd.h> |
35 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
@@ -395,10 +394,6 @@ static void __init realview_pbx_init(void) | |||
395 | struct amba_device *d = amba_devs[i]; | 394 | struct amba_device *d = amba_devs[i]; |
396 | amba_device_register(d, &iomem_resource); | 395 | amba_device_register(d, &iomem_resource); |
397 | } | 396 | } |
398 | |||
399 | #ifdef CONFIG_LEDS | ||
400 | leds_event = realview_leds_event; | ||
401 | #endif | ||
402 | } | 397 | } |
403 | 398 | ||
404 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") | 399 | MACHINE_START(REALVIEW_PBX, "ARM-RealView PBX") |
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c index cb2883d553b5..749220f91a70 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2440.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c | |||
@@ -87,6 +87,19 @@ static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static unsigned long s3c2440_camif_upll_getrate(struct clk *clk) | ||
91 | { | ||
92 | unsigned long parent_rate = clk_get_rate(clk->parent); | ||
93 | unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); | ||
94 | |||
95 | if (!(camdivn & S3C2440_CAMDIVN_CAMCLK_SEL)) | ||
96 | return parent_rate; | ||
97 | |||
98 | camdivn &= S3C2440_CAMDIVN_CAMCLK_MASK; | ||
99 | |||
100 | return parent_rate / (camdivn + 1) / 2; | ||
101 | } | ||
102 | |||
90 | /* Extra S3C2440 clocks */ | 103 | /* Extra S3C2440 clocks */ |
91 | 104 | ||
92 | static struct clk s3c2440_clk_cam = { | 105 | static struct clk s3c2440_clk_cam = { |
@@ -99,6 +112,7 @@ static struct clk s3c2440_clk_cam_upll = { | |||
99 | .name = "camif-upll", | 112 | .name = "camif-upll", |
100 | .ops = &(struct clk_ops) { | 113 | .ops = &(struct clk_ops) { |
101 | .set_rate = s3c2440_camif_upll_setrate, | 114 | .set_rate = s3c2440_camif_upll_setrate, |
115 | .get_rate = s3c2440_camif_upll_getrate, | ||
102 | .round_rate = s3c2440_camif_upll_round, | 116 | .round_rate = s3c2440_camif_upll_round, |
103 | }, | 117 | }, |
104 | }; | 118 | }; |
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index 9638b337593c..63aaf076f611 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -380,7 +380,7 @@ int h1940_led_blink_set(unsigned gpio, int state, | |||
380 | default: | 380 | default: |
381 | blink_gpio = S3C2410_GPA(3); | 381 | blink_gpio = S3C2410_GPA(3); |
382 | check_gpio1 = S3C2410_GPA(1); | 382 | check_gpio1 = S3C2410_GPA(1); |
383 | check_gpio1 = S3C2410_GPA(7); | 383 | check_gpio2 = S3C2410_GPA(7); |
384 | break; | 384 | break; |
385 | } | 385 | } |
386 | 386 | ||
@@ -460,7 +460,7 @@ static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd) | |||
460 | break; | 460 | break; |
461 | default: | 461 | default: |
462 | break; | 462 | break; |
463 | }; | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { | 466 | static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 181aa99427fe..4e3fe57674c8 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mfd/wm831x/irq.h> | 16 | #include <linux/mfd/wm831x/irq.h> |
17 | #include <linux/mfd/wm831x/gpio.h> | 17 | #include <linux/mfd/wm831x/gpio.h> |
18 | #include <linux/mfd/wm8994/pdata.h> | 18 | #include <linux/mfd/wm8994/pdata.h> |
19 | #include <linux/mfd/arizona/pdata.h> | ||
19 | 20 | ||
20 | #include <linux/regulator/machine.h> | 21 | #include <linux/regulator/machine.h> |
21 | 22 | ||
@@ -181,9 +182,33 @@ static const struct i2c_board_info wm1277_devs[] = { | |||
181 | }, | 182 | }, |
182 | }; | 183 | }; |
183 | 184 | ||
184 | static const struct i2c_board_info wm5102_devs[] = { | 185 | static struct arizona_pdata wm5102_pdata = { |
185 | { I2C_BOARD_INFO("wm5102", 0x1a), | 186 | .ldoena = S3C64XX_GPN(7), |
186 | .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2, }, | 187 | .gpio_base = CODEC_GPIO_BASE, |
188 | .irq_active_high = true, | ||
189 | .micd_pol_gpio = CODEC_GPIO_BASE + 4, | ||
190 | .gpio_defaults = { | ||
191 | [2] = 0x10000, /* AIF3TXLRCLK */ | ||
192 | [3] = 0x4, /* OPCLK */ | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | static struct s3c64xx_spi_csinfo wm5102_spi_csinfo = { | ||
197 | .line = S3C64XX_GPN(5), | ||
198 | }; | ||
199 | |||
200 | static struct spi_board_info wm5102_spi_devs[] = { | ||
201 | [0] = { | ||
202 | .modalias = "wm5102", | ||
203 | .max_speed_hz = 10 * 1000 * 1000, | ||
204 | .bus_num = 0, | ||
205 | .chip_select = 0, | ||
206 | .mode = SPI_MODE_0, | ||
207 | .irq = GLENFARCLAS_PMIC_IRQ_BASE + | ||
208 | WM831X_IRQ_GPIO_2, | ||
209 | .controller_data = &wm5102_spi_csinfo, | ||
210 | .platform_data = &wm5102_pdata, | ||
211 | }, | ||
187 | }; | 212 | }; |
188 | 213 | ||
189 | static const struct i2c_board_info wm6230_i2c_devs[] = { | 214 | static const struct i2c_board_info wm6230_i2c_devs[] = { |
@@ -223,8 +248,9 @@ static __devinitdata const struct { | |||
223 | { .id = 0x3c, .name = "1273-EV1 Longmorn" }, | 248 | { .id = 0x3c, .name = "1273-EV1 Longmorn" }, |
224 | { .id = 0x3d, .name = "1277-EV1 Littlemill", | 249 | { .id = 0x3d, .name = "1277-EV1 Littlemill", |
225 | .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, | 250 | .i2c_devs = wm1277_devs, .num_i2c_devs = ARRAY_SIZE(wm1277_devs) }, |
226 | { .id = 0x3e, .name = "WM5102-6271-EV1-CS127", | 251 | { .id = 0x3e, .name = "WM5102-6271-EV1-CS127 Amrut", |
227 | .i2c_devs = wm5102_devs, .num_i2c_devs = ARRAY_SIZE(wm5102_devs) }, | 252 | .spi_devs = wm5102_spi_devs, |
253 | .num_spi_devs = ARRAY_SIZE(wm5102_spi_devs) }, | ||
228 | }; | 254 | }; |
229 | 255 | ||
230 | static __devinit int wlf_gf_module_probe(struct i2c_client *i2c, | 256 | static __devinit int wlf_gf_module_probe(struct i2c_client *i2c, |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index 717d675188d4..8b4d46706645 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c | |||
@@ -287,6 +287,16 @@ static struct platform_device littlemill_device = { | |||
287 | .id = -1, | 287 | .id = -1, |
288 | }; | 288 | }; |
289 | 289 | ||
290 | static struct platform_device bells_wm5102_device = { | ||
291 | .name = "bells", | ||
292 | .id = 0, | ||
293 | }; | ||
294 | |||
295 | static struct platform_device bells_wm5110_device = { | ||
296 | .name = "bells", | ||
297 | .id = 1, | ||
298 | }; | ||
299 | |||
290 | static struct regulator_consumer_supply wallvdd_consumers[] = { | 300 | static struct regulator_consumer_supply wallvdd_consumers[] = { |
291 | REGULATOR_SUPPLY("SPKVDD", "1-001a"), | 301 | REGULATOR_SUPPLY("SPKVDD", "1-001a"), |
292 | REGULATOR_SUPPLY("SPKVDD1", "1-001a"), | 302 | REGULATOR_SUPPLY("SPKVDD1", "1-001a"), |
@@ -359,6 +369,8 @@ static struct platform_device *crag6410_devices[] __initdata = { | |||
359 | &tobermory_device, | 369 | &tobermory_device, |
360 | &littlemill_device, | 370 | &littlemill_device, |
361 | &lowland_device, | 371 | &lowland_device, |
372 | &bells_wm5102_device, | ||
373 | &bells_wm5110_device, | ||
362 | &wallvdd_device, | 374 | &wallvdd_device, |
363 | }; | 375 | }; |
364 | 376 | ||
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile index 60b97ec01676..1aed9e70465d 100644 --- a/arch/arm/mach-sa1100/Makefile +++ b/arch/arm/mach-sa1100/Makefile | |||
@@ -7,21 +7,17 @@ obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o | |||
7 | obj-m := | 7 | obj-m := |
8 | obj-n := | 8 | obj-n := |
9 | obj- := | 9 | obj- := |
10 | led-y := leds.o | ||
11 | 10 | ||
12 | obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o | 11 | obj-$(CONFIG_CPU_FREQ_SA1100) += cpu-sa1100.o |
13 | obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o | 12 | obj-$(CONFIG_CPU_FREQ_SA1110) += cpu-sa1110.o |
14 | 13 | ||
15 | # Specific board support | 14 | # Specific board support |
16 | obj-$(CONFIG_SA1100_ASSABET) += assabet.o | 15 | obj-$(CONFIG_SA1100_ASSABET) += assabet.o |
17 | led-$(CONFIG_SA1100_ASSABET) += leds-assabet.o | ||
18 | obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o | 16 | obj-$(CONFIG_ASSABET_NEPONSET) += neponset.o |
19 | 17 | ||
20 | obj-$(CONFIG_SA1100_BADGE4) += badge4.o | 18 | obj-$(CONFIG_SA1100_BADGE4) += badge4.o |
21 | led-$(CONFIG_SA1100_BADGE4) += leds-badge4.o | ||
22 | 19 | ||
23 | obj-$(CONFIG_SA1100_CERF) += cerf.o | 20 | obj-$(CONFIG_SA1100_CERF) += cerf.o |
24 | led-$(CONFIG_SA1100_CERF) += leds-cerf.o | ||
25 | 21 | ||
26 | obj-$(CONFIG_SA1100_COLLIE) += collie.o | 22 | obj-$(CONFIG_SA1100_COLLIE) += collie.o |
27 | 23 | ||
@@ -29,13 +25,11 @@ obj-$(CONFIG_SA1100_H3100) += h3100.o h3xxx.o | |||
29 | obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o | 25 | obj-$(CONFIG_SA1100_H3600) += h3600.o h3xxx.o |
30 | 26 | ||
31 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o | 27 | obj-$(CONFIG_SA1100_HACKKIT) += hackkit.o |
32 | led-$(CONFIG_SA1100_HACKKIT) += leds-hackkit.o | ||
33 | 28 | ||
34 | obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o | 29 | obj-$(CONFIG_SA1100_JORNADA720) += jornada720.o |
35 | obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o | 30 | obj-$(CONFIG_SA1100_JORNADA720_SSP) += jornada720_ssp.o |
36 | 31 | ||
37 | obj-$(CONFIG_SA1100_LART) += lart.o | 32 | obj-$(CONFIG_SA1100_LART) += lart.o |
38 | led-$(CONFIG_SA1100_LART) += leds-lart.o | ||
39 | 33 | ||
40 | obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o | 34 | obj-$(CONFIG_SA1100_NANOENGINE) += nanoengine.o |
41 | obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o | 35 | obj-$(CONFIG_PCI_NANOENGINE) += pci-nanoengine.o |
@@ -46,9 +40,6 @@ obj-$(CONFIG_SA1100_SHANNON) += shannon.o | |||
46 | 40 | ||
47 | obj-$(CONFIG_SA1100_SIMPAD) += simpad.o | 41 | obj-$(CONFIG_SA1100_SIMPAD) += simpad.o |
48 | 42 | ||
49 | # LEDs support | ||
50 | obj-$(CONFIG_LEDS) += $(led-y) | ||
51 | |||
52 | # Miscellaneous functions | 43 | # Miscellaneous functions |
53 | obj-$(CONFIG_PM) += pm.o sleep.o | 44 | obj-$(CONFIG_PM) += pm.o sleep.o |
54 | obj-$(CONFIG_SA1100_SSP) += ssp.o | 45 | obj-$(CONFIG_SA1100_SSP) += ssp.o |
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c index ba49241b02f0..e1ccda6128eb 100644 --- a/arch/arm/mach-sa1100/assabet.c +++ b/arch/arm/mach-sa1100/assabet.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/mtd/partitions.h> | 20 | #include <linux/mtd/partitions.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/leds.h> | ||
24 | #include <linux/slab.h> | ||
23 | 25 | ||
24 | #include <video/sa1100fb.h> | 26 | #include <video/sa1100fb.h> |
25 | 27 | ||
@@ -529,6 +531,89 @@ static void __init assabet_map_io(void) | |||
529 | sa1100_register_uart(2, 3); | 531 | sa1100_register_uart(2, 3); |
530 | } | 532 | } |
531 | 533 | ||
534 | /* LEDs */ | ||
535 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | ||
536 | struct assabet_led { | ||
537 | struct led_classdev cdev; | ||
538 | u32 mask; | ||
539 | }; | ||
540 | |||
541 | /* | ||
542 | * The triggers lines up below will only be used if the | ||
543 | * LED triggers are compiled in. | ||
544 | */ | ||
545 | static const struct { | ||
546 | const char *name; | ||
547 | const char *trigger; | ||
548 | } assabet_leds[] = { | ||
549 | { "assabet:red", "cpu0",}, | ||
550 | { "assabet:green", "heartbeat", }, | ||
551 | }; | ||
552 | |||
553 | /* | ||
554 | * The LED control in Assabet is reversed: | ||
555 | * - setting bit means turn off LED | ||
556 | * - clearing bit means turn on LED | ||
557 | */ | ||
558 | static void assabet_led_set(struct led_classdev *cdev, | ||
559 | enum led_brightness b) | ||
560 | { | ||
561 | struct assabet_led *led = container_of(cdev, | ||
562 | struct assabet_led, cdev); | ||
563 | |||
564 | if (b != LED_OFF) | ||
565 | ASSABET_BCR_clear(led->mask); | ||
566 | else | ||
567 | ASSABET_BCR_set(led->mask); | ||
568 | } | ||
569 | |||
570 | static enum led_brightness assabet_led_get(struct led_classdev *cdev) | ||
571 | { | ||
572 | struct assabet_led *led = container_of(cdev, | ||
573 | struct assabet_led, cdev); | ||
574 | |||
575 | return (ASSABET_BCR & led->mask) ? LED_OFF : LED_FULL; | ||
576 | } | ||
577 | |||
578 | static int __init assabet_leds_init(void) | ||
579 | { | ||
580 | int i; | ||
581 | |||
582 | if (!machine_is_assabet()) | ||
583 | return -ENODEV; | ||
584 | |||
585 | for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) { | ||
586 | struct assabet_led *led; | ||
587 | |||
588 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
589 | if (!led) | ||
590 | break; | ||
591 | |||
592 | led->cdev.name = assabet_leds[i].name; | ||
593 | led->cdev.brightness_set = assabet_led_set; | ||
594 | led->cdev.brightness_get = assabet_led_get; | ||
595 | led->cdev.default_trigger = assabet_leds[i].trigger; | ||
596 | |||
597 | if (!i) | ||
598 | led->mask = ASSABET_BCR_LED_RED; | ||
599 | else | ||
600 | led->mask = ASSABET_BCR_LED_GREEN; | ||
601 | |||
602 | if (led_classdev_register(NULL, &led->cdev) < 0) { | ||
603 | kfree(led); | ||
604 | break; | ||
605 | } | ||
606 | } | ||
607 | |||
608 | return 0; | ||
609 | } | ||
610 | |||
611 | /* | ||
612 | * Since we may have triggers on any subsystem, defer registration | ||
613 | * until after subsystem_init. | ||
614 | */ | ||
615 | fs_initcall(assabet_leds_init); | ||
616 | #endif | ||
532 | 617 | ||
533 | MACHINE_START(ASSABET, "Intel-Assabet") | 618 | MACHINE_START(ASSABET, "Intel-Assabet") |
534 | .atag_offset = 0x100, | 619 | .atag_offset = 0x100, |
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c index b30fb99b587c..038df4894b0f 100644 --- a/arch/arm/mach-sa1100/badge4.c +++ b/arch/arm/mach-sa1100/badge4.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/mtd/mtd.h> | 22 | #include <linux/mtd/mtd.h> |
23 | #include <linux/mtd/partitions.h> | 23 | #include <linux/mtd/partitions.h> |
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/gpio.h> | ||
26 | #include <linux/leds.h> | ||
25 | 27 | ||
26 | #include <mach/hardware.h> | 28 | #include <mach/hardware.h> |
27 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
@@ -76,8 +78,36 @@ static struct platform_device sa1111_device = { | |||
76 | .resource = sa1111_resources, | 78 | .resource = sa1111_resources, |
77 | }; | 79 | }; |
78 | 80 | ||
81 | /* LEDs */ | ||
82 | struct gpio_led badge4_gpio_leds[] = { | ||
83 | { | ||
84 | .name = "badge4:red", | ||
85 | .default_trigger = "heartbeat", | ||
86 | .gpio = 7, | ||
87 | }, | ||
88 | { | ||
89 | .name = "badge4:green", | ||
90 | .default_trigger = "cpu0", | ||
91 | .gpio = 9, | ||
92 | }, | ||
93 | }; | ||
94 | |||
95 | static struct gpio_led_platform_data badge4_gpio_led_info = { | ||
96 | .leds = badge4_gpio_leds, | ||
97 | .num_leds = ARRAY_SIZE(badge4_gpio_leds), | ||
98 | }; | ||
99 | |||
100 | static struct platform_device badge4_leds = { | ||
101 | .name = "leds-gpio", | ||
102 | .id = -1, | ||
103 | .dev = { | ||
104 | .platform_data = &badge4_gpio_led_info, | ||
105 | } | ||
106 | }; | ||
107 | |||
79 | static struct platform_device *devices[] __initdata = { | 108 | static struct platform_device *devices[] __initdata = { |
80 | &sa1111_device, | 109 | &sa1111_device, |
110 | &badge4_leds, | ||
81 | }; | 111 | }; |
82 | 112 | ||
83 | static int __init badge4_sa1111_init(void) | 113 | static int __init badge4_sa1111_init(void) |
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c index 985d0b584717..ad0eb08ea077 100644 --- a/arch/arm/mach-sa1100/cerf.c +++ b/arch/arm/mach-sa1100/cerf.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/partitions.h> | 19 | #include <linux/mtd/partitions.h> |
20 | #include <linux/gpio.h> | ||
21 | #include <linux/leds.h> | ||
20 | 22 | ||
21 | #include <mach/hardware.h> | 23 | #include <mach/hardware.h> |
22 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
@@ -43,8 +45,48 @@ static struct platform_device cerfuart2_device = { | |||
43 | .resource = cerfuart2_resources, | 45 | .resource = cerfuart2_resources, |
44 | }; | 46 | }; |
45 | 47 | ||
48 | /* LEDs */ | ||
49 | struct gpio_led cerf_gpio_leds[] = { | ||
50 | { | ||
51 | .name = "cerf:d0", | ||
52 | .default_trigger = "heartbeat", | ||
53 | .gpio = 0, | ||
54 | }, | ||
55 | { | ||
56 | .name = "cerf:d1", | ||
57 | .default_trigger = "cpu0", | ||
58 | .gpio = 1, | ||
59 | }, | ||
60 | { | ||
61 | .name = "cerf:d2", | ||
62 | .default_trigger = "default-on", | ||
63 | .gpio = 2, | ||
64 | }, | ||
65 | { | ||
66 | .name = "cerf:d3", | ||
67 | .default_trigger = "default-on", | ||
68 | .gpio = 3, | ||
69 | }, | ||
70 | |||
71 | }; | ||
72 | |||
73 | static struct gpio_led_platform_data cerf_gpio_led_info = { | ||
74 | .leds = cerf_gpio_leds, | ||
75 | .num_leds = ARRAY_SIZE(cerf_gpio_leds), | ||
76 | }; | ||
77 | |||
78 | static struct platform_device cerf_leds = { | ||
79 | .name = "leds-gpio", | ||
80 | .id = -1, | ||
81 | .dev = { | ||
82 | .platform_data = &cerf_gpio_led_info, | ||
83 | } | ||
84 | }; | ||
85 | |||
86 | |||
46 | static struct platform_device *cerf_devices[] __initdata = { | 87 | static struct platform_device *cerf_devices[] __initdata = { |
47 | &cerfuart2_device, | 88 | &cerfuart2_device, |
89 | &cerf_leds, | ||
48 | }; | 90 | }; |
49 | 91 | ||
50 | #ifdef CONFIG_SA1100_CERF_FLASH_32MB | 92 | #ifdef CONFIG_SA1100_CERF_FLASH_32MB |
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c index 7f86bd911826..fc106aab7c7e 100644 --- a/arch/arm/mach-sa1100/hackkit.c +++ b/arch/arm/mach-sa1100/hackkit.c | |||
@@ -21,6 +21,10 @@ | |||
21 | #include <linux/serial_core.h> | 21 | #include <linux/serial_core.h> |
22 | #include <linux/mtd/mtd.h> | 22 | #include <linux/mtd/mtd.h> |
23 | #include <linux/mtd/partitions.h> | 23 | #include <linux/mtd/partitions.h> |
24 | #include <linux/tty.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/leds.h> | ||
27 | #include <linux/platform_device.h> | ||
24 | 28 | ||
25 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
26 | #include <asm/setup.h> | 30 | #include <asm/setup.h> |
@@ -183,9 +187,37 @@ static struct flash_platform_data hackkit_flash_data = { | |||
183 | static struct resource hackkit_flash_resource = | 187 | static struct resource hackkit_flash_resource = |
184 | DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M); | 188 | DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M); |
185 | 189 | ||
190 | /* LEDs */ | ||
191 | struct gpio_led hackkit_gpio_leds[] = { | ||
192 | { | ||
193 | .name = "hackkit:red", | ||
194 | .default_trigger = "cpu0", | ||
195 | .gpio = 22, | ||
196 | }, | ||
197 | { | ||
198 | .name = "hackkit:green", | ||
199 | .default_trigger = "heartbeat", | ||
200 | .gpio = 23, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct gpio_led_platform_data hackkit_gpio_led_info = { | ||
205 | .leds = hackkit_gpio_leds, | ||
206 | .num_leds = ARRAY_SIZE(hackkit_gpio_leds), | ||
207 | }; | ||
208 | |||
209 | static struct platform_device hackkit_leds = { | ||
210 | .name = "leds-gpio", | ||
211 | .id = -1, | ||
212 | .dev = { | ||
213 | .platform_data = &hackkit_gpio_led_info, | ||
214 | } | ||
215 | }; | ||
216 | |||
186 | static void __init hackkit_init(void) | 217 | static void __init hackkit_init(void) |
187 | { | 218 | { |
188 | sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1); | 219 | sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1); |
220 | platform_device_register(&hackkit_leds); | ||
189 | } | 221 | } |
190 | 222 | ||
191 | /********************************************************************** | 223 | /********************************************************************** |
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c index 7dc1a89b1273..3048b17e84c5 100644 --- a/arch/arm/mach-sa1100/lart.c +++ b/arch/arm/mach-sa1100/lart.c | |||
@@ -5,6 +5,9 @@ | |||
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
7 | #include <linux/tty.h> | 7 | #include <linux/tty.h> |
8 | #include <linux/gpio.h> | ||
9 | #include <linux/leds.h> | ||
10 | #include <linux/platform_device.h> | ||
8 | 11 | ||
9 | #include <video/sa1100fb.h> | 12 | #include <video/sa1100fb.h> |
10 | 13 | ||
@@ -126,6 +129,27 @@ static struct map_desc lart_io_desc[] __initdata = { | |||
126 | } | 129 | } |
127 | }; | 130 | }; |
128 | 131 | ||
132 | /* LEDs */ | ||
133 | struct gpio_led lart_gpio_leds[] = { | ||
134 | { | ||
135 | .name = "lart:red", | ||
136 | .default_trigger = "cpu0", | ||
137 | .gpio = 23, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static struct gpio_led_platform_data lart_gpio_led_info = { | ||
142 | .leds = lart_gpio_leds, | ||
143 | .num_leds = ARRAY_SIZE(lart_gpio_leds), | ||
144 | }; | ||
145 | |||
146 | static struct platform_device lart_leds = { | ||
147 | .name = "leds-gpio", | ||
148 | .id = -1, | ||
149 | .dev = { | ||
150 | .platform_data = &lart_gpio_led_info, | ||
151 | } | ||
152 | }; | ||
129 | static void __init lart_map_io(void) | 153 | static void __init lart_map_io(void) |
130 | { | 154 | { |
131 | sa1100_map_io(); | 155 | sa1100_map_io(); |
@@ -139,6 +163,8 @@ static void __init lart_map_io(void) | |||
139 | GPDR |= GPIO_UART_TXD; | 163 | GPDR |= GPIO_UART_TXD; |
140 | GPDR &= ~GPIO_UART_RXD; | 164 | GPDR &= ~GPIO_UART_RXD; |
141 | PPAR |= PPAR_UPR; | 165 | PPAR |= PPAR_UPR; |
166 | |||
167 | platform_device_register(&lart_leds); | ||
142 | } | 168 | } |
143 | 169 | ||
144 | MACHINE_START(LART, "LART") | 170 | MACHINE_START(LART, "LART") |
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c deleted file mode 100644 index 3699176bca94..000000000000 --- a/arch/arm/mach-sa1100/leds-assabet.c +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-assabet.c | ||
3 | * | ||
4 | * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu> | ||
5 | * | ||
6 | * Original (leds-footbridge.c) by Russell King | ||
7 | * | ||
8 | * Assabet uses the LEDs as follows: | ||
9 | * - Green - toggles state every 50 timer interrupts | ||
10 | * - Red - on if system is not idle | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | #include <asm/leds.h> | ||
16 | #include <mach/assabet.h> | ||
17 | |||
18 | #include "leds.h" | ||
19 | |||
20 | |||
21 | #define LED_STATE_ENABLED 1 | ||
22 | #define LED_STATE_CLAIMED 2 | ||
23 | |||
24 | static unsigned int led_state; | ||
25 | static unsigned int hw_led_state; | ||
26 | |||
27 | #define ASSABET_BCR_LED_MASK (ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED) | ||
28 | |||
29 | void assabet_leds_event(led_event_t evt) | ||
30 | { | ||
31 | unsigned long flags; | ||
32 | |||
33 | local_irq_save(flags); | ||
34 | |||
35 | switch (evt) { | ||
36 | case led_start: | ||
37 | hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN; | ||
38 | led_state = LED_STATE_ENABLED; | ||
39 | break; | ||
40 | |||
41 | case led_stop: | ||
42 | led_state &= ~LED_STATE_ENABLED; | ||
43 | hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN; | ||
44 | ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state); | ||
45 | break; | ||
46 | |||
47 | case led_claim: | ||
48 | led_state |= LED_STATE_CLAIMED; | ||
49 | hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN; | ||
50 | break; | ||
51 | |||
52 | case led_release: | ||
53 | led_state &= ~LED_STATE_CLAIMED; | ||
54 | hw_led_state = ASSABET_BCR_LED_RED | ASSABET_BCR_LED_GREEN; | ||
55 | break; | ||
56 | |||
57 | #ifdef CONFIG_LEDS_TIMER | ||
58 | case led_timer: | ||
59 | if (!(led_state & LED_STATE_CLAIMED)) | ||
60 | hw_led_state ^= ASSABET_BCR_LED_GREEN; | ||
61 | break; | ||
62 | #endif | ||
63 | |||
64 | #ifdef CONFIG_LEDS_CPU | ||
65 | case led_idle_start: | ||
66 | if (!(led_state & LED_STATE_CLAIMED)) | ||
67 | hw_led_state |= ASSABET_BCR_LED_RED; | ||
68 | break; | ||
69 | |||
70 | case led_idle_end: | ||
71 | if (!(led_state & LED_STATE_CLAIMED)) | ||
72 | hw_led_state &= ~ASSABET_BCR_LED_RED; | ||
73 | break; | ||
74 | #endif | ||
75 | |||
76 | case led_halted: | ||
77 | break; | ||
78 | |||
79 | case led_green_on: | ||
80 | if (led_state & LED_STATE_CLAIMED) | ||
81 | hw_led_state &= ~ASSABET_BCR_LED_GREEN; | ||
82 | break; | ||
83 | |||
84 | case led_green_off: | ||
85 | if (led_state & LED_STATE_CLAIMED) | ||
86 | hw_led_state |= ASSABET_BCR_LED_GREEN; | ||
87 | break; | ||
88 | |||
89 | case led_amber_on: | ||
90 | break; | ||
91 | |||
92 | case led_amber_off: | ||
93 | break; | ||
94 | |||
95 | case led_red_on: | ||
96 | if (led_state & LED_STATE_CLAIMED) | ||
97 | hw_led_state &= ~ASSABET_BCR_LED_RED; | ||
98 | break; | ||
99 | |||
100 | case led_red_off: | ||
101 | if (led_state & LED_STATE_CLAIMED) | ||
102 | hw_led_state |= ASSABET_BCR_LED_RED; | ||
103 | break; | ||
104 | |||
105 | default: | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | if (led_state & LED_STATE_ENABLED) | ||
110 | ASSABET_BCR_frob(ASSABET_BCR_LED_MASK, hw_led_state); | ||
111 | |||
112 | local_irq_restore(flags); | ||
113 | } | ||
diff --git a/arch/arm/mach-sa1100/leds-badge4.c b/arch/arm/mach-sa1100/leds-badge4.c deleted file mode 100644 index f99fac3eedb6..000000000000 --- a/arch/arm/mach-sa1100/leds-badge4.c +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-badge4.c | ||
3 | * | ||
4 | * Author: Christopher Hoover <ch@hpl.hp.com> | ||
5 | * Copyright (C) 2002 Hewlett-Packard Company | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/init.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <asm/leds.h> | ||
17 | |||
18 | #include "leds.h" | ||
19 | |||
20 | #define LED_STATE_ENABLED 1 | ||
21 | #define LED_STATE_CLAIMED 2 | ||
22 | |||
23 | static unsigned int led_state; | ||
24 | static unsigned int hw_led_state; | ||
25 | |||
26 | #define LED_RED GPIO_GPIO(7) | ||
27 | #define LED_GREEN GPIO_GPIO(9) | ||
28 | #define LED_MASK (LED_RED|LED_GREEN) | ||
29 | |||
30 | #define LED_IDLE LED_GREEN | ||
31 | #define LED_TIMER LED_RED | ||
32 | |||
33 | void badge4_leds_event(led_event_t evt) | ||
34 | { | ||
35 | unsigned long flags; | ||
36 | |||
37 | local_irq_save(flags); | ||
38 | |||
39 | switch (evt) { | ||
40 | case led_start: | ||
41 | GPDR |= LED_MASK; | ||
42 | hw_led_state = LED_MASK; | ||
43 | led_state = LED_STATE_ENABLED; | ||
44 | break; | ||
45 | |||
46 | case led_stop: | ||
47 | led_state &= ~LED_STATE_ENABLED; | ||
48 | break; | ||
49 | |||
50 | case led_claim: | ||
51 | led_state |= LED_STATE_CLAIMED; | ||
52 | hw_led_state = LED_MASK; | ||
53 | break; | ||
54 | |||
55 | case led_release: | ||
56 | led_state &= ~LED_STATE_CLAIMED; | ||
57 | hw_led_state = LED_MASK; | ||
58 | break; | ||
59 | |||
60 | #ifdef CONFIG_LEDS_TIMER | ||
61 | case led_timer: | ||
62 | if (!(led_state & LED_STATE_CLAIMED)) | ||
63 | hw_led_state ^= LED_TIMER; | ||
64 | break; | ||
65 | #endif | ||
66 | |||
67 | #ifdef CONFIG_LEDS_CPU | ||
68 | case led_idle_start: | ||
69 | /* LED off when system is idle */ | ||
70 | if (!(led_state & LED_STATE_CLAIMED)) | ||
71 | hw_led_state &= ~LED_IDLE; | ||
72 | break; | ||
73 | |||
74 | case led_idle_end: | ||
75 | if (!(led_state & LED_STATE_CLAIMED)) | ||
76 | hw_led_state |= LED_IDLE; | ||
77 | break; | ||
78 | #endif | ||
79 | |||
80 | case led_red_on: | ||
81 | if (!(led_state & LED_STATE_CLAIMED)) | ||
82 | hw_led_state &= ~LED_RED; | ||
83 | break; | ||
84 | |||
85 | case led_red_off: | ||
86 | if (!(led_state & LED_STATE_CLAIMED)) | ||
87 | hw_led_state |= LED_RED; | ||
88 | break; | ||
89 | |||
90 | case led_green_on: | ||
91 | if (!(led_state & LED_STATE_CLAIMED)) | ||
92 | hw_led_state &= ~LED_GREEN; | ||
93 | break; | ||
94 | |||
95 | case led_green_off: | ||
96 | if (!(led_state & LED_STATE_CLAIMED)) | ||
97 | hw_led_state |= LED_GREEN; | ||
98 | break; | ||
99 | |||
100 | default: | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | if (led_state & LED_STATE_ENABLED) { | ||
105 | GPSR = hw_led_state; | ||
106 | GPCR = hw_led_state ^ LED_MASK; | ||
107 | } | ||
108 | |||
109 | local_irq_restore(flags); | ||
110 | } | ||
diff --git a/arch/arm/mach-sa1100/leds-cerf.c b/arch/arm/mach-sa1100/leds-cerf.c deleted file mode 100644 index 30fc3b2bf555..000000000000 --- a/arch/arm/mach-sa1100/leds-cerf.c +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-cerf.c | ||
3 | * | ||
4 | * Author: ??? | ||
5 | */ | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/io.h> | ||
8 | |||
9 | #include <mach/hardware.h> | ||
10 | #include <asm/leds.h> | ||
11 | |||
12 | #include "leds.h" | ||
13 | |||
14 | |||
15 | #define LED_STATE_ENABLED 1 | ||
16 | #define LED_STATE_CLAIMED 2 | ||
17 | |||
18 | static unsigned int led_state; | ||
19 | static unsigned int hw_led_state; | ||
20 | |||
21 | #define LED_D0 GPIO_GPIO(0) | ||
22 | #define LED_D1 GPIO_GPIO(1) | ||
23 | #define LED_D2 GPIO_GPIO(2) | ||
24 | #define LED_D3 GPIO_GPIO(3) | ||
25 | #define LED_MASK (LED_D0|LED_D1|LED_D2|LED_D3) | ||
26 | |||
27 | void cerf_leds_event(led_event_t evt) | ||
28 | { | ||
29 | unsigned long flags; | ||
30 | |||
31 | local_irq_save(flags); | ||
32 | |||
33 | switch (evt) { | ||
34 | case led_start: | ||
35 | hw_led_state = LED_MASK; | ||
36 | led_state = LED_STATE_ENABLED; | ||
37 | break; | ||
38 | |||
39 | case led_stop: | ||
40 | led_state &= ~LED_STATE_ENABLED; | ||
41 | break; | ||
42 | |||
43 | case led_claim: | ||
44 | led_state |= LED_STATE_CLAIMED; | ||
45 | hw_led_state = LED_MASK; | ||
46 | break; | ||
47 | case led_release: | ||
48 | led_state &= ~LED_STATE_CLAIMED; | ||
49 | hw_led_state = LED_MASK; | ||
50 | break; | ||
51 | |||
52 | #ifdef CONFIG_LEDS_TIMER | ||
53 | case led_timer: | ||
54 | if (!(led_state & LED_STATE_CLAIMED)) | ||
55 | hw_led_state ^= LED_D0; | ||
56 | break; | ||
57 | #endif | ||
58 | |||
59 | #ifdef CONFIG_LEDS_CPU | ||
60 | case led_idle_start: | ||
61 | if (!(led_state & LED_STATE_CLAIMED)) | ||
62 | hw_led_state &= ~LED_D1; | ||
63 | break; | ||
64 | |||
65 | case led_idle_end: | ||
66 | if (!(led_state & LED_STATE_CLAIMED)) | ||
67 | hw_led_state |= LED_D1; | ||
68 | break; | ||
69 | #endif | ||
70 | case led_green_on: | ||
71 | if (!(led_state & LED_STATE_CLAIMED)) | ||
72 | hw_led_state &= ~LED_D2; | ||
73 | break; | ||
74 | |||
75 | case led_green_off: | ||
76 | if (!(led_state & LED_STATE_CLAIMED)) | ||
77 | hw_led_state |= LED_D2; | ||
78 | break; | ||
79 | |||
80 | case led_amber_on: | ||
81 | if (!(led_state & LED_STATE_CLAIMED)) | ||
82 | hw_led_state &= ~LED_D3; | ||
83 | break; | ||
84 | |||
85 | case led_amber_off: | ||
86 | if (!(led_state & LED_STATE_CLAIMED)) | ||
87 | hw_led_state |= LED_D3; | ||
88 | break; | ||
89 | |||
90 | case led_red_on: | ||
91 | if (!(led_state & LED_STATE_CLAIMED)) | ||
92 | hw_led_state &= ~LED_D1; | ||
93 | break; | ||
94 | |||
95 | case led_red_off: | ||
96 | if (!(led_state & LED_STATE_CLAIMED)) | ||
97 | hw_led_state |= LED_D1; | ||
98 | break; | ||
99 | |||
100 | default: | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | if (led_state & LED_STATE_ENABLED) { | ||
105 | GPSR = hw_led_state; | ||
106 | GPCR = hw_led_state ^ LED_MASK; | ||
107 | } | ||
108 | |||
109 | local_irq_restore(flags); | ||
110 | } | ||
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c deleted file mode 100644 index f8e47235babe..000000000000 --- a/arch/arm/mach-sa1100/leds-hackkit.c +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-hackkit.c | ||
3 | * | ||
4 | * based on leds-lart.c | ||
5 | * | ||
6 | * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000 | ||
7 | * (C) Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>, 2002 | ||
8 | * | ||
9 | * The HackKit has two leds (GPIO 22/23). The red led (gpio 22) is used | ||
10 | * as cpu led, the green one is used as timer led. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/io.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <asm/leds.h> | ||
17 | |||
18 | #include "leds.h" | ||
19 | |||
20 | |||
21 | #define LED_STATE_ENABLED 1 | ||
22 | #define LED_STATE_CLAIMED 2 | ||
23 | |||
24 | static unsigned int led_state; | ||
25 | static unsigned int hw_led_state; | ||
26 | |||
27 | #define LED_GREEN GPIO_GPIO23 | ||
28 | #define LED_RED GPIO_GPIO22 | ||
29 | #define LED_MASK (LED_RED | LED_GREEN) | ||
30 | |||
31 | void hackkit_leds_event(led_event_t evt) | ||
32 | { | ||
33 | unsigned long flags; | ||
34 | |||
35 | local_irq_save(flags); | ||
36 | |||
37 | switch(evt) { | ||
38 | case led_start: | ||
39 | /* pin 22/23 are outputs */ | ||
40 | GPDR |= LED_MASK; | ||
41 | hw_led_state = LED_MASK; | ||
42 | led_state = LED_STATE_ENABLED; | ||
43 | break; | ||
44 | |||
45 | case led_stop: | ||
46 | led_state &= ~LED_STATE_ENABLED; | ||
47 | break; | ||
48 | |||
49 | case led_claim: | ||
50 | led_state |= LED_STATE_CLAIMED; | ||
51 | hw_led_state = LED_MASK; | ||
52 | break; | ||
53 | |||
54 | case led_release: | ||
55 | led_state &= ~LED_STATE_CLAIMED; | ||
56 | hw_led_state = LED_MASK; | ||
57 | break; | ||
58 | |||
59 | #ifdef CONFIG_LEDS_TIMER | ||
60 | case led_timer: | ||
61 | if (!(led_state & LED_STATE_CLAIMED)) | ||
62 | hw_led_state ^= LED_GREEN; | ||
63 | break; | ||
64 | #endif | ||
65 | |||
66 | #ifdef CONFIG_LEDS_CPU | ||
67 | case led_idle_start: | ||
68 | /* The LART people like the LED to be off when the | ||
69 | system is idle... */ | ||
70 | if (!(led_state & LED_STATE_CLAIMED)) | ||
71 | hw_led_state &= ~LED_RED; | ||
72 | break; | ||
73 | |||
74 | case led_idle_end: | ||
75 | /* ... and on if the system is not idle */ | ||
76 | if (!(led_state & LED_STATE_CLAIMED)) | ||
77 | hw_led_state |= LED_RED; | ||
78 | break; | ||
79 | #endif | ||
80 | |||
81 | case led_red_on: | ||
82 | if (led_state & LED_STATE_CLAIMED) | ||
83 | hw_led_state &= ~LED_RED; | ||
84 | break; | ||
85 | |||
86 | case led_red_off: | ||
87 | if (led_state & LED_STATE_CLAIMED) | ||
88 | hw_led_state |= LED_RED; | ||
89 | break; | ||
90 | |||
91 | case led_green_on: | ||
92 | if (led_state & LED_STATE_CLAIMED) | ||
93 | hw_led_state &= ~LED_GREEN; | ||
94 | break; | ||
95 | |||
96 | case led_green_off: | ||
97 | if (led_state & LED_STATE_CLAIMED) | ||
98 | hw_led_state |= LED_GREEN; | ||
99 | break; | ||
100 | |||
101 | default: | ||
102 | break; | ||
103 | } | ||
104 | |||
105 | /* Now set the GPIO state, or nothing will happen at all */ | ||
106 | if (led_state & LED_STATE_ENABLED) { | ||
107 | GPSR = hw_led_state; | ||
108 | GPCR = hw_led_state ^ LED_MASK; | ||
109 | } | ||
110 | |||
111 | local_irq_restore(flags); | ||
112 | } | ||
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c deleted file mode 100644 index 50a5b143b460..000000000000 --- a/arch/arm/mach-sa1100/leds-lart.c +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds-lart.c | ||
3 | * | ||
4 | * (C) Erik Mouw (J.A.K.Mouw@its.tudelft.nl), April 21, 2000 | ||
5 | * | ||
6 | * LART uses the LED as follows: | ||
7 | * - GPIO23 is the LED, on if system is not idle | ||
8 | * You can use both CONFIG_LEDS_CPU and CONFIG_LEDS_TIMER at the same | ||
9 | * time, but in that case the timer events will still dictate the | ||
10 | * pace of the LED. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/io.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <asm/leds.h> | ||
17 | |||
18 | #include "leds.h" | ||
19 | |||
20 | |||
21 | #define LED_STATE_ENABLED 1 | ||
22 | #define LED_STATE_CLAIMED 2 | ||
23 | |||
24 | static unsigned int led_state; | ||
25 | static unsigned int hw_led_state; | ||
26 | |||
27 | #define LED_23 GPIO_GPIO23 | ||
28 | #define LED_MASK (LED_23) | ||
29 | |||
30 | void lart_leds_event(led_event_t evt) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | |||
34 | local_irq_save(flags); | ||
35 | |||
36 | switch(evt) { | ||
37 | case led_start: | ||
38 | /* pin 23 is output pin */ | ||
39 | GPDR |= LED_23; | ||
40 | hw_led_state = LED_MASK; | ||
41 | led_state = LED_STATE_ENABLED; | ||
42 | break; | ||
43 | |||
44 | case led_stop: | ||
45 | led_state &= ~LED_STATE_ENABLED; | ||
46 | break; | ||
47 | |||
48 | case led_claim: | ||
49 | led_state |= LED_STATE_CLAIMED; | ||
50 | hw_led_state = LED_MASK; | ||
51 | break; | ||
52 | |||
53 | case led_release: | ||
54 | led_state &= ~LED_STATE_CLAIMED; | ||
55 | hw_led_state = LED_MASK; | ||
56 | break; | ||
57 | |||
58 | #ifdef CONFIG_LEDS_TIMER | ||
59 | case led_timer: | ||
60 | if (!(led_state & LED_STATE_CLAIMED)) | ||
61 | hw_led_state ^= LED_23; | ||
62 | break; | ||
63 | #endif | ||
64 | |||
65 | #ifdef CONFIG_LEDS_CPU | ||
66 | case led_idle_start: | ||
67 | /* The LART people like the LED to be off when the | ||
68 | system is idle... */ | ||
69 | if (!(led_state & LED_STATE_CLAIMED)) | ||
70 | hw_led_state &= ~LED_23; | ||
71 | break; | ||
72 | |||
73 | case led_idle_end: | ||
74 | /* ... and on if the system is not idle */ | ||
75 | if (!(led_state & LED_STATE_CLAIMED)) | ||
76 | hw_led_state |= LED_23; | ||
77 | break; | ||
78 | #endif | ||
79 | |||
80 | case led_red_on: | ||
81 | if (led_state & LED_STATE_CLAIMED) | ||
82 | hw_led_state &= ~LED_23; | ||
83 | break; | ||
84 | |||
85 | case led_red_off: | ||
86 | if (led_state & LED_STATE_CLAIMED) | ||
87 | hw_led_state |= LED_23; | ||
88 | break; | ||
89 | |||
90 | default: | ||
91 | break; | ||
92 | } | ||
93 | |||
94 | /* Now set the GPIO state, or nothing will happen at all */ | ||
95 | if (led_state & LED_STATE_ENABLED) { | ||
96 | GPSR = hw_led_state; | ||
97 | GPCR = hw_led_state ^ LED_MASK; | ||
98 | } | ||
99 | |||
100 | local_irq_restore(flags); | ||
101 | } | ||
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c deleted file mode 100644 index 5fe71a0f1053..000000000000 --- a/arch/arm/mach-sa1100/leds.c +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-sa1100/leds.c | ||
3 | * | ||
4 | * SA1100 LEDs dispatcher | ||
5 | * | ||
6 | * Copyright (C) 2001 Nicolas Pitre | ||
7 | */ | ||
8 | #include <linux/compiler.h> | ||
9 | #include <linux/init.h> | ||
10 | |||
11 | #include <asm/leds.h> | ||
12 | #include <asm/mach-types.h> | ||
13 | |||
14 | #include "leds.h" | ||
15 | |||
16 | static int __init | ||
17 | sa1100_leds_init(void) | ||
18 | { | ||
19 | if (machine_is_assabet()) | ||
20 | leds_event = assabet_leds_event; | ||
21 | if (machine_is_consus()) | ||
22 | leds_event = consus_leds_event; | ||
23 | if (machine_is_badge4()) | ||
24 | leds_event = badge4_leds_event; | ||
25 | if (machine_is_brutus()) | ||
26 | leds_event = brutus_leds_event; | ||
27 | if (machine_is_cerf()) | ||
28 | leds_event = cerf_leds_event; | ||
29 | if (machine_is_flexanet()) | ||
30 | leds_event = flexanet_leds_event; | ||
31 | if (machine_is_graphicsclient()) | ||
32 | leds_event = graphicsclient_leds_event; | ||
33 | if (machine_is_hackkit()) | ||
34 | leds_event = hackkit_leds_event; | ||
35 | if (machine_is_lart()) | ||
36 | leds_event = lart_leds_event; | ||
37 | if (machine_is_pfs168()) | ||
38 | leds_event = pfs168_leds_event; | ||
39 | if (machine_is_graphicsmaster()) | ||
40 | leds_event = graphicsmaster_leds_event; | ||
41 | if (machine_is_adsbitsy()) | ||
42 | leds_event = adsbitsy_leds_event; | ||
43 | if (machine_is_pt_system3()) | ||
44 | leds_event = system3_leds_event; | ||
45 | |||
46 | leds_event(led_start); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | core_initcall(sa1100_leds_init); | ||
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h deleted file mode 100644 index 776b6020f550..000000000000 --- a/arch/arm/mach-sa1100/leds.h +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | extern void assabet_leds_event(led_event_t evt); | ||
2 | extern void badge4_leds_event(led_event_t evt); | ||
3 | extern void consus_leds_event(led_event_t evt); | ||
4 | extern void brutus_leds_event(led_event_t evt); | ||
5 | extern void cerf_leds_event(led_event_t evt); | ||
6 | extern void flexanet_leds_event(led_event_t evt); | ||
7 | extern void graphicsclient_leds_event(led_event_t evt); | ||
8 | extern void hackkit_leds_event(led_event_t evt); | ||
9 | extern void lart_leds_event(led_event_t evt); | ||
10 | extern void pfs168_leds_event(led_event_t evt); | ||
11 | extern void graphicsmaster_leds_event(led_event_t evt); | ||
12 | extern void adsbitsy_leds_event(led_event_t evt); | ||
13 | extern void system3_leds_event(led_event_t evt); | ||
diff --git a/arch/arm/mach-shark/Makefile b/arch/arm/mach-shark/Makefile index 45be9b04e7ba..29657183c452 100644 --- a/arch/arm/mach-shark/Makefile +++ b/arch/arm/mach-shark/Makefile | |||
@@ -4,9 +4,7 @@ | |||
4 | 4 | ||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-y := core.o dma.o irq.o pci.o | 7 | obj-y := core.o dma.o irq.o pci.o leds.o |
8 | obj-m := | 8 | obj-m := |
9 | obj-n := | 9 | obj-n := |
10 | obj- := | 10 | obj- := |
11 | |||
12 | obj-$(CONFIG_LEDS) += leds.o | ||
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c index d35b94ef73b7..9ad2e9737fb5 100644 --- a/arch/arm/mach-shark/core.c +++ b/arch/arm/mach-shark/core.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <asm/setup.h> | 14 | #include <asm/setup.h> |
15 | #include <asm/mach-types.h> | 15 | #include <asm/mach-types.h> |
16 | #include <asm/leds.h> | ||
17 | #include <asm/param.h> | 16 | #include <asm/param.h> |
18 | #include <asm/system_misc.h> | 17 | #include <asm/system_misc.h> |
19 | 18 | ||
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c index 25609076921f..081c778a10ac 100644 --- a/arch/arm/mach-shark/leds.c +++ b/arch/arm/mach-shark/leds.c | |||
@@ -1,165 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-shark/leds.c | ||
3 | * by Alexander Schulz | ||
4 | * | ||
5 | * derived from: | ||
6 | * arch/arm/kernel/leds-footbridge.c | ||
7 | * Copyright (C) 1998-1999 Russell King | ||
8 | * | ||
9 | * DIGITAL Shark LED control routines. | 2 | * DIGITAL Shark LED control routines. |
10 | * | 3 | * |
11 | * The leds use is as follows: | 4 | * Driver for the 3 user LEDs found on the Shark |
12 | * - Green front - toggles state every 50 timer interrupts | 5 | * Based on Versatile and RealView machine LED code |
13 | * - Amber front - Unused, this is a dual color led (Amber/Green) | ||
14 | * - Amber back - On if system is not idle | ||
15 | * | 6 | * |
16 | * Changelog: | 7 | * License terms: GNU General Public License (GPL) version 2 |
8 | * Author: Bryan Wu <bryan.wu@canonical.com> | ||
17 | */ | 9 | */ |
18 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
19 | #include <linux/module.h> | ||
20 | #include <linux/init.h> | 11 | #include <linux/init.h> |
21 | #include <linux/spinlock.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/ioport.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/leds.h> | ||
24 | 16 | ||
25 | #include <asm/leds.h> | 17 | #include <asm/mach-types.h> |
26 | 18 | ||
27 | #define LED_STATE_ENABLED 1 | 19 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
28 | #define LED_STATE_CLAIMED 2 | 20 | struct shark_led { |
21 | struct led_classdev cdev; | ||
22 | u8 mask; | ||
23 | }; | ||
29 | 24 | ||
30 | #define SEQUOIA_LED_GREEN (1<<6) | 25 | /* |
31 | #define SEQUOIA_LED_AMBER (1<<5) | 26 | * The triggers lines up below will only be used if the |
32 | #define SEQUOIA_LED_BACK (1<<7) | 27 | * LED triggers are compiled in. |
28 | */ | ||
29 | static const struct { | ||
30 | const char *name; | ||
31 | const char *trigger; | ||
32 | } shark_leds[] = { | ||
33 | { "shark:amber0", "default-on", }, /* Bit 5 */ | ||
34 | { "shark:green", "heartbeat", }, /* Bit 6 */ | ||
35 | { "shark:amber1", "cpu0" }, /* Bit 7 */ | ||
36 | }; | ||
37 | |||
38 | static u16 led_reg_read(void) | ||
39 | { | ||
40 | outw(0x09, 0x24); | ||
41 | return inw(0x26); | ||
42 | } | ||
33 | 43 | ||
34 | static char led_state; | 44 | static void led_reg_write(u16 value) |
35 | static short hw_led_state; | 45 | { |
36 | static short saved_state; | 46 | outw(0x09, 0x24); |
47 | outw(value, 0x26); | ||
48 | } | ||
37 | 49 | ||
38 | static DEFINE_RAW_SPINLOCK(leds_lock); | 50 | static void shark_led_set(struct led_classdev *cdev, |
51 | enum led_brightness b) | ||
52 | { | ||
53 | struct shark_led *led = container_of(cdev, | ||
54 | struct shark_led, cdev); | ||
55 | u16 reg = led_reg_read(); | ||
39 | 56 | ||
40 | short sequoia_read(int addr) { | 57 | if (b != LED_OFF) |
41 | outw(addr,0x24); | 58 | reg |= led->mask; |
42 | return inw(0x26); | 59 | else |
43 | } | 60 | reg &= ~led->mask; |
44 | 61 | ||
45 | void sequoia_write(short value,short addr) { | 62 | led_reg_write(reg); |
46 | outw(addr,0x24); | ||
47 | outw(value,0x26); | ||
48 | } | 63 | } |
49 | 64 | ||
50 | static void sequoia_leds_event(led_event_t evt) | 65 | static enum led_brightness shark_led_get(struct led_classdev *cdev) |
51 | { | 66 | { |
52 | unsigned long flags; | 67 | struct shark_led *led = container_of(cdev, |
53 | 68 | struct shark_led, cdev); | |
54 | raw_spin_lock_irqsave(&leds_lock, flags); | 69 | u16 reg = led_reg_read(); |
55 | 70 | ||
56 | hw_led_state = sequoia_read(0x09); | 71 | return (reg & led->mask) ? LED_FULL : LED_OFF; |
72 | } | ||
57 | 73 | ||
58 | switch (evt) { | 74 | static int __init shark_leds_init(void) |
59 | case led_start: | 75 | { |
60 | hw_led_state |= SEQUOIA_LED_GREEN; | 76 | int i; |
61 | hw_led_state |= SEQUOIA_LED_AMBER; | 77 | u16 reg; |
62 | #ifdef CONFIG_LEDS_CPU | ||
63 | hw_led_state |= SEQUOIA_LED_BACK; | ||
64 | #else | ||
65 | hw_led_state &= ~SEQUOIA_LED_BACK; | ||
66 | #endif | ||
67 | led_state |= LED_STATE_ENABLED; | ||
68 | break; | ||
69 | |||
70 | case led_stop: | ||
71 | hw_led_state &= ~SEQUOIA_LED_BACK; | ||
72 | hw_led_state |= SEQUOIA_LED_GREEN; | ||
73 | hw_led_state |= SEQUOIA_LED_AMBER; | ||
74 | led_state &= ~LED_STATE_ENABLED; | ||
75 | break; | ||
76 | |||
77 | case led_claim: | ||
78 | led_state |= LED_STATE_CLAIMED; | ||
79 | saved_state = hw_led_state; | ||
80 | hw_led_state &= ~SEQUOIA_LED_BACK; | ||
81 | hw_led_state |= SEQUOIA_LED_GREEN; | ||
82 | hw_led_state |= SEQUOIA_LED_AMBER; | ||
83 | break; | ||
84 | |||
85 | case led_release: | ||
86 | led_state &= ~LED_STATE_CLAIMED; | ||
87 | hw_led_state = saved_state; | ||
88 | break; | ||
89 | |||
90 | #ifdef CONFIG_LEDS_TIMER | ||
91 | case led_timer: | ||
92 | if (!(led_state & LED_STATE_CLAIMED)) | ||
93 | hw_led_state ^= SEQUOIA_LED_GREEN; | ||
94 | break; | ||
95 | #endif | ||
96 | 78 | ||
97 | #ifdef CONFIG_LEDS_CPU | 79 | if (!machine_is_shark()) |
98 | case led_idle_start: | 80 | return -ENODEV; |
99 | if (!(led_state & LED_STATE_CLAIMED)) | ||
100 | hw_led_state &= ~SEQUOIA_LED_BACK; | ||
101 | break; | ||
102 | 81 | ||
103 | case led_idle_end: | 82 | for (i = 0; i < ARRAY_SIZE(shark_leds); i++) { |
104 | if (!(led_state & LED_STATE_CLAIMED)) | 83 | struct shark_led *led; |
105 | hw_led_state |= SEQUOIA_LED_BACK; | ||
106 | break; | ||
107 | #endif | ||
108 | 84 | ||
109 | case led_green_on: | 85 | led = kzalloc(sizeof(*led), GFP_KERNEL); |
110 | if (led_state & LED_STATE_CLAIMED) | 86 | if (!led) |
111 | hw_led_state &= ~SEQUOIA_LED_GREEN; | 87 | break; |
112 | break; | ||
113 | |||
114 | case led_green_off: | ||
115 | if (led_state & LED_STATE_CLAIMED) | ||
116 | hw_led_state |= SEQUOIA_LED_GREEN; | ||
117 | break; | ||
118 | |||
119 | case led_amber_on: | ||
120 | if (led_state & LED_STATE_CLAIMED) | ||
121 | hw_led_state &= ~SEQUOIA_LED_AMBER; | ||
122 | break; | ||
123 | |||
124 | case led_amber_off: | ||
125 | if (led_state & LED_STATE_CLAIMED) | ||
126 | hw_led_state |= SEQUOIA_LED_AMBER; | ||
127 | break; | ||
128 | |||
129 | case led_red_on: | ||
130 | if (led_state & LED_STATE_CLAIMED) | ||
131 | hw_led_state |= SEQUOIA_LED_BACK; | ||
132 | break; | ||
133 | |||
134 | case led_red_off: | ||
135 | if (led_state & LED_STATE_CLAIMED) | ||
136 | hw_led_state &= ~SEQUOIA_LED_BACK; | ||
137 | break; | ||
138 | |||
139 | default: | ||
140 | break; | ||
141 | } | ||
142 | 88 | ||
143 | if (led_state & LED_STATE_ENABLED) | 89 | led->cdev.name = shark_leds[i].name; |
144 | sequoia_write(hw_led_state,0x09); | 90 | led->cdev.brightness_set = shark_led_set; |
91 | led->cdev.brightness_get = shark_led_get; | ||
92 | led->cdev.default_trigger = shark_leds[i].trigger; | ||
145 | 93 | ||
146 | raw_spin_unlock_irqrestore(&leds_lock, flags); | 94 | /* Count in 5 bits offset */ |
147 | } | 95 | led->mask = BIT(i + 5); |
148 | 96 | ||
149 | static int __init leds_init(void) | 97 | if (led_classdev_register(NULL, &led->cdev) < 0) { |
150 | { | 98 | kfree(led); |
151 | extern void (*leds_event)(led_event_t); | 99 | break; |
152 | short temp; | 100 | } |
153 | 101 | } | |
154 | leds_event = sequoia_leds_event; | ||
155 | 102 | ||
156 | /* Make LEDs independent of power-state */ | 103 | /* Make LEDs independent of power-state */ |
157 | request_region(0x24,4,"sequoia"); | 104 | request_region(0x24, 4, "led_reg"); |
158 | temp = sequoia_read(0x09); | 105 | reg = led_reg_read(); |
159 | temp |= 1<<10; | 106 | reg |= 1 << 10; |
160 | sequoia_write(temp,0x09); | 107 | led_reg_write(reg); |
161 | leds_event(led_start); | 108 | |
162 | return 0; | 109 | return 0; |
163 | } | 110 | } |
164 | 111 | ||
165 | __initcall(leds_init); | 112 | /* |
113 | * Since we may have triggers on any subsystem, defer registration | ||
114 | * until after subsystem_init. | ||
115 | */ | ||
116 | fs_initcall(shark_leds_init); | ||
117 | #endif | ||
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index 0df5ae6740c6..fe2c97c179d1 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common objects | 5 | # Common objects |
6 | obj-y := timer.o console.o clock.o common.o | 6 | obj-y := timer.o console.o clock.o |
7 | 7 | ||
8 | # CPU objects | 8 | # CPU objects |
9 | obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o | 9 | obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index bc3b5da59e25..790dc68c4312 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -1231,6 +1231,15 @@ static struct i2c_board_info i2c1_devices[] = { | |||
1231 | #define USCCR1 IOMEM(0xE6058144) | 1231 | #define USCCR1 IOMEM(0xE6058144) |
1232 | static void __init ap4evb_init(void) | 1232 | static void __init ap4evb_init(void) |
1233 | { | 1233 | { |
1234 | struct pm_domain_device domain_devices[] = { | ||
1235 | { "A4LC", &lcdc1_device, }, | ||
1236 | { "A4LC", &lcdc_device, }, | ||
1237 | { "A4MP", &fsi_device, }, | ||
1238 | { "A3SP", &sh_mmcif_device, }, | ||
1239 | { "A3SP", &sdhi0_device, }, | ||
1240 | { "A3SP", &sdhi1_device, }, | ||
1241 | { "A4R", &ceu_device, }, | ||
1242 | }; | ||
1234 | u32 srcr4; | 1243 | u32 srcr4; |
1235 | struct clk *clk; | 1244 | struct clk *clk; |
1236 | 1245 | ||
@@ -1463,14 +1472,8 @@ static void __init ap4evb_init(void) | |||
1463 | 1472 | ||
1464 | platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); | 1473 | platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); |
1465 | 1474 | ||
1466 | rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device); | 1475 | rmobile_add_devices_to_domains(domain_devices, |
1467 | rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); | 1476 | ARRAY_SIZE(domain_devices)); |
1468 | rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device); | ||
1469 | |||
1470 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device); | ||
1471 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device); | ||
1472 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device); | ||
1473 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device); | ||
1474 | 1477 | ||
1475 | hdmi_init_pm_clock(); | 1478 | hdmi_init_pm_clock(); |
1476 | fsi_init_pm_clock(); | 1479 | fsi_init_pm_clock(); |
@@ -1485,6 +1488,6 @@ MACHINE_START(AP4EVB, "ap4evb") | |||
1485 | .init_irq = sh7372_init_irq, | 1488 | .init_irq = sh7372_init_irq, |
1486 | .handle_irq = shmobile_handle_irq_intc, | 1489 | .handle_irq = shmobile_handle_irq_intc, |
1487 | .init_machine = ap4evb_init, | 1490 | .init_machine = ap4evb_init, |
1488 | .init_late = shmobile_init_late, | 1491 | .init_late = sh7372_pm_init_late, |
1489 | .timer = &shmobile_timer, | 1492 | .timer = &shmobile_timer, |
1490 | MACHINE_END | 1493 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index 206c3227f83d..2912eab3b967 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/mmc/host.h> | 37 | #include <linux/mmc/host.h> |
38 | #include <linux/mmc/sh_mmcif.h> | 38 | #include <linux/mmc/sh_mmcif.h> |
39 | #include <linux/mmc/sh_mobile_sdhi.h> | 39 | #include <linux/mmc/sh_mobile_sdhi.h> |
40 | #include <linux/i2c-gpio.h> | ||
40 | #include <mach/common.h> | 41 | #include <mach/common.h> |
41 | #include <mach/irqs.h> | 42 | #include <mach/irqs.h> |
42 | #include <mach/r8a7740.h> | 43 | #include <mach/r8a7740.h> |
@@ -879,6 +880,21 @@ static struct platform_device fsi_hdmi_device = { | |||
879 | }, | 880 | }, |
880 | }; | 881 | }; |
881 | 882 | ||
883 | /* RTC: RTC connects i2c-gpio. */ | ||
884 | static struct i2c_gpio_platform_data i2c_gpio_data = { | ||
885 | .sda_pin = GPIO_PORT208, | ||
886 | .scl_pin = GPIO_PORT91, | ||
887 | .udelay = 5, /* 100 kHz */ | ||
888 | }; | ||
889 | |||
890 | static struct platform_device i2c_gpio_device = { | ||
891 | .name = "i2c-gpio", | ||
892 | .id = 2, | ||
893 | .dev = { | ||
894 | .platform_data = &i2c_gpio_data, | ||
895 | }, | ||
896 | }; | ||
897 | |||
882 | /* I2C */ | 898 | /* I2C */ |
883 | static struct i2c_board_info i2c0_devices[] = { | 899 | static struct i2c_board_info i2c0_devices[] = { |
884 | { | 900 | { |
@@ -890,6 +906,13 @@ static struct i2c_board_info i2c0_devices[] = { | |||
890 | }, | 906 | }, |
891 | }; | 907 | }; |
892 | 908 | ||
909 | static struct i2c_board_info i2c2_devices[] = { | ||
910 | { | ||
911 | I2C_BOARD_INFO("s35390a", 0x30), | ||
912 | .type = "s35390a", | ||
913 | }, | ||
914 | }; | ||
915 | |||
893 | /* | 916 | /* |
894 | * board devices | 917 | * board devices |
895 | */ | 918 | */ |
@@ -906,6 +929,7 @@ static struct platform_device *eva_devices[] __initdata = { | |||
906 | &fsi_device, | 929 | &fsi_device, |
907 | &fsi_wm8978_device, | 930 | &fsi_wm8978_device, |
908 | &fsi_hdmi_device, | 931 | &fsi_hdmi_device, |
932 | &i2c_gpio_device, | ||
909 | }; | 933 | }; |
910 | 934 | ||
911 | static void __init eva_clock_init(void) | 935 | static void __init eva_clock_init(void) |
@@ -1176,6 +1200,7 @@ static void __init eva_init(void) | |||
1176 | #endif | 1200 | #endif |
1177 | 1201 | ||
1178 | i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); | 1202 | i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); |
1203 | i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices)); | ||
1179 | 1204 | ||
1180 | r8a7740_add_standard_devices(); | 1205 | r8a7740_add_standard_devices(); |
1181 | 1206 | ||
@@ -1184,10 +1209,10 @@ static void __init eva_init(void) | |||
1184 | 1209 | ||
1185 | eva_clock_init(); | 1210 | eva_clock_init(); |
1186 | 1211 | ||
1187 | rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device); | 1212 | rmobile_add_device_to_domain("A4LC", &lcdc0_device); |
1188 | rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device); | 1213 | rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device); |
1189 | if (usb) | 1214 | if (usb) |
1190 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb); | 1215 | rmobile_add_device_to_domain("A3SP", usb); |
1191 | } | 1216 | } |
1192 | 1217 | ||
1193 | static void __init eva_earlytimer_init(void) | 1218 | static void __init eva_earlytimer_init(void) |
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 6525835abc0a..0a43f3189c21 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -346,11 +346,11 @@ static struct resource sh_mmcif_resources[] = { | |||
346 | .flags = IORESOURCE_MEM, | 346 | .flags = IORESOURCE_MEM, |
347 | }, | 347 | }, |
348 | [1] = { | 348 | [1] = { |
349 | .start = gic_spi(141), | 349 | .start = gic_spi(140), |
350 | .flags = IORESOURCE_IRQ, | 350 | .flags = IORESOURCE_IRQ, |
351 | }, | 351 | }, |
352 | [2] = { | 352 | [2] = { |
353 | .start = gic_spi(140), | 353 | .start = gic_spi(141), |
354 | .flags = IORESOURCE_IRQ, | 354 | .flags = IORESOURCE_IRQ, |
355 | }, | 355 | }, |
356 | }; | 356 | }; |
@@ -482,12 +482,10 @@ static struct gpio_keys_button gpio_buttons[] = { | |||
482 | static struct gpio_keys_platform_data gpio_key_info = { | 482 | static struct gpio_keys_platform_data gpio_key_info = { |
483 | .buttons = gpio_buttons, | 483 | .buttons = gpio_buttons, |
484 | .nbuttons = ARRAY_SIZE(gpio_buttons), | 484 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
485 | .poll_interval = 250, /* poling at this point */ | ||
486 | }; | 485 | }; |
487 | 486 | ||
488 | static struct platform_device gpio_keys_device = { | 487 | static struct platform_device gpio_keys_device = { |
489 | /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */ | 488 | .name = "gpio-keys", |
490 | .name = "gpio-keys-polled", | ||
491 | .dev = { | 489 | .dev = { |
492 | .platform_data = &gpio_key_info, | 490 | .platform_data = &gpio_key_info, |
493 | }, | 491 | }, |
@@ -550,6 +548,7 @@ static struct platform_device fsi_ak4648_device = { | |||
550 | /* I2C */ | 548 | /* I2C */ |
551 | static struct pcf857x_platform_data pcf8575_pdata = { | 549 | static struct pcf857x_platform_data pcf8575_pdata = { |
552 | .gpio_base = GPIO_PCF8575_BASE, | 550 | .gpio_base = GPIO_PCF8575_BASE, |
551 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ | ||
553 | }; | 552 | }; |
554 | 553 | ||
555 | static struct i2c_board_info i2c0_devices[] = { | 554 | static struct i2c_board_info i2c0_devices[] = { |
@@ -765,7 +764,7 @@ static void __init kzm_init(void) | |||
765 | 764 | ||
766 | static void kzm9g_restart(char mode, const char *cmd) | 765 | static void kzm9g_restart(char mode, const char *cmd) |
767 | { | 766 | { |
768 | #define RESCNT2 0xe6188020 | 767 | #define RESCNT2 IOMEM(0xe6188020) |
769 | /* Do soft power on reset */ | 768 | /* Do soft power on reset */ |
770 | writel((1 << 31), RESCNT2); | 769 | writel((1 << 31), RESCNT2); |
771 | } | 770 | } |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 62783b5d8813..0c27c810cf99 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -1412,6 +1412,22 @@ static struct i2c_board_info i2c1_devices[] = { | |||
1412 | #define USCCR1 IOMEM(0xE6058144) | 1412 | #define USCCR1 IOMEM(0xE6058144) |
1413 | static void __init mackerel_init(void) | 1413 | static void __init mackerel_init(void) |
1414 | { | 1414 | { |
1415 | struct pm_domain_device domain_devices[] = { | ||
1416 | { "A4LC", &lcdc_device, }, | ||
1417 | { "A4LC", &hdmi_lcdc_device, }, | ||
1418 | { "A4LC", &meram_device, }, | ||
1419 | { "A4MP", &fsi_device, }, | ||
1420 | { "A3SP", &usbhs0_device, }, | ||
1421 | { "A3SP", &usbhs1_device, }, | ||
1422 | { "A3SP", &nand_flash_device, }, | ||
1423 | { "A3SP", &sh_mmcif_device, }, | ||
1424 | { "A3SP", &sdhi0_device, }, | ||
1425 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | ||
1426 | { "A3SP", &sdhi1_device, }, | ||
1427 | #endif | ||
1428 | { "A3SP", &sdhi2_device, }, | ||
1429 | { "A4R", &ceu_device, }, | ||
1430 | }; | ||
1415 | u32 srcr4; | 1431 | u32 srcr4; |
1416 | struct clk *clk; | 1432 | struct clk *clk; |
1417 | 1433 | ||
@@ -1626,20 +1642,8 @@ static void __init mackerel_init(void) | |||
1626 | 1642 | ||
1627 | platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); | 1643 | platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); |
1628 | 1644 | ||
1629 | rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); | 1645 | rmobile_add_devices_to_domains(domain_devices, |
1630 | rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device); | 1646 | ARRAY_SIZE(domain_devices)); |
1631 | rmobile_add_device_to_domain(&sh7372_pd_a4lc, &meram_device); | ||
1632 | rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device); | ||
1633 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs0_device); | ||
1634 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs1_device); | ||
1635 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &nand_flash_device); | ||
1636 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device); | ||
1637 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device); | ||
1638 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | ||
1639 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device); | ||
1640 | #endif | ||
1641 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi2_device); | ||
1642 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device); | ||
1643 | 1647 | ||
1644 | hdmi_init_pm_clock(); | 1648 | hdmi_init_pm_clock(); |
1645 | sh7372_pm_init(); | 1649 | sh7372_pm_init(); |
@@ -1653,6 +1657,6 @@ MACHINE_START(MACKEREL, "mackerel") | |||
1653 | .init_irq = sh7372_init_irq, | 1657 | .init_irq = sh7372_init_irq, |
1654 | .handle_irq = shmobile_handle_irq_intc, | 1658 | .handle_irq = shmobile_handle_irq_intc, |
1655 | .init_machine = mackerel_init, | 1659 | .init_machine = mackerel_init, |
1656 | .init_late = shmobile_init_late, | 1660 | .init_late = sh7372_pm_init_late, |
1657 | .timer = &shmobile_timer, | 1661 | .timer = &shmobile_timer, |
1658 | MACHINE_END | 1662 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c index 01ce3f15c6a3..b8a7525a4e2f 100644 --- a/arch/arm/mach-shmobile/board-marzen.c +++ b/arch/arm/mach-shmobile/board-marzen.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/regulator/fixed.h> | 30 | #include <linux/regulator/fixed.h> |
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/smsc911x.h> | 32 | #include <linux/smsc911x.h> |
33 | #include <linux/mmc/sh_mobile_sdhi.h> | ||
34 | #include <linux/mfd/tmio.h> | ||
33 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
34 | #include <mach/r8a7779.h> | 36 | #include <mach/r8a7779.h> |
35 | #include <mach/common.h> | 37 | #include <mach/common.h> |
@@ -39,6 +41,12 @@ | |||
39 | #include <asm/hardware/gic.h> | 41 | #include <asm/hardware/gic.h> |
40 | #include <asm/traps.h> | 42 | #include <asm/traps.h> |
41 | 43 | ||
44 | /* Fixed 3.3V regulator to be used by SDHI0 */ | ||
45 | static struct regulator_consumer_supply fixed3v3_power_consumers[] = { | ||
46 | REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), | ||
47 | REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), | ||
48 | }; | ||
49 | |||
42 | /* Dummy supplies, where voltage doesn't matter */ | 50 | /* Dummy supplies, where voltage doesn't matter */ |
43 | static struct regulator_consumer_supply dummy_supplies[] = { | 51 | static struct regulator_consumer_supply dummy_supplies[] = { |
44 | REGULATOR_SUPPLY("vddvario", "smsc911x"), | 52 | REGULATOR_SUPPLY("vddvario", "smsc911x"), |
@@ -75,13 +83,61 @@ static struct platform_device eth_device = { | |||
75 | .num_resources = ARRAY_SIZE(smsc911x_resources), | 83 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
76 | }; | 84 | }; |
77 | 85 | ||
86 | static struct resource sdhi0_resources[] = { | ||
87 | [0] = { | ||
88 | .name = "sdhi0", | ||
89 | .start = 0xffe4c000, | ||
90 | .end = 0xffe4c0ff, | ||
91 | .flags = IORESOURCE_MEM, | ||
92 | }, | ||
93 | [1] = { | ||
94 | .start = gic_spi(104), | ||
95 | .flags = IORESOURCE_IRQ, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct sh_mobile_sdhi_info sdhi0_platform_data = { | ||
100 | .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT, | ||
101 | .tmio_caps = MMC_CAP_SD_HIGHSPEED, | ||
102 | }; | ||
103 | |||
104 | static struct platform_device sdhi0_device = { | ||
105 | .name = "sh_mobile_sdhi", | ||
106 | .num_resources = ARRAY_SIZE(sdhi0_resources), | ||
107 | .resource = sdhi0_resources, | ||
108 | .id = 0, | ||
109 | .dev = { | ||
110 | .platform_data = &sdhi0_platform_data, | ||
111 | } | ||
112 | }; | ||
113 | |||
114 | /* Thermal */ | ||
115 | static struct resource thermal_resources[] = { | ||
116 | [0] = { | ||
117 | .start = 0xFFC48000, | ||
118 | .end = 0xFFC48038 - 1, | ||
119 | .flags = IORESOURCE_MEM, | ||
120 | }, | ||
121 | }; | ||
122 | |||
123 | static struct platform_device thermal_device = { | ||
124 | .name = "rcar_thermal", | ||
125 | .resource = thermal_resources, | ||
126 | .num_resources = ARRAY_SIZE(thermal_resources), | ||
127 | }; | ||
128 | |||
78 | static struct platform_device *marzen_devices[] __initdata = { | 129 | static struct platform_device *marzen_devices[] __initdata = { |
79 | ð_device, | 130 | ð_device, |
131 | &sdhi0_device, | ||
132 | &thermal_device, | ||
80 | }; | 133 | }; |
81 | 134 | ||
82 | static void __init marzen_init(void) | 135 | static void __init marzen_init(void) |
83 | { | 136 | { |
84 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | 137 | regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, |
138 | ARRAY_SIZE(fixed3v3_power_consumers), 3300000); | ||
139 | regulator_register_fixed(1, dummy_supplies, | ||
140 | ARRAY_SIZE(dummy_supplies)); | ||
85 | 141 | ||
86 | r8a7779_pinmux_init(); | 142 | r8a7779_pinmux_init(); |
87 | 143 | ||
@@ -97,6 +153,16 @@ static void __init marzen_init(void) | |||
97 | gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */ | 153 | gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */ |
98 | gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */ | 154 | gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */ |
99 | 155 | ||
156 | /* SD0 (CN20) */ | ||
157 | gpio_request(GPIO_FN_SD0_CLK, NULL); | ||
158 | gpio_request(GPIO_FN_SD0_CMD, NULL); | ||
159 | gpio_request(GPIO_FN_SD0_DAT0, NULL); | ||
160 | gpio_request(GPIO_FN_SD0_DAT1, NULL); | ||
161 | gpio_request(GPIO_FN_SD0_DAT2, NULL); | ||
162 | gpio_request(GPIO_FN_SD0_DAT3, NULL); | ||
163 | gpio_request(GPIO_FN_SD0_CD, NULL); | ||
164 | gpio_request(GPIO_FN_SD0_WP, NULL); | ||
165 | |||
100 | r8a7779_add_standard_devices(); | 166 | r8a7779_add_standard_devices(); |
101 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); | 167 | platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); |
102 | } | 168 | } |
diff --git a/arch/arm/mach-shmobile/common.c b/arch/arm/mach-shmobile/common.c deleted file mode 100644 index 608aba9d60d7..000000000000 --- a/arch/arm/mach-shmobile/common.c +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License as published by | ||
4 | * the Free Software Foundation; version 2 of the License. | ||
5 | * | ||
6 | * This program is distributed in the hope that it will be useful, | ||
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
9 | * GNU General Public License for more details. | ||
10 | * | ||
11 | * You should have received a copy of the GNU General Public License | ||
12 | * along with this program; if not, write to the Free Software | ||
13 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
14 | * | ||
15 | */ | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <mach/common.h> | ||
19 | |||
20 | void __init shmobile_init_late(void) | ||
21 | { | ||
22 | shmobile_suspend_init(); | ||
23 | shmobile_cpuidle_init(); | ||
24 | } | ||
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c index 7b541e911ab4..9e050268cde4 100644 --- a/arch/arm/mach-shmobile/cpuidle.c +++ b/arch/arm/mach-shmobile/cpuidle.c | |||
@@ -16,51 +16,38 @@ | |||
16 | #include <asm/cpuidle.h> | 16 | #include <asm/cpuidle.h> |
17 | #include <asm/io.h> | 17 | #include <asm/io.h> |
18 | 18 | ||
19 | static void shmobile_enter_wfi(void) | 19 | int shmobile_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv, |
20 | int index) | ||
20 | { | 21 | { |
21 | cpu_do_idle(); | 22 | cpu_do_idle(); |
22 | } | 23 | return 0; |
23 | |||
24 | void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = { | ||
25 | shmobile_enter_wfi, /* regular sleep mode */ | ||
26 | }; | ||
27 | |||
28 | static int shmobile_cpuidle_enter(struct cpuidle_device *dev, | ||
29 | struct cpuidle_driver *drv, | ||
30 | int index) | ||
31 | { | ||
32 | shmobile_cpuidle_modes[index](); | ||
33 | |||
34 | return index; | ||
35 | } | 24 | } |
36 | 25 | ||
37 | static struct cpuidle_device shmobile_cpuidle_dev; | 26 | static struct cpuidle_device shmobile_cpuidle_dev; |
38 | static struct cpuidle_driver shmobile_cpuidle_driver = { | 27 | static struct cpuidle_driver shmobile_cpuidle_default_driver = { |
39 | .name = "shmobile_cpuidle", | 28 | .name = "shmobile_cpuidle", |
40 | .owner = THIS_MODULE, | 29 | .owner = THIS_MODULE, |
41 | .en_core_tk_irqen = 1, | 30 | .en_core_tk_irqen = 1, |
42 | .states[0] = ARM_CPUIDLE_WFI_STATE, | 31 | .states[0] = ARM_CPUIDLE_WFI_STATE, |
32 | .states[0].enter = shmobile_enter_wfi, | ||
43 | .safe_state_index = 0, /* C1 */ | 33 | .safe_state_index = 0, /* C1 */ |
44 | .state_count = 1, | 34 | .state_count = 1, |
45 | }; | 35 | }; |
46 | 36 | ||
47 | void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); | 37 | static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver; |
38 | |||
39 | void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv) | ||
40 | { | ||
41 | cpuidle_drv = drv; | ||
42 | } | ||
48 | 43 | ||
49 | int shmobile_cpuidle_init(void) | 44 | int shmobile_cpuidle_init(void) |
50 | { | 45 | { |
51 | struct cpuidle_device *dev = &shmobile_cpuidle_dev; | 46 | struct cpuidle_device *dev = &shmobile_cpuidle_dev; |
52 | struct cpuidle_driver *drv = &shmobile_cpuidle_driver; | ||
53 | int i; | ||
54 | |||
55 | for (i = 0; i < CPUIDLE_STATE_MAX; i++) | ||
56 | drv->states[i].enter = shmobile_cpuidle_enter; | ||
57 | |||
58 | if (shmobile_cpuidle_setup) | ||
59 | shmobile_cpuidle_setup(drv); | ||
60 | 47 | ||
61 | cpuidle_register_driver(drv); | 48 | cpuidle_register_driver(cpuidle_drv); |
62 | 49 | ||
63 | dev->state_count = drv->state_count; | 50 | dev->state_count = cpuidle_drv->state_count; |
64 | cpuidle_register_device(dev); | 51 | cpuidle_register_device(dev); |
65 | 52 | ||
66 | return 0; | 53 | return 0; |
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index f80f9c549393..ed77ab8c9143 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -13,8 +13,10 @@ extern int shmobile_clk_init(void); | |||
13 | extern void shmobile_handle_irq_intc(struct pt_regs *); | 13 | extern void shmobile_handle_irq_intc(struct pt_regs *); |
14 | extern struct platform_suspend_ops shmobile_suspend_ops; | 14 | extern struct platform_suspend_ops shmobile_suspend_ops; |
15 | struct cpuidle_driver; | 15 | struct cpuidle_driver; |
16 | extern void (*shmobile_cpuidle_modes[])(void); | 16 | struct cpuidle_device; |
17 | extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); | 17 | extern int shmobile_enter_wfi(struct cpuidle_device *dev, |
18 | struct cpuidle_driver *drv, int index); | ||
19 | extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); | ||
18 | 20 | ||
19 | extern void sh7367_init_irq(void); | 21 | extern void sh7367_init_irq(void); |
20 | extern void sh7367_map_io(void); | 22 | extern void sh7367_map_io(void); |
@@ -75,8 +77,6 @@ extern void r8a7740_meram_workaround(void); | |||
75 | 77 | ||
76 | extern void r8a7779_register_twd(void); | 78 | extern void r8a7779_register_twd(void); |
77 | 79 | ||
78 | extern void shmobile_init_late(void); | ||
79 | |||
80 | #ifdef CONFIG_SUSPEND | 80 | #ifdef CONFIG_SUSPEND |
81 | int shmobile_suspend_init(void); | 81 | int shmobile_suspend_init(void); |
82 | #else | 82 | #else |
@@ -100,4 +100,10 @@ static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; } | |||
100 | 100 | ||
101 | extern void shmobile_smp_init_cpus(unsigned int ncores); | 101 | extern void shmobile_smp_init_cpus(unsigned int ncores); |
102 | 102 | ||
103 | static inline void shmobile_init_late(void) | ||
104 | { | ||
105 | shmobile_suspend_init(); | ||
106 | shmobile_cpuidle_init(); | ||
107 | } | ||
108 | |||
103 | #endif /* __ARCH_MACH_COMMON_H */ | 109 | #endif /* __ARCH_MACH_COMMON_H */ |
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h index 5a402840fe28..690553a06887 100644 --- a/arch/arm/mach-shmobile/include/mach/pm-rmobile.h +++ b/arch/arm/mach-shmobile/include/mach/pm-rmobile.h | |||
@@ -12,6 +12,8 @@ | |||
12 | 12 | ||
13 | #include <linux/pm_domain.h> | 13 | #include <linux/pm_domain.h> |
14 | 14 | ||
15 | #define DEFAULT_DEV_LATENCY_NS 250000 | ||
16 | |||
15 | struct platform_device; | 17 | struct platform_device; |
16 | 18 | ||
17 | struct rmobile_pm_domain { | 19 | struct rmobile_pm_domain { |
@@ -29,16 +31,33 @@ struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d) | |||
29 | return container_of(d, struct rmobile_pm_domain, genpd); | 31 | return container_of(d, struct rmobile_pm_domain, genpd); |
30 | } | 32 | } |
31 | 33 | ||
34 | struct pm_domain_device { | ||
35 | const char *domain_name; | ||
36 | struct platform_device *pdev; | ||
37 | }; | ||
38 | |||
32 | #ifdef CONFIG_PM | 39 | #ifdef CONFIG_PM |
33 | extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd); | 40 | extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num); |
34 | extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, | 41 | extern void rmobile_add_device_to_domain_td(const char *domain_name, |
35 | struct platform_device *pdev); | 42 | struct platform_device *pdev, |
36 | extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, | 43 | struct gpd_timing_data *td); |
37 | struct rmobile_pm_domain *rmobile_sd); | 44 | |
45 | static inline void rmobile_add_device_to_domain(const char *domain_name, | ||
46 | struct platform_device *pdev) | ||
47 | { | ||
48 | rmobile_add_device_to_domain_td(domain_name, pdev, NULL); | ||
49 | } | ||
50 | |||
51 | extern void rmobile_add_devices_to_domains(struct pm_domain_device data[], | ||
52 | int size); | ||
38 | #else | 53 | #else |
39 | #define rmobile_init_pm_domain(pd) do { } while (0) | 54 | |
40 | #define rmobile_add_device_to_domain(pd, pdev) do { } while (0) | 55 | #define rmobile_init_domains(domains, num) do { } while (0) |
41 | #define rmobile_pm_add_subdomain(pd, sd) do { } while (0) | 56 | #define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0) |
57 | #define rmobile_add_device_to_domain(name, pdev) do { } while (0) | ||
58 | |||
59 | static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[], | ||
60 | int size) {} | ||
42 | #endif /* CONFIG_PM */ | 61 | #endif /* CONFIG_PM */ |
43 | 62 | ||
44 | #endif /* PM_RMOBILE_H */ | 63 | #endif /* PM_RMOBILE_H */ |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h index 7143147780df..59d252f4cf97 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7740.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h | |||
@@ -607,9 +607,9 @@ enum { | |||
607 | }; | 607 | }; |
608 | 608 | ||
609 | #ifdef CONFIG_PM | 609 | #ifdef CONFIG_PM |
610 | extern struct rmobile_pm_domain r8a7740_pd_a4s; | 610 | extern void __init r8a7740_init_pm_domains(void); |
611 | extern struct rmobile_pm_domain r8a7740_pd_a3sp; | 611 | #else |
612 | extern struct rmobile_pm_domain r8a7740_pd_a4lc; | 612 | static inline void r8a7740_init_pm_domains(void) {} |
613 | #endif /* CONFIG_PM */ | 613 | #endif /* CONFIG_PM */ |
614 | 614 | ||
615 | #endif /* __ASM_R8A7740_H__ */ | 615 | #endif /* __ASM_R8A7740_H__ */ |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h index f504c5e81b47..499f52d2a4a1 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h | |||
@@ -347,17 +347,9 @@ extern int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch); | |||
347 | extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch); | 347 | extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch); |
348 | 348 | ||
349 | #ifdef CONFIG_PM | 349 | #ifdef CONFIG_PM |
350 | extern struct r8a7779_pm_domain r8a7779_sh4a; | 350 | extern void __init r8a7779_init_pm_domains(void); |
351 | extern struct r8a7779_pm_domain r8a7779_sgx; | ||
352 | extern struct r8a7779_pm_domain r8a7779_vdp1; | ||
353 | extern struct r8a7779_pm_domain r8a7779_impx3; | ||
354 | |||
355 | extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd); | ||
356 | extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd, | ||
357 | struct platform_device *pdev); | ||
358 | #else | 351 | #else |
359 | #define r8a7779_init_pm_domain(pd) do { } while (0) | 352 | static inline void r8a7779_init_pm_domains(void) {} |
360 | #define r8a7779_add_device_to_domain(pd, pdev) do { } while (0) | ||
361 | #endif /* CONFIG_PM */ | 353 | #endif /* CONFIG_PM */ |
362 | 354 | ||
363 | extern struct smp_operations r8a7779_smp_ops; | 355 | extern struct smp_operations r8a7779_smp_ops; |
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h index b59048e6d8fd..eb98b45c5089 100644 --- a/arch/arm/mach-shmobile/include/mach/sh7372.h +++ b/arch/arm/mach-shmobile/include/mach/sh7372.h | |||
@@ -478,21 +478,17 @@ extern struct clk sh7372_fsibck_clk; | |||
478 | extern struct clk sh7372_fsidiva_clk; | 478 | extern struct clk sh7372_fsidiva_clk; |
479 | extern struct clk sh7372_fsidivb_clk; | 479 | extern struct clk sh7372_fsidivb_clk; |
480 | 480 | ||
481 | #ifdef CONFIG_PM | ||
482 | extern struct rmobile_pm_domain sh7372_pd_a4lc; | ||
483 | extern struct rmobile_pm_domain sh7372_pd_a4mp; | ||
484 | extern struct rmobile_pm_domain sh7372_pd_d4; | ||
485 | extern struct rmobile_pm_domain sh7372_pd_a4r; | ||
486 | extern struct rmobile_pm_domain sh7372_pd_a3rv; | ||
487 | extern struct rmobile_pm_domain sh7372_pd_a3ri; | ||
488 | extern struct rmobile_pm_domain sh7372_pd_a4s; | ||
489 | extern struct rmobile_pm_domain sh7372_pd_a3sp; | ||
490 | extern struct rmobile_pm_domain sh7372_pd_a3sg; | ||
491 | #endif /* CONFIG_PM */ | ||
492 | |||
493 | extern void sh7372_intcs_suspend(void); | 481 | extern void sh7372_intcs_suspend(void); |
494 | extern void sh7372_intcs_resume(void); | 482 | extern void sh7372_intcs_resume(void); |
495 | extern void sh7372_intca_suspend(void); | 483 | extern void sh7372_intca_suspend(void); |
496 | extern void sh7372_intca_resume(void); | 484 | extern void sh7372_intca_resume(void); |
497 | 485 | ||
486 | #ifdef CONFIG_PM | ||
487 | extern void __init sh7372_init_pm_domains(void); | ||
488 | #else | ||
489 | static inline void sh7372_init_pm_domains(void) {} | ||
490 | #endif | ||
491 | |||
492 | extern void __init sh7372_pm_init_late(void); | ||
493 | |||
498 | #endif /* __ASM_SH7372_H__ */ | 494 | #endif /* __ASM_SH7372_H__ */ |
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c index 893504d012a6..21e5316d2d88 100644 --- a/arch/arm/mach-shmobile/pm-r8a7740.c +++ b/arch/arm/mach-shmobile/pm-r8a7740.c | |||
@@ -21,14 +21,6 @@ static int r8a7740_pd_a4s_suspend(void) | |||
21 | return -EBUSY; | 21 | return -EBUSY; |
22 | } | 22 | } |
23 | 23 | ||
24 | struct rmobile_pm_domain r8a7740_pd_a4s = { | ||
25 | .genpd.name = "A4S", | ||
26 | .bit_shift = 10, | ||
27 | .gov = &pm_domain_always_on_gov, | ||
28 | .no_debug = true, | ||
29 | .suspend = r8a7740_pd_a4s_suspend, | ||
30 | }; | ||
31 | |||
32 | static int r8a7740_pd_a3sp_suspend(void) | 24 | static int r8a7740_pd_a3sp_suspend(void) |
33 | { | 25 | { |
34 | /* | 26 | /* |
@@ -38,17 +30,31 @@ static int r8a7740_pd_a3sp_suspend(void) | |||
38 | return console_suspend_enabled ? 0 : -EBUSY; | 30 | return console_suspend_enabled ? 0 : -EBUSY; |
39 | } | 31 | } |
40 | 32 | ||
41 | struct rmobile_pm_domain r8a7740_pd_a3sp = { | 33 | static struct rmobile_pm_domain r8a7740_pm_domains[] = { |
42 | .genpd.name = "A3SP", | 34 | { |
43 | .bit_shift = 11, | 35 | .genpd.name = "A4S", |
44 | .gov = &pm_domain_always_on_gov, | 36 | .bit_shift = 10, |
45 | .no_debug = true, | 37 | .gov = &pm_domain_always_on_gov, |
46 | .suspend = r8a7740_pd_a3sp_suspend, | 38 | .no_debug = true, |
39 | .suspend = r8a7740_pd_a4s_suspend, | ||
40 | }, | ||
41 | { | ||
42 | .genpd.name = "A3SP", | ||
43 | .bit_shift = 11, | ||
44 | .gov = &pm_domain_always_on_gov, | ||
45 | .no_debug = true, | ||
46 | .suspend = r8a7740_pd_a3sp_suspend, | ||
47 | }, | ||
48 | { | ||
49 | .genpd.name = "A4LC", | ||
50 | .bit_shift = 1, | ||
51 | }, | ||
47 | }; | 52 | }; |
48 | 53 | ||
49 | struct rmobile_pm_domain r8a7740_pd_a4lc = { | 54 | void __init r8a7740_init_pm_domains(void) |
50 | .genpd.name = "A4LC", | 55 | { |
51 | .bit_shift = 1, | 56 | rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); |
52 | }; | 57 | pm_genpd_add_subdomain_names("A4S", "A3SP"); |
58 | } | ||
53 | 59 | ||
54 | #endif /* CONFIG_PM */ | 60 | #endif /* CONFIG_PM */ |
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c index a18a4ae16d2b..d50a8e9b94a4 100644 --- a/arch/arm/mach-shmobile/pm-r8a7779.c +++ b/arch/arm/mach-shmobile/pm-r8a7779.c | |||
@@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct device *dev) | |||
183 | return true; | 183 | return true; |
184 | } | 184 | } |
185 | 185 | ||
186 | void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) | 186 | static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) |
187 | { | 187 | { |
188 | struct generic_pm_domain *genpd = &r8a7779_pd->genpd; | 188 | struct generic_pm_domain *genpd = &r8a7779_pd->genpd; |
189 | 189 | ||
@@ -199,43 +199,44 @@ void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) | |||
199 | pd_power_up(&r8a7779_pd->genpd); | 199 | pd_power_up(&r8a7779_pd->genpd); |
200 | } | 200 | } |
201 | 201 | ||
202 | void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd, | 202 | static struct r8a7779_pm_domain r8a7779_pm_domains[] = { |
203 | struct platform_device *pdev) | 203 | { |
204 | { | 204 | .genpd.name = "SH4A", |
205 | struct device *dev = &pdev->dev; | 205 | .ch = { |
206 | 206 | .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ | |
207 | pm_genpd_add_device(&r8a7779_pd->genpd, dev); | 207 | .isr_bit = 16, /* SH4A */ |
208 | if (pm_clk_no_clocks(dev)) | 208 | }, |
209 | pm_clk_add(dev, NULL); | 209 | }, |
210 | } | 210 | { |
211 | 211 | .genpd.name = "SGX", | |
212 | struct r8a7779_pm_domain r8a7779_sh4a = { | 212 | .ch = { |
213 | .ch = { | 213 | .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ |
214 | .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ | 214 | .isr_bit = 20, /* SGX */ |
215 | .isr_bit = 16, /* SH4A */ | 215 | }, |
216 | } | 216 | }, |
217 | }; | 217 | { |
218 | 218 | .genpd.name = "VDP1", | |
219 | struct r8a7779_pm_domain r8a7779_sgx = { | 219 | .ch = { |
220 | .ch = { | 220 | .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ |
221 | .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ | 221 | .isr_bit = 21, /* VDP */ |
222 | .isr_bit = 20, /* SGX */ | 222 | }, |
223 | } | 223 | }, |
224 | { | ||
225 | .genpd.name = "IMPX3", | ||
226 | .ch = { | ||
227 | .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ | ||
228 | .isr_bit = 24, /* IMP */ | ||
229 | }, | ||
230 | }, | ||
224 | }; | 231 | }; |
225 | 232 | ||
226 | struct r8a7779_pm_domain r8a7779_vdp1 = { | 233 | void __init r8a7779_init_pm_domains(void) |
227 | .ch = { | 234 | { |
228 | .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ | 235 | int j; |
229 | .isr_bit = 21, /* VDP */ | ||
230 | } | ||
231 | }; | ||
232 | 236 | ||
233 | struct r8a7779_pm_domain r8a7779_impx3 = { | 237 | for (j = 0; j < ARRAY_SIZE(r8a7779_pm_domains); j++) |
234 | .ch = { | 238 | r8a7779_init_pm_domain(&r8a7779_pm_domains[j]); |
235 | .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ | 239 | } |
236 | .isr_bit = 24, /* IMP */ | ||
237 | } | ||
238 | }; | ||
239 | 240 | ||
240 | #endif /* CONFIG_PM */ | 241 | #endif /* CONFIG_PM */ |
241 | 242 | ||
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index 32e177275e47..1fc05d9453d0 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c | |||
@@ -134,7 +134,7 @@ static int rmobile_pd_start_dev(struct device *dev) | |||
134 | return ret; | 134 | return ret; |
135 | } | 135 | } |
136 | 136 | ||
137 | void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | 137 | static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) |
138 | { | 138 | { |
139 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; | 139 | struct generic_pm_domain *genpd = &rmobile_pd->genpd; |
140 | struct dev_power_governor *gov = rmobile_pd->gov; | 140 | struct dev_power_governor *gov = rmobile_pd->gov; |
@@ -149,19 +149,38 @@ void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) | |||
149 | __rmobile_pd_power_up(rmobile_pd, false); | 149 | __rmobile_pd_power_up(rmobile_pd, false); |
150 | } | 150 | } |
151 | 151 | ||
152 | void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, | 152 | void rmobile_init_domains(struct rmobile_pm_domain domains[], int num) |
153 | struct platform_device *pdev) | 153 | { |
154 | int j; | ||
155 | |||
156 | for (j = 0; j < num; j++) | ||
157 | rmobile_init_pm_domain(&domains[j]); | ||
158 | } | ||
159 | |||
160 | void rmobile_add_device_to_domain_td(const char *domain_name, | ||
161 | struct platform_device *pdev, | ||
162 | struct gpd_timing_data *td) | ||
154 | { | 163 | { |
155 | struct device *dev = &pdev->dev; | 164 | struct device *dev = &pdev->dev; |
156 | 165 | ||
157 | pm_genpd_add_device(&rmobile_pd->genpd, dev); | 166 | __pm_genpd_name_add_device(domain_name, dev, td); |
158 | if (pm_clk_no_clocks(dev)) | 167 | if (pm_clk_no_clocks(dev)) |
159 | pm_clk_add(dev, NULL); | 168 | pm_clk_add(dev, NULL); |
160 | } | 169 | } |
161 | 170 | ||
162 | void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, | 171 | void rmobile_add_devices_to_domains(struct pm_domain_device data[], |
163 | struct rmobile_pm_domain *rmobile_sd) | 172 | int size) |
164 | { | 173 | { |
165 | pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd); | 174 | struct gpd_timing_data latencies = { |
175 | .stop_latency_ns = DEFAULT_DEV_LATENCY_NS, | ||
176 | .start_latency_ns = DEFAULT_DEV_LATENCY_NS, | ||
177 | .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS, | ||
178 | .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS, | ||
179 | }; | ||
180 | int j; | ||
181 | |||
182 | for (j = 0; j < size; j++) | ||
183 | rmobile_add_device_to_domain_td(data[j].domain_name, | ||
184 | data[j].pdev, &latencies); | ||
166 | } | 185 | } |
167 | #endif /* CONFIG_PM */ | 186 | #endif /* CONFIG_PM */ |
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c index 162121842a2b..a0826a48dd08 100644 --- a/arch/arm/mach-shmobile/pm-sh7372.c +++ b/arch/arm/mach-shmobile/pm-sh7372.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/bitrev.h> | 22 | #include <linux/bitrev.h> |
23 | #include <linux/console.h> | 23 | #include <linux/console.h> |
24 | #include <asm/cpuidle.h> | ||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
26 | #include <asm/suspend.h> | 27 | #include <asm/suspend.h> |
@@ -72,20 +73,7 @@ | |||
72 | 73 | ||
73 | #ifdef CONFIG_PM | 74 | #ifdef CONFIG_PM |
74 | 75 | ||
75 | struct rmobile_pm_domain sh7372_pd_a4lc = { | 76 | #define PM_DOMAIN_ON_OFF_LATENCY_NS 250000 |
76 | .genpd.name = "A4LC", | ||
77 | .bit_shift = 1, | ||
78 | }; | ||
79 | |||
80 | struct rmobile_pm_domain sh7372_pd_a4mp = { | ||
81 | .genpd.name = "A4MP", | ||
82 | .bit_shift = 2, | ||
83 | }; | ||
84 | |||
85 | struct rmobile_pm_domain sh7372_pd_d4 = { | ||
86 | .genpd.name = "D4", | ||
87 | .bit_shift = 3, | ||
88 | }; | ||
89 | 77 | ||
90 | static int sh7372_a4r_pd_suspend(void) | 78 | static int sh7372_a4r_pd_suspend(void) |
91 | { | 79 | { |
@@ -94,39 +82,25 @@ static int sh7372_a4r_pd_suspend(void) | |||
94 | return 0; | 82 | return 0; |
95 | } | 83 | } |
96 | 84 | ||
97 | struct rmobile_pm_domain sh7372_pd_a4r = { | 85 | static bool a4s_suspend_ready; |
98 | .genpd.name = "A4R", | ||
99 | .bit_shift = 5, | ||
100 | .suspend = sh7372_a4r_pd_suspend, | ||
101 | .resume = sh7372_intcs_resume, | ||
102 | }; | ||
103 | 86 | ||
104 | struct rmobile_pm_domain sh7372_pd_a3rv = { | 87 | static int sh7372_a4s_pd_suspend(void) |
105 | .genpd.name = "A3RV", | ||
106 | .bit_shift = 6, | ||
107 | }; | ||
108 | |||
109 | struct rmobile_pm_domain sh7372_pd_a3ri = { | ||
110 | .genpd.name = "A3RI", | ||
111 | .bit_shift = 8, | ||
112 | }; | ||
113 | |||
114 | static int sh7372_pd_a4s_suspend(void) | ||
115 | { | 88 | { |
116 | /* | 89 | /* |
117 | * The A4S domain contains the CPU core and therefore it should | 90 | * The A4S domain contains the CPU core and therefore it should |
118 | * only be turned off if the CPU is in use. | 91 | * only be turned off if the CPU is not in use. This may happen |
92 | * during system suspend, when SYSC is going to be used for generating | ||
93 | * resume signals and a4s_suspend_ready is set to let | ||
94 | * sh7372_enter_suspend() know that it can turn A4S off. | ||
119 | */ | 95 | */ |
96 | a4s_suspend_ready = true; | ||
120 | return -EBUSY; | 97 | return -EBUSY; |
121 | } | 98 | } |
122 | 99 | ||
123 | struct rmobile_pm_domain sh7372_pd_a4s = { | 100 | static void sh7372_a4s_pd_resume(void) |
124 | .genpd.name = "A4S", | 101 | { |
125 | .bit_shift = 10, | 102 | a4s_suspend_ready = false; |
126 | .gov = &pm_domain_always_on_gov, | 103 | } |
127 | .no_debug = true, | ||
128 | .suspend = sh7372_pd_a4s_suspend, | ||
129 | }; | ||
130 | 104 | ||
131 | static int sh7372_a3sp_pd_suspend(void) | 105 | static int sh7372_a3sp_pd_suspend(void) |
132 | { | 106 | { |
@@ -137,18 +111,80 @@ static int sh7372_a3sp_pd_suspend(void) | |||
137 | return console_suspend_enabled ? 0 : -EBUSY; | 111 | return console_suspend_enabled ? 0 : -EBUSY; |
138 | } | 112 | } |
139 | 113 | ||
140 | struct rmobile_pm_domain sh7372_pd_a3sp = { | 114 | static struct rmobile_pm_domain sh7372_pm_domains[] = { |
141 | .genpd.name = "A3SP", | 115 | { |
142 | .bit_shift = 11, | 116 | .genpd.name = "A4LC", |
143 | .gov = &pm_domain_always_on_gov, | 117 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, |
144 | .no_debug = true, | 118 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, |
145 | .suspend = sh7372_a3sp_pd_suspend, | 119 | .bit_shift = 1, |
120 | }, | ||
121 | { | ||
122 | .genpd.name = "A4MP", | ||
123 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
124 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
125 | .bit_shift = 2, | ||
126 | }, | ||
127 | { | ||
128 | .genpd.name = "D4", | ||
129 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
130 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
131 | .bit_shift = 3, | ||
132 | }, | ||
133 | { | ||
134 | .genpd.name = "A4R", | ||
135 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
136 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
137 | .bit_shift = 5, | ||
138 | .suspend = sh7372_a4r_pd_suspend, | ||
139 | .resume = sh7372_intcs_resume, | ||
140 | }, | ||
141 | { | ||
142 | .genpd.name = "A3RV", | ||
143 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
144 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
145 | .bit_shift = 6, | ||
146 | }, | ||
147 | { | ||
148 | .genpd.name = "A3RI", | ||
149 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
150 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
151 | .bit_shift = 8, | ||
152 | }, | ||
153 | { | ||
154 | .genpd.name = "A4S", | ||
155 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
156 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
157 | .bit_shift = 10, | ||
158 | .gov = &pm_domain_always_on_gov, | ||
159 | .no_debug = true, | ||
160 | .suspend = sh7372_a4s_pd_suspend, | ||
161 | .resume = sh7372_a4s_pd_resume, | ||
162 | }, | ||
163 | { | ||
164 | .genpd.name = "A3SP", | ||
165 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
166 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
167 | .bit_shift = 11, | ||
168 | .gov = &pm_domain_always_on_gov, | ||
169 | .no_debug = true, | ||
170 | .suspend = sh7372_a3sp_pd_suspend, | ||
171 | }, | ||
172 | { | ||
173 | .genpd.name = "A3SG", | ||
174 | .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
175 | .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, | ||
176 | .bit_shift = 13, | ||
177 | }, | ||
146 | }; | 178 | }; |
147 | 179 | ||
148 | struct rmobile_pm_domain sh7372_pd_a3sg = { | 180 | void __init sh7372_init_pm_domains(void) |
149 | .genpd.name = "A3SG", | 181 | { |
150 | .bit_shift = 13, | 182 | rmobile_init_domains(sh7372_pm_domains, ARRAY_SIZE(sh7372_pm_domains)); |
151 | }; | 183 | pm_genpd_add_subdomain_names("A4LC", "A3RV"); |
184 | pm_genpd_add_subdomain_names("A4R", "A4LC"); | ||
185 | pm_genpd_add_subdomain_names("A4S", "A3SG"); | ||
186 | pm_genpd_add_subdomain_names("A4S", "A3SP"); | ||
187 | } | ||
152 | 188 | ||
153 | #endif /* CONFIG_PM */ | 189 | #endif /* CONFIG_PM */ |
154 | 190 | ||
@@ -304,6 +340,21 @@ static void sh7372_enter_a3sm_common(int pllc0_on) | |||
304 | sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); | 340 | sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); |
305 | sh7372_enter_sysc(pllc0_on, 1 << 12); | 341 | sh7372_enter_sysc(pllc0_on, 1 << 12); |
306 | } | 342 | } |
343 | |||
344 | static void sh7372_enter_a4s_common(int pllc0_on) | ||
345 | { | ||
346 | sh7372_intca_suspend(); | ||
347 | sh7372_set_reset_vector(SMFRAM); | ||
348 | sh7372_enter_sysc(pllc0_on, 1 << 10); | ||
349 | sh7372_intca_resume(); | ||
350 | } | ||
351 | |||
352 | static void sh7372_pm_setup_smfram(void) | ||
353 | { | ||
354 | memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100); | ||
355 | } | ||
356 | #else | ||
357 | static inline void sh7372_pm_setup_smfram(void) {} | ||
307 | #endif /* CONFIG_SUSPEND || CONFIG_CPU_IDLE */ | 358 | #endif /* CONFIG_SUSPEND || CONFIG_CPU_IDLE */ |
308 | 359 | ||
309 | #ifdef CONFIG_CPU_IDLE | 360 | #ifdef CONFIG_CPU_IDLE |
@@ -313,7 +364,8 @@ static int sh7372_do_idle_core_standby(unsigned long unused) | |||
313 | return 0; | 364 | return 0; |
314 | } | 365 | } |
315 | 366 | ||
316 | static void sh7372_enter_core_standby(void) | 367 | static int sh7372_enter_core_standby(struct cpuidle_device *dev, |
368 | struct cpuidle_driver *drv, int index) | ||
317 | { | 369 | { |
318 | sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); | 370 | sh7372_set_reset_vector(__pa(sh7372_resume_core_standby_sysc)); |
319 | 371 | ||
@@ -324,83 +376,102 @@ static void sh7372_enter_core_standby(void) | |||
324 | 376 | ||
325 | /* disable reset vector translation */ | 377 | /* disable reset vector translation */ |
326 | __raw_writel(0, SBAR); | 378 | __raw_writel(0, SBAR); |
379 | |||
380 | return 1; | ||
327 | } | 381 | } |
328 | 382 | ||
329 | static void sh7372_enter_a3sm_pll_on(void) | 383 | static int sh7372_enter_a3sm_pll_on(struct cpuidle_device *dev, |
384 | struct cpuidle_driver *drv, int index) | ||
330 | { | 385 | { |
331 | sh7372_enter_a3sm_common(1); | 386 | sh7372_enter_a3sm_common(1); |
387 | return 2; | ||
332 | } | 388 | } |
333 | 389 | ||
334 | static void sh7372_enter_a3sm_pll_off(void) | 390 | static int sh7372_enter_a3sm_pll_off(struct cpuidle_device *dev, |
391 | struct cpuidle_driver *drv, int index) | ||
335 | { | 392 | { |
336 | sh7372_enter_a3sm_common(0); | 393 | sh7372_enter_a3sm_common(0); |
394 | return 3; | ||
337 | } | 395 | } |
338 | 396 | ||
339 | static void sh7372_cpuidle_setup(struct cpuidle_driver *drv) | 397 | static int sh7372_enter_a4s(struct cpuidle_device *dev, |
398 | struct cpuidle_driver *drv, int index) | ||
340 | { | 399 | { |
341 | struct cpuidle_state *state = &drv->states[drv->state_count]; | 400 | unsigned long msk, msk2; |
342 | 401 | ||
343 | snprintf(state->name, CPUIDLE_NAME_LEN, "C2"); | 402 | if (!sh7372_sysc_valid(&msk, &msk2)) |
344 | strncpy(state->desc, "Core Standby Mode", CPUIDLE_DESC_LEN); | 403 | return sh7372_enter_a3sm_pll_off(dev, drv, index); |
345 | state->exit_latency = 10; | 404 | |
346 | state->target_residency = 20 + 10; | 405 | sh7372_setup_sysc(msk, msk2); |
347 | state->flags = CPUIDLE_FLAG_TIME_VALID; | 406 | sh7372_enter_a4s_common(0); |
348 | shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_core_standby; | 407 | return 4; |
349 | drv->state_count++; | ||
350 | |||
351 | state = &drv->states[drv->state_count]; | ||
352 | snprintf(state->name, CPUIDLE_NAME_LEN, "C3"); | ||
353 | strncpy(state->desc, "A3SM PLL ON", CPUIDLE_DESC_LEN); | ||
354 | state->exit_latency = 20; | ||
355 | state->target_residency = 30 + 20; | ||
356 | state->flags = CPUIDLE_FLAG_TIME_VALID; | ||
357 | shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_a3sm_pll_on; | ||
358 | drv->state_count++; | ||
359 | |||
360 | state = &drv->states[drv->state_count]; | ||
361 | snprintf(state->name, CPUIDLE_NAME_LEN, "C4"); | ||
362 | strncpy(state->desc, "A3SM PLL OFF", CPUIDLE_DESC_LEN); | ||
363 | state->exit_latency = 120; | ||
364 | state->target_residency = 30 + 120; | ||
365 | state->flags = CPUIDLE_FLAG_TIME_VALID; | ||
366 | shmobile_cpuidle_modes[drv->state_count] = sh7372_enter_a3sm_pll_off; | ||
367 | drv->state_count++; | ||
368 | } | 408 | } |
369 | 409 | ||
410 | static struct cpuidle_driver sh7372_cpuidle_driver = { | ||
411 | .name = "sh7372_cpuidle", | ||
412 | .owner = THIS_MODULE, | ||
413 | .en_core_tk_irqen = 1, | ||
414 | .state_count = 5, | ||
415 | .safe_state_index = 0, /* C1 */ | ||
416 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
417 | .states[0].enter = shmobile_enter_wfi, | ||
418 | .states[1] = { | ||
419 | .name = "C2", | ||
420 | .desc = "Core Standby Mode", | ||
421 | .exit_latency = 10, | ||
422 | .target_residency = 20 + 10, | ||
423 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
424 | .enter = sh7372_enter_core_standby, | ||
425 | }, | ||
426 | .states[2] = { | ||
427 | .name = "C3", | ||
428 | .desc = "A3SM PLL ON", | ||
429 | .exit_latency = 20, | ||
430 | .target_residency = 30 + 20, | ||
431 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
432 | .enter = sh7372_enter_a3sm_pll_on, | ||
433 | }, | ||
434 | .states[3] = { | ||
435 | .name = "C4", | ||
436 | .desc = "A3SM PLL OFF", | ||
437 | .exit_latency = 120, | ||
438 | .target_residency = 30 + 120, | ||
439 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
440 | .enter = sh7372_enter_a3sm_pll_off, | ||
441 | }, | ||
442 | .states[4] = { | ||
443 | .name = "C5", | ||
444 | .desc = "A4S PLL OFF", | ||
445 | .exit_latency = 240, | ||
446 | .target_residency = 30 + 240, | ||
447 | .flags = CPUIDLE_FLAG_TIME_VALID, | ||
448 | .enter = sh7372_enter_a4s, | ||
449 | .disabled = true, | ||
450 | }, | ||
451 | }; | ||
452 | |||
370 | static void sh7372_cpuidle_init(void) | 453 | static void sh7372_cpuidle_init(void) |
371 | { | 454 | { |
372 | shmobile_cpuidle_setup = sh7372_cpuidle_setup; | 455 | shmobile_cpuidle_set_driver(&sh7372_cpuidle_driver); |
373 | } | 456 | } |
374 | #else | 457 | #else |
375 | static void sh7372_cpuidle_init(void) {} | 458 | static void sh7372_cpuidle_init(void) {} |
376 | #endif | 459 | #endif |
377 | 460 | ||
378 | #ifdef CONFIG_SUSPEND | 461 | #ifdef CONFIG_SUSPEND |
379 | static void sh7372_enter_a4s_common(int pllc0_on) | ||
380 | { | ||
381 | sh7372_intca_suspend(); | ||
382 | memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100); | ||
383 | sh7372_set_reset_vector(SMFRAM); | ||
384 | sh7372_enter_sysc(pllc0_on, 1 << 10); | ||
385 | sh7372_intca_resume(); | ||
386 | } | ||
387 | |||
388 | static int sh7372_enter_suspend(suspend_state_t suspend_state) | 462 | static int sh7372_enter_suspend(suspend_state_t suspend_state) |
389 | { | 463 | { |
390 | unsigned long msk, msk2; | 464 | unsigned long msk, msk2; |
391 | 465 | ||
392 | /* check active clocks to determine potential wakeup sources */ | 466 | /* check active clocks to determine potential wakeup sources */ |
393 | if (sh7372_sysc_valid(&msk, &msk2)) { | 467 | if (sh7372_sysc_valid(&msk, &msk2) && a4s_suspend_ready) { |
394 | if (!console_suspend_enabled && | 468 | /* convert INTC mask/sense to SYSC mask/sense */ |
395 | sh7372_pd_a4s.genpd.status == GPD_STATE_POWER_OFF) { | 469 | sh7372_setup_sysc(msk, msk2); |
396 | /* convert INTC mask/sense to SYSC mask/sense */ | 470 | |
397 | sh7372_setup_sysc(msk, msk2); | 471 | /* enter A4S sleep with PLLC0 off */ |
398 | 472 | pr_debug("entering A4S\n"); | |
399 | /* enter A4S sleep with PLLC0 off */ | 473 | sh7372_enter_a4s_common(0); |
400 | pr_debug("entering A4S\n"); | 474 | return 0; |
401 | sh7372_enter_a4s_common(0); | ||
402 | return 0; | ||
403 | } | ||
404 | } | 475 | } |
405 | 476 | ||
406 | /* default to enter A3SM sleep with PLLC0 off */ | 477 | /* default to enter A3SM sleep with PLLC0 off */ |
@@ -426,7 +497,7 @@ static int sh7372_pm_notifier_fn(struct notifier_block *notifier, | |||
426 | * executed during system suspend and resume, respectively, so | 497 | * executed during system suspend and resume, respectively, so |
427 | * that those functions don't crash while accessing the INTCS. | 498 | * that those functions don't crash while accessing the INTCS. |
428 | */ | 499 | */ |
429 | pm_genpd_poweron(&sh7372_pd_a4r.genpd); | 500 | pm_genpd_name_poweron("A4R"); |
430 | break; | 501 | break; |
431 | case PM_POST_SUSPEND: | 502 | case PM_POST_SUSPEND: |
432 | pm_genpd_poweroff_unused(); | 503 | pm_genpd_poweroff_unused(); |
@@ -455,6 +526,14 @@ void __init sh7372_pm_init(void) | |||
455 | /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ | 526 | /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ |
456 | __raw_writel(0, PDNSEL); | 527 | __raw_writel(0, PDNSEL); |
457 | 528 | ||
529 | sh7372_pm_setup_smfram(); | ||
530 | |||
458 | sh7372_suspend_init(); | 531 | sh7372_suspend_init(); |
459 | sh7372_cpuidle_init(); | 532 | sh7372_cpuidle_init(); |
460 | } | 533 | } |
534 | |||
535 | void __init sh7372_pm_init_late(void) | ||
536 | { | ||
537 | shmobile_init_late(); | ||
538 | pm_genpd_name_attach_cpuidle("A4S", 4); | ||
539 | } | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 78948a9dba0e..11bb1d984197 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c | |||
@@ -673,12 +673,7 @@ void __init r8a7740_add_standard_devices(void) | |||
673 | r8a7740_i2c_workaround(&i2c0_device); | 673 | r8a7740_i2c_workaround(&i2c0_device); |
674 | r8a7740_i2c_workaround(&i2c1_device); | 674 | r8a7740_i2c_workaround(&i2c1_device); |
675 | 675 | ||
676 | /* PM domain */ | 676 | r8a7740_init_pm_domains(); |
677 | rmobile_init_pm_domain(&r8a7740_pd_a4s); | ||
678 | rmobile_init_pm_domain(&r8a7740_pd_a3sp); | ||
679 | rmobile_init_pm_domain(&r8a7740_pd_a4lc); | ||
680 | |||
681 | rmobile_pm_add_subdomain(&r8a7740_pd_a4s, &r8a7740_pd_a3sp); | ||
682 | 677 | ||
683 | /* add devices */ | 678 | /* add devices */ |
684 | platform_add_devices(r8a7740_early_devices, | 679 | platform_add_devices(r8a7740_early_devices, |
@@ -688,16 +683,16 @@ void __init r8a7740_add_standard_devices(void) | |||
688 | 683 | ||
689 | /* add devices to PM domain */ | 684 | /* add devices to PM domain */ |
690 | 685 | ||
691 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif0_device); | 686 | rmobile_add_device_to_domain("A3SP", &scif0_device); |
692 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif1_device); | 687 | rmobile_add_device_to_domain("A3SP", &scif1_device); |
693 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif2_device); | 688 | rmobile_add_device_to_domain("A3SP", &scif2_device); |
694 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif3_device); | 689 | rmobile_add_device_to_domain("A3SP", &scif3_device); |
695 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif4_device); | 690 | rmobile_add_device_to_domain("A3SP", &scif4_device); |
696 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif5_device); | 691 | rmobile_add_device_to_domain("A3SP", &scif5_device); |
697 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif6_device); | 692 | rmobile_add_device_to_domain("A3SP", &scif6_device); |
698 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif7_device); | 693 | rmobile_add_device_to_domain("A3SP", &scif7_device); |
699 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scifb_device); | 694 | rmobile_add_device_to_domain("A3SP", &scifb_device); |
700 | rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &i2c1_device); | 695 | rmobile_add_device_to_domain("A3SP", &i2c1_device); |
701 | } | 696 | } |
702 | 697 | ||
703 | static void __init r8a7740_earlytimer_init(void) | 698 | static void __init r8a7740_earlytimer_init(void) |
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index e98e46f6cf55..2917668f0091 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -251,10 +251,7 @@ void __init r8a7779_add_standard_devices(void) | |||
251 | #endif | 251 | #endif |
252 | r8a7779_pm_init(); | 252 | r8a7779_pm_init(); |
253 | 253 | ||
254 | r8a7779_init_pm_domain(&r8a7779_sh4a); | 254 | r8a7779_init_pm_domains(); |
255 | r8a7779_init_pm_domain(&r8a7779_sgx); | ||
256 | r8a7779_init_pm_domain(&r8a7779_vdp1); | ||
257 | r8a7779_init_pm_domain(&r8a7779_impx3); | ||
258 | 255 | ||
259 | platform_add_devices(r8a7779_early_devices, | 256 | platform_add_devices(r8a7779_early_devices, |
260 | ARRAY_SIZE(r8a7779_early_devices)); | 257 | ARRAY_SIZE(r8a7779_early_devices)); |
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index 838a87be1d5c..a07954fbcd22 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -1001,21 +1001,34 @@ static struct platform_device *sh7372_late_devices[] __initdata = { | |||
1001 | 1001 | ||
1002 | void __init sh7372_add_standard_devices(void) | 1002 | void __init sh7372_add_standard_devices(void) |
1003 | { | 1003 | { |
1004 | rmobile_init_pm_domain(&sh7372_pd_a4lc); | 1004 | struct pm_domain_device domain_devices[] = { |
1005 | rmobile_init_pm_domain(&sh7372_pd_a4mp); | 1005 | { "A3RV", &vpu_device, }, |
1006 | rmobile_init_pm_domain(&sh7372_pd_d4); | 1006 | { "A4MP", &spu0_device, }, |
1007 | rmobile_init_pm_domain(&sh7372_pd_a4r); | 1007 | { "A4MP", &spu1_device, }, |
1008 | rmobile_init_pm_domain(&sh7372_pd_a3rv); | 1008 | { "A3SP", &scif0_device, }, |
1009 | rmobile_init_pm_domain(&sh7372_pd_a3ri); | 1009 | { "A3SP", &scif1_device, }, |
1010 | rmobile_init_pm_domain(&sh7372_pd_a4s); | 1010 | { "A3SP", &scif2_device, }, |
1011 | rmobile_init_pm_domain(&sh7372_pd_a3sp); | 1011 | { "A3SP", &scif3_device, }, |
1012 | rmobile_init_pm_domain(&sh7372_pd_a3sg); | 1012 | { "A3SP", &scif4_device, }, |
1013 | 1013 | { "A3SP", &scif5_device, }, | |
1014 | rmobile_pm_add_subdomain(&sh7372_pd_a4lc, &sh7372_pd_a3rv); | 1014 | { "A3SP", &scif6_device, }, |
1015 | rmobile_pm_add_subdomain(&sh7372_pd_a4r, &sh7372_pd_a4lc); | 1015 | { "A3SP", &iic1_device, }, |
1016 | 1016 | { "A3SP", &dma0_device, }, | |
1017 | rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sg); | 1017 | { "A3SP", &dma1_device, }, |
1018 | rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sp); | 1018 | { "A3SP", &dma2_device, }, |
1019 | { "A3SP", &usb_dma0_device, }, | ||
1020 | { "A3SP", &usb_dma1_device, }, | ||
1021 | { "A4R", &iic0_device, }, | ||
1022 | { "A4R", &veu0_device, }, | ||
1023 | { "A4R", &veu1_device, }, | ||
1024 | { "A4R", &veu2_device, }, | ||
1025 | { "A4R", &veu3_device, }, | ||
1026 | { "A4R", &jpu_device, }, | ||
1027 | { "A4R", &tmu00_device, }, | ||
1028 | { "A4R", &tmu01_device, }, | ||
1029 | }; | ||
1030 | |||
1031 | sh7372_init_pm_domains(); | ||
1019 | 1032 | ||
1020 | platform_add_devices(sh7372_early_devices, | 1033 | platform_add_devices(sh7372_early_devices, |
1021 | ARRAY_SIZE(sh7372_early_devices)); | 1034 | ARRAY_SIZE(sh7372_early_devices)); |
@@ -1023,30 +1036,8 @@ void __init sh7372_add_standard_devices(void) | |||
1023 | platform_add_devices(sh7372_late_devices, | 1036 | platform_add_devices(sh7372_late_devices, |
1024 | ARRAY_SIZE(sh7372_late_devices)); | 1037 | ARRAY_SIZE(sh7372_late_devices)); |
1025 | 1038 | ||
1026 | rmobile_add_device_to_domain(&sh7372_pd_a3rv, &vpu_device); | 1039 | rmobile_add_devices_to_domains(domain_devices, |
1027 | rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu0_device); | 1040 | ARRAY_SIZE(domain_devices)); |
1028 | rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu1_device); | ||
1029 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif0_device); | ||
1030 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif1_device); | ||
1031 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif2_device); | ||
1032 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif3_device); | ||
1033 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif4_device); | ||
1034 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif5_device); | ||
1035 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif6_device); | ||
1036 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &iic1_device); | ||
1037 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma0_device); | ||
1038 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma1_device); | ||
1039 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma2_device); | ||
1040 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma0_device); | ||
1041 | rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma1_device); | ||
1042 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &iic0_device); | ||
1043 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu0_device); | ||
1044 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu1_device); | ||
1045 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu2_device); | ||
1046 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu3_device); | ||
1047 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &jpu_device); | ||
1048 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu00_device); | ||
1049 | rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu01_device); | ||
1050 | } | 1041 | } |
1051 | 1042 | ||
1052 | static void __init sh7372_earlytimer_init(void) | 1043 | static void __init sh7372_earlytimer_init(void) |
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 04eb74e3f601..9aa653b3eb32 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -1,6 +1,4 @@ | |||
1 | obj-y += board-pinmux.o | ||
2 | obj-y += common.o | 1 | obj-y += common.o |
3 | obj-y += devices.o | ||
4 | obj-y += io.o | 2 | obj-y += io.o |
5 | obj-y += irq.o | 3 | obj-y += irq.o |
6 | obj-y += clock.o | 4 | obj-y += clock.o |
@@ -24,7 +22,6 @@ obj-$(CONFIG_SMP) += reset.o | |||
24 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 22 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
25 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o | 23 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o |
26 | obj-$(CONFIG_TEGRA_PCI) += pcie.o | 24 | obj-$(CONFIG_TEGRA_PCI) += pcie.o |
27 | obj-$(CONFIG_USB_SUPPORT) += usb_phy.o | ||
28 | 25 | ||
29 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o | 26 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o |
30 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o | 27 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o |
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c index 5d8c8fb060b0..57e235f4ac74 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/board-dt-tegra20.c | |||
@@ -28,9 +28,11 @@ | |||
28 | #include <linux/of_irq.h> | 28 | #include <linux/of_irq.h> |
29 | #include <linux/of_platform.h> | 29 | #include <linux/of_platform.h> |
30 | #include <linux/pda_power.h> | 30 | #include <linux/pda_power.h> |
31 | #include <linux/platform_data/tegra_usb.h> | ||
31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
32 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
33 | #include <linux/i2c-tegra.h> | 34 | #include <linux/i2c-tegra.h> |
35 | #include <linux/usb/tegra_usb_phy.h> | ||
34 | 36 | ||
35 | #include <asm/hardware/gic.h> | 37 | #include <asm/hardware/gic.h> |
36 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
@@ -43,9 +45,32 @@ | |||
43 | 45 | ||
44 | #include "board.h" | 46 | #include "board.h" |
45 | #include "clock.h" | 47 | #include "clock.h" |
46 | #include "devices.h" | ||
47 | #include "common.h" | 48 | #include "common.h" |
48 | 49 | ||
50 | struct tegra_ehci_platform_data tegra_ehci1_pdata = { | ||
51 | .operating_mode = TEGRA_USB_OTG, | ||
52 | .power_down_on_bus_suspend = 1, | ||
53 | .vbus_gpio = -1, | ||
54 | }; | ||
55 | |||
56 | struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { | ||
57 | .reset_gpio = -1, | ||
58 | .clk = "cdev2", | ||
59 | }; | ||
60 | |||
61 | struct tegra_ehci_platform_data tegra_ehci2_pdata = { | ||
62 | .phy_config = &tegra_ehci2_ulpi_phy_config, | ||
63 | .operating_mode = TEGRA_USB_HOST, | ||
64 | .power_down_on_bus_suspend = 1, | ||
65 | .vbus_gpio = -1, | ||
66 | }; | ||
67 | |||
68 | struct tegra_ehci_platform_data tegra_ehci3_pdata = { | ||
69 | .operating_mode = TEGRA_USB_HOST, | ||
70 | .power_down_on_bus_suspend = 1, | ||
71 | .vbus_gpio = -1, | ||
72 | }; | ||
73 | |||
49 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { | 74 | struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { |
50 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), | 75 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), |
51 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), | 76 | OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL), |
diff --git a/arch/arm/mach-tegra/board-pinmux.c b/arch/arm/mach-tegra/board-pinmux.c deleted file mode 100644 index a5574c71b931..000000000000 --- a/arch/arm/mach-tegra/board-pinmux.c +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/device.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/notifier.h> | ||
18 | #include <linux/string.h> | ||
19 | |||
20 | #include "board-pinmux.h" | ||
21 | #include "devices.h" | ||
22 | |||
23 | unsigned long tegra_pincfg_pullnone_driven[2] = { | ||
24 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), | ||
25 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
26 | }; | ||
27 | |||
28 | unsigned long tegra_pincfg_pullnone_tristate[2] = { | ||
29 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), | ||
30 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), | ||
31 | }; | ||
32 | |||
33 | unsigned long tegra_pincfg_pullnone_na[1] = { | ||
34 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE), | ||
35 | }; | ||
36 | |||
37 | unsigned long tegra_pincfg_pullup_driven[2] = { | ||
38 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), | ||
39 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
40 | }; | ||
41 | |||
42 | unsigned long tegra_pincfg_pullup_tristate[2] = { | ||
43 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), | ||
44 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), | ||
45 | }; | ||
46 | |||
47 | unsigned long tegra_pincfg_pullup_na[1] = { | ||
48 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP), | ||
49 | }; | ||
50 | |||
51 | unsigned long tegra_pincfg_pulldown_driven[2] = { | ||
52 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), | ||
53 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
54 | }; | ||
55 | |||
56 | unsigned long tegra_pincfg_pulldown_tristate[2] = { | ||
57 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), | ||
58 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), | ||
59 | }; | ||
60 | |||
61 | unsigned long tegra_pincfg_pulldown_na[1] = { | ||
62 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN), | ||
63 | }; | ||
64 | |||
65 | unsigned long tegra_pincfg_pullna_driven[1] = { | ||
66 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN), | ||
67 | }; | ||
68 | |||
69 | unsigned long tegra_pincfg_pullna_tristate[1] = { | ||
70 | TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE), | ||
71 | }; | ||
72 | |||
73 | static struct platform_device *devices[] = { | ||
74 | &tegra_gpio_device, | ||
75 | &tegra_pinmux_device, | ||
76 | }; | ||
77 | |||
78 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | ||
79 | struct tegra_board_pinmux_conf *conf_b) | ||
80 | { | ||
81 | if (conf_a) | ||
82 | pinctrl_register_mappings(conf_a->maps, conf_a->map_count); | ||
83 | if (conf_b) | ||
84 | pinctrl_register_mappings(conf_b->maps, conf_b->map_count); | ||
85 | |||
86 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
87 | } | ||
diff --git a/arch/arm/mach-tegra/board-pinmux.h b/arch/arm/mach-tegra/board-pinmux.h deleted file mode 100644 index c5f3f3381e86..000000000000 --- a/arch/arm/mach-tegra/board-pinmux.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011,2012, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This software is licensed under the terms of the GNU General Public | ||
5 | * License version 2, as published by the Free Software Foundation, and | ||
6 | * may be copied, distributed, and modified under those terms. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __MACH_TEGRA_BOARD_PINMUX_H | ||
16 | #define __MACH_TEGRA_BOARD_PINMUX_H | ||
17 | |||
18 | #include <linux/pinctrl/machine.h> | ||
19 | |||
20 | #include <mach/pinconf-tegra.h> | ||
21 | |||
22 | #define PINMUX_DEV "tegra20-pinctrl" | ||
23 | |||
24 | #define TEGRA_MAP_MUX(_group_, _function_) \ | ||
25 | PIN_MAP_MUX_GROUP_HOG_DEFAULT(PINMUX_DEV, _group_, _function_) | ||
26 | |||
27 | #define TEGRA_MAP_CONF(_group_, _pull_, _drive_) \ | ||
28 | PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(PINMUX_DEV, _group_, tegra_pincfg_pull##_pull_##_##_drive_) | ||
29 | |||
30 | #define TEGRA_MAP_MUXCONF(_group_, _function_, _pull_, _drive_) \ | ||
31 | TEGRA_MAP_MUX(_group_, _function_), \ | ||
32 | TEGRA_MAP_CONF(_group_, _pull_, _drive_) | ||
33 | |||
34 | extern unsigned long tegra_pincfg_pullnone_driven[2]; | ||
35 | extern unsigned long tegra_pincfg_pullnone_tristate[2]; | ||
36 | extern unsigned long tegra_pincfg_pullnone_na[1]; | ||
37 | extern unsigned long tegra_pincfg_pullup_driven[2]; | ||
38 | extern unsigned long tegra_pincfg_pullup_tristate[2]; | ||
39 | extern unsigned long tegra_pincfg_pullup_na[1]; | ||
40 | extern unsigned long tegra_pincfg_pulldown_driven[2]; | ||
41 | extern unsigned long tegra_pincfg_pulldown_tristate[2]; | ||
42 | extern unsigned long tegra_pincfg_pulldown_na[1]; | ||
43 | extern unsigned long tegra_pincfg_pullna_driven[1]; | ||
44 | extern unsigned long tegra_pincfg_pullna_tristate[1]; | ||
45 | |||
46 | struct tegra_board_pinmux_conf { | ||
47 | struct pinctrl_map *maps; | ||
48 | int map_count; | ||
49 | }; | ||
50 | |||
51 | void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a, | ||
52 | struct tegra_board_pinmux_conf *conf_b); | ||
53 | |||
54 | #endif | ||
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c deleted file mode 100644 index 61e9603744a7..000000000000 --- a/arch/arm/mach-tegra/devices.c +++ /dev/null | |||
@@ -1,701 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010,2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * Erik Gilling <ccross@android.com> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | |||
20 | #include <linux/resource.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | #include <linux/fsl_devices.h> | ||
24 | #include <linux/serial_8250.h> | ||
25 | #include <linux/i2c-tegra.h> | ||
26 | #include <mach/irqs.h> | ||
27 | #include <mach/iomap.h> | ||
28 | #include <mach/dma.h> | ||
29 | #include <mach/usb_phy.h> | ||
30 | |||
31 | #include "gpio-names.h" | ||
32 | #include "devices.h" | ||
33 | |||
34 | static struct resource gpio_resource[] = { | ||
35 | [0] = { | ||
36 | .start = TEGRA_GPIO_BASE, | ||
37 | .end = TEGRA_GPIO_BASE + TEGRA_GPIO_SIZE-1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, | ||
40 | [1] = { | ||
41 | .start = INT_GPIO1, | ||
42 | .end = INT_GPIO1, | ||
43 | .flags = IORESOURCE_IRQ, | ||
44 | }, | ||
45 | [2] = { | ||
46 | .start = INT_GPIO2, | ||
47 | .end = INT_GPIO2, | ||
48 | .flags = IORESOURCE_IRQ, | ||
49 | }, | ||
50 | [3] = { | ||
51 | .start = INT_GPIO3, | ||
52 | .end = INT_GPIO3, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | [4] = { | ||
56 | .start = INT_GPIO4, | ||
57 | .end = INT_GPIO4, | ||
58 | .flags = IORESOURCE_IRQ, | ||
59 | }, | ||
60 | [5] = { | ||
61 | .start = INT_GPIO5, | ||
62 | .end = INT_GPIO5, | ||
63 | .flags = IORESOURCE_IRQ, | ||
64 | }, | ||
65 | [6] = { | ||
66 | .start = INT_GPIO6, | ||
67 | .end = INT_GPIO6, | ||
68 | .flags = IORESOURCE_IRQ, | ||
69 | }, | ||
70 | [7] = { | ||
71 | .start = INT_GPIO7, | ||
72 | .end = INT_GPIO7, | ||
73 | .flags = IORESOURCE_IRQ, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | struct platform_device tegra_gpio_device = { | ||
78 | .name = "tegra-gpio", | ||
79 | .id = -1, | ||
80 | .resource = gpio_resource, | ||
81 | .num_resources = ARRAY_SIZE(gpio_resource), | ||
82 | }; | ||
83 | |||
84 | static struct resource pinmux_resource[] = { | ||
85 | [0] = { | ||
86 | /* Tri-state registers */ | ||
87 | .start = TEGRA_APB_MISC_BASE + 0x14, | ||
88 | .end = TEGRA_APB_MISC_BASE + 0x20 + 3, | ||
89 | .flags = IORESOURCE_MEM, | ||
90 | }, | ||
91 | [1] = { | ||
92 | /* Mux registers */ | ||
93 | .start = TEGRA_APB_MISC_BASE + 0x80, | ||
94 | .end = TEGRA_APB_MISC_BASE + 0x9c + 3, | ||
95 | .flags = IORESOURCE_MEM, | ||
96 | }, | ||
97 | [2] = { | ||
98 | /* Pull-up/down registers */ | ||
99 | .start = TEGRA_APB_MISC_BASE + 0xa0, | ||
100 | .end = TEGRA_APB_MISC_BASE + 0xb0 + 3, | ||
101 | .flags = IORESOURCE_MEM, | ||
102 | }, | ||
103 | [3] = { | ||
104 | /* Pad control registers */ | ||
105 | .start = TEGRA_APB_MISC_BASE + 0x868, | ||
106 | .end = TEGRA_APB_MISC_BASE + 0x90c + 3, | ||
107 | .flags = IORESOURCE_MEM, | ||
108 | }, | ||
109 | }; | ||
110 | |||
111 | struct platform_device tegra_pinmux_device = { | ||
112 | .name = "tegra20-pinctrl", | ||
113 | .id = -1, | ||
114 | .resource = pinmux_resource, | ||
115 | .num_resources = ARRAY_SIZE(pinmux_resource), | ||
116 | }; | ||
117 | |||
118 | static struct resource i2c_resource1[] = { | ||
119 | [0] = { | ||
120 | .start = INT_I2C, | ||
121 | .end = INT_I2C, | ||
122 | .flags = IORESOURCE_IRQ, | ||
123 | }, | ||
124 | [1] = { | ||
125 | .start = TEGRA_I2C_BASE, | ||
126 | .end = TEGRA_I2C_BASE + TEGRA_I2C_SIZE-1, | ||
127 | .flags = IORESOURCE_MEM, | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | static struct resource i2c_resource2[] = { | ||
132 | [0] = { | ||
133 | .start = INT_I2C2, | ||
134 | .end = INT_I2C2, | ||
135 | .flags = IORESOURCE_IRQ, | ||
136 | }, | ||
137 | [1] = { | ||
138 | .start = TEGRA_I2C2_BASE, | ||
139 | .end = TEGRA_I2C2_BASE + TEGRA_I2C2_SIZE-1, | ||
140 | .flags = IORESOURCE_MEM, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static struct resource i2c_resource3[] = { | ||
145 | [0] = { | ||
146 | .start = INT_I2C3, | ||
147 | .end = INT_I2C3, | ||
148 | .flags = IORESOURCE_IRQ, | ||
149 | }, | ||
150 | [1] = { | ||
151 | .start = TEGRA_I2C3_BASE, | ||
152 | .end = TEGRA_I2C3_BASE + TEGRA_I2C3_SIZE-1, | ||
153 | .flags = IORESOURCE_MEM, | ||
154 | }, | ||
155 | }; | ||
156 | |||
157 | static struct resource i2c_resource4[] = { | ||
158 | [0] = { | ||
159 | .start = INT_DVC, | ||
160 | .end = INT_DVC, | ||
161 | .flags = IORESOURCE_IRQ, | ||
162 | }, | ||
163 | [1] = { | ||
164 | .start = TEGRA_DVC_BASE, | ||
165 | .end = TEGRA_DVC_BASE + TEGRA_DVC_SIZE-1, | ||
166 | .flags = IORESOURCE_MEM, | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | static struct tegra_i2c_platform_data tegra_i2c1_platform_data = { | ||
171 | .bus_clk_rate = 400000, | ||
172 | }; | ||
173 | |||
174 | static struct tegra_i2c_platform_data tegra_i2c2_platform_data = { | ||
175 | .bus_clk_rate = 400000, | ||
176 | }; | ||
177 | |||
178 | static struct tegra_i2c_platform_data tegra_i2c3_platform_data = { | ||
179 | .bus_clk_rate = 400000, | ||
180 | }; | ||
181 | |||
182 | static struct tegra_i2c_platform_data tegra_dvc_platform_data = { | ||
183 | .bus_clk_rate = 400000, | ||
184 | }; | ||
185 | |||
186 | struct platform_device tegra_i2c_device1 = { | ||
187 | .name = "tegra-i2c", | ||
188 | .id = 0, | ||
189 | .resource = i2c_resource1, | ||
190 | .num_resources = ARRAY_SIZE(i2c_resource1), | ||
191 | .dev = { | ||
192 | .platform_data = &tegra_i2c1_platform_data, | ||
193 | }, | ||
194 | }; | ||
195 | |||
196 | struct platform_device tegra_i2c_device2 = { | ||
197 | .name = "tegra-i2c", | ||
198 | .id = 1, | ||
199 | .resource = i2c_resource2, | ||
200 | .num_resources = ARRAY_SIZE(i2c_resource2), | ||
201 | .dev = { | ||
202 | .platform_data = &tegra_i2c2_platform_data, | ||
203 | }, | ||
204 | }; | ||
205 | |||
206 | struct platform_device tegra_i2c_device3 = { | ||
207 | .name = "tegra-i2c", | ||
208 | .id = 2, | ||
209 | .resource = i2c_resource3, | ||
210 | .num_resources = ARRAY_SIZE(i2c_resource3), | ||
211 | .dev = { | ||
212 | .platform_data = &tegra_i2c3_platform_data, | ||
213 | }, | ||
214 | }; | ||
215 | |||
216 | struct platform_device tegra_i2c_device4 = { | ||
217 | .name = "tegra-i2c", | ||
218 | .id = 3, | ||
219 | .resource = i2c_resource4, | ||
220 | .num_resources = ARRAY_SIZE(i2c_resource4), | ||
221 | .dev = { | ||
222 | .platform_data = &tegra_dvc_platform_data, | ||
223 | }, | ||
224 | }; | ||
225 | |||
226 | static struct resource spi_resource1[] = { | ||
227 | [0] = { | ||
228 | .start = INT_S_LINK1, | ||
229 | .end = INT_S_LINK1, | ||
230 | .flags = IORESOURCE_IRQ, | ||
231 | }, | ||
232 | [1] = { | ||
233 | .start = TEGRA_SPI1_BASE, | ||
234 | .end = TEGRA_SPI1_BASE + TEGRA_SPI1_SIZE-1, | ||
235 | .flags = IORESOURCE_MEM, | ||
236 | }, | ||
237 | }; | ||
238 | |||
239 | static struct resource spi_resource2[] = { | ||
240 | [0] = { | ||
241 | .start = INT_SPI_2, | ||
242 | .end = INT_SPI_2, | ||
243 | .flags = IORESOURCE_IRQ, | ||
244 | }, | ||
245 | [1] = { | ||
246 | .start = TEGRA_SPI2_BASE, | ||
247 | .end = TEGRA_SPI2_BASE + TEGRA_SPI2_SIZE-1, | ||
248 | .flags = IORESOURCE_MEM, | ||
249 | }, | ||
250 | }; | ||
251 | |||
252 | static struct resource spi_resource3[] = { | ||
253 | [0] = { | ||
254 | .start = INT_SPI_3, | ||
255 | .end = INT_SPI_3, | ||
256 | .flags = IORESOURCE_IRQ, | ||
257 | }, | ||
258 | [1] = { | ||
259 | .start = TEGRA_SPI3_BASE, | ||
260 | .end = TEGRA_SPI3_BASE + TEGRA_SPI3_SIZE-1, | ||
261 | .flags = IORESOURCE_MEM, | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static struct resource spi_resource4[] = { | ||
266 | [0] = { | ||
267 | .start = INT_SPI_4, | ||
268 | .end = INT_SPI_4, | ||
269 | .flags = IORESOURCE_IRQ, | ||
270 | }, | ||
271 | [1] = { | ||
272 | .start = TEGRA_SPI4_BASE, | ||
273 | .end = TEGRA_SPI4_BASE + TEGRA_SPI4_SIZE-1, | ||
274 | .flags = IORESOURCE_MEM, | ||
275 | }, | ||
276 | }; | ||
277 | |||
278 | struct platform_device tegra_spi_device1 = { | ||
279 | .name = "spi_tegra", | ||
280 | .id = 0, | ||
281 | .resource = spi_resource1, | ||
282 | .num_resources = ARRAY_SIZE(spi_resource1), | ||
283 | .dev = { | ||
284 | .coherent_dma_mask = 0xffffffff, | ||
285 | }, | ||
286 | }; | ||
287 | |||
288 | struct platform_device tegra_spi_device2 = { | ||
289 | .name = "spi_tegra", | ||
290 | .id = 1, | ||
291 | .resource = spi_resource2, | ||
292 | .num_resources = ARRAY_SIZE(spi_resource2), | ||
293 | .dev = { | ||
294 | .coherent_dma_mask = 0xffffffff, | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | struct platform_device tegra_spi_device3 = { | ||
299 | .name = "spi_tegra", | ||
300 | .id = 2, | ||
301 | .resource = spi_resource3, | ||
302 | .num_resources = ARRAY_SIZE(spi_resource3), | ||
303 | .dev = { | ||
304 | .coherent_dma_mask = 0xffffffff, | ||
305 | }, | ||
306 | }; | ||
307 | |||
308 | struct platform_device tegra_spi_device4 = { | ||
309 | .name = "spi_tegra", | ||
310 | .id = 3, | ||
311 | .resource = spi_resource4, | ||
312 | .num_resources = ARRAY_SIZE(spi_resource4), | ||
313 | .dev = { | ||
314 | .coherent_dma_mask = 0xffffffff, | ||
315 | }, | ||
316 | }; | ||
317 | |||
318 | |||
319 | static struct resource sdhci_resource1[] = { | ||
320 | [0] = { | ||
321 | .start = INT_SDMMC1, | ||
322 | .end = INT_SDMMC1, | ||
323 | .flags = IORESOURCE_IRQ, | ||
324 | }, | ||
325 | [1] = { | ||
326 | .start = TEGRA_SDMMC1_BASE, | ||
327 | .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1, | ||
328 | .flags = IORESOURCE_MEM, | ||
329 | }, | ||
330 | }; | ||
331 | |||
332 | static struct resource sdhci_resource2[] = { | ||
333 | [0] = { | ||
334 | .start = INT_SDMMC2, | ||
335 | .end = INT_SDMMC2, | ||
336 | .flags = IORESOURCE_IRQ, | ||
337 | }, | ||
338 | [1] = { | ||
339 | .start = TEGRA_SDMMC2_BASE, | ||
340 | .end = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1, | ||
341 | .flags = IORESOURCE_MEM, | ||
342 | }, | ||
343 | }; | ||
344 | |||
345 | static struct resource sdhci_resource3[] = { | ||
346 | [0] = { | ||
347 | .start = INT_SDMMC3, | ||
348 | .end = INT_SDMMC3, | ||
349 | .flags = IORESOURCE_IRQ, | ||
350 | }, | ||
351 | [1] = { | ||
352 | .start = TEGRA_SDMMC3_BASE, | ||
353 | .end = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1, | ||
354 | .flags = IORESOURCE_MEM, | ||
355 | }, | ||
356 | }; | ||
357 | |||
358 | static struct resource sdhci_resource4[] = { | ||
359 | [0] = { | ||
360 | .start = INT_SDMMC4, | ||
361 | .end = INT_SDMMC4, | ||
362 | .flags = IORESOURCE_IRQ, | ||
363 | }, | ||
364 | [1] = { | ||
365 | .start = TEGRA_SDMMC4_BASE, | ||
366 | .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1, | ||
367 | .flags = IORESOURCE_MEM, | ||
368 | }, | ||
369 | }; | ||
370 | |||
371 | /* board files should fill in platform_data register the devices themselvs. | ||
372 | * See board-harmony.c for an example | ||
373 | */ | ||
374 | struct platform_device tegra_sdhci_device1 = { | ||
375 | .name = "sdhci-tegra", | ||
376 | .id = 0, | ||
377 | .resource = sdhci_resource1, | ||
378 | .num_resources = ARRAY_SIZE(sdhci_resource1), | ||
379 | }; | ||
380 | |||
381 | struct platform_device tegra_sdhci_device2 = { | ||
382 | .name = "sdhci-tegra", | ||
383 | .id = 1, | ||
384 | .resource = sdhci_resource2, | ||
385 | .num_resources = ARRAY_SIZE(sdhci_resource2), | ||
386 | }; | ||
387 | |||
388 | struct platform_device tegra_sdhci_device3 = { | ||
389 | .name = "sdhci-tegra", | ||
390 | .id = 2, | ||
391 | .resource = sdhci_resource3, | ||
392 | .num_resources = ARRAY_SIZE(sdhci_resource3), | ||
393 | }; | ||
394 | |||
395 | struct platform_device tegra_sdhci_device4 = { | ||
396 | .name = "sdhci-tegra", | ||
397 | .id = 3, | ||
398 | .resource = sdhci_resource4, | ||
399 | .num_resources = ARRAY_SIZE(sdhci_resource4), | ||
400 | }; | ||
401 | |||
402 | static struct resource tegra_usb1_resources[] = { | ||
403 | [0] = { | ||
404 | .start = TEGRA_USB_BASE, | ||
405 | .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1, | ||
406 | .flags = IORESOURCE_MEM, | ||
407 | }, | ||
408 | [1] = { | ||
409 | .start = INT_USB, | ||
410 | .end = INT_USB, | ||
411 | .flags = IORESOURCE_IRQ, | ||
412 | }, | ||
413 | }; | ||
414 | |||
415 | static struct resource tegra_usb2_resources[] = { | ||
416 | [0] = { | ||
417 | .start = TEGRA_USB2_BASE, | ||
418 | .end = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1, | ||
419 | .flags = IORESOURCE_MEM, | ||
420 | }, | ||
421 | [1] = { | ||
422 | .start = INT_USB2, | ||
423 | .end = INT_USB2, | ||
424 | .flags = IORESOURCE_IRQ, | ||
425 | }, | ||
426 | }; | ||
427 | |||
428 | static struct resource tegra_usb3_resources[] = { | ||
429 | [0] = { | ||
430 | .start = TEGRA_USB3_BASE, | ||
431 | .end = TEGRA_USB3_BASE + TEGRA_USB3_SIZE - 1, | ||
432 | .flags = IORESOURCE_MEM, | ||
433 | }, | ||
434 | [1] = { | ||
435 | .start = INT_USB3, | ||
436 | .end = INT_USB3, | ||
437 | .flags = IORESOURCE_IRQ, | ||
438 | }, | ||
439 | }; | ||
440 | |||
441 | struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = { | ||
442 | .reset_gpio = -1, | ||
443 | .clk = "cdev2", | ||
444 | }; | ||
445 | |||
446 | struct tegra_ehci_platform_data tegra_ehci1_pdata = { | ||
447 | .operating_mode = TEGRA_USB_OTG, | ||
448 | .power_down_on_bus_suspend = 1, | ||
449 | .vbus_gpio = -1, | ||
450 | }; | ||
451 | |||
452 | struct tegra_ehci_platform_data tegra_ehci2_pdata = { | ||
453 | .phy_config = &tegra_ehci2_ulpi_phy_config, | ||
454 | .operating_mode = TEGRA_USB_HOST, | ||
455 | .power_down_on_bus_suspend = 1, | ||
456 | .vbus_gpio = -1, | ||
457 | }; | ||
458 | |||
459 | struct tegra_ehci_platform_data tegra_ehci3_pdata = { | ||
460 | .operating_mode = TEGRA_USB_HOST, | ||
461 | .power_down_on_bus_suspend = 1, | ||
462 | .vbus_gpio = -1, | ||
463 | }; | ||
464 | |||
465 | static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32); | ||
466 | |||
467 | struct platform_device tegra_ehci1_device = { | ||
468 | .name = "tegra-ehci", | ||
469 | .id = 0, | ||
470 | .dev = { | ||
471 | .dma_mask = &tegra_ehci_dmamask, | ||
472 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
473 | .platform_data = &tegra_ehci1_pdata, | ||
474 | }, | ||
475 | .resource = tegra_usb1_resources, | ||
476 | .num_resources = ARRAY_SIZE(tegra_usb1_resources), | ||
477 | }; | ||
478 | |||
479 | struct platform_device tegra_ehci2_device = { | ||
480 | .name = "tegra-ehci", | ||
481 | .id = 1, | ||
482 | .dev = { | ||
483 | .dma_mask = &tegra_ehci_dmamask, | ||
484 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
485 | .platform_data = &tegra_ehci2_pdata, | ||
486 | }, | ||
487 | .resource = tegra_usb2_resources, | ||
488 | .num_resources = ARRAY_SIZE(tegra_usb2_resources), | ||
489 | }; | ||
490 | |||
491 | struct platform_device tegra_ehci3_device = { | ||
492 | .name = "tegra-ehci", | ||
493 | .id = 2, | ||
494 | .dev = { | ||
495 | .dma_mask = &tegra_ehci_dmamask, | ||
496 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
497 | .platform_data = &tegra_ehci3_pdata, | ||
498 | }, | ||
499 | .resource = tegra_usb3_resources, | ||
500 | .num_resources = ARRAY_SIZE(tegra_usb3_resources), | ||
501 | }; | ||
502 | |||
503 | static struct resource tegra_pmu_resources[] = { | ||
504 | [0] = { | ||
505 | .start = INT_CPU0_PMU_INTR, | ||
506 | .end = INT_CPU0_PMU_INTR, | ||
507 | .flags = IORESOURCE_IRQ, | ||
508 | }, | ||
509 | [1] = { | ||
510 | .start = INT_CPU1_PMU_INTR, | ||
511 | .end = INT_CPU1_PMU_INTR, | ||
512 | .flags = IORESOURCE_IRQ, | ||
513 | }, | ||
514 | }; | ||
515 | |||
516 | struct platform_device tegra_pmu_device = { | ||
517 | .name = "arm-pmu", | ||
518 | .id = -1, | ||
519 | .num_resources = ARRAY_SIZE(tegra_pmu_resources), | ||
520 | .resource = tegra_pmu_resources, | ||
521 | }; | ||
522 | |||
523 | static struct resource tegra_uarta_resources[] = { | ||
524 | [0] = { | ||
525 | .start = TEGRA_UARTA_BASE, | ||
526 | .end = TEGRA_UARTA_BASE + TEGRA_UARTA_SIZE - 1, | ||
527 | .flags = IORESOURCE_MEM, | ||
528 | }, | ||
529 | [1] = { | ||
530 | .start = INT_UARTA, | ||
531 | .end = INT_UARTA, | ||
532 | .flags = IORESOURCE_IRQ, | ||
533 | }, | ||
534 | }; | ||
535 | |||
536 | static struct resource tegra_uartb_resources[] = { | ||
537 | [0] = { | ||
538 | .start = TEGRA_UARTB_BASE, | ||
539 | .end = TEGRA_UARTB_BASE + TEGRA_UARTB_SIZE - 1, | ||
540 | .flags = IORESOURCE_MEM, | ||
541 | }, | ||
542 | [1] = { | ||
543 | .start = INT_UARTB, | ||
544 | .end = INT_UARTB, | ||
545 | .flags = IORESOURCE_IRQ, | ||
546 | }, | ||
547 | }; | ||
548 | |||
549 | static struct resource tegra_uartc_resources[] = { | ||
550 | [0] = { | ||
551 | .start = TEGRA_UARTC_BASE, | ||
552 | .end = TEGRA_UARTC_BASE + TEGRA_UARTC_SIZE - 1, | ||
553 | .flags = IORESOURCE_MEM, | ||
554 | }, | ||
555 | [1] = { | ||
556 | .start = INT_UARTC, | ||
557 | .end = INT_UARTC, | ||
558 | .flags = IORESOURCE_IRQ, | ||
559 | }, | ||
560 | }; | ||
561 | |||
562 | static struct resource tegra_uartd_resources[] = { | ||
563 | [0] = { | ||
564 | .start = TEGRA_UARTD_BASE, | ||
565 | .end = TEGRA_UARTD_BASE + TEGRA_UARTD_SIZE - 1, | ||
566 | .flags = IORESOURCE_MEM, | ||
567 | }, | ||
568 | [1] = { | ||
569 | .start = INT_UARTD, | ||
570 | .end = INT_UARTD, | ||
571 | .flags = IORESOURCE_IRQ, | ||
572 | }, | ||
573 | }; | ||
574 | |||
575 | static struct resource tegra_uarte_resources[] = { | ||
576 | [0] = { | ||
577 | .start = TEGRA_UARTE_BASE, | ||
578 | .end = TEGRA_UARTE_BASE + TEGRA_UARTE_SIZE - 1, | ||
579 | .flags = IORESOURCE_MEM, | ||
580 | }, | ||
581 | [1] = { | ||
582 | .start = INT_UARTE, | ||
583 | .end = INT_UARTE, | ||
584 | .flags = IORESOURCE_IRQ, | ||
585 | }, | ||
586 | }; | ||
587 | |||
588 | struct platform_device tegra_uarta_device = { | ||
589 | .name = "tegra_uart", | ||
590 | .id = 0, | ||
591 | .num_resources = ARRAY_SIZE(tegra_uarta_resources), | ||
592 | .resource = tegra_uarta_resources, | ||
593 | .dev = { | ||
594 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
595 | }, | ||
596 | }; | ||
597 | |||
598 | struct platform_device tegra_uartb_device = { | ||
599 | .name = "tegra_uart", | ||
600 | .id = 1, | ||
601 | .num_resources = ARRAY_SIZE(tegra_uartb_resources), | ||
602 | .resource = tegra_uartb_resources, | ||
603 | .dev = { | ||
604 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
605 | }, | ||
606 | }; | ||
607 | |||
608 | struct platform_device tegra_uartc_device = { | ||
609 | .name = "tegra_uart", | ||
610 | .id = 2, | ||
611 | .num_resources = ARRAY_SIZE(tegra_uartc_resources), | ||
612 | .resource = tegra_uartc_resources, | ||
613 | .dev = { | ||
614 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
615 | }, | ||
616 | }; | ||
617 | |||
618 | struct platform_device tegra_uartd_device = { | ||
619 | .name = "tegra_uart", | ||
620 | .id = 3, | ||
621 | .num_resources = ARRAY_SIZE(tegra_uartd_resources), | ||
622 | .resource = tegra_uartd_resources, | ||
623 | .dev = { | ||
624 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
625 | }, | ||
626 | }; | ||
627 | |||
628 | struct platform_device tegra_uarte_device = { | ||
629 | .name = "tegra_uart", | ||
630 | .id = 4, | ||
631 | .num_resources = ARRAY_SIZE(tegra_uarte_resources), | ||
632 | .resource = tegra_uarte_resources, | ||
633 | .dev = { | ||
634 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
635 | }, | ||
636 | }; | ||
637 | |||
638 | static struct resource i2s_resource1[] = { | ||
639 | [0] = { | ||
640 | .start = INT_I2S1, | ||
641 | .end = INT_I2S1, | ||
642 | .flags = IORESOURCE_IRQ | ||
643 | }, | ||
644 | [1] = { | ||
645 | .start = TEGRA_DMA_REQ_SEL_I2S_1, | ||
646 | .end = TEGRA_DMA_REQ_SEL_I2S_1, | ||
647 | .flags = IORESOURCE_DMA | ||
648 | }, | ||
649 | [2] = { | ||
650 | .start = TEGRA_I2S1_BASE, | ||
651 | .end = TEGRA_I2S1_BASE + TEGRA_I2S1_SIZE - 1, | ||
652 | .flags = IORESOURCE_MEM | ||
653 | } | ||
654 | }; | ||
655 | |||
656 | static struct resource i2s_resource2[] = { | ||
657 | [0] = { | ||
658 | .start = INT_I2S2, | ||
659 | .end = INT_I2S2, | ||
660 | .flags = IORESOURCE_IRQ | ||
661 | }, | ||
662 | [1] = { | ||
663 | .start = TEGRA_DMA_REQ_SEL_I2S2_1, | ||
664 | .end = TEGRA_DMA_REQ_SEL_I2S2_1, | ||
665 | .flags = IORESOURCE_DMA | ||
666 | }, | ||
667 | [2] = { | ||
668 | .start = TEGRA_I2S2_BASE, | ||
669 | .end = TEGRA_I2S2_BASE + TEGRA_I2S2_SIZE - 1, | ||
670 | .flags = IORESOURCE_MEM | ||
671 | } | ||
672 | }; | ||
673 | |||
674 | struct platform_device tegra_i2s_device1 = { | ||
675 | .name = "tegra20-i2s", | ||
676 | .id = 0, | ||
677 | .resource = i2s_resource1, | ||
678 | .num_resources = ARRAY_SIZE(i2s_resource1), | ||
679 | }; | ||
680 | |||
681 | struct platform_device tegra_i2s_device2 = { | ||
682 | .name = "tegra20-i2s", | ||
683 | .id = 1, | ||
684 | .resource = i2s_resource2, | ||
685 | .num_resources = ARRAY_SIZE(i2s_resource2), | ||
686 | }; | ||
687 | |||
688 | static struct resource tegra_das_resources[] = { | ||
689 | [0] = { | ||
690 | .start = TEGRA_APB_MISC_DAS_BASE, | ||
691 | .end = TEGRA_APB_MISC_DAS_BASE + TEGRA_APB_MISC_DAS_SIZE - 1, | ||
692 | .flags = IORESOURCE_MEM, | ||
693 | }, | ||
694 | }; | ||
695 | |||
696 | struct platform_device tegra_das_device = { | ||
697 | .name = "tegra20-das", | ||
698 | .id = -1, | ||
699 | .num_resources = ARRAY_SIZE(tegra_das_resources), | ||
700 | .resource = tegra_das_resources, | ||
701 | }; | ||
diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h deleted file mode 100644 index 4f5052726495..000000000000 --- a/arch/arm/mach-tegra/devices.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010,2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * Erik Gilling <ccross@android.com> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __MACH_TEGRA_DEVICES_H | ||
20 | #define __MACH_TEGRA_DEVICES_H | ||
21 | |||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/platform_data/tegra_usb.h> | ||
24 | |||
25 | #include <mach/usb_phy.h> | ||
26 | |||
27 | extern struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config; | ||
28 | |||
29 | extern struct tegra_ehci_platform_data tegra_ehci1_pdata; | ||
30 | extern struct tegra_ehci_platform_data tegra_ehci2_pdata; | ||
31 | extern struct tegra_ehci_platform_data tegra_ehci3_pdata; | ||
32 | |||
33 | extern struct platform_device tegra_gpio_device; | ||
34 | extern struct platform_device tegra_pinmux_device; | ||
35 | extern struct platform_device tegra_sdhci_device1; | ||
36 | extern struct platform_device tegra_sdhci_device2; | ||
37 | extern struct platform_device tegra_sdhci_device3; | ||
38 | extern struct platform_device tegra_sdhci_device4; | ||
39 | extern struct platform_device tegra_i2c_device1; | ||
40 | extern struct platform_device tegra_i2c_device2; | ||
41 | extern struct platform_device tegra_i2c_device3; | ||
42 | extern struct platform_device tegra_i2c_device4; | ||
43 | extern struct platform_device tegra_spi_device1; | ||
44 | extern struct platform_device tegra_spi_device2; | ||
45 | extern struct platform_device tegra_spi_device3; | ||
46 | extern struct platform_device tegra_spi_device4; | ||
47 | extern struct platform_device tegra_ehci1_device; | ||
48 | extern struct platform_device tegra_ehci2_device; | ||
49 | extern struct platform_device tegra_ehci3_device; | ||
50 | extern struct platform_device tegra_uarta_device; | ||
51 | extern struct platform_device tegra_uartb_device; | ||
52 | extern struct platform_device tegra_uartc_device; | ||
53 | extern struct platform_device tegra_uartd_device; | ||
54 | extern struct platform_device tegra_uarte_device; | ||
55 | extern struct platform_device tegra_pmu_device; | ||
56 | extern struct platform_device tegra_i2s_device1; | ||
57 | extern struct platform_device tegra_i2s_device2; | ||
58 | extern struct platform_device tegra_das_device; | ||
59 | |||
60 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h deleted file mode 100644 index a13025612939..000000000000 --- a/arch/arm/mach-tegra/include/mach/kbc.h +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | /* | ||
2 | * Platform definitions for tegra-kbc keyboard input driver | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License 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, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef ASMARM_ARCH_TEGRA_KBC_H | ||
22 | #define ASMARM_ARCH_TEGRA_KBC_H | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | #include <linux/input/matrix_keypad.h> | ||
26 | |||
27 | #define KBC_MAX_GPIO 24 | ||
28 | #define KBC_MAX_KPENT 8 | ||
29 | |||
30 | #define KBC_MAX_ROW 16 | ||
31 | #define KBC_MAX_COL 8 | ||
32 | #define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL) | ||
33 | |||
34 | enum tegra_pin_type { | ||
35 | PIN_CFG_IGNORE, | ||
36 | PIN_CFG_COL, | ||
37 | PIN_CFG_ROW, | ||
38 | }; | ||
39 | |||
40 | struct tegra_kbc_pin_cfg { | ||
41 | enum tegra_pin_type type; | ||
42 | unsigned char num; | ||
43 | }; | ||
44 | |||
45 | struct tegra_kbc_wake_key { | ||
46 | u8 row:4; | ||
47 | u8 col:4; | ||
48 | }; | ||
49 | |||
50 | struct tegra_kbc_platform_data { | ||
51 | unsigned int debounce_cnt; | ||
52 | unsigned int repeat_cnt; | ||
53 | |||
54 | struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO]; | ||
55 | const struct matrix_keymap_data *keymap_data; | ||
56 | |||
57 | u32 wakeup_key; | ||
58 | bool wakeup; | ||
59 | bool use_fn_map; | ||
60 | bool use_ghost_filter; | ||
61 | }; | ||
62 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h deleted file mode 100644 index 1f24d304921e..000000000000 --- a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | /* | ||
2 | * pinctrl configuration definitions for the NVIDIA Tegra pinmux | ||
3 | * | ||
4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __PINCONF_TEGRA_H__ | ||
17 | #define __PINCONF_TEGRA_H__ | ||
18 | |||
19 | enum tegra_pinconf_param { | ||
20 | /* argument: tegra_pinconf_pull */ | ||
21 | TEGRA_PINCONF_PARAM_PULL, | ||
22 | /* argument: tegra_pinconf_tristate */ | ||
23 | TEGRA_PINCONF_PARAM_TRISTATE, | ||
24 | /* argument: Boolean */ | ||
25 | TEGRA_PINCONF_PARAM_ENABLE_INPUT, | ||
26 | /* argument: Boolean */ | ||
27 | TEGRA_PINCONF_PARAM_OPEN_DRAIN, | ||
28 | /* argument: Boolean */ | ||
29 | TEGRA_PINCONF_PARAM_LOCK, | ||
30 | /* argument: Boolean */ | ||
31 | TEGRA_PINCONF_PARAM_IORESET, | ||
32 | /* argument: Boolean */ | ||
33 | TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE, | ||
34 | /* argument: Boolean */ | ||
35 | TEGRA_PINCONF_PARAM_SCHMITT, | ||
36 | /* argument: Boolean */ | ||
37 | TEGRA_PINCONF_PARAM_LOW_POWER_MODE, | ||
38 | /* argument: Integer, range is HW-dependant */ | ||
39 | TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH, | ||
40 | /* argument: Integer, range is HW-dependant */ | ||
41 | TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH, | ||
42 | /* argument: Integer, range is HW-dependant */ | ||
43 | TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING, | ||
44 | /* argument: Integer, range is HW-dependant */ | ||
45 | TEGRA_PINCONF_PARAM_SLEW_RATE_RISING, | ||
46 | }; | ||
47 | |||
48 | enum tegra_pinconf_pull { | ||
49 | TEGRA_PINCONFIG_PULL_NONE, | ||
50 | TEGRA_PINCONFIG_PULL_DOWN, | ||
51 | TEGRA_PINCONFIG_PULL_UP, | ||
52 | }; | ||
53 | |||
54 | enum tegra_pinconf_tristate { | ||
55 | TEGRA_PINCONFIG_DRIVEN, | ||
56 | TEGRA_PINCONFIG_TRISTATE, | ||
57 | }; | ||
58 | |||
59 | #define TEGRA_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_)) | ||
60 | #define TEGRA_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16) | ||
61 | #define TEGRA_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff) | ||
62 | |||
63 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/suspend.h b/arch/arm/mach-tegra/include/mach/suspend.h deleted file mode 100644 index 5af8715d2e1e..000000000000 --- a/arch/arm/mach-tegra/include/mach/suspend.h +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/include/mach/suspend.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * | ||
6 | * Author: | ||
7 | * Colin Cross <ccross@google.com> | ||
8 | * | ||
9 | * This software is licensed under the terms of the GNU General Public | ||
10 | * License version 2, as published by the Free Software Foundation, and | ||
11 | * may be copied, distributed, and modified under those terms. | ||
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 | |||
20 | |||
21 | #ifndef _MACH_TEGRA_SUSPEND_H_ | ||
22 | #define _MACH_TEGRA_SUSPEND_H_ | ||
23 | |||
24 | void tegra_pinmux_suspend(void); | ||
25 | void tegra_irq_suspend(void); | ||
26 | void tegra_gpio_suspend(void); | ||
27 | void tegra_clk_suspend(void); | ||
28 | void tegra_dma_suspend(void); | ||
29 | void tegra_timer_suspend(void); | ||
30 | |||
31 | void tegra_pinmux_resume(void); | ||
32 | void tegra_irq_resume(void); | ||
33 | void tegra_gpio_resume(void); | ||
34 | void tegra_clk_resume(void); | ||
35 | void tegra_dma_resume(void); | ||
36 | void tegra_timer_resume(void); | ||
37 | |||
38 | #endif /* _MACH_TEGRA_SUSPEND_H_ */ | ||
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h deleted file mode 100644 index 935ce9f65590..000000000000 --- a/arch/arm/mach-tegra/include/mach/usb_phy.h +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/include/mach/usb_phy.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
16 | |||
17 | #ifndef __MACH_USB_PHY_H | ||
18 | #define __MACH_USB_PHY_H | ||
19 | |||
20 | #include <linux/clk.h> | ||
21 | #include <linux/usb/otg.h> | ||
22 | |||
23 | struct tegra_utmip_config { | ||
24 | u8 hssync_start_delay; | ||
25 | u8 elastic_limit; | ||
26 | u8 idle_wait_delay; | ||
27 | u8 term_range_adj; | ||
28 | u8 xcvr_setup; | ||
29 | u8 xcvr_lsfslew; | ||
30 | u8 xcvr_lsrslew; | ||
31 | }; | ||
32 | |||
33 | struct tegra_ulpi_config { | ||
34 | int reset_gpio; | ||
35 | const char *clk; | ||
36 | }; | ||
37 | |||
38 | enum tegra_usb_phy_port_speed { | ||
39 | TEGRA_USB_PHY_PORT_SPEED_FULL = 0, | ||
40 | TEGRA_USB_PHY_PORT_SPEED_LOW, | ||
41 | TEGRA_USB_PHY_PORT_SPEED_HIGH, | ||
42 | }; | ||
43 | |||
44 | enum tegra_usb_phy_mode { | ||
45 | TEGRA_USB_PHY_MODE_DEVICE, | ||
46 | TEGRA_USB_PHY_MODE_HOST, | ||
47 | }; | ||
48 | |||
49 | struct tegra_xtal_freq; | ||
50 | |||
51 | struct tegra_usb_phy { | ||
52 | int instance; | ||
53 | const struct tegra_xtal_freq *freq; | ||
54 | void __iomem *regs; | ||
55 | void __iomem *pad_regs; | ||
56 | struct clk *clk; | ||
57 | struct clk *pll_u; | ||
58 | struct clk *pad_clk; | ||
59 | enum tegra_usb_phy_mode mode; | ||
60 | void *config; | ||
61 | struct usb_phy *ulpi; | ||
62 | }; | ||
63 | |||
64 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | ||
65 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); | ||
66 | |||
67 | int tegra_usb_phy_power_on(struct tegra_usb_phy *phy); | ||
68 | |||
69 | void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy); | ||
70 | |||
71 | void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy); | ||
72 | |||
73 | void tegra_usb_phy_power_off(struct tegra_usb_phy *phy); | ||
74 | |||
75 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy); | ||
76 | |||
77 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy); | ||
78 | |||
79 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | ||
80 | enum tegra_usb_phy_port_speed port_speed); | ||
81 | |||
82 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy); | ||
83 | |||
84 | void tegra_usb_phy_close(struct tegra_usb_phy *phy); | ||
85 | |||
86 | #endif /* __MACH_USB_PHY_H */ | ||
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c index 3463fb5b79c7..a8dba6489c9b 100644 --- a/arch/arm/mach-tegra/pcie.c +++ b/arch/arm/mach-tegra/pcie.c | |||
@@ -352,17 +352,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class); | |||
352 | /* Tegra PCIE requires relaxed ordering */ | 352 | /* Tegra PCIE requires relaxed ordering */ |
353 | static void __devinit tegra_pcie_relax_enable(struct pci_dev *dev) | 353 | static void __devinit tegra_pcie_relax_enable(struct pci_dev *dev) |
354 | { | 354 | { |
355 | u16 val16; | 355 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN); |
356 | int pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
357 | |||
358 | if (pos <= 0) { | ||
359 | dev_err(&dev->dev, "skipping relaxed ordering fixup\n"); | ||
360 | return; | ||
361 | } | ||
362 | |||
363 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &val16); | ||
364 | val16 |= PCI_EXP_DEVCTL_RELAX_EN; | ||
365 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, val16); | ||
366 | } | 356 | } |
367 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_relax_enable); | 357 | DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_relax_enable); |
368 | 358 | ||
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c index 15d506501ccc..de0662de28a0 100644 --- a/arch/arm/mach-tegra/powergate.c +++ b/arch/arm/mach-tegra/powergate.c | |||
@@ -199,7 +199,9 @@ int __init tegra_powergate_init(void) | |||
199 | 199 | ||
200 | #ifdef CONFIG_DEBUG_FS | 200 | #ifdef CONFIG_DEBUG_FS |
201 | 201 | ||
202 | static const char * const powergate_name[] = { | 202 | static const char * const *powergate_name; |
203 | |||
204 | static const char * const powergate_name_t20[] = { | ||
203 | [TEGRA_POWERGATE_CPU] = "cpu", | 205 | [TEGRA_POWERGATE_CPU] = "cpu", |
204 | [TEGRA_POWERGATE_3D] = "3d", | 206 | [TEGRA_POWERGATE_3D] = "3d", |
205 | [TEGRA_POWERGATE_VENC] = "venc", | 207 | [TEGRA_POWERGATE_VENC] = "venc", |
@@ -209,6 +211,23 @@ static const char * const powergate_name[] = { | |||
209 | [TEGRA_POWERGATE_MPE] = "mpe", | 211 | [TEGRA_POWERGATE_MPE] = "mpe", |
210 | }; | 212 | }; |
211 | 213 | ||
214 | static const char * const powergate_name_t30[] = { | ||
215 | [TEGRA_POWERGATE_CPU] = "cpu0", | ||
216 | [TEGRA_POWERGATE_3D] = "3d0", | ||
217 | [TEGRA_POWERGATE_VENC] = "venc", | ||
218 | [TEGRA_POWERGATE_VDEC] = "vdec", | ||
219 | [TEGRA_POWERGATE_PCIE] = "pcie", | ||
220 | [TEGRA_POWERGATE_L2] = "l2", | ||
221 | [TEGRA_POWERGATE_MPE] = "mpe", | ||
222 | [TEGRA_POWERGATE_HEG] = "heg", | ||
223 | [TEGRA_POWERGATE_SATA] = "sata", | ||
224 | [TEGRA_POWERGATE_CPU1] = "cpu1", | ||
225 | [TEGRA_POWERGATE_CPU2] = "cpu2", | ||
226 | [TEGRA_POWERGATE_CPU3] = "cpu3", | ||
227 | [TEGRA_POWERGATE_CELP] = "celp", | ||
228 | [TEGRA_POWERGATE_3D1] = "3d1", | ||
229 | }; | ||
230 | |||
212 | static int powergate_show(struct seq_file *s, void *data) | 231 | static int powergate_show(struct seq_file *s, void *data) |
213 | { | 232 | { |
214 | int i; | 233 | int i; |
@@ -237,14 +256,24 @@ static const struct file_operations powergate_fops = { | |||
237 | int __init tegra_powergate_debugfs_init(void) | 256 | int __init tegra_powergate_debugfs_init(void) |
238 | { | 257 | { |
239 | struct dentry *d; | 258 | struct dentry *d; |
240 | int err = -ENOMEM; | ||
241 | 259 | ||
242 | d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL, | 260 | switch (tegra_chip_id) { |
243 | &powergate_fops); | 261 | case TEGRA20: |
244 | if (!d) | 262 | powergate_name = powergate_name_t20; |
245 | return -ENOMEM; | 263 | break; |
264 | case TEGRA30: | ||
265 | powergate_name = powergate_name_t30; | ||
266 | break; | ||
267 | } | ||
268 | |||
269 | if (powergate_name) { | ||
270 | d = debugfs_create_file("powergate", S_IRUGO, NULL, NULL, | ||
271 | &powergate_fops); | ||
272 | if (!d) | ||
273 | return -ENOMEM; | ||
274 | } | ||
246 | 275 | ||
247 | return err; | 276 | return 0; |
248 | } | 277 | } |
249 | 278 | ||
250 | #endif | 279 | #endif |
diff --git a/arch/arm/mach-tegra/tegra20_clocks.c b/arch/arm/mach-tegra/tegra20_clocks.c index 9273b0dffc66..deb873fb12b6 100644 --- a/arch/arm/mach-tegra/tegra20_clocks.c +++ b/arch/arm/mach-tegra/tegra20_clocks.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | 29 | ||
30 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
31 | #include <mach/suspend.h> | ||
32 | 31 | ||
33 | #include "clock.h" | 32 | #include "clock.h" |
34 | #include "fuse.h" | 33 | #include "fuse.h" |
diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c index e81dcd239c95..cc9b5fd8c3d3 100644 --- a/arch/arm/mach-tegra/tegra20_clocks_data.c +++ b/arch/arm/mach-tegra/tegra20_clocks_data.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
29 | 29 | ||
30 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
31 | #include <mach/suspend.h> | ||
32 | 31 | ||
33 | #include "clock.h" | 32 | #include "clock.h" |
34 | #include "fuse.h" | 33 | #include "fuse.h" |
@@ -918,14 +917,10 @@ PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | |||
918 | PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); | 917 | PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); |
919 | PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 92000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ | 918 | PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 92000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ |
920 | PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */ | 919 | PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* scales with voltage */ |
921 | PERIPH_CLK(i2c1, "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); | 920 | PERIPH_CLK(i2c1, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); |
922 | PERIPH_CLK(i2c2, "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); | 921 | PERIPH_CLK(i2c2, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); |
923 | PERIPH_CLK(i2c3, "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); | 922 | PERIPH_CLK(i2c3, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); |
924 | PERIPH_CLK(dvc, "tegra-i2c.3", NULL, 47, 0x128, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); | 923 | PERIPH_CLK(dvc, "tegra-i2c.3", "div-clk", 47, 0x128, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U16); |
925 | PERIPH_CLK(i2c1_i2c, "tegra-i2c.0", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
926 | PERIPH_CLK(i2c2_i2c, "tegra-i2c.1", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
927 | PERIPH_CLK(i2c3_i2c, "tegra-i2c.2", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
928 | PERIPH_CLK(dvc_i2c, "tegra-i2c.3", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
929 | PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 600000000, mux_pllp_pllc_pllm_clkm, MUX); | 924 | PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 600000000, mux_pllp_pllc_pllm_clkm, MUX); |
930 | PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 600000000, mux_pllp_pllc_pllm_clkm, MUX); | 925 | PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 600000000, mux_pllp_pllc_pllm_clkm, MUX); |
931 | PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 600000000, mux_pllp_pllc_pllm_clkm, MUX); | 926 | PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 600000000, mux_pllp_pllc_pllm_clkm, MUX); |
@@ -990,10 +985,6 @@ static struct clk *tegra_list_clks[] = { | |||
990 | &tegra_i2c2, | 985 | &tegra_i2c2, |
991 | &tegra_i2c3, | 986 | &tegra_i2c3, |
992 | &tegra_dvc, | 987 | &tegra_dvc, |
993 | &tegra_i2c1_i2c, | ||
994 | &tegra_i2c2_i2c, | ||
995 | &tegra_i2c3_i2c, | ||
996 | &tegra_dvc_i2c, | ||
997 | &tegra_uarta, | 988 | &tegra_uarta, |
998 | &tegra_uartb, | 989 | &tegra_uartb, |
999 | &tegra_uartc, | 990 | &tegra_uartc, |
@@ -1057,6 +1048,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = { | |||
1057 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), | 1048 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), |
1058 | CLK_DUPLICATE("cclk", NULL, "cpu"), | 1049 | CLK_DUPLICATE("cclk", NULL, "cpu"), |
1059 | CLK_DUPLICATE("twd", "smp_twd", NULL), | 1050 | CLK_DUPLICATE("twd", "smp_twd", NULL), |
1051 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"), | ||
1052 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"), | ||
1053 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"), | ||
1054 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"), | ||
1060 | }; | 1055 | }; |
1061 | 1056 | ||
1062 | #define CLK(dev, con, ck) \ | 1057 | #define CLK(dev, con, ck) \ |
diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c b/arch/arm/mach-tegra/tegra30_clocks_data.c index c10449603df0..d92cb556ae35 100644 --- a/arch/arm/mach-tegra/tegra30_clocks_data.c +++ b/arch/arm/mach-tegra/tegra30_clocks_data.c | |||
@@ -1071,11 +1071,11 @@ PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | |||
1071 | PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); | 1071 | PERIPH_CLK(owr, "tegra_w1", NULL, 71, 0x1cc, 26000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); |
1072 | PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ | 1072 | PERIPH_CLK(nor, "nor", NULL, 42, 0x1d0, 127000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71); /* requires min voltage */ |
1073 | PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); /* scales with voltage */ | 1073 | PERIPH_CLK(mipi, "mipi", NULL, 50, 0x174, 60000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | PERIPH_ON_APB); /* scales with voltage */ |
1074 | PERIPH_CLK(i2c1, "tegra-i2c.0", NULL, 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); | 1074 | PERIPH_CLK(i2c1, "tegra-i2c.0", "div-clk", 12, 0x124, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); |
1075 | PERIPH_CLK(i2c2, "tegra-i2c.1", NULL, 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); | 1075 | PERIPH_CLK(i2c2, "tegra-i2c.1", "div-clk", 54, 0x198, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); |
1076 | PERIPH_CLK(i2c3, "tegra-i2c.2", NULL, 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); | 1076 | PERIPH_CLK(i2c3, "tegra-i2c.2", "div-clk", 67, 0x1b8, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); |
1077 | PERIPH_CLK(i2c4, "tegra-i2c.3", NULL, 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); | 1077 | PERIPH_CLK(i2c4, "tegra-i2c.3", "div-clk", 103, 0x3c4, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); |
1078 | PERIPH_CLK(i2c5, "tegra-i2c.4", NULL, 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); | 1078 | PERIPH_CLK(i2c5, "tegra-i2c.4", "div-clk", 47, 0x128, 26000000, mux_pllp_clkm, MUX | DIV_U16 | PERIPH_ON_APB); |
1079 | PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); | 1079 | PERIPH_CLK(uarta, "tegra-uart.0", NULL, 6, 0x178, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); |
1080 | PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); | 1080 | PERIPH_CLK(uartb, "tegra-uart.1", NULL, 7, 0x17c, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); |
1081 | PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); | 1081 | PERIPH_CLK(uartc, "tegra-uart.2", NULL, 55, 0x1a0, 800000000, mux_pllp_pllc_pllm_clkm, MUX | DIV_U71 | DIV_U71_UART | PERIPH_ON_APB); |
@@ -1287,6 +1287,11 @@ struct clk_duplicate tegra_clk_duplicates[] = { | |||
1287 | CLK_DUPLICATE("dam1", NULL, "dam1"), | 1287 | CLK_DUPLICATE("dam1", NULL, "dam1"), |
1288 | CLK_DUPLICATE("dam2", NULL, "dam2"), | 1288 | CLK_DUPLICATE("dam2", NULL, "dam2"), |
1289 | CLK_DUPLICATE("spdif_in", NULL, "spdif_in"), | 1289 | CLK_DUPLICATE("spdif_in", NULL, "spdif_in"), |
1290 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.0", "fast-clk"), | ||
1291 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.1", "fast-clk"), | ||
1292 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.2", "fast-clk"), | ||
1293 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.3", "fast-clk"), | ||
1294 | CLK_DUPLICATE("pll_p_out3", "tegra-i2c.4", "fast-clk"), | ||
1290 | }; | 1295 | }; |
1291 | 1296 | ||
1292 | struct clk *tegra_ptr_clks[] = { | 1297 | struct clk *tegra_ptr_clks[] = { |
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c index 57b5bdc13b9b..eccdce983043 100644 --- a/arch/arm/mach-tegra/timer.c +++ b/arch/arm/mach-tegra/timer.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <mach/iomap.h> | 34 | #include <mach/iomap.h> |
35 | #include <mach/irqs.h> | 35 | #include <mach/irqs.h> |
36 | #include <mach/suspend.h> | ||
37 | 36 | ||
38 | #include "board.h" | 37 | #include "board.h" |
39 | #include "clock.h" | 38 | #include "clock.h" |
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c deleted file mode 100644 index 022b33a05c3a..000000000000 --- a/arch/arm/mach-tegra/usb_phy.c +++ /dev/null | |||
@@ -1,817 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/usb_phy.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * | ||
6 | * Author: | ||
7 | * Erik Gilling <konkers@google.com> | ||
8 | * Benoit Goby <benoit@android.com> | ||
9 | * | ||
10 | * This software is licensed under the terms of the GNU General Public | ||
11 | * License version 2, as published by the Free Software Foundation, and | ||
12 | * may be copied, distributed, and modified under those terms. | ||
13 | * | ||
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 | */ | ||
20 | |||
21 | #include <linux/resource.h> | ||
22 | #include <linux/delay.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/err.h> | ||
25 | #include <linux/export.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/io.h> | ||
28 | #include <linux/gpio.h> | ||
29 | #include <linux/of_gpio.h> | ||
30 | #include <linux/usb/otg.h> | ||
31 | #include <linux/usb/ulpi.h> | ||
32 | #include <asm/mach-types.h> | ||
33 | #include <mach/gpio-tegra.h> | ||
34 | #include <mach/usb_phy.h> | ||
35 | #include <mach/iomap.h> | ||
36 | |||
37 | #define ULPI_VIEWPORT 0x170 | ||
38 | |||
39 | #define USB_PORTSC1 0x184 | ||
40 | #define USB_PORTSC1_PTS(x) (((x) & 0x3) << 30) | ||
41 | #define USB_PORTSC1_PSPD(x) (((x) & 0x3) << 26) | ||
42 | #define USB_PORTSC1_PHCD (1 << 23) | ||
43 | #define USB_PORTSC1_WKOC (1 << 22) | ||
44 | #define USB_PORTSC1_WKDS (1 << 21) | ||
45 | #define USB_PORTSC1_WKCN (1 << 20) | ||
46 | #define USB_PORTSC1_PTC(x) (((x) & 0xf) << 16) | ||
47 | #define USB_PORTSC1_PP (1 << 12) | ||
48 | #define USB_PORTSC1_SUSP (1 << 7) | ||
49 | #define USB_PORTSC1_PE (1 << 2) | ||
50 | #define USB_PORTSC1_CCS (1 << 0) | ||
51 | |||
52 | #define USB_SUSP_CTRL 0x400 | ||
53 | #define USB_WAKE_ON_CNNT_EN_DEV (1 << 3) | ||
54 | #define USB_WAKE_ON_DISCON_EN_DEV (1 << 4) | ||
55 | #define USB_SUSP_CLR (1 << 5) | ||
56 | #define USB_PHY_CLK_VALID (1 << 7) | ||
57 | #define UTMIP_RESET (1 << 11) | ||
58 | #define UHSIC_RESET (1 << 11) | ||
59 | #define UTMIP_PHY_ENABLE (1 << 12) | ||
60 | #define ULPI_PHY_ENABLE (1 << 13) | ||
61 | #define USB_SUSP_SET (1 << 14) | ||
62 | #define USB_WAKEUP_DEBOUNCE_COUNT(x) (((x) & 0x7) << 16) | ||
63 | |||
64 | #define USB1_LEGACY_CTRL 0x410 | ||
65 | #define USB1_NO_LEGACY_MODE (1 << 0) | ||
66 | #define USB1_VBUS_SENSE_CTL_MASK (3 << 1) | ||
67 | #define USB1_VBUS_SENSE_CTL_VBUS_WAKEUP (0 << 1) | ||
68 | #define USB1_VBUS_SENSE_CTL_AB_SESS_VLD_OR_VBUS_WAKEUP \ | ||
69 | (1 << 1) | ||
70 | #define USB1_VBUS_SENSE_CTL_AB_SESS_VLD (2 << 1) | ||
71 | #define USB1_VBUS_SENSE_CTL_A_SESS_VLD (3 << 1) | ||
72 | |||
73 | #define ULPI_TIMING_CTRL_0 0x424 | ||
74 | #define ULPI_OUTPUT_PINMUX_BYP (1 << 10) | ||
75 | #define ULPI_CLKOUT_PINMUX_BYP (1 << 11) | ||
76 | |||
77 | #define ULPI_TIMING_CTRL_1 0x428 | ||
78 | #define ULPI_DATA_TRIMMER_LOAD (1 << 0) | ||
79 | #define ULPI_DATA_TRIMMER_SEL(x) (((x) & 0x7) << 1) | ||
80 | #define ULPI_STPDIRNXT_TRIMMER_LOAD (1 << 16) | ||
81 | #define ULPI_STPDIRNXT_TRIMMER_SEL(x) (((x) & 0x7) << 17) | ||
82 | #define ULPI_DIR_TRIMMER_LOAD (1 << 24) | ||
83 | #define ULPI_DIR_TRIMMER_SEL(x) (((x) & 0x7) << 25) | ||
84 | |||
85 | #define UTMIP_PLL_CFG1 0x804 | ||
86 | #define UTMIP_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) | ||
87 | #define UTMIP_PLLU_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27) | ||
88 | |||
89 | #define UTMIP_XCVR_CFG0 0x808 | ||
90 | #define UTMIP_XCVR_SETUP(x) (((x) & 0xf) << 0) | ||
91 | #define UTMIP_XCVR_LSRSLEW(x) (((x) & 0x3) << 8) | ||
92 | #define UTMIP_XCVR_LSFSLEW(x) (((x) & 0x3) << 10) | ||
93 | #define UTMIP_FORCE_PD_POWERDOWN (1 << 14) | ||
94 | #define UTMIP_FORCE_PD2_POWERDOWN (1 << 16) | ||
95 | #define UTMIP_FORCE_PDZI_POWERDOWN (1 << 18) | ||
96 | #define UTMIP_XCVR_HSSLEW_MSB(x) (((x) & 0x7f) << 25) | ||
97 | |||
98 | #define UTMIP_BIAS_CFG0 0x80c | ||
99 | #define UTMIP_OTGPD (1 << 11) | ||
100 | #define UTMIP_BIASPD (1 << 10) | ||
101 | |||
102 | #define UTMIP_HSRX_CFG0 0x810 | ||
103 | #define UTMIP_ELASTIC_LIMIT(x) (((x) & 0x1f) << 10) | ||
104 | #define UTMIP_IDLE_WAIT(x) (((x) & 0x1f) << 15) | ||
105 | |||
106 | #define UTMIP_HSRX_CFG1 0x814 | ||
107 | #define UTMIP_HS_SYNC_START_DLY(x) (((x) & 0x1f) << 1) | ||
108 | |||
109 | #define UTMIP_TX_CFG0 0x820 | ||
110 | #define UTMIP_FS_PREABMLE_J (1 << 19) | ||
111 | #define UTMIP_HS_DISCON_DISABLE (1 << 8) | ||
112 | |||
113 | #define UTMIP_MISC_CFG0 0x824 | ||
114 | #define UTMIP_DPDM_OBSERVE (1 << 26) | ||
115 | #define UTMIP_DPDM_OBSERVE_SEL(x) (((x) & 0xf) << 27) | ||
116 | #define UTMIP_DPDM_OBSERVE_SEL_FS_J UTMIP_DPDM_OBSERVE_SEL(0xf) | ||
117 | #define UTMIP_DPDM_OBSERVE_SEL_FS_K UTMIP_DPDM_OBSERVE_SEL(0xe) | ||
118 | #define UTMIP_DPDM_OBSERVE_SEL_FS_SE1 UTMIP_DPDM_OBSERVE_SEL(0xd) | ||
119 | #define UTMIP_DPDM_OBSERVE_SEL_FS_SE0 UTMIP_DPDM_OBSERVE_SEL(0xc) | ||
120 | #define UTMIP_SUSPEND_EXIT_ON_EDGE (1 << 22) | ||
121 | |||
122 | #define UTMIP_MISC_CFG1 0x828 | ||
123 | #define UTMIP_PLL_ACTIVE_DLY_COUNT(x) (((x) & 0x1f) << 18) | ||
124 | #define UTMIP_PLLU_STABLE_COUNT(x) (((x) & 0xfff) << 6) | ||
125 | |||
126 | #define UTMIP_DEBOUNCE_CFG0 0x82c | ||
127 | #define UTMIP_BIAS_DEBOUNCE_A(x) (((x) & 0xffff) << 0) | ||
128 | |||
129 | #define UTMIP_BAT_CHRG_CFG0 0x830 | ||
130 | #define UTMIP_PD_CHRG (1 << 0) | ||
131 | |||
132 | #define UTMIP_SPARE_CFG0 0x834 | ||
133 | #define FUSE_SETUP_SEL (1 << 3) | ||
134 | |||
135 | #define UTMIP_XCVR_CFG1 0x838 | ||
136 | #define UTMIP_FORCE_PDDISC_POWERDOWN (1 << 0) | ||
137 | #define UTMIP_FORCE_PDCHRP_POWERDOWN (1 << 2) | ||
138 | #define UTMIP_FORCE_PDDR_POWERDOWN (1 << 4) | ||
139 | #define UTMIP_XCVR_TERM_RANGE_ADJ(x) (((x) & 0xf) << 18) | ||
140 | |||
141 | #define UTMIP_BIAS_CFG1 0x83c | ||
142 | #define UTMIP_BIAS_PDTRK_COUNT(x) (((x) & 0x1f) << 3) | ||
143 | |||
144 | static DEFINE_SPINLOCK(utmip_pad_lock); | ||
145 | static int utmip_pad_count; | ||
146 | |||
147 | struct tegra_xtal_freq { | ||
148 | int freq; | ||
149 | u8 enable_delay; | ||
150 | u8 stable_count; | ||
151 | u8 active_delay; | ||
152 | u8 xtal_freq_count; | ||
153 | u16 debounce; | ||
154 | }; | ||
155 | |||
156 | static const struct tegra_xtal_freq tegra_freq_table[] = { | ||
157 | { | ||
158 | .freq = 12000000, | ||
159 | .enable_delay = 0x02, | ||
160 | .stable_count = 0x2F, | ||
161 | .active_delay = 0x04, | ||
162 | .xtal_freq_count = 0x76, | ||
163 | .debounce = 0x7530, | ||
164 | }, | ||
165 | { | ||
166 | .freq = 13000000, | ||
167 | .enable_delay = 0x02, | ||
168 | .stable_count = 0x33, | ||
169 | .active_delay = 0x05, | ||
170 | .xtal_freq_count = 0x7F, | ||
171 | .debounce = 0x7EF4, | ||
172 | }, | ||
173 | { | ||
174 | .freq = 19200000, | ||
175 | .enable_delay = 0x03, | ||
176 | .stable_count = 0x4B, | ||
177 | .active_delay = 0x06, | ||
178 | .xtal_freq_count = 0xBB, | ||
179 | .debounce = 0xBB80, | ||
180 | }, | ||
181 | { | ||
182 | .freq = 26000000, | ||
183 | .enable_delay = 0x04, | ||
184 | .stable_count = 0x66, | ||
185 | .active_delay = 0x09, | ||
186 | .xtal_freq_count = 0xFE, | ||
187 | .debounce = 0xFDE8, | ||
188 | }, | ||
189 | }; | ||
190 | |||
191 | static struct tegra_utmip_config utmip_default[] = { | ||
192 | [0] = { | ||
193 | .hssync_start_delay = 9, | ||
194 | .idle_wait_delay = 17, | ||
195 | .elastic_limit = 16, | ||
196 | .term_range_adj = 6, | ||
197 | .xcvr_setup = 9, | ||
198 | .xcvr_lsfslew = 1, | ||
199 | .xcvr_lsrslew = 1, | ||
200 | }, | ||
201 | [2] = { | ||
202 | .hssync_start_delay = 9, | ||
203 | .idle_wait_delay = 17, | ||
204 | .elastic_limit = 16, | ||
205 | .term_range_adj = 6, | ||
206 | .xcvr_setup = 9, | ||
207 | .xcvr_lsfslew = 2, | ||
208 | .xcvr_lsrslew = 2, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static inline bool phy_is_ulpi(struct tegra_usb_phy *phy) | ||
213 | { | ||
214 | return (phy->instance == 1); | ||
215 | } | ||
216 | |||
217 | static int utmip_pad_open(struct tegra_usb_phy *phy) | ||
218 | { | ||
219 | phy->pad_clk = clk_get_sys("utmip-pad", NULL); | ||
220 | if (IS_ERR(phy->pad_clk)) { | ||
221 | pr_err("%s: can't get utmip pad clock\n", __func__); | ||
222 | return PTR_ERR(phy->pad_clk); | ||
223 | } | ||
224 | |||
225 | if (phy->instance == 0) { | ||
226 | phy->pad_regs = phy->regs; | ||
227 | } else { | ||
228 | phy->pad_regs = ioremap(TEGRA_USB_BASE, TEGRA_USB_SIZE); | ||
229 | if (!phy->pad_regs) { | ||
230 | pr_err("%s: can't remap usb registers\n", __func__); | ||
231 | clk_put(phy->pad_clk); | ||
232 | return -ENOMEM; | ||
233 | } | ||
234 | } | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static void utmip_pad_close(struct tegra_usb_phy *phy) | ||
239 | { | ||
240 | if (phy->instance != 0) | ||
241 | iounmap(phy->pad_regs); | ||
242 | clk_put(phy->pad_clk); | ||
243 | } | ||
244 | |||
245 | static void utmip_pad_power_on(struct tegra_usb_phy *phy) | ||
246 | { | ||
247 | unsigned long val, flags; | ||
248 | void __iomem *base = phy->pad_regs; | ||
249 | |||
250 | clk_prepare_enable(phy->pad_clk); | ||
251 | |||
252 | spin_lock_irqsave(&utmip_pad_lock, flags); | ||
253 | |||
254 | if (utmip_pad_count++ == 0) { | ||
255 | val = readl(base + UTMIP_BIAS_CFG0); | ||
256 | val &= ~(UTMIP_OTGPD | UTMIP_BIASPD); | ||
257 | writel(val, base + UTMIP_BIAS_CFG0); | ||
258 | } | ||
259 | |||
260 | spin_unlock_irqrestore(&utmip_pad_lock, flags); | ||
261 | |||
262 | clk_disable_unprepare(phy->pad_clk); | ||
263 | } | ||
264 | |||
265 | static int utmip_pad_power_off(struct tegra_usb_phy *phy) | ||
266 | { | ||
267 | unsigned long val, flags; | ||
268 | void __iomem *base = phy->pad_regs; | ||
269 | |||
270 | if (!utmip_pad_count) { | ||
271 | pr_err("%s: utmip pad already powered off\n", __func__); | ||
272 | return -EINVAL; | ||
273 | } | ||
274 | |||
275 | clk_prepare_enable(phy->pad_clk); | ||
276 | |||
277 | spin_lock_irqsave(&utmip_pad_lock, flags); | ||
278 | |||
279 | if (--utmip_pad_count == 0) { | ||
280 | val = readl(base + UTMIP_BIAS_CFG0); | ||
281 | val |= UTMIP_OTGPD | UTMIP_BIASPD; | ||
282 | writel(val, base + UTMIP_BIAS_CFG0); | ||
283 | } | ||
284 | |||
285 | spin_unlock_irqrestore(&utmip_pad_lock, flags); | ||
286 | |||
287 | clk_disable_unprepare(phy->pad_clk); | ||
288 | |||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | static int utmi_wait_register(void __iomem *reg, u32 mask, u32 result) | ||
293 | { | ||
294 | unsigned long timeout = 2000; | ||
295 | do { | ||
296 | if ((readl(reg) & mask) == result) | ||
297 | return 0; | ||
298 | udelay(1); | ||
299 | timeout--; | ||
300 | } while (timeout); | ||
301 | return -1; | ||
302 | } | ||
303 | |||
304 | static void utmi_phy_clk_disable(struct tegra_usb_phy *phy) | ||
305 | { | ||
306 | unsigned long val; | ||
307 | void __iomem *base = phy->regs; | ||
308 | |||
309 | if (phy->instance == 0) { | ||
310 | val = readl(base + USB_SUSP_CTRL); | ||
311 | val |= USB_SUSP_SET; | ||
312 | writel(val, base + USB_SUSP_CTRL); | ||
313 | |||
314 | udelay(10); | ||
315 | |||
316 | val = readl(base + USB_SUSP_CTRL); | ||
317 | val &= ~USB_SUSP_SET; | ||
318 | writel(val, base + USB_SUSP_CTRL); | ||
319 | } | ||
320 | |||
321 | if (phy->instance == 2) { | ||
322 | val = readl(base + USB_PORTSC1); | ||
323 | val |= USB_PORTSC1_PHCD; | ||
324 | writel(val, base + USB_PORTSC1); | ||
325 | } | ||
326 | |||
327 | if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0) | ||
328 | pr_err("%s: timeout waiting for phy to stabilize\n", __func__); | ||
329 | } | ||
330 | |||
331 | static void utmi_phy_clk_enable(struct tegra_usb_phy *phy) | ||
332 | { | ||
333 | unsigned long val; | ||
334 | void __iomem *base = phy->regs; | ||
335 | |||
336 | if (phy->instance == 0) { | ||
337 | val = readl(base + USB_SUSP_CTRL); | ||
338 | val |= USB_SUSP_CLR; | ||
339 | writel(val, base + USB_SUSP_CTRL); | ||
340 | |||
341 | udelay(10); | ||
342 | |||
343 | val = readl(base + USB_SUSP_CTRL); | ||
344 | val &= ~USB_SUSP_CLR; | ||
345 | writel(val, base + USB_SUSP_CTRL); | ||
346 | } | ||
347 | |||
348 | if (phy->instance == 2) { | ||
349 | val = readl(base + USB_PORTSC1); | ||
350 | val &= ~USB_PORTSC1_PHCD; | ||
351 | writel(val, base + USB_PORTSC1); | ||
352 | } | ||
353 | |||
354 | if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, | ||
355 | USB_PHY_CLK_VALID)) | ||
356 | pr_err("%s: timeout waiting for phy to stabilize\n", __func__); | ||
357 | } | ||
358 | |||
359 | static int utmi_phy_power_on(struct tegra_usb_phy *phy) | ||
360 | { | ||
361 | unsigned long val; | ||
362 | void __iomem *base = phy->regs; | ||
363 | struct tegra_utmip_config *config = phy->config; | ||
364 | |||
365 | val = readl(base + USB_SUSP_CTRL); | ||
366 | val |= UTMIP_RESET; | ||
367 | writel(val, base + USB_SUSP_CTRL); | ||
368 | |||
369 | if (phy->instance == 0) { | ||
370 | val = readl(base + USB1_LEGACY_CTRL); | ||
371 | val |= USB1_NO_LEGACY_MODE; | ||
372 | writel(val, base + USB1_LEGACY_CTRL); | ||
373 | } | ||
374 | |||
375 | val = readl(base + UTMIP_TX_CFG0); | ||
376 | val &= ~UTMIP_FS_PREABMLE_J; | ||
377 | writel(val, base + UTMIP_TX_CFG0); | ||
378 | |||
379 | val = readl(base + UTMIP_HSRX_CFG0); | ||
380 | val &= ~(UTMIP_IDLE_WAIT(~0) | UTMIP_ELASTIC_LIMIT(~0)); | ||
381 | val |= UTMIP_IDLE_WAIT(config->idle_wait_delay); | ||
382 | val |= UTMIP_ELASTIC_LIMIT(config->elastic_limit); | ||
383 | writel(val, base + UTMIP_HSRX_CFG0); | ||
384 | |||
385 | val = readl(base + UTMIP_HSRX_CFG1); | ||
386 | val &= ~UTMIP_HS_SYNC_START_DLY(~0); | ||
387 | val |= UTMIP_HS_SYNC_START_DLY(config->hssync_start_delay); | ||
388 | writel(val, base + UTMIP_HSRX_CFG1); | ||
389 | |||
390 | val = readl(base + UTMIP_DEBOUNCE_CFG0); | ||
391 | val &= ~UTMIP_BIAS_DEBOUNCE_A(~0); | ||
392 | val |= UTMIP_BIAS_DEBOUNCE_A(phy->freq->debounce); | ||
393 | writel(val, base + UTMIP_DEBOUNCE_CFG0); | ||
394 | |||
395 | val = readl(base + UTMIP_MISC_CFG0); | ||
396 | val &= ~UTMIP_SUSPEND_EXIT_ON_EDGE; | ||
397 | writel(val, base + UTMIP_MISC_CFG0); | ||
398 | |||
399 | val = readl(base + UTMIP_MISC_CFG1); | ||
400 | val &= ~(UTMIP_PLL_ACTIVE_DLY_COUNT(~0) | UTMIP_PLLU_STABLE_COUNT(~0)); | ||
401 | val |= UTMIP_PLL_ACTIVE_DLY_COUNT(phy->freq->active_delay) | | ||
402 | UTMIP_PLLU_STABLE_COUNT(phy->freq->stable_count); | ||
403 | writel(val, base + UTMIP_MISC_CFG1); | ||
404 | |||
405 | val = readl(base + UTMIP_PLL_CFG1); | ||
406 | val &= ~(UTMIP_XTAL_FREQ_COUNT(~0) | UTMIP_PLLU_ENABLE_DLY_COUNT(~0)); | ||
407 | val |= UTMIP_XTAL_FREQ_COUNT(phy->freq->xtal_freq_count) | | ||
408 | UTMIP_PLLU_ENABLE_DLY_COUNT(phy->freq->enable_delay); | ||
409 | writel(val, base + UTMIP_PLL_CFG1); | ||
410 | |||
411 | if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) { | ||
412 | val = readl(base + USB_SUSP_CTRL); | ||
413 | val &= ~(USB_WAKE_ON_CNNT_EN_DEV | USB_WAKE_ON_DISCON_EN_DEV); | ||
414 | writel(val, base + USB_SUSP_CTRL); | ||
415 | } | ||
416 | |||
417 | utmip_pad_power_on(phy); | ||
418 | |||
419 | val = readl(base + UTMIP_XCVR_CFG0); | ||
420 | val &= ~(UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | | ||
421 | UTMIP_FORCE_PDZI_POWERDOWN | UTMIP_XCVR_SETUP(~0) | | ||
422 | UTMIP_XCVR_LSFSLEW(~0) | UTMIP_XCVR_LSRSLEW(~0) | | ||
423 | UTMIP_XCVR_HSSLEW_MSB(~0)); | ||
424 | val |= UTMIP_XCVR_SETUP(config->xcvr_setup); | ||
425 | val |= UTMIP_XCVR_LSFSLEW(config->xcvr_lsfslew); | ||
426 | val |= UTMIP_XCVR_LSRSLEW(config->xcvr_lsrslew); | ||
427 | writel(val, base + UTMIP_XCVR_CFG0); | ||
428 | |||
429 | val = readl(base + UTMIP_XCVR_CFG1); | ||
430 | val &= ~(UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | | ||
431 | UTMIP_FORCE_PDDR_POWERDOWN | UTMIP_XCVR_TERM_RANGE_ADJ(~0)); | ||
432 | val |= UTMIP_XCVR_TERM_RANGE_ADJ(config->term_range_adj); | ||
433 | writel(val, base + UTMIP_XCVR_CFG1); | ||
434 | |||
435 | val = readl(base + UTMIP_BAT_CHRG_CFG0); | ||
436 | val &= ~UTMIP_PD_CHRG; | ||
437 | writel(val, base + UTMIP_BAT_CHRG_CFG0); | ||
438 | |||
439 | val = readl(base + UTMIP_BIAS_CFG1); | ||
440 | val &= ~UTMIP_BIAS_PDTRK_COUNT(~0); | ||
441 | val |= UTMIP_BIAS_PDTRK_COUNT(0x5); | ||
442 | writel(val, base + UTMIP_BIAS_CFG1); | ||
443 | |||
444 | if (phy->instance == 0) { | ||
445 | val = readl(base + UTMIP_SPARE_CFG0); | ||
446 | if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) | ||
447 | val &= ~FUSE_SETUP_SEL; | ||
448 | else | ||
449 | val |= FUSE_SETUP_SEL; | ||
450 | writel(val, base + UTMIP_SPARE_CFG0); | ||
451 | } | ||
452 | |||
453 | if (phy->instance == 2) { | ||
454 | val = readl(base + USB_SUSP_CTRL); | ||
455 | val |= UTMIP_PHY_ENABLE; | ||
456 | writel(val, base + USB_SUSP_CTRL); | ||
457 | } | ||
458 | |||
459 | val = readl(base + USB_SUSP_CTRL); | ||
460 | val &= ~UTMIP_RESET; | ||
461 | writel(val, base + USB_SUSP_CTRL); | ||
462 | |||
463 | if (phy->instance == 0) { | ||
464 | val = readl(base + USB1_LEGACY_CTRL); | ||
465 | val &= ~USB1_VBUS_SENSE_CTL_MASK; | ||
466 | val |= USB1_VBUS_SENSE_CTL_A_SESS_VLD; | ||
467 | writel(val, base + USB1_LEGACY_CTRL); | ||
468 | |||
469 | val = readl(base + USB_SUSP_CTRL); | ||
470 | val &= ~USB_SUSP_SET; | ||
471 | writel(val, base + USB_SUSP_CTRL); | ||
472 | } | ||
473 | |||
474 | utmi_phy_clk_enable(phy); | ||
475 | |||
476 | if (phy->instance == 2) { | ||
477 | val = readl(base + USB_PORTSC1); | ||
478 | val &= ~USB_PORTSC1_PTS(~0); | ||
479 | writel(val, base + USB_PORTSC1); | ||
480 | } | ||
481 | |||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | static void utmi_phy_power_off(struct tegra_usb_phy *phy) | ||
486 | { | ||
487 | unsigned long val; | ||
488 | void __iomem *base = phy->regs; | ||
489 | |||
490 | utmi_phy_clk_disable(phy); | ||
491 | |||
492 | if (phy->mode == TEGRA_USB_PHY_MODE_DEVICE) { | ||
493 | val = readl(base + USB_SUSP_CTRL); | ||
494 | val &= ~USB_WAKEUP_DEBOUNCE_COUNT(~0); | ||
495 | val |= USB_WAKE_ON_CNNT_EN_DEV | USB_WAKEUP_DEBOUNCE_COUNT(5); | ||
496 | writel(val, base + USB_SUSP_CTRL); | ||
497 | } | ||
498 | |||
499 | val = readl(base + USB_SUSP_CTRL); | ||
500 | val |= UTMIP_RESET; | ||
501 | writel(val, base + USB_SUSP_CTRL); | ||
502 | |||
503 | val = readl(base + UTMIP_BAT_CHRG_CFG0); | ||
504 | val |= UTMIP_PD_CHRG; | ||
505 | writel(val, base + UTMIP_BAT_CHRG_CFG0); | ||
506 | |||
507 | val = readl(base + UTMIP_XCVR_CFG0); | ||
508 | val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN | | ||
509 | UTMIP_FORCE_PDZI_POWERDOWN; | ||
510 | writel(val, base + UTMIP_XCVR_CFG0); | ||
511 | |||
512 | val = readl(base + UTMIP_XCVR_CFG1); | ||
513 | val |= UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN | | ||
514 | UTMIP_FORCE_PDDR_POWERDOWN; | ||
515 | writel(val, base + UTMIP_XCVR_CFG1); | ||
516 | |||
517 | utmip_pad_power_off(phy); | ||
518 | } | ||
519 | |||
520 | static void utmi_phy_preresume(struct tegra_usb_phy *phy) | ||
521 | { | ||
522 | unsigned long val; | ||
523 | void __iomem *base = phy->regs; | ||
524 | |||
525 | val = readl(base + UTMIP_TX_CFG0); | ||
526 | val |= UTMIP_HS_DISCON_DISABLE; | ||
527 | writel(val, base + UTMIP_TX_CFG0); | ||
528 | } | ||
529 | |||
530 | static void utmi_phy_postresume(struct tegra_usb_phy *phy) | ||
531 | { | ||
532 | unsigned long val; | ||
533 | void __iomem *base = phy->regs; | ||
534 | |||
535 | val = readl(base + UTMIP_TX_CFG0); | ||
536 | val &= ~UTMIP_HS_DISCON_DISABLE; | ||
537 | writel(val, base + UTMIP_TX_CFG0); | ||
538 | } | ||
539 | |||
540 | static void utmi_phy_restore_start(struct tegra_usb_phy *phy, | ||
541 | enum tegra_usb_phy_port_speed port_speed) | ||
542 | { | ||
543 | unsigned long val; | ||
544 | void __iomem *base = phy->regs; | ||
545 | |||
546 | val = readl(base + UTMIP_MISC_CFG0); | ||
547 | val &= ~UTMIP_DPDM_OBSERVE_SEL(~0); | ||
548 | if (port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
549 | val |= UTMIP_DPDM_OBSERVE_SEL_FS_K; | ||
550 | else | ||
551 | val |= UTMIP_DPDM_OBSERVE_SEL_FS_J; | ||
552 | writel(val, base + UTMIP_MISC_CFG0); | ||
553 | udelay(1); | ||
554 | |||
555 | val = readl(base + UTMIP_MISC_CFG0); | ||
556 | val |= UTMIP_DPDM_OBSERVE; | ||
557 | writel(val, base + UTMIP_MISC_CFG0); | ||
558 | udelay(10); | ||
559 | } | ||
560 | |||
561 | static void utmi_phy_restore_end(struct tegra_usb_phy *phy) | ||
562 | { | ||
563 | unsigned long val; | ||
564 | void __iomem *base = phy->regs; | ||
565 | |||
566 | val = readl(base + UTMIP_MISC_CFG0); | ||
567 | val &= ~UTMIP_DPDM_OBSERVE; | ||
568 | writel(val, base + UTMIP_MISC_CFG0); | ||
569 | udelay(10); | ||
570 | } | ||
571 | |||
572 | static int ulpi_phy_power_on(struct tegra_usb_phy *phy) | ||
573 | { | ||
574 | int ret; | ||
575 | unsigned long val; | ||
576 | void __iomem *base = phy->regs; | ||
577 | struct tegra_ulpi_config *config = phy->config; | ||
578 | |||
579 | gpio_direction_output(config->reset_gpio, 0); | ||
580 | msleep(5); | ||
581 | gpio_direction_output(config->reset_gpio, 1); | ||
582 | |||
583 | clk_prepare_enable(phy->clk); | ||
584 | msleep(1); | ||
585 | |||
586 | val = readl(base + USB_SUSP_CTRL); | ||
587 | val |= UHSIC_RESET; | ||
588 | writel(val, base + USB_SUSP_CTRL); | ||
589 | |||
590 | val = readl(base + ULPI_TIMING_CTRL_0); | ||
591 | val |= ULPI_OUTPUT_PINMUX_BYP | ULPI_CLKOUT_PINMUX_BYP; | ||
592 | writel(val, base + ULPI_TIMING_CTRL_0); | ||
593 | |||
594 | val = readl(base + USB_SUSP_CTRL); | ||
595 | val |= ULPI_PHY_ENABLE; | ||
596 | writel(val, base + USB_SUSP_CTRL); | ||
597 | |||
598 | val = 0; | ||
599 | writel(val, base + ULPI_TIMING_CTRL_1); | ||
600 | |||
601 | val |= ULPI_DATA_TRIMMER_SEL(4); | ||
602 | val |= ULPI_STPDIRNXT_TRIMMER_SEL(4); | ||
603 | val |= ULPI_DIR_TRIMMER_SEL(4); | ||
604 | writel(val, base + ULPI_TIMING_CTRL_1); | ||
605 | udelay(10); | ||
606 | |||
607 | val |= ULPI_DATA_TRIMMER_LOAD; | ||
608 | val |= ULPI_STPDIRNXT_TRIMMER_LOAD; | ||
609 | val |= ULPI_DIR_TRIMMER_LOAD; | ||
610 | writel(val, base + ULPI_TIMING_CTRL_1); | ||
611 | |||
612 | /* Fix VbusInvalid due to floating VBUS */ | ||
613 | ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08); | ||
614 | if (ret) { | ||
615 | pr_err("%s: ulpi write failed\n", __func__); | ||
616 | return ret; | ||
617 | } | ||
618 | |||
619 | ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B); | ||
620 | if (ret) { | ||
621 | pr_err("%s: ulpi write failed\n", __func__); | ||
622 | return ret; | ||
623 | } | ||
624 | |||
625 | val = readl(base + USB_PORTSC1); | ||
626 | val |= USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN; | ||
627 | writel(val, base + USB_PORTSC1); | ||
628 | |||
629 | val = readl(base + USB_SUSP_CTRL); | ||
630 | val |= USB_SUSP_CLR; | ||
631 | writel(val, base + USB_SUSP_CTRL); | ||
632 | udelay(100); | ||
633 | |||
634 | val = readl(base + USB_SUSP_CTRL); | ||
635 | val &= ~USB_SUSP_CLR; | ||
636 | writel(val, base + USB_SUSP_CTRL); | ||
637 | |||
638 | return 0; | ||
639 | } | ||
640 | |||
641 | static void ulpi_phy_power_off(struct tegra_usb_phy *phy) | ||
642 | { | ||
643 | unsigned long val; | ||
644 | void __iomem *base = phy->regs; | ||
645 | struct tegra_ulpi_config *config = phy->config; | ||
646 | |||
647 | /* Clear WKCN/WKDS/WKOC wake-on events that can cause the USB | ||
648 | * Controller to immediately bring the ULPI PHY out of low power | ||
649 | */ | ||
650 | val = readl(base + USB_PORTSC1); | ||
651 | val &= ~(USB_PORTSC1_WKOC | USB_PORTSC1_WKDS | USB_PORTSC1_WKCN); | ||
652 | writel(val, base + USB_PORTSC1); | ||
653 | |||
654 | gpio_direction_output(config->reset_gpio, 0); | ||
655 | clk_disable(phy->clk); | ||
656 | } | ||
657 | |||
658 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, | ||
659 | void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode) | ||
660 | { | ||
661 | struct tegra_usb_phy *phy; | ||
662 | struct tegra_ulpi_config *ulpi_config; | ||
663 | unsigned long parent_rate; | ||
664 | int i; | ||
665 | int err; | ||
666 | |||
667 | phy = kmalloc(sizeof(struct tegra_usb_phy), GFP_KERNEL); | ||
668 | if (!phy) | ||
669 | return ERR_PTR(-ENOMEM); | ||
670 | |||
671 | phy->instance = instance; | ||
672 | phy->regs = regs; | ||
673 | phy->config = config; | ||
674 | phy->mode = phy_mode; | ||
675 | |||
676 | if (!phy->config) { | ||
677 | if (phy_is_ulpi(phy)) { | ||
678 | pr_err("%s: ulpi phy configuration missing", __func__); | ||
679 | err = -EINVAL; | ||
680 | goto err0; | ||
681 | } else { | ||
682 | phy->config = &utmip_default[instance]; | ||
683 | } | ||
684 | } | ||
685 | |||
686 | phy->pll_u = clk_get_sys(NULL, "pll_u"); | ||
687 | if (IS_ERR(phy->pll_u)) { | ||
688 | pr_err("Can't get pll_u clock\n"); | ||
689 | err = PTR_ERR(phy->pll_u); | ||
690 | goto err0; | ||
691 | } | ||
692 | clk_prepare_enable(phy->pll_u); | ||
693 | |||
694 | parent_rate = clk_get_rate(clk_get_parent(phy->pll_u)); | ||
695 | for (i = 0; i < ARRAY_SIZE(tegra_freq_table); i++) { | ||
696 | if (tegra_freq_table[i].freq == parent_rate) { | ||
697 | phy->freq = &tegra_freq_table[i]; | ||
698 | break; | ||
699 | } | ||
700 | } | ||
701 | if (!phy->freq) { | ||
702 | pr_err("invalid pll_u parent rate %ld\n", parent_rate); | ||
703 | err = -EINVAL; | ||
704 | goto err1; | ||
705 | } | ||
706 | |||
707 | if (phy_is_ulpi(phy)) { | ||
708 | ulpi_config = config; | ||
709 | phy->clk = clk_get_sys(NULL, ulpi_config->clk); | ||
710 | if (IS_ERR(phy->clk)) { | ||
711 | pr_err("%s: can't get ulpi clock\n", __func__); | ||
712 | err = -ENXIO; | ||
713 | goto err1; | ||
714 | } | ||
715 | if (!gpio_is_valid(ulpi_config->reset_gpio)) | ||
716 | ulpi_config->reset_gpio = | ||
717 | of_get_named_gpio(dev->of_node, | ||
718 | "nvidia,phy-reset-gpio", 0); | ||
719 | if (!gpio_is_valid(ulpi_config->reset_gpio)) { | ||
720 | pr_err("%s: invalid reset gpio: %d\n", __func__, | ||
721 | ulpi_config->reset_gpio); | ||
722 | err = -EINVAL; | ||
723 | goto err1; | ||
724 | } | ||
725 | gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); | ||
726 | gpio_direction_output(ulpi_config->reset_gpio, 0); | ||
727 | phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); | ||
728 | phy->ulpi->io_priv = regs + ULPI_VIEWPORT; | ||
729 | } else { | ||
730 | err = utmip_pad_open(phy); | ||
731 | if (err < 0) | ||
732 | goto err1; | ||
733 | } | ||
734 | |||
735 | return phy; | ||
736 | |||
737 | err1: | ||
738 | clk_disable_unprepare(phy->pll_u); | ||
739 | clk_put(phy->pll_u); | ||
740 | err0: | ||
741 | kfree(phy); | ||
742 | return ERR_PTR(err); | ||
743 | } | ||
744 | EXPORT_SYMBOL_GPL(tegra_usb_phy_open); | ||
745 | |||
746 | int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) | ||
747 | { | ||
748 | if (phy_is_ulpi(phy)) | ||
749 | return ulpi_phy_power_on(phy); | ||
750 | else | ||
751 | return utmi_phy_power_on(phy); | ||
752 | } | ||
753 | EXPORT_SYMBOL_GPL(tegra_usb_phy_power_on); | ||
754 | |||
755 | void tegra_usb_phy_power_off(struct tegra_usb_phy *phy) | ||
756 | { | ||
757 | if (phy_is_ulpi(phy)) | ||
758 | ulpi_phy_power_off(phy); | ||
759 | else | ||
760 | utmi_phy_power_off(phy); | ||
761 | } | ||
762 | EXPORT_SYMBOL_GPL(tegra_usb_phy_power_off); | ||
763 | |||
764 | void tegra_usb_phy_preresume(struct tegra_usb_phy *phy) | ||
765 | { | ||
766 | if (!phy_is_ulpi(phy)) | ||
767 | utmi_phy_preresume(phy); | ||
768 | } | ||
769 | EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume); | ||
770 | |||
771 | void tegra_usb_phy_postresume(struct tegra_usb_phy *phy) | ||
772 | { | ||
773 | if (!phy_is_ulpi(phy)) | ||
774 | utmi_phy_postresume(phy); | ||
775 | } | ||
776 | EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume); | ||
777 | |||
778 | void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy, | ||
779 | enum tegra_usb_phy_port_speed port_speed) | ||
780 | { | ||
781 | if (!phy_is_ulpi(phy)) | ||
782 | utmi_phy_restore_start(phy, port_speed); | ||
783 | } | ||
784 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start); | ||
785 | |||
786 | void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy) | ||
787 | { | ||
788 | if (!phy_is_ulpi(phy)) | ||
789 | utmi_phy_restore_end(phy); | ||
790 | } | ||
791 | EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end); | ||
792 | |||
793 | void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy) | ||
794 | { | ||
795 | if (!phy_is_ulpi(phy)) | ||
796 | utmi_phy_clk_disable(phy); | ||
797 | } | ||
798 | EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable); | ||
799 | |||
800 | void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy) | ||
801 | { | ||
802 | if (!phy_is_ulpi(phy)) | ||
803 | utmi_phy_clk_enable(phy); | ||
804 | } | ||
805 | EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable); | ||
806 | |||
807 | void tegra_usb_phy_close(struct tegra_usb_phy *phy) | ||
808 | { | ||
809 | if (phy_is_ulpi(phy)) | ||
810 | clk_put(phy->clk); | ||
811 | else | ||
812 | utmip_pad_close(phy); | ||
813 | clk_disable_unprepare(phy->pll_u); | ||
814 | clk_put(phy->pll_u); | ||
815 | kfree(phy); | ||
816 | } | ||
817 | EXPORT_SYMBOL_GPL(tegra_usb_phy_close); | ||
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index ef6f602b7e48..b8efac4daed8 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -1557,9 +1557,6 @@ static struct u300_mux_hog u300_mux_hogs[] = { | |||
1557 | .dev = &uart0_device.dev, | 1557 | .dev = &uart0_device.dev, |
1558 | }, | 1558 | }, |
1559 | { | 1559 | { |
1560 | .dev = &pl022_device.dev, | ||
1561 | }, | ||
1562 | { | ||
1563 | .dev = &mmcsd_device.dev, | 1560 | .dev = &mmcsd_device.dev, |
1564 | }, | 1561 | }, |
1565 | }; | 1562 | }; |
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c index 0d4620ed853c..96800aa1316d 100644 --- a/arch/arm/mach-u300/i2c.c +++ b/arch/arm/mach-u300/i2c.c | |||
@@ -9,7 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/i2c.h> | 11 | #include <linux/i2c.h> |
12 | #include <linux/mfd/abx500.h> | 12 | #include <linux/mfd/ab3100.h> |
13 | #include <linux/regulator/machine.h> | 13 | #include <linux/regulator/machine.h> |
14 | #include <linux/amba/bus.h> | 14 | #include <linux/amba/bus.h> |
15 | #include <mach/irqs.h> | 15 | #include <mach/irqs.h> |
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig index a258996d954b..c77c86c47369 100644 --- a/arch/arm/mach-ux500/Kconfig +++ b/arch/arm/mach-ux500/Kconfig | |||
@@ -29,6 +29,7 @@ config MACH_MOP500 | |||
29 | select I2C | 29 | select I2C |
30 | select I2C_NOMADIK | 30 | select I2C_NOMADIK |
31 | select SOC_BUS | 31 | select SOC_BUS |
32 | select REGULATOR_FIXED_VOLTAGE | ||
32 | help | 33 | help |
33 | Include support for the MOP500 development platform. | 34 | Include support for the MOP500 development platform. |
34 | 35 | ||
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 5691ef679d01..f24710dfc395 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
@@ -12,6 +12,6 @@ obj-$(CONFIG_MACH_MOP500) += board-mop500.o board-mop500-sdi.o \ | |||
12 | board-mop500-uib.o board-mop500-stuib.o \ | 12 | board-mop500-uib.o board-mop500-stuib.o \ |
13 | board-mop500-u8500uib.o \ | 13 | board-mop500-u8500uib.o \ |
14 | board-mop500-pins.o \ | 14 | board-mop500-pins.o \ |
15 | board-mop500-msp.o | 15 | board-mop500-audio.o |
16 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 16 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
17 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 17 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
diff --git a/arch/arm/mach-ux500/board-mop500-msp.c b/arch/arm/mach-ux500/board-mop500-audio.c index df15646036aa..070629a95625 100644 --- a/arch/arm/mach-ux500/board-mop500-msp.c +++ b/arch/arm/mach-ux500/board-mop500-audio.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/platform_device.h> | 7 | #include <linux/platform_device.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/gpio.h> | 9 | #include <linux/gpio.h> |
10 | #include <linux/pinctrl/consumer.h> | ||
11 | 10 | ||
12 | #include <plat/gpio-nomadik.h> | 11 | #include <plat/gpio-nomadik.h> |
13 | #include <plat/pincfg.h> | 12 | #include <plat/pincfg.h> |
@@ -23,53 +22,6 @@ | |||
23 | #include "devices-db8500.h" | 22 | #include "devices-db8500.h" |
24 | #include "pins-db8500.h" | 23 | #include "pins-db8500.h" |
25 | 24 | ||
26 | /* MSP1/3 Tx/Rx usage protection */ | ||
27 | static DEFINE_SPINLOCK(msp_rxtx_lock); | ||
28 | |||
29 | /* Reference Count */ | ||
30 | static int msp_rxtx_ref; | ||
31 | |||
32 | /* Pin modes */ | ||
33 | struct pinctrl *msp1_p; | ||
34 | struct pinctrl_state *msp1_def; | ||
35 | struct pinctrl_state *msp1_sleep; | ||
36 | |||
37 | int msp13_i2s_init(void) | ||
38 | { | ||
39 | int retval = 0; | ||
40 | unsigned long flags; | ||
41 | |||
42 | spin_lock_irqsave(&msp_rxtx_lock, flags); | ||
43 | if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_def))) { | ||
44 | retval = pinctrl_select_state(msp1_p, msp1_def); | ||
45 | if (retval) | ||
46 | pr_err("could not set MSP1 defstate\n"); | ||
47 | } | ||
48 | if (!retval) | ||
49 | msp_rxtx_ref++; | ||
50 | spin_unlock_irqrestore(&msp_rxtx_lock, flags); | ||
51 | |||
52 | return retval; | ||
53 | } | ||
54 | |||
55 | int msp13_i2s_exit(void) | ||
56 | { | ||
57 | int retval = 0; | ||
58 | unsigned long flags; | ||
59 | |||
60 | spin_lock_irqsave(&msp_rxtx_lock, flags); | ||
61 | WARN_ON(!msp_rxtx_ref); | ||
62 | msp_rxtx_ref--; | ||
63 | if (msp_rxtx_ref == 0 && !(IS_ERR(msp1_p) || IS_ERR(msp1_sleep))) { | ||
64 | retval = pinctrl_select_state(msp1_p, msp1_sleep); | ||
65 | if (retval) | ||
66 | pr_err("could not set MSP1 sleepstate\n"); | ||
67 | } | ||
68 | spin_unlock_irqrestore(&msp_rxtx_lock, flags); | ||
69 | |||
70 | return retval; | ||
71 | } | ||
72 | |||
73 | static struct stedma40_chan_cfg msp0_dma_rx = { | 25 | static struct stedma40_chan_cfg msp0_dma_rx = { |
74 | .high_priority = true, | 26 | .high_priority = true, |
75 | .dir = STEDMA40_PERIPH_TO_MEM, | 27 | .dir = STEDMA40_PERIPH_TO_MEM, |
@@ -96,7 +48,7 @@ static struct stedma40_chan_cfg msp0_dma_tx = { | |||
96 | /* data_width is set during configuration */ | 48 | /* data_width is set during configuration */ |
97 | }; | 49 | }; |
98 | 50 | ||
99 | static struct msp_i2s_platform_data msp0_platform_data = { | 51 | struct msp_i2s_platform_data msp0_platform_data = { |
100 | .id = MSP_I2S_0, | 52 | .id = MSP_I2S_0, |
101 | .msp_i2s_dma_rx = &msp0_dma_rx, | 53 | .msp_i2s_dma_rx = &msp0_dma_rx, |
102 | .msp_i2s_dma_tx = &msp0_dma_tx, | 54 | .msp_i2s_dma_tx = &msp0_dma_tx, |
@@ -128,12 +80,10 @@ static struct stedma40_chan_cfg msp1_dma_tx = { | |||
128 | /* data_width is set during configuration */ | 80 | /* data_width is set during configuration */ |
129 | }; | 81 | }; |
130 | 82 | ||
131 | static struct msp_i2s_platform_data msp1_platform_data = { | 83 | struct msp_i2s_platform_data msp1_platform_data = { |
132 | .id = MSP_I2S_1, | 84 | .id = MSP_I2S_1, |
133 | .msp_i2s_dma_rx = NULL, | 85 | .msp_i2s_dma_rx = NULL, |
134 | .msp_i2s_dma_tx = &msp1_dma_tx, | 86 | .msp_i2s_dma_tx = &msp1_dma_tx, |
135 | .msp_i2s_init = msp13_i2s_init, | ||
136 | .msp_i2s_exit = msp13_i2s_exit, | ||
137 | }; | 87 | }; |
138 | 88 | ||
139 | static struct stedma40_chan_cfg msp2_dma_rx = { | 89 | static struct stedma40_chan_cfg msp2_dma_rx = { |
@@ -193,11 +143,11 @@ static struct platform_device *db8500_add_msp_i2s(struct device *parent, | |||
193 | 143 | ||
194 | /* Platform device for ASoC MOP500 machine */ | 144 | /* Platform device for ASoC MOP500 machine */ |
195 | static struct platform_device snd_soc_mop500 = { | 145 | static struct platform_device snd_soc_mop500 = { |
196 | .name = "snd-soc-mop500", | 146 | .name = "snd-soc-mop500", |
197 | .id = 0, | 147 | .id = 0, |
198 | .dev = { | 148 | .dev = { |
199 | .platform_data = NULL, | 149 | .platform_data = NULL, |
200 | }, | 150 | }, |
201 | }; | 151 | }; |
202 | 152 | ||
203 | /* Platform device for Ux500-PCM */ | 153 | /* Platform device for Ux500-PCM */ |
@@ -209,59 +159,37 @@ static struct platform_device ux500_pcm = { | |||
209 | }, | 159 | }, |
210 | }; | 160 | }; |
211 | 161 | ||
212 | static struct msp_i2s_platform_data msp2_platform_data = { | 162 | struct msp_i2s_platform_data msp2_platform_data = { |
213 | .id = MSP_I2S_2, | 163 | .id = MSP_I2S_2, |
214 | .msp_i2s_dma_rx = &msp2_dma_rx, | 164 | .msp_i2s_dma_rx = &msp2_dma_rx, |
215 | .msp_i2s_dma_tx = &msp2_dma_tx, | 165 | .msp_i2s_dma_tx = &msp2_dma_tx, |
216 | }; | 166 | }; |
217 | 167 | ||
218 | static struct msp_i2s_platform_data msp3_platform_data = { | 168 | struct msp_i2s_platform_data msp3_platform_data = { |
219 | .id = MSP_I2S_3, | 169 | .id = MSP_I2S_3, |
220 | .msp_i2s_dma_rx = &msp1_dma_rx, | 170 | .msp_i2s_dma_rx = &msp1_dma_rx, |
221 | .msp_i2s_dma_tx = NULL, | 171 | .msp_i2s_dma_tx = NULL, |
222 | .msp_i2s_init = msp13_i2s_init, | ||
223 | .msp_i2s_exit = msp13_i2s_exit, | ||
224 | }; | 172 | }; |
225 | 173 | ||
226 | int mop500_msp_init(struct device *parent) | 174 | void mop500_audio_init(struct device *parent) |
227 | { | 175 | { |
228 | struct platform_device *msp1; | ||
229 | |||
230 | pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__); | 176 | pr_info("%s: Register platform-device 'snd-soc-mop500'.\n", __func__); |
231 | platform_device_register(&snd_soc_mop500); | 177 | platform_device_register(&snd_soc_mop500); |
232 | 178 | ||
233 | pr_info("Initialize MSP I2S-devices.\n"); | 179 | pr_info("Initialize MSP I2S-devices.\n"); |
234 | db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, | 180 | db8500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, |
235 | &msp0_platform_data); | 181 | &msp0_platform_data); |
236 | msp1 = db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, | 182 | db8500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, |
237 | &msp1_platform_data); | 183 | &msp1_platform_data); |
238 | db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, | 184 | db8500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, |
239 | &msp2_platform_data); | 185 | &msp2_platform_data); |
240 | db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, | 186 | db8500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, |
241 | &msp3_platform_data); | 187 | &msp3_platform_data); |
188 | } | ||
242 | 189 | ||
243 | /* Get the pinctrl handle for MSP1 */ | 190 | /* Due for removal once the MSP driver has been fully DT:ed. */ |
244 | if (msp1) { | 191 | void mop500_of_audio_init(struct device *parent) |
245 | msp1_p = pinctrl_get(&msp1->dev); | 192 | { |
246 | if (IS_ERR(msp1_p)) | ||
247 | dev_err(&msp1->dev, "could not get MSP1 pinctrl\n"); | ||
248 | else { | ||
249 | msp1_def = pinctrl_lookup_state(msp1_p, | ||
250 | PINCTRL_STATE_DEFAULT); | ||
251 | if (IS_ERR(msp1_def)) { | ||
252 | dev_err(&msp1->dev, | ||
253 | "could not get MSP1 defstate\n"); | ||
254 | } | ||
255 | msp1_sleep = pinctrl_lookup_state(msp1_p, | ||
256 | PINCTRL_STATE_SLEEP); | ||
257 | if (IS_ERR(msp1_sleep)) | ||
258 | dev_err(&msp1->dev, | ||
259 | "could not get MSP1 idlestate\n"); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__); | 193 | pr_info("%s: Register platform-device 'ux500-pcm'\n", __func__); |
264 | platform_device_register(&ux500_pcm); | 194 | platform_device_register(&ux500_pcm); |
265 | |||
266 | return 0; | ||
267 | } | 195 | } |
diff --git a/arch/arm/mach-ux500/board-mop500-msp.h b/arch/arm/mach-ux500/board-mop500-msp.h deleted file mode 100644 index 6fcfb5e2cc94..000000000000 --- a/arch/arm/mach-ux500/board-mop500-msp.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2012 | ||
3 | * | ||
4 | * Author: Ola Lilja <ola.o.lilja@stericsson.com>, | ||
5 | * for ST-Ericsson. | ||
6 | * | ||
7 | * License terms: | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as published | ||
11 | * by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | void mop500_msp_init(struct device *parent); | ||
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c index 32fd99204464..a267c6d30e37 100644 --- a/arch/arm/mach-ux500/board-mop500-pins.c +++ b/arch/arm/mach-ux500/board-mop500-pins.c | |||
@@ -30,16 +30,15 @@ static enum custom_pin_cfg_t pinsfor; | |||
30 | #define BIAS(a,b) static unsigned long a[] = { b } | 30 | #define BIAS(a,b) static unsigned long a[] = { b } |
31 | 31 | ||
32 | BIAS(pd, PIN_PULL_DOWN); | 32 | BIAS(pd, PIN_PULL_DOWN); |
33 | BIAS(slpm_gpio_nopull, PIN_SLPM_GPIO|PIN_SLPM_INPUT_NOPULL); | ||
34 | BIAS(in_nopull, PIN_INPUT_NOPULL); | 33 | BIAS(in_nopull, PIN_INPUT_NOPULL); |
35 | BIAS(in_nopull_sleep_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE); | 34 | BIAS(in_nopull_slpm_nowkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_DISABLE); |
36 | BIAS(in_pu, PIN_INPUT_PULLUP); | 35 | BIAS(in_pu, PIN_INPUT_PULLUP); |
37 | BIAS(in_pd, PIN_INPUT_PULLDOWN); | 36 | BIAS(in_pd, PIN_INPUT_PULLDOWN); |
38 | BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP); | 37 | BIAS(in_pd_slpm_in_pu, PIN_INPUT_PULLDOWN|PIN_SLPM_INPUT_PULLUP); |
39 | BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW); | 38 | BIAS(in_pu_slpm_out_lo, PIN_INPUT_PULLUP|PIN_SLPM_OUTPUT_LOW); |
40 | BIAS(out_hi, PIN_OUTPUT_HIGH); | 39 | BIAS(out_hi, PIN_OUTPUT_HIGH); |
41 | BIAS(out_lo, PIN_OUTPUT_LOW); | 40 | BIAS(out_lo, PIN_OUTPUT_LOW); |
42 | BIAS(out_lo_sleep_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE); | 41 | BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE); |
43 | /* These also force them into GPIO mode */ | 42 | /* These also force them into GPIO mode */ |
44 | BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED); | 43 | BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED); |
45 | BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED); | 44 | BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED); |
@@ -48,23 +47,32 @@ BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SL | |||
48 | BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED); | 47 | BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED); |
49 | BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED); | 48 | BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED); |
50 | /* Sleep modes */ | 49 | /* Sleep modes */ |
51 | BIAS(sleep_in_wkup_pdis, PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 50 | BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
52 | BIAS(sleep_in_nopull_wkup, PIN_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE); | 51 | BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); |
53 | BIAS(sleep_out_hi_wkup_pdis, PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 52 | BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
54 | BIAS(sleep_out_lo_wkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE); | 53 | BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
55 | BIAS(sleep_out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 54 | BIAS(slpm_out_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
55 | BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE); | ||
56 | BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | ||
57 | BIAS(slpm_in_nopull_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_INPUT_NOPULL|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | ||
56 | 58 | ||
57 | /* We use these to define hog settings that are always done on boot */ | 59 | /* We use these to define hog settings that are always done on boot */ |
58 | #define DB8500_MUX_HOG(group,func) \ | 60 | #define DB8500_MUX_HOG(group,func) \ |
59 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) | 61 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) |
60 | #define DB8500_PIN_HOG(pin,conf) \ | 62 | #define DB8500_PIN_HOG(pin,conf) \ |
61 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) | 63 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) |
64 | #define DB8500_PIN_SLEEP(pin, conf, dev) \ | ||
65 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ | ||
66 | pin, conf) | ||
62 | 67 | ||
63 | /* These are default states associated with device and changed runtime */ | 68 | /* These are default states associated with device and changed runtime */ |
64 | #define DB8500_MUX(group,func,dev) \ | 69 | #define DB8500_MUX(group,func,dev) \ |
65 | PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func) | 70 | PIN_MAP_MUX_GROUP_DEFAULT(dev, "pinctrl-db8500", group, func) |
66 | #define DB8500_PIN(pin,conf,dev) \ | 71 | #define DB8500_PIN(pin,conf,dev) \ |
67 | PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf) | 72 | PIN_MAP_CONFIGS_PIN_DEFAULT(dev, "pinctrl-db8500", pin, conf) |
73 | #define DB8500_PIN_SLEEP(pin, conf, dev) \ | ||
74 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ | ||
75 | pin, conf) | ||
68 | 76 | ||
69 | #define DB8500_PIN_SLEEP(pin,conf,dev) \ | 77 | #define DB8500_PIN_SLEEP(pin,conf,dev) \ |
70 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ | 78 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ |
@@ -134,40 +142,47 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
134 | DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */ | 142 | DB8500_PIN("GPIO2_AH4", in_pu, "uart0"), /* RXD */ |
135 | DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */ | 143 | DB8500_PIN("GPIO3_AH3", out_hi, "uart0"), /* TXD */ |
136 | /* UART0 sleep state */ | 144 | /* UART0 sleep state */ |
137 | DB8500_PIN_SLEEP("GPIO0_AJ5", sleep_in_wkup_pdis, "uart0"), | 145 | DB8500_PIN_SLEEP("GPIO0_AJ5", slpm_in_wkup_pdis, "uart0"), |
138 | DB8500_PIN_SLEEP("GPIO1_AJ3", sleep_out_hi_wkup_pdis, "uart0"), | 146 | DB8500_PIN_SLEEP("GPIO1_AJ3", slpm_out_hi_wkup_pdis, "uart0"), |
139 | DB8500_PIN_SLEEP("GPIO2_AH4", sleep_in_wkup_pdis, "uart0"), | 147 | DB8500_PIN_SLEEP("GPIO2_AH4", slpm_in_wkup_pdis, "uart0"), |
140 | DB8500_PIN_SLEEP("GPIO3_AH3", sleep_out_wkup_pdis, "uart0"), | 148 | DB8500_PIN_SLEEP("GPIO3_AH3", slpm_out_wkup_pdis, "uart0"), |
141 | /* MSP1 for ALSA codec */ | 149 | /* MSP1 for ALSA codec */ |
142 | DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"), | 150 | DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"), |
143 | DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"), | 151 | DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"), |
144 | DB8500_PIN("GPIO33_AF2", out_lo_sleep_nowkup, "ux500-msp-i2s.1"), | 152 | DB8500_PIN("GPIO33_AF2", out_lo_slpm_nowkup, "ux500-msp-i2s.1"), |
145 | DB8500_PIN("GPIO34_AE1", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"), | 153 | DB8500_PIN("GPIO34_AE1", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), |
146 | DB8500_PIN("GPIO35_AE2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"), | 154 | DB8500_PIN("GPIO35_AE2", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), |
147 | DB8500_PIN("GPIO36_AG2", in_nopull_sleep_nowkup, "ux500-msp-i2s.1"), | 155 | DB8500_PIN("GPIO36_AG2", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), |
148 | /* MSP1 sleep state */ | 156 | /* MSP1 sleep state */ |
149 | DB8500_PIN_SLEEP("GPIO33_AF2", sleep_out_lo_wkup, "ux500-msp-i2s.1"), | 157 | DB8500_PIN_SLEEP("GPIO33_AF2", slpm_out_lo_wkup, "ux500-msp-i2s.1"), |
150 | DB8500_PIN_SLEEP("GPIO34_AE1", sleep_in_nopull_wkup, "ux500-msp-i2s.1"), | 158 | DB8500_PIN_SLEEP("GPIO34_AE1", slpm_in_nopull_wkup, "ux500-msp-i2s.1"), |
151 | DB8500_PIN_SLEEP("GPIO35_AE2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"), | 159 | DB8500_PIN_SLEEP("GPIO35_AE2", slpm_in_nopull_wkup, "ux500-msp-i2s.1"), |
152 | DB8500_PIN_SLEEP("GPIO36_AG2", sleep_in_nopull_wkup, "ux500-msp-i2s.1"), | 160 | DB8500_PIN_SLEEP("GPIO36_AG2", slpm_in_nopull_wkup, "ux500-msp-i2s.1"), |
153 | /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */ | 161 | /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */ |
154 | DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"), | 162 | DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"), |
155 | DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"), | 163 | DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"), |
156 | /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */ | 164 | /* Mux in LCD VSI1 and pull it up for MCDE HDMI output */ |
157 | DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"), | 165 | DB8500_MUX("lcdvsi1_a_1", "lcd", "av8100-hdmi"), |
158 | /* Mux in I2C blocks, put pins into GPIO in sleepmode no pull-up */ | 166 | /* Mux in i2c0 block, default state */ |
159 | DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"), | 167 | DB8500_MUX("i2c0_a_1", "i2c0", "nmk-i2c.0"), |
160 | DB8500_PIN("GPIO147_C15", slpm_gpio_nopull, "nmk-i2c.0"), | 168 | /* i2c0 sleep state */ |
161 | DB8500_PIN("GPIO148_B16", slpm_gpio_nopull, "nmk-i2c.0"), | 169 | DB8500_PIN_SLEEP("GPIO147_C15", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SDA */ |
170 | DB8500_PIN_SLEEP("GPIO148_B16", slpm_in_nopull_wkup_pdis, "nmk-i2c.0"), /* SCL */ | ||
171 | /* Mux in i2c1 block, default state */ | ||
162 | DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"), | 172 | DB8500_MUX("i2c1_b_2", "i2c1", "nmk-i2c.1"), |
163 | DB8500_PIN("GPIO16_AD3", slpm_gpio_nopull, "nmk-i2c.1"), | 173 | /* i2c1 sleep state */ |
164 | DB8500_PIN("GPIO17_AD4", slpm_gpio_nopull, "nmk-i2c.1"), | 174 | DB8500_PIN_SLEEP("GPIO16_AD3", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SDA */ |
175 | DB8500_PIN_SLEEP("GPIO17_AD4", slpm_in_nopull_wkup_pdis, "nmk-i2c.1"), /* SCL */ | ||
176 | /* Mux in i2c2 block, default state */ | ||
165 | DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"), | 177 | DB8500_MUX("i2c2_b_2", "i2c2", "nmk-i2c.2"), |
166 | DB8500_PIN("GPIO10_AF5", slpm_gpio_nopull, "nmk-i2c.2"), | 178 | /* i2c2 sleep state */ |
167 | DB8500_PIN("GPIO11_AG4", slpm_gpio_nopull, "nmk-i2c.2"), | 179 | DB8500_PIN_SLEEP("GPIO10_AF5", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SDA */ |
180 | DB8500_PIN_SLEEP("GPIO11_AG4", slpm_in_nopull_wkup_pdis, "nmk-i2c.2"), /* SCL */ | ||
181 | /* Mux in i2c3 block, default state */ | ||
168 | DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"), | 182 | DB8500_MUX("i2c3_c_2", "i2c3", "nmk-i2c.3"), |
169 | DB8500_PIN("GPIO229_AG7", slpm_gpio_nopull, "nmk-i2c.3"), | 183 | /* i2c3 sleep state */ |
170 | DB8500_PIN("GPIO230_AF7", slpm_gpio_nopull, "nmk-i2c.3"), | 184 | DB8500_PIN_SLEEP("GPIO229_AG7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SDA */ |
185 | DB8500_PIN_SLEEP("GPIO230_AF7", slpm_in_nopull_wkup_pdis, "nmk-i2c.3"), /* SCL */ | ||
171 | /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */ | 186 | /* Mux in SDI0 (here called MC0) used for removable MMC/SD/SDIO cards */ |
172 | DB8500_MUX("mc0_a_1", "mc0", "sdi0"), | 187 | DB8500_MUX("mc0_a_1", "mc0", "sdi0"), |
173 | DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */ | 188 | DB8500_PIN("GPIO18_AC2", out_hi, "sdi0"), /* CMDDIR */ |
@@ -219,11 +234,15 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
219 | DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), | 234 | DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), |
220 | DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ | 235 | DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ |
221 | /* Mux in SPI2 pins on the "other C1" altfunction */ | 236 | /* Mux in SPI2 pins on the "other C1" altfunction */ |
222 | DB8500_MUX("spi2_oc1_1", "spi2", "spi2"), | 237 | DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), |
223 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ | 238 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ |
224 | DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */ | 239 | DB8500_PIN("GPIO218_AH11", in_pd, "spi2"), /* RXD */ |
225 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ | 240 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ |
226 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ | 241 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ |
242 | /* SPI2 sleep state */ | ||
243 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ | ||
244 | DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ | ||
245 | DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ | ||
227 | }; | 246 | }; |
228 | 247 | ||
229 | /* | 248 | /* |
@@ -410,7 +429,7 @@ static struct pinctrl_map __initdata u9500_pinmap[] = { | |||
410 | DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu), | 429 | DB8500_PIN_HOG("GPIO144_B13", gpio_in_pu), |
411 | /* HSI */ | 430 | /* HSI */ |
412 | DB8500_MUX_HOG("hsir_a_1", "hsi"), | 431 | DB8500_MUX_HOG("hsir_a_1", "hsi"), |
413 | DB8500_MUX_HOG("hsit_a_1", "hsi"), | 432 | DB8500_MUX_HOG("hsit_a_2", "hsi"), |
414 | DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */ | 433 | DB8500_PIN_HOG("GPIO219_AG10", in_pd), /* RX FLA0 */ |
415 | DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */ | 434 | DB8500_PIN_HOG("GPIO220_AH10", in_pd), /* RX DAT0 */ |
416 | DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */ | 435 | DB8500_PIN_HOG("GPIO221_AJ11", out_lo), /* RX RDY0 */ |
@@ -418,7 +437,7 @@ static struct pinctrl_map __initdata u9500_pinmap[] = { | |||
418 | DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */ | 437 | DB8500_PIN_HOG("GPIO223_AH9", out_lo), /* TX DAT0 */ |
419 | DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */ | 438 | DB8500_PIN_HOG("GPIO224_AG9", in_pd), /* TX RDY0 */ |
420 | DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */ | 439 | DB8500_PIN_HOG("GPIO225_AG8", in_pd), /* CAWAKE0 */ |
421 | DB8500_PIN_HOG("GPIO226_AF8", out_hi), /* ACWAKE0 */ | 440 | DB8500_PIN_HOG("GPIO226_AF8", gpio_out_hi), /* ACWAKE0 */ |
422 | }; | 441 | }; |
423 | 442 | ||
424 | static struct pinctrl_map __initdata u8500_pinmap[] = { | 443 | static struct pinctrl_map __initdata u8500_pinmap[] = { |
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index 52426a425787..2a17bc506cff 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c | |||
@@ -13,6 +13,21 @@ | |||
13 | #include <linux/regulator/ab8500.h> | 13 | #include <linux/regulator/ab8500.h> |
14 | #include "board-mop500-regulators.h" | 14 | #include "board-mop500-regulators.h" |
15 | 15 | ||
16 | static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { | ||
17 | REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), | ||
18 | }; | ||
19 | |||
20 | struct regulator_init_data gpio_en_3v3_regulator = { | ||
21 | .constraints = { | ||
22 | .name = "EN-3V3", | ||
23 | .min_uV = 3300000, | ||
24 | .max_uV = 3300000, | ||
25 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | ||
26 | }, | ||
27 | .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), | ||
28 | .consumer_supplies = gpio_en_3v3_consumers, | ||
29 | }; | ||
30 | |||
16 | /* | 31 | /* |
17 | * TPS61052 regulator | 32 | * TPS61052 regulator |
18 | */ | 33 | */ |
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h index 94992158d962..78a0642a2206 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.h +++ b/arch/arm/mach-ux500/board-mop500-regulators.h | |||
@@ -18,5 +18,6 @@ extern struct ab8500_regulator_reg_init | |||
18 | ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; | 18 | ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; |
19 | extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; | 19 | extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; |
20 | extern struct regulator_init_data tps61052_regulator; | 20 | extern struct regulator_init_data tps61052_regulator; |
21 | extern struct regulator_init_data gpio_en_3v3_regulator; | ||
21 | 22 | ||
22 | #endif | 23 | #endif |
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index 18ff781cfbe4..9c8e4a9e83ee 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c | |||
@@ -152,7 +152,7 @@ static struct stedma40_chan_cfg sdi1_dma_cfg_tx = { | |||
152 | }; | 152 | }; |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | static struct mmci_platform_data mop500_sdi1_data = { | 155 | struct mmci_platform_data mop500_sdi1_data = { |
156 | .ocr_mask = MMC_VDD_29_30, | 156 | .ocr_mask = MMC_VDD_29_30, |
157 | .f_max = 50000000, | 157 | .f_max = 50000000, |
158 | .capabilities = MMC_CAP_4_BIT_DATA, | 158 | .capabilities = MMC_CAP_4_BIT_DATA, |
@@ -189,7 +189,7 @@ static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = { | |||
189 | }; | 189 | }; |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | static struct mmci_platform_data mop500_sdi2_data = { | 192 | struct mmci_platform_data mop500_sdi2_data = { |
193 | .ocr_mask = MMC_VDD_165_195, | 193 | .ocr_mask = MMC_VDD_165_195, |
194 | .f_max = 50000000, | 194 | .f_max = 50000000, |
195 | .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | | 195 | .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | |
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 7ebfcc7d7515..416d436111f2 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
24 | #include <linux/mfd/abx500/ab8500.h> | 24 | #include <linux/mfd/abx500/ab8500.h> |
25 | #include <linux/regulator/ab8500.h> | 25 | #include <linux/regulator/ab8500.h> |
26 | #include <linux/regulator/fixed.h> | ||
26 | #include <linux/mfd/tc3589x.h> | 27 | #include <linux/mfd/tc3589x.h> |
27 | #include <linux/mfd/tps6105x.h> | 28 | #include <linux/mfd/tps6105x.h> |
28 | #include <linux/mfd/abx500/ab8500-gpio.h> | 29 | #include <linux/mfd/abx500/ab8500-gpio.h> |
@@ -54,7 +55,6 @@ | |||
54 | #include "devices-db8500.h" | 55 | #include "devices-db8500.h" |
55 | #include "board-mop500.h" | 56 | #include "board-mop500.h" |
56 | #include "board-mop500-regulators.h" | 57 | #include "board-mop500-regulators.h" |
57 | #include "board-mop500-msp.h" | ||
58 | 58 | ||
59 | static struct gpio_led snowball_led_array[] = { | 59 | static struct gpio_led snowball_led_array[] = { |
60 | { | 60 | { |
@@ -76,6 +76,23 @@ static struct platform_device snowball_led_dev = { | |||
76 | }, | 76 | }, |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static struct fixed_voltage_config snowball_gpio_en_3v3_data = { | ||
80 | .supply_name = "EN-3V3", | ||
81 | .gpio = SNOWBALL_EN_3V3_ETH_GPIO, | ||
82 | .microvolts = 3300000, | ||
83 | .enable_high = 1, | ||
84 | .init_data = &gpio_en_3v3_regulator, | ||
85 | .startup_delay = 5000, /* 1200us */ | ||
86 | }; | ||
87 | |||
88 | static struct platform_device snowball_gpio_en_3v3_regulator_dev = { | ||
89 | .name = "reg-fixed-voltage", | ||
90 | .id = 1, | ||
91 | .dev = { | ||
92 | .platform_data = &snowball_gpio_en_3v3_data, | ||
93 | }, | ||
94 | }; | ||
95 | |||
79 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { | 96 | static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { |
80 | .gpio_base = MOP500_AB8500_PIN_GPIO(1), | 97 | .gpio_base = MOP500_AB8500_PIN_GPIO(1), |
81 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, | 98 | .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, |
@@ -565,6 +582,7 @@ static struct platform_device *snowball_platform_devs[] __initdata = { | |||
565 | &snowball_led_dev, | 582 | &snowball_led_dev, |
566 | &snowball_key_dev, | 583 | &snowball_key_dev, |
567 | &snowball_sbnet_dev, | 584 | &snowball_sbnet_dev, |
585 | &snowball_gpio_en_3v3_regulator_dev, | ||
568 | }; | 586 | }; |
569 | 587 | ||
570 | static void __init mop500_init_machine(void) | 588 | static void __init mop500_init_machine(void) |
@@ -587,7 +605,7 @@ static void __init mop500_init_machine(void) | |||
587 | mop500_i2c_init(parent); | 605 | mop500_i2c_init(parent); |
588 | mop500_sdi_init(parent); | 606 | mop500_sdi_init(parent); |
589 | mop500_spi_init(parent); | 607 | mop500_spi_init(parent); |
590 | mop500_msp_init(parent); | 608 | mop500_audio_init(parent); |
591 | mop500_uart_init(parent); | 609 | mop500_uart_init(parent); |
592 | 610 | ||
593 | u8500_cryp1_hash1_init(parent); | 611 | u8500_cryp1_hash1_init(parent); |
@@ -621,7 +639,7 @@ static void __init snowball_init_machine(void) | |||
621 | mop500_i2c_init(parent); | 639 | mop500_i2c_init(parent); |
622 | snowball_sdi_init(parent); | 640 | snowball_sdi_init(parent); |
623 | mop500_spi_init(parent); | 641 | mop500_spi_init(parent); |
624 | mop500_msp_init(parent); | 642 | mop500_audio_init(parent); |
625 | mop500_uart_init(parent); | 643 | mop500_uart_init(parent); |
626 | 644 | ||
627 | /* This board has full regulator constraints */ | 645 | /* This board has full regulator constraints */ |
@@ -653,7 +671,7 @@ static void __init hrefv60_init_machine(void) | |||
653 | mop500_i2c_init(parent); | 671 | mop500_i2c_init(parent); |
654 | hrefv60_sdi_init(parent); | 672 | hrefv60_sdi_init(parent); |
655 | mop500_spi_init(parent); | 673 | mop500_spi_init(parent); |
656 | mop500_msp_init(parent); | 674 | mop500_audio_init(parent); |
657 | mop500_uart_init(parent); | 675 | mop500_uart_init(parent); |
658 | 676 | ||
659 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | 677 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
@@ -708,12 +726,9 @@ MACHINE_END | |||
708 | 726 | ||
709 | #ifdef CONFIG_MACH_UX500_DT | 727 | #ifdef CONFIG_MACH_UX500_DT |
710 | 728 | ||
711 | static struct platform_device *snowball_of_platform_devs[] __initdata = { | ||
712 | &snowball_led_dev, | ||
713 | &snowball_key_dev, | ||
714 | }; | ||
715 | |||
716 | struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | 729 | struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { |
730 | /* Requires call-back bindings. */ | ||
731 | OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), | ||
717 | /* Requires DMA and call-back bindings. */ | 732 | /* Requires DMA and call-back bindings. */ |
718 | OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), | 733 | OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), |
719 | OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), | 734 | OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), |
@@ -721,6 +736,8 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | |||
721 | /* Requires DMA bindings. */ | 736 | /* Requires DMA bindings. */ |
722 | OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), | 737 | OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), |
723 | OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), | 738 | OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), |
739 | OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), | ||
740 | OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data), | ||
724 | OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), | 741 | OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), |
725 | /* Requires clock name bindings. */ | 742 | /* Requires clock name bindings. */ |
726 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL), | 743 | OF_DEV_AUXDATA("st,nomadik-gpio", 0x8012e000, "gpio.0", NULL), |
@@ -739,6 +756,15 @@ struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { | |||
739 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), | 756 | OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), |
740 | /* Requires device name bindings. */ | 757 | /* Requires device name bindings. */ |
741 | OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL), | 758 | OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL), |
759 | /* Requires clock name and DMA bindings. */ | ||
760 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, | ||
761 | "ux500-msp-i2s.0", &msp0_platform_data), | ||
762 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000, | ||
763 | "ux500-msp-i2s.1", &msp1_platform_data), | ||
764 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80117000, | ||
765 | "ux500-msp-i2s.2", &msp2_platform_data), | ||
766 | OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, | ||
767 | "ux500-msp-i2s.3", &msp3_platform_data), | ||
742 | {}, | 768 | {}, |
743 | }; | 769 | }; |
744 | 770 | ||
@@ -779,7 +805,7 @@ static void __init u8500_init_machine(void) | |||
779 | ARRAY_SIZE(mop500_platform_devs)); | 805 | ARRAY_SIZE(mop500_platform_devs)); |
780 | 806 | ||
781 | mop500_sdi_init(parent); | 807 | mop500_sdi_init(parent); |
782 | mop500_msp_init(parent); | 808 | mop500_audio_init(parent); |
783 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | 809 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); |
784 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | 810 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); |
785 | i2c_register_board_info(2, mop500_i2c2_devices, | 811 | i2c_register_board_info(2, mop500_i2c2_devices, |
@@ -788,7 +814,7 @@ static void __init u8500_init_machine(void) | |||
788 | mop500_uib_init(); | 814 | mop500_uib_init(); |
789 | 815 | ||
790 | } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { | 816 | } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { |
791 | mop500_msp_init(parent); | 817 | mop500_of_audio_init(parent); |
792 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) { | 818 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) { |
793 | /* | 819 | /* |
794 | * The HREFv60 board removed a GPIO expander and routed | 820 | * The HREFv60 board removed a GPIO expander and routed |
@@ -799,16 +825,6 @@ static void __init u8500_init_machine(void) | |||
799 | platform_add_devices(mop500_platform_devs, | 825 | platform_add_devices(mop500_platform_devs, |
800 | ARRAY_SIZE(mop500_platform_devs)); | 826 | ARRAY_SIZE(mop500_platform_devs)); |
801 | 827 | ||
802 | hrefv60_sdi_init(parent); | ||
803 | mop500_msp_init(parent); | ||
804 | |||
805 | i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); | ||
806 | i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES; | ||
807 | |||
808 | i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); | ||
809 | i2c_register_board_info(2, mop500_i2c2_devices, | ||
810 | ARRAY_SIZE(mop500_i2c2_devices)); | ||
811 | |||
812 | mop500_uib_init(); | 828 | mop500_uib_init(); |
813 | } | 829 | } |
814 | 830 | ||
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index b5bfc1a78b1a..aca39a68712a 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | /* For NOMADIK_NR_GPIO */ | 10 | /* For NOMADIK_NR_GPIO */ |
11 | #include <mach/irqs.h> | 11 | #include <mach/irqs.h> |
12 | #include <mach/msp.h> | ||
12 | #include <linux/amba/mmci.h> | 13 | #include <linux/amba/mmci.h> |
13 | 14 | ||
14 | /* Snowball specific GPIO assignments, this board has no GPIO expander */ | 15 | /* Snowball specific GPIO assignments, this board has no GPIO expander */ |
@@ -80,7 +81,14 @@ | |||
80 | struct device; | 81 | struct device; |
81 | struct i2c_board_info; | 82 | struct i2c_board_info; |
82 | extern struct mmci_platform_data mop500_sdi0_data; | 83 | extern struct mmci_platform_data mop500_sdi0_data; |
84 | extern struct mmci_platform_data mop500_sdi1_data; | ||
85 | extern struct mmci_platform_data mop500_sdi2_data; | ||
83 | extern struct mmci_platform_data mop500_sdi4_data; | 86 | extern struct mmci_platform_data mop500_sdi4_data; |
87 | extern struct msp_i2s_platform_data msp0_platform_data; | ||
88 | extern struct msp_i2s_platform_data msp1_platform_data; | ||
89 | extern struct msp_i2s_platform_data msp2_platform_data; | ||
90 | extern struct msp_i2s_platform_data msp3_platform_data; | ||
91 | extern struct arm_pmu_platdata db8500_pmu_platdata; | ||
84 | 92 | ||
85 | extern void mop500_sdi_init(struct device *parent); | 93 | extern void mop500_sdi_init(struct device *parent); |
86 | extern void snowball_sdi_init(struct device *parent); | 94 | extern void snowball_sdi_init(struct device *parent); |
@@ -91,6 +99,9 @@ void __init mop500_stuib_init(void); | |||
91 | void __init mop500_pinmaps_init(void); | 99 | void __init mop500_pinmaps_init(void); |
92 | void __init snowball_pinmaps_init(void); | 100 | void __init snowball_pinmaps_init(void); |
93 | void __init hrefv60_pinmaps_init(void); | 101 | void __init hrefv60_pinmaps_init(void); |
102 | void mop500_audio_init(struct device *parent); | ||
103 | /* Due for removal once the MSP driver has been fully DT:ed. */ | ||
104 | void mop500_of_audio_init(struct device *parent); | ||
94 | 105 | ||
95 | int __init mop500_uib_init(void); | 106 | int __init mop500_uib_init(void); |
96 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, | 107 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, |
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index aef2c68e9ec1..bcdfe6b1d453 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/mfd/abx500/ab8500.h> | 19 | #include <linux/mfd/abx500/ab8500.h> |
20 | 20 | ||
21 | #include <asm/pmu.h> | ||
21 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
22 | #include <plat/gpio-nomadik.h> | 23 | #include <plat/gpio-nomadik.h> |
23 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
@@ -137,10 +138,6 @@ static struct platform_device *platform_devs[] __initdata = { | |||
137 | &db8500_prcmu_device, | 138 | &db8500_prcmu_device, |
138 | }; | 139 | }; |
139 | 140 | ||
140 | static struct platform_device *of_platform_devs[] __initdata = { | ||
141 | &u8500_dma40_device, | ||
142 | }; | ||
143 | |||
144 | static resource_size_t __initdata db8500_gpio_base[] = { | 141 | static resource_size_t __initdata db8500_gpio_base[] = { |
145 | U8500_GPIOBANK0_BASE, | 142 | U8500_GPIOBANK0_BASE, |
146 | U8500_GPIOBANK1_BASE, | 143 | U8500_GPIOBANK1_BASE, |
@@ -234,7 +231,6 @@ struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500) | |||
234 | struct device * __init u8500_of_init_devices(void) | 231 | struct device * __init u8500_of_init_devices(void) |
235 | { | 232 | { |
236 | struct device *parent; | 233 | struct device *parent; |
237 | int i; | ||
238 | 234 | ||
239 | parent = db8500_soc_device_init(); | 235 | parent = db8500_soc_device_init(); |
240 | 236 | ||
@@ -243,8 +239,7 @@ struct device * __init u8500_of_init_devices(void) | |||
243 | platform_device_register_data(parent, | 239 | platform_device_register_data(parent, |
244 | "cpufreq-u8500", -1, NULL, 0); | 240 | "cpufreq-u8500", -1, NULL, 0); |
245 | 241 | ||
246 | for (i = 0; i < ARRAY_SIZE(of_platform_devs); i++) | 242 | u8500_dma40_device.dev.parent = parent; |
247 | of_platform_devs[i]->dev.parent = parent; | ||
248 | 243 | ||
249 | /* | 244 | /* |
250 | * Devices to be DT:ed: | 245 | * Devices to be DT:ed: |
@@ -252,7 +247,7 @@ struct device * __init u8500_of_init_devices(void) | |||
252 | * db8500_pmu_device = done | 247 | * db8500_pmu_device = done |
253 | * db8500_prcmu_device = done | 248 | * db8500_prcmu_device = done |
254 | */ | 249 | */ |
255 | platform_add_devices(of_platform_devs, ARRAY_SIZE(of_platform_devs)); | 250 | platform_device_register(&u8500_dma40_device); |
256 | 251 | ||
257 | return parent; | 252 | return parent; |
258 | } | 253 | } |
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 3d62c64c84c4..2236cbd03cd7 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
@@ -49,6 +49,8 @@ void __init ux500_init_irq(void) | |||
49 | void __iomem *dist_base; | 49 | void __iomem *dist_base; |
50 | void __iomem *cpu_base; | 50 | void __iomem *cpu_base; |
51 | 51 | ||
52 | gic_arch_extn.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND; | ||
53 | |||
52 | if (cpu_is_u8500_family() || cpu_is_ux540_family()) { | 54 | if (cpu_is_u8500_family() || cpu_is_ux540_family()) { |
53 | dist_base = __io_address(U8500_GIC_DIST_BASE); | 55 | dist_base = __io_address(U8500_GIC_DIST_BASE); |
54 | cpu_base = __io_address(U8500_GIC_CPU_BASE); | 56 | cpu_base = __io_address(U8500_GIC_CPU_BASE); |
diff --git a/arch/arm/mach-ux500/include/mach/msp.h b/arch/arm/mach-ux500/include/mach/msp.h index 798be19129ef..3cc7142eee02 100644 --- a/arch/arm/mach-ux500/include/mach/msp.h +++ b/arch/arm/mach-ux500/include/mach/msp.h | |||
@@ -22,8 +22,6 @@ struct msp_i2s_platform_data { | |||
22 | enum msp_i2s_id id; | 22 | enum msp_i2s_id id; |
23 | struct stedma40_chan_cfg *msp_i2s_dma_rx; | 23 | struct stedma40_chan_cfg *msp_i2s_dma_rx; |
24 | struct stedma40_chan_cfg *msp_i2s_dma_tx; | 24 | struct stedma40_chan_cfg *msp_i2s_dma_tx; |
25 | int (*msp_i2s_init) (void); | ||
26 | int (*msp_i2s_exit) (void); | ||
27 | }; | 25 | }; |
28 | 26 | ||
29 | #endif | 27 | #endif |
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h index 34775baadaea..d60ecd1753f0 100644 --- a/arch/arm/mach-ux500/include/mach/uncompress.h +++ b/arch/arm/mach-ux500/include/mach/uncompress.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/amba/serial.h> | 24 | #include <linux/amba/serial.h> |
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | 26 | ||
27 | u32 ux500_uart_base; | 27 | void __iomem *ux500_uart_base; |
28 | 28 | ||
29 | static void putc(const char c) | 29 | static void putc(const char c) |
30 | { | 30 | { |
@@ -51,7 +51,7 @@ static void flush(void) | |||
51 | static inline void arch_decomp_setup(void) | 51 | static inline void arch_decomp_setup(void) |
52 | { | 52 | { |
53 | /* Use machine_is_foo() macro if you need to switch base someday */ | 53 | /* Use machine_is_foo() macro if you need to switch base someday */ |
54 | ux500_uart_base = U8500_UART2_BASE; | 54 | ux500_uart_base = (void __iomem *)U8500_UART2_BASE; |
55 | } | 55 | } |
56 | 56 | ||
57 | #define arch_decomp_wdog() /* nothing to do here */ | 57 | #define arch_decomp_wdog() /* nothing to do here */ |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index ca7902c6ed18..5b5c1eeb5b5c 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/mtd/physmap.h> | 37 | #include <linux/mtd/physmap.h> |
38 | 38 | ||
39 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
40 | #include <asm/leds.h> | ||
41 | #include <asm/hardware/arm_timer.h> | 40 | #include <asm/hardware/arm_timer.h> |
42 | #include <asm/hardware/icst.h> | 41 | #include <asm/hardware/icst.h> |
43 | #include <asm/hardware/vic.h> | 42 | #include <asm/hardware/vic.h> |
@@ -758,10 +757,6 @@ void __init versatile_init(void) | |||
758 | struct amba_device *d = amba_devs[i]; | 757 | struct amba_device *d = amba_devs[i]; |
759 | amba_device_register(d, &iomem_resource); | 758 | amba_device_register(d, &iomem_resource); |
760 | } | 759 | } |
761 | |||
762 | #ifdef CONFIG_LEDS | ||
763 | leds_event = versatile_leds_event; | ||
764 | #endif | ||
765 | } | 760 | } |
766 | 761 | ||
767 | /* | 762 | /* |
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 5f6b7d543e55..560e0df728f8 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -659,6 +659,7 @@ static void __init v2m_dt_init(void) | |||
659 | 659 | ||
660 | const static char *v2m_dt_match[] __initconst = { | 660 | const static char *v2m_dt_match[] __initconst = { |
661 | "arm,vexpress", | 661 | "arm,vexpress", |
662 | "xen,xenvm", | ||
662 | NULL, | 663 | NULL, |
663 | }; | 664 | }; |
664 | 665 | ||
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig deleted file mode 100644 index 2c20a341c11a..000000000000 --- a/arch/arm/mach-vt8500/Kconfig +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | if ARCH_VT8500 | ||
2 | |||
3 | config VTWM_VERSION_VT8500 | ||
4 | bool | ||
5 | |||
6 | config VTWM_VERSION_WM8505 | ||
7 | bool | ||
8 | |||
9 | config MACH_BV07 | ||
10 | bool "Benign BV07-8500 Mini Netbook" | ||
11 | depends on ARCH_VT8500 | ||
12 | select VTWM_VERSION_VT8500 | ||
13 | help | ||
14 | Add support for the inexpensive 7-inch netbooks sold by many | ||
15 | Chinese distributors under various names. Note that there are | ||
16 | many hardware implementations in identical exterior, make sure | ||
17 | that yours is indeed based on a VIA VT8500 chip. | ||
18 | |||
19 | config MACH_WM8505_7IN_NETBOOK | ||
20 | bool "WM8505 7-inch generic netbook" | ||
21 | depends on ARCH_VT8500 | ||
22 | select VTWM_VERSION_WM8505 | ||
23 | help | ||
24 | Add support for the inexpensive 7-inch netbooks sold by many | ||
25 | Chinese distributors under various names. Note that there are | ||
26 | many hardware implementations in identical exterior, make sure | ||
27 | that yours is indeed based on a WonderMedia WM8505 chip. | ||
28 | |||
29 | comment "LCD panel size" | ||
30 | |||
31 | config WMT_PANEL_800X480 | ||
32 | bool "7-inch with 800x480 resolution" | ||
33 | depends on (FB_VT8500 || FB_WM8505) | ||
34 | default y | ||
35 | help | ||
36 | These are found in most of the netbooks in generic cases, as | ||
37 | well as in Eken M001 tablets and possibly elsewhere. | ||
38 | |||
39 | To select this panel at runtime, say y here and append | ||
40 | 'panel=800x480' to your kernel command line. Otherwise, the | ||
41 | largest one available will be used. | ||
42 | |||
43 | config WMT_PANEL_800X600 | ||
44 | bool "8-inch with 800x600 resolution" | ||
45 | depends on (FB_VT8500 || FB_WM8505) | ||
46 | help | ||
47 | These are found in Eken M003 tablets and possibly elsewhere. | ||
48 | |||
49 | To select this panel at runtime, say y here and append | ||
50 | 'panel=800x600' to your kernel command line. Otherwise, the | ||
51 | largest one available will be used. | ||
52 | |||
53 | config WMT_PANEL_1024X576 | ||
54 | bool "10-inch with 1024x576 resolution" | ||
55 | depends on (FB_VT8500 || FB_WM8505) | ||
56 | help | ||
57 | These are found in CherryPal netbooks and possibly elsewhere. | ||
58 | |||
59 | To select this panel at runtime, say y here and append | ||
60 | 'panel=1024x576' to your kernel command line. Otherwise, the | ||
61 | largest one available will be used. | ||
62 | |||
63 | config WMT_PANEL_1024X600 | ||
64 | bool "10-inch with 1024x600 resolution" | ||
65 | depends on (FB_VT8500 || FB_WM8505) | ||
66 | help | ||
67 | These are found in Eken M006 tablets and possibly elsewhere. | ||
68 | |||
69 | To select this panel at runtime, say y here and append | ||
70 | 'panel=1024x600' to your kernel command line. Otherwise, the | ||
71 | largest one available will be used. | ||
72 | |||
73 | endif | ||
diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile index 7ce51767c99c..e035251cda48 100644 --- a/arch/arm/mach-vt8500/Makefile +++ b/arch/arm/mach-vt8500/Makefile | |||
@@ -1,7 +1 @@ | |||
1 | obj-y += devices.o gpio.o irq.o timer.o restart.o | obj-$(CONFIG_ARCH_VT8500) += irq.o timer.o vt8500.o | |
2 | |||
3 | obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o | ||
4 | obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o | ||
5 | |||
6 | obj-$(CONFIG_MACH_BV07) += bv07.o | ||
7 | obj-$(CONFIG_MACH_WM8505_7IN_NETBOOK) += wm8505_7in.o | ||
diff --git a/arch/arm/mach-vt8500/bv07.c b/arch/arm/mach-vt8500/bv07.c deleted file mode 100644 index f9fbeb2d10e9..000000000000 --- a/arch/arm/mach-vt8500/bv07.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/bv07.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/io.h> | ||
22 | #include <linux/pm.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/mach/arch.h> | ||
26 | #include <mach/restart.h> | ||
27 | |||
28 | #include "devices.h" | ||
29 | |||
30 | static void __iomem *pmc_hiber; | ||
31 | |||
32 | static struct platform_device *devices[] __initdata = { | ||
33 | &vt8500_device_uart0, | ||
34 | &vt8500_device_lcdc, | ||
35 | &vt8500_device_ehci, | ||
36 | &vt8500_device_ge_rops, | ||
37 | &vt8500_device_pwm, | ||
38 | &vt8500_device_pwmbl, | ||
39 | &vt8500_device_rtc, | ||
40 | }; | ||
41 | |||
42 | static void vt8500_power_off(void) | ||
43 | { | ||
44 | local_irq_disable(); | ||
45 | writew(5, pmc_hiber); | ||
46 | asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); | ||
47 | } | ||
48 | |||
49 | void __init bv07_init(void) | ||
50 | { | ||
51 | #ifdef CONFIG_FB_VT8500 | ||
52 | void __iomem *gpio_mux_reg = ioremap(wmt_gpio_base + 0x200, 4); | ||
53 | if (gpio_mux_reg) { | ||
54 | writel(readl(gpio_mux_reg) | 1, gpio_mux_reg); | ||
55 | iounmap(gpio_mux_reg); | ||
56 | } else { | ||
57 | printk(KERN_ERR "Could not remap the GPIO mux register, display may not work properly!\n"); | ||
58 | } | ||
59 | #endif | ||
60 | pmc_hiber = ioremap(wmt_pmc_base + 0x12, 2); | ||
61 | if (pmc_hiber) | ||
62 | pm_power_off = &vt8500_power_off; | ||
63 | else | ||
64 | printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); | ||
65 | |||
66 | wmt_setup_restart(); | ||
67 | vt8500_set_resources(); | ||
68 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
69 | vt8500_gpio_init(); | ||
70 | } | ||
71 | |||
72 | MACHINE_START(BV07, "Benign BV07 Mini Netbook") | ||
73 | .atag_offset = 0x100, | ||
74 | .restart = wmt_restart, | ||
75 | .reserve = vt8500_reserve_mem, | ||
76 | .map_io = vt8500_map_io, | ||
77 | .init_irq = vt8500_init_irq, | ||
78 | .timer = &vt8500_timer, | ||
79 | .init_machine = bv07_init, | ||
80 | MACHINE_END | ||
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-vt8500/common.h index a978b3cc3a8d..2b2419646e95 100644 --- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h +++ b/arch/arm/mach-vt8500/common.h | |||
@@ -1,10 +1,6 @@ | |||
1 | /* | 1 | /* linux/arch/arm/mach-vt8500/dt_common.h |
2 | * arch/arm/mach-tegra/include/mach/gpio.h | ||
3 | * | 2 | * |
4 | * Copyright (C) 2010 Google, Inc. | 3 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> |
5 | * | ||
6 | * Author: | ||
7 | * Erik Gilling <konkers@google.com> | ||
8 | * | 4 | * |
9 | * This software is licensed under the terms of the GNU General Public | 5 | * This software is licensed under the terms of the GNU General Public |
10 | * License version 2, as published by the Free Software Foundation, and | 6 | * License version 2, as published by the Free Software Foundation, and |
@@ -17,12 +13,16 @@ | |||
17 | * | 13 | * |
18 | */ | 14 | */ |
19 | 15 | ||
20 | #ifndef __MACH_TEGRA_GPIO_TEGRA_H | 16 | #ifndef __ARCH_ARM_MACH_VT8500_DT_COMMON_H |
21 | #define __MACH_TEGRA_GPIO_TEGRA_H | 17 | #define __ARCH_ARM_MACH_VT8500_DT_COMMON_H |
18 | |||
19 | #include <linux/of.h> | ||
22 | 20 | ||
23 | #include <linux/types.h> | 21 | void __init vt8500_timer_init(void); |
24 | #include <mach/irqs.h> | 22 | int __init vt8500_irq_init(struct device_node *node, |
23 | struct device_node *parent); | ||
25 | 24 | ||
26 | #define TEGRA_NR_GPIOS INT_GPIO_NR | 25 | /* defined in drivers/clk/clk-vt8500.c */ |
26 | void __init vtwm_clk_init(void __iomem *pmc_base); | ||
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-vt8500/devices-vt8500.c b/arch/arm/mach-vt8500/devices-vt8500.c deleted file mode 100644 index 19519aeecf37..000000000000 --- a/arch/arm/mach-vt8500/devices-vt8500.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/devices-vt8500.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
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 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/vt8500_regs.h> | ||
19 | #include <mach/vt8500_irqs.h> | ||
20 | #include <mach/i8042.h> | ||
21 | #include "devices.h" | ||
22 | |||
23 | void __init vt8500_set_resources(void) | ||
24 | { | ||
25 | struct resource tmp[3]; | ||
26 | |||
27 | tmp[0] = wmt_mmio_res(VT8500_LCDC_BASE, SZ_1K); | ||
28 | tmp[1] = wmt_irq_res(IRQ_LCDC); | ||
29 | wmt_res_add(&vt8500_device_lcdc, tmp, 2); | ||
30 | |||
31 | tmp[0] = wmt_mmio_res(VT8500_UART0_BASE, 0x1040); | ||
32 | tmp[1] = wmt_irq_res(IRQ_UART0); | ||
33 | wmt_res_add(&vt8500_device_uart0, tmp, 2); | ||
34 | |||
35 | tmp[0] = wmt_mmio_res(VT8500_UART1_BASE, 0x1040); | ||
36 | tmp[1] = wmt_irq_res(IRQ_UART1); | ||
37 | wmt_res_add(&vt8500_device_uart1, tmp, 2); | ||
38 | |||
39 | tmp[0] = wmt_mmio_res(VT8500_UART2_BASE, 0x1040); | ||
40 | tmp[1] = wmt_irq_res(IRQ_UART2); | ||
41 | wmt_res_add(&vt8500_device_uart2, tmp, 2); | ||
42 | |||
43 | tmp[0] = wmt_mmio_res(VT8500_UART3_BASE, 0x1040); | ||
44 | tmp[1] = wmt_irq_res(IRQ_UART3); | ||
45 | wmt_res_add(&vt8500_device_uart3, tmp, 2); | ||
46 | |||
47 | tmp[0] = wmt_mmio_res(VT8500_EHCI_BASE, SZ_512); | ||
48 | tmp[1] = wmt_irq_res(IRQ_EHCI); | ||
49 | wmt_res_add(&vt8500_device_ehci, tmp, 2); | ||
50 | |||
51 | tmp[0] = wmt_mmio_res(VT8500_GEGEA_BASE, SZ_256); | ||
52 | wmt_res_add(&vt8500_device_ge_rops, tmp, 1); | ||
53 | |||
54 | tmp[0] = wmt_mmio_res(VT8500_PWM_BASE, 0x44); | ||
55 | wmt_res_add(&vt8500_device_pwm, tmp, 1); | ||
56 | |||
57 | tmp[0] = wmt_mmio_res(VT8500_RTC_BASE, 0x2c); | ||
58 | tmp[1] = wmt_irq_res(IRQ_RTC); | ||
59 | tmp[2] = wmt_irq_res(IRQ_RTCSM); | ||
60 | wmt_res_add(&vt8500_device_rtc, tmp, 3); | ||
61 | } | ||
62 | |||
63 | static void __init vt8500_set_externs(void) | ||
64 | { | ||
65 | /* Non-resource-aware stuff */ | ||
66 | wmt_ic_base = VT8500_IC_BASE; | ||
67 | wmt_gpio_base = VT8500_GPIO_BASE; | ||
68 | wmt_pmc_base = VT8500_PMC_BASE; | ||
69 | wmt_i8042_base = VT8500_PS2_BASE; | ||
70 | |||
71 | wmt_nr_irqs = VT8500_NR_IRQS; | ||
72 | wmt_timer_irq = IRQ_PMCOS0; | ||
73 | wmt_gpio_ext_irq[0] = IRQ_EXT0; | ||
74 | wmt_gpio_ext_irq[1] = IRQ_EXT1; | ||
75 | wmt_gpio_ext_irq[2] = IRQ_EXT2; | ||
76 | wmt_gpio_ext_irq[3] = IRQ_EXT3; | ||
77 | wmt_gpio_ext_irq[4] = IRQ_EXT4; | ||
78 | wmt_gpio_ext_irq[5] = IRQ_EXT5; | ||
79 | wmt_gpio_ext_irq[6] = IRQ_EXT6; | ||
80 | wmt_gpio_ext_irq[7] = IRQ_EXT7; | ||
81 | wmt_i8042_kbd_irq = IRQ_PS2KBD; | ||
82 | wmt_i8042_aux_irq = IRQ_PS2MOUSE; | ||
83 | } | ||
84 | |||
85 | void __init vt8500_map_io(void) | ||
86 | { | ||
87 | iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc)); | ||
88 | |||
89 | /* Should be done before interrupts and timers are initialized */ | ||
90 | vt8500_set_externs(); | ||
91 | } | ||
diff --git a/arch/arm/mach-vt8500/devices-wm8505.c b/arch/arm/mach-vt8500/devices-wm8505.c deleted file mode 100644 index db4594e029f4..000000000000 --- a/arch/arm/mach-vt8500/devices-wm8505.c +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/devices-wm8505.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
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 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <mach/wm8505_regs.h> | ||
19 | #include <mach/wm8505_irqs.h> | ||
20 | #include <mach/i8042.h> | ||
21 | #include "devices.h" | ||
22 | |||
23 | void __init wm8505_set_resources(void) | ||
24 | { | ||
25 | struct resource tmp[3]; | ||
26 | |||
27 | tmp[0] = wmt_mmio_res(WM8505_GOVR_BASE, SZ_512); | ||
28 | wmt_res_add(&vt8500_device_wm8505_fb, tmp, 1); | ||
29 | |||
30 | tmp[0] = wmt_mmio_res(WM8505_UART0_BASE, 0x1040); | ||
31 | tmp[1] = wmt_irq_res(IRQ_UART0); | ||
32 | wmt_res_add(&vt8500_device_uart0, tmp, 2); | ||
33 | |||
34 | tmp[0] = wmt_mmio_res(WM8505_UART1_BASE, 0x1040); | ||
35 | tmp[1] = wmt_irq_res(IRQ_UART1); | ||
36 | wmt_res_add(&vt8500_device_uart1, tmp, 2); | ||
37 | |||
38 | tmp[0] = wmt_mmio_res(WM8505_UART2_BASE, 0x1040); | ||
39 | tmp[1] = wmt_irq_res(IRQ_UART2); | ||
40 | wmt_res_add(&vt8500_device_uart2, tmp, 2); | ||
41 | |||
42 | tmp[0] = wmt_mmio_res(WM8505_UART3_BASE, 0x1040); | ||
43 | tmp[1] = wmt_irq_res(IRQ_UART3); | ||
44 | wmt_res_add(&vt8500_device_uart3, tmp, 2); | ||
45 | |||
46 | tmp[0] = wmt_mmio_res(WM8505_UART4_BASE, 0x1040); | ||
47 | tmp[1] = wmt_irq_res(IRQ_UART4); | ||
48 | wmt_res_add(&vt8500_device_uart4, tmp, 2); | ||
49 | |||
50 | tmp[0] = wmt_mmio_res(WM8505_UART5_BASE, 0x1040); | ||
51 | tmp[1] = wmt_irq_res(IRQ_UART5); | ||
52 | wmt_res_add(&vt8500_device_uart5, tmp, 2); | ||
53 | |||
54 | tmp[0] = wmt_mmio_res(WM8505_EHCI_BASE, SZ_512); | ||
55 | tmp[1] = wmt_irq_res(IRQ_EHCI); | ||
56 | wmt_res_add(&vt8500_device_ehci, tmp, 2); | ||
57 | |||
58 | tmp[0] = wmt_mmio_res(WM8505_GEGEA_BASE, SZ_256); | ||
59 | wmt_res_add(&vt8500_device_ge_rops, tmp, 1); | ||
60 | |||
61 | tmp[0] = wmt_mmio_res(WM8505_PWM_BASE, 0x44); | ||
62 | wmt_res_add(&vt8500_device_pwm, tmp, 1); | ||
63 | |||
64 | tmp[0] = wmt_mmio_res(WM8505_RTC_BASE, 0x2c); | ||
65 | tmp[1] = wmt_irq_res(IRQ_RTC); | ||
66 | tmp[2] = wmt_irq_res(IRQ_RTCSM); | ||
67 | wmt_res_add(&vt8500_device_rtc, tmp, 3); | ||
68 | } | ||
69 | |||
70 | static void __init wm8505_set_externs(void) | ||
71 | { | ||
72 | /* Non-resource-aware stuff */ | ||
73 | wmt_ic_base = WM8505_IC_BASE; | ||
74 | wmt_sic_base = WM8505_SIC_BASE; | ||
75 | wmt_gpio_base = WM8505_GPIO_BASE; | ||
76 | wmt_pmc_base = WM8505_PMC_BASE; | ||
77 | wmt_i8042_base = WM8505_PS2_BASE; | ||
78 | |||
79 | wmt_nr_irqs = WM8505_NR_IRQS; | ||
80 | wmt_timer_irq = IRQ_PMCOS0; | ||
81 | wmt_gpio_ext_irq[0] = IRQ_EXT0; | ||
82 | wmt_gpio_ext_irq[1] = IRQ_EXT1; | ||
83 | wmt_gpio_ext_irq[2] = IRQ_EXT2; | ||
84 | wmt_gpio_ext_irq[3] = IRQ_EXT3; | ||
85 | wmt_gpio_ext_irq[4] = IRQ_EXT4; | ||
86 | wmt_gpio_ext_irq[5] = IRQ_EXT5; | ||
87 | wmt_gpio_ext_irq[6] = IRQ_EXT6; | ||
88 | wmt_gpio_ext_irq[7] = IRQ_EXT7; | ||
89 | wmt_i8042_kbd_irq = IRQ_PS2KBD; | ||
90 | wmt_i8042_aux_irq = IRQ_PS2MOUSE; | ||
91 | } | ||
92 | |||
93 | void __init wm8505_map_io(void) | ||
94 | { | ||
95 | iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc)); | ||
96 | |||
97 | /* Should be done before interrupts and timers are initialized */ | ||
98 | wm8505_set_externs(); | ||
99 | } | ||
diff --git a/arch/arm/mach-vt8500/devices.c b/arch/arm/mach-vt8500/devices.c deleted file mode 100644 index 82b4bcedffba..000000000000 --- a/arch/arm/mach-vt8500/devices.c +++ /dev/null | |||
@@ -1,270 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/devices.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
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 | #include <linux/kernel.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/dma-mapping.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/pwm_backlight.h> | ||
22 | #include <linux/memblock.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | |||
26 | #include <linux/platform_data/video-vt8500lcdfb.h> | ||
27 | #include <mach/i8042.h> | ||
28 | #include "devices.h" | ||
29 | |||
30 | /* These can't use resources currently */ | ||
31 | unsigned long wmt_ic_base __initdata; | ||
32 | unsigned long wmt_sic_base __initdata; | ||
33 | unsigned long wmt_gpio_base __initdata; | ||
34 | unsigned long wmt_pmc_base __initdata; | ||
35 | unsigned long wmt_i8042_base __initdata; | ||
36 | |||
37 | int wmt_nr_irqs __initdata; | ||
38 | int wmt_timer_irq __initdata; | ||
39 | int wmt_gpio_ext_irq[8] __initdata; | ||
40 | |||
41 | /* Should remain accessible after init. | ||
42 | * i8042 driver desperately calls for attention... | ||
43 | */ | ||
44 | int wmt_i8042_kbd_irq; | ||
45 | int wmt_i8042_aux_irq; | ||
46 | |||
47 | static u64 fb_dma_mask = DMA_BIT_MASK(32); | ||
48 | |||
49 | struct platform_device vt8500_device_lcdc = { | ||
50 | .name = "vt8500-lcd", | ||
51 | .id = 0, | ||
52 | .dev = { | ||
53 | .dma_mask = &fb_dma_mask, | ||
54 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | struct platform_device vt8500_device_wm8505_fb = { | ||
59 | .name = "wm8505-fb", | ||
60 | .id = 0, | ||
61 | }; | ||
62 | |||
63 | /* Smallest to largest */ | ||
64 | static struct vt8500fb_platform_data panels[] = { | ||
65 | #ifdef CONFIG_WMT_PANEL_800X480 | ||
66 | { | ||
67 | .xres_virtual = 800, | ||
68 | .yres_virtual = 480 * 2, | ||
69 | .mode = { | ||
70 | .name = "800x480", | ||
71 | .xres = 800, | ||
72 | .yres = 480, | ||
73 | .left_margin = 88, | ||
74 | .right_margin = 40, | ||
75 | .upper_margin = 32, | ||
76 | .lower_margin = 11, | ||
77 | .hsync_len = 0, | ||
78 | .vsync_len = 1, | ||
79 | .vmode = FB_VMODE_NONINTERLACED, | ||
80 | }, | ||
81 | }, | ||
82 | #endif | ||
83 | #ifdef CONFIG_WMT_PANEL_800X600 | ||
84 | { | ||
85 | .xres_virtual = 800, | ||
86 | .yres_virtual = 600 * 2, | ||
87 | .mode = { | ||
88 | .name = "800x600", | ||
89 | .xres = 800, | ||
90 | .yres = 600, | ||
91 | .left_margin = 88, | ||
92 | .right_margin = 40, | ||
93 | .upper_margin = 32, | ||
94 | .lower_margin = 11, | ||
95 | .hsync_len = 0, | ||
96 | .vsync_len = 1, | ||
97 | .vmode = FB_VMODE_NONINTERLACED, | ||
98 | }, | ||
99 | }, | ||
100 | #endif | ||
101 | #ifdef CONFIG_WMT_PANEL_1024X576 | ||
102 | { | ||
103 | .xres_virtual = 1024, | ||
104 | .yres_virtual = 576 * 2, | ||
105 | .mode = { | ||
106 | .name = "1024x576", | ||
107 | .xres = 1024, | ||
108 | .yres = 576, | ||
109 | .left_margin = 40, | ||
110 | .right_margin = 24, | ||
111 | .upper_margin = 32, | ||
112 | .lower_margin = 11, | ||
113 | .hsync_len = 96, | ||
114 | .vsync_len = 2, | ||
115 | .vmode = FB_VMODE_NONINTERLACED, | ||
116 | }, | ||
117 | }, | ||
118 | #endif | ||
119 | #ifdef CONFIG_WMT_PANEL_1024X600 | ||
120 | { | ||
121 | .xres_virtual = 1024, | ||
122 | .yres_virtual = 600 * 2, | ||
123 | .mode = { | ||
124 | .name = "1024x600", | ||
125 | .xres = 1024, | ||
126 | .yres = 600, | ||
127 | .left_margin = 66, | ||
128 | .right_margin = 2, | ||
129 | .upper_margin = 19, | ||
130 | .lower_margin = 1, | ||
131 | .hsync_len = 23, | ||
132 | .vsync_len = 8, | ||
133 | .vmode = FB_VMODE_NONINTERLACED, | ||
134 | }, | ||
135 | }, | ||
136 | #endif | ||
137 | }; | ||
138 | |||
139 | static int current_panel_idx __initdata = ARRAY_SIZE(panels) - 1; | ||
140 | |||
141 | static int __init panel_setup(char *str) | ||
142 | { | ||
143 | int i; | ||
144 | |||
145 | for (i = 0; i < ARRAY_SIZE(panels); i++) { | ||
146 | if (strcmp(panels[i].mode.name, str) == 0) { | ||
147 | current_panel_idx = i; | ||
148 | break; | ||
149 | } | ||
150 | } | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | early_param("panel", panel_setup); | ||
155 | |||
156 | static inline void preallocate_fb(struct vt8500fb_platform_data *p, | ||
157 | unsigned long align) { | ||
158 | p->video_mem_len = (p->xres_virtual * p->yres_virtual * 4) >> | ||
159 | (p->bpp > 16 ? 0 : (p->bpp > 8 ? 1 : | ||
160 | (8 / p->bpp) + 1)); | ||
161 | p->video_mem_phys = (unsigned long)memblock_alloc(p->video_mem_len, | ||
162 | align); | ||
163 | p->video_mem_virt = phys_to_virt(p->video_mem_phys); | ||
164 | } | ||
165 | |||
166 | struct platform_device vt8500_device_uart0 = { | ||
167 | .name = "vt8500_serial", | ||
168 | .id = 0, | ||
169 | }; | ||
170 | |||
171 | struct platform_device vt8500_device_uart1 = { | ||
172 | .name = "vt8500_serial", | ||
173 | .id = 1, | ||
174 | }; | ||
175 | |||
176 | struct platform_device vt8500_device_uart2 = { | ||
177 | .name = "vt8500_serial", | ||
178 | .id = 2, | ||
179 | }; | ||
180 | |||
181 | struct platform_device vt8500_device_uart3 = { | ||
182 | .name = "vt8500_serial", | ||
183 | .id = 3, | ||
184 | }; | ||
185 | |||
186 | struct platform_device vt8500_device_uart4 = { | ||
187 | .name = "vt8500_serial", | ||
188 | .id = 4, | ||
189 | }; | ||
190 | |||
191 | struct platform_device vt8500_device_uart5 = { | ||
192 | .name = "vt8500_serial", | ||
193 | .id = 5, | ||
194 | }; | ||
195 | |||
196 | static u64 ehci_dma_mask = DMA_BIT_MASK(32); | ||
197 | |||
198 | struct platform_device vt8500_device_ehci = { | ||
199 | .name = "vt8500-ehci", | ||
200 | .id = 0, | ||
201 | .dev = { | ||
202 | .dma_mask = &ehci_dma_mask, | ||
203 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
204 | }, | ||
205 | }; | ||
206 | |||
207 | struct platform_device vt8500_device_ge_rops = { | ||
208 | .name = "wmt_ge_rops", | ||
209 | .id = -1, | ||
210 | }; | ||
211 | |||
212 | struct platform_device vt8500_device_pwm = { | ||
213 | .name = "vt8500-pwm", | ||
214 | .id = 0, | ||
215 | }; | ||
216 | |||
217 | static struct platform_pwm_backlight_data vt8500_pwmbl_data = { | ||
218 | .pwm_id = 0, | ||
219 | .max_brightness = 128, | ||
220 | .dft_brightness = 70, | ||
221 | .pwm_period_ns = 250000, /* revisit when clocks are implemented */ | ||
222 | }; | ||
223 | |||
224 | struct platform_device vt8500_device_pwmbl = { | ||
225 | .name = "pwm-backlight", | ||
226 | .id = 0, | ||
227 | .dev = { | ||
228 | .platform_data = &vt8500_pwmbl_data, | ||
229 | }, | ||
230 | }; | ||
231 | |||
232 | struct platform_device vt8500_device_rtc = { | ||
233 | .name = "vt8500-rtc", | ||
234 | .id = 0, | ||
235 | }; | ||
236 | |||
237 | struct map_desc wmt_io_desc[] __initdata = { | ||
238 | /* SoC MMIO registers */ | ||
239 | [0] = { | ||
240 | .virtual = 0xf8000000, | ||
241 | .pfn = __phys_to_pfn(0xd8000000), | ||
242 | .length = 0x00390000, /* max of all chip variants */ | ||
243 | .type = MT_DEVICE | ||
244 | }, | ||
245 | /* PCI I/O space, numbers tied to those in <mach/io.h> */ | ||
246 | [1] = { | ||
247 | .virtual = 0xf0000000, | ||
248 | .pfn = __phys_to_pfn(0xc0000000), | ||
249 | .length = SZ_64K, | ||
250 | .type = MT_DEVICE | ||
251 | }, | ||
252 | }; | ||
253 | |||
254 | void __init vt8500_reserve_mem(void) | ||
255 | { | ||
256 | #ifdef CONFIG_FB_VT8500 | ||
257 | panels[current_panel_idx].bpp = 16; /* Always use RGB565 */ | ||
258 | preallocate_fb(&panels[current_panel_idx], SZ_4M); | ||
259 | vt8500_device_lcdc.dev.platform_data = &panels[current_panel_idx]; | ||
260 | #endif | ||
261 | } | ||
262 | |||
263 | void __init wm8505_reserve_mem(void) | ||
264 | { | ||
265 | #if defined CONFIG_FB_WM8505 | ||
266 | panels[current_panel_idx].bpp = 32; /* Always use RGB888 */ | ||
267 | preallocate_fb(&panels[current_panel_idx], 32); | ||
268 | vt8500_device_wm8505_fb.dev.platform_data = &panels[current_panel_idx]; | ||
269 | #endif | ||
270 | } | ||
diff --git a/arch/arm/mach-vt8500/devices.h b/arch/arm/mach-vt8500/devices.h deleted file mode 100644 index 188d4e17f35c..000000000000 --- a/arch/arm/mach-vt8500/devices.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/devices.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
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 __ARCH_ARM_MACH_VT8500_DEVICES_H | ||
17 | #define __ARCH_ARM_MACH_VT8500_DEVICES_H | ||
18 | |||
19 | #include <linux/platform_device.h> | ||
20 | #include <asm/mach/map.h> | ||
21 | |||
22 | void __init vt8500_init_irq(void); | ||
23 | void __init wm8505_init_irq(void); | ||
24 | void __init vt8500_map_io(void); | ||
25 | void __init wm8505_map_io(void); | ||
26 | void __init vt8500_reserve_mem(void); | ||
27 | void __init wm8505_reserve_mem(void); | ||
28 | void __init vt8500_gpio_init(void); | ||
29 | void __init vt8500_set_resources(void); | ||
30 | void __init wm8505_set_resources(void); | ||
31 | |||
32 | extern unsigned long wmt_ic_base __initdata; | ||
33 | extern unsigned long wmt_sic_base __initdata; | ||
34 | extern unsigned long wmt_gpio_base __initdata; | ||
35 | extern unsigned long wmt_pmc_base __initdata; | ||
36 | |||
37 | extern int wmt_nr_irqs __initdata; | ||
38 | extern int wmt_timer_irq __initdata; | ||
39 | extern int wmt_gpio_ext_irq[8] __initdata; | ||
40 | |||
41 | extern struct map_desc wmt_io_desc[2] __initdata; | ||
42 | |||
43 | static inline struct resource wmt_mmio_res(u32 start, u32 size) | ||
44 | { | ||
45 | struct resource tmp = { | ||
46 | .flags = IORESOURCE_MEM, | ||
47 | .start = start, | ||
48 | .end = start + size - 1, | ||
49 | }; | ||
50 | |||
51 | return tmp; | ||
52 | } | ||
53 | |||
54 | static inline struct resource wmt_irq_res(int irq) | ||
55 | { | ||
56 | struct resource tmp = { | ||
57 | .flags = IORESOURCE_IRQ, | ||
58 | .start = irq, | ||
59 | .end = irq, | ||
60 | }; | ||
61 | |||
62 | return tmp; | ||
63 | } | ||
64 | |||
65 | static inline void wmt_res_add(struct platform_device *pdev, | ||
66 | const struct resource *res, unsigned int num) | ||
67 | { | ||
68 | if (unlikely(platform_device_add_resources(pdev, res, num))) | ||
69 | pr_err("Failed to assign resources\n"); | ||
70 | } | ||
71 | |||
72 | extern struct sys_timer vt8500_timer; | ||
73 | |||
74 | extern struct platform_device vt8500_device_uart0; | ||
75 | extern struct platform_device vt8500_device_uart1; | ||
76 | extern struct platform_device vt8500_device_uart2; | ||
77 | extern struct platform_device vt8500_device_uart3; | ||
78 | extern struct platform_device vt8500_device_uart4; | ||
79 | extern struct platform_device vt8500_device_uart5; | ||
80 | |||
81 | extern struct platform_device vt8500_device_lcdc; | ||
82 | extern struct platform_device vt8500_device_wm8505_fb; | ||
83 | extern struct platform_device vt8500_device_ehci; | ||
84 | extern struct platform_device vt8500_device_ge_rops; | ||
85 | extern struct platform_device vt8500_device_pwm; | ||
86 | extern struct platform_device vt8500_device_pwmbl; | ||
87 | extern struct platform_device vt8500_device_rtc; | ||
88 | #endif | ||
diff --git a/arch/arm/mach-vt8500/gpio.c b/arch/arm/mach-vt8500/gpio.c deleted file mode 100644 index 2bcc0ec783df..000000000000 --- a/arch/arm/mach-vt8500/gpio.c +++ /dev/null | |||
@@ -1,240 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/gpio.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
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 | #include <linux/gpio.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/io.h> | ||
20 | |||
21 | #include "devices.h" | ||
22 | |||
23 | #define to_vt8500(__chip) container_of(__chip, struct vt8500_gpio_chip, chip) | ||
24 | |||
25 | #define ENABLE_REGS 0x0 | ||
26 | #define DIRECTION_REGS 0x20 | ||
27 | #define OUTVALUE_REGS 0x40 | ||
28 | #define INVALUE_REGS 0x60 | ||
29 | |||
30 | #define EXT_REGOFF 0x1c | ||
31 | |||
32 | static void __iomem *regbase; | ||
33 | |||
34 | struct vt8500_gpio_chip { | ||
35 | struct gpio_chip chip; | ||
36 | unsigned int shift; | ||
37 | unsigned int regoff; | ||
38 | }; | ||
39 | |||
40 | static int gpio_to_irq_map[8]; | ||
41 | |||
42 | static int vt8500_muxed_gpio_request(struct gpio_chip *chip, | ||
43 | unsigned offset) | ||
44 | { | ||
45 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
46 | unsigned val = readl(regbase + ENABLE_REGS + vt8500_chip->regoff); | ||
47 | |||
48 | val |= (1 << vt8500_chip->shift << offset); | ||
49 | writel(val, regbase + ENABLE_REGS + vt8500_chip->regoff); | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static void vt8500_muxed_gpio_free(struct gpio_chip *chip, | ||
55 | unsigned offset) | ||
56 | { | ||
57 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
58 | unsigned val = readl(regbase + ENABLE_REGS + vt8500_chip->regoff); | ||
59 | |||
60 | val &= ~(1 << vt8500_chip->shift << offset); | ||
61 | writel(val, regbase + ENABLE_REGS + vt8500_chip->regoff); | ||
62 | } | ||
63 | |||
64 | static int vt8500_muxed_gpio_direction_input(struct gpio_chip *chip, | ||
65 | unsigned offset) | ||
66 | { | ||
67 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
68 | unsigned val = readl(regbase + DIRECTION_REGS + vt8500_chip->regoff); | ||
69 | |||
70 | val &= ~(1 << vt8500_chip->shift << offset); | ||
71 | writel(val, regbase + DIRECTION_REGS + vt8500_chip->regoff); | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static int vt8500_muxed_gpio_direction_output(struct gpio_chip *chip, | ||
77 | unsigned offset, int value) | ||
78 | { | ||
79 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
80 | unsigned val = readl(regbase + DIRECTION_REGS + vt8500_chip->regoff); | ||
81 | |||
82 | val |= (1 << vt8500_chip->shift << offset); | ||
83 | writel(val, regbase + DIRECTION_REGS + vt8500_chip->regoff); | ||
84 | |||
85 | if (value) { | ||
86 | val = readl(regbase + OUTVALUE_REGS + vt8500_chip->regoff); | ||
87 | val |= (1 << vt8500_chip->shift << offset); | ||
88 | writel(val, regbase + OUTVALUE_REGS + vt8500_chip->regoff); | ||
89 | } | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static int vt8500_muxed_gpio_get_value(struct gpio_chip *chip, | ||
94 | unsigned offset) | ||
95 | { | ||
96 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
97 | |||
98 | return (readl(regbase + INVALUE_REGS + vt8500_chip->regoff) | ||
99 | >> vt8500_chip->shift >> offset) & 1; | ||
100 | } | ||
101 | |||
102 | static void vt8500_muxed_gpio_set_value(struct gpio_chip *chip, | ||
103 | unsigned offset, int value) | ||
104 | { | ||
105 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
106 | unsigned val = readl(regbase + INVALUE_REGS + vt8500_chip->regoff); | ||
107 | |||
108 | if (value) | ||
109 | val |= (1 << vt8500_chip->shift << offset); | ||
110 | else | ||
111 | val &= ~(1 << vt8500_chip->shift << offset); | ||
112 | |||
113 | writel(val, regbase + INVALUE_REGS + vt8500_chip->regoff); | ||
114 | } | ||
115 | |||
116 | #define VT8500_GPIO_BANK(__name, __shift, __off, __base, __num) \ | ||
117 | { \ | ||
118 | .chip = { \ | ||
119 | .label = __name, \ | ||
120 | .request = vt8500_muxed_gpio_request, \ | ||
121 | .free = vt8500_muxed_gpio_free, \ | ||
122 | .direction_input = vt8500_muxed_gpio_direction_input, \ | ||
123 | .direction_output = vt8500_muxed_gpio_direction_output, \ | ||
124 | .get = vt8500_muxed_gpio_get_value, \ | ||
125 | .set = vt8500_muxed_gpio_set_value, \ | ||
126 | .can_sleep = 0, \ | ||
127 | .base = __base, \ | ||
128 | .ngpio = __num, \ | ||
129 | }, \ | ||
130 | .shift = __shift, \ | ||
131 | .regoff = __off, \ | ||
132 | } | ||
133 | |||
134 | static struct vt8500_gpio_chip vt8500_muxed_gpios[] = { | ||
135 | VT8500_GPIO_BANK("uart0", 0, 0x0, 8, 4), | ||
136 | VT8500_GPIO_BANK("uart1", 4, 0x0, 12, 4), | ||
137 | VT8500_GPIO_BANK("spi0", 8, 0x0, 16, 4), | ||
138 | VT8500_GPIO_BANK("spi1", 12, 0x0, 20, 4), | ||
139 | VT8500_GPIO_BANK("spi2", 16, 0x0, 24, 4), | ||
140 | VT8500_GPIO_BANK("pwmout", 24, 0x0, 28, 2), | ||
141 | |||
142 | VT8500_GPIO_BANK("sdmmc", 0, 0x4, 30, 11), | ||
143 | VT8500_GPIO_BANK("ms", 16, 0x4, 41, 7), | ||
144 | VT8500_GPIO_BANK("i2c0", 24, 0x4, 48, 2), | ||
145 | VT8500_GPIO_BANK("i2c1", 26, 0x4, 50, 2), | ||
146 | |||
147 | VT8500_GPIO_BANK("mii", 0, 0x8, 52, 20), | ||
148 | VT8500_GPIO_BANK("see", 20, 0x8, 72, 4), | ||
149 | VT8500_GPIO_BANK("ide", 24, 0x8, 76, 7), | ||
150 | |||
151 | VT8500_GPIO_BANK("ccir", 0, 0xc, 83, 19), | ||
152 | |||
153 | VT8500_GPIO_BANK("ts", 8, 0x10, 102, 11), | ||
154 | |||
155 | VT8500_GPIO_BANK("lcd", 0, 0x14, 113, 23), | ||
156 | }; | ||
157 | |||
158 | static int vt8500_gpio_direction_input(struct gpio_chip *chip, | ||
159 | unsigned offset) | ||
160 | { | ||
161 | unsigned val = readl(regbase + DIRECTION_REGS + EXT_REGOFF); | ||
162 | |||
163 | val &= ~(1 << offset); | ||
164 | writel(val, regbase + DIRECTION_REGS + EXT_REGOFF); | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static int vt8500_gpio_direction_output(struct gpio_chip *chip, | ||
169 | unsigned offset, int value) | ||
170 | { | ||
171 | unsigned val = readl(regbase + DIRECTION_REGS + EXT_REGOFF); | ||
172 | |||
173 | val |= (1 << offset); | ||
174 | writel(val, regbase + DIRECTION_REGS + EXT_REGOFF); | ||
175 | |||
176 | if (value) { | ||
177 | val = readl(regbase + OUTVALUE_REGS + EXT_REGOFF); | ||
178 | val |= (1 << offset); | ||
179 | writel(val, regbase + OUTVALUE_REGS + EXT_REGOFF); | ||
180 | } | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static int vt8500_gpio_get_value(struct gpio_chip *chip, | ||
185 | unsigned offset) | ||
186 | { | ||
187 | return (readl(regbase + INVALUE_REGS + EXT_REGOFF) >> offset) & 1; | ||
188 | } | ||
189 | |||
190 | static void vt8500_gpio_set_value(struct gpio_chip *chip, | ||
191 | unsigned offset, int value) | ||
192 | { | ||
193 | unsigned val = readl(regbase + OUTVALUE_REGS + EXT_REGOFF); | ||
194 | |||
195 | if (value) | ||
196 | val |= (1 << offset); | ||
197 | else | ||
198 | val &= ~(1 << offset); | ||
199 | |||
200 | writel(val, regbase + OUTVALUE_REGS + EXT_REGOFF); | ||
201 | } | ||
202 | |||
203 | static int vt8500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
204 | { | ||
205 | if (offset > 7) | ||
206 | return -EINVAL; | ||
207 | |||
208 | return gpio_to_irq_map[offset]; | ||
209 | } | ||
210 | |||
211 | static struct gpio_chip vt8500_external_gpios = { | ||
212 | .label = "extgpio", | ||
213 | .direction_input = vt8500_gpio_direction_input, | ||
214 | .direction_output = vt8500_gpio_direction_output, | ||
215 | .get = vt8500_gpio_get_value, | ||
216 | .set = vt8500_gpio_set_value, | ||
217 | .to_irq = vt8500_gpio_to_irq, | ||
218 | .can_sleep = 0, | ||
219 | .base = 0, | ||
220 | .ngpio = 8, | ||
221 | }; | ||
222 | |||
223 | void __init vt8500_gpio_init(void) | ||
224 | { | ||
225 | int i; | ||
226 | |||
227 | for (i = 0; i < 8; i++) | ||
228 | gpio_to_irq_map[i] = wmt_gpio_ext_irq[i]; | ||
229 | |||
230 | regbase = ioremap(wmt_gpio_base, SZ_64K); | ||
231 | if (!regbase) { | ||
232 | printk(KERN_ERR "Failed to map MMIO registers for GPIO\n"); | ||
233 | return; | ||
234 | } | ||
235 | |||
236 | gpiochip_add(&vt8500_external_gpios); | ||
237 | |||
238 | for (i = 0; i < ARRAY_SIZE(vt8500_muxed_gpios); i++) | ||
239 | gpiochip_add(&vt8500_muxed_gpios[i].chip); | ||
240 | } | ||
diff --git a/arch/arm/mach-vt8500/include/mach/restart.h b/arch/arm/mach-vt8500/include/mach/restart.h index 89f9b787d2a0..738979518acb 100644 --- a/arch/arm/mach-vt8500/include/mach/restart.h +++ b/arch/arm/mach-vt8500/include/mach/restart.h | |||
@@ -13,5 +13,5 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | void wmt_setup_restart(void); | 16 | void vt8500_setup_restart(void); |
17 | void wmt_restart(char mode, const char *cmd); | 17 | void vt8500_restart(char mode, const char *cmd); |
diff --git a/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h b/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h deleted file mode 100644 index ecfee9124711..000000000000 --- a/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/include/mach/vt8500_irqs.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | /* VT8500 Interrupt Sources */ | ||
22 | |||
23 | #define IRQ_JPEGENC 0 /* JPEG Encoder */ | ||
24 | #define IRQ_JPEGDEC 1 /* JPEG Decoder */ | ||
25 | /* Reserved */ | ||
26 | #define IRQ_PATA 3 /* PATA Controller */ | ||
27 | /* Reserved */ | ||
28 | #define IRQ_DMA 5 /* DMA Controller */ | ||
29 | #define IRQ_EXT0 6 /* External Interrupt 0 */ | ||
30 | #define IRQ_EXT1 7 /* External Interrupt 1 */ | ||
31 | #define IRQ_GE 8 /* Graphic Engine */ | ||
32 | #define IRQ_GOV 9 /* Graphic Overlay Engine */ | ||
33 | #define IRQ_ETHER 10 /* Ethernet MAC */ | ||
34 | #define IRQ_MPEGTS 11 /* Transport Stream Interface */ | ||
35 | #define IRQ_LCDC 12 /* LCD Controller */ | ||
36 | #define IRQ_EXT2 13 /* External Interrupt 2 */ | ||
37 | #define IRQ_EXT3 14 /* External Interrupt 3 */ | ||
38 | #define IRQ_EXT4 15 /* External Interrupt 4 */ | ||
39 | #define IRQ_CIPHER 16 /* Cipher */ | ||
40 | #define IRQ_VPP 17 /* Video Post-Processor */ | ||
41 | #define IRQ_I2C1 18 /* I2C 1 */ | ||
42 | #define IRQ_I2C0 19 /* I2C 0 */ | ||
43 | #define IRQ_SDMMC 20 /* SD/MMC Controller */ | ||
44 | #define IRQ_SDMMC_DMA 21 /* SD/MMC Controller DMA */ | ||
45 | #define IRQ_PMC_WU 22 /* Power Management Controller Wakeup */ | ||
46 | /* Reserved */ | ||
47 | #define IRQ_SPI0 24 /* SPI 0 */ | ||
48 | #define IRQ_SPI1 25 /* SPI 1 */ | ||
49 | #define IRQ_SPI2 26 /* SPI 2 */ | ||
50 | #define IRQ_LCDDF 27 /* LCD Data Formatter */ | ||
51 | #define IRQ_NAND 28 /* NAND Flash Controller */ | ||
52 | #define IRQ_NAND_DMA 29 /* NAND Flash Controller DMA */ | ||
53 | #define IRQ_MS 30 /* MemoryStick Controller */ | ||
54 | #define IRQ_MS_DMA 31 /* MemoryStick Controller DMA */ | ||
55 | #define IRQ_UART0 32 /* UART 0 */ | ||
56 | #define IRQ_UART1 33 /* UART 1 */ | ||
57 | #define IRQ_I2S 34 /* I2S */ | ||
58 | #define IRQ_PCM 35 /* PCM */ | ||
59 | #define IRQ_PMCOS0 36 /* PMC OS Timer 0 */ | ||
60 | #define IRQ_PMCOS1 37 /* PMC OS Timer 1 */ | ||
61 | #define IRQ_PMCOS2 38 /* PMC OS Timer 2 */ | ||
62 | #define IRQ_PMCOS3 39 /* PMC OS Timer 3 */ | ||
63 | #define IRQ_VPU 40 /* Video Processing Unit */ | ||
64 | #define IRQ_VID 41 /* Video Digital Input Interface */ | ||
65 | #define IRQ_AC97 42 /* AC97 Interface */ | ||
66 | #define IRQ_EHCI 43 /* USB */ | ||
67 | #define IRQ_NOR 44 /* NOR Flash Controller */ | ||
68 | #define IRQ_PS2MOUSE 45 /* PS/2 Mouse */ | ||
69 | #define IRQ_PS2KBD 46 /* PS/2 Keyboard */ | ||
70 | #define IRQ_UART2 47 /* UART 2 */ | ||
71 | #define IRQ_RTC 48 /* RTC Interrupt */ | ||
72 | #define IRQ_RTCSM 49 /* RTC Second/Minute Update Interrupt */ | ||
73 | #define IRQ_UART3 50 /* UART 3 */ | ||
74 | #define IRQ_ADC 51 /* ADC */ | ||
75 | #define IRQ_EXT5 52 /* External Interrupt 5 */ | ||
76 | #define IRQ_EXT6 53 /* External Interrupt 6 */ | ||
77 | #define IRQ_EXT7 54 /* External Interrupt 7 */ | ||
78 | #define IRQ_CIR 55 /* CIR */ | ||
79 | #define IRQ_DMA0 56 /* DMA Channel 0 */ | ||
80 | #define IRQ_DMA1 57 /* DMA Channel 1 */ | ||
81 | #define IRQ_DMA2 58 /* DMA Channel 2 */ | ||
82 | #define IRQ_DMA3 59 /* DMA Channel 3 */ | ||
83 | #define IRQ_DMA4 60 /* DMA Channel 4 */ | ||
84 | #define IRQ_DMA5 61 /* DMA Channel 5 */ | ||
85 | #define IRQ_DMA6 62 /* DMA Channel 6 */ | ||
86 | #define IRQ_DMA7 63 /* DMA Channel 7 */ | ||
87 | |||
88 | #define VT8500_NR_IRQS 64 | ||
diff --git a/arch/arm/mach-vt8500/include/mach/vt8500_regs.h b/arch/arm/mach-vt8500/include/mach/vt8500_regs.h deleted file mode 100644 index 29c63ecb2383..000000000000 --- a/arch/arm/mach-vt8500/include/mach/vt8500_regs.h +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/include/mach/vt8500_regs.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_VT8500_REGS_H | ||
21 | #define __ASM_ARM_ARCH_VT8500_REGS_H | ||
22 | |||
23 | /* VT8500 Registers Map */ | ||
24 | |||
25 | #define VT8500_REGS_START_PHYS 0xd8000000 /* Start of MMIO registers */ | ||
26 | #define VT8500_REGS_START_VIRT 0xf8000000 /* Virtual mapping start */ | ||
27 | |||
28 | #define VT8500_DDR_BASE 0xd8000000 /* 1k DDR/DDR2 Memory | ||
29 | Controller */ | ||
30 | #define VT8500_DMA_BASE 0xd8001000 /* 1k DMA Controller */ | ||
31 | #define VT8500_SFLASH_BASE 0xd8002000 /* 1k Serial Flash Memory | ||
32 | Controller */ | ||
33 | #define VT8500_ETHER_BASE 0xd8004000 /* 1k Ethernet MAC 0 */ | ||
34 | #define VT8500_CIPHER_BASE 0xd8006000 /* 4k Cipher */ | ||
35 | #define VT8500_USB_BASE 0xd8007800 /* 2k USB OTG */ | ||
36 | # define VT8500_EHCI_BASE 0xd8007900 /* EHCI */ | ||
37 | # define VT8500_UHCI_BASE 0xd8007b01 /* UHCI */ | ||
38 | #define VT8500_PATA_BASE 0xd8008000 /* 512 PATA */ | ||
39 | #define VT8500_PS2_BASE 0xd8008800 /* 1k PS/2 */ | ||
40 | #define VT8500_NAND_BASE 0xd8009000 /* 1k NAND Controller */ | ||
41 | #define VT8500_NOR_BASE 0xd8009400 /* 1k NOR Controller */ | ||
42 | #define VT8500_SDMMC_BASE 0xd800a000 /* 1k SD/MMC Controller */ | ||
43 | #define VT8500_MS_BASE 0xd800b000 /* 1k MS/MSPRO Controller */ | ||
44 | #define VT8500_LCDC_BASE 0xd800e400 /* 1k LCD Controller */ | ||
45 | #define VT8500_VPU_BASE 0xd8050000 /* 256 VPU */ | ||
46 | #define VT8500_GOV_BASE 0xd8050300 /* 256 GOV */ | ||
47 | #define VT8500_GEGEA_BASE 0xd8050400 /* 768 GE/GE Alpha Mixing */ | ||
48 | #define VT8500_LCDF_BASE 0xd8050900 /* 256 LCD Formatter */ | ||
49 | #define VT8500_VID_BASE 0xd8050a00 /* 256 VID */ | ||
50 | #define VT8500_VPP_BASE 0xd8050b00 /* 256 VPP */ | ||
51 | #define VT8500_TSBK_BASE 0xd80f4000 /* 4k TSBK */ | ||
52 | #define VT8500_JPEGDEC_BASE 0xd80fe000 /* 4k JPEG Decoder */ | ||
53 | #define VT8500_JPEGENC_BASE 0xd80ff000 /* 4k JPEG Encoder */ | ||
54 | #define VT8500_RTC_BASE 0xd8100000 /* 64k RTC */ | ||
55 | #define VT8500_GPIO_BASE 0xd8110000 /* 64k GPIO Configuration */ | ||
56 | #define VT8500_SCC_BASE 0xd8120000 /* 64k System Configuration*/ | ||
57 | #define VT8500_PMC_BASE 0xd8130000 /* 64k PMC Configuration */ | ||
58 | #define VT8500_IC_BASE 0xd8140000 /* 64k Interrupt Controller*/ | ||
59 | #define VT8500_UART0_BASE 0xd8200000 /* 64k UART 0 */ | ||
60 | #define VT8500_UART2_BASE 0xd8210000 /* 64k UART 2 */ | ||
61 | #define VT8500_PWM_BASE 0xd8220000 /* 64k PWM Configuration */ | ||
62 | #define VT8500_SPI0_BASE 0xd8240000 /* 64k SPI 0 */ | ||
63 | #define VT8500_SPI1_BASE 0xd8250000 /* 64k SPI 1 */ | ||
64 | #define VT8500_CIR_BASE 0xd8270000 /* 64k CIR */ | ||
65 | #define VT8500_I2C0_BASE 0xd8280000 /* 64k I2C 0 */ | ||
66 | #define VT8500_AC97_BASE 0xd8290000 /* 64k AC97 */ | ||
67 | #define VT8500_SPI2_BASE 0xd82a0000 /* 64k SPI 2 */ | ||
68 | #define VT8500_UART1_BASE 0xd82b0000 /* 64k UART 1 */ | ||
69 | #define VT8500_UART3_BASE 0xd82c0000 /* 64k UART 3 */ | ||
70 | #define VT8500_PCM_BASE 0xd82d0000 /* 64k PCM */ | ||
71 | #define VT8500_I2C1_BASE 0xd8320000 /* 64k I2C 1 */ | ||
72 | #define VT8500_I2S_BASE 0xd8330000 /* 64k I2S */ | ||
73 | #define VT8500_ADC_BASE 0xd8340000 /* 64k ADC */ | ||
74 | |||
75 | #define VT8500_REGS_END_PHYS 0xd834ffff /* End of MMIO registers */ | ||
76 | #define VT8500_REGS_LENGTH (VT8500_REGS_END_PHYS \ | ||
77 | - VT8500_REGS_START_PHYS + 1) | ||
78 | |||
79 | #endif | ||
diff --git a/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h b/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h deleted file mode 100644 index 6128627ac753..000000000000 --- a/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/include/mach/wm8505_irqs.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | /* WM8505 Interrupt Sources */ | ||
22 | |||
23 | #define IRQ_UHCI 0 /* UHC FS (UHCI?) */ | ||
24 | #define IRQ_EHCI 1 /* UHC HS */ | ||
25 | #define IRQ_UDCDMA 2 /* UDC DMA */ | ||
26 | /* Reserved */ | ||
27 | #define IRQ_PS2MOUSE 4 /* PS/2 Mouse */ | ||
28 | #define IRQ_UDC 5 /* UDC */ | ||
29 | #define IRQ_EXT0 6 /* External Interrupt 0 */ | ||
30 | #define IRQ_EXT1 7 /* External Interrupt 1 */ | ||
31 | #define IRQ_KEYPAD 8 /* Keypad */ | ||
32 | #define IRQ_DMA 9 /* DMA Controller */ | ||
33 | #define IRQ_ETHER 10 /* Ethernet MAC */ | ||
34 | /* Reserved */ | ||
35 | /* Reserved */ | ||
36 | #define IRQ_EXT2 13 /* External Interrupt 2 */ | ||
37 | #define IRQ_EXT3 14 /* External Interrupt 3 */ | ||
38 | #define IRQ_EXT4 15 /* External Interrupt 4 */ | ||
39 | #define IRQ_APB 16 /* APB Bridge */ | ||
40 | #define IRQ_DMA0 17 /* DMA Channel 0 */ | ||
41 | #define IRQ_I2C1 18 /* I2C 1 */ | ||
42 | #define IRQ_I2C0 19 /* I2C 0 */ | ||
43 | #define IRQ_SDMMC 20 /* SD/MMC Controller */ | ||
44 | #define IRQ_SDMMC_DMA 21 /* SD/MMC Controller DMA */ | ||
45 | #define IRQ_PMC_WU 22 /* Power Management Controller Wakeup */ | ||
46 | #define IRQ_PS2KBD 23 /* PS/2 Keyboard */ | ||
47 | #define IRQ_SPI0 24 /* SPI 0 */ | ||
48 | #define IRQ_SPI1 25 /* SPI 1 */ | ||
49 | #define IRQ_SPI2 26 /* SPI 2 */ | ||
50 | #define IRQ_DMA1 27 /* DMA Channel 1 */ | ||
51 | #define IRQ_NAND 28 /* NAND Flash Controller */ | ||
52 | #define IRQ_NAND_DMA 29 /* NAND Flash Controller DMA */ | ||
53 | #define IRQ_UART5 30 /* UART 5 */ | ||
54 | #define IRQ_UART4 31 /* UART 4 */ | ||
55 | #define IRQ_UART0 32 /* UART 0 */ | ||
56 | #define IRQ_UART1 33 /* UART 1 */ | ||
57 | #define IRQ_DMA2 34 /* DMA Channel 2 */ | ||
58 | #define IRQ_I2S 35 /* I2S */ | ||
59 | #define IRQ_PMCOS0 36 /* PMC OS Timer 0 */ | ||
60 | #define IRQ_PMCOS1 37 /* PMC OS Timer 1 */ | ||
61 | #define IRQ_PMCOS2 38 /* PMC OS Timer 2 */ | ||
62 | #define IRQ_PMCOS3 39 /* PMC OS Timer 3 */ | ||
63 | #define IRQ_DMA3 40 /* DMA Channel 3 */ | ||
64 | #define IRQ_DMA4 41 /* DMA Channel 4 */ | ||
65 | #define IRQ_AC97 42 /* AC97 Interface */ | ||
66 | /* Reserved */ | ||
67 | #define IRQ_NOR 44 /* NOR Flash Controller */ | ||
68 | #define IRQ_DMA5 45 /* DMA Channel 5 */ | ||
69 | #define IRQ_DMA6 46 /* DMA Channel 6 */ | ||
70 | #define IRQ_UART2 47 /* UART 2 */ | ||
71 | #define IRQ_RTC 48 /* RTC Interrupt */ | ||
72 | #define IRQ_RTCSM 49 /* RTC Second/Minute Update Interrupt */ | ||
73 | #define IRQ_UART3 50 /* UART 3 */ | ||
74 | #define IRQ_DMA7 51 /* DMA Channel 7 */ | ||
75 | #define IRQ_EXT5 52 /* External Interrupt 5 */ | ||
76 | #define IRQ_EXT6 53 /* External Interrupt 6 */ | ||
77 | #define IRQ_EXT7 54 /* External Interrupt 7 */ | ||
78 | #define IRQ_CIR 55 /* CIR */ | ||
79 | #define IRQ_SIC0 56 /* SIC IRQ0 */ | ||
80 | #define IRQ_SIC1 57 /* SIC IRQ1 */ | ||
81 | #define IRQ_SIC2 58 /* SIC IRQ2 */ | ||
82 | #define IRQ_SIC3 59 /* SIC IRQ3 */ | ||
83 | #define IRQ_SIC4 60 /* SIC IRQ4 */ | ||
84 | #define IRQ_SIC5 61 /* SIC IRQ5 */ | ||
85 | #define IRQ_SIC6 62 /* SIC IRQ6 */ | ||
86 | #define IRQ_SIC7 63 /* SIC IRQ7 */ | ||
87 | /* Reserved */ | ||
88 | #define IRQ_JPEGDEC 65 /* JPEG Decoder */ | ||
89 | #define IRQ_SAE 66 /* SAE (?) */ | ||
90 | /* Reserved */ | ||
91 | #define IRQ_VPU 79 /* Video Processing Unit */ | ||
92 | #define IRQ_VPP 80 /* Video Post-Processor */ | ||
93 | #define IRQ_VID 81 /* Video Digital Input Interface */ | ||
94 | #define IRQ_SPU 82 /* SPU (?) */ | ||
95 | #define IRQ_PIP 83 /* PIP Error */ | ||
96 | #define IRQ_GE 84 /* Graphic Engine */ | ||
97 | #define IRQ_GOV 85 /* Graphic Overlay Engine */ | ||
98 | #define IRQ_DVO 86 /* Digital Video Output */ | ||
99 | /* Reserved */ | ||
100 | #define IRQ_DMA8 92 /* DMA Channel 8 */ | ||
101 | #define IRQ_DMA9 93 /* DMA Channel 9 */ | ||
102 | #define IRQ_DMA10 94 /* DMA Channel 10 */ | ||
103 | #define IRQ_DMA11 95 /* DMA Channel 11 */ | ||
104 | #define IRQ_DMA12 96 /* DMA Channel 12 */ | ||
105 | #define IRQ_DMA13 97 /* DMA Channel 13 */ | ||
106 | #define IRQ_DMA14 98 /* DMA Channel 14 */ | ||
107 | #define IRQ_DMA15 99 /* DMA Channel 15 */ | ||
108 | /* Reserved */ | ||
109 | #define IRQ_GOVW 111 /* GOVW (?) */ | ||
110 | #define IRQ_GOVRSDSCD 112 /* GOVR SDSCD (?) */ | ||
111 | #define IRQ_GOVRSDMIF 113 /* GOVR SDMIF (?) */ | ||
112 | #define IRQ_GOVRHDSCD 114 /* GOVR HDSCD (?) */ | ||
113 | #define IRQ_GOVRHDMIF 115 /* GOVR HDMIF (?) */ | ||
114 | |||
115 | #define WM8505_NR_IRQS 116 | ||
diff --git a/arch/arm/mach-vt8500/include/mach/wm8505_regs.h b/arch/arm/mach-vt8500/include/mach/wm8505_regs.h deleted file mode 100644 index df1550941efb..000000000000 --- a/arch/arm/mach-vt8500/include/mach/wm8505_regs.h +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/include/mach/wm8505_regs.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | #ifndef __ASM_ARM_ARCH_WM8505_REGS_H | ||
21 | #define __ASM_ARM_ARCH_WM8505_REGS_H | ||
22 | |||
23 | /* WM8505 Registers Map */ | ||
24 | |||
25 | #define WM8505_REGS_START_PHYS 0xd8000000 /* Start of MMIO registers */ | ||
26 | #define WM8505_REGS_START_VIRT 0xf8000000 /* Virtual mapping start */ | ||
27 | |||
28 | #define WM8505_DDR_BASE 0xd8000400 /* 1k DDR/DDR2 Memory | ||
29 | Controller */ | ||
30 | #define WM8505_DMA_BASE 0xd8001800 /* 1k DMA Controller */ | ||
31 | #define WM8505_VDMA_BASE 0xd8001c00 /* 1k VDMA */ | ||
32 | #define WM8505_SFLASH_BASE 0xd8002000 /* 1k Serial Flash Memory | ||
33 | Controller */ | ||
34 | #define WM8505_ETHER_BASE 0xd8004000 /* 1k Ethernet MAC 0 */ | ||
35 | #define WM8505_CIPHER_BASE 0xd8006000 /* 4k Cipher */ | ||
36 | #define WM8505_USB_BASE 0xd8007000 /* 2k USB 2.0 Host */ | ||
37 | # define WM8505_EHCI_BASE 0xd8007100 /* EHCI */ | ||
38 | # define WM8505_UHCI_BASE 0xd8007301 /* UHCI */ | ||
39 | #define WM8505_PS2_BASE 0xd8008800 /* 1k PS/2 */ | ||
40 | #define WM8505_NAND_BASE 0xd8009000 /* 1k NAND Controller */ | ||
41 | #define WM8505_NOR_BASE 0xd8009400 /* 1k NOR Controller */ | ||
42 | #define WM8505_SDMMC_BASE 0xd800a000 /* 1k SD/MMC Controller */ | ||
43 | #define WM8505_VPU_BASE 0xd8050000 /* 256 VPU */ | ||
44 | #define WM8505_GOV_BASE 0xd8050300 /* 256 GOV */ | ||
45 | #define WM8505_GEGEA_BASE 0xd8050400 /* 768 GE/GE Alpha Mixing */ | ||
46 | #define WM8505_GOVR_BASE 0xd8050800 /* 512 GOVR (frambuffer) */ | ||
47 | #define WM8505_VID_BASE 0xd8050a00 /* 256 VID */ | ||
48 | #define WM8505_SCL_BASE 0xd8050d00 /* 256 SCL */ | ||
49 | #define WM8505_VPP_BASE 0xd8050f00 /* 256 VPP */ | ||
50 | #define WM8505_JPEGDEC_BASE 0xd80fe000 /* 4k JPEG Decoder */ | ||
51 | #define WM8505_RTC_BASE 0xd8100000 /* 64k RTC */ | ||
52 | #define WM8505_GPIO_BASE 0xd8110000 /* 64k GPIO Configuration */ | ||
53 | #define WM8505_SCC_BASE 0xd8120000 /* 64k System Configuration*/ | ||
54 | #define WM8505_PMC_BASE 0xd8130000 /* 64k PMC Configuration */ | ||
55 | #define WM8505_IC_BASE 0xd8140000 /* 64k Interrupt Controller*/ | ||
56 | #define WM8505_SIC_BASE 0xd8150000 /* 64k Secondary IC */ | ||
57 | #define WM8505_UART0_BASE 0xd8200000 /* 64k UART 0 */ | ||
58 | #define WM8505_UART2_BASE 0xd8210000 /* 64k UART 2 */ | ||
59 | #define WM8505_PWM_BASE 0xd8220000 /* 64k PWM Configuration */ | ||
60 | #define WM8505_SPI0_BASE 0xd8240000 /* 64k SPI 0 */ | ||
61 | #define WM8505_SPI1_BASE 0xd8250000 /* 64k SPI 1 */ | ||
62 | #define WM8505_KEYPAD_BASE 0xd8260000 /* 64k Keypad control */ | ||
63 | #define WM8505_CIR_BASE 0xd8270000 /* 64k CIR */ | ||
64 | #define WM8505_I2C0_BASE 0xd8280000 /* 64k I2C 0 */ | ||
65 | #define WM8505_AC97_BASE 0xd8290000 /* 64k AC97 */ | ||
66 | #define WM8505_SPI2_BASE 0xd82a0000 /* 64k SPI 2 */ | ||
67 | #define WM8505_UART1_BASE 0xd82b0000 /* 64k UART 1 */ | ||
68 | #define WM8505_UART3_BASE 0xd82c0000 /* 64k UART 3 */ | ||
69 | #define WM8505_I2C1_BASE 0xd8320000 /* 64k I2C 1 */ | ||
70 | #define WM8505_I2S_BASE 0xd8330000 /* 64k I2S */ | ||
71 | #define WM8505_UART4_BASE 0xd8370000 /* 64k UART 4 */ | ||
72 | #define WM8505_UART5_BASE 0xd8380000 /* 64k UART 5 */ | ||
73 | |||
74 | #define WM8505_REGS_END_PHYS 0xd838ffff /* End of MMIO registers */ | ||
75 | #define WM8505_REGS_LENGTH (WM8505_REGS_END_PHYS \ | ||
76 | - WM8505_REGS_START_PHYS + 1) | ||
77 | |||
78 | #endif | ||
diff --git a/arch/arm/mach-vt8500/irq.c b/arch/arm/mach-vt8500/irq.c index 642de0408f25..f8f9ab9bc56e 100644 --- a/arch/arm/mach-vt8500/irq.c +++ b/arch/arm/mach-vt8500/irq.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-vt8500/irq.c | 2 | * arch/arm/mach-vt8500/irq.c |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | 5 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -18,81 +19,102 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 20 | */ |
20 | 21 | ||
22 | /* | ||
23 | * This file is copied and modified from the original irq.c provided by | ||
24 | * Alexey Charkov. Minor changes have been made for Device Tree Support. | ||
25 | */ | ||
26 | |||
27 | #include <linux/slab.h> | ||
21 | #include <linux/io.h> | 28 | #include <linux/io.h> |
22 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
30 | #include <linux/irqdomain.h> | ||
23 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/bitops.h> | ||
33 | |||
34 | #include <linux/of.h> | ||
35 | #include <linux/of_irq.h> | ||
36 | #include <linux/of_address.h> | ||
24 | 37 | ||
25 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
26 | 39 | ||
27 | #include "devices.h" | ||
28 | 40 | ||
29 | #define VT8500_IC_DCTR 0x40 /* Destination control | 41 | #define VT8500_ICPC_IRQ 0x20 |
30 | register, 64*u8 */ | 42 | #define VT8500_ICPC_FIQ 0x24 |
31 | #define VT8500_INT_ENABLE (1 << 3) | 43 | #define VT8500_ICDC 0x40 /* Destination Control 64*u32 */ |
32 | #define VT8500_TRIGGER_HIGH (0 << 4) | 44 | #define VT8500_ICIS 0x80 /* Interrupt status, 16*u32 */ |
33 | #define VT8500_TRIGGER_RISING (1 << 4) | 45 | |
34 | #define VT8500_TRIGGER_FALLING (2 << 4) | 46 | /* ICPC */ |
47 | #define ICPC_MASK 0x3F | ||
48 | #define ICPC_ROTATE BIT(6) | ||
49 | |||
50 | /* IC_DCTR */ | ||
51 | #define ICDC_IRQ 0x00 | ||
52 | #define ICDC_FIQ 0x01 | ||
53 | #define ICDC_DSS0 0x02 | ||
54 | #define ICDC_DSS1 0x03 | ||
55 | #define ICDC_DSS2 0x04 | ||
56 | #define ICDC_DSS3 0x05 | ||
57 | #define ICDC_DSS4 0x06 | ||
58 | #define ICDC_DSS5 0x07 | ||
59 | |||
60 | #define VT8500_INT_DISABLE 0 | ||
61 | #define VT8500_INT_ENABLE BIT(3) | ||
62 | |||
63 | #define VT8500_TRIGGER_HIGH 0 | ||
64 | #define VT8500_TRIGGER_RISING BIT(5) | ||
65 | #define VT8500_TRIGGER_FALLING BIT(6) | ||
35 | #define VT8500_EDGE ( VT8500_TRIGGER_RISING \ | 66 | #define VT8500_EDGE ( VT8500_TRIGGER_RISING \ |
36 | | VT8500_TRIGGER_FALLING) | 67 | | VT8500_TRIGGER_FALLING) |
37 | #define VT8500_IC_STATUS 0x80 /* Interrupt status, 2*u32 */ | ||
38 | 68 | ||
39 | static void __iomem *ic_regbase; | 69 | static int irq_cnt; |
40 | static void __iomem *sic_regbase; | 70 | |
71 | struct vt8500_irq_priv { | ||
72 | void __iomem *base; | ||
73 | }; | ||
41 | 74 | ||
42 | static void vt8500_irq_mask(struct irq_data *d) | 75 | static void vt8500_irq_mask(struct irq_data *d) |
43 | { | 76 | { |
44 | void __iomem *base = ic_regbase; | 77 | struct vt8500_irq_priv *priv = |
45 | unsigned irq = d->irq; | 78 | (struct vt8500_irq_priv *)(d->domain->host_data); |
79 | void __iomem *base = priv->base; | ||
46 | u8 edge; | 80 | u8 edge; |
47 | 81 | ||
48 | if (irq >= 64) { | 82 | edge = readb(base + VT8500_ICDC + d->hwirq) & VT8500_EDGE; |
49 | base = sic_regbase; | ||
50 | irq -= 64; | ||
51 | } | ||
52 | edge = readb(base + VT8500_IC_DCTR + irq) & VT8500_EDGE; | ||
53 | if (edge) { | 83 | if (edge) { |
54 | void __iomem *stat_reg = base + VT8500_IC_STATUS | 84 | void __iomem *stat_reg = base + VT8500_ICIS |
55 | + (irq < 32 ? 0 : 4); | 85 | + (d->hwirq < 32 ? 0 : 4); |
56 | unsigned status = readl(stat_reg); | 86 | unsigned status = readl(stat_reg); |
57 | 87 | ||
58 | status |= (1 << (irq & 0x1f)); | 88 | status |= (1 << (d->hwirq & 0x1f)); |
59 | writel(status, stat_reg); | 89 | writel(status, stat_reg); |
60 | } else { | 90 | } else { |
61 | u8 dctr = readb(base + VT8500_IC_DCTR + irq); | 91 | u8 dctr = readb(base + VT8500_ICDC + d->hwirq); |
62 | 92 | ||
63 | dctr &= ~VT8500_INT_ENABLE; | 93 | dctr &= ~VT8500_INT_ENABLE; |
64 | writeb(dctr, base + VT8500_IC_DCTR + irq); | 94 | writeb(dctr, base + VT8500_ICDC + d->hwirq); |
65 | } | 95 | } |
66 | } | 96 | } |
67 | 97 | ||
68 | static void vt8500_irq_unmask(struct irq_data *d) | 98 | static void vt8500_irq_unmask(struct irq_data *d) |
69 | { | 99 | { |
70 | void __iomem *base = ic_regbase; | 100 | struct vt8500_irq_priv *priv = |
71 | unsigned irq = d->irq; | 101 | (struct vt8500_irq_priv *)(d->domain->host_data); |
102 | void __iomem *base = priv->base; | ||
72 | u8 dctr; | 103 | u8 dctr; |
73 | 104 | ||
74 | if (irq >= 64) { | 105 | dctr = readb(base + VT8500_ICDC + d->hwirq); |
75 | base = sic_regbase; | ||
76 | irq -= 64; | ||
77 | } | ||
78 | dctr = readb(base + VT8500_IC_DCTR + irq); | ||
79 | dctr |= VT8500_INT_ENABLE; | 106 | dctr |= VT8500_INT_ENABLE; |
80 | writeb(dctr, base + VT8500_IC_DCTR + irq); | 107 | writeb(dctr, base + VT8500_ICDC + d->hwirq); |
81 | } | 108 | } |
82 | 109 | ||
83 | static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type) | 110 | static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type) |
84 | { | 111 | { |
85 | void __iomem *base = ic_regbase; | 112 | struct vt8500_irq_priv *priv = |
86 | unsigned irq = d->irq; | 113 | (struct vt8500_irq_priv *)(d->domain->host_data); |
87 | unsigned orig_irq = irq; | 114 | void __iomem *base = priv->base; |
88 | u8 dctr; | 115 | u8 dctr; |
89 | 116 | ||
90 | if (irq >= 64) { | 117 | dctr = readb(base + VT8500_ICDC + d->hwirq); |
91 | base = sic_regbase; | ||
92 | irq -= 64; | ||
93 | } | ||
94 | |||
95 | dctr = readb(base + VT8500_IC_DCTR + irq); | ||
96 | dctr &= ~VT8500_EDGE; | 118 | dctr &= ~VT8500_EDGE; |
97 | 119 | ||
98 | switch (flow_type) { | 120 | switch (flow_type) { |
@@ -100,18 +122,18 @@ static int vt8500_irq_set_type(struct irq_data *d, unsigned int flow_type) | |||
100 | return -EINVAL; | 122 | return -EINVAL; |
101 | case IRQF_TRIGGER_HIGH: | 123 | case IRQF_TRIGGER_HIGH: |
102 | dctr |= VT8500_TRIGGER_HIGH; | 124 | dctr |= VT8500_TRIGGER_HIGH; |
103 | __irq_set_handler_locked(orig_irq, handle_level_irq); | 125 | __irq_set_handler_locked(d->irq, handle_level_irq); |
104 | break; | 126 | break; |
105 | case IRQF_TRIGGER_FALLING: | 127 | case IRQF_TRIGGER_FALLING: |
106 | dctr |= VT8500_TRIGGER_FALLING; | 128 | dctr |= VT8500_TRIGGER_FALLING; |
107 | __irq_set_handler_locked(orig_irq, handle_edge_irq); | 129 | __irq_set_handler_locked(d->irq, handle_edge_irq); |
108 | break; | 130 | break; |
109 | case IRQF_TRIGGER_RISING: | 131 | case IRQF_TRIGGER_RISING: |
110 | dctr |= VT8500_TRIGGER_RISING; | 132 | dctr |= VT8500_TRIGGER_RISING; |
111 | __irq_set_handler_locked(orig_irq, handle_edge_irq); | 133 | __irq_set_handler_locked(d->irq, handle_edge_irq); |
112 | break; | 134 | break; |
113 | } | 135 | } |
114 | writeb(dctr, base + VT8500_IC_DCTR + irq); | 136 | writeb(dctr, base + VT8500_ICDC + d->hwirq); |
115 | 137 | ||
116 | return 0; | 138 | return 0; |
117 | } | 139 | } |
@@ -124,57 +146,76 @@ static struct irq_chip vt8500_irq_chip = { | |||
124 | .irq_set_type = vt8500_irq_set_type, | 146 | .irq_set_type = vt8500_irq_set_type, |
125 | }; | 147 | }; |
126 | 148 | ||
127 | void __init vt8500_init_irq(void) | 149 | static void __init vt8500_init_irq_hw(void __iomem *base) |
128 | { | 150 | { |
129 | unsigned int i; | 151 | unsigned int i; |
130 | 152 | ||
131 | ic_regbase = ioremap(wmt_ic_base, SZ_64K); | 153 | /* Enable rotating priority for IRQ */ |
154 | writel(ICPC_ROTATE, base + VT8500_ICPC_IRQ); | ||
155 | writel(0x00, base + VT8500_ICPC_FIQ); | ||
132 | 156 | ||
133 | if (ic_regbase) { | 157 | for (i = 0; i < 64; i++) { |
134 | /* Enable rotating priority for IRQ */ | 158 | /* Disable all interrupts and route them to IRQ */ |
135 | writel((1 << 6), ic_regbase + 0x20); | 159 | writeb(VT8500_INT_DISABLE | ICDC_IRQ, |
136 | writel(0, ic_regbase + 0x24); | 160 | base + VT8500_ICDC + i); |
161 | } | ||
162 | } | ||
137 | 163 | ||
138 | for (i = 0; i < wmt_nr_irqs; i++) { | 164 | static int vt8500_irq_map(struct irq_domain *h, unsigned int virq, |
139 | /* Disable all interrupts and route them to IRQ */ | 165 | irq_hw_number_t hw) |
140 | writeb(0x00, ic_regbase + VT8500_IC_DCTR + i); | 166 | { |
167 | irq_set_chip_and_handler(virq, &vt8500_irq_chip, handle_level_irq); | ||
168 | set_irq_flags(virq, IRQF_VALID); | ||
141 | 169 | ||
142 | irq_set_chip_and_handler(i, &vt8500_irq_chip, | 170 | return 0; |
143 | handle_level_irq); | ||
144 | set_irq_flags(i, IRQF_VALID); | ||
145 | } | ||
146 | } else { | ||
147 | printk(KERN_ERR "Unable to remap the Interrupt Controller registers, not enabling IRQs!\n"); | ||
148 | } | ||
149 | } | 171 | } |
150 | 172 | ||
151 | void __init wm8505_init_irq(void) | 173 | static struct irq_domain_ops vt8500_irq_domain_ops = { |
174 | .map = vt8500_irq_map, | ||
175 | .xlate = irq_domain_xlate_onecell, | ||
176 | }; | ||
177 | |||
178 | int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) | ||
152 | { | 179 | { |
153 | unsigned int i; | 180 | struct irq_domain *vt8500_irq_domain; |
181 | struct vt8500_irq_priv *priv; | ||
182 | int irq, i; | ||
183 | struct device_node *np = node; | ||
184 | |||
185 | priv = kzalloc(sizeof(struct vt8500_irq_priv), GFP_KERNEL); | ||
186 | priv->base = of_iomap(np, 0); | ||
187 | |||
188 | vt8500_irq_domain = irq_domain_add_legacy(node, 64, irq_cnt, 0, | ||
189 | &vt8500_irq_domain_ops, priv); | ||
190 | if (!vt8500_irq_domain) | ||
191 | pr_err("%s: Unable to add wmt irq domain!\n", __func__); | ||
192 | |||
193 | irq_set_default_host(vt8500_irq_domain); | ||
194 | |||
195 | vt8500_init_irq_hw(priv->base); | ||
154 | 196 | ||
155 | ic_regbase = ioremap(wmt_ic_base, SZ_64K); | 197 | pr_info("Added IRQ Controller @ %x [virq_base = %d]\n", |
156 | sic_regbase = ioremap(wmt_sic_base, SZ_64K); | 198 | (u32)(priv->base), irq_cnt); |
157 | 199 | ||
158 | if (ic_regbase && sic_regbase) { | 200 | /* check if this is a slaved controller */ |
159 | /* Enable rotating priority for IRQ */ | 201 | if (of_irq_count(np) != 0) { |
160 | writel((1 << 6), ic_regbase + 0x20); | 202 | /* check that we have the correct number of interrupts */ |
161 | writel(0, ic_regbase + 0x24); | 203 | if (of_irq_count(np) != 8) { |
162 | writel((1 << 6), sic_regbase + 0x20); | 204 | pr_err("%s: Incorrect IRQ map for slave controller\n", |
163 | writel(0, sic_regbase + 0x24); | 205 | __func__); |
164 | 206 | return -EINVAL; | |
165 | for (i = 0; i < wmt_nr_irqs; i++) { | ||
166 | /* Disable all interrupts and route them to IRQ */ | ||
167 | if (i < 64) | ||
168 | writeb(0x00, ic_regbase + VT8500_IC_DCTR + i); | ||
169 | else | ||
170 | writeb(0x00, sic_regbase + VT8500_IC_DCTR | ||
171 | + i - 64); | ||
172 | |||
173 | irq_set_chip_and_handler(i, &vt8500_irq_chip, | ||
174 | handle_level_irq); | ||
175 | set_irq_flags(i, IRQF_VALID); | ||
176 | } | 207 | } |
177 | } else { | 208 | |
178 | printk(KERN_ERR "Unable to remap the Interrupt Controller registers, not enabling IRQs!\n"); | 209 | for (i = 0; i < 8; i++) { |
210 | irq = irq_of_parse_and_map(np, i); | ||
211 | enable_irq(irq); | ||
212 | } | ||
213 | |||
214 | pr_info("vt8500-irq: Enabled slave->parent interrupts\n"); | ||
179 | } | 215 | } |
216 | |||
217 | irq_cnt += 64; | ||
218 | |||
219 | return 0; | ||
180 | } | 220 | } |
221 | |||
diff --git a/arch/arm/mach-vt8500/restart.c b/arch/arm/mach-vt8500/restart.c deleted file mode 100644 index 497e89a5e130..000000000000 --- a/arch/arm/mach-vt8500/restart.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-vt8500/restart.c | ||
2 | * | ||
3 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
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 | #include <asm/io.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
18 | |||
19 | #define LEGACY_PMC_BASE 0xD8130000 | ||
20 | #define WMT_PRIZM_PMSR_REG 0x60 | ||
21 | |||
22 | static void __iomem *pmc_base; | ||
23 | |||
24 | void wmt_setup_restart(void) | ||
25 | { | ||
26 | struct device_node *np; | ||
27 | |||
28 | /* | ||
29 | * Check if Power Mgmt Controller node is present in device tree. If no | ||
30 | * device tree node, use the legacy PMSR value (valid for all current | ||
31 | * SoCs). | ||
32 | */ | ||
33 | np = of_find_compatible_node(NULL, NULL, "wmt,prizm-pmc"); | ||
34 | if (np) { | ||
35 | pmc_base = of_iomap(np, 0); | ||
36 | |||
37 | if (!pmc_base) | ||
38 | pr_err("%s:of_iomap(pmc) failed\n", __func__); | ||
39 | |||
40 | of_node_put(np); | ||
41 | } else { | ||
42 | pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); | ||
43 | if (!pmc_base) { | ||
44 | pr_err("%s:ioremap(rstc) failed\n", __func__); | ||
45 | return; | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | void wmt_restart(char mode, const char *cmd) | ||
51 | { | ||
52 | if (pmc_base) | ||
53 | writel(1, pmc_base + WMT_PRIZM_PMSR_REG); | ||
54 | } | ||
diff --git a/arch/arm/mach-vt8500/timer.c b/arch/arm/mach-vt8500/timer.c index d5376c592ab6..050e1833f2d0 100644 --- a/arch/arm/mach-vt8500/timer.c +++ b/arch/arm/mach-vt8500/timer.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-vt8500/timer.c | 2 | * arch/arm/mach-vt8500/timer_dt.c |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | 5 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -18,18 +19,25 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 20 | */ |
20 | 21 | ||
22 | /* | ||
23 | * This file is copied and modified from the original timer.c provided by | ||
24 | * Alexey Charkov. Minor changes have been made for Device Tree Support. | ||
25 | */ | ||
26 | |||
21 | #include <linux/io.h> | 27 | #include <linux/io.h> |
22 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
23 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
24 | #include <linux/clocksource.h> | 30 | #include <linux/clocksource.h> |
25 | #include <linux/clockchips.h> | 31 | #include <linux/clockchips.h> |
26 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
27 | |||
28 | #include <asm/mach/time.h> | 33 | #include <asm/mach/time.h> |
29 | 34 | ||
30 | #include "devices.h" | 35 | #include <linux/of.h> |
36 | #include <linux/of_address.h> | ||
37 | #include <linux/of_irq.h> | ||
31 | 38 | ||
32 | #define VT8500_TIMER_OFFSET 0x0100 | 39 | #define VT8500_TIMER_OFFSET 0x0100 |
40 | #define VT8500_TIMER_HZ 3000000 | ||
33 | #define TIMER_MATCH_VAL 0x0000 | 41 | #define TIMER_MATCH_VAL 0x0000 |
34 | #define TIMER_COUNT_VAL 0x0010 | 42 | #define TIMER_COUNT_VAL 0x0010 |
35 | #define TIMER_STATUS_VAL 0x0014 | 43 | #define TIMER_STATUS_VAL 0x0014 |
@@ -39,7 +47,6 @@ | |||
39 | #define TIMER_COUNT_R_ACTIVE (1 << 5) /* not ready for read */ | 47 | #define TIMER_COUNT_R_ACTIVE (1 << 5) /* not ready for read */ |
40 | #define TIMER_COUNT_W_ACTIVE (1 << 4) /* not ready for write */ | 48 | #define TIMER_COUNT_W_ACTIVE (1 << 4) /* not ready for write */ |
41 | #define TIMER_MATCH_W_ACTIVE (1 << 0) /* not ready for write */ | 49 | #define TIMER_MATCH_W_ACTIVE (1 << 0) /* not ready for write */ |
42 | #define VT8500_TIMER_HZ 3000000 | ||
43 | 50 | ||
44 | #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) | 51 | #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) |
45 | 52 | ||
@@ -55,7 +62,7 @@ static cycle_t vt8500_timer_read(struct clocksource *cs) | |||
55 | return readl(regbase + TIMER_COUNT_VAL); | 62 | return readl(regbase + TIMER_COUNT_VAL); |
56 | } | 63 | } |
57 | 64 | ||
58 | struct clocksource clocksource = { | 65 | static struct clocksource clocksource = { |
59 | .name = "vt8500_timer", | 66 | .name = "vt8500_timer", |
60 | .rating = 200, | 67 | .rating = 200, |
61 | .read = vt8500_timer_read, | 68 | .read = vt8500_timer_read, |
@@ -98,7 +105,7 @@ static void vt8500_timer_set_mode(enum clock_event_mode mode, | |||
98 | } | 105 | } |
99 | } | 106 | } |
100 | 107 | ||
101 | struct clock_event_device clockevent = { | 108 | static struct clock_event_device clockevent = { |
102 | .name = "vt8500_timer", | 109 | .name = "vt8500_timer", |
103 | .features = CLOCK_EVT_FEAT_ONESHOT, | 110 | .features = CLOCK_EVT_FEAT_ONESHOT, |
104 | .rating = 200, | 111 | .rating = 200, |
@@ -115,26 +122,51 @@ static irqreturn_t vt8500_timer_interrupt(int irq, void *dev_id) | |||
115 | return IRQ_HANDLED; | 122 | return IRQ_HANDLED; |
116 | } | 123 | } |
117 | 124 | ||
118 | struct irqaction irq = { | 125 | static struct irqaction irq = { |
119 | .name = "vt8500_timer", | 126 | .name = "vt8500_timer", |
120 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 127 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
121 | .handler = vt8500_timer_interrupt, | 128 | .handler = vt8500_timer_interrupt, |
122 | .dev_id = &clockevent, | 129 | .dev_id = &clockevent, |
123 | }; | 130 | }; |
124 | 131 | ||
125 | static void __init vt8500_timer_init(void) | 132 | static struct of_device_id vt8500_timer_ids[] = { |
133 | { .compatible = "via,vt8500-timer" }, | ||
134 | { } | ||
135 | }; | ||
136 | |||
137 | void __init vt8500_timer_init(void) | ||
126 | { | 138 | { |
127 | regbase = ioremap(wmt_pmc_base + VT8500_TIMER_OFFSET, 0x28); | 139 | struct device_node *np; |
128 | if (!regbase) | 140 | int timer_irq; |
129 | printk(KERN_ERR "vt8500_timer_init: failed to map MMIO registers\n"); | 141 | |
142 | np = of_find_matching_node(NULL, vt8500_timer_ids); | ||
143 | if (!np) { | ||
144 | pr_err("%s: Timer description missing from Device Tree\n", | ||
145 | __func__); | ||
146 | return; | ||
147 | } | ||
148 | regbase = of_iomap(np, 0); | ||
149 | if (!regbase) { | ||
150 | pr_err("%s: Missing iobase description in Device Tree\n", | ||
151 | __func__); | ||
152 | of_node_put(np); | ||
153 | return; | ||
154 | } | ||
155 | timer_irq = irq_of_parse_and_map(np, 0); | ||
156 | if (!timer_irq) { | ||
157 | pr_err("%s: Missing irq description in Device Tree\n", | ||
158 | __func__); | ||
159 | of_node_put(np); | ||
160 | return; | ||
161 | } | ||
130 | 162 | ||
131 | writel(1, regbase + TIMER_CTRL_VAL); | 163 | writel(1, regbase + TIMER_CTRL_VAL); |
132 | writel(0xf, regbase + TIMER_STATUS_VAL); | 164 | writel(0xf, regbase + TIMER_STATUS_VAL); |
133 | writel(~0, regbase + TIMER_MATCH_VAL); | 165 | writel(~0, regbase + TIMER_MATCH_VAL); |
134 | 166 | ||
135 | if (clocksource_register_hz(&clocksource, VT8500_TIMER_HZ)) | 167 | if (clocksource_register_hz(&clocksource, VT8500_TIMER_HZ)) |
136 | printk(KERN_ERR "vt8500_timer_init: clocksource_register failed for %s\n", | 168 | pr_err("%s: vt8500_timer_init: clocksource_register failed for %s\n", |
137 | clocksource.name); | 169 | __func__, clocksource.name); |
138 | 170 | ||
139 | clockevents_calc_mult_shift(&clockevent, VT8500_TIMER_HZ, 4); | 171 | clockevents_calc_mult_shift(&clockevent, VT8500_TIMER_HZ, 4); |
140 | 172 | ||
@@ -144,12 +176,9 @@ static void __init vt8500_timer_init(void) | |||
144 | clockevent.min_delta_ns = clockevent_delta2ns(4, &clockevent); | 176 | clockevent.min_delta_ns = clockevent_delta2ns(4, &clockevent); |
145 | clockevent.cpumask = cpumask_of(0); | 177 | clockevent.cpumask = cpumask_of(0); |
146 | 178 | ||
147 | if (setup_irq(wmt_timer_irq, &irq)) | 179 | if (setup_irq(timer_irq, &irq)) |
148 | printk(KERN_ERR "vt8500_timer_init: setup_irq failed for %s\n", | 180 | pr_err("%s: setup_irq failed for %s\n", __func__, |
149 | clockevent.name); | 181 | clockevent.name); |
150 | clockevents_register_device(&clockevent); | 182 | clockevents_register_device(&clockevent); |
151 | } | 183 | } |
152 | 184 | ||
153 | struct sys_timer vt8500_timer = { | ||
154 | .init = vt8500_timer_init | ||
155 | }; | ||
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c new file mode 100644 index 000000000000..587ea950d08b --- /dev/null +++ b/arch/arm/mach-vt8500/vt8500.c | |||
@@ -0,0 +1,195 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/vt8500.c | ||
3 | * | ||
4 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
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 | #include <linux/io.h> | ||
22 | #include <linux/pm.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/time.h> | ||
27 | #include <asm/mach/map.h> | ||
28 | |||
29 | #include <linux/of.h> | ||
30 | #include <linux/of_address.h> | ||
31 | #include <linux/of_irq.h> | ||
32 | #include <linux/of_platform.h> | ||
33 | |||
34 | #include <mach/restart.h> | ||
35 | |||
36 | #include "common.h" | ||
37 | |||
38 | #define LEGACY_GPIO_BASE 0xD8110000 | ||
39 | #define LEGACY_PMC_BASE 0xD8130000 | ||
40 | |||
41 | /* Registers in GPIO Controller */ | ||
42 | #define VT8500_GPIO_MUX_REG 0x200 | ||
43 | |||
44 | /* Registers in Power Management Controller */ | ||
45 | #define VT8500_HCR_REG 0x12 | ||
46 | #define VT8500_PMSR_REG 0x60 | ||
47 | |||
48 | static void __iomem *pmc_base; | ||
49 | |||
50 | void vt8500_restart(char mode, const char *cmd) | ||
51 | { | ||
52 | if (pmc_base) | ||
53 | writel(1, pmc_base + VT8500_PMSR_REG); | ||
54 | } | ||
55 | |||
56 | static struct map_desc vt8500_io_desc[] __initdata = { | ||
57 | /* SoC MMIO registers */ | ||
58 | [0] = { | ||
59 | .virtual = 0xf8000000, | ||
60 | .pfn = __phys_to_pfn(0xd8000000), | ||
61 | .length = 0x00390000, /* max of all chip variants */ | ||
62 | .type = MT_DEVICE | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | void __init vt8500_map_io(void) | ||
67 | { | ||
68 | iotable_init(vt8500_io_desc, ARRAY_SIZE(vt8500_io_desc)); | ||
69 | } | ||
70 | |||
71 | static void vt8500_power_off(void) | ||
72 | { | ||
73 | local_irq_disable(); | ||
74 | writew(5, pmc_base + VT8500_HCR_REG); | ||
75 | asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); | ||
76 | } | ||
77 | |||
78 | void __init vt8500_init(void) | ||
79 | { | ||
80 | struct device_node *np, *fb; | ||
81 | void __iomem *gpio_base; | ||
82 | |||
83 | #ifdef CONFIG_FB_VT8500 | ||
84 | fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb"); | ||
85 | if (fb) { | ||
86 | np = of_find_compatible_node(NULL, NULL, "via,vt8500-gpio"); | ||
87 | if (np) { | ||
88 | gpio_base = of_iomap(np, 0); | ||
89 | |||
90 | if (!gpio_base) | ||
91 | pr_err("%s: of_iomap(gpio_mux) failed\n", | ||
92 | __func__); | ||
93 | |||
94 | of_node_put(np); | ||
95 | } else { | ||
96 | gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); | ||
97 | if (!gpio_base) | ||
98 | pr_err("%s: ioremap(legacy_gpio_mux) failed\n", | ||
99 | __func__); | ||
100 | } | ||
101 | if (gpio_base) { | ||
102 | writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | 1, | ||
103 | gpio_base + VT8500_GPIO_MUX_REG); | ||
104 | iounmap(gpio_base); | ||
105 | } else | ||
106 | pr_err("%s: Could not remap GPIO mux\n", __func__); | ||
107 | |||
108 | of_node_put(fb); | ||
109 | } | ||
110 | #endif | ||
111 | |||
112 | #ifdef CONFIG_FB_WM8505 | ||
113 | fb = of_find_compatible_node(NULL, NULL, "wm,wm8505-fb"); | ||
114 | if (fb) { | ||
115 | np = of_find_compatible_node(NULL, NULL, "wm,wm8505-gpio"); | ||
116 | if (!np) | ||
117 | np = of_find_compatible_node(NULL, NULL, | ||
118 | "wm,wm8650-gpio"); | ||
119 | if (np) { | ||
120 | gpio_base = of_iomap(np, 0); | ||
121 | |||
122 | if (!gpio_base) | ||
123 | pr_err("%s: of_iomap(gpio_mux) failed\n", | ||
124 | __func__); | ||
125 | |||
126 | of_node_put(np); | ||
127 | } else { | ||
128 | gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000); | ||
129 | if (!gpio_base) | ||
130 | pr_err("%s: ioremap(legacy_gpio_mux) failed\n", | ||
131 | __func__); | ||
132 | } | ||
133 | if (gpio_base) { | ||
134 | writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | | ||
135 | 0x80000000, gpio_base + VT8500_GPIO_MUX_REG); | ||
136 | iounmap(gpio_base); | ||
137 | } else | ||
138 | pr_err("%s: Could not remap GPIO mux\n", __func__); | ||
139 | |||
140 | of_node_put(fb); | ||
141 | } | ||
142 | #endif | ||
143 | |||
144 | np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc"); | ||
145 | if (np) { | ||
146 | pmc_base = of_iomap(np, 0); | ||
147 | |||
148 | if (!pmc_base) | ||
149 | pr_err("%s:of_iomap(pmc) failed\n", __func__); | ||
150 | |||
151 | of_node_put(np); | ||
152 | } else { | ||
153 | pmc_base = ioremap(LEGACY_PMC_BASE, 0x1000); | ||
154 | if (!pmc_base) | ||
155 | pr_err("%s:ioremap(power_off) failed\n", __func__); | ||
156 | } | ||
157 | if (pmc_base) | ||
158 | pm_power_off = &vt8500_power_off; | ||
159 | else | ||
160 | pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__); | ||
161 | |||
162 | vtwm_clk_init(pmc_base); | ||
163 | |||
164 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
165 | } | ||
166 | |||
167 | static const struct of_device_id vt8500_irq_match[] __initconst = { | ||
168 | { .compatible = "via,vt8500-intc", .data = vt8500_irq_init, }, | ||
169 | { /* sentinel */ }, | ||
170 | }; | ||
171 | |||
172 | static void __init vt8500_init_irq(void) | ||
173 | { | ||
174 | of_irq_init(vt8500_irq_match); | ||
175 | }; | ||
176 | |||
177 | static struct sys_timer vt8500_timer = { | ||
178 | .init = vt8500_timer_init, | ||
179 | }; | ||
180 | |||
181 | static const char * const vt8500_dt_compat[] = { | ||
182 | "via,vt8500", | ||
183 | "wm,wm8650", | ||
184 | "wm,wm8505", | ||
185 | }; | ||
186 | |||
187 | DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") | ||
188 | .dt_compat = vt8500_dt_compat, | ||
189 | .map_io = vt8500_map_io, | ||
190 | .init_irq = vt8500_init_irq, | ||
191 | .timer = &vt8500_timer, | ||
192 | .init_machine = vt8500_init, | ||
193 | .restart = vt8500_restart, | ||
194 | MACHINE_END | ||
195 | |||
diff --git a/arch/arm/mach-vt8500/wm8505_7in.c b/arch/arm/mach-vt8500/wm8505_7in.c deleted file mode 100644 index db19886caf7c..000000000000 --- a/arch/arm/mach-vt8500/wm8505_7in.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-vt8500/wm8505_7in.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/io.h> | ||
22 | #include <linux/pm.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/mach/arch.h> | ||
26 | #include <mach/restart.h> | ||
27 | |||
28 | #include "devices.h" | ||
29 | |||
30 | static void __iomem *pmc_hiber; | ||
31 | |||
32 | static struct platform_device *devices[] __initdata = { | ||
33 | &vt8500_device_uart0, | ||
34 | &vt8500_device_ehci, | ||
35 | &vt8500_device_wm8505_fb, | ||
36 | &vt8500_device_ge_rops, | ||
37 | &vt8500_device_pwm, | ||
38 | &vt8500_device_pwmbl, | ||
39 | &vt8500_device_rtc, | ||
40 | }; | ||
41 | |||
42 | static void vt8500_power_off(void) | ||
43 | { | ||
44 | local_irq_disable(); | ||
45 | writew(5, pmc_hiber); | ||
46 | asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); | ||
47 | } | ||
48 | |||
49 | void __init wm8505_7in_init(void) | ||
50 | { | ||
51 | #ifdef CONFIG_FB_WM8505 | ||
52 | void __iomem *gpio_mux_reg = ioremap(wmt_gpio_base + 0x200, 4); | ||
53 | if (gpio_mux_reg) { | ||
54 | writel(readl(gpio_mux_reg) | 0x80000000, gpio_mux_reg); | ||
55 | iounmap(gpio_mux_reg); | ||
56 | } else { | ||
57 | printk(KERN_ERR "Could not remap the GPIO mux register, display may not work properly!\n"); | ||
58 | } | ||
59 | #endif | ||
60 | pmc_hiber = ioremap(wmt_pmc_base + 0x12, 2); | ||
61 | if (pmc_hiber) | ||
62 | pm_power_off = &vt8500_power_off; | ||
63 | else | ||
64 | printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); | ||
65 | wmt_setup_restart(); | ||
66 | wm8505_set_resources(); | ||
67 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
68 | vt8500_gpio_init(); | ||
69 | } | ||
70 | |||
71 | MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook") | ||
72 | .atag_offset = 0x100, | ||
73 | .restart = wmt_restart, | ||
74 | .reserve = wm8505_reserve_mem, | ||
75 | .map_io = wm8505_map_io, | ||
76 | .init_irq = wm8505_init_irq, | ||
77 | .timer = &vt8500_timer, | ||
78 | .init_machine = wm8505_7in_init, | ||
79 | MACHINE_END | ||
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 2a8e380501e8..577baf7d0a8d 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -554,7 +554,7 @@ static const struct of_device_id l2x0_ids[] __initconst = { | |||
554 | int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | 554 | int __init l2x0_of_init(u32 aux_val, u32 aux_mask) |
555 | { | 555 | { |
556 | struct device_node *np; | 556 | struct device_node *np; |
557 | struct l2x0_of_data *data; | 557 | const struct l2x0_of_data *data; |
558 | struct resource res; | 558 | struct resource res; |
559 | 559 | ||
560 | np = of_find_matching_node(NULL, l2x0_ids); | 560 | np = of_find_matching_node(NULL, l2x0_ids); |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index e59c4ab71bcb..477a2d23ddf1 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -73,11 +73,18 @@ static dma_addr_t arm_dma_map_page(struct device *dev, struct page *page, | |||
73 | unsigned long offset, size_t size, enum dma_data_direction dir, | 73 | unsigned long offset, size_t size, enum dma_data_direction dir, |
74 | struct dma_attrs *attrs) | 74 | struct dma_attrs *attrs) |
75 | { | 75 | { |
76 | if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | 76 | if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) |
77 | __dma_page_cpu_to_dev(page, offset, size, dir); | 77 | __dma_page_cpu_to_dev(page, offset, size, dir); |
78 | return pfn_to_dma(dev, page_to_pfn(page)) + offset; | 78 | return pfn_to_dma(dev, page_to_pfn(page)) + offset; |
79 | } | 79 | } |
80 | 80 | ||
81 | static dma_addr_t arm_coherent_dma_map_page(struct device *dev, struct page *page, | ||
82 | unsigned long offset, size_t size, enum dma_data_direction dir, | ||
83 | struct dma_attrs *attrs) | ||
84 | { | ||
85 | return pfn_to_dma(dev, page_to_pfn(page)) + offset; | ||
86 | } | ||
87 | |||
81 | /** | 88 | /** |
82 | * arm_dma_unmap_page - unmap a buffer previously mapped through dma_map_page() | 89 | * arm_dma_unmap_page - unmap a buffer previously mapped through dma_map_page() |
83 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | 90 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices |
@@ -96,7 +103,7 @@ static void arm_dma_unmap_page(struct device *dev, dma_addr_t handle, | |||
96 | size_t size, enum dma_data_direction dir, | 103 | size_t size, enum dma_data_direction dir, |
97 | struct dma_attrs *attrs) | 104 | struct dma_attrs *attrs) |
98 | { | 105 | { |
99 | if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | 106 | if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) |
100 | __dma_page_dev_to_cpu(pfn_to_page(dma_to_pfn(dev, handle)), | 107 | __dma_page_dev_to_cpu(pfn_to_page(dma_to_pfn(dev, handle)), |
101 | handle & ~PAGE_MASK, size, dir); | 108 | handle & ~PAGE_MASK, size, dir); |
102 | } | 109 | } |
@@ -106,8 +113,7 @@ static void arm_dma_sync_single_for_cpu(struct device *dev, | |||
106 | { | 113 | { |
107 | unsigned int offset = handle & (PAGE_SIZE - 1); | 114 | unsigned int offset = handle & (PAGE_SIZE - 1); |
108 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); | 115 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); |
109 | if (!arch_is_coherent()) | 116 | __dma_page_dev_to_cpu(page, offset, size, dir); |
110 | __dma_page_dev_to_cpu(page, offset, size, dir); | ||
111 | } | 117 | } |
112 | 118 | ||
113 | static void arm_dma_sync_single_for_device(struct device *dev, | 119 | static void arm_dma_sync_single_for_device(struct device *dev, |
@@ -115,8 +121,7 @@ static void arm_dma_sync_single_for_device(struct device *dev, | |||
115 | { | 121 | { |
116 | unsigned int offset = handle & (PAGE_SIZE - 1); | 122 | unsigned int offset = handle & (PAGE_SIZE - 1); |
117 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); | 123 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle-offset)); |
118 | if (!arch_is_coherent()) | 124 | __dma_page_cpu_to_dev(page, offset, size, dir); |
119 | __dma_page_cpu_to_dev(page, offset, size, dir); | ||
120 | } | 125 | } |
121 | 126 | ||
122 | static int arm_dma_set_mask(struct device *dev, u64 dma_mask); | 127 | static int arm_dma_set_mask(struct device *dev, u64 dma_mask); |
@@ -138,6 +143,22 @@ struct dma_map_ops arm_dma_ops = { | |||
138 | }; | 143 | }; |
139 | EXPORT_SYMBOL(arm_dma_ops); | 144 | EXPORT_SYMBOL(arm_dma_ops); |
140 | 145 | ||
146 | static void *arm_coherent_dma_alloc(struct device *dev, size_t size, | ||
147 | dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs); | ||
148 | static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_addr, | ||
149 | dma_addr_t handle, struct dma_attrs *attrs); | ||
150 | |||
151 | struct dma_map_ops arm_coherent_dma_ops = { | ||
152 | .alloc = arm_coherent_dma_alloc, | ||
153 | .free = arm_coherent_dma_free, | ||
154 | .mmap = arm_dma_mmap, | ||
155 | .get_sgtable = arm_dma_get_sgtable, | ||
156 | .map_page = arm_coherent_dma_map_page, | ||
157 | .map_sg = arm_dma_map_sg, | ||
158 | .set_dma_mask = arm_dma_set_mask, | ||
159 | }; | ||
160 | EXPORT_SYMBOL(arm_coherent_dma_ops); | ||
161 | |||
141 | static u64 get_coherent_dma_mask(struct device *dev) | 162 | static u64 get_coherent_dma_mask(struct device *dev) |
142 | { | 163 | { |
143 | u64 mask = (u64)arm_dma_limit; | 164 | u64 mask = (u64)arm_dma_limit; |
@@ -346,6 +367,8 @@ static int __init atomic_pool_init(void) | |||
346 | (unsigned)pool->size / 1024); | 367 | (unsigned)pool->size / 1024); |
347 | return 0; | 368 | return 0; |
348 | } | 369 | } |
370 | |||
371 | kfree(pages); | ||
349 | no_pages: | 372 | no_pages: |
350 | kfree(bitmap); | 373 | kfree(bitmap); |
351 | no_bitmap: | 374 | no_bitmap: |
@@ -584,7 +607,7 @@ static void *__alloc_simple_buffer(struct device *dev, size_t size, gfp_t gfp, | |||
584 | 607 | ||
585 | 608 | ||
586 | static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | 609 | static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, |
587 | gfp_t gfp, pgprot_t prot, const void *caller) | 610 | gfp_t gfp, pgprot_t prot, bool is_coherent, const void *caller) |
588 | { | 611 | { |
589 | u64 mask = get_coherent_dma_mask(dev); | 612 | u64 mask = get_coherent_dma_mask(dev); |
590 | struct page *page; | 613 | struct page *page; |
@@ -617,7 +640,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | |||
617 | *handle = DMA_ERROR_CODE; | 640 | *handle = DMA_ERROR_CODE; |
618 | size = PAGE_ALIGN(size); | 641 | size = PAGE_ALIGN(size); |
619 | 642 | ||
620 | if (arch_is_coherent() || nommu()) | 643 | if (is_coherent || nommu()) |
621 | addr = __alloc_simple_buffer(dev, size, gfp, &page); | 644 | addr = __alloc_simple_buffer(dev, size, gfp, &page); |
622 | else if (gfp & GFP_ATOMIC) | 645 | else if (gfp & GFP_ATOMIC) |
623 | addr = __alloc_from_pool(size, &page); | 646 | addr = __alloc_from_pool(size, &page); |
@@ -645,7 +668,20 @@ void *arm_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | |||
645 | if (dma_alloc_from_coherent(dev, size, handle, &memory)) | 668 | if (dma_alloc_from_coherent(dev, size, handle, &memory)) |
646 | return memory; | 669 | return memory; |
647 | 670 | ||
648 | return __dma_alloc(dev, size, handle, gfp, prot, | 671 | return __dma_alloc(dev, size, handle, gfp, prot, false, |
672 | __builtin_return_address(0)); | ||
673 | } | ||
674 | |||
675 | static void *arm_coherent_dma_alloc(struct device *dev, size_t size, | ||
676 | dma_addr_t *handle, gfp_t gfp, struct dma_attrs *attrs) | ||
677 | { | ||
678 | pgprot_t prot = __get_dma_pgprot(attrs, pgprot_kernel); | ||
679 | void *memory; | ||
680 | |||
681 | if (dma_alloc_from_coherent(dev, size, handle, &memory)) | ||
682 | return memory; | ||
683 | |||
684 | return __dma_alloc(dev, size, handle, gfp, prot, true, | ||
649 | __builtin_return_address(0)); | 685 | __builtin_return_address(0)); |
650 | } | 686 | } |
651 | 687 | ||
@@ -682,8 +718,9 @@ int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, | |||
682 | /* | 718 | /* |
683 | * Free a buffer as defined by the above mapping. | 719 | * Free a buffer as defined by the above mapping. |
684 | */ | 720 | */ |
685 | void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | 721 | static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, |
686 | dma_addr_t handle, struct dma_attrs *attrs) | 722 | dma_addr_t handle, struct dma_attrs *attrs, |
723 | bool is_coherent) | ||
687 | { | 724 | { |
688 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle)); | 725 | struct page *page = pfn_to_page(dma_to_pfn(dev, handle)); |
689 | 726 | ||
@@ -692,7 +729,7 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | |||
692 | 729 | ||
693 | size = PAGE_ALIGN(size); | 730 | size = PAGE_ALIGN(size); |
694 | 731 | ||
695 | if (arch_is_coherent() || nommu()) { | 732 | if (is_coherent || nommu()) { |
696 | __dma_free_buffer(page, size); | 733 | __dma_free_buffer(page, size); |
697 | } else if (__free_from_pool(cpu_addr, size)) { | 734 | } else if (__free_from_pool(cpu_addr, size)) { |
698 | return; | 735 | return; |
@@ -708,6 +745,18 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | |||
708 | } | 745 | } |
709 | } | 746 | } |
710 | 747 | ||
748 | void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | ||
749 | dma_addr_t handle, struct dma_attrs *attrs) | ||
750 | { | ||
751 | __arm_dma_free(dev, size, cpu_addr, handle, attrs, false); | ||
752 | } | ||
753 | |||
754 | static void arm_coherent_dma_free(struct device *dev, size_t size, void *cpu_addr, | ||
755 | dma_addr_t handle, struct dma_attrs *attrs) | ||
756 | { | ||
757 | __arm_dma_free(dev, size, cpu_addr, handle, attrs, true); | ||
758 | } | ||
759 | |||
711 | int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, | 760 | int arm_dma_get_sgtable(struct device *dev, struct sg_table *sgt, |
712 | void *cpu_addr, dma_addr_t handle, size_t size, | 761 | void *cpu_addr, dma_addr_t handle, size_t size, |
713 | struct dma_attrs *attrs) | 762 | struct dma_attrs *attrs) |
@@ -1010,11 +1059,12 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, gfp_t | |||
1010 | if (!pages[i]) | 1059 | if (!pages[i]) |
1011 | goto error; | 1060 | goto error; |
1012 | 1061 | ||
1013 | if (order) | 1062 | if (order) { |
1014 | split_page(pages[i], order); | 1063 | split_page(pages[i], order); |
1015 | j = 1 << order; | 1064 | j = 1 << order; |
1016 | while (--j) | 1065 | while (--j) |
1017 | pages[i + j] = pages[i] + j; | 1066 | pages[i + j] = pages[i] + j; |
1067 | } | ||
1018 | 1068 | ||
1019 | __dma_clear_buffer(pages[i], PAGE_SIZE << order); | 1069 | __dma_clear_buffer(pages[i], PAGE_SIZE << order); |
1020 | i += 1 << order; | 1070 | i += 1 << order; |
@@ -1301,7 +1351,8 @@ static int arm_iommu_get_sgtable(struct device *dev, struct sg_table *sgt, | |||
1301 | */ | 1351 | */ |
1302 | static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, | 1352 | static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, |
1303 | size_t size, dma_addr_t *handle, | 1353 | size_t size, dma_addr_t *handle, |
1304 | enum dma_data_direction dir, struct dma_attrs *attrs) | 1354 | enum dma_data_direction dir, struct dma_attrs *attrs, |
1355 | bool is_coherent) | ||
1305 | { | 1356 | { |
1306 | struct dma_iommu_mapping *mapping = dev->archdata.mapping; | 1357 | struct dma_iommu_mapping *mapping = dev->archdata.mapping; |
1307 | dma_addr_t iova, iova_base; | 1358 | dma_addr_t iova, iova_base; |
@@ -1320,8 +1371,8 @@ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, | |||
1320 | phys_addr_t phys = page_to_phys(sg_page(s)); | 1371 | phys_addr_t phys = page_to_phys(sg_page(s)); |
1321 | unsigned int len = PAGE_ALIGN(s->offset + s->length); | 1372 | unsigned int len = PAGE_ALIGN(s->offset + s->length); |
1322 | 1373 | ||
1323 | if (!arch_is_coherent() && | 1374 | if (!is_coherent && |
1324 | !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | 1375 | !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) |
1325 | __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); | 1376 | __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); |
1326 | 1377 | ||
1327 | ret = iommu_map(mapping->domain, iova, phys, len, 0); | 1378 | ret = iommu_map(mapping->domain, iova, phys, len, 0); |
@@ -1339,20 +1390,9 @@ fail: | |||
1339 | return ret; | 1390 | return ret; |
1340 | } | 1391 | } |
1341 | 1392 | ||
1342 | /** | 1393 | static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, |
1343 | * arm_iommu_map_sg - map a set of SG buffers for streaming mode DMA | 1394 | enum dma_data_direction dir, struct dma_attrs *attrs, |
1344 | * @dev: valid struct device pointer | 1395 | bool is_coherent) |
1345 | * @sg: list of buffers | ||
1346 | * @nents: number of buffers to map | ||
1347 | * @dir: DMA transfer direction | ||
1348 | * | ||
1349 | * Map a set of buffers described by scatterlist in streaming mode for DMA. | ||
1350 | * The scatter gather list elements are merged together (if possible) and | ||
1351 | * tagged with the appropriate dma address and length. They are obtained via | ||
1352 | * sg_dma_{address,length}. | ||
1353 | */ | ||
1354 | int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
1355 | enum dma_data_direction dir, struct dma_attrs *attrs) | ||
1356 | { | 1396 | { |
1357 | struct scatterlist *s = sg, *dma = sg, *start = sg; | 1397 | struct scatterlist *s = sg, *dma = sg, *start = sg; |
1358 | int i, count = 0; | 1398 | int i, count = 0; |
@@ -1368,7 +1408,7 @@ int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
1368 | 1408 | ||
1369 | if (s->offset || (size & ~PAGE_MASK) || size + s->length > max) { | 1409 | if (s->offset || (size & ~PAGE_MASK) || size + s->length > max) { |
1370 | if (__map_sg_chunk(dev, start, size, &dma->dma_address, | 1410 | if (__map_sg_chunk(dev, start, size, &dma->dma_address, |
1371 | dir, attrs) < 0) | 1411 | dir, attrs, is_coherent) < 0) |
1372 | goto bad_mapping; | 1412 | goto bad_mapping; |
1373 | 1413 | ||
1374 | dma->dma_address += offset; | 1414 | dma->dma_address += offset; |
@@ -1381,7 +1421,8 @@ int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
1381 | } | 1421 | } |
1382 | size += s->length; | 1422 | size += s->length; |
1383 | } | 1423 | } |
1384 | if (__map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs) < 0) | 1424 | if (__map_sg_chunk(dev, start, size, &dma->dma_address, dir, attrs, |
1425 | is_coherent) < 0) | ||
1385 | goto bad_mapping; | 1426 | goto bad_mapping; |
1386 | 1427 | ||
1387 | dma->dma_address += offset; | 1428 | dma->dma_address += offset; |
@@ -1396,17 +1437,44 @@ bad_mapping: | |||
1396 | } | 1437 | } |
1397 | 1438 | ||
1398 | /** | 1439 | /** |
1399 | * arm_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg | 1440 | * arm_coherent_iommu_map_sg - map a set of SG buffers for streaming mode DMA |
1400 | * @dev: valid struct device pointer | 1441 | * @dev: valid struct device pointer |
1401 | * @sg: list of buffers | 1442 | * @sg: list of buffers |
1402 | * @nents: number of buffers to unmap (same as was passed to dma_map_sg) | 1443 | * @nents: number of buffers to map |
1403 | * @dir: DMA transfer direction (same as was passed to dma_map_sg) | 1444 | * @dir: DMA transfer direction |
1404 | * | 1445 | * |
1405 | * Unmap a set of streaming mode DMA translations. Again, CPU access | 1446 | * Map a set of i/o coherent buffers described by scatterlist in streaming |
1406 | * rules concerning calls here are the same as for dma_unmap_single(). | 1447 | * mode for DMA. The scatter gather list elements are merged together (if |
1448 | * possible) and tagged with the appropriate dma address and length. They are | ||
1449 | * obtained via sg_dma_{address,length}. | ||
1407 | */ | 1450 | */ |
1408 | void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | 1451 | int arm_coherent_iommu_map_sg(struct device *dev, struct scatterlist *sg, |
1409 | enum dma_data_direction dir, struct dma_attrs *attrs) | 1452 | int nents, enum dma_data_direction dir, struct dma_attrs *attrs) |
1453 | { | ||
1454 | return __iommu_map_sg(dev, sg, nents, dir, attrs, true); | ||
1455 | } | ||
1456 | |||
1457 | /** | ||
1458 | * arm_iommu_map_sg - map a set of SG buffers for streaming mode DMA | ||
1459 | * @dev: valid struct device pointer | ||
1460 | * @sg: list of buffers | ||
1461 | * @nents: number of buffers to map | ||
1462 | * @dir: DMA transfer direction | ||
1463 | * | ||
1464 | * Map a set of buffers described by scatterlist in streaming mode for DMA. | ||
1465 | * The scatter gather list elements are merged together (if possible) and | ||
1466 | * tagged with the appropriate dma address and length. They are obtained via | ||
1467 | * sg_dma_{address,length}. | ||
1468 | */ | ||
1469 | int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, | ||
1470 | int nents, enum dma_data_direction dir, struct dma_attrs *attrs) | ||
1471 | { | ||
1472 | return __iommu_map_sg(dev, sg, nents, dir, attrs, false); | ||
1473 | } | ||
1474 | |||
1475 | static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
1476 | int nents, enum dma_data_direction dir, struct dma_attrs *attrs, | ||
1477 | bool is_coherent) | ||
1410 | { | 1478 | { |
1411 | struct scatterlist *s; | 1479 | struct scatterlist *s; |
1412 | int i; | 1480 | int i; |
@@ -1415,7 +1483,7 @@ void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
1415 | if (sg_dma_len(s)) | 1483 | if (sg_dma_len(s)) |
1416 | __iommu_remove_mapping(dev, sg_dma_address(s), | 1484 | __iommu_remove_mapping(dev, sg_dma_address(s), |
1417 | sg_dma_len(s)); | 1485 | sg_dma_len(s)); |
1418 | if (!arch_is_coherent() && | 1486 | if (!is_coherent && |
1419 | !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | 1487 | !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) |
1420 | __dma_page_dev_to_cpu(sg_page(s), s->offset, | 1488 | __dma_page_dev_to_cpu(sg_page(s), s->offset, |
1421 | s->length, dir); | 1489 | s->length, dir); |
@@ -1423,6 +1491,38 @@ void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
1423 | } | 1491 | } |
1424 | 1492 | ||
1425 | /** | 1493 | /** |
1494 | * arm_coherent_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg | ||
1495 | * @dev: valid struct device pointer | ||
1496 | * @sg: list of buffers | ||
1497 | * @nents: number of buffers to unmap (same as was passed to dma_map_sg) | ||
1498 | * @dir: DMA transfer direction (same as was passed to dma_map_sg) | ||
1499 | * | ||
1500 | * Unmap a set of streaming mode DMA translations. Again, CPU access | ||
1501 | * rules concerning calls here are the same as for dma_unmap_single(). | ||
1502 | */ | ||
1503 | void arm_coherent_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, | ||
1504 | int nents, enum dma_data_direction dir, struct dma_attrs *attrs) | ||
1505 | { | ||
1506 | __iommu_unmap_sg(dev, sg, nents, dir, attrs, true); | ||
1507 | } | ||
1508 | |||
1509 | /** | ||
1510 | * arm_iommu_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg | ||
1511 | * @dev: valid struct device pointer | ||
1512 | * @sg: list of buffers | ||
1513 | * @nents: number of buffers to unmap (same as was passed to dma_map_sg) | ||
1514 | * @dir: DMA transfer direction (same as was passed to dma_map_sg) | ||
1515 | * | ||
1516 | * Unmap a set of streaming mode DMA translations. Again, CPU access | ||
1517 | * rules concerning calls here are the same as for dma_unmap_single(). | ||
1518 | */ | ||
1519 | void arm_iommu_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
1520 | enum dma_data_direction dir, struct dma_attrs *attrs) | ||
1521 | { | ||
1522 | __iommu_unmap_sg(dev, sg, nents, dir, attrs, false); | ||
1523 | } | ||
1524 | |||
1525 | /** | ||
1426 | * arm_iommu_sync_sg_for_cpu | 1526 | * arm_iommu_sync_sg_for_cpu |
1427 | * @dev: valid struct device pointer | 1527 | * @dev: valid struct device pointer |
1428 | * @sg: list of buffers | 1528 | * @sg: list of buffers |
@@ -1436,8 +1536,7 @@ void arm_iommu_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, | |||
1436 | int i; | 1536 | int i; |
1437 | 1537 | ||
1438 | for_each_sg(sg, s, nents, i) | 1538 | for_each_sg(sg, s, nents, i) |
1439 | if (!arch_is_coherent()) | 1539 | __dma_page_dev_to_cpu(sg_page(s), s->offset, s->length, dir); |
1440 | __dma_page_dev_to_cpu(sg_page(s), s->offset, s->length, dir); | ||
1441 | 1540 | ||
1442 | } | 1541 | } |
1443 | 1542 | ||
@@ -1455,22 +1554,21 @@ void arm_iommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg, | |||
1455 | int i; | 1554 | int i; |
1456 | 1555 | ||
1457 | for_each_sg(sg, s, nents, i) | 1556 | for_each_sg(sg, s, nents, i) |
1458 | if (!arch_is_coherent()) | 1557 | __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); |
1459 | __dma_page_cpu_to_dev(sg_page(s), s->offset, s->length, dir); | ||
1460 | } | 1558 | } |
1461 | 1559 | ||
1462 | 1560 | ||
1463 | /** | 1561 | /** |
1464 | * arm_iommu_map_page | 1562 | * arm_coherent_iommu_map_page |
1465 | * @dev: valid struct device pointer | 1563 | * @dev: valid struct device pointer |
1466 | * @page: page that buffer resides in | 1564 | * @page: page that buffer resides in |
1467 | * @offset: offset into page for start of buffer | 1565 | * @offset: offset into page for start of buffer |
1468 | * @size: size of buffer to map | 1566 | * @size: size of buffer to map |
1469 | * @dir: DMA transfer direction | 1567 | * @dir: DMA transfer direction |
1470 | * | 1568 | * |
1471 | * IOMMU aware version of arm_dma_map_page() | 1569 | * Coherent IOMMU aware version of arm_dma_map_page() |
1472 | */ | 1570 | */ |
1473 | static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, | 1571 | static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *page, |
1474 | unsigned long offset, size_t size, enum dma_data_direction dir, | 1572 | unsigned long offset, size_t size, enum dma_data_direction dir, |
1475 | struct dma_attrs *attrs) | 1573 | struct dma_attrs *attrs) |
1476 | { | 1574 | { |
@@ -1478,9 +1576,6 @@ static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, | |||
1478 | dma_addr_t dma_addr; | 1576 | dma_addr_t dma_addr; |
1479 | int ret, len = PAGE_ALIGN(size + offset); | 1577 | int ret, len = PAGE_ALIGN(size + offset); |
1480 | 1578 | ||
1481 | if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | ||
1482 | __dma_page_cpu_to_dev(page, offset, size, dir); | ||
1483 | |||
1484 | dma_addr = __alloc_iova(mapping, len); | 1579 | dma_addr = __alloc_iova(mapping, len); |
1485 | if (dma_addr == DMA_ERROR_CODE) | 1580 | if (dma_addr == DMA_ERROR_CODE) |
1486 | return dma_addr; | 1581 | return dma_addr; |
@@ -1496,6 +1591,51 @@ fail: | |||
1496 | } | 1591 | } |
1497 | 1592 | ||
1498 | /** | 1593 | /** |
1594 | * arm_iommu_map_page | ||
1595 | * @dev: valid struct device pointer | ||
1596 | * @page: page that buffer resides in | ||
1597 | * @offset: offset into page for start of buffer | ||
1598 | * @size: size of buffer to map | ||
1599 | * @dir: DMA transfer direction | ||
1600 | * | ||
1601 | * IOMMU aware version of arm_dma_map_page() | ||
1602 | */ | ||
1603 | static dma_addr_t arm_iommu_map_page(struct device *dev, struct page *page, | ||
1604 | unsigned long offset, size_t size, enum dma_data_direction dir, | ||
1605 | struct dma_attrs *attrs) | ||
1606 | { | ||
1607 | if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | ||
1608 | __dma_page_cpu_to_dev(page, offset, size, dir); | ||
1609 | |||
1610 | return arm_coherent_iommu_map_page(dev, page, offset, size, dir, attrs); | ||
1611 | } | ||
1612 | |||
1613 | /** | ||
1614 | * arm_coherent_iommu_unmap_page | ||
1615 | * @dev: valid struct device pointer | ||
1616 | * @handle: DMA address of buffer | ||
1617 | * @size: size of buffer (same as passed to dma_map_page) | ||
1618 | * @dir: DMA transfer direction (same as passed to dma_map_page) | ||
1619 | * | ||
1620 | * Coherent IOMMU aware version of arm_dma_unmap_page() | ||
1621 | */ | ||
1622 | static void arm_coherent_iommu_unmap_page(struct device *dev, dma_addr_t handle, | ||
1623 | size_t size, enum dma_data_direction dir, | ||
1624 | struct dma_attrs *attrs) | ||
1625 | { | ||
1626 | struct dma_iommu_mapping *mapping = dev->archdata.mapping; | ||
1627 | dma_addr_t iova = handle & PAGE_MASK; | ||
1628 | int offset = handle & ~PAGE_MASK; | ||
1629 | int len = PAGE_ALIGN(size + offset); | ||
1630 | |||
1631 | if (!iova) | ||
1632 | return; | ||
1633 | |||
1634 | iommu_unmap(mapping->domain, iova, len); | ||
1635 | __free_iova(mapping, iova, len); | ||
1636 | } | ||
1637 | |||
1638 | /** | ||
1499 | * arm_iommu_unmap_page | 1639 | * arm_iommu_unmap_page |
1500 | * @dev: valid struct device pointer | 1640 | * @dev: valid struct device pointer |
1501 | * @handle: DMA address of buffer | 1641 | * @handle: DMA address of buffer |
@@ -1517,7 +1657,7 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle, | |||
1517 | if (!iova) | 1657 | if (!iova) |
1518 | return; | 1658 | return; |
1519 | 1659 | ||
1520 | if (!arch_is_coherent() && !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | 1660 | if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) |
1521 | __dma_page_dev_to_cpu(page, offset, size, dir); | 1661 | __dma_page_dev_to_cpu(page, offset, size, dir); |
1522 | 1662 | ||
1523 | iommu_unmap(mapping->domain, iova, len); | 1663 | iommu_unmap(mapping->domain, iova, len); |
@@ -1535,8 +1675,7 @@ static void arm_iommu_sync_single_for_cpu(struct device *dev, | |||
1535 | if (!iova) | 1675 | if (!iova) |
1536 | return; | 1676 | return; |
1537 | 1677 | ||
1538 | if (!arch_is_coherent()) | 1678 | __dma_page_dev_to_cpu(page, offset, size, dir); |
1539 | __dma_page_dev_to_cpu(page, offset, size, dir); | ||
1540 | } | 1679 | } |
1541 | 1680 | ||
1542 | static void arm_iommu_sync_single_for_device(struct device *dev, | 1681 | static void arm_iommu_sync_single_for_device(struct device *dev, |
@@ -1570,6 +1709,19 @@ struct dma_map_ops iommu_ops = { | |||
1570 | .sync_sg_for_device = arm_iommu_sync_sg_for_device, | 1709 | .sync_sg_for_device = arm_iommu_sync_sg_for_device, |
1571 | }; | 1710 | }; |
1572 | 1711 | ||
1712 | struct dma_map_ops iommu_coherent_ops = { | ||
1713 | .alloc = arm_iommu_alloc_attrs, | ||
1714 | .free = arm_iommu_free_attrs, | ||
1715 | .mmap = arm_iommu_mmap_attrs, | ||
1716 | .get_sgtable = arm_iommu_get_sgtable, | ||
1717 | |||
1718 | .map_page = arm_coherent_iommu_map_page, | ||
1719 | .unmap_page = arm_coherent_iommu_unmap_page, | ||
1720 | |||
1721 | .map_sg = arm_coherent_iommu_map_sg, | ||
1722 | .unmap_sg = arm_coherent_iommu_unmap_sg, | ||
1723 | }; | ||
1724 | |||
1573 | /** | 1725 | /** |
1574 | * arm_iommu_create_mapping | 1726 | * arm_iommu_create_mapping |
1575 | * @bus: pointer to the bus holding the client device (for IOMMU calls) | 1727 | * @bus: pointer to the bus holding the client device (for IOMMU calls) |
@@ -1663,7 +1815,7 @@ int arm_iommu_attach_device(struct device *dev, | |||
1663 | dev->archdata.mapping = mapping; | 1815 | dev->archdata.mapping = mapping; |
1664 | set_dma_ops(dev, &iommu_ops); | 1816 | set_dma_ops(dev, &iommu_ops); |
1665 | 1817 | ||
1666 | pr_info("Attached IOMMU controller to %s device.\n", dev_name(dev)); | 1818 | pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev)); |
1667 | return 0; | 1819 | return 0; |
1668 | } | 1820 | } |
1669 | 1821 | ||
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 18144e6a3115..941dfb9e9a78 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -423,17 +423,6 @@ static void __init build_mem_type_table(void) | |||
423 | vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; | 423 | vecs_pgprot = kern_pgprot = user_pgprot = cp->pte; |
424 | 424 | ||
425 | /* | 425 | /* |
426 | * Enable CPU-specific coherency if supported. | ||
427 | * (Only available on XSC3 at the moment.) | ||
428 | */ | ||
429 | if (arch_is_coherent() && cpu_is_xsc3()) { | ||
430 | mem_types[MT_MEMORY].prot_sect |= PMD_SECT_S; | ||
431 | mem_types[MT_MEMORY].prot_pte |= L_PTE_SHARED; | ||
432 | mem_types[MT_MEMORY_DMA_READY].prot_pte |= L_PTE_SHARED; | ||
433 | mem_types[MT_MEMORY_NONCACHED].prot_sect |= PMD_SECT_S; | ||
434 | mem_types[MT_MEMORY_NONCACHED].prot_pte |= L_PTE_SHARED; | ||
435 | } | ||
436 | /* | ||
437 | * ARMv6 and above have extended page tables. | 426 | * ARMv6 and above have extended page tables. |
438 | */ | 427 | */ |
439 | if (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP)) { | 428 | if (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP)) { |
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index cb3e3eef55c0..6b46cee2f9cd 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -15,7 +15,11 @@ config IMX_HAVE_PLATFORM_GPIO_KEYS | |||
15 | 15 | ||
16 | config IMX_HAVE_PLATFORM_IMX21_HCD | 16 | config IMX_HAVE_PLATFORM_IMX21_HCD |
17 | bool | 17 | bool |
18 | 18 | ||
19 | config IMX_HAVE_PLATFORM_IMX27_CODA | ||
20 | bool | ||
21 | default y if SOC_IMX27 | ||
22 | |||
19 | config IMX_HAVE_PLATFORM_IMX2_WDT | 23 | config IMX_HAVE_PLATFORM_IMX2_WDT |
20 | bool | 24 | bool |
21 | 25 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index c11ac8472beb..76f3195475d0 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -4,6 +4,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o | |||
4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o | 4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o |
5 | obj-y += platform-gpio-mxc.o | 5 | obj-y += platform-gpio-mxc.o |
6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o | 6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o |
7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o | ||
7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o | 8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o |
8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o | 9 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o |
9 | obj-y += platform-imx-dma.o | 10 | obj-y += platform-imx-dma.o |
diff --git a/arch/arm/plat-mxc/devices/platform-imx27-coda.c b/arch/arm/plat-mxc/devices/platform-imx27-coda.c new file mode 100644 index 000000000000..8b12aacdf396 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-imx27-coda.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Vista Silicon | ||
3 | * Javier Martin <javier.martin@vista-silicon.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <mach/hardware.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #ifdef CONFIG_SOC_IMX27 | ||
14 | const struct imx_imx27_coda_data imx27_coda_data __initconst = { | ||
15 | .iobase = MX27_VPU_BASE_ADDR, | ||
16 | .iosize = SZ_512, | ||
17 | .irq = MX27_INT_VPU, | ||
18 | }; | ||
19 | #endif | ||
20 | |||
21 | struct platform_device *__init imx_add_imx27_coda( | ||
22 | const struct imx_imx27_coda_data *data) | ||
23 | { | ||
24 | struct resource res[] = { | ||
25 | { | ||
26 | .start = data->iobase, | ||
27 | .end = data->iobase + data->iosize - 1, | ||
28 | .flags = IORESOURCE_MEM, | ||
29 | }, { | ||
30 | .start = data->irq, | ||
31 | .end = data->irq, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | }; | ||
35 | return imx_add_platform_device_dmamask("coda-imx27", 0, res, 2, NULL, | ||
36 | 0, DMA_BIT_MASK(32)); | ||
37 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 9e3e3d8ae8c2..eaf79d220c9a 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -83,6 +83,14 @@ struct platform_device *__init imx_add_imx21_hcd( | |||
83 | const struct imx_imx21_hcd_data *data, | 83 | const struct imx_imx21_hcd_data *data, |
84 | const struct mx21_usbh_platform_data *pdata); | 84 | const struct mx21_usbh_platform_data *pdata); |
85 | 85 | ||
86 | struct imx_imx27_coda_data { | ||
87 | resource_size_t iobase; | ||
88 | resource_size_t iosize; | ||
89 | resource_size_t irq; | ||
90 | }; | ||
91 | struct platform_device *__init imx_add_imx27_coda( | ||
92 | const struct imx_imx27_coda_data *data); | ||
93 | |||
86 | struct imx_imx2_wdt_data { | 94 | struct imx_imx2_wdt_data { |
87 | int id; | 95 | int id; |
88 | resource_size_t iobase; | 96 | resource_size_t iobase; |
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h index 627d94f1b010..ec466400a200 100644 --- a/arch/arm/plat-mxc/include/mach/mx25.h +++ b/arch/arm/plat-mxc/include/mach/mx25.h | |||
@@ -98,6 +98,7 @@ | |||
98 | #define MX25_INT_UART1 (NR_IRQS_LEGACY + 45) | 98 | #define MX25_INT_UART1 (NR_IRQS_LEGACY + 45) |
99 | #define MX25_INT_GPIO2 (NR_IRQS_LEGACY + 51) | 99 | #define MX25_INT_GPIO2 (NR_IRQS_LEGACY + 51) |
100 | #define MX25_INT_GPIO1 (NR_IRQS_LEGACY + 52) | 100 | #define MX25_INT_GPIO1 (NR_IRQS_LEGACY + 52) |
101 | #define MX25_INT_GPT1 (NR_IRQS_LEGACY + 54) | ||
101 | #define MX25_INT_FEC (NR_IRQS_LEGACY + 57) | 102 | #define MX25_INT_FEC (NR_IRQS_LEGACY + 57) |
102 | 103 | ||
103 | #define MX25_DMA_REQ_SSI2_RX1 22 | 104 | #define MX25_DMA_REQ_SSI2_RX1 22 |
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index d15a4a6d6146..ca83a7659aef 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig | |||
@@ -42,9 +42,8 @@ config OMAP_DEBUG_DEVICES | |||
42 | For debug cards on TI reference boards. | 42 | For debug cards on TI reference boards. |
43 | 43 | ||
44 | config OMAP_DEBUG_LEDS | 44 | config OMAP_DEBUG_LEDS |
45 | bool | 45 | def_bool y if NEW_LEDS |
46 | depends on OMAP_DEBUG_DEVICES | 46 | depends on OMAP_DEBUG_DEVICES |
47 | default y if LEDS_CLASS | ||
48 | 47 | ||
49 | config POWER_AVS_OMAP | 48 | config POWER_AVS_OMAP |
50 | bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2" | 49 | bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2" |
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c index 195aaae65872..ea29bbe8e5cf 100644 --- a/arch/arm/plat-omap/debug-leds.c +++ b/arch/arm/plat-omap/debug-leds.c | |||
@@ -1,280 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/plat-omap/debug-leds.c | 2 | * linux/arch/arm/plat-omap/debug-leds.c |
3 | * | 3 | * |
4 | * Copyright 2011 by Bryan Wu <bryan.wu@canonical.com> | ||
4 | * Copyright 2003 by Texas Instruments Incorporated | 5 | * Copyright 2003 by Texas Instruments Incorporated |
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * 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 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
9 | */ | 10 | */ |
10 | #include <linux/gpio.h> | 11 | |
12 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | 13 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
13 | #include <linux/leds.h> | 15 | #include <linux/leds.h> |
14 | #include <linux/io.h> | 16 | #include <linux/io.h> |
15 | #include <linux/platform_data/gpio-omap.h> | 17 | #include <linux/platform_data/gpio-omap.h> |
18 | #include <linux/slab.h> | ||
16 | 19 | ||
17 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
18 | #include <asm/leds.h> | ||
19 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
20 | 22 | ||
21 | #include <plat/fpga.h> | 23 | #include <plat/fpga.h> |
22 | 24 | ||
23 | |||
24 | /* Many OMAP development platforms reuse the same "debug board"; these | 25 | /* Many OMAP development platforms reuse the same "debug board"; these |
25 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the | 26 | * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the |
26 | * debug board (all green), accessed through FPGA registers. | 27 | * debug board (all green), accessed through FPGA registers. |
27 | * | ||
28 | * The "surfer" expansion board and H2 sample board also have two-color | ||
29 | * green+red LEDs (in parallel), used here for timer and idle indicators | ||
30 | * in preference to the ones on the debug board, for a "Disco LED" effect. | ||
31 | * | ||
32 | * This driver exports either the original ARM LED API, the new generic | ||
33 | * one, or both. | ||
34 | */ | ||
35 | |||
36 | static spinlock_t lock; | ||
37 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
38 | static u16 led_state, hw_led_state; | ||
39 | |||
40 | |||
41 | #ifdef CONFIG_OMAP_DEBUG_LEDS | ||
42 | #define new_led_api() 1 | ||
43 | #else | ||
44 | #define new_led_api() 0 | ||
45 | #endif | ||
46 | |||
47 | |||
48 | /*-------------------------------------------------------------------------*/ | ||
49 | |||
50 | /* original ARM debug LED API: | ||
51 | * - timer and idle leds (some boards use non-FPGA leds here); | ||
52 | * - up to 4 generic leds, easily accessed in-kernel (any context) | ||
53 | */ | 28 | */ |
54 | 29 | ||
55 | #define GPIO_LED_RED 3 | 30 | static struct h2p2_dbg_fpga __iomem *fpga; |
56 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
57 | |||
58 | #define LED_STATE_ENABLED 0x01 | ||
59 | #define LED_STATE_CLAIMED 0x02 | ||
60 | #define LED_TIMER_ON 0x04 | ||
61 | |||
62 | #define GPIO_IDLE GPIO_LED_GREEN | ||
63 | #define GPIO_TIMER GPIO_LED_RED | ||
64 | |||
65 | static void h2p2_dbg_leds_event(led_event_t evt) | ||
66 | { | ||
67 | unsigned long flags; | ||
68 | |||
69 | spin_lock_irqsave(&lock, flags); | ||
70 | |||
71 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
72 | goto done; | ||
73 | |||
74 | switch (evt) { | ||
75 | case led_start: | ||
76 | if (fpga) | ||
77 | led_state |= LED_STATE_ENABLED; | ||
78 | break; | ||
79 | |||
80 | case led_stop: | ||
81 | case led_halted: | ||
82 | /* all leds off during suspend or shutdown */ | ||
83 | |||
84 | if (!(machine_is_omap_perseus2() || machine_is_omap_h4())) { | ||
85 | gpio_set_value(GPIO_TIMER, 0); | ||
86 | gpio_set_value(GPIO_IDLE, 0); | ||
87 | } | ||
88 | |||
89 | __raw_writew(~0, &fpga->leds); | ||
90 | led_state &= ~LED_STATE_ENABLED; | ||
91 | goto done; | ||
92 | |||
93 | case led_claim: | ||
94 | led_state |= LED_STATE_CLAIMED; | ||
95 | hw_led_state = 0; | ||
96 | break; | ||
97 | |||
98 | case led_release: | ||
99 | led_state &= ~LED_STATE_CLAIMED; | ||
100 | break; | ||
101 | |||
102 | #ifdef CONFIG_LEDS_TIMER | ||
103 | case led_timer: | ||
104 | led_state ^= LED_TIMER_ON; | ||
105 | |||
106 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
107 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
108 | else { | ||
109 | gpio_set_value(GPIO_TIMER, | ||
110 | led_state & LED_TIMER_ON); | ||
111 | goto done; | ||
112 | } | ||
113 | |||
114 | break; | ||
115 | #endif | ||
116 | |||
117 | #ifdef CONFIG_LEDS_CPU | ||
118 | /* LED lit iff busy */ | ||
119 | case led_idle_start: | ||
120 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
121 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
122 | else { | ||
123 | gpio_set_value(GPIO_IDLE, 1); | ||
124 | goto done; | ||
125 | } | ||
126 | |||
127 | break; | ||
128 | 31 | ||
129 | case led_idle_end: | 32 | static u16 fpga_led_state; |
130 | if (machine_is_omap_perseus2() || machine_is_omap_h4()) | ||
131 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
132 | else { | ||
133 | gpio_set_value(GPIO_IDLE, 0); | ||
134 | goto done; | ||
135 | } | ||
136 | |||
137 | break; | ||
138 | #endif | ||
139 | |||
140 | case led_green_on: | ||
141 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
142 | break; | ||
143 | case led_green_off: | ||
144 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
145 | break; | ||
146 | |||
147 | case led_amber_on: | ||
148 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
149 | break; | ||
150 | case led_amber_off: | ||
151 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
152 | break; | ||
153 | |||
154 | case led_red_on: | ||
155 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
156 | break; | ||
157 | case led_red_off: | ||
158 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
159 | break; | ||
160 | |||
161 | case led_blue_on: | ||
162 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
163 | break; | ||
164 | case led_blue_off: | ||
165 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
166 | break; | ||
167 | |||
168 | default: | ||
169 | break; | ||
170 | } | ||
171 | |||
172 | |||
173 | /* | ||
174 | * Actually burn the LEDs | ||
175 | */ | ||
176 | if (led_state & LED_STATE_ENABLED) | ||
177 | __raw_writew(~hw_led_state, &fpga->leds); | ||
178 | |||
179 | done: | ||
180 | spin_unlock_irqrestore(&lock, flags); | ||
181 | } | ||
182 | |||
183 | /*-------------------------------------------------------------------------*/ | ||
184 | |||
185 | /* "new" LED API | ||
186 | * - with syfs access and generic triggering | ||
187 | * - not readily accessible to in-kernel drivers | ||
188 | */ | ||
189 | 33 | ||
190 | struct dbg_led { | 34 | struct dbg_led { |
191 | struct led_classdev cdev; | 35 | struct led_classdev cdev; |
192 | u16 mask; | 36 | u16 mask; |
193 | }; | 37 | }; |
194 | 38 | ||
195 | static struct dbg_led dbg_leds[] = { | 39 | static const struct { |
196 | /* REVISIT at least H2 uses different timer & cpu leds... */ | 40 | const char *name; |
197 | #ifndef CONFIG_LEDS_TIMER | 41 | const char *trigger; |
198 | { .mask = 1 << 0, .cdev.name = "d4:green", | 42 | } dbg_leds[] = { |
199 | .cdev.default_trigger = "heartbeat", }, | 43 | { "dbg:d4", "heartbeat", }, |
200 | #endif | 44 | { "dbg:d5", "cpu0", }, |
201 | #ifndef CONFIG_LEDS_CPU | 45 | { "dbg:d6", "default-on", }, |
202 | { .mask = 1 << 1, .cdev.name = "d5:green", }, /* !idle */ | 46 | { "dbg:d7", }, |
203 | #endif | 47 | { "dbg:d8", }, |
204 | { .mask = 1 << 2, .cdev.name = "d6:green", }, | 48 | { "dbg:d9", }, |
205 | { .mask = 1 << 3, .cdev.name = "d7:green", }, | 49 | { "dbg:d10", }, |
206 | 50 | { "dbg:d11", }, | |
207 | { .mask = 1 << 4, .cdev.name = "d8:green", }, | 51 | { "dbg:d12", }, |
208 | { .mask = 1 << 5, .cdev.name = "d9:green", }, | 52 | { "dbg:d13", }, |
209 | { .mask = 1 << 6, .cdev.name = "d10:green", }, | 53 | { "dbg:d14", }, |
210 | { .mask = 1 << 7, .cdev.name = "d11:green", }, | 54 | { "dbg:d15", }, |
211 | 55 | { "dbg:d16", }, | |
212 | { .mask = 1 << 8, .cdev.name = "d12:green", }, | 56 | { "dbg:d17", }, |
213 | { .mask = 1 << 9, .cdev.name = "d13:green", }, | 57 | { "dbg:d18", }, |
214 | { .mask = 1 << 10, .cdev.name = "d14:green", }, | 58 | { "dbg:d19", }, |
215 | { .mask = 1 << 11, .cdev.name = "d15:green", }, | ||
216 | |||
217 | #ifndef CONFIG_LEDS | ||
218 | { .mask = 1 << 12, .cdev.name = "d16:green", }, | ||
219 | { .mask = 1 << 13, .cdev.name = "d17:green", }, | ||
220 | { .mask = 1 << 14, .cdev.name = "d18:green", }, | ||
221 | { .mask = 1 << 15, .cdev.name = "d19:green", }, | ||
222 | #endif | ||
223 | }; | 59 | }; |
224 | 60 | ||
225 | static void | 61 | /* |
226 | fpga_led_set(struct led_classdev *cdev, enum led_brightness value) | 62 | * The triggers lines up below will only be used if the |
63 | * LED triggers are compiled in. | ||
64 | */ | ||
65 | static void dbg_led_set(struct led_classdev *cdev, | ||
66 | enum led_brightness b) | ||
227 | { | 67 | { |
228 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); | 68 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
229 | unsigned long flags; | 69 | u16 reg; |
230 | 70 | ||
231 | spin_lock_irqsave(&lock, flags); | 71 | reg = __raw_readw(&fpga->leds); |
232 | if (value == LED_OFF) | 72 | if (b != LED_OFF) |
233 | hw_led_state &= ~led->mask; | 73 | reg |= led->mask; |
234 | else | 74 | else |
235 | hw_led_state |= led->mask; | 75 | reg &= ~led->mask; |
236 | __raw_writew(~hw_led_state, &fpga->leds); | 76 | __raw_writew(reg, &fpga->leds); |
237 | spin_unlock_irqrestore(&lock, flags); | ||
238 | } | 77 | } |
239 | 78 | ||
240 | static void __init newled_init(struct device *dev) | 79 | static enum led_brightness dbg_led_get(struct led_classdev *cdev) |
241 | { | 80 | { |
242 | unsigned i; | 81 | struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); |
243 | struct dbg_led *led; | 82 | u16 reg; |
244 | int status; | ||
245 | 83 | ||
246 | for (i = 0, led = dbg_leds; i < ARRAY_SIZE(dbg_leds); i++, led++) { | 84 | reg = __raw_readw(&fpga->leds); |
247 | led->cdev.brightness_set = fpga_led_set; | 85 | return (reg & led->mask) ? LED_FULL : LED_OFF; |
248 | status = led_classdev_register(dev, &led->cdev); | ||
249 | if (status < 0) | ||
250 | break; | ||
251 | } | ||
252 | return; | ||
253 | } | 86 | } |
254 | 87 | ||
255 | 88 | static int fpga_probe(struct platform_device *pdev) | |
256 | /*-------------------------------------------------------------------------*/ | ||
257 | |||
258 | static int /* __init */ fpga_probe(struct platform_device *pdev) | ||
259 | { | 89 | { |
260 | struct resource *iomem; | 90 | struct resource *iomem; |
261 | 91 | int i; | |
262 | spin_lock_init(&lock); | ||
263 | 92 | ||
264 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 93 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
265 | if (!iomem) | 94 | if (!iomem) |
266 | return -ENODEV; | 95 | return -ENODEV; |
267 | 96 | ||
268 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); | 97 | fpga = ioremap(iomem->start, H2P2_DBG_FPGA_SIZE); |
269 | __raw_writew(~0, &fpga->leds); | 98 | __raw_writew(0xff, &fpga->leds); |
99 | |||
100 | for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { | ||
101 | struct dbg_led *led; | ||
102 | |||
103 | led = kzalloc(sizeof(*led), GFP_KERNEL); | ||
104 | if (!led) | ||
105 | break; | ||
270 | 106 | ||
271 | #ifdef CONFIG_LEDS | 107 | led->cdev.name = dbg_leds[i].name; |
272 | leds_event = h2p2_dbg_leds_event; | 108 | led->cdev.brightness_set = dbg_led_set; |
273 | leds_event(led_start); | 109 | led->cdev.brightness_get = dbg_led_get; |
274 | #endif | 110 | led->cdev.default_trigger = dbg_leds[i].trigger; |
111 | led->mask = BIT(i); | ||
275 | 112 | ||
276 | if (new_led_api()) { | 113 | if (led_classdev_register(NULL, &led->cdev) < 0) { |
277 | newled_init(&pdev->dev); | 114 | kfree(led); |
115 | break; | ||
116 | } | ||
278 | } | 117 | } |
279 | 118 | ||
280 | return 0; | 119 | return 0; |
@@ -282,13 +121,15 @@ static int /* __init */ fpga_probe(struct platform_device *pdev) | |||
282 | 121 | ||
283 | static int fpga_suspend_noirq(struct device *dev) | 122 | static int fpga_suspend_noirq(struct device *dev) |
284 | { | 123 | { |
285 | __raw_writew(~0, &fpga->leds); | 124 | fpga_led_state = __raw_readw(&fpga->leds); |
125 | __raw_writew(0xff, &fpga->leds); | ||
126 | |||
286 | return 0; | 127 | return 0; |
287 | } | 128 | } |
288 | 129 | ||
289 | static int fpga_resume_noirq(struct device *dev) | 130 | static int fpga_resume_noirq(struct device *dev) |
290 | { | 131 | { |
291 | __raw_writew(~hw_led_state, &fpga->leds); | 132 | __raw_writew(~fpga_led_state, &fpga->leds); |
292 | return 0; | 133 | return 0; |
293 | } | 134 | } |
294 | 135 | ||
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h index b2eac60b6904..f4a4cd014795 100644 --- a/arch/arm/plat-omap/include/plat/omap-serial.h +++ b/arch/arm/plat-omap/include/plat/omap-serial.h | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | #define OMAP_UART_DMA_CH_FREE -1 | 53 | #define OMAP_UART_DMA_CH_FREE -1 |
54 | 54 | ||
55 | #define OMAP_MAX_HSUART_PORTS 4 | 55 | #define OMAP_MAX_HSUART_PORTS 6 |
56 | 56 | ||
57 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA | 57 | #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA |
58 | 58 | ||
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index bd20588c356b..87ee140fefaa 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #define __ASM_ARCH_OMAP_USB_H | 4 | #define __ASM_ARCH_OMAP_USB_H |
5 | 5 | ||
6 | #include <linux/io.h> | 6 | #include <linux/io.h> |
7 | #include <linux/platform_device.h> | ||
7 | #include <linux/usb/musb.h> | 8 | #include <linux/usb/musb.h> |
8 | 9 | ||
9 | #define OMAP3_HS_USB_PORTS 3 | 10 | #define OMAP3_HS_USB_PORTS 3 |
@@ -63,6 +64,10 @@ struct usbhs_omap_platform_data { | |||
63 | struct ehci_hcd_omap_platform_data *ehci_data; | 64 | struct ehci_hcd_omap_platform_data *ehci_data; |
64 | struct ohci_hcd_omap_platform_data *ohci_data; | 65 | struct ohci_hcd_omap_platform_data *ohci_data; |
65 | }; | 66 | }; |
67 | |||
68 | struct usbtll_omap_platform_data { | ||
69 | enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS]; | ||
70 | }; | ||
66 | /*-------------------------------------------------------------------------*/ | 71 | /*-------------------------------------------------------------------------*/ |
67 | 72 | ||
68 | struct omap_musb_board_data { | 73 | struct omap_musb_board_data { |
@@ -81,6 +86,8 @@ enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; | |||
81 | extern void usb_musb_init(struct omap_musb_board_data *board_data); | 86 | extern void usb_musb_init(struct omap_musb_board_data *board_data); |
82 | 87 | ||
83 | extern void usbhs_init(const struct usbhs_omap_board_data *pdata); | 88 | extern void usbhs_init(const struct usbhs_omap_board_data *pdata); |
89 | extern int omap_tll_enable(void); | ||
90 | extern int omap_tll_disable(void); | ||
84 | 91 | ||
85 | extern int omap4430_phy_power(struct device *dev, int ID, int on); | 92 | extern int omap4430_phy_power(struct device *dev, int ID, int on); |
86 | extern int omap4430_phy_set_clk(struct device *dev, int on); | 93 | extern int omap4430_phy_set_clk(struct device *dev, int on); |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 5e13c3884aa4..42377ef9ea3d 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -310,7 +310,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox) | |||
310 | omap_mbox_disable_irq(mbox, IRQ_RX); | 310 | omap_mbox_disable_irq(mbox, IRQ_RX); |
311 | free_irq(mbox->irq, mbox); | 311 | free_irq(mbox->irq, mbox); |
312 | tasklet_kill(&mbox->txq->tasklet); | 312 | tasklet_kill(&mbox->txq->tasklet); |
313 | flush_work_sync(&mbox->rxq->work); | 313 | flush_work(&mbox->rxq->work); |
314 | mbox_queue_free(mbox->txq); | 314 | mbox_queue_free(mbox->txq); |
315 | mbox_queue_free(mbox->rxq); | 315 | mbox_queue_free(mbox->rxq); |
316 | } | 316 | } |
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index 65c5eca475e7..012bbd0b8d81 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -119,7 +119,7 @@ void clk_disable(struct clk *clk) | |||
119 | 119 | ||
120 | unsigned long clk_get_rate(struct clk *clk) | 120 | unsigned long clk_get_rate(struct clk *clk) |
121 | { | 121 | { |
122 | if (IS_ERR(clk)) | 122 | if (IS_ERR_OR_NULL(clk)) |
123 | return 0; | 123 | return 0; |
124 | 124 | ||
125 | if (clk->rate != 0) | 125 | if (clk->rate != 0) |
@@ -136,7 +136,7 @@ unsigned long clk_get_rate(struct clk *clk) | |||
136 | 136 | ||
137 | long clk_round_rate(struct clk *clk, unsigned long rate) | 137 | long clk_round_rate(struct clk *clk, unsigned long rate) |
138 | { | 138 | { |
139 | if (!IS_ERR(clk) && clk->ops && clk->ops->round_rate) | 139 | if (!IS_ERR_OR_NULL(clk) && clk->ops && clk->ops->round_rate) |
140 | return (clk->ops->round_rate)(clk, rate); | 140 | return (clk->ops->round_rate)(clk, rate); |
141 | 141 | ||
142 | return rate; | 142 | return rate; |
@@ -144,9 +144,10 @@ long clk_round_rate(struct clk *clk, unsigned long rate) | |||
144 | 144 | ||
145 | int clk_set_rate(struct clk *clk, unsigned long rate) | 145 | int clk_set_rate(struct clk *clk, unsigned long rate) |
146 | { | 146 | { |
147 | unsigned long flags; | ||
147 | int ret; | 148 | int ret; |
148 | 149 | ||
149 | if (IS_ERR(clk)) | 150 | if (IS_ERR_OR_NULL(clk)) |
150 | return -EINVAL; | 151 | return -EINVAL; |
151 | 152 | ||
152 | /* We do not default just do a clk->rate = rate as | 153 | /* We do not default just do a clk->rate = rate as |
@@ -159,9 +160,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
159 | if (clk->ops == NULL || clk->ops->set_rate == NULL) | 160 | if (clk->ops == NULL || clk->ops->set_rate == NULL) |
160 | return -EINVAL; | 161 | return -EINVAL; |
161 | 162 | ||
162 | spin_lock(&clocks_lock); | 163 | spin_lock_irqsave(&clocks_lock, flags); |
163 | ret = (clk->ops->set_rate)(clk, rate); | 164 | ret = (clk->ops->set_rate)(clk, rate); |
164 | spin_unlock(&clocks_lock); | 165 | spin_unlock_irqrestore(&clocks_lock, flags); |
165 | 166 | ||
166 | return ret; | 167 | return ret; |
167 | } | 168 | } |
@@ -173,17 +174,18 @@ struct clk *clk_get_parent(struct clk *clk) | |||
173 | 174 | ||
174 | int clk_set_parent(struct clk *clk, struct clk *parent) | 175 | int clk_set_parent(struct clk *clk, struct clk *parent) |
175 | { | 176 | { |
177 | unsigned long flags; | ||
176 | int ret = 0; | 178 | int ret = 0; |
177 | 179 | ||
178 | if (IS_ERR(clk)) | 180 | if (IS_ERR_OR_NULL(clk) || IS_ERR_OR_NULL(parent)) |
179 | return -EINVAL; | 181 | return -EINVAL; |
180 | 182 | ||
181 | spin_lock(&clocks_lock); | 183 | spin_lock_irqsave(&clocks_lock, flags); |
182 | 184 | ||
183 | if (clk->ops && clk->ops->set_parent) | 185 | if (clk->ops && clk->ops->set_parent) |
184 | ret = (clk->ops->set_parent)(clk, parent); | 186 | ret = (clk->ops->set_parent)(clk, parent); |
185 | 187 | ||
186 | spin_unlock(&clocks_lock); | 188 | spin_unlock_irqrestore(&clocks_lock, flags); |
187 | 189 | ||
188 | return ret; | 190 | return ret; |
189 | } | 191 | } |
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index b151d4932661..03f654d55eff 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/platform_data/usb-ehci-s5p.h> | 51 | #include <linux/platform_data/usb-ehci-s5p.h> |
52 | #include <plat/fb.h> | 52 | #include <plat/fb.h> |
53 | #include <plat/fb-s3c2410.h> | 53 | #include <plat/fb-s3c2410.h> |
54 | #include <plat/hdmi.h> | ||
54 | #include <linux/platform_data/hwmon-s3c.h> | 55 | #include <linux/platform_data/hwmon-s3c.h> |
55 | #include <linux/platform_data/i2c-s3c2410.h> | 56 | #include <linux/platform_data/i2c-s3c2410.h> |
56 | #include <plat/keypad.h> | 57 | #include <plat/keypad.h> |
@@ -762,7 +763,7 @@ void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd) | |||
762 | &s5p_device_i2c_hdmiphy); | 763 | &s5p_device_i2c_hdmiphy); |
763 | } | 764 | } |
764 | 765 | ||
765 | struct s5p_hdmi_platform_data s5p_hdmi_def_platdata; | 766 | static struct s5p_hdmi_platform_data s5p_hdmi_def_platdata; |
766 | 767 | ||
767 | void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info, | 768 | void __init s5p_hdmi_set_platdata(struct i2c_board_info *hdmiphy_info, |
768 | struct i2c_board_info *mhl_info, int mhl_bus) | 769 | struct i2c_board_info *mhl_info, int mhl_bus) |
@@ -1590,6 +1591,8 @@ struct platform_device s3c64xx_device_spi1 = { | |||
1590 | void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, | 1591 | void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
1591 | int num_cs) | 1592 | int num_cs) |
1592 | { | 1593 | { |
1594 | struct s3c64xx_spi_info pd; | ||
1595 | |||
1593 | /* Reject invalid configuration */ | 1596 | /* Reject invalid configuration */ |
1594 | if (!num_cs || src_clk_nr < 0) { | 1597 | if (!num_cs || src_clk_nr < 0) { |
1595 | pr_err("%s: Invalid SPI configuration\n", __func__); | 1598 | pr_err("%s: Invalid SPI configuration\n", __func__); |
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c index 4dcb11c3d894..60552e22f22e 100644 --- a/arch/arm/plat-samsung/time.c +++ b/arch/arm/plat-samsung/time.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | 30 | ||
31 | #include <asm/leds.h> | ||
32 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
33 | 32 | ||
34 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig index 8d5c10a5084d..2a4ae8a6a081 100644 --- a/arch/arm/plat-versatile/Kconfig +++ b/arch/arm/plat-versatile/Kconfig | |||
@@ -16,8 +16,10 @@ config PLAT_VERSATILE_FPGA_IRQ_NR | |||
16 | depends on PLAT_VERSATILE_FPGA_IRQ | 16 | depends on PLAT_VERSATILE_FPGA_IRQ |
17 | 17 | ||
18 | config PLAT_VERSATILE_LEDS | 18 | config PLAT_VERSATILE_LEDS |
19 | def_bool y if LEDS_CLASS | 19 | def_bool y if NEW_LEDS |
20 | depends on ARCH_REALVIEW || ARCH_VERSATILE | 20 | depends on ARCH_REALVIEW || ARCH_VERSATILE |
21 | select LEDS_CLASS | ||
22 | select LEDS_TRIGGER | ||
21 | 23 | ||
22 | config PLAT_VERSATILE_SCHED_CLOCK | 24 | config PLAT_VERSATILE_SCHED_CLOCK |
23 | def_bool y | 25 | def_bool y |
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c index 3169fa555ea6..d2490d00b46c 100644 --- a/arch/arm/plat-versatile/leds.c +++ b/arch/arm/plat-versatile/leds.c | |||
@@ -37,10 +37,10 @@ static const struct { | |||
37 | } versatile_leds[] = { | 37 | } versatile_leds[] = { |
38 | { "versatile:0", "heartbeat", }, | 38 | { "versatile:0", "heartbeat", }, |
39 | { "versatile:1", "mmc0", }, | 39 | { "versatile:1", "mmc0", }, |
40 | { "versatile:2", }, | 40 | { "versatile:2", "cpu0" }, |
41 | { "versatile:3", }, | 41 | { "versatile:3", "cpu1" }, |
42 | { "versatile:4", }, | 42 | { "versatile:4", "cpu2" }, |
43 | { "versatile:5", }, | 43 | { "versatile:5", "cpu3" }, |
44 | { "versatile:6", }, | 44 | { "versatile:6", }, |
45 | { "versatile:7", }, | 45 | { "versatile:7", }, |
46 | }; | 46 | }; |
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types index 7bc7948c5432..831e1fdfdb2f 100644 --- a/arch/arm/tools/mach-types +++ b/arch/arm/tools/mach-types | |||
@@ -66,7 +66,6 @@ iq80321 ARCH_IQ80321 IQ80321 169 | |||
66 | ks8695 ARCH_KS8695 KS8695 180 | 66 | ks8695 ARCH_KS8695 KS8695 180 |
67 | karo ARCH_KARO KARO 190 | 67 | karo ARCH_KARO KARO 190 |
68 | smdk2410 ARCH_SMDK2410 SMDK2410 193 | 68 | smdk2410 ARCH_SMDK2410 SMDK2410 193 |
69 | ceiva ARCH_CEIVA CEIVA 200 | ||
70 | voiceblue MACH_VOICEBLUE VOICEBLUE 218 | 69 | voiceblue MACH_VOICEBLUE VOICEBLUE 218 |
71 | h5400 ARCH_H5400 H5400 220 | 70 | h5400 ARCH_H5400 H5400 220 |
72 | omap_innovator MACH_OMAP_INNOVATOR OMAP_INNOVATOR 234 | 71 | omap_innovator MACH_OMAP_INNOVATOR OMAP_INNOVATOR 234 |
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile new file mode 100644 index 000000000000..43841033afd3 --- /dev/null +++ b/arch/arm/xen/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-y := enlighten.o hypercall.o grant-table.o | |||
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c new file mode 100644 index 000000000000..59bcb96ac369 --- /dev/null +++ b/arch/arm/xen/enlighten.c | |||
@@ -0,0 +1,168 @@ | |||
1 | #include <xen/xen.h> | ||
2 | #include <xen/events.h> | ||
3 | #include <xen/grant_table.h> | ||
4 | #include <xen/hvm.h> | ||
5 | #include <xen/interface/xen.h> | ||
6 | #include <xen/interface/memory.h> | ||
7 | #include <xen/interface/hvm/params.h> | ||
8 | #include <xen/features.h> | ||
9 | #include <xen/platform_pci.h> | ||
10 | #include <xen/xenbus.h> | ||
11 | #include <asm/xen/hypervisor.h> | ||
12 | #include <asm/xen/hypercall.h> | ||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/irqreturn.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_irq.h> | ||
18 | #include <linux/of_address.h> | ||
19 | |||
20 | struct start_info _xen_start_info; | ||
21 | struct start_info *xen_start_info = &_xen_start_info; | ||
22 | EXPORT_SYMBOL_GPL(xen_start_info); | ||
23 | |||
24 | enum xen_domain_type xen_domain_type = XEN_NATIVE; | ||
25 | EXPORT_SYMBOL_GPL(xen_domain_type); | ||
26 | |||
27 | struct shared_info xen_dummy_shared_info; | ||
28 | struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info; | ||
29 | |||
30 | DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); | ||
31 | |||
32 | /* TODO: to be removed */ | ||
33 | __read_mostly int xen_have_vector_callback; | ||
34 | EXPORT_SYMBOL_GPL(xen_have_vector_callback); | ||
35 | |||
36 | int xen_platform_pci_unplug = XEN_UNPLUG_ALL; | ||
37 | EXPORT_SYMBOL_GPL(xen_platform_pci_unplug); | ||
38 | |||
39 | static __read_mostly int xen_events_irq = -1; | ||
40 | |||
41 | int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | ||
42 | unsigned long addr, | ||
43 | unsigned long mfn, int nr, | ||
44 | pgprot_t prot, unsigned domid) | ||
45 | { | ||
46 | return -ENOSYS; | ||
47 | } | ||
48 | EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); | ||
49 | |||
50 | /* | ||
51 | * see Documentation/devicetree/bindings/arm/xen.txt for the | ||
52 | * documentation of the Xen Device Tree format. | ||
53 | */ | ||
54 | #define GRANT_TABLE_PHYSADDR 0 | ||
55 | static int __init xen_guest_init(void) | ||
56 | { | ||
57 | struct xen_add_to_physmap xatp; | ||
58 | static struct shared_info *shared_info_page = 0; | ||
59 | struct device_node *node; | ||
60 | int len; | ||
61 | const char *s = NULL; | ||
62 | const char *version = NULL; | ||
63 | const char *xen_prefix = "xen,xen-"; | ||
64 | struct resource res; | ||
65 | |||
66 | node = of_find_compatible_node(NULL, NULL, "xen,xen"); | ||
67 | if (!node) { | ||
68 | pr_debug("No Xen support\n"); | ||
69 | return 0; | ||
70 | } | ||
71 | s = of_get_property(node, "compatible", &len); | ||
72 | if (strlen(xen_prefix) + 3 < len && | ||
73 | !strncmp(xen_prefix, s, strlen(xen_prefix))) | ||
74 | version = s + strlen(xen_prefix); | ||
75 | if (version == NULL) { | ||
76 | pr_debug("Xen version not found\n"); | ||
77 | return 0; | ||
78 | } | ||
79 | if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res)) | ||
80 | return 0; | ||
81 | xen_hvm_resume_frames = res.start >> PAGE_SHIFT; | ||
82 | xen_events_irq = irq_of_parse_and_map(node, 0); | ||
83 | pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n", | ||
84 | version, xen_events_irq, xen_hvm_resume_frames); | ||
85 | xen_domain_type = XEN_HVM_DOMAIN; | ||
86 | |||
87 | xen_setup_features(); | ||
88 | if (xen_feature(XENFEAT_dom0)) | ||
89 | xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; | ||
90 | else | ||
91 | xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED); | ||
92 | |||
93 | if (!shared_info_page) | ||
94 | shared_info_page = (struct shared_info *) | ||
95 | get_zeroed_page(GFP_KERNEL); | ||
96 | if (!shared_info_page) { | ||
97 | pr_err("not enough memory\n"); | ||
98 | return -ENOMEM; | ||
99 | } | ||
100 | xatp.domid = DOMID_SELF; | ||
101 | xatp.idx = 0; | ||
102 | xatp.space = XENMAPSPACE_shared_info; | ||
103 | xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT; | ||
104 | if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) | ||
105 | BUG(); | ||
106 | |||
107 | HYPERVISOR_shared_info = (struct shared_info *)shared_info_page; | ||
108 | |||
109 | /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info | ||
110 | * page, we use it in the event channel upcall and in some pvclock | ||
111 | * related functions. We don't need the vcpu_info placement | ||
112 | * optimizations because we don't use any pv_mmu or pv_irq op on | ||
113 | * HVM. | ||
114 | * The shared info contains exactly 1 CPU (the boot CPU). The guest | ||
115 | * is required to use VCPUOP_register_vcpu_info to place vcpu info | ||
116 | * for secondary CPUs as they are brought up. */ | ||
117 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | ||
118 | |||
119 | gnttab_init(); | ||
120 | if (!xen_initial_domain()) | ||
121 | xenbus_probe(NULL); | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | core_initcall(xen_guest_init); | ||
126 | |||
127 | static irqreturn_t xen_arm_callback(int irq, void *arg) | ||
128 | { | ||
129 | xen_hvm_evtchn_do_upcall(); | ||
130 | return IRQ_HANDLED; | ||
131 | } | ||
132 | |||
133 | static int __init xen_init_events(void) | ||
134 | { | ||
135 | if (!xen_domain() || xen_events_irq < 0) | ||
136 | return -ENODEV; | ||
137 | |||
138 | xen_init_IRQ(); | ||
139 | |||
140 | if (request_percpu_irq(xen_events_irq, xen_arm_callback, | ||
141 | "events", xen_vcpu)) { | ||
142 | pr_err("Error requesting IRQ %d\n", xen_events_irq); | ||
143 | return -EINVAL; | ||
144 | } | ||
145 | |||
146 | enable_percpu_irq(xen_events_irq, 0); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | postcore_initcall(xen_init_events); | ||
151 | |||
152 | /* XXX: only until balloon is properly working */ | ||
153 | int alloc_xenballooned_pages(int nr_pages, struct page **pages, bool highmem) | ||
154 | { | ||
155 | *pages = alloc_pages(highmem ? GFP_HIGHUSER : GFP_KERNEL, | ||
156 | get_order(nr_pages)); | ||
157 | if (*pages == NULL) | ||
158 | return -ENOMEM; | ||
159 | return 0; | ||
160 | } | ||
161 | EXPORT_SYMBOL_GPL(alloc_xenballooned_pages); | ||
162 | |||
163 | void free_xenballooned_pages(int nr_pages, struct page **pages) | ||
164 | { | ||
165 | kfree(*pages); | ||
166 | *pages = NULL; | ||
167 | } | ||
168 | EXPORT_SYMBOL_GPL(free_xenballooned_pages); | ||
diff --git a/arch/arm/xen/grant-table.c b/arch/arm/xen/grant-table.c new file mode 100644 index 000000000000..dbd1330c0196 --- /dev/null +++ b/arch/arm/xen/grant-table.c | |||
@@ -0,0 +1,53 @@ | |||
1 | /****************************************************************************** | ||
2 | * grant_table.c | ||
3 | * ARM specific part | ||
4 | * | ||
5 | * Granting foreign access to our memory reservation. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version 2 | ||
9 | * as published by the Free Software Foundation; or, when distributed | ||
10 | * separately from the Linux kernel or incorporated into other | ||
11 | * software packages, subject to the following license: | ||
12 | * | ||
13 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
14 | * of this source file (the "Software"), to deal in the Software without | ||
15 | * restriction, including without limitation the rights to use, copy, modify, | ||
16 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
17 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
18 | * the following conditions: | ||
19 | * | ||
20 | * The above copyright notice and this permission notice shall be included in | ||
21 | * all copies or substantial portions of the Software. | ||
22 | * | ||
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
29 | * IN THE SOFTWARE. | ||
30 | */ | ||
31 | |||
32 | #include <xen/interface/xen.h> | ||
33 | #include <xen/page.h> | ||
34 | #include <xen/grant_table.h> | ||
35 | |||
36 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | ||
37 | unsigned long max_nr_gframes, | ||
38 | void **__shared) | ||
39 | { | ||
40 | return -ENOSYS; | ||
41 | } | ||
42 | |||
43 | void arch_gnttab_unmap(void *shared, unsigned long nr_gframes) | ||
44 | { | ||
45 | return; | ||
46 | } | ||
47 | |||
48 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, | ||
49 | unsigned long max_nr_gframes, | ||
50 | grant_status_t **__shared) | ||
51 | { | ||
52 | return -ENOSYS; | ||
53 | } | ||
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S new file mode 100644 index 000000000000..074f5ed101b9 --- /dev/null +++ b/arch/arm/xen/hypercall.S | |||
@@ -0,0 +1,106 @@ | |||
1 | /****************************************************************************** | ||
2 | * hypercall.S | ||
3 | * | ||
4 | * Xen hypercall wrappers | ||
5 | * | ||
6 | * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation; or, when distributed | ||
11 | * separately from the Linux kernel or incorporated into other | ||
12 | * software packages, subject to the following license: | ||
13 | * | ||
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
15 | * of this source file (the "Software"), to deal in the Software without | ||
16 | * restriction, including without limitation the rights to use, copy, modify, | ||
17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
18 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
19 | * the following conditions: | ||
20 | * | ||
21 | * The above copyright notice and this permission notice shall be included in | ||
22 | * all copies or substantial portions of the Software. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
30 | * IN THE SOFTWARE. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * The Xen hypercall calling convention is very similar to the ARM | ||
35 | * procedure calling convention: the first paramter is passed in r0, the | ||
36 | * second in r1, the third in r2 and the fourth in r3. Considering that | ||
37 | * Xen hypercalls have 5 arguments at most, the fifth paramter is passed | ||
38 | * in r4, differently from the procedure calling convention of using the | ||
39 | * stack for that case. | ||
40 | * | ||
41 | * The hypercall number is passed in r12. | ||
42 | * | ||
43 | * The return value is in r0. | ||
44 | * | ||
45 | * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM | ||
46 | * hypercall tag. | ||
47 | */ | ||
48 | |||
49 | #include <linux/linkage.h> | ||
50 | #include <asm/assembler.h> | ||
51 | #include <xen/interface/xen.h> | ||
52 | |||
53 | |||
54 | /* HVC 0xEA1 */ | ||
55 | #ifdef CONFIG_THUMB2_KERNEL | ||
56 | #define xen_hvc .word 0xf7e08ea1 | ||
57 | #else | ||
58 | #define xen_hvc .word 0xe140ea71 | ||
59 | #endif | ||
60 | |||
61 | #define HYPERCALL_SIMPLE(hypercall) \ | ||
62 | ENTRY(HYPERVISOR_##hypercall) \ | ||
63 | mov r12, #__HYPERVISOR_##hypercall; \ | ||
64 | xen_hvc; \ | ||
65 | mov pc, lr; \ | ||
66 | ENDPROC(HYPERVISOR_##hypercall) | ||
67 | |||
68 | #define HYPERCALL0 HYPERCALL_SIMPLE | ||
69 | #define HYPERCALL1 HYPERCALL_SIMPLE | ||
70 | #define HYPERCALL2 HYPERCALL_SIMPLE | ||
71 | #define HYPERCALL3 HYPERCALL_SIMPLE | ||
72 | #define HYPERCALL4 HYPERCALL_SIMPLE | ||
73 | |||
74 | #define HYPERCALL5(hypercall) \ | ||
75 | ENTRY(HYPERVISOR_##hypercall) \ | ||
76 | stmdb sp!, {r4} \ | ||
77 | ldr r4, [sp, #4] \ | ||
78 | mov r12, #__HYPERVISOR_##hypercall; \ | ||
79 | xen_hvc \ | ||
80 | ldm sp!, {r4} \ | ||
81 | mov pc, lr \ | ||
82 | ENDPROC(HYPERVISOR_##hypercall) | ||
83 | |||
84 | .text | ||
85 | |||
86 | HYPERCALL2(xen_version); | ||
87 | HYPERCALL3(console_io); | ||
88 | HYPERCALL3(grant_table_op); | ||
89 | HYPERCALL2(sched_op); | ||
90 | HYPERCALL2(event_channel_op); | ||
91 | HYPERCALL2(hvm_op); | ||
92 | HYPERCALL2(memory_op); | ||
93 | HYPERCALL2(physdev_op); | ||
94 | |||
95 | ENTRY(privcmd_call) | ||
96 | stmdb sp!, {r4} | ||
97 | mov r12, r0 | ||
98 | mov r0, r1 | ||
99 | mov r1, r2 | ||
100 | mov r2, r3 | ||
101 | ldr r3, [sp, #8] | ||
102 | ldr r4, [sp, #4] | ||
103 | xen_hvc | ||
104 | ldm sp!, {r4} | ||
105 | mov pc, lr | ||
106 | ENDPROC(privcmd_call); | ||