diff options
author | Olof Johansson <olof@lixom.net> | 2012-10-01 17:33:55 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-10-01 17:33:55 -0400 |
commit | 8b1a13b02812b60b88920801363920956691feb3 (patch) | |
tree | cf140e1dfd5754aef0a59003cf9266aad003b8f5 | |
parent | 5c008d7029fcd12a9a54fa618781b71353f6c4bd (diff) | |
parent | 04ef037c926ddb31088c976538e29eada4fd1490 (diff) |
Merge branch 'next/drivers' into HEAD
Conflicts:
arch/arm/boot/dts/omap4.dtsi
arch/arm/mach-clps711x/common.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/leds-h2p2-debug.c
arch/arm/mach-omap1/leds.c
arch/arm/mach-pnx4008/time.c
arch/arm/plat-omap/debug-leds.c
drivers/Makefile
drivers/bus/omap_l3_noc.c
162 files changed, 4908 insertions, 3542 deletions
diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt new file mode 100644 index 000000000000..d2fe064a828b --- /dev/null +++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt | |||
@@ -0,0 +1,10 @@ | |||
1 | * OMAP OCP2SCP - ocp interface to scp interface | ||
2 | |||
3 | properties: | ||
4 | - compatible : Should be "ti,omap-ocp2scp" | ||
5 | - #address-cells, #size-cells : Must be present if the device has sub-nodes | ||
6 | - ranges : the child address space are mapped 1:1 onto the parent address space | ||
7 | - ti,hwmods : must be "ocp2scp_usb_phy" | ||
8 | |||
9 | Sub-nodes: | ||
10 | All the devices connected to ocp2scp are described using sub-node to ocp2scp | ||
diff --git a/Documentation/devicetree/bindings/media/exynos5-gsc.txt b/Documentation/devicetree/bindings/media/exynos5-gsc.txt new file mode 100644 index 000000000000..0604d42f38d1 --- /dev/null +++ b/Documentation/devicetree/bindings/media/exynos5-gsc.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * Samsung Exynos5 G-Scaler device | ||
2 | |||
3 | G-Scaler is used for scaling and color space conversion on EXYNOS5 SoCs. | ||
4 | |||
5 | Required properties: | ||
6 | - compatible: should be "samsung,exynos5-gsc" | ||
7 | - reg: should contain G-Scaler physical address location and length. | ||
8 | - interrupts: should contain G-Scaler interrupt number | ||
9 | |||
10 | Example: | ||
11 | |||
12 | gsc_0: gsc@0x13e00000 { | ||
13 | compatible = "samsung,exynos5-gsc"; | ||
14 | reg = <0x13e00000 0x1000>; | ||
15 | interrupts = <0 85 0>; | ||
16 | }; | ||
17 | |||
18 | Aliases: | ||
19 | Each G-Scaler node should have a numbered alias in the aliases node, | ||
20 | in the form of gscN, N = 0...3. G-Scaler driver uses these aliases | ||
21 | to retrieve the device IDs using "of_alias_get_id()" call. | ||
22 | |||
23 | Example: | ||
24 | |||
25 | aliases { | ||
26 | gsc0 =&gsc_0; | ||
27 | gsc1 =&gsc_1; | ||
28 | gsc2 =&gsc_2; | ||
29 | gsc3 =&gsc_3; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt new file mode 100644 index 000000000000..03dee50532f5 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt | |||
@@ -0,0 +1,196 @@ | |||
1 | Samsung GPIO and Pin Mux/Config controller | ||
2 | |||
3 | Samsung's ARM based SoC's integrates a GPIO and Pin mux/config hardware | ||
4 | controller. It controls the input/output settings on the available pads/pins | ||
5 | and also provides ability to multiplex and configure the output of various | ||
6 | on-chip controllers onto these pads. | ||
7 | |||
8 | Required Properties: | ||
9 | - compatible: should be one of the following. | ||
10 | - "samsung,pinctrl-exynos4210": for Exynos4210 compatible pin-controller. | ||
11 | - "samsung,pinctrl-exynos5250": for Exynos5250 compatible pin-controller. | ||
12 | |||
13 | - reg: Base address of the pin controller hardware module and length of | ||
14 | the address space it occupies. | ||
15 | |||
16 | - interrupts: interrupt specifier for the controller. The format and value of | ||
17 | the interrupt specifier depends on the interrupt parent for the controller. | ||
18 | |||
19 | - Pin mux/config groups as child nodes: The pin mux (selecting pin function | ||
20 | mode) and pin config (pull up/down, driver strength) settings are represented | ||
21 | as child nodes of the pin-controller node. There should be atleast one | ||
22 | child node and there is no limit on the count of these child nodes. | ||
23 | |||
24 | The child node should contain a list of pin(s) on which a particular pin | ||
25 | function selection or pin configuration (or both) have to applied. This | ||
26 | list of pins is specified using the property name "samsung,pins". There | ||
27 | should be atleast one pin specfied for this property and there is no upper | ||
28 | limit on the count of pins that can be specified. The pins are specified | ||
29 | using pin names which are derived from the hardware manual of the SoC. As | ||
30 | an example, the pins in GPA0 bank of the pin controller can be represented | ||
31 | as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case. | ||
32 | The format of the pin names should be (as per the hardware manual) | ||
33 | "[pin bank name]-[pin number within the bank]". | ||
34 | |||
35 | The pin function selection that should be applied on the pins listed in the | ||
36 | child node is specified using the "samsung,pin-function" property. The value | ||
37 | of this property that should be applied to each of the pins listed in the | ||
38 | "samsung,pins" property should be picked from the hardware manual of the SoC | ||
39 | for the specified pin group. This property is optional in the child node if | ||
40 | no specific function selection is desired for the pins listed in the child | ||
41 | node. The value of this property is used as-is to program the pin-controller | ||
42 | function selector register of the pin-bank. | ||
43 | |||
44 | The child node can also optionally specify one or more of the pin | ||
45 | configuration that should be applied on all the pins listed in the | ||
46 | "samsung,pins" property of the child node. The following pin configuration | ||
47 | properties are supported. | ||
48 | |||
49 | - samsung,pin-pud: Pull up/down configuration. | ||
50 | - samsung,pin-drv: Drive strength configuration. | ||
51 | - samsung,pin-pud-pdn: Pull up/down configuration in power down mode. | ||
52 | - samsung,pin-drv-pdn: Drive strength configuration in power down mode. | ||
53 | |||
54 | The values specified by these config properties should be derived from the | ||
55 | hardware manual and these values are programmed as-is into the pin | ||
56 | pull up/down and driver strength register of the pin-controller. | ||
57 | |||
58 | Note: A child should include atleast a pin function selection property or | ||
59 | pin configuration property (one or more) or both. | ||
60 | |||
61 | The client nodes that require a particular pin function selection and/or | ||
62 | pin configuration should use the bindings listed in the "pinctrl-bindings.txt" | ||
63 | file. | ||
64 | |||
65 | External GPIO and Wakeup Interrupts: | ||
66 | |||
67 | The controller supports two types of external interrupts over gpio. The first | ||
68 | is the external gpio interrupt and second is the external wakeup interrupts. | ||
69 | The difference between the two is that the external wakeup interrupts can be | ||
70 | used as system wakeup events. | ||
71 | |||
72 | A. External GPIO Interrupts: For supporting external gpio interrupts, the | ||
73 | following properties should be specified in the pin-controller device node. | ||
74 | |||
75 | - interrupt-controller: identifies the controller node as interrupt-parent. | ||
76 | - #interrupt-cells: the value of this property should be 2. | ||
77 | - First Cell: represents the external gpio interrupt number local to the | ||
78 | external gpio interrupt space of the controller. | ||
79 | - Second Cell: flags to identify the type of the interrupt | ||
80 | - 1 = rising edge triggered | ||
81 | - 2 = falling edge triggered | ||
82 | - 3 = rising and falling edge triggered | ||
83 | - 4 = high level triggered | ||
84 | - 8 = low level triggered | ||
85 | |||
86 | B. External Wakeup Interrupts: For supporting external wakeup interrupts, a | ||
87 | child node representing the external wakeup interrupt controller should be | ||
88 | included in the pin-controller device node. This child node should include | ||
89 | the following properties. | ||
90 | |||
91 | - compatible: identifies the type of the external wakeup interrupt controller | ||
92 | The possible values are: | ||
93 | - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller | ||
94 | found on Samsung Exynos4210 SoC. | ||
95 | - interrupt-parent: phandle of the interrupt parent to which the external | ||
96 | wakeup interrupts are forwarded to. | ||
97 | - interrupt-controller: identifies the node as interrupt-parent. | ||
98 | - #interrupt-cells: the value of this property should be 2 | ||
99 | - First Cell: represents the external wakeup interrupt number local to | ||
100 | the external wakeup interrupt space of the controller. | ||
101 | - Second Cell: flags to identify the type of the interrupt | ||
102 | - 1 = rising edge triggered | ||
103 | - 2 = falling edge triggered | ||
104 | - 3 = rising and falling edge triggered | ||
105 | - 4 = high level triggered | ||
106 | - 8 = low level triggered | ||
107 | |||
108 | Aliases: | ||
109 | |||
110 | All the pin controller nodes should be represented in the aliases node using | ||
111 | the following format 'pinctrl{n}' where n is a unique number for the alias. | ||
112 | |||
113 | Example 1: A pin-controller node with pin groups. | ||
114 | |||
115 | pinctrl_0: pinctrl@11400000 { | ||
116 | compatible = "samsung,pinctrl-exynos4210"; | ||
117 | reg = <0x11400000 0x1000>; | ||
118 | interrupts = <0 47 0>; | ||
119 | |||
120 | uart0_data: uart0-data { | ||
121 | samsung,pins = "gpa0-0", "gpa0-1"; | ||
122 | samsung,pin-function = <2>; | ||
123 | samsung,pin-pud = <0>; | ||
124 | samsung,pin-drv = <0>; | ||
125 | }; | ||
126 | |||
127 | uart0_fctl: uart0-fctl { | ||
128 | samsung,pins = "gpa0-2", "gpa0-3"; | ||
129 | samsung,pin-function = <2>; | ||
130 | samsung,pin-pud = <0>; | ||
131 | samsung,pin-drv = <0>; | ||
132 | }; | ||
133 | |||
134 | uart1_data: uart1-data { | ||
135 | samsung,pins = "gpa0-4", "gpa0-5"; | ||
136 | samsung,pin-function = <2>; | ||
137 | samsung,pin-pud = <0>; | ||
138 | samsung,pin-drv = <0>; | ||
139 | }; | ||
140 | |||
141 | uart1_fctl: uart1-fctl { | ||
142 | samsung,pins = "gpa0-6", "gpa0-7"; | ||
143 | samsung,pin-function = <2>; | ||
144 | samsung,pin-pud = <0>; | ||
145 | samsung,pin-drv = <0>; | ||
146 | }; | ||
147 | |||
148 | i2c2_bus: i2c2-bus { | ||
149 | samsung,pins = "gpa0-6", "gpa0-7"; | ||
150 | samsung,pin-function = <3>; | ||
151 | samsung,pin-pud = <3>; | ||
152 | samsung,pin-drv = <0>; | ||
153 | }; | ||
154 | }; | ||
155 | |||
156 | Example 2: A pin-controller node with external wakeup interrupt controller node. | ||
157 | |||
158 | pinctrl_1: pinctrl@11000000 { | ||
159 | compatible = "samsung,pinctrl-exynos4210"; | ||
160 | reg = <0x11000000 0x1000>; | ||
161 | interrupts = <0 46 0>; | ||
162 | interrupt-controller; | ||
163 | #interrupt-cells = <2>; | ||
164 | |||
165 | wakup_eint: wakeup-interrupt-controller { | ||
166 | compatible = "samsung,exynos4210-wakeup-eint"; | ||
167 | interrupt-parent = <&gic>; | ||
168 | interrupt-controller; | ||
169 | #interrupt-cells = <2>; | ||
170 | interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>, | ||
171 | <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>, | ||
172 | <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>, | ||
173 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>, | ||
174 | <0 32 0>; | ||
175 | }; | ||
176 | }; | ||
177 | |||
178 | Example 3: A uart client node that supports 'default' and 'flow-control' states. | ||
179 | |||
180 | uart@13800000 { | ||
181 | compatible = "samsung,exynos4210-uart"; | ||
182 | reg = <0x13800000 0x100>; | ||
183 | interrupts = <0 52 0>; | ||
184 | pinctrl-names = "default", "flow-control; | ||
185 | pinctrl-0 = <&uart0_data>; | ||
186 | pinctrl-1 = <&uart0_data &uart0_fctl>; | ||
187 | }; | ||
188 | |||
189 | Example 4: Set up the default pin state for uart controller. | ||
190 | |||
191 | static int s3c24xx_serial_probe(struct platform_device *pdev) { | ||
192 | struct pinctrl *pinctrl; | ||
193 | ... | ||
194 | ... | ||
195 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
196 | } | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ad790fc25ed4..2201ff3002a7 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1768,59 +1768,6 @@ config FORCE_MAX_ZONEORDER | |||
1768 | This config option is actually maximum order plus one. For example, | 1768 | This config option is actually maximum order plus one. For example, |
1769 | a value of 11 means that the largest free memory block is 2^10 pages. | 1769 | a value of 11 means that the largest free memory block is 2^10 pages. |
1770 | 1770 | ||
1771 | config LEDS | ||
1772 | bool "Timer and CPU usage LEDs" | ||
1773 | depends on ARCH_CDB89712 || ARCH_EBSA110 || \ | ||
1774 | ARCH_EBSA285 || ARCH_INTEGRATOR || \ | ||
1775 | ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ | ||
1776 | ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ | ||
1777 | ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \ | ||
1778 | ARCH_AT91 || ARCH_DAVINCI || \ | ||
1779 | ARCH_KS8695 || MACH_RD88F5182 || ARCH_REALVIEW | ||
1780 | help | ||
1781 | If you say Y here, the LEDs on your machine will be used | ||
1782 | to provide useful information about your current system status. | ||
1783 | |||
1784 | If you are compiling a kernel for a NetWinder or EBSA-285, you will | ||
1785 | be able to select which LEDs are active using the options below. If | ||
1786 | you are compiling a kernel for the EBSA-110 or the LART however, the | ||
1787 | red LED will simply flash regularly to indicate that the system is | ||
1788 | still functional. It is safe to say Y here if you have a CATS | ||
1789 | system, but the driver will do nothing. | ||
1790 | |||
1791 | config LEDS_TIMER | ||
1792 | bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \ | ||
1793 | OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1794 | || MACH_OMAP_PERSEUS2 | ||
1795 | depends on LEDS | ||
1796 | depends on !GENERIC_CLOCKEVENTS | ||
1797 | default y if ARCH_EBSA110 | ||
1798 | help | ||
1799 | If you say Y here, one of the system LEDs (the green one on the | ||
1800 | NetWinder, the amber one on the EBSA285, or the red one on the LART) | ||
1801 | will flash regularly to indicate that the system is still | ||
1802 | operational. This is mainly useful to kernel hackers who are | ||
1803 | debugging unstable kernels. | ||
1804 | |||
1805 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1806 | functions. You may choose to use both, but the Timer LED function | ||
1807 | will overrule the CPU usage LED. | ||
1808 | |||
1809 | config LEDS_CPU | ||
1810 | bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \ | ||
1811 | !ARCH_OMAP) \ | ||
1812 | || OMAP_OSK_MISTRAL || MACH_OMAP_H2 \ | ||
1813 | || MACH_OMAP_PERSEUS2 | ||
1814 | depends on LEDS | ||
1815 | help | ||
1816 | If you say Y here, the red LED will be used to give a good real | ||
1817 | time indication of CPU usage, by lighting whenever the idle task | ||
1818 | is not currently executing. | ||
1819 | |||
1820 | The LART uses the same LED for both Timer LED and CPU usage LED | ||
1821 | functions. You may choose to use both, but the Timer LED function | ||
1822 | will overrule the CPU usage LED. | ||
1823 | |||
1824 | config ALIGNMENT_TRAP | 1771 | config ALIGNMENT_TRAP |
1825 | bool | 1772 | bool |
1826 | depends on CPU_CP15_MMU | 1773 | depends on CPU_CP15_MMU |
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.dtsi b/arch/arm/boot/dts/exynos4210.dtsi index 02891fe876e4..a4bd0c9a206e 100644 --- a/arch/arm/boot/dts/exynos4210.dtsi +++ b/arch/arm/boot/dts/exynos4210.dtsi | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | /include/ "skeleton.dtsi" | 22 | /include/ "skeleton.dtsi" |
23 | /include/ "exynos4210-pinctrl.dtsi" | ||
23 | 24 | ||
24 | / { | 25 | / { |
25 | compatible = "samsung,exynos4210"; | 26 | compatible = "samsung,exynos4210"; |
@@ -29,6 +30,9 @@ | |||
29 | spi0 = &spi_0; | 30 | spi0 = &spi_0; |
30 | spi1 = &spi_1; | 31 | spi1 = &spi_1; |
31 | spi2 = &spi_2; | 32 | spi2 = &spi_2; |
33 | pinctrl0 = &pinctrl_0; | ||
34 | pinctrl1 = &pinctrl_1; | ||
35 | pinctrl2 = &pinctrl_2; | ||
32 | }; | 36 | }; |
33 | 37 | ||
34 | gic:interrupt-controller@10490000 { | 38 | gic:interrupt-controller@10490000 { |
@@ -50,6 +54,39 @@ | |||
50 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; | 54 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; |
51 | }; | 55 | }; |
52 | 56 | ||
57 | pinctrl_0: pinctrl@11400000 { | ||
58 | compatible = "samsung,pinctrl-exynos4210"; | ||
59 | reg = <0x11400000 0x1000>; | ||
60 | interrupts = <0 47 0>; | ||
61 | interrupt-controller; | ||
62 | #interrupt-cells = <2>; | ||
63 | }; | ||
64 | |||
65 | pinctrl_1: pinctrl@11000000 { | ||
66 | compatible = "samsung,pinctrl-exynos4210"; | ||
67 | reg = <0x11000000 0x1000>; | ||
68 | interrupts = <0 46 0>; | ||
69 | interrupt-controller; | ||
70 | #interrupt-cells = <2>; | ||
71 | |||
72 | wakup_eint: wakeup-interrupt-controller { | ||
73 | compatible = "samsung,exynos4210-wakeup-eint"; | ||
74 | interrupt-parent = <&gic>; | ||
75 | interrupt-controller; | ||
76 | #interrupt-cells = <2>; | ||
77 | interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>, | ||
78 | <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>, | ||
79 | <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>, | ||
80 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>, | ||
81 | <0 32 0>; | ||
82 | }; | ||
83 | }; | ||
84 | |||
85 | pinctrl_2: pinctrl@03860000 { | ||
86 | compatible = "samsung,pinctrl-exynos4210"; | ||
87 | reg = <0x03860000 0x1000>; | ||
88 | }; | ||
89 | |||
53 | watchdog@10060000 { | 90 | watchdog@10060000 { |
54 | compatible = "samsung,s3c2410-wdt"; | 91 | compatible = "samsung,s3c2410-wdt"; |
55 | reg = <0x10060000 0x100>; | 92 | reg = <0x10060000 0x100>; |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 004aaa8d123c..b55794b494b4 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 { |
@@ -460,4 +464,28 @@ | |||
460 | #gpio-cells = <4>; | 464 | #gpio-cells = <4>; |
461 | }; | 465 | }; |
462 | }; | 466 | }; |
467 | |||
468 | gsc_0: gsc@0x13e00000 { | ||
469 | compatible = "samsung,exynos5-gsc"; | ||
470 | reg = <0x13e00000 0x1000>; | ||
471 | interrupts = <0 85 0>; | ||
472 | }; | ||
473 | |||
474 | gsc_1: gsc@0x13e10000 { | ||
475 | compatible = "samsung,exynos5-gsc"; | ||
476 | reg = <0x13e10000 0x1000>; | ||
477 | interrupts = <0 86 0>; | ||
478 | }; | ||
479 | |||
480 | gsc_2: gsc@0x13e20000 { | ||
481 | compatible = "samsung,exynos5-gsc"; | ||
482 | reg = <0x13e20000 0x1000>; | ||
483 | interrupts = <0 87 0>; | ||
484 | }; | ||
485 | |||
486 | gsc_3: gsc@0x13e30000 { | ||
487 | compatible = "samsung,exynos5-gsc"; | ||
488 | reg = <0x13e30000 0x1000>; | ||
489 | interrupts = <0 88 0>; | ||
490 | }; | ||
463 | }; | 491 | }; |
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/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/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/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/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/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/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/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/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/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/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 b3d365dadef5..1fad22f7e21f 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/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-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile index aed9eb664499..6da6940b3656 100644 --- a/arch/arm/mach-clps711x/Makefile +++ b/arch/arm/mach-clps711x/Makefile | |||
@@ -15,5 +15,3 @@ obj-$(CONFIG_ARCH_CLEP7312) += clep7312.o | |||
15 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o | 15 | obj-$(CONFIG_ARCH_EDB7211) += edb7211-arch.o edb7211-mm.o |
16 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o | 16 | obj-$(CONFIG_ARCH_FORTUNET) += fortunet.o |
17 | obj-$(CONFIG_ARCH_P720T) += p720t.o | 17 | obj-$(CONFIG_ARCH_P720T) += p720t.o |
18 | leds-$(CONFIG_ARCH_P720T) += p720t-leds.o | ||
19 | obj-$(CONFIG_LEDS) += $(leds-y) | ||
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-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-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 6c3299ebbfc5..412884dafa6c 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -405,6 +405,8 @@ config MACH_EXYNOS4_DT | |||
405 | select USE_OF | 405 | select USE_OF |
406 | select ARM_AMBA | 406 | select ARM_AMBA |
407 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD | 407 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD |
408 | select PINCTRL | ||
409 | select PINCTRL_EXYNOS4 | ||
408 | help | 410 | help |
409 | Machine support for Samsung Exynos4 machine with device tree enabled. | 411 | 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. | 412 | Select this if a fdt blob is available for the Exynos4 SoC based board. |
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c index 618d0aaaa599..f3171c3f3d94 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", |
@@ -755,6 +817,26 @@ static struct clk exynos5_init_clocks_off[] = { | |||
755 | .enable = exynos5_clk_ip_peric_ctrl, | 817 | .enable = exynos5_clk_ip_peric_ctrl, |
756 | .ctrlbit = (1 << 18), | 818 | .ctrlbit = (1 << 18), |
757 | }, { | 819 | }, { |
820 | .name = "gscl", | ||
821 | .devname = "exynos-gsc.0", | ||
822 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
823 | .ctrlbit = (1 << 0), | ||
824 | }, { | ||
825 | .name = "gscl", | ||
826 | .devname = "exynos-gsc.1", | ||
827 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
828 | .ctrlbit = (1 << 1), | ||
829 | }, { | ||
830 | .name = "gscl", | ||
831 | .devname = "exynos-gsc.2", | ||
832 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
833 | .ctrlbit = (1 << 2), | ||
834 | }, { | ||
835 | .name = "gscl", | ||
836 | .devname = "exynos-gsc.3", | ||
837 | .enable = exynos5_clk_ip_gscl_ctrl, | ||
838 | .ctrlbit = (1 << 3), | ||
839 | }, { | ||
758 | .name = SYSMMU_CLOCK_NAME, | 840 | .name = SYSMMU_CLOCK_NAME, |
759 | .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), | 841 | .devname = SYSMMU_CLOCK_DEVNAME(mfc_l, 0), |
760 | .enable = &exynos5_clk_ip_mfc_ctrl, | 842 | .enable = &exynos5_clk_ip_mfc_ctrl, |
@@ -1225,6 +1307,10 @@ static struct clksrc_clk *exynos5_sysclks[] = { | |||
1225 | &exynos5_clk_aclk_266, | 1307 | &exynos5_clk_aclk_266, |
1226 | &exynos5_clk_aclk_200, | 1308 | &exynos5_clk_aclk_200, |
1227 | &exynos5_clk_aclk_166, | 1309 | &exynos5_clk_aclk_166, |
1310 | &exynos5_clk_aclk_300_gscl, | ||
1311 | &exynos5_clk_mout_aclk_300_gscl, | ||
1312 | &exynos5_clk_mout_aclk_300_gscl_mid, | ||
1313 | &exynos5_clk_mout_aclk_300_gscl_mid1, | ||
1228 | &exynos5_clk_aclk_66_pre, | 1314 | &exynos5_clk_aclk_66_pre, |
1229 | &exynos5_clk_aclk_66, | 1315 | &exynos5_clk_aclk_66, |
1230 | &exynos5_clk_dout_mmc0, | 1316 | &exynos5_clk_dout_mmc0, |
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 6d33f50c2e56..5aa77f996e59 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -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 |
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index ef770bc2318f..e707eb1b1eab 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -56,6 +56,14 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = { | |||
56 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL), | 56 | 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), | 57 | 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), | 58 | OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL), |
59 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0, | ||
60 | "exynos-gsc.0", NULL), | ||
61 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1, | ||
62 | "exynos-gsc.1", NULL), | ||
63 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2, | ||
64 | "exynos-gsc.2", NULL), | ||
65 | OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3, | ||
66 | "exynos-gsc.3", NULL), | ||
59 | {}, | 67 | {}, |
60 | }; | 68 | }; |
61 | 69 | ||
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-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/Makefile b/arch/arm/mach-ks8695/Makefile index 853efd9133c6..9324ef965c26 100644 --- a/arch/arm/mach-ks8695/Makefile +++ b/arch/arm/mach-ks8695/Makefile | |||
@@ -11,9 +11,6 @@ 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 |
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-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 edc30b8b77ed..a6219eaf1f68 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
@@ -48,6 +48,7 @@ config ARCH_OMAP3 | |||
48 | select ARM_CPU_SUSPEND if PM | 48 | select ARM_CPU_SUSPEND if PM |
49 | select MULTI_IRQ_HANDLER | 49 | select MULTI_IRQ_HANDLER |
50 | select SOC_HAS_OMAP2_SDRC | 50 | select SOC_HAS_OMAP2_SDRC |
51 | select OMAP_INTERCONNECT | ||
51 | 52 | ||
52 | config ARCH_OMAP4 | 53 | config ARCH_OMAP4 |
53 | bool "TI OMAP4" | 54 | bool "TI OMAP4" |
@@ -67,6 +68,7 @@ config ARCH_OMAP4 | |||
67 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 68 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
68 | select ARM_CPU_SUSPEND if PM | 69 | select ARM_CPU_SUSPEND if PM |
69 | select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP | 70 | select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP |
71 | select OMAP_INTERCONNECT | ||
70 | 72 | ||
71 | config SOC_OMAP5 | 73 | config SOC_OMAP5 |
72 | bool "TI OMAP5" | 74 | bool "TI OMAP5" |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 845202358ddc..7d6abda3b74e 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -180,11 +180,6 @@ obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o | |||
180 | # EMU peripherals | 180 | # EMU peripherals |
181 | obj-$(CONFIG_OMAP3_EMU) += emu.o | 181 | obj-$(CONFIG_OMAP3_EMU) += emu.o |
182 | 182 | ||
183 | # L3 interconnect | ||
184 | obj-$(CONFIG_ARCH_OMAP3) += omap_l3_smx.o | ||
185 | obj-$(CONFIG_ARCH_OMAP4) += omap_l3_noc.o | ||
186 | obj-$(CONFIG_SOC_OMAP5) += omap_l3_noc.o | ||
187 | |||
188 | obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o | 183 | obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o |
189 | mailbox_mach-objs := mailbox.o | 184 | mailbox_mach-objs := mailbox.o |
190 | 185 | ||
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-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 6ff466bd43e8..ae1e9977603e 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 0ca0db787903..3c48035afd6b 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 1aebaf719462..bdc6c335830a 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-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 f8f2c0ac4c01..f2141ae5a7de 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 b442fb276d57..ec4fcd9a7e9c 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 5d2c8bebb069..17954a327e1b 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-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 d673211f121c..1710ed1a0ac0 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 09d7f4b4b354..5240f104a3cd 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 b775a0abec0a..b2ce04bf4c9b 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-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c index c8a7b951f759..cc9b5fd8c3d3 100644 --- a/arch/arm/mach-tegra/tegra20_clocks_data.c +++ b/arch/arm/mach-tegra/tegra20_clocks_data.c | |||
@@ -917,14 +917,10 @@ PERIPH_CLK(la, "la", NULL, 76, 0x1f8, 26000000, mux_pllp_pllc_pllm_clkm, MUX | |||
917 | 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); |
918 | 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 */ |
919 | 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 */ |
920 | 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); |
921 | 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); |
922 | 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); |
923 | 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); |
924 | PERIPH_CLK(i2c1_i2c, "tegra-i2c.0", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
925 | PERIPH_CLK(i2c2_i2c, "tegra-i2c.1", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
926 | PERIPH_CLK(i2c3_i2c, "tegra-i2c.2", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
927 | PERIPH_CLK(dvc_i2c, "tegra-i2c.3", "i2c", 0, 0, 72000000, mux_pllp_out3, 0); | ||
928 | 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); |
929 | 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); |
930 | 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); |
@@ -989,10 +985,6 @@ static struct clk *tegra_list_clks[] = { | |||
989 | &tegra_i2c2, | 985 | &tegra_i2c2, |
990 | &tegra_i2c3, | 986 | &tegra_i2c3, |
991 | &tegra_dvc, | 987 | &tegra_dvc, |
992 | &tegra_i2c1_i2c, | ||
993 | &tegra_i2c2_i2c, | ||
994 | &tegra_i2c3_i2c, | ||
995 | &tegra_dvc_i2c, | ||
996 | &tegra_uarta, | 988 | &tegra_uarta, |
997 | &tegra_uartb, | 989 | &tegra_uartb, |
998 | &tegra_uartc, | 990 | &tegra_uartc, |
@@ -1056,6 +1048,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = { | |||
1056 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), | 1048 | CLK_DUPLICATE("vde", "tegra-aes", "vde"), |
1057 | CLK_DUPLICATE("cclk", NULL, "cpu"), | 1049 | CLK_DUPLICATE("cclk", NULL, "cpu"), |
1058 | 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"), | ||
1059 | }; | 1055 | }; |
1060 | 1056 | ||
1061 | #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-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/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-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/drivers/Kconfig b/drivers/Kconfig index 36d3daa19a74..dbdefa3fe775 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -2,6 +2,8 @@ menu "Device Drivers" | |||
2 | 2 | ||
3 | source "drivers/base/Kconfig" | 3 | source "drivers/base/Kconfig" |
4 | 4 | ||
5 | source "drivers/bus/Kconfig" | ||
6 | |||
5 | source "drivers/connector/Kconfig" | 7 | source "drivers/connector/Kconfig" |
6 | 8 | ||
7 | source "drivers/mtd/Kconfig" | 9 | source "drivers/mtd/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 8c30e73cd94c..acb48fa4531c 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -6,6 +6,7 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | obj-y += irqchip/ | 8 | obj-y += irqchip/ |
9 | obj-y += bus/ | ||
9 | 10 | ||
10 | # GPIO must come after pinctrl as gpios may need to mux pins etc | 11 | # GPIO must come after pinctrl as gpios may need to mux pins etc |
11 | obj-y += pinctrl/ | 12 | obj-y += pinctrl/ |
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig new file mode 100644 index 000000000000..bbec35d21fe5 --- /dev/null +++ b/drivers/bus/Kconfig | |||
@@ -0,0 +1,21 @@ | |||
1 | # | ||
2 | # Bus Devices | ||
3 | # | ||
4 | |||
5 | menu "Bus devices" | ||
6 | |||
7 | config OMAP_OCP2SCP | ||
8 | tristate "OMAP OCP2SCP DRIVER" | ||
9 | help | ||
10 | Driver to enable ocp2scp module which transforms ocp interface | ||
11 | protocol to scp protocol. In OMAP4, USB PHY is connected via | ||
12 | OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via | ||
13 | OCP2SCP. | ||
14 | |||
15 | config OMAP_INTERCONNECT | ||
16 | tristate "OMAP INTERCONNECT DRIVER" | ||
17 | depends on ARCH_OMAP2PLUS | ||
18 | |||
19 | help | ||
20 | Driver to enable OMAP interconnect error handling driver. | ||
21 | endmenu | ||
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile new file mode 100644 index 000000000000..45d997c85453 --- /dev/null +++ b/drivers/bus/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for the bus drivers. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o | ||
6 | |||
7 | # Interconnect bus driver for OMAP SoCs. | ||
8 | obj-$(CONFIG_OMAP_INTERCONNECT) += omap_l3_smx.o omap_l3_noc.o | ||
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c new file mode 100644 index 000000000000..ff63560b8467 --- /dev/null +++ b/drivers/bus/omap-ocp2scp.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /* | ||
2 | * omap-ocp2scp.c - transform ocp interface protocol to scp protocol | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com | ||
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 | * Author: Kishon Vijay Abraham I <kishon@ti.com> | ||
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 | #include <linux/module.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/pm_runtime.h> | ||
23 | #include <linux/of.h> | ||
24 | #include <linux/of_platform.h> | ||
25 | |||
26 | static int ocp2scp_remove_devices(struct device *dev, void *c) | ||
27 | { | ||
28 | struct platform_device *pdev = to_platform_device(dev); | ||
29 | |||
30 | platform_device_unregister(pdev); | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static int __devinit omap_ocp2scp_probe(struct platform_device *pdev) | ||
36 | { | ||
37 | int ret; | ||
38 | struct device_node *np = pdev->dev.of_node; | ||
39 | |||
40 | if (np) { | ||
41 | ret = of_platform_populate(np, NULL, NULL, &pdev->dev); | ||
42 | if (ret) { | ||
43 | dev_err(&pdev->dev, "failed to add resources for ocp2scp child\n"); | ||
44 | goto err0; | ||
45 | } | ||
46 | } | ||
47 | pm_runtime_enable(&pdev->dev); | ||
48 | |||
49 | return 0; | ||
50 | |||
51 | err0: | ||
52 | device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); | ||
53 | |||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | static int __devexit omap_ocp2scp_remove(struct platform_device *pdev) | ||
58 | { | ||
59 | pm_runtime_disable(&pdev->dev); | ||
60 | device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); | ||
61 | |||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | #ifdef CONFIG_OF | ||
66 | static const struct of_device_id omap_ocp2scp_id_table[] = { | ||
67 | { .compatible = "ti,omap-ocp2scp" }, | ||
68 | {} | ||
69 | }; | ||
70 | MODULE_DEVICE_TABLE(of, omap_ocp2scp_id_table); | ||
71 | #endif | ||
72 | |||
73 | static struct platform_driver omap_ocp2scp_driver = { | ||
74 | .probe = omap_ocp2scp_probe, | ||
75 | .remove = __devexit_p(omap_ocp2scp_remove), | ||
76 | .driver = { | ||
77 | .name = "omap-ocp2scp", | ||
78 | .owner = THIS_MODULE, | ||
79 | .of_match_table = of_match_ptr(omap_ocp2scp_id_table), | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | module_platform_driver(omap_ocp2scp_driver); | ||
84 | |||
85 | MODULE_ALIAS("platform: omap-ocp2scp"); | ||
86 | MODULE_AUTHOR("Texas Instruments Inc."); | ||
87 | MODULE_DESCRIPTION("OMAP OCP2SCP driver"); | ||
88 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/arm/mach-omap2/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c index f447e02102bb..44b2b3e57882 100644 --- a/arch/arm/mach-omap2/omap_l3_noc.c +++ b/drivers/bus/omap_l3_noc.c | |||
@@ -191,7 +191,7 @@ static int __devinit omap4_l3_probe(struct platform_device *pdev) | |||
191 | IRQF_DISABLED, "l3-dbg-irq", l3); | 191 | IRQF_DISABLED, "l3-dbg-irq", l3); |
192 | if (ret) { | 192 | if (ret) { |
193 | pr_crit("L3: request_irq failed to register for 0x%x\n", | 193 | pr_crit("L3: request_irq failed to register for 0x%x\n", |
194 | 9 + OMAP44XX_IRQ_GIC_START); | 194 | l3->debug_irq); |
195 | goto err3; | 195 | goto err3; |
196 | } | 196 | } |
197 | 197 | ||
@@ -201,7 +201,7 @@ static int __devinit omap4_l3_probe(struct platform_device *pdev) | |||
201 | IRQF_DISABLED, "l3-app-irq", l3); | 201 | IRQF_DISABLED, "l3-app-irq", l3); |
202 | if (ret) { | 202 | if (ret) { |
203 | pr_crit("L3: request_irq failed to register for 0x%x\n", | 203 | pr_crit("L3: request_irq failed to register for 0x%x\n", |
204 | 10 + OMAP44XX_IRQ_GIC_START); | 204 | l3->app_irq); |
205 | goto err4; | 205 | goto err4; |
206 | } | 206 | } |
207 | 207 | ||
diff --git a/arch/arm/mach-omap2/omap_l3_noc.h b/drivers/bus/omap_l3_noc.h index a6ce34dc4814..a6ce34dc4814 100644 --- a/arch/arm/mach-omap2/omap_l3_noc.h +++ b/drivers/bus/omap_l3_noc.h | |||
diff --git a/arch/arm/mach-omap2/omap_l3_smx.c b/drivers/bus/omap_l3_smx.c index acc216491b8a..acc216491b8a 100644 --- a/arch/arm/mach-omap2/omap_l3_smx.c +++ b/drivers/bus/omap_l3_smx.c | |||
diff --git a/arch/arm/mach-omap2/omap_l3_smx.h b/drivers/bus/omap_l3_smx.h index 4f3cebca4179..4f3cebca4179 100644 --- a/arch/arm/mach-omap2/omap_l3_smx.h +++ b/drivers/bus/omap_l3_smx.h | |||
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index d45c3345b4af..a0e2f7d70355 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | #include <asm/hardware/dec21285.h> | 31 | #include <asm/hardware/dec21285.h> |
32 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/leds.h> | ||
34 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
35 | #include <asm/uaccess.h> | 34 | #include <asm/uaccess.h> |
36 | 35 | ||
@@ -179,9 +178,6 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
179 | 178 | ||
180 | written = 0; | 179 | written = 0; |
181 | 180 | ||
182 | leds_event(led_claim); | ||
183 | leds_event(led_green_on); | ||
184 | |||
185 | nBlock = (int) p >> 16; //block # of 64K bytes | 181 | nBlock = (int) p >> 16; //block # of 64K bytes |
186 | 182 | ||
187 | /* | 183 | /* |
@@ -258,11 +254,6 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
258 | printk(KERN_DEBUG "flash_write: written 0x%X bytes OK.\n", written); | 254 | printk(KERN_DEBUG "flash_write: written 0x%X bytes OK.\n", written); |
259 | } | 255 | } |
260 | 256 | ||
261 | /* | ||
262 | * restore reg on exit | ||
263 | */ | ||
264 | leds_event(led_release); | ||
265 | |||
266 | mutex_unlock(&nwflash_mutex); | 257 | mutex_unlock(&nwflash_mutex); |
267 | 258 | ||
268 | return written; | 259 | return written; |
@@ -334,11 +325,6 @@ static int erase_block(int nBlock) | |||
334 | int temp, temp1; | 325 | int temp, temp1; |
335 | 326 | ||
336 | /* | 327 | /* |
337 | * orange LED == erase | ||
338 | */ | ||
339 | leds_event(led_amber_on); | ||
340 | |||
341 | /* | ||
342 | * reset footbridge to the correct offset 0 (...0..3) | 328 | * reset footbridge to the correct offset 0 (...0..3) |
343 | */ | 329 | */ |
344 | *CSR_ROMWRITEREG = 0; | 330 | *CSR_ROMWRITEREG = 0; |
@@ -446,12 +432,6 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
446 | unsigned long timeout; | 432 | unsigned long timeout; |
447 | unsigned long timeout1; | 433 | unsigned long timeout1; |
448 | 434 | ||
449 | /* | ||
450 | * red LED == write | ||
451 | */ | ||
452 | leds_event(led_amber_off); | ||
453 | leds_event(led_red_on); | ||
454 | |||
455 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); | 435 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); |
456 | 436 | ||
457 | /* | 437 | /* |
@@ -558,17 +538,9 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
558 | pWritePtr - FLASH_BASE); | 538 | pWritePtr - FLASH_BASE); |
559 | 539 | ||
560 | /* | 540 | /* |
561 | * no LED == waiting | ||
562 | */ | ||
563 | leds_event(led_amber_off); | ||
564 | /* | ||
565 | * wait couple ms | 541 | * wait couple ms |
566 | */ | 542 | */ |
567 | msleep(10); | 543 | msleep(10); |
568 | /* | ||
569 | * red LED == write | ||
570 | */ | ||
571 | leds_event(led_red_on); | ||
572 | 544 | ||
573 | goto WriteRetry; | 545 | goto WriteRetry; |
574 | } else { | 546 | } else { |
@@ -583,12 +555,6 @@ static int write_block(unsigned long p, const char __user *buf, int count) | |||
583 | } | 555 | } |
584 | } | 556 | } |
585 | 557 | ||
586 | /* | ||
587 | * green LED == read/verify | ||
588 | */ | ||
589 | leds_event(led_amber_off); | ||
590 | leds_event(led_green_on); | ||
591 | |||
592 | msleep(10); | 558 | msleep(10); |
593 | 559 | ||
594 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); | 560 | pWritePtr = (unsigned char *) ((unsigned int) (FLASH_BASE + p)); |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 8af4b06e80f7..a006f0db15af 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2797,6 +2797,27 @@ static __init void exynos4_gpiolib_init(void) | |||
2797 | int group = 0; | 2797 | int group = 0; |
2798 | void __iomem *gpx_base; | 2798 | void __iomem *gpx_base; |
2799 | 2799 | ||
2800 | #ifdef CONFIG_PINCTRL_SAMSUNG | ||
2801 | /* | ||
2802 | * This gpio driver includes support for device tree support and | ||
2803 | * there are platforms using it. In order to maintain | ||
2804 | * compatibility with those platforms, and to allow non-dt | ||
2805 | * Exynos4210 platforms to use this gpiolib support, a check | ||
2806 | * is added to find out if there is a active pin-controller | ||
2807 | * driver support available. If it is available, this gpiolib | ||
2808 | * support is ignored and the gpiolib support available in | ||
2809 | * pin-controller driver is used. This is a temporary check and | ||
2810 | * will go away when all of the Exynos4210 platforms have | ||
2811 | * switched to using device tree and the pin-ctrl driver. | ||
2812 | */ | ||
2813 | struct device_node *pctrl_np; | ||
2814 | const char *pctrl_compat = "samsung,pinctrl-exynos4210"; | ||
2815 | pctrl_np = of_find_compatible_node(NULL, NULL, pctrl_compat); | ||
2816 | if (pctrl_np) | ||
2817 | if (of_device_is_available(pctrl_np)) | ||
2818 | return; | ||
2819 | #endif | ||
2820 | |||
2800 | /* gpio part1 */ | 2821 | /* gpio part1 */ |
2801 | gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K); | 2822 | gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K); |
2802 | if (gpio_base1 == NULL) { | 2823 | if (gpio_base1 == NULL) { |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 9a08c57bc936..f981ac4e6783 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/i2c-tegra.h> | 28 | #include <linux/i2c-tegra.h> |
29 | #include <linux/of_i2c.h> | 29 | #include <linux/of_i2c.h> |
30 | #include <linux/of_device.h> | ||
30 | #include <linux/module.h> | 31 | #include <linux/module.h> |
31 | 32 | ||
32 | #include <asm/unaligned.h> | 33 | #include <asm/unaligned.h> |
@@ -114,11 +115,21 @@ enum msg_end_type { | |||
114 | }; | 115 | }; |
115 | 116 | ||
116 | /** | 117 | /** |
118 | * struct tegra_i2c_hw_feature : Different HW support on Tegra | ||
119 | * @has_continue_xfer_support: Continue transfer supports. | ||
120 | */ | ||
121 | |||
122 | struct tegra_i2c_hw_feature { | ||
123 | bool has_continue_xfer_support; | ||
124 | }; | ||
125 | |||
126 | /** | ||
117 | * struct tegra_i2c_dev - per device i2c context | 127 | * struct tegra_i2c_dev - per device i2c context |
118 | * @dev: device reference for power management | 128 | * @dev: device reference for power management |
129 | * @hw: Tegra i2c hw feature. | ||
119 | * @adapter: core i2c layer adapter information | 130 | * @adapter: core i2c layer adapter information |
120 | * @clk: clock reference for i2c controller | 131 | * @div_clk: clock reference for div clock of i2c controller. |
121 | * @i2c_clk: clock reference for i2c bus | 132 | * @fast_clk: clock reference for fast clock of i2c controller. |
122 | * @base: ioremapped registers cookie | 133 | * @base: ioremapped registers cookie |
123 | * @cont_id: i2c controller id, used for for packet header | 134 | * @cont_id: i2c controller id, used for for packet header |
124 | * @irq: irq number of transfer complete interrupt | 135 | * @irq: irq number of transfer complete interrupt |
@@ -133,9 +144,10 @@ enum msg_end_type { | |||
133 | */ | 144 | */ |
134 | struct tegra_i2c_dev { | 145 | struct tegra_i2c_dev { |
135 | struct device *dev; | 146 | struct device *dev; |
147 | const struct tegra_i2c_hw_feature *hw; | ||
136 | struct i2c_adapter adapter; | 148 | struct i2c_adapter adapter; |
137 | struct clk *clk; | 149 | struct clk *div_clk; |
138 | struct clk *i2c_clk; | 150 | struct clk *fast_clk; |
139 | void __iomem *base; | 151 | void __iomem *base; |
140 | int cont_id; | 152 | int cont_id; |
141 | int irq; | 153 | int irq; |
@@ -351,16 +363,40 @@ static void tegra_dvc_init(struct tegra_i2c_dev *i2c_dev) | |||
351 | dvc_writel(i2c_dev, val, DVC_CTRL_REG1); | 363 | dvc_writel(i2c_dev, val, DVC_CTRL_REG1); |
352 | } | 364 | } |
353 | 365 | ||
366 | static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) | ||
367 | { | ||
368 | int ret; | ||
369 | ret = clk_prepare_enable(i2c_dev->fast_clk); | ||
370 | if (ret < 0) { | ||
371 | dev_err(i2c_dev->dev, | ||
372 | "Enabling fast clk failed, err %d\n", ret); | ||
373 | return ret; | ||
374 | } | ||
375 | ret = clk_prepare_enable(i2c_dev->div_clk); | ||
376 | if (ret < 0) { | ||
377 | dev_err(i2c_dev->dev, | ||
378 | "Enabling div clk failed, err %d\n", ret); | ||
379 | clk_disable_unprepare(i2c_dev->fast_clk); | ||
380 | } | ||
381 | return ret; | ||
382 | } | ||
383 | |||
384 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) | ||
385 | { | ||
386 | clk_disable_unprepare(i2c_dev->div_clk); | ||
387 | clk_disable_unprepare(i2c_dev->fast_clk); | ||
388 | } | ||
389 | |||
354 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | 390 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) |
355 | { | 391 | { |
356 | u32 val; | 392 | u32 val; |
357 | int err = 0; | 393 | int err = 0; |
358 | 394 | ||
359 | clk_prepare_enable(i2c_dev->clk); | 395 | tegra_i2c_clock_enable(i2c_dev); |
360 | 396 | ||
361 | tegra_periph_reset_assert(i2c_dev->clk); | 397 | tegra_periph_reset_assert(i2c_dev->div_clk); |
362 | udelay(2); | 398 | udelay(2); |
363 | tegra_periph_reset_deassert(i2c_dev->clk); | 399 | tegra_periph_reset_deassert(i2c_dev->div_clk); |
364 | 400 | ||
365 | if (i2c_dev->is_dvc) | 401 | if (i2c_dev->is_dvc) |
366 | tegra_dvc_init(i2c_dev); | 402 | tegra_dvc_init(i2c_dev); |
@@ -369,7 +405,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
369 | (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); | 405 | (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); |
370 | i2c_writel(i2c_dev, val, I2C_CNFG); | 406 | i2c_writel(i2c_dev, val, I2C_CNFG); |
371 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); | 407 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); |
372 | clk_set_rate(i2c_dev->clk, i2c_dev->bus_clk_rate * 8); | 408 | clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * 8); |
373 | 409 | ||
374 | if (!i2c_dev->is_dvc) { | 410 | if (!i2c_dev->is_dvc) { |
375 | u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); | 411 | u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); |
@@ -387,7 +423,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
387 | if (tegra_i2c_flush_fifos(i2c_dev)) | 423 | if (tegra_i2c_flush_fifos(i2c_dev)) |
388 | err = -ETIMEDOUT; | 424 | err = -ETIMEDOUT; |
389 | 425 | ||
390 | clk_disable_unprepare(i2c_dev->clk); | 426 | tegra_i2c_clock_disable(i2c_dev); |
391 | 427 | ||
392 | if (i2c_dev->irq_disabled) { | 428 | if (i2c_dev->irq_disabled) { |
393 | i2c_dev->irq_disabled = 0; | 429 | i2c_dev->irq_disabled = 0; |
@@ -563,7 +599,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
563 | if (i2c_dev->is_suspended) | 599 | if (i2c_dev->is_suspended) |
564 | return -EBUSY; | 600 | return -EBUSY; |
565 | 601 | ||
566 | clk_prepare_enable(i2c_dev->clk); | 602 | tegra_i2c_clock_enable(i2c_dev); |
567 | for (i = 0; i < num; i++) { | 603 | for (i = 0; i < num; i++) { |
568 | enum msg_end_type end_type = MSG_END_STOP; | 604 | enum msg_end_type end_type = MSG_END_STOP; |
569 | if (i < (num - 1)) { | 605 | if (i < (num - 1)) { |
@@ -576,14 +612,19 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], | |||
576 | if (ret) | 612 | if (ret) |
577 | break; | 613 | break; |
578 | } | 614 | } |
579 | clk_disable_unprepare(i2c_dev->clk); | 615 | tegra_i2c_clock_disable(i2c_dev); |
580 | return ret ?: i; | 616 | return ret ?: i; |
581 | } | 617 | } |
582 | 618 | ||
583 | static u32 tegra_i2c_func(struct i2c_adapter *adap) | 619 | static u32 tegra_i2c_func(struct i2c_adapter *adap) |
584 | { | 620 | { |
585 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | | 621 | struct tegra_i2c_dev *i2c_dev = i2c_get_adapdata(adap); |
586 | I2C_FUNC_PROTOCOL_MANGLING | I2C_FUNC_NOSTART; | 622 | u32 ret = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | |
623 | I2C_FUNC_PROTOCOL_MANGLING; | ||
624 | |||
625 | if (i2c_dev->hw->has_continue_xfer_support) | ||
626 | ret |= I2C_FUNC_NOSTART; | ||
627 | return ret; | ||
587 | } | 628 | } |
588 | 629 | ||
589 | static const struct i2c_algorithm tegra_i2c_algo = { | 630 | static const struct i2c_algorithm tegra_i2c_algo = { |
@@ -591,13 +632,32 @@ static const struct i2c_algorithm tegra_i2c_algo = { | |||
591 | .functionality = tegra_i2c_func, | 632 | .functionality = tegra_i2c_func, |
592 | }; | 633 | }; |
593 | 634 | ||
635 | static const struct tegra_i2c_hw_feature tegra20_i2c_hw = { | ||
636 | .has_continue_xfer_support = false, | ||
637 | }; | ||
638 | |||
639 | static const struct tegra_i2c_hw_feature tegra30_i2c_hw = { | ||
640 | .has_continue_xfer_support = true, | ||
641 | }; | ||
642 | |||
643 | #if defined(CONFIG_OF) | ||
644 | /* Match table for of_platform binding */ | ||
645 | static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { | ||
646 | { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, | ||
647 | { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, | ||
648 | { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, | ||
649 | {}, | ||
650 | }; | ||
651 | MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); | ||
652 | #endif | ||
653 | |||
594 | static int __devinit tegra_i2c_probe(struct platform_device *pdev) | 654 | static int __devinit tegra_i2c_probe(struct platform_device *pdev) |
595 | { | 655 | { |
596 | struct tegra_i2c_dev *i2c_dev; | 656 | struct tegra_i2c_dev *i2c_dev; |
597 | struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; | 657 | struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; |
598 | struct resource *res; | 658 | struct resource *res; |
599 | struct clk *clk; | 659 | struct clk *div_clk; |
600 | struct clk *i2c_clk; | 660 | struct clk *fast_clk; |
601 | const unsigned int *prop; | 661 | const unsigned int *prop; |
602 | void __iomem *base; | 662 | void __iomem *base; |
603 | int irq; | 663 | int irq; |
@@ -622,16 +682,16 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
622 | } | 682 | } |
623 | irq = res->start; | 683 | irq = res->start; |
624 | 684 | ||
625 | clk = devm_clk_get(&pdev->dev, NULL); | 685 | div_clk = devm_clk_get(&pdev->dev, "div-clk"); |
626 | if (IS_ERR(clk)) { | 686 | if (IS_ERR(div_clk)) { |
627 | dev_err(&pdev->dev, "missing controller clock"); | 687 | dev_err(&pdev->dev, "missing controller clock"); |
628 | return PTR_ERR(clk); | 688 | return PTR_ERR(div_clk); |
629 | } | 689 | } |
630 | 690 | ||
631 | i2c_clk = devm_clk_get(&pdev->dev, "i2c"); | 691 | fast_clk = devm_clk_get(&pdev->dev, "fast-clk"); |
632 | if (IS_ERR(i2c_clk)) { | 692 | if (IS_ERR(fast_clk)) { |
633 | dev_err(&pdev->dev, "missing bus clock"); | 693 | dev_err(&pdev->dev, "missing bus clock"); |
634 | return PTR_ERR(i2c_clk); | 694 | return PTR_ERR(fast_clk); |
635 | } | 695 | } |
636 | 696 | ||
637 | i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); | 697 | i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); |
@@ -641,8 +701,8 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
641 | } | 701 | } |
642 | 702 | ||
643 | i2c_dev->base = base; | 703 | i2c_dev->base = base; |
644 | i2c_dev->clk = clk; | 704 | i2c_dev->div_clk = div_clk; |
645 | i2c_dev->i2c_clk = i2c_clk; | 705 | i2c_dev->fast_clk = fast_clk; |
646 | i2c_dev->adapter.algo = &tegra_i2c_algo; | 706 | i2c_dev->adapter.algo = &tegra_i2c_algo; |
647 | i2c_dev->irq = irq; | 707 | i2c_dev->irq = irq; |
648 | i2c_dev->cont_id = pdev->id; | 708 | i2c_dev->cont_id = pdev->id; |
@@ -659,11 +719,18 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
659 | i2c_dev->bus_clk_rate = be32_to_cpup(prop); | 719 | i2c_dev->bus_clk_rate = be32_to_cpup(prop); |
660 | } | 720 | } |
661 | 721 | ||
662 | if (pdev->dev.of_node) | 722 | i2c_dev->hw = &tegra20_i2c_hw; |
723 | |||
724 | if (pdev->dev.of_node) { | ||
725 | const struct of_device_id *match; | ||
726 | match = of_match_device(of_match_ptr(tegra_i2c_of_match), | ||
727 | &pdev->dev); | ||
728 | i2c_dev->hw = match->data; | ||
663 | i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, | 729 | i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node, |
664 | "nvidia,tegra20-i2c-dvc"); | 730 | "nvidia,tegra20-i2c-dvc"); |
665 | else if (pdev->id == 3) | 731 | } else if (pdev->id == 3) { |
666 | i2c_dev->is_dvc = 1; | 732 | i2c_dev->is_dvc = 1; |
733 | } | ||
667 | init_completion(&i2c_dev->msg_complete); | 734 | init_completion(&i2c_dev->msg_complete); |
668 | 735 | ||
669 | platform_set_drvdata(pdev, i2c_dev); | 736 | platform_set_drvdata(pdev, i2c_dev); |
@@ -681,8 +748,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
681 | return ret; | 748 | return ret; |
682 | } | 749 | } |
683 | 750 | ||
684 | clk_prepare_enable(i2c_dev->i2c_clk); | ||
685 | |||
686 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); | 751 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); |
687 | i2c_dev->adapter.owner = THIS_MODULE; | 752 | i2c_dev->adapter.owner = THIS_MODULE; |
688 | i2c_dev->adapter.class = I2C_CLASS_HWMON; | 753 | i2c_dev->adapter.class = I2C_CLASS_HWMON; |
@@ -696,7 +761,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
696 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); | 761 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); |
697 | if (ret) { | 762 | if (ret) { |
698 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); | 763 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); |
699 | clk_disable_unprepare(i2c_dev->i2c_clk); | ||
700 | return ret; | 764 | return ret; |
701 | } | 765 | } |
702 | 766 | ||
@@ -751,16 +815,6 @@ static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume); | |||
751 | #define TEGRA_I2C_PM NULL | 815 | #define TEGRA_I2C_PM NULL |
752 | #endif | 816 | #endif |
753 | 817 | ||
754 | #if defined(CONFIG_OF) | ||
755 | /* Match table for of_platform binding */ | ||
756 | static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { | ||
757 | { .compatible = "nvidia,tegra20-i2c", }, | ||
758 | { .compatible = "nvidia,tegra20-i2c-dvc", }, | ||
759 | {}, | ||
760 | }; | ||
761 | MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); | ||
762 | #endif | ||
763 | |||
764 | static struct platform_driver tegra_i2c_driver = { | 818 | static struct platform_driver tegra_i2c_driver = { |
765 | .probe = tegra_i2c_probe, | 819 | .probe = tegra_i2c_probe, |
766 | .remove = __devexit_p(tegra_i2c_remove), | 820 | .remove = __devexit_p(tegra_i2c_remove), |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index c96bbaadeebd..16578d3b52bb 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -506,6 +506,16 @@ config LEDS_TRIGGER_BACKLIGHT | |||
506 | 506 | ||
507 | If unsure, say N. | 507 | If unsure, say N. |
508 | 508 | ||
509 | config LEDS_TRIGGER_CPU | ||
510 | bool "LED CPU Trigger" | ||
511 | depends on LEDS_TRIGGERS | ||
512 | help | ||
513 | This allows LEDs to be controlled by active CPUs. This shows | ||
514 | the active CPUs across an array of LEDs so you can see which | ||
515 | CPUs are active on the system at any given moment. | ||
516 | |||
517 | If unsure, say N. | ||
518 | |||
509 | config LEDS_TRIGGER_GPIO | 519 | config LEDS_TRIGGER_GPIO |
510 | tristate "LED GPIO Trigger" | 520 | tristate "LED GPIO Trigger" |
511 | depends on LEDS_TRIGGERS | 521 | depends on LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index a4429a9217bc..a9b627c4f8ba 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -61,5 +61,6 @@ obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o | |||
61 | obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o | 61 | obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o |
62 | obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o | 62 | obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o |
63 | obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o | 63 | obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o |
64 | obj-$(CONFIG_LEDS_TRIGGER_CPU) += ledtrig-cpu.o | ||
64 | obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o | 65 | obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o |
65 | obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o | 66 | obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o |
diff --git a/drivers/leds/ledtrig-cpu.c b/drivers/leds/ledtrig-cpu.c new file mode 100644 index 000000000000..b312056da14d --- /dev/null +++ b/drivers/leds/ledtrig-cpu.c | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * ledtrig-cpu.c - LED trigger based on CPU activity | ||
3 | * | ||
4 | * This LED trigger will be registered for each possible CPU and named as | ||
5 | * cpu0, cpu1, cpu2, cpu3, etc. | ||
6 | * | ||
7 | * It can be bound to any LED just like other triggers using either a | ||
8 | * board file or via sysfs interface. | ||
9 | * | ||
10 | * An API named ledtrig_cpu is exported for any user, who want to add CPU | ||
11 | * activity indication in their code | ||
12 | * | ||
13 | * Copyright 2011 Linus Walleij <linus.walleij@linaro.org> | ||
14 | * Copyright 2011 - 2012 Bryan Wu <bryan.wu@canonical.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License version 2 as | ||
18 | * published by the Free Software Foundation. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/slab.h> | ||
26 | #include <linux/percpu.h> | ||
27 | #include <linux/syscore_ops.h> | ||
28 | #include <linux/rwsem.h> | ||
29 | #include "leds.h" | ||
30 | |||
31 | #define MAX_NAME_LEN 8 | ||
32 | |||
33 | struct led_trigger_cpu { | ||
34 | char name[MAX_NAME_LEN]; | ||
35 | struct led_trigger *_trig; | ||
36 | struct mutex lock; | ||
37 | int lock_is_inited; | ||
38 | }; | ||
39 | |||
40 | static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig); | ||
41 | |||
42 | /** | ||
43 | * ledtrig_cpu - emit a CPU event as a trigger | ||
44 | * @evt: CPU event to be emitted | ||
45 | * | ||
46 | * Emit a CPU event on a CPU core, which will trigger a | ||
47 | * binded LED to turn on or turn off. | ||
48 | */ | ||
49 | void ledtrig_cpu(enum cpu_led_event ledevt) | ||
50 | { | ||
51 | struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig); | ||
52 | |||
53 | /* mutex lock should be initialized before calling mutex_call() */ | ||
54 | if (!trig->lock_is_inited) | ||
55 | return; | ||
56 | |||
57 | mutex_lock(&trig->lock); | ||
58 | |||
59 | /* Locate the correct CPU LED */ | ||
60 | switch (ledevt) { | ||
61 | case CPU_LED_IDLE_END: | ||
62 | case CPU_LED_START: | ||
63 | /* Will turn the LED on, max brightness */ | ||
64 | led_trigger_event(trig->_trig, LED_FULL); | ||
65 | break; | ||
66 | |||
67 | case CPU_LED_IDLE_START: | ||
68 | case CPU_LED_STOP: | ||
69 | case CPU_LED_HALTED: | ||
70 | /* Will turn the LED off */ | ||
71 | led_trigger_event(trig->_trig, LED_OFF); | ||
72 | break; | ||
73 | |||
74 | default: | ||
75 | /* Will leave the LED as it is */ | ||
76 | break; | ||
77 | } | ||
78 | |||
79 | mutex_unlock(&trig->lock); | ||
80 | } | ||
81 | EXPORT_SYMBOL(ledtrig_cpu); | ||
82 | |||
83 | static int ledtrig_cpu_syscore_suspend(void) | ||
84 | { | ||
85 | ledtrig_cpu(CPU_LED_STOP); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static void ledtrig_cpu_syscore_resume(void) | ||
90 | { | ||
91 | ledtrig_cpu(CPU_LED_START); | ||
92 | } | ||
93 | |||
94 | static void ledtrig_cpu_syscore_shutdown(void) | ||
95 | { | ||
96 | ledtrig_cpu(CPU_LED_HALTED); | ||
97 | } | ||
98 | |||
99 | static struct syscore_ops ledtrig_cpu_syscore_ops = { | ||
100 | .shutdown = ledtrig_cpu_syscore_shutdown, | ||
101 | .suspend = ledtrig_cpu_syscore_suspend, | ||
102 | .resume = ledtrig_cpu_syscore_resume, | ||
103 | }; | ||
104 | |||
105 | static int __init ledtrig_cpu_init(void) | ||
106 | { | ||
107 | int cpu; | ||
108 | |||
109 | /* Supports up to 9999 cpu cores */ | ||
110 | BUILD_BUG_ON(CONFIG_NR_CPUS > 9999); | ||
111 | |||
112 | /* | ||
113 | * Registering CPU led trigger for each CPU core here | ||
114 | * ignores CPU hotplug, but after this CPU hotplug works | ||
115 | * fine with this trigger. | ||
116 | */ | ||
117 | for_each_possible_cpu(cpu) { | ||
118 | struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); | ||
119 | |||
120 | mutex_init(&trig->lock); | ||
121 | |||
122 | snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu); | ||
123 | |||
124 | mutex_lock(&trig->lock); | ||
125 | led_trigger_register_simple(trig->name, &trig->_trig); | ||
126 | trig->lock_is_inited = 1; | ||
127 | mutex_unlock(&trig->lock); | ||
128 | } | ||
129 | |||
130 | register_syscore_ops(&ledtrig_cpu_syscore_ops); | ||
131 | |||
132 | pr_info("ledtrig-cpu: registered to indicate activity on CPUs\n"); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | module_init(ledtrig_cpu_init); | ||
137 | |||
138 | static void __exit ledtrig_cpu_exit(void) | ||
139 | { | ||
140 | int cpu; | ||
141 | |||
142 | for_each_possible_cpu(cpu) { | ||
143 | struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu); | ||
144 | |||
145 | mutex_lock(&trig->lock); | ||
146 | |||
147 | led_trigger_unregister_simple(trig->_trig); | ||
148 | trig->_trig = NULL; | ||
149 | memset(trig->name, 0, MAX_NAME_LEN); | ||
150 | trig->lock_is_inited = 0; | ||
151 | |||
152 | mutex_unlock(&trig->lock); | ||
153 | mutex_destroy(&trig->lock); | ||
154 | } | ||
155 | |||
156 | unregister_syscore_ops(&ledtrig_cpu_syscore_ops); | ||
157 | } | ||
158 | module_exit(ledtrig_cpu_exit); | ||
159 | |||
160 | MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); | ||
161 | MODULE_AUTHOR("Bryan Wu <bryan.wu@canonical.com>"); | ||
162 | MODULE_DESCRIPTION("CPU LED trigger"); | ||
163 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 8ca417614c57..598cd0a3adee 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -406,46 +406,6 @@ config MTD_NAND_ATMEL | |||
406 | help | 406 | help |
407 | Enables support for NAND Flash / Smart Media Card interface | 407 | Enables support for NAND Flash / Smart Media Card interface |
408 | on Atmel AT91 and AVR32 processors. | 408 | on Atmel AT91 and AVR32 processors. |
409 | choice | ||
410 | prompt "ECC management for NAND Flash / SmartMedia on AT91 / AVR32" | ||
411 | depends on MTD_NAND_ATMEL | ||
412 | |||
413 | config MTD_NAND_ATMEL_ECC_HW | ||
414 | bool "Hardware ECC" | ||
415 | depends on ARCH_AT91SAM9263 || ARCH_AT91SAM9260 || AVR32 | ||
416 | help | ||
417 | Use hardware ECC instead of software ECC when the chip | ||
418 | supports it. | ||
419 | |||
420 | The hardware ECC controller is capable of single bit error | ||
421 | correction and 2-bit random detection per page. | ||
422 | |||
423 | NB : hardware and software ECC schemes are incompatible. | ||
424 | If you switch from one to another, you'll have to erase your | ||
425 | mtd partition. | ||
426 | |||
427 | If unsure, say Y | ||
428 | |||
429 | config MTD_NAND_ATMEL_ECC_SOFT | ||
430 | bool "Software ECC" | ||
431 | help | ||
432 | Use software ECC. | ||
433 | |||
434 | NB : hardware and software ECC schemes are incompatible. | ||
435 | If you switch from one to another, you'll have to erase your | ||
436 | mtd partition. | ||
437 | |||
438 | config MTD_NAND_ATMEL_ECC_NONE | ||
439 | bool "No ECC (testing only, DANGEROUS)" | ||
440 | depends on DEBUG_KERNEL | ||
441 | help | ||
442 | No ECC will be used. | ||
443 | It's not a good idea and it should be reserved for testing | ||
444 | purpose only. | ||
445 | |||
446 | If unsure, say N | ||
447 | |||
448 | endchoice | ||
449 | 409 | ||
450 | config MTD_NAND_PXA3xx | 410 | config MTD_NAND_PXA3xx |
451 | tristate "Support for NAND flash devices on PXA3xx" | 411 | tristate "Support for NAND flash devices on PXA3xx" |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 54e3588bef62..34e94c7f68ca 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -145,6 +145,15 @@ config PINCTRL_COH901 | |||
145 | COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 | 145 | COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 |
146 | ports of 8 GPIO pins each. | 146 | ports of 8 GPIO pins each. |
147 | 147 | ||
148 | config PINCTRL_SAMSUNG | ||
149 | bool "Samsung pinctrl driver" | ||
150 | select PINMUX | ||
151 | select PINCONF | ||
152 | |||
153 | config PINCTRL_EXYNOS4 | ||
154 | bool "Pinctrl driver data for Exynos4 SoC" | ||
155 | select PINCTRL_SAMSUNG | ||
156 | |||
148 | source "drivers/pinctrl/spear/Kconfig" | 157 | source "drivers/pinctrl/spear/Kconfig" |
149 | 158 | ||
150 | endmenu | 159 | endmenu |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index f40b1f81ff2c..6a88113e11d9 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -29,5 +29,7 @@ obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o | |||
29 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o | 29 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o |
30 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o | 30 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o |
31 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o | 31 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o |
32 | obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o | ||
33 | obj-$(CONFIG_PINCTRL_EXYNOS4) += pinctrl-exynos.o | ||
32 | 34 | ||
33 | obj-$(CONFIG_PLAT_SPEAR) += spear/ | 35 | obj-$(CONFIG_PLAT_SPEAR) += spear/ |
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c new file mode 100644 index 000000000000..21362f48d370 --- /dev/null +++ b/drivers/pinctrl/pinctrl-exynos.c | |||
@@ -0,0 +1,579 @@ | |||
1 | /* | ||
2 | * Exynos specific support for Samsung pinctrl/gpiolib driver with eint support. | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2012 Linaro Ltd | ||
7 | * http://www.linaro.org | ||
8 | * | ||
9 | * Author: Thomas Abraham <thomas.ab@samsung.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This file contains the Samsung Exynos specific information required by the | ||
17 | * the Samsung pinctrl/gpiolib driver. It also includes the implementation of | ||
18 | * external gpio and wakeup interrupt support. | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/irqdomain.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/of_irq.h> | ||
27 | #include <linux/io.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/err.h> | ||
30 | |||
31 | #include <asm/mach/irq.h> | ||
32 | |||
33 | #include "pinctrl-samsung.h" | ||
34 | #include "pinctrl-exynos.h" | ||
35 | |||
36 | /* list of external wakeup controllers supported */ | ||
37 | static const struct of_device_id exynos_wkup_irq_ids[] = { | ||
38 | { .compatible = "samsung,exynos4210-wakeup-eint", }, | ||
39 | }; | ||
40 | |||
41 | static void exynos_gpio_irq_unmask(struct irq_data *irqd) | ||
42 | { | ||
43 | struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; | ||
44 | struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); | ||
45 | unsigned long reg_mask = d->ctrl->geint_mask + edata->eint_offset; | ||
46 | unsigned long mask; | ||
47 | |||
48 | mask = readl(d->virt_base + reg_mask); | ||
49 | mask &= ~(1 << edata->pin); | ||
50 | writel(mask, d->virt_base + reg_mask); | ||
51 | } | ||
52 | |||
53 | static void exynos_gpio_irq_mask(struct irq_data *irqd) | ||
54 | { | ||
55 | struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; | ||
56 | struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); | ||
57 | unsigned long reg_mask = d->ctrl->geint_mask + edata->eint_offset; | ||
58 | unsigned long mask; | ||
59 | |||
60 | mask = readl(d->virt_base + reg_mask); | ||
61 | mask |= 1 << edata->pin; | ||
62 | writel(mask, d->virt_base + reg_mask); | ||
63 | } | ||
64 | |||
65 | static void exynos_gpio_irq_ack(struct irq_data *irqd) | ||
66 | { | ||
67 | struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; | ||
68 | struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); | ||
69 | unsigned long reg_pend = d->ctrl->geint_pend + edata->eint_offset; | ||
70 | |||
71 | writel(1 << edata->pin, d->virt_base + reg_pend); | ||
72 | } | ||
73 | |||
74 | static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) | ||
75 | { | ||
76 | struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; | ||
77 | struct samsung_pin_ctrl *ctrl = d->ctrl; | ||
78 | struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); | ||
79 | struct samsung_pin_bank *bank = edata->bank; | ||
80 | unsigned int shift = EXYNOS_EINT_CON_LEN * edata->pin; | ||
81 | unsigned int con, trig_type; | ||
82 | unsigned long reg_con = ctrl->geint_con + edata->eint_offset; | ||
83 | unsigned int mask; | ||
84 | |||
85 | switch (type) { | ||
86 | case IRQ_TYPE_EDGE_RISING: | ||
87 | trig_type = EXYNOS_EINT_EDGE_RISING; | ||
88 | break; | ||
89 | case IRQ_TYPE_EDGE_FALLING: | ||
90 | trig_type = EXYNOS_EINT_EDGE_FALLING; | ||
91 | break; | ||
92 | case IRQ_TYPE_EDGE_BOTH: | ||
93 | trig_type = EXYNOS_EINT_EDGE_BOTH; | ||
94 | break; | ||
95 | case IRQ_TYPE_LEVEL_HIGH: | ||
96 | trig_type = EXYNOS_EINT_LEVEL_HIGH; | ||
97 | break; | ||
98 | case IRQ_TYPE_LEVEL_LOW: | ||
99 | trig_type = EXYNOS_EINT_LEVEL_LOW; | ||
100 | break; | ||
101 | default: | ||
102 | pr_err("unsupported external interrupt type\n"); | ||
103 | return -EINVAL; | ||
104 | } | ||
105 | |||
106 | if (type & IRQ_TYPE_EDGE_BOTH) | ||
107 | __irq_set_handler_locked(irqd->irq, handle_edge_irq); | ||
108 | else | ||
109 | __irq_set_handler_locked(irqd->irq, handle_level_irq); | ||
110 | |||
111 | con = readl(d->virt_base + reg_con); | ||
112 | con &= ~(EXYNOS_EINT_CON_MASK << shift); | ||
113 | con |= trig_type << shift; | ||
114 | writel(con, d->virt_base + reg_con); | ||
115 | |||
116 | reg_con = bank->pctl_offset; | ||
117 | shift = edata->pin * bank->func_width; | ||
118 | mask = (1 << bank->func_width) - 1; | ||
119 | |||
120 | con = readl(d->virt_base + reg_con); | ||
121 | con &= ~(mask << shift); | ||
122 | con |= EXYNOS_EINT_FUNC << shift; | ||
123 | writel(con, d->virt_base + reg_con); | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * irq_chip for gpio interrupts. | ||
130 | */ | ||
131 | static struct irq_chip exynos_gpio_irq_chip = { | ||
132 | .name = "exynos_gpio_irq_chip", | ||
133 | .irq_unmask = exynos_gpio_irq_unmask, | ||
134 | .irq_mask = exynos_gpio_irq_mask, | ||
135 | .irq_ack = exynos_gpio_irq_ack, | ||
136 | .irq_set_type = exynos_gpio_irq_set_type, | ||
137 | }; | ||
138 | |||
139 | /* | ||
140 | * given a controller-local external gpio interrupt number, prepare the handler | ||
141 | * data for it. | ||
142 | */ | ||
143 | static struct exynos_geint_data *exynos_get_eint_data(irq_hw_number_t hw, | ||
144 | struct samsung_pinctrl_drv_data *d) | ||
145 | { | ||
146 | struct samsung_pin_bank *bank = d->ctrl->pin_banks; | ||
147 | struct exynos_geint_data *eint_data; | ||
148 | unsigned int nr_banks = d->ctrl->nr_banks, idx; | ||
149 | unsigned int irq_base = 0, eint_offset = 0; | ||
150 | |||
151 | if (hw >= d->ctrl->nr_gint) { | ||
152 | dev_err(d->dev, "unsupported ext-gpio interrupt\n"); | ||
153 | return NULL; | ||
154 | } | ||
155 | |||
156 | for (idx = 0; idx < nr_banks; idx++, bank++) { | ||
157 | if (bank->eint_type != EINT_TYPE_GPIO) | ||
158 | continue; | ||
159 | if ((hw >= irq_base) && (hw < (irq_base + bank->nr_pins))) | ||
160 | break; | ||
161 | irq_base += bank->nr_pins; | ||
162 | eint_offset += 4; | ||
163 | } | ||
164 | |||
165 | if (idx == nr_banks) { | ||
166 | dev_err(d->dev, "pin bank not found for ext-gpio interrupt\n"); | ||
167 | return NULL; | ||
168 | } | ||
169 | |||
170 | eint_data = devm_kzalloc(d->dev, sizeof(*eint_data), GFP_KERNEL); | ||
171 | if (!eint_data) { | ||
172 | dev_err(d->dev, "no memory for eint-gpio data\n"); | ||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | eint_data->bank = bank; | ||
177 | eint_data->pin = hw - irq_base; | ||
178 | eint_data->eint_offset = eint_offset; | ||
179 | return eint_data; | ||
180 | } | ||
181 | |||
182 | static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq, | ||
183 | irq_hw_number_t hw) | ||
184 | { | ||
185 | struct samsung_pinctrl_drv_data *d = h->host_data; | ||
186 | struct exynos_geint_data *eint_data; | ||
187 | |||
188 | eint_data = exynos_get_eint_data(hw, d); | ||
189 | if (!eint_data) | ||
190 | return -EINVAL; | ||
191 | |||
192 | irq_set_handler_data(virq, eint_data); | ||
193 | irq_set_chip_data(virq, h->host_data); | ||
194 | irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip, | ||
195 | handle_level_irq); | ||
196 | set_irq_flags(virq, IRQF_VALID); | ||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void exynos_gpio_irq_unmap(struct irq_domain *h, unsigned int virq) | ||
201 | { | ||
202 | struct samsung_pinctrl_drv_data *d = h->host_data; | ||
203 | struct exynos_geint_data *eint_data; | ||
204 | |||
205 | eint_data = irq_get_handler_data(virq); | ||
206 | devm_kfree(d->dev, eint_data); | ||
207 | } | ||
208 | |||
209 | /* | ||
210 | * irq domain callbacks for external gpio interrupt controller. | ||
211 | */ | ||
212 | static const struct irq_domain_ops exynos_gpio_irqd_ops = { | ||
213 | .map = exynos_gpio_irq_map, | ||
214 | .unmap = exynos_gpio_irq_unmap, | ||
215 | .xlate = irq_domain_xlate_twocell, | ||
216 | }; | ||
217 | |||
218 | static irqreturn_t exynos_eint_gpio_irq(int irq, void *data) | ||
219 | { | ||
220 | struct samsung_pinctrl_drv_data *d = data; | ||
221 | struct samsung_pin_ctrl *ctrl = d->ctrl; | ||
222 | struct samsung_pin_bank *bank = ctrl->pin_banks; | ||
223 | unsigned int svc, group, pin, virq; | ||
224 | |||
225 | svc = readl(d->virt_base + ctrl->svc); | ||
226 | group = EXYNOS_SVC_GROUP(svc); | ||
227 | pin = svc & EXYNOS_SVC_NUM_MASK; | ||
228 | |||
229 | if (!group) | ||
230 | return IRQ_HANDLED; | ||
231 | bank += (group - 1); | ||
232 | |||
233 | virq = irq_linear_revmap(d->gpio_irqd, bank->irq_base + pin); | ||
234 | if (!virq) | ||
235 | return IRQ_NONE; | ||
236 | generic_handle_irq(virq); | ||
237 | return IRQ_HANDLED; | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * exynos_eint_gpio_init() - setup handling of external gpio interrupts. | ||
242 | * @d: driver data of samsung pinctrl driver. | ||
243 | */ | ||
244 | static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d) | ||
245 | { | ||
246 | struct device *dev = d->dev; | ||
247 | unsigned int ret; | ||
248 | |||
249 | if (!d->irq) { | ||
250 | dev_err(dev, "irq number not available\n"); | ||
251 | return -EINVAL; | ||
252 | } | ||
253 | |||
254 | ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq, | ||
255 | 0, dev_name(dev), d); | ||
256 | if (ret) { | ||
257 | dev_err(dev, "irq request failed\n"); | ||
258 | return -ENXIO; | ||
259 | } | ||
260 | |||
261 | d->gpio_irqd = irq_domain_add_linear(dev->of_node, d->ctrl->nr_gint, | ||
262 | &exynos_gpio_irqd_ops, d); | ||
263 | if (!d->gpio_irqd) { | ||
264 | dev_err(dev, "gpio irq domain allocation failed\n"); | ||
265 | return -ENXIO; | ||
266 | } | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static void exynos_wkup_irq_unmask(struct irq_data *irqd) | ||
272 | { | ||
273 | struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd); | ||
274 | unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK; | ||
275 | unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1); | ||
276 | unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2); | ||
277 | unsigned long mask; | ||
278 | |||
279 | mask = readl(d->virt_base + reg_mask); | ||
280 | mask &= ~(1 << pin); | ||
281 | writel(mask, d->virt_base + reg_mask); | ||
282 | } | ||
283 | |||
284 | static void exynos_wkup_irq_mask(struct irq_data *irqd) | ||
285 | { | ||
286 | struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd); | ||
287 | unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK; | ||
288 | unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1); | ||
289 | unsigned long reg_mask = d->ctrl->weint_mask + (bank << 2); | ||
290 | unsigned long mask; | ||
291 | |||
292 | mask = readl(d->virt_base + reg_mask); | ||
293 | mask |= 1 << pin; | ||
294 | writel(mask, d->virt_base + reg_mask); | ||
295 | } | ||
296 | |||
297 | static void exynos_wkup_irq_ack(struct irq_data *irqd) | ||
298 | { | ||
299 | struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd); | ||
300 | unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK; | ||
301 | unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1); | ||
302 | unsigned long pend = d->ctrl->weint_pend + (bank << 2); | ||
303 | |||
304 | writel(1 << pin, d->virt_base + pend); | ||
305 | } | ||
306 | |||
307 | static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type) | ||
308 | { | ||
309 | struct samsung_pinctrl_drv_data *d = irq_data_get_irq_chip_data(irqd); | ||
310 | unsigned int bank = irqd->hwirq / EXYNOS_EINT_MAX_PER_BANK; | ||
311 | unsigned int pin = irqd->hwirq & (EXYNOS_EINT_MAX_PER_BANK - 1); | ||
312 | unsigned long reg_con = d->ctrl->weint_con + (bank << 2); | ||
313 | unsigned long shift = EXYNOS_EINT_CON_LEN * pin; | ||
314 | unsigned long con, trig_type; | ||
315 | |||
316 | switch (type) { | ||
317 | case IRQ_TYPE_EDGE_RISING: | ||
318 | trig_type = EXYNOS_EINT_EDGE_RISING; | ||
319 | break; | ||
320 | case IRQ_TYPE_EDGE_FALLING: | ||
321 | trig_type = EXYNOS_EINT_EDGE_FALLING; | ||
322 | break; | ||
323 | case IRQ_TYPE_EDGE_BOTH: | ||
324 | trig_type = EXYNOS_EINT_EDGE_BOTH; | ||
325 | break; | ||
326 | case IRQ_TYPE_LEVEL_HIGH: | ||
327 | trig_type = EXYNOS_EINT_LEVEL_HIGH; | ||
328 | break; | ||
329 | case IRQ_TYPE_LEVEL_LOW: | ||
330 | trig_type = EXYNOS_EINT_LEVEL_LOW; | ||
331 | break; | ||
332 | default: | ||
333 | pr_err("unsupported external interrupt type\n"); | ||
334 | return -EINVAL; | ||
335 | } | ||
336 | |||
337 | if (type & IRQ_TYPE_EDGE_BOTH) | ||
338 | __irq_set_handler_locked(irqd->irq, handle_edge_irq); | ||
339 | else | ||
340 | __irq_set_handler_locked(irqd->irq, handle_level_irq); | ||
341 | |||
342 | con = readl(d->virt_base + reg_con); | ||
343 | con &= ~(EXYNOS_EINT_CON_MASK << shift); | ||
344 | con |= trig_type << shift; | ||
345 | writel(con, d->virt_base + reg_con); | ||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | /* | ||
350 | * irq_chip for wakeup interrupts | ||
351 | */ | ||
352 | static struct irq_chip exynos_wkup_irq_chip = { | ||
353 | .name = "exynos_wkup_irq_chip", | ||
354 | .irq_unmask = exynos_wkup_irq_unmask, | ||
355 | .irq_mask = exynos_wkup_irq_mask, | ||
356 | .irq_ack = exynos_wkup_irq_ack, | ||
357 | .irq_set_type = exynos_wkup_irq_set_type, | ||
358 | }; | ||
359 | |||
360 | /* interrupt handler for wakeup interrupts 0..15 */ | ||
361 | static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc) | ||
362 | { | ||
363 | struct exynos_weint_data *eintd = irq_get_handler_data(irq); | ||
364 | struct irq_chip *chip = irq_get_chip(irq); | ||
365 | int eint_irq; | ||
366 | |||
367 | chained_irq_enter(chip, desc); | ||
368 | chip->irq_mask(&desc->irq_data); | ||
369 | |||
370 | if (chip->irq_ack) | ||
371 | chip->irq_ack(&desc->irq_data); | ||
372 | |||
373 | eint_irq = irq_linear_revmap(eintd->domain, eintd->irq); | ||
374 | generic_handle_irq(eint_irq); | ||
375 | chip->irq_unmask(&desc->irq_data); | ||
376 | chained_irq_exit(chip, desc); | ||
377 | } | ||
378 | |||
379 | static inline void exynos_irq_demux_eint(int irq_base, unsigned long pend, | ||
380 | struct irq_domain *domain) | ||
381 | { | ||
382 | unsigned int irq; | ||
383 | |||
384 | while (pend) { | ||
385 | irq = fls(pend) - 1; | ||
386 | generic_handle_irq(irq_find_mapping(domain, irq_base + irq)); | ||
387 | pend &= ~(1 << irq); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | /* interrupt handler for wakeup interrupt 16 */ | ||
392 | static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) | ||
393 | { | ||
394 | struct irq_chip *chip = irq_get_chip(irq); | ||
395 | struct exynos_weint_data *eintd = irq_get_handler_data(irq); | ||
396 | struct samsung_pinctrl_drv_data *d = eintd->domain->host_data; | ||
397 | unsigned long pend; | ||
398 | unsigned long mask; | ||
399 | |||
400 | chained_irq_enter(chip, desc); | ||
401 | pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8); | ||
402 | mask = readl(d->virt_base + d->ctrl->weint_mask + 0x8); | ||
403 | exynos_irq_demux_eint(16, pend & ~mask, eintd->domain); | ||
404 | pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC); | ||
405 | mask = readl(d->virt_base + d->ctrl->weint_mask + 0xC); | ||
406 | exynos_irq_demux_eint(24, pend & ~mask, eintd->domain); | ||
407 | chained_irq_exit(chip, desc); | ||
408 | } | ||
409 | |||
410 | static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq, | ||
411 | irq_hw_number_t hw) | ||
412 | { | ||
413 | irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq); | ||
414 | irq_set_chip_data(virq, h->host_data); | ||
415 | set_irq_flags(virq, IRQF_VALID); | ||
416 | return 0; | ||
417 | } | ||
418 | |||
419 | /* | ||
420 | * irq domain callbacks for external wakeup interrupt controller. | ||
421 | */ | ||
422 | static const struct irq_domain_ops exynos_wkup_irqd_ops = { | ||
423 | .map = exynos_wkup_irq_map, | ||
424 | .xlate = irq_domain_xlate_twocell, | ||
425 | }; | ||
426 | |||
427 | /* | ||
428 | * exynos_eint_wkup_init() - setup handling of external wakeup interrupts. | ||
429 | * @d: driver data of samsung pinctrl driver. | ||
430 | */ | ||
431 | static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) | ||
432 | { | ||
433 | struct device *dev = d->dev; | ||
434 | struct device_node *wkup_np = NULL; | ||
435 | struct device_node *np; | ||
436 | struct exynos_weint_data *weint_data; | ||
437 | int idx, irq; | ||
438 | |||
439 | for_each_child_of_node(dev->of_node, np) { | ||
440 | if (of_match_node(exynos_wkup_irq_ids, np)) { | ||
441 | wkup_np = np; | ||
442 | break; | ||
443 | } | ||
444 | } | ||
445 | if (!wkup_np) | ||
446 | return -ENODEV; | ||
447 | |||
448 | d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint, | ||
449 | &exynos_wkup_irqd_ops, d); | ||
450 | if (!d->wkup_irqd) { | ||
451 | dev_err(dev, "wakeup irq domain allocation failed\n"); | ||
452 | return -ENXIO; | ||
453 | } | ||
454 | |||
455 | weint_data = devm_kzalloc(dev, sizeof(*weint_data) * 17, GFP_KERNEL); | ||
456 | if (!weint_data) { | ||
457 | dev_err(dev, "could not allocate memory for weint_data\n"); | ||
458 | return -ENOMEM; | ||
459 | } | ||
460 | |||
461 | irq = irq_of_parse_and_map(wkup_np, 16); | ||
462 | if (irq) { | ||
463 | weint_data[16].domain = d->wkup_irqd; | ||
464 | irq_set_chained_handler(irq, exynos_irq_demux_eint16_31); | ||
465 | irq_set_handler_data(irq, &weint_data[16]); | ||
466 | } else { | ||
467 | dev_err(dev, "irq number for EINT16-32 not found\n"); | ||
468 | } | ||
469 | |||
470 | for (idx = 0; idx < 16; idx++) { | ||
471 | weint_data[idx].domain = d->wkup_irqd; | ||
472 | weint_data[idx].irq = idx; | ||
473 | |||
474 | irq = irq_of_parse_and_map(wkup_np, idx); | ||
475 | if (irq) { | ||
476 | irq_set_handler_data(irq, &weint_data[idx]); | ||
477 | irq_set_chained_handler(irq, exynos_irq_eint0_15); | ||
478 | } else { | ||
479 | dev_err(dev, "irq number for eint-%x not found\n", idx); | ||
480 | } | ||
481 | } | ||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | /* pin banks of exynos4210 pin-controller 0 */ | ||
486 | static struct samsung_pin_bank exynos4210_pin_banks0[] = { | ||
487 | EXYNOS_PIN_BANK_EINTG(0x000, EXYNOS4210_GPIO_A0, "gpa0"), | ||
488 | EXYNOS_PIN_BANK_EINTG(0x020, EXYNOS4210_GPIO_A1, "gpa1"), | ||
489 | EXYNOS_PIN_BANK_EINTG(0x040, EXYNOS4210_GPIO_B, "gpb"), | ||
490 | EXYNOS_PIN_BANK_EINTG(0x060, EXYNOS4210_GPIO_C0, "gpc0"), | ||
491 | EXYNOS_PIN_BANK_EINTG(0x080, EXYNOS4210_GPIO_C1, "gpc1"), | ||
492 | EXYNOS_PIN_BANK_EINTG(0x0A0, EXYNOS4210_GPIO_D0, "gpd0"), | ||
493 | EXYNOS_PIN_BANK_EINTG(0x0C0, EXYNOS4210_GPIO_D1, "gpd1"), | ||
494 | EXYNOS_PIN_BANK_EINTG(0x0E0, EXYNOS4210_GPIO_E0, "gpe0"), | ||
495 | EXYNOS_PIN_BANK_EINTG(0x100, EXYNOS4210_GPIO_E1, "gpe1"), | ||
496 | EXYNOS_PIN_BANK_EINTG(0x120, EXYNOS4210_GPIO_E2, "gpe2"), | ||
497 | EXYNOS_PIN_BANK_EINTG(0x140, EXYNOS4210_GPIO_E3, "gpe3"), | ||
498 | EXYNOS_PIN_BANK_EINTG(0x160, EXYNOS4210_GPIO_E4, "gpe4"), | ||
499 | EXYNOS_PIN_BANK_EINTG(0x180, EXYNOS4210_GPIO_F0, "gpf0"), | ||
500 | EXYNOS_PIN_BANK_EINTG(0x1A0, EXYNOS4210_GPIO_F1, "gpf1"), | ||
501 | EXYNOS_PIN_BANK_EINTG(0x1C0, EXYNOS4210_GPIO_F2, "gpf2"), | ||
502 | EXYNOS_PIN_BANK_EINTG(0x1E0, EXYNOS4210_GPIO_F3, "gpf3"), | ||
503 | }; | ||
504 | |||
505 | /* pin banks of exynos4210 pin-controller 1 */ | ||
506 | static struct samsung_pin_bank exynos4210_pin_banks1[] = { | ||
507 | EXYNOS_PIN_BANK_EINTG(0x000, EXYNOS4210_GPIO_J0, "gpj0"), | ||
508 | EXYNOS_PIN_BANK_EINTG(0x020, EXYNOS4210_GPIO_J1, "gpj1"), | ||
509 | EXYNOS_PIN_BANK_EINTG(0x040, EXYNOS4210_GPIO_K0, "gpk0"), | ||
510 | EXYNOS_PIN_BANK_EINTG(0x060, EXYNOS4210_GPIO_K1, "gpk1"), | ||
511 | EXYNOS_PIN_BANK_EINTG(0x080, EXYNOS4210_GPIO_K2, "gpk2"), | ||
512 | EXYNOS_PIN_BANK_EINTG(0x0A0, EXYNOS4210_GPIO_K3, "gpk3"), | ||
513 | EXYNOS_PIN_BANK_EINTG(0x0C0, EXYNOS4210_GPIO_L0, "gpl0"), | ||
514 | EXYNOS_PIN_BANK_EINTG(0x0E0, EXYNOS4210_GPIO_L1, "gpl1"), | ||
515 | EXYNOS_PIN_BANK_EINTG(0x100, EXYNOS4210_GPIO_L2, "gpl2"), | ||
516 | EXYNOS_PIN_BANK_EINTN(0x120, EXYNOS4210_GPIO_Y0, "gpy0"), | ||
517 | EXYNOS_PIN_BANK_EINTN(0x140, EXYNOS4210_GPIO_Y1, "gpy1"), | ||
518 | EXYNOS_PIN_BANK_EINTN(0x160, EXYNOS4210_GPIO_Y2, "gpy2"), | ||
519 | EXYNOS_PIN_BANK_EINTN(0x180, EXYNOS4210_GPIO_Y3, "gpy3"), | ||
520 | EXYNOS_PIN_BANK_EINTN(0x1A0, EXYNOS4210_GPIO_Y4, "gpy4"), | ||
521 | EXYNOS_PIN_BANK_EINTN(0x1C0, EXYNOS4210_GPIO_Y5, "gpy5"), | ||
522 | EXYNOS_PIN_BANK_EINTN(0x1E0, EXYNOS4210_GPIO_Y6, "gpy6"), | ||
523 | EXYNOS_PIN_BANK_EINTN(0xC00, EXYNOS4210_GPIO_X0, "gpx0"), | ||
524 | EXYNOS_PIN_BANK_EINTN(0xC20, EXYNOS4210_GPIO_X1, "gpx1"), | ||
525 | EXYNOS_PIN_BANK_EINTN(0xC40, EXYNOS4210_GPIO_X2, "gpx2"), | ||
526 | EXYNOS_PIN_BANK_EINTN(0xC60, EXYNOS4210_GPIO_X3, "gpx3"), | ||
527 | }; | ||
528 | |||
529 | /* pin banks of exynos4210 pin-controller 2 */ | ||
530 | static struct samsung_pin_bank exynos4210_pin_banks2[] = { | ||
531 | EXYNOS_PIN_BANK_EINTN(0x000, EXYNOS4210_GPIO_Z, "gpz"), | ||
532 | }; | ||
533 | |||
534 | /* | ||
535 | * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes | ||
536 | * three gpio/pin-mux/pinconfig controllers. | ||
537 | */ | ||
538 | struct samsung_pin_ctrl exynos4210_pin_ctrl[] = { | ||
539 | { | ||
540 | /* pin-controller instance 0 data */ | ||
541 | .pin_banks = exynos4210_pin_banks0, | ||
542 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0), | ||
543 | .base = EXYNOS4210_GPIO_A0_START, | ||
544 | .nr_pins = EXYNOS4210_GPIOA_NR_PINS, | ||
545 | .nr_gint = EXYNOS4210_GPIOA_NR_GINT, | ||
546 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
547 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
548 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
549 | .svc = EXYNOS_SVC_OFFSET, | ||
550 | .eint_gpio_init = exynos_eint_gpio_init, | ||
551 | .label = "exynos4210-gpio-ctrl0", | ||
552 | }, { | ||
553 | /* pin-controller instance 1 data */ | ||
554 | .pin_banks = exynos4210_pin_banks1, | ||
555 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1), | ||
556 | .base = EXYNOS4210_GPIOA_NR_PINS, | ||
557 | .nr_pins = EXYNOS4210_GPIOB_NR_PINS, | ||
558 | .nr_gint = EXYNOS4210_GPIOB_NR_GINT, | ||
559 | .nr_wint = 32, | ||
560 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
561 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
562 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
563 | .weint_con = EXYNOS_WKUP_ECON_OFFSET, | ||
564 | .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, | ||
565 | .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, | ||
566 | .svc = EXYNOS_SVC_OFFSET, | ||
567 | .eint_gpio_init = exynos_eint_gpio_init, | ||
568 | .eint_wkup_init = exynos_eint_wkup_init, | ||
569 | .label = "exynos4210-gpio-ctrl1", | ||
570 | }, { | ||
571 | /* pin-controller instance 2 data */ | ||
572 | .pin_banks = exynos4210_pin_banks2, | ||
573 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2), | ||
574 | .base = EXYNOS4210_GPIOA_NR_PINS + | ||
575 | EXYNOS4210_GPIOB_NR_PINS, | ||
576 | .nr_pins = EXYNOS4210_GPIOC_NR_PINS, | ||
577 | .label = "exynos4210-gpio-ctrl2", | ||
578 | }, | ||
579 | }; | ||
diff --git a/drivers/pinctrl/pinctrl-exynos.h b/drivers/pinctrl/pinctrl-exynos.h new file mode 100644 index 000000000000..31d0a06174e4 --- /dev/null +++ b/drivers/pinctrl/pinctrl-exynos.h | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * Exynos specific definitions for Samsung pinctrl and gpiolib driver. | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2012 Linaro Ltd | ||
7 | * http://www.linaro.org | ||
8 | * | ||
9 | * This file contains the Exynos specific definitions for the Samsung | ||
10 | * pinctrl/gpiolib interface drivers. | ||
11 | * | ||
12 | * Author: Thomas Abraham <thomas.ab@samsung.com> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | */ | ||
19 | |||
20 | #define EXYNOS_GPIO_START(__gpio) ((__gpio##_START) + (__gpio##_NR)) | ||
21 | |||
22 | #define EXYNOS4210_GPIO_A0_NR (8) | ||
23 | #define EXYNOS4210_GPIO_A1_NR (6) | ||
24 | #define EXYNOS4210_GPIO_B_NR (8) | ||
25 | #define EXYNOS4210_GPIO_C0_NR (5) | ||
26 | #define EXYNOS4210_GPIO_C1_NR (5) | ||
27 | #define EXYNOS4210_GPIO_D0_NR (4) | ||
28 | #define EXYNOS4210_GPIO_D1_NR (4) | ||
29 | #define EXYNOS4210_GPIO_E0_NR (5) | ||
30 | #define EXYNOS4210_GPIO_E1_NR (8) | ||
31 | #define EXYNOS4210_GPIO_E2_NR (6) | ||
32 | #define EXYNOS4210_GPIO_E3_NR (8) | ||
33 | #define EXYNOS4210_GPIO_E4_NR (8) | ||
34 | #define EXYNOS4210_GPIO_F0_NR (8) | ||
35 | #define EXYNOS4210_GPIO_F1_NR (8) | ||
36 | #define EXYNOS4210_GPIO_F2_NR (8) | ||
37 | #define EXYNOS4210_GPIO_F3_NR (6) | ||
38 | #define EXYNOS4210_GPIO_J0_NR (8) | ||
39 | #define EXYNOS4210_GPIO_J1_NR (5) | ||
40 | #define EXYNOS4210_GPIO_K0_NR (7) | ||
41 | #define EXYNOS4210_GPIO_K1_NR (7) | ||
42 | #define EXYNOS4210_GPIO_K2_NR (7) | ||
43 | #define EXYNOS4210_GPIO_K3_NR (7) | ||
44 | #define EXYNOS4210_GPIO_L0_NR (8) | ||
45 | #define EXYNOS4210_GPIO_L1_NR (3) | ||
46 | #define EXYNOS4210_GPIO_L2_NR (8) | ||
47 | #define EXYNOS4210_GPIO_Y0_NR (6) | ||
48 | #define EXYNOS4210_GPIO_Y1_NR (4) | ||
49 | #define EXYNOS4210_GPIO_Y2_NR (6) | ||
50 | #define EXYNOS4210_GPIO_Y3_NR (8) | ||
51 | #define EXYNOS4210_GPIO_Y4_NR (8) | ||
52 | #define EXYNOS4210_GPIO_Y5_NR (8) | ||
53 | #define EXYNOS4210_GPIO_Y6_NR (8) | ||
54 | #define EXYNOS4210_GPIO_X0_NR (8) | ||
55 | #define EXYNOS4210_GPIO_X1_NR (8) | ||
56 | #define EXYNOS4210_GPIO_X2_NR (8) | ||
57 | #define EXYNOS4210_GPIO_X3_NR (8) | ||
58 | #define EXYNOS4210_GPIO_Z_NR (7) | ||
59 | |||
60 | enum exynos4210_gpio_xa_start { | ||
61 | EXYNOS4210_GPIO_A0_START = 0, | ||
62 | EXYNOS4210_GPIO_A1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_A0), | ||
63 | EXYNOS4210_GPIO_B_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_A1), | ||
64 | EXYNOS4210_GPIO_C0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_B), | ||
65 | EXYNOS4210_GPIO_C1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_C0), | ||
66 | EXYNOS4210_GPIO_D0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_C1), | ||
67 | EXYNOS4210_GPIO_D1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_D0), | ||
68 | EXYNOS4210_GPIO_E0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_D1), | ||
69 | EXYNOS4210_GPIO_E1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_E0), | ||
70 | EXYNOS4210_GPIO_E2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_E1), | ||
71 | EXYNOS4210_GPIO_E3_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_E2), | ||
72 | EXYNOS4210_GPIO_E4_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_E3), | ||
73 | EXYNOS4210_GPIO_F0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_E4), | ||
74 | EXYNOS4210_GPIO_F1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_F0), | ||
75 | EXYNOS4210_GPIO_F2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_F1), | ||
76 | EXYNOS4210_GPIO_F3_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_F2), | ||
77 | }; | ||
78 | |||
79 | enum exynos4210_gpio_xb_start { | ||
80 | EXYNOS4210_GPIO_J0_START = 0, | ||
81 | EXYNOS4210_GPIO_J1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_J0), | ||
82 | EXYNOS4210_GPIO_K0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_J1), | ||
83 | EXYNOS4210_GPIO_K1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_K0), | ||
84 | EXYNOS4210_GPIO_K2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_K1), | ||
85 | EXYNOS4210_GPIO_K3_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_K2), | ||
86 | EXYNOS4210_GPIO_L0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_K3), | ||
87 | EXYNOS4210_GPIO_L1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_L0), | ||
88 | EXYNOS4210_GPIO_L2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_L1), | ||
89 | EXYNOS4210_GPIO_Y0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_L2), | ||
90 | EXYNOS4210_GPIO_Y1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y0), | ||
91 | EXYNOS4210_GPIO_Y2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y1), | ||
92 | EXYNOS4210_GPIO_Y3_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y2), | ||
93 | EXYNOS4210_GPIO_Y4_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y3), | ||
94 | EXYNOS4210_GPIO_Y5_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y4), | ||
95 | EXYNOS4210_GPIO_Y6_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y5), | ||
96 | EXYNOS4210_GPIO_X0_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_Y6), | ||
97 | EXYNOS4210_GPIO_X1_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_X0), | ||
98 | EXYNOS4210_GPIO_X2_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_X1), | ||
99 | EXYNOS4210_GPIO_X3_START = EXYNOS_GPIO_START(EXYNOS4210_GPIO_X2), | ||
100 | }; | ||
101 | |||
102 | enum exynos4210_gpio_xc_start { | ||
103 | EXYNOS4210_GPIO_Z_START = 0, | ||
104 | }; | ||
105 | |||
106 | #define EXYNOS4210_GPIO_A0_IRQ EXYNOS4210_GPIO_A0_START | ||
107 | #define EXYNOS4210_GPIO_A1_IRQ EXYNOS4210_GPIO_A1_START | ||
108 | #define EXYNOS4210_GPIO_B_IRQ EXYNOS4210_GPIO_B_START | ||
109 | #define EXYNOS4210_GPIO_C0_IRQ EXYNOS4210_GPIO_C0_START | ||
110 | #define EXYNOS4210_GPIO_C1_IRQ EXYNOS4210_GPIO_C1_START | ||
111 | #define EXYNOS4210_GPIO_D0_IRQ EXYNOS4210_GPIO_D0_START | ||
112 | #define EXYNOS4210_GPIO_D1_IRQ EXYNOS4210_GPIO_D1_START | ||
113 | #define EXYNOS4210_GPIO_E0_IRQ EXYNOS4210_GPIO_E0_START | ||
114 | #define EXYNOS4210_GPIO_E1_IRQ EXYNOS4210_GPIO_E1_START | ||
115 | #define EXYNOS4210_GPIO_E2_IRQ EXYNOS4210_GPIO_E2_START | ||
116 | #define EXYNOS4210_GPIO_E3_IRQ EXYNOS4210_GPIO_E3_START | ||
117 | #define EXYNOS4210_GPIO_E4_IRQ EXYNOS4210_GPIO_E4_START | ||
118 | #define EXYNOS4210_GPIO_F0_IRQ EXYNOS4210_GPIO_F0_START | ||
119 | #define EXYNOS4210_GPIO_F1_IRQ EXYNOS4210_GPIO_F1_START | ||
120 | #define EXYNOS4210_GPIO_F2_IRQ EXYNOS4210_GPIO_F2_START | ||
121 | #define EXYNOS4210_GPIO_F3_IRQ EXYNOS4210_GPIO_F3_START | ||
122 | #define EXYNOS4210_GPIO_J0_IRQ EXYNOS4210_GPIO_J0_START | ||
123 | #define EXYNOS4210_GPIO_J1_IRQ EXYNOS4210_GPIO_J1_START | ||
124 | #define EXYNOS4210_GPIO_K0_IRQ EXYNOS4210_GPIO_K0_START | ||
125 | #define EXYNOS4210_GPIO_K1_IRQ EXYNOS4210_GPIO_K1_START | ||
126 | #define EXYNOS4210_GPIO_K2_IRQ EXYNOS4210_GPIO_K2_START | ||
127 | #define EXYNOS4210_GPIO_K3_IRQ EXYNOS4210_GPIO_K3_START | ||
128 | #define EXYNOS4210_GPIO_L0_IRQ EXYNOS4210_GPIO_L0_START | ||
129 | #define EXYNOS4210_GPIO_L1_IRQ EXYNOS4210_GPIO_L1_START | ||
130 | #define EXYNOS4210_GPIO_L2_IRQ EXYNOS4210_GPIO_L2_START | ||
131 | #define EXYNOS4210_GPIO_Z_IRQ EXYNOS4210_GPIO_Z_START | ||
132 | |||
133 | #define EXYNOS4210_GPIOA_NR_PINS EXYNOS_GPIO_START(EXYNOS4210_GPIO_F3) | ||
134 | #define EXYNOS4210_GPIOA_NR_GINT EXYNOS_GPIO_START(EXYNOS4210_GPIO_F3) | ||
135 | #define EXYNOS4210_GPIOB_NR_PINS EXYNOS_GPIO_START(EXYNOS4210_GPIO_X3) | ||
136 | #define EXYNOS4210_GPIOB_NR_GINT EXYNOS_GPIO_START(EXYNOS4210_GPIO_L2) | ||
137 | #define EXYNOS4210_GPIOC_NR_PINS EXYNOS_GPIO_START(EXYNOS4210_GPIO_Z) | ||
138 | |||
139 | /* External GPIO and wakeup interrupt related definitions */ | ||
140 | #define EXYNOS_GPIO_ECON_OFFSET 0x700 | ||
141 | #define EXYNOS_GPIO_EMASK_OFFSET 0x900 | ||
142 | #define EXYNOS_GPIO_EPEND_OFFSET 0xA00 | ||
143 | #define EXYNOS_WKUP_ECON_OFFSET 0xE00 | ||
144 | #define EXYNOS_WKUP_EMASK_OFFSET 0xF00 | ||
145 | #define EXYNOS_WKUP_EPEND_OFFSET 0xF40 | ||
146 | #define EXYNOS_SVC_OFFSET 0xB08 | ||
147 | #define EXYNOS_EINT_FUNC 0xF | ||
148 | |||
149 | /* helpers to access interrupt service register */ | ||
150 | #define EXYNOS_SVC_GROUP_SHIFT 3 | ||
151 | #define EXYNOS_SVC_GROUP_MASK 0x1f | ||
152 | #define EXYNOS_SVC_NUM_MASK 7 | ||
153 | #define EXYNOS_SVC_GROUP(x) ((x >> EXYNOS_SVC_GROUP_SHIFT) & \ | ||
154 | EXYNOS_SVC_GROUP_MASK) | ||
155 | |||
156 | /* Exynos specific external interrupt trigger types */ | ||
157 | #define EXYNOS_EINT_LEVEL_LOW 0 | ||
158 | #define EXYNOS_EINT_LEVEL_HIGH 1 | ||
159 | #define EXYNOS_EINT_EDGE_FALLING 2 | ||
160 | #define EXYNOS_EINT_EDGE_RISING 3 | ||
161 | #define EXYNOS_EINT_EDGE_BOTH 4 | ||
162 | #define EXYNOS_EINT_CON_MASK 0xF | ||
163 | #define EXYNOS_EINT_CON_LEN 4 | ||
164 | |||
165 | #define EXYNOS_EINT_MAX_PER_BANK 8 | ||
166 | #define EXYNOS_EINT_NR_WKUP_EINT | ||
167 | |||
168 | #define EXYNOS_PIN_BANK_EINTN(reg, __gpio, id) \ | ||
169 | { \ | ||
170 | .pctl_offset = reg, \ | ||
171 | .pin_base = (__gpio##_START), \ | ||
172 | .nr_pins = (__gpio##_NR), \ | ||
173 | .func_width = 4, \ | ||
174 | .pud_width = 2, \ | ||
175 | .drv_width = 2, \ | ||
176 | .conpdn_width = 2, \ | ||
177 | .pudpdn_width = 2, \ | ||
178 | .eint_type = EINT_TYPE_NONE, \ | ||
179 | .name = id \ | ||
180 | } | ||
181 | |||
182 | #define EXYNOS_PIN_BANK_EINTG(reg, __gpio, id) \ | ||
183 | { \ | ||
184 | .pctl_offset = reg, \ | ||
185 | .pin_base = (__gpio##_START), \ | ||
186 | .nr_pins = (__gpio##_NR), \ | ||
187 | .func_width = 4, \ | ||
188 | .pud_width = 2, \ | ||
189 | .drv_width = 2, \ | ||
190 | .conpdn_width = 2, \ | ||
191 | .pudpdn_width = 2, \ | ||
192 | .eint_type = EINT_TYPE_GPIO, \ | ||
193 | .irq_base = (__gpio##_IRQ), \ | ||
194 | .name = id \ | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * struct exynos_geint_data: gpio eint specific data for irq_chip callbacks. | ||
199 | * @bank: pin bank from which this gpio interrupt originates. | ||
200 | * @pin: pin number within the bank. | ||
201 | * @eint_offset: offset to be added to the con/pend/mask register bank base. | ||
202 | */ | ||
203 | struct exynos_geint_data { | ||
204 | struct samsung_pin_bank *bank; | ||
205 | u32 pin; | ||
206 | u32 eint_offset; | ||
207 | }; | ||
208 | |||
209 | /** | ||
210 | * struct exynos_weint_data: irq specific data for all the wakeup interrupts | ||
211 | * generated by the external wakeup interrupt controller. | ||
212 | * @domain: irq domain representing the external wakeup interrupts | ||
213 | * @irq: interrupt number within the domain. | ||
214 | */ | ||
215 | struct exynos_weint_data { | ||
216 | struct irq_domain *domain; | ||
217 | u32 irq; | ||
218 | }; | ||
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c new file mode 100644 index 000000000000..dd108a94acf9 --- /dev/null +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -0,0 +1,888 @@ | |||
1 | /* | ||
2 | * pin-controller/pin-mux/pin-config/gpio-driver for Samsung's SoC's. | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2012 Linaro Ltd | ||
7 | * http://www.linaro.org | ||
8 | * | ||
9 | * Author: Thomas Abraham <thomas.ab@samsung.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This driver implements the Samsung pinctrl driver. It supports setting up of | ||
17 | * pinmux and pinconf configurations. The gpiolib interface is also included. | ||
18 | * External interrupt (gpio and wakeup) support are not included in this driver | ||
19 | * but provides extensions to which platform specific implementation of the gpio | ||
20 | * and wakeup interrupts can be hooked to. | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/err.h> | ||
28 | #include <linux/gpio.h> | ||
29 | |||
30 | #include "core.h" | ||
31 | #include "pinctrl-samsung.h" | ||
32 | |||
33 | #define GROUP_SUFFIX "-grp" | ||
34 | #define GSUFFIX_LEN sizeof(GROUP_SUFFIX) | ||
35 | #define FUNCTION_SUFFIX "-mux" | ||
36 | #define FSUFFIX_LEN sizeof(FUNCTION_SUFFIX) | ||
37 | |||
38 | /* list of all possible config options supported */ | ||
39 | struct pin_config { | ||
40 | char *prop_cfg; | ||
41 | unsigned int cfg_type; | ||
42 | } pcfgs[] = { | ||
43 | { "samsung,pin-pud", PINCFG_TYPE_PUD }, | ||
44 | { "samsung,pin-drv", PINCFG_TYPE_DRV }, | ||
45 | { "samsung,pin-con-pdn", PINCFG_TYPE_CON_PDN }, | ||
46 | { "samsung,pin-pud-pdn", PINCFG_TYPE_PUD_PDN }, | ||
47 | }; | ||
48 | |||
49 | /* check if the selector is a valid pin group selector */ | ||
50 | static int samsung_get_group_count(struct pinctrl_dev *pctldev) | ||
51 | { | ||
52 | struct samsung_pinctrl_drv_data *drvdata; | ||
53 | |||
54 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
55 | return drvdata->nr_groups; | ||
56 | } | ||
57 | |||
58 | /* return the name of the group selected by the group selector */ | ||
59 | static const char *samsung_get_group_name(struct pinctrl_dev *pctldev, | ||
60 | unsigned selector) | ||
61 | { | ||
62 | struct samsung_pinctrl_drv_data *drvdata; | ||
63 | |||
64 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
65 | return drvdata->pin_groups[selector].name; | ||
66 | } | ||
67 | |||
68 | /* return the pin numbers associated with the specified group */ | ||
69 | static int samsung_get_group_pins(struct pinctrl_dev *pctldev, | ||
70 | unsigned selector, const unsigned **pins, unsigned *num_pins) | ||
71 | { | ||
72 | struct samsung_pinctrl_drv_data *drvdata; | ||
73 | |||
74 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
75 | *pins = drvdata->pin_groups[selector].pins; | ||
76 | *num_pins = drvdata->pin_groups[selector].num_pins; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | /* create pinctrl_map entries by parsing device tree nodes */ | ||
81 | static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, | ||
82 | struct device_node *np, struct pinctrl_map **maps, | ||
83 | unsigned *nmaps) | ||
84 | { | ||
85 | struct device *dev = pctldev->dev; | ||
86 | struct pinctrl_map *map; | ||
87 | unsigned long *cfg = NULL; | ||
88 | char *gname, *fname; | ||
89 | int cfg_cnt = 0, map_cnt = 0, idx = 0; | ||
90 | |||
91 | /* count the number of config options specfied in the node */ | ||
92 | for (idx = 0; idx < ARRAY_SIZE(pcfgs); idx++) { | ||
93 | if (of_find_property(np, pcfgs[idx].prop_cfg, NULL)) | ||
94 | cfg_cnt++; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Find out the number of map entries to create. All the config options | ||
99 | * can be accomadated into a single config map entry. | ||
100 | */ | ||
101 | if (cfg_cnt) | ||
102 | map_cnt = 1; | ||
103 | if (of_find_property(np, "samsung,pin-function", NULL)) | ||
104 | map_cnt++; | ||
105 | if (!map_cnt) { | ||
106 | dev_err(dev, "node %s does not have either config or function " | ||
107 | "configurations\n", np->name); | ||
108 | return -EINVAL; | ||
109 | } | ||
110 | |||
111 | /* Allocate memory for pin-map entries */ | ||
112 | map = kzalloc(sizeof(*map) * map_cnt, GFP_KERNEL); | ||
113 | if (!map) { | ||
114 | dev_err(dev, "could not alloc memory for pin-maps\n"); | ||
115 | return -ENOMEM; | ||
116 | } | ||
117 | *nmaps = 0; | ||
118 | |||
119 | /* | ||
120 | * Allocate memory for pin group name. The pin group name is derived | ||
121 | * from the node name from which these map entries are be created. | ||
122 | */ | ||
123 | gname = kzalloc(strlen(np->name) + GSUFFIX_LEN, GFP_KERNEL); | ||
124 | if (!gname) { | ||
125 | dev_err(dev, "failed to alloc memory for group name\n"); | ||
126 | goto free_map; | ||
127 | } | ||
128 | sprintf(gname, "%s%s", np->name, GROUP_SUFFIX); | ||
129 | |||
130 | /* | ||
131 | * don't have config options? then skip over to creating function | ||
132 | * map entries. | ||
133 | */ | ||
134 | if (!cfg_cnt) | ||
135 | goto skip_cfgs; | ||
136 | |||
137 | /* Allocate memory for config entries */ | ||
138 | cfg = kzalloc(sizeof(*cfg) * cfg_cnt, GFP_KERNEL); | ||
139 | if (!cfg) { | ||
140 | dev_err(dev, "failed to alloc memory for configs\n"); | ||
141 | goto free_gname; | ||
142 | } | ||
143 | |||
144 | /* Prepare a list of config settings */ | ||
145 | for (idx = 0, cfg_cnt = 0; idx < ARRAY_SIZE(pcfgs); idx++) { | ||
146 | u32 value; | ||
147 | if (!of_property_read_u32(np, pcfgs[idx].prop_cfg, &value)) | ||
148 | cfg[cfg_cnt++] = | ||
149 | PINCFG_PACK(pcfgs[idx].cfg_type, value); | ||
150 | } | ||
151 | |||
152 | /* create the config map entry */ | ||
153 | map[*nmaps].data.configs.group_or_pin = gname; | ||
154 | map[*nmaps].data.configs.configs = cfg; | ||
155 | map[*nmaps].data.configs.num_configs = cfg_cnt; | ||
156 | map[*nmaps].type = PIN_MAP_TYPE_CONFIGS_GROUP; | ||
157 | *nmaps += 1; | ||
158 | |||
159 | skip_cfgs: | ||
160 | /* create the function map entry */ | ||
161 | if (of_find_property(np, "samsung,pin-function", NULL)) { | ||
162 | fname = kzalloc(strlen(np->name) + FSUFFIX_LEN, GFP_KERNEL); | ||
163 | if (!fname) { | ||
164 | dev_err(dev, "failed to alloc memory for func name\n"); | ||
165 | goto free_cfg; | ||
166 | } | ||
167 | sprintf(fname, "%s%s", np->name, FUNCTION_SUFFIX); | ||
168 | |||
169 | map[*nmaps].data.mux.group = gname; | ||
170 | map[*nmaps].data.mux.function = fname; | ||
171 | map[*nmaps].type = PIN_MAP_TYPE_MUX_GROUP; | ||
172 | *nmaps += 1; | ||
173 | } | ||
174 | |||
175 | *maps = map; | ||
176 | return 0; | ||
177 | |||
178 | free_cfg: | ||
179 | kfree(cfg); | ||
180 | free_gname: | ||
181 | kfree(gname); | ||
182 | free_map: | ||
183 | kfree(map); | ||
184 | return -ENOMEM; | ||
185 | } | ||
186 | |||
187 | /* free the memory allocated to hold the pin-map table */ | ||
188 | static void samsung_dt_free_map(struct pinctrl_dev *pctldev, | ||
189 | struct pinctrl_map *map, unsigned num_maps) | ||
190 | { | ||
191 | int idx; | ||
192 | |||
193 | for (idx = 0; idx < num_maps; idx++) { | ||
194 | if (map[idx].type == PIN_MAP_TYPE_MUX_GROUP) { | ||
195 | kfree(map[idx].data.mux.function); | ||
196 | if (!idx) | ||
197 | kfree(map[idx].data.mux.group); | ||
198 | } else if (map->type == PIN_MAP_TYPE_CONFIGS_GROUP) { | ||
199 | kfree(map[idx].data.configs.configs); | ||
200 | if (!idx) | ||
201 | kfree(map[idx].data.configs.group_or_pin); | ||
202 | } | ||
203 | }; | ||
204 | |||
205 | kfree(map); | ||
206 | } | ||
207 | |||
208 | /* list of pinctrl callbacks for the pinctrl core */ | ||
209 | static struct pinctrl_ops samsung_pctrl_ops = { | ||
210 | .get_groups_count = samsung_get_group_count, | ||
211 | .get_group_name = samsung_get_group_name, | ||
212 | .get_group_pins = samsung_get_group_pins, | ||
213 | .dt_node_to_map = samsung_dt_node_to_map, | ||
214 | .dt_free_map = samsung_dt_free_map, | ||
215 | }; | ||
216 | |||
217 | /* check if the selector is a valid pin function selector */ | ||
218 | static int samsung_get_functions_count(struct pinctrl_dev *pctldev) | ||
219 | { | ||
220 | struct samsung_pinctrl_drv_data *drvdata; | ||
221 | |||
222 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
223 | return drvdata->nr_functions; | ||
224 | } | ||
225 | |||
226 | /* return the name of the pin function specified */ | ||
227 | static const char *samsung_pinmux_get_fname(struct pinctrl_dev *pctldev, | ||
228 | unsigned selector) | ||
229 | { | ||
230 | struct samsung_pinctrl_drv_data *drvdata; | ||
231 | |||
232 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
233 | return drvdata->pmx_functions[selector].name; | ||
234 | } | ||
235 | |||
236 | /* return the groups associated for the specified function selector */ | ||
237 | static int samsung_pinmux_get_groups(struct pinctrl_dev *pctldev, | ||
238 | unsigned selector, const char * const **groups, | ||
239 | unsigned * const num_groups) | ||
240 | { | ||
241 | struct samsung_pinctrl_drv_data *drvdata; | ||
242 | |||
243 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
244 | *groups = drvdata->pmx_functions[selector].groups; | ||
245 | *num_groups = drvdata->pmx_functions[selector].num_groups; | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | /* | ||
250 | * given a pin number that is local to a pin controller, find out the pin bank | ||
251 | * and the register base of the pin bank. | ||
252 | */ | ||
253 | static void pin_to_reg_bank(struct gpio_chip *gc, unsigned pin, | ||
254 | void __iomem **reg, u32 *offset, | ||
255 | struct samsung_pin_bank **bank) | ||
256 | { | ||
257 | struct samsung_pinctrl_drv_data *drvdata; | ||
258 | struct samsung_pin_bank *b; | ||
259 | |||
260 | drvdata = dev_get_drvdata(gc->dev); | ||
261 | b = drvdata->ctrl->pin_banks; | ||
262 | |||
263 | while ((pin >= b->pin_base) && | ||
264 | ((b->pin_base + b->nr_pins - 1) < pin)) | ||
265 | b++; | ||
266 | |||
267 | *reg = drvdata->virt_base + b->pctl_offset; | ||
268 | *offset = pin - b->pin_base; | ||
269 | if (bank) | ||
270 | *bank = b; | ||
271 | |||
272 | /* some banks have two config registers in a single bank */ | ||
273 | if (*offset * b->func_width > BITS_PER_LONG) | ||
274 | *reg += 4; | ||
275 | } | ||
276 | |||
277 | /* enable or disable a pinmux function */ | ||
278 | static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector, | ||
279 | unsigned group, bool enable) | ||
280 | { | ||
281 | struct samsung_pinctrl_drv_data *drvdata; | ||
282 | const unsigned int *pins; | ||
283 | struct samsung_pin_bank *bank; | ||
284 | void __iomem *reg; | ||
285 | u32 mask, shift, data, pin_offset, cnt; | ||
286 | |||
287 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
288 | pins = drvdata->pin_groups[group].pins; | ||
289 | |||
290 | /* | ||
291 | * for each pin in the pin group selected, program the correspoding pin | ||
292 | * pin function number in the config register. | ||
293 | */ | ||
294 | for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) { | ||
295 | pin_to_reg_bank(drvdata->gc, pins[cnt] - drvdata->ctrl->base, | ||
296 | ®, &pin_offset, &bank); | ||
297 | mask = (1 << bank->func_width) - 1; | ||
298 | shift = pin_offset * bank->func_width; | ||
299 | |||
300 | data = readl(reg); | ||
301 | data &= ~(mask << shift); | ||
302 | if (enable) | ||
303 | data |= drvdata->pin_groups[group].func << shift; | ||
304 | writel(data, reg); | ||
305 | } | ||
306 | } | ||
307 | |||
308 | /* enable a specified pinmux by writing to registers */ | ||
309 | static int samsung_pinmux_enable(struct pinctrl_dev *pctldev, unsigned selector, | ||
310 | unsigned group) | ||
311 | { | ||
312 | samsung_pinmux_setup(pctldev, selector, group, true); | ||
313 | return 0; | ||
314 | } | ||
315 | |||
316 | /* disable a specified pinmux by writing to registers */ | ||
317 | static void samsung_pinmux_disable(struct pinctrl_dev *pctldev, | ||
318 | unsigned selector, unsigned group) | ||
319 | { | ||
320 | samsung_pinmux_setup(pctldev, selector, group, false); | ||
321 | } | ||
322 | |||
323 | /* | ||
324 | * The calls to gpio_direction_output() and gpio_direction_input() | ||
325 | * leads to this function call (via the pinctrl_gpio_direction_{input|output}() | ||
326 | * function called from the gpiolib interface). | ||
327 | */ | ||
328 | static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, | ||
329 | struct pinctrl_gpio_range *range, unsigned offset, bool input) | ||
330 | { | ||
331 | struct samsung_pin_bank *bank; | ||
332 | void __iomem *reg; | ||
333 | u32 data, pin_offset, mask, shift; | ||
334 | |||
335 | pin_to_reg_bank(range->gc, offset, ®, &pin_offset, &bank); | ||
336 | mask = (1 << bank->func_width) - 1; | ||
337 | shift = pin_offset * bank->func_width; | ||
338 | |||
339 | data = readl(reg); | ||
340 | data &= ~(mask << shift); | ||
341 | if (!input) | ||
342 | data |= FUNC_OUTPUT << shift; | ||
343 | writel(data, reg); | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* list of pinmux callbacks for the pinmux vertical in pinctrl core */ | ||
348 | static struct pinmux_ops samsung_pinmux_ops = { | ||
349 | .get_functions_count = samsung_get_functions_count, | ||
350 | .get_function_name = samsung_pinmux_get_fname, | ||
351 | .get_function_groups = samsung_pinmux_get_groups, | ||
352 | .enable = samsung_pinmux_enable, | ||
353 | .disable = samsung_pinmux_disable, | ||
354 | .gpio_set_direction = samsung_pinmux_gpio_set_direction, | ||
355 | }; | ||
356 | |||
357 | /* set or get the pin config settings for a specified pin */ | ||
358 | static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin, | ||
359 | unsigned long *config, bool set) | ||
360 | { | ||
361 | struct samsung_pinctrl_drv_data *drvdata; | ||
362 | struct samsung_pin_bank *bank; | ||
363 | void __iomem *reg_base; | ||
364 | enum pincfg_type cfg_type = PINCFG_UNPACK_TYPE(*config); | ||
365 | u32 data, width, pin_offset, mask, shift; | ||
366 | u32 cfg_value, cfg_reg; | ||
367 | |||
368 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
369 | pin_to_reg_bank(drvdata->gc, pin - drvdata->ctrl->base, ®_base, | ||
370 | &pin_offset, &bank); | ||
371 | |||
372 | switch (cfg_type) { | ||
373 | case PINCFG_TYPE_PUD: | ||
374 | width = bank->pud_width; | ||
375 | cfg_reg = PUD_REG; | ||
376 | break; | ||
377 | case PINCFG_TYPE_DRV: | ||
378 | width = bank->drv_width; | ||
379 | cfg_reg = DRV_REG; | ||
380 | break; | ||
381 | case PINCFG_TYPE_CON_PDN: | ||
382 | width = bank->conpdn_width; | ||
383 | cfg_reg = CONPDN_REG; | ||
384 | break; | ||
385 | case PINCFG_TYPE_PUD_PDN: | ||
386 | width = bank->pudpdn_width; | ||
387 | cfg_reg = PUDPDN_REG; | ||
388 | break; | ||
389 | default: | ||
390 | WARN_ON(1); | ||
391 | return -EINVAL; | ||
392 | } | ||
393 | |||
394 | mask = (1 << width) - 1; | ||
395 | shift = pin_offset * width; | ||
396 | data = readl(reg_base + cfg_reg); | ||
397 | |||
398 | if (set) { | ||
399 | cfg_value = PINCFG_UNPACK_VALUE(*config); | ||
400 | data &= ~(mask << shift); | ||
401 | data |= (cfg_value << shift); | ||
402 | writel(data, reg_base + cfg_reg); | ||
403 | } else { | ||
404 | data >>= shift; | ||
405 | data &= mask; | ||
406 | *config = PINCFG_PACK(cfg_type, data); | ||
407 | } | ||
408 | return 0; | ||
409 | } | ||
410 | |||
411 | /* set the pin config settings for a specified pin */ | ||
412 | static int samsung_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, | ||
413 | unsigned long config) | ||
414 | { | ||
415 | return samsung_pinconf_rw(pctldev, pin, &config, true); | ||
416 | } | ||
417 | |||
418 | /* get the pin config settings for a specified pin */ | ||
419 | static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, | ||
420 | unsigned long *config) | ||
421 | { | ||
422 | return samsung_pinconf_rw(pctldev, pin, config, false); | ||
423 | } | ||
424 | |||
425 | /* set the pin config settings for a specified pin group */ | ||
426 | static int samsung_pinconf_group_set(struct pinctrl_dev *pctldev, | ||
427 | unsigned group, unsigned long config) | ||
428 | { | ||
429 | struct samsung_pinctrl_drv_data *drvdata; | ||
430 | const unsigned int *pins; | ||
431 | unsigned int cnt; | ||
432 | |||
433 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
434 | pins = drvdata->pin_groups[group].pins; | ||
435 | |||
436 | for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) | ||
437 | samsung_pinconf_set(pctldev, pins[cnt], config); | ||
438 | |||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | /* get the pin config settings for a specified pin group */ | ||
443 | static int samsung_pinconf_group_get(struct pinctrl_dev *pctldev, | ||
444 | unsigned int group, unsigned long *config) | ||
445 | { | ||
446 | struct samsung_pinctrl_drv_data *drvdata; | ||
447 | const unsigned int *pins; | ||
448 | |||
449 | drvdata = pinctrl_dev_get_drvdata(pctldev); | ||
450 | pins = drvdata->pin_groups[group].pins; | ||
451 | samsung_pinconf_get(pctldev, pins[0], config); | ||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | /* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ | ||
456 | static struct pinconf_ops samsung_pinconf_ops = { | ||
457 | .pin_config_get = samsung_pinconf_get, | ||
458 | .pin_config_set = samsung_pinconf_set, | ||
459 | .pin_config_group_get = samsung_pinconf_group_get, | ||
460 | .pin_config_group_set = samsung_pinconf_group_set, | ||
461 | }; | ||
462 | |||
463 | /* gpiolib gpio_set callback function */ | ||
464 | static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) | ||
465 | { | ||
466 | void __iomem *reg; | ||
467 | u32 pin_offset, data; | ||
468 | |||
469 | pin_to_reg_bank(gc, offset, ®, &pin_offset, NULL); | ||
470 | data = readl(reg + DAT_REG); | ||
471 | data &= ~(1 << pin_offset); | ||
472 | if (value) | ||
473 | data |= 1 << pin_offset; | ||
474 | writel(data, reg + DAT_REG); | ||
475 | } | ||
476 | |||
477 | /* gpiolib gpio_get callback function */ | ||
478 | static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) | ||
479 | { | ||
480 | void __iomem *reg; | ||
481 | u32 pin_offset, data; | ||
482 | |||
483 | pin_to_reg_bank(gc, offset, ®, &pin_offset, NULL); | ||
484 | data = readl(reg + DAT_REG); | ||
485 | data >>= pin_offset; | ||
486 | data &= 1; | ||
487 | return data; | ||
488 | } | ||
489 | |||
490 | /* | ||
491 | * gpiolib gpio_direction_input callback function. The setting of the pin | ||
492 | * mux function as 'gpio input' will be handled by the pinctrl susbsystem | ||
493 | * interface. | ||
494 | */ | ||
495 | static int samsung_gpio_direction_input(struct gpio_chip *gc, unsigned offset) | ||
496 | { | ||
497 | return pinctrl_gpio_direction_input(gc->base + offset); | ||
498 | } | ||
499 | |||
500 | /* | ||
501 | * gpiolib gpio_direction_output callback function. The setting of the pin | ||
502 | * mux function as 'gpio output' will be handled by the pinctrl susbsystem | ||
503 | * interface. | ||
504 | */ | ||
505 | static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, | ||
506 | int value) | ||
507 | { | ||
508 | samsung_gpio_set(gc, offset, value); | ||
509 | return pinctrl_gpio_direction_output(gc->base + offset); | ||
510 | } | ||
511 | |||
512 | /* | ||
513 | * Parse the pin names listed in the 'samsung,pins' property and convert it | ||
514 | * into a list of gpio numbers are create a pin group from it. | ||
515 | */ | ||
516 | static int __init samsung_pinctrl_parse_dt_pins(struct platform_device *pdev, | ||
517 | struct device_node *cfg_np, struct pinctrl_desc *pctl, | ||
518 | unsigned int **pin_list, unsigned int *npins) | ||
519 | { | ||
520 | struct device *dev = &pdev->dev; | ||
521 | struct property *prop; | ||
522 | struct pinctrl_pin_desc const *pdesc = pctl->pins; | ||
523 | unsigned int idx = 0, cnt; | ||
524 | const char *pin_name; | ||
525 | |||
526 | *npins = of_property_count_strings(cfg_np, "samsung,pins"); | ||
527 | if (*npins < 0) { | ||
528 | dev_err(dev, "invalid pin list in %s node", cfg_np->name); | ||
529 | return -EINVAL; | ||
530 | } | ||
531 | |||
532 | *pin_list = devm_kzalloc(dev, *npins * sizeof(**pin_list), GFP_KERNEL); | ||
533 | if (!*pin_list) { | ||
534 | dev_err(dev, "failed to allocate memory for pin list\n"); | ||
535 | return -ENOMEM; | ||
536 | } | ||
537 | |||
538 | of_property_for_each_string(cfg_np, "samsung,pins", prop, pin_name) { | ||
539 | for (cnt = 0; cnt < pctl->npins; cnt++) { | ||
540 | if (pdesc[cnt].name) { | ||
541 | if (!strcmp(pin_name, pdesc[cnt].name)) { | ||
542 | (*pin_list)[idx++] = pdesc[cnt].number; | ||
543 | break; | ||
544 | } | ||
545 | } | ||
546 | } | ||
547 | if (cnt == pctl->npins) { | ||
548 | dev_err(dev, "pin %s not valid in %s node\n", | ||
549 | pin_name, cfg_np->name); | ||
550 | devm_kfree(dev, *pin_list); | ||
551 | return -EINVAL; | ||
552 | } | ||
553 | } | ||
554 | |||
555 | return 0; | ||
556 | } | ||
557 | |||
558 | /* | ||
559 | * Parse the information about all the available pin groups and pin functions | ||
560 | * from device node of the pin-controller. A pin group is formed with all | ||
561 | * the pins listed in the "samsung,pins" property. | ||
562 | */ | ||
563 | static int __init samsung_pinctrl_parse_dt(struct platform_device *pdev, | ||
564 | struct samsung_pinctrl_drv_data *drvdata) | ||
565 | { | ||
566 | struct device *dev = &pdev->dev; | ||
567 | struct device_node *dev_np = dev->of_node; | ||
568 | struct device_node *cfg_np; | ||
569 | struct samsung_pin_group *groups, *grp; | ||
570 | struct samsung_pmx_func *functions, *func; | ||
571 | unsigned *pin_list; | ||
572 | unsigned int npins, grp_cnt, func_idx = 0; | ||
573 | char *gname, *fname; | ||
574 | int ret; | ||
575 | |||
576 | grp_cnt = of_get_child_count(dev_np); | ||
577 | if (!grp_cnt) | ||
578 | return -EINVAL; | ||
579 | |||
580 | groups = devm_kzalloc(dev, grp_cnt * sizeof(*groups), GFP_KERNEL); | ||
581 | if (!groups) { | ||
582 | dev_err(dev, "failed allocate memory for ping group list\n"); | ||
583 | return -EINVAL; | ||
584 | } | ||
585 | grp = groups; | ||
586 | |||
587 | functions = devm_kzalloc(dev, grp_cnt * sizeof(*functions), GFP_KERNEL); | ||
588 | if (!functions) { | ||
589 | dev_err(dev, "failed to allocate memory for function list\n"); | ||
590 | return -EINVAL; | ||
591 | } | ||
592 | func = functions; | ||
593 | |||
594 | /* | ||
595 | * Iterate over all the child nodes of the pin controller node | ||
596 | * and create pin groups and pin function lists. | ||
597 | */ | ||
598 | for_each_child_of_node(dev_np, cfg_np) { | ||
599 | u32 function; | ||
600 | if (of_find_property(cfg_np, "interrupt-controller", NULL)) | ||
601 | continue; | ||
602 | |||
603 | ret = samsung_pinctrl_parse_dt_pins(pdev, cfg_np, | ||
604 | &drvdata->pctl, &pin_list, &npins); | ||
605 | if (ret) | ||
606 | return ret; | ||
607 | |||
608 | /* derive pin group name from the node name */ | ||
609 | gname = devm_kzalloc(dev, strlen(cfg_np->name) + GSUFFIX_LEN, | ||
610 | GFP_KERNEL); | ||
611 | if (!gname) { | ||
612 | dev_err(dev, "failed to alloc memory for group name\n"); | ||
613 | return -ENOMEM; | ||
614 | } | ||
615 | sprintf(gname, "%s%s", cfg_np->name, GROUP_SUFFIX); | ||
616 | |||
617 | grp->name = gname; | ||
618 | grp->pins = pin_list; | ||
619 | grp->num_pins = npins; | ||
620 | of_property_read_u32(cfg_np, "samsung,pin-function", &function); | ||
621 | grp->func = function; | ||
622 | grp++; | ||
623 | |||
624 | if (!of_find_property(cfg_np, "samsung,pin-function", NULL)) | ||
625 | continue; | ||
626 | |||
627 | /* derive function name from the node name */ | ||
628 | fname = devm_kzalloc(dev, strlen(cfg_np->name) + FSUFFIX_LEN, | ||
629 | GFP_KERNEL); | ||
630 | if (!fname) { | ||
631 | dev_err(dev, "failed to alloc memory for func name\n"); | ||
632 | return -ENOMEM; | ||
633 | } | ||
634 | sprintf(fname, "%s%s", cfg_np->name, FUNCTION_SUFFIX); | ||
635 | |||
636 | func->name = fname; | ||
637 | func->groups = devm_kzalloc(dev, sizeof(char *), GFP_KERNEL); | ||
638 | if (!func->groups) { | ||
639 | dev_err(dev, "failed to alloc memory for group list " | ||
640 | "in pin function"); | ||
641 | return -ENOMEM; | ||
642 | } | ||
643 | func->groups[0] = gname; | ||
644 | func->num_groups = 1; | ||
645 | func++; | ||
646 | func_idx++; | ||
647 | } | ||
648 | |||
649 | drvdata->pin_groups = groups; | ||
650 | drvdata->nr_groups = grp_cnt; | ||
651 | drvdata->pmx_functions = functions; | ||
652 | drvdata->nr_functions = func_idx; | ||
653 | |||
654 | return 0; | ||
655 | } | ||
656 | |||
657 | /* register the pinctrl interface with the pinctrl subsystem */ | ||
658 | static int __init samsung_pinctrl_register(struct platform_device *pdev, | ||
659 | struct samsung_pinctrl_drv_data *drvdata) | ||
660 | { | ||
661 | struct pinctrl_desc *ctrldesc = &drvdata->pctl; | ||
662 | struct pinctrl_pin_desc *pindesc, *pdesc; | ||
663 | struct samsung_pin_bank *pin_bank; | ||
664 | char *pin_names; | ||
665 | int pin, bank, ret; | ||
666 | |||
667 | ctrldesc->name = "samsung-pinctrl"; | ||
668 | ctrldesc->owner = THIS_MODULE; | ||
669 | ctrldesc->pctlops = &samsung_pctrl_ops; | ||
670 | ctrldesc->pmxops = &samsung_pinmux_ops; | ||
671 | ctrldesc->confops = &samsung_pinconf_ops; | ||
672 | |||
673 | pindesc = devm_kzalloc(&pdev->dev, sizeof(*pindesc) * | ||
674 | drvdata->ctrl->nr_pins, GFP_KERNEL); | ||
675 | if (!pindesc) { | ||
676 | dev_err(&pdev->dev, "mem alloc for pin descriptors failed\n"); | ||
677 | return -ENOMEM; | ||
678 | } | ||
679 | ctrldesc->pins = pindesc; | ||
680 | ctrldesc->npins = drvdata->ctrl->nr_pins; | ||
681 | ctrldesc->npins = drvdata->ctrl->nr_pins; | ||
682 | |||
683 | /* dynamically populate the pin number and pin name for pindesc */ | ||
684 | for (pin = 0, pdesc = pindesc; pin < ctrldesc->npins; pin++, pdesc++) | ||
685 | pdesc->number = pin + drvdata->ctrl->base; | ||
686 | |||
687 | /* | ||
688 | * allocate space for storing the dynamically generated names for all | ||
689 | * the pins which belong to this pin-controller. | ||
690 | */ | ||
691 | pin_names = devm_kzalloc(&pdev->dev, sizeof(char) * PIN_NAME_LENGTH * | ||
692 | drvdata->ctrl->nr_pins, GFP_KERNEL); | ||
693 | if (!pin_names) { | ||
694 | dev_err(&pdev->dev, "mem alloc for pin names failed\n"); | ||
695 | return -ENOMEM; | ||
696 | } | ||
697 | |||
698 | /* for each pin, the name of the pin is pin-bank name + pin number */ | ||
699 | for (bank = 0; bank < drvdata->ctrl->nr_banks; bank++) { | ||
700 | pin_bank = &drvdata->ctrl->pin_banks[bank]; | ||
701 | for (pin = 0; pin < pin_bank->nr_pins; pin++) { | ||
702 | sprintf(pin_names, "%s-%d", pin_bank->name, pin); | ||
703 | pdesc = pindesc + pin_bank->pin_base + pin; | ||
704 | pdesc->name = pin_names; | ||
705 | pin_names += PIN_NAME_LENGTH; | ||
706 | } | ||
707 | } | ||
708 | |||
709 | drvdata->pctl_dev = pinctrl_register(ctrldesc, &pdev->dev, drvdata); | ||
710 | if (!drvdata->pctl_dev) { | ||
711 | dev_err(&pdev->dev, "could not register pinctrl driver\n"); | ||
712 | return -EINVAL; | ||
713 | } | ||
714 | |||
715 | drvdata->grange.name = "samsung-pctrl-gpio-range"; | ||
716 | drvdata->grange.id = 0; | ||
717 | drvdata->grange.base = drvdata->ctrl->base; | ||
718 | drvdata->grange.npins = drvdata->ctrl->nr_pins; | ||
719 | drvdata->grange.gc = drvdata->gc; | ||
720 | pinctrl_add_gpio_range(drvdata->pctl_dev, &drvdata->grange); | ||
721 | |||
722 | ret = samsung_pinctrl_parse_dt(pdev, drvdata); | ||
723 | if (ret) { | ||
724 | pinctrl_unregister(drvdata->pctl_dev); | ||
725 | return ret; | ||
726 | } | ||
727 | |||
728 | return 0; | ||
729 | } | ||
730 | |||
731 | /* register the gpiolib interface with the gpiolib subsystem */ | ||
732 | static int __init samsung_gpiolib_register(struct platform_device *pdev, | ||
733 | struct samsung_pinctrl_drv_data *drvdata) | ||
734 | { | ||
735 | struct gpio_chip *gc; | ||
736 | int ret; | ||
737 | |||
738 | gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); | ||
739 | if (!gc) { | ||
740 | dev_err(&pdev->dev, "mem alloc for gpio_chip failed\n"); | ||
741 | return -ENOMEM; | ||
742 | } | ||
743 | |||
744 | drvdata->gc = gc; | ||
745 | gc->base = drvdata->ctrl->base; | ||
746 | gc->ngpio = drvdata->ctrl->nr_pins; | ||
747 | gc->dev = &pdev->dev; | ||
748 | gc->set = samsung_gpio_set; | ||
749 | gc->get = samsung_gpio_get; | ||
750 | gc->direction_input = samsung_gpio_direction_input; | ||
751 | gc->direction_output = samsung_gpio_direction_output; | ||
752 | gc->label = drvdata->ctrl->label; | ||
753 | gc->owner = THIS_MODULE; | ||
754 | ret = gpiochip_add(gc); | ||
755 | if (ret) { | ||
756 | dev_err(&pdev->dev, "failed to register gpio_chip %s, error " | ||
757 | "code: %d\n", gc->label, ret); | ||
758 | return ret; | ||
759 | } | ||
760 | |||
761 | return 0; | ||
762 | } | ||
763 | |||
764 | /* unregister the gpiolib interface with the gpiolib subsystem */ | ||
765 | static int __init samsung_gpiolib_unregister(struct platform_device *pdev, | ||
766 | struct samsung_pinctrl_drv_data *drvdata) | ||
767 | { | ||
768 | int ret = gpiochip_remove(drvdata->gc); | ||
769 | if (ret) { | ||
770 | dev_err(&pdev->dev, "gpio chip remove failed\n"); | ||
771 | return ret; | ||
772 | } | ||
773 | return 0; | ||
774 | } | ||
775 | |||
776 | static const struct of_device_id samsung_pinctrl_dt_match[]; | ||
777 | |||
778 | /* retrieve the soc specific data */ | ||
779 | static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( | ||
780 | struct platform_device *pdev) | ||
781 | { | ||
782 | int id; | ||
783 | const struct of_device_id *match; | ||
784 | const struct device_node *node = pdev->dev.of_node; | ||
785 | |||
786 | id = of_alias_get_id(pdev->dev.of_node, "pinctrl"); | ||
787 | if (id < 0) { | ||
788 | dev_err(&pdev->dev, "failed to get alias id\n"); | ||
789 | return NULL; | ||
790 | } | ||
791 | match = of_match_node(samsung_pinctrl_dt_match, node); | ||
792 | return (struct samsung_pin_ctrl *)match->data + id; | ||
793 | } | ||
794 | |||
795 | static int __devinit samsung_pinctrl_probe(struct platform_device *pdev) | ||
796 | { | ||
797 | struct samsung_pinctrl_drv_data *drvdata; | ||
798 | struct device *dev = &pdev->dev; | ||
799 | struct samsung_pin_ctrl *ctrl; | ||
800 | struct resource *res; | ||
801 | int ret; | ||
802 | |||
803 | if (!dev->of_node) { | ||
804 | dev_err(dev, "device tree node not found\n"); | ||
805 | return -ENODEV; | ||
806 | } | ||
807 | |||
808 | ctrl = samsung_pinctrl_get_soc_data(pdev); | ||
809 | if (!ctrl) { | ||
810 | dev_err(&pdev->dev, "driver data not available\n"); | ||
811 | return -EINVAL; | ||
812 | } | ||
813 | |||
814 | drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); | ||
815 | if (!drvdata) { | ||
816 | dev_err(dev, "failed to allocate memory for driver's " | ||
817 | "private data\n"); | ||
818 | return -ENOMEM; | ||
819 | } | ||
820 | drvdata->ctrl = ctrl; | ||
821 | drvdata->dev = dev; | ||
822 | |||
823 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
824 | if (!res) { | ||
825 | dev_err(dev, "cannot find IO resource\n"); | ||
826 | return -ENOENT; | ||
827 | } | ||
828 | |||
829 | drvdata->virt_base = devm_request_and_ioremap(&pdev->dev, res); | ||
830 | if (!drvdata->virt_base) { | ||
831 | dev_err(dev, "ioremap failed\n"); | ||
832 | return -ENODEV; | ||
833 | } | ||
834 | |||
835 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
836 | if (res) | ||
837 | drvdata->irq = res->start; | ||
838 | |||
839 | ret = samsung_gpiolib_register(pdev, drvdata); | ||
840 | if (ret) | ||
841 | return ret; | ||
842 | |||
843 | ret = samsung_pinctrl_register(pdev, drvdata); | ||
844 | if (ret) { | ||
845 | samsung_gpiolib_unregister(pdev, drvdata); | ||
846 | return ret; | ||
847 | } | ||
848 | |||
849 | if (ctrl->eint_gpio_init) | ||
850 | ctrl->eint_gpio_init(drvdata); | ||
851 | if (ctrl->eint_wkup_init) | ||
852 | ctrl->eint_wkup_init(drvdata); | ||
853 | |||
854 | platform_set_drvdata(pdev, drvdata); | ||
855 | return 0; | ||
856 | } | ||
857 | |||
858 | static const struct of_device_id samsung_pinctrl_dt_match[] = { | ||
859 | { .compatible = "samsung,pinctrl-exynos4210", | ||
860 | .data = (void *)exynos4210_pin_ctrl }, | ||
861 | {}, | ||
862 | }; | ||
863 | MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match); | ||
864 | |||
865 | static struct platform_driver samsung_pinctrl_driver = { | ||
866 | .probe = samsung_pinctrl_probe, | ||
867 | .driver = { | ||
868 | .name = "samsung-pinctrl", | ||
869 | .owner = THIS_MODULE, | ||
870 | .of_match_table = of_match_ptr(samsung_pinctrl_dt_match), | ||
871 | }, | ||
872 | }; | ||
873 | |||
874 | static int __init samsung_pinctrl_drv_register(void) | ||
875 | { | ||
876 | return platform_driver_register(&samsung_pinctrl_driver); | ||
877 | } | ||
878 | postcore_initcall(samsung_pinctrl_drv_register); | ||
879 | |||
880 | static void __exit samsung_pinctrl_drv_unregister(void) | ||
881 | { | ||
882 | platform_driver_unregister(&samsung_pinctrl_driver); | ||
883 | } | ||
884 | module_exit(samsung_pinctrl_drv_unregister); | ||
885 | |||
886 | MODULE_AUTHOR("Thomas Abraham <thomas.ab@samsung.com>"); | ||
887 | MODULE_DESCRIPTION("Samsung pinctrl driver"); | ||
888 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h new file mode 100644 index 000000000000..b8956934cda6 --- /dev/null +++ b/drivers/pinctrl/pinctrl-samsung.h | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * pin-controller/pin-mux/pin-config/gpio-driver for Samsung's SoC's. | ||
3 | * | ||
4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. | ||
5 | * http://www.samsung.com | ||
6 | * Copyright (c) 2012 Linaro Ltd | ||
7 | * http://www.linaro.org | ||
8 | * | ||
9 | * Author: Thomas Abraham <thomas.ab@samsung.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #ifndef __PINCTRL_SAMSUNG_H | ||
18 | #define __PINCTRL_SAMSUNG_H | ||
19 | |||
20 | #include <linux/pinctrl/pinctrl.h> | ||
21 | #include <linux/pinctrl/pinmux.h> | ||
22 | #include <linux/pinctrl/pinconf.h> | ||
23 | #include <linux/pinctrl/consumer.h> | ||
24 | #include <linux/pinctrl/machine.h> | ||
25 | |||
26 | /* register offsets within a pin bank */ | ||
27 | #define DAT_REG 0x4 | ||
28 | #define PUD_REG 0x8 | ||
29 | #define DRV_REG 0xC | ||
30 | #define CONPDN_REG 0x10 | ||
31 | #define PUDPDN_REG 0x14 | ||
32 | |||
33 | /* pinmux function number for pin as gpio output line */ | ||
34 | #define FUNC_OUTPUT 0x1 | ||
35 | |||
36 | /** | ||
37 | * enum pincfg_type - possible pin configuration types supported. | ||
38 | * @PINCFG_TYPE_PUD: Pull up/down configuration. | ||
39 | * @PINCFG_TYPE_DRV: Drive strength configuration. | ||
40 | * @PINCFG_TYPE_CON_PDN: Pin function in power down mode. | ||
41 | * @PINCFG_TYPE_PUD_PDN: Pull up/down configuration in power down mode. | ||
42 | */ | ||
43 | enum pincfg_type { | ||
44 | PINCFG_TYPE_PUD, | ||
45 | PINCFG_TYPE_DRV, | ||
46 | PINCFG_TYPE_CON_PDN, | ||
47 | PINCFG_TYPE_PUD_PDN, | ||
48 | }; | ||
49 | |||
50 | /* | ||
51 | * pin configuration (pull up/down and drive strength) type and its value are | ||
52 | * packed together into a 16-bits. The upper 8-bits represent the configuration | ||
53 | * type and the lower 8-bits hold the value of the configuration type. | ||
54 | */ | ||
55 | #define PINCFG_TYPE_MASK 0xFF | ||
56 | #define PINCFG_VALUE_SHIFT 8 | ||
57 | #define PINCFG_VALUE_MASK (0xFF << PINCFG_VALUE_SHIFT) | ||
58 | #define PINCFG_PACK(type, value) (((value) << PINCFG_VALUE_SHIFT) | type) | ||
59 | #define PINCFG_UNPACK_TYPE(cfg) ((cfg) & PINCFG_TYPE_MASK) | ||
60 | #define PINCFG_UNPACK_VALUE(cfg) (((cfg) & PINCFG_VALUE_MASK) >> \ | ||
61 | PINCFG_VALUE_SHIFT) | ||
62 | /** | ||
63 | * enum eint_type - possible external interrupt types. | ||
64 | * @EINT_TYPE_NONE: bank does not support external interrupts | ||
65 | * @EINT_TYPE_GPIO: bank supportes external gpio interrupts | ||
66 | * @EINT_TYPE_WKUP: bank supportes external wakeup interrupts | ||
67 | * | ||
68 | * Samsung GPIO controller groups all the available pins into banks. The pins | ||
69 | * in a pin bank can support external gpio interrupts or external wakeup | ||
70 | * interrupts or no interrupts at all. From a software perspective, the only | ||
71 | * difference between external gpio and external wakeup interrupts is that | ||
72 | * the wakeup interrupts can additionally wakeup the system if it is in | ||
73 | * suspended state. | ||
74 | */ | ||
75 | enum eint_type { | ||
76 | EINT_TYPE_NONE, | ||
77 | EINT_TYPE_GPIO, | ||
78 | EINT_TYPE_WKUP, | ||
79 | }; | ||
80 | |||
81 | /* maximum length of a pin in pin descriptor (example: "gpa0-0") */ | ||
82 | #define PIN_NAME_LENGTH 10 | ||
83 | |||
84 | #define PIN_GROUP(n, p, f) \ | ||
85 | { \ | ||
86 | .name = n, \ | ||
87 | .pins = p, \ | ||
88 | .num_pins = ARRAY_SIZE(p), \ | ||
89 | .func = f \ | ||
90 | } | ||
91 | |||
92 | #define PMX_FUNC(n, g) \ | ||
93 | { \ | ||
94 | .name = n, \ | ||
95 | .groups = g, \ | ||
96 | .num_groups = ARRAY_SIZE(g), \ | ||
97 | } | ||
98 | |||
99 | struct samsung_pinctrl_drv_data; | ||
100 | |||
101 | /** | ||
102 | * struct samsung_pin_bank: represent a controller pin-bank. | ||
103 | * @reg_offset: starting offset of the pin-bank registers. | ||
104 | * @pin_base: starting pin number of the bank. | ||
105 | * @nr_pins: number of pins included in this bank. | ||
106 | * @func_width: width of the function selector bit field. | ||
107 | * @pud_width: width of the pin pull up/down selector bit field. | ||
108 | * @drv_width: width of the pin driver strength selector bit field. | ||
109 | * @conpdn_width: width of the sleep mode function selector bin field. | ||
110 | * @pudpdn_width: width of the sleep mode pull up/down selector bit field. | ||
111 | * @eint_type: type of the external interrupt supported by the bank. | ||
112 | * @irq_base: starting controller local irq number of the bank. | ||
113 | * @name: name to be prefixed for each pin in this pin bank. | ||
114 | */ | ||
115 | struct samsung_pin_bank { | ||
116 | u32 pctl_offset; | ||
117 | u32 pin_base; | ||
118 | u8 nr_pins; | ||
119 | u8 func_width; | ||
120 | u8 pud_width; | ||
121 | u8 drv_width; | ||
122 | u8 conpdn_width; | ||
123 | u8 pudpdn_width; | ||
124 | enum eint_type eint_type; | ||
125 | u32 irq_base; | ||
126 | char *name; | ||
127 | }; | ||
128 | |||
129 | /** | ||
130 | * struct samsung_pin_ctrl: represent a pin controller. | ||
131 | * @pin_banks: list of pin banks included in this controller. | ||
132 | * @nr_banks: number of pin banks. | ||
133 | * @base: starting system wide pin number. | ||
134 | * @nr_pins: number of pins supported by the controller. | ||
135 | * @nr_gint: number of external gpio interrupts supported. | ||
136 | * @nr_wint: number of external wakeup interrupts supported. | ||
137 | * @geint_con: offset of the ext-gpio controller registers. | ||
138 | * @geint_mask: offset of the ext-gpio interrupt mask registers. | ||
139 | * @geint_pend: offset of the ext-gpio interrupt pending registers. | ||
140 | * @weint_con: offset of the ext-wakeup controller registers. | ||
141 | * @weint_mask: offset of the ext-wakeup interrupt mask registers. | ||
142 | * @weint_pend: offset of the ext-wakeup interrupt pending registers. | ||
143 | * @svc: offset of the interrupt service register. | ||
144 | * @eint_gpio_init: platform specific callback to setup the external gpio | ||
145 | * interrupts for the controller. | ||
146 | * @eint_wkup_init: platform specific callback to setup the external wakeup | ||
147 | * interrupts for the controller. | ||
148 | * @label: for debug information. | ||
149 | */ | ||
150 | struct samsung_pin_ctrl { | ||
151 | struct samsung_pin_bank *pin_banks; | ||
152 | u32 nr_banks; | ||
153 | |||
154 | u32 base; | ||
155 | u32 nr_pins; | ||
156 | u32 nr_gint; | ||
157 | u32 nr_wint; | ||
158 | |||
159 | u32 geint_con; | ||
160 | u32 geint_mask; | ||
161 | u32 geint_pend; | ||
162 | |||
163 | u32 weint_con; | ||
164 | u32 weint_mask; | ||
165 | u32 weint_pend; | ||
166 | |||
167 | u32 svc; | ||
168 | |||
169 | int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *); | ||
170 | int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *); | ||
171 | char *label; | ||
172 | }; | ||
173 | |||
174 | /** | ||
175 | * struct samsung_pinctrl_drv_data: wrapper for holding driver data together. | ||
176 | * @virt_base: register base address of the controller. | ||
177 | * @dev: device instance representing the controller. | ||
178 | * @irq: interrpt number used by the controller to notify gpio interrupts. | ||
179 | * @ctrl: pin controller instance managed by the driver. | ||
180 | * @pctl: pin controller descriptor registered with the pinctrl subsystem. | ||
181 | * @pctl_dev: cookie representing pinctrl device instance. | ||
182 | * @pin_groups: list of pin groups available to the driver. | ||
183 | * @nr_groups: number of such pin groups. | ||
184 | * @pmx_functions: list of pin functions available to the driver. | ||
185 | * @nr_function: number of such pin functions. | ||
186 | * @gc: gpio_chip instance registered with gpiolib. | ||
187 | * @grange: linux gpio pin range supported by this controller. | ||
188 | */ | ||
189 | struct samsung_pinctrl_drv_data { | ||
190 | void __iomem *virt_base; | ||
191 | struct device *dev; | ||
192 | int irq; | ||
193 | |||
194 | struct samsung_pin_ctrl *ctrl; | ||
195 | struct pinctrl_desc pctl; | ||
196 | struct pinctrl_dev *pctl_dev; | ||
197 | |||
198 | const struct samsung_pin_group *pin_groups; | ||
199 | unsigned int nr_groups; | ||
200 | const struct samsung_pmx_func *pmx_functions; | ||
201 | unsigned int nr_functions; | ||
202 | |||
203 | struct irq_domain *gpio_irqd; | ||
204 | struct irq_domain *wkup_irqd; | ||
205 | |||
206 | struct gpio_chip *gc; | ||
207 | struct pinctrl_gpio_range grange; | ||
208 | }; | ||
209 | |||
210 | /** | ||
211 | * struct samsung_pin_group: represent group of pins of a pinmux function. | ||
212 | * @name: name of the pin group, used to lookup the group. | ||
213 | * @pins: the pins included in this group. | ||
214 | * @num_pins: number of pins included in this group. | ||
215 | * @func: the function number to be programmed when selected. | ||
216 | */ | ||
217 | struct samsung_pin_group { | ||
218 | const char *name; | ||
219 | const unsigned int *pins; | ||
220 | u8 num_pins; | ||
221 | u8 func; | ||
222 | }; | ||
223 | |||
224 | /** | ||
225 | * struct samsung_pmx_func: represent a pin function. | ||
226 | * @name: name of the pin function, used to lookup the function. | ||
227 | * @groups: one or more names of pin groups that provide this function. | ||
228 | * @num_groups: number of groups included in @groups. | ||
229 | */ | ||
230 | struct samsung_pmx_func { | ||
231 | const char *name; | ||
232 | const char **groups; | ||
233 | u8 num_groups; | ||
234 | }; | ||
235 | |||
236 | /* list of all exported SoC specific data */ | ||
237 | extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; | ||
238 | |||
239 | #endif /* __PINCTRL_SAMSUNG_H */ | ||
diff --git a/include/linux/leds.h b/include/linux/leds.h index 3aade1d8f410..c6f8dad2ceb0 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h | |||
@@ -237,4 +237,20 @@ struct gpio_led_platform_data { | |||
237 | struct platform_device *gpio_led_register_device( | 237 | struct platform_device *gpio_led_register_device( |
238 | int id, const struct gpio_led_platform_data *pdata); | 238 | int id, const struct gpio_led_platform_data *pdata); |
239 | 239 | ||
240 | enum cpu_led_event { | ||
241 | CPU_LED_IDLE_START, /* CPU enters idle */ | ||
242 | CPU_LED_IDLE_END, /* CPU idle ends */ | ||
243 | CPU_LED_START, /* Machine starts, especially resume */ | ||
244 | CPU_LED_STOP, /* Machine stops, especially suspend */ | ||
245 | CPU_LED_HALTED, /* Machine shutdown */ | ||
246 | }; | ||
247 | #ifdef CONFIG_LEDS_TRIGGER_CPU | ||
248 | extern void ledtrig_cpu(enum cpu_led_event evt); | ||
249 | #else | ||
250 | static inline void ledtrig_cpu(enum cpu_led_event evt) | ||
251 | { | ||
252 | return; | ||
253 | } | ||
254 | #endif | ||
255 | |||
240 | #endif /* __LINUX_LEDS_H_INCLUDED */ | 256 | #endif /* __LINUX_LEDS_H_INCLUDED */ |