diff options
118 files changed, 3077 insertions, 732 deletions
diff --git a/Documentation/devicetree/bindings/arm/tegra/emc.txt b/Documentation/devicetree/bindings/arm/tegra/emc.txt new file mode 100644 index 000000000000..09335f8eee00 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/emc.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | Embedded Memory Controller | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be emc | ||
5 | - #address-cells : Should be 1 | ||
6 | - #size-cells : Should be 0 | ||
7 | - compatible : Should contain "nvidia,tegra20-emc". | ||
8 | - reg : Offset and length of the register set for the device | ||
9 | - nvidia,use-ram-code : If present, the sub-nodes will be addressed | ||
10 | and chosen using the ramcode board selector. If omitted, only one | ||
11 | set of tables can be present and said tables will be used | ||
12 | irrespective of ram-code configuration. | ||
13 | |||
14 | Child device nodes describe the memory settings for different configurations and clock rates. | ||
15 | |||
16 | Example: | ||
17 | |||
18 | emc@7000f400 { | ||
19 | #address-cells = < 1 >; | ||
20 | #size-cells = < 0 >; | ||
21 | compatible = "nvidia,tegra20-emc"; | ||
22 | reg = <0x7000f4000 0x200>; | ||
23 | } | ||
24 | |||
25 | |||
26 | Embedded Memory Controller ram-code table | ||
27 | |||
28 | If the emc node has the nvidia,use-ram-code property present, then the | ||
29 | next level of nodes below the emc table are used to specify which settings | ||
30 | apply for which ram-code settings. | ||
31 | |||
32 | If the emc node lacks the nvidia,use-ram-code property, this level is omitted | ||
33 | and the tables are stored directly under the emc node (see below). | ||
34 | |||
35 | Properties: | ||
36 | |||
37 | - name : Should be emc-tables | ||
38 | - nvidia,ram-code : the binary representation of the ram-code board strappings | ||
39 | for which this node (and children) are valid. | ||
40 | |||
41 | |||
42 | |||
43 | Embedded Memory Controller configuration table | ||
44 | |||
45 | This is a table containing the EMC register settings for the various | ||
46 | operating speeds of the memory controller. They are always located as | ||
47 | subnodes of the emc controller node. | ||
48 | |||
49 | There are two ways of specifying which tables to use: | ||
50 | |||
51 | * The simplest is if there is just one set of tables in the device tree, | ||
52 | and they will always be used (based on which frequency is used). | ||
53 | This is the preferred method, especially when firmware can fill in | ||
54 | this information based on the specific system information and just | ||
55 | pass it on to the kernel. | ||
56 | |||
57 | * The slightly more complex one is when more than one memory configuration | ||
58 | might exist on the system. The Tegra20 platform handles this during | ||
59 | early boot by selecting one out of possible 4 memory settings based | ||
60 | on a 2-pin "ram code" bootstrap setting on the board. The values of | ||
61 | these strappings can be read through a register in the SoC, and thus | ||
62 | used to select which tables to use. | ||
63 | |||
64 | Properties: | ||
65 | - name : Should be emc-table | ||
66 | - compatible : Should contain "nvidia,tegra20-emc-table". | ||
67 | - reg : either an opaque enumerator to tell different tables apart, or | ||
68 | the valid frequency for which the table should be used (in kHz). | ||
69 | - clock-frequency : the clock frequency for the EMC at which this | ||
70 | table should be used (in kHz). | ||
71 | - nvidia,emc-registers : a 46 word array of EMC registers to be programmed | ||
72 | for operation at the 'clock-frequency' setting. | ||
73 | The order and contents of the registers are: | ||
74 | RC, RFC, RAS, RP, R2W, W2R, R2P, W2P, RD_RCD, WR_RCD, RRD, REXT, | ||
75 | WDV, QUSE, QRST, QSAFE, RDV, REFRESH, BURST_REFRESH_NUM, PDEX2WR, | ||
76 | PDEX2RD, PCHG2PDEN, ACT2PDEN, AR2PDEN, RW2PDEN, TXSR, TCKE, TFAW, | ||
77 | TRPAB, TCLKSTABLE, TCLKSTOP, TREFBW, QUSE_EXTRA, FBIO_CFG6, ODT_WRITE, | ||
78 | ODT_READ, FBIO_CFG5, CFG_DIG_DLL, DLL_XFORM_DQS, DLL_XFORM_QUSE, | ||
79 | ZCAL_REF_CNT, ZCAL_WAIT_CNT, AUTO_CAL_INTERVAL, CFG_CLKTRIM_0, | ||
80 | CFG_CLKTRIM_1, CFG_CLKTRIM_2 | ||
81 | |||
82 | emc-table@166000 { | ||
83 | reg = <166000>; | ||
84 | compatible = "nvidia,tegra20-emc-table"; | ||
85 | clock-frequency = < 166000 >; | ||
86 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
87 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
88 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
89 | 0 0 0 0 >; | ||
90 | }; | ||
91 | |||
92 | emc-table@333000 { | ||
93 | reg = <333000>; | ||
94 | compatible = "nvidia,tegra20-emc-table"; | ||
95 | clock-frequency = < 333000 >; | ||
96 | nvidia,emc-registers = < 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
97 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
98 | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 | ||
99 | 0 0 0 0 >; | ||
100 | }; | ||
diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt new file mode 100644 index 000000000000..b5846e21cc2e --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | NVIDIA Tegra Power Management Controller (PMC) | ||
2 | |||
3 | Properties: | ||
4 | - name : Should be pmc | ||
5 | - compatible : Should contain "nvidia,tegra<chip>-pmc". | ||
6 | - reg : Offset and length of the register set for the device | ||
7 | - nvidia,invert-interrupt : If present, inverts the PMU interrupt signal. | ||
8 | The PMU is an external Power Management Unit, whose interrupt output | ||
9 | signal is fed into the PMC. This signal is optionally inverted, and then | ||
10 | fed into the ARM GIC. The PMC is not involved in the detection or | ||
11 | handling of this interrupt signal, merely its inversion. | ||
12 | |||
13 | Example: | ||
14 | |||
15 | pmc@7000f400 { | ||
16 | compatible = "nvidia,tegra20-pmc"; | ||
17 | reg = <0x7000e400 0x400>; | ||
18 | nvidia,invert-interrupt; | ||
19 | }; | ||
diff --git a/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt new file mode 100644 index 000000000000..90fa7da525b8 --- /dev/null +++ b/Documentation/devicetree/bindings/dma/tegra20-apbdma.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | * NVIDIA Tegra APB DMA controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: Should be "nvidia,<chip>-apbdma" | ||
5 | - reg: Should contain DMA registers location and length. This shuld include | ||
6 | all of the per-channel registers. | ||
7 | - interrupts: Should contain all of the per-channel DMA interrupts. | ||
8 | |||
9 | Examples: | ||
10 | |||
11 | apbdma: dma@6000a000 { | ||
12 | compatible = "nvidia,tegra20-apbdma"; | ||
13 | reg = <0x6000a000 0x1200>; | ||
14 | interrupts = < 0 136 0x04 | ||
15 | 0 137 0x04 | ||
16 | 0 138 0x04 | ||
17 | 0 139 0x04 | ||
18 | 0 140 0x04 | ||
19 | 0 141 0x04 | ||
20 | 0 142 0x04 | ||
21 | 0 143 0x04 | ||
22 | 0 144 0x04 | ||
23 | 0 145 0x04 | ||
24 | 0 146 0x04 | ||
25 | 0 147 0x04 | ||
26 | 0 148 0x04 | ||
27 | 0 149 0x04 | ||
28 | 0 150 0x04 | ||
29 | 0 151 0x04 >; | ||
30 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt index eb4b530d64e1..023c9526e5f8 100644 --- a/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt +++ b/Documentation/devicetree/bindings/gpio/gpio_nvidia.txt | |||
@@ -1,8 +1,40 @@ | |||
1 | NVIDIA Tegra 2 GPIO controller | 1 | NVIDIA Tegra GPIO controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : "nvidia,tegra20-gpio" | 4 | - compatible : "nvidia,tegra<chip>-gpio" |
5 | - reg : Physical base address and length of the controller's registers. | ||
6 | - interrupts : The interrupt outputs from the controller. For Tegra20, | ||
7 | there should be 7 interrupts specified, and for Tegra30, there should | ||
8 | be 8 interrupts specified. | ||
5 | - #gpio-cells : Should be two. The first cell is the pin number and the | 9 | - #gpio-cells : Should be two. The first cell is the pin number and the |
6 | second cell is used to specify optional parameters: | 10 | second cell is used to specify optional parameters: |
7 | - bit 0 specifies polarity (0 for normal, 1 for inverted) | 11 | - bit 0 specifies polarity (0 for normal, 1 for inverted) |
8 | - gpio-controller : Marks the device node as a GPIO controller. | 12 | - gpio-controller : Marks the device node as a GPIO controller. |
13 | - #interrupt-cells : Should be 2. | ||
14 | The first cell is the GPIO number. | ||
15 | The second cell is used to specify flags: | ||
16 | bits[3:0] trigger type and level flags: | ||
17 | 1 = low-to-high edge triggered. | ||
18 | 2 = high-to-low edge triggered. | ||
19 | 4 = active high level-sensitive. | ||
20 | 8 = active low level-sensitive. | ||
21 | Valid combinations are 1, 2, 3, 4, 8. | ||
22 | - interrupt-controller : Marks the device node as an interrupt controller. | ||
23 | |||
24 | Example: | ||
25 | |||
26 | gpio: gpio@6000d000 { | ||
27 | compatible = "nvidia,tegra20-gpio"; | ||
28 | reg = < 0x6000d000 0x1000 >; | ||
29 | interrupts = < 0 32 0x04 | ||
30 | 0 33 0x04 | ||
31 | 0 34 0x04 | ||
32 | 0 35 0x04 | ||
33 | 0 55 0x04 | ||
34 | 0 87 0x04 | ||
35 | 0 89 0x04 >; | ||
36 | #gpio-cells = <2>; | ||
37 | gpio-controller; | ||
38 | #interrupt-cells = <2>; | ||
39 | interrupt-controller; | ||
40 | }; | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c941fd06b2af..8ef416a3a551 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -760,7 +760,7 @@ config ARCH_SA1100 | |||
760 | select ARCH_HAS_CPUFREQ | 760 | select ARCH_HAS_CPUFREQ |
761 | select CPU_FREQ | 761 | select CPU_FREQ |
762 | select GENERIC_CLOCKEVENTS | 762 | select GENERIC_CLOCKEVENTS |
763 | select HAVE_CLK | 763 | select CLKDEV_LOOKUP |
764 | select HAVE_SCHED_CLOCK | 764 | select HAVE_SCHED_CLOCK |
765 | select TICK_ONESHOT | 765 | select TICK_ONESHOT |
766 | select ARCH_REQUIRE_GPIOLIB | 766 | select ARCH_REQUIRE_GPIOLIB |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index b895a2a92da8..66ca8014ff3e 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -180,12 +180,12 @@ choice | |||
180 | Say Y here if you want kernel low-level debugging support | 180 | Say Y here if you want kernel low-level debugging support |
181 | on i.MX50 or i.MX53. | 181 | on i.MX50 or i.MX53. |
182 | 182 | ||
183 | config DEBUG_IMX6Q_UART | 183 | config DEBUG_IMX6Q_UART4 |
184 | bool "i.MX6Q Debug UART" | 184 | bool "i.MX6Q Debug UART4" |
185 | depends on SOC_IMX6Q | 185 | depends on SOC_IMX6Q |
186 | help | 186 | help |
187 | Say Y here if you want kernel low-level debugging support | 187 | Say Y here if you want kernel low-level debugging support |
188 | on i.MX6Q. | 188 | on i.MX6Q UART4. |
189 | 189 | ||
190 | config DEBUG_MSM_UART1 | 190 | config DEBUG_MSM_UART1 |
191 | bool "Kernel low-level debugging messages via MSM UART1" | 191 | bool "Kernel low-level debugging messages via MSM UART1" |
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts index 80afa1b70b80..6e8447dc0202 100644 --- a/arch/arm/boot/dts/tegra-harmony.dts +++ b/arch/arm/boot/dts/tegra-harmony.dts | |||
@@ -10,19 +10,25 @@ | |||
10 | reg = < 0x00000000 0x40000000 >; | 10 | reg = < 0x00000000 0x40000000 >; |
11 | }; | 11 | }; |
12 | 12 | ||
13 | pmc@7000f400 { | ||
14 | nvidia,invert-interrupt; | ||
15 | }; | ||
16 | |||
13 | i2c@7000c000 { | 17 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 18 | clock-frequency = <400000>; |
15 | 19 | ||
16 | codec: wm8903@1a { | 20 | wm8903: wm8903@1a { |
17 | compatible = "wlf,wm8903"; | 21 | compatible = "wlf,wm8903"; |
18 | reg = <0x1a>; | 22 | reg = <0x1a>; |
19 | interrupts = < 347 >; | 23 | interrupt-parent = <&gpio>; |
24 | interrupts = < 187 0x04 >; | ||
20 | 25 | ||
21 | gpio-controller; | 26 | gpio-controller; |
22 | #gpio-cells = <2>; | 27 | #gpio-cells = <2>; |
23 | 28 | ||
24 | /* 0x8000 = Not configured */ | 29 | micdet-cfg = <0>; |
25 | gpio-cfg = < 0x8000 0x8000 0 0x8000 0x8000 >; | 30 | micdet-delay = <100>; |
31 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
26 | }; | 32 | }; |
27 | }; | 33 | }; |
28 | 34 | ||
@@ -38,13 +44,32 @@ | |||
38 | clock-frequency = <400000>; | 44 | clock-frequency = <400000>; |
39 | }; | 45 | }; |
40 | 46 | ||
41 | sound { | 47 | i2s@70002a00 { |
42 | compatible = "nvidia,harmony-sound", "nvidia,tegra-wm8903"; | 48 | status = "disable"; |
49 | }; | ||
43 | 50 | ||
44 | spkr-en-gpios = <&codec 2 0>; | 51 | sound { |
45 | hp-det-gpios = <&gpio 178 0>; | 52 | compatible = "nvidia,tegra-audio-wm8903-harmony", |
46 | int-mic-en-gpios = <&gpio 184 0>; | 53 | "nvidia,tegra-audio-wm8903"; |
47 | ext-mic-en-gpios = <&gpio 185 0>; | 54 | nvidia,model = "NVIDIA Tegra Harmony"; |
55 | |||
56 | nvidia,audio-routing = | ||
57 | "Headphone Jack", "HPOUTR", | ||
58 | "Headphone Jack", "HPOUTL", | ||
59 | "Int Spk", "ROP", | ||
60 | "Int Spk", "RON", | ||
61 | "Int Spk", "LOP", | ||
62 | "Int Spk", "LON", | ||
63 | "Mic Jack", "MICBIAS", | ||
64 | "IN1L", "Mic Jack"; | ||
65 | |||
66 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
67 | nvidia,audio-codec = <&wm8903>; | ||
68 | |||
69 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
70 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
71 | nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ | ||
72 | nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
48 | }; | 73 | }; |
49 | 74 | ||
50 | serial@70006000 { | 75 | serial@70006000 { |
diff --git a/arch/arm/boot/dts/tegra-paz00.dts b/arch/arm/boot/dts/tegra-paz00.dts index 61f385809970..fc97254c3644 100644 --- a/arch/arm/boot/dts/tegra-paz00.dts +++ b/arch/arm/boot/dts/tegra-paz00.dts | |||
@@ -12,6 +12,13 @@ | |||
12 | 12 | ||
13 | i2c@7000c000 { | 13 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 14 | clock-frequency = <400000>; |
15 | |||
16 | alc5632: alc5632@1e { | ||
17 | compatible = "realtek,alc5632"; | ||
18 | reg = <0x1e>; | ||
19 | gpio-controller; | ||
20 | #gpio-cells = <2>; | ||
21 | }; | ||
15 | }; | 22 | }; |
16 | 23 | ||
17 | i2c@7000c400 { | 24 | i2c@7000c400 { |
@@ -42,6 +49,29 @@ | |||
42 | }; | 49 | }; |
43 | }; | 50 | }; |
44 | 51 | ||
52 | i2s@70002a00 { | ||
53 | status = "disable"; | ||
54 | }; | ||
55 | |||
56 | sound { | ||
57 | compatible = "nvidia,tegra-audio-alc5632-paz00", | ||
58 | "nvidia,tegra-audio-alc5632"; | ||
59 | |||
60 | nvidia,model = "Compal PAZ00"; | ||
61 | |||
62 | nvidia,audio-routing = | ||
63 | "Int Spk", "SPKOUT", | ||
64 | "Int Spk", "SPKOUTN", | ||
65 | "Headset Mic", "MICBIAS1", | ||
66 | "MIC1", "Headset Mic", | ||
67 | "Headset Stereophone", "HPR", | ||
68 | "Headset Stereophone", "HPL"; | ||
69 | |||
70 | nvidia,audio-codec = <&alc5632>; | ||
71 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
72 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
73 | }; | ||
74 | |||
45 | serial@70006000 { | 75 | serial@70006000 { |
46 | clock-frequency = <216000000>; | 76 | clock-frequency = <216000000>; |
47 | }; | 77 | }; |
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts index b55a02e34ba7..876d5c92ce36 100644 --- a/arch/arm/boot/dts/tegra-seaboard.dts +++ b/arch/arm/boot/dts/tegra-seaboard.dts | |||
@@ -13,6 +13,20 @@ | |||
13 | 13 | ||
14 | i2c@7000c000 { | 14 | i2c@7000c000 { |
15 | clock-frequency = <400000>; | 15 | clock-frequency = <400000>; |
16 | |||
17 | wm8903: wm8903@1a { | ||
18 | compatible = "wlf,wm8903"; | ||
19 | reg = <0x1a>; | ||
20 | interrupt-parent = <&gpio>; | ||
21 | interrupts = < 187 0x04 >; | ||
22 | |||
23 | gpio-controller; | ||
24 | #gpio-cells = <2>; | ||
25 | |||
26 | micdet-cfg = <0>; | ||
27 | micdet-delay = <100>; | ||
28 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
29 | }; | ||
16 | }; | 30 | }; |
17 | 31 | ||
18 | i2c@7000c400 { | 32 | i2c@7000c400 { |
@@ -32,6 +46,32 @@ | |||
32 | }; | 46 | }; |
33 | }; | 47 | }; |
34 | 48 | ||
49 | i2s@70002a00 { | ||
50 | status = "disable"; | ||
51 | }; | ||
52 | |||
53 | sound { | ||
54 | compatible = "nvidia,tegra-audio-wm8903-seaboard", | ||
55 | "nvidia,tegra-audio-wm8903"; | ||
56 | nvidia,model = "NVIDIA Tegra Seaboard"; | ||
57 | |||
58 | nvidia,audio-routing = | ||
59 | "Headphone Jack", "HPOUTR", | ||
60 | "Headphone Jack", "HPOUTL", | ||
61 | "Int Spk", "ROP", | ||
62 | "Int Spk", "RON", | ||
63 | "Int Spk", "LOP", | ||
64 | "Int Spk", "LON", | ||
65 | "Mic Jack", "MICBIAS", | ||
66 | "IN1R", "Mic Jack"; | ||
67 | |||
68 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
69 | nvidia,audio-codec = <&wm8903>; | ||
70 | |||
71 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
72 | nvidia,hp-det-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
73 | }; | ||
74 | |||
35 | serial@70006000 { | 75 | serial@70006000 { |
36 | status = "disable"; | 76 | status = "disable"; |
37 | }; | 77 | }; |
@@ -93,4 +133,42 @@ | |||
93 | gpio-key,wakeup; | 133 | gpio-key,wakeup; |
94 | }; | 134 | }; |
95 | }; | 135 | }; |
136 | |||
137 | emc@7000f400 { | ||
138 | emc-table@190000 { | ||
139 | reg = < 190000 >; | ||
140 | compatible = "nvidia,tegra20-emc-table"; | ||
141 | clock-frequency = < 190000 >; | ||
142 | nvidia,emc-registers = < 0x0000000c 0x00000026 | ||
143 | 0x00000009 0x00000003 0x00000004 0x00000004 | ||
144 | 0x00000002 0x0000000c 0x00000003 0x00000003 | ||
145 | 0x00000002 0x00000001 0x00000004 0x00000005 | ||
146 | 0x00000004 0x00000009 0x0000000d 0x0000059f | ||
147 | 0x00000000 0x00000003 0x00000003 0x00000003 | ||
148 | 0x00000003 0x00000001 0x0000000b 0x000000c8 | ||
149 | 0x00000003 0x00000007 0x00000004 0x0000000f | ||
150 | 0x00000002 0x00000000 0x00000000 0x00000002 | ||
151 | 0x00000000 0x00000000 0x00000083 0xa06204ae | ||
152 | 0x007dc010 0x00000000 0x00000000 0x00000000 | ||
153 | 0x00000000 0x00000000 0x00000000 0x00000000 >; | ||
154 | }; | ||
155 | |||
156 | emc-table@380000 { | ||
157 | reg = < 380000 >; | ||
158 | compatible = "nvidia,tegra20-emc-table"; | ||
159 | clock-frequency = < 380000 >; | ||
160 | nvidia,emc-registers = < 0x00000017 0x0000004b | ||
161 | 0x00000012 0x00000006 0x00000004 0x00000005 | ||
162 | 0x00000003 0x0000000c 0x00000006 0x00000006 | ||
163 | 0x00000003 0x00000001 0x00000004 0x00000005 | ||
164 | 0x00000004 0x00000009 0x0000000d 0x00000b5f | ||
165 | 0x00000000 0x00000003 0x00000003 0x00000006 | ||
166 | 0x00000006 0x00000001 0x00000011 0x000000c8 | ||
167 | 0x00000003 0x0000000e 0x00000007 0x0000000f | ||
168 | 0x00000002 0x00000000 0x00000000 0x00000002 | ||
169 | 0x00000000 0x00000000 0x00000083 0xe044048b | ||
170 | 0x007d8010 0x00000000 0x00000000 0x00000000 | ||
171 | 0x00000000 0x00000000 0x00000000 0x00000000 >; | ||
172 | }; | ||
173 | }; | ||
96 | }; | 174 | }; |
diff --git a/arch/arm/boot/dts/tegra-trimslice.dts b/arch/arm/boot/dts/tegra-trimslice.dts index 3b3ee7db99f3..252476867b54 100644 --- a/arch/arm/boot/dts/tegra-trimslice.dts +++ b/arch/arm/boot/dts/tegra-trimslice.dts | |||
@@ -26,6 +26,18 @@ | |||
26 | status = "disable"; | 26 | status = "disable"; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | i2s@70002800 { | ||
30 | status = "disable"; | ||
31 | }; | ||
32 | |||
33 | i2s@70002a00 { | ||
34 | status = "disable"; | ||
35 | }; | ||
36 | |||
37 | das@70000c00 { | ||
38 | status = "disable"; | ||
39 | }; | ||
40 | |||
29 | serial@70006000 { | 41 | serial@70006000 { |
30 | clock-frequency = < 216000000 >; | 42 | clock-frequency = < 216000000 >; |
31 | }; | 43 | }; |
diff --git a/arch/arm/boot/dts/tegra-ventana.dts b/arch/arm/boot/dts/tegra-ventana.dts index c7d3b87f29df..2dcff8728e90 100644 --- a/arch/arm/boot/dts/tegra-ventana.dts +++ b/arch/arm/boot/dts/tegra-ventana.dts | |||
@@ -12,6 +12,20 @@ | |||
12 | 12 | ||
13 | i2c@7000c000 { | 13 | i2c@7000c000 { |
14 | clock-frequency = <400000>; | 14 | clock-frequency = <400000>; |
15 | |||
16 | wm8903: wm8903@1a { | ||
17 | compatible = "wlf,wm8903"; | ||
18 | reg = <0x1a>; | ||
19 | interrupt-parent = <&gpio>; | ||
20 | interrupts = < 187 0x04 >; | ||
21 | |||
22 | gpio-controller; | ||
23 | #gpio-cells = <2>; | ||
24 | |||
25 | micdet-cfg = <0>; | ||
26 | micdet-delay = <100>; | ||
27 | gpio-cfg = < 0xffffffff 0xffffffff 0 0xffffffff 0xffffffff >; | ||
28 | }; | ||
15 | }; | 29 | }; |
16 | 30 | ||
17 | i2c@7000c400 { | 31 | i2c@7000c400 { |
@@ -26,6 +40,34 @@ | |||
26 | clock-frequency = <400000>; | 40 | clock-frequency = <400000>; |
27 | }; | 41 | }; |
28 | 42 | ||
43 | i2s@70002a00 { | ||
44 | status = "disable"; | ||
45 | }; | ||
46 | |||
47 | sound { | ||
48 | compatible = "nvidia,tegra-audio-wm8903-ventana", | ||
49 | "nvidia,tegra-audio-wm8903"; | ||
50 | nvidia,model = "NVIDIA Tegra Ventana"; | ||
51 | |||
52 | nvidia,audio-routing = | ||
53 | "Headphone Jack", "HPOUTR", | ||
54 | "Headphone Jack", "HPOUTL", | ||
55 | "Int Spk", "ROP", | ||
56 | "Int Spk", "RON", | ||
57 | "Int Spk", "LOP", | ||
58 | "Int Spk", "LON", | ||
59 | "Mic Jack", "MICBIAS", | ||
60 | "IN1L", "Mic Jack"; | ||
61 | |||
62 | nvidia,i2s-controller = <&tegra_i2s1>; | ||
63 | nvidia,audio-codec = <&wm8903>; | ||
64 | |||
65 | nvidia,spkr-en-gpios = <&wm8903 2 0>; | ||
66 | nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ | ||
67 | nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ | ||
68 | nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ | ||
69 | }; | ||
70 | |||
29 | serial@70006000 { | 71 | serial@70006000 { |
30 | status = "disable"; | 72 | status = "disable"; |
31 | }; | 73 | }; |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 3da7afd45322..ec1f0101c79c 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -4,6 +4,11 @@ | |||
4 | compatible = "nvidia,tegra20"; | 4 | compatible = "nvidia,tegra20"; |
5 | interrupt-parent = <&intc>; | 5 | interrupt-parent = <&intc>; |
6 | 6 | ||
7 | pmc@7000f400 { | ||
8 | compatible = "nvidia,tegra20-pmc"; | ||
9 | reg = <0x7000e400 0x400>; | ||
10 | }; | ||
11 | |||
7 | intc: interrupt-controller@50041000 { | 12 | intc: interrupt-controller@50041000 { |
8 | compatible = "arm,cortex-a9-gic"; | 13 | compatible = "arm,cortex-a9-gic"; |
9 | interrupt-controller; | 14 | interrupt-controller; |
@@ -12,6 +17,27 @@ | |||
12 | < 0x50040100 0x0100 >; | 17 | < 0x50040100 0x0100 >; |
13 | }; | 18 | }; |
14 | 19 | ||
20 | apbdma: dma@6000a000 { | ||
21 | compatible = "nvidia,tegra20-apbdma"; | ||
22 | reg = <0x6000a000 0x1200>; | ||
23 | interrupts = < 0 104 0x04 | ||
24 | 0 105 0x04 | ||
25 | 0 106 0x04 | ||
26 | 0 107 0x04 | ||
27 | 0 108 0x04 | ||
28 | 0 109 0x04 | ||
29 | 0 110 0x04 | ||
30 | 0 111 0x04 | ||
31 | 0 112 0x04 | ||
32 | 0 113 0x04 | ||
33 | 0 114 0x04 | ||
34 | 0 115 0x04 | ||
35 | 0 116 0x04 | ||
36 | 0 117 0x04 | ||
37 | 0 118 0x04 | ||
38 | 0 119 0x04 >; | ||
39 | }; | ||
40 | |||
15 | i2c@7000c000 { | 41 | i2c@7000c000 { |
16 | #address-cells = <1>; | 42 | #address-cells = <1>; |
17 | #size-cells = <0>; | 43 | #size-cells = <0>; |
@@ -44,18 +70,18 @@ | |||
44 | interrupts = < 0 53 0x04 >; | 70 | interrupts = < 0 53 0x04 >; |
45 | }; | 71 | }; |
46 | 72 | ||
47 | i2s@70002800 { | 73 | tegra_i2s1: i2s@70002800 { |
48 | compatible = "nvidia,tegra20-i2s"; | 74 | compatible = "nvidia,tegra20-i2s"; |
49 | reg = <0x70002800 0x200>; | 75 | reg = <0x70002800 0x200>; |
50 | interrupts = < 0 13 0x04 >; | 76 | interrupts = < 0 13 0x04 >; |
51 | dma-channel = < 2 >; | 77 | nvidia,dma-request-selector = < &apbdma 2 >; |
52 | }; | 78 | }; |
53 | 79 | ||
54 | i2s@70002a00 { | 80 | tegra_i2s2: i2s@70002a00 { |
55 | compatible = "nvidia,tegra20-i2s"; | 81 | compatible = "nvidia,tegra20-i2s"; |
56 | reg = <0x70002a00 0x200>; | 82 | reg = <0x70002a00 0x200>; |
57 | interrupts = < 0 3 0x04 >; | 83 | interrupts = < 0 3 0x04 >; |
58 | dma-channel = < 1 >; | 84 | nvidia,dma-request-selector = < &apbdma 1 >; |
59 | }; | 85 | }; |
60 | 86 | ||
61 | das@70000c00 { | 87 | das@70000c00 { |
@@ -75,6 +101,8 @@ | |||
75 | 0 89 0x04 >; | 101 | 0 89 0x04 >; |
76 | #gpio-cells = <2>; | 102 | #gpio-cells = <2>; |
77 | gpio-controller; | 103 | gpio-controller; |
104 | #interrupt-cells = <2>; | ||
105 | interrupt-controller; | ||
78 | }; | 106 | }; |
79 | 107 | ||
80 | pinmux: pinmux@70000000 { | 108 | pinmux: pinmux@70000000 { |
@@ -120,6 +148,13 @@ | |||
120 | interrupts = < 0 91 0x04 >; | 148 | interrupts = < 0 91 0x04 >; |
121 | }; | 149 | }; |
122 | 150 | ||
151 | emc@7000f400 { | ||
152 | #address-cells = <1>; | ||
153 | #size-cells = <0>; | ||
154 | compatible = "nvidia,tegra20-emc"; | ||
155 | reg = <0x7000f400 0x200>; | ||
156 | }; | ||
157 | |||
123 | sdhci@c8000000 { | 158 | sdhci@c8000000 { |
124 | compatible = "nvidia,tegra20-sdhci"; | 159 | compatible = "nvidia,tegra20-sdhci"; |
125 | reg = <0xc8000000 0x200>; | 160 | reg = <0xc8000000 0x200>; |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index ee7db9892e02..ac4b75cb26c0 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -4,6 +4,11 @@ | |||
4 | compatible = "nvidia,tegra30"; | 4 | compatible = "nvidia,tegra30"; |
5 | interrupt-parent = <&intc>; | 5 | interrupt-parent = <&intc>; |
6 | 6 | ||
7 | pmc@7000f400 { | ||
8 | compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; | ||
9 | reg = <0x7000e400 0x400>; | ||
10 | }; | ||
11 | |||
7 | intc: interrupt-controller@50041000 { | 12 | intc: interrupt-controller@50041000 { |
8 | compatible = "arm,cortex-a9-gic"; | 13 | compatible = "arm,cortex-a9-gic"; |
9 | interrupt-controller; | 14 | interrupt-controller; |
@@ -12,6 +17,43 @@ | |||
12 | < 0x50040100 0x0100 >; | 17 | < 0x50040100 0x0100 >; |
13 | }; | 18 | }; |
14 | 19 | ||
20 | apbdma: dma@6000a000 { | ||
21 | compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; | ||
22 | reg = <0x6000a000 0x1400>; | ||
23 | interrupts = < 0 104 0x04 | ||
24 | 0 105 0x04 | ||
25 | 0 106 0x04 | ||
26 | 0 107 0x04 | ||
27 | 0 108 0x04 | ||
28 | 0 109 0x04 | ||
29 | 0 110 0x04 | ||
30 | 0 111 0x04 | ||
31 | 0 112 0x04 | ||
32 | 0 113 0x04 | ||
33 | 0 114 0x04 | ||
34 | 0 115 0x04 | ||
35 | 0 116 0x04 | ||
36 | 0 117 0x04 | ||
37 | 0 118 0x04 | ||
38 | 0 119 0x04 | ||
39 | 0 128 0x04 | ||
40 | 0 129 0x04 | ||
41 | 0 130 0x04 | ||
42 | 0 131 0x04 | ||
43 | 0 132 0x04 | ||
44 | 0 133 0x04 | ||
45 | 0 134 0x04 | ||
46 | 0 135 0x04 | ||
47 | 0 136 0x04 | ||
48 | 0 137 0x04 | ||
49 | 0 138 0x04 | ||
50 | 0 139 0x04 | ||
51 | 0 140 0x04 | ||
52 | 0 141 0x04 | ||
53 | 0 142 0x04 | ||
54 | 0 143 0x04 >; | ||
55 | }; | ||
56 | |||
15 | i2c@7000c000 { | 57 | i2c@7000c000 { |
16 | #address-cells = <1>; | 58 | #address-cells = <1>; |
17 | #size-cells = <0>; | 59 | #size-cells = <0>; |
@@ -55,9 +97,18 @@ | |||
55 | gpio: gpio@6000d000 { | 97 | gpio: gpio@6000d000 { |
56 | compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; | 98 | compatible = "nvidia,tegra30-gpio", "nvidia,tegra20-gpio"; |
57 | reg = < 0x6000d000 0x1000 >; | 99 | reg = < 0x6000d000 0x1000 >; |
58 | interrupts = < 0 32 0x04 0 33 0x04 0 34 0x04 0 35 0x04 0 55 0x04 0 87 0x04 0 89 0x04 >; | 100 | interrupts = < 0 32 0x04 |
101 | 0 33 0x04 | ||
102 | 0 34 0x04 | ||
103 | 0 35 0x04 | ||
104 | 0 55 0x04 | ||
105 | 0 87 0x04 | ||
106 | 0 89 0x04 | ||
107 | 0 125 0x04 >; | ||
59 | #gpio-cells = <2>; | 108 | #gpio-cells = <2>; |
60 | gpio-controller; | 109 | gpio-controller; |
110 | #interrupt-cells = <2>; | ||
111 | interrupt-controller; | ||
61 | }; | 112 | }; |
62 | 113 | ||
63 | serial@70006000 { | 114 | serial@70006000 { |
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index d88fb87b414d..b5ac644e12af 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -45,6 +45,7 @@ CONFIG_FPE_NWFPE=y | |||
45 | CONFIG_FPE_NWFPE_XP=y | 45 | CONFIG_FPE_NWFPE_XP=y |
46 | CONFIG_PM_DEBUG=y | 46 | CONFIG_PM_DEBUG=y |
47 | CONFIG_NET=y | 47 | CONFIG_NET=y |
48 | CONFIG_SMSC911X=y | ||
48 | CONFIG_PACKET=y | 49 | CONFIG_PACKET=y |
49 | CONFIG_UNIX=y | 50 | CONFIG_UNIX=y |
50 | CONFIG_INET=y | 51 | CONFIG_INET=y |
@@ -79,6 +80,8 @@ CONFIG_MISC_DEVICES=y | |||
79 | CONFIG_EEPROM_AT24=y | 80 | CONFIG_EEPROM_AT24=y |
80 | CONFIG_EEPROM_AT25=y | 81 | CONFIG_EEPROM_AT25=y |
81 | CONFIG_NETDEVICES=y | 82 | CONFIG_NETDEVICES=y |
83 | CONFIG_CS89x0=y | ||
84 | CONFIG_CS89x0_PLATFORM=y | ||
82 | CONFIG_DM9000=y | 85 | CONFIG_DM9000=y |
83 | CONFIG_SMC91X=y | 86 | CONFIG_SMC91X=y |
84 | CONFIG_SMC911X=y | 87 | CONFIG_SMC911X=y |
@@ -116,6 +119,21 @@ CONFIG_FB_IMX=y | |||
116 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 119 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
117 | CONFIG_LCD_CLASS_DEVICE=y | 120 | CONFIG_LCD_CLASS_DEVICE=y |
118 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 121 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
122 | CONFIG_LCD_L4F00242T03=y | ||
123 | CONFIG_MEDIA_SUPPORT=y | ||
124 | CONFIG_VIDEO_DEV=y | ||
125 | CONFIG_VIDEO_V4L2_COMMON=y | ||
126 | CONFIG_VIDEO_MEDIA=y | ||
127 | CONFIG_VIDEO_V4L2=y | ||
128 | CONFIG_VIDEOBUF_GEN=y | ||
129 | CONFIG_VIDEOBUF_DMA_CONTIG=y | ||
130 | CONFIG_VIDEOBUF2_CORE=y | ||
131 | CONFIG_VIDEO_CAPTURE_DRIVERS=y | ||
132 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
133 | CONFIG_SOC_CAMERA=y | ||
134 | CONFIG_SOC_CAMERA_OV2640=y | ||
135 | CONFIG_VIDEO_MX2_HOSTSUPPORT=y | ||
136 | CONFIG_VIDEO_MX2=y | ||
119 | CONFIG_BACKLIGHT_PWM=y | 137 | CONFIG_BACKLIGHT_PWM=y |
120 | CONFIG_FRAMEBUFFER_CONSOLE=y | 138 | CONFIG_FRAMEBUFFER_CONSOLE=y |
121 | CONFIG_FONTS=y | 139 | CONFIG_FONTS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 3cd606905178..dc6f6411bbf5 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -81,6 +81,8 @@ CONFIG_PATA_IMX=y | |||
81 | CONFIG_NETDEVICES=y | 81 | CONFIG_NETDEVICES=y |
82 | # CONFIG_NET_VENDOR_BROADCOM is not set | 82 | # CONFIG_NET_VENDOR_BROADCOM is not set |
83 | # CONFIG_NET_VENDOR_CHELSIO is not set | 83 | # CONFIG_NET_VENDOR_CHELSIO is not set |
84 | CONFIG_CS89x0=y | ||
85 | CONFIG_CS89x0_PLATFORM=y | ||
84 | # CONFIG_NET_VENDOR_FARADAY is not set | 86 | # CONFIG_NET_VENDOR_FARADAY is not set |
85 | # CONFIG_NET_VENDOR_INTEL is not set | 87 | # CONFIG_NET_VENDOR_INTEL is not set |
86 | # CONFIG_NET_VENDOR_MARVELL is not set | 88 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -125,7 +127,39 @@ CONFIG_IMX2_WDT=y | |||
125 | CONFIG_MFD_MC13XXX=y | 127 | CONFIG_MFD_MC13XXX=y |
126 | CONFIG_REGULATOR=y | 128 | CONFIG_REGULATOR=y |
127 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 129 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
130 | CONFIG_REGULATOR_MC13783=y | ||
128 | CONFIG_REGULATOR_MC13892=y | 131 | CONFIG_REGULATOR_MC13892=y |
132 | CONFIG_MEDIA_SUPPORT=y | ||
133 | CONFIG_VIDEO_V4L2=y | ||
134 | CONFIG_VIDEO_DEV=y | ||
135 | CONFIG_VIDEO_V4L2_COMMON=y | ||
136 | CONFIG_VIDEOBUF_GEN=y | ||
137 | CONFIG_VIDEOBUF2_CORE=y | ||
138 | CONFIG_VIDEOBUF2_MEMOPS=y | ||
139 | CONFIG_VIDEOBUF2_DMA_CONTIG=y | ||
140 | CONFIG_VIDEO_CAPTURE_DRIVERS=y | ||
141 | CONFIG_V4L_PLATFORM_DRIVERS=y | ||
142 | CONFIG_SOC_CAMERA=y | ||
143 | CONFIG_SOC_CAMERA_OV2640=y | ||
144 | CONFIG_MX3_VIDEO=y | ||
145 | CONFIG_VIDEO_MX3=y | ||
146 | CONFIG_FB=y | ||
147 | CONFIG_FB_MX3=y | ||
148 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
149 | CONFIG_LCD_CLASS_DEVICE=y | ||
150 | CONFIG_LCD_L4F00242T03=y | ||
151 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
152 | CONFIG_BACKLIGHT_GENERIC=y | ||
153 | CONFIG_DUMMY_CONSOLE=y | ||
154 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
155 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
156 | CONFIG_FONTS=y | ||
157 | CONFIG_FONT_8x8=y | ||
158 | CONFIG_FONT_8x16=y | ||
159 | CONFIG_LOGO=y | ||
160 | CONFIG_LOGO_LINUX_MONO=y | ||
161 | CONFIG_LOGO_LINUX_VGA16=y | ||
162 | CONFIG_LOGO_LINUX_CLUT224=y | ||
129 | CONFIG_USB=y | 163 | CONFIG_USB=y |
130 | CONFIG_USB_EHCI_HCD=y | 164 | CONFIG_USB_EHCI_HCD=y |
131 | CONFIG_USB_EHCI_MXC=y | 165 | CONFIG_USB_EHCI_MXC=y |
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 443675d317e6..a691ef4c6008 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -101,7 +101,7 @@ CONFIG_MFD_ASIC3=y | |||
101 | CONFIG_HTC_EGPIO=y | 101 | CONFIG_HTC_EGPIO=y |
102 | CONFIG_HTC_PASIC3=y | 102 | CONFIG_HTC_PASIC3=y |
103 | CONFIG_REGULATOR=y | 103 | CONFIG_REGULATOR=y |
104 | CONFIG_REGULATOR_BQ24022=y | 104 | CONFIG_REGULATOR_GPIO=y |
105 | CONFIG_FB=y | 105 | CONFIG_FB=y |
106 | CONFIG_FB_PXA=y | 106 | CONFIG_FB_PXA=y |
107 | CONFIG_FB_PXA_OVERLAY=y | 107 | CONFIG_FB_PXA_OVERLAY=y |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 366a7765635b..70709ab0102a 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -891,7 +891,8 @@ static struct platform_device at91sam9263_isi_device = { | |||
891 | .num_resources = ARRAY_SIZE(isi_resources), | 891 | .num_resources = ARRAY_SIZE(isi_resources), |
892 | }; | 892 | }; |
893 | 893 | ||
894 | void __init at91_add_device_isi(void) | 894 | void __init at91_add_device_isi(struct isi_platform_data *data, |
895 | bool use_pck_as_mck) | ||
895 | { | 896 | { |
896 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ | 897 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ |
897 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ | 898 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ |
@@ -904,14 +905,20 @@ void __init at91_add_device_isi(void) | |||
904 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ | 905 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ |
905 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ | 906 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ |
906 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ | 907 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ |
907 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
908 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ | 908 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ |
909 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ | 909 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ |
910 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ | 910 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ |
911 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ | 911 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ |
912 | |||
913 | if (use_pck_as_mck) { | ||
914 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
915 | |||
916 | /* TODO: register the PCK for ISI_MCK and set its parent */ | ||
917 | } | ||
912 | } | 918 | } |
913 | #else | 919 | #else |
914 | void __init at91_add_device_isi(void) {} | 920 | void __init at91_add_device_isi(struct isi_platform_data *data, |
921 | bool use_pck_as_mck) {} | ||
915 | #endif | 922 | #endif |
916 | 923 | ||
917 | 924 | ||
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 96e2adcd5a84..bd4e68cd3e2f 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/clk.h> | ||
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
18 | #include <linux/i2c-gpio.h> | 19 | #include <linux/i2c-gpio.h> |
19 | #include <linux/atmel-mci.h> | 20 | #include <linux/atmel-mci.h> |
@@ -28,7 +29,10 @@ | |||
28 | #include <mach/at_hdmac.h> | 29 | #include <mach/at_hdmac.h> |
29 | #include <mach/atmel-mci.h> | 30 | #include <mach/atmel-mci.h> |
30 | 31 | ||
32 | #include <media/atmel-isi.h> | ||
33 | |||
31 | #include "generic.h" | 34 | #include "generic.h" |
35 | #include "clock.h" | ||
32 | 36 | ||
33 | 37 | ||
34 | /* -------------------------------------------------------------------- | 38 | /* -------------------------------------------------------------------- |
@@ -870,6 +874,96 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
870 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} | 874 | void __init at91_add_device_ac97(struct ac97c_platform_data *data) {} |
871 | #endif | 875 | #endif |
872 | 876 | ||
877 | /* -------------------------------------------------------------------- | ||
878 | * Image Sensor Interface | ||
879 | * -------------------------------------------------------------------- */ | ||
880 | #if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE) | ||
881 | static u64 isi_dmamask = DMA_BIT_MASK(32); | ||
882 | static struct isi_platform_data isi_data; | ||
883 | |||
884 | struct resource isi_resources[] = { | ||
885 | [0] = { | ||
886 | .start = AT91SAM9G45_BASE_ISI, | ||
887 | .end = AT91SAM9G45_BASE_ISI + SZ_16K - 1, | ||
888 | .flags = IORESOURCE_MEM, | ||
889 | }, | ||
890 | [1] = { | ||
891 | .start = AT91SAM9G45_ID_ISI, | ||
892 | .end = AT91SAM9G45_ID_ISI, | ||
893 | .flags = IORESOURCE_IRQ, | ||
894 | }, | ||
895 | }; | ||
896 | |||
897 | static struct platform_device at91sam9g45_isi_device = { | ||
898 | .name = "atmel_isi", | ||
899 | .id = 0, | ||
900 | .dev = { | ||
901 | .dma_mask = &isi_dmamask, | ||
902 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
903 | .platform_data = &isi_data, | ||
904 | }, | ||
905 | .resource = isi_resources, | ||
906 | .num_resources = ARRAY_SIZE(isi_resources), | ||
907 | }; | ||
908 | |||
909 | static struct clk_lookup isi_mck_lookups[] = { | ||
910 | CLKDEV_CON_DEV_ID("isi_mck", "atmel_isi.0", NULL), | ||
911 | }; | ||
912 | |||
913 | void __init at91_add_device_isi(struct isi_platform_data *data, | ||
914 | bool use_pck_as_mck) | ||
915 | { | ||
916 | struct clk *pck; | ||
917 | struct clk *parent; | ||
918 | |||
919 | if (!data) | ||
920 | return; | ||
921 | isi_data = *data; | ||
922 | |||
923 | at91_set_A_periph(AT91_PIN_PB20, 0); /* ISI_D0 */ | ||
924 | at91_set_A_periph(AT91_PIN_PB21, 0); /* ISI_D1 */ | ||
925 | at91_set_A_periph(AT91_PIN_PB22, 0); /* ISI_D2 */ | ||
926 | at91_set_A_periph(AT91_PIN_PB23, 0); /* ISI_D3 */ | ||
927 | at91_set_A_periph(AT91_PIN_PB24, 0); /* ISI_D4 */ | ||
928 | at91_set_A_periph(AT91_PIN_PB25, 0); /* ISI_D5 */ | ||
929 | at91_set_A_periph(AT91_PIN_PB26, 0); /* ISI_D6 */ | ||
930 | at91_set_A_periph(AT91_PIN_PB27, 0); /* ISI_D7 */ | ||
931 | at91_set_A_periph(AT91_PIN_PB28, 0); /* ISI_PCK */ | ||
932 | at91_set_A_periph(AT91_PIN_PB30, 0); /* ISI_HSYNC */ | ||
933 | at91_set_A_periph(AT91_PIN_PB29, 0); /* ISI_VSYNC */ | ||
934 | at91_set_B_periph(AT91_PIN_PB8, 0); /* ISI_PD8 */ | ||
935 | at91_set_B_periph(AT91_PIN_PB9, 0); /* ISI_PD9 */ | ||
936 | at91_set_B_periph(AT91_PIN_PB10, 0); /* ISI_PD10 */ | ||
937 | at91_set_B_periph(AT91_PIN_PB11, 0); /* ISI_PD11 */ | ||
938 | |||
939 | platform_device_register(&at91sam9g45_isi_device); | ||
940 | |||
941 | if (use_pck_as_mck) { | ||
942 | at91_set_B_periph(AT91_PIN_PB31, 0); /* ISI_MCK (PCK1) */ | ||
943 | |||
944 | pck = clk_get(NULL, "pck1"); | ||
945 | parent = clk_get(NULL, "plla"); | ||
946 | |||
947 | BUG_ON(IS_ERR(pck) || IS_ERR(parent)); | ||
948 | |||
949 | if (clk_set_parent(pck, parent)) { | ||
950 | pr_err("Failed to set PCK's parent\n"); | ||
951 | } else { | ||
952 | /* Register PCK as ISI_MCK */ | ||
953 | isi_mck_lookups[0].clk = pck; | ||
954 | clkdev_add_table(isi_mck_lookups, | ||
955 | ARRAY_SIZE(isi_mck_lookups)); | ||
956 | } | ||
957 | |||
958 | clk_put(pck); | ||
959 | clk_put(parent); | ||
960 | } | ||
961 | } | ||
962 | #else | ||
963 | void __init at91_add_device_isi(struct isi_platform_data *data, | ||
964 | bool use_pck_as_mck) {} | ||
965 | #endif | ||
966 | |||
873 | 967 | ||
874 | /* -------------------------------------------------------------------- | 968 | /* -------------------------------------------------------------------- |
875 | * LCD Controller | 969 | * LCD Controller |
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c index eec02cd57ced..1815152001f7 100644 --- a/arch/arm/mach-at91/board-flexibity.c +++ b/arch/arm/mach-at91/board-flexibity.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/arm/mach-at91/board-flexibity.c | 2 | * linux/arch/arm/mach-at91/board-flexibity.c |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Flexibity | 4 | * Copyright (C) 2010-2011 Flexibity |
5 | * Copyright (C) 2005 SAN People | 5 | * Copyright (C) 2005 SAN People |
6 | * Copyright (C) 2006 Atmel | 6 | * Copyright (C) 2006 Atmel |
7 | * | 7 | * |
@@ -62,6 +62,13 @@ static struct at91_udc_data __initdata flexibity_udc_data = { | |||
62 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ | 62 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
63 | }; | 63 | }; |
64 | 64 | ||
65 | /* I2C devices */ | ||
66 | static struct i2c_board_info __initdata flexibity_i2c_devices[] = { | ||
67 | { | ||
68 | I2C_BOARD_INFO("ds1307", 0x68), | ||
69 | }, | ||
70 | }; | ||
71 | |||
65 | /* SPI devices */ | 72 | /* SPI devices */ |
66 | static struct spi_board_info flexibity_spi_devices[] = { | 73 | static struct spi_board_info flexibity_spi_devices[] = { |
67 | { /* DataFlash chip */ | 74 | { /* DataFlash chip */ |
@@ -141,6 +148,9 @@ static void __init flexibity_board_init(void) | |||
141 | at91_add_device_usbh(&flexibity_usbh_data); | 148 | at91_add_device_usbh(&flexibity_usbh_data); |
142 | /* USB Device */ | 149 | /* USB Device */ |
143 | at91_add_device_udc(&flexibity_udc_data); | 150 | at91_add_device_udc(&flexibity_udc_data); |
151 | /* I2C */ | ||
152 | at91_add_device_i2c(flexibity_i2c_devices, | ||
153 | ARRAY_SIZE(flexibity_i2c_devices)); | ||
144 | /* SPI */ | 154 | /* SPI */ |
145 | at91_add_device_spi(flexibity_spi_devices, | 155 | at91_add_device_spi(flexibity_spi_devices, |
146 | ARRAY_SIZE(flexibity_spi_devices)); | 156 | ARRAY_SIZE(flexibity_spi_devices)); |
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index ea0d1b9c2b7b..57497e2b8878 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c | |||
@@ -24,11 +24,13 @@ | |||
24 | #include <linux/gpio_keys.h> | 24 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/leds.h> | 26 | #include <linux/leds.h> |
27 | #include <linux/clk.h> | ||
28 | #include <linux/atmel-mci.h> | 27 | #include <linux/atmel-mci.h> |
28 | #include <linux/delay.h> | ||
29 | 29 | ||
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <video/atmel_lcdc.h> | 31 | #include <video/atmel_lcdc.h> |
32 | #include <media/soc_camera.h> | ||
33 | #include <media/atmel-isi.h> | ||
32 | 34 | ||
33 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
34 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
@@ -185,6 +187,71 @@ static void __init ek_add_device_nand(void) | |||
185 | 187 | ||
186 | 188 | ||
187 | /* | 189 | /* |
190 | * ISI | ||
191 | */ | ||
192 | static struct isi_platform_data __initdata isi_data = { | ||
193 | .frate = ISI_CFG1_FRATE_CAPTURE_ALL, | ||
194 | /* to use codec and preview path simultaneously */ | ||
195 | .full_mode = 1, | ||
196 | .data_width_flags = ISI_DATAWIDTH_8 | ISI_DATAWIDTH_10, | ||
197 | /* ISI_MCK is provided by programmable clock or external clock */ | ||
198 | .mck_hz = 25000000, | ||
199 | }; | ||
200 | |||
201 | |||
202 | /* | ||
203 | * soc-camera OV2640 | ||
204 | */ | ||
205 | #if defined(CONFIG_SOC_CAMERA_OV2640) || \ | ||
206 | defined(CONFIG_SOC_CAMERA_OV2640_MODULE) | ||
207 | static unsigned long isi_camera_query_bus_param(struct soc_camera_link *link) | ||
208 | { | ||
209 | /* ISI board for ek using default 8-bits connection */ | ||
210 | return SOCAM_DATAWIDTH_8; | ||
211 | } | ||
212 | |||
213 | static int i2c_camera_power(struct device *dev, int on) | ||
214 | { | ||
215 | /* enable or disable the camera */ | ||
216 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
217 | at91_set_gpio_output(AT91_PIN_PD13, !on); | ||
218 | |||
219 | if (!on) | ||
220 | goto out; | ||
221 | |||
222 | /* If enabled, give a reset impulse */ | ||
223 | at91_set_gpio_output(AT91_PIN_PD12, 0); | ||
224 | msleep(20); | ||
225 | at91_set_gpio_output(AT91_PIN_PD12, 1); | ||
226 | msleep(100); | ||
227 | |||
228 | out: | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | static struct i2c_board_info i2c_camera = { | ||
233 | I2C_BOARD_INFO("ov2640", 0x30), | ||
234 | }; | ||
235 | |||
236 | static struct soc_camera_link iclink_ov2640 = { | ||
237 | .bus_id = 0, | ||
238 | .board_info = &i2c_camera, | ||
239 | .i2c_adapter_id = 0, | ||
240 | .power = i2c_camera_power, | ||
241 | .query_bus_param = isi_camera_query_bus_param, | ||
242 | }; | ||
243 | |||
244 | static struct platform_device isi_ov2640 = { | ||
245 | .name = "soc-camera-pdrv", | ||
246 | .id = 0, | ||
247 | .dev = { | ||
248 | .platform_data = &iclink_ov2640, | ||
249 | }, | ||
250 | }; | ||
251 | #endif | ||
252 | |||
253 | |||
254 | /* | ||
188 | * LCD Controller | 255 | * LCD Controller |
189 | */ | 256 | */ |
190 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 257 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
@@ -377,7 +444,12 @@ static struct gpio_led ek_pwm_led[] = { | |||
377 | #endif | 444 | #endif |
378 | }; | 445 | }; |
379 | 446 | ||
380 | 447 | static struct platform_device *devices[] __initdata = { | |
448 | #if defined(CONFIG_SOC_CAMERA_OV2640) || \ | ||
449 | defined(CONFIG_SOC_CAMERA_OV2640_MODULE) | ||
450 | &isi_ov2640, | ||
451 | #endif | ||
452 | }; | ||
381 | 453 | ||
382 | static void __init ek_board_init(void) | 454 | static void __init ek_board_init(void) |
383 | { | 455 | { |
@@ -399,6 +471,8 @@ static void __init ek_board_init(void) | |||
399 | ek_add_device_nand(); | 471 | ek_add_device_nand(); |
400 | /* I2C */ | 472 | /* I2C */ |
401 | at91_add_device_i2c(0, NULL, 0); | 473 | at91_add_device_i2c(0, NULL, 0); |
474 | /* ISI, using programmable clock as ISI_MCK */ | ||
475 | at91_add_device_isi(&isi_data, true); | ||
402 | /* LCD Controller */ | 476 | /* LCD Controller */ |
403 | at91_add_device_lcdc(&ek_lcdc_data); | 477 | at91_add_device_lcdc(&ek_lcdc_data); |
404 | /* Touch Screen */ | 478 | /* Touch Screen */ |
@@ -410,6 +484,8 @@ static void __init ek_board_init(void) | |||
410 | /* LEDs */ | 484 | /* LEDs */ |
411 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 485 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); |
412 | at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); | 486 | at91_pwm_leds(ek_pwm_led, ARRAY_SIZE(ek_pwm_led)); |
487 | /* Other platform devices */ | ||
488 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
413 | } | 489 | } |
414 | 490 | ||
415 | MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") | 491 | MACHINE_START(AT91SAM9M10G45EK, "Atmel AT91SAM9M10G45-EK") |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 3b33f07b1e11..dc8d6d4f17cf 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -107,6 +107,8 @@ struct atmel_nand_data { | |||
107 | u8 ale; /* address line number connected to ALE */ | 107 | u8 ale; /* address line number connected to ALE */ |
108 | u8 cle; /* address line number connected to CLE */ | 108 | u8 cle; /* address line number connected to CLE */ |
109 | u8 bus_width_16; /* buswidth is 16 bit */ | 109 | u8 bus_width_16; /* buswidth is 16 bit */ |
110 | u8 correction_cap; /* PMECC correction capability */ | ||
111 | u16 sector_size; /* Sector size for PMECC */ | ||
110 | struct mtd_partition *parts; | 112 | struct mtd_partition *parts; |
111 | unsigned int num_parts; | 113 | unsigned int num_parts; |
112 | }; | 114 | }; |
@@ -179,7 +181,9 @@ extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data); | |||
179 | extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); | 181 | extern void __init at91_add_device_ac97(struct ac97c_platform_data *data); |
180 | 182 | ||
181 | /* ISI */ | 183 | /* ISI */ |
182 | extern void __init at91_add_device_isi(void); | 184 | struct isi_platform_data; |
185 | extern void __init at91_add_device_isi(struct isi_platform_data *data, | ||
186 | bool use_pck_as_mck); | ||
183 | 187 | ||
184 | /* Touchscreen Controller */ | 188 | /* Touchscreen Controller */ |
185 | struct at91_tsadcc_data { | 189 | struct at91_tsadcc_data { |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 98997c2da262..2bf7d6e23989 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -42,6 +42,7 @@ config SOC_EXYNOS4212 | |||
42 | bool "SAMSUNG EXYNOS4212" | 42 | bool "SAMSUNG EXYNOS4212" |
43 | default y | 43 | default y |
44 | depends on ARCH_EXYNOS4 | 44 | depends on ARCH_EXYNOS4 |
45 | select SAMSUNG_DMADEV | ||
45 | select S5P_PM if PM | 46 | select S5P_PM if PM |
46 | select S5P_SLEEP if PM | 47 | select S5P_SLEEP if PM |
47 | help | 48 | help |
@@ -51,6 +52,7 @@ config SOC_EXYNOS4412 | |||
51 | bool "SAMSUNG EXYNOS4412" | 52 | bool "SAMSUNG EXYNOS4412" |
52 | default y | 53 | default y |
53 | depends on ARCH_EXYNOS4 | 54 | depends on ARCH_EXYNOS4 |
55 | select SAMSUNG_DMADEV | ||
54 | help | 56 | help |
55 | Enable EXYNOS4412 SoC support | 57 | Enable EXYNOS4412 SoC support |
56 | 58 | ||
@@ -335,6 +337,7 @@ config MACH_SMDK4212 | |||
335 | select SAMSUNG_DEV_BACKLIGHT | 337 | select SAMSUNG_DEV_BACKLIGHT |
336 | select SAMSUNG_DEV_KEYPAD | 338 | select SAMSUNG_DEV_KEYPAD |
337 | select SAMSUNG_DEV_PWM | 339 | select SAMSUNG_DEV_PWM |
340 | select EXYNOS4_DEV_DMA | ||
338 | select EXYNOS4_SETUP_I2C1 | 341 | select EXYNOS4_SETUP_I2C1 |
339 | select EXYNOS4_SETUP_I2C3 | 342 | select EXYNOS4_SETUP_I2C3 |
340 | select EXYNOS4_SETUP_I2C7 | 343 | select EXYNOS4_SETUP_I2C7 |
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c index 060dde7d7ad6..200159dcb341 100644 --- a/arch/arm/mach-exynos/clock-exynos4.c +++ b/arch/arm/mach-exynos/clock-exynos4.c | |||
@@ -789,6 +789,13 @@ static struct clk exynos4_clk_pdma1 = { | |||
789 | .ctrlbit = (1 << 1), | 789 | .ctrlbit = (1 << 1), |
790 | }; | 790 | }; |
791 | 791 | ||
792 | static struct clk exynos4_clk_mdma1 = { | ||
793 | .name = "dma", | ||
794 | .devname = "dma-pl330.2", | ||
795 | .enable = exynos4_clk_ip_image_ctrl, | ||
796 | .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)), | ||
797 | }; | ||
798 | |||
792 | struct clk *exynos4_clkset_group_list[] = { | 799 | struct clk *exynos4_clkset_group_list[] = { |
793 | [0] = &clk_ext_xtal_mux, | 800 | [0] = &clk_ext_xtal_mux, |
794 | [1] = &clk_xusbxti, | 801 | [1] = &clk_xusbxti, |
@@ -1307,6 +1314,7 @@ static struct clksrc_clk *exynos4_sysclks[] = { | |||
1307 | static struct clk *exynos4_clk_cdev[] = { | 1314 | static struct clk *exynos4_clk_cdev[] = { |
1308 | &exynos4_clk_pdma0, | 1315 | &exynos4_clk_pdma0, |
1309 | &exynos4_clk_pdma1, | 1316 | &exynos4_clk_pdma1, |
1317 | &exynos4_clk_mdma1, | ||
1310 | }; | 1318 | }; |
1311 | 1319 | ||
1312 | static struct clksrc_clk *exynos4_clksrc_cdev[] = { | 1320 | static struct clksrc_clk *exynos4_clksrc_cdev[] = { |
@@ -1335,6 +1343,7 @@ static struct clk_lookup exynos4_clk_lookup[] = { | |||
1335 | CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), | 1343 | CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), |
1336 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), | 1344 | CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), |
1337 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), | 1345 | CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), |
1346 | CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), | ||
1338 | CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), | 1347 | CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), |
1339 | CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), | 1348 | CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), |
1340 | CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), | 1349 | CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), |
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c index 25f3ef2c36e5..13607c4328b3 100644 --- a/arch/arm/mach-exynos/dma.c +++ b/arch/arm/mach-exynos/dma.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
30 | #include <plat/devs.h> | 30 | #include <plat/devs.h> |
31 | #include <plat/irqs.h> | 31 | #include <plat/irqs.h> |
32 | #include <plat/cpu.h> | ||
32 | 33 | ||
33 | #include <mach/map.h> | 34 | #include <mach/map.h> |
34 | #include <mach/irqs.h> | 35 | #include <mach/irqs.h> |
@@ -36,7 +37,7 @@ | |||
36 | 37 | ||
37 | static u64 dma_dmamask = DMA_BIT_MASK(32); | 38 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
38 | 39 | ||
39 | static u8 pdma0_peri[] = { | 40 | static u8 exynos4210_pdma0_peri[] = { |
40 | DMACH_PCM0_RX, | 41 | DMACH_PCM0_RX, |
41 | DMACH_PCM0_TX, | 42 | DMACH_PCM0_TX, |
42 | DMACH_PCM2_RX, | 43 | DMACH_PCM2_RX, |
@@ -69,15 +70,47 @@ static u8 pdma0_peri[] = { | |||
69 | DMACH_AC97_PCMOUT, | 70 | DMACH_AC97_PCMOUT, |
70 | }; | 71 | }; |
71 | 72 | ||
72 | static struct dma_pl330_platdata exynos4_pdma0_pdata = { | 73 | static u8 exynos4212_pdma0_peri[] = { |
73 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), | 74 | DMACH_PCM0_RX, |
74 | .peri_id = pdma0_peri, | 75 | DMACH_PCM0_TX, |
76 | DMACH_PCM2_RX, | ||
77 | DMACH_PCM2_TX, | ||
78 | DMACH_MIPI_HSI0, | ||
79 | DMACH_MIPI_HSI1, | ||
80 | DMACH_SPI0_RX, | ||
81 | DMACH_SPI0_TX, | ||
82 | DMACH_SPI2_RX, | ||
83 | DMACH_SPI2_TX, | ||
84 | DMACH_I2S0S_TX, | ||
85 | DMACH_I2S0_RX, | ||
86 | DMACH_I2S0_TX, | ||
87 | DMACH_I2S2_RX, | ||
88 | DMACH_I2S2_TX, | ||
89 | DMACH_UART0_RX, | ||
90 | DMACH_UART0_TX, | ||
91 | DMACH_UART2_RX, | ||
92 | DMACH_UART2_TX, | ||
93 | DMACH_UART4_RX, | ||
94 | DMACH_UART4_TX, | ||
95 | DMACH_SLIMBUS0_RX, | ||
96 | DMACH_SLIMBUS0_TX, | ||
97 | DMACH_SLIMBUS2_RX, | ||
98 | DMACH_SLIMBUS2_TX, | ||
99 | DMACH_SLIMBUS4_RX, | ||
100 | DMACH_SLIMBUS4_TX, | ||
101 | DMACH_AC97_MICIN, | ||
102 | DMACH_AC97_PCMIN, | ||
103 | DMACH_AC97_PCMOUT, | ||
104 | DMACH_MIPI_HSI4, | ||
105 | DMACH_MIPI_HSI5, | ||
75 | }; | 106 | }; |
76 | 107 | ||
108 | struct dma_pl330_platdata exynos4_pdma0_pdata; | ||
109 | |||
77 | static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, | 110 | static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, |
78 | EXYNOS4_PA_PDMA0, {IRQ_PDMA0}, &exynos4_pdma0_pdata); | 111 | EXYNOS4_PA_PDMA0, {IRQ_PDMA0}, &exynos4_pdma0_pdata); |
79 | 112 | ||
80 | static u8 pdma1_peri[] = { | 113 | static u8 exynos4210_pdma1_peri[] = { |
81 | DMACH_PCM0_RX, | 114 | DMACH_PCM0_RX, |
82 | DMACH_PCM0_TX, | 115 | DMACH_PCM0_TX, |
83 | DMACH_PCM1_RX, | 116 | DMACH_PCM1_RX, |
@@ -105,19 +138,84 @@ static u8 pdma1_peri[] = { | |||
105 | DMACH_SLIMBUS5_TX, | 138 | DMACH_SLIMBUS5_TX, |
106 | }; | 139 | }; |
107 | 140 | ||
108 | static struct dma_pl330_platdata exynos4_pdma1_pdata = { | 141 | static u8 exynos4212_pdma1_peri[] = { |
109 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), | 142 | DMACH_PCM0_RX, |
110 | .peri_id = pdma1_peri, | 143 | DMACH_PCM0_TX, |
144 | DMACH_PCM1_RX, | ||
145 | DMACH_PCM1_TX, | ||
146 | DMACH_MIPI_HSI2, | ||
147 | DMACH_MIPI_HSI3, | ||
148 | DMACH_SPI1_RX, | ||
149 | DMACH_SPI1_TX, | ||
150 | DMACH_I2S0S_TX, | ||
151 | DMACH_I2S0_RX, | ||
152 | DMACH_I2S0_TX, | ||
153 | DMACH_I2S1_RX, | ||
154 | DMACH_I2S1_TX, | ||
155 | DMACH_UART0_RX, | ||
156 | DMACH_UART0_TX, | ||
157 | DMACH_UART1_RX, | ||
158 | DMACH_UART1_TX, | ||
159 | DMACH_UART3_RX, | ||
160 | DMACH_UART3_TX, | ||
161 | DMACH_SLIMBUS1_RX, | ||
162 | DMACH_SLIMBUS1_TX, | ||
163 | DMACH_SLIMBUS3_RX, | ||
164 | DMACH_SLIMBUS3_TX, | ||
165 | DMACH_SLIMBUS5_RX, | ||
166 | DMACH_SLIMBUS5_TX, | ||
167 | DMACH_SLIMBUS0AUX_RX, | ||
168 | DMACH_SLIMBUS0AUX_TX, | ||
169 | DMACH_SPDIF, | ||
170 | DMACH_MIPI_HSI6, | ||
171 | DMACH_MIPI_HSI7, | ||
111 | }; | 172 | }; |
112 | 173 | ||
174 | static struct dma_pl330_platdata exynos4_pdma1_pdata; | ||
175 | |||
113 | static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, | 176 | static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, |
114 | EXYNOS4_PA_PDMA1, {IRQ_PDMA1}, &exynos4_pdma1_pdata); | 177 | EXYNOS4_PA_PDMA1, {IRQ_PDMA1}, &exynos4_pdma1_pdata); |
115 | 178 | ||
179 | static u8 mdma_peri[] = { | ||
180 | DMACH_MTOM_0, | ||
181 | DMACH_MTOM_1, | ||
182 | DMACH_MTOM_2, | ||
183 | DMACH_MTOM_3, | ||
184 | DMACH_MTOM_4, | ||
185 | DMACH_MTOM_5, | ||
186 | DMACH_MTOM_6, | ||
187 | DMACH_MTOM_7, | ||
188 | }; | ||
189 | |||
190 | static struct dma_pl330_platdata exynos4_mdma1_pdata = { | ||
191 | .nr_valid_peri = ARRAY_SIZE(mdma_peri), | ||
192 | .peri_id = mdma_peri, | ||
193 | }; | ||
194 | |||
195 | static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330, | ||
196 | EXYNOS4_PA_MDMA1, {IRQ_MDMA1}, &exynos4_mdma1_pdata); | ||
197 | |||
116 | static int __init exynos4_dma_init(void) | 198 | static int __init exynos4_dma_init(void) |
117 | { | 199 | { |
118 | if (of_have_populated_dt()) | 200 | if (of_have_populated_dt()) |
119 | return 0; | 201 | return 0; |
120 | 202 | ||
203 | if (soc_is_exynos4210()) { | ||
204 | exynos4_pdma0_pdata.nr_valid_peri = | ||
205 | ARRAY_SIZE(exynos4210_pdma0_peri); | ||
206 | exynos4_pdma0_pdata.peri_id = exynos4210_pdma0_peri; | ||
207 | exynos4_pdma1_pdata.nr_valid_peri = | ||
208 | ARRAY_SIZE(exynos4210_pdma1_peri); | ||
209 | exynos4_pdma1_pdata.peri_id = exynos4210_pdma1_peri; | ||
210 | } else if (soc_is_exynos4212() || soc_is_exynos4412()) { | ||
211 | exynos4_pdma0_pdata.nr_valid_peri = | ||
212 | ARRAY_SIZE(exynos4212_pdma0_peri); | ||
213 | exynos4_pdma0_pdata.peri_id = exynos4212_pdma0_peri; | ||
214 | exynos4_pdma1_pdata.nr_valid_peri = | ||
215 | ARRAY_SIZE(exynos4212_pdma1_peri); | ||
216 | exynos4_pdma1_pdata.peri_id = exynos4212_pdma1_peri; | ||
217 | } | ||
218 | |||
121 | dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); | 219 | dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); |
122 | dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); | 220 | dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); |
123 | amba_device_register(&exynos4_pdma0_device, &iomem_resource); | 221 | amba_device_register(&exynos4_pdma0_device, &iomem_resource); |
@@ -126,6 +224,9 @@ static int __init exynos4_dma_init(void) | |||
126 | dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); | 224 | dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); |
127 | amba_device_register(&exynos4_pdma1_device, &iomem_resource); | 225 | amba_device_register(&exynos4_pdma1_device, &iomem_resource); |
128 | 226 | ||
227 | dma_cap_set(DMA_MEMCPY, exynos4_mdma1_pdata.cap_mask); | ||
228 | amba_device_register(&exynos4_mdma1_device, &iomem_resource); | ||
229 | |||
129 | return 0; | 230 | return 0; |
130 | } | 231 | } |
131 | arch_initcall(exynos4_dma_init); | 232 | arch_initcall(exynos4_dma_init); |
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h index f77bce04789a..1d401c957835 100644 --- a/arch/arm/mach-exynos/include/mach/irqs.h +++ b/arch/arm/mach-exynos/include/mach/irqs.h | |||
@@ -43,6 +43,8 @@ | |||
43 | #define IRQ_EINT15 IRQ_SPI(31) | 43 | #define IRQ_EINT15 IRQ_SPI(31) |
44 | #define IRQ_EINT16_31 IRQ_SPI(32) | 44 | #define IRQ_EINT16_31 IRQ_SPI(32) |
45 | 45 | ||
46 | #define IRQ_MDMA0 IRQ_SPI(33) | ||
47 | #define IRQ_MDMA1 IRQ_SPI(34) | ||
46 | #define IRQ_PDMA0 IRQ_SPI(35) | 48 | #define IRQ_PDMA0 IRQ_SPI(35) |
47 | #define IRQ_PDMA1 IRQ_SPI(36) | 49 | #define IRQ_PDMA1 IRQ_SPI(36) |
48 | #define IRQ_TIMER0_VIC IRQ_SPI(37) | 50 | #define IRQ_TIMER0_VIC IRQ_SPI(37) |
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index a8cd65fcc685..609127df9b02 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -72,7 +72,8 @@ | |||
72 | #define EXYNOS4_PA_TWD 0x10500600 | 72 | #define EXYNOS4_PA_TWD 0x10500600 |
73 | #define EXYNOS4_PA_L2CC 0x10502000 | 73 | #define EXYNOS4_PA_L2CC 0x10502000 |
74 | 74 | ||
75 | #define EXYNOS4_PA_MDMA 0x10810000 | 75 | #define EXYNOS4_PA_MDMA0 0x10810000 |
76 | #define EXYNOS4_PA_MDMA1 0x12840000 | ||
76 | #define EXYNOS4_PA_PDMA0 0x12680000 | 77 | #define EXYNOS4_PA_PDMA0 0x12680000 |
77 | #define EXYNOS4_PA_PDMA1 0x12690000 | 78 | #define EXYNOS4_PA_PDMA1 0x12690000 |
78 | 79 | ||
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 191f5c675fe1..82ea6fccfb34 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -117,7 +117,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | static struct regulator_consumer_supply emmc_supplies[] = { | 119 | static struct regulator_consumer_supply emmc_supplies[] = { |
120 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | 120 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), |
121 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), | 121 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), |
122 | }; | 122 | }; |
123 | 123 | ||
@@ -418,7 +418,7 @@ static struct regulator_consumer_supply __initdata max8997_ldo12_[] = { | |||
418 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ | 418 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ |
419 | }; | 419 | }; |
420 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { | 420 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { |
421 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */ | 421 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */ |
422 | }; | 422 | }; |
423 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { | 423 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { |
424 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), | 424 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 0b944eb66ebd..28658da9f423 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -752,7 +752,7 @@ static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { | |||
752 | }; | 752 | }; |
753 | 753 | ||
754 | static struct regulator_consumer_supply mmc0_supplies[] = { | 754 | static struct regulator_consumer_supply mmc0_supplies[] = { |
755 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | 755 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), |
756 | }; | 756 | }; |
757 | 757 | ||
758 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { | 758 | static struct regulator_init_data mmc0_fixed_voltage_init_data = { |
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 37a5d715a6c2..feeebde71deb 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -298,6 +298,7 @@ config MACH_MX27_3DS | |||
298 | select IMX_HAVE_PLATFORM_IMX_I2C | 298 | select IMX_HAVE_PLATFORM_IMX_I2C |
299 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | 299 | select IMX_HAVE_PLATFORM_IMX_KEYPAD |
300 | select IMX_HAVE_PLATFORM_IMX_UART | 300 | select IMX_HAVE_PLATFORM_IMX_UART |
301 | select IMX_HAVE_PLATFORM_MX2_CAMERA | ||
301 | select IMX_HAVE_PLATFORM_MXC_EHCI | 302 | select IMX_HAVE_PLATFORM_MXC_EHCI |
302 | select IMX_HAVE_PLATFORM_MXC_MMC | 303 | select IMX_HAVE_PLATFORM_MXC_MMC |
303 | select IMX_HAVE_PLATFORM_SPI_IMX | 304 | select IMX_HAVE_PLATFORM_SPI_IMX |
diff --git a/arch/arm/mach-imx/clock-imx6q.c b/arch/arm/mach-imx/clock-imx6q.c index 2d88f8b9a454..111c328f5420 100644 --- a/arch/arm/mach-imx/clock-imx6q.c +++ b/arch/arm/mach-imx/clock-imx6q.c | |||
@@ -329,6 +329,12 @@ | |||
329 | #define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) | 329 | #define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26) |
330 | #define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27) | 330 | #define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27) |
331 | 331 | ||
332 | #define BP_CCOSR_CKO1_EN 7 | ||
333 | #define BP_CCOSR_CKO1_PODF 4 | ||
334 | #define BM_CCOSR_CKO1_PODF (0x7 << 4) | ||
335 | #define BP_CCOSR_CKO1_SEL 0 | ||
336 | #define BM_CCOSR_CKO1_SEL (0xf << 0) | ||
337 | |||
332 | #define FREQ_480M 480000000 | 338 | #define FREQ_480M 480000000 |
333 | #define FREQ_528M 528000000 | 339 | #define FREQ_528M 528000000 |
334 | #define FREQ_594M 594000000 | 340 | #define FREQ_594M 594000000 |
@@ -393,6 +399,7 @@ static struct clk ipu1_di1_clk; | |||
393 | static struct clk ipu2_di0_clk; | 399 | static struct clk ipu2_di0_clk; |
394 | static struct clk ipu2_di1_clk; | 400 | static struct clk ipu2_di1_clk; |
395 | static struct clk enfc_clk; | 401 | static struct clk enfc_clk; |
402 | static struct clk cko1_clk; | ||
396 | static struct clk dummy_clk = {}; | 403 | static struct clk dummy_clk = {}; |
397 | 404 | ||
398 | static unsigned long external_high_reference; | 405 | static unsigned long external_high_reference; |
@@ -938,6 +945,24 @@ static void _clk_disable(struct clk *clk) | |||
938 | writel_relaxed(reg, clk->enable_reg); | 945 | writel_relaxed(reg, clk->enable_reg); |
939 | } | 946 | } |
940 | 947 | ||
948 | static int _clk_enable_1b(struct clk *clk) | ||
949 | { | ||
950 | u32 reg; | ||
951 | reg = readl_relaxed(clk->enable_reg); | ||
952 | reg |= 0x1 << clk->enable_shift; | ||
953 | writel_relaxed(reg, clk->enable_reg); | ||
954 | |||
955 | return 0; | ||
956 | } | ||
957 | |||
958 | static void _clk_disable_1b(struct clk *clk) | ||
959 | { | ||
960 | u32 reg; | ||
961 | reg = readl_relaxed(clk->enable_reg); | ||
962 | reg &= ~(0x1 << clk->enable_shift); | ||
963 | writel_relaxed(reg, clk->enable_reg); | ||
964 | } | ||
965 | |||
941 | struct divider { | 966 | struct divider { |
942 | struct clk *clk; | 967 | struct clk *clk; |
943 | void __iomem *reg; | 968 | void __iomem *reg; |
@@ -983,6 +1008,7 @@ DEF_CLK_DIV1(ipu2_di0_pre_div, &ipu2_di0_pre_clk, CSCDR2, IPU2_DI0_PRE); | |||
983 | DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); | 1008 | DEF_CLK_DIV1(ipu2_di1_pre_div, &ipu2_di1_pre_clk, CSCDR2, IPU2_DI1_PRE); |
984 | DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); | 1009 | DEF_CLK_DIV1(ipu1_div, &ipu1_clk, CSCDR3, IPU1_HSP); |
985 | DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); | 1010 | DEF_CLK_DIV1(ipu2_div, &ipu2_clk, CSCDR3, IPU2_HSP); |
1011 | DEF_CLK_DIV1(cko1_div, &cko1_clk, CCOSR, CKO1); | ||
986 | 1012 | ||
987 | #define DEF_CLK_DIV2(d, c, r, b) \ | 1013 | #define DEF_CLK_DIV2(d, c, r, b) \ |
988 | static struct divider d = { \ | 1014 | static struct divider d = { \ |
@@ -1038,6 +1064,7 @@ static struct divider *dividers[] = { | |||
1038 | &enfc_div, | 1064 | &enfc_div, |
1039 | &spdif_div, | 1065 | &spdif_div, |
1040 | &asrc_serial_div, | 1066 | &asrc_serial_div, |
1067 | &cko1_div, | ||
1041 | }; | 1068 | }; |
1042 | 1069 | ||
1043 | static unsigned long ldb_di_clk_get_rate(struct clk *clk) | 1070 | static unsigned long ldb_di_clk_get_rate(struct clk *clk) |
@@ -1625,6 +1652,32 @@ DEF_IPU_DI_MUX(CSCDR2, 2, 1); | |||
1625 | DEF_IPU_MUX(1); | 1652 | DEF_IPU_MUX(1); |
1626 | DEF_IPU_MUX(2); | 1653 | DEF_IPU_MUX(2); |
1627 | 1654 | ||
1655 | static struct multiplexer cko1_mux = { | ||
1656 | .clk = &cko1_clk, | ||
1657 | .reg = CCOSR, | ||
1658 | .bp = BP_CCOSR_CKO1_SEL, | ||
1659 | .bm = BM_CCOSR_CKO1_SEL, | ||
1660 | .parents = { | ||
1661 | &pll3_usb_otg, | ||
1662 | &pll2_bus, | ||
1663 | &pll1_sys, | ||
1664 | &pll5_video, | ||
1665 | &dummy_clk, | ||
1666 | &axi_clk, | ||
1667 | &enfc_clk, | ||
1668 | &ipu1_di0_clk, | ||
1669 | &ipu1_di1_clk, | ||
1670 | &ipu2_di0_clk, | ||
1671 | &ipu2_di1_clk, | ||
1672 | &ahb_clk, | ||
1673 | &ipg_clk, | ||
1674 | &ipg_perclk, | ||
1675 | &ckil_clk, | ||
1676 | &pll4_audio, | ||
1677 | NULL | ||
1678 | }, | ||
1679 | }; | ||
1680 | |||
1628 | static struct multiplexer *multiplexers[] = { | 1681 | static struct multiplexer *multiplexers[] = { |
1629 | &axi_mux, | 1682 | &axi_mux, |
1630 | &periph_mux, | 1683 | &periph_mux, |
@@ -1667,6 +1720,7 @@ static struct multiplexer *multiplexers[] = { | |||
1667 | &ipu2_di1_mux, | 1720 | &ipu2_di1_mux, |
1668 | &ipu1_mux, | 1721 | &ipu1_mux, |
1669 | &ipu2_mux, | 1722 | &ipu2_mux, |
1723 | &cko1_mux, | ||
1670 | }; | 1724 | }; |
1671 | 1725 | ||
1672 | static int _clk_set_parent(struct clk *clk, struct clk *parent) | 1726 | static int _clk_set_parent(struct clk *clk, struct clk *parent) |
@@ -1690,7 +1744,7 @@ static int _clk_set_parent(struct clk *clk, struct clk *parent) | |||
1690 | break; | 1744 | break; |
1691 | i++; | 1745 | i++; |
1692 | } | 1746 | } |
1693 | if (!m->parents[i]) | 1747 | if (!m->parents[i] || m->parents[i] == &dummy_clk) |
1694 | return -EINVAL; | 1748 | return -EINVAL; |
1695 | 1749 | ||
1696 | val = readl_relaxed(m->reg); | 1750 | val = readl_relaxed(m->reg); |
@@ -1745,6 +1799,20 @@ DEF_NG_CLK(asrc_serial_clk, &pll3_usb_otg); | |||
1745 | .secondary = s, \ | 1799 | .secondary = s, \ |
1746 | } | 1800 | } |
1747 | 1801 | ||
1802 | #define DEF_CLK_1B(name, er, es, p, s) \ | ||
1803 | static struct clk name = { \ | ||
1804 | .enable_reg = er, \ | ||
1805 | .enable_shift = es, \ | ||
1806 | .enable = _clk_enable_1b, \ | ||
1807 | .disable = _clk_disable_1b, \ | ||
1808 | .get_rate = _clk_get_rate, \ | ||
1809 | .set_rate = _clk_set_rate, \ | ||
1810 | .round_rate = _clk_round_rate, \ | ||
1811 | .set_parent = _clk_set_parent, \ | ||
1812 | .parent = p, \ | ||
1813 | .secondary = s, \ | ||
1814 | } | ||
1815 | |||
1748 | DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL); | 1816 | DEF_CLK(aips_tz1_clk, CCGR0, CG0, &ahb_clk, NULL); |
1749 | DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL); | 1817 | DEF_CLK(aips_tz2_clk, CCGR0, CG1, &ahb_clk, NULL); |
1750 | DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL); | 1818 | DEF_CLK(apbh_dma_clk, CCGR0, CG2, &ahb_clk, NULL); |
@@ -1811,6 +1879,7 @@ DEF_CLK(usdhc4_clk, CCGR6, CG4, &pll2_pfd_400m, NULL); | |||
1811 | DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); | 1879 | DEF_CLK(emi_slow_clk, CCGR6, CG5, &axi_clk, NULL); |
1812 | DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); | 1880 | DEF_CLK(vdo_axi_clk, CCGR6, CG6, &axi_clk, NULL); |
1813 | DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); | 1881 | DEF_CLK(vpu_clk, CCGR6, CG7, &axi_clk, NULL); |
1882 | DEF_CLK_1B(cko1_clk, CCOSR, BP_CCOSR_CKO1_EN, &pll2_bus, NULL); | ||
1814 | 1883 | ||
1815 | static int pcie_clk_enable(struct clk *clk) | 1884 | static int pcie_clk_enable(struct clk *clk) |
1816 | { | 1885 | { |
@@ -1922,6 +1991,7 @@ static struct clk_lookup lookups[] = { | |||
1922 | _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), | 1991 | _REGISTER_CLOCK(NULL, "gpmi_io_clk", gpmi_io_clk), |
1923 | _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), | 1992 | _REGISTER_CLOCK(NULL, "usboh3_clk", usboh3_clk), |
1924 | _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), | 1993 | _REGISTER_CLOCK(NULL, "sata_clk", sata_clk), |
1994 | _REGISTER_CLOCK(NULL, "cko1_clk", cko1_clk), | ||
1925 | }; | 1995 | }; |
1926 | 1996 | ||
1927 | int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) | 1997 | int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) |
@@ -2029,6 +2099,8 @@ int __init mx6q_clocks_init(void) | |||
2029 | clk_set_rate(&usdhc3_clk, 49500000); | 2099 | clk_set_rate(&usdhc3_clk, 49500000); |
2030 | clk_set_rate(&usdhc4_clk, 49500000); | 2100 | clk_set_rate(&usdhc4_clk, 49500000); |
2031 | 2101 | ||
2102 | clk_set_parent(&cko1_clk, &ahb_clk); | ||
2103 | |||
2032 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); | 2104 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); |
2033 | base = of_iomap(np, 0); | 2105 | base = of_iomap(np, 0); |
2034 | WARN_ON(!base); | 2106 | WARN_ON(!base); |
diff --git a/arch/arm/mach-imx/lluart.c b/arch/arm/mach-imx/lluart.c index d4ab6f29a766..0213f8dcee81 100644 --- a/arch/arm/mach-imx/lluart.c +++ b/arch/arm/mach-imx/lluart.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
18 | 18 | ||
19 | static struct map_desc imx_lluart_desc = { | 19 | static struct map_desc imx_lluart_desc = { |
20 | #ifdef CONFIG_DEBUG_IMX6Q_UART | 20 | #ifdef CONFIG_DEBUG_IMX6Q_UART4 |
21 | .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), | 21 | .virtual = MX6Q_IO_P2V(MX6Q_UART4_BASE_ADDR), |
22 | .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), | 22 | .pfn = __phys_to_pfn(MX6Q_UART4_BASE_ADDR), |
23 | .length = MX6Q_UART4_SIZE, | 23 | .length = MX6Q_UART4_SIZE, |
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c index 8d9f95514b1f..e432d4acee1f 100644 --- a/arch/arm/mach-imx/mach-mx21ads.c +++ b/arch/arm/mach-imx/mach-mx21ads.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ | 37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ |
38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) | 38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) |
39 | 39 | ||
40 | #define MX21ADS_CS8900A_MMIO_SIZE 0x200000 | ||
40 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) | 41 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) |
41 | #define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000) | ||
42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) | 42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) |
43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) | 43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) |
44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) | 44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) |
@@ -159,6 +159,18 @@ static struct platform_device mx21ads_nor_mtd_device = { | |||
159 | .resource = &mx21ads_flash_resource, | 159 | .resource = &mx21ads_flash_resource, |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static const struct resource mx21ads_cs8900_resources[] __initconst = { | ||
163 | DEFINE_RES_MEM(MX21_CS1_BASE_ADDR, MX21ADS_CS8900A_MMIO_SIZE), | ||
164 | DEFINE_RES_IRQ(MX21ADS_CS8900A_IRQ), | ||
165 | }; | ||
166 | |||
167 | static const struct platform_device_info mx21ads_cs8900_devinfo __initconst = { | ||
168 | .name = "cs89x0", | ||
169 | .id = 0, | ||
170 | .res = mx21ads_cs8900_resources, | ||
171 | .num_res = ARRAY_SIZE(mx21ads_cs8900_resources), | ||
172 | }; | ||
173 | |||
162 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { | 174 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { |
163 | .flags = IMXUART_HAVE_RTSCTS, | 175 | .flags = IMXUART_HAVE_RTSCTS, |
164 | }; | 176 | }; |
@@ -292,6 +304,8 @@ static void __init mx21ads_board_init(void) | |||
292 | imx21_add_mxc_nand(&mx21ads_nand_board_info); | 304 | imx21_add_mxc_nand(&mx21ads_nand_board_info); |
293 | 305 | ||
294 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 306 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
307 | platform_device_register_full( | ||
308 | (struct platform_device_info *)&mx21ads_cs8900_devinfo); | ||
295 | } | 309 | } |
296 | 310 | ||
297 | static void __init mx21ads_timer_init(void) | 311 | static void __init mx21ads_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index 18f35816706a..c6d385c52257 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/regulator/machine.h> | 31 | #include <linux/regulator/machine.h> |
32 | #include <linux/spi/l4f00242t03.h> | 32 | #include <linux/spi/l4f00242t03.h> |
33 | 33 | ||
34 | #include <media/soc_camera.h> | ||
35 | |||
34 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 37 | #include <asm/mach/arch.h> |
36 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
@@ -52,6 +54,8 @@ | |||
52 | #define SD1_CD IMX_GPIO_NR(2, 26) | 54 | #define SD1_CD IMX_GPIO_NR(2, 26) |
53 | #define LCD_RESET IMX_GPIO_NR(1, 3) | 55 | #define LCD_RESET IMX_GPIO_NR(1, 3) |
54 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) | 56 | #define LCD_ENABLE IMX_GPIO_NR(1, 31) |
57 | #define CSI_PWRDWN IMX_GPIO_NR(4, 19) | ||
58 | #define CSI_RESET IMX_GPIO_NR(3, 6) | ||
55 | 59 | ||
56 | static const int mx27pdk_pins[] __initconst = { | 60 | static const int mx27pdk_pins[] __initconst = { |
57 | /* UART1 */ | 61 | /* UART1 */ |
@@ -141,6 +145,26 @@ static const int mx27pdk_pins[] __initconst = { | |||
141 | PA30_PF_CONTRAST, | 145 | PA30_PF_CONTRAST, |
142 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, | 146 | LCD_ENABLE | GPIO_GPIO | GPIO_OUT, |
143 | LCD_RESET | GPIO_GPIO | GPIO_OUT, | 147 | LCD_RESET | GPIO_GPIO | GPIO_OUT, |
148 | /* CSI */ | ||
149 | PB10_PF_CSI_D0, | ||
150 | PB11_PF_CSI_D1, | ||
151 | PB12_PF_CSI_D2, | ||
152 | PB13_PF_CSI_D3, | ||
153 | PB14_PF_CSI_D4, | ||
154 | PB15_PF_CSI_MCLK, | ||
155 | PB16_PF_CSI_PIXCLK, | ||
156 | PB17_PF_CSI_D5, | ||
157 | PB18_PF_CSI_D6, | ||
158 | PB19_PF_CSI_D7, | ||
159 | PB20_PF_CSI_VSYNC, | ||
160 | PB21_PF_CSI_HSYNC, | ||
161 | CSI_PWRDWN | GPIO_GPIO | GPIO_OUT, | ||
162 | CSI_RESET | GPIO_GPIO | GPIO_OUT, | ||
163 | }; | ||
164 | |||
165 | static struct gpio mx27_3ds_camera_gpios[] = { | ||
166 | { CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" }, | ||
167 | { CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" }, | ||
144 | }; | 168 | }; |
145 | 169 | ||
146 | static const struct imxuart_platform_data uart_pdata __initconst = { | 170 | static const struct imxuart_platform_data uart_pdata __initconst = { |
@@ -242,6 +266,7 @@ static struct regulator_init_data gpo_init = { | |||
242 | 266 | ||
243 | static struct regulator_consumer_supply vmmc1_consumers[] = { | 267 | static struct regulator_consumer_supply vmmc1_consumers[] = { |
244 | REGULATOR_SUPPLY("vcore", "spi0.0"), | 268 | REGULATOR_SUPPLY("vcore", "spi0.0"), |
269 | REGULATOR_SUPPLY("cmos_2v8", "soc-camera-pdrv.0"), | ||
245 | }; | 270 | }; |
246 | 271 | ||
247 | static struct regulator_init_data vmmc1_init = { | 272 | static struct regulator_init_data vmmc1_init = { |
@@ -270,6 +295,22 @@ static struct regulator_init_data vgen_init = { | |||
270 | .consumer_supplies = vgen_consumers, | 295 | .consumer_supplies = vgen_consumers, |
271 | }; | 296 | }; |
272 | 297 | ||
298 | static struct regulator_consumer_supply vvib_consumers[] = { | ||
299 | REGULATOR_SUPPLY("cmos_vcore", "soc-camera-pdrv.0"), | ||
300 | }; | ||
301 | |||
302 | static struct regulator_init_data vvib_init = { | ||
303 | .constraints = { | ||
304 | .min_uV = 1300000, | ||
305 | .max_uV = 1300000, | ||
306 | .apply_uV = 1, | ||
307 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | ||
308 | REGULATOR_CHANGE_STATUS, | ||
309 | }, | ||
310 | .num_consumer_supplies = ARRAY_SIZE(vvib_consumers), | ||
311 | .consumer_supplies = vvib_consumers, | ||
312 | }; | ||
313 | |||
273 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | 314 | static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { |
274 | { | 315 | { |
275 | .id = MC13783_REG_VMMC1, | 316 | .id = MC13783_REG_VMMC1, |
@@ -283,6 +324,9 @@ static struct mc13xxx_regulator_init_data mx27_3ds_regulators[] = { | |||
283 | }, { | 324 | }, { |
284 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ | 325 | .id = MC13783_REG_GPO3, /* Turn on 3.3V */ |
285 | .init_data = &gpo_init, | 326 | .init_data = &gpo_init, |
327 | }, { | ||
328 | .id = MC13783_REG_VVIB, /* Power OV2640 */ | ||
329 | .init_data = &vvib_init, | ||
286 | }, | 330 | }, |
287 | }; | 331 | }; |
288 | 332 | ||
@@ -311,6 +355,51 @@ static const struct spi_imx_master spi2_pdata __initconst = { | |||
311 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), | 355 | .num_chipselect = ARRAY_SIZE(spi2_chipselect), |
312 | }; | 356 | }; |
313 | 357 | ||
358 | static int mx27_3ds_camera_power(struct device *dev, int on) | ||
359 | { | ||
360 | /* enable or disable the camera */ | ||
361 | pr_debug("%s: %s the camera\n", __func__, on ? "ENABLE" : "DISABLE"); | ||
362 | gpio_set_value(CSI_PWRDWN, on ? 0 : 1); | ||
363 | |||
364 | if (!on) | ||
365 | goto out; | ||
366 | |||
367 | /* If enabled, give a reset impulse */ | ||
368 | gpio_set_value(CSI_RESET, 0); | ||
369 | msleep(20); | ||
370 | gpio_set_value(CSI_RESET, 1); | ||
371 | msleep(100); | ||
372 | |||
373 | out: | ||
374 | return 0; | ||
375 | } | ||
376 | |||
377 | static struct i2c_board_info mx27_3ds_i2c_camera = { | ||
378 | I2C_BOARD_INFO("ov2640", 0x30), | ||
379 | }; | ||
380 | |||
381 | static struct regulator_bulk_data mx27_3ds_camera_regs[] = { | ||
382 | { .supply = "cmos_vcore" }, | ||
383 | { .supply = "cmos_2v8" }, | ||
384 | }; | ||
385 | |||
386 | static struct soc_camera_link iclink_ov2640 = { | ||
387 | .bus_id = 0, | ||
388 | .board_info = &mx27_3ds_i2c_camera, | ||
389 | .i2c_adapter_id = 0, | ||
390 | .power = mx27_3ds_camera_power, | ||
391 | .regulators = mx27_3ds_camera_regs, | ||
392 | .num_regulators = ARRAY_SIZE(mx27_3ds_camera_regs), | ||
393 | }; | ||
394 | |||
395 | static struct platform_device mx27_3ds_ov2640 = { | ||
396 | .name = "soc-camera-pdrv", | ||
397 | .id = 0, | ||
398 | .dev = { | ||
399 | .platform_data = &iclink_ov2640, | ||
400 | }, | ||
401 | }; | ||
402 | |||
314 | static struct imx_fb_videomode mx27_3ds_modes[] = { | 403 | static struct imx_fb_videomode mx27_3ds_modes[] = { |
315 | { /* 480x640 @ 60 Hz */ | 404 | { /* 480x640 @ 60 Hz */ |
316 | .mode = { | 405 | .mode = { |
@@ -367,12 +456,21 @@ static struct spi_board_info mx27_3ds_spi_devs[] __initdata = { | |||
367 | }, | 456 | }, |
368 | }; | 457 | }; |
369 | 458 | ||
459 | static struct platform_device *devices[] __initdata = { | ||
460 | &mx27_3ds_ov2640, | ||
461 | }; | ||
462 | |||
463 | static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = { | ||
464 | .clk = 26000000, | ||
465 | }; | ||
466 | |||
370 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { | 467 | static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { |
371 | .bitrate = 100000, | 468 | .bitrate = 100000, |
372 | }; | 469 | }; |
373 | 470 | ||
374 | static void __init mx27pdk_init(void) | 471 | static void __init mx27pdk_init(void) |
375 | { | 472 | { |
473 | int ret; | ||
376 | imx27_soc_init(); | 474 | imx27_soc_init(); |
377 | 475 | ||
378 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), | 476 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
@@ -404,7 +502,17 @@ static void __init mx27pdk_init(void) | |||
404 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) | 502 | if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
405 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); | 503 | pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n"); |
406 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); | 504 | imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data); |
505 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
407 | imx27_add_imx_fb(&mx27_3ds_fb_data); | 506 | imx27_add_imx_fb(&mx27_3ds_fb_data); |
507 | |||
508 | ret = gpio_request_array(mx27_3ds_camera_gpios, | ||
509 | ARRAY_SIZE(mx27_3ds_camera_gpios)); | ||
510 | if (ret) { | ||
511 | pr_err("Failed to request camera gpios"); | ||
512 | iclink_ov2640.power = NULL; | ||
513 | } | ||
514 | |||
515 | imx27_add_mx2_camera(&mx27_3ds_cam_pdata); | ||
408 | } | 516 | } |
409 | 517 | ||
410 | static void __init mx27pdk_timer_init(void) | 518 | static void __init mx27pdk_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c index 4917aab0e253..4518e5448227 100644 --- a/arch/arm/mach-imx/mach-mx31ads.c +++ b/arch/arm/mach-imx/mach-mx31ads.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/memory.h> | 28 | #include <asm/memory.h> |
29 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
30 | #include <mach/common.h> | 30 | #include <mach/common.h> |
31 | #include <mach/board-mx31ads.h> | ||
32 | #include <mach/iomux-mx3.h> | 31 | #include <mach/iomux-mx3.h> |
33 | 32 | ||
34 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 | 33 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 |
@@ -39,6 +38,9 @@ | |||
39 | 38 | ||
40 | #include "devices-imx31.h" | 39 | #include "devices-imx31.h" |
41 | 40 | ||
41 | /* Base address of PBC controller */ | ||
42 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
43 | |||
42 | /* PBC Board interrupt status register */ | 44 | /* PBC Board interrupt status register */ |
43 | #define PBC_INTSTATUS 0x000016 | 45 | #define PBC_INTSTATUS 0x000016 |
44 | 46 | ||
@@ -62,6 +64,7 @@ | |||
62 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) | 64 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) |
63 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) | 65 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) |
64 | 66 | ||
67 | #define MXC_EXP_IO_BASE MXC_BOARD_IRQ_START | ||
65 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) | 68 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) |
66 | 69 | ||
67 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) | 70 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) |
@@ -69,6 +72,10 @@ | |||
69 | 72 | ||
70 | #define MXC_MAX_EXP_IO_LINES 16 | 73 | #define MXC_MAX_EXP_IO_LINES 16 |
71 | 74 | ||
75 | /* CS8900 */ | ||
76 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
77 | #define CS4_CS8900_MMIO_START 0x20000 | ||
78 | |||
72 | /* | 79 | /* |
73 | * The serial port definition structure. | 80 | * The serial port definition structure. |
74 | */ | 81 | */ |
@@ -101,11 +108,29 @@ static struct platform_device serial_device = { | |||
101 | }, | 108 | }, |
102 | }; | 109 | }; |
103 | 110 | ||
111 | static const struct resource mx31ads_cs8900_resources[] __initconst = { | ||
112 | DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K), | ||
113 | DEFINE_RES_IRQ(EXPIO_INT_ENET_INT), | ||
114 | }; | ||
115 | |||
116 | static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = { | ||
117 | .name = "cs89x0", | ||
118 | .id = 0, | ||
119 | .res = mx31ads_cs8900_resources, | ||
120 | .num_res = ARRAY_SIZE(mx31ads_cs8900_resources), | ||
121 | }; | ||
122 | |||
104 | static int __init mxc_init_extuart(void) | 123 | static int __init mxc_init_extuart(void) |
105 | { | 124 | { |
106 | return platform_device_register(&serial_device); | 125 | return platform_device_register(&serial_device); |
107 | } | 126 | } |
108 | 127 | ||
128 | static void __init mxc_init_ext_ethernet(void) | ||
129 | { | ||
130 | platform_device_register_full( | ||
131 | (struct platform_device_info *)&mx31ads_cs8900_devinfo); | ||
132 | } | ||
133 | |||
109 | static const struct imxuart_platform_data uart_pdata __initconst = { | 134 | static const struct imxuart_platform_data uart_pdata __initconst = { |
110 | .flags = IMXUART_HAVE_RTSCTS, | 135 | .flags = IMXUART_HAVE_RTSCTS, |
111 | }; | 136 | }; |
@@ -492,12 +517,15 @@ static void __init mxc_init_audio(void) | |||
492 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); | 517 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); |
493 | } | 518 | } |
494 | 519 | ||
495 | /* static mappings */ | 520 | /* |
521 | * Static mappings, starting from the CS4 start address up to the start address | ||
522 | * of the CS8900. | ||
523 | */ | ||
496 | static struct map_desc mx31ads_io_desc[] __initdata = { | 524 | static struct map_desc mx31ads_io_desc[] __initdata = { |
497 | { | 525 | { |
498 | .virtual = MX31_CS4_BASE_ADDR_VIRT, | 526 | .virtual = MX31_CS4_BASE_ADDR_VIRT, |
499 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), | 527 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), |
500 | .length = MX31_CS4_SIZE / 2, | 528 | .length = CS4_CS8900_MMIO_START, |
501 | .type = MT_DEVICE | 529 | .type = MT_DEVICE |
502 | }, | 530 | }, |
503 | }; | 531 | }; |
@@ -522,6 +550,7 @@ static void __init mx31ads_init(void) | |||
522 | mxc_init_imx_uart(); | 550 | mxc_init_imx_uart(); |
523 | mxc_init_i2c(); | 551 | mxc_init_i2c(); |
524 | mxc_init_audio(); | 552 | mxc_init_audio(); |
553 | mxc_init_ext_ethernet(); | ||
525 | } | 554 | } |
526 | 555 | ||
527 | static void __init mx31ads_timer_init(void) | 556 | static void __init mx31ads_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c index c0511fb1a5f9..f17a15f28316 100644 --- a/arch/arm/mach-imx/mach-mx31moboard.c +++ b/arch/arm/mach-imx/mach-mx31moboard.c | |||
@@ -507,7 +507,7 @@ static void mx31moboard_poweroff(void) | |||
507 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); | 507 | struct clk *clk = clk_get_sys("imx2-wdt.0", NULL); |
508 | 508 | ||
509 | if (!IS_ERR(clk)) | 509 | if (!IS_ERR(clk)) |
510 | clk_enable(clk); | 510 | clk_prepare_enable(clk); |
511 | 511 | ||
512 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); | 512 | mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST); |
513 | 513 | ||
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c index 6dc093448057..e26a9cb05ed8 100644 --- a/arch/arm/mach-imx/pm-imx5.c +++ b/arch/arm/mach-imx/pm-imx5.c | |||
@@ -89,7 +89,7 @@ void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode) | |||
89 | 89 | ||
90 | static int mx5_suspend_prepare(void) | 90 | static int mx5_suspend_prepare(void) |
91 | { | 91 | { |
92 | return clk_enable(gpc_dvfs_clk); | 92 | return clk_prepare_enable(gpc_dvfs_clk); |
93 | } | 93 | } |
94 | 94 | ||
95 | static int mx5_suspend_enter(suspend_state_t state) | 95 | static int mx5_suspend_enter(suspend_state_t state) |
@@ -119,7 +119,7 @@ static int mx5_suspend_enter(suspend_state_t state) | |||
119 | 119 | ||
120 | static void mx5_suspend_finish(void) | 120 | static void mx5_suspend_finish(void) |
121 | { | 121 | { |
122 | clk_disable(gpc_dvfs_clk); | 122 | clk_disable_unprepare(gpc_dvfs_clk); |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mx5_pm_valid(suspend_state_t state) | 125 | static int mx5_pm_valid(suspend_state_t state) |
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c index 0e01bf44479c..f55c772d1816 100644 --- a/arch/arm/mach-lpc32xx/clock.c +++ b/arch/arm/mach-lpc32xx/clock.c | |||
@@ -721,6 +721,41 @@ static struct clk clk_tsc = { | |||
721 | .get_rate = local_return_parent_rate, | 721 | .get_rate = local_return_parent_rate, |
722 | }; | 722 | }; |
723 | 723 | ||
724 | static int adc_onoff_enable(struct clk *clk, int enable) | ||
725 | { | ||
726 | u32 tmp; | ||
727 | u32 divider; | ||
728 | |||
729 | /* Use PERIPH_CLOCK */ | ||
730 | tmp = __raw_readl(LPC32XX_CLKPWR_ADC_CLK_CTRL_1); | ||
731 | tmp |= LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL; | ||
732 | /* | ||
733 | * Set clock divider so that we have equal to or less than | ||
734 | * 4.5MHz clock at ADC | ||
735 | */ | ||
736 | divider = clk->get_rate(clk) / 4500000 + 1; | ||
737 | tmp |= divider; | ||
738 | __raw_writel(tmp, LPC32XX_CLKPWR_ADC_CLK_CTRL_1); | ||
739 | |||
740 | /* synchronize rate of this clock w/ actual HW setting */ | ||
741 | clk->rate = clk->get_rate(clk->parent) / divider; | ||
742 | |||
743 | if (enable == 0) | ||
744 | __raw_writel(0, clk->enable_reg); | ||
745 | else | ||
746 | __raw_writel(clk->enable_mask, clk->enable_reg); | ||
747 | |||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | static struct clk clk_adc = { | ||
752 | .parent = &clk_pclk, | ||
753 | .enable = adc_onoff_enable, | ||
754 | .enable_reg = LPC32XX_CLKPWR_ADC_CLK_CTRL, | ||
755 | .enable_mask = LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN, | ||
756 | .get_rate = local_return_parent_rate, | ||
757 | }; | ||
758 | |||
724 | static int mmc_onoff_enable(struct clk *clk, int enable) | 759 | static int mmc_onoff_enable(struct clk *clk, int enable) |
725 | { | 760 | { |
726 | u32 tmp; | 761 | u32 tmp; |
@@ -1055,6 +1090,7 @@ static struct clk_lookup lookups[] = { | |||
1055 | _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) | 1090 | _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) |
1056 | _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) | 1091 | _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) |
1057 | _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) | 1092 | _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) |
1093 | _REGISTER_CLOCK("lpc32xx-adc", NULL, clk_adc) | ||
1058 | _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) | 1094 | _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) |
1059 | _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) | 1095 | _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) |
1060 | _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) | 1096 | _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) |
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c index 369b152896cd..6c76bb36559b 100644 --- a/arch/arm/mach-lpc32xx/common.c +++ b/arch/arm/mach-lpc32xx/common.c | |||
@@ -138,6 +138,28 @@ struct platform_device lpc32xx_rtc_device = { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * ADC support | ||
142 | */ | ||
143 | static struct resource adc_resources[] = { | ||
144 | { | ||
145 | .start = LPC32XX_ADC_BASE, | ||
146 | .end = LPC32XX_ADC_BASE + SZ_4K - 1, | ||
147 | .flags = IORESOURCE_MEM, | ||
148 | }, { | ||
149 | .start = IRQ_LPC32XX_TS_IRQ, | ||
150 | .end = IRQ_LPC32XX_TS_IRQ, | ||
151 | .flags = IORESOURCE_IRQ, | ||
152 | }, | ||
153 | }; | ||
154 | |||
155 | struct platform_device lpc32xx_adc_device = { | ||
156 | .name = "lpc32xx-adc", | ||
157 | .id = -1, | ||
158 | .num_resources = ARRAY_SIZE(adc_resources), | ||
159 | .resource = adc_resources, | ||
160 | }; | ||
161 | |||
162 | /* | ||
141 | * Returns the unique ID for the device | 163 | * Returns the unique ID for the device |
142 | */ | 164 | */ |
143 | void lpc32xx_get_uid(u32 devid[4]) | 165 | void lpc32xx_get_uid(u32 devid[4]) |
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h index 75640bfb097f..68f2e46d98ad 100644 --- a/arch/arm/mach-lpc32xx/common.h +++ b/arch/arm/mach-lpc32xx/common.h | |||
@@ -29,6 +29,7 @@ extern struct platform_device lpc32xx_i2c0_device; | |||
29 | extern struct platform_device lpc32xx_i2c1_device; | 29 | extern struct platform_device lpc32xx_i2c1_device; |
30 | extern struct platform_device lpc32xx_i2c2_device; | 30 | extern struct platform_device lpc32xx_i2c2_device; |
31 | extern struct platform_device lpc32xx_tsc_device; | 31 | extern struct platform_device lpc32xx_tsc_device; |
32 | extern struct platform_device lpc32xx_adc_device; | ||
32 | extern struct platform_device lpc32xx_rtc_device; | 33 | extern struct platform_device lpc32xx_rtc_device; |
33 | 34 | ||
34 | /* | 35 | /* |
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c index 8571d6250dc1..0d79a3f8a5e0 100644 --- a/arch/arm/mach-lpc32xx/phy3250.c +++ b/arch/arm/mach-lpc32xx/phy3250.c | |||
@@ -254,6 +254,7 @@ static struct platform_device *phy3250_devs[] __initdata = { | |||
254 | &lpc32xx_i2c2_device, | 254 | &lpc32xx_i2c2_device, |
255 | &lpc32xx_watchdog_device, | 255 | &lpc32xx_watchdog_device, |
256 | &lpc32xx_gpio_led_device, | 256 | &lpc32xx_gpio_led_device, |
257 | &lpc32xx_adc_device, | ||
257 | }; | 258 | }; |
258 | 259 | ||
259 | static struct amba_device *amba_devs[] __initdata = { | 260 | static struct amba_device *amba_devs[] __initdata = { |
diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h index 4de13abef7bb..e2e1f1e5e124 100644 --- a/arch/arm/mach-mmp/include/mach/pxa910.h +++ b/arch/arm/mach-mmp/include/mach/pxa910.h | |||
@@ -22,6 +22,7 @@ extern struct pxa_device_desc pxa910_device_pwm4; | |||
22 | extern struct pxa_device_desc pxa910_device_nand; | 22 | extern struct pxa_device_desc pxa910_device_nand; |
23 | 23 | ||
24 | extern struct platform_device pxa910_device_gpio; | 24 | extern struct platform_device pxa910_device_gpio; |
25 | extern struct platform_device pxa910_device_rtc; | ||
25 | 26 | ||
26 | static inline int pxa910_add_uart(int id) | 27 | static inline int pxa910_add_uart(int id) |
27 | { | 28 | { |
diff --git a/arch/arm/mach-mmp/include/mach/regs-apbc.h b/arch/arm/mach-mmp/include/mach/regs-apbc.h index 1a96585336ba..8a37fb003655 100644 --- a/arch/arm/mach-mmp/include/mach/regs-apbc.h +++ b/arch/arm/mach-mmp/include/mach/regs-apbc.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #define APBC_PXA910_SSP1 APBC_REG(0x01c) | 57 | #define APBC_PXA910_SSP1 APBC_REG(0x01c) |
58 | #define APBC_PXA910_SSP2 APBC_REG(0x020) | 58 | #define APBC_PXA910_SSP2 APBC_REG(0x020) |
59 | #define APBC_PXA910_IPC APBC_REG(0x024) | 59 | #define APBC_PXA910_IPC APBC_REG(0x024) |
60 | #define APBC_PXA910_RTC APBC_REG(0x028) | ||
60 | #define APBC_PXA910_TWSI0 APBC_REG(0x02c) | 61 | #define APBC_PXA910_TWSI0 APBC_REG(0x02c) |
61 | #define APBC_PXA910_KPC APBC_REG(0x030) | 62 | #define APBC_PXA910_KPC APBC_REG(0x030) |
62 | #define APBC_PXA910_TIMERS APBC_REG(0x034) | 63 | #define APBC_PXA910_TIMERS APBC_REG(0x034) |
diff --git a/arch/arm/mach-mmp/include/mach/regs-rtc.h b/arch/arm/mach-mmp/include/mach/regs-rtc.h new file mode 100644 index 000000000000..5bff886a3941 --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/regs-rtc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef __ASM_MACH_REGS_RTC_H | ||
2 | #define __ASM_MACH_REGS_RTC_H | ||
3 | |||
4 | #include <mach/addr-map.h> | ||
5 | |||
6 | #define RTC_VIRT_BASE (APB_VIRT_BASE + 0x10000) | ||
7 | #define RTC_REG(x) (*((volatile u32 __iomem *)(RTC_VIRT_BASE + (x)))) | ||
8 | |||
9 | /* | ||
10 | * Real Time Clock | ||
11 | */ | ||
12 | |||
13 | #define RCNR RTC_REG(0x00) /* RTC Count Register */ | ||
14 | #define RTAR RTC_REG(0x04) /* RTC Alarm Register */ | ||
15 | #define RTSR RTC_REG(0x08) /* RTC Status Register */ | ||
16 | #define RTTR RTC_REG(0x0C) /* RTC Timer Trim Register */ | ||
17 | |||
18 | #define RTSR_HZE (1 << 3) /* HZ interrupt enable */ | ||
19 | #define RTSR_ALE (1 << 2) /* RTC alarm interrupt enable */ | ||
20 | #define RTSR_HZ (1 << 1) /* HZ rising-edge detected */ | ||
21 | #define RTSR_AL (1 << 0) /* RTC alarm detected */ | ||
22 | |||
23 | #endif /* __ASM_MACH_REGS_RTC_H */ | ||
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c index 0c87e69adf9f..43f8bcc29b67 100644 --- a/arch/arm/mach-mmp/pxa910.c +++ b/arch/arm/mach-mmp/pxa910.c | |||
@@ -92,6 +92,7 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000); | |||
92 | static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); | 92 | static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); |
93 | static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); | 93 | static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); |
94 | static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); | 94 | static APBC_CLK(gpio, PXA910_GPIO, 0, 13000000); |
95 | static APBC_CLK(rtc, PXA910_RTC, 8, 32768); | ||
95 | 96 | ||
96 | static APMU_CLK(nand, NAND, 0x19b, 156000000); | 97 | static APMU_CLK(nand, NAND, 0x19b, 156000000); |
97 | static APMU_CLK(u2o, USB, 0x1b, 480000000); | 98 | static APMU_CLK(u2o, USB, 0x1b, 480000000); |
@@ -109,6 +110,7 @@ static struct clk_lookup pxa910_clkregs[] = { | |||
109 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), | 110 | INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), |
110 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), | 111 | INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), |
111 | INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), | 112 | INIT_CLKREG(&clk_u2o, "pxa-u2o", "U2OCLK"), |
113 | INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), | ||
112 | }; | 114 | }; |
113 | 115 | ||
114 | static int __init pxa910_init(void) | 116 | static int __init pxa910_init(void) |
@@ -184,3 +186,28 @@ struct platform_device pxa910_device_gpio = { | |||
184 | .num_resources = ARRAY_SIZE(pxa910_resource_gpio), | 186 | .num_resources = ARRAY_SIZE(pxa910_resource_gpio), |
185 | .resource = pxa910_resource_gpio, | 187 | .resource = pxa910_resource_gpio, |
186 | }; | 188 | }; |
189 | |||
190 | static struct resource pxa910_resource_rtc[] = { | ||
191 | { | ||
192 | .start = 0xd4010000, | ||
193 | .end = 0xd401003f, | ||
194 | .flags = IORESOURCE_MEM, | ||
195 | }, { | ||
196 | .start = IRQ_PXA910_RTC_INT, | ||
197 | .end = IRQ_PXA910_RTC_INT, | ||
198 | .name = "rtc 1Hz", | ||
199 | .flags = IORESOURCE_IRQ, | ||
200 | }, { | ||
201 | .start = IRQ_PXA910_RTC_ALARM, | ||
202 | .end = IRQ_PXA910_RTC_ALARM, | ||
203 | .name = "rtc alarm", | ||
204 | .flags = IORESOURCE_IRQ, | ||
205 | }, | ||
206 | }; | ||
207 | |||
208 | struct platform_device pxa910_device_rtc = { | ||
209 | .name = "sa1100-rtc", | ||
210 | .id = -1, | ||
211 | .num_resources = ARRAY_SIZE(pxa910_resource_rtc), | ||
212 | .resource = pxa910_resource_rtc, | ||
213 | }; | ||
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 5ac5d5832e45..e72c709da44f 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c | |||
@@ -124,6 +124,7 @@ static struct platform_device ttc_dkb_device_onenand = { | |||
124 | 124 | ||
125 | static struct platform_device *ttc_dkb_devices[] = { | 125 | static struct platform_device *ttc_dkb_devices[] = { |
126 | &pxa910_device_gpio, | 126 | &pxa910_device_gpio, |
127 | &pxa910_device_rtc, | ||
127 | &ttc_dkb_device_onenand, | 128 | &ttc_dkb_device_onenand, |
128 | }; | 129 | }; |
129 | 130 | ||
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c index 293958beb505..e3ac52c34019 100644 --- a/arch/arm/mach-mxs/clock-mx23.c +++ b/arch/arm/mach-mxs/clock-mx23.c | |||
@@ -439,6 +439,7 @@ static struct clk_lookup lookups[] = { | |||
439 | _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) | 439 | _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk) |
440 | _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) | 440 | _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk) |
441 | _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) | 441 | _REGISTER_CLOCK("imx23-fb", NULL, lcdif_clk) |
442 | _REGISTER_CLOCK("imx23-gpmi-nand", NULL, gpmi_clk) | ||
442 | }; | 443 | }; |
443 | 444 | ||
444 | static int clk_misc_init(void) | 445 | static int clk_misc_init(void) |
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index 22ad12f6e4de..cea29c99e214 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
@@ -617,6 +617,7 @@ static struct clk_lookup lookups[] = { | |||
617 | _REGISTER_CLOCK("duart", NULL, uart_clk) | 617 | _REGISTER_CLOCK("duart", NULL, uart_clk) |
618 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) | 618 | _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) |
619 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) | 619 | _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) |
620 | _REGISTER_CLOCK("imx28-gpmi-nand", NULL, gpmi_clk) | ||
620 | _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) | 621 | _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk) |
621 | _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) | 622 | _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk) |
622 | _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk) | 623 | _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk) |
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h index 3fa651d2c994..4d1329d59287 100644 --- a/arch/arm/mach-mxs/devices-mx23.h +++ b/arch/arm/mach-mxs/devices-mx23.h | |||
@@ -21,6 +21,10 @@ extern const struct mxs_auart_data mx23_auart_data[] __initconst; | |||
21 | #define mx23_add_auart0() mx23_add_auart(0) | 21 | #define mx23_add_auart0() mx23_add_auart(0) |
22 | #define mx23_add_auart1() mx23_add_auart(1) | 22 | #define mx23_add_auart1() mx23_add_auart(1) |
23 | 23 | ||
24 | extern const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst; | ||
25 | #define mx23_add_gpmi_nand(pdata) \ | ||
26 | mxs_add_gpmi_nand(pdata, &mx23_gpmi_nand_data) | ||
27 | |||
24 | extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; | 28 | extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; |
25 | #define mx23_add_mxs_mmc(id, pdata) \ | 29 | #define mx23_add_mxs_mmc(id, pdata) \ |
26 | mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) | 30 | mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) |
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 4f50094e293d..9dbeae130842 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h | |||
@@ -34,6 +34,10 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst; | |||
34 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) | 34 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) |
35 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) | 35 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) |
36 | 36 | ||
37 | extern const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst; | ||
38 | #define mx28_add_gpmi_nand(pdata) \ | ||
39 | mxs_add_gpmi_nand(pdata, &mx28_gpmi_nand_data) | ||
40 | |||
37 | extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; | 41 | extern const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst; |
38 | #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) | 42 | #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) |
39 | 43 | ||
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index 18b6bf526a27..b8913df4cfa2 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig | |||
@@ -12,6 +12,9 @@ config MXS_HAVE_PLATFORM_FLEXCAN | |||
12 | select HAVE_CAN_FLEXCAN if CAN | 12 | select HAVE_CAN_FLEXCAN if CAN |
13 | bool | 13 | bool |
14 | 14 | ||
15 | config MXS_HAVE_PLATFORM_GPMI_NAND | ||
16 | bool | ||
17 | |||
15 | config MXS_HAVE_PLATFORM_MXS_I2C | 18 | config MXS_HAVE_PLATFORM_MXS_I2C |
16 | bool | 19 | bool |
17 | 20 | ||
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index f52e3e53baec..c8f5c9541a30 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -3,6 +3,7 @@ obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | |||
3 | obj-y += platform-dma.o | 3 | obj-y += platform-dma.o |
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | 4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o |
5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 5 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_GPMI_NAND) += platform-gpmi-nand.o | ||
6 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o | 7 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o |
7 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o | 8 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o |
8 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o | 9 | obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o |
diff --git a/arch/arm/mach-mxs/devices/platform-gpmi-nand.c b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c new file mode 100644 index 000000000000..3e22df5944a8 --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-gpmi-nand.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | */ | ||
18 | #include <asm/sizes.h> | ||
19 | #include <mach/mx23.h> | ||
20 | #include <mach/mx28.h> | ||
21 | #include <mach/devices-common.h> | ||
22 | #include <linux/dma-mapping.h> | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX23 | ||
25 | const struct mxs_gpmi_nand_data mx23_gpmi_nand_data __initconst = { | ||
26 | .devid = "imx23-gpmi-nand", | ||
27 | .res = { | ||
28 | /* GPMI */ | ||
29 | DEFINE_RES_MEM_NAMED(MX23_GPMI_BASE_ADDR, SZ_8K, | ||
30 | GPMI_NAND_GPMI_REGS_ADDR_RES_NAME), | ||
31 | DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_ATTENTION, | ||
32 | GPMI_NAND_GPMI_INTERRUPT_RES_NAME), | ||
33 | /* BCH */ | ||
34 | DEFINE_RES_MEM_NAMED(MX23_BCH_BASE_ADDR, SZ_8K, | ||
35 | GPMI_NAND_BCH_REGS_ADDR_RES_NAME), | ||
36 | DEFINE_RES_IRQ_NAMED(MX23_INT_BCH, | ||
37 | GPMI_NAND_BCH_INTERRUPT_RES_NAME), | ||
38 | /* DMA */ | ||
39 | DEFINE_RES_NAMED(MX23_DMA_GPMI0, | ||
40 | MX23_DMA_GPMI3 - MX23_DMA_GPMI0 + 1, | ||
41 | GPMI_NAND_DMA_CHANNELS_RES_NAME, | ||
42 | IORESOURCE_DMA), | ||
43 | DEFINE_RES_IRQ_NAMED(MX23_INT_GPMI_DMA, | ||
44 | GPMI_NAND_DMA_INTERRUPT_RES_NAME), | ||
45 | }, | ||
46 | }; | ||
47 | #endif | ||
48 | |||
49 | #ifdef CONFIG_SOC_IMX28 | ||
50 | const struct mxs_gpmi_nand_data mx28_gpmi_nand_data __initconst = { | ||
51 | .devid = "imx28-gpmi-nand", | ||
52 | .res = { | ||
53 | /* GPMI */ | ||
54 | DEFINE_RES_MEM_NAMED(MX28_GPMI_BASE_ADDR, SZ_8K, | ||
55 | GPMI_NAND_GPMI_REGS_ADDR_RES_NAME), | ||
56 | DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI, | ||
57 | GPMI_NAND_GPMI_INTERRUPT_RES_NAME), | ||
58 | /* BCH */ | ||
59 | DEFINE_RES_MEM_NAMED(MX28_BCH_BASE_ADDR, SZ_8K, | ||
60 | GPMI_NAND_BCH_REGS_ADDR_RES_NAME), | ||
61 | DEFINE_RES_IRQ_NAMED(MX28_INT_BCH, | ||
62 | GPMI_NAND_BCH_INTERRUPT_RES_NAME), | ||
63 | /* DMA */ | ||
64 | DEFINE_RES_NAMED(MX28_DMA_GPMI0, | ||
65 | MX28_DMA_GPMI7 - MX28_DMA_GPMI0 + 1, | ||
66 | GPMI_NAND_DMA_CHANNELS_RES_NAME, | ||
67 | IORESOURCE_DMA), | ||
68 | DEFINE_RES_IRQ_NAMED(MX28_INT_GPMI_DMA, | ||
69 | GPMI_NAND_DMA_INTERRUPT_RES_NAME), | ||
70 | }, | ||
71 | }; | ||
72 | #endif | ||
73 | |||
74 | struct platform_device *__init | ||
75 | mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata, | ||
76 | const struct mxs_gpmi_nand_data *data) | ||
77 | { | ||
78 | return mxs_add_platform_device_dmamask(data->devid, -1, | ||
79 | data->res, GPMI_NAND_RES_SIZE, | ||
80 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
81 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index dc369c1239fc..f2e383955d88 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h | |||
@@ -66,6 +66,16 @@ struct platform_device *__init mxs_add_flexcan( | |||
66 | const struct mxs_flexcan_data *data, | 66 | const struct mxs_flexcan_data *data, |
67 | const struct flexcan_platform_data *pdata); | 67 | const struct flexcan_platform_data *pdata); |
68 | 68 | ||
69 | /* gpmi-nand */ | ||
70 | #include <linux/mtd/gpmi-nand.h> | ||
71 | struct mxs_gpmi_nand_data { | ||
72 | const char *devid; | ||
73 | const struct resource res[GPMI_NAND_RES_SIZE]; | ||
74 | }; | ||
75 | struct platform_device *__init | ||
76 | mxs_add_gpmi_nand(const struct gpmi_nand_platform_data *pdata, | ||
77 | const struct mxs_gpmi_nand_data *data); | ||
78 | |||
69 | /* i2c */ | 79 | /* i2c */ |
70 | struct mxs_mxs_i2c_data { | 80 | struct mxs_mxs_i2c_data { |
71 | int id; | 81 | int id; |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 3c8dd928628e..34b9766d1d23 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include "omap_hwmod_common_data.h" | 30 | #include "omap_hwmod_common_data.h" |
31 | 31 | ||
32 | #include "smartreflex.h" | ||
32 | #include "prm-regbits-34xx.h" | 33 | #include "prm-regbits-34xx.h" |
33 | #include "cm-regbits-34xx.h" | 34 | #include "cm-regbits-34xx.h" |
34 | #include "wd_timer.h" | 35 | #include "wd_timer.h" |
@@ -376,6 +377,16 @@ static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = { | |||
376 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 377 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
377 | }; | 378 | }; |
378 | 379 | ||
380 | static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = { | ||
381 | { .irq = 18}, | ||
382 | { .irq = -1 } | ||
383 | }; | ||
384 | |||
385 | static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = { | ||
386 | { .irq = 19}, | ||
387 | { .irq = -1 } | ||
388 | }; | ||
389 | |||
379 | /* L4 CORE -> SR1 interface */ | 390 | /* L4 CORE -> SR1 interface */ |
380 | static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { | 391 | static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { |
381 | { | 392 | { |
@@ -2664,6 +2675,10 @@ static struct omap_hwmod_class omap36xx_smartreflex_hwmod_class = { | |||
2664 | }; | 2675 | }; |
2665 | 2676 | ||
2666 | /* SR1 */ | 2677 | /* SR1 */ |
2678 | static struct omap_smartreflex_dev_attr sr1_dev_attr = { | ||
2679 | .sensor_voltdm_name = "mpu_iva", | ||
2680 | }; | ||
2681 | |||
2667 | static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { | 2682 | static struct omap_hwmod_ocp_if *omap3_sr1_slaves[] = { |
2668 | &omap3_l4_core__sr1, | 2683 | &omap3_l4_core__sr1, |
2669 | }; | 2684 | }; |
@@ -2672,7 +2687,6 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { | |||
2672 | .name = "sr1_hwmod", | 2687 | .name = "sr1_hwmod", |
2673 | .class = &omap34xx_smartreflex_hwmod_class, | 2688 | .class = &omap34xx_smartreflex_hwmod_class, |
2674 | .main_clk = "sr1_fck", | 2689 | .main_clk = "sr1_fck", |
2675 | .vdd_name = "mpu_iva", | ||
2676 | .prcm = { | 2690 | .prcm = { |
2677 | .omap2 = { | 2691 | .omap2 = { |
2678 | .prcm_reg_id = 1, | 2692 | .prcm_reg_id = 1, |
@@ -2684,6 +2698,8 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { | |||
2684 | }, | 2698 | }, |
2685 | .slaves = omap3_sr1_slaves, | 2699 | .slaves = omap3_sr1_slaves, |
2686 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), | 2700 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), |
2701 | .dev_attr = &sr1_dev_attr, | ||
2702 | .mpu_irqs = omap3_smartreflex_mpu_irqs, | ||
2687 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, | 2703 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, |
2688 | }; | 2704 | }; |
2689 | 2705 | ||
@@ -2691,7 +2707,6 @@ static struct omap_hwmod omap36xx_sr1_hwmod = { | |||
2691 | .name = "sr1_hwmod", | 2707 | .name = "sr1_hwmod", |
2692 | .class = &omap36xx_smartreflex_hwmod_class, | 2708 | .class = &omap36xx_smartreflex_hwmod_class, |
2693 | .main_clk = "sr1_fck", | 2709 | .main_clk = "sr1_fck", |
2694 | .vdd_name = "mpu_iva", | ||
2695 | .prcm = { | 2710 | .prcm = { |
2696 | .omap2 = { | 2711 | .omap2 = { |
2697 | .prcm_reg_id = 1, | 2712 | .prcm_reg_id = 1, |
@@ -2703,9 +2718,15 @@ static struct omap_hwmod omap36xx_sr1_hwmod = { | |||
2703 | }, | 2718 | }, |
2704 | .slaves = omap3_sr1_slaves, | 2719 | .slaves = omap3_sr1_slaves, |
2705 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), | 2720 | .slaves_cnt = ARRAY_SIZE(omap3_sr1_slaves), |
2721 | .dev_attr = &sr1_dev_attr, | ||
2722 | .mpu_irqs = omap3_smartreflex_mpu_irqs, | ||
2706 | }; | 2723 | }; |
2707 | 2724 | ||
2708 | /* SR2 */ | 2725 | /* SR2 */ |
2726 | static struct omap_smartreflex_dev_attr sr2_dev_attr = { | ||
2727 | .sensor_voltdm_name = "core", | ||
2728 | }; | ||
2729 | |||
2709 | static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { | 2730 | static struct omap_hwmod_ocp_if *omap3_sr2_slaves[] = { |
2710 | &omap3_l4_core__sr2, | 2731 | &omap3_l4_core__sr2, |
2711 | }; | 2732 | }; |
@@ -2714,7 +2735,6 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { | |||
2714 | .name = "sr2_hwmod", | 2735 | .name = "sr2_hwmod", |
2715 | .class = &omap34xx_smartreflex_hwmod_class, | 2736 | .class = &omap34xx_smartreflex_hwmod_class, |
2716 | .main_clk = "sr2_fck", | 2737 | .main_clk = "sr2_fck", |
2717 | .vdd_name = "core", | ||
2718 | .prcm = { | 2738 | .prcm = { |
2719 | .omap2 = { | 2739 | .omap2 = { |
2720 | .prcm_reg_id = 1, | 2740 | .prcm_reg_id = 1, |
@@ -2726,6 +2746,8 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { | |||
2726 | }, | 2746 | }, |
2727 | .slaves = omap3_sr2_slaves, | 2747 | .slaves = omap3_sr2_slaves, |
2728 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), | 2748 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), |
2749 | .dev_attr = &sr2_dev_attr, | ||
2750 | .mpu_irqs = omap3_smartreflex_core_irqs, | ||
2729 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, | 2751 | .flags = HWMOD_SET_DEFAULT_CLOCKACT, |
2730 | }; | 2752 | }; |
2731 | 2753 | ||
@@ -2733,7 +2755,6 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { | |||
2733 | .name = "sr2_hwmod", | 2755 | .name = "sr2_hwmod", |
2734 | .class = &omap36xx_smartreflex_hwmod_class, | 2756 | .class = &omap36xx_smartreflex_hwmod_class, |
2735 | .main_clk = "sr2_fck", | 2757 | .main_clk = "sr2_fck", |
2736 | .vdd_name = "core", | ||
2737 | .prcm = { | 2758 | .prcm = { |
2738 | .omap2 = { | 2759 | .omap2 = { |
2739 | .prcm_reg_id = 1, | 2760 | .prcm_reg_id = 1, |
@@ -2745,6 +2766,8 @@ static struct omap_hwmod omap36xx_sr2_hwmod = { | |||
2745 | }, | 2766 | }, |
2746 | .slaves = omap3_sr2_slaves, | 2767 | .slaves = omap3_sr2_slaves, |
2747 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), | 2768 | .slaves_cnt = ARRAY_SIZE(omap3_sr2_slaves), |
2769 | .dev_attr = &sr2_dev_attr, | ||
2770 | .mpu_irqs = omap3_smartreflex_core_irqs, | ||
2748 | }; | 2771 | }; |
2749 | 2772 | ||
2750 | /* | 2773 | /* |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index acb561ea7c11..08daa5e0eb5f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include "omap_hwmod_common_data.h" | 34 | #include "omap_hwmod_common_data.h" |
35 | 35 | ||
36 | #include "smartreflex.h" | ||
36 | #include "cm1_44xx.h" | 37 | #include "cm1_44xx.h" |
37 | #include "cm2_44xx.h" | 38 | #include "cm2_44xx.h" |
38 | #include "prm44xx.h" | 39 | #include "prm44xx.h" |
@@ -3962,6 +3963,10 @@ static struct omap_hwmod_class omap44xx_smartreflex_hwmod_class = { | |||
3962 | }; | 3963 | }; |
3963 | 3964 | ||
3964 | /* smartreflex_core */ | 3965 | /* smartreflex_core */ |
3966 | static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = { | ||
3967 | .sensor_voltdm_name = "core", | ||
3968 | }; | ||
3969 | |||
3965 | static struct omap_hwmod omap44xx_smartreflex_core_hwmod; | 3970 | static struct omap_hwmod omap44xx_smartreflex_core_hwmod; |
3966 | static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { | 3971 | static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = { |
3967 | { .irq = 19 + OMAP44XX_IRQ_GIC_START }, | 3972 | { .irq = 19 + OMAP44XX_IRQ_GIC_START }, |
@@ -3998,7 +4003,6 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { | |||
3998 | .mpu_irqs = omap44xx_smartreflex_core_irqs, | 4003 | .mpu_irqs = omap44xx_smartreflex_core_irqs, |
3999 | 4004 | ||
4000 | .main_clk = "smartreflex_core_fck", | 4005 | .main_clk = "smartreflex_core_fck", |
4001 | .vdd_name = "core", | ||
4002 | .prcm = { | 4006 | .prcm = { |
4003 | .omap4 = { | 4007 | .omap4 = { |
4004 | .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, | 4008 | .clkctrl_offs = OMAP4_CM_ALWON_SR_CORE_CLKCTRL_OFFSET, |
@@ -4008,9 +4012,14 @@ static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { | |||
4008 | }, | 4012 | }, |
4009 | .slaves = omap44xx_smartreflex_core_slaves, | 4013 | .slaves = omap44xx_smartreflex_core_slaves, |
4010 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), | 4014 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_core_slaves), |
4015 | .dev_attr = &smartreflex_core_dev_attr, | ||
4011 | }; | 4016 | }; |
4012 | 4017 | ||
4013 | /* smartreflex_iva */ | 4018 | /* smartreflex_iva */ |
4019 | static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = { | ||
4020 | .sensor_voltdm_name = "iva", | ||
4021 | }; | ||
4022 | |||
4014 | static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; | 4023 | static struct omap_hwmod omap44xx_smartreflex_iva_hwmod; |
4015 | static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { | 4024 | static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = { |
4016 | { .irq = 102 + OMAP44XX_IRQ_GIC_START }, | 4025 | { .irq = 102 + OMAP44XX_IRQ_GIC_START }, |
@@ -4046,7 +4055,6 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { | |||
4046 | .clkdm_name = "l4_ao_clkdm", | 4055 | .clkdm_name = "l4_ao_clkdm", |
4047 | .mpu_irqs = omap44xx_smartreflex_iva_irqs, | 4056 | .mpu_irqs = omap44xx_smartreflex_iva_irqs, |
4048 | .main_clk = "smartreflex_iva_fck", | 4057 | .main_clk = "smartreflex_iva_fck", |
4049 | .vdd_name = "iva", | ||
4050 | .prcm = { | 4058 | .prcm = { |
4051 | .omap4 = { | 4059 | .omap4 = { |
4052 | .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, | 4060 | .clkctrl_offs = OMAP4_CM_ALWON_SR_IVA_CLKCTRL_OFFSET, |
@@ -4056,9 +4064,14 @@ static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { | |||
4056 | }, | 4064 | }, |
4057 | .slaves = omap44xx_smartreflex_iva_slaves, | 4065 | .slaves = omap44xx_smartreflex_iva_slaves, |
4058 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), | 4066 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_iva_slaves), |
4067 | .dev_attr = &smartreflex_iva_dev_attr, | ||
4059 | }; | 4068 | }; |
4060 | 4069 | ||
4061 | /* smartreflex_mpu */ | 4070 | /* smartreflex_mpu */ |
4071 | static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = { | ||
4072 | .sensor_voltdm_name = "mpu", | ||
4073 | }; | ||
4074 | |||
4062 | static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; | 4075 | static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod; |
4063 | static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { | 4076 | static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = { |
4064 | { .irq = 18 + OMAP44XX_IRQ_GIC_START }, | 4077 | { .irq = 18 + OMAP44XX_IRQ_GIC_START }, |
@@ -4094,7 +4107,6 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { | |||
4094 | .clkdm_name = "l4_ao_clkdm", | 4107 | .clkdm_name = "l4_ao_clkdm", |
4095 | .mpu_irqs = omap44xx_smartreflex_mpu_irqs, | 4108 | .mpu_irqs = omap44xx_smartreflex_mpu_irqs, |
4096 | .main_clk = "smartreflex_mpu_fck", | 4109 | .main_clk = "smartreflex_mpu_fck", |
4097 | .vdd_name = "mpu", | ||
4098 | .prcm = { | 4110 | .prcm = { |
4099 | .omap4 = { | 4111 | .omap4 = { |
4100 | .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, | 4112 | .clkctrl_offs = OMAP4_CM_ALWON_SR_MPU_CLKCTRL_OFFSET, |
@@ -4104,6 +4116,7 @@ static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { | |||
4104 | }, | 4116 | }, |
4105 | .slaves = omap44xx_smartreflex_mpu_slaves, | 4117 | .slaves = omap44xx_smartreflex_mpu_slaves, |
4106 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), | 4118 | .slaves_cnt = ARRAY_SIZE(omap44xx_smartreflex_mpu_slaves), |
4119 | .dev_attr = &smartreflex_mpu_dev_attr, | ||
4107 | }; | 4120 | }; |
4108 | 4121 | ||
4109 | /* | 4122 | /* |
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index 53d9d0a5b39d..955566eefac4 100644 --- a/arch/arm/mach-omap2/smartreflex-class3.c +++ b/arch/arm/mach-omap2/smartreflex-class3.c | |||
@@ -29,6 +29,7 @@ static int sr_class3_enable(struct voltagedomain *voltdm) | |||
29 | 29 | ||
30 | static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) | 30 | static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) |
31 | { | 31 | { |
32 | sr_disable_errgen(voltdm); | ||
32 | omap_vp_disable(voltdm); | 33 | omap_vp_disable(voltdm); |
33 | sr_disable(voltdm); | 34 | sr_disable(voltdm); |
34 | if (is_volt_reset) | 35 | if (is_volt_reset) |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 47c77a1d932a..008fbd7b9352 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -36,6 +36,12 @@ | |||
36 | #define SR_DISABLE_TIMEOUT 200 | 36 | #define SR_DISABLE_TIMEOUT 200 |
37 | 37 | ||
38 | struct omap_sr { | 38 | struct omap_sr { |
39 | struct list_head node; | ||
40 | struct platform_device *pdev; | ||
41 | struct omap_sr_nvalue_table *nvalue_table; | ||
42 | struct voltagedomain *voltdm; | ||
43 | struct dentry *dbg_dir; | ||
44 | unsigned int irq; | ||
39 | int srid; | 45 | int srid; |
40 | int ip_type; | 46 | int ip_type; |
41 | int nvalue_count; | 47 | int nvalue_count; |
@@ -49,13 +55,7 @@ struct omap_sr { | |||
49 | u32 senp_avgweight; | 55 | u32 senp_avgweight; |
50 | u32 senp_mod; | 56 | u32 senp_mod; |
51 | u32 senn_mod; | 57 | u32 senn_mod; |
52 | unsigned int irq; | ||
53 | void __iomem *base; | 58 | void __iomem *base; |
54 | struct platform_device *pdev; | ||
55 | struct list_head node; | ||
56 | struct omap_sr_nvalue_table *nvalue_table; | ||
57 | struct voltagedomain *voltdm; | ||
58 | struct dentry *dbg_dir; | ||
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* sr_list contains all the instances of smartreflex module */ | 61 | /* sr_list contains all the instances of smartreflex module */ |
@@ -74,10 +74,6 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask, | |||
74 | u32 value) | 74 | u32 value) |
75 | { | 75 | { |
76 | u32 reg_val; | 76 | u32 reg_val; |
77 | u32 errconfig_offs = 0, errconfig_mask = 0; | ||
78 | |||
79 | reg_val = __raw_readl(sr->base + offset); | ||
80 | reg_val &= ~mask; | ||
81 | 77 | ||
82 | /* | 78 | /* |
83 | * Smartreflex error config register is special as it contains | 79 | * Smartreflex error config register is special as it contains |
@@ -88,16 +84,15 @@ static inline void sr_modify_reg(struct omap_sr *sr, unsigned offset, u32 mask, | |||
88 | * if they are currently set, but does allow the caller to write | 84 | * if they are currently set, but does allow the caller to write |
89 | * those bits. | 85 | * those bits. |
90 | */ | 86 | */ |
91 | if (sr->ip_type == SR_TYPE_V1) { | 87 | if (sr->ip_type == SR_TYPE_V1 && offset == ERRCONFIG_V1) |
92 | errconfig_offs = ERRCONFIG_V1; | 88 | mask |= ERRCONFIG_STATUS_V1_MASK; |
93 | errconfig_mask = ERRCONFIG_STATUS_V1_MASK; | 89 | else if (sr->ip_type == SR_TYPE_V2 && offset == ERRCONFIG_V2) |
94 | } else if (sr->ip_type == SR_TYPE_V2) { | 90 | mask |= ERRCONFIG_VPBOUNDINTST_V2; |
95 | errconfig_offs = ERRCONFIG_V2; | 91 | |
96 | errconfig_mask = ERRCONFIG_VPBOUNDINTST_V2; | 92 | reg_val = __raw_readl(sr->base + offset); |
97 | } | 93 | reg_val &= ~mask; |
98 | 94 | ||
99 | if (offset == errconfig_offs) | 95 | value &= mask; |
100 | reg_val &= ~errconfig_mask; | ||
101 | 96 | ||
102 | reg_val |= value; | 97 | reg_val |= value; |
103 | 98 | ||
@@ -128,21 +123,28 @@ static struct omap_sr *_sr_lookup(struct voltagedomain *voltdm) | |||
128 | 123 | ||
129 | static irqreturn_t sr_interrupt(int irq, void *data) | 124 | static irqreturn_t sr_interrupt(int irq, void *data) |
130 | { | 125 | { |
131 | struct omap_sr *sr_info = (struct omap_sr *)data; | 126 | struct omap_sr *sr_info = data; |
132 | u32 status = 0; | 127 | u32 status = 0; |
133 | 128 | ||
134 | if (sr_info->ip_type == SR_TYPE_V1) { | 129 | switch (sr_info->ip_type) { |
130 | case SR_TYPE_V1: | ||
135 | /* Read the status bits */ | 131 | /* Read the status bits */ |
136 | status = sr_read_reg(sr_info, ERRCONFIG_V1); | 132 | status = sr_read_reg(sr_info, ERRCONFIG_V1); |
137 | 133 | ||
138 | /* Clear them by writing back */ | 134 | /* Clear them by writing back */ |
139 | sr_write_reg(sr_info, ERRCONFIG_V1, status); | 135 | sr_write_reg(sr_info, ERRCONFIG_V1, status); |
140 | } else if (sr_info->ip_type == SR_TYPE_V2) { | 136 | break; |
137 | case SR_TYPE_V2: | ||
141 | /* Read the status bits */ | 138 | /* Read the status bits */ |
142 | status = sr_read_reg(sr_info, IRQSTATUS); | 139 | status = sr_read_reg(sr_info, IRQSTATUS); |
143 | 140 | ||
144 | /* Clear them by writing back */ | 141 | /* Clear them by writing back */ |
145 | sr_write_reg(sr_info, IRQSTATUS, status); | 142 | sr_write_reg(sr_info, IRQSTATUS, status); |
143 | break; | ||
144 | default: | ||
145 | dev_err(&sr_info->pdev->dev, "UNKNOWN IP type %d\n", | ||
146 | sr_info->ip_type); | ||
147 | return IRQ_NONE; | ||
146 | } | 148 | } |
147 | 149 | ||
148 | if (sr_class->notify) | 150 | if (sr_class->notify) |
@@ -166,6 +168,7 @@ static void sr_set_clk_length(struct omap_sr *sr) | |||
166 | __func__); | 168 | __func__); |
167 | return; | 169 | return; |
168 | } | 170 | } |
171 | |||
169 | sys_clk_speed = clk_get_rate(sys_ck); | 172 | sys_clk_speed = clk_get_rate(sys_ck); |
170 | clk_put(sys_ck); | 173 | clk_put(sys_ck); |
171 | 174 | ||
@@ -267,7 +270,7 @@ static int sr_late_init(struct omap_sr *sr_info) | |||
267 | goto error; | 270 | goto error; |
268 | } | 271 | } |
269 | ret = request_irq(sr_info->irq, sr_interrupt, | 272 | ret = request_irq(sr_info->irq, sr_interrupt, |
270 | 0, name, (void *)sr_info); | 273 | 0, name, sr_info); |
271 | if (ret) | 274 | if (ret) |
272 | goto error; | 275 | goto error; |
273 | disable_irq(sr_info->irq); | 276 | disable_irq(sr_info->irq); |
@@ -288,12 +291,15 @@ error: | |||
288 | "not function as desired\n", __func__); | 291 | "not function as desired\n", __func__); |
289 | kfree(name); | 292 | kfree(name); |
290 | kfree(sr_info); | 293 | kfree(sr_info); |
294 | |||
291 | return ret; | 295 | return ret; |
292 | } | 296 | } |
293 | 297 | ||
294 | static void sr_v1_disable(struct omap_sr *sr) | 298 | static void sr_v1_disable(struct omap_sr *sr) |
295 | { | 299 | { |
296 | int timeout = 0; | 300 | int timeout = 0; |
301 | int errconf_val = ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | | ||
302 | ERRCONFIG_MCUBOUNDINTST; | ||
297 | 303 | ||
298 | /* Enable MCUDisableAcknowledge interrupt */ | 304 | /* Enable MCUDisableAcknowledge interrupt */ |
299 | sr_modify_reg(sr, ERRCONFIG_V1, | 305 | sr_modify_reg(sr, ERRCONFIG_V1, |
@@ -302,13 +308,13 @@ static void sr_v1_disable(struct omap_sr *sr) | |||
302 | /* SRCONFIG - disable SR */ | 308 | /* SRCONFIG - disable SR */ |
303 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); | 309 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); |
304 | 310 | ||
305 | /* Disable all other SR interrupts and clear the status */ | 311 | /* Disable all other SR interrupts and clear the status as needed */ |
312 | if (sr_read_reg(sr, ERRCONFIG_V1) & ERRCONFIG_VPBOUNDINTST_V1) | ||
313 | errconf_val |= ERRCONFIG_VPBOUNDINTST_V1; | ||
306 | sr_modify_reg(sr, ERRCONFIG_V1, | 314 | sr_modify_reg(sr, ERRCONFIG_V1, |
307 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | | 315 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | |
308 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), | 316 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_VPBOUNDINTEN_V1), |
309 | (ERRCONFIG_MCUACCUMINTST | ERRCONFIG_MCUVALIDINTST | | 317 | errconf_val); |
310 | ERRCONFIG_MCUBOUNDINTST | | ||
311 | ERRCONFIG_VPBOUNDINTST_V1)); | ||
312 | 318 | ||
313 | /* | 319 | /* |
314 | * Wait for SR to be disabled. | 320 | * Wait for SR to be disabled. |
@@ -337,9 +343,17 @@ static void sr_v2_disable(struct omap_sr *sr) | |||
337 | /* SRCONFIG - disable SR */ | 343 | /* SRCONFIG - disable SR */ |
338 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); | 344 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SRENABLE, 0x0); |
339 | 345 | ||
340 | /* Disable all other SR interrupts and clear the status */ | 346 | /* |
341 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | 347 | * Disable all other SR interrupts and clear the status |
348 | * write to status register ONLY on need basis - only if status | ||
349 | * is set. | ||
350 | */ | ||
351 | if (sr_read_reg(sr, ERRCONFIG_V2) & ERRCONFIG_VPBOUNDINTST_V2) | ||
352 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | ||
342 | ERRCONFIG_VPBOUNDINTST_V2); | 353 | ERRCONFIG_VPBOUNDINTST_V2); |
354 | else | ||
355 | sr_modify_reg(sr, ERRCONFIG_V2, ERRCONFIG_VPBOUNDINTEN_V2, | ||
356 | 0x0); | ||
343 | sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | | 357 | sr_write_reg(sr, IRQENABLE_CLR, (IRQENABLE_MCUACCUMINT | |
344 | IRQENABLE_MCUVALIDINT | | 358 | IRQENABLE_MCUVALIDINT | |
345 | IRQENABLE_MCUBOUNDSINT)); | 359 | IRQENABLE_MCUBOUNDSINT)); |
@@ -398,15 +412,16 @@ static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 efuse_offs) | |||
398 | */ | 412 | */ |
399 | int sr_configure_errgen(struct voltagedomain *voltdm) | 413 | int sr_configure_errgen(struct voltagedomain *voltdm) |
400 | { | 414 | { |
401 | u32 sr_config, sr_errconfig, errconfig_offs, vpboundint_en; | 415 | u32 sr_config, sr_errconfig, errconfig_offs; |
402 | u32 vpboundint_st, senp_en = 0, senn_en = 0; | 416 | u32 vpboundint_en, vpboundint_st; |
417 | u32 senp_en = 0, senn_en = 0; | ||
403 | u8 senp_shift, senn_shift; | 418 | u8 senp_shift, senn_shift; |
404 | struct omap_sr *sr = _sr_lookup(voltdm); | 419 | struct omap_sr *sr = _sr_lookup(voltdm); |
405 | 420 | ||
406 | if (IS_ERR(sr)) { | 421 | if (IS_ERR(sr)) { |
407 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 422 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
408 | __func__, voltdm->name); | 423 | __func__, voltdm->name); |
409 | return -EINVAL; | 424 | return PTR_ERR(sr); |
410 | } | 425 | } |
411 | 426 | ||
412 | if (!sr->clk_length) | 427 | if (!sr->clk_length) |
@@ -418,20 +433,23 @@ int sr_configure_errgen(struct voltagedomain *voltdm) | |||
418 | sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | | 433 | sr_config = (sr->clk_length << SRCONFIG_SRCLKLENGTH_SHIFT) | |
419 | SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; | 434 | SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN; |
420 | 435 | ||
421 | if (sr->ip_type == SR_TYPE_V1) { | 436 | switch (sr->ip_type) { |
437 | case SR_TYPE_V1: | ||
422 | sr_config |= SRCONFIG_DELAYCTRL; | 438 | sr_config |= SRCONFIG_DELAYCTRL; |
423 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; | 439 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; |
424 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; | 440 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; |
425 | errconfig_offs = ERRCONFIG_V1; | 441 | errconfig_offs = ERRCONFIG_V1; |
426 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; | 442 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; |
427 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; | 443 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; |
428 | } else if (sr->ip_type == SR_TYPE_V2) { | 444 | break; |
445 | case SR_TYPE_V2: | ||
429 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; | 446 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; |
430 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; | 447 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; |
431 | errconfig_offs = ERRCONFIG_V2; | 448 | errconfig_offs = ERRCONFIG_V2; |
432 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; | 449 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; |
433 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; | 450 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; |
434 | } else { | 451 | break; |
452 | default: | ||
435 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | 453 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" |
436 | "module without specifying the ip\n", __func__); | 454 | "module without specifying the ip\n", __func__); |
437 | return -EINVAL; | 455 | return -EINVAL; |
@@ -447,8 +465,55 @@ int sr_configure_errgen(struct voltagedomain *voltdm) | |||
447 | sr_errconfig); | 465 | sr_errconfig); |
448 | 466 | ||
449 | /* Enabling the interrupts if the ERROR module is used */ | 467 | /* Enabling the interrupts if the ERROR module is used */ |
450 | sr_modify_reg(sr, errconfig_offs, | 468 | sr_modify_reg(sr, errconfig_offs, (vpboundint_en | vpboundint_st), |
451 | vpboundint_en, (vpboundint_en | vpboundint_st)); | 469 | vpboundint_en); |
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | /** | ||
475 | * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component | ||
476 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | ||
477 | * | ||
478 | * This API is to be called from the smartreflex class driver to | ||
479 | * disable the error generator module inside the smartreflex module. | ||
480 | * | ||
481 | * Returns 0 on success and error value in case of failure. | ||
482 | */ | ||
483 | int sr_disable_errgen(struct voltagedomain *voltdm) | ||
484 | { | ||
485 | u32 errconfig_offs; | ||
486 | u32 vpboundint_en, vpboundint_st; | ||
487 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
488 | |||
489 | if (IS_ERR(sr)) { | ||
490 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | ||
491 | __func__, voltdm->name); | ||
492 | return PTR_ERR(sr); | ||
493 | } | ||
494 | |||
495 | switch (sr->ip_type) { | ||
496 | case SR_TYPE_V1: | ||
497 | errconfig_offs = ERRCONFIG_V1; | ||
498 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1; | ||
499 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1; | ||
500 | break; | ||
501 | case SR_TYPE_V2: | ||
502 | errconfig_offs = ERRCONFIG_V2; | ||
503 | vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2; | ||
504 | vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2; | ||
505 | break; | ||
506 | default: | ||
507 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | ||
508 | "module without specifying the ip\n", __func__); | ||
509 | return -EINVAL; | ||
510 | } | ||
511 | |||
512 | /* Disable the interrupts of ERROR module */ | ||
513 | sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0); | ||
514 | |||
515 | /* Disable the Sensor and errorgen */ | ||
516 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0); | ||
452 | 517 | ||
453 | return 0; | 518 | return 0; |
454 | } | 519 | } |
@@ -475,7 +540,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
475 | if (IS_ERR(sr)) { | 540 | if (IS_ERR(sr)) { |
476 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 541 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
477 | __func__, voltdm->name); | 542 | __func__, voltdm->name); |
478 | return -EINVAL; | 543 | return PTR_ERR(sr); |
479 | } | 544 | } |
480 | 545 | ||
481 | if (!sr->clk_length) | 546 | if (!sr->clk_length) |
@@ -488,14 +553,17 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
488 | SRCONFIG_SENENABLE | | 553 | SRCONFIG_SENENABLE | |
489 | (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); | 554 | (sr->accum_data << SRCONFIG_ACCUMDATA_SHIFT); |
490 | 555 | ||
491 | if (sr->ip_type == SR_TYPE_V1) { | 556 | switch (sr->ip_type) { |
557 | case SR_TYPE_V1: | ||
492 | sr_config |= SRCONFIG_DELAYCTRL; | 558 | sr_config |= SRCONFIG_DELAYCTRL; |
493 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; | 559 | senn_shift = SRCONFIG_SENNENABLE_V1_SHIFT; |
494 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; | 560 | senp_shift = SRCONFIG_SENPENABLE_V1_SHIFT; |
495 | } else if (sr->ip_type == SR_TYPE_V2) { | 561 | break; |
562 | case SR_TYPE_V2: | ||
496 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; | 563 | senn_shift = SRCONFIG_SENNENABLE_V2_SHIFT; |
497 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; | 564 | senp_shift = SRCONFIG_SENPENABLE_V2_SHIFT; |
498 | } else { | 565 | break; |
566 | default: | ||
499 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | 567 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" |
500 | "module without specifying the ip\n", __func__); | 568 | "module without specifying the ip\n", __func__); |
501 | return -EINVAL; | 569 | return -EINVAL; |
@@ -511,20 +579,27 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
511 | * Enabling the interrupts if MINMAXAVG module is used. | 579 | * Enabling the interrupts if MINMAXAVG module is used. |
512 | * TODO: check if all the interrupts are mandatory | 580 | * TODO: check if all the interrupts are mandatory |
513 | */ | 581 | */ |
514 | if (sr->ip_type == SR_TYPE_V1) { | 582 | switch (sr->ip_type) { |
583 | case SR_TYPE_V1: | ||
515 | sr_modify_reg(sr, ERRCONFIG_V1, | 584 | sr_modify_reg(sr, ERRCONFIG_V1, |
516 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | | 585 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUVALIDINTEN | |
517 | ERRCONFIG_MCUBOUNDINTEN), | 586 | ERRCONFIG_MCUBOUNDINTEN), |
518 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | | 587 | (ERRCONFIG_MCUACCUMINTEN | ERRCONFIG_MCUACCUMINTST | |
519 | ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | | 588 | ERRCONFIG_MCUVALIDINTEN | ERRCONFIG_MCUVALIDINTST | |
520 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); | 589 | ERRCONFIG_MCUBOUNDINTEN | ERRCONFIG_MCUBOUNDINTST)); |
521 | } else if (sr->ip_type == SR_TYPE_V2) { | 590 | break; |
591 | case SR_TYPE_V2: | ||
522 | sr_write_reg(sr, IRQSTATUS, | 592 | sr_write_reg(sr, IRQSTATUS, |
523 | IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | | 593 | IRQSTATUS_MCUACCUMINT | IRQSTATUS_MCVALIDINT | |
524 | IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); | 594 | IRQSTATUS_MCBOUNDSINT | IRQSTATUS_MCUDISABLEACKINT); |
525 | sr_write_reg(sr, IRQENABLE_SET, | 595 | sr_write_reg(sr, IRQENABLE_SET, |
526 | IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | | 596 | IRQENABLE_MCUACCUMINT | IRQENABLE_MCUVALIDINT | |
527 | IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); | 597 | IRQENABLE_MCUBOUNDSINT | IRQENABLE_MCUDISABLEACKINT); |
598 | break; | ||
599 | default: | ||
600 | dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex" | ||
601 | "module without specifying the ip\n", __func__); | ||
602 | return -EINVAL; | ||
528 | } | 603 | } |
529 | 604 | ||
530 | return 0; | 605 | return 0; |
@@ -543,15 +618,15 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
543 | */ | 618 | */ |
544 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | 619 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) |
545 | { | 620 | { |
546 | u32 nvalue_reciprocal; | ||
547 | struct omap_volt_data *volt_data; | 621 | struct omap_volt_data *volt_data; |
548 | struct omap_sr *sr = _sr_lookup(voltdm); | 622 | struct omap_sr *sr = _sr_lookup(voltdm); |
623 | u32 nvalue_reciprocal; | ||
549 | int ret; | 624 | int ret; |
550 | 625 | ||
551 | if (IS_ERR(sr)) { | 626 | if (IS_ERR(sr)) { |
552 | pr_warning("%s: omap_sr struct for sr_%s not found\n", | 627 | pr_warning("%s: omap_sr struct for sr_%s not found\n", |
553 | __func__, voltdm->name); | 628 | __func__, voltdm->name); |
554 | return -EINVAL; | 629 | return PTR_ERR(sr); |
555 | } | 630 | } |
556 | 631 | ||
557 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); | 632 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); |
@@ -559,7 +634,7 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | |||
559 | if (IS_ERR(volt_data)) { | 634 | if (IS_ERR(volt_data)) { |
560 | dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" | 635 | dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" |
561 | "for nominal voltage %ld\n", __func__, volt); | 636 | "for nominal voltage %ld\n", __func__, volt); |
562 | return -ENODATA; | 637 | return PTR_ERR(volt_data); |
563 | } | 638 | } |
564 | 639 | ||
565 | nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); | 640 | nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); |
@@ -617,10 +692,17 @@ void sr_disable(struct voltagedomain *voltdm) | |||
617 | * disable the clocks. | 692 | * disable the clocks. |
618 | */ | 693 | */ |
619 | if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { | 694 | if (sr_read_reg(sr, SRCONFIG) & SRCONFIG_SRENABLE) { |
620 | if (sr->ip_type == SR_TYPE_V1) | 695 | switch (sr->ip_type) { |
696 | case SR_TYPE_V1: | ||
621 | sr_v1_disable(sr); | 697 | sr_v1_disable(sr); |
622 | else if (sr->ip_type == SR_TYPE_V2) | 698 | break; |
699 | case SR_TYPE_V2: | ||
623 | sr_v2_disable(sr); | 700 | sr_v2_disable(sr); |
701 | break; | ||
702 | default: | ||
703 | dev_err(&sr->pdev->dev, "UNKNOWN IP type %d\n", | ||
704 | sr->ip_type); | ||
705 | } | ||
624 | } | 706 | } |
625 | 707 | ||
626 | pm_runtime_put_sync_suspend(&sr->pdev->dev); | 708 | pm_runtime_put_sync_suspend(&sr->pdev->dev); |
@@ -779,10 +861,10 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data) | |||
779 | sr_pmic_data = pmic_data; | 861 | sr_pmic_data = pmic_data; |
780 | } | 862 | } |
781 | 863 | ||
782 | /* PM Debug Fs enteries to enable disable smartreflex. */ | 864 | /* PM Debug FS entries to enable and disable smartreflex. */ |
783 | static int omap_sr_autocomp_show(void *data, u64 *val) | 865 | static int omap_sr_autocomp_show(void *data, u64 *val) |
784 | { | 866 | { |
785 | struct omap_sr *sr_info = (struct omap_sr *) data; | 867 | struct omap_sr *sr_info = data; |
786 | 868 | ||
787 | if (!sr_info) { | 869 | if (!sr_info) { |
788 | pr_warning("%s: omap_sr struct not found\n", __func__); | 870 | pr_warning("%s: omap_sr struct not found\n", __func__); |
@@ -796,7 +878,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val) | |||
796 | 878 | ||
797 | static int omap_sr_autocomp_store(void *data, u64 val) | 879 | static int omap_sr_autocomp_store(void *data, u64 val) |
798 | { | 880 | { |
799 | struct omap_sr *sr_info = (struct omap_sr *) data; | 881 | struct omap_sr *sr_info = data; |
800 | 882 | ||
801 | if (!sr_info) { | 883 | if (!sr_info) { |
802 | pr_warning("%s: omap_sr struct not found\n", __func__); | 884 | pr_warning("%s: omap_sr struct not found\n", __func__); |
@@ -804,7 +886,7 @@ static int omap_sr_autocomp_store(void *data, u64 val) | |||
804 | } | 886 | } |
805 | 887 | ||
806 | /* Sanity check */ | 888 | /* Sanity check */ |
807 | if (val && (val != 1)) { | 889 | if (val > 1) { |
808 | pr_warning("%s: Invalid argument %lld\n", __func__, val); | 890 | pr_warning("%s: Invalid argument %lld\n", __func__, val); |
809 | return -EINVAL; | 891 | return -EINVAL; |
810 | } | 892 | } |
@@ -821,11 +903,11 @@ static int omap_sr_autocomp_store(void *data, u64 val) | |||
821 | } | 903 | } |
822 | 904 | ||
823 | DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, | 905 | DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show, |
824 | omap_sr_autocomp_store, "%llu\n"); | 906 | omap_sr_autocomp_store, "%llu\n"); |
825 | 907 | ||
826 | static int __init omap_sr_probe(struct platform_device *pdev) | 908 | static int __init omap_sr_probe(struct platform_device *pdev) |
827 | { | 909 | { |
828 | struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | 910 | struct omap_sr *sr_info; |
829 | struct omap_sr_data *pdata = pdev->dev.platform_data; | 911 | struct omap_sr_data *pdata = pdev->dev.platform_data; |
830 | struct resource *mem, *irq; | 912 | struct resource *mem, *irq; |
831 | struct dentry *nvalue_dir; | 913 | struct dentry *nvalue_dir; |
@@ -833,12 +915,15 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
833 | int i, ret = 0; | 915 | int i, ret = 0; |
834 | char *name; | 916 | char *name; |
835 | 917 | ||
918 | sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | ||
836 | if (!sr_info) { | 919 | if (!sr_info) { |
837 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", | 920 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", |
838 | __func__); | 921 | __func__); |
839 | return -ENOMEM; | 922 | return -ENOMEM; |
840 | } | 923 | } |
841 | 924 | ||
925 | platform_set_drvdata(pdev, sr_info); | ||
926 | |||
842 | if (!pdata) { | 927 | if (!pdata) { |
843 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | 928 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); |
844 | ret = -EINVAL; | 929 | ret = -EINVAL; |
@@ -904,7 +989,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
904 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); | 989 | dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__); |
905 | if (!sr_dbg_dir) { | 990 | if (!sr_dbg_dir) { |
906 | sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); | 991 | sr_dbg_dir = debugfs_create_dir("smartreflex", NULL); |
907 | if (!sr_dbg_dir) { | 992 | if (IS_ERR_OR_NULL(sr_dbg_dir)) { |
908 | ret = PTR_ERR(sr_dbg_dir); | 993 | ret = PTR_ERR(sr_dbg_dir); |
909 | pr_err("%s:sr debugfs dir creation failed(%d)\n", | 994 | pr_err("%s:sr debugfs dir creation failed(%d)\n", |
910 | __func__, ret); | 995 | __func__, ret); |
@@ -921,7 +1006,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
921 | } | 1006 | } |
922 | sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); | 1007 | sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir); |
923 | kfree(name); | 1008 | kfree(name); |
924 | if (IS_ERR(sr_info->dbg_dir)) { | 1009 | if (IS_ERR_OR_NULL(sr_info->dbg_dir)) { |
925 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", | 1010 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", |
926 | __func__); | 1011 | __func__); |
927 | ret = PTR_ERR(sr_info->dbg_dir); | 1012 | ret = PTR_ERR(sr_info->dbg_dir); |
@@ -938,7 +1023,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
938 | &sr_info->err_minlimit); | 1023 | &sr_info->err_minlimit); |
939 | 1024 | ||
940 | nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); | 1025 | nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir); |
941 | if (IS_ERR(nvalue_dir)) { | 1026 | if (IS_ERR_OR_NULL(nvalue_dir)) { |
942 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" | 1027 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" |
943 | "for n-values\n", __func__); | 1028 | "for n-values\n", __func__); |
944 | ret = PTR_ERR(nvalue_dir); | 1029 | ret = PTR_ERR(nvalue_dir); |
@@ -994,7 +1079,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev) | |||
994 | if (IS_ERR(sr_info)) { | 1079 | if (IS_ERR(sr_info)) { |
995 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", | 1080 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", |
996 | __func__); | 1081 | __func__); |
997 | return -EINVAL; | 1082 | return PTR_ERR(sr_info); |
998 | } | 1083 | } |
999 | 1084 | ||
1000 | if (sr_info->autocomp_active) | 1085 | if (sr_info->autocomp_active) |
@@ -1011,8 +1096,32 @@ static int __devexit omap_sr_remove(struct platform_device *pdev) | |||
1011 | return 0; | 1096 | return 0; |
1012 | } | 1097 | } |
1013 | 1098 | ||
1099 | static void __devexit omap_sr_shutdown(struct platform_device *pdev) | ||
1100 | { | ||
1101 | struct omap_sr_data *pdata = pdev->dev.platform_data; | ||
1102 | struct omap_sr *sr_info; | ||
1103 | |||
1104 | if (!pdata) { | ||
1105 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | ||
1106 | return; | ||
1107 | } | ||
1108 | |||
1109 | sr_info = _sr_lookup(pdata->voltdm); | ||
1110 | if (IS_ERR(sr_info)) { | ||
1111 | dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", | ||
1112 | __func__); | ||
1113 | return; | ||
1114 | } | ||
1115 | |||
1116 | if (sr_info->autocomp_active) | ||
1117 | sr_stop_vddautocomp(sr_info); | ||
1118 | |||
1119 | return; | ||
1120 | } | ||
1121 | |||
1014 | static struct platform_driver smartreflex_driver = { | 1122 | static struct platform_driver smartreflex_driver = { |
1015 | .remove = __devexit_p(omap_sr_remove), | 1123 | .remove = __devexit_p(omap_sr_remove), |
1124 | .shutdown = __devexit_p(omap_sr_shutdown), | ||
1016 | .driver = { | 1125 | .driver = { |
1017 | .name = "smartreflex", | 1126 | .name = "smartreflex", |
1018 | }, | 1127 | }, |
@@ -1042,12 +1151,12 @@ static int __init sr_init(void) | |||
1042 | 1151 | ||
1043 | return 0; | 1152 | return 0; |
1044 | } | 1153 | } |
1154 | late_initcall(sr_init); | ||
1045 | 1155 | ||
1046 | static void __exit sr_exit(void) | 1156 | static void __exit sr_exit(void) |
1047 | { | 1157 | { |
1048 | platform_driver_unregister(&smartreflex_driver); | 1158 | platform_driver_unregister(&smartreflex_driver); |
1049 | } | 1159 | } |
1050 | late_initcall(sr_init); | ||
1051 | module_exit(sr_exit); | 1160 | module_exit(sr_exit); |
1052 | 1161 | ||
1053 | MODULE_DESCRIPTION("OMAP Smartreflex Driver"); | 1162 | MODULE_DESCRIPTION("OMAP Smartreflex Driver"); |
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h index 5f35b9e25556..5809141171f8 100644 --- a/arch/arm/mach-omap2/smartreflex.h +++ b/arch/arm/mach-omap2/smartreflex.h | |||
@@ -152,6 +152,15 @@ struct omap_sr_pmic_data { | |||
152 | void (*sr_pmic_init) (void); | 152 | void (*sr_pmic_init) (void); |
153 | }; | 153 | }; |
154 | 154 | ||
155 | /** | ||
156 | * struct omap_smartreflex_dev_attr - Smartreflex Device attribute. | ||
157 | * | ||
158 | * @sensor_voltdm_name: Name of voltdomain of SR instance | ||
159 | */ | ||
160 | struct omap_smartreflex_dev_attr { | ||
161 | const char *sensor_voltdm_name; | ||
162 | }; | ||
163 | |||
155 | #ifdef CONFIG_OMAP_SMARTREFLEX | 164 | #ifdef CONFIG_OMAP_SMARTREFLEX |
156 | /* | 165 | /* |
157 | * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. | 166 | * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR. |
@@ -231,6 +240,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); | |||
231 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt); | 240 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt); |
232 | void sr_disable(struct voltagedomain *voltdm); | 241 | void sr_disable(struct voltagedomain *voltdm); |
233 | int sr_configure_errgen(struct voltagedomain *voltdm); | 242 | int sr_configure_errgen(struct voltagedomain *voltdm); |
243 | int sr_disable_errgen(struct voltagedomain *voltdm); | ||
234 | int sr_configure_minmax(struct voltagedomain *voltdm); | 244 | int sr_configure_minmax(struct voltagedomain *voltdm); |
235 | 245 | ||
236 | /* API to register the smartreflex class driver with the smartreflex driver */ | 246 | /* API to register the smartreflex class driver with the smartreflex driver */ |
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index 78c9437913ce..a503e1e8358c 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -74,6 +74,7 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | |||
74 | struct omap_sr_data *sr_data; | 74 | struct omap_sr_data *sr_data; |
75 | struct platform_device *pdev; | 75 | struct platform_device *pdev; |
76 | struct omap_volt_data *volt_data; | 76 | struct omap_volt_data *volt_data; |
77 | struct omap_smartreflex_dev_attr *sr_dev_attr; | ||
77 | char *name = "smartreflex"; | 78 | char *name = "smartreflex"; |
78 | static int i; | 79 | static int i; |
79 | 80 | ||
@@ -84,9 +85,11 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | |||
84 | return -ENOMEM; | 85 | return -ENOMEM; |
85 | } | 86 | } |
86 | 87 | ||
87 | if (!oh->vdd_name) { | 88 | sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr; |
89 | if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) { | ||
88 | pr_err("%s: No voltage domain specified for %s." | 90 | pr_err("%s: No voltage domain specified for %s." |
89 | "Cannot initialize\n", __func__, oh->name); | 91 | "Cannot initialize\n", __func__, |
92 | oh->name); | ||
90 | goto exit; | 93 | goto exit; |
91 | } | 94 | } |
92 | 95 | ||
@@ -94,10 +97,10 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) | |||
94 | sr_data->senn_mod = 0x1; | 97 | sr_data->senn_mod = 0x1; |
95 | sr_data->senp_mod = 0x1; | 98 | sr_data->senp_mod = 0x1; |
96 | 99 | ||
97 | sr_data->voltdm = voltdm_lookup(oh->vdd_name); | 100 | sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); |
98 | if (IS_ERR(sr_data->voltdm)) { | 101 | if (IS_ERR(sr_data->voltdm)) { |
99 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", | 102 | pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", |
100 | __func__, oh->vdd_name); | 103 | __func__, sr_dev_attr->sensor_voltdm_name); |
101 | goto exit; | 104 | goto exit; |
102 | } | 105 | } |
103 | 106 | ||
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 5bc13121eac5..84f2d7015cfe 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -406,20 +406,17 @@ static struct resource pxa_rtc_resources[] = { | |||
406 | [1] = { | 406 | [1] = { |
407 | .start = IRQ_RTC1Hz, | 407 | .start = IRQ_RTC1Hz, |
408 | .end = IRQ_RTC1Hz, | 408 | .end = IRQ_RTC1Hz, |
409 | .name = "rtc 1Hz", | ||
409 | .flags = IORESOURCE_IRQ, | 410 | .flags = IORESOURCE_IRQ, |
410 | }, | 411 | }, |
411 | [2] = { | 412 | [2] = { |
412 | .start = IRQ_RTCAlrm, | 413 | .start = IRQ_RTCAlrm, |
413 | .end = IRQ_RTCAlrm, | 414 | .end = IRQ_RTCAlrm, |
415 | .name = "rtc alarm", | ||
414 | .flags = IORESOURCE_IRQ, | 416 | .flags = IORESOURCE_IRQ, |
415 | }, | 417 | }, |
416 | }; | 418 | }; |
417 | 419 | ||
418 | struct platform_device sa1100_device_rtc = { | ||
419 | .name = "sa1100-rtc", | ||
420 | .id = -1, | ||
421 | }; | ||
422 | |||
423 | struct platform_device pxa_device_rtc = { | 420 | struct platform_device pxa_device_rtc = { |
424 | .name = "pxa-rtc", | 421 | .name = "pxa-rtc", |
425 | .id = -1, | 422 | .id = -1, |
@@ -427,6 +424,27 @@ struct platform_device pxa_device_rtc = { | |||
427 | .resource = pxa_rtc_resources, | 424 | .resource = pxa_rtc_resources, |
428 | }; | 425 | }; |
429 | 426 | ||
427 | static struct resource sa1100_rtc_resources[] = { | ||
428 | { | ||
429 | .start = IRQ_RTC1Hz, | ||
430 | .end = IRQ_RTC1Hz, | ||
431 | .name = "rtc 1Hz", | ||
432 | .flags = IORESOURCE_IRQ, | ||
433 | }, { | ||
434 | .start = IRQ_RTCAlrm, | ||
435 | .end = IRQ_RTCAlrm, | ||
436 | .name = "rtc alarm", | ||
437 | .flags = IORESOURCE_IRQ, | ||
438 | }, | ||
439 | }; | ||
440 | |||
441 | struct platform_device sa1100_device_rtc = { | ||
442 | .name = "sa1100-rtc", | ||
443 | .id = -1, | ||
444 | .num_resources = ARRAY_SIZE(sa1100_rtc_resources), | ||
445 | .resource = sa1100_rtc_resources, | ||
446 | }; | ||
447 | |||
430 | static struct resource pxa_ac97_resources[] = { | 448 | static struct resource pxa_ac97_resources[] = { |
431 | [0] = { | 449 | [0] = { |
432 | .start = 0x40500000, | 450 | .start = 0x40500000, |
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index f309bf975202..3fa929d4a4f5 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c | |||
@@ -28,7 +28,8 @@ | |||
28 | #include <linux/mtd/physmap.h> | 28 | #include <linux/mtd/physmap.h> |
29 | #include <linux/pda_power.h> | 29 | #include <linux/pda_power.h> |
30 | #include <linux/pwm_backlight.h> | 30 | #include <linux/pwm_backlight.h> |
31 | #include <linux/regulator/bq24022.h> | 31 | #include <linux/regulator/driver.h> |
32 | #include <linux/regulator/gpio-regulator.h> | ||
32 | #include <linux/regulator/machine.h> | 33 | #include <linux/regulator/machine.h> |
33 | #include <linux/regulator/max1586.h> | 34 | #include <linux/regulator/max1586.h> |
34 | #include <linux/spi/ads7846.h> | 35 | #include <linux/spi/ads7846.h> |
@@ -698,14 +699,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
698 | .consumer_supplies = bq24022_consumers, | 699 | .consumer_supplies = bq24022_consumers, |
699 | }; | 700 | }; |
700 | 701 | ||
701 | static struct bq24022_mach_info bq24022_info = { | 702 | static struct gpio bq24022_gpios[] = { |
702 | .gpio_nce = GPIO72_HX4700_BQ24022_nCHARGE_EN, | 703 | { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
703 | .gpio_iset2 = GPIO96_HX4700_BQ24022_ISET2, | 704 | }; |
704 | .init_data = &bq24022_init_data, | 705 | |
706 | static struct gpio_regulator_state bq24022_states[] = { | ||
707 | { .value = 100000, .gpios = (0 << 0) }, | ||
708 | { .value = 500000, .gpios = (1 << 0) }, | ||
709 | }; | ||
710 | |||
711 | static struct gpio_regulator_config bq24022_info = { | ||
712 | .supply_name = "bq24022", | ||
713 | |||
714 | .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN, | ||
715 | .enable_high = 0, | ||
716 | .enabled_at_boot = 0, | ||
717 | |||
718 | .gpios = bq24022_gpios, | ||
719 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
720 | |||
721 | .states = bq24022_states, | ||
722 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
723 | |||
724 | .type = REGULATOR_CURRENT, | ||
725 | .init_data = &bq24022_init_data, | ||
705 | }; | 726 | }; |
706 | 727 | ||
707 | static struct platform_device bq24022 = { | 728 | static struct platform_device bq24022 = { |
708 | .name = "bq24022", | 729 | .name = "gpio-regulator", |
709 | .id = -1, | 730 | .id = -1, |
710 | .dev = { | 731 | .dev = { |
711 | .platform_data = &bq24022_info, | 732 | .platform_data = &bq24022_info, |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 3d6baf91396c..5e26f3e93fdd 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -25,7 +25,8 @@ | |||
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
28 | #include <linux/regulator/bq24022.h> | 28 | #include <linux/regulator/driver.h> |
29 | #include <linux/regulator/gpio-regulator.h> | ||
29 | #include <linux/regulator/machine.h> | 30 | #include <linux/regulator/machine.h> |
30 | #include <linux/usb/gpio_vbus.h> | 31 | #include <linux/usb/gpio_vbus.h> |
31 | #include <linux/i2c/pxa-i2c.h> | 32 | #include <linux/i2c/pxa-i2c.h> |
@@ -596,14 +597,34 @@ static struct regulator_init_data bq24022_init_data = { | |||
596 | .consumer_supplies = bq24022_consumers, | 597 | .consumer_supplies = bq24022_consumers, |
597 | }; | 598 | }; |
598 | 599 | ||
599 | static struct bq24022_mach_info bq24022_info = { | 600 | static struct gpio bq24022_gpios[] = { |
600 | .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | 601 | { EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
601 | .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, | 602 | }; |
602 | .init_data = &bq24022_init_data, | 603 | |
604 | static struct gpio_regulator_state bq24022_states[] = { | ||
605 | { .value = 100000, .gpios = (0 << 0) }, | ||
606 | { .value = 500000, .gpios = (1 << 0) }, | ||
607 | }; | ||
608 | |||
609 | static struct gpio_regulator_config bq24022_info = { | ||
610 | .supply_name = "bq24022", | ||
611 | |||
612 | .enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | ||
613 | .enable_high = 0, | ||
614 | .enabled_at_boot = 0, | ||
615 | |||
616 | .gpios = bq24022_gpios, | ||
617 | .nr_gpios = ARRAY_SIZE(bq24022_gpios), | ||
618 | |||
619 | .states = bq24022_states, | ||
620 | .nr_states = ARRAY_SIZE(bq24022_states), | ||
621 | |||
622 | .type = REGULATOR_CURRENT, | ||
623 | .init_data = &bq24022_init_data, | ||
603 | }; | 624 | }; |
604 | 625 | ||
605 | static struct platform_device bq24022 = { | 626 | static struct platform_device bq24022 = { |
606 | .name = "bq24022", | 627 | .name = "gpio-regulator", |
607 | .id = -1, | 628 | .id = -1, |
608 | .dev = { | 629 | .dev = { |
609 | .platform_data = &bq24022_info, | 630 | .platform_data = &bq24022_info, |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 3918a672238e..1570d457fea3 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -89,6 +89,7 @@ static struct clk_lookup pxa3xx_clkregs[] = { | |||
89 | INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), | 89 | INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), |
90 | INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), | 90 | INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), |
91 | INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), | 91 | INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), |
92 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | #ifdef CONFIG_PM | 95 | #ifdef CONFIG_PM |
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c index 5ce434b95e87..47601f80e6e7 100644 --- a/arch/arm/mach-pxa/pxa95x.c +++ b/arch/arm/mach-pxa/pxa95x.c | |||
@@ -231,6 +231,7 @@ static struct clk_lookup pxa95x_clkregs[] = { | |||
231 | INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), | 231 | INIT_CLKREG(&clk_pxa95x_pwm0, "pxa27x-pwm.0", NULL), |
232 | INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), | 232 | INIT_CLKREG(&clk_pxa95x_pwm1, "pxa27x-pwm.1", NULL), |
233 | INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), | 233 | INIT_CLKREG(&clk_pxa95x_gpio, "pxa-gpio", NULL), |
234 | INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), | ||
234 | }; | 235 | }; |
235 | 236 | ||
236 | void __init pxa95x_init_irq(void) | 237 | void __init pxa95x_init_irq(void) |
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c index 08bb0355159d..0e9a71c90ed7 100644 --- a/arch/arm/mach-s3c24xx/s3c2416.c +++ b/arch/arm/mach-s3c24xx/s3c2416.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <plat/fb-core.h> | 59 | #include <plat/fb-core.h> |
60 | #include <plat/nand-core.h> | 60 | #include <plat/nand-core.h> |
61 | #include <plat/adc-core.h> | 61 | #include <plat/adc-core.h> |
62 | #include <plat/rtc-core.h> | ||
62 | 63 | ||
63 | static struct map_desc s3c2416_iodesc[] __initdata = { | 64 | static struct map_desc s3c2416_iodesc[] __initdata = { |
64 | IODESC_ENT(WATCHDOG), | 65 | IODESC_ENT(WATCHDOG), |
@@ -98,6 +99,7 @@ int __init s3c2416_init(void) | |||
98 | s3c_fb_setname("s3c2443-fb"); | 99 | s3c_fb_setname("s3c2443-fb"); |
99 | 100 | ||
100 | s3c_adc_setname("s3c2416-adc"); | 101 | s3c_adc_setname("s3c2416-adc"); |
102 | s3c_rtc_setname("s3c2416-rtc"); | ||
101 | 103 | ||
102 | #ifdef CONFIG_PM | 104 | #ifdef CONFIG_PM |
103 | register_syscore_ops(&s3c2416_pm_syscore_ops); | 105 | register_syscore_ops(&s3c2416_pm_syscore_ops); |
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c index b9deaeb0dfff..b7778a9dafaf 100644 --- a/arch/arm/mach-s3c24xx/s3c2443.c +++ b/arch/arm/mach-s3c24xx/s3c2443.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/fb-core.h> | 41 | #include <plat/fb-core.h> |
42 | #include <plat/nand-core.h> | 42 | #include <plat/nand-core.h> |
43 | #include <plat/adc-core.h> | 43 | #include <plat/adc-core.h> |
44 | #include <plat/rtc-core.h> | ||
44 | 45 | ||
45 | static struct map_desc s3c2443_iodesc[] __initdata = { | 46 | static struct map_desc s3c2443_iodesc[] __initdata = { |
46 | IODESC_ENT(WATCHDOG), | 47 | IODESC_ENT(WATCHDOG), |
@@ -73,6 +74,7 @@ int __init s3c2443_init(void) | |||
73 | s3c_fb_setname("s3c2443-fb"); | 74 | s3c_fb_setname("s3c2443-fb"); |
74 | 75 | ||
75 | s3c_adc_setname("s3c2443-adc"); | 76 | s3c_adc_setname("s3c2443-adc"); |
77 | s3c_rtc_setname("s3c2443-rtc"); | ||
76 | 78 | ||
77 | /* change WDT IRQ number */ | 79 | /* change WDT IRQ number */ |
78 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; | 80 | s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; |
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index dab3c6347a8f..172ebd0ee0a2 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -11,17 +11,29 @@ | |||
11 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/mutex.h> | 13 | #include <linux/mutex.h> |
14 | #include <linux/io.h> | ||
15 | #include <linux/clkdev.h> | ||
14 | 16 | ||
15 | #include <mach/hardware.h> | 17 | #include <mach/hardware.h> |
16 | 18 | ||
17 | /* | 19 | struct clkops { |
18 | * Very simple clock implementation - we only have one clock to deal with. | 20 | void (*enable)(struct clk *); |
19 | */ | 21 | void (*disable)(struct clk *); |
22 | }; | ||
23 | |||
20 | struct clk { | 24 | struct clk { |
25 | const struct clkops *ops; | ||
21 | unsigned int enabled; | 26 | unsigned int enabled; |
22 | }; | 27 | }; |
23 | 28 | ||
24 | static void clk_gpio27_enable(void) | 29 | #define DEFINE_CLK(_name, _ops) \ |
30 | struct clk clk_##_name = { \ | ||
31 | .ops = _ops, \ | ||
32 | } | ||
33 | |||
34 | static DEFINE_SPINLOCK(clocks_lock); | ||
35 | |||
36 | static void clk_gpio27_enable(struct clk *clk) | ||
25 | { | 37 | { |
26 | /* | 38 | /* |
27 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: | 39 | * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: |
@@ -32,38 +44,24 @@ static void clk_gpio27_enable(void) | |||
32 | TUCR = TUCR_3_6864MHz; | 44 | TUCR = TUCR_3_6864MHz; |
33 | } | 45 | } |
34 | 46 | ||
35 | static void clk_gpio27_disable(void) | 47 | static void clk_gpio27_disable(struct clk *clk) |
36 | { | 48 | { |
37 | TUCR = 0; | 49 | TUCR = 0; |
38 | GPDR &= ~GPIO_32_768kHz; | 50 | GPDR &= ~GPIO_32_768kHz; |
39 | GAFR &= ~GPIO_32_768kHz; | 51 | GAFR &= ~GPIO_32_768kHz; |
40 | } | 52 | } |
41 | 53 | ||
42 | static struct clk clk_gpio27; | ||
43 | |||
44 | static DEFINE_SPINLOCK(clocks_lock); | ||
45 | |||
46 | struct clk *clk_get(struct device *dev, const char *id) | ||
47 | { | ||
48 | const char *devname = dev_name(dev); | ||
49 | |||
50 | return strcmp(devname, "sa1111.0") ? ERR_PTR(-ENOENT) : &clk_gpio27; | ||
51 | } | ||
52 | EXPORT_SYMBOL(clk_get); | ||
53 | |||
54 | void clk_put(struct clk *clk) | ||
55 | { | ||
56 | } | ||
57 | EXPORT_SYMBOL(clk_put); | ||
58 | |||
59 | int clk_enable(struct clk *clk) | 54 | int clk_enable(struct clk *clk) |
60 | { | 55 | { |
61 | unsigned long flags; | 56 | unsigned long flags; |
62 | 57 | ||
63 | spin_lock_irqsave(&clocks_lock, flags); | 58 | if (clk) { |
64 | if (clk->enabled++ == 0) | 59 | spin_lock_irqsave(&clocks_lock, flags); |
65 | clk_gpio27_enable(); | 60 | if (clk->enabled++ == 0) |
66 | spin_unlock_irqrestore(&clocks_lock, flags); | 61 | clk->ops->enable(clk); |
62 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
63 | } | ||
64 | |||
67 | return 0; | 65 | return 0; |
68 | } | 66 | } |
69 | EXPORT_SYMBOL(clk_enable); | 67 | EXPORT_SYMBOL(clk_enable); |
@@ -72,17 +70,31 @@ void clk_disable(struct clk *clk) | |||
72 | { | 70 | { |
73 | unsigned long flags; | 71 | unsigned long flags; |
74 | 72 | ||
75 | WARN_ON(clk->enabled == 0); | 73 | if (clk) { |
76 | 74 | WARN_ON(clk->enabled == 0); | |
77 | spin_lock_irqsave(&clocks_lock, flags); | 75 | spin_lock_irqsave(&clocks_lock, flags); |
78 | if (--clk->enabled == 0) | 76 | if (--clk->enabled == 0) |
79 | clk_gpio27_disable(); | 77 | clk->ops->disable(clk); |
80 | spin_unlock_irqrestore(&clocks_lock, flags); | 78 | spin_unlock_irqrestore(&clocks_lock, flags); |
79 | } | ||
81 | } | 80 | } |
82 | EXPORT_SYMBOL(clk_disable); | 81 | EXPORT_SYMBOL(clk_disable); |
83 | 82 | ||
84 | unsigned long clk_get_rate(struct clk *clk) | 83 | const struct clkops clk_gpio27_ops = { |
84 | .enable = clk_gpio27_enable, | ||
85 | .disable = clk_gpio27_disable, | ||
86 | }; | ||
87 | |||
88 | static DEFINE_CLK(gpio27, &clk_gpio27_ops); | ||
89 | |||
90 | static struct clk_lookup sa11xx_clkregs[] = { | ||
91 | CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27), | ||
92 | CLKDEV_INIT("sa1100-rtc", NULL, NULL), | ||
93 | }; | ||
94 | |||
95 | static int __init sa11xx_clk_init(void) | ||
85 | { | 96 | { |
86 | return 3686400; | 97 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); |
98 | return 0; | ||
87 | } | 99 | } |
88 | EXPORT_SYMBOL(clk_get_rate); | 100 | core_initcall(sa11xx_clk_init); |
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index bb10ee2cb89f..7c1ebf4a7920 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -345,9 +345,17 @@ void sa11x0_register_irda(struct irda_platform_data *irda) | |||
345 | sa11x0_register_device(&sa11x0ir_device, irda); | 345 | sa11x0_register_device(&sa11x0ir_device, irda); |
346 | } | 346 | } |
347 | 347 | ||
348 | static struct resource sa1100_rtc_resources[] = { | ||
349 | DEFINE_RES_MEM(0x90010000, 0x9001003f), | ||
350 | DEFINE_RES_IRQ_NAMED(IRQ_RTC1Hz, "rtc 1Hz"), | ||
351 | DEFINE_RES_IRQ_NAMED(IRQ_RTCAlrm, "rtc alarm"), | ||
352 | }; | ||
353 | |||
348 | static struct platform_device sa11x0rtc_device = { | 354 | static struct platform_device sa11x0rtc_device = { |
349 | .name = "sa1100-rtc", | 355 | .name = "sa1100-rtc", |
350 | .id = -1, | 356 | .id = -1, |
357 | .num_resources = ARRAY_SIZE(sa1100_rtc_resources), | ||
358 | .resource = sa1100_rtc_resources, | ||
351 | }; | 359 | }; |
352 | 360 | ||
353 | static struct platform_device *sa11x0_devices[] __initdata = { | 361 | static struct platform_device *sa11x0_devices[] __initdata = { |
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 76a79b8a1721..1dd2726986cf 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -7,6 +7,7 @@ obj-y += clock.o | |||
7 | obj-y += timer.o | 7 | obj-y += timer.o |
8 | obj-y += pinmux.o | 8 | obj-y += pinmux.o |
9 | obj-y += fuse.o | 9 | obj-y += fuse.o |
10 | obj-y += pmc.o | ||
10 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 11 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
11 | obj-$(CONFIG_CPU_IDLE) += sleep.o | 12 | obj-$(CONFIG_CPU_IDLE) += sleep.o |
12 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o | 13 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o |
@@ -18,7 +19,7 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o | |||
18 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o | 19 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o |
19 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 20 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
20 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 21 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
21 | obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o | 22 | obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o |
22 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o | 23 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o |
23 | obj-$(CONFIG_TEGRA_PCI) += pcie.o | 24 | obj-$(CONFIG_TEGRA_PCI) += pcie.o |
24 | obj-$(CONFIG_USB_SUPPORT) += usb_phy.o | 25 | obj-$(CONFIG_USB_SUPPORT) += usb_phy.o |
diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c new file mode 100644 index 000000000000..e75451e517bd --- /dev/null +++ b/arch/arm/mach-tegra/apbio.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 NVIDIA Corporation. | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/dma-mapping.h> | ||
19 | #include <linux/spinlock.h> | ||
20 | #include <linux/completion.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | #include <mach/dma.h> | ||
25 | #include <mach/iomap.h> | ||
26 | |||
27 | #include "apbio.h" | ||
28 | |||
29 | static DEFINE_MUTEX(tegra_apb_dma_lock); | ||
30 | |||
31 | static struct tegra_dma_channel *tegra_apb_dma; | ||
32 | static u32 *tegra_apb_bb; | ||
33 | static dma_addr_t tegra_apb_bb_phys; | ||
34 | static DECLARE_COMPLETION(tegra_apb_wait); | ||
35 | |||
36 | bool tegra_apb_init(void) | ||
37 | { | ||
38 | struct tegra_dma_channel *ch; | ||
39 | |||
40 | mutex_lock(&tegra_apb_dma_lock); | ||
41 | |||
42 | /* Check to see if we raced to setup */ | ||
43 | if (tegra_apb_dma) | ||
44 | goto out; | ||
45 | |||
46 | ch = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT | | ||
47 | TEGRA_DMA_SHARED); | ||
48 | |||
49 | if (!ch) | ||
50 | goto out_fail; | ||
51 | |||
52 | tegra_apb_bb = dma_alloc_coherent(NULL, sizeof(u32), | ||
53 | &tegra_apb_bb_phys, GFP_KERNEL); | ||
54 | if (!tegra_apb_bb) { | ||
55 | pr_err("%s: can not allocate bounce buffer\n", __func__); | ||
56 | tegra_dma_free_channel(ch); | ||
57 | goto out_fail; | ||
58 | } | ||
59 | |||
60 | tegra_apb_dma = ch; | ||
61 | out: | ||
62 | mutex_unlock(&tegra_apb_dma_lock); | ||
63 | return true; | ||
64 | |||
65 | out_fail: | ||
66 | mutex_unlock(&tegra_apb_dma_lock); | ||
67 | return false; | ||
68 | } | ||
69 | |||
70 | static void apb_dma_complete(struct tegra_dma_req *req) | ||
71 | { | ||
72 | complete(&tegra_apb_wait); | ||
73 | } | ||
74 | |||
75 | u32 tegra_apb_readl(unsigned long offset) | ||
76 | { | ||
77 | struct tegra_dma_req req; | ||
78 | int ret; | ||
79 | |||
80 | if (!tegra_apb_dma && !tegra_apb_init()) | ||
81 | return readl(IO_TO_VIRT(offset)); | ||
82 | |||
83 | mutex_lock(&tegra_apb_dma_lock); | ||
84 | req.complete = apb_dma_complete; | ||
85 | req.to_memory = 1; | ||
86 | req.dest_addr = tegra_apb_bb_phys; | ||
87 | req.dest_bus_width = 32; | ||
88 | req.dest_wrap = 1; | ||
89 | req.source_addr = offset; | ||
90 | req.source_bus_width = 32; | ||
91 | req.source_wrap = 4; | ||
92 | req.req_sel = TEGRA_DMA_REQ_SEL_CNTR; | ||
93 | req.size = 4; | ||
94 | |||
95 | INIT_COMPLETION(tegra_apb_wait); | ||
96 | |||
97 | tegra_dma_enqueue_req(tegra_apb_dma, &req); | ||
98 | |||
99 | ret = wait_for_completion_timeout(&tegra_apb_wait, | ||
100 | msecs_to_jiffies(50)); | ||
101 | |||
102 | if (WARN(ret == 0, "apb read dma timed out")) { | ||
103 | tegra_dma_dequeue_req(tegra_apb_dma, &req); | ||
104 | *(u32 *)tegra_apb_bb = 0; | ||
105 | } | ||
106 | |||
107 | mutex_unlock(&tegra_apb_dma_lock); | ||
108 | return *((u32 *)tegra_apb_bb); | ||
109 | } | ||
110 | |||
111 | void tegra_apb_writel(u32 value, unsigned long offset) | ||
112 | { | ||
113 | struct tegra_dma_req req; | ||
114 | int ret; | ||
115 | |||
116 | if (!tegra_apb_dma && !tegra_apb_init()) { | ||
117 | writel(value, IO_TO_VIRT(offset)); | ||
118 | return; | ||
119 | } | ||
120 | |||
121 | mutex_lock(&tegra_apb_dma_lock); | ||
122 | *((u32 *)tegra_apb_bb) = value; | ||
123 | req.complete = apb_dma_complete; | ||
124 | req.to_memory = 0; | ||
125 | req.dest_addr = offset; | ||
126 | req.dest_wrap = 4; | ||
127 | req.dest_bus_width = 32; | ||
128 | req.source_addr = tegra_apb_bb_phys; | ||
129 | req.source_bus_width = 32; | ||
130 | req.source_wrap = 1; | ||
131 | req.req_sel = TEGRA_DMA_REQ_SEL_CNTR; | ||
132 | req.size = 4; | ||
133 | |||
134 | INIT_COMPLETION(tegra_apb_wait); | ||
135 | |||
136 | tegra_dma_enqueue_req(tegra_apb_dma, &req); | ||
137 | |||
138 | ret = wait_for_completion_timeout(&tegra_apb_wait, | ||
139 | msecs_to_jiffies(50)); | ||
140 | |||
141 | if (WARN(ret == 0, "apb write dma timed out")) | ||
142 | tegra_dma_dequeue_req(tegra_apb_dma, &req); | ||
143 | |||
144 | mutex_unlock(&tegra_apb_dma_lock); | ||
145 | } | ||
diff --git a/arch/arm/mach-tegra/apbio.h b/arch/arm/mach-tegra/apbio.h new file mode 100644 index 000000000000..8b49e8c89a64 --- /dev/null +++ b/arch/arm/mach-tegra/apbio.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 NVIDIA Corporation. | ||
3 | * Copyright (C) 2010 Google, Inc. | ||
4 | * | ||
5 | * This software is licensed under the terms of the GNU General Public | ||
6 | * License version 2, as published by the Free Software Foundation, and | ||
7 | * may be copied, distributed, and modified under those terms. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #ifndef __MACH_TEGRA_APBIO_H | ||
17 | #define __MACH_TEGRA_APBIO_H | ||
18 | |||
19 | #ifdef CONFIG_TEGRA_SYSTEM_DMA | ||
20 | |||
21 | u32 tegra_apb_readl(unsigned long offset); | ||
22 | void tegra_apb_writel(u32 value, unsigned long offset); | ||
23 | |||
24 | #else | ||
25 | #include <asm/io.h> | ||
26 | #include <mach/io.h> | ||
27 | |||
28 | static inline u32 tegra_apb_readl(unsigned long offset) | ||
29 | { | ||
30 | return readl(IO_TO_VIRT(offset)); | ||
31 | } | ||
32 | |||
33 | static inline void tegra_apb_writel(u32 value, unsigned long offset) | ||
34 | { | ||
35 | writel(value, IO_TO_VIRT(offset)); | ||
36 | } | ||
37 | #endif | ||
38 | |||
39 | #endif | ||
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c index c0298b3f7d63..82f32300796c 100644 --- a/arch/arm/mach-tegra/board-harmony-power.c +++ b/arch/arm/mach-tegra/board-harmony-power.c | |||
@@ -18,18 +18,13 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/io.h> | ||
22 | #include <linux/regulator/machine.h> | 21 | #include <linux/regulator/machine.h> |
23 | #include <linux/mfd/tps6586x.h> | 22 | #include <linux/mfd/tps6586x.h> |
24 | 23 | ||
25 | #include <mach/iomap.h> | ||
26 | #include <mach/irqs.h> | 24 | #include <mach/irqs.h> |
27 | 25 | ||
28 | #include "board-harmony.h" | 26 | #include "board-harmony.h" |
29 | 27 | ||
30 | #define PMC_CTRL 0x0 | ||
31 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
32 | |||
33 | static struct regulator_consumer_supply tps658621_ldo0_supply[] = { | 28 | static struct regulator_consumer_supply tps658621_ldo0_supply[] = { |
34 | REGULATOR_SUPPLY("pex_clk", NULL), | 29 | REGULATOR_SUPPLY("pex_clk", NULL), |
35 | }; | 30 | }; |
@@ -115,16 +110,6 @@ static struct i2c_board_info __initdata harmony_regulators[] = { | |||
115 | 110 | ||
116 | int __init harmony_regulator_init(void) | 111 | int __init harmony_regulator_init(void) |
117 | { | 112 | { |
118 | void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); | ||
119 | u32 pmc_ctrl; | ||
120 | |||
121 | /* | ||
122 | * Configure the power management controller to trigger PMU | ||
123 | * interrupts when low | ||
124 | */ | ||
125 | pmc_ctrl = readl(pmc + PMC_CTRL); | ||
126 | writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL); | ||
127 | |||
128 | i2c_register_board_info(3, harmony_regulators, 1); | 113 | i2c_register_board_info(3, harmony_regulators, 1); |
129 | 114 | ||
130 | return 0; | 115 | return 0; |
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index 789bdc9e8f91..c00aadb01e09 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c | |||
@@ -101,7 +101,6 @@ static struct wm8903_platform_data harmony_wm8903_pdata = { | |||
101 | static struct i2c_board_info __initdata wm8903_board_info = { | 101 | static struct i2c_board_info __initdata wm8903_board_info = { |
102 | I2C_BOARD_INFO("wm8903", 0x1a), | 102 | I2C_BOARD_INFO("wm8903", 0x1a), |
103 | .platform_data = &harmony_wm8903_pdata, | 103 | .platform_data = &harmony_wm8903_pdata, |
104 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), | ||
105 | }; | 104 | }; |
106 | 105 | ||
107 | static void __init harmony_i2c_init(void) | 106 | static void __init harmony_i2c_init(void) |
@@ -111,6 +110,7 @@ static void __init harmony_i2c_init(void) | |||
111 | platform_device_register(&tegra_i2c_device3); | 110 | platform_device_register(&tegra_i2c_device3); |
112 | platform_device_register(&tegra_i2c_device4); | 111 | platform_device_register(&tegra_i2c_device4); |
113 | 112 | ||
113 | wm8903_board_info.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); | ||
114 | i2c_register_board_info(0, &wm8903_board_info, 1); | 114 | i2c_register_board_info(0, &wm8903_board_info, 1); |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c index ebac65f52510..d669847f0485 100644 --- a/arch/arm/mach-tegra/board-seaboard.c +++ b/arch/arm/mach-tegra/board-seaboard.c | |||
@@ -159,7 +159,6 @@ static struct platform_device *seaboard_devices[] __initdata = { | |||
159 | 159 | ||
160 | static struct i2c_board_info __initdata isl29018_device = { | 160 | static struct i2c_board_info __initdata isl29018_device = { |
161 | I2C_BOARD_INFO("isl29018", 0x44), | 161 | I2C_BOARD_INFO("isl29018", 0x44), |
162 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_ISL29018_IRQ), | ||
163 | }; | 162 | }; |
164 | 163 | ||
165 | static struct i2c_board_info __initdata adt7461_device = { | 164 | static struct i2c_board_info __initdata adt7461_device = { |
@@ -183,7 +182,6 @@ static struct wm8903_platform_data wm8903_pdata = { | |||
183 | static struct i2c_board_info __initdata wm8903_device = { | 182 | static struct i2c_board_info __initdata wm8903_device = { |
184 | I2C_BOARD_INFO("wm8903", 0x1a), | 183 | I2C_BOARD_INFO("wm8903", 0x1a), |
185 | .platform_data = &wm8903_pdata, | 184 | .platform_data = &wm8903_pdata, |
186 | .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ), | ||
187 | }; | 185 | }; |
188 | 186 | ||
189 | static int seaboard_ehci_init(void) | 187 | static int seaboard_ehci_init(void) |
@@ -214,7 +212,10 @@ static void __init seaboard_i2c_init(void) | |||
214 | gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); | 212 | gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018"); |
215 | gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); | 213 | gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ); |
216 | 214 | ||
215 | isl29018_device.irq = gpio_to_irq(TEGRA_GPIO_ISL29018_IRQ); | ||
217 | i2c_register_board_info(0, &isl29018_device, 1); | 216 | i2c_register_board_info(0, &isl29018_device, 1); |
217 | |||
218 | wm8903_device.irq = gpio_to_irq(TEGRA_GPIO_CDC_IRQ); | ||
218 | i2c_register_board_info(0, &wm8903_device, 1); | 219 | i2c_register_board_info(0, &wm8903_device, 1); |
219 | 220 | ||
220 | i2c_register_board_info(3, &adt7461_device, 1); | 221 | i2c_register_board_info(3, &adt7461_device, 1); |
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 6c93cd0e520c..2f86fcca64a6 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -31,6 +31,24 @@ | |||
31 | #include "board.h" | 31 | #include "board.h" |
32 | #include "clock.h" | 32 | #include "clock.h" |
33 | #include "fuse.h" | 33 | #include "fuse.h" |
34 | #include "pmc.h" | ||
35 | |||
36 | /* | ||
37 | * Storage for debug-macro.S's state. | ||
38 | * | ||
39 | * This must be in .data not .bss so that it gets initialized each time the | ||
40 | * kernel is loaded. The data is declared here rather than debug-macro.S so | ||
41 | * that multiple inclusions of debug-macro.S point at the same data. | ||
42 | */ | ||
43 | #define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF) | ||
44 | u32 tegra_uart_config[3] = { | ||
45 | /* Debug UART initialization required */ | ||
46 | 1, | ||
47 | /* Debug UART physical address */ | ||
48 | (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET), | ||
49 | /* Debug UART virtual address */ | ||
50 | (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET), | ||
51 | }; | ||
34 | 52 | ||
35 | #ifdef CONFIG_OF | 53 | #ifdef CONFIG_OF |
36 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { | 54 | static const struct of_device_id tegra_dt_irq_match[] __initconst = { |
@@ -99,6 +117,7 @@ void __init tegra20_init_early(void) | |||
99 | tegra2_init_clocks(); | 117 | tegra2_init_clocks(); |
100 | tegra_clk_init_from_table(tegra20_clk_init_table); | 118 | tegra_clk_init_from_table(tegra20_clk_init_table); |
101 | tegra_init_cache(0x331, 0x441); | 119 | tegra_init_cache(0x331, 0x441); |
120 | tegra_pmc_init(); | ||
102 | } | 121 | } |
103 | #endif | 122 | #endif |
104 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | 123 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC |
@@ -106,5 +125,6 @@ void __init tegra30_init_early(void) | |||
106 | { | 125 | { |
107 | tegra30_init_clocks(); | 126 | tegra30_init_clocks(); |
108 | tegra_init_cache(0x441, 0x551); | 127 | tegra_init_cache(0x441, 0x551); |
128 | tegra_pmc_init(); | ||
109 | } | 129 | } |
110 | #endif | 130 | #endif |
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c index c0cf967e47d3..abea4f6e2dd5 100644 --- a/arch/arm/mach-tegra/dma.c +++ b/arch/arm/mach-tegra/dma.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <mach/iomap.h> | 33 | #include <mach/iomap.h> |
34 | #include <mach/suspend.h> | 34 | #include <mach/suspend.h> |
35 | 35 | ||
36 | #include "apbio.h" | ||
37 | |||
36 | #define APB_DMA_GEN 0x000 | 38 | #define APB_DMA_GEN 0x000 |
37 | #define GEN_ENABLE (1<<31) | 39 | #define GEN_ENABLE (1<<31) |
38 | 40 | ||
@@ -50,8 +52,6 @@ | |||
50 | #define CSR_ONCE (1<<27) | 52 | #define CSR_ONCE (1<<27) |
51 | #define CSR_FLOW (1<<21) | 53 | #define CSR_FLOW (1<<21) |
52 | #define CSR_REQ_SEL_SHIFT 16 | 54 | #define CSR_REQ_SEL_SHIFT 16 |
53 | #define CSR_REQ_SEL_MASK (0x1F<<CSR_REQ_SEL_SHIFT) | ||
54 | #define CSR_REQ_SEL_INVALID (31<<CSR_REQ_SEL_SHIFT) | ||
55 | #define CSR_WCOUNT_SHIFT 2 | 55 | #define CSR_WCOUNT_SHIFT 2 |
56 | #define CSR_WCOUNT_MASK 0xFFFC | 56 | #define CSR_WCOUNT_MASK 0xFFFC |
57 | 57 | ||
@@ -133,6 +133,7 @@ struct tegra_dma_channel { | |||
133 | 133 | ||
134 | static bool tegra_dma_initialized; | 134 | static bool tegra_dma_initialized; |
135 | static DEFINE_MUTEX(tegra_dma_lock); | 135 | static DEFINE_MUTEX(tegra_dma_lock); |
136 | static DEFINE_SPINLOCK(enable_lock); | ||
136 | 137 | ||
137 | static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); | 138 | static DECLARE_BITMAP(channel_usage, NV_DMA_MAX_CHANNELS); |
138 | static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; | 139 | static struct tegra_dma_channel dma_channels[NV_DMA_MAX_CHANNELS]; |
@@ -180,36 +181,94 @@ static void tegra_dma_stop(struct tegra_dma_channel *ch) | |||
180 | 181 | ||
181 | static int tegra_dma_cancel(struct tegra_dma_channel *ch) | 182 | static int tegra_dma_cancel(struct tegra_dma_channel *ch) |
182 | { | 183 | { |
183 | u32 csr; | ||
184 | unsigned long irq_flags; | 184 | unsigned long irq_flags; |
185 | 185 | ||
186 | spin_lock_irqsave(&ch->lock, irq_flags); | 186 | spin_lock_irqsave(&ch->lock, irq_flags); |
187 | while (!list_empty(&ch->list)) | 187 | while (!list_empty(&ch->list)) |
188 | list_del(ch->list.next); | 188 | list_del(ch->list.next); |
189 | 189 | ||
190 | csr = readl(ch->addr + APB_DMA_CHAN_CSR); | ||
191 | csr &= ~CSR_REQ_SEL_MASK; | ||
192 | csr |= CSR_REQ_SEL_INVALID; | ||
193 | writel(csr, ch->addr + APB_DMA_CHAN_CSR); | ||
194 | |||
195 | tegra_dma_stop(ch); | 190 | tegra_dma_stop(ch); |
196 | 191 | ||
197 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 192 | spin_unlock_irqrestore(&ch->lock, irq_flags); |
198 | return 0; | 193 | return 0; |
199 | } | 194 | } |
200 | 195 | ||
196 | static unsigned int get_channel_status(struct tegra_dma_channel *ch, | ||
197 | struct tegra_dma_req *req, bool is_stop_dma) | ||
198 | { | ||
199 | void __iomem *addr = IO_ADDRESS(TEGRA_APB_DMA_BASE); | ||
200 | unsigned int status; | ||
201 | |||
202 | if (is_stop_dma) { | ||
203 | /* | ||
204 | * STOP the DMA and get the transfer count. | ||
205 | * Getting the transfer count is tricky. | ||
206 | * - Globally disable DMA on all channels | ||
207 | * - Read the channel's status register to know the number | ||
208 | * of pending bytes to be transfered. | ||
209 | * - Stop the dma channel | ||
210 | * - Globally re-enable DMA to resume other transfers | ||
211 | */ | ||
212 | spin_lock(&enable_lock); | ||
213 | writel(0, addr + APB_DMA_GEN); | ||
214 | udelay(20); | ||
215 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
216 | tegra_dma_stop(ch); | ||
217 | writel(GEN_ENABLE, addr + APB_DMA_GEN); | ||
218 | spin_unlock(&enable_lock); | ||
219 | if (status & STA_ISE_EOC) { | ||
220 | pr_err("Got Dma Int here clearing"); | ||
221 | writel(status, ch->addr + APB_DMA_CHAN_STA); | ||
222 | } | ||
223 | req->status = TEGRA_DMA_REQ_ERROR_ABORTED; | ||
224 | } else { | ||
225 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
226 | } | ||
227 | return status; | ||
228 | } | ||
229 | |||
230 | /* should be called with the channel lock held */ | ||
231 | static unsigned int dma_active_count(struct tegra_dma_channel *ch, | ||
232 | struct tegra_dma_req *req, unsigned int status) | ||
233 | { | ||
234 | unsigned int to_transfer; | ||
235 | unsigned int req_transfer_count; | ||
236 | unsigned int bytes_transferred; | ||
237 | |||
238 | to_transfer = ((status & STA_COUNT_MASK) >> STA_COUNT_SHIFT) + 1; | ||
239 | req_transfer_count = ch->req_transfer_count + 1; | ||
240 | bytes_transferred = req_transfer_count; | ||
241 | if (status & STA_BUSY) | ||
242 | bytes_transferred -= to_transfer; | ||
243 | /* | ||
244 | * In continuous transfer mode, DMA only tracks the count of the | ||
245 | * half DMA buffer. So, if the DMA already finished half the DMA | ||
246 | * then add the half buffer to the completed count. | ||
247 | */ | ||
248 | if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) { | ||
249 | if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) | ||
250 | bytes_transferred += req_transfer_count; | ||
251 | if (status & STA_ISE_EOC) | ||
252 | bytes_transferred += req_transfer_count; | ||
253 | } | ||
254 | bytes_transferred *= 4; | ||
255 | return bytes_transferred; | ||
256 | } | ||
257 | |||
201 | int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | 258 | int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, |
202 | struct tegra_dma_req *_req) | 259 | struct tegra_dma_req *_req) |
203 | { | 260 | { |
204 | unsigned int csr; | ||
205 | unsigned int status; | 261 | unsigned int status; |
206 | struct tegra_dma_req *req = NULL; | 262 | struct tegra_dma_req *req = NULL; |
207 | int found = 0; | 263 | int found = 0; |
208 | unsigned long irq_flags; | 264 | unsigned long irq_flags; |
209 | int to_transfer; | 265 | int stop = 0; |
210 | int req_transfer_count; | ||
211 | 266 | ||
212 | spin_lock_irqsave(&ch->lock, irq_flags); | 267 | spin_lock_irqsave(&ch->lock, irq_flags); |
268 | |||
269 | if (list_entry(ch->list.next, struct tegra_dma_req, node) == _req) | ||
270 | stop = 1; | ||
271 | |||
213 | list_for_each_entry(req, &ch->list, node) { | 272 | list_for_each_entry(req, &ch->list, node) { |
214 | if (req == _req) { | 273 | if (req == _req) { |
215 | list_del(&req->node); | 274 | list_del(&req->node); |
@@ -222,47 +281,12 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | |||
222 | return 0; | 281 | return 0; |
223 | } | 282 | } |
224 | 283 | ||
225 | /* STOP the DMA and get the transfer count. | 284 | if (!stop) |
226 | * Getting the transfer count is tricky. | 285 | goto skip_stop_dma; |
227 | * - Change the source selector to invalid to stop the DMA from | ||
228 | * FIFO to memory. | ||
229 | * - Read the status register to know the number of pending | ||
230 | * bytes to be transferred. | ||
231 | * - Finally stop or program the DMA to the next buffer in the | ||
232 | * list. | ||
233 | */ | ||
234 | csr = readl(ch->addr + APB_DMA_CHAN_CSR); | ||
235 | csr &= ~CSR_REQ_SEL_MASK; | ||
236 | csr |= CSR_REQ_SEL_INVALID; | ||
237 | writel(csr, ch->addr + APB_DMA_CHAN_CSR); | ||
238 | |||
239 | /* Get the transfer count */ | ||
240 | status = readl(ch->addr + APB_DMA_CHAN_STA); | ||
241 | to_transfer = (status & STA_COUNT_MASK) >> STA_COUNT_SHIFT; | ||
242 | req_transfer_count = ch->req_transfer_count; | ||
243 | req_transfer_count += 1; | ||
244 | to_transfer += 1; | ||
245 | |||
246 | req->bytes_transferred = req_transfer_count; | ||
247 | |||
248 | if (status & STA_BUSY) | ||
249 | req->bytes_transferred -= to_transfer; | ||
250 | |||
251 | /* In continuous transfer mode, DMA only tracks the count of the | ||
252 | * half DMA buffer. So, if the DMA already finished half the DMA | ||
253 | * then add the half buffer to the completed count. | ||
254 | * | ||
255 | * FIXME: There can be a race here. What if the req to | ||
256 | * dequue happens at the same time as the DMA just moved to | ||
257 | * the new buffer and SW didn't yet received the interrupt? | ||
258 | */ | ||
259 | if (ch->mode & TEGRA_DMA_MODE_CONTINOUS) | ||
260 | if (req->buffer_status == TEGRA_DMA_REQ_BUF_STATUS_HALF_FULL) | ||
261 | req->bytes_transferred += req_transfer_count; | ||
262 | 286 | ||
263 | req->bytes_transferred *= 4; | 287 | status = get_channel_status(ch, req, true); |
288 | req->bytes_transferred = dma_active_count(ch, req, status); | ||
264 | 289 | ||
265 | tegra_dma_stop(ch); | ||
266 | if (!list_empty(&ch->list)) { | 290 | if (!list_empty(&ch->list)) { |
267 | /* if the list is not empty, queue the next request */ | 291 | /* if the list is not empty, queue the next request */ |
268 | struct tegra_dma_req *next_req; | 292 | struct tegra_dma_req *next_req; |
@@ -270,6 +294,8 @@ int tegra_dma_dequeue_req(struct tegra_dma_channel *ch, | |||
270 | typeof(*next_req), node); | 294 | typeof(*next_req), node); |
271 | tegra_dma_update_hw(ch, next_req); | 295 | tegra_dma_update_hw(ch, next_req); |
272 | } | 296 | } |
297 | |||
298 | skip_stop_dma: | ||
273 | req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; | 299 | req->status = -TEGRA_DMA_REQ_ERROR_ABORTED; |
274 | 300 | ||
275 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 301 | spin_unlock_irqrestore(&ch->lock, irq_flags); |
@@ -357,7 +383,7 @@ struct tegra_dma_channel *tegra_dma_allocate_channel(int mode) | |||
357 | int channel; | 383 | int channel; |
358 | struct tegra_dma_channel *ch = NULL; | 384 | struct tegra_dma_channel *ch = NULL; |
359 | 385 | ||
360 | if (WARN_ON(!tegra_dma_initialized)) | 386 | if (!tegra_dma_initialized) |
361 | return NULL; | 387 | return NULL; |
362 | 388 | ||
363 | mutex_lock(&tegra_dma_lock); | 389 | mutex_lock(&tegra_dma_lock); |
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index ea49bd93c6b9..c1afb2738769 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -19,25 +19,75 @@ | |||
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/module.h> | 22 | #include <linux/export.h> |
23 | 23 | ||
24 | #include <mach/iomap.h> | 24 | #include <mach/iomap.h> |
25 | 25 | ||
26 | #include "fuse.h" | 26 | #include "fuse.h" |
27 | #include "apbio.h" | ||
27 | 28 | ||
28 | #define FUSE_UID_LOW 0x108 | 29 | #define FUSE_UID_LOW 0x108 |
29 | #define FUSE_UID_HIGH 0x10c | 30 | #define FUSE_UID_HIGH 0x10c |
30 | #define FUSE_SKU_INFO 0x110 | 31 | #define FUSE_SKU_INFO 0x110 |
31 | #define FUSE_SPARE_BIT 0x200 | 32 | #define FUSE_SPARE_BIT 0x200 |
32 | 33 | ||
33 | static inline u32 fuse_readl(unsigned long offset) | 34 | int tegra_sku_id; |
35 | int tegra_cpu_process_id; | ||
36 | int tegra_core_process_id; | ||
37 | enum tegra_revision tegra_revision; | ||
38 | |||
39 | /* The BCT to use at boot is specified by board straps that can be read | ||
40 | * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs. | ||
41 | */ | ||
42 | int tegra_bct_strapping; | ||
43 | |||
44 | #define STRAP_OPT 0x008 | ||
45 | #define GMI_AD0 (1 << 4) | ||
46 | #define GMI_AD1 (1 << 5) | ||
47 | #define RAM_ID_MASK (GMI_AD0 | GMI_AD1) | ||
48 | #define RAM_CODE_SHIFT 4 | ||
49 | |||
50 | static const char *tegra_revision_name[TEGRA_REVISION_MAX] = { | ||
51 | [TEGRA_REVISION_UNKNOWN] = "unknown", | ||
52 | [TEGRA_REVISION_A01] = "A01", | ||
53 | [TEGRA_REVISION_A02] = "A02", | ||
54 | [TEGRA_REVISION_A03] = "A03", | ||
55 | [TEGRA_REVISION_A03p] = "A03 prime", | ||
56 | [TEGRA_REVISION_A04] = "A04", | ||
57 | }; | ||
58 | |||
59 | static inline u32 tegra_fuse_readl(unsigned long offset) | ||
60 | { | ||
61 | return tegra_apb_readl(TEGRA_FUSE_BASE + offset); | ||
62 | } | ||
63 | |||
64 | static inline bool get_spare_fuse(int bit) | ||
34 | { | 65 | { |
35 | return readl(IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); | 66 | return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); |
36 | } | 67 | } |
37 | 68 | ||
38 | static inline void fuse_writel(u32 value, unsigned long offset) | 69 | static enum tegra_revision tegra_get_revision(void) |
39 | { | 70 | { |
40 | writel(value, IO_TO_VIRT(TEGRA_FUSE_BASE + offset)); | 71 | void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804; |
72 | u32 id = readl(chip_id); | ||
73 | u32 minor_rev = (id >> 16) & 0xf; | ||
74 | u32 chipid = (id >> 8) & 0xff; | ||
75 | |||
76 | switch (minor_rev) { | ||
77 | case 1: | ||
78 | return TEGRA_REVISION_A01; | ||
79 | case 2: | ||
80 | return TEGRA_REVISION_A02; | ||
81 | case 3: | ||
82 | if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19))) | ||
83 | return TEGRA_REVISION_A03p; | ||
84 | else | ||
85 | return TEGRA_REVISION_A03; | ||
86 | case 4: | ||
87 | return TEGRA_REVISION_A04; | ||
88 | default: | ||
89 | return TEGRA_REVISION_UNKNOWN; | ||
90 | } | ||
41 | } | 91 | } |
42 | 92 | ||
43 | void tegra_init_fuse(void) | 93 | void tegra_init_fuse(void) |
@@ -46,41 +96,32 @@ void tegra_init_fuse(void) | |||
46 | reg |= 1 << 28; | 96 | reg |= 1 << 28; |
47 | writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); | 97 | writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); |
48 | 98 | ||
49 | pr_info("Tegra SKU: %d CPU Process: %d Core Process: %d\n", | 99 | reg = tegra_fuse_readl(FUSE_SKU_INFO); |
50 | tegra_sku_id(), tegra_cpu_process_id(), | 100 | tegra_sku_id = reg & 0xFF; |
51 | tegra_core_process_id()); | 101 | |
102 | reg = tegra_fuse_readl(FUSE_SPARE_BIT); | ||
103 | tegra_cpu_process_id = (reg >> 6) & 3; | ||
104 | |||
105 | reg = tegra_fuse_readl(FUSE_SPARE_BIT); | ||
106 | tegra_core_process_id = (reg >> 12) & 3; | ||
107 | |||
108 | reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); | ||
109 | tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; | ||
110 | |||
111 | tegra_revision = tegra_get_revision(); | ||
112 | |||
113 | pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", | ||
114 | tegra_revision_name[tegra_get_revision()], | ||
115 | tegra_sku_id, tegra_cpu_process_id, | ||
116 | tegra_core_process_id); | ||
52 | } | 117 | } |
53 | 118 | ||
54 | unsigned long long tegra_chip_uid(void) | 119 | unsigned long long tegra_chip_uid(void) |
55 | { | 120 | { |
56 | unsigned long long lo, hi; | 121 | unsigned long long lo, hi; |
57 | 122 | ||
58 | lo = fuse_readl(FUSE_UID_LOW); | 123 | lo = tegra_fuse_readl(FUSE_UID_LOW); |
59 | hi = fuse_readl(FUSE_UID_HIGH); | 124 | hi = tegra_fuse_readl(FUSE_UID_HIGH); |
60 | return (hi << 32ull) | lo; | 125 | return (hi << 32ull) | lo; |
61 | } | 126 | } |
62 | EXPORT_SYMBOL(tegra_chip_uid); | 127 | EXPORT_SYMBOL(tegra_chip_uid); |
63 | |||
64 | int tegra_sku_id(void) | ||
65 | { | ||
66 | int sku_id; | ||
67 | u32 reg = fuse_readl(FUSE_SKU_INFO); | ||
68 | sku_id = reg & 0xFF; | ||
69 | return sku_id; | ||
70 | } | ||
71 | |||
72 | int tegra_cpu_process_id(void) | ||
73 | { | ||
74 | int cpu_process_id; | ||
75 | u32 reg = fuse_readl(FUSE_SPARE_BIT); | ||
76 | cpu_process_id = (reg >> 6) & 3; | ||
77 | return cpu_process_id; | ||
78 | } | ||
79 | |||
80 | int tegra_core_process_id(void) | ||
81 | { | ||
82 | int core_process_id; | ||
83 | u32 reg = fuse_readl(FUSE_SPARE_BIT); | ||
84 | core_process_id = (reg >> 12) & 3; | ||
85 | return core_process_id; | ||
86 | } | ||
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h index 584b2e27dbda..d65d2abf803b 100644 --- a/arch/arm/mach-tegra/fuse.h +++ b/arch/arm/mach-tegra/fuse.h | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/fuse.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | 2 | * Copyright (C) 2010 Google, Inc. |
5 | * | 3 | * |
6 | * Author: | 4 | * Author: |
@@ -17,8 +15,34 @@ | |||
17 | * | 15 | * |
18 | */ | 16 | */ |
19 | 17 | ||
18 | #ifndef __MACH_TEGRA_FUSE_H | ||
19 | #define __MACH_TEGRA_FUSE_H | ||
20 | |||
21 | enum tegra_revision { | ||
22 | TEGRA_REVISION_UNKNOWN = 0, | ||
23 | TEGRA_REVISION_A01, | ||
24 | TEGRA_REVISION_A02, | ||
25 | TEGRA_REVISION_A03, | ||
26 | TEGRA_REVISION_A03p, | ||
27 | TEGRA_REVISION_A04, | ||
28 | TEGRA_REVISION_MAX, | ||
29 | }; | ||
30 | |||
31 | #define SKU_ID_T20 8 | ||
32 | #define SKU_ID_T25SE 20 | ||
33 | #define SKU_ID_AP25 23 | ||
34 | #define SKU_ID_T25 24 | ||
35 | #define SKU_ID_AP25E 27 | ||
36 | #define SKU_ID_T25E 28 | ||
37 | |||
38 | extern int tegra_sku_id; | ||
39 | extern int tegra_cpu_process_id; | ||
40 | extern int tegra_core_process_id; | ||
41 | extern enum tegra_revision tegra_revision; | ||
42 | |||
43 | extern int tegra_bct_strapping; | ||
44 | |||
20 | unsigned long long tegra_chip_uid(void); | 45 | unsigned long long tegra_chip_uid(void); |
21 | int tegra_sku_id(void); | ||
22 | int tegra_cpu_process_id(void); | ||
23 | int tegra_core_process_id(void); | ||
24 | void tegra_init_fuse(void); | 46 | void tegra_init_fuse(void); |
47 | |||
48 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S index 619abc63aee8..90069abd37bd 100644 --- a/arch/arm/mach-tegra/include/mach/debug-macro.S +++ b/arch/arm/mach-tegra/include/mach/debug-macro.S | |||
@@ -1,11 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/include/mach/debug-macro.S | 2 | * arch/arm/mach-tegra/include/mach/debug-macro.S |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010,2011 Google, Inc. |
5 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
5 | * | 6 | * |
6 | * Author: | 7 | * Author: |
7 | * Colin Cross <ccross@google.com> | 8 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 9 | * Erik Gilling <konkers@google.com> |
10 | * Doug Anderson <dianders@chromium.org> | ||
11 | * Stephen Warren <swarren@nvidia.com> | ||
12 | * | ||
13 | * Portions based on mach-omap2's debug-macro.S | ||
14 | * Copyright (C) 1994-1999 Russell King | ||
9 | * | 15 | * |
10 | * This software is licensed under the terms of the GNU General Public | 16 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 17 | * License version 2, as published by the Free Software Foundation, and |
@@ -18,18 +24,78 @@ | |||
18 | * | 24 | * |
19 | */ | 25 | */ |
20 | 26 | ||
27 | #include <linux/serial_reg.h> | ||
28 | |||
21 | #include <mach/io.h> | 29 | #include <mach/io.h> |
22 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
31 | #include <mach/irammap.h> | ||
32 | |||
33 | .macro addruart, rp, rv, tmp | ||
34 | adr \rp, 99f @ actual addr of 99f | ||
35 | ldr \rv, [\rp] @ linked addr is stored there | ||
36 | sub \rv, \rv, \rp @ offset between the two | ||
37 | ldr \rp, [\rp, #4] @ linked tegra_uart_config | ||
38 | sub \tmp, \rp, \rv @ actual tegra_uart_config | ||
39 | ldr \rp, [\tmp] @ Load tegra_uart_config | ||
40 | cmp \rp, #1 @ needs intitialization? | ||
41 | bne 100f @ no; go load the addresses | ||
42 | mov \rv, #0 @ yes; record init is done | ||
43 | str \rv, [\tmp] | ||
44 | mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM | ||
45 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET] | ||
46 | movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff | ||
47 | movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16 | ||
48 | cmp \rv, \rp @ Cookie present? | ||
49 | bne 100f @ No, use default UART | ||
50 | mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM | ||
51 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4] | ||
52 | str \rv, [\tmp, #4] @ Store in tegra_uart_phys | ||
53 | sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address | ||
54 | add \rv, \rv, #IO_APB_VIRT | ||
55 | str \rv, [\tmp, #8] @ Store in tegra_uart_virt | ||
56 | b 100f | ||
57 | |||
58 | .align | ||
59 | 99: .word . | ||
60 | .word tegra_uart_config | ||
61 | .ltorg | ||
62 | |||
63 | 100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys | ||
64 | ldr \rv, [\tmp, #8] @ Load tegra_uart_virt | ||
65 | .endm | ||
66 | |||
67 | #define UART_SHIFT 2 | ||
68 | |||
69 | /* | ||
70 | * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra | ||
71 | * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case. | ||
72 | * We use the fact that all 5 valid UART addresses all have something in the | ||
73 | * 2nd-to-lowest byte. | ||
74 | */ | ||
23 | 75 | ||
24 | .macro addruart, rp, rv, tmp | 76 | .macro senduart, rd, rx |
25 | ldr \rp, =IO_APB_PHYS @ physical | 77 | tst \rx, #0x0000ff00 |
26 | ldr \rv, =IO_APB_VIRT @ virtual | 78 | strneb \rd, [\rx, #UART_TX << UART_SHIFT] |
27 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF) | 79 | 1001: |
28 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | 80 | .endm |
29 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF) | ||
30 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | ||
31 | .endm | ||
32 | 81 | ||
33 | #define UART_SHIFT 2 | 82 | .macro busyuart, rd, rx |
34 | #include <asm/hardware/debug-8250.S> | 83 | tst \rx, #0x0000ff00 |
84 | beq 1002f | ||
85 | 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] | ||
86 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
87 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
88 | bne 1001b | ||
89 | 1002: | ||
90 | .endm | ||
35 | 91 | ||
92 | .macro waituart, rd, rx | ||
93 | #ifdef FLOW_CONTROL | ||
94 | tst \rx, #0x0000ff00 | ||
95 | beq 1002f | ||
96 | 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] | ||
97 | tst \rd, #UART_MSR_CTS | ||
98 | beq 1001b | ||
99 | 1002: | ||
100 | #endif | ||
101 | .endm | ||
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h index 87d37fdf5084..6140820555e1 100644 --- a/arch/arm/mach-tegra/include/mach/gpio-tegra.h +++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h | |||
@@ -25,8 +25,6 @@ | |||
25 | 25 | ||
26 | #define TEGRA_NR_GPIOS INT_GPIO_NR | 26 | #define TEGRA_NR_GPIOS INT_GPIO_NR |
27 | 27 | ||
28 | #define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio)) | ||
29 | |||
30 | struct tegra_gpio_table { | 28 | struct tegra_gpio_table { |
31 | int gpio; /* GPIO number */ | 29 | int gpio; /* GPIO number */ |
32 | bool enable; /* Enable for GPIO at init? */ | 30 | bool enable; /* Enable for GPIO at init? */ |
diff --git a/arch/arm/mach-tegra/include/mach/irammap.h b/arch/arm/mach-tegra/include/mach/irammap.h new file mode 100644 index 000000000000..0cbe63261854 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/irammap.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #ifndef __MACH_TEGRA_IRAMMAP_H | ||
18 | #define __MACH_TEGRA_IRAMMAP_H | ||
19 | |||
20 | #include <asm/sizes.h> | ||
21 | |||
22 | /* The first 1K of IRAM is permanently reserved for the CPU reset handler */ | ||
23 | #define TEGRA_IRAM_RESET_HANDLER_OFFSET 0 | ||
24 | #define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K | ||
25 | |||
26 | /* | ||
27 | * These locations are written to by uncompress.h, and read by debug-macro.S. | ||
28 | * The first word holds the cookie value if the data is valid. The second | ||
29 | * word holds the UART physical address. | ||
30 | */ | ||
31 | #define TEGRA_IRAM_DEBUG_UART_OFFSET SZ_1K | ||
32 | #define TEGRA_IRAM_DEBUG_UART_SIZE 8 | ||
33 | #define TEGRA_IRAM_DEBUG_UART_COOKIE 0x55415254 | ||
34 | |||
35 | #endif | ||
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h index 4e8323770c79..5a440f315e57 100644 --- a/arch/arm/mach-tegra/include/mach/uncompress.h +++ b/arch/arm/mach-tegra/include/mach/uncompress.h | |||
@@ -2,10 +2,14 @@ | |||
2 | * arch/arm/mach-tegra/include/mach/uncompress.h | 2 | * arch/arm/mach-tegra/include/mach/uncompress.h |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010 Google, Inc. |
5 | * Copyright (C) 2011 Google, Inc. | ||
6 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
5 | * | 7 | * |
6 | * Author: | 8 | * Author: |
7 | * Colin Cross <ccross@google.com> | 9 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 10 | * Erik Gilling <konkers@google.com> |
11 | * Doug Anderson <dianders@chromium.org> | ||
12 | * Stephen Warren <swarren@nvidia.com> | ||
9 | * | 13 | * |
10 | * This software is licensed under the terms of the GNU General Public | 14 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 15 | * License version 2, as published by the Free Software Foundation, and |
@@ -25,36 +29,130 @@ | |||
25 | #include <linux/serial_reg.h> | 29 | #include <linux/serial_reg.h> |
26 | 30 | ||
27 | #include <mach/iomap.h> | 31 | #include <mach/iomap.h> |
32 | #include <mach/irammap.h> | ||
33 | |||
34 | #define BIT(x) (1 << (x)) | ||
35 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | ||
36 | |||
37 | #define DEBUG_UART_SHIFT 2 | ||
38 | |||
39 | volatile u8 *uart; | ||
28 | 40 | ||
29 | static void putc(int c) | 41 | static void putc(int c) |
30 | { | 42 | { |
31 | volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | ||
32 | int shift = 2; | ||
33 | |||
34 | if (uart == NULL) | 43 | if (uart == NULL) |
35 | return; | 44 | return; |
36 | 45 | ||
37 | while (!(uart[UART_LSR << shift] & UART_LSR_THRE)) | 46 | while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE)) |
38 | barrier(); | 47 | barrier(); |
39 | uart[UART_TX << shift] = c; | 48 | uart[UART_TX << DEBUG_UART_SHIFT] = c; |
40 | } | 49 | } |
41 | 50 | ||
42 | static inline void flush(void) | 51 | static inline void flush(void) |
43 | { | 52 | { |
44 | } | 53 | } |
45 | 54 | ||
55 | static inline void save_uart_address(void) | ||
56 | { | ||
57 | u32 *buf = (u32 *)(TEGRA_IRAM_BASE + TEGRA_IRAM_DEBUG_UART_OFFSET); | ||
58 | |||
59 | if (uart) { | ||
60 | buf[0] = TEGRA_IRAM_DEBUG_UART_COOKIE; | ||
61 | buf[1] = (u32)uart; | ||
62 | } else | ||
63 | buf[0] = 0; | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * Setup before decompression. This is where we do UART selection for | ||
68 | * earlyprintk and init the uart_base register. | ||
69 | */ | ||
46 | static inline void arch_decomp_setup(void) | 70 | static inline void arch_decomp_setup(void) |
47 | { | 71 | { |
48 | volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | 72 | static const struct { |
49 | int shift = 2; | 73 | u32 base; |
74 | u32 reset_reg; | ||
75 | u32 clock_reg; | ||
76 | u32 bit; | ||
77 | } uarts[] = { | ||
78 | { | ||
79 | TEGRA_UARTA_BASE, | ||
80 | TEGRA_CLK_RESET_BASE + 0x04, | ||
81 | TEGRA_CLK_RESET_BASE + 0x10, | ||
82 | 6, | ||
83 | }, | ||
84 | { | ||
85 | TEGRA_UARTB_BASE, | ||
86 | TEGRA_CLK_RESET_BASE + 0x04, | ||
87 | TEGRA_CLK_RESET_BASE + 0x10, | ||
88 | 7, | ||
89 | }, | ||
90 | { | ||
91 | TEGRA_UARTC_BASE, | ||
92 | TEGRA_CLK_RESET_BASE + 0x08, | ||
93 | TEGRA_CLK_RESET_BASE + 0x14, | ||
94 | 23, | ||
95 | }, | ||
96 | { | ||
97 | TEGRA_UARTD_BASE, | ||
98 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
99 | TEGRA_CLK_RESET_BASE + 0x18, | ||
100 | 1, | ||
101 | }, | ||
102 | { | ||
103 | TEGRA_UARTE_BASE, | ||
104 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
105 | TEGRA_CLK_RESET_BASE + 0x18, | ||
106 | 2, | ||
107 | }, | ||
108 | }; | ||
109 | int i; | ||
110 | volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; | ||
111 | u32 chip, div; | ||
112 | |||
113 | /* | ||
114 | * Look for the first UART that: | ||
115 | * a) Is not in reset. | ||
116 | * b) Is clocked. | ||
117 | * c) Has a 'D' in the scratchpad register. | ||
118 | * | ||
119 | * Note that on Tegra30, the first two conditions are required, since | ||
120 | * if not true, accesses to the UART scratch register will hang. | ||
121 | * Tegra20 doesn't have this issue. | ||
122 | * | ||
123 | * The intent is that the bootloader will tell the kernel which UART | ||
124 | * to use by setting up those conditions. If nothing found, we'll fall | ||
125 | * back to what's specified in TEGRA_DEBUG_UART_BASE. | ||
126 | */ | ||
127 | for (i = 0; i < ARRAY_SIZE(uarts); i++) { | ||
128 | if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit)) | ||
129 | continue; | ||
50 | 130 | ||
131 | if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit))) | ||
132 | continue; | ||
133 | |||
134 | uart = (volatile u8 *)uarts[i].base; | ||
135 | if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D') | ||
136 | continue; | ||
137 | |||
138 | break; | ||
139 | } | ||
140 | if (i == ARRAY_SIZE(uarts)) | ||
141 | uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE; | ||
142 | save_uart_address(); | ||
51 | if (uart == NULL) | 143 | if (uart == NULL) |
52 | return; | 144 | return; |
53 | 145 | ||
54 | uart[UART_LCR << shift] |= UART_LCR_DLAB; | 146 | chip = (apb_misc[0x804 / 4] >> 8) & 0xff; |
55 | uart[UART_DLL << shift] = 0x75; | 147 | if (chip == 0x20) |
56 | uart[UART_DLM << shift] = 0x0; | 148 | div = 0x0075; |
57 | uart[UART_LCR << shift] = 3; | 149 | else |
150 | div = 0x00dd; | ||
151 | |||
152 | uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB; | ||
153 | uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff; | ||
154 | uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8; | ||
155 | uart[UART_LCR << DEBUG_UART_SHIFT] = 3; | ||
58 | } | 156 | } |
59 | 157 | ||
60 | static inline void arch_decomp_wdog(void) | 158 | static inline void arch_decomp_wdog(void) |
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c new file mode 100644 index 000000000000..7af6a54404be --- /dev/null +++ b/arch/arm/mach-tegra/pmc.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of.h> | ||
21 | |||
22 | #include <mach/iomap.h> | ||
23 | |||
24 | #define PMC_CTRL 0x0 | ||
25 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
26 | |||
27 | static inline u32 tegra_pmc_readl(u32 reg) | ||
28 | { | ||
29 | return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
30 | } | ||
31 | |||
32 | static inline void tegra_pmc_writel(u32 val, u32 reg) | ||
33 | { | ||
34 | writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg)); | ||
35 | } | ||
36 | |||
37 | #ifdef CONFIG_OF | ||
38 | static const struct of_device_id matches[] __initconst = { | ||
39 | { .compatible = "nvidia,tegra20-pmc" }, | ||
40 | { } | ||
41 | }; | ||
42 | #endif | ||
43 | |||
44 | void __init tegra_pmc_init(void) | ||
45 | { | ||
46 | /* | ||
47 | * For now, Harmony is the only board that uses the PMC, and it wants | ||
48 | * the signal inverted. Seaboard would too if it used the PMC. | ||
49 | * Hopefully by the time other boards want to use the PMC, everything | ||
50 | * will be device-tree, or they also want it inverted. | ||
51 | */ | ||
52 | bool invert_interrupt = true; | ||
53 | u32 val; | ||
54 | |||
55 | #ifdef CONFIG_OF | ||
56 | if (of_have_populated_dt()) { | ||
57 | struct device_node *np; | ||
58 | |||
59 | invert_interrupt = false; | ||
60 | |||
61 | np = of_find_matching_node(NULL, matches); | ||
62 | if (np) { | ||
63 | if (of_find_property(np, "nvidia,invert-interrupt", | ||
64 | NULL)) | ||
65 | invert_interrupt = true; | ||
66 | } | ||
67 | } | ||
68 | #endif | ||
69 | |||
70 | val = tegra_pmc_readl(PMC_CTRL); | ||
71 | if (invert_interrupt) | ||
72 | val |= PMC_CTRL_INTR_LOW; | ||
73 | else | ||
74 | val &= ~PMC_CTRL_INTR_LOW; | ||
75 | tegra_pmc_writel(val, PMC_CTRL); | ||
76 | } | ||
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h new file mode 100644 index 000000000000..8995ee4a8768 --- /dev/null +++ b/arch/arm/mach-tegra/pmc.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef __MACH_TEGRA_PMC_H | ||
19 | #define __MACH_TEGRA_PMC_H | ||
20 | |||
21 | void tegra_pmc_init(void); | ||
22 | |||
23 | #endif | ||
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index 1976e934cdd9..592a4eeb5328 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c | |||
@@ -720,7 +720,7 @@ static void tegra2_pllx_clk_init(struct clk *c) | |||
720 | { | 720 | { |
721 | tegra2_pll_clk_init(c); | 721 | tegra2_pll_clk_init(c); |
722 | 722 | ||
723 | if (tegra_sku_id() == 7) | 723 | if (tegra_sku_id == 7) |
724 | c->max_rate = 750000000; | 724 | c->max_rate = 750000000; |
725 | } | 725 | } |
726 | 726 | ||
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c index 0f7ae6e90b55..5070d833bdd1 100644 --- a/arch/arm/mach-tegra/tegra2_emc.c +++ b/arch/arm/mach-tegra/tegra2_emc.c | |||
@@ -16,14 +16,19 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/device.h> | ||
19 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | #include <linux/io.h> | 22 | #include <linux/io.h> |
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/of.h> | ||
25 | #include <linux/platform_device.h> | ||
26 | #include <linux/platform_data/tegra_emc.h> | ||
23 | 27 | ||
24 | #include <mach/iomap.h> | 28 | #include <mach/iomap.h> |
25 | 29 | ||
26 | #include "tegra2_emc.h" | 30 | #include "tegra2_emc.h" |
31 | #include "fuse.h" | ||
27 | 32 | ||
28 | #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE | 33 | #ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE |
29 | static bool emc_enable = true; | 34 | static bool emc_enable = true; |
@@ -32,18 +37,17 @@ static bool emc_enable; | |||
32 | #endif | 37 | #endif |
33 | module_param(emc_enable, bool, 0644); | 38 | module_param(emc_enable, bool, 0644); |
34 | 39 | ||
35 | static void __iomem *emc = IO_ADDRESS(TEGRA_EMC_BASE); | 40 | static struct platform_device *emc_pdev; |
36 | static const struct tegra_emc_table *tegra_emc_table; | 41 | static void __iomem *emc_regbase; |
37 | static int tegra_emc_table_size; | ||
38 | 42 | ||
39 | static inline void emc_writel(u32 val, unsigned long addr) | 43 | static inline void emc_writel(u32 val, unsigned long addr) |
40 | { | 44 | { |
41 | writel(val, emc + addr); | 45 | writel(val, emc_regbase + addr); |
42 | } | 46 | } |
43 | 47 | ||
44 | static inline u32 emc_readl(unsigned long addr) | 48 | static inline u32 emc_readl(unsigned long addr) |
45 | { | 49 | { |
46 | return readl(emc + addr); | 50 | return readl(emc_regbase + addr); |
47 | } | 51 | } |
48 | 52 | ||
49 | static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { | 53 | static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { |
@@ -98,15 +102,15 @@ static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = { | |||
98 | /* Select the closest EMC rate that is higher than the requested rate */ | 102 | /* Select the closest EMC rate that is higher than the requested rate */ |
99 | long tegra_emc_round_rate(unsigned long rate) | 103 | long tegra_emc_round_rate(unsigned long rate) |
100 | { | 104 | { |
105 | struct tegra_emc_pdata *pdata; | ||
101 | int i; | 106 | int i; |
102 | int best = -1; | 107 | int best = -1; |
103 | unsigned long distance = ULONG_MAX; | 108 | unsigned long distance = ULONG_MAX; |
104 | 109 | ||
105 | if (!tegra_emc_table) | 110 | if (!emc_pdev) |
106 | return -EINVAL; | 111 | return -EINVAL; |
107 | 112 | ||
108 | if (!emc_enable) | 113 | pdata = emc_pdev->dev.platform_data; |
109 | return -EINVAL; | ||
110 | 114 | ||
111 | pr_debug("%s: %lu\n", __func__, rate); | 115 | pr_debug("%s: %lu\n", __func__, rate); |
112 | 116 | ||
@@ -116,10 +120,10 @@ long tegra_emc_round_rate(unsigned long rate) | |||
116 | */ | 120 | */ |
117 | rate = rate / 2 / 1000; | 121 | rate = rate / 2 / 1000; |
118 | 122 | ||
119 | for (i = 0; i < tegra_emc_table_size; i++) { | 123 | for (i = 0; i < pdata->num_tables; i++) { |
120 | if (tegra_emc_table[i].rate >= rate && | 124 | if (pdata->tables[i].rate >= rate && |
121 | (tegra_emc_table[i].rate - rate) < distance) { | 125 | (pdata->tables[i].rate - rate) < distance) { |
122 | distance = tegra_emc_table[i].rate - rate; | 126 | distance = pdata->tables[i].rate - rate; |
123 | best = i; | 127 | best = i; |
124 | } | 128 | } |
125 | } | 129 | } |
@@ -127,9 +131,9 @@ long tegra_emc_round_rate(unsigned long rate) | |||
127 | if (best < 0) | 131 | if (best < 0) |
128 | return -EINVAL; | 132 | return -EINVAL; |
129 | 133 | ||
130 | pr_debug("%s: using %lu\n", __func__, tegra_emc_table[best].rate); | 134 | pr_debug("%s: using %lu\n", __func__, pdata->tables[best].rate); |
131 | 135 | ||
132 | return tegra_emc_table[best].rate * 2 * 1000; | 136 | return pdata->tables[best].rate * 2 * 1000; |
133 | } | 137 | } |
134 | 138 | ||
135 | /* | 139 | /* |
@@ -142,37 +146,211 @@ long tegra_emc_round_rate(unsigned long rate) | |||
142 | */ | 146 | */ |
143 | int tegra_emc_set_rate(unsigned long rate) | 147 | int tegra_emc_set_rate(unsigned long rate) |
144 | { | 148 | { |
149 | struct tegra_emc_pdata *pdata; | ||
145 | int i; | 150 | int i; |
146 | int j; | 151 | int j; |
147 | 152 | ||
148 | if (!tegra_emc_table) | 153 | if (!emc_pdev) |
149 | return -EINVAL; | 154 | return -EINVAL; |
150 | 155 | ||
156 | pdata = emc_pdev->dev.platform_data; | ||
157 | |||
151 | /* | 158 | /* |
152 | * The EMC clock rate is twice the bus rate, and the bus rate is | 159 | * The EMC clock rate is twice the bus rate, and the bus rate is |
153 | * measured in kHz | 160 | * measured in kHz |
154 | */ | 161 | */ |
155 | rate = rate / 2 / 1000; | 162 | rate = rate / 2 / 1000; |
156 | 163 | ||
157 | for (i = 0; i < tegra_emc_table_size; i++) | 164 | for (i = 0; i < pdata->num_tables; i++) |
158 | if (tegra_emc_table[i].rate == rate) | 165 | if (pdata->tables[i].rate == rate) |
159 | break; | 166 | break; |
160 | 167 | ||
161 | if (i >= tegra_emc_table_size) | 168 | if (i >= pdata->num_tables) |
162 | return -EINVAL; | 169 | return -EINVAL; |
163 | 170 | ||
164 | pr_debug("%s: setting to %lu\n", __func__, rate); | 171 | pr_debug("%s: setting to %lu\n", __func__, rate); |
165 | 172 | ||
166 | for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) | 173 | for (j = 0; j < TEGRA_EMC_NUM_REGS; j++) |
167 | emc_writel(tegra_emc_table[i].regs[j], emc_reg_addr[j]); | 174 | emc_writel(pdata->tables[i].regs[j], emc_reg_addr[j]); |
168 | 175 | ||
169 | emc_readl(tegra_emc_table[i].regs[TEGRA_EMC_NUM_REGS - 1]); | 176 | emc_readl(pdata->tables[i].regs[TEGRA_EMC_NUM_REGS - 1]); |
170 | 177 | ||
171 | return 0; | 178 | return 0; |
172 | } | 179 | } |
173 | 180 | ||
174 | void tegra_init_emc(const struct tegra_emc_table *table, int table_size) | 181 | #ifdef CONFIG_OF |
182 | static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np) | ||
183 | { | ||
184 | struct device_node *iter; | ||
185 | u32 reg; | ||
186 | |||
187 | for_each_child_of_node(np, iter) { | ||
188 | if (of_property_read_u32(np, "nvidia,ram-code", ®)) | ||
189 | continue; | ||
190 | if (reg == tegra_bct_strapping) | ||
191 | return of_node_get(iter); | ||
192 | } | ||
193 | |||
194 | return NULL; | ||
195 | } | ||
196 | |||
197 | static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( | ||
198 | struct platform_device *pdev) | ||
199 | { | ||
200 | struct device_node *np = pdev->dev.of_node; | ||
201 | struct device_node *tnp, *iter; | ||
202 | struct tegra_emc_pdata *pdata; | ||
203 | int ret, i, num_tables; | ||
204 | |||
205 | if (!np) | ||
206 | return NULL; | ||
207 | |||
208 | if (of_find_property(np, "nvidia,use-ram-code", NULL)) { | ||
209 | tnp = tegra_emc_ramcode_devnode(np); | ||
210 | if (!tnp) | ||
211 | dev_warn(&pdev->dev, | ||
212 | "can't find emc table for ram-code 0x%02x\n", | ||
213 | tegra_bct_strapping); | ||
214 | } else | ||
215 | tnp = of_node_get(np); | ||
216 | |||
217 | if (!tnp) | ||
218 | return NULL; | ||
219 | |||
220 | num_tables = 0; | ||
221 | for_each_child_of_node(tnp, iter) | ||
222 | if (of_device_is_compatible(iter, "nvidia,tegra20-emc-table")) | ||
223 | num_tables++; | ||
224 | |||
225 | if (!num_tables) { | ||
226 | pdata = NULL; | ||
227 | goto out; | ||
228 | } | ||
229 | |||
230 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
231 | pdata->tables = devm_kzalloc(&pdev->dev, | ||
232 | sizeof(*pdata->tables) * num_tables, | ||
233 | GFP_KERNEL); | ||
234 | |||
235 | i = 0; | ||
236 | for_each_child_of_node(tnp, iter) { | ||
237 | u32 prop; | ||
238 | |||
239 | ret = of_property_read_u32(iter, "clock-frequency", &prop); | ||
240 | if (ret) { | ||
241 | dev_err(&pdev->dev, "no clock-frequency in %s\n", | ||
242 | iter->full_name); | ||
243 | continue; | ||
244 | } | ||
245 | pdata->tables[i].rate = prop; | ||
246 | |||
247 | ret = of_property_read_u32_array(iter, "nvidia,emc-registers", | ||
248 | pdata->tables[i].regs, | ||
249 | TEGRA_EMC_NUM_REGS); | ||
250 | if (ret) { | ||
251 | dev_err(&pdev->dev, | ||
252 | "malformed emc-registers property in %s\n", | ||
253 | iter->full_name); | ||
254 | continue; | ||
255 | } | ||
256 | |||
257 | i++; | ||
258 | } | ||
259 | pdata->num_tables = i; | ||
260 | |||
261 | out: | ||
262 | of_node_put(tnp); | ||
263 | return pdata; | ||
264 | } | ||
265 | #else | ||
266 | static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata( | ||
267 | struct platform_device *pdev) | ||
268 | { | ||
269 | return NULL; | ||
270 | } | ||
271 | #endif | ||
272 | |||
273 | static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_device *pdev) | ||
274 | { | ||
275 | struct clk *c = clk_get_sys(NULL, "emc"); | ||
276 | struct tegra_emc_pdata *pdata; | ||
277 | unsigned long khz; | ||
278 | int i; | ||
279 | |||
280 | WARN_ON(pdev->dev.platform_data); | ||
281 | BUG_ON(IS_ERR_OR_NULL(c)); | ||
282 | |||
283 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
284 | pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), | ||
285 | GFP_KERNEL); | ||
286 | |||
287 | pdata->tables[0].rate = clk_get_rate(c) / 2 / 1000; | ||
288 | |||
289 | for (i = 0; i < TEGRA_EMC_NUM_REGS; i++) | ||
290 | pdata->tables[0].regs[i] = emc_readl(emc_reg_addr[i]); | ||
291 | |||
292 | pdata->num_tables = 1; | ||
293 | |||
294 | khz = pdata->tables[0].rate; | ||
295 | dev_info(&pdev->dev, "no tables provided, using %ld kHz emc, " | ||
296 | "%ld kHz mem\n", khz * 2, khz); | ||
297 | |||
298 | return pdata; | ||
299 | } | ||
300 | |||
301 | static int __devinit tegra_emc_probe(struct platform_device *pdev) | ||
302 | { | ||
303 | struct tegra_emc_pdata *pdata; | ||
304 | struct resource *res; | ||
305 | |||
306 | if (!emc_enable) { | ||
307 | dev_err(&pdev->dev, "disabled per module parameter\n"); | ||
308 | return -ENODEV; | ||
309 | } | ||
310 | |||
311 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
312 | if (!res) { | ||
313 | dev_err(&pdev->dev, "missing register base\n"); | ||
314 | return -ENOMEM; | ||
315 | } | ||
316 | |||
317 | emc_regbase = devm_request_and_ioremap(&pdev->dev, res); | ||
318 | if (!emc_regbase) { | ||
319 | dev_err(&pdev->dev, "failed to remap registers\n"); | ||
320 | return -ENOMEM; | ||
321 | } | ||
322 | |||
323 | pdata = pdev->dev.platform_data; | ||
324 | |||
325 | if (!pdata) | ||
326 | pdata = tegra_emc_dt_parse_pdata(pdev); | ||
327 | |||
328 | if (!pdata) | ||
329 | pdata = tegra_emc_fill_pdata(pdev); | ||
330 | |||
331 | pdev->dev.platform_data = pdata; | ||
332 | |||
333 | emc_pdev = pdev; | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static struct of_device_id tegra_emc_of_match[] __devinitdata = { | ||
339 | { .compatible = "nvidia,tegra20-emc", }, | ||
340 | { }, | ||
341 | }; | ||
342 | |||
343 | static struct platform_driver tegra_emc_driver = { | ||
344 | .driver = { | ||
345 | .name = "tegra-emc", | ||
346 | .owner = THIS_MODULE, | ||
347 | .of_match_table = tegra_emc_of_match, | ||
348 | }, | ||
349 | .probe = tegra_emc_probe, | ||
350 | }; | ||
351 | |||
352 | static int __init tegra_emc_init(void) | ||
175 | { | 353 | { |
176 | tegra_emc_table = table; | 354 | return platform_driver_register(&tegra_emc_driver); |
177 | tegra_emc_table_size = table_size; | ||
178 | } | 355 | } |
356 | device_initcall(tegra_emc_init); | ||
diff --git a/arch/arm/mach-tegra/tegra2_emc.h b/arch/arm/mach-tegra/tegra2_emc.h index 19f08cb31603..f61409b54cb7 100644 --- a/arch/arm/mach-tegra/tegra2_emc.h +++ b/arch/arm/mach-tegra/tegra2_emc.h | |||
@@ -15,13 +15,10 @@ | |||
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #define TEGRA_EMC_NUM_REGS 46 | 18 | #ifndef __MACH_TEGRA_TEGRA2_EMC_H_ |
19 | 19 | #define __MACH_TEGRA_TEGRA2_EMC_H | |
20 | struct tegra_emc_table { | ||
21 | unsigned long rate; | ||
22 | u32 regs[TEGRA_EMC_NUM_REGS]; | ||
23 | }; | ||
24 | 20 | ||
25 | int tegra_emc_set_rate(unsigned long rate); | 21 | int tegra_emc_set_rate(unsigned long rate); |
26 | long tegra_emc_round_rate(unsigned long rate); | 22 | long tegra_emc_round_rate(unsigned long rate); |
27 | void tegra_init_emc(const struct tegra_emc_table *table, int table_size); | 23 | |
24 | #endif | ||
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c index d8a56aee521b..ade4a1c4e2a3 100644 --- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c +++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c | |||
@@ -60,9 +60,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
60 | dev_err(dev, "no sata clock.\n"); | 60 | dev_err(dev, "no sata clock.\n"); |
61 | return PTR_ERR(sata_clk); | 61 | return PTR_ERR(sata_clk); |
62 | } | 62 | } |
63 | ret = clk_enable(sata_clk); | 63 | ret = clk_prepare_enable(sata_clk); |
64 | if (ret) { | 64 | if (ret) { |
65 | dev_err(dev, "can't enable sata clock.\n"); | 65 | dev_err(dev, "can't prepare/enable sata clock.\n"); |
66 | goto put_sata_clk; | 66 | goto put_sata_clk; |
67 | } | 67 | } |
68 | 68 | ||
@@ -73,9 +73,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
73 | ret = PTR_ERR(sata_ref_clk); | 73 | ret = PTR_ERR(sata_ref_clk); |
74 | goto release_sata_clk; | 74 | goto release_sata_clk; |
75 | } | 75 | } |
76 | ret = clk_enable(sata_ref_clk); | 76 | ret = clk_prepare_enable(sata_ref_clk); |
77 | if (ret) { | 77 | if (ret) { |
78 | dev_err(dev, "can't enable sata ref clock.\n"); | 78 | dev_err(dev, "can't prepare/enable sata ref clock.\n"); |
79 | goto put_sata_ref_clk; | 79 | goto put_sata_ref_clk; |
80 | } | 80 | } |
81 | 81 | ||
@@ -104,11 +104,11 @@ static int imx_sata_init(struct device *dev, void __iomem *addr) | |||
104 | return 0; | 104 | return 0; |
105 | 105 | ||
106 | release_sata_ref_clk: | 106 | release_sata_ref_clk: |
107 | clk_disable(sata_ref_clk); | 107 | clk_disable_unprepare(sata_ref_clk); |
108 | put_sata_ref_clk: | 108 | put_sata_ref_clk: |
109 | clk_put(sata_ref_clk); | 109 | clk_put(sata_ref_clk); |
110 | release_sata_clk: | 110 | release_sata_clk: |
111 | clk_disable(sata_clk); | 111 | clk_disable_unprepare(sata_clk); |
112 | put_sata_clk: | 112 | put_sata_clk: |
113 | clk_put(sata_clk); | 113 | clk_put(sata_clk); |
114 | 114 | ||
@@ -117,10 +117,10 @@ put_sata_clk: | |||
117 | 117 | ||
118 | static void imx_sata_exit(struct device *dev) | 118 | static void imx_sata_exit(struct device *dev) |
119 | { | 119 | { |
120 | clk_disable(sata_ref_clk); | 120 | clk_disable_unprepare(sata_ref_clk); |
121 | clk_put(sata_ref_clk); | 121 | clk_put(sata_ref_clk); |
122 | 122 | ||
123 | clk_disable(sata_clk); | 123 | clk_disable_unprepare(sata_clk); |
124 | clk_put(sata_clk); | 124 | clk_put(sata_clk); |
125 | 125 | ||
126 | } | 126 | } |
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c index d3467f818c33..9129c9e7d532 100644 --- a/arch/arm/plat-mxc/epit.c +++ b/arch/arm/plat-mxc/epit.c | |||
@@ -203,7 +203,7 @@ static int __init epit_clockevent_init(struct clk *timer_clk) | |||
203 | 203 | ||
204 | void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) | 204 | void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq) |
205 | { | 205 | { |
206 | clk_enable(timer_clk); | 206 | clk_prepare_enable(timer_clk); |
207 | 207 | ||
208 | timer_base = base; | 208 | timer_base = base; |
209 | 209 | ||
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h deleted file mode 100644 index 94b60dd47137..000000000000 --- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
12 | #define __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | |||
16 | /* | ||
17 | * These symbols are used by drivers/net/cs89x0.c. | ||
18 | * This is ugly as hell, but we have to provide them until | ||
19 | * someone fixed the driver. | ||
20 | */ | ||
21 | |||
22 | /* Base address of PBC controller */ | ||
23 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
24 | /* Offsets for the PBC Controller register */ | ||
25 | |||
26 | /* Ethernet Controller IO base address */ | ||
27 | #define PBC_CS8900A_IOBASE 0x020000 | ||
28 | |||
29 | #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START) | ||
30 | |||
31 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
32 | |||
33 | #endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */ | ||
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S index 6e192c4a391a..8ddda365f1a0 100644 --- a/arch/arm/plat-mxc/include/mach/debug-macro.S +++ b/arch/arm/plat-mxc/include/mach/debug-macro.S | |||
@@ -24,7 +24,7 @@ | |||
24 | #define UART_PADDR MX51_UART1_BASE_ADDR | 24 | #define UART_PADDR MX51_UART1_BASE_ADDR |
25 | #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) | 25 | #elif defined (CONFIG_DEBUG_IMX50_IMX53_UART) |
26 | #define UART_PADDR MX53_UART1_BASE_ADDR | 26 | #define UART_PADDR MX53_UART1_BASE_ADDR |
27 | #elif defined (CONFIG_DEBUG_IMX6Q_UART) | 27 | #elif defined (CONFIG_DEBUG_IMX6Q_UART4) |
28 | #define UART_PADDR MX6Q_UART4_BASE_ADDR | 28 | #define UART_PADDR MX6Q_UART4_BASE_ADDR |
29 | #endif | 29 | #endif |
30 | 30 | ||
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h index 233d0a5e2d68..1b9080385b46 100644 --- a/arch/arm/plat-mxc/include/mach/dma.h +++ b/arch/arm/plat-mxc/include/mach/dma.h | |||
@@ -60,8 +60,7 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan) | |||
60 | 60 | ||
61 | static inline int imx_dma_is_general_purpose(struct dma_chan *chan) | 61 | static inline int imx_dma_is_general_purpose(struct dma_chan *chan) |
62 | { | 62 | { |
63 | return !strcmp(dev_name(chan->device->dev), "imx31-sdma") || | 63 | return strstr(dev_name(chan->device->dev), "sdma") || |
64 | !strcmp(dev_name(chan->device->dev), "imx35-sdma") || | ||
65 | !strcmp(dev_name(chan->device->dev), "imx-dma"); | 64 | !strcmp(dev_name(chan->device->dev), "imx-dma"); |
66 | } | 65 | } |
67 | 66 | ||
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index e032717f7d02..c0cab2270dd1 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c | |||
@@ -132,7 +132,7 @@ int pwm_enable(struct pwm_device *pwm) | |||
132 | int rc = 0; | 132 | int rc = 0; |
133 | 133 | ||
134 | if (!pwm->clk_enabled) { | 134 | if (!pwm->clk_enabled) { |
135 | rc = clk_enable(pwm->clk); | 135 | rc = clk_prepare_enable(pwm->clk); |
136 | if (!rc) | 136 | if (!rc) |
137 | pwm->clk_enabled = 1; | 137 | pwm->clk_enabled = 1; |
138 | } | 138 | } |
@@ -145,7 +145,7 @@ void pwm_disable(struct pwm_device *pwm) | |||
145 | writel(0, pwm->mmio_base + MX3_PWMCR); | 145 | writel(0, pwm->mmio_base + MX3_PWMCR); |
146 | 146 | ||
147 | if (pwm->clk_enabled) { | 147 | if (pwm->clk_enabled) { |
148 | clk_disable(pwm->clk); | 148 | clk_disable_unprepare(pwm->clk); |
149 | pwm->clk_enabled = 0; | 149 | pwm->clk_enabled = 0; |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c index 3599bf2cfd4f..f30dcacbbd0a 100644 --- a/arch/arm/plat-mxc/system.c +++ b/arch/arm/plat-mxc/system.c | |||
@@ -48,7 +48,7 @@ void mxc_restart(char mode, const char *cmd) | |||
48 | 48 | ||
49 | clk = clk_get_sys("imx2-wdt.0", NULL); | 49 | clk = clk_get_sys("imx2-wdt.0", NULL); |
50 | if (!IS_ERR(clk)) | 50 | if (!IS_ERR(clk)) |
51 | clk_enable(clk); | 51 | clk_prepare_enable(clk); |
52 | wcr_enable = (1 << 2); | 52 | wcr_enable = (1 << 2); |
53 | } | 53 | } |
54 | 54 | ||
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c index 1c96cdb4c35e..7daf7c9a413b 100644 --- a/arch/arm/plat-mxc/time.c +++ b/arch/arm/plat-mxc/time.c | |||
@@ -283,7 +283,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) | |||
283 | { | 283 | { |
284 | uint32_t tctl_val; | 284 | uint32_t tctl_val; |
285 | 285 | ||
286 | clk_enable(timer_clk); | 286 | clk_prepare_enable(timer_clk); |
287 | 287 | ||
288 | timer_base = base; | 288 | timer_base = base; |
289 | 289 | ||
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 647010109afa..9e8e63d52aab 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -484,7 +484,6 @@ struct omap_hwmod_class { | |||
484 | * @main_clk: main clock: OMAP clock name | 484 | * @main_clk: main clock: OMAP clock name |
485 | * @_clk: pointer to the main struct clk (filled in at runtime) | 485 | * @_clk: pointer to the main struct clk (filled in at runtime) |
486 | * @opt_clks: other device clocks that drivers can request (0..*) | 486 | * @opt_clks: other device clocks that drivers can request (0..*) |
487 | * @vdd_name: voltage domain name | ||
488 | * @voltdm: pointer to voltage domain (filled in at runtime) | 487 | * @voltdm: pointer to voltage domain (filled in at runtime) |
489 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on | 488 | * @masters: ptr to array of OCP ifs that this hwmod can initiate on |
490 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on | 489 | * @slaves: ptr to array of OCP ifs that this hwmod can respond on |
@@ -528,7 +527,6 @@ struct omap_hwmod { | |||
528 | struct omap_hwmod_opt_clk *opt_clks; | 527 | struct omap_hwmod_opt_clk *opt_clks; |
529 | char *clkdm_name; | 528 | char *clkdm_name; |
530 | struct clockdomain *clkdm; | 529 | struct clockdomain *clkdm; |
531 | char *vdd_name; | ||
532 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ | 530 | struct omap_hwmod_ocp_if **masters; /* connect to *_IA */ |
533 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ | 531 | struct omap_hwmod_ocp_if **slaves; /* connect to *_TA */ |
534 | void *dev_attr; | 532 | void *dev_attr; |
diff --git a/arch/arm/plat-samsung/include/plat/dma-pl330.h b/arch/arm/plat-samsung/include/plat/dma-pl330.h index c5eaad529de5..0670f37aaaed 100644 --- a/arch/arm/plat-samsung/include/plat/dma-pl330.h +++ b/arch/arm/plat-samsung/include/plat/dma-pl330.h | |||
@@ -82,6 +82,22 @@ enum dma_ch { | |||
82 | DMACH_SLIMBUS4_TX, | 82 | DMACH_SLIMBUS4_TX, |
83 | DMACH_SLIMBUS5_RX, | 83 | DMACH_SLIMBUS5_RX, |
84 | DMACH_SLIMBUS5_TX, | 84 | DMACH_SLIMBUS5_TX, |
85 | DMACH_MIPI_HSI0, | ||
86 | DMACH_MIPI_HSI1, | ||
87 | DMACH_MIPI_HSI2, | ||
88 | DMACH_MIPI_HSI3, | ||
89 | DMACH_MIPI_HSI4, | ||
90 | DMACH_MIPI_HSI5, | ||
91 | DMACH_MIPI_HSI6, | ||
92 | DMACH_MIPI_HSI7, | ||
93 | DMACH_MTOM_0, | ||
94 | DMACH_MTOM_1, | ||
95 | DMACH_MTOM_2, | ||
96 | DMACH_MTOM_3, | ||
97 | DMACH_MTOM_4, | ||
98 | DMACH_MTOM_5, | ||
99 | DMACH_MTOM_6, | ||
100 | DMACH_MTOM_7, | ||
85 | /* END Marker, also used to denote a reserved channel */ | 101 | /* END Marker, also used to denote a reserved channel */ |
86 | DMACH_MAX, | 102 | DMACH_MAX, |
87 | }; | 103 | }; |
diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h index 30b7cc14cef5..0f8263e93eea 100644 --- a/arch/arm/plat-samsung/include/plat/regs-rtc.h +++ b/arch/arm/plat-samsung/include/plat/regs-rtc.h | |||
@@ -18,51 +18,54 @@ | |||
18 | #define S3C2410_INTP_ALM (1 << 1) | 18 | #define S3C2410_INTP_ALM (1 << 1) |
19 | #define S3C2410_INTP_TIC (1 << 0) | 19 | #define S3C2410_INTP_TIC (1 << 0) |
20 | 20 | ||
21 | #define S3C2410_RTCCON S3C2410_RTCREG(0x40) | 21 | #define S3C2410_RTCCON S3C2410_RTCREG(0x40) |
22 | #define S3C2410_RTCCON_RTCEN (1<<0) | 22 | #define S3C2410_RTCCON_RTCEN (1 << 0) |
23 | #define S3C2410_RTCCON_CLKSEL (1<<1) | 23 | #define S3C2410_RTCCON_CNTSEL (1 << 2) |
24 | #define S3C2410_RTCCON_CNTSEL (1<<2) | 24 | #define S3C2410_RTCCON_CLKRST (1 << 3) |
25 | #define S3C2410_RTCCON_CLKRST (1<<3) | 25 | #define S3C2443_RTCCON_TICSEL (1 << 4) |
26 | #define S3C64XX_RTCCON_TICEN (1<<8) | 26 | #define S3C64XX_RTCCON_TICEN (1 << 8) |
27 | 27 | ||
28 | #define S3C64XX_RTCCON_TICMSK (0xF<<7) | 28 | #define S3C2410_TICNT S3C2410_RTCREG(0x44) |
29 | #define S3C64XX_RTCCON_TICSHT (7) | 29 | #define S3C2410_TICNT_ENABLE (1 << 7) |
30 | 30 | ||
31 | #define S3C2410_TICNT S3C2410_RTCREG(0x44) | 31 | /* S3C2443: tick count is 15 bit wide |
32 | #define S3C2410_TICNT_ENABLE (1<<7) | 32 | * TICNT[6:0] contains upper 7 bits |
33 | * TICNT1[7:0] contains lower 8 bits | ||
34 | */ | ||
35 | #define S3C2443_TICNT_PART(x) ((x & 0x7f00) >> 8) | ||
36 | #define S3C2443_TICNT1 S3C2410_RTCREG(0x4C) | ||
37 | #define S3C2443_TICNT1_PART(x) (x & 0xff) | ||
33 | 38 | ||
34 | #define S3C2410_RTCALM S3C2410_RTCREG(0x50) | 39 | /* S3C2416: tick count is 32 bit wide |
35 | #define S3C2410_RTCALM_ALMEN (1<<6) | 40 | * TICNT[6:0] contains bits [14:8] |
36 | #define S3C2410_RTCALM_YEAREN (1<<5) | 41 | * TICNT1[7:0] contains lower 8 bits |
37 | #define S3C2410_RTCALM_MONEN (1<<4) | 42 | * TICNT2[16:0] contains upper 17 bits |
38 | #define S3C2410_RTCALM_DAYEN (1<<3) | 43 | */ |
39 | #define S3C2410_RTCALM_HOUREN (1<<2) | 44 | #define S3C2416_TICNT2 S3C2410_RTCREG(0x48) |
40 | #define S3C2410_RTCALM_MINEN (1<<1) | 45 | #define S3C2416_TICNT2_PART(x) ((x & 0xffff8000) >> 15) |
41 | #define S3C2410_RTCALM_SECEN (1<<0) | ||
42 | 46 | ||
43 | #define S3C2410_RTCALM_ALL \ | 47 | #define S3C2410_RTCALM S3C2410_RTCREG(0x50) |
44 | S3C2410_RTCALM_ALMEN | S3C2410_RTCALM_YEAREN | S3C2410_RTCALM_MONEN |\ | 48 | #define S3C2410_RTCALM_ALMEN (1 << 6) |
45 | S3C2410_RTCALM_DAYEN | S3C2410_RTCALM_HOUREN | S3C2410_RTCALM_MINEN |\ | 49 | #define S3C2410_RTCALM_YEAREN (1 << 5) |
46 | S3C2410_RTCALM_SECEN | 50 | #define S3C2410_RTCALM_MONEN (1 << 4) |
51 | #define S3C2410_RTCALM_DAYEN (1 << 3) | ||
52 | #define S3C2410_RTCALM_HOUREN (1 << 2) | ||
53 | #define S3C2410_RTCALM_MINEN (1 << 1) | ||
54 | #define S3C2410_RTCALM_SECEN (1 << 0) | ||
47 | 55 | ||
56 | #define S3C2410_ALMSEC S3C2410_RTCREG(0x54) | ||
57 | #define S3C2410_ALMMIN S3C2410_RTCREG(0x58) | ||
58 | #define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) | ||
48 | 59 | ||
49 | #define S3C2410_ALMSEC S3C2410_RTCREG(0x54) | 60 | #define S3C2410_ALMDATE S3C2410_RTCREG(0x60) |
50 | #define S3C2410_ALMMIN S3C2410_RTCREG(0x58) | 61 | #define S3C2410_ALMMON S3C2410_RTCREG(0x64) |
51 | #define S3C2410_ALMHOUR S3C2410_RTCREG(0x5c) | 62 | #define S3C2410_ALMYEAR S3C2410_RTCREG(0x68) |
52 | |||
53 | #define S3C2410_ALMDATE S3C2410_RTCREG(0x60) | ||
54 | #define S3C2410_ALMMON S3C2410_RTCREG(0x64) | ||
55 | #define S3C2410_ALMYEAR S3C2410_RTCREG(0x68) | ||
56 | |||
57 | #define S3C2410_RTCRST S3C2410_RTCREG(0x6c) | ||
58 | |||
59 | #define S3C2410_RTCSEC S3C2410_RTCREG(0x70) | ||
60 | #define S3C2410_RTCMIN S3C2410_RTCREG(0x74) | ||
61 | #define S3C2410_RTCHOUR S3C2410_RTCREG(0x78) | ||
62 | #define S3C2410_RTCDATE S3C2410_RTCREG(0x7c) | ||
63 | #define S3C2410_RTCDAY S3C2410_RTCREG(0x80) | ||
64 | #define S3C2410_RTCMON S3C2410_RTCREG(0x84) | ||
65 | #define S3C2410_RTCYEAR S3C2410_RTCREG(0x88) | ||
66 | 63 | ||
64 | #define S3C2410_RTCSEC S3C2410_RTCREG(0x70) | ||
65 | #define S3C2410_RTCMIN S3C2410_RTCREG(0x74) | ||
66 | #define S3C2410_RTCHOUR S3C2410_RTCREG(0x78) | ||
67 | #define S3C2410_RTCDATE S3C2410_RTCREG(0x7c) | ||
68 | #define S3C2410_RTCMON S3C2410_RTCREG(0x84) | ||
69 | #define S3C2410_RTCYEAR S3C2410_RTCREG(0x88) | ||
67 | 70 | ||
68 | #endif /* __ASM_ARCH_REGS_RTC_H */ | 71 | #endif /* __ASM_ARCH_REGS_RTC_H */ |
diff --git a/arch/arm/plat-samsung/include/plat/rtc-core.h b/arch/arm/plat-samsung/include/plat/rtc-core.h new file mode 100644 index 000000000000..21d8594d37ca --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/rtc-core.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/rtc-core.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de> | ||
4 | * | ||
5 | * Samsung RTC Controller core functions | ||
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 | #ifndef __ASM_PLAT_RTC_CORE_H | ||
13 | #define __ASM_PLAT_RTC_CORE_H __FILE__ | ||
14 | |||
15 | /* These functions are only for use with the core support code, such as | ||
16 | * the cpu specific initialisation code | ||
17 | */ | ||
18 | |||
19 | /* re-define device name depending on support. */ | ||
20 | static inline void s3c_rtc_setname(char *name) | ||
21 | { | ||
22 | #if defined(CONFIG_SAMSUNG_DEV_RTC) || defined(CONFIG_PLAT_S3C24XX) | ||
23 | s3c_device_rtc.name = name; | ||
24 | #endif | ||
25 | } | ||
26 | |||
27 | #endif /* __ASM_PLAT_RTC_CORE_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h index f82f888b91a9..317e246ffc56 100644 --- a/arch/arm/plat-samsung/include/plat/sdhci.h +++ b/arch/arm/plat-samsung/include/plat/sdhci.h | |||
@@ -40,6 +40,7 @@ enum clk_types { | |||
40 | * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI | 40 | * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI |
41 | * @max_width: The maximum number of data bits supported. | 41 | * @max_width: The maximum number of data bits supported. |
42 | * @host_caps: Standard MMC host capabilities bit field. | 42 | * @host_caps: Standard MMC host capabilities bit field. |
43 | * @host_caps2: The second standard MMC host capabilities bit field. | ||
43 | * @cd_type: Type of Card Detection method (see cd_types enum above) | 44 | * @cd_type: Type of Card Detection method (see cd_types enum above) |
44 | * @clk_type: Type of clock divider method (see clk_types enum above) | 45 | * @clk_type: Type of clock divider method (see clk_types enum above) |
45 | * @ext_cd_init: Initialize external card detect subsystem. Called on | 46 | * @ext_cd_init: Initialize external card detect subsystem. Called on |
@@ -63,6 +64,7 @@ enum clk_types { | |||
63 | struct s3c_sdhci_platdata { | 64 | struct s3c_sdhci_platdata { |
64 | unsigned int max_width; | 65 | unsigned int max_width; |
65 | unsigned int host_caps; | 66 | unsigned int host_caps; |
67 | unsigned int host_caps2; | ||
66 | unsigned int pm_caps; | 68 | unsigned int pm_caps; |
67 | enum cd_types cd_type; | 69 | enum cd_types cd_type; |
68 | enum clk_types clk_type; | 70 | enum clk_types clk_type; |
diff --git a/arch/arm/plat-samsung/platformdata.c b/arch/arm/plat-samsung/platformdata.c index 0f707184eae0..fa78aa710ed1 100644 --- a/arch/arm/plat-samsung/platformdata.c +++ b/arch/arm/plat-samsung/platformdata.c | |||
@@ -53,6 +53,8 @@ void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, | |||
53 | set->cfg_gpio = pd->cfg_gpio; | 53 | set->cfg_gpio = pd->cfg_gpio; |
54 | if (pd->host_caps) | 54 | if (pd->host_caps) |
55 | set->host_caps |= pd->host_caps; | 55 | set->host_caps |= pd->host_caps; |
56 | if (pd->host_caps2) | ||
57 | set->host_caps2 |= pd->host_caps2; | ||
56 | if (pd->pm_caps) | 58 | if (pd->pm_caps) |
57 | set->pm_caps |= pd->pm_caps; | 59 | set->pm_caps |= pd->pm_caps; |
58 | if (pd->clk_type) | 60 | if (pd->clk_type) |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index bdc293791590..6f17671260e1 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | ||
28 | 29 | ||
29 | #include <asm/mach/irq.h> | 30 | #include <asm/mach/irq.h> |
30 | 31 | ||
@@ -74,9 +75,10 @@ struct tegra_gpio_bank { | |||
74 | #endif | 75 | #endif |
75 | }; | 76 | }; |
76 | 77 | ||
77 | 78 | static struct irq_domain *irq_domain; | |
78 | static void __iomem *regs; | 79 | static void __iomem *regs; |
79 | static struct tegra_gpio_bank tegra_gpio_banks[7]; | 80 | static u32 tegra_gpio_bank_count; |
81 | static struct tegra_gpio_bank *tegra_gpio_banks; | ||
80 | 82 | ||
81 | static inline void tegra_gpio_writel(u32 val, u32 reg) | 83 | static inline void tegra_gpio_writel(u32 val, u32 reg) |
82 | { | 84 | { |
@@ -139,7 +141,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | |||
139 | 141 | ||
140 | static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 142 | static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
141 | { | 143 | { |
142 | return TEGRA_GPIO_TO_IRQ(offset); | 144 | return irq_find_mapping(irq_domain, offset); |
143 | } | 145 | } |
144 | 146 | ||
145 | static struct gpio_chip tegra_gpio_chip = { | 147 | static struct gpio_chip tegra_gpio_chip = { |
@@ -155,28 +157,28 @@ static struct gpio_chip tegra_gpio_chip = { | |||
155 | 157 | ||
156 | static void tegra_gpio_irq_ack(struct irq_data *d) | 158 | static void tegra_gpio_irq_ack(struct irq_data *d) |
157 | { | 159 | { |
158 | int gpio = d->irq - INT_GPIO_BASE; | 160 | int gpio = d->hwirq; |
159 | 161 | ||
160 | tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); | 162 | tegra_gpio_writel(1 << GPIO_BIT(gpio), GPIO_INT_CLR(gpio)); |
161 | } | 163 | } |
162 | 164 | ||
163 | static void tegra_gpio_irq_mask(struct irq_data *d) | 165 | static void tegra_gpio_irq_mask(struct irq_data *d) |
164 | { | 166 | { |
165 | int gpio = d->irq - INT_GPIO_BASE; | 167 | int gpio = d->hwirq; |
166 | 168 | ||
167 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); | 169 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 0); |
168 | } | 170 | } |
169 | 171 | ||
170 | static void tegra_gpio_irq_unmask(struct irq_data *d) | 172 | static void tegra_gpio_irq_unmask(struct irq_data *d) |
171 | { | 173 | { |
172 | int gpio = d->irq - INT_GPIO_BASE; | 174 | int gpio = d->hwirq; |
173 | 175 | ||
174 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); | 176 | tegra_gpio_mask_write(GPIO_MSK_INT_ENB(gpio), gpio, 1); |
175 | } | 177 | } |
176 | 178 | ||
177 | static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | 179 | static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) |
178 | { | 180 | { |
179 | int gpio = d->irq - INT_GPIO_BASE; | 181 | int gpio = d->hwirq; |
180 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 182 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
181 | int port = GPIO_PORT(gpio); | 183 | int port = GPIO_PORT(gpio); |
182 | int lvl_type; | 184 | int lvl_type; |
@@ -273,7 +275,7 @@ void tegra_gpio_resume(void) | |||
273 | 275 | ||
274 | local_irq_save(flags); | 276 | local_irq_save(flags); |
275 | 277 | ||
276 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { | 278 | for (b = 0; b < tegra_gpio_bank_count; b++) { |
277 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; | 279 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; |
278 | 280 | ||
279 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { | 281 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { |
@@ -296,7 +298,7 @@ void tegra_gpio_suspend(void) | |||
296 | int p; | 298 | int p; |
297 | 299 | ||
298 | local_irq_save(flags); | 300 | local_irq_save(flags); |
299 | for (b = 0; b < ARRAY_SIZE(tegra_gpio_banks); b++) { | 301 | for (b = 0; b < tegra_gpio_bank_count; b++) { |
300 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; | 302 | struct tegra_gpio_bank *bank = &tegra_gpio_banks[b]; |
301 | 303 | ||
302 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { | 304 | for (p = 0; p < ARRAY_SIZE(bank->oe); p++) { |
@@ -337,13 +339,44 @@ static struct lock_class_key gpio_lock_class; | |||
337 | 339 | ||
338 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) | 340 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) |
339 | { | 341 | { |
342 | int irq_base; | ||
340 | struct resource *res; | 343 | struct resource *res; |
341 | struct tegra_gpio_bank *bank; | 344 | struct tegra_gpio_bank *bank; |
342 | int gpio; | 345 | int gpio; |
343 | int i; | 346 | int i; |
344 | int j; | 347 | int j; |
345 | 348 | ||
346 | for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { | 349 | for (;;) { |
350 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); | ||
351 | if (!res) | ||
352 | break; | ||
353 | tegra_gpio_bank_count++; | ||
354 | } | ||
355 | if (!tegra_gpio_bank_count) { | ||
356 | dev_err(&pdev->dev, "Missing IRQ resource\n"); | ||
357 | return -ENODEV; | ||
358 | } | ||
359 | |||
360 | tegra_gpio_chip.ngpio = tegra_gpio_bank_count * 32; | ||
361 | |||
362 | tegra_gpio_banks = devm_kzalloc(&pdev->dev, | ||
363 | tegra_gpio_bank_count * sizeof(*tegra_gpio_banks), | ||
364 | GFP_KERNEL); | ||
365 | if (!tegra_gpio_banks) { | ||
366 | dev_err(&pdev->dev, "Couldn't allocate bank structure\n"); | ||
367 | return -ENODEV; | ||
368 | } | ||
369 | |||
370 | irq_base = irq_alloc_descs(-1, 0, tegra_gpio_chip.ngpio, 0); | ||
371 | if (irq_base < 0) { | ||
372 | dev_err(&pdev->dev, "Couldn't allocate IRQ numbers\n"); | ||
373 | return -ENODEV; | ||
374 | } | ||
375 | irq_domain = irq_domain_add_legacy(pdev->dev.of_node, | ||
376 | tegra_gpio_chip.ngpio, irq_base, 0, | ||
377 | &irq_domain_simple_ops, NULL); | ||
378 | |||
379 | for (i = 0; i < tegra_gpio_bank_count; i++) { | ||
347 | res = platform_get_resource(pdev, IORESOURCE_IRQ, i); | 380 | res = platform_get_resource(pdev, IORESOURCE_IRQ, i); |
348 | if (!res) { | 381 | if (!res) { |
349 | dev_err(&pdev->dev, "Missing IRQ resource\n"); | 382 | dev_err(&pdev->dev, "Missing IRQ resource\n"); |
@@ -380,8 +413,8 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
380 | 413 | ||
381 | gpiochip_add(&tegra_gpio_chip); | 414 | gpiochip_add(&tegra_gpio_chip); |
382 | 415 | ||
383 | for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) { | 416 | for (gpio = 0; gpio < tegra_gpio_chip.ngpio; gpio++) { |
384 | int irq = TEGRA_GPIO_TO_IRQ(gpio); | 417 | int irq = irq_find_mapping(irq_domain, gpio); |
385 | /* No validity check; all Tegra GPIOs are valid IRQs */ | 418 | /* No validity check; all Tegra GPIOs are valid IRQs */ |
386 | 419 | ||
387 | bank = &tegra_gpio_banks[GPIO_BANK(gpio)]; | 420 | bank = &tegra_gpio_banks[GPIO_BANK(gpio)]; |
@@ -393,7 +426,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
393 | set_irq_flags(irq, IRQF_VALID); | 426 | set_irq_flags(irq, IRQF_VALID); |
394 | } | 427 | } |
395 | 428 | ||
396 | for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { | 429 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
397 | bank = &tegra_gpio_banks[i]; | 430 | bank = &tegra_gpio_banks[i]; |
398 | 431 | ||
399 | irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler); | 432 | irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler); |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 124d9c594f40..dfb84b7ee550 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -191,7 +191,7 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx) | |||
191 | 191 | ||
192 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); | 192 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); |
193 | 193 | ||
194 | clk_enable(i2c_imx->clk); | 194 | clk_prepare_enable(i2c_imx->clk); |
195 | writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR); | 195 | writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR); |
196 | /* Enable I2C controller */ | 196 | /* Enable I2C controller */ |
197 | writeb(0, i2c_imx->base + IMX_I2C_I2SR); | 197 | writeb(0, i2c_imx->base + IMX_I2C_I2SR); |
@@ -240,7 +240,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
240 | 240 | ||
241 | /* Disable I2C controller */ | 241 | /* Disable I2C controller */ |
242 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); | 242 | writeb(0, i2c_imx->base + IMX_I2C_I2CR); |
243 | clk_disable(i2c_imx->clk); | 243 | clk_disable_unprepare(i2c_imx->clk); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, | 246 | static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 0be4e2013632..6193a0d7bde5 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -464,7 +464,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
464 | err = PTR_ERR(clk); | 464 | err = PTR_ERR(clk); |
465 | goto err_clk_get; | 465 | goto err_clk_get; |
466 | } | 466 | } |
467 | clk_enable(clk); | 467 | clk_prepare_enable(clk); |
468 | pltfm_host->clk = clk; | 468 | pltfm_host->clk = clk; |
469 | 469 | ||
470 | if (!is_imx25_esdhc(imx_data)) | 470 | if (!is_imx25_esdhc(imx_data)) |
@@ -559,7 +559,7 @@ no_card_detect_irq: | |||
559 | gpio_free(boarddata->wp_gpio); | 559 | gpio_free(boarddata->wp_gpio); |
560 | no_card_detect_pin: | 560 | no_card_detect_pin: |
561 | no_board_data: | 561 | no_board_data: |
562 | clk_disable(pltfm_host->clk); | 562 | clk_disable_unprepare(pltfm_host->clk); |
563 | clk_put(pltfm_host->clk); | 563 | clk_put(pltfm_host->clk); |
564 | err_clk_get: | 564 | err_clk_get: |
565 | kfree(imx_data); | 565 | kfree(imx_data); |
@@ -586,7 +586,7 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev) | |||
586 | gpio_free(boarddata->cd_gpio); | 586 | gpio_free(boarddata->cd_gpio); |
587 | } | 587 | } |
588 | 588 | ||
589 | clk_disable(pltfm_host->clk); | 589 | clk_disable_unprepare(pltfm_host->clk); |
590 | clk_put(pltfm_host->clk); | 590 | clk_put(pltfm_host->clk); |
591 | kfree(imx_data); | 591 | kfree(imx_data); |
592 | 592 | ||
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 1af756ee0f9a..b19e7d435f8d 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -518,9 +518,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
518 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) | 518 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) |
519 | host->mmc->caps = MMC_CAP_NONREMOVABLE; | 519 | host->mmc->caps = MMC_CAP_NONREMOVABLE; |
520 | 520 | ||
521 | if (pdata->host_caps) | ||
522 | host->mmc->caps |= pdata->host_caps; | ||
523 | |||
524 | if (pdata->pm_caps) | 521 | if (pdata->pm_caps) |
525 | host->mmc->pm_caps |= pdata->pm_caps; | 522 | host->mmc->pm_caps |= pdata->pm_caps; |
526 | 523 | ||
@@ -544,6 +541,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
544 | if (pdata->host_caps) | 541 | if (pdata->host_caps) |
545 | host->mmc->caps |= pdata->host_caps; | 542 | host->mmc->caps |= pdata->host_caps; |
546 | 543 | ||
544 | if (pdata->host_caps2) | ||
545 | host->mmc->caps2 |= pdata->host_caps2; | ||
546 | |||
547 | ret = sdhci_add_host(host); | 547 | ret = sdhci_add_host(host); |
548 | if (ret) { | 548 | if (ret) { |
549 | dev_err(dev, "sdhci_add_host() failed\n"); | 549 | dev_err(dev, "sdhci_add_host() failed\n"); |
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 068c3563e00f..88bbd8ffa7fe 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -190,8 +190,10 @@ static struct devprobe2 isa_probes[] __initdata = { | |||
190 | {seeq8005_probe, 0}, | 190 | {seeq8005_probe, 0}, |
191 | #endif | 191 | #endif |
192 | #ifdef CONFIG_CS89x0 | 192 | #ifdef CONFIG_CS89x0 |
193 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | {cs89x0_probe, 0}, | 194 | {cs89x0_probe, 0}, |
194 | #endif | 195 | #endif |
196 | #endif | ||
195 | #ifdef CONFIG_AT1700 | 197 | #ifdef CONFIG_AT1700 |
196 | {at1700_probe, 0}, | 198 | {at1700_probe, 0}, |
197 | #endif | 199 | #endif |
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig index 1f8648f099c7..8388e36cf08f 100644 --- a/drivers/net/ethernet/cirrus/Kconfig +++ b/drivers/net/ethernet/cirrus/Kconfig | |||
@@ -5,8 +5,7 @@ | |||
5 | config NET_VENDOR_CIRRUS | 5 | config NET_VENDOR_CIRRUS |
6 | bool "Cirrus devices" | 6 | bool "Cirrus devices" |
7 | default y | 7 | default y |
8 | depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ | 8 | depends on ISA || EISA || ARM || MAC |
9 | || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC | ||
10 | ---help--- | 9 | ---help--- |
11 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
12 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
@@ -21,8 +20,7 @@ if NET_VENDOR_CIRRUS | |||
21 | 20 | ||
22 | config CS89x0 | 21 | config CS89x0 |
23 | tristate "CS89x0 support" | 22 | tristate "CS89x0 support" |
24 | depends on (ISA || EISA || MACH_IXDP2351 \ | 23 | depends on ISA || EISA || ARM |
25 | || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440) | ||
26 | ---help--- | 24 | ---help--- |
27 | Support for CS89x0 chipset based Ethernet cards. If you have a | 25 | Support for CS89x0 chipset based Ethernet cards. If you have a |
28 | network (Ethernet) card of this type, say Y and read the | 26 | network (Ethernet) card of this type, say Y and read the |
@@ -33,10 +31,15 @@ config CS89x0 | |||
33 | To compile this driver as a module, choose M here. The module | 31 | To compile this driver as a module, choose M here. The module |
34 | will be called cs89x0. | 32 | will be called cs89x0. |
35 | 33 | ||
36 | config CS89x0_NONISA_IRQ | 34 | config CS89x0_PLATFORM |
37 | def_bool y | 35 | bool "CS89x0 platform driver support" |
38 | depends on CS89x0 != n | 36 | depends on CS89x0 |
39 | depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440 | 37 | help |
38 | Say Y to compile the cs89x0 driver as a platform driver. This | ||
39 | makes this driver suitable for use on certain evaluation boards | ||
40 | such as the iMX21ADS. | ||
41 | |||
42 | If you are unsure, say N. | ||
40 | 43 | ||
41 | config EP93XX_ETH | 44 | config EP93XX_ETH |
42 | tristate "EP93xx Ethernet support" | 45 | tristate "EP93xx Ethernet support" |
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index d5ff93653e4c..30fee428c489 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -100,9 +100,6 @@ | |||
100 | 100 | ||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* Always include 'config.h' first in case the user wants to turn on | ||
104 | or override something. */ | ||
105 | #include <linux/module.h> | ||
106 | 103 | ||
107 | /* | 104 | /* |
108 | * Set this to zero to disable DMA code | 105 | * Set this to zero to disable DMA code |
@@ -131,9 +128,12 @@ | |||
131 | 128 | ||
132 | */ | 129 | */ |
133 | 130 | ||
131 | #include <linux/module.h> | ||
132 | #include <linux/printk.h> | ||
134 | #include <linux/errno.h> | 133 | #include <linux/errno.h> |
135 | #include <linux/netdevice.h> | 134 | #include <linux/netdevice.h> |
136 | #include <linux/etherdevice.h> | 135 | #include <linux/etherdevice.h> |
136 | #include <linux/platform_device.h> | ||
137 | #include <linux/kernel.h> | 137 | #include <linux/kernel.h> |
138 | #include <linux/types.h> | 138 | #include <linux/types.h> |
139 | #include <linux/fcntl.h> | 139 | #include <linux/fcntl.h> |
@@ -151,6 +151,7 @@ | |||
151 | #include <asm/system.h> | 151 | #include <asm/system.h> |
152 | #include <asm/io.h> | 152 | #include <asm/io.h> |
153 | #include <asm/irq.h> | 153 | #include <asm/irq.h> |
154 | #include <linux/atomic.h> | ||
154 | #if ALLOW_DMA | 155 | #if ALLOW_DMA |
155 | #include <asm/dma.h> | 156 | #include <asm/dma.h> |
156 | #endif | 157 | #endif |
@@ -174,26 +175,20 @@ static char version[] __initdata = | |||
174 | them to system IRQ numbers. This mapping is card specific and is set to | 175 | them to system IRQ numbers. This mapping is card specific and is set to |
175 | the configuration of the Cirrus Eval board for this chip. */ | 176 | the configuration of the Cirrus Eval board for this chip. */ |
176 | #if defined(CONFIG_MACH_IXDP2351) | 177 | #if defined(CONFIG_MACH_IXDP2351) |
178 | #define CS89x0_NONISA_IRQ | ||
177 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | 179 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; |
178 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | 180 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; |
179 | #elif defined(CONFIG_ARCH_IXDP2X01) | 181 | #elif defined(CONFIG_ARCH_IXDP2X01) |
182 | #define CS89x0_NONISA_IRQ | ||
180 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 183 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
181 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | 184 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; |
182 | #elif defined(CONFIG_MACH_QQ2440) | ||
183 | #include <mach/qq2440.h> | ||
184 | static unsigned int netcard_portlist[] __used __initdata = { QQ2440_CS8900_VIRT_BASE + 0x300, 0 }; | ||
185 | static unsigned int cs8900_irq_map[] = { QQ2440_CS8900_IRQ, 0, 0, 0 }; | ||
186 | #elif defined(CONFIG_MACH_MX31ADS) | ||
187 | #include <mach/board-mx31ads.h> | ||
188 | static unsigned int netcard_portlist[] __used __initdata = { | ||
189 | PBC_BASE_ADDRESS + PBC_CS8900A_IOBASE + 0x300, 0 | ||
190 | }; | ||
191 | static unsigned cs8900_irq_map[] = {EXPIO_INT_ENET_INT, 0, 0, 0}; | ||
192 | #else | 185 | #else |
186 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | static unsigned int netcard_portlist[] __used __initdata = | 187 | static unsigned int netcard_portlist[] __used __initdata = |
194 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; | 188 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; |
195 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; | 189 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; |
196 | #endif | 190 | #endif |
191 | #endif | ||
197 | 192 | ||
198 | #if DEBUGGING | 193 | #if DEBUGGING |
199 | static unsigned int net_debug = DEBUGGING; | 194 | static unsigned int net_debug = DEBUGGING; |
@@ -236,11 +231,16 @@ struct net_local { | |||
236 | unsigned char *end_dma_buff; /* points to the end of the buffer */ | 231 | unsigned char *end_dma_buff; /* points to the end of the buffer */ |
237 | unsigned char *rx_dma_ptr; /* points to the next packet */ | 232 | unsigned char *rx_dma_ptr; /* points to the next packet */ |
238 | #endif | 233 | #endif |
234 | #ifdef CONFIG_CS89x0_PLATFORM | ||
235 | void __iomem *virt_addr;/* Virtual address for accessing the CS89x0. */ | ||
236 | unsigned long phys_addr;/* Physical address for accessing the CS89x0. */ | ||
237 | unsigned long size; /* Length of CS89x0 memory region. */ | ||
238 | #endif | ||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* Index to functions, as function prototypes. */ | 241 | /* Index to functions, as function prototypes. */ |
242 | 242 | ||
243 | static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); | 243 | static int cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular); |
244 | static int net_open(struct net_device *dev); | 244 | static int net_open(struct net_device *dev); |
245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); | 245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); |
246 | static irqreturn_t net_interrupt(int irq, void *dev_id); | 246 | static irqreturn_t net_interrupt(int irq, void *dev_id); |
@@ -294,6 +294,7 @@ static int __init media_fn(char *str) | |||
294 | __setup("cs89x0_media=", media_fn); | 294 | __setup("cs89x0_media=", media_fn); |
295 | 295 | ||
296 | 296 | ||
297 | #ifndef CONFIG_CS89x0_PLATFORM | ||
297 | /* Check for a network adaptor of this type, and return '0' iff one exists. | 298 | /* Check for a network adaptor of this type, and return '0' iff one exists. |
298 | If dev->base_addr == 0, probe all likely locations. | 299 | If dev->base_addr == 0, probe all likely locations. |
299 | If dev->base_addr == 1, always return failure. | 300 | If dev->base_addr == 1, always return failure. |
@@ -343,6 +344,7 @@ out: | |||
343 | return ERR_PTR(err); | 344 | return ERR_PTR(err); |
344 | } | 345 | } |
345 | #endif | 346 | #endif |
347 | #endif | ||
346 | 348 | ||
347 | #if defined(CONFIG_MACH_IXDP2351) | 349 | #if defined(CONFIG_MACH_IXDP2351) |
348 | static u16 | 350 | static u16 |
@@ -504,7 +506,7 @@ static const struct net_device_ops net_ops = { | |||
504 | */ | 506 | */ |
505 | 507 | ||
506 | static int __init | 508 | static int __init |
507 | cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | 509 | cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular) |
508 | { | 510 | { |
509 | struct net_local *lp = netdev_priv(dev); | 511 | struct net_local *lp = netdev_priv(dev); |
510 | static unsigned version_printed; | 512 | static unsigned version_printed; |
@@ -529,15 +531,12 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
529 | lp->force = g_cs89x0_media__force; | 531 | lp->force = g_cs89x0_media__force; |
530 | #endif | 532 | #endif |
531 | 533 | ||
532 | #if defined(CONFIG_MACH_QQ2440) | ||
533 | lp->force |= FORCE_RJ45 | FORCE_FULL; | ||
534 | #endif | ||
535 | } | 534 | } |
536 | 535 | ||
537 | /* Grab the region so we can find another board if autoIRQ fails. */ | 536 | /* Grab the region so we can find another board if autoIRQ fails. */ |
538 | /* WTF is going on here? */ | 537 | /* WTF is going on here? */ |
539 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { | 538 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { |
540 | printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", | 539 | printk(KERN_ERR "%s: request_region(0x%lx, 0x%x) failed\n", |
541 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); | 540 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); |
542 | retval = -EBUSY; | 541 | retval = -EBUSY; |
543 | goto out1; | 542 | goto out1; |
@@ -549,7 +548,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
549 | will skip the test for the ADD_PORT. */ | 548 | will skip the test for the ADD_PORT. */ |
550 | if (ioaddr & 1) { | 549 | if (ioaddr & 1) { |
551 | if (net_debug > 1) | 550 | if (net_debug > 1) |
552 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); | 551 | printk(KERN_INFO "%s: odd ioaddr 0x%lx\n", dev->name, ioaddr); |
553 | if ((ioaddr & 2) != 2) | 552 | if ((ioaddr & 2) != 2) |
554 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { | 553 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { |
555 | printk(KERN_ERR "%s: bad signature 0x%x\n", | 554 | printk(KERN_ERR "%s: bad signature 0x%x\n", |
@@ -560,13 +559,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
560 | } | 559 | } |
561 | 560 | ||
562 | ioaddr &= ~3; | 561 | ioaddr &= ~3; |
563 | printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", | 562 | printk(KERN_DEBUG "PP_addr at %lx[%x]: 0x%x\n", |
564 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); | 563 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); |
565 | writeword(ioaddr, ADD_PORT, PP_ChipID); | 564 | writeword(ioaddr, ADD_PORT, PP_ChipID); |
566 | 565 | ||
567 | tmp = readword(ioaddr, DATA_PORT); | 566 | tmp = readword(ioaddr, DATA_PORT); |
568 | if (tmp != CHIP_EISA_ID_SIG) { | 567 | if (tmp != CHIP_EISA_ID_SIG) { |
569 | printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" | 568 | printk(KERN_DEBUG "%s: incorrect signature at %lx[%x]: 0x%x!=" |
570 | CHIP_EISA_ID_SIG_STR "\n", | 569 | CHIP_EISA_ID_SIG_STR "\n", |
571 | dev->name, ioaddr, DATA_PORT, tmp); | 570 | dev->name, ioaddr, DATA_PORT, tmp); |
572 | retval = -ENODEV; | 571 | retval = -ENODEV; |
@@ -736,8 +735,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
736 | dev->irq = i; | 735 | dev->irq = i; |
737 | } else { | 736 | } else { |
738 | i = lp->isa_config & INT_NO_MASK; | 737 | i = lp->isa_config & INT_NO_MASK; |
738 | #ifndef CONFIG_CS89x0_PLATFORM | ||
739 | if (lp->chip_type == CS8900) { | 739 | if (lp->chip_type == CS8900) { |
740 | #ifdef CONFIG_CS89x0_NONISA_IRQ | 740 | #ifdef CS89x0_NONISA_IRQ |
741 | i = cs8900_irq_map[0]; | 741 | i = cs8900_irq_map[0]; |
742 | #else | 742 | #else |
743 | /* Translate the IRQ using the IRQ mapping table. */ | 743 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -758,6 +758,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
758 | } | 758 | } |
759 | #endif | 759 | #endif |
760 | } | 760 | } |
761 | #endif | ||
761 | if (!dev->irq) | 762 | if (!dev->irq) |
762 | dev->irq = i; | 763 | dev->irq = i; |
763 | } | 764 | } |
@@ -1168,6 +1169,7 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1168 | int i; | 1169 | int i; |
1169 | 1170 | ||
1170 | if (chip_type == CS8900) { | 1171 | if (chip_type == CS8900) { |
1172 | #ifndef CONFIG_CS89x0_PLATFORM | ||
1171 | /* Search the mapping table for the corresponding IRQ pin. */ | 1173 | /* Search the mapping table for the corresponding IRQ pin. */ |
1172 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) | 1174 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) |
1173 | if (cs8900_irq_map[i] == irq) | 1175 | if (cs8900_irq_map[i] == irq) |
@@ -1175,6 +1177,10 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1175 | /* Not found */ | 1177 | /* Not found */ |
1176 | if (i == ARRAY_SIZE(cs8900_irq_map)) | 1178 | if (i == ARRAY_SIZE(cs8900_irq_map)) |
1177 | i = 3; | 1179 | i = 3; |
1180 | #else | ||
1181 | /* INTRQ0 pin is used for interrupt generation. */ | ||
1182 | i = 0; | ||
1183 | #endif | ||
1178 | writereg(dev, PP_CS8900_ISAINT, i); | 1184 | writereg(dev, PP_CS8900_ISAINT, i); |
1179 | } else { | 1185 | } else { |
1180 | writereg(dev, PP_CS8920_ISAINT, irq); | 1186 | writereg(dev, PP_CS8920_ISAINT, irq); |
@@ -1228,7 +1234,7 @@ net_open(struct net_device *dev) | |||
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | #ifndef CONFIG_CS89x0_NONISA_IRQ | 1237 | #if !defined(CS89x0_NONISA_IRQ) && !defined(CONFIG_CS89x0_PLATFORM) |
1232 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1238 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1233 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1239 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1234 | dev->name, dev->irq, lp->irq_map); | 1240 | dev->name, dev->irq, lp->irq_map); |
@@ -1746,7 +1752,7 @@ static int set_mac_address(struct net_device *dev, void *p) | |||
1746 | return 0; | 1752 | return 0; |
1747 | } | 1753 | } |
1748 | 1754 | ||
1749 | #ifdef MODULE | 1755 | #if defined(MODULE) && !defined(CONFIG_CS89x0_PLATFORM) |
1750 | 1756 | ||
1751 | static struct net_device *dev_cs89x0; | 1757 | static struct net_device *dev_cs89x0; |
1752 | 1758 | ||
@@ -1900,7 +1906,97 @@ cleanup_module(void) | |||
1900 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); | 1906 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); |
1901 | free_netdev(dev_cs89x0); | 1907 | free_netdev(dev_cs89x0); |
1902 | } | 1908 | } |
1903 | #endif /* MODULE */ | 1909 | #endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ |
1910 | |||
1911 | #ifdef CONFIG_CS89x0_PLATFORM | ||
1912 | static int __init cs89x0_platform_probe(struct platform_device *pdev) | ||
1913 | { | ||
1914 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); | ||
1915 | struct net_local *lp; | ||
1916 | struct resource *mem_res; | ||
1917 | int err; | ||
1918 | |||
1919 | if (!dev) | ||
1920 | return -ENOMEM; | ||
1921 | |||
1922 | lp = netdev_priv(dev); | ||
1923 | |||
1924 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1925 | dev->irq = platform_get_irq(pdev, 0); | ||
1926 | if (mem_res == NULL || dev->irq <= 0) { | ||
1927 | dev_warn(&dev->dev, "memory/interrupt resource missing.\n"); | ||
1928 | err = -ENXIO; | ||
1929 | goto free; | ||
1930 | } | ||
1931 | |||
1932 | lp->phys_addr = mem_res->start; | ||
1933 | lp->size = resource_size(mem_res); | ||
1934 | if (!request_mem_region(lp->phys_addr, lp->size, DRV_NAME)) { | ||
1935 | dev_warn(&dev->dev, "request_mem_region() failed.\n"); | ||
1936 | err = -EBUSY; | ||
1937 | goto free; | ||
1938 | } | ||
1939 | |||
1940 | lp->virt_addr = ioremap(lp->phys_addr, lp->size); | ||
1941 | if (!lp->virt_addr) { | ||
1942 | dev_warn(&dev->dev, "ioremap() failed.\n"); | ||
1943 | err = -ENOMEM; | ||
1944 | goto release; | ||
1945 | } | ||
1946 | |||
1947 | err = cs89x0_probe1(dev, (unsigned long)lp->virt_addr, 0); | ||
1948 | if (err) { | ||
1949 | dev_warn(&dev->dev, "no cs8900 or cs8920 detected.\n"); | ||
1950 | goto unmap; | ||
1951 | } | ||
1952 | |||
1953 | platform_set_drvdata(pdev, dev); | ||
1954 | return 0; | ||
1955 | |||
1956 | unmap: | ||
1957 | iounmap(lp->virt_addr); | ||
1958 | release: | ||
1959 | release_mem_region(lp->phys_addr, lp->size); | ||
1960 | free: | ||
1961 | free_netdev(dev); | ||
1962 | return err; | ||
1963 | } | ||
1964 | |||
1965 | static int cs89x0_platform_remove(struct platform_device *pdev) | ||
1966 | { | ||
1967 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1968 | struct net_local *lp = netdev_priv(dev); | ||
1969 | |||
1970 | unregister_netdev(dev); | ||
1971 | iounmap(lp->virt_addr); | ||
1972 | release_mem_region(lp->phys_addr, lp->size); | ||
1973 | free_netdev(dev); | ||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1977 | static struct platform_driver cs89x0_driver = { | ||
1978 | .driver = { | ||
1979 | .name = DRV_NAME, | ||
1980 | .owner = THIS_MODULE, | ||
1981 | }, | ||
1982 | .remove = cs89x0_platform_remove, | ||
1983 | }; | ||
1984 | |||
1985 | static int __init cs89x0_init(void) | ||
1986 | { | ||
1987 | return platform_driver_probe(&cs89x0_driver, cs89x0_platform_probe); | ||
1988 | } | ||
1989 | |||
1990 | module_init(cs89x0_init); | ||
1991 | |||
1992 | static void __exit cs89x0_cleanup(void) | ||
1993 | { | ||
1994 | platform_driver_unregister(&cs89x0_driver); | ||
1995 | } | ||
1996 | |||
1997 | module_exit(cs89x0_cleanup); | ||
1998 | |||
1999 | #endif /* CONFIG_CS89x0_PLATFORM */ | ||
1904 | 2000 | ||
1905 | /* | 2001 | /* |
1906 | * Local variables: | 2002 | * Local variables: |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index a229de98ae6f..36db5a441eba 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -258,14 +258,6 @@ config REGULATOR_DB8500_PRCMU | |||
258 | This driver supports the voltage domain regulators controlled by the | 258 | This driver supports the voltage domain regulators controlled by the |
259 | DB8500 PRCMU | 259 | DB8500 PRCMU |
260 | 260 | ||
261 | config REGULATOR_BQ24022 | ||
262 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" | ||
263 | help | ||
264 | This driver controls a TI bq24022 Charger attached via | ||
265 | GPIOs. The provided current regulator can enable/disable | ||
266 | charging select between 100 mA and 500 mA charging current | ||
267 | limit. | ||
268 | |||
269 | config REGULATOR_TPS6105X | 261 | config REGULATOR_TPS6105X |
270 | tristate "TI TPS6105X Power regulators" | 262 | tristate "TI TPS6105X Power regulators" |
271 | depends on TPS6105X | 263 | depends on TPS6105X |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index b5042c885d89..94b52745e957 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -16,7 +16,6 @@ obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o | |||
16 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o | 16 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o |
17 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o | 17 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o |
18 | obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o | 18 | obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o |
19 | obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o | ||
20 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o | 19 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o |
21 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o | 20 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o |
22 | obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o | 21 | obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o |
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c deleted file mode 100644 index 9fab6d1bbe80..000000000000 --- a/drivers/regulator/bq24022.c +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
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/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/gpio.h> | ||
19 | #include <linux/regulator/bq24022.h> | ||
20 | #include <linux/regulator/driver.h> | ||
21 | |||
22 | |||
23 | static int bq24022_set_current_limit(struct regulator_dev *rdev, | ||
24 | int min_uA, int max_uA) | ||
25 | { | ||
26 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
27 | |||
28 | dev_dbg(rdev_get_dev(rdev), "setting current limit to %s mA\n", | ||
29 | max_uA >= 500000 ? "500" : "100"); | ||
30 | |||
31 | /* REVISIT: maybe return error if min_uA != 0 ? */ | ||
32 | gpio_set_value(pdata->gpio_iset2, max_uA >= 500000); | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static int bq24022_get_current_limit(struct regulator_dev *rdev) | ||
37 | { | ||
38 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
39 | |||
40 | return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000; | ||
41 | } | ||
42 | |||
43 | static int bq24022_enable(struct regulator_dev *rdev) | ||
44 | { | ||
45 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
46 | |||
47 | dev_dbg(rdev_get_dev(rdev), "enabling charger\n"); | ||
48 | |||
49 | gpio_set_value(pdata->gpio_nce, 0); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int bq24022_disable(struct regulator_dev *rdev) | ||
54 | { | ||
55 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
56 | |||
57 | dev_dbg(rdev_get_dev(rdev), "disabling charger\n"); | ||
58 | |||
59 | gpio_set_value(pdata->gpio_nce, 1); | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int bq24022_is_enabled(struct regulator_dev *rdev) | ||
64 | { | ||
65 | struct bq24022_mach_info *pdata = rdev_get_drvdata(rdev); | ||
66 | |||
67 | return !gpio_get_value(pdata->gpio_nce); | ||
68 | } | ||
69 | |||
70 | static struct regulator_ops bq24022_ops = { | ||
71 | .set_current_limit = bq24022_set_current_limit, | ||
72 | .get_current_limit = bq24022_get_current_limit, | ||
73 | .enable = bq24022_enable, | ||
74 | .disable = bq24022_disable, | ||
75 | .is_enabled = bq24022_is_enabled, | ||
76 | }; | ||
77 | |||
78 | static struct regulator_desc bq24022_desc = { | ||
79 | .name = "bq24022", | ||
80 | .ops = &bq24022_ops, | ||
81 | .type = REGULATOR_CURRENT, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init bq24022_probe(struct platform_device *pdev) | ||
86 | { | ||
87 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
88 | struct regulator_dev *bq24022; | ||
89 | int ret; | ||
90 | |||
91 | if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2) | ||
92 | return -EINVAL; | ||
93 | |||
94 | ret = gpio_request(pdata->gpio_nce, "ncharge_en"); | ||
95 | if (ret) { | ||
96 | dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n", | ||
97 | pdata->gpio_nce); | ||
98 | goto err_ce; | ||
99 | } | ||
100 | ret = gpio_request(pdata->gpio_iset2, "charge_mode"); | ||
101 | if (ret) { | ||
102 | dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n", | ||
103 | pdata->gpio_iset2); | ||
104 | goto err_iset2; | ||
105 | } | ||
106 | ret = gpio_direction_output(pdata->gpio_iset2, 0); | ||
107 | ret = gpio_direction_output(pdata->gpio_nce, 1); | ||
108 | |||
109 | bq24022 = regulator_register(&bq24022_desc, &pdev->dev, | ||
110 | pdata->init_data, pdata, NULL); | ||
111 | if (IS_ERR(bq24022)) { | ||
112 | dev_dbg(&pdev->dev, "couldn't register regulator\n"); | ||
113 | ret = PTR_ERR(bq24022); | ||
114 | goto err_reg; | ||
115 | } | ||
116 | platform_set_drvdata(pdev, bq24022); | ||
117 | dev_dbg(&pdev->dev, "registered regulator\n"); | ||
118 | |||
119 | return 0; | ||
120 | err_reg: | ||
121 | gpio_free(pdata->gpio_iset2); | ||
122 | err_iset2: | ||
123 | gpio_free(pdata->gpio_nce); | ||
124 | err_ce: | ||
125 | return ret; | ||
126 | } | ||
127 | |||
128 | static int __devexit bq24022_remove(struct platform_device *pdev) | ||
129 | { | ||
130 | struct bq24022_mach_info *pdata = pdev->dev.platform_data; | ||
131 | struct regulator_dev *bq24022 = platform_get_drvdata(pdev); | ||
132 | |||
133 | regulator_unregister(bq24022); | ||
134 | gpio_free(pdata->gpio_iset2); | ||
135 | gpio_free(pdata->gpio_nce); | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static struct platform_driver bq24022_driver = { | ||
141 | .driver = { | ||
142 | .name = "bq24022", | ||
143 | }, | ||
144 | .remove = __devexit_p(bq24022_remove), | ||
145 | }; | ||
146 | |||
147 | static int __init bq24022_init(void) | ||
148 | { | ||
149 | return platform_driver_probe(&bq24022_driver, bq24022_probe); | ||
150 | } | ||
151 | |||
152 | static void __exit bq24022_exit(void) | ||
153 | { | ||
154 | platform_driver_unregister(&bq24022_driver); | ||
155 | } | ||
156 | |||
157 | module_init(bq24022_init); | ||
158 | module_exit(bq24022_exit); | ||
159 | |||
160 | MODULE_AUTHOR("Philipp Zabel"); | ||
161 | MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver"); | ||
162 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 4768a9d28375..8c8377d50c4c 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -780,8 +780,8 @@ config RTC_DRV_EP93XX | |||
780 | will be called rtc-ep93xx. | 780 | will be called rtc-ep93xx. |
781 | 781 | ||
782 | config RTC_DRV_SA1100 | 782 | config RTC_DRV_SA1100 |
783 | tristate "SA11x0/PXA2xx" | 783 | tristate "SA11x0/PXA2xx/PXA910" |
784 | depends on ARCH_SA1100 || ARCH_PXA | 784 | depends on ARCH_SA1100 || ARCH_PXA || ARCH_MMP |
785 | help | 785 | help |
786 | If you say Y here you will get access to the real time clock | 786 | If you say Y here you will get access to the real time clock |
787 | built into your SA11x0 or PXA2xx CPU. | 787 | built into your SA11x0 or PXA2xx CPU. |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index c543f6f1eec2..9ccea134a996 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | enum s3c_cpu_type { | 36 | enum s3c_cpu_type { |
37 | TYPE_S3C2410, | 37 | TYPE_S3C2410, |
38 | TYPE_S3C2416, | ||
39 | TYPE_S3C2443, | ||
38 | TYPE_S3C64XX, | 40 | TYPE_S3C64XX, |
39 | }; | 41 | }; |
40 | 42 | ||
@@ -132,6 +134,7 @@ static int s3c_rtc_setfreq(struct device *dev, int freq) | |||
132 | struct platform_device *pdev = to_platform_device(dev); | 134 | struct platform_device *pdev = to_platform_device(dev); |
133 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | 135 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); |
134 | unsigned int tmp = 0; | 136 | unsigned int tmp = 0; |
137 | int val; | ||
135 | 138 | ||
136 | if (!is_power_of_2(freq)) | 139 | if (!is_power_of_2(freq)) |
137 | return -EINVAL; | 140 | return -EINVAL; |
@@ -139,12 +142,22 @@ static int s3c_rtc_setfreq(struct device *dev, int freq) | |||
139 | clk_enable(rtc_clk); | 142 | clk_enable(rtc_clk); |
140 | spin_lock_irq(&s3c_rtc_pie_lock); | 143 | spin_lock_irq(&s3c_rtc_pie_lock); |
141 | 144 | ||
142 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { | 145 | if (s3c_rtc_cpu_type != TYPE_S3C64XX) { |
143 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); | 146 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); |
144 | tmp &= S3C2410_TICNT_ENABLE; | 147 | tmp &= S3C2410_TICNT_ENABLE; |
145 | } | 148 | } |
146 | 149 | ||
147 | tmp |= (rtc_dev->max_user_freq / freq)-1; | 150 | val = (rtc_dev->max_user_freq / freq) - 1; |
151 | |||
152 | if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { | ||
153 | tmp |= S3C2443_TICNT_PART(val); | ||
154 | writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1); | ||
155 | |||
156 | if (s3c_rtc_cpu_type == TYPE_S3C2416) | ||
157 | writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2); | ||
158 | } else { | ||
159 | tmp |= val; | ||
160 | } | ||
148 | 161 | ||
149 | writel(tmp, s3c_rtc_base + S3C2410_TICNT); | 162 | writel(tmp, s3c_rtc_base + S3C2410_TICNT); |
150 | spin_unlock_irq(&s3c_rtc_pie_lock); | 163 | spin_unlock_irq(&s3c_rtc_pie_lock); |
@@ -371,7 +384,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) | |||
371 | tmp &= ~S3C2410_RTCCON_RTCEN; | 384 | tmp &= ~S3C2410_RTCCON_RTCEN; |
372 | writew(tmp, base + S3C2410_RTCCON); | 385 | writew(tmp, base + S3C2410_RTCCON); |
373 | 386 | ||
374 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { | 387 | if (s3c_rtc_cpu_type != TYPE_S3C64XX) { |
375 | tmp = readb(base + S3C2410_TICNT); | 388 | tmp = readb(base + S3C2410_TICNT); |
376 | tmp &= ~S3C2410_TICNT_ENABLE; | 389 | tmp &= ~S3C2410_TICNT_ENABLE; |
377 | writeb(tmp, base + S3C2410_TICNT); | 390 | writeb(tmp, base + S3C2410_TICNT); |
@@ -428,12 +441,27 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
428 | return 0; | 441 | return 0; |
429 | } | 442 | } |
430 | 443 | ||
444 | static const struct of_device_id s3c_rtc_dt_match[]; | ||
445 | |||
446 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | ||
447 | { | ||
448 | #ifdef CONFIG_OF | ||
449 | if (pdev->dev.of_node) { | ||
450 | const struct of_device_id *match; | ||
451 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | ||
452 | return match->data; | ||
453 | } | ||
454 | #endif | ||
455 | return platform_get_device_id(pdev)->driver_data; | ||
456 | } | ||
457 | |||
431 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) | 458 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) |
432 | { | 459 | { |
433 | struct rtc_device *rtc; | 460 | struct rtc_device *rtc; |
434 | struct rtc_time rtc_tm; | 461 | struct rtc_time rtc_tm; |
435 | struct resource *res; | 462 | struct resource *res; |
436 | int ret; | 463 | int ret; |
464 | int tmp; | ||
437 | 465 | ||
438 | pr_debug("%s: probe=%p\n", __func__, pdev); | 466 | pr_debug("%s: probe=%p\n", __func__, pdev); |
439 | 467 | ||
@@ -508,13 +536,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
508 | goto err_nortc; | 536 | goto err_nortc; |
509 | } | 537 | } |
510 | 538 | ||
511 | #ifdef CONFIG_OF | 539 | s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev); |
512 | if (pdev->dev.of_node) | ||
513 | s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, | ||
514 | "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; | ||
515 | else | ||
516 | #endif | ||
517 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
518 | 540 | ||
519 | /* Check RTC Time */ | 541 | /* Check RTC Time */ |
520 | 542 | ||
@@ -533,11 +555,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
533 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); | 555 | dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); |
534 | } | 556 | } |
535 | 557 | ||
536 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) | 558 | if (s3c_rtc_cpu_type != TYPE_S3C2410) |
537 | rtc->max_user_freq = 32768; | 559 | rtc->max_user_freq = 32768; |
538 | else | 560 | else |
539 | rtc->max_user_freq = 128; | 561 | rtc->max_user_freq = 128; |
540 | 562 | ||
563 | if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) { | ||
564 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | ||
565 | tmp |= S3C2443_RTCCON_TICSEL; | ||
566 | writew(tmp, s3c_rtc_base + S3C2410_RTCCON); | ||
567 | } | ||
568 | |||
541 | platform_set_drvdata(pdev, rtc); | 569 | platform_set_drvdata(pdev, rtc); |
542 | 570 | ||
543 | s3c_rtc_setfreq(&pdev->dev, 1); | 571 | s3c_rtc_setfreq(&pdev->dev, 1); |
@@ -638,8 +666,19 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
638 | 666 | ||
639 | #ifdef CONFIG_OF | 667 | #ifdef CONFIG_OF |
640 | static const struct of_device_id s3c_rtc_dt_match[] = { | 668 | static const struct of_device_id s3c_rtc_dt_match[] = { |
641 | { .compatible = "samsung,s3c2410-rtc" }, | 669 | { |
642 | { .compatible = "samsung,s3c6410-rtc" }, | 670 | .compatible = "samsung,s3c2410-rtc" |
671 | .data = TYPE_S3C2410, | ||
672 | }, { | ||
673 | .compatible = "samsung,s3c2416-rtc" | ||
674 | .data = TYPE_S3C2416, | ||
675 | }, { | ||
676 | .compatible = "samsung,s3c2443-rtc" | ||
677 | .data = TYPE_S3C2443, | ||
678 | }, { | ||
679 | .compatible = "samsung,s3c6410-rtc" | ||
680 | .data = TYPE_S3C64XX, | ||
681 | }, | ||
643 | {}, | 682 | {}, |
644 | }; | 683 | }; |
645 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); | 684 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); |
@@ -652,6 +691,12 @@ static struct platform_device_id s3c_rtc_driver_ids[] = { | |||
652 | .name = "s3c2410-rtc", | 691 | .name = "s3c2410-rtc", |
653 | .driver_data = TYPE_S3C2410, | 692 | .driver_data = TYPE_S3C2410, |
654 | }, { | 693 | }, { |
694 | .name = "s3c2416-rtc", | ||
695 | .driver_data = TYPE_S3C2416, | ||
696 | }, { | ||
697 | .name = "s3c2443-rtc", | ||
698 | .driver_data = TYPE_S3C2443, | ||
699 | }, { | ||
655 | .name = "s3c64xx-rtc", | 700 | .name = "s3c64xx-rtc", |
656 | .driver_data = TYPE_S3C64XX, | 701 | .driver_data = TYPE_S3C64XX, |
657 | }, | 702 | }, |
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 44cd81c72ea1..fa512ed42017 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c | |||
@@ -23,35 +23,44 @@ | |||
23 | 23 | ||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/clk.h> | ||
26 | #include <linux/rtc.h> | 27 | #include <linux/rtc.h> |
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
29 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/slab.h> | ||
30 | #include <linux/string.h> | 32 | #include <linux/string.h> |
33 | #include <linux/of.h> | ||
31 | #include <linux/pm.h> | 34 | #include <linux/pm.h> |
32 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
33 | 36 | ||
34 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
35 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
36 | 39 | ||
37 | #ifdef CONFIG_ARCH_PXA | 40 | #if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP) |
38 | #include <mach/regs-rtc.h> | 41 | #include <mach/regs-rtc.h> |
39 | #endif | 42 | #endif |
40 | 43 | ||
41 | #define RTC_DEF_DIVIDER (32768 - 1) | 44 | #define RTC_DEF_DIVIDER (32768 - 1) |
42 | #define RTC_DEF_TRIM 0 | 45 | #define RTC_DEF_TRIM 0 |
43 | 46 | #define RTC_FREQ 1024 | |
44 | static const unsigned long RTC_FREQ = 1024; | 47 | |
45 | static DEFINE_SPINLOCK(sa1100_rtc_lock); | 48 | struct sa1100_rtc { |
49 | spinlock_t lock; | ||
50 | int irq_1hz; | ||
51 | int irq_alarm; | ||
52 | struct rtc_device *rtc; | ||
53 | struct clk *clk; | ||
54 | }; | ||
46 | 55 | ||
47 | static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) | 56 | static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) |
48 | { | 57 | { |
49 | struct platform_device *pdev = to_platform_device(dev_id); | 58 | struct sa1100_rtc *info = dev_get_drvdata(dev_id); |
50 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 59 | struct rtc_device *rtc = info->rtc; |
51 | unsigned int rtsr; | 60 | unsigned int rtsr; |
52 | unsigned long events = 0; | 61 | unsigned long events = 0; |
53 | 62 | ||
54 | spin_lock(&sa1100_rtc_lock); | 63 | spin_lock(&info->lock); |
55 | 64 | ||
56 | rtsr = RTSR; | 65 | rtsr = RTSR; |
57 | /* clear interrupt sources */ | 66 | /* clear interrupt sources */ |
@@ -87,26 +96,28 @@ static irqreturn_t sa1100_rtc_interrupt(int irq, void *dev_id) | |||
87 | 96 | ||
88 | rtc_update_irq(rtc, 1, events); | 97 | rtc_update_irq(rtc, 1, events); |
89 | 98 | ||
90 | spin_unlock(&sa1100_rtc_lock); | 99 | spin_unlock(&info->lock); |
91 | 100 | ||
92 | return IRQ_HANDLED; | 101 | return IRQ_HANDLED; |
93 | } | 102 | } |
94 | 103 | ||
95 | static int sa1100_rtc_open(struct device *dev) | 104 | static int sa1100_rtc_open(struct device *dev) |
96 | { | 105 | { |
106 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
107 | struct rtc_device *rtc = info->rtc; | ||
97 | int ret; | 108 | int ret; |
98 | struct platform_device *plat_dev = to_platform_device(dev); | ||
99 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); | ||
100 | 109 | ||
101 | ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); | 110 | ret = clk_prepare_enable(info->clk); |
111 | if (ret) | ||
112 | goto fail_clk; | ||
113 | ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); | ||
102 | if (ret) { | 114 | if (ret) { |
103 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); | 115 | dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz); |
104 | goto fail_ui; | 116 | goto fail_ui; |
105 | } | 117 | } |
106 | ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, 0, | 118 | ret = request_irq(info->irq_alarm, sa1100_rtc_interrupt, 0, "rtc Alrm", dev); |
107 | "rtc Alrm", dev); | ||
108 | if (ret) { | 119 | if (ret) { |
109 | dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); | 120 | dev_err(dev, "IRQ %d already in use.\n", info->irq_alarm); |
110 | goto fail_ai; | 121 | goto fail_ai; |
111 | } | 122 | } |
112 | rtc->max_user_freq = RTC_FREQ; | 123 | rtc->max_user_freq = RTC_FREQ; |
@@ -115,29 +126,36 @@ static int sa1100_rtc_open(struct device *dev) | |||
115 | return 0; | 126 | return 0; |
116 | 127 | ||
117 | fail_ai: | 128 | fail_ai: |
118 | free_irq(IRQ_RTC1Hz, dev); | 129 | free_irq(info->irq_1hz, dev); |
119 | fail_ui: | 130 | fail_ui: |
131 | clk_disable_unprepare(info->clk); | ||
132 | fail_clk: | ||
120 | return ret; | 133 | return ret; |
121 | } | 134 | } |
122 | 135 | ||
123 | static void sa1100_rtc_release(struct device *dev) | 136 | static void sa1100_rtc_release(struct device *dev) |
124 | { | 137 | { |
125 | spin_lock_irq(&sa1100_rtc_lock); | 138 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
139 | |||
140 | spin_lock_irq(&info->lock); | ||
126 | RTSR = 0; | 141 | RTSR = 0; |
127 | spin_unlock_irq(&sa1100_rtc_lock); | 142 | spin_unlock_irq(&info->lock); |
128 | 143 | ||
129 | free_irq(IRQ_RTCAlrm, dev); | 144 | free_irq(info->irq_alarm, dev); |
130 | free_irq(IRQ_RTC1Hz, dev); | 145 | free_irq(info->irq_1hz, dev); |
146 | clk_disable_unprepare(info->clk); | ||
131 | } | 147 | } |
132 | 148 | ||
133 | static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | 149 | static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
134 | { | 150 | { |
135 | spin_lock_irq(&sa1100_rtc_lock); | 151 | struct sa1100_rtc *info = dev_get_drvdata(dev); |
152 | |||
153 | spin_lock_irq(&info->lock); | ||
136 | if (enabled) | 154 | if (enabled) |
137 | RTSR |= RTSR_ALE; | 155 | RTSR |= RTSR_ALE; |
138 | else | 156 | else |
139 | RTSR &= ~RTSR_ALE; | 157 | RTSR &= ~RTSR_ALE; |
140 | spin_unlock_irq(&sa1100_rtc_lock); | 158 | spin_unlock_irq(&info->lock); |
141 | return 0; | 159 | return 0; |
142 | } | 160 | } |
143 | 161 | ||
@@ -170,10 +188,11 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
170 | 188 | ||
171 | static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | 189 | static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
172 | { | 190 | { |
191 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
173 | unsigned long time; | 192 | unsigned long time; |
174 | int ret; | 193 | int ret; |
175 | 194 | ||
176 | spin_lock_irq(&sa1100_rtc_lock); | 195 | spin_lock_irq(&info->lock); |
177 | ret = rtc_tm_to_time(&alrm->time, &time); | 196 | ret = rtc_tm_to_time(&alrm->time, &time); |
178 | if (ret != 0) | 197 | if (ret != 0) |
179 | goto out; | 198 | goto out; |
@@ -184,7 +203,7 @@ static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
184 | else | 203 | else |
185 | RTSR &= ~RTSR_ALE; | 204 | RTSR &= ~RTSR_ALE; |
186 | out: | 205 | out: |
187 | spin_unlock_irq(&sa1100_rtc_lock); | 206 | spin_unlock_irq(&info->lock); |
188 | 207 | ||
189 | return ret; | 208 | return ret; |
190 | } | 209 | } |
@@ -211,6 +230,27 @@ static const struct rtc_class_ops sa1100_rtc_ops = { | |||
211 | static int sa1100_rtc_probe(struct platform_device *pdev) | 230 | static int sa1100_rtc_probe(struct platform_device *pdev) |
212 | { | 231 | { |
213 | struct rtc_device *rtc; | 232 | struct rtc_device *rtc; |
233 | struct sa1100_rtc *info; | ||
234 | int irq_1hz, irq_alarm, ret = 0; | ||
235 | |||
236 | irq_1hz = platform_get_irq_byname(pdev, "rtc 1Hz"); | ||
237 | irq_alarm = platform_get_irq_byname(pdev, "rtc alarm"); | ||
238 | if (irq_1hz < 0 || irq_alarm < 0) | ||
239 | return -ENODEV; | ||
240 | |||
241 | info = kzalloc(sizeof(struct sa1100_rtc), GFP_KERNEL); | ||
242 | if (!info) | ||
243 | return -ENOMEM; | ||
244 | info->clk = clk_get(&pdev->dev, NULL); | ||
245 | if (IS_ERR(info->clk)) { | ||
246 | dev_err(&pdev->dev, "failed to find rtc clock source\n"); | ||
247 | ret = PTR_ERR(info->clk); | ||
248 | goto err_clk; | ||
249 | } | ||
250 | info->irq_1hz = irq_1hz; | ||
251 | info->irq_alarm = irq_alarm; | ||
252 | spin_lock_init(&info->lock); | ||
253 | platform_set_drvdata(pdev, info); | ||
214 | 254 | ||
215 | /* | 255 | /* |
216 | * According to the manual we should be able to let RTTR be zero | 256 | * According to the manual we should be able to let RTTR be zero |
@@ -232,10 +272,11 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
232 | rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, | 272 | rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops, |
233 | THIS_MODULE); | 273 | THIS_MODULE); |
234 | 274 | ||
235 | if (IS_ERR(rtc)) | 275 | if (IS_ERR(rtc)) { |
236 | return PTR_ERR(rtc); | 276 | ret = PTR_ERR(rtc); |
237 | 277 | goto err_dev; | |
238 | platform_set_drvdata(pdev, rtc); | 278 | } |
279 | info->rtc = rtc; | ||
239 | 280 | ||
240 | /* Fix for a nasty initialization problem the in SA11xx RTSR register. | 281 | /* Fix for a nasty initialization problem the in SA11xx RTSR register. |
241 | * See also the comments in sa1100_rtc_interrupt(). | 282 | * See also the comments in sa1100_rtc_interrupt(). |
@@ -262,14 +303,24 @@ static int sa1100_rtc_probe(struct platform_device *pdev) | |||
262 | RTSR = RTSR_AL | RTSR_HZ; | 303 | RTSR = RTSR_AL | RTSR_HZ; |
263 | 304 | ||
264 | return 0; | 305 | return 0; |
306 | err_dev: | ||
307 | platform_set_drvdata(pdev, NULL); | ||
308 | clk_put(info->clk); | ||
309 | err_clk: | ||
310 | kfree(info); | ||
311 | return ret; | ||
265 | } | 312 | } |
266 | 313 | ||
267 | static int sa1100_rtc_remove(struct platform_device *pdev) | 314 | static int sa1100_rtc_remove(struct platform_device *pdev) |
268 | { | 315 | { |
269 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 316 | struct sa1100_rtc *info = platform_get_drvdata(pdev); |
270 | 317 | ||
271 | if (rtc) | 318 | if (info) { |
272 | rtc_device_unregister(rtc); | 319 | rtc_device_unregister(info->rtc); |
320 | clk_put(info->clk); | ||
321 | platform_set_drvdata(pdev, NULL); | ||
322 | kfree(info); | ||
323 | } | ||
273 | 324 | ||
274 | return 0; | 325 | return 0; |
275 | } | 326 | } |
@@ -277,15 +328,17 @@ static int sa1100_rtc_remove(struct platform_device *pdev) | |||
277 | #ifdef CONFIG_PM | 328 | #ifdef CONFIG_PM |
278 | static int sa1100_rtc_suspend(struct device *dev) | 329 | static int sa1100_rtc_suspend(struct device *dev) |
279 | { | 330 | { |
331 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
280 | if (device_may_wakeup(dev)) | 332 | if (device_may_wakeup(dev)) |
281 | enable_irq_wake(IRQ_RTCAlrm); | 333 | enable_irq_wake(info->irq_alarm); |
282 | return 0; | 334 | return 0; |
283 | } | 335 | } |
284 | 336 | ||
285 | static int sa1100_rtc_resume(struct device *dev) | 337 | static int sa1100_rtc_resume(struct device *dev) |
286 | { | 338 | { |
339 | struct sa1100_rtc *info = dev_get_drvdata(dev); | ||
287 | if (device_may_wakeup(dev)) | 340 | if (device_may_wakeup(dev)) |
288 | disable_irq_wake(IRQ_RTCAlrm); | 341 | disable_irq_wake(info->irq_alarm); |
289 | return 0; | 342 | return 0; |
290 | } | 343 | } |
291 | 344 | ||
@@ -295,6 +348,13 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = { | |||
295 | }; | 348 | }; |
296 | #endif | 349 | #endif |
297 | 350 | ||
351 | static struct of_device_id sa1100_rtc_dt_ids[] = { | ||
352 | { .compatible = "mrvl,sa1100-rtc", }, | ||
353 | { .compatible = "mrvl,mmp-rtc", }, | ||
354 | {} | ||
355 | }; | ||
356 | MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids); | ||
357 | |||
298 | static struct platform_driver sa1100_rtc_driver = { | 358 | static struct platform_driver sa1100_rtc_driver = { |
299 | .probe = sa1100_rtc_probe, | 359 | .probe = sa1100_rtc_probe, |
300 | .remove = sa1100_rtc_remove, | 360 | .remove = sa1100_rtc_remove, |
@@ -303,6 +363,7 @@ static struct platform_driver sa1100_rtc_driver = { | |||
303 | #ifdef CONFIG_PM | 363 | #ifdef CONFIG_PM |
304 | .pm = &sa1100_rtc_pm_ops, | 364 | .pm = &sa1100_rtc_pm_ops, |
305 | #endif | 365 | #endif |
366 | .of_match_table = sa1100_rtc_dt_ids, | ||
306 | }, | 367 | }, |
307 | }; | 368 | }; |
308 | 369 | ||
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 0b7fed746b27..e7feceeebc2f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1508,7 +1508,7 @@ static int serial_imx_probe(struct platform_device *pdev) | |||
1508 | ret = PTR_ERR(sport->clk); | 1508 | ret = PTR_ERR(sport->clk); |
1509 | goto unmap; | 1509 | goto unmap; |
1510 | } | 1510 | } |
1511 | clk_enable(sport->clk); | 1511 | clk_prepare_enable(sport->clk); |
1512 | 1512 | ||
1513 | sport->port.uartclk = clk_get_rate(sport->clk); | 1513 | sport->port.uartclk = clk_get_rate(sport->clk); |
1514 | 1514 | ||
@@ -1531,8 +1531,8 @@ deinit: | |||
1531 | if (pdata && pdata->exit) | 1531 | if (pdata && pdata->exit) |
1532 | pdata->exit(pdev); | 1532 | pdata->exit(pdev); |
1533 | clkput: | 1533 | clkput: |
1534 | clk_disable_unprepare(sport->clk); | ||
1534 | clk_put(sport->clk); | 1535 | clk_put(sport->clk); |
1535 | clk_disable(sport->clk); | ||
1536 | unmap: | 1536 | unmap: |
1537 | iounmap(sport->port.membase); | 1537 | iounmap(sport->port.membase); |
1538 | free: | 1538 | free: |
@@ -1552,11 +1552,10 @@ static int serial_imx_remove(struct platform_device *pdev) | |||
1552 | 1552 | ||
1553 | if (sport) { | 1553 | if (sport) { |
1554 | uart_remove_one_port(&imx_reg, &sport->port); | 1554 | uart_remove_one_port(&imx_reg, &sport->port); |
1555 | clk_disable_unprepare(sport->clk); | ||
1555 | clk_put(sport->clk); | 1556 | clk_put(sport->clk); |
1556 | } | 1557 | } |
1557 | 1558 | ||
1558 | clk_disable(sport->clk); | ||
1559 | |||
1560 | if (pdata && pdata->exit) | 1559 | if (pdata && pdata->exit) |
1561 | pdata->exit(pdev); | 1560 | pdata->exit(pdev); |
1562 | 1561 | ||
diff --git a/include/linux/platform_data/tegra_emc.h b/include/linux/platform_data/tegra_emc.h new file mode 100644 index 000000000000..df67505e98f8 --- /dev/null +++ b/include/linux/platform_data/tegra_emc.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * Olof Johansson <olof@lixom.net> | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __TEGRA_EMC_H_ | ||
20 | #define __TEGRA_EMC_H_ | ||
21 | |||
22 | #define TEGRA_EMC_NUM_REGS 46 | ||
23 | |||
24 | struct tegra_emc_table { | ||
25 | unsigned long rate; | ||
26 | u32 regs[TEGRA_EMC_NUM_REGS]; | ||
27 | }; | ||
28 | |||
29 | struct tegra_emc_pdata { | ||
30 | int num_tables; | ||
31 | struct tegra_emc_table *tables; | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h deleted file mode 100644 index a6d014005d49..000000000000 --- a/include/linux/regulator/bq24022.h +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /* | ||
2 | * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater) | ||
3 | * 1-Cell Li-Ion Charger connected via GPIOs. | ||
4 | * | ||
5 | * Copyright (c) 2008 Philipp Zabel | ||
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 | struct regulator_init_data; | ||
14 | |||
15 | /** | ||
16 | * bq24022_mach_info - platform data for bq24022 | ||
17 | * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging | ||
18 | * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA | ||
19 | */ | ||
20 | struct bq24022_mach_info { | ||
21 | int gpio_nce; | ||
22 | int gpio_iset2; | ||
23 | struct regulator_init_data *init_data; | ||
24 | }; | ||
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c index a839494c5ea8..601df809a26a 100644 --- a/sound/soc/imx/imx-audmux.c +++ b/sound/soc/imx/imx-audmux.c | |||
@@ -80,13 +80,13 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
80 | return -ENOMEM; | 80 | return -ENOMEM; |
81 | 81 | ||
82 | if (audmux_clk) | 82 | if (audmux_clk) |
83 | clk_enable(audmux_clk); | 83 | clk_prepare_enable(audmux_clk); |
84 | 84 | ||
85 | ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); | 85 | ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); |
86 | pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); | 86 | pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); |
87 | 87 | ||
88 | if (audmux_clk) | 88 | if (audmux_clk) |
89 | clk_disable(audmux_clk); | 89 | clk_disable_unprepare(audmux_clk); |
90 | 90 | ||
91 | ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", | 91 | ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", |
92 | pdcr, ptcr); | 92 | pdcr, ptcr); |
@@ -237,13 +237,13 @@ int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr, | |||
237 | return -ENOSYS; | 237 | return -ENOSYS; |
238 | 238 | ||
239 | if (audmux_clk) | 239 | if (audmux_clk) |
240 | clk_enable(audmux_clk); | 240 | clk_prepare_enable(audmux_clk); |
241 | 241 | ||
242 | writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port)); | 242 | writel(ptcr, audmux_base + IMX_AUDMUX_V2_PTCR(port)); |
243 | writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port)); | 243 | writel(pdcr, audmux_base + IMX_AUDMUX_V2_PDCR(port)); |
244 | 244 | ||
245 | if (audmux_clk) | 245 | if (audmux_clk) |
246 | clk_disable(audmux_clk); | 246 | clk_disable_unprepare(audmux_clk); |
247 | 247 | ||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |