diff options
author | Arnd Bergmann <arnd@arndb.de> | 2013-05-06 17:43:45 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2013-05-06 17:43:45 -0400 |
commit | 442a33ebce9e02a2dd6662f16c9f2aad834d0115 (patch) | |
tree | ca8654a286f61da917318645cab9e061095ecdba | |
parent | a94d236dc355f374857ee4e6e78b7dec8a0f29e3 (diff) | |
parent | f31c2f1c68aff83277eddc6798adf3438e9c680a (diff) |
Merge branch 'late/clksrc' into late/cleanup
There is no reason to keep the clksrc cleanups separate from the
other cleanups, and this resolves some merge conflicts.
Conflicts:
arch/arm/mach-spear/spear13xx.c
drivers/irqchip/Makefile
353 files changed, 15263 insertions, 4947 deletions
diff --git a/Documentation/arm/sunxi/clocks.txt b/Documentation/arm/sunxi/clocks.txt new file mode 100644 index 000000000000..e09a88aa3136 --- /dev/null +++ b/Documentation/arm/sunxi/clocks.txt | |||
@@ -0,0 +1,56 @@ | |||
1 | Frequently asked questions about the sunxi clock system | ||
2 | ======================================================= | ||
3 | |||
4 | This document contains useful bits of information that people tend to ask | ||
5 | about the sunxi clock system, as well as accompanying ASCII art when adequate. | ||
6 | |||
7 | Q: Why is the main 24MHz oscillator gatable? Wouldn't that break the | ||
8 | system? | ||
9 | |||
10 | A: The 24MHz oscillator allows gating to save power. Indeed, if gated | ||
11 | carelessly the system would stop functioning, but with the right | ||
12 | steps, one can gate it and keep the system running. Consider this | ||
13 | simplified suspend example: | ||
14 | |||
15 | While the system is operational, you would see something like | ||
16 | |||
17 | 24MHz 32kHz | ||
18 | | | ||
19 | PLL1 | ||
20 | \ | ||
21 | \_ CPU Mux | ||
22 | | | ||
23 | [CPU] | ||
24 | |||
25 | When you are about to suspend, you switch the CPU Mux to the 32kHz | ||
26 | oscillator: | ||
27 | |||
28 | 24Mhz 32kHz | ||
29 | | | | ||
30 | PLL1 | | ||
31 | / | ||
32 | CPU Mux _/ | ||
33 | | | ||
34 | [CPU] | ||
35 | |||
36 | Finally you can gate the main oscillator | ||
37 | |||
38 | 32kHz | ||
39 | | | ||
40 | | | ||
41 | / | ||
42 | CPU Mux _/ | ||
43 | | | ||
44 | [CPU] | ||
45 | |||
46 | Q: Were can I learn more about the sunxi clocks? | ||
47 | |||
48 | A: The linux-sunxi wiki contains a page documenting the clock registers, | ||
49 | you can find it at | ||
50 | |||
51 | http://linux-sunxi.org/A10/CCM | ||
52 | |||
53 | The authoritative source for information at this time is the ccmu driver | ||
54 | released by Allwinner, you can find it at | ||
55 | |||
56 | https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.0/arch/arm/mach-sun4i/clock/ccmu | ||
diff --git a/Documentation/clk.txt b/Documentation/clk.txt index 1943fae014fd..4274a546eb57 100644 --- a/Documentation/clk.txt +++ b/Documentation/clk.txt | |||
@@ -174,9 +174,9 @@ int clk_foo_enable(struct clk_hw *hw) | |||
174 | }; | 174 | }; |
175 | 175 | ||
176 | Below is a matrix detailing which clk_ops are mandatory based upon the | 176 | Below is a matrix detailing which clk_ops are mandatory based upon the |
177 | hardware capbilities of that clock. A cell marked as "y" means | 177 | hardware capabilities of that clock. A cell marked as "y" means |
178 | mandatory, a cell marked as "n" implies that either including that | 178 | mandatory, a cell marked as "n" implies that either including that |
179 | callback is invalid or otherwise uneccesary. Empty cells are either | 179 | callback is invalid or otherwise unnecessary. Empty cells are either |
180 | optional or must be evaluated on a case-by-case basis. | 180 | optional or must be evaluated on a case-by-case basis. |
181 | 181 | ||
182 | clock hardware characteristics | 182 | clock hardware characteristics |
diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt index b5846e21cc2e..1608a54e90e1 100644 --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-pmc.txt | |||
@@ -1,19 +1,84 @@ | |||
1 | NVIDIA Tegra Power Management Controller (PMC) | 1 | NVIDIA Tegra Power Management Controller (PMC) |
2 | 2 | ||
3 | Properties: | 3 | The PMC block interacts with an external Power Management Unit. The PMC |
4 | mostly controls the entry and exit of the system from different sleep | ||
5 | modes. It provides power-gating controllers for SoC and CPU power-islands. | ||
6 | |||
7 | Required properties: | ||
4 | - name : Should be pmc | 8 | - name : Should be pmc |
5 | - compatible : Should contain "nvidia,tegra<chip>-pmc". | 9 | - compatible : Should contain "nvidia,tegra<chip>-pmc". |
6 | - reg : Offset and length of the register set for the device | 10 | - reg : Offset and length of the register set for the device |
11 | - clocks : Must contain an entry for each entry in clock-names. | ||
12 | - clock-names : Must include the following entries: | ||
13 | "pclk" (The Tegra clock of that name), | ||
14 | "clk32k_in" (The 32KHz clock input to Tegra). | ||
15 | |||
16 | Optional properties: | ||
7 | - nvidia,invert-interrupt : If present, inverts the PMU interrupt signal. | 17 | - nvidia,invert-interrupt : If present, inverts the PMU interrupt signal. |
8 | The PMU is an external Power Management Unit, whose interrupt output | 18 | 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 | 19 | 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 | 20 | fed into the ARM GIC. The PMC is not involved in the detection or |
11 | handling of this interrupt signal, merely its inversion. | 21 | handling of this interrupt signal, merely its inversion. |
22 | - nvidia,suspend-mode : The suspend mode that the platform should use. | ||
23 | Valid values are 0, 1 and 2: | ||
24 | 0 (LP0): CPU + Core voltage off and DRAM in self-refresh | ||
25 | 1 (LP1): CPU voltage off and DRAM in self-refresh | ||
26 | 2 (LP2): CPU voltage off | ||
27 | - nvidia,core-power-req-active-high : Boolean, core power request active-high | ||
28 | - nvidia,sys-clock-req-active-high : Boolean, system clock request active-high | ||
29 | - nvidia,combined-power-req : Boolean, combined power request for CPU & Core | ||
30 | - nvidia,cpu-pwr-good-en : Boolean, CPU power good signal (from PMIC to PMC) | ||
31 | is enabled. | ||
32 | |||
33 | Required properties when nvidia,suspend-mode is specified: | ||
34 | - nvidia,cpu-pwr-good-time : CPU power good time in uS. | ||
35 | - nvidia,cpu-pwr-off-time : CPU power off time in uS. | ||
36 | - nvidia,core-pwr-good-time : <Oscillator-stable-time Power-stable-time> | ||
37 | Core power good time in uS. | ||
38 | - nvidia,core-pwr-off-time : Core power off time in uS. | ||
39 | |||
40 | Required properties when nvidia,suspend-mode=<0>: | ||
41 | - nvidia,lp0-vec : <start length> Starting address and length of LP0 vector | ||
42 | The LP0 vector contains the warm boot code that is executed by AVP when | ||
43 | resuming from the LP0 state. The AVP (Audio-Video Processor) is an ARM7 | ||
44 | processor and always being the first boot processor when chip is power on | ||
45 | or resume from deep sleep mode. When the system is resumed from the deep | ||
46 | sleep mode, the warm boot code will restore some PLLs, clocks and then | ||
47 | bring up CPU0 for resuming the system. | ||
12 | 48 | ||
13 | Example: | 49 | Example: |
14 | 50 | ||
51 | / SoC dts including file | ||
15 | pmc@7000f400 { | 52 | pmc@7000f400 { |
16 | compatible = "nvidia,tegra20-pmc"; | 53 | compatible = "nvidia,tegra20-pmc"; |
17 | reg = <0x7000e400 0x400>; | 54 | reg = <0x7000e400 0x400>; |
55 | clocks = <&tegra_car 110>, <&clk32k_in>; | ||
56 | clock-names = "pclk", "clk32k_in"; | ||
18 | nvidia,invert-interrupt; | 57 | nvidia,invert-interrupt; |
58 | nvidia,suspend-mode = <1>; | ||
59 | nvidia,cpu-pwr-good-time = <2000>; | ||
60 | nvidia,cpu-pwr-off-time = <100>; | ||
61 | nvidia,core-pwr-good-time = <3845 3845>; | ||
62 | nvidia,core-pwr-off-time = <458>; | ||
63 | nvidia,core-power-req-active-high; | ||
64 | nvidia,sys-clock-req-active-high; | ||
65 | nvidia,lp0-vec = <0xbdffd000 0x2000>; | ||
66 | }; | ||
67 | |||
68 | / Tegra board dts file | ||
69 | { | ||
70 | ... | ||
71 | clocks { | ||
72 | compatible = "simple-bus"; | ||
73 | #address-cells = <1>; | ||
74 | #size-cells = <0>; | ||
75 | |||
76 | clk32k_in: clock { | ||
77 | compatible = "fixed-clock"; | ||
78 | reg=<0>; | ||
79 | #clock-cells = <0>; | ||
80 | clock-frequency = <32768>; | ||
81 | }; | ||
82 | }; | ||
83 | ... | ||
19 | }; | 84 | }; |
diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt index 5ddb2e9efaaa..4b87ea1194e3 100644 --- a/Documentation/devicetree/bindings/bus/ti-gpmc.txt +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt | |||
@@ -35,36 +35,83 @@ Required properties: | |||
35 | 35 | ||
36 | Timing properties for child nodes. All are optional and default to 0. | 36 | Timing properties for child nodes. All are optional and default to 0. |
37 | 37 | ||
38 | - gpmc,sync-clk: Minimum clock period for synchronous mode, in picoseconds | 38 | - gpmc,sync-clk-ps: Minimum clock period for synchronous mode, in picoseconds |
39 | 39 | ||
40 | Chip-select signal timings corresponding to GPMC_CONFIG2: | 40 | Chip-select signal timings (in nanoseconds) corresponding to GPMC_CONFIG2: |
41 | - gpmc,cs-on: Assertion time | 41 | - gpmc,cs-on-ns: Assertion time |
42 | - gpmc,cs-rd-off: Read deassertion time | 42 | - gpmc,cs-rd-off-ns: Read deassertion time |
43 | - gpmc,cs-wr-off: Write deassertion time | 43 | - gpmc,cs-wr-off-ns: Write deassertion time |
44 | 44 | ||
45 | ADV signal timings corresponding to GPMC_CONFIG3: | 45 | ADV signal timings (in nanoseconds) corresponding to GPMC_CONFIG3: |
46 | - gpmc,adv-on: Assertion time | 46 | - gpmc,adv-on-ns: Assertion time |
47 | - gpmc,adv-rd-off: Read deassertion time | 47 | - gpmc,adv-rd-off-ns: Read deassertion time |
48 | - gpmc,adv-wr-off: Write deassertion time | 48 | - gpmc,adv-wr-off-ns: Write deassertion time |
49 | 49 | ||
50 | WE signals timings corresponding to GPMC_CONFIG4: | 50 | WE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: |
51 | - gpmc,we-on: Assertion time | 51 | - gpmc,we-on-ns Assertion time |
52 | - gpmc,we-off: Deassertion time | 52 | - gpmc,we-off-ns: Deassertion time |
53 | 53 | ||
54 | OE signals timings corresponding to GPMC_CONFIG4: | 54 | OE signals timings (in nanoseconds) corresponding to GPMC_CONFIG4: |
55 | - gpmc,oe-on: Assertion time | 55 | - gpmc,oe-on-ns: Assertion time |
56 | - gpmc,oe-off: Deassertion time | 56 | - gpmc,oe-off-ns: Deassertion time |
57 | 57 | ||
58 | Access time and cycle time timings corresponding to GPMC_CONFIG5: | 58 | Access time and cycle time timings (in nanoseconds) corresponding to |
59 | - gpmc,page-burst-access: Multiple access word delay | 59 | GPMC_CONFIG5: |
60 | - gpmc,access: Start-cycle to first data valid delay | 60 | - gpmc,page-burst-access-ns: Multiple access word delay |
61 | - gpmc,rd-cycle: Total read cycle time | 61 | - gpmc,access-ns: Start-cycle to first data valid delay |
62 | - gpmc,wr-cycle: Total write cycle time | 62 | - gpmc,rd-cycle-ns: Total read cycle time |
63 | - gpmc,wr-cycle-ns: Total write cycle time | ||
64 | - gpmc,bus-turnaround-ns: Turn-around time between successive accesses | ||
65 | - gpmc,cycle2cycle-delay-ns: Delay between chip-select pulses | ||
66 | - gpmc,clk-activation-ns: GPMC clock activation time | ||
67 | - gpmc,wait-monitoring-ns: Start of wait monitoring with regard to valid | ||
68 | data | ||
69 | |||
70 | Boolean timing parameters. If property is present parameter enabled and | ||
71 | disabled if omitted: | ||
72 | - gpmc,adv-extra-delay: ADV signal is delayed by half GPMC clock | ||
73 | - gpmc,cs-extra-delay: CS signal is delayed by half GPMC clock | ||
74 | - gpmc,cycle2cycle-diffcsen: Add "cycle2cycle-delay" between successive | ||
75 | accesses to a different CS | ||
76 | - gpmc,cycle2cycle-samecsen: Add "cycle2cycle-delay" between successive | ||
77 | accesses to the same CS | ||
78 | - gpmc,oe-extra-delay: OE signal is delayed by half GPMC clock | ||
79 | - gpmc,we-extra-delay: WE signal is delayed by half GPMC clock | ||
80 | - gpmc,time-para-granularity: Multiply all access times by 2 | ||
63 | 81 | ||
64 | The following are only applicable to OMAP3+ and AM335x: | 82 | The following are only applicable to OMAP3+ and AM335x: |
65 | - gpmc,wr-access | 83 | - gpmc,wr-access-ns: In synchronous write mode, for single or |
66 | - gpmc,wr-data-mux-bus | 84 | burst accesses, defines the number of |
67 | 85 | GPMC_FCLK cycles from start access time | |
86 | to the GPMC_CLK rising edge used by the | ||
87 | memory device for the first data capture. | ||
88 | - gpmc,wr-data-mux-bus-ns: In address-data multiplex mode, specifies | ||
89 | the time when the first data is driven on | ||
90 | the address-data bus. | ||
91 | |||
92 | GPMC chip-select settings properties for child nodes. All are optional. | ||
93 | |||
94 | - gpmc,burst-length Page/burst length. Must be 4, 8 or 16. | ||
95 | - gpmc,burst-wrap Enables wrap bursting | ||
96 | - gpmc,burst-read Enables read page/burst mode | ||
97 | - gpmc,burst-write Enables write page/burst mode | ||
98 | - gpmc,device-nand Device is NAND | ||
99 | - gpmc,device-width Total width of device(s) connected to a GPMC | ||
100 | chip-select in bytes. The GPMC supports 8-bit | ||
101 | and 16-bit devices and so this property must be | ||
102 | 1 or 2. | ||
103 | - gpmc,mux-add-data Address and data multiplexing configuration. | ||
104 | Valid values are 1 for address-address-data | ||
105 | multiplexing mode and 2 for address-data | ||
106 | multiplexing mode. | ||
107 | - gpmc,sync-read Enables synchronous read. Defaults to asynchronous | ||
108 | is this is not set. | ||
109 | - gpmc,sync-write Enables synchronous writes. Defaults to asynchronous | ||
110 | is this is not set. | ||
111 | - gpmc,wait-pin Wait-pin used by client. Must be less than | ||
112 | "gpmc,num-waitpins". | ||
113 | - gpmc,wait-on-read Enables wait monitoring on reads. | ||
114 | - gpmc,wait-on-write Enables wait monitoring on writes. | ||
68 | 115 | ||
69 | Example for an AM33xx board: | 116 | Example for an AM33xx board: |
70 | 117 | ||
diff --git a/Documentation/devicetree/bindings/clock/axi-clkgen.txt b/Documentation/devicetree/bindings/clock/axi-clkgen.txt new file mode 100644 index 000000000000..028b493e97ff --- /dev/null +++ b/Documentation/devicetree/bindings/clock/axi-clkgen.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | Binding for the axi-clkgen clock generator | ||
2 | |||
3 | This binding uses the common clock binding[1]. | ||
4 | |||
5 | [1] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
6 | |||
7 | Required properties: | ||
8 | - compatible : shall be "adi,axi-clkgen". | ||
9 | - #clock-cells : from common clock binding; Should always be set to 0. | ||
10 | - reg : Address and length of the axi-clkgen register set. | ||
11 | - clocks : Phandle and clock specifier for the parent clock. | ||
12 | |||
13 | Optional properties: | ||
14 | - clock-output-names : From common clock binding. | ||
15 | |||
16 | Example: | ||
17 | clock@0xff000000 { | ||
18 | compatible = "adi,axi-clkgen"; | ||
19 | #clock-cells = <0>; | ||
20 | reg = <0xff000000 0x1000>; | ||
21 | clocks = <&osc 1>; | ||
22 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt new file mode 100644 index 000000000000..d6cb083b90a2 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt | |||
@@ -0,0 +1,303 @@ | |||
1 | NVIDIA Tegra114 Clock And Reset Controller | ||
2 | |||
3 | This binding uses the common clock binding: | ||
4 | Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
5 | |||
6 | The CAR (Clock And Reset) Controller on Tegra is the HW module responsible | ||
7 | for muxing and gating Tegra's clocks, and setting their rates. | ||
8 | |||
9 | Required properties : | ||
10 | - compatible : Should be "nvidia,tegra114-car" | ||
11 | - reg : Should contain CAR registers location and length | ||
12 | - clocks : Should contain phandle and clock specifiers for two clocks: | ||
13 | the 32 KHz "32k_in", and the board-specific oscillator "osc". | ||
14 | - #clock-cells : Should be 1. | ||
15 | In clock consumers, this cell represents the clock ID exposed by the CAR. | ||
16 | |||
17 | The first 160 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB | ||
18 | registers. These IDs often match those in the CAR's RST_DEVICES registers, | ||
19 | but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In | ||
20 | this case, those clocks are assigned IDs above 160 in order to highlight | ||
21 | this issue. Implementations that interpret these clock IDs as bit values | ||
22 | within the CLK_OUT_ENB or RST_DEVICES registers should be careful to | ||
23 | explicitly handle these special cases. | ||
24 | |||
25 | The balance of the clocks controlled by the CAR are assigned IDs of 160 and | ||
26 | above. | ||
27 | |||
28 | 0 unassigned | ||
29 | 1 unassigned | ||
30 | 2 unassigned | ||
31 | 3 unassigned | ||
32 | 4 rtc | ||
33 | 5 timer | ||
34 | 6 uarta | ||
35 | 7 unassigned (register bit affects uartb and vfir) | ||
36 | 8 unassigned | ||
37 | 9 sdmmc2 | ||
38 | 10 unassigned (register bit affects spdif_in and spdif_out) | ||
39 | 11 i2s1 | ||
40 | 12 i2c1 | ||
41 | 13 ndflash | ||
42 | 14 sdmmc1 | ||
43 | 15 sdmmc4 | ||
44 | 16 unassigned | ||
45 | 17 pwm | ||
46 | 18 i2s2 | ||
47 | 19 epp | ||
48 | 20 unassigned (register bit affects vi and vi_sensor) | ||
49 | 21 2d | ||
50 | 22 usbd | ||
51 | 23 isp | ||
52 | 24 3d | ||
53 | 25 unassigned | ||
54 | 26 disp2 | ||
55 | 27 disp1 | ||
56 | 28 host1x | ||
57 | 29 vcp | ||
58 | 30 i2s0 | ||
59 | 31 unassigned | ||
60 | |||
61 | 32 unassigned | ||
62 | 33 unassigned | ||
63 | 34 apbdma | ||
64 | 35 unassigned | ||
65 | 36 kbc | ||
66 | 37 unassigned | ||
67 | 38 unassigned | ||
68 | 39 unassigned (register bit affects fuse and fuse_burn) | ||
69 | 40 kfuse | ||
70 | 41 sbc1 | ||
71 | 42 nor | ||
72 | 43 unassigned | ||
73 | 44 sbc2 | ||
74 | 45 unassigned | ||
75 | 46 sbc3 | ||
76 | 47 i2c5 | ||
77 | 48 dsia | ||
78 | 49 unassigned | ||
79 | 50 mipi | ||
80 | 51 hdmi | ||
81 | 52 csi | ||
82 | 53 unassigned | ||
83 | 54 i2c2 | ||
84 | 55 uartc | ||
85 | 56 mipi-cal | ||
86 | 57 emc | ||
87 | 58 usb2 | ||
88 | 59 usb3 | ||
89 | 60 msenc | ||
90 | 61 vde | ||
91 | 62 bsea | ||
92 | 63 bsev | ||
93 | |||
94 | 64 unassigned | ||
95 | 65 uartd | ||
96 | 66 unassigned | ||
97 | 67 i2c3 | ||
98 | 68 sbc4 | ||
99 | 69 sdmmc3 | ||
100 | 70 unassigned | ||
101 | 71 owr | ||
102 | 72 afi | ||
103 | 73 csite | ||
104 | 74 unassigned | ||
105 | 75 unassigned | ||
106 | 76 la | ||
107 | 77 trace | ||
108 | 78 soc_therm | ||
109 | 79 dtv | ||
110 | 80 ndspeed | ||
111 | 81 i2cslow | ||
112 | 82 dsib | ||
113 | 83 tsec | ||
114 | 84 unassigned | ||
115 | 85 unassigned | ||
116 | 86 unassigned | ||
117 | 87 unassigned | ||
118 | 88 unassigned | ||
119 | 89 xusb_host | ||
120 | 90 unassigned | ||
121 | 91 msenc | ||
122 | 92 csus | ||
123 | 93 unassigned | ||
124 | 94 unassigned | ||
125 | 95 unassigned (bit affects xusb_dev and xusb_dev_src) | ||
126 | |||
127 | 96 unassigned | ||
128 | 97 unassigned | ||
129 | 98 unassigned | ||
130 | 99 mselect | ||
131 | 100 tsensor | ||
132 | 101 i2s3 | ||
133 | 102 i2s4 | ||
134 | 103 i2c4 | ||
135 | 104 sbc5 | ||
136 | 105 sbc6 | ||
137 | 106 d_audio | ||
138 | 107 apbif | ||
139 | 108 dam0 | ||
140 | 109 dam1 | ||
141 | 110 dam2 | ||
142 | 111 hda2codec_2x | ||
143 | 112 unassigned | ||
144 | 113 audio0_2x | ||
145 | 114 audio1_2x | ||
146 | 115 audio2_2x | ||
147 | 116 audio3_2x | ||
148 | 117 audio4_2x | ||
149 | 118 spdif_2x | ||
150 | 119 actmon | ||
151 | 120 extern1 | ||
152 | 121 extern2 | ||
153 | 122 extern3 | ||
154 | 123 unassigned | ||
155 | 124 unassigned | ||
156 | 125 hda | ||
157 | 126 unassigned | ||
158 | 127 se | ||
159 | |||
160 | 128 hda2hdmi | ||
161 | 129 unassigned | ||
162 | 130 unassigned | ||
163 | 131 unassigned | ||
164 | 132 unassigned | ||
165 | 133 unassigned | ||
166 | 134 unassigned | ||
167 | 135 unassigned | ||
168 | 136 unassigned | ||
169 | 137 unassigned | ||
170 | 138 unassigned | ||
171 | 139 unassigned | ||
172 | 140 unassigned | ||
173 | 141 unassigned | ||
174 | 142 unassigned | ||
175 | 143 unassigned (bit affects xusb_falcon_src, xusb_fs_src, | ||
176 | xusb_host_src and xusb_ss_src) | ||
177 | 144 cilab | ||
178 | 145 cilcd | ||
179 | 146 cile | ||
180 | 147 dsialp | ||
181 | 148 dsiblp | ||
182 | 149 unassigned | ||
183 | 150 dds | ||
184 | 151 unassigned | ||
185 | 152 dp2 | ||
186 | 153 amx | ||
187 | 154 adx | ||
188 | 155 unassigned (bit affects dfll_ref and dfll_soc) | ||
189 | 156 xusb_ss | ||
190 | |||
191 | 192 uartb | ||
192 | 193 vfir | ||
193 | 194 spdif_in | ||
194 | 195 spdif_out | ||
195 | 196 vi | ||
196 | 197 vi_sensor | ||
197 | 198 fuse | ||
198 | 199 fuse_burn | ||
199 | 200 clk_32k | ||
200 | 201 clk_m | ||
201 | 202 clk_m_div2 | ||
202 | 203 clk_m_div4 | ||
203 | 204 pll_ref | ||
204 | 205 pll_c | ||
205 | 206 pll_c_out1 | ||
206 | 207 pll_c2 | ||
207 | 208 pll_c3 | ||
208 | 209 pll_m | ||
209 | 210 pll_m_out1 | ||
210 | 211 pll_p | ||
211 | 212 pll_p_out1 | ||
212 | 213 pll_p_out2 | ||
213 | 214 pll_p_out3 | ||
214 | 215 pll_p_out4 | ||
215 | 216 pll_a | ||
216 | 217 pll_a_out0 | ||
217 | 218 pll_d | ||
218 | 219 pll_d_out0 | ||
219 | 220 pll_d2 | ||
220 | 221 pll_d2_out0 | ||
221 | 222 pll_u | ||
222 | 223 pll_u_480M | ||
223 | 224 pll_u_60M | ||
224 | 225 pll_u_48M | ||
225 | 226 pll_u_12M | ||
226 | 227 pll_x | ||
227 | 228 pll_x_out0 | ||
228 | 229 pll_re_vco | ||
229 | 230 pll_re_out | ||
230 | 231 pll_e_out0 | ||
231 | 232 spdif_in_sync | ||
232 | 233 i2s0_sync | ||
233 | 234 i2s1_sync | ||
234 | 235 i2s2_sync | ||
235 | 236 i2s3_sync | ||
236 | 237 i2s4_sync | ||
237 | 238 vimclk_sync | ||
238 | 239 audio0 | ||
239 | 240 audio1 | ||
240 | 241 audio2 | ||
241 | 242 audio3 | ||
242 | 243 audio4 | ||
243 | 244 spdif | ||
244 | 245 clk_out_1 | ||
245 | 246 clk_out_2 | ||
246 | 247 clk_out_3 | ||
247 | 248 blink | ||
248 | 252 xusb_host_src | ||
249 | 253 xusb_falcon_src | ||
250 | 254 xusb_fs_src | ||
251 | 255 xusb_ss_src | ||
252 | 256 xusb_dev_src | ||
253 | 257 xusb_dev | ||
254 | 258 xusb_hs_src | ||
255 | 259 sclk | ||
256 | 260 hclk | ||
257 | 261 pclk | ||
258 | 262 cclk_g | ||
259 | 263 cclk_lp | ||
260 | 264 dfll_ref | ||
261 | 265 dfll_soc | ||
262 | |||
263 | Example SoC include file: | ||
264 | |||
265 | / { | ||
266 | tegra_car: clock { | ||
267 | compatible = "nvidia,tegra114-car"; | ||
268 | reg = <0x60006000 0x1000>; | ||
269 | #clock-cells = <1>; | ||
270 | }; | ||
271 | |||
272 | usb@c5004000 { | ||
273 | clocks = <&tegra_car 58>; /* usb2 */ | ||
274 | }; | ||
275 | }; | ||
276 | |||
277 | Example board file: | ||
278 | |||
279 | / { | ||
280 | clocks { | ||
281 | compatible = "simple-bus"; | ||
282 | #address-cells = <1>; | ||
283 | #size-cells = <0>; | ||
284 | |||
285 | osc: clock@0 { | ||
286 | compatible = "fixed-clock"; | ||
287 | reg = <0>; | ||
288 | #clock-cells = <0>; | ||
289 | clock-frequency = <12000000>; | ||
290 | }; | ||
291 | |||
292 | clk_32k: clock@1 { | ||
293 | compatible = "fixed-clock"; | ||
294 | reg = <1>; | ||
295 | #clock-cells = <0>; | ||
296 | clock-frequency = <32768>; | ||
297 | }; | ||
298 | }; | ||
299 | |||
300 | &tegra_car { | ||
301 | clocks = <&clk_32k> <&osc>; | ||
302 | }; | ||
303 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt index 0921fac73528..e885680f6b45 100644 --- a/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt +++ b/Documentation/devicetree/bindings/clock/nvidia,tegra20-car.txt | |||
@@ -120,8 +120,8 @@ Required properties : | |||
120 | 90 clk_d | 120 | 90 clk_d |
121 | 91 unassigned | 121 | 91 unassigned |
122 | 92 sus | 122 | 92 sus |
123 | 93 cdev1 | 123 | 93 cdev2 |
124 | 94 cdev2 | 124 | 94 cdev1 |
125 | 95 unassigned | 125 | 95 unassigned |
126 | 126 | ||
127 | 96 uart2 | 127 | 96 uart2 |
diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt new file mode 100644 index 000000000000..20b8479c2760 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/sunxi.txt | |||
@@ -0,0 +1,44 @@ | |||
1 | Device Tree Clock bindings for arch-sunxi | ||
2 | |||
3 | This binding uses the common clock binding[1]. | ||
4 | |||
5 | [1] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
6 | |||
7 | Required properties: | ||
8 | - compatible : shall be one of the following: | ||
9 | "allwinner,sun4i-osc-clk" - for a gatable oscillator | ||
10 | "allwinner,sun4i-pll1-clk" - for the main PLL clock | ||
11 | "allwinner,sun4i-cpu-clk" - for the CPU multiplexer clock | ||
12 | "allwinner,sun4i-axi-clk" - for the AXI clock | ||
13 | "allwinner,sun4i-ahb-clk" - for the AHB clock | ||
14 | "allwinner,sun4i-apb0-clk" - for the APB0 clock | ||
15 | "allwinner,sun4i-apb1-clk" - for the APB1 clock | ||
16 | "allwinner,sun4i-apb1-mux-clk" - for the APB1 clock muxing | ||
17 | |||
18 | Required properties for all clocks: | ||
19 | - reg : shall be the control register address for the clock. | ||
20 | - clocks : shall be the input parent clock(s) phandle for the clock | ||
21 | - #clock-cells : from common clock binding; shall be set to 0. | ||
22 | |||
23 | For example: | ||
24 | |||
25 | osc24M: osc24M@01c20050 { | ||
26 | #clock-cells = <0>; | ||
27 | compatible = "allwinner,sun4i-osc-clk"; | ||
28 | reg = <0x01c20050 0x4>; | ||
29 | clocks = <&osc24M_fixed>; | ||
30 | }; | ||
31 | |||
32 | pll1: pll1@01c20000 { | ||
33 | #clock-cells = <0>; | ||
34 | compatible = "allwinner,sun4i-pll1-clk"; | ||
35 | reg = <0x01c20000 0x4>; | ||
36 | clocks = <&osc24M>; | ||
37 | }; | ||
38 | |||
39 | cpu: cpu@01c20054 { | ||
40 | #clock-cells = <0>; | ||
41 | compatible = "allwinner,sun4i-cpu-clk"; | ||
42 | reg = <0x01c20054 0x4>; | ||
43 | clocks = <&osc32k>, <&osc24M>, <&pll1>; | ||
44 | }; | ||
diff --git a/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt b/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt deleted file mode 100644 index f4dc5233167e..000000000000 --- a/Documentation/devicetree/bindings/gpio/gpio-vt8500.txt +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | VIA/Wondermedia VT8500 GPIO Controller | ||
2 | ----------------------------------------------------- | ||
3 | |||
4 | Required properties: | ||
5 | - compatible : "via,vt8500-gpio", "wm,wm8505-gpio" | ||
6 | or "wm,wm8650-gpio" depending on your SoC | ||
7 | - reg : Should contain 1 register range (address and length) | ||
8 | - #gpio-cells : should be <3>. | ||
9 | 1) bank | ||
10 | 2) pin number | ||
11 | 3) flags - should be 0 | ||
12 | |||
13 | Example: | ||
14 | |||
15 | gpio: gpio-controller@d8110000 { | ||
16 | compatible = "via,vt8500-gpio"; | ||
17 | gpio-controller; | ||
18 | reg = <0xd8110000 0x10000>; | ||
19 | #gpio-cells = <3>; | ||
20 | }; | ||
21 | |||
22 | vibrate { | ||
23 | gpios = <&gpio 0 1 0>; /* Bank 0, Pin 1, No flags */ | ||
24 | }; | ||
diff --git a/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt b/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt new file mode 100644 index 000000000000..c54c5a9a2a90 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/samsung,s3c24xx-irq.txt | |||
@@ -0,0 +1,53 @@ | |||
1 | Samsung S3C24XX Interrupt Controllers | ||
2 | |||
3 | The S3C24XX SoCs contain a custom set of interrupt controllers providing a | ||
4 | varying number of interrupt sources. The set consists of a main- and sub- | ||
5 | controller and on newer SoCs even a second main controller. | ||
6 | |||
7 | Required properties: | ||
8 | - compatible: Compatible property value should be "samsung,s3c2410-irq" | ||
9 | for machines before s3c2416 and "samsung,s3c2416-irq" for s3c2416 and later. | ||
10 | |||
11 | - reg: Physical base address of the controller and length of memory mapped | ||
12 | region. | ||
13 | |||
14 | - interrupt-controller : Identifies the node as an interrupt controller | ||
15 | |||
16 | - #interrupt-cells : Specifies the number of cells needed to encode an | ||
17 | interrupt source. The value shall be 4 and interrupt descriptor shall | ||
18 | have the following format: | ||
19 | <ctrl_num parent_irq ctrl_irq type> | ||
20 | |||
21 | ctrl_num contains the controller to use: | ||
22 | - 0 ... main controller | ||
23 | - 1 ... sub controller | ||
24 | - 2 ... second main controller on s3c2416 and s3c2450 | ||
25 | parent_irq contains the parent bit in the main controller and will be | ||
26 | ignored in main controllers | ||
27 | ctrl_irq contains the interrupt bit of the controller | ||
28 | type contains the trigger type to use | ||
29 | |||
30 | Example: | ||
31 | |||
32 | interrupt-controller@4a000000 { | ||
33 | compatible = "samsung,s3c2410-irq"; | ||
34 | reg = <0x4a000000 0x100>; | ||
35 | interrupt-controller; | ||
36 | #interrupt-cells=<4>; | ||
37 | }; | ||
38 | |||
39 | [...] | ||
40 | |||
41 | serial@50000000 { | ||
42 | compatible = "samsung,s3c2410-uart"; | ||
43 | reg = <0x50000000 0x4000>; | ||
44 | interrupt-parent = <&subintc>; | ||
45 | interrupts = <1 28 0 4>, <1 28 1 4>; | ||
46 | }; | ||
47 | |||
48 | rtc@57000000 { | ||
49 | compatible = "samsung,s3c2410-rtc"; | ||
50 | reg = <0x57000000 0x100>; | ||
51 | interrupt-parent = <&intc>; | ||
52 | interrupts = <0 30 0 3>, <0 8 0 3>; | ||
53 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nor.txt b/Documentation/devicetree/bindings/mtd/gpmc-nor.txt new file mode 100644 index 000000000000..420b3ab18890 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/gpmc-nor.txt | |||
@@ -0,0 +1,98 @@ | |||
1 | Device tree bindings for NOR flash connect to TI GPMC | ||
2 | |||
3 | NOR flash connected to the TI GPMC (found on OMAP boards) are represented as | ||
4 | child nodes of the GPMC controller with a name of "nor". | ||
5 | |||
6 | All timing relevant properties as well as generic GPMC child properties are | ||
7 | explained in a separate documents. Please refer to | ||
8 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
9 | |||
10 | Required properties: | ||
11 | - bank-width: Width of NOR flash in bytes. GPMC supports 8-bit and | ||
12 | 16-bit devices and so must be either 1 or 2 bytes. | ||
13 | - compatible: Documentation/devicetree/bindings/mtd/mtd-physmap.txt | ||
14 | - gpmc,cs-on-ns: Chip-select assertion time | ||
15 | - gpmc,cs-rd-off-ns: Chip-select de-assertion time for reads | ||
16 | - gpmc,cs-wr-off-ns: Chip-select de-assertion time for writes | ||
17 | - gpmc,oe-on-ns: Output-enable assertion time | ||
18 | - gpmc,oe-off-ns: Output-enable de-assertion time | ||
19 | - gpmc,we-on-ns Write-enable assertion time | ||
20 | - gpmc,we-off-ns: Write-enable de-assertion time | ||
21 | - gpmc,access-ns: Start cycle to first data capture (read access) | ||
22 | - gpmc,rd-cycle-ns: Total read cycle time | ||
23 | - gpmc,wr-cycle-ns: Total write cycle time | ||
24 | - linux,mtd-name: Documentation/devicetree/bindings/mtd/mtd-physmap.txt | ||
25 | - reg: Chip-select, base address (relative to chip-select) | ||
26 | and size of NOR flash. Note that base address will be | ||
27 | typically 0 as this is the start of the chip-select. | ||
28 | |||
29 | Optional properties: | ||
30 | - gpmc,XXX Additional GPMC timings and settings parameters. See | ||
31 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
32 | |||
33 | Optional properties for partiton table parsing: | ||
34 | - #address-cells: should be set to 1 | ||
35 | - #size-cells: should be set to 1 | ||
36 | |||
37 | Example: | ||
38 | |||
39 | gpmc: gpmc@6e000000 { | ||
40 | compatible = "ti,omap3430-gpmc", "simple-bus"; | ||
41 | ti,hwmods = "gpmc"; | ||
42 | reg = <0x6e000000 0x1000>; | ||
43 | interrupts = <20>; | ||
44 | gpmc,num-cs = <8>; | ||
45 | gpmc,num-waitpins = <4>; | ||
46 | #address-cells = <2>; | ||
47 | #size-cells = <1>; | ||
48 | |||
49 | ranges = <0 0 0x10000000 0x08000000>; | ||
50 | |||
51 | nor@0,0 { | ||
52 | compatible = "cfi-flash"; | ||
53 | linux,mtd-name= "intel,pf48f6000m0y1be"; | ||
54 | #address-cells = <1>; | ||
55 | #size-cells = <1>; | ||
56 | reg = <0 0 0x08000000>; | ||
57 | bank-width = <2>; | ||
58 | |||
59 | gpmc,mux-add-data; | ||
60 | gpmc,cs-on-ns = <0>; | ||
61 | gpmc,cs-rd-off-ns = <186>; | ||
62 | gpmc,cs-wr-off-ns = <186>; | ||
63 | gpmc,adv-on-ns = <12>; | ||
64 | gpmc,adv-rd-off-ns = <48>; | ||
65 | gpmc,adv-wr-off-ns = <48>; | ||
66 | gpmc,oe-on-ns = <54>; | ||
67 | gpmc,oe-off-ns = <168>; | ||
68 | gpmc,we-on-ns = <54>; | ||
69 | gpmc,we-off-ns = <168>; | ||
70 | gpmc,rd-cycle-ns = <186>; | ||
71 | gpmc,wr-cycle-ns = <186>; | ||
72 | gpmc,access-ns = <114>; | ||
73 | gpmc,page-burst-access-ns = <6>; | ||
74 | gpmc,bus-turnaround-ns = <12>; | ||
75 | gpmc,cycle2cycle-delay-ns = <18>; | ||
76 | gpmc,wr-data-mux-bus-ns = <90>; | ||
77 | gpmc,wr-access-ns = <186>; | ||
78 | gpmc,cycle2cycle-samecsen; | ||
79 | gpmc,cycle2cycle-diffcsen; | ||
80 | |||
81 | partition@0 { | ||
82 | label = "bootloader-nor"; | ||
83 | reg = <0 0x40000>; | ||
84 | }; | ||
85 | partition@0x40000 { | ||
86 | label = "params-nor"; | ||
87 | reg = <0x40000 0x40000>; | ||
88 | }; | ||
89 | partition@0x80000 { | ||
90 | label = "kernel-nor"; | ||
91 | reg = <0x80000 0x200000>; | ||
92 | }; | ||
93 | partition@0x280000 { | ||
94 | label = "filesystem-nor"; | ||
95 | reg = <0x240000 0x7d80000>; | ||
96 | }; | ||
97 | }; | ||
98 | }; | ||
diff --git a/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt b/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt index deec9da224a2..b7529424ac88 100644 --- a/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt +++ b/Documentation/devicetree/bindings/mtd/gpmc-onenand.txt | |||
@@ -10,6 +10,8 @@ Documentation/devicetree/bindings/bus/ti-gpmc.txt | |||
10 | Required properties: | 10 | Required properties: |
11 | 11 | ||
12 | - reg: The CS line the peripheral is connected to | 12 | - reg: The CS line the peripheral is connected to |
13 | - gpmc,device-width Width of the ONENAND device connected to the GPMC | ||
14 | in bytes. Must be 1 or 2. | ||
13 | 15 | ||
14 | Optional properties: | 16 | Optional properties: |
15 | 17 | ||
@@ -34,6 +36,7 @@ Example for an OMAP3430 board: | |||
34 | 36 | ||
35 | onenand@0 { | 37 | onenand@0 { |
36 | reg = <0 0 0>; /* CS0, offset 0 */ | 38 | reg = <0 0 0>; /* CS0, offset 0 */ |
39 | gpmc,device-width = <2>; | ||
37 | 40 | ||
38 | #address-cells = <1>; | 41 | #address-cells = <1>; |
39 | #size-cells = <1>; | 42 | #size-cells = <1>; |
diff --git a/Documentation/devicetree/bindings/net/gpmc-eth.txt b/Documentation/devicetree/bindings/net/gpmc-eth.txt new file mode 100644 index 000000000000..24cb4e46f675 --- /dev/null +++ b/Documentation/devicetree/bindings/net/gpmc-eth.txt | |||
@@ -0,0 +1,97 @@ | |||
1 | Device tree bindings for Ethernet chip connected to TI GPMC | ||
2 | |||
3 | Besides being used to interface with external memory devices, the | ||
4 | General-Purpose Memory Controller can be used to connect Pseudo-SRAM devices | ||
5 | such as ethernet controllers to processors using the TI GPMC as a data bus. | ||
6 | |||
7 | Ethernet controllers connected to TI GPMC are represented as child nodes of | ||
8 | the GPMC controller with an "ethernet" name. | ||
9 | |||
10 | All timing relevant properties as well as generic GPMC child properties are | ||
11 | explained in a separate documents. Please refer to | ||
12 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
13 | |||
14 | For the properties relevant to the ethernet controller connected to the GPMC | ||
15 | refer to the binding documentation of the device. For example, the documentation | ||
16 | for the SMSC 911x is Documentation/devicetree/bindings/net/smsc911x.txt | ||
17 | |||
18 | Child nodes need to specify the GPMC bus address width using the "bank-width" | ||
19 | property but is possible that an ethernet controller also has a property to | ||
20 | specify the I/O registers address width. Even when the GPMC has a maximum 16-bit | ||
21 | address width, it supports devices with 32-bit word registers. | ||
22 | For example with an SMSC LAN911x/912x controller connected to the TI GPMC on an | ||
23 | OMAP2+ board, "bank-width = <2>;" and "reg-io-width = <4>;". | ||
24 | |||
25 | Required properties: | ||
26 | - bank-width: Address width of the device in bytes. GPMC supports 8-bit | ||
27 | and 16-bit devices and so must be either 1 or 2 bytes. | ||
28 | - compatible: Compatible string property for the ethernet child device. | ||
29 | - gpmc,cs-on: Chip-select assertion time | ||
30 | - gpmc,cs-rd-off: Chip-select de-assertion time for reads | ||
31 | - gpmc,cs-wr-off: Chip-select de-assertion time for writes | ||
32 | - gpmc,oe-on: Output-enable assertion time | ||
33 | - gpmc,oe-off Output-enable de-assertion time | ||
34 | - gpmc,we-on: Write-enable assertion time | ||
35 | - gpmc,we-off: Write-enable de-assertion time | ||
36 | - gpmc,access: Start cycle to first data capture (read access) | ||
37 | - gpmc,rd-cycle: Total read cycle time | ||
38 | - gpmc,wr-cycle: Total write cycle time | ||
39 | - reg: Chip-select, base address (relative to chip-select) | ||
40 | and size of the memory mapped for the device. | ||
41 | Note that base address will be typically 0 as this | ||
42 | is the start of the chip-select. | ||
43 | |||
44 | Optional properties: | ||
45 | - gpmc,XXX Additional GPMC timings and settings parameters. See | ||
46 | Documentation/devicetree/bindings/bus/ti-gpmc.txt | ||
47 | |||
48 | Example: | ||
49 | |||
50 | gpmc: gpmc@6e000000 { | ||
51 | compatible = "ti,omap3430-gpmc"; | ||
52 | ti,hwmods = "gpmc"; | ||
53 | reg = <0x6e000000 0x1000>; | ||
54 | interrupts = <20>; | ||
55 | gpmc,num-cs = <8>; | ||
56 | gpmc,num-waitpins = <4>; | ||
57 | #address-cells = <2>; | ||
58 | #size-cells = <1>; | ||
59 | |||
60 | ranges = <5 0 0x2c000000 0x1000000>; | ||
61 | |||
62 | ethernet@5,0 { | ||
63 | compatible = "smsc,lan9221", "smsc,lan9115"; | ||
64 | reg = <5 0 0xff>; | ||
65 | bank-width = <2>; | ||
66 | |||
67 | gpmc,mux-add-data; | ||
68 | gpmc,cs-on = <0>; | ||
69 | gpmc,cs-rd-off = <186>; | ||
70 | gpmc,cs-wr-off = <186>; | ||
71 | gpmc,adv-on = <12>; | ||
72 | gpmc,adv-rd-off = <48>; | ||
73 | gpmc,adv-wr-off = <48>; | ||
74 | gpmc,oe-on = <54>; | ||
75 | gpmc,oe-off = <168>; | ||
76 | gpmc,we-on = <54>; | ||
77 | gpmc,we-off = <168>; | ||
78 | gpmc,rd-cycle = <186>; | ||
79 | gpmc,wr-cycle = <186>; | ||
80 | gpmc,access = <114>; | ||
81 | gpmc,page-burst-access = <6>; | ||
82 | gpmc,bus-turnaround = <12>; | ||
83 | gpmc,cycle2cycle-delay = <18>; | ||
84 | gpmc,wr-data-mux-bus = <90>; | ||
85 | gpmc,wr-access = <186>; | ||
86 | gpmc,cycle2cycle-samecsen; | ||
87 | gpmc,cycle2cycle-diffcsen; | ||
88 | |||
89 | interrupt-parent = <&gpio6>; | ||
90 | interrupts = <16>; | ||
91 | vmmc-supply = <&vddvario>; | ||
92 | vmmc_aux-supply = <&vdd33a>; | ||
93 | reg-io-width = <4>; | ||
94 | |||
95 | smsc,save-mac-address; | ||
96 | }; | ||
97 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt new file mode 100644 index 000000000000..b3aa90f0ce44 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt | |||
@@ -0,0 +1,57 @@ | |||
1 | VIA VT8500 and Wondermedia WM8xxx-series pinmux/gpio controller | ||
2 | |||
3 | These SoCs contain a combined Pinmux/GPIO module. Each pin may operate as | ||
4 | either a GPIO in, GPIO out or as an alternate function (I2C, SPI etc). | ||
5 | |||
6 | Required properties: | ||
7 | - compatible: "via,vt8500-pinctrl", "wm,wm8505-pinctrl", "wm,wm8650-pinctrl", | ||
8 | "wm8750-pinctrl" or "wm,wm8850-pinctrl" | ||
9 | - reg: Should contain the physical address of the module's registers. | ||
10 | - interrupt-controller: Marks the device node as an interrupt controller. | ||
11 | - #interrupt-cells: Should be two. | ||
12 | - gpio-controller: Marks the device node as a GPIO controller. | ||
13 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
14 | second cell is used to specify optional parameters. | ||
15 | bit 0 - active low | ||
16 | |||
17 | Please refer to ../gpio/gpio.txt for a general description of GPIO bindings. | ||
18 | |||
19 | Please refer to pinctrl-bindings.txt in this directory for details of the | ||
20 | common pinctrl bindings used by client devices, including the meaning of the | ||
21 | phrase "pin configuration node". | ||
22 | |||
23 | Each pin configuration node lists the pin(s) to which it applies, and one or | ||
24 | more of the mux functions to select on those pin(s), and pull-up/down | ||
25 | configuration. Each subnode only affects those parameters that are explicitly | ||
26 | listed. In other words, a subnode that lists only a mux function implies no | ||
27 | information about any pull configuration. Similarly, a subnode that lists only | ||
28 | a pull parameter implies no information about the mux function. | ||
29 | |||
30 | Required subnode-properties: | ||
31 | - wm,pins: An array of cells. Each cell contains the ID of a pin. | ||
32 | |||
33 | Optional subnode-properties: | ||
34 | - wm,function: Integer, containing the function to mux to the pin(s): | ||
35 | 0: GPIO in | ||
36 | 1: GPIO out | ||
37 | 2: alternate | ||
38 | |||
39 | - wm,pull: Integer, representing the pull-down/up to apply to the pin(s): | ||
40 | 0: none | ||
41 | 1: down | ||
42 | 2: up | ||
43 | |||
44 | Each of wm,function and wm,pull may contain either a single value which | ||
45 | will be applied to all pins in wm,pins, or one value for each entry in | ||
46 | wm,pins. | ||
47 | |||
48 | Example: | ||
49 | |||
50 | pinctrl: pinctrl { | ||
51 | compatible = "wm,wm8505-pinctrl"; | ||
52 | reg = <0xD8110000 0x10000>; | ||
53 | interrupt-controller; | ||
54 | #interrupt-cells = <2>; | ||
55 | gpio-controller; | ||
56 | #gpio-cells = <2>; | ||
57 | }; | ||
diff --git a/Documentation/devicetree/bindings/timer/arm,sp804.txt b/Documentation/devicetree/bindings/timer/arm,sp804.txt new file mode 100644 index 000000000000..5cd8eee74af1 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/arm,sp804.txt | |||
@@ -0,0 +1,29 @@ | |||
1 | ARM sp804 Dual Timers | ||
2 | --------------------------------------- | ||
3 | |||
4 | Required properties: | ||
5 | - compatible: Should be "arm,sp804" & "arm,primecell" | ||
6 | - interrupts: Should contain the list of Dual Timer interrupts. This is the | ||
7 | interrupt for timer 1 and timer 2. In the case of a single entry, it is | ||
8 | the combined interrupt or if "arm,sp804-has-irq" is present that | ||
9 | specifies which timer interrupt is connected. | ||
10 | - reg: Should contain location and length for dual timer register. | ||
11 | - clocks: clocks driving the dual timer hardware. This list should be 1 or 3 | ||
12 | clocks. With 3 clocks, the order is timer0 clock, timer1 clock, | ||
13 | apb_pclk. A single clock can also be specified if the same clock is | ||
14 | used for all clock inputs. | ||
15 | |||
16 | Optional properties: | ||
17 | - arm,sp804-has-irq = <#>: In the case of only 1 timer irq line connected, this | ||
18 | specifies if the irq connection is for timer 1 or timer 2. A value of 1 | ||
19 | or 2 should be used. | ||
20 | |||
21 | Example: | ||
22 | |||
23 | timer0: timer@fc800000 { | ||
24 | compatible = "arm,sp804", "arm,primecell"; | ||
25 | reg = <0xfc800000 0x1000>; | ||
26 | interrupts = <0 0 4>, <0 1 4>; | ||
27 | clocks = <&timclk1 &timclk2 &pclk>; | ||
28 | clock-names = "timer1", "timer2", "apb_pclk"; | ||
29 | }; | ||
diff --git a/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt b/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt new file mode 100644 index 000000000000..993695c659e1 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/cadence,ttc-timer.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | Cadence TTC - Triple Timer Counter | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Should be "cdns,ttc". | ||
5 | - reg : Specifies base physical address and size of the registers. | ||
6 | - interrupts : A list of 3 interrupts; one per timer channel. | ||
7 | - clocks: phandle to the source clock | ||
8 | |||
9 | Example: | ||
10 | |||
11 | ttc0: ttc0@f8001000 { | ||
12 | interrupt-parent = <&intc>; | ||
13 | interrupts = < 0 10 4 0 11 4 0 12 4 >; | ||
14 | compatible = "cdns,ttc"; | ||
15 | reg = <0xF8001000 0x1000>; | ||
16 | clocks = <&cpu_clk 3>; | ||
17 | }; | ||
diff --git a/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt b/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt new file mode 100644 index 000000000000..cb47bfbcaeea --- /dev/null +++ b/Documentation/devicetree/bindings/timer/samsung,exynos4210-mct.txt | |||
@@ -0,0 +1,68 @@ | |||
1 | Samsung's Multi Core Timer (MCT) | ||
2 | |||
3 | The Samsung's Multi Core Timer (MCT) module includes two main blocks, the | ||
4 | global timer and CPU local timers. The global timer is a 64-bit free running | ||
5 | up-counter and can generate 4 interrupts when the counter reaches one of the | ||
6 | four preset counter values. The CPU local timers are 32-bit free running | ||
7 | down-counters and generate an interrupt when the counter expires. There is | ||
8 | one CPU local timer instantiated in MCT for every CPU in the system. | ||
9 | |||
10 | Required properties: | ||
11 | |||
12 | - compatible: should be "samsung,exynos4210-mct". | ||
13 | (a) "samsung,exynos4210-mct", for mct compatible with Exynos4210 mct. | ||
14 | (b) "samsung,exynos4412-mct", for mct compatible with Exynos4412 mct. | ||
15 | |||
16 | - reg: base address of the mct controller and length of the address space | ||
17 | it occupies. | ||
18 | |||
19 | - interrupts: the list of interrupts generated by the controller. The following | ||
20 | should be the order of the interrupts specified. The local timer interrupts | ||
21 | should be specified after the four global timer interrupts have been | ||
22 | specified. | ||
23 | |||
24 | 0: Global Timer Interrupt 0 | ||
25 | 1: Global Timer Interrupt 1 | ||
26 | 2: Global Timer Interrupt 2 | ||
27 | 3: Global Timer Interrupt 3 | ||
28 | 4: Local Timer Interrupt 0 | ||
29 | 5: Local Timer Interrupt 1 | ||
30 | 6: .. | ||
31 | 7: .. | ||
32 | i: Local Timer Interrupt n | ||
33 | |||
34 | Example 1: In this example, the system uses only the first global timer | ||
35 | interrupt generated by MCT and the remaining three global timer | ||
36 | interrupts are unused. Two local timer interrupts have been | ||
37 | specified. | ||
38 | |||
39 | mct@10050000 { | ||
40 | compatible = "samsung,exynos4210-mct"; | ||
41 | reg = <0x10050000 0x800>; | ||
42 | interrupts = <0 57 0>, <0 0 0>, <0 0 0>, <0 0 0>, | ||
43 | <0 42 0>, <0 48 0>; | ||
44 | }; | ||
45 | |||
46 | Example 2: In this example, the MCT global and local timer interrupts are | ||
47 | connected to two seperate interrupt controllers. Hence, an | ||
48 | interrupt-map is created to map the interrupts to the respective | ||
49 | interrupt controllers. | ||
50 | |||
51 | mct@101C0000 { | ||
52 | compatible = "samsung,exynos4210-mct"; | ||
53 | reg = <0x101C0000 0x800>; | ||
54 | interrupt-controller; | ||
55 | #interrups-cells = <2>; | ||
56 | interrupt-parent = <&mct_map>; | ||
57 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
58 | <4 0>, <5 0>; | ||
59 | |||
60 | mct_map: mct-map { | ||
61 | #interrupt-cells = <2>; | ||
62 | #address-cells = <0>; | ||
63 | #size-cells = <0>; | ||
64 | interrupt-map = <0x0 0 &combiner 23 3>, | ||
65 | <0x4 0 &gic 0 120 0>, | ||
66 | <0x5 0 &gic 0 121 0>; | ||
67 | }; | ||
68 | }; | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5fa0cc590887..38b5d5dad8e4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -673,6 +673,7 @@ config ARCH_TEGRA | |||
673 | select HAVE_CLK | 673 | select HAVE_CLK |
674 | select HAVE_SMP | 674 | select HAVE_SMP |
675 | select MIGHT_HAVE_CACHE_L2X0 | 675 | select MIGHT_HAVE_CACHE_L2X0 |
676 | select SOC_BUS | ||
676 | select SPARSE_IRQ | 677 | select SPARSE_IRQ |
677 | select USE_OF | 678 | select USE_OF |
678 | help | 679 | help |
@@ -769,12 +770,15 @@ config ARCH_SA1100 | |||
769 | config ARCH_S3C24XX | 770 | config ARCH_S3C24XX |
770 | bool "Samsung S3C24XX SoCs" | 771 | bool "Samsung S3C24XX SoCs" |
771 | select ARCH_HAS_CPUFREQ | 772 | select ARCH_HAS_CPUFREQ |
772 | select ARCH_USES_GETTIMEOFFSET | ||
773 | select CLKDEV_LOOKUP | 773 | select CLKDEV_LOOKUP |
774 | select CLKSRC_MMIO | ||
775 | select GENERIC_CLOCKEVENTS | ||
776 | select GENERIC_GPIO | ||
774 | select HAVE_CLK | 777 | select HAVE_CLK |
775 | select HAVE_S3C2410_I2C if I2C | 778 | select HAVE_S3C2410_I2C if I2C |
776 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 779 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
777 | select HAVE_S3C_RTC if RTC_CLASS | 780 | select HAVE_S3C_RTC if RTC_CLASS |
781 | select MULTI_IRQ_HANDLER | ||
778 | select NEED_MACH_GPIO_H | 782 | select NEED_MACH_GPIO_H |
779 | select NEED_MACH_IO_H | 783 | select NEED_MACH_IO_H |
780 | help | 784 | help |
@@ -787,10 +791,11 @@ config ARCH_S3C64XX | |||
787 | bool "Samsung S3C64XX" | 791 | bool "Samsung S3C64XX" |
788 | select ARCH_HAS_CPUFREQ | 792 | select ARCH_HAS_CPUFREQ |
789 | select ARCH_REQUIRE_GPIOLIB | 793 | select ARCH_REQUIRE_GPIOLIB |
790 | select ARCH_USES_GETTIMEOFFSET | ||
791 | select ARM_VIC | 794 | select ARM_VIC |
792 | select CLKDEV_LOOKUP | 795 | select CLKDEV_LOOKUP |
796 | select CLKSRC_MMIO | ||
793 | select CPU_V6 | 797 | select CPU_V6 |
798 | select GENERIC_CLOCKEVENTS | ||
794 | select HAVE_CLK | 799 | select HAVE_CLK |
795 | select HAVE_S3C2410_I2C if I2C | 800 | select HAVE_S3C2410_I2C if I2C |
796 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 801 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
@@ -824,9 +829,11 @@ config ARCH_S5P64X0 | |||
824 | 829 | ||
825 | config ARCH_S5PC100 | 830 | config ARCH_S5PC100 |
826 | bool "Samsung S5PC100" | 831 | bool "Samsung S5PC100" |
827 | select ARCH_USES_GETTIMEOFFSET | ||
828 | select CLKDEV_LOOKUP | 832 | select CLKDEV_LOOKUP |
833 | select CLKSRC_MMIO | ||
829 | select CPU_V7 | 834 | select CPU_V7 |
835 | select GENERIC_CLOCKEVENTS | ||
836 | select GENERIC_GPIO | ||
830 | select HAVE_CLK | 837 | select HAVE_CLK |
831 | select HAVE_S3C2410_I2C if I2C | 838 | select HAVE_S3C2410_I2C if I2C |
832 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 839 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
@@ -1165,6 +1172,7 @@ config PLAT_VERSATILE | |||
1165 | config ARM_TIMER_SP804 | 1172 | config ARM_TIMER_SP804 |
1166 | bool | 1173 | bool |
1167 | select CLKSRC_MMIO | 1174 | select CLKSRC_MMIO |
1175 | select CLKSRC_OF if OF | ||
1168 | select HAVE_SCHED_CLOCK | 1176 | select HAVE_SCHED_CLOCK |
1169 | 1177 | ||
1170 | source arch/arm/mm/Kconfig | 1178 | source arch/arm/mm/Kconfig |
@@ -1595,6 +1603,7 @@ config HAVE_ARM_ARCH_TIMER | |||
1595 | config HAVE_ARM_TWD | 1603 | config HAVE_ARM_TWD |
1596 | bool | 1604 | bool |
1597 | depends on SMP | 1605 | depends on SMP |
1606 | select CLKSRC_OF if OF | ||
1598 | help | 1607 | help |
1599 | This options enables support for the ARM timer and watchdog unit | 1608 | This options enables support for the ARM timer and watchdog unit |
1600 | 1609 | ||
@@ -1648,7 +1657,7 @@ config LOCAL_TIMERS | |||
1648 | bool "Use local timer interrupts" | 1657 | bool "Use local timer interrupts" |
1649 | depends on SMP | 1658 | depends on SMP |
1650 | default y | 1659 | default y |
1651 | select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT) | 1660 | select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !CLKSRC_EXYNOS_MCT) |
1652 | help | 1661 | help |
1653 | Enable support for local timers on SMP platforms, rather then the | 1662 | Enable support for local timers on SMP platforms, rather then the |
1654 | legacy IPI broadcast method. Local timers allows the system | 1663 | legacy IPI broadcast method. Local timers allows the system |
@@ -1663,7 +1672,8 @@ config ARCH_NR_GPIO | |||
1663 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA | 1672 | default 1024 if ARCH_SHMOBILE || ARCH_TEGRA |
1664 | default 512 if SOC_OMAP5 | 1673 | default 512 if SOC_OMAP5 |
1665 | default 355 if ARCH_U8500 | 1674 | default 355 if ARCH_U8500 |
1666 | default 288 if ARCH_VT8500 || ARCH_SUNXI | 1675 | default 352 if ARCH_VT8500 |
1676 | default 288 if ARCH_SUNXI | ||
1667 | default 264 if MACH_H4700 | 1677 | default 264 if MACH_H4700 |
1668 | default 0 | 1678 | default 0 |
1669 | help | 1679 | help |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 234e78f7014e..e35b0a7ac77b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -170,6 +170,8 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ | |||
170 | tegra30-cardhu-a04.dtb \ | 170 | tegra30-cardhu-a04.dtb \ |
171 | tegra114-dalmore.dtb \ | 171 | tegra114-dalmore.dtb \ |
172 | tegra114-pluto.dtb | 172 | tegra114-pluto.dtb |
173 | dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ | ||
174 | versatile-pb.dtb | ||
173 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ | 175 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ |
174 | vexpress-v2p-ca9.dtb \ | 176 | vexpress-v2p-ca9.dtb \ |
175 | vexpress-v2p-ca15-tc1.dtb \ | 177 | vexpress-v2p-ca15-tc1.dtb \ |
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi index 2feffc70814c..49a2786e00b9 100644 --- a/arch/arm/boot/dts/exynos4210.dtsi +++ b/arch/arm/boot/dts/exynos4210.dtsi | |||
@@ -47,6 +47,28 @@ | |||
47 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; | 47 | <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | mct@10050000 { | ||
51 | compatible = "samsung,exynos4210-mct"; | ||
52 | reg = <0x10050000 0x800>; | ||
53 | interrupt-controller; | ||
54 | #interrups-cells = <2>; | ||
55 | interrupt-parent = <&mct_map>; | ||
56 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
57 | <4 0>, <5 0>; | ||
58 | |||
59 | mct_map: mct-map { | ||
60 | #interrupt-cells = <2>; | ||
61 | #address-cells = <0>; | ||
62 | #size-cells = <0>; | ||
63 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
64 | <0x1 0 &gic 0 69 0>, | ||
65 | <0x2 0 &combiner 12 6>, | ||
66 | <0x3 0 &combiner 12 7>, | ||
67 | <0x4 0 &gic 0 42 0>, | ||
68 | <0x5 0 &gic 0 48 0>; | ||
69 | }; | ||
70 | }; | ||
71 | |||
50 | pinctrl_0: pinctrl@11400000 { | 72 | pinctrl_0: pinctrl@11400000 { |
51 | compatible = "samsung,exynos4210-pinctrl"; | 73 | compatible = "samsung,exynos4210-pinctrl"; |
52 | reg = <0x11400000 0x1000>; | 74 | reg = <0x11400000 0x1000>; |
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi index c6ae2005961f..36d4299789ef 100644 --- a/arch/arm/boot/dts/exynos4212.dtsi +++ b/arch/arm/boot/dts/exynos4212.dtsi | |||
@@ -25,4 +25,26 @@ | |||
25 | gic:interrupt-controller@10490000 { | 25 | gic:interrupt-controller@10490000 { |
26 | cpu-offset = <0x8000>; | 26 | cpu-offset = <0x8000>; |
27 | }; | 27 | }; |
28 | |||
29 | mct@10050000 { | ||
30 | compatible = "samsung,exynos4412-mct"; | ||
31 | reg = <0x10050000 0x800>; | ||
32 | interrupt-controller; | ||
33 | #interrups-cells = <2>; | ||
34 | interrupt-parent = <&mct_map>; | ||
35 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
36 | <4 0>, <5 0>; | ||
37 | |||
38 | mct_map: mct-map { | ||
39 | #interrupt-cells = <2>; | ||
40 | #address-cells = <0>; | ||
41 | #size-cells = <0>; | ||
42 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
43 | <0x1 0 &combiner 12 5>, | ||
44 | <0x2 0 &combiner 12 6>, | ||
45 | <0x3 0 &combiner 12 7>, | ||
46 | <0x4 0 &gic 1 12 0>, | ||
47 | <0x5 0 &gic 1 12 0>; | ||
48 | }; | ||
49 | }; | ||
28 | }; | 50 | }; |
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi index d7dfe312772a..821c9fdd1e3b 100644 --- a/arch/arm/boot/dts/exynos4412.dtsi +++ b/arch/arm/boot/dts/exynos4412.dtsi | |||
@@ -25,4 +25,28 @@ | |||
25 | gic:interrupt-controller@10490000 { | 25 | gic:interrupt-controller@10490000 { |
26 | cpu-offset = <0x4000>; | 26 | cpu-offset = <0x4000>; |
27 | }; | 27 | }; |
28 | |||
29 | mct@10050000 { | ||
30 | compatible = "samsung,exynos4412-mct"; | ||
31 | reg = <0x10050000 0x800>; | ||
32 | interrupt-controller; | ||
33 | #interrups-cells = <2>; | ||
34 | interrupt-parent = <&mct_map>; | ||
35 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
36 | <4 0>, <5 0>, <6 0>, <7 0>; | ||
37 | |||
38 | mct_map: mct-map { | ||
39 | #interrupt-cells = <2>; | ||
40 | #address-cells = <0>; | ||
41 | #size-cells = <0>; | ||
42 | interrupt-map = <0x0 0 &gic 0 57 0>, | ||
43 | <0x1 0 &combiner 12 5>, | ||
44 | <0x2 0 &combiner 12 6>, | ||
45 | <0x3 0 &combiner 12 7>, | ||
46 | <0x4 0 &gic 1 12 0>, | ||
47 | <0x5 0 &gic 1 12 0>, | ||
48 | <0x6 0 &gic 1 12 0>, | ||
49 | <0x7 0 &gic 1 12 0>; | ||
50 | }; | ||
51 | }; | ||
28 | }; | 52 | }; |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index b1ac73e21c80..c60108e0d27e 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -69,6 +69,28 @@ | |||
69 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; | 69 | <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | mct@101C0000 { | ||
73 | compatible = "samsung,exynos4210-mct"; | ||
74 | reg = <0x101C0000 0x800>; | ||
75 | interrupt-controller; | ||
76 | #interrups-cells = <2>; | ||
77 | interrupt-parent = <&mct_map>; | ||
78 | interrupts = <0 0>, <1 0>, <2 0>, <3 0>, | ||
79 | <4 0>, <5 0>; | ||
80 | |||
81 | mct_map: mct-map { | ||
82 | #interrupt-cells = <2>; | ||
83 | #address-cells = <0>; | ||
84 | #size-cells = <0>; | ||
85 | interrupt-map = <0x0 0 &combiner 23 3>, | ||
86 | <0x1 0 &combiner 23 4>, | ||
87 | <0x2 0 &combiner 25 2>, | ||
88 | <0x3 0 &combiner 25 3>, | ||
89 | <0x4 0 &gic 0 120 0>, | ||
90 | <0x5 0 &gic 0 121 0>; | ||
91 | }; | ||
92 | }; | ||
93 | |||
72 | watchdog { | 94 | watchdog { |
73 | compatible = "samsung,s3c2410-wdt"; | 95 | compatible = "samsung,s3c2410-wdt"; |
74 | reg = <0x101D0000 0x100>; | 96 | reg = <0x101D0000 0x100>; |
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts index 8b119399025a..ff1aea0ee043 100644 --- a/arch/arm/boot/dts/integratorcp.dts +++ b/arch/arm/boot/dts/integratorcp.dts | |||
@@ -24,15 +24,15 @@ | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | timer0: timer@13000000 { | 26 | timer0: timer@13000000 { |
27 | compatible = "arm,sp804", "arm,primecell"; | 27 | compatible = "arm,integrator-cp-timer"; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | timer1: timer@13000100 { | 30 | timer1: timer@13000100 { |
31 | compatible = "arm,sp804", "arm,primecell"; | 31 | compatible = "arm,integrator-cp-timer"; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | timer2: timer@13000200 { | 34 | timer2: timer@13000200 { |
35 | compatible = "arm,sp804", "arm,primecell"; | 35 | compatible = "arm,integrator-cp-timer"; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | pic: pic@14000000 { | 38 | pic: pic@14000000 { |
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts index f624dc85d441..02d23f15fd86 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts | |||
@@ -38,6 +38,57 @@ | |||
38 | }; | 38 | }; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* HS USB Port 2 RESET */ | ||
42 | hsusb2_reset: hsusb2_reset_reg { | ||
43 | compatible = "regulator-fixed"; | ||
44 | regulator-name = "hsusb2_reset"; | ||
45 | regulator-min-microvolt = <3300000>; | ||
46 | regulator-max-microvolt = <3300000>; | ||
47 | gpio = <&gpio5 19 0>; /* gpio_147 */ | ||
48 | startup-delay-us = <70000>; | ||
49 | enable-active-high; | ||
50 | }; | ||
51 | |||
52 | /* HS USB Port 2 Power */ | ||
53 | hsusb2_power: hsusb2_power_reg { | ||
54 | compatible = "regulator-fixed"; | ||
55 | regulator-name = "hsusb2_vbus"; | ||
56 | regulator-min-microvolt = <3300000>; | ||
57 | regulator-max-microvolt = <3300000>; | ||
58 | gpio = <&twl_gpio 18 0>; /* GPIO LEDA */ | ||
59 | startup-delay-us = <70000>; | ||
60 | }; | ||
61 | |||
62 | /* HS USB Host PHY on PORT 2 */ | ||
63 | hsusb2_phy: hsusb2_phy { | ||
64 | compatible = "usb-nop-xceiv"; | ||
65 | reset-supply = <&hsusb2_reset>; | ||
66 | vcc-supply = <&hsusb2_power>; | ||
67 | }; | ||
68 | }; | ||
69 | |||
70 | &omap3_pmx_core { | ||
71 | pinctrl-names = "default"; | ||
72 | pinctrl-0 = < | ||
73 | &hsusbb2_pins | ||
74 | >; | ||
75 | |||
76 | hsusbb2_pins: pinmux_hsusbb2_pins { | ||
77 | pinctrl-single,pins = < | ||
78 | 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ | ||
79 | 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ | ||
80 | 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ | ||
81 | 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ | ||
82 | 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ | ||
83 | 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ | ||
84 | 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ | ||
85 | 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ | ||
86 | 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */ | ||
87 | 0x1aa 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */ | ||
88 | 0x1ac 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */ | ||
89 | 0x1ae 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */ | ||
90 | >; | ||
91 | }; | ||
41 | }; | 92 | }; |
42 | 93 | ||
43 | &i2c1 { | 94 | &i2c1 { |
@@ -65,3 +116,23 @@ | |||
65 | &mmc3 { | 116 | &mmc3 { |
66 | status = "disabled"; | 117 | status = "disabled"; |
67 | }; | 118 | }; |
119 | |||
120 | &usbhshost { | ||
121 | port2-mode = "ehci-phy"; | ||
122 | }; | ||
123 | |||
124 | &usbhsehci { | ||
125 | phys = <0 &hsusb2_phy>; | ||
126 | }; | ||
127 | |||
128 | &twl_gpio { | ||
129 | ti,use-leds; | ||
130 | /* pullups: BIT(1) */ | ||
131 | ti,pullups = <0x000002>; | ||
132 | /* | ||
133 | * pulldowns: | ||
134 | * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13) | ||
135 | * BIT(15), BIT(16), BIT(17) | ||
136 | */ | ||
137 | ti,pulldowns = <0x03a1c4>; | ||
138 | }; | ||
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 1acc26148ffc..a14f74bbce7c 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi | |||
@@ -397,5 +397,36 @@ | |||
397 | ti,timer-alwon; | 397 | ti,timer-alwon; |
398 | ti,timer-secure; | 398 | ti,timer-secure; |
399 | }; | 399 | }; |
400 | |||
401 | usbhstll: usbhstll@48062000 { | ||
402 | compatible = "ti,usbhs-tll"; | ||
403 | reg = <0x48062000 0x1000>; | ||
404 | interrupts = <78>; | ||
405 | ti,hwmods = "usb_tll_hs"; | ||
406 | }; | ||
407 | |||
408 | usbhshost: usbhshost@48064000 { | ||
409 | compatible = "ti,usbhs-host"; | ||
410 | reg = <0x48064000 0x400>; | ||
411 | ti,hwmods = "usb_host_hs"; | ||
412 | #address-cells = <1>; | ||
413 | #size-cells = <1>; | ||
414 | ranges; | ||
415 | |||
416 | usbhsohci: ohci@48064400 { | ||
417 | compatible = "ti,ohci-omap3", "usb-ohci"; | ||
418 | reg = <0x48064400 0x400>; | ||
419 | interrupt-parent = <&intc>; | ||
420 | interrupts = <76>; | ||
421 | }; | ||
422 | |||
423 | usbhsehci: ehci@48064800 { | ||
424 | compatible = "ti,ehci-omap", "usb-ehci"; | ||
425 | reg = <0x48064800 0x400>; | ||
426 | interrupt-parent = <&intc>; | ||
427 | interrupts = <77>; | ||
428 | }; | ||
429 | }; | ||
430 | |||
400 | }; | 431 | }; |
401 | }; | 432 | }; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 739bb79e410e..b7db1a2b6ca7 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
@@ -529,5 +529,35 @@ | |||
529 | ti,hwmods = "timer11"; | 529 | ti,hwmods = "timer11"; |
530 | ti,timer-pwm; | 530 | ti,timer-pwm; |
531 | }; | 531 | }; |
532 | |||
533 | usbhstll: usbhstll@4a062000 { | ||
534 | compatible = "ti,usbhs-tll"; | ||
535 | reg = <0x4a062000 0x1000>; | ||
536 | interrupts = <0 78 0x4>; | ||
537 | ti,hwmods = "usb_tll_hs"; | ||
538 | }; | ||
539 | |||
540 | usbhshost: usbhshost@4a064000 { | ||
541 | compatible = "ti,usbhs-host"; | ||
542 | reg = <0x4a064000 0x800>; | ||
543 | ti,hwmods = "usb_host_hs"; | ||
544 | #address-cells = <1>; | ||
545 | #size-cells = <1>; | ||
546 | ranges; | ||
547 | |||
548 | usbhsohci: ohci@4a064800 { | ||
549 | compatible = "ti,ohci-omap3", "usb-ohci"; | ||
550 | reg = <0x4a064800 0x400>; | ||
551 | interrupt-parent = <&gic>; | ||
552 | interrupts = <0 76 0x4>; | ||
553 | }; | ||
554 | |||
555 | usbhsehci: ehci@4a064c00 { | ||
556 | compatible = "ti,ehci-omap", "usb-ehci"; | ||
557 | reg = <0x4a064c00 0x400>; | ||
558 | interrupt-parent = <&gic>; | ||
559 | interrupts = <0 77 0x4>; | ||
560 | }; | ||
561 | }; | ||
532 | }; | 562 | }; |
533 | }; | 563 | }; |
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi new file mode 100644 index 000000000000..fe5c6f213271 --- /dev/null +++ b/arch/arm/boot/dts/r8a7779.dtsi | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * Device Tree Source for Renesas r8a7779 | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
5 | * Copyright (C) 2013 Simon Horman | ||
6 | * | ||
7 | * This file is licensed under the terms of the GNU General Public License | ||
8 | * version 2. This program is licensed "as is" without any warranty of any | ||
9 | * kind, whether express or implied. | ||
10 | */ | ||
11 | |||
12 | /include/ "skeleton.dtsi" | ||
13 | |||
14 | / { | ||
15 | compatible = "renesas,r8a7779"; | ||
16 | |||
17 | cpus { | ||
18 | #address-cells = <1>; | ||
19 | #size-cells = <0>; | ||
20 | |||
21 | cpu@0 { | ||
22 | device_type = "cpu"; | ||
23 | compatible = "arm,cortex-a9"; | ||
24 | reg = <0>; | ||
25 | }; | ||
26 | cpu@1 { | ||
27 | device_type = "cpu"; | ||
28 | compatible = "arm,cortex-a9"; | ||
29 | reg = <1>; | ||
30 | }; | ||
31 | cpu@2 { | ||
32 | device_type = "cpu"; | ||
33 | compatible = "arm,cortex-a9"; | ||
34 | reg = <2>; | ||
35 | }; | ||
36 | cpu@3 { | ||
37 | device_type = "cpu"; | ||
38 | compatible = "arm,cortex-a9"; | ||
39 | reg = <3>; | ||
40 | }; | ||
41 | }; | ||
42 | |||
43 | gic: interrupt-controller@f0001000 { | ||
44 | compatible = "arm,cortex-a9-gic"; | ||
45 | #interrupt-cells = <3>; | ||
46 | interrupt-controller; | ||
47 | reg = <0xf0001000 0x1000>, | ||
48 | <0xf0000100 0x100>; | ||
49 | }; | ||
50 | |||
51 | i2c0: i2c@0xffc70000 { | ||
52 | #address-cells = <1>; | ||
53 | #size-cells = <0>; | ||
54 | compatible = "renesas,rmobile-iic"; | ||
55 | reg = <0xffc70000 0x1000>; | ||
56 | interrupt-parent = <&gic>; | ||
57 | interrupts = <0 79 0x4>; | ||
58 | }; | ||
59 | |||
60 | i2c1: i2c@0xffc71000 { | ||
61 | #address-cells = <1>; | ||
62 | #size-cells = <0>; | ||
63 | compatible = "renesas,rmobile-iic"; | ||
64 | reg = <0xffc71000 0x1000>; | ||
65 | interrupt-parent = <&gic>; | ||
66 | interrupts = <0 82 0x4>; | ||
67 | }; | ||
68 | |||
69 | i2c2: i2c@0xffc72000 { | ||
70 | #address-cells = <1>; | ||
71 | #size-cells = <0>; | ||
72 | compatible = "renesas,rmobile-iic"; | ||
73 | reg = <0xffc72000 0x1000>; | ||
74 | interrupt-parent = <&gic>; | ||
75 | interrupts = <0 80 0x4>; | ||
76 | }; | ||
77 | |||
78 | i2c3: i2c@0xffc73000 { | ||
79 | #address-cells = <1>; | ||
80 | #size-cells = <0>; | ||
81 | compatible = "renesas,rmobile-iic"; | ||
82 | reg = <0xffc73000 0x1000>; | ||
83 | interrupt-parent = <&gic>; | ||
84 | interrupts = <0 81 0x4>; | ||
85 | }; | ||
86 | |||
87 | thermal@ffc48000 { | ||
88 | compatible = "renesas,rcar-thermal"; | ||
89 | reg = <0xffc48000 0x38>; | ||
90 | }; | ||
91 | |||
92 | sata: sata@fc600000 { | ||
93 | compatible = "renesas,rcar-sata"; | ||
94 | reg = <0xfc600000 0x2000>; | ||
95 | interrupt-parent = <&gic>; | ||
96 | interrupts = <0 100 0x4>; | ||
97 | }; | ||
98 | }; | ||
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index a30aca62658a..616990dc92db 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts | |||
@@ -12,10 +12,22 @@ | |||
12 | 12 | ||
13 | serial@70006300 { | 13 | serial@70006300 { |
14 | status = "okay"; | 14 | status = "okay"; |
15 | clock-frequency = <408000000>; | ||
16 | }; | 15 | }; |
17 | 16 | ||
18 | pmc { | 17 | pmc { |
19 | nvidia,invert-interrupt; | 18 | nvidia,invert-interrupt; |
20 | }; | 19 | }; |
20 | |||
21 | clocks { | ||
22 | compatible = "simple-bus"; | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <0>; | ||
25 | |||
26 | clk32k_in: clock { | ||
27 | compatible = "fixed-clock"; | ||
28 | reg=<0>; | ||
29 | #clock-cells = <0>; | ||
30 | clock-frequency = <32768>; | ||
31 | }; | ||
32 | }; | ||
21 | }; | 33 | }; |
diff --git a/arch/arm/boot/dts/tegra114-pluto.dts b/arch/arm/boot/dts/tegra114-pluto.dts index 9bea8f57aa47..6bbc8efae9c0 100644 --- a/arch/arm/boot/dts/tegra114-pluto.dts +++ b/arch/arm/boot/dts/tegra114-pluto.dts | |||
@@ -12,10 +12,22 @@ | |||
12 | 12 | ||
13 | serial@70006300 { | 13 | serial@70006300 { |
14 | status = "okay"; | 14 | status = "okay"; |
15 | clock-frequency = <408000000>; | ||
16 | }; | 15 | }; |
17 | 16 | ||
18 | pmc { | 17 | pmc { |
19 | nvidia,invert-interrupt; | 18 | nvidia,invert-interrupt; |
20 | }; | 19 | }; |
20 | |||
21 | clocks { | ||
22 | compatible = "simple-bus"; | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <0>; | ||
25 | |||
26 | clk32k_in: clock { | ||
27 | compatible = "fixed-clock"; | ||
28 | reg=<0>; | ||
29 | #clock-cells = <0>; | ||
30 | clock-frequency = <32768>; | ||
31 | }; | ||
32 | }; | ||
21 | }; | 33 | }; |
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi index 1dfaf2874c57..c1110a9b2a91 100644 --- a/arch/arm/boot/dts/tegra114.dtsi +++ b/arch/arm/boot/dts/tegra114.dtsi | |||
@@ -24,10 +24,11 @@ | |||
24 | 0 42 0x04 | 24 | 0 42 0x04 |
25 | 0 121 0x04 | 25 | 0 121 0x04 |
26 | 0 122 0x04>; | 26 | 0 122 0x04>; |
27 | clocks = <&tegra_car 5>; | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | tegra_car: clock { | 30 | tegra_car: clock { |
30 | compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; | 31 | compatible = "nvidia,tegra114-car"; |
31 | reg = <0x60006000 0x1000>; | 32 | reg = <0x60006000 0x1000>; |
32 | #clock-cells = <1>; | 33 | #clock-cells = <1>; |
33 | }; | 34 | }; |
@@ -66,6 +67,7 @@ | |||
66 | reg-shift = <2>; | 67 | reg-shift = <2>; |
67 | interrupts = <0 36 0x04>; | 68 | interrupts = <0 36 0x04>; |
68 | status = "disabled"; | 69 | status = "disabled"; |
70 | clocks = <&tegra_car 6>; | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | serial@70006040 { | 73 | serial@70006040 { |
@@ -74,6 +76,7 @@ | |||
74 | reg-shift = <2>; | 76 | reg-shift = <2>; |
75 | interrupts = <0 37 0x04>; | 77 | interrupts = <0 37 0x04>; |
76 | status = "disabled"; | 78 | status = "disabled"; |
79 | clocks = <&tegra_car 192>; | ||
77 | }; | 80 | }; |
78 | 81 | ||
79 | serial@70006200 { | 82 | serial@70006200 { |
@@ -82,6 +85,7 @@ | |||
82 | reg-shift = <2>; | 85 | reg-shift = <2>; |
83 | interrupts = <0 46 0x04>; | 86 | interrupts = <0 46 0x04>; |
84 | status = "disabled"; | 87 | status = "disabled"; |
88 | clocks = <&tegra_car 55>; | ||
85 | }; | 89 | }; |
86 | 90 | ||
87 | serial@70006300 { | 91 | serial@70006300 { |
@@ -90,17 +94,21 @@ | |||
90 | reg-shift = <2>; | 94 | reg-shift = <2>; |
91 | interrupts = <0 90 0x04>; | 95 | interrupts = <0 90 0x04>; |
92 | status = "disabled"; | 96 | status = "disabled"; |
97 | clocks = <&tegra_car 65>; | ||
93 | }; | 98 | }; |
94 | 99 | ||
95 | rtc { | 100 | rtc { |
96 | compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; | 101 | compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; |
97 | reg = <0x7000e000 0x100>; | 102 | reg = <0x7000e000 0x100>; |
98 | interrupts = <0 2 0x04>; | 103 | interrupts = <0 2 0x04>; |
104 | clocks = <&tegra_car 4>; | ||
99 | }; | 105 | }; |
100 | 106 | ||
101 | pmc { | 107 | pmc { |
102 | compatible = "nvidia,tegra114-pmc", "nvidia,tegra30-pmc"; | 108 | compatible = "nvidia,tegra114-pmc"; |
103 | reg = <0x7000e400 0x400>; | 109 | reg = <0x7000e400 0x400>; |
110 | clocks = <&tegra_car 261>, <&clk32k_in>; | ||
111 | clock-names = "pclk", "clk32k_in"; | ||
104 | }; | 112 | }; |
105 | 113 | ||
106 | iommu { | 114 | iommu { |
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi index 444162090042..4e3afdef28a8 100644 --- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi +++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi | |||
@@ -444,7 +444,20 @@ | |||
444 | }; | 444 | }; |
445 | 445 | ||
446 | sdhci@c8000600 { | 446 | sdhci@c8000600 { |
447 | cd-gpios = <&gpio 23 0>; /* gpio PC7 */ | 447 | cd-gpios = <&gpio 23 1>; /* gpio PC7 */ |
448 | }; | ||
449 | |||
450 | clocks { | ||
451 | compatible = "simple-bus"; | ||
452 | #address-cells = <1>; | ||
453 | #size-cells = <0>; | ||
454 | |||
455 | clk32k_in: clock { | ||
456 | compatible = "fixed-clock"; | ||
457 | reg=<0>; | ||
458 | #clock-cells = <0>; | ||
459 | clock-frequency = <32768>; | ||
460 | }; | ||
448 | }; | 461 | }; |
449 | 462 | ||
450 | sound { | 463 | sound { |
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts index 61d027f03617..ae9d5a20834e 100644 --- a/arch/arm/boot/dts/tegra20-harmony.dts +++ b/arch/arm/boot/dts/tegra20-harmony.dts | |||
@@ -437,7 +437,7 @@ | |||
437 | 437 | ||
438 | sdhci@c8000200 { | 438 | sdhci@c8000200 { |
439 | status = "okay"; | 439 | status = "okay"; |
440 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 440 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ |
441 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ | 441 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
442 | power-gpios = <&gpio 155 0>; /* gpio PT3 */ | 442 | power-gpios = <&gpio 155 0>; /* gpio PT3 */ |
443 | bus-width = <4>; | 443 | bus-width = <4>; |
@@ -445,12 +445,25 @@ | |||
445 | 445 | ||
446 | sdhci@c8000600 { | 446 | sdhci@c8000600 { |
447 | status = "okay"; | 447 | status = "okay"; |
448 | cd-gpios = <&gpio 58 0>; /* gpio PH2 */ | 448 | cd-gpios = <&gpio 58 1>; /* gpio PH2 */ |
449 | wp-gpios = <&gpio 59 0>; /* gpio PH3 */ | 449 | wp-gpios = <&gpio 59 0>; /* gpio PH3 */ |
450 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ | 450 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ |
451 | bus-width = <8>; | 451 | bus-width = <8>; |
452 | }; | 452 | }; |
453 | 453 | ||
454 | clocks { | ||
455 | compatible = "simple-bus"; | ||
456 | #address-cells = <1>; | ||
457 | #size-cells = <0>; | ||
458 | |||
459 | clk32k_in: clock { | ||
460 | compatible = "fixed-clock"; | ||
461 | reg=<0>; | ||
462 | #clock-cells = <0>; | ||
463 | clock-frequency = <32768>; | ||
464 | }; | ||
465 | }; | ||
466 | |||
454 | kbc { | 467 | kbc { |
455 | status = "okay"; | 468 | status = "okay"; |
456 | nvidia,debounce-delay-ms = <2>; | 469 | nvidia,debounce-delay-ms = <2>; |
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts index 54d6fce00a59..fd60940e4063 100644 --- a/arch/arm/boot/dts/tegra20-paz00.dts +++ b/arch/arm/boot/dts/tegra20-paz00.dts | |||
@@ -436,7 +436,7 @@ | |||
436 | 436 | ||
437 | sdhci@c8000000 { | 437 | sdhci@c8000000 { |
438 | status = "okay"; | 438 | status = "okay"; |
439 | cd-gpios = <&gpio 173 0>; /* gpio PV5 */ | 439 | cd-gpios = <&gpio 173 1>; /* gpio PV5 */ |
440 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ | 440 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
441 | power-gpios = <&gpio 169 0>; /* gpio PV1 */ | 441 | power-gpios = <&gpio 169 0>; /* gpio PV1 */ |
442 | bus-width = <4>; | 442 | bus-width = <4>; |
@@ -447,6 +447,19 @@ | |||
447 | bus-width = <8>; | 447 | bus-width = <8>; |
448 | }; | 448 | }; |
449 | 449 | ||
450 | clocks { | ||
451 | compatible = "simple-bus"; | ||
452 | #address-cells = <1>; | ||
453 | #size-cells = <0>; | ||
454 | |||
455 | clk32k_in: clock { | ||
456 | compatible = "fixed-clock"; | ||
457 | reg=<0>; | ||
458 | #clock-cells = <0>; | ||
459 | clock-frequency = <32768>; | ||
460 | }; | ||
461 | }; | ||
462 | |||
450 | gpio-keys { | 463 | gpio-keys { |
451 | compatible = "gpio-keys"; | 464 | compatible = "gpio-keys"; |
452 | 465 | ||
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts index 37b3a57ec0f1..4ee700a33ca5 100644 --- a/arch/arm/boot/dts/tegra20-seaboard.dts +++ b/arch/arm/boot/dts/tegra20-seaboard.dts | |||
@@ -584,7 +584,7 @@ | |||
584 | 584 | ||
585 | sdhci@c8000400 { | 585 | sdhci@c8000400 { |
586 | status = "okay"; | 586 | status = "okay"; |
587 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 587 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ |
588 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ | 588 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
589 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ | 589 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ |
590 | bus-width = <4>; | 590 | bus-width = <4>; |
@@ -595,6 +595,19 @@ | |||
595 | bus-width = <8>; | 595 | bus-width = <8>; |
596 | }; | 596 | }; |
597 | 597 | ||
598 | clocks { | ||
599 | compatible = "simple-bus"; | ||
600 | #address-cells = <1>; | ||
601 | #size-cells = <0>; | ||
602 | |||
603 | clk32k_in: clock { | ||
604 | compatible = "fixed-clock"; | ||
605 | reg=<0>; | ||
606 | #clock-cells = <0>; | ||
607 | clock-frequency = <32768>; | ||
608 | }; | ||
609 | }; | ||
610 | |||
598 | gpio-keys { | 611 | gpio-keys { |
599 | compatible = "gpio-keys"; | 612 | compatible = "gpio-keys"; |
600 | 613 | ||
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi index 4766abae7a72..c19025725918 100644 --- a/arch/arm/boot/dts/tegra20-tamonten.dtsi +++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi | |||
@@ -465,12 +465,25 @@ | |||
465 | }; | 465 | }; |
466 | 466 | ||
467 | sdhci@c8000600 { | 467 | sdhci@c8000600 { |
468 | cd-gpios = <&gpio 58 0>; /* gpio PH2 */ | 468 | cd-gpios = <&gpio 58 1>; /* gpio PH2 */ |
469 | wp-gpios = <&gpio 59 0>; /* gpio PH3 */ | 469 | wp-gpios = <&gpio 59 0>; /* gpio PH3 */ |
470 | bus-width = <4>; | 470 | bus-width = <4>; |
471 | status = "okay"; | 471 | status = "okay"; |
472 | }; | 472 | }; |
473 | 473 | ||
474 | clocks { | ||
475 | compatible = "simple-bus"; | ||
476 | #address-cells = <1>; | ||
477 | #size-cells = <0>; | ||
478 | |||
479 | clk32k_in: clock { | ||
480 | compatible = "fixed-clock"; | ||
481 | reg=<0>; | ||
482 | #clock-cells = <0>; | ||
483 | clock-frequency = <32768>; | ||
484 | }; | ||
485 | }; | ||
486 | |||
474 | regulators { | 487 | regulators { |
475 | compatible = "simple-bus"; | 488 | compatible = "simple-bus"; |
476 | 489 | ||
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts index 5d79e4fc49a6..a9f3f06580f5 100644 --- a/arch/arm/boot/dts/tegra20-trimslice.dts +++ b/arch/arm/boot/dts/tegra20-trimslice.dts | |||
@@ -325,11 +325,24 @@ | |||
325 | 325 | ||
326 | sdhci@c8000600 { | 326 | sdhci@c8000600 { |
327 | status = "okay"; | 327 | status = "okay"; |
328 | cd-gpios = <&gpio 121 0>; /* gpio PP1 */ | 328 | cd-gpios = <&gpio 121 1>; /* gpio PP1 */ |
329 | wp-gpios = <&gpio 122 0>; /* gpio PP2 */ | 329 | wp-gpios = <&gpio 122 0>; /* gpio PP2 */ |
330 | bus-width = <4>; | 330 | bus-width = <4>; |
331 | }; | 331 | }; |
332 | 332 | ||
333 | clocks { | ||
334 | compatible = "simple-bus"; | ||
335 | #address-cells = <1>; | ||
336 | #size-cells = <0>; | ||
337 | |||
338 | clk32k_in: clock { | ||
339 | compatible = "fixed-clock"; | ||
340 | reg=<0>; | ||
341 | #clock-cells = <0>; | ||
342 | clock-frequency = <32768>; | ||
343 | }; | ||
344 | }; | ||
345 | |||
333 | poweroff { | 346 | poweroff { |
334 | compatible = "gpio-poweroff"; | 347 | compatible = "gpio-poweroff"; |
335 | gpios = <&gpio 191 1>; /* gpio PX7, active low */ | 348 | gpios = <&gpio 191 1>; /* gpio PX7, active low */ |
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts index 425c89000c20..f544806e9618 100644 --- a/arch/arm/boot/dts/tegra20-ventana.dts +++ b/arch/arm/boot/dts/tegra20-ventana.dts | |||
@@ -520,7 +520,7 @@ | |||
520 | 520 | ||
521 | sdhci@c8000400 { | 521 | sdhci@c8000400 { |
522 | status = "okay"; | 522 | status = "okay"; |
523 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 523 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ |
524 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ | 524 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
525 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ | 525 | power-gpios = <&gpio 70 0>; /* gpio PI6 */ |
526 | bus-width = <4>; | 526 | bus-width = <4>; |
@@ -531,6 +531,19 @@ | |||
531 | bus-width = <8>; | 531 | bus-width = <8>; |
532 | }; | 532 | }; |
533 | 533 | ||
534 | clocks { | ||
535 | compatible = "simple-bus"; | ||
536 | #address-cells = <1>; | ||
537 | #size-cells = <0>; | ||
538 | |||
539 | clk32k_in: clock { | ||
540 | compatible = "fixed-clock"; | ||
541 | reg=<0>; | ||
542 | #clock-cells = <0>; | ||
543 | clock-frequency = <32768>; | ||
544 | }; | ||
545 | }; | ||
546 | |||
534 | regulators { | 547 | regulators { |
535 | compatible = "simple-bus"; | 548 | compatible = "simple-bus"; |
536 | #address-cells = <1>; | 549 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts index ea57c0f6dcce..258cf945f515 100644 --- a/arch/arm/boot/dts/tegra20-whistler.dts +++ b/arch/arm/boot/dts/tegra20-whistler.dts | |||
@@ -510,6 +510,7 @@ | |||
510 | 510 | ||
511 | sdhci@c8000400 { | 511 | sdhci@c8000400 { |
512 | status = "okay"; | 512 | status = "okay"; |
513 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ | ||
513 | wp-gpios = <&gpio 173 0>; /* gpio PV5 */ | 514 | wp-gpios = <&gpio 173 0>; /* gpio PV5 */ |
514 | bus-width = <8>; | 515 | bus-width = <8>; |
515 | }; | 516 | }; |
@@ -519,6 +520,19 @@ | |||
519 | bus-width = <8>; | 520 | bus-width = <8>; |
520 | }; | 521 | }; |
521 | 522 | ||
523 | clocks { | ||
524 | compatible = "simple-bus"; | ||
525 | #address-cells = <1>; | ||
526 | #size-cells = <0>; | ||
527 | |||
528 | clk32k_in: clock { | ||
529 | compatible = "fixed-clock"; | ||
530 | reg=<0>; | ||
531 | #clock-cells = <0>; | ||
532 | clock-frequency = <32768>; | ||
533 | }; | ||
534 | }; | ||
535 | |||
522 | kbc { | 536 | kbc { |
523 | status = "okay"; | 537 | status = "okay"; |
524 | nvidia,debounce-delay-ms = <20>; | 538 | nvidia,debounce-delay-ms = <20>; |
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi index 3d3f64d2111a..fc7febc2b386 100644 --- a/arch/arm/boot/dts/tegra20.dtsi +++ b/arch/arm/boot/dts/tegra20.dtsi | |||
@@ -145,6 +145,7 @@ | |||
145 | 0 1 0x04 | 145 | 0 1 0x04 |
146 | 0 41 0x04 | 146 | 0 41 0x04 |
147 | 0 42 0x04>; | 147 | 0 42 0x04>; |
148 | clocks = <&tegra_car 5>; | ||
148 | }; | 149 | }; |
149 | 150 | ||
150 | tegra_car: clock { | 151 | tegra_car: clock { |
@@ -304,6 +305,7 @@ | |||
304 | compatible = "nvidia,tegra20-rtc"; | 305 | compatible = "nvidia,tegra20-rtc"; |
305 | reg = <0x7000e000 0x100>; | 306 | reg = <0x7000e000 0x100>; |
306 | interrupts = <0 2 0x04>; | 307 | interrupts = <0 2 0x04>; |
308 | clocks = <&tegra_car 4>; | ||
307 | }; | 309 | }; |
308 | 310 | ||
309 | i2c@7000c000 { | 311 | i2c@7000c000 { |
@@ -416,6 +418,8 @@ | |||
416 | pmc { | 418 | pmc { |
417 | compatible = "nvidia,tegra20-pmc"; | 419 | compatible = "nvidia,tegra20-pmc"; |
418 | reg = <0x7000e400 0x400>; | 420 | reg = <0x7000e400 0x400>; |
421 | clocks = <&tegra_car 110>, <&clk32k_in>; | ||
422 | clock-names = "pclk", "clk32k_in"; | ||
419 | }; | 423 | }; |
420 | 424 | ||
421 | memory-controller@7000f000 { | 425 | memory-controller@7000f000 { |
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts index 8ff2ff20e4a3..6248b2445b32 100644 --- a/arch/arm/boot/dts/tegra30-beaver.dts +++ b/arch/arm/boot/dts/tegra30-beaver.dts | |||
@@ -257,7 +257,7 @@ | |||
257 | 257 | ||
258 | sdhci@78000000 { | 258 | sdhci@78000000 { |
259 | status = "okay"; | 259 | status = "okay"; |
260 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 260 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ |
261 | wp-gpios = <&gpio 155 0>; /* gpio PT3 */ | 261 | wp-gpios = <&gpio 155 0>; /* gpio PT3 */ |
262 | power-gpios = <&gpio 31 0>; /* gpio PD7 */ | 262 | power-gpios = <&gpio 31 0>; /* gpio PD7 */ |
263 | bus-width = <4>; | 263 | bus-width = <4>; |
@@ -268,6 +268,19 @@ | |||
268 | bus-width = <8>; | 268 | bus-width = <8>; |
269 | }; | 269 | }; |
270 | 270 | ||
271 | clocks { | ||
272 | compatible = "simple-bus"; | ||
273 | #address-cells = <1>; | ||
274 | #size-cells = <0>; | ||
275 | |||
276 | clk32k_in: clock { | ||
277 | compatible = "fixed-clock"; | ||
278 | reg=<0>; | ||
279 | #clock-cells = <0>; | ||
280 | clock-frequency = <32768>; | ||
281 | }; | ||
282 | }; | ||
283 | |||
271 | regulators { | 284 | regulators { |
272 | compatible = "simple-bus"; | 285 | compatible = "simple-bus"; |
273 | #address-cells = <1>; | 286 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi index 17499272a4ef..65bf2b63174e 100644 --- a/arch/arm/boot/dts/tegra30-cardhu.dtsi +++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi | |||
@@ -311,7 +311,7 @@ | |||
311 | 311 | ||
312 | sdhci@78000000 { | 312 | sdhci@78000000 { |
313 | status = "okay"; | 313 | status = "okay"; |
314 | cd-gpios = <&gpio 69 0>; /* gpio PI5 */ | 314 | cd-gpios = <&gpio 69 1>; /* gpio PI5 */ |
315 | wp-gpios = <&gpio 155 0>; /* gpio PT3 */ | 315 | wp-gpios = <&gpio 155 0>; /* gpio PT3 */ |
316 | power-gpios = <&gpio 31 0>; /* gpio PD7 */ | 316 | power-gpios = <&gpio 31 0>; /* gpio PD7 */ |
317 | bus-width = <4>; | 317 | bus-width = <4>; |
@@ -322,6 +322,19 @@ | |||
322 | bus-width = <8>; | 322 | bus-width = <8>; |
323 | }; | 323 | }; |
324 | 324 | ||
325 | clocks { | ||
326 | compatible = "simple-bus"; | ||
327 | #address-cells = <1>; | ||
328 | #size-cells = <0>; | ||
329 | |||
330 | clk32k_in: clock { | ||
331 | compatible = "fixed-clock"; | ||
332 | reg=<0>; | ||
333 | #clock-cells = <0>; | ||
334 | clock-frequency = <32768>; | ||
335 | }; | ||
336 | }; | ||
337 | |||
325 | regulators { | 338 | regulators { |
326 | compatible = "simple-bus"; | 339 | compatible = "simple-bus"; |
327 | #address-cells = <1>; | 340 | #address-cells = <1>; |
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index dbf46c272562..9fe7a92b4c85 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi | |||
@@ -148,6 +148,7 @@ | |||
148 | 0 42 0x04 | 148 | 0 42 0x04 |
149 | 0 121 0x04 | 149 | 0 121 0x04 |
150 | 0 122 0x04>; | 150 | 0 122 0x04>; |
151 | clocks = <&tegra_car 5>; | ||
151 | }; | 152 | }; |
152 | 153 | ||
153 | tegra_car: clock { | 154 | tegra_car: clock { |
@@ -291,6 +292,7 @@ | |||
291 | compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc"; | 292 | compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc"; |
292 | reg = <0x7000e000 0x100>; | 293 | reg = <0x7000e000 0x100>; |
293 | interrupts = <0 2 0x04>; | 294 | interrupts = <0 2 0x04>; |
295 | clocks = <&tegra_car 4>; | ||
294 | }; | 296 | }; |
295 | 297 | ||
296 | i2c@7000c000 { | 298 | i2c@7000c000 { |
@@ -423,8 +425,10 @@ | |||
423 | }; | 425 | }; |
424 | 426 | ||
425 | pmc { | 427 | pmc { |
426 | compatible = "nvidia,tegra20-pmc", "nvidia,tegra30-pmc"; | 428 | compatible = "nvidia,tegra30-pmc"; |
427 | reg = <0x7000e400 0x400>; | 429 | reg = <0x7000e400 0x400>; |
430 | clocks = <&tegra_car 218>, <&clk32k_in>; | ||
431 | clock-names = "pclk", "clk32k_in"; | ||
428 | }; | 432 | }; |
429 | 433 | ||
430 | memory-controller { | 434 | memory-controller { |
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts index e2fe3195c0d1..dde75ae8b4b1 100644 --- a/arch/arm/boot/dts/versatile-ab.dts +++ b/arch/arm/boot/dts/versatile-ab.dts | |||
@@ -121,6 +121,18 @@ | |||
121 | interrupts = <0>; | 121 | interrupts = <0>; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | timer@101e2000 { | ||
125 | compatible = "arm,sp804", "arm,primecell"; | ||
126 | reg = <0x101e2000 0x1000>; | ||
127 | interrupts = <4>; | ||
128 | }; | ||
129 | |||
130 | timer@101e3000 { | ||
131 | compatible = "arm,sp804", "arm,primecell"; | ||
132 | reg = <0x101e3000 0x1000>; | ||
133 | interrupts = <5>; | ||
134 | }; | ||
135 | |||
124 | gpio0: gpio@101e4000 { | 136 | gpio0: gpio@101e4000 { |
125 | compatible = "arm,pl061", "arm,primecell"; | 137 | compatible = "arm,pl061", "arm,primecell"; |
126 | reg = <0x101e4000 0x1000>; | 138 | reg = <0x101e4000 0x1000>; |
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca9.dts b/arch/arm/boot/dts/vexpress-v2p-ca9.dts index 1420bb14d95c..62d9b225dcce 100644 --- a/arch/arm/boot/dts/vexpress-v2p-ca9.dts +++ b/arch/arm/boot/dts/vexpress-v2p-ca9.dts | |||
@@ -98,6 +98,7 @@ | |||
98 | <0 49 4>; | 98 | <0 49 4>; |
99 | clocks = <&oscclk2>, <&oscclk2>; | 99 | clocks = <&oscclk2>, <&oscclk2>; |
100 | clock-names = "timclk", "apb_pclk"; | 100 | clock-names = "timclk", "apb_pclk"; |
101 | status = "disabled"; | ||
101 | }; | 102 | }; |
102 | 103 | ||
103 | watchdog@100e5000 { | 104 | watchdog@100e5000 { |
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi index cf31ced46602..e1c3926aca52 100644 --- a/arch/arm/boot/dts/vt8500.dtsi +++ b/arch/arm/boot/dts/vt8500.dtsi | |||
@@ -25,11 +25,13 @@ | |||
25 | #interrupt-cells = <1>; | 25 | #interrupt-cells = <1>; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | gpio: gpio-controller@d8110000 { | 28 | pinctrl: pinctrl@d8110000 { |
29 | compatible = "via,vt8500-gpio"; | 29 | compatible = "via,vt8500-pinctrl"; |
30 | gpio-controller; | ||
31 | reg = <0xd8110000 0x10000>; | 30 | reg = <0xd8110000 0x10000>; |
32 | #gpio-cells = <3>; | 31 | interrupt-controller; |
32 | #interrupt-cells = <2>; | ||
33 | gpio-controller; | ||
34 | #gpio-cells = <2>; | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | pmc@d8130000 { | 37 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi index e74a1c0fb9a2..bb92ef8ce665 100644 --- a/arch/arm/boot/dts/wm8505.dtsi +++ b/arch/arm/boot/dts/wm8505.dtsi | |||
@@ -40,11 +40,13 @@ | |||
40 | interrupts = <56 57 58 59 60 61 62 63>; | 40 | interrupts = <56 57 58 59 60 61 62 63>; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | gpio: gpio-controller@d8110000 { | 43 | pinctrl: pinctrl@d8110000 { |
44 | compatible = "wm,wm8505-gpio"; | 44 | compatible = "wm,wm8505-pinctrl"; |
45 | gpio-controller; | ||
46 | reg = <0xd8110000 0x10000>; | 45 | reg = <0xd8110000 0x10000>; |
47 | #gpio-cells = <3>; | 46 | interrupt-controller; |
47 | #interrupt-cells = <2>; | ||
48 | gpio-controller; | ||
49 | #gpio-cells = <2>; | ||
48 | }; | 50 | }; |
49 | 51 | ||
50 | pmc@d8130000 { | 52 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi index db3c0a12e052..bb4af580f40b 100644 --- a/arch/arm/boot/dts/wm8650.dtsi +++ b/arch/arm/boot/dts/wm8650.dtsi | |||
@@ -34,11 +34,13 @@ | |||
34 | interrupts = <56 57 58 59 60 61 62 63>; | 34 | interrupts = <56 57 58 59 60 61 62 63>; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | gpio: gpio-controller@d8110000 { | 37 | pinctrl: pinctrl@d8110000 { |
38 | compatible = "wm,wm8650-gpio"; | 38 | compatible = "wm,wm8650-pinctrl"; |
39 | gpio-controller; | ||
40 | reg = <0xd8110000 0x10000>; | 39 | reg = <0xd8110000 0x10000>; |
41 | #gpio-cells = <3>; | 40 | interrupt-controller; |
41 | #interrupt-cells = <2>; | ||
42 | gpio-controller; | ||
43 | #gpio-cells = <2>; | ||
42 | }; | 44 | }; |
43 | 45 | ||
44 | pmc@d8130000 { | 46 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi index e8cbfdc87bba..11cd180c58d3 100644 --- a/arch/arm/boot/dts/wm8850.dtsi +++ b/arch/arm/boot/dts/wm8850.dtsi | |||
@@ -41,11 +41,13 @@ | |||
41 | interrupts = <56 57 58 59 60 61 62 63>; | 41 | interrupts = <56 57 58 59 60 61 62 63>; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | gpio: gpio-controller@d8110000 { | 44 | pinctrl: pinctrl@d8110000 { |
45 | compatible = "wm,wm8650-gpio"; | 45 | compatible = "wm,wm8850-pinctrl"; |
46 | gpio-controller; | ||
47 | reg = <0xd8110000 0x10000>; | 46 | reg = <0xd8110000 0x10000>; |
48 | #gpio-cells = <3>; | 47 | interrupt-controller; |
48 | #interrupt-cells = <2>; | ||
49 | gpio-controller; | ||
50 | #gpio-cells = <2>; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | pmc@d8130000 { | 53 | pmc@d8130000 { |
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 5914b5654591..51243db2e9e4 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi | |||
@@ -111,56 +111,23 @@ | |||
111 | }; | 111 | }; |
112 | 112 | ||
113 | ttc0: ttc0@f8001000 { | 113 | ttc0: ttc0@f8001000 { |
114 | #address-cells = <1>; | 114 | interrupt-parent = <&intc>; |
115 | #size-cells = <0>; | 115 | interrupts = < 0 10 4 0 11 4 0 12 4 >; |
116 | compatible = "xlnx,ttc"; | 116 | compatible = "cdns,ttc"; |
117 | reg = <0xF8001000 0x1000>; | 117 | reg = <0xF8001000 0x1000>; |
118 | clocks = <&cpu_clk 3>; | 118 | clocks = <&cpu_clk 3>; |
119 | clock-names = "cpu_1x"; | 119 | clock-names = "cpu_1x"; |
120 | clock-ranges; | 120 | clock-ranges; |
121 | |||
122 | ttc0_0: ttc0.0 { | ||
123 | status = "disabled"; | ||
124 | reg = <0>; | ||
125 | interrupts = <0 10 4>; | ||
126 | }; | ||
127 | ttc0_1: ttc0.1 { | ||
128 | status = "disabled"; | ||
129 | reg = <1>; | ||
130 | interrupts = <0 11 4>; | ||
131 | }; | ||
132 | ttc0_2: ttc0.2 { | ||
133 | status = "disabled"; | ||
134 | reg = <2>; | ||
135 | interrupts = <0 12 4>; | ||
136 | }; | ||
137 | }; | 121 | }; |
138 | 122 | ||
139 | ttc1: ttc1@f8002000 { | 123 | ttc1: ttc1@f8002000 { |
140 | #interrupt-parent = <&intc>; | 124 | interrupt-parent = <&intc>; |
141 | #address-cells = <1>; | 125 | interrupts = < 0 37 4 0 38 4 0 39 4 >; |
142 | #size-cells = <0>; | 126 | compatible = "cdns,ttc"; |
143 | compatible = "xlnx,ttc"; | ||
144 | reg = <0xF8002000 0x1000>; | 127 | reg = <0xF8002000 0x1000>; |
145 | clocks = <&cpu_clk 3>; | 128 | clocks = <&cpu_clk 3>; |
146 | clock-names = "cpu_1x"; | 129 | clock-names = "cpu_1x"; |
147 | clock-ranges; | 130 | clock-ranges; |
148 | |||
149 | ttc1_0: ttc1.0 { | ||
150 | status = "disabled"; | ||
151 | reg = <0>; | ||
152 | interrupts = <0 37 4>; | ||
153 | }; | ||
154 | ttc1_1: ttc1.1 { | ||
155 | status = "disabled"; | ||
156 | reg = <1>; | ||
157 | interrupts = <0 38 4>; | ||
158 | }; | ||
159 | ttc1_2: ttc1.2 { | ||
160 | status = "disabled"; | ||
161 | reg = <2>; | ||
162 | interrupts = <0 39 4>; | ||
163 | }; | ||
164 | }; | 131 | }; |
165 | }; | 132 | }; |
166 | }; | 133 | }; |
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts index c772942a399a..86f44d5b0265 100644 --- a/arch/arm/boot/dts/zynq-zc702.dts +++ b/arch/arm/boot/dts/zynq-zc702.dts | |||
@@ -32,13 +32,3 @@ | |||
32 | &ps_clk { | 32 | &ps_clk { |
33 | clock-frequency = <33333330>; | 33 | clock-frequency = <33333330>; |
34 | }; | 34 | }; |
35 | |||
36 | &ttc0_0 { | ||
37 | status = "ok"; | ||
38 | compatible = "xlnx,ttc-counter-clocksource"; | ||
39 | }; | ||
40 | |||
41 | &ttc0_1 { | ||
42 | status = "ok"; | ||
43 | compatible = "xlnx,ttc-counter-clockevent"; | ||
44 | }; | ||
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c index 9d2d3ba339ff..ddc740769601 100644 --- a/arch/arm/common/timer-sp.c +++ b/arch/arm/common/timer-sp.c | |||
@@ -25,33 +25,29 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/of.h> | ||
29 | #include <linux/of_address.h> | ||
30 | #include <linux/of_irq.h> | ||
28 | 31 | ||
29 | #include <asm/sched_clock.h> | 32 | #include <asm/sched_clock.h> |
30 | #include <asm/hardware/arm_timer.h> | 33 | #include <asm/hardware/arm_timer.h> |
34 | #include <asm/hardware/timer-sp.h> | ||
31 | 35 | ||
32 | static long __init sp804_get_clock_rate(const char *name) | 36 | static long __init sp804_get_clock_rate(struct clk *clk) |
33 | { | 37 | { |
34 | struct clk *clk; | ||
35 | long rate; | 38 | long rate; |
36 | int err; | 39 | int err; |
37 | 40 | ||
38 | clk = clk_get_sys("sp804", name); | ||
39 | if (IS_ERR(clk)) { | ||
40 | pr_err("sp804: %s clock not found: %d\n", name, | ||
41 | (int)PTR_ERR(clk)); | ||
42 | return PTR_ERR(clk); | ||
43 | } | ||
44 | |||
45 | err = clk_prepare(clk); | 41 | err = clk_prepare(clk); |
46 | if (err) { | 42 | if (err) { |
47 | pr_err("sp804: %s clock failed to prepare: %d\n", name, err); | 43 | pr_err("sp804: clock failed to prepare: %d\n", err); |
48 | clk_put(clk); | 44 | clk_put(clk); |
49 | return err; | 45 | return err; |
50 | } | 46 | } |
51 | 47 | ||
52 | err = clk_enable(clk); | 48 | err = clk_enable(clk); |
53 | if (err) { | 49 | if (err) { |
54 | pr_err("sp804: %s clock failed to enable: %d\n", name, err); | 50 | pr_err("sp804: clock failed to enable: %d\n", err); |
55 | clk_unprepare(clk); | 51 | clk_unprepare(clk); |
56 | clk_put(clk); | 52 | clk_put(clk); |
57 | return err; | 53 | return err; |
@@ -59,7 +55,7 @@ static long __init sp804_get_clock_rate(const char *name) | |||
59 | 55 | ||
60 | rate = clk_get_rate(clk); | 56 | rate = clk_get_rate(clk); |
61 | if (rate < 0) { | 57 | if (rate < 0) { |
62 | pr_err("sp804: %s clock failed to get rate: %ld\n", name, rate); | 58 | pr_err("sp804: clock failed to get rate: %ld\n", rate); |
63 | clk_disable(clk); | 59 | clk_disable(clk); |
64 | clk_unprepare(clk); | 60 | clk_unprepare(clk); |
65 | clk_put(clk); | 61 | clk_put(clk); |
@@ -77,9 +73,21 @@ static u32 sp804_read(void) | |||
77 | 73 | ||
78 | void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base, | 74 | void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base, |
79 | const char *name, | 75 | const char *name, |
76 | struct clk *clk, | ||
80 | int use_sched_clock) | 77 | int use_sched_clock) |
81 | { | 78 | { |
82 | long rate = sp804_get_clock_rate(name); | 79 | long rate; |
80 | |||
81 | if (!clk) { | ||
82 | clk = clk_get_sys("sp804", name); | ||
83 | if (IS_ERR(clk)) { | ||
84 | pr_err("sp804: clock not found: %d\n", | ||
85 | (int)PTR_ERR(clk)); | ||
86 | return; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | rate = sp804_get_clock_rate(clk); | ||
83 | 91 | ||
84 | if (rate < 0) | 92 | if (rate < 0) |
85 | return; | 93 | return; |
@@ -171,12 +179,20 @@ static struct irqaction sp804_timer_irq = { | |||
171 | .dev_id = &sp804_clockevent, | 179 | .dev_id = &sp804_clockevent, |
172 | }; | 180 | }; |
173 | 181 | ||
174 | void __init sp804_clockevents_init(void __iomem *base, unsigned int irq, | 182 | void __init __sp804_clockevents_init(void __iomem *base, unsigned int irq, struct clk *clk, const char *name) |
175 | const char *name) | ||
176 | { | 183 | { |
177 | struct clock_event_device *evt = &sp804_clockevent; | 184 | struct clock_event_device *evt = &sp804_clockevent; |
178 | long rate = sp804_get_clock_rate(name); | 185 | long rate; |
179 | 186 | ||
187 | if (!clk) | ||
188 | clk = clk_get_sys("sp804", name); | ||
189 | if (IS_ERR(clk)) { | ||
190 | pr_err("sp804: %s clock not found: %d\n", name, | ||
191 | (int)PTR_ERR(clk)); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | rate = sp804_get_clock_rate(clk); | ||
180 | if (rate < 0) | 196 | if (rate < 0) |
181 | return; | 197 | return; |
182 | 198 | ||
@@ -186,6 +202,98 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq, | |||
186 | evt->irq = irq; | 202 | evt->irq = irq; |
187 | evt->cpumask = cpu_possible_mask; | 203 | evt->cpumask = cpu_possible_mask; |
188 | 204 | ||
205 | writel(0, base + TIMER_CTRL); | ||
206 | |||
189 | setup_irq(irq, &sp804_timer_irq); | 207 | setup_irq(irq, &sp804_timer_irq); |
190 | clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); | 208 | clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); |
191 | } | 209 | } |
210 | |||
211 | static void __init sp804_of_init(struct device_node *np) | ||
212 | { | ||
213 | static bool initialized = false; | ||
214 | void __iomem *base; | ||
215 | int irq; | ||
216 | u32 irq_num = 0; | ||
217 | struct clk *clk1, *clk2; | ||
218 | const char *name = of_get_property(np, "compatible", NULL); | ||
219 | |||
220 | base = of_iomap(np, 0); | ||
221 | if (WARN_ON(!base)) | ||
222 | return; | ||
223 | |||
224 | /* Ensure timers are disabled */ | ||
225 | writel(0, base + TIMER_CTRL); | ||
226 | writel(0, base + TIMER_2_BASE + TIMER_CTRL); | ||
227 | |||
228 | if (initialized || !of_device_is_available(np)) | ||
229 | goto err; | ||
230 | |||
231 | clk1 = of_clk_get(np, 0); | ||
232 | if (IS_ERR(clk1)) | ||
233 | clk1 = NULL; | ||
234 | |||
235 | /* Get the 2nd clock if the timer has 2 timer clocks */ | ||
236 | if (of_count_phandle_with_args(np, "clocks", "#clock-cells") == 3) { | ||
237 | clk2 = of_clk_get(np, 1); | ||
238 | if (IS_ERR(clk2)) { | ||
239 | pr_err("sp804: %s clock not found: %d\n", np->name, | ||
240 | (int)PTR_ERR(clk2)); | ||
241 | goto err; | ||
242 | } | ||
243 | } else | ||
244 | clk2 = clk1; | ||
245 | |||
246 | irq = irq_of_parse_and_map(np, 0); | ||
247 | if (irq <= 0) | ||
248 | goto err; | ||
249 | |||
250 | of_property_read_u32(np, "arm,sp804-has-irq", &irq_num); | ||
251 | if (irq_num == 2) { | ||
252 | __sp804_clockevents_init(base + TIMER_2_BASE, irq, clk2, name); | ||
253 | __sp804_clocksource_and_sched_clock_init(base, name, clk1, 1); | ||
254 | } else { | ||
255 | __sp804_clockevents_init(base, irq, clk1 , name); | ||
256 | __sp804_clocksource_and_sched_clock_init(base + TIMER_2_BASE, | ||
257 | name, clk2, 1); | ||
258 | } | ||
259 | initialized = true; | ||
260 | |||
261 | return; | ||
262 | err: | ||
263 | iounmap(base); | ||
264 | } | ||
265 | CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_of_init); | ||
266 | |||
267 | static void __init integrator_cp_of_init(struct device_node *np) | ||
268 | { | ||
269 | static int init_count = 0; | ||
270 | void __iomem *base; | ||
271 | int irq; | ||
272 | const char *name = of_get_property(np, "compatible", NULL); | ||
273 | |||
274 | base = of_iomap(np, 0); | ||
275 | if (WARN_ON(!base)) | ||
276 | return; | ||
277 | |||
278 | /* Ensure timer is disabled */ | ||
279 | writel(0, base + TIMER_CTRL); | ||
280 | |||
281 | if (init_count == 2 || !of_device_is_available(np)) | ||
282 | goto err; | ||
283 | |||
284 | if (!init_count) | ||
285 | sp804_clocksource_init(base, name); | ||
286 | else { | ||
287 | irq = irq_of_parse_and_map(np, 0); | ||
288 | if (irq <= 0) | ||
289 | goto err; | ||
290 | |||
291 | sp804_clockevents_init(base, irq, name); | ||
292 | } | ||
293 | |||
294 | init_count++; | ||
295 | return; | ||
296 | err: | ||
297 | iounmap(base); | ||
298 | } | ||
299 | CLOCKSOURCE_OF_DECLARE(intcp, "arm,integrator-cp-timer", integrator_cp_of_init); | ||
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h index 7ade91d8cc6f..7c1bfc0aea0c 100644 --- a/arch/arm/include/asm/arch_timer.h +++ b/arch/arm/include/asm/arch_timer.h | |||
@@ -10,8 +10,7 @@ | |||
10 | #include <clocksource/arm_arch_timer.h> | 10 | #include <clocksource/arm_arch_timer.h> |
11 | 11 | ||
12 | #ifdef CONFIG_ARM_ARCH_TIMER | 12 | #ifdef CONFIG_ARM_ARCH_TIMER |
13 | int arch_timer_of_register(void); | 13 | int arch_timer_arch_init(void); |
14 | int arch_timer_sched_clock_init(void); | ||
15 | 14 | ||
16 | /* | 15 | /* |
17 | * These register accessors are marked inline so the compiler can | 16 | * These register accessors are marked inline so the compiler can |
@@ -110,16 +109,6 @@ static inline void __cpuinit arch_counter_set_user_access(void) | |||
110 | 109 | ||
111 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); | 110 | asm volatile("mcr p15, 0, %0, c14, c1, 0" : : "r" (cntkctl)); |
112 | } | 111 | } |
113 | #else | ||
114 | static inline int arch_timer_of_register(void) | ||
115 | { | ||
116 | return -ENXIO; | ||
117 | } | ||
118 | |||
119 | static inline int arch_timer_sched_clock_init(void) | ||
120 | { | ||
121 | return -ENXIO; | ||
122 | } | ||
123 | #endif | 112 | #endif |
124 | 113 | ||
125 | #endif | 114 | #endif |
diff --git a/arch/arm/include/asm/hardware/timer-sp.h b/arch/arm/include/asm/hardware/timer-sp.h index 2dd9d3f83f29..bb28af7c32de 100644 --- a/arch/arm/include/asm/hardware/timer-sp.h +++ b/arch/arm/include/asm/hardware/timer-sp.h | |||
@@ -1,15 +1,23 @@ | |||
1 | struct clk; | ||
2 | |||
1 | void __sp804_clocksource_and_sched_clock_init(void __iomem *, | 3 | void __sp804_clocksource_and_sched_clock_init(void __iomem *, |
2 | const char *, int); | 4 | const char *, struct clk *, int); |
5 | void __sp804_clockevents_init(void __iomem *, unsigned int, | ||
6 | struct clk *, const char *); | ||
3 | 7 | ||
4 | static inline void sp804_clocksource_init(void __iomem *base, const char *name) | 8 | static inline void sp804_clocksource_init(void __iomem *base, const char *name) |
5 | { | 9 | { |
6 | __sp804_clocksource_and_sched_clock_init(base, name, 0); | 10 | __sp804_clocksource_and_sched_clock_init(base, name, NULL, 0); |
7 | } | 11 | } |
8 | 12 | ||
9 | static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base, | 13 | static inline void sp804_clocksource_and_sched_clock_init(void __iomem *base, |
10 | const char *name) | 14 | const char *name) |
11 | { | 15 | { |
12 | __sp804_clocksource_and_sched_clock_init(base, name, 1); | 16 | __sp804_clocksource_and_sched_clock_init(base, name, NULL, 1); |
13 | } | 17 | } |
14 | 18 | ||
15 | void sp804_clockevents_init(void __iomem *, unsigned int, const char *); | 19 | static inline void sp804_clockevents_init(void __iomem *base, unsigned int irq, const char *name) |
20 | { | ||
21 | __sp804_clockevents_init(base, irq, NULL, name); | ||
22 | |||
23 | } | ||
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h index e3f757263438..3d520ddca61b 100644 --- a/arch/arm/include/asm/sched_clock.h +++ b/arch/arm/include/asm/sched_clock.h | |||
@@ -11,4 +11,6 @@ | |||
11 | extern void sched_clock_postinit(void); | 11 | extern void sched_clock_postinit(void); |
12 | extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); | 12 | extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); |
13 | 13 | ||
14 | extern unsigned long long (*sched_clock_func)(void); | ||
15 | |||
14 | #endif | 16 | #endif |
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h index 0f01f4677bd2..7b2899c2f7fc 100644 --- a/arch/arm/include/asm/smp_twd.h +++ b/arch/arm/include/asm/smp_twd.h | |||
@@ -34,12 +34,4 @@ struct twd_local_timer name __initdata = { \ | |||
34 | 34 | ||
35 | int twd_local_timer_register(struct twd_local_timer *); | 35 | int twd_local_timer_register(struct twd_local_timer *); |
36 | 36 | ||
37 | #ifdef CONFIG_HAVE_ARM_TWD | ||
38 | void twd_local_timer_of_register(void); | ||
39 | #else | ||
40 | static inline void twd_local_timer_of_register(void) | ||
41 | { | ||
42 | } | ||
43 | #endif | ||
44 | |||
45 | #endif | 37 | #endif |
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c index d957a51435d8..59dcdced6e30 100644 --- a/arch/arm/kernel/arch_timer.c +++ b/arch/arm/kernel/arch_timer.c | |||
@@ -22,9 +22,11 @@ static unsigned long arch_timer_read_counter_long(void) | |||
22 | return arch_timer_read_counter(); | 22 | return arch_timer_read_counter(); |
23 | } | 23 | } |
24 | 24 | ||
25 | static u32 arch_timer_read_counter_u32(void) | 25 | static u32 sched_clock_mult __read_mostly; |
26 | |||
27 | static unsigned long long notrace arch_timer_sched_clock(void) | ||
26 | { | 28 | { |
27 | return arch_timer_read_counter(); | 29 | return arch_timer_read_counter() * sched_clock_mult; |
28 | } | 30 | } |
29 | 31 | ||
30 | static struct delay_timer arch_delay_timer; | 32 | static struct delay_timer arch_delay_timer; |
@@ -37,25 +39,20 @@ static void __init arch_timer_delay_timer_register(void) | |||
37 | register_current_timer_delay(&arch_delay_timer); | 39 | register_current_timer_delay(&arch_delay_timer); |
38 | } | 40 | } |
39 | 41 | ||
40 | int __init arch_timer_of_register(void) | 42 | int __init arch_timer_arch_init(void) |
41 | { | 43 | { |
42 | int ret; | 44 | u32 arch_timer_rate = arch_timer_get_rate(); |
43 | 45 | ||
44 | ret = arch_timer_init(); | 46 | if (arch_timer_rate == 0) |
45 | if (ret) | 47 | return -ENXIO; |
46 | return ret; | ||
47 | 48 | ||
48 | arch_timer_delay_timer_register(); | 49 | arch_timer_delay_timer_register(); |
49 | 50 | ||
50 | return 0; | 51 | /* Cache the sched_clock multiplier to save a divide in the hot path. */ |
51 | } | 52 | sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; |
52 | 53 | sched_clock_func = arch_timer_sched_clock; | |
53 | int __init arch_timer_sched_clock_init(void) | 54 | pr_info("sched_clock: ARM arch timer >56 bits at %ukHz, resolution %uns\n", |
54 | { | 55 | arch_timer_rate / 1000, sched_clock_mult); |
55 | if (arch_timer_get_rate() == 0) | ||
56 | return -ENXIO; | ||
57 | 56 | ||
58 | setup_sched_clock(arch_timer_read_counter_u32, | ||
59 | 32, arch_timer_get_rate()); | ||
60 | return 0; | 57 | return 0; |
61 | } | 58 | } |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 0f82098c9bfe..cd22d821bf74 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -562,21 +562,21 @@ ENDPROC(__und_usr) | |||
562 | @ Fall-through from Thumb-2 __und_usr | 562 | @ Fall-through from Thumb-2 __und_usr |
563 | @ | 563 | @ |
564 | #ifdef CONFIG_NEON | 564 | #ifdef CONFIG_NEON |
565 | get_thread_info r10 @ get current thread | ||
565 | adr r6, .LCneon_thumb_opcodes | 566 | adr r6, .LCneon_thumb_opcodes |
566 | b 2f | 567 | b 2f |
567 | #endif | 568 | #endif |
568 | call_fpe: | 569 | call_fpe: |
570 | get_thread_info r10 @ get current thread | ||
569 | #ifdef CONFIG_NEON | 571 | #ifdef CONFIG_NEON |
570 | adr r6, .LCneon_arm_opcodes | 572 | adr r6, .LCneon_arm_opcodes |
571 | 2: | 573 | 2: ldr r5, [r6], #4 @ mask value |
572 | ldr r7, [r6], #4 @ mask value | ||
573 | cmp r7, #0 @ end mask? | ||
574 | beq 1f | ||
575 | and r8, r0, r7 | ||
576 | ldr r7, [r6], #4 @ opcode bits matching in mask | 574 | ldr r7, [r6], #4 @ opcode bits matching in mask |
575 | cmp r5, #0 @ end mask? | ||
576 | beq 1f | ||
577 | and r8, r0, r5 | ||
577 | cmp r8, r7 @ NEON instruction? | 578 | cmp r8, r7 @ NEON instruction? |
578 | bne 2b | 579 | bne 2b |
579 | get_thread_info r10 | ||
580 | mov r7, #1 | 580 | mov r7, #1 |
581 | strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used | 581 | strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used |
582 | strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used | 582 | strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used |
@@ -586,7 +586,6 @@ call_fpe: | |||
586 | tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 | 586 | tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 |
587 | tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 | 587 | tstne r0, #0x04000000 @ bit 26 set on both ARM and Thumb-2 |
588 | moveq pc, lr | 588 | moveq pc, lr |
589 | get_thread_info r10 @ get current thread | ||
590 | and r8, r0, #0x00000f00 @ mask out CP number | 589 | and r8, r0, #0x00000f00 @ mask out CP number |
591 | THUMB( lsr r8, r8, #8 ) | 590 | THUMB( lsr r8, r8, #8 ) |
592 | mov r7, #1 | 591 | mov r7, #1 |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 047d3e40e470..cbd0f51937cc 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -459,15 +459,16 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
459 | * atomic helpers and the signal restart code. Insert it into the | 459 | * atomic helpers and the signal restart code. Insert it into the |
460 | * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. | 460 | * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. |
461 | */ | 461 | */ |
462 | static struct vm_area_struct gate_vma; | 462 | static struct vm_area_struct gate_vma = { |
463 | .vm_start = 0xffff0000, | ||
464 | .vm_end = 0xffff0000 + PAGE_SIZE, | ||
465 | .vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYEXEC, | ||
466 | .vm_mm = &init_mm, | ||
467 | }; | ||
463 | 468 | ||
464 | static int __init gate_vma_init(void) | 469 | static int __init gate_vma_init(void) |
465 | { | 470 | { |
466 | gate_vma.vm_start = 0xffff0000; | 471 | gate_vma.vm_page_prot = PAGE_READONLY_EXEC; |
467 | gate_vma.vm_end = 0xffff0000 + PAGE_SIZE; | ||
468 | gate_vma.vm_page_prot = PAGE_READONLY_EXEC; | ||
469 | gate_vma.vm_flags = VM_READ | VM_EXEC | | ||
470 | VM_MAYREAD | VM_MAYEXEC; | ||
471 | return 0; | 472 | return 0; |
472 | } | 473 | } |
473 | arch_initcall(gate_vma_init); | 474 | arch_initcall(gate_vma_init); |
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index bd6f56b9ec21..880584852fca 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c | |||
@@ -20,6 +20,7 @@ struct clock_data { | |||
20 | u64 epoch_ns; | 20 | u64 epoch_ns; |
21 | u32 epoch_cyc; | 21 | u32 epoch_cyc; |
22 | u32 epoch_cyc_copy; | 22 | u32 epoch_cyc_copy; |
23 | unsigned long rate; | ||
23 | u32 mult; | 24 | u32 mult; |
24 | u32 shift; | 25 | u32 shift; |
25 | bool suspended; | 26 | bool suspended; |
@@ -113,11 +114,14 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) | |||
113 | u64 res, wrap; | 114 | u64 res, wrap; |
114 | char r_unit; | 115 | char r_unit; |
115 | 116 | ||
117 | if (cd.rate > rate) | ||
118 | return; | ||
119 | |||
116 | BUG_ON(bits > 32); | 120 | BUG_ON(bits > 32); |
117 | WARN_ON(!irqs_disabled()); | 121 | WARN_ON(!irqs_disabled()); |
118 | WARN_ON(read_sched_clock != jiffy_sched_clock_read); | ||
119 | read_sched_clock = read; | 122 | read_sched_clock = read; |
120 | sched_clock_mask = (1 << bits) - 1; | 123 | sched_clock_mask = (1 << bits) - 1; |
124 | cd.rate = rate; | ||
121 | 125 | ||
122 | /* calculate the mult/shift to convert counter ticks to ns. */ | 126 | /* calculate the mult/shift to convert counter ticks to ns. */ |
123 | clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0); | 127 | clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0); |
@@ -161,12 +165,19 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) | |||
161 | pr_debug("Registered %pF as sched_clock source\n", read); | 165 | pr_debug("Registered %pF as sched_clock source\n", read); |
162 | } | 166 | } |
163 | 167 | ||
164 | unsigned long long notrace sched_clock(void) | 168 | static unsigned long long notrace sched_clock_32(void) |
165 | { | 169 | { |
166 | u32 cyc = read_sched_clock(); | 170 | u32 cyc = read_sched_clock(); |
167 | return cyc_to_sched_clock(cyc, sched_clock_mask); | 171 | return cyc_to_sched_clock(cyc, sched_clock_mask); |
168 | } | 172 | } |
169 | 173 | ||
174 | unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32; | ||
175 | |||
176 | unsigned long long notrace sched_clock(void) | ||
177 | { | ||
178 | return sched_clock_func(); | ||
179 | } | ||
180 | |||
170 | void __init sched_clock_postinit(void) | 181 | void __init sched_clock_postinit(void) |
171 | { | 182 | { |
172 | /* | 183 | /* |
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 3f2565037480..90525d9d290b 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c | |||
@@ -362,25 +362,13 @@ int __init twd_local_timer_register(struct twd_local_timer *tlt) | |||
362 | } | 362 | } |
363 | 363 | ||
364 | #ifdef CONFIG_OF | 364 | #ifdef CONFIG_OF |
365 | const static struct of_device_id twd_of_match[] __initconst = { | 365 | static void __init twd_local_timer_of_register(struct device_node *np) |
366 | { .compatible = "arm,cortex-a9-twd-timer", }, | ||
367 | { .compatible = "arm,cortex-a5-twd-timer", }, | ||
368 | { .compatible = "arm,arm11mp-twd-timer", }, | ||
369 | { }, | ||
370 | }; | ||
371 | |||
372 | void __init twd_local_timer_of_register(void) | ||
373 | { | 366 | { |
374 | struct device_node *np; | ||
375 | int err; | 367 | int err; |
376 | 368 | ||
377 | if (!is_smp() || !setup_max_cpus) | 369 | if (!is_smp() || !setup_max_cpus) |
378 | return; | 370 | return; |
379 | 371 | ||
380 | np = of_find_matching_node(NULL, twd_of_match); | ||
381 | if (!np) | ||
382 | return; | ||
383 | |||
384 | twd_ppi = irq_of_parse_and_map(np, 0); | 372 | twd_ppi = irq_of_parse_and_map(np, 0); |
385 | if (!twd_ppi) { | 373 | if (!twd_ppi) { |
386 | err = -EINVAL; | 374 | err = -EINVAL; |
@@ -398,4 +386,7 @@ void __init twd_local_timer_of_register(void) | |||
398 | out: | 386 | out: |
399 | WARN(err, "twd_local_timer_of_register failed (%d)\n", err); | 387 | WARN(err, "twd_local_timer_of_register failed (%d)\n", err); |
400 | } | 388 | } |
389 | CLOCKSOURCE_OF_DECLARE(arm_twd_a9, "arm,cortex-a9-twd-timer", twd_local_timer_of_register); | ||
390 | CLOCKSOURCE_OF_DECLARE(arm_twd_a5, "arm,cortex-a5-twd-timer", twd_local_timer_of_register); | ||
391 | CLOCKSOURCE_OF_DECLARE(arm_twd_11mp, "arm,arm11mp-twd-timer", twd_local_timer_of_register); | ||
401 | #endif | 392 | #endif |
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index 955d92d265e5..abff4e9aaee0 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/profile.h> | 23 | #include <linux/profile.h> |
24 | #include <linux/timer.h> | 24 | #include <linux/timer.h> |
25 | #include <linux/clocksource.h> | ||
25 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
26 | 27 | ||
27 | #include <asm/thread_info.h> | 28 | #include <asm/thread_info.h> |
@@ -115,6 +116,10 @@ int __init register_persistent_clock(clock_access_fn read_boot, | |||
115 | 116 | ||
116 | void __init time_init(void) | 117 | void __init time_init(void) |
117 | { | 118 | { |
118 | machine_desc->init_time(); | 119 | if (machine_desc->init_time) |
120 | machine_desc->init_time(); | ||
121 | else | ||
122 | clocksource_of_init(); | ||
123 | |||
119 | sched_clock_postinit(); | 124 | sched_clock_postinit(); |
120 | } | 125 | } |
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index ac7a341bd0ff..25efb5ac30f1 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -169,6 +169,8 @@ static struct clk *periph_clocks[] __initdata = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct clk_lookup periph_clocks_lookups[] = { | 171 | static struct clk_lookup periph_clocks_lookups[] = { |
172 | CLKDEV_CON_DEV_ID("hclk", "at91sam9261-lcdfb.0", &hck1), | ||
173 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g10-lcdfb.0", &hck1), | ||
172 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 174 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
173 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 175 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
174 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 176 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 92e0f861084a..629ea5fc95cf 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -488,7 +488,6 @@ static struct resource lcdc_resources[] = { | |||
488 | }; | 488 | }; |
489 | 489 | ||
490 | static struct platform_device at91_lcdc_device = { | 490 | static struct platform_device at91_lcdc_device = { |
491 | .name = "atmel_lcdfb", | ||
492 | .id = 0, | 491 | .id = 0, |
493 | .dev = { | 492 | .dev = { |
494 | .dma_mask = &lcdc_dmamask, | 493 | .dma_mask = &lcdc_dmamask, |
@@ -505,6 +504,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
505 | return; | 504 | return; |
506 | } | 505 | } |
507 | 506 | ||
507 | if (cpu_is_at91sam9g10()) | ||
508 | at91_lcdc_device.name = "at91sam9g10-lcdfb"; | ||
509 | else | ||
510 | at91_lcdc_device.name = "at91sam9261-lcdfb"; | ||
511 | |||
508 | #if defined(CONFIG_FB_ATMEL_STN) | 512 | #if defined(CONFIG_FB_ATMEL_STN) |
509 | at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ | 513 | at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */ |
510 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ | 514 | at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 8e2d9f4a9a45..f44ffd2105a7 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -190,6 +190,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), | 190 | CLKDEV_CON_DEV_ID("pclk", "at91rm9200_ssc.1", &ssc1_clk), |
191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), | 191 | CLKDEV_CON_DEV_ID("pclk", "fff98000.ssc", &ssc0_clk), |
192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), | 192 | CLKDEV_CON_DEV_ID("pclk", "fff9c000.ssc", &ssc1_clk), |
193 | CLKDEV_CON_DEV_ID("hclk", "at91sam9263-lcdfb.0", &lcdc_clk), | ||
193 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), | 194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk), |
194 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), | 195 | CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk), |
195 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 196 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ed666f5cb01d..858c8aac2daf 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -848,7 +848,7 @@ static struct resource lcdc_resources[] = { | |||
848 | }; | 848 | }; |
849 | 849 | ||
850 | static struct platform_device at91_lcdc_device = { | 850 | static struct platform_device at91_lcdc_device = { |
851 | .name = "atmel_lcdfb", | 851 | .name = "at91sam9263-lcdfb", |
852 | .id = 0, | 852 | .id = 0, |
853 | .dev = { | 853 | .dev = { |
854 | .dma_mask = &lcdc_dmamask, | 854 | .dma_mask = &lcdc_dmamask, |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 4fcbe7b5b58d..dc49c2c45d49 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -228,6 +228,8 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
228 | CLKDEV_CON_ID("hclk", &macb_clk), | 228 | CLKDEV_CON_ID("hclk", &macb_clk), |
229 | /* One additional fake clock for ohci */ | 229 | /* One additional fake clock for ohci */ |
230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), | 230 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), |
231 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g45-lcdfb.0", &lcdc_clk), | ||
232 | CLKDEV_CON_DEV_ID("hclk", "at91sam9g45es-lcdfb.0", &lcdc_clk), | ||
231 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), | 233 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), |
232 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 234 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
233 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 235 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 827c9f2a70fb..fe626d431b69 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -981,7 +981,6 @@ static struct resource lcdc_resources[] = { | |||
981 | }; | 981 | }; |
982 | 982 | ||
983 | static struct platform_device at91_lcdc_device = { | 983 | static struct platform_device at91_lcdc_device = { |
984 | .name = "atmel_lcdfb", | ||
985 | .id = 0, | 984 | .id = 0, |
986 | .dev = { | 985 | .dev = { |
987 | .dma_mask = &lcdc_dmamask, | 986 | .dma_mask = &lcdc_dmamask, |
@@ -997,6 +996,11 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) | |||
997 | if (!data) | 996 | if (!data) |
998 | return; | 997 | return; |
999 | 998 | ||
999 | if (cpu_is_at91sam9g45es()) | ||
1000 | at91_lcdc_device.name = "at91sam9g45es-lcdfb"; | ||
1001 | else | ||
1002 | at91_lcdc_device.name = "at91sam9g45-lcdfb"; | ||
1003 | |||
1000 | at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ | 1004 | at91_set_A_periph(AT91_PIN_PE0, 0); /* LCDDPWR */ |
1001 | 1005 | ||
1002 | at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */ | 1006 | at91_set_A_periph(AT91_PIN_PE2, 0); /* LCDCC */ |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index c39600764236..f77fae5591bc 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -179,6 +179,7 @@ static struct clk *periph_clocks[] __initdata = { | |||
179 | }; | 179 | }; |
180 | 180 | ||
181 | static struct clk_lookup periph_clocks_lookups[] = { | 181 | static struct clk_lookup periph_clocks_lookups[] = { |
182 | CLKDEV_CON_DEV_ID("hclk", "at91sam9rl-lcdfb.0", &lcdc_clk), | ||
182 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 183 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
183 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 184 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
184 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 185 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index ddf223ff35c4..352468f265a9 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -514,7 +514,7 @@ static struct resource lcdc_resources[] = { | |||
514 | }; | 514 | }; |
515 | 515 | ||
516 | static struct platform_device at91_lcdc_device = { | 516 | static struct platform_device at91_lcdc_device = { |
517 | .name = "atmel_lcdfb", | 517 | .name = "at91sam9rl-lcdfb", |
518 | .id = 0, | 518 | .id = 0, |
519 | .dev = { | 519 | .dev = { |
520 | .dma_mask = &lcdc_dmamask, | 520 | .dma_mask = &lcdc_dmamask, |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 70f94c87479d..faca4326b46a 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig | |||
@@ -79,12 +79,6 @@ config SOC_EXYNOS5440 | |||
79 | help | 79 | help |
80 | Enable EXYNOS5440 SoC support | 80 | Enable EXYNOS5440 SoC support |
81 | 81 | ||
82 | config EXYNOS4_MCT | ||
83 | bool | ||
84 | default y | ||
85 | help | ||
86 | Use MCT (Multi Core Timer) as kernel timers | ||
87 | |||
88 | config EXYNOS_DEV_DMA | 82 | config EXYNOS_DEV_DMA |
89 | bool | 83 | bool |
90 | help | 84 | help |
@@ -276,8 +270,8 @@ config MACH_UNIVERSAL_C210 | |||
276 | select S5P_DEV_ONENAND | 270 | select S5P_DEV_ONENAND |
277 | select S5P_DEV_TV | 271 | select S5P_DEV_TV |
278 | select S5P_GPIO_INT | 272 | select S5P_GPIO_INT |
279 | select S5P_HRT | ||
280 | select S5P_SETUP_MIPIPHY | 273 | select S5P_SETUP_MIPIPHY |
274 | select SAMSUNG_HRT | ||
281 | help | 275 | help |
282 | Machine support for Samsung Mobile Universal S5PC210 Reference | 276 | Machine support for Samsung Mobile Universal S5PC210 Reference |
283 | Board. | 277 | Board. |
@@ -406,6 +400,7 @@ config MACH_EXYNOS4_DT | |||
406 | bool "Samsung Exynos4 Machine using device tree" | 400 | bool "Samsung Exynos4 Machine using device tree" |
407 | depends on ARCH_EXYNOS4 | 401 | depends on ARCH_EXYNOS4 |
408 | select ARM_AMBA | 402 | select ARM_AMBA |
403 | select CLKSRC_OF | ||
409 | select CPU_EXYNOS4210 | 404 | select CPU_EXYNOS4210 |
410 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD | 405 | select HAVE_SAMSUNG_KEYPAD if INPUT_KEYBOARD |
411 | select PINCTRL | 406 | select PINCTRL |
@@ -422,6 +417,7 @@ config MACH_EXYNOS5_DT | |||
422 | default y | 417 | default y |
423 | depends on ARCH_EXYNOS5 | 418 | depends on ARCH_EXYNOS5 |
424 | select ARM_AMBA | 419 | select ARM_AMBA |
420 | select CLKSRC_OF | ||
425 | select USE_OF | 421 | select USE_OF |
426 | help | 422 | help |
427 | Machine support for Samsung EXYNOS5 machine with device tree enabled. | 423 | Machine support for Samsung EXYNOS5 machine with device tree enabled. |
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index 435757e57bb4..daf289b21486 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile | |||
@@ -26,8 +26,6 @@ obj-$(CONFIG_ARCH_EXYNOS) += pmu.o | |||
26 | 26 | ||
27 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 27 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
28 | 28 | ||
29 | obj-$(CONFIG_EXYNOS4_MCT) += mct.o | ||
30 | |||
31 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 29 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
32 | 30 | ||
33 | # machine support | 31 | # machine support |
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index d63d399c7bae..db7dbd0eb6b4 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -257,11 +257,6 @@ static struct map_desc exynos5_iodesc[] __initdata = { | |||
257 | .length = SZ_4K, | 257 | .length = SZ_4K, |
258 | .type = MT_DEVICE, | 258 | .type = MT_DEVICE, |
259 | }, { | 259 | }, { |
260 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
261 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER), | ||
262 | .length = SZ_4K, | ||
263 | .type = MT_DEVICE, | ||
264 | }, { | ||
265 | .virtual = (unsigned long)S5P_VA_SYSRAM, | 260 | .virtual = (unsigned long)S5P_VA_SYSRAM, |
266 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), | 261 | .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM), |
267 | .length = SZ_4K, | 262 | .length = SZ_4K, |
@@ -822,6 +817,7 @@ static int __init exynos_init_irq_eint(void) | |||
822 | static const struct of_device_id exynos_pinctrl_ids[] = { | 817 | static const struct of_device_id exynos_pinctrl_ids[] = { |
823 | { .compatible = "samsung,exynos4210-pinctrl", }, | 818 | { .compatible = "samsung,exynos4210-pinctrl", }, |
824 | { .compatible = "samsung,exynos4x12-pinctrl", }, | 819 | { .compatible = "samsung,exynos4x12-pinctrl", }, |
820 | { .compatible = "samsung,exynos5250-pinctrl", }, | ||
825 | }; | 821 | }; |
826 | struct device_node *pctrl_np, *wkup_np; | 822 | struct device_node *pctrl_np, *wkup_np; |
827 | const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; | 823 | const char *wkup_compat = "samsung,exynos4210-wakeup-eint"; |
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 9339bb8954be..3b186eaaaa7b 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H | 12 | #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H |
13 | #define __ARCH_ARM_MACH_EXYNOS_COMMON_H | 13 | #define __ARCH_ARM_MACH_EXYNOS_COMMON_H |
14 | 14 | ||
15 | extern void exynos4_timer_init(void); | 15 | extern void mct_init(void); |
16 | 16 | ||
17 | struct map_desc; | 17 | struct map_desc; |
18 | void exynos_init_io(struct map_desc *mach_desc, int size); | 18 | void exynos_init_io(struct map_desc *mach_desc, int size); |
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h index 1f4dc35cd4b9..c0e75d8dd737 100644 --- a/arch/arm/mach-exynos/include/mach/irqs.h +++ b/arch/arm/mach-exynos/include/mach/irqs.h | |||
@@ -30,8 +30,6 @@ | |||
30 | 30 | ||
31 | /* For EXYNOS4 and EXYNOS5 */ | 31 | /* For EXYNOS4 and EXYNOS5 */ |
32 | 32 | ||
33 | #define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12) | ||
34 | |||
35 | #define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) | 33 | #define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32) |
36 | 34 | ||
37 | /* For EXYNOS4 SoCs */ | 35 | /* For EXYNOS4 SoCs */ |
@@ -323,8 +321,6 @@ | |||
323 | #define EXYNOS5_IRQ_CEC IRQ_SPI(114) | 321 | #define EXYNOS5_IRQ_CEC IRQ_SPI(114) |
324 | #define EXYNOS5_IRQ_SATA IRQ_SPI(115) | 322 | #define EXYNOS5_IRQ_SATA IRQ_SPI(115) |
325 | 323 | ||
326 | #define EXYNOS5_IRQ_MCT_L0 IRQ_SPI(120) | ||
327 | #define EXYNOS5_IRQ_MCT_L1 IRQ_SPI(121) | ||
328 | #define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) | 324 | #define EXYNOS5_IRQ_MMC44 IRQ_SPI(123) |
329 | #define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) | 325 | #define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124) |
330 | #define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) | 326 | #define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125) |
@@ -419,8 +415,6 @@ | |||
419 | #define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) | 415 | #define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4) |
420 | 416 | ||
421 | #define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) | 417 | #define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0) |
422 | #define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3) | ||
423 | #define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4) | ||
424 | 418 | ||
425 | #define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) | 419 | #define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0) |
426 | #define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1) | 420 | #define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1) |
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 1df6abbf53b8..7f99b7b187d6 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h | |||
@@ -65,7 +65,6 @@ | |||
65 | #define EXYNOS5_PA_CMU 0x10010000 | 65 | #define EXYNOS5_PA_CMU 0x10010000 |
66 | 66 | ||
67 | #define EXYNOS4_PA_SYSTIMER 0x10050000 | 67 | #define EXYNOS4_PA_SYSTIMER 0x10050000 |
68 | #define EXYNOS5_PA_SYSTIMER 0x101C0000 | ||
69 | 68 | ||
70 | #define EXYNOS4_PA_WATCHDOG 0x10060000 | 69 | #define EXYNOS4_PA_WATCHDOG 0x10060000 |
71 | #define EXYNOS5_PA_WATCHDOG 0x101D0000 | 70 | #define EXYNOS5_PA_WATCHDOG 0x101D0000 |
diff --git a/arch/arm/mach-exynos/include/mach/regs-mct.h b/arch/arm/mach-exynos/include/mach/regs-mct.h deleted file mode 100644 index 80dd02ad6d61..000000000000 --- a/arch/arm/mach-exynos/include/mach/regs-mct.h +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | /* arch/arm/mach-exynos4/include/mach/regs-mct.h | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * EXYNOS4 MCT configutation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARCH_REGS_MCT_H | ||
14 | #define __ASM_ARCH_REGS_MCT_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define EXYNOS4_MCTREG(x) (S5P_VA_SYSTIMER + (x)) | ||
19 | |||
20 | #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) | ||
21 | #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) | ||
22 | #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) | ||
23 | |||
24 | #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) | ||
25 | #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) | ||
26 | #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) | ||
27 | |||
28 | #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) | ||
29 | |||
30 | #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) | ||
31 | #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) | ||
32 | #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) | ||
33 | |||
34 | #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) | ||
35 | #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) | ||
36 | #define EXYNOS4_MCT_L_MASK (0xffffff00) | ||
37 | |||
38 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
39 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
40 | #define MCT_L_TCON_OFFSET (0x20) | ||
41 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
42 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
43 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
44 | |||
45 | #define MCT_G_TCON_START (1 << 8) | ||
46 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
47 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
48 | |||
49 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
50 | #define MCT_L_TCON_INT_START (1 << 1) | ||
51 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
52 | |||
53 | #endif /* __ASM_ARCH_REGS_MCT_H */ | ||
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c index 685f29173afa..3b1a34742679 100644 --- a/arch/arm/mach-exynos/mach-armlex4210.c +++ b/arch/arm/mach-exynos/mach-armlex4210.c | |||
@@ -202,6 +202,6 @@ MACHINE_START(ARMLEX4210, "ARMLEX4210") | |||
202 | .map_io = armlex4210_map_io, | 202 | .map_io = armlex4210_map_io, |
203 | .init_machine = armlex4210_machine_init, | 203 | .init_machine = armlex4210_machine_init, |
204 | .init_late = exynos_init_late, | 204 | .init_late = exynos_init_late, |
205 | .init_time = exynos4_timer_init, | 205 | .init_time = mct_init, |
206 | .restart = exynos4_restart, | 206 | .restart = exynos4_restart, |
207 | MACHINE_END | 207 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c index 3358088c822a..c4ae108e192d 100644 --- a/arch/arm/mach-exynos/mach-exynos4-dt.c +++ b/arch/arm/mach-exynos/mach-exynos4-dt.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/of_platform.h> | 14 | #include <linux/of_platform.h> |
15 | #include <linux/serial_core.h> | 15 | #include <linux/serial_core.h> |
16 | #include <linux/clocksource.h> | ||
16 | 17 | ||
17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
18 | #include <mach/map.h> | 19 | #include <mach/map.h> |
@@ -142,7 +143,7 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") | |||
142 | .map_io = exynos4_dt_map_io, | 143 | .map_io = exynos4_dt_map_io, |
143 | .init_machine = exynos4_dt_machine_init, | 144 | .init_machine = exynos4_dt_machine_init, |
144 | .init_late = exynos_init_late, | 145 | .init_late = exynos_init_late, |
145 | .init_time = exynos4_timer_init, | 146 | .init_time = clocksource_of_init, |
146 | .dt_compat = exynos4_dt_compat, | 147 | .dt_compat = exynos4_dt_compat, |
147 | .restart = exynos4_restart, | 148 | .restart = exynos4_restart, |
148 | MACHINE_END | 149 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c index acaeb14db54b..be7eaac0df01 100644 --- a/arch/arm/mach-exynos/mach-exynos5-dt.c +++ b/arch/arm/mach-exynos/mach-exynos5-dt.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/serial_core.h> | 14 | #include <linux/serial_core.h> |
15 | #include <linux/memblock.h> | 15 | #include <linux/memblock.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/clocksource.h> | ||
17 | 18 | ||
18 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
19 | #include <mach/map.h> | 20 | #include <mach/map.h> |
@@ -216,7 +217,6 @@ DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") | |||
216 | .map_io = exynos5_dt_map_io, | 217 | .map_io = exynos5_dt_map_io, |
217 | .init_machine = exynos5_dt_machine_init, | 218 | .init_machine = exynos5_dt_machine_init, |
218 | .init_late = exynos_init_late, | 219 | .init_late = exynos_init_late, |
219 | .init_time = exynos4_timer_init, | ||
220 | .dt_compat = exynos5_dt_compat, | 220 | .dt_compat = exynos5_dt_compat, |
221 | .restart = exynos5_restart, | 221 | .restart = exynos5_restart, |
222 | .reserve = exynos5_reserve, | 222 | .reserve = exynos5_reserve, |
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 1ea79730187f..da3605d15110 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -1380,7 +1380,7 @@ MACHINE_START(NURI, "NURI") | |||
1380 | .map_io = nuri_map_io, | 1380 | .map_io = nuri_map_io, |
1381 | .init_machine = nuri_machine_init, | 1381 | .init_machine = nuri_machine_init, |
1382 | .init_late = exynos_init_late, | 1382 | .init_late = exynos_init_late, |
1383 | .init_time = exynos4_timer_init, | 1383 | .init_time = mct_init, |
1384 | .reserve = &nuri_reserve, | 1384 | .reserve = &nuri_reserve, |
1385 | .restart = exynos4_restart, | 1385 | .restart = exynos4_restart, |
1386 | MACHINE_END | 1386 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c index 579d2d171daa..1772cd284f4c 100644 --- a/arch/arm/mach-exynos/mach-origen.c +++ b/arch/arm/mach-exynos/mach-origen.c | |||
@@ -815,7 +815,7 @@ MACHINE_START(ORIGEN, "ORIGEN") | |||
815 | .map_io = origen_map_io, | 815 | .map_io = origen_map_io, |
816 | .init_machine = origen_machine_init, | 816 | .init_machine = origen_machine_init, |
817 | .init_late = exynos_init_late, | 817 | .init_late = exynos_init_late, |
818 | .init_time = exynos4_timer_init, | 818 | .init_time = mct_init, |
819 | .reserve = &origen_reserve, | 819 | .reserve = &origen_reserve, |
820 | .restart = exynos4_restart, | 820 | .restart = exynos4_restart, |
821 | MACHINE_END | 821 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c index fe6149624b84..34a6356364eb 100644 --- a/arch/arm/mach-exynos/mach-smdk4x12.c +++ b/arch/arm/mach-exynos/mach-smdk4x12.c | |||
@@ -376,7 +376,7 @@ MACHINE_START(SMDK4212, "SMDK4212") | |||
376 | .init_irq = exynos4_init_irq, | 376 | .init_irq = exynos4_init_irq, |
377 | .map_io = smdk4x12_map_io, | 377 | .map_io = smdk4x12_map_io, |
378 | .init_machine = smdk4x12_machine_init, | 378 | .init_machine = smdk4x12_machine_init, |
379 | .init_time = exynos4_timer_init, | 379 | .init_time = mct_init, |
380 | .restart = exynos4_restart, | 380 | .restart = exynos4_restart, |
381 | .reserve = &smdk4x12_reserve, | 381 | .reserve = &smdk4x12_reserve, |
382 | MACHINE_END | 382 | MACHINE_END |
@@ -390,7 +390,7 @@ MACHINE_START(SMDK4412, "SMDK4412") | |||
390 | .map_io = smdk4x12_map_io, | 390 | .map_io = smdk4x12_map_io, |
391 | .init_machine = smdk4x12_machine_init, | 391 | .init_machine = smdk4x12_machine_init, |
392 | .init_late = exynos_init_late, | 392 | .init_late = exynos_init_late, |
393 | .init_time = exynos4_timer_init, | 393 | .init_time = mct_init, |
394 | .restart = exynos4_restart, | 394 | .restart = exynos4_restart, |
395 | .reserve = &smdk4x12_reserve, | 395 | .reserve = &smdk4x12_reserve, |
396 | MACHINE_END | 396 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c index d71672922b19..893b14e8c62a 100644 --- a/arch/arm/mach-exynos/mach-smdkv310.c +++ b/arch/arm/mach-exynos/mach-smdkv310.c | |||
@@ -423,7 +423,7 @@ MACHINE_START(SMDKV310, "SMDKV310") | |||
423 | .init_irq = exynos4_init_irq, | 423 | .init_irq = exynos4_init_irq, |
424 | .map_io = smdkv310_map_io, | 424 | .map_io = smdkv310_map_io, |
425 | .init_machine = smdkv310_machine_init, | 425 | .init_machine = smdkv310_machine_init, |
426 | .init_time = exynos4_timer_init, | 426 | .init_time = mct_init, |
427 | .reserve = &smdkv310_reserve, | 427 | .reserve = &smdkv310_reserve, |
428 | .restart = exynos4_restart, | 428 | .restart = exynos4_restart, |
429 | MACHINE_END | 429 | MACHINE_END |
@@ -436,7 +436,7 @@ MACHINE_START(SMDKC210, "SMDKC210") | |||
436 | .map_io = smdkv310_map_io, | 436 | .map_io = smdkv310_map_io, |
437 | .init_machine = smdkv310_machine_init, | 437 | .init_machine = smdkv310_machine_init, |
438 | .init_late = exynos_init_late, | 438 | .init_late = exynos_init_late, |
439 | .init_time = exynos4_timer_init, | 439 | .init_time = mct_init, |
440 | .reserve = &smdkv310_reserve, | 440 | .reserve = &smdkv310_reserve, |
441 | .restart = exynos4_restart, | 441 | .restart = exynos4_restart, |
442 | MACHINE_END | 442 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 497fcb793dc1..c870b0aaa5e0 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <plat/mfc.h> | 41 | #include <plat/mfc.h> |
42 | #include <plat/sdhci.h> | 42 | #include <plat/sdhci.h> |
43 | #include <plat/fimc-core.h> | 43 | #include <plat/fimc-core.h> |
44 | #include <plat/s5p-time.h> | 44 | #include <plat/samsung-time.h> |
45 | #include <plat/camport.h> | 45 | #include <plat/camport.h> |
46 | 46 | ||
47 | #include <mach/map.h> | 47 | #include <mach/map.h> |
@@ -1094,7 +1094,7 @@ static void __init universal_map_io(void) | |||
1094 | exynos_init_io(NULL, 0); | 1094 | exynos_init_io(NULL, 0); |
1095 | s3c24xx_init_clocks(clk_xusbxti.rate); | 1095 | s3c24xx_init_clocks(clk_xusbxti.rate); |
1096 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); | 1096 | s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs)); |
1097 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | 1097 | samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | static void s5p_tv_setup(void) | 1100 | static void s5p_tv_setup(void) |
@@ -1152,7 +1152,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") | |||
1152 | .map_io = universal_map_io, | 1152 | .map_io = universal_map_io, |
1153 | .init_machine = universal_machine_init, | 1153 | .init_machine = universal_machine_init, |
1154 | .init_late = exynos_init_late, | 1154 | .init_late = exynos_init_late, |
1155 | .init_time = s5p_timer_init, | 1155 | .init_time = samsung_timer_init, |
1156 | .reserve = &universal_reserve, | 1156 | .reserve = &universal_reserve, |
1157 | .restart = exynos4_restart, | 1157 | .restart = exynos4_restart, |
1158 | MACHINE_END | 1158 | MACHINE_END |
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index a4f9f50247d4..e7df2dd43a40 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/clkdev.h> | 17 | #include <linux/clkdev.h> |
18 | #include <linux/clocksource.h> | ||
18 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
19 | #include <linux/io.h> | 20 | #include <linux/io.h> |
20 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
@@ -28,13 +29,9 @@ | |||
28 | #include <linux/amba/bus.h> | 29 | #include <linux/amba/bus.h> |
29 | #include <linux/clk-provider.h> | 30 | #include <linux/clk-provider.h> |
30 | 31 | ||
31 | #include <asm/arch_timer.h> | ||
32 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
33 | #include <asm/cputype.h> | 33 | #include <asm/cputype.h> |
34 | #include <asm/smp_plat.h> | 34 | #include <asm/smp_plat.h> |
35 | #include <asm/smp_twd.h> | ||
36 | #include <asm/hardware/arm_timer.h> | ||
37 | #include <asm/hardware/timer-sp.h> | ||
38 | #include <asm/hardware/cache-l2x0.h> | 35 | #include <asm/hardware/cache-l2x0.h> |
39 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
40 | #include <asm/mach/map.h> | 37 | #include <asm/mach/map.h> |
@@ -91,38 +88,18 @@ static void __init highbank_init_irq(void) | |||
91 | #endif | 88 | #endif |
92 | } | 89 | } |
93 | 90 | ||
94 | static struct clk_lookup lookup = { | ||
95 | .dev_id = "sp804", | ||
96 | .con_id = NULL, | ||
97 | }; | ||
98 | |||
99 | static void __init highbank_timer_init(void) | 91 | static void __init highbank_timer_init(void) |
100 | { | 92 | { |
101 | int irq; | ||
102 | struct device_node *np; | 93 | struct device_node *np; |
103 | void __iomem *timer_base; | ||
104 | 94 | ||
105 | /* Map system registers */ | 95 | /* Map system registers */ |
106 | np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); | 96 | np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); |
107 | sregs_base = of_iomap(np, 0); | 97 | sregs_base = of_iomap(np, 0); |
108 | WARN_ON(!sregs_base); | 98 | WARN_ON(!sregs_base); |
109 | 99 | ||
110 | np = of_find_compatible_node(NULL, NULL, "arm,sp804"); | ||
111 | timer_base = of_iomap(np, 0); | ||
112 | WARN_ON(!timer_base); | ||
113 | irq = irq_of_parse_and_map(np, 0); | ||
114 | |||
115 | of_clk_init(NULL); | 100 | of_clk_init(NULL); |
116 | lookup.clk = of_clk_get(np, 0); | ||
117 | clkdev_add(&lookup); | ||
118 | |||
119 | sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1"); | ||
120 | sp804_clockevents_init(timer_base, irq, "timer0"); | ||
121 | |||
122 | twd_local_timer_of_register(); | ||
123 | 101 | ||
124 | arch_timer_of_register(); | 102 | clocksource_of_init(); |
125 | arch_timer_sched_clock_init(); | ||
126 | } | 103 | } |
127 | 104 | ||
128 | static void highbank_power_off(void) | 105 | static void highbank_power_off(void) |
diff --git a/arch/arm/mach-imx/clk-busy.c b/arch/arm/mach-imx/clk-busy.c index 1ab91b5209e6..85b728cc27ab 100644 --- a/arch/arm/mach-imx/clk-busy.c +++ b/arch/arm/mach-imx/clk-busy.c | |||
@@ -169,7 +169,7 @@ struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, | |||
169 | 169 | ||
170 | busy->mux.reg = reg; | 170 | busy->mux.reg = reg; |
171 | busy->mux.shift = shift; | 171 | busy->mux.shift = shift; |
172 | busy->mux.width = width; | 172 | busy->mux.mask = BIT(width) - 1; |
173 | busy->mux.lock = &imx_ccm_lock; | 173 | busy->mux.lock = &imx_ccm_lock; |
174 | busy->mux_ops = &clk_mux_ops; | 174 | busy->mux_ops = &clk_mux_ops; |
175 | 175 | ||
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 9ffd103b27e4..b59ddcb57c78 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/clkdev.h> | 14 | #include <linux/clkdev.h> |
15 | #include <linux/clocksource.h> | ||
15 | #include <linux/cpu.h> | 16 | #include <linux/cpu.h> |
16 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
17 | #include <linux/export.h> | 18 | #include <linux/export.h> |
@@ -28,11 +29,9 @@ | |||
28 | #include <linux/regmap.h> | 29 | #include <linux/regmap.h> |
29 | #include <linux/micrel_phy.h> | 30 | #include <linux/micrel_phy.h> |
30 | #include <linux/mfd/syscon.h> | 31 | #include <linux/mfd/syscon.h> |
31 | #include <asm/smp_twd.h> | ||
32 | #include <asm/hardware/cache-l2x0.h> | 32 | #include <asm/hardware/cache-l2x0.h> |
33 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
34 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
35 | #include <asm/mach/time.h> | ||
36 | #include <asm/system_misc.h> | 35 | #include <asm/system_misc.h> |
37 | 36 | ||
38 | #include "common.h" | 37 | #include "common.h" |
@@ -292,7 +291,7 @@ static void __init imx6q_init_irq(void) | |||
292 | static void __init imx6q_timer_init(void) | 291 | static void __init imx6q_timer_init(void) |
293 | { | 292 | { |
294 | mx6q_clocks_init(); | 293 | mx6q_clocks_init(); |
295 | twd_local_timer_of_register(); | 294 | clocksource_of_init(); |
296 | imx_print_silicon_rev("i.MX6Q", imx6q_revision()); | 295 | imx_print_silicon_rev("i.MX6Q", imx6q_revision()); |
297 | } | 296 | } |
298 | 297 | ||
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index ea961445e0e9..b23c8e4f28e8 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -536,16 +536,14 @@ static void __init ap_init_of(void) | |||
536 | 'A' + (ap_sc_id & 0x0f)); | 536 | 'A' + (ap_sc_id & 0x0f)); |
537 | 537 | ||
538 | soc_dev = soc_device_register(soc_dev_attr); | 538 | soc_dev = soc_device_register(soc_dev_attr); |
539 | if (IS_ERR_OR_NULL(soc_dev)) { | 539 | if (IS_ERR(soc_dev)) { |
540 | kfree(soc_dev_attr->revision); | 540 | kfree(soc_dev_attr->revision); |
541 | kfree(soc_dev_attr); | 541 | kfree(soc_dev_attr); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
545 | parent = soc_device_to_device(soc_dev); | 545 | parent = soc_device_to_device(soc_dev); |
546 | 546 | integrator_init_sysfs(parent, ap_sc_id); | |
547 | if (!IS_ERR_OR_NULL(parent)) | ||
548 | integrator_init_sysfs(parent, ap_sc_id); | ||
549 | 547 | ||
550 | of_platform_populate(root, of_default_bus_match_table, | 548 | of_platform_populate(root, of_default_bus_match_table, |
551 | ap_auxdata_lookup, parent); | 549 | ap_auxdata_lookup, parent); |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index 2b0db82a5381..8c60fcb08a98 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c | |||
@@ -250,39 +250,6 @@ static void __init intcp_init_early(void) | |||
250 | } | 250 | } |
251 | 251 | ||
252 | #ifdef CONFIG_OF | 252 | #ifdef CONFIG_OF |
253 | |||
254 | static void __init cp_of_timer_init(void) | ||
255 | { | ||
256 | struct device_node *node; | ||
257 | const char *path; | ||
258 | void __iomem *base; | ||
259 | int err; | ||
260 | int irq; | ||
261 | |||
262 | err = of_property_read_string(of_aliases, | ||
263 | "arm,timer-primary", &path); | ||
264 | if (WARN_ON(err)) | ||
265 | return; | ||
266 | node = of_find_node_by_path(path); | ||
267 | base = of_iomap(node, 0); | ||
268 | if (WARN_ON(!base)) | ||
269 | return; | ||
270 | writel(0, base + TIMER_CTRL); | ||
271 | sp804_clocksource_init(base, node->name); | ||
272 | |||
273 | err = of_property_read_string(of_aliases, | ||
274 | "arm,timer-secondary", &path); | ||
275 | if (WARN_ON(err)) | ||
276 | return; | ||
277 | node = of_find_node_by_path(path); | ||
278 | base = of_iomap(node, 0); | ||
279 | if (WARN_ON(!base)) | ||
280 | return; | ||
281 | irq = irq_of_parse_and_map(node, 0); | ||
282 | writel(0, base + TIMER_CTRL); | ||
283 | sp804_clockevents_init(base, irq, node->name); | ||
284 | } | ||
285 | |||
286 | static const struct of_device_id fpga_irq_of_match[] __initconst = { | 253 | static const struct of_device_id fpga_irq_of_match[] __initconst = { |
287 | { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, }, | 254 | { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, }, |
288 | { /* Sentinel */ } | 255 | { /* Sentinel */ } |
@@ -360,17 +327,14 @@ static void __init intcp_init_of(void) | |||
360 | 'A' + (intcp_sc_id & 0x0f)); | 327 | 'A' + (intcp_sc_id & 0x0f)); |
361 | 328 | ||
362 | soc_dev = soc_device_register(soc_dev_attr); | 329 | soc_dev = soc_device_register(soc_dev_attr); |
363 | if (IS_ERR_OR_NULL(soc_dev)) { | 330 | if (IS_ERR(soc_dev)) { |
364 | kfree(soc_dev_attr->revision); | 331 | kfree(soc_dev_attr->revision); |
365 | kfree(soc_dev_attr); | 332 | kfree(soc_dev_attr); |
366 | return; | 333 | return; |
367 | } | 334 | } |
368 | 335 | ||
369 | parent = soc_device_to_device(soc_dev); | 336 | parent = soc_device_to_device(soc_dev); |
370 | 337 | integrator_init_sysfs(parent, intcp_sc_id); | |
371 | if (!IS_ERR_OR_NULL(parent)) | ||
372 | integrator_init_sysfs(parent, intcp_sc_id); | ||
373 | |||
374 | of_platform_populate(root, of_default_bus_match_table, | 338 | of_platform_populate(root, of_default_bus_match_table, |
375 | intcp_auxdata_lookup, parent); | 339 | intcp_auxdata_lookup, parent); |
376 | } | 340 | } |
@@ -386,7 +350,6 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") | |||
386 | .init_early = intcp_init_early, | 350 | .init_early = intcp_init_early, |
387 | .init_irq = intcp_init_irq_of, | 351 | .init_irq = intcp_init_irq_of, |
388 | .handle_irq = fpga_handle_irq, | 352 | .handle_irq = fpga_handle_irq, |
389 | .init_time = cp_of_timer_init, | ||
390 | .init_machine = intcp_init_of, | 353 | .init_machine = intcp_init_of, |
391 | .restart = integrator_restart, | 354 | .restart = integrator_restart, |
392 | .dt_compat = intcp_dt_board_compat, | 355 | .dt_compat = intcp_dt_board_compat, |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 594c6335496e..23b004afa3f8 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -428,16 +428,23 @@ static void enable_board_wakeup_source(void) | |||
428 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); | 428 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); |
429 | } | 429 | } |
430 | 430 | ||
431 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
432 | { | ||
433 | .port = 1, | ||
434 | .reset_gpio = 57, | ||
435 | .vcc_gpio = -EINVAL, | ||
436 | }, | ||
437 | { | ||
438 | .port = 2, | ||
439 | .reset_gpio = 61, | ||
440 | .vcc_gpio = -EINVAL, | ||
441 | }, | ||
442 | }; | ||
443 | |||
431 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 444 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
432 | 445 | ||
433 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 446 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
434 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 447 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
435 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
436 | |||
437 | .phy_reset = true, | ||
438 | .reset_gpio_port[0] = 57, | ||
439 | .reset_gpio_port[1] = 61, | ||
440 | .reset_gpio_port[2] = -EINVAL | ||
441 | }; | 448 | }; |
442 | 449 | ||
443 | #ifdef CONFIG_OMAP_MUX | 450 | #ifdef CONFIG_OMAP_MUX |
@@ -589,6 +596,8 @@ static void __init omap_3430sdp_init(void) | |||
589 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); | 596 | board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); |
590 | sdp3430_display_init(); | 597 | sdp3430_display_init(); |
591 | enable_board_wakeup_source(); | 598 | enable_board_wakeup_source(); |
599 | |||
600 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
592 | usbhs_init(&usbhs_bdata); | 601 | usbhs_init(&usbhs_bdata); |
593 | } | 602 | } |
594 | 603 | ||
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c index 67447bd4564f..20d6d8189240 100644 --- a/arch/arm/mach-omap2/board-3630sdp.c +++ b/arch/arm/mach-omap2/board-3630sdp.c | |||
@@ -53,16 +53,23 @@ static void enable_board_wakeup_source(void) | |||
53 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); | 53 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); |
54 | } | 54 | } |
55 | 55 | ||
56 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
57 | { | ||
58 | .port = 1, | ||
59 | .reset_gpio = 126, | ||
60 | .vcc_gpio = -EINVAL, | ||
61 | }, | ||
62 | { | ||
63 | .port = 2, | ||
64 | .reset_gpio = 61, | ||
65 | .vcc_gpio = -EINVAL, | ||
66 | }, | ||
67 | }; | ||
68 | |||
56 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 69 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
57 | 70 | ||
58 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 71 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
59 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 72 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
60 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
61 | |||
62 | .phy_reset = true, | ||
63 | .reset_gpio_port[0] = 126, | ||
64 | .reset_gpio_port[1] = 61, | ||
65 | .reset_gpio_port[2] = -EINVAL | ||
66 | }; | 73 | }; |
67 | 74 | ||
68 | #ifdef CONFIG_OMAP_MUX | 75 | #ifdef CONFIG_OMAP_MUX |
@@ -199,6 +206,8 @@ static void __init omap_sdp_init(void) | |||
199 | board_smc91x_init(); | 206 | board_smc91x_init(); |
200 | board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); | 207 | board_flash_init(sdp_flash_partitions, chip_sel_sdp, NAND_BUSWIDTH_16); |
201 | enable_board_wakeup_source(); | 208 | enable_board_wakeup_source(); |
209 | |||
210 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
202 | usbhs_init(&usbhs_bdata); | 211 | usbhs_init(&usbhs_bdata); |
203 | } | 212 | } |
204 | 213 | ||
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c index 7d3358b2e593..fc53911d0d13 100644 --- a/arch/arm/mach-omap2/board-am3517crane.c +++ b/arch/arm/mach-omap2/board-am3517crane.c | |||
@@ -47,15 +47,17 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
47 | }; | 47 | }; |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
51 | { | ||
52 | .port = 1, | ||
53 | .reset_gpio = GPIO_USB_NRESET, | ||
54 | .vcc_gpio = GPIO_USB_POWER, | ||
55 | .vcc_polarity = 1, | ||
56 | }, | ||
57 | }; | ||
58 | |||
50 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 59 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
51 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 60 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
52 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
53 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
54 | |||
55 | .phy_reset = true, | ||
56 | .reset_gpio_port[0] = GPIO_USB_NRESET, | ||
57 | .reset_gpio_port[1] = -EINVAL, | ||
58 | .reset_gpio_port[2] = -EINVAL | ||
59 | }; | 61 | }; |
60 | 62 | ||
61 | static struct mtd_partition crane_nand_partitions[] = { | 63 | static struct mtd_partition crane_nand_partitions[] = { |
@@ -131,13 +133,7 @@ static void __init am3517_crane_init(void) | |||
131 | return; | 133 | return; |
132 | } | 134 | } |
133 | 135 | ||
134 | ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, | 136 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); |
135 | "usb_ehci_enable"); | ||
136 | if (ret < 0) { | ||
137 | pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | usbhs_init(&usbhs_bdata); | 137 | usbhs_init(&usbhs_bdata); |
142 | am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); | 138 | am35xx_emac_init(AM35XX_DEFAULT_MDIO_FREQUENCY, 1); |
143 | } | 139 | } |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 2b9eb3de7aa6..d63f14b534b5 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -213,6 +213,14 @@ static __init void am3517_evm_mcbsp1_init(void) | |||
213 | omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); | 213 | omap_ctrl_writel(devconf0, OMAP2_CONTROL_DEVCONF0); |
214 | } | 214 | } |
215 | 215 | ||
216 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
217 | { | ||
218 | .port = 1, | ||
219 | .reset_gpio = 57, | ||
220 | .vcc_gpio = -EINVAL, | ||
221 | }, | ||
222 | }; | ||
223 | |||
216 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 224 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
217 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 225 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
218 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | 226 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ |
@@ -221,12 +229,6 @@ static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | |||
221 | #else | 229 | #else |
222 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 230 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
223 | #endif | 231 | #endif |
224 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
225 | |||
226 | .phy_reset = true, | ||
227 | .reset_gpio_port[0] = 57, | ||
228 | .reset_gpio_port[1] = -EINVAL, | ||
229 | .reset_gpio_port[2] = -EINVAL | ||
230 | }; | 232 | }; |
231 | 233 | ||
232 | #ifdef CONFIG_OMAP_MUX | 234 | #ifdef CONFIG_OMAP_MUX |
@@ -288,7 +290,6 @@ static struct omap2_hsmmc_info mmc[] = { | |||
288 | {} /* Terminator */ | 290 | {} /* Terminator */ |
289 | }; | 291 | }; |
290 | 292 | ||
291 | |||
292 | static void __init am3517_evm_init(void) | 293 | static void __init am3517_evm_init(void) |
293 | { | 294 | { |
294 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 295 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
@@ -300,6 +301,8 @@ static void __init am3517_evm_init(void) | |||
300 | 301 | ||
301 | /* Configure GPIO for EHCI port */ | 302 | /* Configure GPIO for EHCI port */ |
302 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); | 303 | omap_mux_init_gpio(57, OMAP_PIN_OUTPUT); |
304 | |||
305 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
303 | usbhs_init(&usbhs_bdata); | 306 | usbhs_init(&usbhs_bdata); |
304 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); | 307 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); |
305 | 308 | ||
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 710e99da266c..ee6218c74807 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -376,15 +376,22 @@ static struct omap2_hsmmc_info mmc[] = { | |||
376 | {} /* Terminator */ | 376 | {} /* Terminator */ |
377 | }; | 377 | }; |
378 | 378 | ||
379 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
380 | { | ||
381 | .port = 1, | ||
382 | .reset_gpio = OMAP_MAX_GPIO_LINES + 6, | ||
383 | .vcc_gpio = -EINVAL, | ||
384 | }, | ||
385 | { | ||
386 | .port = 2, | ||
387 | .reset_gpio = OMAP_MAX_GPIO_LINES + 7, | ||
388 | .vcc_gpio = -EINVAL, | ||
389 | }, | ||
390 | }; | ||
391 | |||
379 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 392 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
380 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 393 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
381 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 394 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
382 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
383 | |||
384 | .phy_reset = true, | ||
385 | .reset_gpio_port[0] = OMAP_MAX_GPIO_LINES + 6, | ||
386 | .reset_gpio_port[1] = OMAP_MAX_GPIO_LINES + 7, | ||
387 | .reset_gpio_port[2] = -EINVAL | ||
388 | }; | 395 | }; |
389 | 396 | ||
390 | static void __init cm_t35_init_usbh(void) | 397 | static void __init cm_t35_init_usbh(void) |
@@ -401,6 +408,7 @@ static void __init cm_t35_init_usbh(void) | |||
401 | msleep(1); | 408 | msleep(1); |
402 | } | 409 | } |
403 | 410 | ||
411 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
404 | usbhs_init(&usbhs_bdata); | 412 | usbhs_init(&usbhs_bdata); |
405 | } | 413 | } |
406 | 414 | ||
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c index a66da808cc4a..4eb5e6f2f7f5 100644 --- a/arch/arm/mach-omap2/board-cm-t3517.c +++ b/arch/arm/mach-omap2/board-cm-t3517.c | |||
@@ -188,15 +188,22 @@ static inline void cm_t3517_init_rtc(void) {} | |||
188 | #define HSUSB2_RESET_GPIO (147) | 188 | #define HSUSB2_RESET_GPIO (147) |
189 | #define USB_HUB_RESET_GPIO (152) | 189 | #define USB_HUB_RESET_GPIO (152) |
190 | 190 | ||
191 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
192 | { | ||
193 | .port = 1, | ||
194 | .reset_gpio = HSUSB1_RESET_GPIO, | ||
195 | .vcc_gpio = -EINVAL, | ||
196 | }, | ||
197 | { | ||
198 | .port = 2, | ||
199 | .reset_gpio = HSUSB2_RESET_GPIO, | ||
200 | .vcc_gpio = -EINVAL, | ||
201 | }, | ||
202 | }; | ||
203 | |||
191 | static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { | 204 | static struct usbhs_omap_platform_data cm_t3517_ehci_pdata __initdata = { |
192 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 205 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
193 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 206 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
194 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
195 | |||
196 | .phy_reset = true, | ||
197 | .reset_gpio_port[0] = HSUSB1_RESET_GPIO, | ||
198 | .reset_gpio_port[1] = HSUSB2_RESET_GPIO, | ||
199 | .reset_gpio_port[2] = -EINVAL, | ||
200 | }; | 207 | }; |
201 | 208 | ||
202 | static int __init cm_t3517_init_usbh(void) | 209 | static int __init cm_t3517_init_usbh(void) |
@@ -213,6 +220,7 @@ static int __init cm_t3517_init_usbh(void) | |||
213 | msleep(1); | 220 | msleep(1); |
214 | } | 221 | } |
215 | 222 | ||
223 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
216 | usbhs_init(&cm_t3517_ehci_pdata); | 224 | usbhs_init(&cm_t3517_ehci_pdata); |
217 | 225 | ||
218 | return 0; | 226 | return 0; |
@@ -324,6 +332,6 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517") | |||
324 | .handle_irq = omap3_intc_handle_irq, | 332 | .handle_irq = omap3_intc_handle_irq, |
325 | .init_machine = cm_t3517_init, | 333 | .init_machine = cm_t3517_init, |
326 | .init_late = am35xx_init_late, | 334 | .init_late = am35xx_init_late, |
327 | .init_time = omap3_gp_gptimer_timer_init, | 335 | .init_time = omap3_gptimer_timer_init, |
328 | .restart = omap3xxx_restart, | 336 | .restart = omap3xxx_restart, |
329 | MACHINE_END | 337 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 34944cfdfbd9..576420544178 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -415,15 +415,7 @@ static struct platform_device *devkit8000_devices[] __initdata = { | |||
415 | }; | 415 | }; |
416 | 416 | ||
417 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 417 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
418 | |||
419 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 418 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
420 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
421 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
422 | |||
423 | .phy_reset = true, | ||
424 | .reset_gpio_port[0] = -EINVAL, | ||
425 | .reset_gpio_port[1] = -EINVAL, | ||
426 | .reset_gpio_port[2] = -EINVAL | ||
427 | }; | 419 | }; |
428 | 420 | ||
429 | #ifdef CONFIG_OMAP_MUX | 421 | #ifdef CONFIG_OMAP_MUX |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index e54a48060198..78813b397209 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c | |||
@@ -140,7 +140,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)") | |||
140 | .init_irq = omap_intc_of_init, | 140 | .init_irq = omap_intc_of_init, |
141 | .handle_irq = omap3_intc_handle_irq, | 141 | .handle_irq = omap3_intc_handle_irq, |
142 | .init_machine = omap_generic_init, | 142 | .init_machine = omap_generic_init, |
143 | .init_time = omap3_am33xx_gptimer_timer_init, | 143 | .init_time = omap3_gptimer_timer_init, |
144 | .dt_compat = am33xx_boards_compat, | 144 | .dt_compat = am33xx_boards_compat, |
145 | .restart = am33xx_restart, | 145 | .restart = am33xx_restart, |
146 | MACHINE_END | 146 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index e979d48270c9..b54562d1235e 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -527,26 +527,28 @@ static void __init igep_i2c_init(void) | |||
527 | omap3_pmic_init("twl4030", &igep_twldata); | 527 | omap3_pmic_init("twl4030", &igep_twldata); |
528 | } | 528 | } |
529 | 529 | ||
530 | static struct usbhs_phy_data igep2_phy_data[] __initdata = { | ||
531 | { | ||
532 | .port = 1, | ||
533 | .reset_gpio = IGEP2_GPIO_USBH_NRESET, | ||
534 | .vcc_gpio = -EINVAL, | ||
535 | }, | ||
536 | }; | ||
537 | |||
538 | static struct usbhs_phy_data igep3_phy_data[] __initdata = { | ||
539 | { | ||
540 | .port = 2, | ||
541 | .reset_gpio = IGEP3_GPIO_USBH_NRESET, | ||
542 | .vcc_gpio = -EINVAL, | ||
543 | }, | ||
544 | }; | ||
545 | |||
530 | static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { | 546 | static struct usbhs_omap_platform_data igep2_usbhs_bdata __initdata = { |
531 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 547 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
532 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
533 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
534 | |||
535 | .phy_reset = true, | ||
536 | .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, | ||
537 | .reset_gpio_port[1] = -EINVAL, | ||
538 | .reset_gpio_port[2] = -EINVAL, | ||
539 | }; | 548 | }; |
540 | 549 | ||
541 | static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { | 550 | static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = { |
542 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
543 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 551 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
544 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
545 | |||
546 | .phy_reset = true, | ||
547 | .reset_gpio_port[0] = -EINVAL, | ||
548 | .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, | ||
549 | .reset_gpio_port[2] = -EINVAL, | ||
550 | }; | 552 | }; |
551 | 553 | ||
552 | #ifdef CONFIG_OMAP_MUX | 554 | #ifdef CONFIG_OMAP_MUX |
@@ -642,8 +644,10 @@ static void __init igep_init(void) | |||
642 | if (machine_is_igep0020()) { | 644 | if (machine_is_igep0020()) { |
643 | omap_display_init(&igep2_dss_data); | 645 | omap_display_init(&igep2_dss_data); |
644 | igep2_init_smsc911x(); | 646 | igep2_init_smsc911x(); |
647 | usbhs_init_phys(igep2_phy_data, ARRAY_SIZE(igep2_phy_data)); | ||
645 | usbhs_init(&igep2_usbhs_bdata); | 648 | usbhs_init(&igep2_usbhs_bdata); |
646 | } else { | 649 | } else { |
650 | usbhs_init_phys(igep3_phy_data, ARRAY_SIZE(igep3_phy_data)); | ||
647 | usbhs_init(&igep3_usbhs_bdata); | 651 | usbhs_init(&igep3_usbhs_bdata); |
648 | } | 652 | } |
649 | } | 653 | } |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 0ce91af753fa..6de78605c0af 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mtd/nand.h> | 33 | #include <linux/mtd/nand.h> |
34 | #include <linux/mmc/host.h> | 34 | #include <linux/mmc/host.h> |
35 | #include <linux/usb/phy.h> | 35 | #include <linux/usb/phy.h> |
36 | #include <linux/usb/nop-usb-xceiv.h> | ||
36 | 37 | ||
37 | #include <linux/regulator/machine.h> | 38 | #include <linux/regulator/machine.h> |
38 | #include <linux/i2c/twl.h> | 39 | #include <linux/i2c/twl.h> |
@@ -277,6 +278,21 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = { | |||
277 | 278 | ||
278 | static struct gpio_led gpio_leds[]; | 279 | static struct gpio_led gpio_leds[]; |
279 | 280 | ||
281 | /* PHY's VCC regulator might be added later, so flag that we need it */ | ||
282 | static struct nop_usb_xceiv_platform_data hsusb2_phy_data = { | ||
283 | .needs_vcc = true, | ||
284 | }; | ||
285 | |||
286 | static struct usbhs_phy_data phy_data[] = { | ||
287 | { | ||
288 | .port = 2, | ||
289 | .reset_gpio = 147, | ||
290 | .vcc_gpio = -1, /* updated in beagle_twl_gpio_setup */ | ||
291 | .vcc_polarity = 1, /* updated in beagle_twl_gpio_setup */ | ||
292 | .platform_data = &hsusb2_phy_data, | ||
293 | }, | ||
294 | }; | ||
295 | |||
280 | static int beagle_twl_gpio_setup(struct device *dev, | 296 | static int beagle_twl_gpio_setup(struct device *dev, |
281 | unsigned gpio, unsigned ngpio) | 297 | unsigned gpio, unsigned ngpio) |
282 | { | 298 | { |
@@ -318,9 +334,11 @@ static int beagle_twl_gpio_setup(struct device *dev, | |||
318 | } | 334 | } |
319 | dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; | 335 | dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; |
320 | 336 | ||
321 | gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level, | 337 | /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */ |
322 | "nEN_USB_PWR"); | 338 | phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX; |
339 | phy_data[0].vcc_polarity = beagle_config.usb_pwr_level; | ||
323 | 340 | ||
341 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
324 | return 0; | 342 | return 0; |
325 | } | 343 | } |
326 | 344 | ||
@@ -453,15 +471,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = { | |||
453 | }; | 471 | }; |
454 | 472 | ||
455 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 473 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
456 | |||
457 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
458 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 474 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
459 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
460 | |||
461 | .phy_reset = true, | ||
462 | .reset_gpio_port[0] = -EINVAL, | ||
463 | .reset_gpio_port[1] = 147, | ||
464 | .reset_gpio_port[2] = -EINVAL | ||
465 | }; | 475 | }; |
466 | 476 | ||
467 | #ifdef CONFIG_OMAP_MUX | 477 | #ifdef CONFIG_OMAP_MUX |
@@ -479,7 +489,7 @@ static int __init beagle_opp_init(void) | |||
479 | 489 | ||
480 | /* Initialize the omap3 opp table if not already created. */ | 490 | /* Initialize the omap3 opp table if not already created. */ |
481 | r = omap3_opp_init(); | 491 | r = omap3_opp_init(); |
482 | if (IS_ERR_VALUE(r) && (r != -EEXIST)) { | 492 | if (r < 0 && (r != -EEXIST)) { |
483 | pr_err("%s: opp default init failed\n", __func__); | 493 | pr_err("%s: opp default init failed\n", __func__); |
484 | return r; | 494 | return r; |
485 | } | 495 | } |
@@ -543,7 +553,9 @@ static void __init omap3_beagle_init(void) | |||
543 | 553 | ||
544 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 554 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
545 | usb_musb_init(NULL); | 555 | usb_musb_init(NULL); |
556 | |||
546 | usbhs_init(&usbhs_bdata); | 557 | usbhs_init(&usbhs_bdata); |
558 | |||
547 | board_nand_init(omap3beagle_nand_partitions, | 559 | board_nand_init(omap3beagle_nand_partitions, |
548 | ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, | 560 | ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS, |
549 | NAND_BUSWIDTH_16, NULL); | 561 | NAND_BUSWIDTH_16, NULL); |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 5eecc178f8bf..f76d0de7b406 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -466,7 +466,7 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = { | |||
466 | static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { | 466 | static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = { |
467 | REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ | 467 | REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"), /* OMAP ISP */ |
468 | REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ | 468 | REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"), /* OMAP ISP */ |
469 | REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), | 469 | REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ |
470 | REGULATOR_SUPPLY("vaux2", NULL), | 470 | REGULATOR_SUPPLY("vaux2", NULL), |
471 | }; | 471 | }; |
472 | 472 | ||
@@ -509,17 +509,16 @@ static int __init omap3_evm_i2c_init(void) | |||
509 | return 0; | 509 | return 0; |
510 | } | 510 | } |
511 | 511 | ||
512 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 512 | static struct usbhs_phy_data phy_data[] __initdata = { |
513 | { | ||
514 | .port = 2, | ||
515 | .reset_gpio = -1, /* set at runtime */ | ||
516 | .vcc_gpio = -EINVAL, | ||
517 | }, | ||
518 | }; | ||
513 | 519 | ||
514 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | 520 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
515 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 521 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
516 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
517 | |||
518 | .phy_reset = true, | ||
519 | /* PHY reset GPIO will be runtime programmed based on EVM version */ | ||
520 | .reset_gpio_port[0] = -EINVAL, | ||
521 | .reset_gpio_port[1] = -EINVAL, | ||
522 | .reset_gpio_port[2] = -EINVAL | ||
523 | }; | 522 | }; |
524 | 523 | ||
525 | #ifdef CONFIG_OMAP_MUX | 524 | #ifdef CONFIG_OMAP_MUX |
@@ -695,7 +694,7 @@ static void __init omap3_evm_init(void) | |||
695 | 694 | ||
696 | /* setup EHCI phy reset config */ | 695 | /* setup EHCI phy reset config */ |
697 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); | 696 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
698 | usbhs_bdata.reset_gpio_port[1] = 21; | 697 | phy_data[0].reset_gpio = 21; |
699 | 698 | ||
700 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ | 699 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ |
701 | musb_board_data.power = 500; | 700 | musb_board_data.power = 500; |
@@ -703,10 +702,12 @@ static void __init omap3_evm_init(void) | |||
703 | } else { | 702 | } else { |
704 | /* setup EHCI phy reset on MDC */ | 703 | /* setup EHCI phy reset on MDC */ |
705 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); | 704 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); |
706 | usbhs_bdata.reset_gpio_port[1] = 135; | 705 | phy_data[0].reset_gpio = 135; |
707 | } | 706 | } |
708 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 707 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
709 | usb_musb_init(&musb_board_data); | 708 | usb_musb_init(&musb_board_data); |
709 | |||
710 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
710 | usbhs_init(&usbhs_bdata); | 711 | usbhs_init(&usbhs_bdata); |
711 | board_nand_init(omap3evm_nand_partitions, | 712 | board_nand_init(omap3evm_nand_partitions, |
712 | ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS, | 713 | ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS, |
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 533180f8bf41..28133d5b4fed 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -351,7 +351,7 @@ static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = { | |||
351 | }; | 351 | }; |
352 | 352 | ||
353 | static struct regulator_consumer_supply pandora_usb_phy_supply[] = { | 353 | static struct regulator_consumer_supply pandora_usb_phy_supply[] = { |
354 | REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"), | 354 | REGULATOR_SUPPLY("vcc", "nop_usb_xceiv.2"), /* hsusb port 2 */ |
355 | }; | 355 | }; |
356 | 356 | ||
357 | /* ads7846 on SPI and 2 nub controllers on I2C */ | 357 | /* ads7846 on SPI and 2 nub controllers on I2C */ |
@@ -566,6 +566,14 @@ fail: | |||
566 | printk(KERN_ERR "wl1251 board initialisation failed\n"); | 566 | printk(KERN_ERR "wl1251 board initialisation failed\n"); |
567 | } | 567 | } |
568 | 568 | ||
569 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
570 | { | ||
571 | .port = 2, | ||
572 | .reset_gpio = 16, | ||
573 | .vcc_gpio = -EINVAL, | ||
574 | }, | ||
575 | }; | ||
576 | |||
569 | static struct platform_device *omap3pandora_devices[] __initdata = { | 577 | static struct platform_device *omap3pandora_devices[] __initdata = { |
570 | &pandora_leds_gpio, | 578 | &pandora_leds_gpio, |
571 | &pandora_keys_gpio, | 579 | &pandora_keys_gpio, |
@@ -574,15 +582,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = { | |||
574 | }; | 582 | }; |
575 | 583 | ||
576 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 584 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
577 | |||
578 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
579 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 585 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
580 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
581 | |||
582 | .phy_reset = true, | ||
583 | .reset_gpio_port[0] = -EINVAL, | ||
584 | .reset_gpio_port[1] = 16, | ||
585 | .reset_gpio_port[2] = -EINVAL | ||
586 | }; | 586 | }; |
587 | 587 | ||
588 | #ifdef CONFIG_OMAP_MUX | 588 | #ifdef CONFIG_OMAP_MUX |
@@ -606,7 +606,10 @@ static void __init omap3pandora_init(void) | |||
606 | spi_register_board_info(omap3pandora_spi_board_info, | 606 | spi_register_board_info(omap3pandora_spi_board_info, |
607 | ARRAY_SIZE(omap3pandora_spi_board_info)); | 607 | ARRAY_SIZE(omap3pandora_spi_board_info)); |
608 | omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); | 608 | omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); |
609 | |||
610 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
609 | usbhs_init(&usbhs_bdata); | 611 | usbhs_init(&usbhs_bdata); |
612 | |||
610 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 613 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
611 | usb_musb_init(NULL); | 614 | usb_musb_init(NULL); |
612 | gpmc_nand_init(&pandora_nand_data, NULL); | 615 | gpmc_nand_init(&pandora_nand_data, NULL); |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index 5e63f0758cef..d37e6b187ae4 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -346,19 +346,20 @@ static int __init omap3_stalker_i2c_init(void) | |||
346 | 346 | ||
347 | #define OMAP3_STALKER_TS_GPIO 175 | 347 | #define OMAP3_STALKER_TS_GPIO 175 |
348 | 348 | ||
349 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
350 | { | ||
351 | .port = 2, | ||
352 | .reset_gpio = 21, | ||
353 | .vcc_gpio = -EINVAL, | ||
354 | }, | ||
355 | }; | ||
356 | |||
349 | static struct platform_device *omap3_stalker_devices[] __initdata = { | 357 | static struct platform_device *omap3_stalker_devices[] __initdata = { |
350 | &keys_gpio, | 358 | &keys_gpio, |
351 | }; | 359 | }; |
352 | 360 | ||
353 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 361 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
354 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
355 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 362 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
356 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
357 | |||
358 | .phy_reset = true, | ||
359 | .reset_gpio_port[0] = -EINVAL, | ||
360 | .reset_gpio_port[1] = 21, | ||
361 | .reset_gpio_port[2] = -EINVAL, | ||
362 | }; | 363 | }; |
363 | 364 | ||
364 | #ifdef CONFIG_OMAP_MUX | 365 | #ifdef CONFIG_OMAP_MUX |
@@ -395,6 +396,8 @@ static void __init omap3_stalker_init(void) | |||
395 | omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); | 396 | omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); |
396 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 397 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
397 | usb_musb_init(NULL); | 398 | usb_musb_init(NULL); |
399 | |||
400 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
398 | usbhs_init(&usbhs_bdata); | 401 | usbhs_init(&usbhs_bdata); |
399 | omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); | 402 | omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); |
400 | 403 | ||
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c index bcd44fbcd877..7da48bc42bbf 100644 --- a/arch/arm/mach-omap2/board-omap3touchbook.c +++ b/arch/arm/mach-omap2/board-omap3touchbook.c | |||
@@ -305,21 +305,22 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
305 | }; | 305 | }; |
306 | #endif | 306 | #endif |
307 | 307 | ||
308 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
309 | { | ||
310 | .port = 2, | ||
311 | .reset_gpio = 147, | ||
312 | .vcc_gpio = -EINVAL, | ||
313 | }, | ||
314 | }; | ||
315 | |||
308 | static struct platform_device *omap3_touchbook_devices[] __initdata = { | 316 | static struct platform_device *omap3_touchbook_devices[] __initdata = { |
309 | &leds_gpio, | 317 | &leds_gpio, |
310 | &keys_gpio, | 318 | &keys_gpio, |
311 | }; | 319 | }; |
312 | 320 | ||
313 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 321 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
314 | |||
315 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 322 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
316 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 323 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
317 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
318 | |||
319 | .phy_reset = true, | ||
320 | .reset_gpio_port[0] = -EINVAL, | ||
321 | .reset_gpio_port[1] = 147, | ||
322 | .reset_gpio_port[2] = -EINVAL | ||
323 | }; | 324 | }; |
324 | 325 | ||
325 | static void omap3_touchbook_poweroff(void) | 326 | static void omap3_touchbook_poweroff(void) |
@@ -368,6 +369,8 @@ static void __init omap3_touchbook_init(void) | |||
368 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); | 369 | omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); |
369 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 370 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
370 | usb_musb_init(NULL); | 371 | usb_musb_init(NULL); |
372 | |||
373 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
371 | usbhs_init(&usbhs_bdata); | 374 | usbhs_init(&usbhs_bdata); |
372 | board_nand_init(omap3touchbook_nand_partitions, | 375 | board_nand_init(omap3touchbook_nand_partitions, |
373 | ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, | 376 | ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS, |
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index b02c2f00609b..a71ad345f20d 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/ti_wilink_st.h> | 31 | #include <linux/ti_wilink_st.h> |
32 | #include <linux/usb/musb.h> | 32 | #include <linux/usb/musb.h> |
33 | #include <linux/usb/phy.h> | 33 | #include <linux/usb/phy.h> |
34 | #include <linux/usb/nop-usb-xceiv.h> | ||
34 | #include <linux/wl12xx.h> | 35 | #include <linux/wl12xx.h> |
35 | #include <linux/irqchip/arm-gic.h> | 36 | #include <linux/irqchip/arm-gic.h> |
36 | #include <linux/platform_data/omap-abe-twl6040.h> | 37 | #include <linux/platform_data/omap-abe-twl6040.h> |
@@ -132,6 +133,22 @@ static struct platform_device btwilink_device = { | |||
132 | .id = -1, | 133 | .id = -1, |
133 | }; | 134 | }; |
134 | 135 | ||
136 | /* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */ | ||
137 | static struct nop_usb_xceiv_platform_data hsusb1_phy_data = { | ||
138 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ | ||
139 | .clk_rate = 19200000, | ||
140 | }; | ||
141 | |||
142 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
143 | { | ||
144 | .port = 1, | ||
145 | .reset_gpio = GPIO_HUB_NRESET, | ||
146 | .vcc_gpio = GPIO_HUB_POWER, | ||
147 | .vcc_polarity = 1, | ||
148 | .platform_data = &hsusb1_phy_data, | ||
149 | }, | ||
150 | }; | ||
151 | |||
135 | static struct platform_device *panda_devices[] __initdata = { | 152 | static struct platform_device *panda_devices[] __initdata = { |
136 | &leds_gpio, | 153 | &leds_gpio, |
137 | &wl1271_device, | 154 | &wl1271_device, |
@@ -142,49 +159,19 @@ static struct platform_device *panda_devices[] __initdata = { | |||
142 | 159 | ||
143 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 160 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
144 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 161 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
145 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
146 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
147 | .phy_reset = false, | ||
148 | .reset_gpio_port[0] = -EINVAL, | ||
149 | .reset_gpio_port[1] = -EINVAL, | ||
150 | .reset_gpio_port[2] = -EINVAL | ||
151 | }; | ||
152 | |||
153 | static struct gpio panda_ehci_gpios[] __initdata = { | ||
154 | { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, | ||
155 | { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, | ||
156 | }; | 162 | }; |
157 | 163 | ||
158 | static void __init omap4_ehci_init(void) | 164 | static void __init omap4_ehci_init(void) |
159 | { | 165 | { |
160 | int ret; | 166 | int ret; |
161 | struct clk *phy_ref_clk; | ||
162 | 167 | ||
163 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ | 168 | /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */ |
164 | phy_ref_clk = clk_get(NULL, "auxclk3_ck"); | 169 | ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL); |
165 | if (IS_ERR(phy_ref_clk)) { | 170 | if (ret) |
166 | pr_err("Cannot request auxclk3\n"); | 171 | pr_err("Failed to add main_clk alias to auxclk3_ck\n"); |
167 | return; | ||
168 | } | ||
169 | clk_set_rate(phy_ref_clk, 19200000); | ||
170 | clk_prepare_enable(phy_ref_clk); | ||
171 | |||
172 | /* disable the power to the usb hub prior to init and reset phy+hub */ | ||
173 | ret = gpio_request_array(panda_ehci_gpios, | ||
174 | ARRAY_SIZE(panda_ehci_gpios)); | ||
175 | if (ret) { | ||
176 | pr_err("Unable to initialize EHCI power/reset\n"); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | gpio_export(GPIO_HUB_POWER, 0); | ||
181 | gpio_export(GPIO_HUB_NRESET, 0); | ||
182 | gpio_set_value(GPIO_HUB_NRESET, 1); | ||
183 | 172 | ||
173 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
184 | usbhs_init(&usbhs_bdata); | 174 | usbhs_init(&usbhs_bdata); |
185 | |||
186 | /* enable power to hub */ | ||
187 | gpio_set_value(GPIO_HUB_POWER, 1); | ||
188 | } | 175 | } |
189 | 176 | ||
190 | static struct omap_musb_board_data musb_board_data = { | 177 | static struct omap_musb_board_data musb_board_data = { |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index f790ce5aaa34..4ca6b680aa72 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -428,14 +428,16 @@ static int __init overo_spi_init(void) | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
432 | { | ||
433 | .port = 2, | ||
434 | .reset_gpio = OVERO_GPIO_USBH_NRESET, | ||
435 | .vcc_gpio = -EINVAL, | ||
436 | }, | ||
437 | }; | ||
438 | |||
431 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 439 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
432 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
433 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 440 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
434 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
435 | .phy_reset = true, | ||
436 | .reset_gpio_port[0] = -EINVAL, | ||
437 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, | ||
438 | .reset_gpio_port[2] = -EINVAL | ||
439 | }; | 441 | }; |
440 | 442 | ||
441 | #ifdef CONFIG_OMAP_MUX | 443 | #ifdef CONFIG_OMAP_MUX |
@@ -472,6 +474,8 @@ static void __init overo_init(void) | |||
472 | ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); | 474 | ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL); |
473 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 475 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
474 | usb_musb_init(NULL); | 476 | usb_musb_init(NULL); |
477 | |||
478 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
475 | usbhs_init(&usbhs_bdata); | 479 | usbhs_init(&usbhs_bdata); |
476 | overo_spi_init(); | 480 | overo_spi_init(); |
477 | overo_init_smsc911x(); | 481 | overo_init_smsc911x(); |
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c index 5e4d4c9fe61a..1a3dd865d8eb 100644 --- a/arch/arm/mach-omap2/board-zoom.c +++ b/arch/arm/mach-omap2/board-zoom.c | |||
@@ -92,14 +92,16 @@ static struct mtd_partition zoom_nand_partitions[] = { | |||
92 | }, | 92 | }, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static struct usbhs_phy_data phy_data[] __initdata = { | ||
96 | { | ||
97 | .port = 2, | ||
98 | .reset_gpio = ZOOM3_EHCI_RESET_GPIO, | ||
99 | .vcc_gpio = -EINVAL, | ||
100 | }, | ||
101 | }; | ||
102 | |||
95 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { | 103 | static struct usbhs_omap_platform_data usbhs_bdata __initdata = { |
96 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
97 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | 104 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, |
98 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
99 | .phy_reset = true, | ||
100 | .reset_gpio_port[0] = -EINVAL, | ||
101 | .reset_gpio_port[1] = ZOOM3_EHCI_RESET_GPIO, | ||
102 | .reset_gpio_port[2] = -EINVAL, | ||
103 | }; | 105 | }; |
104 | 106 | ||
105 | static void __init omap_zoom_init(void) | 107 | static void __init omap_zoom_init(void) |
@@ -109,6 +111,8 @@ static void __init omap_zoom_init(void) | |||
109 | } else if (machine_is_omap_zoom3()) { | 111 | } else if (machine_is_omap_zoom3()) { |
110 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); | 112 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); |
111 | omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); | 113 | omap_mux_init_gpio(ZOOM3_EHCI_RESET_GPIO, OMAP_PIN_OUTPUT); |
114 | |||
115 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | ||
112 | usbhs_init(&usbhs_bdata); | 116 | usbhs_init(&usbhs_bdata); |
113 | } | 117 | } |
114 | 118 | ||
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index e4ec3a69ee2e..2191f25ad21b 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -596,7 +596,7 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name) | |||
596 | return -ENOENT; | 596 | return -ENOENT; |
597 | 597 | ||
598 | r = clk_set_rate(mpurate_ck, mpurate); | 598 | r = clk_set_rate(mpurate_ck, mpurate); |
599 | if (IS_ERR_VALUE(r)) { | 599 | if (r < 0) { |
600 | WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", | 600 | WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", |
601 | mpurate_ck_name, mpurate, r); | 601 | mpurate_ck_name, mpurate, r); |
602 | clk_put(mpurate_ck); | 602 | clk_put(mpurate_ck); |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index d6ba13e1c540..272490e72ee0 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -82,8 +82,7 @@ extern void omap2_init_common_infrastructure(void); | |||
82 | extern void omap2_sync32k_timer_init(void); | 82 | extern void omap2_sync32k_timer_init(void); |
83 | extern void omap3_sync32k_timer_init(void); | 83 | extern void omap3_sync32k_timer_init(void); |
84 | extern void omap3_secure_sync32k_timer_init(void); | 84 | extern void omap3_secure_sync32k_timer_init(void); |
85 | extern void omap3_gp_gptimer_timer_init(void); | 85 | extern void omap3_gptimer_timer_init(void); |
86 | extern void omap3_am33xx_gptimer_timer_init(void); | ||
87 | extern void omap4_local_timer_init(void); | 86 | extern void omap4_local_timer_init(void); |
88 | extern void omap5_realtime_timer_init(void); | 87 | extern void omap5_realtime_timer_init(void); |
89 | 88 | ||
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index afc1e8c32d6c..d9c27195caf0 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c | |||
@@ -74,14 +74,6 @@ static int omap2_nand_gpmc_retime( | |||
74 | t.cs_wr_off = gpmc_t->cs_wr_off; | 74 | t.cs_wr_off = gpmc_t->cs_wr_off; |
75 | t.wr_cycle = gpmc_t->wr_cycle; | 75 | t.wr_cycle = gpmc_t->wr_cycle; |
76 | 76 | ||
77 | /* Configure GPMC */ | ||
78 | if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) | ||
79 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 1); | ||
80 | else | ||
81 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_DEV_SIZE, 0); | ||
82 | gpmc_cs_configure(gpmc_nand_data->cs, | ||
83 | GPMC_CONFIG_DEV_TYPE, GPMC_DEVICETYPE_NAND); | ||
84 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_WP, 0); | ||
85 | err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); | 77 | err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t); |
86 | if (err) | 78 | if (err) |
87 | return err; | 79 | return err; |
@@ -115,14 +107,18 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, | |||
115 | struct gpmc_timings *gpmc_t) | 107 | struct gpmc_timings *gpmc_t) |
116 | { | 108 | { |
117 | int err = 0; | 109 | int err = 0; |
110 | struct gpmc_settings s; | ||
118 | struct device *dev = &gpmc_nand_device.dev; | 111 | struct device *dev = &gpmc_nand_device.dev; |
119 | 112 | ||
113 | memset(&s, 0, sizeof(struct gpmc_settings)); | ||
114 | |||
120 | gpmc_nand_device.dev.platform_data = gpmc_nand_data; | 115 | gpmc_nand_device.dev.platform_data = gpmc_nand_data; |
121 | 116 | ||
122 | err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, | 117 | err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, |
123 | (unsigned long *)&gpmc_nand_resource[0].start); | 118 | (unsigned long *)&gpmc_nand_resource[0].start); |
124 | if (err < 0) { | 119 | if (err < 0) { |
125 | dev_err(dev, "Cannot request GPMC CS\n"); | 120 | dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
121 | gpmc_nand_data->cs, err); | ||
126 | return err; | 122 | return err; |
127 | } | 123 | } |
128 | 124 | ||
@@ -140,11 +136,31 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, | |||
140 | dev_err(dev, "Unable to set gpmc timings: %d\n", err); | 136 | dev_err(dev, "Unable to set gpmc timings: %d\n", err); |
141 | return err; | 137 | return err; |
142 | } | 138 | } |
143 | } | ||
144 | 139 | ||
145 | /* Enable RD PIN Monitoring Reg */ | 140 | if (gpmc_nand_data->of_node) { |
146 | if (gpmc_nand_data->dev_ready) { | 141 | gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); |
147 | gpmc_cs_configure(gpmc_nand_data->cs, GPMC_CONFIG_RDY_BSY, 1); | 142 | } else { |
143 | s.device_nand = true; | ||
144 | |||
145 | /* Enable RD PIN Monitoring Reg */ | ||
146 | if (gpmc_nand_data->dev_ready) { | ||
147 | s.wait_on_read = true; | ||
148 | s.wait_on_write = true; | ||
149 | } | ||
150 | } | ||
151 | |||
152 | if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) | ||
153 | s.device_width = GPMC_DEVWIDTH_16BIT; | ||
154 | else | ||
155 | s.device_width = GPMC_DEVWIDTH_8BIT; | ||
156 | |||
157 | err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); | ||
158 | if (err < 0) | ||
159 | goto out_free_cs; | ||
160 | |||
161 | err = gpmc_configure(GPMC_CONFIG_WP, 0); | ||
162 | if (err < 0) | ||
163 | goto out_free_cs; | ||
148 | } | 164 | } |
149 | 165 | ||
150 | gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); | 166 | gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); |
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index fadd87435cd0..64b5a8346982 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c | |||
@@ -47,11 +47,23 @@ static struct platform_device gpmc_onenand_device = { | |||
47 | .resource = &gpmc_onenand_resource, | 47 | .resource = &gpmc_onenand_resource, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static struct gpmc_timings omap2_onenand_calc_async_timings(void) | 50 | static struct gpmc_settings onenand_async = { |
51 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
52 | .mux_add_data = GPMC_MUX_AD, | ||
53 | }; | ||
54 | |||
55 | static struct gpmc_settings onenand_sync = { | ||
56 | .burst_read = true, | ||
57 | .burst_wrap = true, | ||
58 | .burst_len = GPMC_BURST_16, | ||
59 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
60 | .mux_add_data = GPMC_MUX_AD, | ||
61 | .wait_pin = 0, | ||
62 | }; | ||
63 | |||
64 | static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) | ||
51 | { | 65 | { |
52 | struct gpmc_device_timings dev_t; | 66 | struct gpmc_device_timings dev_t; |
53 | struct gpmc_timings t; | ||
54 | |||
55 | const int t_cer = 15; | 67 | const int t_cer = 15; |
56 | const int t_avdp = 12; | 68 | const int t_avdp = 12; |
57 | const int t_aavdh = 7; | 69 | const int t_aavdh = 7; |
@@ -64,7 +76,6 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void) | |||
64 | 76 | ||
65 | memset(&dev_t, 0, sizeof(dev_t)); | 77 | memset(&dev_t, 0, sizeof(dev_t)); |
66 | 78 | ||
67 | dev_t.mux = true; | ||
68 | dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; | 79 | dev_t.t_avdp_r = max_t(int, t_avdp, t_cer) * 1000; |
69 | dev_t.t_avdp_w = dev_t.t_avdp_r; | 80 | dev_t.t_avdp_w = dev_t.t_avdp_r; |
70 | dev_t.t_aavdh = t_aavdh * 1000; | 81 | dev_t.t_aavdh = t_aavdh * 1000; |
@@ -76,19 +87,7 @@ static struct gpmc_timings omap2_onenand_calc_async_timings(void) | |||
76 | dev_t.t_wpl = t_wpl * 1000; | 87 | dev_t.t_wpl = t_wpl * 1000; |
77 | dev_t.t_wph = t_wph * 1000; | 88 | dev_t.t_wph = t_wph * 1000; |
78 | 89 | ||
79 | gpmc_calc_timings(&t, &dev_t); | 90 | gpmc_calc_timings(t, &onenand_async, &dev_t); |
80 | |||
81 | return t; | ||
82 | } | ||
83 | |||
84 | static int gpmc_set_async_mode(int cs, struct gpmc_timings *t) | ||
85 | { | ||
86 | /* Configure GPMC for asynchronous read */ | ||
87 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, | ||
88 | GPMC_CONFIG1_DEVICESIZE_16 | | ||
89 | GPMC_CONFIG1_MUXADDDATA); | ||
90 | |||
91 | return gpmc_cs_set_timings(cs, t); | ||
92 | } | 91 | } |
93 | 92 | ||
94 | static void omap2_onenand_set_async_mode(void __iomem *onenand_base) | 93 | static void omap2_onenand_set_async_mode(void __iomem *onenand_base) |
@@ -158,12 +157,11 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, | |||
158 | return freq; | 157 | return freq; |
159 | } | 158 | } |
160 | 159 | ||
161 | static struct gpmc_timings | 160 | static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, |
162 | omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | 161 | unsigned int flags, |
163 | int freq) | 162 | int freq) |
164 | { | 163 | { |
165 | struct gpmc_device_timings dev_t; | 164 | struct gpmc_device_timings dev_t; |
166 | struct gpmc_timings t; | ||
167 | const int t_cer = 15; | 165 | const int t_cer = 15; |
168 | const int t_avdp = 12; | 166 | const int t_avdp = 12; |
169 | const int t_cez = 20; /* max of t_cez, t_oez */ | 167 | const int t_cez = 20; /* max of t_cez, t_oez */ |
@@ -172,9 +170,9 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
172 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; | 170 | int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; |
173 | int div, gpmc_clk_ns; | 171 | int div, gpmc_clk_ns; |
174 | 172 | ||
175 | if (cfg->flags & ONENAND_SYNC_READ) | 173 | if (flags & ONENAND_SYNC_READ) |
176 | onenand_flags = ONENAND_FLAG_SYNCREAD; | 174 | onenand_flags = ONENAND_FLAG_SYNCREAD; |
177 | else if (cfg->flags & ONENAND_SYNC_READWRITE) | 175 | else if (flags & ONENAND_SYNC_READWRITE) |
178 | onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; | 176 | onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; |
179 | 177 | ||
180 | switch (freq) { | 178 | switch (freq) { |
@@ -239,10 +237,11 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
239 | /* Set synchronous read timings */ | 237 | /* Set synchronous read timings */ |
240 | memset(&dev_t, 0, sizeof(dev_t)); | 238 | memset(&dev_t, 0, sizeof(dev_t)); |
241 | 239 | ||
242 | dev_t.mux = true; | 240 | if (onenand_flags & ONENAND_FLAG_SYNCREAD) |
243 | dev_t.sync_read = true; | 241 | onenand_sync.sync_read = true; |
244 | if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { | 242 | if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { |
245 | dev_t.sync_write = true; | 243 | onenand_sync.sync_write = true; |
244 | onenand_sync.burst_write = true; | ||
246 | } else { | 245 | } else { |
247 | dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; | 246 | dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; |
248 | dev_t.t_wpl = t_wpl * 1000; | 247 | dev_t.t_wpl = t_wpl * 1000; |
@@ -265,32 +264,7 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg, | |||
265 | dev_t.cyc_aavdh_oe = 1; | 264 | dev_t.cyc_aavdh_oe = 1; |
266 | dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; | 265 | dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; |
267 | 266 | ||
268 | gpmc_calc_timings(&t, &dev_t); | 267 | gpmc_calc_timings(t, &onenand_sync, &dev_t); |
269 | |||
270 | return t; | ||
271 | } | ||
272 | |||
273 | static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t) | ||
274 | { | ||
275 | unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD; | ||
276 | unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE; | ||
277 | |||
278 | /* Configure GPMC for synchronous read */ | ||
279 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, | ||
280 | GPMC_CONFIG1_WRAPBURST_SUPP | | ||
281 | GPMC_CONFIG1_READMULTIPLE_SUPP | | ||
282 | (sync_read ? GPMC_CONFIG1_READTYPE_SYNC : 0) | | ||
283 | (sync_write ? GPMC_CONFIG1_WRITEMULTIPLE_SUPP : 0) | | ||
284 | (sync_write ? GPMC_CONFIG1_WRITETYPE_SYNC : 0) | | ||
285 | GPMC_CONFIG1_PAGE_LEN(2) | | ||
286 | (cpu_is_omap34xx() ? 0 : | ||
287 | (GPMC_CONFIG1_WAIT_READ_MON | | ||
288 | GPMC_CONFIG1_WAIT_PIN_SEL(0))) | | ||
289 | GPMC_CONFIG1_DEVICESIZE_16 | | ||
290 | GPMC_CONFIG1_DEVICETYPE_NOR | | ||
291 | GPMC_CONFIG1_MUXADDDATA); | ||
292 | |||
293 | return gpmc_cs_set_timings(cs, t); | ||
294 | } | 268 | } |
295 | 269 | ||
296 | static int omap2_onenand_setup_async(void __iomem *onenand_base) | 270 | static int omap2_onenand_setup_async(void __iomem *onenand_base) |
@@ -298,12 +272,20 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) | |||
298 | struct gpmc_timings t; | 272 | struct gpmc_timings t; |
299 | int ret; | 273 | int ret; |
300 | 274 | ||
275 | if (gpmc_onenand_data->of_node) | ||
276 | gpmc_read_settings_dt(gpmc_onenand_data->of_node, | ||
277 | &onenand_async); | ||
278 | |||
301 | omap2_onenand_set_async_mode(onenand_base); | 279 | omap2_onenand_set_async_mode(onenand_base); |
302 | 280 | ||
303 | t = omap2_onenand_calc_async_timings(); | 281 | omap2_onenand_calc_async_timings(&t); |
282 | |||
283 | ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); | ||
284 | if (ret < 0) | ||
285 | return ret; | ||
304 | 286 | ||
305 | ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t); | 287 | ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); |
306 | if (IS_ERR_VALUE(ret)) | 288 | if (ret < 0) |
307 | return ret; | 289 | return ret; |
308 | 290 | ||
309 | omap2_onenand_set_async_mode(onenand_base); | 291 | omap2_onenand_set_async_mode(onenand_base); |
@@ -322,10 +304,26 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) | |||
322 | set_onenand_cfg(onenand_base); | 304 | set_onenand_cfg(onenand_base); |
323 | } | 305 | } |
324 | 306 | ||
325 | t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq); | 307 | if (gpmc_onenand_data->of_node) { |
308 | gpmc_read_settings_dt(gpmc_onenand_data->of_node, | ||
309 | &onenand_sync); | ||
310 | } else { | ||
311 | /* | ||
312 | * FIXME: Appears to be legacy code from initial ONENAND commit. | ||
313 | * Unclear what boards this is for and if this can be removed. | ||
314 | */ | ||
315 | if (!cpu_is_omap34xx()) | ||
316 | onenand_sync.wait_on_read = true; | ||
317 | } | ||
318 | |||
319 | omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq); | ||
326 | 320 | ||
327 | ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); | 321 | ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync); |
328 | if (IS_ERR_VALUE(ret)) | 322 | if (ret < 0) |
323 | return ret; | ||
324 | |||
325 | ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); | ||
326 | if (ret < 0) | ||
329 | return ret; | 327 | return ret; |
330 | 328 | ||
331 | set_onenand_cfg(onenand_base); | 329 | set_onenand_cfg(onenand_base); |
@@ -359,6 +357,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) | |||
359 | void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | 357 | void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
360 | { | 358 | { |
361 | int err; | 359 | int err; |
360 | struct device *dev = &gpmc_onenand_device.dev; | ||
362 | 361 | ||
363 | gpmc_onenand_data = _onenand_data; | 362 | gpmc_onenand_data = _onenand_data; |
364 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; | 363 | gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; |
@@ -366,7 +365,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
366 | 365 | ||
367 | if (cpu_is_omap24xx() && | 366 | if (cpu_is_omap24xx() && |
368 | (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { | 367 | (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { |
369 | printk(KERN_ERR "Onenand using only SYNC_READ on 24xx\n"); | 368 | dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n"); |
370 | gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; | 369 | gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; |
371 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; | 370 | gpmc_onenand_data->flags |= ONENAND_SYNC_READ; |
372 | } | 371 | } |
@@ -379,7 +378,8 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
379 | err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, | 378 | err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, |
380 | (unsigned long *)&gpmc_onenand_resource.start); | 379 | (unsigned long *)&gpmc_onenand_resource.start); |
381 | if (err < 0) { | 380 | if (err < 0) { |
382 | pr_err("%s: Cannot request GPMC CS\n", __func__); | 381 | dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
382 | gpmc_onenand_data->cs, err); | ||
383 | return; | 383 | return; |
384 | } | 384 | } |
385 | 385 | ||
@@ -387,7 +387,7 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |||
387 | ONENAND_IO_SIZE - 1; | 387 | ONENAND_IO_SIZE - 1; |
388 | 388 | ||
389 | if (platform_device_register(&gpmc_onenand_device) < 0) { | 389 | if (platform_device_register(&gpmc_onenand_device) < 0) { |
390 | pr_err("%s: Unable to register OneNAND device\n", __func__); | 390 | dev_err(dev, "Unable to register OneNAND device\n"); |
391 | gpmc_cs_free(gpmc_onenand_data->cs); | 391 | gpmc_cs_free(gpmc_onenand_data->cs); |
392 | return; | 392 | return; |
393 | } | 393 | } |
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c index 11d0b756f098..61a063595e66 100644 --- a/arch/arm/mach-omap2/gpmc-smc91x.c +++ b/arch/arm/mach-omap2/gpmc-smc91x.c | |||
@@ -49,6 +49,10 @@ static struct platform_device gpmc_smc91x_device = { | |||
49 | .resource = gpmc_smc91x_resources, | 49 | .resource = gpmc_smc91x_resources, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct gpmc_settings smc91x_settings = { | ||
53 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
54 | }; | ||
55 | |||
52 | /* | 56 | /* |
53 | * Set the gpmc timings for smc91c96. The timings are taken | 57 | * Set the gpmc timings for smc91c96. The timings are taken |
54 | * from the data sheet available at: | 58 | * from the data sheet available at: |
@@ -67,18 +71,6 @@ static int smc91c96_gpmc_retime(void) | |||
67 | const int t7 = 5; /* Figure 12.4 write */ | 71 | const int t7 = 5; /* Figure 12.4 write */ |
68 | const int t8 = 5; /* Figure 12.4 write */ | 72 | const int t8 = 5; /* Figure 12.4 write */ |
69 | const int t20 = 185; /* Figure 12.2 read and 12.4 write */ | 73 | const int t20 = 185; /* Figure 12.2 read and 12.4 write */ |
70 | u32 l; | ||
71 | |||
72 | l = GPMC_CONFIG1_DEVICESIZE_16; | ||
73 | if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) | ||
74 | l |= GPMC_CONFIG1_MUXADDDATA; | ||
75 | if (gpmc_cfg->flags & GPMC_READ_MON) | ||
76 | l |= GPMC_CONFIG1_WAIT_READ_MON; | ||
77 | if (gpmc_cfg->flags & GPMC_WRITE_MON) | ||
78 | l |= GPMC_CONFIG1_WAIT_WRITE_MON; | ||
79 | if (gpmc_cfg->wait_pin) | ||
80 | l |= GPMC_CONFIG1_WAIT_PIN_SEL(gpmc_cfg->wait_pin); | ||
81 | gpmc_cs_write_reg(gpmc_cfg->cs, GPMC_CS_CONFIG1, l); | ||
82 | 74 | ||
83 | /* | 75 | /* |
84 | * FIXME: Calculate the address and data bus muxed timings. | 76 | * FIXME: Calculate the address and data bus muxed timings. |
@@ -104,7 +96,7 @@ static int smc91c96_gpmc_retime(void) | |||
104 | dev_t.t_cez_w = t4_w * 1000; | 96 | dev_t.t_cez_w = t4_w * 1000; |
105 | dev_t.t_wr_cycle = (t20 - t3) * 1000; | 97 | dev_t.t_wr_cycle = (t20 - t3) * 1000; |
106 | 98 | ||
107 | gpmc_calc_timings(&t, &dev_t); | 99 | gpmc_calc_timings(&t, &smc91x_settings, &dev_t); |
108 | 100 | ||
109 | return gpmc_cs_set_timings(gpmc_cfg->cs, &t); | 101 | return gpmc_cs_set_timings(gpmc_cfg->cs, &t); |
110 | } | 102 | } |
@@ -133,6 +125,18 @@ void __init gpmc_smc91x_init(struct omap_smc91x_platform_data *board_data) | |||
133 | gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; | 125 | gpmc_smc91x_resources[0].end = cs_mem_base + 0x30f; |
134 | gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); | 126 | gpmc_smc91x_resources[1].flags |= (gpmc_cfg->flags & IRQF_TRIGGER_MASK); |
135 | 127 | ||
128 | if (gpmc_cfg->flags & GPMC_MUX_ADD_DATA) | ||
129 | smc91x_settings.mux_add_data = GPMC_MUX_AD; | ||
130 | if (gpmc_cfg->flags & GPMC_READ_MON) | ||
131 | smc91x_settings.wait_on_read = true; | ||
132 | if (gpmc_cfg->flags & GPMC_WRITE_MON) | ||
133 | smc91x_settings.wait_on_write = true; | ||
134 | if (gpmc_cfg->wait_pin) | ||
135 | smc91x_settings.wait_pin = gpmc_cfg->wait_pin; | ||
136 | ret = gpmc_cs_program_settings(gpmc_cfg->cs, &smc91x_settings); | ||
137 | if (ret < 0) | ||
138 | goto free1; | ||
139 | |||
136 | if (gpmc_cfg->retime) { | 140 | if (gpmc_cfg->retime) { |
137 | ret = gpmc_cfg->retime(); | 141 | ret = gpmc_cfg->retime(); |
138 | if (ret != 0) | 142 | if (ret != 0) |
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index 410e1bac7815..ed946df5ad8a 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/of.h> | 28 | #include <linux/of.h> |
29 | #include <linux/of_address.h> | ||
29 | #include <linux/of_mtd.h> | 30 | #include <linux/of_mtd.h> |
30 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
31 | #include <linux/mtd/nand.h> | 32 | #include <linux/mtd/nand.h> |
@@ -91,9 +92,7 @@ | |||
91 | #define GPMC_CS_SIZE 0x30 | 92 | #define GPMC_CS_SIZE 0x30 |
92 | #define GPMC_BCH_SIZE 0x10 | 93 | #define GPMC_BCH_SIZE 0x10 |
93 | 94 | ||
94 | #define GPMC_MEM_START 0x00000000 | ||
95 | #define GPMC_MEM_END 0x3FFFFFFF | 95 | #define GPMC_MEM_END 0x3FFFFFFF |
96 | #define BOOT_ROM_SPACE 0x100000 /* 1MB */ | ||
97 | 96 | ||
98 | #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ | 97 | #define GPMC_CHUNK_SHIFT 24 /* 16 MB */ |
99 | #define GPMC_SECTION_SHIFT 28 /* 128 MB */ | 98 | #define GPMC_SECTION_SHIFT 28 /* 128 MB */ |
@@ -107,6 +106,9 @@ | |||
107 | 106 | ||
108 | #define GPMC_HAS_WR_ACCESS 0x1 | 107 | #define GPMC_HAS_WR_ACCESS 0x1 |
109 | #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 | 108 | #define GPMC_HAS_WR_DATA_MUX_BUS 0x2 |
109 | #define GPMC_HAS_MUX_AAD 0x4 | ||
110 | |||
111 | #define GPMC_NR_WAITPINS 4 | ||
110 | 112 | ||
111 | /* XXX: Only NAND irq has been considered,currently these are the only ones used | 113 | /* XXX: Only NAND irq has been considered,currently these are the only ones used |
112 | */ | 114 | */ |
@@ -153,6 +155,7 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM]; | |||
153 | static DEFINE_SPINLOCK(gpmc_mem_lock); | 155 | static DEFINE_SPINLOCK(gpmc_mem_lock); |
154 | /* Define chip-selects as reserved by default until probe completes */ | 156 | /* Define chip-selects as reserved by default until probe completes */ |
155 | static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); | 157 | static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); |
158 | static unsigned int gpmc_nr_waitpins; | ||
156 | static struct device *gpmc_dev; | 159 | static struct device *gpmc_dev; |
157 | static int gpmc_irq; | 160 | static int gpmc_irq; |
158 | static resource_size_t phys_base, mem_size; | 161 | static resource_size_t phys_base, mem_size; |
@@ -181,7 +184,7 @@ void gpmc_cs_write_reg(int cs, int idx, u32 val) | |||
181 | __raw_writel(val, reg_addr); | 184 | __raw_writel(val, reg_addr); |
182 | } | 185 | } |
183 | 186 | ||
184 | u32 gpmc_cs_read_reg(int cs, int idx) | 187 | static u32 gpmc_cs_read_reg(int cs, int idx) |
185 | { | 188 | { |
186 | void __iomem *reg_addr; | 189 | void __iomem *reg_addr; |
187 | 190 | ||
@@ -190,7 +193,7 @@ u32 gpmc_cs_read_reg(int cs, int idx) | |||
190 | } | 193 | } |
191 | 194 | ||
192 | /* TODO: Add support for gpmc_fck to clock framework and use it */ | 195 | /* TODO: Add support for gpmc_fck to clock framework and use it */ |
193 | unsigned long gpmc_get_fclk_period(void) | 196 | static unsigned long gpmc_get_fclk_period(void) |
194 | { | 197 | { |
195 | unsigned long rate = clk_get_rate(gpmc_l3_clk); | 198 | unsigned long rate = clk_get_rate(gpmc_l3_clk); |
196 | 199 | ||
@@ -205,7 +208,7 @@ unsigned long gpmc_get_fclk_period(void) | |||
205 | return rate; | 208 | return rate; |
206 | } | 209 | } |
207 | 210 | ||
208 | unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | 211 | static unsigned int gpmc_ns_to_ticks(unsigned int time_ns) |
209 | { | 212 | { |
210 | unsigned long tick_ps; | 213 | unsigned long tick_ps; |
211 | 214 | ||
@@ -215,7 +218,7 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | |||
215 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; | 218 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; |
216 | } | 219 | } |
217 | 220 | ||
218 | unsigned int gpmc_ps_to_ticks(unsigned int time_ps) | 221 | static unsigned int gpmc_ps_to_ticks(unsigned int time_ps) |
219 | { | 222 | { |
220 | unsigned long tick_ps; | 223 | unsigned long tick_ps; |
221 | 224 | ||
@@ -230,13 +233,6 @@ unsigned int gpmc_ticks_to_ns(unsigned int ticks) | |||
230 | return ticks * gpmc_get_fclk_period() / 1000; | 233 | return ticks * gpmc_get_fclk_period() / 1000; |
231 | } | 234 | } |
232 | 235 | ||
233 | unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns) | ||
234 | { | ||
235 | unsigned long ticks = gpmc_ns_to_ticks(time_ns); | ||
236 | |||
237 | return ticks * gpmc_get_fclk_period() / 1000; | ||
238 | } | ||
239 | |||
240 | static unsigned int gpmc_ticks_to_ps(unsigned int ticks) | 236 | static unsigned int gpmc_ticks_to_ps(unsigned int ticks) |
241 | { | 237 | { |
242 | return ticks * gpmc_get_fclk_period(); | 238 | return ticks * gpmc_get_fclk_period(); |
@@ -405,11 +401,18 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t) | |||
405 | return 0; | 401 | return 0; |
406 | } | 402 | } |
407 | 403 | ||
408 | static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) | 404 | static int gpmc_cs_enable_mem(int cs, u32 base, u32 size) |
409 | { | 405 | { |
410 | u32 l; | 406 | u32 l; |
411 | u32 mask; | 407 | u32 mask; |
412 | 408 | ||
409 | /* | ||
410 | * Ensure that base address is aligned on a | ||
411 | * boundary equal to or greater than size. | ||
412 | */ | ||
413 | if (base & (size - 1)) | ||
414 | return -EINVAL; | ||
415 | |||
413 | mask = (1 << GPMC_SECTION_SHIFT) - size; | 416 | mask = (1 << GPMC_SECTION_SHIFT) - size; |
414 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); | 417 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); |
415 | l &= ~0x3f; | 418 | l &= ~0x3f; |
@@ -418,6 +421,8 @@ static void gpmc_cs_enable_mem(int cs, u32 base, u32 size) | |||
418 | l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; | 421 | l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8; |
419 | l |= GPMC_CONFIG7_CSVALID; | 422 | l |= GPMC_CONFIG7_CSVALID; |
420 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); | 423 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l); |
424 | |||
425 | return 0; | ||
421 | } | 426 | } |
422 | 427 | ||
423 | static void gpmc_cs_disable_mem(int cs) | 428 | static void gpmc_cs_disable_mem(int cs) |
@@ -448,22 +453,14 @@ static int gpmc_cs_mem_enabled(int cs) | |||
448 | return l & GPMC_CONFIG7_CSVALID; | 453 | return l & GPMC_CONFIG7_CSVALID; |
449 | } | 454 | } |
450 | 455 | ||
451 | int gpmc_cs_set_reserved(int cs, int reserved) | 456 | static void gpmc_cs_set_reserved(int cs, int reserved) |
452 | { | 457 | { |
453 | if (cs > GPMC_CS_NUM) | ||
454 | return -ENODEV; | ||
455 | |||
456 | gpmc_cs_map &= ~(1 << cs); | 458 | gpmc_cs_map &= ~(1 << cs); |
457 | gpmc_cs_map |= (reserved ? 1 : 0) << cs; | 459 | gpmc_cs_map |= (reserved ? 1 : 0) << cs; |
458 | |||
459 | return 0; | ||
460 | } | 460 | } |
461 | 461 | ||
462 | int gpmc_cs_reserved(int cs) | 462 | static bool gpmc_cs_reserved(int cs) |
463 | { | 463 | { |
464 | if (cs > GPMC_CS_NUM) | ||
465 | return -ENODEV; | ||
466 | |||
467 | return gpmc_cs_map & (1 << cs); | 464 | return gpmc_cs_map & (1 << cs); |
468 | } | 465 | } |
469 | 466 | ||
@@ -510,6 +507,39 @@ static int gpmc_cs_delete_mem(int cs) | |||
510 | return r; | 507 | return r; |
511 | } | 508 | } |
512 | 509 | ||
510 | /** | ||
511 | * gpmc_cs_remap - remaps a chip-select physical base address | ||
512 | * @cs: chip-select to remap | ||
513 | * @base: physical base address to re-map chip-select to | ||
514 | * | ||
515 | * Re-maps a chip-select to a new physical base address specified by | ||
516 | * "base". Returns 0 on success and appropriate negative error code | ||
517 | * on failure. | ||
518 | */ | ||
519 | static int gpmc_cs_remap(int cs, u32 base) | ||
520 | { | ||
521 | int ret; | ||
522 | u32 old_base, size; | ||
523 | |||
524 | if (cs > GPMC_CS_NUM) | ||
525 | return -ENODEV; | ||
526 | gpmc_cs_get_memconf(cs, &old_base, &size); | ||
527 | if (base == old_base) | ||
528 | return 0; | ||
529 | gpmc_cs_disable_mem(cs); | ||
530 | ret = gpmc_cs_delete_mem(cs); | ||
531 | if (ret < 0) | ||
532 | return ret; | ||
533 | ret = gpmc_cs_insert_mem(cs, base, size); | ||
534 | if (ret < 0) | ||
535 | return ret; | ||
536 | ret = gpmc_cs_enable_mem(cs, base, size); | ||
537 | if (ret < 0) | ||
538 | return ret; | ||
539 | |||
540 | return 0; | ||
541 | } | ||
542 | |||
513 | int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) | 543 | int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) |
514 | { | 544 | { |
515 | struct resource *res = &gpmc_cs_mem[cs]; | 545 | struct resource *res = &gpmc_cs_mem[cs]; |
@@ -535,7 +565,12 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) | |||
535 | if (r < 0) | 565 | if (r < 0) |
536 | goto out; | 566 | goto out; |
537 | 567 | ||
538 | gpmc_cs_enable_mem(cs, res->start, resource_size(res)); | 568 | r = gpmc_cs_enable_mem(cs, res->start, resource_size(res)); |
569 | if (r < 0) { | ||
570 | release_resource(res); | ||
571 | goto out; | ||
572 | } | ||
573 | |||
539 | *base = res->start; | 574 | *base = res->start; |
540 | gpmc_cs_set_reserved(cs, 1); | 575 | gpmc_cs_set_reserved(cs, 1); |
541 | out: | 576 | out: |
@@ -561,16 +596,14 @@ void gpmc_cs_free(int cs) | |||
561 | EXPORT_SYMBOL(gpmc_cs_free); | 596 | EXPORT_SYMBOL(gpmc_cs_free); |
562 | 597 | ||
563 | /** | 598 | /** |
564 | * gpmc_cs_configure - write request to configure gpmc | 599 | * gpmc_configure - write request to configure gpmc |
565 | * @cs: chip select number | ||
566 | * @cmd: command type | 600 | * @cmd: command type |
567 | * @wval: value to write | 601 | * @wval: value to write |
568 | * @return status of the operation | 602 | * @return status of the operation |
569 | */ | 603 | */ |
570 | int gpmc_cs_configure(int cs, int cmd, int wval) | 604 | int gpmc_configure(int cmd, int wval) |
571 | { | 605 | { |
572 | int err = 0; | 606 | u32 regval; |
573 | u32 regval = 0; | ||
574 | 607 | ||
575 | switch (cmd) { | 608 | switch (cmd) { |
576 | case GPMC_ENABLE_IRQ: | 609 | case GPMC_ENABLE_IRQ: |
@@ -590,43 +623,14 @@ int gpmc_cs_configure(int cs, int cmd, int wval) | |||
590 | gpmc_write_reg(GPMC_CONFIG, regval); | 623 | gpmc_write_reg(GPMC_CONFIG, regval); |
591 | break; | 624 | break; |
592 | 625 | ||
593 | case GPMC_CONFIG_RDY_BSY: | ||
594 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
595 | if (wval) | ||
596 | regval |= WR_RD_PIN_MONITORING; | ||
597 | else | ||
598 | regval &= ~WR_RD_PIN_MONITORING; | ||
599 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
600 | break; | ||
601 | |||
602 | case GPMC_CONFIG_DEV_SIZE: | ||
603 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
604 | |||
605 | /* clear 2 target bits */ | ||
606 | regval &= ~GPMC_CONFIG1_DEVICESIZE(3); | ||
607 | |||
608 | /* set the proper value */ | ||
609 | regval |= GPMC_CONFIG1_DEVICESIZE(wval); | ||
610 | |||
611 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
612 | break; | ||
613 | |||
614 | case GPMC_CONFIG_DEV_TYPE: | ||
615 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
616 | regval |= GPMC_CONFIG1_DEVICETYPE(wval); | ||
617 | if (wval == GPMC_DEVICETYPE_NOR) | ||
618 | regval |= GPMC_CONFIG1_MUXADDDATA; | ||
619 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); | ||
620 | break; | ||
621 | |||
622 | default: | 626 | default: |
623 | printk(KERN_ERR "gpmc_configure_cs: Not supported\n"); | 627 | pr_err("%s: command not supported\n", __func__); |
624 | err = -EINVAL; | 628 | return -EINVAL; |
625 | } | 629 | } |
626 | 630 | ||
627 | return err; | 631 | return 0; |
628 | } | 632 | } |
629 | EXPORT_SYMBOL(gpmc_cs_configure); | 633 | EXPORT_SYMBOL(gpmc_configure); |
630 | 634 | ||
631 | void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) | 635 | void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) |
632 | { | 636 | { |
@@ -716,7 +720,7 @@ static int gpmc_setup_irq(void) | |||
716 | return -EINVAL; | 720 | return -EINVAL; |
717 | 721 | ||
718 | gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); | 722 | gpmc_irq_start = irq_alloc_descs(-1, 0, GPMC_NR_IRQ, 0); |
719 | if (IS_ERR_VALUE(gpmc_irq_start)) { | 723 | if (gpmc_irq_start < 0) { |
720 | pr_err("irq_alloc_descs failed\n"); | 724 | pr_err("irq_alloc_descs failed\n"); |
721 | return gpmc_irq_start; | 725 | return gpmc_irq_start; |
722 | } | 726 | } |
@@ -781,16 +785,16 @@ static void gpmc_mem_exit(void) | |||
781 | 785 | ||
782 | } | 786 | } |
783 | 787 | ||
784 | static int gpmc_mem_init(void) | 788 | static void gpmc_mem_init(void) |
785 | { | 789 | { |
786 | int cs, rc; | 790 | int cs; |
787 | unsigned long boot_rom_space = 0; | ||
788 | 791 | ||
789 | /* never allocate the first page, to facilitate bug detection; | 792 | /* |
790 | * even if we didn't boot from ROM. | 793 | * The first 1MB of GPMC address space is typically mapped to |
794 | * the internal ROM. Never allocate the first page, to | ||
795 | * facilitate bug detection; even if we didn't boot from ROM. | ||
791 | */ | 796 | */ |
792 | boot_rom_space = BOOT_ROM_SPACE; | 797 | gpmc_mem_root.start = SZ_1M; |
793 | gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space; | ||
794 | gpmc_mem_root.end = GPMC_MEM_END; | 798 | gpmc_mem_root.end = GPMC_MEM_END; |
795 | 799 | ||
796 | /* Reserve all regions that has been set up by bootloader */ | 800 | /* Reserve all regions that has been set up by bootloader */ |
@@ -800,16 +804,12 @@ static int gpmc_mem_init(void) | |||
800 | if (!gpmc_cs_mem_enabled(cs)) | 804 | if (!gpmc_cs_mem_enabled(cs)) |
801 | continue; | 805 | continue; |
802 | gpmc_cs_get_memconf(cs, &base, &size); | 806 | gpmc_cs_get_memconf(cs, &base, &size); |
803 | rc = gpmc_cs_insert_mem(cs, base, size); | 807 | if (gpmc_cs_insert_mem(cs, base, size)) { |
804 | if (IS_ERR_VALUE(rc)) { | 808 | pr_warn("%s: disabling cs %d mapped at 0x%x-0x%x\n", |
805 | while (--cs >= 0) | 809 | __func__, cs, base, base + size); |
806 | if (gpmc_cs_mem_enabled(cs)) | 810 | gpmc_cs_disable_mem(cs); |
807 | gpmc_cs_delete_mem(cs); | ||
808 | return rc; | ||
809 | } | 811 | } |
810 | } | 812 | } |
811 | |||
812 | return 0; | ||
813 | } | 813 | } |
814 | 814 | ||
815 | static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) | 815 | static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) |
@@ -825,9 +825,9 @@ static u32 gpmc_round_ps_to_sync_clk(u32 time_ps, u32 sync_clk) | |||
825 | 825 | ||
826 | /* XXX: can the cycles be avoided ? */ | 826 | /* XXX: can the cycles be avoided ? */ |
827 | static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, | 827 | static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, |
828 | struct gpmc_device_timings *dev_t) | 828 | struct gpmc_device_timings *dev_t, |
829 | bool mux) | ||
829 | { | 830 | { |
830 | bool mux = dev_t->mux; | ||
831 | u32 temp; | 831 | u32 temp; |
832 | 832 | ||
833 | /* adv_rd_off */ | 833 | /* adv_rd_off */ |
@@ -880,9 +880,9 @@ static int gpmc_calc_sync_read_timings(struct gpmc_timings *gpmc_t, | |||
880 | } | 880 | } |
881 | 881 | ||
882 | static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, | 882 | static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, |
883 | struct gpmc_device_timings *dev_t) | 883 | struct gpmc_device_timings *dev_t, |
884 | bool mux) | ||
884 | { | 885 | { |
885 | bool mux = dev_t->mux; | ||
886 | u32 temp; | 886 | u32 temp; |
887 | 887 | ||
888 | /* adv_wr_off */ | 888 | /* adv_wr_off */ |
@@ -942,9 +942,9 @@ static int gpmc_calc_sync_write_timings(struct gpmc_timings *gpmc_t, | |||
942 | } | 942 | } |
943 | 943 | ||
944 | static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, | 944 | static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, |
945 | struct gpmc_device_timings *dev_t) | 945 | struct gpmc_device_timings *dev_t, |
946 | bool mux) | ||
946 | { | 947 | { |
947 | bool mux = dev_t->mux; | ||
948 | u32 temp; | 948 | u32 temp; |
949 | 949 | ||
950 | /* adv_rd_off */ | 950 | /* adv_rd_off */ |
@@ -982,9 +982,9 @@ static int gpmc_calc_async_read_timings(struct gpmc_timings *gpmc_t, | |||
982 | } | 982 | } |
983 | 983 | ||
984 | static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, | 984 | static int gpmc_calc_async_write_timings(struct gpmc_timings *gpmc_t, |
985 | struct gpmc_device_timings *dev_t) | 985 | struct gpmc_device_timings *dev_t, |
986 | bool mux) | ||
986 | { | 987 | { |
987 | bool mux = dev_t->mux; | ||
988 | u32 temp; | 988 | u32 temp; |
989 | 989 | ||
990 | /* adv_wr_off */ | 990 | /* adv_wr_off */ |
@@ -1054,7 +1054,8 @@ static int gpmc_calc_sync_common_timings(struct gpmc_timings *gpmc_t, | |||
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, | 1056 | static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, |
1057 | struct gpmc_device_timings *dev_t) | 1057 | struct gpmc_device_timings *dev_t, |
1058 | bool sync) | ||
1058 | { | 1059 | { |
1059 | u32 temp; | 1060 | u32 temp; |
1060 | 1061 | ||
@@ -1068,7 +1069,7 @@ static int gpmc_calc_common_timings(struct gpmc_timings *gpmc_t, | |||
1068 | gpmc_t->cs_on + dev_t->t_ce_avd); | 1069 | gpmc_t->cs_on + dev_t->t_ce_avd); |
1069 | gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); | 1070 | gpmc_t->adv_on = gpmc_round_ps_to_ticks(temp); |
1070 | 1071 | ||
1071 | if (dev_t->sync_write || dev_t->sync_read) | 1072 | if (sync) |
1072 | gpmc_calc_sync_common_timings(gpmc_t, dev_t); | 1073 | gpmc_calc_sync_common_timings(gpmc_t, dev_t); |
1073 | 1074 | ||
1074 | return 0; | 1075 | return 0; |
@@ -1103,21 +1104,29 @@ static void gpmc_convert_ps_to_ns(struct gpmc_timings *t) | |||
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | 1106 | int gpmc_calc_timings(struct gpmc_timings *gpmc_t, |
1106 | struct gpmc_device_timings *dev_t) | 1107 | struct gpmc_settings *gpmc_s, |
1108 | struct gpmc_device_timings *dev_t) | ||
1107 | { | 1109 | { |
1110 | bool mux = false, sync = false; | ||
1111 | |||
1112 | if (gpmc_s) { | ||
1113 | mux = gpmc_s->mux_add_data ? true : false; | ||
1114 | sync = (gpmc_s->sync_read || gpmc_s->sync_write); | ||
1115 | } | ||
1116 | |||
1108 | memset(gpmc_t, 0, sizeof(*gpmc_t)); | 1117 | memset(gpmc_t, 0, sizeof(*gpmc_t)); |
1109 | 1118 | ||
1110 | gpmc_calc_common_timings(gpmc_t, dev_t); | 1119 | gpmc_calc_common_timings(gpmc_t, dev_t, sync); |
1111 | 1120 | ||
1112 | if (dev_t->sync_read) | 1121 | if (gpmc_s && gpmc_s->sync_read) |
1113 | gpmc_calc_sync_read_timings(gpmc_t, dev_t); | 1122 | gpmc_calc_sync_read_timings(gpmc_t, dev_t, mux); |
1114 | else | 1123 | else |
1115 | gpmc_calc_async_read_timings(gpmc_t, dev_t); | 1124 | gpmc_calc_async_read_timings(gpmc_t, dev_t, mux); |
1116 | 1125 | ||
1117 | if (dev_t->sync_write) | 1126 | if (gpmc_s && gpmc_s->sync_write) |
1118 | gpmc_calc_sync_write_timings(gpmc_t, dev_t); | 1127 | gpmc_calc_sync_write_timings(gpmc_t, dev_t, mux); |
1119 | else | 1128 | else |
1120 | gpmc_calc_async_write_timings(gpmc_t, dev_t); | 1129 | gpmc_calc_async_write_timings(gpmc_t, dev_t, mux); |
1121 | 1130 | ||
1122 | /* TODO: remove, see function definition */ | 1131 | /* TODO: remove, see function definition */ |
1123 | gpmc_convert_ps_to_ns(gpmc_t); | 1132 | gpmc_convert_ps_to_ns(gpmc_t); |
@@ -1125,6 +1134,90 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | |||
1125 | return 0; | 1134 | return 0; |
1126 | } | 1135 | } |
1127 | 1136 | ||
1137 | /** | ||
1138 | * gpmc_cs_program_settings - programs non-timing related settings | ||
1139 | * @cs: GPMC chip-select to program | ||
1140 | * @p: pointer to GPMC settings structure | ||
1141 | * | ||
1142 | * Programs non-timing related settings for a GPMC chip-select, such as | ||
1143 | * bus-width, burst configuration, etc. Function should be called once | ||
1144 | * for each chip-select that is being used and must be called before | ||
1145 | * calling gpmc_cs_set_timings() as timing parameters in the CONFIG1 | ||
1146 | * register will be initialised to zero by this function. Returns 0 on | ||
1147 | * success and appropriate negative error code on failure. | ||
1148 | */ | ||
1149 | int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) | ||
1150 | { | ||
1151 | u32 config1; | ||
1152 | |||
1153 | if ((!p->device_width) || (p->device_width > GPMC_DEVWIDTH_16BIT)) { | ||
1154 | pr_err("%s: invalid width %d!", __func__, p->device_width); | ||
1155 | return -EINVAL; | ||
1156 | } | ||
1157 | |||
1158 | /* Address-data multiplexing not supported for NAND devices */ | ||
1159 | if (p->device_nand && p->mux_add_data) { | ||
1160 | pr_err("%s: invalid configuration!\n", __func__); | ||
1161 | return -EINVAL; | ||
1162 | } | ||
1163 | |||
1164 | if ((p->mux_add_data > GPMC_MUX_AD) || | ||
1165 | ((p->mux_add_data == GPMC_MUX_AAD) && | ||
1166 | !(gpmc_capability & GPMC_HAS_MUX_AAD))) { | ||
1167 | pr_err("%s: invalid multiplex configuration!\n", __func__); | ||
1168 | return -EINVAL; | ||
1169 | } | ||
1170 | |||
1171 | /* Page/burst mode supports lengths of 4, 8 and 16 bytes */ | ||
1172 | if (p->burst_read || p->burst_write) { | ||
1173 | switch (p->burst_len) { | ||
1174 | case GPMC_BURST_4: | ||
1175 | case GPMC_BURST_8: | ||
1176 | case GPMC_BURST_16: | ||
1177 | break; | ||
1178 | default: | ||
1179 | pr_err("%s: invalid page/burst-length (%d)\n", | ||
1180 | __func__, p->burst_len); | ||
1181 | return -EINVAL; | ||
1182 | } | ||
1183 | } | ||
1184 | |||
1185 | if ((p->wait_on_read || p->wait_on_write) && | ||
1186 | (p->wait_pin > gpmc_nr_waitpins)) { | ||
1187 | pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin); | ||
1188 | return -EINVAL; | ||
1189 | } | ||
1190 | |||
1191 | config1 = GPMC_CONFIG1_DEVICESIZE((p->device_width - 1)); | ||
1192 | |||
1193 | if (p->sync_read) | ||
1194 | config1 |= GPMC_CONFIG1_READTYPE_SYNC; | ||
1195 | if (p->sync_write) | ||
1196 | config1 |= GPMC_CONFIG1_WRITETYPE_SYNC; | ||
1197 | if (p->wait_on_read) | ||
1198 | config1 |= GPMC_CONFIG1_WAIT_READ_MON; | ||
1199 | if (p->wait_on_write) | ||
1200 | config1 |= GPMC_CONFIG1_WAIT_WRITE_MON; | ||
1201 | if (p->wait_on_read || p->wait_on_write) | ||
1202 | config1 |= GPMC_CONFIG1_WAIT_PIN_SEL(p->wait_pin); | ||
1203 | if (p->device_nand) | ||
1204 | config1 |= GPMC_CONFIG1_DEVICETYPE(GPMC_DEVICETYPE_NAND); | ||
1205 | if (p->mux_add_data) | ||
1206 | config1 |= GPMC_CONFIG1_MUXTYPE(p->mux_add_data); | ||
1207 | if (p->burst_read) | ||
1208 | config1 |= GPMC_CONFIG1_READMULTIPLE_SUPP; | ||
1209 | if (p->burst_write) | ||
1210 | config1 |= GPMC_CONFIG1_WRITEMULTIPLE_SUPP; | ||
1211 | if (p->burst_read || p->burst_write) { | ||
1212 | config1 |= GPMC_CONFIG1_PAGE_LEN(p->burst_len >> 3); | ||
1213 | config1 |= p->burst_wrap ? GPMC_CONFIG1_WRAPBURST_SUPP : 0; | ||
1214 | } | ||
1215 | |||
1216 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, config1); | ||
1217 | |||
1218 | return 0; | ||
1219 | } | ||
1220 | |||
1128 | #ifdef CONFIG_OF | 1221 | #ifdef CONFIG_OF |
1129 | static struct of_device_id gpmc_dt_ids[] = { | 1222 | static struct of_device_id gpmc_dt_ids[] = { |
1130 | { .compatible = "ti,omap2420-gpmc" }, | 1223 | { .compatible = "ti,omap2420-gpmc" }, |
@@ -1136,70 +1229,110 @@ static struct of_device_id gpmc_dt_ids[] = { | |||
1136 | }; | 1229 | }; |
1137 | MODULE_DEVICE_TABLE(of, gpmc_dt_ids); | 1230 | MODULE_DEVICE_TABLE(of, gpmc_dt_ids); |
1138 | 1231 | ||
1232 | /** | ||
1233 | * gpmc_read_settings_dt - read gpmc settings from device-tree | ||
1234 | * @np: pointer to device-tree node for a gpmc child device | ||
1235 | * @p: pointer to gpmc settings structure | ||
1236 | * | ||
1237 | * Reads the GPMC settings for a GPMC child device from device-tree and | ||
1238 | * stores them in the GPMC settings structure passed. The GPMC settings | ||
1239 | * structure is initialised to zero by this function and so any | ||
1240 | * previously stored settings will be cleared. | ||
1241 | */ | ||
1242 | void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) | ||
1243 | { | ||
1244 | memset(p, 0, sizeof(struct gpmc_settings)); | ||
1245 | |||
1246 | p->sync_read = of_property_read_bool(np, "gpmc,sync-read"); | ||
1247 | p->sync_write = of_property_read_bool(np, "gpmc,sync-write"); | ||
1248 | p->device_nand = of_property_read_bool(np, "gpmc,device-nand"); | ||
1249 | of_property_read_u32(np, "gpmc,device-width", &p->device_width); | ||
1250 | of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data); | ||
1251 | |||
1252 | if (!of_property_read_u32(np, "gpmc,burst-length", &p->burst_len)) { | ||
1253 | p->burst_wrap = of_property_read_bool(np, "gpmc,burst-wrap"); | ||
1254 | p->burst_read = of_property_read_bool(np, "gpmc,burst-read"); | ||
1255 | p->burst_write = of_property_read_bool(np, "gpmc,burst-write"); | ||
1256 | if (!p->burst_read && !p->burst_write) | ||
1257 | pr_warn("%s: page/burst-length set but not used!\n", | ||
1258 | __func__); | ||
1259 | } | ||
1260 | |||
1261 | if (!of_property_read_u32(np, "gpmc,wait-pin", &p->wait_pin)) { | ||
1262 | p->wait_on_read = of_property_read_bool(np, | ||
1263 | "gpmc,wait-on-read"); | ||
1264 | p->wait_on_write = of_property_read_bool(np, | ||
1265 | "gpmc,wait-on-write"); | ||
1266 | if (!p->wait_on_read && !p->wait_on_write) | ||
1267 | pr_warn("%s: read/write wait monitoring not enabled!\n", | ||
1268 | __func__); | ||
1269 | } | ||
1270 | } | ||
1271 | |||
1139 | static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, | 1272 | static void __maybe_unused gpmc_read_timings_dt(struct device_node *np, |
1140 | struct gpmc_timings *gpmc_t) | 1273 | struct gpmc_timings *gpmc_t) |
1141 | { | 1274 | { |
1142 | u32 val; | 1275 | struct gpmc_bool_timings *p; |
1276 | |||
1277 | if (!np || !gpmc_t) | ||
1278 | return; | ||
1143 | 1279 | ||
1144 | memset(gpmc_t, 0, sizeof(*gpmc_t)); | 1280 | memset(gpmc_t, 0, sizeof(*gpmc_t)); |
1145 | 1281 | ||
1146 | /* minimum clock period for syncronous mode */ | 1282 | /* minimum clock period for syncronous mode */ |
1147 | if (!of_property_read_u32(np, "gpmc,sync-clk", &val)) | 1283 | of_property_read_u32(np, "gpmc,sync-clk-ps", &gpmc_t->sync_clk); |
1148 | gpmc_t->sync_clk = val; | ||
1149 | 1284 | ||
1150 | /* chip select timtings */ | 1285 | /* chip select timtings */ |
1151 | if (!of_property_read_u32(np, "gpmc,cs-on", &val)) | 1286 | of_property_read_u32(np, "gpmc,cs-on-ns", &gpmc_t->cs_on); |
1152 | gpmc_t->cs_on = val; | 1287 | of_property_read_u32(np, "gpmc,cs-rd-off-ns", &gpmc_t->cs_rd_off); |
1153 | 1288 | of_property_read_u32(np, "gpmc,cs-wr-off-ns", &gpmc_t->cs_wr_off); | |
1154 | if (!of_property_read_u32(np, "gpmc,cs-rd-off", &val)) | ||
1155 | gpmc_t->cs_rd_off = val; | ||
1156 | |||
1157 | if (!of_property_read_u32(np, "gpmc,cs-wr-off", &val)) | ||
1158 | gpmc_t->cs_wr_off = val; | ||
1159 | 1289 | ||
1160 | /* ADV signal timings */ | 1290 | /* ADV signal timings */ |
1161 | if (!of_property_read_u32(np, "gpmc,adv-on", &val)) | 1291 | of_property_read_u32(np, "gpmc,adv-on-ns", &gpmc_t->adv_on); |
1162 | gpmc_t->adv_on = val; | 1292 | of_property_read_u32(np, "gpmc,adv-rd-off-ns", &gpmc_t->adv_rd_off); |
1163 | 1293 | of_property_read_u32(np, "gpmc,adv-wr-off-ns", &gpmc_t->adv_wr_off); | |
1164 | if (!of_property_read_u32(np, "gpmc,adv-rd-off", &val)) | ||
1165 | gpmc_t->adv_rd_off = val; | ||
1166 | |||
1167 | if (!of_property_read_u32(np, "gpmc,adv-wr-off", &val)) | ||
1168 | gpmc_t->adv_wr_off = val; | ||
1169 | 1294 | ||
1170 | /* WE signal timings */ | 1295 | /* WE signal timings */ |
1171 | if (!of_property_read_u32(np, "gpmc,we-on", &val)) | 1296 | of_property_read_u32(np, "gpmc,we-on-ns", &gpmc_t->we_on); |
1172 | gpmc_t->we_on = val; | 1297 | of_property_read_u32(np, "gpmc,we-off-ns", &gpmc_t->we_off); |
1173 | |||
1174 | if (!of_property_read_u32(np, "gpmc,we-off", &val)) | ||
1175 | gpmc_t->we_off = val; | ||
1176 | 1298 | ||
1177 | /* OE signal timings */ | 1299 | /* OE signal timings */ |
1178 | if (!of_property_read_u32(np, "gpmc,oe-on", &val)) | 1300 | of_property_read_u32(np, "gpmc,oe-on-ns", &gpmc_t->oe_on); |
1179 | gpmc_t->oe_on = val; | 1301 | of_property_read_u32(np, "gpmc,oe-off-ns", &gpmc_t->oe_off); |
1180 | |||
1181 | if (!of_property_read_u32(np, "gpmc,oe-off", &val)) | ||
1182 | gpmc_t->oe_off = val; | ||
1183 | 1302 | ||
1184 | /* access and cycle timings */ | 1303 | /* access and cycle timings */ |
1185 | if (!of_property_read_u32(np, "gpmc,page-burst-access", &val)) | 1304 | of_property_read_u32(np, "gpmc,page-burst-access-ns", |
1186 | gpmc_t->page_burst_access = val; | 1305 | &gpmc_t->page_burst_access); |
1187 | 1306 | of_property_read_u32(np, "gpmc,access-ns", &gpmc_t->access); | |
1188 | if (!of_property_read_u32(np, "gpmc,access", &val)) | 1307 | of_property_read_u32(np, "gpmc,rd-cycle-ns", &gpmc_t->rd_cycle); |
1189 | gpmc_t->access = val; | 1308 | of_property_read_u32(np, "gpmc,wr-cycle-ns", &gpmc_t->wr_cycle); |
1190 | 1309 | of_property_read_u32(np, "gpmc,bus-turnaround-ns", | |
1191 | if (!of_property_read_u32(np, "gpmc,rd-cycle", &val)) | 1310 | &gpmc_t->bus_turnaround); |
1192 | gpmc_t->rd_cycle = val; | 1311 | of_property_read_u32(np, "gpmc,cycle2cycle-delay-ns", |
1193 | 1312 | &gpmc_t->cycle2cycle_delay); | |
1194 | if (!of_property_read_u32(np, "gpmc,wr-cycle", &val)) | 1313 | of_property_read_u32(np, "gpmc,wait-monitoring-ns", |
1195 | gpmc_t->wr_cycle = val; | 1314 | &gpmc_t->wait_monitoring); |
1196 | 1315 | of_property_read_u32(np, "gpmc,clk-activation-ns", | |
1197 | /* only for OMAP3430 */ | 1316 | &gpmc_t->clk_activation); |
1198 | if (!of_property_read_u32(np, "gpmc,wr-access", &val)) | 1317 | |
1199 | gpmc_t->wr_access = val; | 1318 | /* only applicable to OMAP3+ */ |
1200 | 1319 | of_property_read_u32(np, "gpmc,wr-access-ns", &gpmc_t->wr_access); | |
1201 | if (!of_property_read_u32(np, "gpmc,wr-data-mux-bus", &val)) | 1320 | of_property_read_u32(np, "gpmc,wr-data-mux-bus-ns", |
1202 | gpmc_t->wr_data_mux_bus = val; | 1321 | &gpmc_t->wr_data_mux_bus); |
1322 | |||
1323 | /* bool timing parameters */ | ||
1324 | p = &gpmc_t->bool_timings; | ||
1325 | |||
1326 | p->cycle2cyclediffcsen = | ||
1327 | of_property_read_bool(np, "gpmc,cycle2cycle-diffcsen"); | ||
1328 | p->cycle2cyclesamecsen = | ||
1329 | of_property_read_bool(np, "gpmc,cycle2cycle-samecsen"); | ||
1330 | p->we_extra_delay = of_property_read_bool(np, "gpmc,we-extra-delay"); | ||
1331 | p->oe_extra_delay = of_property_read_bool(np, "gpmc,oe-extra-delay"); | ||
1332 | p->adv_extra_delay = of_property_read_bool(np, "gpmc,adv-extra-delay"); | ||
1333 | p->cs_extra_delay = of_property_read_bool(np, "gpmc,cs-extra-delay"); | ||
1334 | p->time_para_granularity = | ||
1335 | of_property_read_bool(np, "gpmc,time-para-granularity"); | ||
1203 | } | 1336 | } |
1204 | 1337 | ||
1205 | #ifdef CONFIG_MTD_NAND | 1338 | #ifdef CONFIG_MTD_NAND |
@@ -1295,6 +1428,81 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, | |||
1295 | } | 1428 | } |
1296 | #endif | 1429 | #endif |
1297 | 1430 | ||
1431 | /** | ||
1432 | * gpmc_probe_generic_child - configures the gpmc for a child device | ||
1433 | * @pdev: pointer to gpmc platform device | ||
1434 | * @child: pointer to device-tree node for child device | ||
1435 | * | ||
1436 | * Allocates and configures a GPMC chip-select for a child device. | ||
1437 | * Returns 0 on success and appropriate negative error code on failure. | ||
1438 | */ | ||
1439 | static int gpmc_probe_generic_child(struct platform_device *pdev, | ||
1440 | struct device_node *child) | ||
1441 | { | ||
1442 | struct gpmc_settings gpmc_s; | ||
1443 | struct gpmc_timings gpmc_t; | ||
1444 | struct resource res; | ||
1445 | unsigned long base; | ||
1446 | int ret, cs; | ||
1447 | |||
1448 | if (of_property_read_u32(child, "reg", &cs) < 0) { | ||
1449 | dev_err(&pdev->dev, "%s has no 'reg' property\n", | ||
1450 | child->full_name); | ||
1451 | return -ENODEV; | ||
1452 | } | ||
1453 | |||
1454 | if (of_address_to_resource(child, 0, &res) < 0) { | ||
1455 | dev_err(&pdev->dev, "%s has malformed 'reg' property\n", | ||
1456 | child->full_name); | ||
1457 | return -ENODEV; | ||
1458 | } | ||
1459 | |||
1460 | ret = gpmc_cs_request(cs, resource_size(&res), &base); | ||
1461 | if (ret < 0) { | ||
1462 | dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs); | ||
1463 | return ret; | ||
1464 | } | ||
1465 | |||
1466 | /* | ||
1467 | * FIXME: gpmc_cs_request() will map the CS to an arbitary | ||
1468 | * location in the gpmc address space. When booting with | ||
1469 | * device-tree we want the NOR flash to be mapped to the | ||
1470 | * location specified in the device-tree blob. So remap the | ||
1471 | * CS to this location. Once DT migration is complete should | ||
1472 | * just make gpmc_cs_request() map a specific address. | ||
1473 | */ | ||
1474 | ret = gpmc_cs_remap(cs, res.start); | ||
1475 | if (ret < 0) { | ||
1476 | dev_err(&pdev->dev, "cannot remap GPMC CS %d to 0x%x\n", | ||
1477 | cs, res.start); | ||
1478 | goto err; | ||
1479 | } | ||
1480 | |||
1481 | gpmc_read_settings_dt(child, &gpmc_s); | ||
1482 | |||
1483 | ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width); | ||
1484 | if (ret < 0) | ||
1485 | goto err; | ||
1486 | |||
1487 | ret = gpmc_cs_program_settings(cs, &gpmc_s); | ||
1488 | if (ret < 0) | ||
1489 | goto err; | ||
1490 | |||
1491 | gpmc_read_timings_dt(child, &gpmc_t); | ||
1492 | gpmc_cs_set_timings(cs, &gpmc_t); | ||
1493 | |||
1494 | if (of_platform_device_create(child, NULL, &pdev->dev)) | ||
1495 | return 0; | ||
1496 | |||
1497 | dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name); | ||
1498 | ret = -ENODEV; | ||
1499 | |||
1500 | err: | ||
1501 | gpmc_cs_free(cs); | ||
1502 | |||
1503 | return ret; | ||
1504 | } | ||
1505 | |||
1298 | static int gpmc_probe_dt(struct platform_device *pdev) | 1506 | static int gpmc_probe_dt(struct platform_device *pdev) |
1299 | { | 1507 | { |
1300 | int ret; | 1508 | int ret; |
@@ -1305,6 +1513,13 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1305 | if (!of_id) | 1513 | if (!of_id) |
1306 | return 0; | 1514 | return 0; |
1307 | 1515 | ||
1516 | ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins", | ||
1517 | &gpmc_nr_waitpins); | ||
1518 | if (ret < 0) { | ||
1519 | pr_err("%s: number of wait pins not found!\n", __func__); | ||
1520 | return ret; | ||
1521 | } | ||
1522 | |||
1308 | for_each_node_by_name(child, "nand") { | 1523 | for_each_node_by_name(child, "nand") { |
1309 | ret = gpmc_probe_nand_child(pdev, child); | 1524 | ret = gpmc_probe_nand_child(pdev, child); |
1310 | if (ret < 0) { | 1525 | if (ret < 0) { |
@@ -1320,6 +1535,23 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
1320 | return ret; | 1535 | return ret; |
1321 | } | 1536 | } |
1322 | } | 1537 | } |
1538 | |||
1539 | for_each_node_by_name(child, "nor") { | ||
1540 | ret = gpmc_probe_generic_child(pdev, child); | ||
1541 | if (ret < 0) { | ||
1542 | of_node_put(child); | ||
1543 | return ret; | ||
1544 | } | ||
1545 | } | ||
1546 | |||
1547 | for_each_node_by_name(child, "ethernet") { | ||
1548 | ret = gpmc_probe_generic_child(pdev, child); | ||
1549 | if (ret < 0) { | ||
1550 | of_node_put(child); | ||
1551 | return ret; | ||
1552 | } | ||
1553 | } | ||
1554 | |||
1323 | return 0; | 1555 | return 0; |
1324 | } | 1556 | } |
1325 | #else | 1557 | #else |
@@ -1364,25 +1596,37 @@ static int gpmc_probe(struct platform_device *pdev) | |||
1364 | gpmc_dev = &pdev->dev; | 1596 | gpmc_dev = &pdev->dev; |
1365 | 1597 | ||
1366 | l = gpmc_read_reg(GPMC_REVISION); | 1598 | l = gpmc_read_reg(GPMC_REVISION); |
1599 | |||
1600 | /* | ||
1601 | * FIXME: Once device-tree migration is complete the below flags | ||
1602 | * should be populated based upon the device-tree compatible | ||
1603 | * string. For now just use the IP revision. OMAP3+ devices have | ||
1604 | * the wr_access and wr_data_mux_bus register fields. OMAP4+ | ||
1605 | * devices support the addr-addr-data multiplex protocol. | ||
1606 | * | ||
1607 | * GPMC IP revisions: | ||
1608 | * - OMAP24xx = 2.0 | ||
1609 | * - OMAP3xxx = 5.0 | ||
1610 | * - OMAP44xx/54xx/AM335x = 6.0 | ||
1611 | */ | ||
1367 | if (GPMC_REVISION_MAJOR(l) > 0x4) | 1612 | if (GPMC_REVISION_MAJOR(l) > 0x4) |
1368 | gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; | 1613 | gpmc_capability = GPMC_HAS_WR_ACCESS | GPMC_HAS_WR_DATA_MUX_BUS; |
1614 | if (GPMC_REVISION_MAJOR(l) > 0x5) | ||
1615 | gpmc_capability |= GPMC_HAS_MUX_AAD; | ||
1369 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), | 1616 | dev_info(gpmc_dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), |
1370 | GPMC_REVISION_MINOR(l)); | 1617 | GPMC_REVISION_MINOR(l)); |
1371 | 1618 | ||
1372 | rc = gpmc_mem_init(); | 1619 | gpmc_mem_init(); |
1373 | if (IS_ERR_VALUE(rc)) { | ||
1374 | clk_disable_unprepare(gpmc_l3_clk); | ||
1375 | clk_put(gpmc_l3_clk); | ||
1376 | dev_err(gpmc_dev, "failed to reserve memory\n"); | ||
1377 | return rc; | ||
1378 | } | ||
1379 | 1620 | ||
1380 | if (IS_ERR_VALUE(gpmc_setup_irq())) | 1621 | if (gpmc_setup_irq() < 0) |
1381 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); | 1622 | dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); |
1382 | 1623 | ||
1383 | /* Now the GPMC is initialised, unreserve the chip-selects */ | 1624 | /* Now the GPMC is initialised, unreserve the chip-selects */ |
1384 | gpmc_cs_map = 0; | 1625 | gpmc_cs_map = 0; |
1385 | 1626 | ||
1627 | if (!pdev->dev.of_node) | ||
1628 | gpmc_nr_waitpins = GPMC_NR_WAITPINS; | ||
1629 | |||
1386 | rc = gpmc_probe_dt(pdev); | 1630 | rc = gpmc_probe_dt(pdev); |
1387 | if (rc < 0) { | 1631 | if (rc < 0) { |
1388 | clk_disable_unprepare(gpmc_l3_clk); | 1632 | clk_disable_unprepare(gpmc_l3_clk); |
diff --git a/arch/arm/mach-omap2/gpmc.h b/arch/arm/mach-omap2/gpmc.h index fe0a844d5007..707f6d58edd5 100644 --- a/arch/arm/mach-omap2/gpmc.h +++ b/arch/arm/mach-omap2/gpmc.h | |||
@@ -58,7 +58,7 @@ | |||
58 | #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) | 58 | #define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) |
59 | #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) | 59 | #define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) |
60 | #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) | 60 | #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) |
61 | #define GPMC_CONFIG1_MUXADDDATA (1 << 9) | 61 | #define GPMC_CONFIG1_MUXTYPE(val) ((val & 3) << 8) |
62 | #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) | 62 | #define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) |
63 | #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) | 63 | #define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) |
64 | #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) | 64 | #define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1)) |
@@ -73,6 +73,13 @@ | |||
73 | #define GPMC_IRQ_FIFOEVENTENABLE 0x01 | 73 | #define GPMC_IRQ_FIFOEVENTENABLE 0x01 |
74 | #define GPMC_IRQ_COUNT_EVENT 0x02 | 74 | #define GPMC_IRQ_COUNT_EVENT 0x02 |
75 | 75 | ||
76 | #define GPMC_BURST_4 4 /* 4 word burst */ | ||
77 | #define GPMC_BURST_8 8 /* 8 word burst */ | ||
78 | #define GPMC_BURST_16 16 /* 16 word burst */ | ||
79 | #define GPMC_DEVWIDTH_8BIT 1 /* 8-bit device width */ | ||
80 | #define GPMC_DEVWIDTH_16BIT 2 /* 16-bit device width */ | ||
81 | #define GPMC_MUX_AAD 1 /* Addr-Addr-Data multiplex */ | ||
82 | #define GPMC_MUX_AD 2 /* Addr-Data multiplex */ | ||
76 | 83 | ||
77 | /* bool type time settings */ | 84 | /* bool type time settings */ |
78 | struct gpmc_bool_timings { | 85 | struct gpmc_bool_timings { |
@@ -178,10 +185,6 @@ struct gpmc_device_timings { | |||
178 | u8 cyc_wpl; /* write deassertion time in cycles */ | 185 | u8 cyc_wpl; /* write deassertion time in cycles */ |
179 | u32 cyc_iaa; /* initial access time in cycles */ | 186 | u32 cyc_iaa; /* initial access time in cycles */ |
180 | 187 | ||
181 | bool mux; /* address & data muxed */ | ||
182 | bool sync_write;/* synchronous write */ | ||
183 | bool sync_read; /* synchronous read */ | ||
184 | |||
185 | /* extra delays */ | 188 | /* extra delays */ |
186 | bool ce_xdelay; | 189 | bool ce_xdelay; |
187 | bool avd_xdelay; | 190 | bool avd_xdelay; |
@@ -189,28 +192,40 @@ struct gpmc_device_timings { | |||
189 | bool we_xdelay; | 192 | bool we_xdelay; |
190 | }; | 193 | }; |
191 | 194 | ||
195 | struct gpmc_settings { | ||
196 | bool burst_wrap; /* enables wrap bursting */ | ||
197 | bool burst_read; /* enables read page/burst mode */ | ||
198 | bool burst_write; /* enables write page/burst mode */ | ||
199 | bool device_nand; /* device is NAND */ | ||
200 | bool sync_read; /* enables synchronous reads */ | ||
201 | bool sync_write; /* enables synchronous writes */ | ||
202 | bool wait_on_read; /* monitor wait on reads */ | ||
203 | bool wait_on_write; /* monitor wait on writes */ | ||
204 | u32 burst_len; /* page/burst length */ | ||
205 | u32 device_width; /* device bus width (8 or 16 bit) */ | ||
206 | u32 mux_add_data; /* multiplex address & data */ | ||
207 | u32 wait_pin; /* wait-pin to be used */ | ||
208 | }; | ||
209 | |||
192 | extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, | 210 | extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t, |
193 | struct gpmc_device_timings *dev_t); | 211 | struct gpmc_settings *gpmc_s, |
212 | struct gpmc_device_timings *dev_t); | ||
194 | 213 | ||
195 | extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); | 214 | extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); |
196 | extern int gpmc_get_client_irq(unsigned irq_config); | 215 | extern int gpmc_get_client_irq(unsigned irq_config); |
197 | 216 | ||
198 | extern unsigned int gpmc_ns_to_ticks(unsigned int time_ns); | ||
199 | extern unsigned int gpmc_ps_to_ticks(unsigned int time_ps); | ||
200 | extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); | 217 | extern unsigned int gpmc_ticks_to_ns(unsigned int ticks); |
201 | extern unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns); | ||
202 | extern unsigned long gpmc_get_fclk_period(void); | ||
203 | 218 | ||
204 | extern void gpmc_cs_write_reg(int cs, int idx, u32 val); | 219 | extern void gpmc_cs_write_reg(int cs, int idx, u32 val); |
205 | extern u32 gpmc_cs_read_reg(int cs, int idx); | ||
206 | extern int gpmc_calc_divider(unsigned int sync_clk); | 220 | extern int gpmc_calc_divider(unsigned int sync_clk); |
207 | extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); | 221 | extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); |
222 | extern int gpmc_cs_program_settings(int cs, struct gpmc_settings *p); | ||
208 | extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); | 223 | extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); |
209 | extern void gpmc_cs_free(int cs); | 224 | extern void gpmc_cs_free(int cs); |
210 | extern int gpmc_cs_set_reserved(int cs, int reserved); | ||
211 | extern int gpmc_cs_reserved(int cs); | ||
212 | extern void omap3_gpmc_save_context(void); | 225 | extern void omap3_gpmc_save_context(void); |
213 | extern void omap3_gpmc_restore_context(void); | 226 | extern void omap3_gpmc_restore_context(void); |
214 | extern int gpmc_cs_configure(int cs, int cmd, int wval); | 227 | extern int gpmc_configure(int cmd, int wval); |
228 | extern void gpmc_read_settings_dt(struct device_node *np, | ||
229 | struct gpmc_settings *p); | ||
215 | 230 | ||
216 | #endif | 231 | #endif |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 381be7ac0c17..eeea4fa28fbc 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -131,7 +131,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) | |||
131 | int oh_cnt, i, ret = 0; | 131 | int oh_cnt, i, ret = 0; |
132 | 132 | ||
133 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); | 133 | oh_cnt = of_property_count_strings(node, "ti,hwmods"); |
134 | if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { | 134 | if (oh_cnt <= 0) { |
135 | dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); | 135 | dev_dbg(&pdev->dev, "No 'hwmods' to build omap_device\n"); |
136 | return -ENODEV; | 136 | return -ENODEV; |
137 | } | 137 | } |
@@ -815,20 +815,17 @@ struct device *omap_device_get_by_hwmod_name(const char *oh_name) | |||
815 | } | 815 | } |
816 | 816 | ||
817 | oh = omap_hwmod_lookup(oh_name); | 817 | oh = omap_hwmod_lookup(oh_name); |
818 | if (IS_ERR_OR_NULL(oh)) { | 818 | if (!oh) { |
819 | WARN(1, "%s: no hwmod for %s\n", __func__, | 819 | WARN(1, "%s: no hwmod for %s\n", __func__, |
820 | oh_name); | 820 | oh_name); |
821 | return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV); | 821 | return ERR_PTR(-ENODEV); |
822 | } | 822 | } |
823 | if (IS_ERR_OR_NULL(oh->od)) { | 823 | if (!oh->od) { |
824 | WARN(1, "%s: no omap_device for %s\n", __func__, | 824 | WARN(1, "%s: no omap_device for %s\n", __func__, |
825 | oh_name); | 825 | oh_name); |
826 | return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV); | 826 | return ERR_PTR(-ENODEV); |
827 | } | 827 | } |
828 | 828 | ||
829 | if (IS_ERR_OR_NULL(oh->od->pdev)) | ||
830 | return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV); | ||
831 | |||
832 | return &oh->od->pdev->dev; | 829 | return &oh->od->pdev->dev; |
833 | } | 830 | } |
834 | 831 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 5f33c2da6999..3f50f680372e 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1662,7 +1662,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) | |||
1662 | return -ENOSYS; | 1662 | return -ENOSYS; |
1663 | 1663 | ||
1664 | ret = _lookup_hardreset(oh, name, &ohri); | 1664 | ret = _lookup_hardreset(oh, name, &ohri); |
1665 | if (IS_ERR_VALUE(ret)) | 1665 | if (ret < 0) |
1666 | return ret; | 1666 | return ret; |
1667 | 1667 | ||
1668 | if (oh->clkdm) { | 1668 | if (oh->clkdm) { |
@@ -2412,7 +2412,7 @@ static int __init _init(struct omap_hwmod *oh, void *data) | |||
2412 | _init_mpu_rt_base(oh, NULL); | 2412 | _init_mpu_rt_base(oh, NULL); |
2413 | 2413 | ||
2414 | r = _init_clocks(oh, NULL); | 2414 | r = _init_clocks(oh, NULL); |
2415 | if (IS_ERR_VALUE(r)) { | 2415 | if (r < 0) { |
2416 | WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); | 2416 | WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); |
2417 | return -EINVAL; | 2417 | return -EINVAL; |
2418 | } | 2418 | } |
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 1edd000a8143..0b339861d751 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -217,7 +217,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) | |||
217 | return 0; | 217 | return 0; |
218 | 218 | ||
219 | d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); | 219 | d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); |
220 | if (!(IS_ERR_OR_NULL(d))) | 220 | if (d) |
221 | (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, | 221 | (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, |
222 | (void *)pwrdm, &pwrdm_suspend_fops); | 222 | (void *)pwrdm, &pwrdm_suspend_fops); |
223 | 223 | ||
@@ -261,8 +261,8 @@ static int __init pm_dbg_init(void) | |||
261 | return 0; | 261 | return 0; |
262 | 262 | ||
263 | d = debugfs_create_dir("pm_debug", NULL); | 263 | d = debugfs_create_dir("pm_debug", NULL); |
264 | if (IS_ERR_OR_NULL(d)) | 264 | if (!d) |
265 | return PTR_ERR(d); | 265 | return -EINVAL; |
266 | 266 | ||
267 | (void) debugfs_create_file("count", S_IRUGO, | 267 | (void) debugfs_create_file("count", S_IRUGO, |
268 | d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); | 268 | d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 89cad4a605dd..86babd740d41 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -1180,7 +1180,7 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) | |||
1180 | { | 1180 | { |
1181 | int i; | 1181 | int i; |
1182 | 1182 | ||
1183 | if (IS_ERR_OR_NULL(pwrdm)) { | 1183 | if (!pwrdm) { |
1184 | pr_debug("powerdomain: %s: invalid powerdomain pointer\n", | 1184 | pr_debug("powerdomain: %s: invalid powerdomain pointer\n", |
1185 | __func__); | 1185 | __func__); |
1186 | return 1; | 1186 | return 1; |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index d00d89c93f1c..fdf1c039062c 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <asm/smp_twd.h> | 46 | #include <asm/smp_twd.h> |
47 | #include <asm/sched_clock.h> | 47 | #include <asm/sched_clock.h> |
48 | 48 | ||
49 | #include <asm/arch_timer.h> | ||
50 | #include "omap_hwmod.h" | 49 | #include "omap_hwmod.h" |
51 | #include "omap_device.h" | 50 | #include "omap_device.h" |
52 | #include <plat/counter-32k.h> | 51 | #include <plat/counter-32k.h> |
@@ -57,16 +56,6 @@ | |||
57 | #include "common.h" | 56 | #include "common.h" |
58 | #include "powerdomain.h" | 57 | #include "powerdomain.h" |
59 | 58 | ||
60 | /* Parent clocks, eventually these will come from the clock framework */ | ||
61 | |||
62 | #define OMAP2_MPU_SOURCE "sys_ck" | ||
63 | #define OMAP3_MPU_SOURCE OMAP2_MPU_SOURCE | ||
64 | #define OMAP4_MPU_SOURCE "sys_clkin_ck" | ||
65 | #define OMAP5_MPU_SOURCE "sys_clkin" | ||
66 | #define OMAP2_32K_SOURCE "func_32k_ck" | ||
67 | #define OMAP3_32K_SOURCE "omap_32k_fck" | ||
68 | #define OMAP4_32K_SOURCE "sys_32k_ck" | ||
69 | |||
70 | #define REALTIME_COUNTER_BASE 0x48243200 | 59 | #define REALTIME_COUNTER_BASE 0x48243200 |
71 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 | 60 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 |
72 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 | 61 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 |
@@ -130,7 +119,6 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode, | |||
130 | } | 119 | } |
131 | 120 | ||
132 | static struct clock_event_device clockevent_gpt = { | 121 | static struct clock_event_device clockevent_gpt = { |
133 | .name = "gp_timer", | ||
134 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 122 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
135 | .rating = 300, | 123 | .rating = 300, |
136 | .set_next_event = omap2_gp_timer_set_next_event, | 124 | .set_next_event = omap2_gp_timer_set_next_event, |
@@ -171,6 +159,12 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, | |||
171 | if (property && !of_get_property(np, property, NULL)) | 159 | if (property && !of_get_property(np, property, NULL)) |
172 | continue; | 160 | continue; |
173 | 161 | ||
162 | if (!property && (of_get_property(np, "ti,timer-alwon", NULL) || | ||
163 | of_get_property(np, "ti,timer-dsp", NULL) || | ||
164 | of_get_property(np, "ti,timer-pwm", NULL) || | ||
165 | of_get_property(np, "ti,timer-secure", NULL))) | ||
166 | continue; | ||
167 | |||
174 | of_add_property(np, &device_disabled); | 168 | of_add_property(np, &device_disabled); |
175 | return np; | 169 | return np; |
176 | } | 170 | } |
@@ -215,16 +209,17 @@ static u32 __init omap_dm_timer_get_errata(void) | |||
215 | } | 209 | } |
216 | 210 | ||
217 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | 211 | static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, |
218 | int gptimer_id, | 212 | const char *fck_source, |
219 | const char *fck_source, | 213 | const char *property, |
220 | const char *property, | 214 | const char **timer_name, |
221 | int posted) | 215 | int posted) |
222 | { | 216 | { |
223 | char name[10]; /* 10 = sizeof("gptXX_Xck0") */ | 217 | char name[10]; /* 10 = sizeof("gptXX_Xck0") */ |
224 | const char *oh_name; | 218 | const char *oh_name; |
225 | struct device_node *np; | 219 | struct device_node *np; |
226 | struct omap_hwmod *oh; | 220 | struct omap_hwmod *oh; |
227 | struct resource irq, mem; | 221 | struct resource irq, mem; |
222 | struct clk *src; | ||
228 | int r = 0; | 223 | int r = 0; |
229 | 224 | ||
230 | if (of_have_populated_dt()) { | 225 | if (of_have_populated_dt()) { |
@@ -244,10 +239,10 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
244 | 239 | ||
245 | of_node_put(np); | 240 | of_node_put(np); |
246 | } else { | 241 | } else { |
247 | if (omap_dm_timer_reserve_systimer(gptimer_id)) | 242 | if (omap_dm_timer_reserve_systimer(timer->id)) |
248 | return -ENODEV; | 243 | return -ENODEV; |
249 | 244 | ||
250 | sprintf(name, "timer%d", gptimer_id); | 245 | sprintf(name, "timer%d", timer->id); |
251 | oh_name = name; | 246 | oh_name = name; |
252 | } | 247 | } |
253 | 248 | ||
@@ -255,6 +250,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
255 | if (!oh) | 250 | if (!oh) |
256 | return -ENODEV; | 251 | return -ENODEV; |
257 | 252 | ||
253 | *timer_name = oh->name; | ||
254 | |||
258 | if (!of_have_populated_dt()) { | 255 | if (!of_have_populated_dt()) { |
259 | r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, | 256 | r = omap_hwmod_get_resource_byname(oh, IORESOURCE_IRQ, NULL, |
260 | &irq); | 257 | &irq); |
@@ -277,24 +274,24 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
277 | /* After the dmtimer is using hwmod these clocks won't be needed */ | 274 | /* After the dmtimer is using hwmod these clocks won't be needed */ |
278 | timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); | 275 | timer->fclk = clk_get(NULL, omap_hwmod_get_main_clk(oh)); |
279 | if (IS_ERR(timer->fclk)) | 276 | if (IS_ERR(timer->fclk)) |
280 | return -ENODEV; | 277 | return PTR_ERR(timer->fclk); |
281 | 278 | ||
282 | /* FIXME: Need to remove hard-coded test on timer ID */ | 279 | src = clk_get(NULL, fck_source); |
283 | if (gptimer_id != 12) { | 280 | if (IS_ERR(src)) |
284 | struct clk *src; | 281 | return PTR_ERR(src); |
285 | 282 | ||
286 | src = clk_get(NULL, fck_source); | 283 | if (clk_get_parent(timer->fclk) != src) { |
287 | if (IS_ERR(src)) { | 284 | r = clk_set_parent(timer->fclk, src); |
288 | r = -EINVAL; | 285 | if (r < 0) { |
289 | } else { | 286 | pr_warn("%s: %s cannot set source\n", __func__, |
290 | r = clk_set_parent(timer->fclk, src); | 287 | oh->name); |
291 | if (IS_ERR_VALUE(r)) | ||
292 | pr_warn("%s: %s cannot set source\n", | ||
293 | __func__, oh->name); | ||
294 | clk_put(src); | 288 | clk_put(src); |
289 | return r; | ||
295 | } | 290 | } |
296 | } | 291 | } |
297 | 292 | ||
293 | clk_put(src); | ||
294 | |||
298 | omap_hwmod_setup_one(oh_name); | 295 | omap_hwmod_setup_one(oh_name); |
299 | omap_hwmod_enable(oh); | 296 | omap_hwmod_enable(oh); |
300 | __omap_dm_timer_init_regs(timer); | 297 | __omap_dm_timer_init_regs(timer); |
@@ -318,6 +315,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
318 | { | 315 | { |
319 | int res; | 316 | int res; |
320 | 317 | ||
318 | clkev.id = gptimer_id; | ||
321 | clkev.errata = omap_dm_timer_get_errata(); | 319 | clkev.errata = omap_dm_timer_get_errata(); |
322 | 320 | ||
323 | /* | 321 | /* |
@@ -327,8 +325,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
327 | */ | 325 | */ |
328 | __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); | 326 | __omap_dm_timer_override_errata(&clkev, OMAP_TIMER_ERRATA_I103_I767); |
329 | 327 | ||
330 | res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source, property, | 328 | res = omap_dm_timer_init_one(&clkev, fck_source, property, |
331 | OMAP_TIMER_POSTED); | 329 | &clockevent_gpt.name, OMAP_TIMER_POSTED); |
332 | BUG_ON(res); | 330 | BUG_ON(res); |
333 | 331 | ||
334 | omap2_gp_timer_irq.dev_id = &clkev; | 332 | omap2_gp_timer_irq.dev_id = &clkev; |
@@ -342,8 +340,8 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
342 | 3, /* Timer internal resynch latency */ | 340 | 3, /* Timer internal resynch latency */ |
343 | 0xffffffff); | 341 | 0xffffffff); |
344 | 342 | ||
345 | pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", | 343 | pr_info("OMAP clockevent source: %s at %lu Hz\n", clockevent_gpt.name, |
346 | gptimer_id, clkev.rate); | 344 | clkev.rate); |
347 | } | 345 | } |
348 | 346 | ||
349 | /* Clocksource code */ | 347 | /* Clocksource code */ |
@@ -360,7 +358,6 @@ static cycle_t clocksource_read_cycles(struct clocksource *cs) | |||
360 | } | 358 | } |
361 | 359 | ||
362 | static struct clocksource clocksource_gpt = { | 360 | static struct clocksource clocksource_gpt = { |
363 | .name = "gp_timer", | ||
364 | .rating = 300, | 361 | .rating = 300, |
365 | .read = clocksource_read_cycles, | 362 | .read = clocksource_read_cycles, |
366 | .mask = CLOCKSOURCE_MASK(32), | 363 | .mask = CLOCKSOURCE_MASK(32), |
@@ -443,13 +440,16 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void) | |||
443 | } | 440 | } |
444 | 441 | ||
445 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, | 442 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, |
446 | const char *fck_source) | 443 | const char *fck_source, |
444 | const char *property) | ||
447 | { | 445 | { |
448 | int res; | 446 | int res; |
449 | 447 | ||
448 | clksrc.id = gptimer_id; | ||
450 | clksrc.errata = omap_dm_timer_get_errata(); | 449 | clksrc.errata = omap_dm_timer_get_errata(); |
451 | 450 | ||
452 | res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source, NULL, | 451 | res = omap_dm_timer_init_one(&clksrc, fck_source, property, |
452 | &clocksource_gpt.name, | ||
453 | OMAP_TIMER_NONPOSTED); | 453 | OMAP_TIMER_NONPOSTED); |
454 | BUG_ON(res); | 454 | BUG_ON(res); |
455 | 455 | ||
@@ -462,8 +462,8 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id, | |||
462 | pr_err("Could not register clocksource %s\n", | 462 | pr_err("Could not register clocksource %s\n", |
463 | clocksource_gpt.name); | 463 | clocksource_gpt.name); |
464 | else | 464 | else |
465 | pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", | 465 | pr_info("OMAP clocksource: %s at %lu Hz\n", |
466 | gptimer_id, clksrc.rate); | 466 | clocksource_gpt.name, clksrc.rate); |
467 | } | 467 | } |
468 | 468 | ||
469 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER | 469 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER |
@@ -488,7 +488,7 @@ static void __init realtime_counter_init(void) | |||
488 | pr_err("%s: ioremap failed\n", __func__); | 488 | pr_err("%s: ioremap failed\n", __func__); |
489 | return; | 489 | return; |
490 | } | 490 | } |
491 | sys_clk = clk_get(NULL, OMAP5_MPU_SOURCE); | 491 | sys_clk = clk_get(NULL, "sys_clkin"); |
492 | if (IS_ERR(sys_clk)) { | 492 | if (IS_ERR(sys_clk)) { |
493 | pr_err("%s: failed to get system clock handle\n", __func__); | 493 | pr_err("%s: failed to get system clock handle\n", __func__); |
494 | iounmap(base); | 494 | iounmap(base); |
@@ -545,18 +545,19 @@ static inline void __init realtime_counter_init(void) | |||
545 | #endif | 545 | #endif |
546 | 546 | ||
547 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 547 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
548 | clksrc_nr, clksrc_src) \ | 548 | clksrc_nr, clksrc_src, clksrc_prop) \ |
549 | void __init omap##name##_gptimer_timer_init(void) \ | 549 | void __init omap##name##_gptimer_timer_init(void) \ |
550 | { \ | 550 | { \ |
551 | if (omap_clk_init) \ | 551 | if (omap_clk_init) \ |
552 | omap_clk_init(); \ | 552 | omap_clk_init(); \ |
553 | omap_dmtimer_init(); \ | 553 | omap_dmtimer_init(); \ |
554 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 554 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
555 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ | 555 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ |
556 | clksrc_prop); \ | ||
556 | } | 557 | } |
557 | 558 | ||
558 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 559 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
559 | clksrc_nr, clksrc_src) \ | 560 | clksrc_nr, clksrc_src, clksrc_prop) \ |
560 | void __init omap##name##_sync32k_timer_init(void) \ | 561 | void __init omap##name##_sync32k_timer_init(void) \ |
561 | { \ | 562 | { \ |
562 | if (omap_clk_init) \ | 563 | if (omap_clk_init) \ |
@@ -565,33 +566,35 @@ void __init omap##name##_sync32k_timer_init(void) \ | |||
565 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 566 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
566 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ | 567 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ |
567 | if (use_gptimer_clksrc) \ | 568 | if (use_gptimer_clksrc) \ |
568 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\ | 569 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src, \ |
570 | clksrc_prop); \ | ||
569 | else \ | 571 | else \ |
570 | omap2_sync32k_clocksource_init(); \ | 572 | omap2_sync32k_clocksource_init(); \ |
571 | } | 573 | } |
572 | 574 | ||
573 | #ifdef CONFIG_ARCH_OMAP2 | 575 | #ifdef CONFIG_ARCH_OMAP2 |
574 | OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", | 576 | OMAP_SYS_32K_TIMER_INIT(2, 1, "timer_32k_ck", "ti,timer-alwon", |
575 | 2, OMAP2_MPU_SOURCE); | 577 | 2, "timer_sys_ck", NULL); |
576 | #endif /* CONFIG_ARCH_OMAP2 */ | 578 | #endif /* CONFIG_ARCH_OMAP2 */ |
577 | 579 | ||
578 | #ifdef CONFIG_ARCH_OMAP3 | 580 | #ifdef CONFIG_ARCH_OMAP3 |
579 | OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", | 581 | OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon", |
580 | 2, OMAP3_MPU_SOURCE); | 582 | 2, "timer_sys_ck", NULL); |
581 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", | 583 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure", |
582 | 2, OMAP3_MPU_SOURCE); | 584 | 2, "timer_sys_ck", NULL); |
583 | OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon", | ||
584 | 2, OMAP3_MPU_SOURCE); | ||
585 | #endif /* CONFIG_ARCH_OMAP3 */ | 585 | #endif /* CONFIG_ARCH_OMAP3 */ |
586 | 586 | ||
587 | #ifdef CONFIG_SOC_AM33XX | 587 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) |
588 | OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", | 588 | OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL, |
589 | 2, OMAP4_MPU_SOURCE); | 589 | 1, "timer_sys_ck", "ti,timer-alwon"); |
590 | #endif /* CONFIG_SOC_AM33XX */ | 590 | #endif |
591 | |||
592 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | ||
593 | static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon", | ||
594 | 2, "sys_clkin_ck", NULL); | ||
595 | #endif | ||
591 | 596 | ||
592 | #ifdef CONFIG_ARCH_OMAP4 | 597 | #ifdef CONFIG_ARCH_OMAP4 |
593 | OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | ||
594 | 2, OMAP4_MPU_SOURCE); | ||
595 | #ifdef CONFIG_LOCAL_TIMERS | 598 | #ifdef CONFIG_LOCAL_TIMERS |
596 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); | 599 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); |
597 | void __init omap4_local_timer_init(void) | 600 | void __init omap4_local_timer_init(void) |
@@ -602,7 +605,7 @@ void __init omap4_local_timer_init(void) | |||
602 | int err; | 605 | int err; |
603 | 606 | ||
604 | if (of_have_populated_dt()) { | 607 | if (of_have_populated_dt()) { |
605 | twd_local_timer_of_register(); | 608 | clocksource_of_init(); |
606 | return; | 609 | return; |
607 | } | 610 | } |
608 | 611 | ||
@@ -620,18 +623,12 @@ void __init omap4_local_timer_init(void) | |||
620 | #endif /* CONFIG_ARCH_OMAP4 */ | 623 | #endif /* CONFIG_ARCH_OMAP4 */ |
621 | 624 | ||
622 | #ifdef CONFIG_SOC_OMAP5 | 625 | #ifdef CONFIG_SOC_OMAP5 |
623 | OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | ||
624 | 2, OMAP5_MPU_SOURCE); | ||
625 | void __init omap5_realtime_timer_init(void) | 626 | void __init omap5_realtime_timer_init(void) |
626 | { | 627 | { |
627 | int err; | 628 | omap4_sync32k_timer_init(); |
628 | |||
629 | omap5_sync32k_timer_init(); | ||
630 | realtime_counter_init(); | 629 | realtime_counter_init(); |
631 | 630 | ||
632 | err = arch_timer_of_register(); | 631 | clocksource_of_init(); |
633 | if (err) | ||
634 | pr_err("%s: arch_timer_register failed %d\n", __func__, err); | ||
635 | } | 632 | } |
636 | #endif /* CONFIG_SOC_OMAP5 */ | 633 | #endif /* CONFIG_SOC_OMAP5 */ |
637 | 634 | ||
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c index 5706bdccf45e..aa27d7f5cbb7 100644 --- a/arch/arm/mach-omap2/usb-host.c +++ b/arch/arm/mach-omap2/usb-host.c | |||
@@ -22,8 +22,12 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/dma-mapping.h> | 24 | #include <linux/dma-mapping.h> |
25 | 25 | #include <linux/regulator/machine.h> | |
26 | #include <asm/io.h> | 26 | #include <linux/regulator/fixed.h> |
27 | #include <linux/string.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/usb/phy.h> | ||
27 | 31 | ||
28 | #include "soc.h" | 32 | #include "soc.h" |
29 | #include "omap_device.h" | 33 | #include "omap_device.h" |
@@ -526,3 +530,155 @@ void __init usbhs_init(struct usbhs_omap_platform_data *pdata) | |||
526 | } | 530 | } |
527 | 531 | ||
528 | #endif | 532 | #endif |
533 | |||
534 | /* Template for PHY regulators */ | ||
535 | static struct fixed_voltage_config hsusb_reg_config = { | ||
536 | /* .supply_name filled later */ | ||
537 | .microvolts = 3300000, | ||
538 | .gpio = -1, /* updated later */ | ||
539 | .startup_delay = 70000, /* 70msec */ | ||
540 | .enable_high = 1, /* updated later */ | ||
541 | .enabled_at_boot = 0, /* keep in RESET */ | ||
542 | /* .init_data filled later */ | ||
543 | }; | ||
544 | |||
545 | static const char *nop_name = "nop_usb_xceiv"; /* NOP PHY driver */ | ||
546 | static const char *reg_name = "reg-fixed-voltage"; /* Regulator driver */ | ||
547 | |||
548 | /** | ||
549 | * usbhs_add_regulator - Add a gpio based fixed voltage regulator device | ||
550 | * @name: name for the regulator | ||
551 | * @dev_id: device id of the device this regulator supplies power to | ||
552 | * @dev_supply: supply name that the device expects | ||
553 | * @gpio: GPIO number | ||
554 | * @polarity: 1 - Active high, 0 - Active low | ||
555 | */ | ||
556 | static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply, | ||
557 | int gpio, int polarity) | ||
558 | { | ||
559 | struct regulator_consumer_supply *supplies; | ||
560 | struct regulator_init_data *reg_data; | ||
561 | struct fixed_voltage_config *config; | ||
562 | struct platform_device *pdev; | ||
563 | int ret; | ||
564 | |||
565 | supplies = kzalloc(sizeof(*supplies), GFP_KERNEL); | ||
566 | if (!supplies) | ||
567 | return -ENOMEM; | ||
568 | |||
569 | supplies->supply = dev_supply; | ||
570 | supplies->dev_name = dev_id; | ||
571 | |||
572 | reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); | ||
573 | if (!reg_data) | ||
574 | return -ENOMEM; | ||
575 | |||
576 | reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; | ||
577 | reg_data->consumer_supplies = supplies; | ||
578 | reg_data->num_consumer_supplies = 1; | ||
579 | |||
580 | config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config), | ||
581 | GFP_KERNEL); | ||
582 | if (!config) | ||
583 | return -ENOMEM; | ||
584 | |||
585 | config->supply_name = name; | ||
586 | config->gpio = gpio; | ||
587 | config->enable_high = polarity; | ||
588 | config->init_data = reg_data; | ||
589 | |||
590 | /* create a regulator device */ | ||
591 | pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); | ||
592 | if (!pdev) | ||
593 | return -ENOMEM; | ||
594 | |||
595 | pdev->id = PLATFORM_DEVID_AUTO; | ||
596 | pdev->name = reg_name; | ||
597 | pdev->dev.platform_data = config; | ||
598 | |||
599 | ret = platform_device_register(pdev); | ||
600 | if (ret) | ||
601 | pr_err("%s: Failed registering regulator %s for %s\n", | ||
602 | __func__, name, dev_id); | ||
603 | |||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys) | ||
608 | { | ||
609 | char *rail_name; | ||
610 | int i, len; | ||
611 | struct platform_device *pdev; | ||
612 | char *phy_id; | ||
613 | |||
614 | /* the phy_id will be something like "nop_usb_xceiv.1" */ | ||
615 | len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */ | ||
616 | |||
617 | for (i = 0; i < num_phys; i++) { | ||
618 | |||
619 | if (!phy->port) { | ||
620 | pr_err("%s: Invalid port 0. Must start from 1\n", | ||
621 | __func__); | ||
622 | continue; | ||
623 | } | ||
624 | |||
625 | /* do we need a NOP PHY device ? */ | ||
626 | if (!gpio_is_valid(phy->reset_gpio) && | ||
627 | !gpio_is_valid(phy->vcc_gpio)) | ||
628 | continue; | ||
629 | |||
630 | /* create a NOP PHY device */ | ||
631 | pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); | ||
632 | if (!pdev) | ||
633 | return -ENOMEM; | ||
634 | |||
635 | pdev->id = phy->port; | ||
636 | pdev->name = nop_name; | ||
637 | pdev->dev.platform_data = phy->platform_data; | ||
638 | |||
639 | phy_id = kmalloc(len, GFP_KERNEL); | ||
640 | if (!phy_id) | ||
641 | return -ENOMEM; | ||
642 | |||
643 | scnprintf(phy_id, len, "nop_usb_xceiv.%d\n", | ||
644 | pdev->id); | ||
645 | |||
646 | if (platform_device_register(pdev)) { | ||
647 | pr_err("%s: Failed to register device %s\n", | ||
648 | __func__, phy_id); | ||
649 | continue; | ||
650 | } | ||
651 | |||
652 | usb_bind_phy("ehci-omap.0", phy->port - 1, phy_id); | ||
653 | |||
654 | /* Do we need RESET regulator ? */ | ||
655 | if (gpio_is_valid(phy->reset_gpio)) { | ||
656 | |||
657 | rail_name = kmalloc(13, GFP_KERNEL); | ||
658 | if (!rail_name) | ||
659 | return -ENOMEM; | ||
660 | |||
661 | scnprintf(rail_name, 13, "hsusb%d_reset", phy->port); | ||
662 | |||
663 | usbhs_add_regulator(rail_name, phy_id, "reset", | ||
664 | phy->reset_gpio, 1); | ||
665 | } | ||
666 | |||
667 | /* Do we need VCC regulator ? */ | ||
668 | if (gpio_is_valid(phy->vcc_gpio)) { | ||
669 | |||
670 | rail_name = kmalloc(13, GFP_KERNEL); | ||
671 | if (!rail_name) | ||
672 | return -ENOMEM; | ||
673 | |||
674 | scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port); | ||
675 | |||
676 | usbhs_add_regulator(rail_name, phy_id, "vcc", | ||
677 | phy->vcc_gpio, phy->vcc_polarity); | ||
678 | } | ||
679 | |||
680 | phy++; | ||
681 | } | ||
682 | |||
683 | return 0; | ||
684 | } | ||
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c index c5a3c6f9504e..e832bc7b8e2d 100644 --- a/arch/arm/mach-omap2/usb-tusb6010.c +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/err.h> | ||
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
12 | #include <linux/types.h> | 13 | #include <linux/types.h> |
13 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
@@ -26,6 +27,24 @@ | |||
26 | static u8 async_cs, sync_cs; | 27 | static u8 async_cs, sync_cs; |
27 | static unsigned refclk_psec; | 28 | static unsigned refclk_psec; |
28 | 29 | ||
30 | static struct gpmc_settings tusb_async = { | ||
31 | .wait_on_read = true, | ||
32 | .wait_on_write = true, | ||
33 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
34 | .mux_add_data = GPMC_MUX_AD, | ||
35 | }; | ||
36 | |||
37 | static struct gpmc_settings tusb_sync = { | ||
38 | .burst_read = true, | ||
39 | .burst_write = true, | ||
40 | .sync_read = true, | ||
41 | .sync_write = true, | ||
42 | .wait_on_read = true, | ||
43 | .wait_on_write = true, | ||
44 | .burst_len = GPMC_BURST_16, | ||
45 | .device_width = GPMC_DEVWIDTH_16BIT, | ||
46 | .mux_add_data = GPMC_MUX_AD, | ||
47 | }; | ||
29 | 48 | ||
30 | /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ | 49 | /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ |
31 | 50 | ||
@@ -37,8 +56,6 @@ static int tusb_set_async_mode(unsigned sysclk_ps) | |||
37 | 56 | ||
38 | memset(&dev_t, 0, sizeof(dev_t)); | 57 | memset(&dev_t, 0, sizeof(dev_t)); |
39 | 58 | ||
40 | dev_t.mux = true; | ||
41 | |||
42 | dev_t.t_ceasu = 8 * 1000; | 59 | dev_t.t_ceasu = 8 * 1000; |
43 | dev_t.t_avdasu = t_acsnh_advnh - 7000; | 60 | dev_t.t_avdasu = t_acsnh_advnh - 7000; |
44 | dev_t.t_ce_avd = 1000; | 61 | dev_t.t_ce_avd = 1000; |
@@ -52,7 +69,7 @@ static int tusb_set_async_mode(unsigned sysclk_ps) | |||
52 | dev_t.t_wpl = 300; | 69 | dev_t.t_wpl = 300; |
53 | dev_t.cyc_aavdh_we = 1; | 70 | dev_t.cyc_aavdh_we = 1; |
54 | 71 | ||
55 | gpmc_calc_timings(&t, &dev_t); | 72 | gpmc_calc_timings(&t, &tusb_async, &dev_t); |
56 | 73 | ||
57 | return gpmc_cs_set_timings(async_cs, &t); | 74 | return gpmc_cs_set_timings(async_cs, &t); |
58 | } | 75 | } |
@@ -65,10 +82,6 @@ static int tusb_set_sync_mode(unsigned sysclk_ps) | |||
65 | 82 | ||
66 | memset(&dev_t, 0, sizeof(dev_t)); | 83 | memset(&dev_t, 0, sizeof(dev_t)); |
67 | 84 | ||
68 | dev_t.mux = true; | ||
69 | dev_t.sync_read = true; | ||
70 | dev_t.sync_write = true; | ||
71 | |||
72 | dev_t.clk = 11100; | 85 | dev_t.clk = 11100; |
73 | dev_t.t_bacc = 1000; | 86 | dev_t.t_bacc = 1000; |
74 | dev_t.t_ces = 1000; | 87 | dev_t.t_ces = 1000; |
@@ -84,7 +97,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps) | |||
84 | dev_t.cyc_wpl = 6; | 97 | dev_t.cyc_wpl = 6; |
85 | dev_t.t_ce_rdyz = 7000; | 98 | dev_t.t_ce_rdyz = 7000; |
86 | 99 | ||
87 | gpmc_calc_timings(&t, &dev_t); | 100 | gpmc_calc_timings(&t, &tusb_sync, &dev_t); |
88 | 101 | ||
89 | return gpmc_cs_set_timings(sync_cs, &t); | 102 | return gpmc_cs_set_timings(sync_cs, &t); |
90 | } | 103 | } |
@@ -165,18 +178,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
165 | return status; | 178 | return status; |
166 | } | 179 | } |
167 | tusb_resources[0].end = tusb_resources[0].start + 0x9ff; | 180 | tusb_resources[0].end = tusb_resources[0].start + 0x9ff; |
181 | tusb_async.wait_pin = waitpin; | ||
168 | async_cs = async; | 182 | async_cs = async; |
169 | gpmc_cs_write_reg(async, GPMC_CS_CONFIG1, | ||
170 | GPMC_CONFIG1_PAGE_LEN(2) | ||
171 | | GPMC_CONFIG1_WAIT_READ_MON | ||
172 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
173 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
174 | | GPMC_CONFIG1_READTYPE_ASYNC | ||
175 | | GPMC_CONFIG1_WRITETYPE_ASYNC | ||
176 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
177 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
178 | | GPMC_CONFIG1_MUXADDDATA); | ||
179 | 183 | ||
184 | status = gpmc_cs_program_settings(async_cs, &tusb_async); | ||
185 | if (status < 0) | ||
186 | return status; | ||
180 | 187 | ||
181 | /* SYNC region, primarily for DMA */ | 188 | /* SYNC region, primarily for DMA */ |
182 | status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) | 189 | status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) |
@@ -186,21 +193,12 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | |||
186 | return status; | 193 | return status; |
187 | } | 194 | } |
188 | tusb_resources[1].end = tusb_resources[1].start + 0x9ff; | 195 | tusb_resources[1].end = tusb_resources[1].start + 0x9ff; |
196 | tusb_sync.wait_pin = waitpin; | ||
189 | sync_cs = sync; | 197 | sync_cs = sync; |
190 | gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1, | 198 | |
191 | GPMC_CONFIG1_READMULTIPLE_SUPP | 199 | status = gpmc_cs_program_settings(sync_cs, &tusb_sync); |
192 | | GPMC_CONFIG1_READTYPE_SYNC | 200 | if (status < 0) |
193 | | GPMC_CONFIG1_WRITEMULTIPLE_SUPP | 201 | return status; |
194 | | GPMC_CONFIG1_WRITETYPE_SYNC | ||
195 | | GPMC_CONFIG1_PAGE_LEN(2) | ||
196 | | GPMC_CONFIG1_WAIT_READ_MON | ||
197 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
198 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
199 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
200 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
201 | | GPMC_CONFIG1_MUXADDDATA | ||
202 | /* fclk divider gets set later */ | ||
203 | ); | ||
204 | 202 | ||
205 | /* IRQ */ | 203 | /* IRQ */ |
206 | status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); | 204 | status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); |
diff --git a/arch/arm/mach-omap2/usb.h b/arch/arm/mach-omap2/usb.h index 3319f5cf47a3..e7261ebcf7b0 100644 --- a/arch/arm/mach-omap2/usb.h +++ b/arch/arm/mach-omap2/usb.h | |||
@@ -53,8 +53,17 @@ | |||
53 | #define USBPHY_OTGSESSEND_EN (1 << 20) | 53 | #define USBPHY_OTGSESSEND_EN (1 << 20) |
54 | #define USBPHY_DATA_POLARITY (1 << 23) | 54 | #define USBPHY_DATA_POLARITY (1 << 23) |
55 | 55 | ||
56 | struct usbhs_phy_data { | ||
57 | int port; /* 1 indexed port number */ | ||
58 | int reset_gpio; | ||
59 | int vcc_gpio; | ||
60 | bool vcc_polarity; /* 1 active high, 0 active low */ | ||
61 | void *platform_data; | ||
62 | }; | ||
63 | |||
56 | extern void usb_musb_init(struct omap_musb_board_data *board_data); | 64 | extern void usb_musb_init(struct omap_musb_board_data *board_data); |
57 | extern void usbhs_init(struct usbhs_omap_platform_data *pdata); | 65 | extern void usbhs_init(struct usbhs_omap_platform_data *pdata); |
66 | extern int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys); | ||
58 | 67 | ||
59 | extern void am35x_musb_reset(void); | 68 | extern void am35x_musb_reset(void); |
60 | extern void am35x_musb_phy_power(u8 on); | 69 | extern void am35x_musb_phy_power(u8 on); |
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig index 37f513d1588e..0a8663c5f2ba 100644 --- a/arch/arm/mach-s3c24xx/Kconfig +++ b/arch/arm/mach-s3c24xx/Kconfig | |||
@@ -30,6 +30,7 @@ config CPU_S3C2410 | |||
30 | select S3C2410_CLOCK | 30 | select S3C2410_CLOCK |
31 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX | 31 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX |
32 | select S3C2410_PM if PM | 32 | select S3C2410_PM if PM |
33 | select SAMSUNG_HRT | ||
33 | help | 34 | help |
34 | Support for S3C2410 and S3C2410A family from the S3C24XX line | 35 | Support for S3C2410 and S3C2410A family from the S3C24XX line |
35 | of Samsung Mobile CPUs. | 36 | of Samsung Mobile CPUs. |
@@ -41,6 +42,7 @@ config CPU_S3C2412 | |||
41 | select CPU_LLSERIAL_S3C2440 | 42 | select CPU_LLSERIAL_S3C2440 |
42 | select S3C2412_DMA if S3C24XX_DMA | 43 | select S3C2412_DMA if S3C24XX_DMA |
43 | select S3C2412_PM if PM | 44 | select S3C2412_PM if PM |
45 | select SAMSUNG_HRT | ||
44 | help | 46 | help |
45 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line | 47 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line |
46 | 48 | ||
@@ -53,6 +55,7 @@ config CPU_S3C2416 | |||
53 | select S3C2443_COMMON | 55 | select S3C2443_COMMON |
54 | select S3C2443_DMA if S3C24XX_DMA | 56 | select S3C2443_DMA if S3C24XX_DMA |
55 | select SAMSUNG_CLKSRC | 57 | select SAMSUNG_CLKSRC |
58 | select SAMSUNG_HRT | ||
56 | help | 59 | help |
57 | Support for the S3C2416 SoC from the S3C24XX line | 60 | Support for the S3C2416 SoC from the S3C24XX line |
58 | 61 | ||
@@ -63,6 +66,7 @@ config CPU_S3C2440 | |||
63 | select S3C2410_CLOCK | 66 | select S3C2410_CLOCK |
64 | select S3C2410_PM if PM | 67 | select S3C2410_PM if PM |
65 | select S3C2440_DMA if S3C24XX_DMA | 68 | select S3C2440_DMA if S3C24XX_DMA |
69 | select SAMSUNG_HRT | ||
66 | help | 70 | help |
67 | Support for S3C2440 Samsung Mobile CPU based systems. | 71 | Support for S3C2440 Samsung Mobile CPU based systems. |
68 | 72 | ||
@@ -72,6 +76,7 @@ config CPU_S3C2442 | |||
72 | select CPU_LLSERIAL_S3C2440 | 76 | select CPU_LLSERIAL_S3C2440 |
73 | select S3C2410_CLOCK | 77 | select S3C2410_CLOCK |
74 | select S3C2410_PM if PM | 78 | select S3C2410_PM if PM |
79 | select SAMSUNG_HRT | ||
75 | help | 80 | help |
76 | Support for S3C2442 Samsung Mobile CPU based systems. | 81 | Support for S3C2442 Samsung Mobile CPU based systems. |
77 | 82 | ||
@@ -87,6 +92,7 @@ config CPU_S3C2443 | |||
87 | select S3C2443_COMMON | 92 | select S3C2443_COMMON |
88 | select S3C2443_DMA if S3C24XX_DMA | 93 | select S3C2443_DMA if S3C24XX_DMA |
89 | select SAMSUNG_CLKSRC | 94 | select SAMSUNG_CLKSRC |
95 | select SAMSUNG_HRT | ||
90 | help | 96 | help |
91 | Support for the S3C2443 SoC from the S3C24XX line | 97 | Support for the S3C2443 SoC from the S3C24XX line |
92 | 98 | ||
@@ -401,6 +407,7 @@ config S3C2412_DMA | |||
401 | config S3C2412_PM | 407 | config S3C2412_PM |
402 | bool | 408 | bool |
403 | select S3C2412_PM_SLEEP | 409 | select S3C2412_PM_SLEEP |
410 | select SAMSUNG_WAKEMASK | ||
404 | help | 411 | help |
405 | Internal config node to apply S3C2412 power management | 412 | Internal config node to apply S3C2412 power management |
406 | 413 | ||
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile index af53d27d5c36..6f46ecfc8396 100644 --- a/arch/arm/mach-s3c24xx/Makefile +++ b/arch/arm/mach-s3c24xx/Makefile | |||
@@ -14,7 +14,7 @@ obj- := | |||
14 | 14 | ||
15 | # core | 15 | # core |
16 | 16 | ||
17 | obj-y += common.o irq.o | 17 | obj-y += common.o |
18 | 18 | ||
19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o | 19 | obj-$(CONFIG_CPU_S3C2410) += s3c2410.o |
20 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o | 20 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o |
@@ -22,7 +22,7 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o | |||
22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o | 22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o |
23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o | 23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o |
24 | 24 | ||
25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o | 25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o |
26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o | 26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o |
27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o | 27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o |
28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o | 28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o |
@@ -31,9 +31,9 @@ obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o | |||
31 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o | 31 | obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o |
32 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o | 32 | obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o |
33 | 33 | ||
34 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o irq-s3c2440.o clock-s3c2440.o | 34 | obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o |
35 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o | 35 | obj-$(CONFIG_CPU_S3C2442) += s3c2442.o |
36 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o irq-s3c244x.o clock-s3c244x.o | 36 | obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o |
37 | obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o | 37 | obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o |
38 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o | 38 | obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o |
39 | obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o | 39 | obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o |
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c index c0daa9590b4c..cb1b791954de 100644 --- a/arch/arm/mach-s3c24xx/bast-irq.c +++ b/arch/arm/mach-s3c24xx/bast-irq.c | |||
@@ -34,8 +34,6 @@ | |||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | #include <mach/regs-irq.h> | 35 | #include <mach/regs-irq.h> |
36 | 36 | ||
37 | #include <plat/irq.h> | ||
38 | |||
39 | #include "bast.h" | 37 | #include "bast.h" |
40 | 38 | ||
41 | #define irqdbf(x...) | 39 | #define irqdbf(x...) |
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c index 641266f3d152..34fffdf6fc1d 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2410.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2410.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <mach/regs-clock.h> | 40 | #include <mach/regs-clock.h> |
41 | #include <mach/regs-gpio.h> | 41 | #include <mach/regs-gpio.h> |
42 | 42 | ||
43 | #include <plat/s3c2410.h> | ||
44 | #include <plat/clock.h> | 43 | #include <plat/clock.h> |
45 | #include <plat/cpu.h> | 44 | #include <plat/cpu.h> |
46 | 45 | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c index d10b695a9066..2cc017da88fe 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2412.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2412.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <mach/regs-clock.h> | 41 | #include <mach/regs-clock.h> |
42 | #include <mach/regs-gpio.h> | 42 | #include <mach/regs-gpio.h> |
43 | 43 | ||
44 | #include <plat/s3c2412.h> | ||
45 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
46 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
47 | 46 | ||
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c index 14a81c2317a4..036056cea57c 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2416.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2416.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | 16 | ||
17 | #include <plat/s3c2416.h> | ||
18 | #include <plat/clock.h> | 17 | #include <plat/clock.h> |
19 | #include <plat/clock-clksrc.h> | 18 | #include <plat/clock-clksrc.h> |
20 | #include <plat/cpu.h> | 19 | #include <plat/cpu.h> |
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c index bdaba59b42dc..0a53051b0787 100644 --- a/arch/arm/mach-s3c24xx/clock-s3c2443.c +++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | #include <plat/cpu-freq.h> | 42 | #include <plat/cpu-freq.h> |
43 | 43 | ||
44 | #include <plat/s3c2443.h> | ||
45 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
46 | #include <plat/clock-clksrc.h> | 45 | #include <plat/clock-clksrc.h> |
47 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
diff --git a/arch/arm/mach-s3c24xx/common-smdk.c b/arch/arm/mach-s3c24xx/common-smdk.c index 3b2cf6db3634..404444dd3840 100644 --- a/arch/arm/mach-s3c24xx/common-smdk.c +++ b/arch/arm/mach-s3c24xx/common-smdk.c | |||
@@ -41,11 +41,12 @@ | |||
41 | 41 | ||
42 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 42 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
43 | 43 | ||
44 | #include <plat/common-smdk.h> | ||
45 | #include <plat/gpio-cfg.h> | 44 | #include <plat/gpio-cfg.h> |
46 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
47 | #include <plat/pm.h> | 46 | #include <plat/pm.h> |
48 | 47 | ||
48 | #include "common-smdk.h" | ||
49 | |||
49 | /* LED devices */ | 50 | /* LED devices */ |
50 | 51 | ||
51 | static struct s3c24xx_led_platdata smdk_pdata_led4 = { | 52 | static struct s3c24xx_led_platdata smdk_pdata_led4 = { |
diff --git a/arch/arm/plat-samsung/include/plat/common-smdk.h b/arch/arm/mach-s3c24xx/common-smdk.h index ba028f1ed30b..98f733e1cb42 100644 --- a/arch/arm/plat-samsung/include/plat/common-smdk.h +++ b/arch/arm/mach-s3c24xx/common-smdk.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/common-smdk.h | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | 2 | * Copyright (c) 2006 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 3 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 4 | * |
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index 6bcf87f65f9e..d97533d21ac4 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c | |||
@@ -47,14 +47,11 @@ | |||
47 | #include <plat/cpu.h> | 47 | #include <plat/cpu.h> |
48 | #include <plat/devs.h> | 48 | #include <plat/devs.h> |
49 | #include <plat/clock.h> | 49 | #include <plat/clock.h> |
50 | #include <plat/s3c2410.h> | ||
51 | #include <plat/s3c2412.h> | ||
52 | #include <plat/s3c2416.h> | ||
53 | #include <plat/s3c244x.h> | ||
54 | #include <plat/s3c2443.h> | ||
55 | #include <plat/cpu-freq.h> | 50 | #include <plat/cpu-freq.h> |
56 | #include <plat/pll.h> | 51 | #include <plat/pll.h> |
57 | 52 | ||
53 | #include "common.h" | ||
54 | |||
58 | /* table of supported CPUs */ | 55 | /* table of supported CPUs */ |
59 | 56 | ||
60 | static const char name_s3c2410[] = "S3C2410"; | 57 | static const char name_s3c2410[] = "S3C2410"; |
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h index ed6276fcaa3b..307c3714be55 100644 --- a/arch/arm/mach-s3c24xx/common.h +++ b/arch/arm/mach-s3c24xx/common.h | |||
@@ -12,8 +12,98 @@ | |||
12 | #ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H | 12 | #ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H |
13 | #define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ | 13 | #define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ |
14 | 14 | ||
15 | void s3c2410_restart(char mode, const char *cmd); | 15 | struct s3c2410_uartcfg; |
16 | void s3c244x_restart(char mode, const char *cmd); | 16 | |
17 | #ifdef CONFIG_CPU_S3C2410 | ||
18 | extern int s3c2410_init(void); | ||
19 | extern int s3c2410a_init(void); | ||
20 | extern void s3c2410_map_io(void); | ||
21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
22 | extern void s3c2410_init_clocks(int xtal); | ||
23 | extern void s3c2410_restart(char mode, const char *cmd); | ||
24 | extern void s3c2410_init_irq(void); | ||
25 | #else | ||
26 | #define s3c2410_init_clocks NULL | ||
27 | #define s3c2410_init_uarts NULL | ||
28 | #define s3c2410_map_io NULL | ||
29 | #define s3c2410_init NULL | ||
30 | #define s3c2410a_init NULL | ||
31 | #endif | ||
32 | |||
33 | #ifdef CONFIG_CPU_S3C2412 | ||
34 | extern int s3c2412_init(void); | ||
35 | extern void s3c2412_map_io(void); | ||
36 | extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
37 | extern void s3c2412_init_clocks(int xtal); | ||
38 | extern int s3c2412_baseclk_add(void); | ||
39 | extern void s3c2412_restart(char mode, const char *cmd); | ||
40 | extern void s3c2412_init_irq(void); | ||
41 | #else | ||
42 | #define s3c2412_init_clocks NULL | ||
43 | #define s3c2412_init_uarts NULL | ||
44 | #define s3c2412_map_io NULL | ||
45 | #define s3c2412_init NULL | ||
46 | #endif | ||
47 | |||
48 | #ifdef CONFIG_CPU_S3C2416 | ||
49 | extern int s3c2416_init(void); | ||
50 | extern void s3c2416_map_io(void); | ||
51 | extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
52 | extern void s3c2416_init_clocks(int xtal); | ||
53 | extern int s3c2416_baseclk_add(void); | ||
54 | extern void s3c2416_restart(char mode, const char *cmd); | ||
55 | extern void s3c2416_init_irq(void); | ||
56 | |||
57 | extern struct syscore_ops s3c2416_irq_syscore_ops; | ||
58 | #else | ||
59 | #define s3c2416_init_clocks NULL | ||
60 | #define s3c2416_init_uarts NULL | ||
61 | #define s3c2416_map_io NULL | ||
62 | #define s3c2416_init NULL | ||
63 | #endif | ||
64 | |||
65 | #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) | ||
66 | extern void s3c244x_map_io(void); | ||
67 | extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
68 | extern void s3c244x_init_clocks(int xtal); | ||
69 | extern void s3c244x_restart(char mode, const char *cmd); | ||
70 | #else | ||
71 | #define s3c244x_init_clocks NULL | ||
72 | #define s3c244x_init_uarts NULL | ||
73 | #endif | ||
74 | |||
75 | #ifdef CONFIG_CPU_S3C2440 | ||
76 | extern int s3c2440_init(void); | ||
77 | extern void s3c2440_map_io(void); | ||
78 | extern void s3c2440_init_irq(void); | ||
79 | #else | ||
80 | #define s3c2440_init NULL | ||
81 | #define s3c2440_map_io NULL | ||
82 | #endif | ||
83 | |||
84 | #ifdef CONFIG_CPU_S3C2442 | ||
85 | extern int s3c2442_init(void); | ||
86 | extern void s3c2442_map_io(void); | ||
87 | extern void s3c2442_init_irq(void); | ||
88 | #else | ||
89 | #define s3c2442_init NULL | ||
90 | #define s3c2442_map_io NULL | ||
91 | #endif | ||
92 | |||
93 | #ifdef CONFIG_CPU_S3C2443 | ||
94 | extern int s3c2443_init(void); | ||
95 | extern void s3c2443_map_io(void); | ||
96 | extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
97 | extern void s3c2443_init_clocks(int xtal); | ||
98 | extern int s3c2443_baseclk_add(void); | ||
99 | extern void s3c2443_restart(char mode, const char *cmd); | ||
100 | extern void s3c2443_init_irq(void); | ||
101 | #else | ||
102 | #define s3c2443_init_clocks NULL | ||
103 | #define s3c2443_init_uarts NULL | ||
104 | #define s3c2443_map_io NULL | ||
105 | #define s3c2443_init NULL | ||
106 | #endif | ||
17 | 107 | ||
18 | extern struct syscore_ops s3c24xx_irq_syscore_ops; | 108 | extern struct syscore_ops s3c24xx_irq_syscore_ops; |
19 | 109 | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2410.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c index 25d085adc93c..a6c94b820954 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2410.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
31 | #include <mach/regs-sdi.h> | ||
32 | #include <plat/regs-iis.h> | 31 | #include <plat/regs-iis.h> |
33 | #include <plat/regs-spi.h> | 32 | #include <plat/regs-spi.h> |
34 | 33 | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c index d2408ba372cb..c0e8c3f5057e 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2412.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
31 | #include <mach/regs-sdi.h> | ||
32 | #include <plat/regs-iis.h> | 31 | #include <plat/regs-iis.h> |
33 | #include <plat/regs-spi.h> | 32 | #include <plat/regs-spi.h> |
34 | 33 | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2440.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c index 0b86e74d104f..1c08eccd9425 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2440.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
31 | #include <mach/regs-sdi.h> | ||
32 | #include <plat/regs-iis.h> | 31 | #include <plat/regs-iis.h> |
33 | #include <plat/regs-spi.h> | 32 | #include <plat/regs-spi.h> |
34 | 33 | ||
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c index 05536254a3f8..000e4c69fce9 100644 --- a/arch/arm/mach-s3c24xx/dma-s3c2443.c +++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <plat/regs-ac97.h> | 28 | #include <plat/regs-ac97.h> |
29 | #include <plat/regs-dma.h> | 29 | #include <plat/regs-dma.h> |
30 | #include <mach/regs-lcd.h> | 30 | #include <mach/regs-lcd.h> |
31 | #include <mach/regs-sdi.h> | ||
32 | #include <plat/regs-iis.h> | 31 | #include <plat/regs-iis.h> |
33 | #include <plat/regs-spi.h> | 32 | #include <plat/regs-spi.h> |
34 | 33 | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S deleted file mode 100644 index 6a21beeba1da..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-s3c2410/include/mach/entry-macro.S | ||
3 | * | ||
4 | * Low-level IRQ helper macros for S3C2410-based platforms | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public | ||
7 | * License version 2. This program is licensed "as is" without any | ||
8 | * warranty of any kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | /* We have a problem that the INTOFFSET register does not always | ||
12 | * show one interrupt. Occasionally we get two interrupts through | ||
13 | * the prioritiser, and this causes the INTOFFSET register to show | ||
14 | * what looks like the logical-or of the two interrupt numbers. | ||
15 | * | ||
16 | * Thanks to Klaus, Shannon, et al for helping to debug this problem | ||
17 | */ | ||
18 | |||
19 | #define INTPND (0x10) | ||
20 | #define INTOFFSET (0x14) | ||
21 | |||
22 | #include <mach/hardware.h> | ||
23 | #include <asm/irq.h> | ||
24 | |||
25 | .macro get_irqnr_preamble, base, tmp | ||
26 | .endm | ||
27 | |||
28 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
29 | |||
30 | mov \base, #S3C24XX_VA_IRQ | ||
31 | |||
32 | @@ try the interrupt offset register, since it is there | ||
33 | |||
34 | ldr \irqstat, [\base, #INTPND ] | ||
35 | teq \irqstat, #0 | ||
36 | beq 1002f | ||
37 | ldr \irqnr, [\base, #INTOFFSET ] | ||
38 | mov \tmp, #1 | ||
39 | tst \irqstat, \tmp, lsl \irqnr | ||
40 | bne 1001f | ||
41 | |||
42 | @@ the number specified is not a valid irq, so try | ||
43 | @@ and work it out for ourselves | ||
44 | |||
45 | mov \irqnr, #0 @@ start here | ||
46 | |||
47 | @@ work out which irq (if any) we got | ||
48 | |||
49 | movs \tmp, \irqstat, lsl#16 | ||
50 | addeq \irqnr, \irqnr, #16 | ||
51 | moveq \irqstat, \irqstat, lsr#16 | ||
52 | tst \irqstat, #0xff | ||
53 | addeq \irqnr, \irqnr, #8 | ||
54 | moveq \irqstat, \irqstat, lsr#8 | ||
55 | tst \irqstat, #0xf | ||
56 | addeq \irqnr, \irqnr, #4 | ||
57 | moveq \irqstat, \irqstat, lsr#4 | ||
58 | tst \irqstat, #0x3 | ||
59 | addeq \irqnr, \irqnr, #2 | ||
60 | moveq \irqstat, \irqstat, lsr#2 | ||
61 | tst \irqstat, #0x1 | ||
62 | addeq \irqnr, \irqnr, #1 | ||
63 | |||
64 | @@ we have the value | ||
65 | 1001: | ||
66 | adds \irqnr, \irqnr, #IRQ_EINT0 | ||
67 | 1002: | ||
68 | @@ exit here, Z flag unset if IRQ | ||
69 | |||
70 | .endm | ||
diff --git a/arch/arm/mach-s3c24xx/include/mach/irqs.h b/arch/arm/mach-s3c24xx/include/mach/irqs.h index b7a9f4d469e8..43cada8019b4 100644 --- a/arch/arm/mach-s3c24xx/include/mach/irqs.h +++ b/arch/arm/mach-s3c24xx/include/mach/irqs.h | |||
@@ -59,49 +59,53 @@ | |||
59 | #define IRQ_ADCPARENT S3C2410_IRQ(31) | 59 | #define IRQ_ADCPARENT S3C2410_IRQ(31) |
60 | 60 | ||
61 | /* interrupts generated from the external interrupts sources */ | 61 | /* interrupts generated from the external interrupts sources */ |
62 | #define IRQ_EINT4 S3C2410_IRQ(32) /* 48 */ | 62 | #define IRQ_EINT0_2412 S3C2410_IRQ(32) |
63 | #define IRQ_EINT5 S3C2410_IRQ(33) | 63 | #define IRQ_EINT1_2412 S3C2410_IRQ(33) |
64 | #define IRQ_EINT6 S3C2410_IRQ(34) | 64 | #define IRQ_EINT2_2412 S3C2410_IRQ(34) |
65 | #define IRQ_EINT7 S3C2410_IRQ(35) | 65 | #define IRQ_EINT3_2412 S3C2410_IRQ(35) |
66 | #define IRQ_EINT8 S3C2410_IRQ(36) | 66 | #define IRQ_EINT4 S3C2410_IRQ(36) /* 52 */ |
67 | #define IRQ_EINT9 S3C2410_IRQ(37) | 67 | #define IRQ_EINT5 S3C2410_IRQ(37) |
68 | #define IRQ_EINT10 S3C2410_IRQ(38) | 68 | #define IRQ_EINT6 S3C2410_IRQ(38) |
69 | #define IRQ_EINT11 S3C2410_IRQ(39) | 69 | #define IRQ_EINT7 S3C2410_IRQ(39) |
70 | #define IRQ_EINT12 S3C2410_IRQ(40) | 70 | #define IRQ_EINT8 S3C2410_IRQ(40) |
71 | #define IRQ_EINT13 S3C2410_IRQ(41) | 71 | #define IRQ_EINT9 S3C2410_IRQ(41) |
72 | #define IRQ_EINT14 S3C2410_IRQ(42) | 72 | #define IRQ_EINT10 S3C2410_IRQ(42) |
73 | #define IRQ_EINT15 S3C2410_IRQ(43) | 73 | #define IRQ_EINT11 S3C2410_IRQ(43) |
74 | #define IRQ_EINT16 S3C2410_IRQ(44) | 74 | #define IRQ_EINT12 S3C2410_IRQ(44) |
75 | #define IRQ_EINT17 S3C2410_IRQ(45) | 75 | #define IRQ_EINT13 S3C2410_IRQ(45) |
76 | #define IRQ_EINT18 S3C2410_IRQ(46) | 76 | #define IRQ_EINT14 S3C2410_IRQ(46) |
77 | #define IRQ_EINT19 S3C2410_IRQ(47) | 77 | #define IRQ_EINT15 S3C2410_IRQ(47) |
78 | #define IRQ_EINT20 S3C2410_IRQ(48) /* 64 */ | 78 | #define IRQ_EINT16 S3C2410_IRQ(48) |
79 | #define IRQ_EINT21 S3C2410_IRQ(49) | 79 | #define IRQ_EINT17 S3C2410_IRQ(49) |
80 | #define IRQ_EINT22 S3C2410_IRQ(50) | 80 | #define IRQ_EINT18 S3C2410_IRQ(50) |
81 | #define IRQ_EINT23 S3C2410_IRQ(51) | 81 | #define IRQ_EINT19 S3C2410_IRQ(51) |
82 | #define IRQ_EINT20 S3C2410_IRQ(52) /* 68 */ | ||
83 | #define IRQ_EINT21 S3C2410_IRQ(53) | ||
84 | #define IRQ_EINT22 S3C2410_IRQ(54) | ||
85 | #define IRQ_EINT23 S3C2410_IRQ(55) | ||
82 | 86 | ||
83 | #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) | 87 | #define IRQ_EINT_BIT(x) ((x) - IRQ_EINT4 + 4) |
84 | #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) | 88 | #define IRQ_EINT(x) (((x) >= 4) ? (IRQ_EINT4 + (x) - 4) : (IRQ_EINT0 + (x))) |
85 | 89 | ||
86 | #define IRQ_LCD_FIFO S3C2410_IRQ(52) | 90 | #define IRQ_LCD_FIFO S3C2410_IRQ(56) |
87 | #define IRQ_LCD_FRAME S3C2410_IRQ(53) | 91 | #define IRQ_LCD_FRAME S3C2410_IRQ(57) |
88 | 92 | ||
89 | /* IRQs for the interal UARTs, and ADC | 93 | /* IRQs for the interal UARTs, and ADC |
90 | * these need to be ordered in number of appearance in the | 94 | * these need to be ordered in number of appearance in the |
91 | * SUBSRC mask register | 95 | * SUBSRC mask register |
92 | */ | 96 | */ |
93 | 97 | ||
94 | #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54) | 98 | #define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+58) |
95 | 99 | ||
96 | #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */ | 100 | #define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 74 */ |
97 | #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) | 101 | #define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1) |
98 | #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) | 102 | #define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2) |
99 | 103 | ||
100 | #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */ | 104 | #define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 77 */ |
101 | #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) | 105 | #define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4) |
102 | #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) | 106 | #define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5) |
103 | 107 | ||
104 | #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */ | 108 | #define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 80 */ |
105 | #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) | 109 | #define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7) |
106 | #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) | 110 | #define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8) |
107 | 111 | ||
@@ -136,7 +140,7 @@ | |||
136 | 140 | ||
137 | /* second interrupt-register of s3c2416/s3c2450 */ | 141 | /* second interrupt-register of s3c2416/s3c2450 */ |
138 | 142 | ||
139 | #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 54 + 29) | 143 | #define S3C2416_IRQ(x) S3C2410_IRQ((x) + 58 + 29) |
140 | #define IRQ_S3C2416_2D S3C2416_IRQ(0) | 144 | #define IRQ_S3C2416_2D S3C2416_IRQ(0) |
141 | #define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) | 145 | #define IRQ_S3C2416_IIC1 S3C2416_IRQ(1) |
142 | #define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2) | 146 | #define IRQ_S3C2416_RESERVED2 S3C2416_IRQ(2) |
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h b/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h deleted file mode 100644 index cbf2d8884e30..000000000000 --- a/arch/arm/mach-s3c24xx/include/mach/regs-sdi.h +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | /* arch/arm/mach-s3c2410/include/mach/regs-sdi.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk> | ||
4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
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 | * S3C2410 MMC/SDIO register definitions | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_ARM_REGS_SDI | ||
14 | #define __ASM_ARM_REGS_SDI "regs-sdi.h" | ||
15 | |||
16 | #define S3C2410_SDICON (0x00) | ||
17 | #define S3C2410_SDIPRE (0x04) | ||
18 | #define S3C2410_SDICMDARG (0x08) | ||
19 | #define S3C2410_SDICMDCON (0x0C) | ||
20 | #define S3C2410_SDICMDSTAT (0x10) | ||
21 | #define S3C2410_SDIRSP0 (0x14) | ||
22 | #define S3C2410_SDIRSP1 (0x18) | ||
23 | #define S3C2410_SDIRSP2 (0x1C) | ||
24 | #define S3C2410_SDIRSP3 (0x20) | ||
25 | #define S3C2410_SDITIMER (0x24) | ||
26 | #define S3C2410_SDIBSIZE (0x28) | ||
27 | #define S3C2410_SDIDCON (0x2C) | ||
28 | #define S3C2410_SDIDCNT (0x30) | ||
29 | #define S3C2410_SDIDSTA (0x34) | ||
30 | #define S3C2410_SDIFSTA (0x38) | ||
31 | |||
32 | #define S3C2410_SDIDATA (0x3C) | ||
33 | #define S3C2410_SDIIMSK (0x40) | ||
34 | |||
35 | #define S3C2440_SDIDATA (0x40) | ||
36 | #define S3C2440_SDIIMSK (0x3C) | ||
37 | |||
38 | #define S3C2440_SDICON_SDRESET (1<<8) | ||
39 | #define S3C2440_SDICON_MMCCLOCK (1<<5) | ||
40 | #define S3C2410_SDICON_BYTEORDER (1<<4) | ||
41 | #define S3C2410_SDICON_SDIOIRQ (1<<3) | ||
42 | #define S3C2410_SDICON_RWAITEN (1<<2) | ||
43 | #define S3C2410_SDICON_FIFORESET (1<<1) | ||
44 | #define S3C2410_SDICON_CLOCKTYPE (1<<0) | ||
45 | |||
46 | #define S3C2410_SDICMDCON_ABORT (1<<12) | ||
47 | #define S3C2410_SDICMDCON_WITHDATA (1<<11) | ||
48 | #define S3C2410_SDICMDCON_LONGRSP (1<<10) | ||
49 | #define S3C2410_SDICMDCON_WAITRSP (1<<9) | ||
50 | #define S3C2410_SDICMDCON_CMDSTART (1<<8) | ||
51 | #define S3C2410_SDICMDCON_SENDERHOST (1<<6) | ||
52 | #define S3C2410_SDICMDCON_INDEX (0x3f) | ||
53 | |||
54 | #define S3C2410_SDICMDSTAT_CRCFAIL (1<<12) | ||
55 | #define S3C2410_SDICMDSTAT_CMDSENT (1<<11) | ||
56 | #define S3C2410_SDICMDSTAT_CMDTIMEOUT (1<<10) | ||
57 | #define S3C2410_SDICMDSTAT_RSPFIN (1<<9) | ||
58 | #define S3C2410_SDICMDSTAT_XFERING (1<<8) | ||
59 | #define S3C2410_SDICMDSTAT_INDEX (0xff) | ||
60 | |||
61 | #define S3C2440_SDIDCON_DS_BYTE (0<<22) | ||
62 | #define S3C2440_SDIDCON_DS_HALFWORD (1<<22) | ||
63 | #define S3C2440_SDIDCON_DS_WORD (2<<22) | ||
64 | #define S3C2410_SDIDCON_IRQPERIOD (1<<21) | ||
65 | #define S3C2410_SDIDCON_TXAFTERRESP (1<<20) | ||
66 | #define S3C2410_SDIDCON_RXAFTERCMD (1<<19) | ||
67 | #define S3C2410_SDIDCON_BUSYAFTERCMD (1<<18) | ||
68 | #define S3C2410_SDIDCON_BLOCKMODE (1<<17) | ||
69 | #define S3C2410_SDIDCON_WIDEBUS (1<<16) | ||
70 | #define S3C2410_SDIDCON_DMAEN (1<<15) | ||
71 | #define S3C2410_SDIDCON_STOP (1<<14) | ||
72 | #define S3C2440_SDIDCON_DATSTART (1<<14) | ||
73 | #define S3C2410_SDIDCON_DATMODE (3<<12) | ||
74 | #define S3C2410_SDIDCON_BLKNUM (0x7ff) | ||
75 | |||
76 | /* constants for S3C2410_SDIDCON_DATMODE */ | ||
77 | #define S3C2410_SDIDCON_XFER_READY (0<<12) | ||
78 | #define S3C2410_SDIDCON_XFER_CHKSTART (1<<12) | ||
79 | #define S3C2410_SDIDCON_XFER_RXSTART (2<<12) | ||
80 | #define S3C2410_SDIDCON_XFER_TXSTART (3<<12) | ||
81 | |||
82 | #define S3C2410_SDIDCON_BLKNUM_MASK (0xFFF) | ||
83 | #define S3C2410_SDIDCNT_BLKNUM_SHIFT (12) | ||
84 | |||
85 | #define S3C2410_SDIDSTA_RDYWAITREQ (1<<10) | ||
86 | #define S3C2410_SDIDSTA_SDIOIRQDETECT (1<<9) | ||
87 | #define S3C2410_SDIDSTA_FIFOFAIL (1<<8) /* reserved on 2440 */ | ||
88 | #define S3C2410_SDIDSTA_CRCFAIL (1<<7) | ||
89 | #define S3C2410_SDIDSTA_RXCRCFAIL (1<<6) | ||
90 | #define S3C2410_SDIDSTA_DATATIMEOUT (1<<5) | ||
91 | #define S3C2410_SDIDSTA_XFERFINISH (1<<4) | ||
92 | #define S3C2410_SDIDSTA_BUSYFINISH (1<<3) | ||
93 | #define S3C2410_SDIDSTA_SBITERR (1<<2) /* reserved on 2410a/2440 */ | ||
94 | #define S3C2410_SDIDSTA_TXDATAON (1<<1) | ||
95 | #define S3C2410_SDIDSTA_RXDATAON (1<<0) | ||
96 | |||
97 | #define S3C2440_SDIFSTA_FIFORESET (1<<16) | ||
98 | #define S3C2440_SDIFSTA_FIFOFAIL (3<<14) /* 3 is correct (2 bits) */ | ||
99 | #define S3C2410_SDIFSTA_TFDET (1<<13) | ||
100 | #define S3C2410_SDIFSTA_RFDET (1<<12) | ||
101 | #define S3C2410_SDIFSTA_TFHALF (1<<11) | ||
102 | #define S3C2410_SDIFSTA_TFEMPTY (1<<10) | ||
103 | #define S3C2410_SDIFSTA_RFLAST (1<<9) | ||
104 | #define S3C2410_SDIFSTA_RFFULL (1<<8) | ||
105 | #define S3C2410_SDIFSTA_RFHALF (1<<7) | ||
106 | #define S3C2410_SDIFSTA_COUNTMASK (0x7f) | ||
107 | |||
108 | #define S3C2410_SDIIMSK_RESPONSECRC (1<<17) | ||
109 | #define S3C2410_SDIIMSK_CMDSENT (1<<16) | ||
110 | #define S3C2410_SDIIMSK_CMDTIMEOUT (1<<15) | ||
111 | #define S3C2410_SDIIMSK_RESPONSEND (1<<14) | ||
112 | #define S3C2410_SDIIMSK_READWAIT (1<<13) | ||
113 | #define S3C2410_SDIIMSK_SDIOIRQ (1<<12) | ||
114 | #define S3C2410_SDIIMSK_FIFOFAIL (1<<11) | ||
115 | #define S3C2410_SDIIMSK_CRCSTATUS (1<<10) | ||
116 | #define S3C2410_SDIIMSK_DATACRC (1<<9) | ||
117 | #define S3C2410_SDIIMSK_DATATIMEOUT (1<<8) | ||
118 | #define S3C2410_SDIIMSK_DATAFINISH (1<<7) | ||
119 | #define S3C2410_SDIIMSK_BUSYFINISH (1<<6) | ||
120 | #define S3C2410_SDIIMSK_SBITERR (1<<5) /* reserved 2440/2410a */ | ||
121 | #define S3C2410_SDIIMSK_TXFIFOHALF (1<<4) | ||
122 | #define S3C2410_SDIIMSK_TXFIFOEMPTY (1<<3) | ||
123 | #define S3C2410_SDIIMSK_RXFIFOLAST (1<<2) | ||
124 | #define S3C2410_SDIIMSK_RXFIFOFULL (1<<1) | ||
125 | #define S3C2410_SDIIMSK_RXFIFOHALF (1<<0) | ||
126 | |||
127 | #endif /* __ASM_ARM_REGS_SDI */ | ||
diff --git a/arch/arm/mach-s3c24xx/irq-pm.c b/arch/arm/mach-s3c24xx/irq-pm.c index e1199599873e..b91341ef2b2e 100644 --- a/arch/arm/mach-s3c24xx/irq-pm.c +++ b/arch/arm/mach-s3c24xx/irq-pm.c | |||
@@ -16,10 +16,15 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <linux/syscore_ops.h> | 18 | #include <linux/syscore_ops.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <plat/cpu.h> | 21 | #include <plat/cpu.h> |
21 | #include <plat/pm.h> | 22 | #include <plat/pm.h> |
22 | #include <plat/irq.h> | 23 | #include <plat/map-base.h> |
24 | #include <plat/map-s3c.h> | ||
25 | |||
26 | #include <mach/regs-irq.h> | ||
27 | #include <mach/regs-gpio.h> | ||
23 | 28 | ||
24 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
25 | 30 | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c deleted file mode 100644 index 67d763178d3f..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2412.c +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/irq.h> | ||
39 | #include <plat/pm.h> | ||
40 | |||
41 | #include "s3c2412-power.h" | ||
42 | |||
43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
44 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | ||
45 | |||
46 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
47 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
48 | * both show the status, they both now need to be acked when the IRQs | ||
49 | * go off. | ||
50 | */ | ||
51 | |||
52 | static void | ||
53 | s3c2412_irq_mask(struct irq_data *data) | ||
54 | { | ||
55 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
56 | unsigned long mask; | ||
57 | |||
58 | mask = __raw_readl(S3C2410_INTMSK); | ||
59 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
60 | |||
61 | mask = __raw_readl(S3C2412_EINTMASK); | ||
62 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
63 | } | ||
64 | |||
65 | static inline void | ||
66 | s3c2412_irq_ack(struct irq_data *data) | ||
67 | { | ||
68 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
69 | |||
70 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
71 | __raw_writel(bitval, S3C2410_SRCPND); | ||
72 | __raw_writel(bitval, S3C2410_INTPND); | ||
73 | } | ||
74 | |||
75 | static inline void | ||
76 | s3c2412_irq_maskack(struct irq_data *data) | ||
77 | { | ||
78 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
79 | unsigned long mask; | ||
80 | |||
81 | mask = __raw_readl(S3C2410_INTMSK); | ||
82 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
83 | |||
84 | mask = __raw_readl(S3C2412_EINTMASK); | ||
85 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
86 | |||
87 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
88 | __raw_writel(bitval, S3C2410_SRCPND); | ||
89 | __raw_writel(bitval, S3C2410_INTPND); | ||
90 | } | ||
91 | |||
92 | static void | ||
93 | s3c2412_irq_unmask(struct irq_data *data) | ||
94 | { | ||
95 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
96 | unsigned long mask; | ||
97 | |||
98 | mask = __raw_readl(S3C2412_EINTMASK); | ||
99 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
100 | |||
101 | mask = __raw_readl(S3C2410_INTMSK); | ||
102 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
103 | } | ||
104 | |||
105 | static struct irq_chip s3c2412_irq_eint0t4 = { | ||
106 | .irq_ack = s3c2412_irq_ack, | ||
107 | .irq_mask = s3c2412_irq_mask, | ||
108 | .irq_unmask = s3c2412_irq_unmask, | ||
109 | .irq_set_wake = s3c_irq_wake, | ||
110 | .irq_set_type = s3c_irqext_type, | ||
111 | }; | ||
112 | |||
113 | #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) | ||
114 | |||
115 | /* CF and SDI sub interrupts */ | ||
116 | |||
117 | static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) | ||
118 | { | ||
119 | unsigned int subsrc, submsk; | ||
120 | |||
121 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
122 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
123 | |||
124 | subsrc &= ~submsk; | ||
125 | |||
126 | if (subsrc & INTBIT(IRQ_S3C2412_SDI)) | ||
127 | generic_handle_irq(IRQ_S3C2412_SDI); | ||
128 | |||
129 | if (subsrc & INTBIT(IRQ_S3C2412_CF)) | ||
130 | generic_handle_irq(IRQ_S3C2412_CF); | ||
131 | } | ||
132 | |||
133 | #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) | ||
134 | #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) | ||
135 | |||
136 | static void s3c2412_irq_cfsdi_mask(struct irq_data *data) | ||
137 | { | ||
138 | s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
139 | } | ||
140 | |||
141 | static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) | ||
142 | { | ||
143 | s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); | ||
144 | } | ||
145 | |||
146 | static void s3c2412_irq_cfsdi_ack(struct irq_data *data) | ||
147 | { | ||
148 | s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
149 | } | ||
150 | |||
151 | static struct irq_chip s3c2412_irq_cfsdi = { | ||
152 | .name = "s3c2412-cfsdi", | ||
153 | .irq_ack = s3c2412_irq_cfsdi_ack, | ||
154 | .irq_mask = s3c2412_irq_cfsdi_mask, | ||
155 | .irq_unmask = s3c2412_irq_cfsdi_unmask, | ||
156 | }; | ||
157 | |||
158 | static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state) | ||
159 | { | ||
160 | unsigned long pwrcfg; | ||
161 | |||
162 | pwrcfg = __raw_readl(S3C2412_PWRCFG); | ||
163 | if (state) | ||
164 | pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ; | ||
165 | else | ||
166 | pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ; | ||
167 | __raw_writel(pwrcfg, S3C2412_PWRCFG); | ||
168 | |||
169 | return s3c_irq_chip.irq_set_wake(data, state); | ||
170 | } | ||
171 | |||
172 | static struct irq_chip s3c2412_irq_rtc_chip; | ||
173 | |||
174 | static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | ||
175 | { | ||
176 | unsigned int irqno; | ||
177 | |||
178 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
179 | irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, | ||
180 | handle_edge_irq); | ||
181 | set_irq_flags(irqno, IRQF_VALID); | ||
182 | } | ||
183 | |||
184 | /* add demux support for CF/SDI */ | ||
185 | |||
186 | irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); | ||
187 | |||
188 | for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { | ||
189 | irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, | ||
190 | handle_level_irq); | ||
191 | set_irq_flags(irqno, IRQF_VALID); | ||
192 | } | ||
193 | |||
194 | /* change RTC IRQ's set wake method */ | ||
195 | |||
196 | s3c2412_irq_rtc_chip = s3c_irq_chip; | ||
197 | s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake; | ||
198 | |||
199 | irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static struct subsys_interface s3c2412_irq_interface = { | ||
205 | .name = "s3c2412_irq", | ||
206 | .subsys = &s3c2412_subsys, | ||
207 | .add_dev = s3c2412_irq_add, | ||
208 | }; | ||
209 | |||
210 | static int s3c2412_irq_init(void) | ||
211 | { | ||
212 | return subsys_interface_register(&s3c2412_irq_interface); | ||
213 | } | ||
214 | |||
215 | arch_initcall(s3c2412_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2440.c b/arch/arm/mach-s3c24xx/irq-s3c2440.c deleted file mode 100644 index 4a18cde439cc..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2440.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2440/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/pm.h> | ||
39 | #include <plat/irq.h> | ||
40 | |||
41 | /* WDT/AC97 */ | ||
42 | |||
43 | static void s3c_irq_demux_wdtac97(unsigned int irq, | ||
44 | struct irq_desc *desc) | ||
45 | { | ||
46 | unsigned int subsrc, submsk; | ||
47 | |||
48 | /* read the current pending interrupts, and the mask | ||
49 | * for what it is available */ | ||
50 | |||
51 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
52 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
53 | |||
54 | subsrc &= ~submsk; | ||
55 | subsrc >>= 13; | ||
56 | subsrc &= 3; | ||
57 | |||
58 | if (subsrc != 0) { | ||
59 | if (subsrc & 1) { | ||
60 | generic_handle_irq(IRQ_S3C2440_WDT); | ||
61 | } | ||
62 | if (subsrc & 2) { | ||
63 | generic_handle_irq(IRQ_S3C2440_AC97); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | |||
69 | #define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0)) | ||
70 | |||
71 | static void | ||
72 | s3c_irq_wdtac97_mask(struct irq_data *data) | ||
73 | { | ||
74 | s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13); | ||
75 | } | ||
76 | |||
77 | static void | ||
78 | s3c_irq_wdtac97_unmask(struct irq_data *data) | ||
79 | { | ||
80 | s3c_irqsub_unmask(data->irq, INTMSK_WDT); | ||
81 | } | ||
82 | |||
83 | static void | ||
84 | s3c_irq_wdtac97_ack(struct irq_data *data) | ||
85 | { | ||
86 | s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13); | ||
87 | } | ||
88 | |||
89 | static struct irq_chip s3c_irq_wdtac97 = { | ||
90 | .irq_mask = s3c_irq_wdtac97_mask, | ||
91 | .irq_unmask = s3c_irq_wdtac97_unmask, | ||
92 | .irq_ack = s3c_irq_wdtac97_ack, | ||
93 | }; | ||
94 | |||
95 | static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif) | ||
96 | { | ||
97 | unsigned int irqno; | ||
98 | |||
99 | printk("S3C2440: IRQ Support\n"); | ||
100 | |||
101 | /* add new chained handler for wdt, ac7 */ | ||
102 | |||
103 | irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip, | ||
104 | handle_level_irq); | ||
105 | irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97); | ||
106 | |||
107 | for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) { | ||
108 | irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97, | ||
109 | handle_level_irq); | ||
110 | set_irq_flags(irqno, IRQF_VALID); | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static struct subsys_interface s3c2440_irq_interface = { | ||
117 | .name = "s3c2440_irq", | ||
118 | .subsys = &s3c2440_subsys, | ||
119 | .add_dev = s3c2440_irq_add, | ||
120 | }; | ||
121 | |||
122 | static int s3c2440_irq_init(void) | ||
123 | { | ||
124 | return subsys_interface_register(&s3c2440_irq_interface); | ||
125 | } | ||
126 | |||
127 | arch_initcall(s3c2440_irq_init); | ||
128 | |||
diff --git a/arch/arm/mach-s3c24xx/irq-s3c244x.c b/arch/arm/mach-s3c24xx/irq-s3c244x.c deleted file mode 100644 index 5fe8e58d3afd..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c244x.c +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/s3c244x-irq.c | ||
2 | * | ||
3 | * Copyright (c) 2003-2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/pm.h> | ||
39 | #include <plat/irq.h> | ||
40 | |||
41 | /* camera irq */ | ||
42 | |||
43 | static void s3c_irq_demux_cam(unsigned int irq, | ||
44 | struct irq_desc *desc) | ||
45 | { | ||
46 | unsigned int subsrc, submsk; | ||
47 | |||
48 | /* read the current pending interrupts, and the mask | ||
49 | * for what it is available */ | ||
50 | |||
51 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
52 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
53 | |||
54 | subsrc &= ~submsk; | ||
55 | subsrc >>= 11; | ||
56 | subsrc &= 3; | ||
57 | |||
58 | if (subsrc != 0) { | ||
59 | if (subsrc & 1) { | ||
60 | generic_handle_irq(IRQ_S3C2440_CAM_C); | ||
61 | } | ||
62 | if (subsrc & 2) { | ||
63 | generic_handle_irq(IRQ_S3C2440_CAM_P); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | |||
68 | #define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0)) | ||
69 | |||
70 | static void | ||
71 | s3c_irq_cam_mask(struct irq_data *data) | ||
72 | { | ||
73 | s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11); | ||
74 | } | ||
75 | |||
76 | static void | ||
77 | s3c_irq_cam_unmask(struct irq_data *data) | ||
78 | { | ||
79 | s3c_irqsub_unmask(data->irq, INTMSK_CAM); | ||
80 | } | ||
81 | |||
82 | static void | ||
83 | s3c_irq_cam_ack(struct irq_data *data) | ||
84 | { | ||
85 | s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11); | ||
86 | } | ||
87 | |||
88 | static struct irq_chip s3c_irq_cam = { | ||
89 | .irq_mask = s3c_irq_cam_mask, | ||
90 | .irq_unmask = s3c_irq_cam_unmask, | ||
91 | .irq_ack = s3c_irq_cam_ack, | ||
92 | }; | ||
93 | |||
94 | static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif) | ||
95 | { | ||
96 | unsigned int irqno; | ||
97 | |||
98 | irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip, | ||
99 | handle_level_irq); | ||
100 | set_irq_flags(IRQ_NFCON, IRQF_VALID); | ||
101 | |||
102 | /* add chained handler for camera */ | ||
103 | |||
104 | irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip, | ||
105 | handle_level_irq); | ||
106 | irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam); | ||
107 | |||
108 | for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) { | ||
109 | irq_set_chip_and_handler(irqno, &s3c_irq_cam, | ||
110 | handle_level_irq); | ||
111 | set_irq_flags(irqno, IRQF_VALID); | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static struct subsys_interface s3c2440_irq_interface = { | ||
118 | .name = "s3c2440_irq", | ||
119 | .subsys = &s3c2440_subsys, | ||
120 | .add_dev = s3c244x_irq_add, | ||
121 | }; | ||
122 | |||
123 | static int s3c2440_irq_init(void) | ||
124 | { | ||
125 | return subsys_interface_register(&s3c2440_irq_interface); | ||
126 | } | ||
127 | |||
128 | arch_initcall(s3c2440_irq_init); | ||
129 | |||
130 | static struct subsys_interface s3c2442_irq_interface = { | ||
131 | .name = "s3c2442_irq", | ||
132 | .subsys = &s3c2442_subsys, | ||
133 | .add_dev = s3c244x_irq_add, | ||
134 | }; | ||
135 | |||
136 | |||
137 | static int s3c2442_irq_init(void) | ||
138 | { | ||
139 | return subsys_interface_register(&s3c2442_irq_interface); | ||
140 | } | ||
141 | |||
142 | arch_initcall(s3c2442_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c index 0e0279e79150..e27b5c91b3db 100644 --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c | |||
@@ -63,6 +63,8 @@ | |||
63 | #include <linux/mtd/map.h> | 63 | #include <linux/mtd/map.h> |
64 | #include <linux/mtd/physmap.h> | 64 | #include <linux/mtd/physmap.h> |
65 | 65 | ||
66 | #include <plat/samsung-time.h> | ||
67 | |||
66 | #include "common.h" | 68 | #include "common.h" |
67 | 69 | ||
68 | static struct resource amlm5900_nor_resource = | 70 | static struct resource amlm5900_nor_resource = |
@@ -160,6 +162,7 @@ static void __init amlm5900_map_io(void) | |||
160 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); | 162 | s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); |
161 | s3c24xx_init_clocks(0); | 163 | s3c24xx_init_clocks(0); |
162 | s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); | 164 | s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); |
165 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
163 | } | 166 | } |
164 | 167 | ||
165 | #ifdef CONFIG_FB_S3C2410 | 168 | #ifdef CONFIG_FB_S3C2410 |
@@ -235,8 +238,8 @@ static void __init amlm5900_init(void) | |||
235 | MACHINE_START(AML_M5900, "AML_M5900") | 238 | MACHINE_START(AML_M5900, "AML_M5900") |
236 | .atag_offset = 0x100, | 239 | .atag_offset = 0x100, |
237 | .map_io = amlm5900_map_io, | 240 | .map_io = amlm5900_map_io, |
238 | .init_irq = s3c24xx_init_irq, | 241 | .init_irq = s3c2410_init_irq, |
239 | .init_machine = amlm5900_init, | 242 | .init_machine = amlm5900_init, |
240 | .init_time = s3c24xx_timer_init, | 243 | .init_time = samsung_timer_init, |
241 | .restart = s3c2410_restart, | 244 | .restart = s3c2410_restart, |
242 | MACHINE_END | 245 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c index bb595f15ce36..c1fb6c37867f 100644 --- a/arch/arm/mach-s3c24xx/mach-anubis.c +++ b/arch/arm/mach-s3c24xx/mach-anubis.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
51 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> | 51 | #include <linux/platform_data/asoc-s3c24xx_simtec.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "anubis.h" | 54 | #include "anubis.h" |
54 | #include "common.h" | 55 | #include "common.h" |
@@ -410,6 +411,7 @@ static void __init anubis_map_io(void) | |||
410 | s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); | 411 | s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); |
411 | s3c24xx_init_clocks(0); | 412 | s3c24xx_init_clocks(0); |
412 | s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); | 413 | s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); |
414 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
413 | 415 | ||
414 | /* check for the newer revision boards with large page nand */ | 416 | /* check for the newer revision boards with large page nand */ |
415 | 417 | ||
@@ -443,7 +445,7 @@ MACHINE_START(ANUBIS, "Simtec-Anubis") | |||
443 | .atag_offset = 0x100, | 445 | .atag_offset = 0x100, |
444 | .map_io = anubis_map_io, | 446 | .map_io = anubis_map_io, |
445 | .init_machine = anubis_init, | 447 | .init_machine = anubis_init, |
446 | .init_irq = s3c24xx_init_irq, | 448 | .init_irq = s3c2440_init_irq, |
447 | .init_time = s3c24xx_timer_init, | 449 | .init_time = samsung_timer_init, |
448 | .restart = s3c244x_restart, | 450 | .restart = s3c244x_restart, |
449 | MACHINE_END | 451 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c index b4bc60c78ebb..6dfeeb7ef469 100644 --- a/arch/arm/mach-s3c24xx/mach-at2440evb.c +++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <plat/devs.h> | 48 | #include <plat/devs.h> |
49 | #include <plat/cpu.h> | 49 | #include <plat/cpu.h> |
50 | #include <linux/platform_data/mmc-s3cmci.h> | 50 | #include <linux/platform_data/mmc-s3cmci.h> |
51 | #include <plat/samsung-time.h> | ||
51 | 52 | ||
52 | #include "common.h" | 53 | #include "common.h" |
53 | 54 | ||
@@ -192,6 +193,7 @@ static void __init at2440evb_map_io(void) | |||
192 | s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); | 193 | s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); |
193 | s3c24xx_init_clocks(16934400); | 194 | s3c24xx_init_clocks(16934400); |
194 | s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); | 195 | s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); |
196 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
195 | } | 197 | } |
196 | 198 | ||
197 | static void __init at2440evb_init(void) | 199 | static void __init at2440evb_init(void) |
@@ -209,7 +211,7 @@ MACHINE_START(AT2440EVB, "AT2440EVB") | |||
209 | .atag_offset = 0x100, | 211 | .atag_offset = 0x100, |
210 | .map_io = at2440evb_map_io, | 212 | .map_io = at2440evb_map_io, |
211 | .init_machine = at2440evb_init, | 213 | .init_machine = at2440evb_init, |
212 | .init_irq = s3c24xx_init_irq, | 214 | .init_irq = s3c2440_init_irq, |
213 | .init_time = s3c24xx_timer_init, | 215 | .init_time = samsung_timer_init, |
214 | .restart = s3c244x_restart, | 216 | .restart = s3c244x_restart, |
215 | MACHINE_END | 217 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c index ca6618081041..22d6ae926d91 100644 --- a/arch/arm/mach-s3c24xx/mach-bast.c +++ b/arch/arm/mach-s3c24xx/mach-bast.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <plat/devs.h> | 55 | #include <plat/devs.h> |
56 | #include <plat/gpio-cfg.h> | 56 | #include <plat/gpio-cfg.h> |
57 | #include <plat/regs-serial.h> | 57 | #include <plat/regs-serial.h> |
58 | #include <plat/samsung-time.h> | ||
58 | 59 | ||
59 | #include "bast.h" | 60 | #include "bast.h" |
60 | #include "common.h" | 61 | #include "common.h" |
@@ -576,6 +577,7 @@ static void __init bast_map_io(void) | |||
576 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); | 577 | s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); |
577 | s3c24xx_init_clocks(0); | 578 | s3c24xx_init_clocks(0); |
578 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); | 579 | s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); |
580 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
579 | } | 581 | } |
580 | 582 | ||
581 | static void __init bast_init(void) | 583 | static void __init bast_init(void) |
@@ -603,8 +605,8 @@ MACHINE_START(BAST, "Simtec-BAST") | |||
603 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 605 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
604 | .atag_offset = 0x100, | 606 | .atag_offset = 0x100, |
605 | .map_io = bast_map_io, | 607 | .map_io = bast_map_io, |
606 | .init_irq = s3c24xx_init_irq, | 608 | .init_irq = s3c2410_init_irq, |
607 | .init_machine = bast_init, | 609 | .init_machine = bast_init, |
608 | .init_time = s3c24xx_timer_init, | 610 | .init_time = samsung_timer_init, |
609 | .restart = s3c2410_restart, | 611 | .restart = s3c2410_restart, |
610 | MACHINE_END | 612 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c index a25e8c5a7b4c..13d8d073675a 100644 --- a/arch/arm/mach-s3c24xx/mach-gta02.c +++ b/arch/arm/mach-s3c24xx/mach-gta02.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <plat/gpio-cfg.h> | 81 | #include <plat/gpio-cfg.h> |
82 | #include <plat/pm.h> | 82 | #include <plat/pm.h> |
83 | #include <plat/regs-serial.h> | 83 | #include <plat/regs-serial.h> |
84 | #include <plat/samsung-time.h> | ||
84 | 85 | ||
85 | #include "common.h" | 86 | #include "common.h" |
86 | #include "gta02.h" | 87 | #include "gta02.h" |
@@ -501,6 +502,7 @@ static void __init gta02_map_io(void) | |||
501 | s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); | 502 | s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); |
502 | s3c24xx_init_clocks(12000000); | 503 | s3c24xx_init_clocks(12000000); |
503 | s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); | 504 | s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); |
505 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
504 | } | 506 | } |
505 | 507 | ||
506 | 508 | ||
@@ -587,8 +589,8 @@ MACHINE_START(NEO1973_GTA02, "GTA02") | |||
587 | /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ | 589 | /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ |
588 | .atag_offset = 0x100, | 590 | .atag_offset = 0x100, |
589 | .map_io = gta02_map_io, | 591 | .map_io = gta02_map_io, |
590 | .init_irq = s3c24xx_init_irq, | 592 | .init_irq = s3c2442_init_irq, |
591 | .init_machine = gta02_machine_init, | 593 | .init_machine = gta02_machine_init, |
592 | .init_time = s3c24xx_timer_init, | 594 | .init_time = samsung_timer_init, |
593 | .restart = s3c244x_restart, | 595 | .restart = s3c244x_restart, |
594 | MACHINE_END | 596 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index 79bc0830d740..af4334d6b4d5 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <plat/pll.h> | 62 | #include <plat/pll.h> |
63 | #include <plat/pm.h> | 63 | #include <plat/pm.h> |
64 | #include <plat/regs-serial.h> | 64 | #include <plat/regs-serial.h> |
65 | 65 | #include <plat/samsung-time.h> | |
66 | 66 | ||
67 | #include "common.h" | 67 | #include "common.h" |
68 | #include "h1940.h" | 68 | #include "h1940.h" |
@@ -646,6 +646,7 @@ static void __init h1940_map_io(void) | |||
646 | s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); | 646 | s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); |
647 | s3c24xx_init_clocks(0); | 647 | s3c24xx_init_clocks(0); |
648 | s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); | 648 | s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); |
649 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
649 | 650 | ||
650 | /* setup PM */ | 651 | /* setup PM */ |
651 | 652 | ||
@@ -666,11 +667,6 @@ static void __init h1940_reserve(void) | |||
666 | memblock_reserve(0x30081000, 0x1000); | 667 | memblock_reserve(0x30081000, 0x1000); |
667 | } | 668 | } |
668 | 669 | ||
669 | static void __init h1940_init_irq(void) | ||
670 | { | ||
671 | s3c24xx_init_irq(); | ||
672 | } | ||
673 | |||
674 | static void __init h1940_init(void) | 670 | static void __init h1940_init(void) |
675 | { | 671 | { |
676 | u32 tmp; | 672 | u32 tmp; |
@@ -739,8 +735,8 @@ MACHINE_START(H1940, "IPAQ-H1940") | |||
739 | .atag_offset = 0x100, | 735 | .atag_offset = 0x100, |
740 | .map_io = h1940_map_io, | 736 | .map_io = h1940_map_io, |
741 | .reserve = h1940_reserve, | 737 | .reserve = h1940_reserve, |
742 | .init_irq = h1940_init_irq, | 738 | .init_irq = s3c2410_init_irq, |
743 | .init_machine = h1940_init, | 739 | .init_machine = h1940_init, |
744 | .init_time = s3c24xx_timer_init, | 740 | .init_time = samsung_timer_init, |
745 | .restart = s3c2410_restart, | 741 | .restart = s3c2410_restart, |
746 | MACHINE_END | 742 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c index 54e83c1f780c..a45fcd8ccf79 100644 --- a/arch/arm/mach-s3c24xx/mach-jive.c +++ b/arch/arm/mach-s3c24xx/mach-jive.c | |||
@@ -46,14 +46,15 @@ | |||
46 | #include <linux/mtd/nand_ecc.h> | 46 | #include <linux/mtd/nand_ecc.h> |
47 | #include <linux/mtd/partitions.h> | 47 | #include <linux/mtd/partitions.h> |
48 | 48 | ||
49 | #include <plat/s3c2412.h> | ||
50 | #include <plat/gpio-cfg.h> | 49 | #include <plat/gpio-cfg.h> |
51 | #include <plat/clock.h> | 50 | #include <plat/clock.h> |
52 | #include <plat/devs.h> | 51 | #include <plat/devs.h> |
53 | #include <plat/cpu.h> | 52 | #include <plat/cpu.h> |
54 | #include <plat/pm.h> | 53 | #include <plat/pm.h> |
55 | #include <linux/platform_data/usb-s3c2410_udc.h> | 54 | #include <linux/platform_data/usb-s3c2410_udc.h> |
55 | #include <plat/samsung-time.h> | ||
56 | 56 | ||
57 | #include "common.h" | ||
57 | #include "s3c2412-power.h" | 58 | #include "s3c2412-power.h" |
58 | 59 | ||
59 | static struct map_desc jive_iodesc[] __initdata = { | 60 | static struct map_desc jive_iodesc[] __initdata = { |
@@ -506,6 +507,7 @@ static void __init jive_map_io(void) | |||
506 | s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); | 507 | s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); |
507 | s3c24xx_init_clocks(12000000); | 508 | s3c24xx_init_clocks(12000000); |
508 | s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); | 509 | s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); |
510 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
509 | } | 511 | } |
510 | 512 | ||
511 | static void jive_power_off(void) | 513 | static void jive_power_off(void) |
@@ -658,9 +660,9 @@ MACHINE_START(JIVE, "JIVE") | |||
658 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | 660 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
659 | .atag_offset = 0x100, | 661 | .atag_offset = 0x100, |
660 | 662 | ||
661 | .init_irq = s3c24xx_init_irq, | 663 | .init_irq = s3c2412_init_irq, |
662 | .map_io = jive_map_io, | 664 | .map_io = jive_map_io, |
663 | .init_machine = jive_machine_init, | 665 | .init_machine = jive_machine_init, |
664 | .init_time = s3c24xx_timer_init, | 666 | .init_time = samsung_timer_init, |
665 | .restart = s3c2412_restart, | 667 | .restart = s3c2412_restart, |
666 | MACHINE_END | 668 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c index 2865e5919f2c..a83db46320bc 100644 --- a/arch/arm/mach-s3c24xx/mach-mini2440.c +++ b/arch/arm/mach-s3c24xx/mach-mini2440.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <plat/clock.h> | 56 | #include <plat/clock.h> |
57 | #include <plat/devs.h> | 57 | #include <plat/devs.h> |
58 | #include <plat/cpu.h> | 58 | #include <plat/cpu.h> |
59 | #include <plat/samsung-time.h> | ||
59 | 60 | ||
60 | #include <sound/s3c24xx_uda134x.h> | 61 | #include <sound/s3c24xx_uda134x.h> |
61 | 62 | ||
@@ -525,6 +526,7 @@ static void __init mini2440_map_io(void) | |||
525 | s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); | 526 | s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); |
526 | s3c24xx_init_clocks(12000000); | 527 | s3c24xx_init_clocks(12000000); |
527 | s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); | 528 | s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); |
529 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
528 | } | 530 | } |
529 | 531 | ||
530 | /* | 532 | /* |
@@ -686,7 +688,7 @@ MACHINE_START(MINI2440, "MINI2440") | |||
686 | .atag_offset = 0x100, | 688 | .atag_offset = 0x100, |
687 | .map_io = mini2440_map_io, | 689 | .map_io = mini2440_map_io, |
688 | .init_machine = mini2440_init, | 690 | .init_machine = mini2440_init, |
689 | .init_irq = s3c24xx_init_irq, | 691 | .init_irq = s3c2440_init_irq, |
690 | .init_time = s3c24xx_timer_init, | 692 | .init_time = samsung_timer_init, |
691 | .restart = s3c244x_restart, | 693 | .restart = s3c244x_restart, |
692 | MACHINE_END | 694 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c index d9d04b240295..2cb46c37c920 100644 --- a/arch/arm/mach-s3c24xx/mach-n30.c +++ b/arch/arm/mach-s3c24xx/mach-n30.c | |||
@@ -48,8 +48,8 @@ | |||
48 | #include <plat/cpu.h> | 48 | #include <plat/cpu.h> |
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <linux/platform_data/mmc-s3cmci.h> | 50 | #include <linux/platform_data/mmc-s3cmci.h> |
51 | #include <plat/s3c2410.h> | ||
52 | #include <linux/platform_data/usb-s3c2410_udc.h> | 51 | #include <linux/platform_data/usb-s3c2410_udc.h> |
52 | #include <plat/samsung-time.h> | ||
53 | 53 | ||
54 | #include "common.h" | 54 | #include "common.h" |
55 | 55 | ||
@@ -536,6 +536,7 @@ static void __init n30_map_io(void) | |||
536 | n30_hwinit(); | 536 | n30_hwinit(); |
537 | s3c24xx_init_clocks(0); | 537 | s3c24xx_init_clocks(0); |
538 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); | 538 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); |
539 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
539 | } | 540 | } |
540 | 541 | ||
541 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ | 542 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ |
@@ -589,9 +590,9 @@ MACHINE_START(N30, "Acer-N30") | |||
589 | Ben Dooks <ben-linux@fluff.org> | 590 | Ben Dooks <ben-linux@fluff.org> |
590 | */ | 591 | */ |
591 | .atag_offset = 0x100, | 592 | .atag_offset = 0x100, |
592 | .init_time = s3c24xx_timer_init, | 593 | .init_time = samsung_timer_init, |
593 | .init_machine = n30_init, | 594 | .init_machine = n30_init, |
594 | .init_irq = s3c24xx_init_irq, | 595 | .init_irq = s3c2410_init_irq, |
595 | .map_io = n30_map_io, | 596 | .map_io = n30_map_io, |
596 | .restart = s3c2410_restart, | 597 | .restart = s3c2410_restart, |
597 | MACHINE_END | 598 | MACHINE_END |
@@ -600,9 +601,9 @@ MACHINE_START(N35, "Acer-N35") | |||
600 | /* Maintainer: Christer Weinigel <christer@weinigel.se> | 601 | /* Maintainer: Christer Weinigel <christer@weinigel.se> |
601 | */ | 602 | */ |
602 | .atag_offset = 0x100, | 603 | .atag_offset = 0x100, |
603 | .init_time = s3c24xx_timer_init, | 604 | .init_time = samsung_timer_init, |
604 | .init_machine = n30_init, | 605 | .init_machine = n30_init, |
605 | .init_irq = s3c24xx_init_irq, | 606 | .init_irq = s3c2410_init_irq, |
606 | .map_io = n30_map_io, | 607 | .map_io = n30_map_io, |
607 | .restart = s3c2410_restart, | 608 | .restart = s3c2410_restart, |
608 | MACHINE_END | 609 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c index a454e2461860..01f4354206f9 100644 --- a/arch/arm/mach-s3c24xx/mach-nexcoder.c +++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c | |||
@@ -41,11 +41,10 @@ | |||
41 | #include <linux/platform_data/i2c-s3c2410.h> | 41 | #include <linux/platform_data/i2c-s3c2410.h> |
42 | 42 | ||
43 | #include <plat/gpio-cfg.h> | 43 | #include <plat/gpio-cfg.h> |
44 | #include <plat/s3c2410.h> | ||
45 | #include <plat/s3c244x.h> | ||
46 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
47 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
48 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
49 | 48 | ||
50 | #include "common.h" | 49 | #include "common.h" |
51 | 50 | ||
@@ -137,6 +136,7 @@ static void __init nexcoder_map_io(void) | |||
137 | s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); | 136 | s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); |
138 | s3c24xx_init_clocks(0); | 137 | s3c24xx_init_clocks(0); |
139 | s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); | 138 | s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); |
139 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
140 | 140 | ||
141 | nexcoder_sensorboard_init(); | 141 | nexcoder_sensorboard_init(); |
142 | } | 142 | } |
@@ -152,7 +152,7 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") | |||
152 | .atag_offset = 0x100, | 152 | .atag_offset = 0x100, |
153 | .map_io = nexcoder_map_io, | 153 | .map_io = nexcoder_map_io, |
154 | .init_machine = nexcoder_init, | 154 | .init_machine = nexcoder_init, |
155 | .init_irq = s3c24xx_init_irq, | 155 | .init_irq = s3c2440_init_irq, |
156 | .init_time = s3c24xx_timer_init, | 156 | .init_time = samsung_timer_init, |
157 | .restart = s3c244x_restart, | 157 | .restart = s3c244x_restart, |
158 | MACHINE_END | 158 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c index ae2cbdf3e3ca..58d6fbe5bf1f 100644 --- a/arch/arm/mach-s3c24xx/mach-osiris.c +++ b/arch/arm/mach-s3c24xx/mach-osiris.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
46 | #include <plat/gpio-cfg.h> | 46 | #include <plat/gpio-cfg.h> |
47 | #include <plat/regs-serial.h> | 47 | #include <plat/regs-serial.h> |
48 | #include <plat/samsung-time.h> | ||
48 | 49 | ||
49 | #include <mach/hardware.h> | 50 | #include <mach/hardware.h> |
50 | #include <mach/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
@@ -384,6 +385,7 @@ static void __init osiris_map_io(void) | |||
384 | s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); | 385 | s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); |
385 | s3c24xx_init_clocks(0); | 386 | s3c24xx_init_clocks(0); |
386 | s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); | 387 | s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); |
388 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
387 | 389 | ||
388 | /* check for the newer revision boards with large page nand */ | 390 | /* check for the newer revision boards with large page nand */ |
389 | 391 | ||
@@ -424,8 +426,8 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS") | |||
424 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 426 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
425 | .atag_offset = 0x100, | 427 | .atag_offset = 0x100, |
426 | .map_io = osiris_map_io, | 428 | .map_io = osiris_map_io, |
427 | .init_irq = s3c24xx_init_irq, | 429 | .init_irq = s3c2440_init_irq, |
428 | .init_machine = osiris_init, | 430 | .init_machine = osiris_init, |
429 | .init_time = s3c24xx_timer_init, | 431 | .init_time = samsung_timer_init, |
430 | .restart = s3c244x_restart, | 432 | .restart = s3c244x_restart, |
431 | MACHINE_END | 433 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c index 40a47d6c6a85..7e16b0740ec1 100644 --- a/arch/arm/mach-s3c24xx/mach-otom.c +++ b/arch/arm/mach-s3c24xx/mach-otom.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <plat/cpu.h> | 33 | #include <plat/cpu.h> |
34 | #include <plat/devs.h> | 34 | #include <plat/devs.h> |
35 | #include <plat/regs-serial.h> | 35 | #include <plat/regs-serial.h> |
36 | #include <plat/s3c2410.h> | 36 | #include <plat/samsung-time.h> |
37 | 37 | ||
38 | #include "common.h" | 38 | #include "common.h" |
39 | #include "otom.h" | 39 | #include "otom.h" |
@@ -102,6 +102,7 @@ static void __init otom11_map_io(void) | |||
102 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); | 102 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); |
103 | s3c24xx_init_clocks(0); | 103 | s3c24xx_init_clocks(0); |
104 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); | 104 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); |
105 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
105 | } | 106 | } |
106 | 107 | ||
107 | static void __init otom11_init(void) | 108 | static void __init otom11_init(void) |
@@ -115,7 +116,7 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | |||
115 | .atag_offset = 0x100, | 116 | .atag_offset = 0x100, |
116 | .map_io = otom11_map_io, | 117 | .map_io = otom11_map_io, |
117 | .init_machine = otom11_init, | 118 | .init_machine = otom11_init, |
118 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
119 | .init_time = s3c24xx_timer_init, | 120 | .init_time = samsung_timer_init, |
120 | .restart = s3c2410_restart, | 121 | .restart = s3c2410_restart, |
121 | MACHINE_END | 122 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c index 56175f0941b1..f8feaeadb55a 100644 --- a/arch/arm/mach-s3c24xx/mach-qt2410.c +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c | |||
@@ -55,13 +55,14 @@ | |||
55 | #include <linux/platform_data/usb-s3c2410_udc.h> | 55 | #include <linux/platform_data/usb-s3c2410_udc.h> |
56 | #include <linux/platform_data/i2c-s3c2410.h> | 56 | #include <linux/platform_data/i2c-s3c2410.h> |
57 | 57 | ||
58 | #include <plat/common-smdk.h> | ||
59 | #include <plat/gpio-cfg.h> | 58 | #include <plat/gpio-cfg.h> |
60 | #include <plat/devs.h> | 59 | #include <plat/devs.h> |
61 | #include <plat/cpu.h> | 60 | #include <plat/cpu.h> |
62 | #include <plat/pm.h> | 61 | #include <plat/pm.h> |
62 | #include <plat/samsung-time.h> | ||
63 | 63 | ||
64 | #include "common.h" | 64 | #include "common.h" |
65 | #include "common-smdk.h" | ||
65 | 66 | ||
66 | static struct map_desc qt2410_iodesc[] __initdata = { | 67 | static struct map_desc qt2410_iodesc[] __initdata = { |
67 | { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE } | 68 | { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE } |
@@ -304,6 +305,7 @@ static void __init qt2410_map_io(void) | |||
304 | s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); | 305 | s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); |
305 | s3c24xx_init_clocks(12*1000*1000); | 306 | s3c24xx_init_clocks(12*1000*1000); |
306 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | 307 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); |
308 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
307 | } | 309 | } |
308 | 310 | ||
309 | static void __init qt2410_machine_init(void) | 311 | static void __init qt2410_machine_init(void) |
@@ -341,8 +343,8 @@ static void __init qt2410_machine_init(void) | |||
341 | MACHINE_START(QT2410, "QT2410") | 343 | MACHINE_START(QT2410, "QT2410") |
342 | .atag_offset = 0x100, | 344 | .atag_offset = 0x100, |
343 | .map_io = qt2410_map_io, | 345 | .map_io = qt2410_map_io, |
344 | .init_irq = s3c24xx_init_irq, | 346 | .init_irq = s3c2410_init_irq, |
345 | .init_machine = qt2410_machine_init, | 347 | .init_machine = qt2410_machine_init, |
346 | .init_time = s3c24xx_timer_init, | 348 | .init_time = samsung_timer_init, |
347 | .restart = s3c2410_restart, | 349 | .restart = s3c2410_restart, |
348 | MACHINE_END | 350 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c index 1f9ba2ae5288..e4d67a33ebee 100644 --- a/arch/arm/mach-s3c24xx/mach-rx1950.c +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <plat/pm.h> | 58 | #include <plat/pm.h> |
59 | #include <plat/regs-iic.h> | 59 | #include <plat/regs-iic.h> |
60 | #include <plat/regs-serial.h> | 60 | #include <plat/regs-serial.h> |
61 | #include <plat/samsung-time.h> | ||
61 | 62 | ||
62 | #include "common.h" | 63 | #include "common.h" |
63 | #include "h1940.h" | 64 | #include "h1940.h" |
@@ -741,6 +742,7 @@ static void __init rx1950_map_io(void) | |||
741 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); | 742 | s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); |
742 | s3c24xx_init_clocks(16934000); | 743 | s3c24xx_init_clocks(16934000); |
743 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); | 744 | s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); |
745 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
744 | 746 | ||
745 | /* setup PM */ | 747 | /* setup PM */ |
746 | 748 | ||
@@ -811,8 +813,8 @@ MACHINE_START(RX1950, "HP iPAQ RX1950") | |||
811 | .atag_offset = 0x100, | 813 | .atag_offset = 0x100, |
812 | .map_io = rx1950_map_io, | 814 | .map_io = rx1950_map_io, |
813 | .reserve = rx1950_reserve, | 815 | .reserve = rx1950_reserve, |
814 | .init_irq = s3c24xx_init_irq, | 816 | .init_irq = s3c2442_init_irq, |
815 | .init_machine = rx1950_init_machine, | 817 | .init_machine = rx1950_init_machine, |
816 | .init_time = s3c24xx_timer_init, | 818 | .init_time = samsung_timer_init, |
817 | .restart = s3c244x_restart, | 819 | .restart = s3c244x_restart, |
818 | MACHINE_END | 820 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c index f20418a2fb1b..3bc6231d0a1f 100644 --- a/arch/arm/mach-s3c24xx/mach-rx3715.c +++ b/arch/arm/mach-s3c24xx/mach-rx3715.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/pm.h> | 50 | #include <plat/pm.h> |
51 | #include <plat/regs-serial.h> | 51 | #include <plat/regs-serial.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "common.h" | 54 | #include "common.h" |
54 | #include "h1940.h" | 55 | #include "h1940.h" |
@@ -179,6 +180,7 @@ static void __init rx3715_map_io(void) | |||
179 | s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); | 180 | s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); |
180 | s3c24xx_init_clocks(16934000); | 181 | s3c24xx_init_clocks(16934000); |
181 | s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); | 182 | s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); |
183 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
182 | } | 184 | } |
183 | 185 | ||
184 | /* H1940 and RX3715 need to reserve this for suspend */ | 186 | /* H1940 and RX3715 need to reserve this for suspend */ |
@@ -188,11 +190,6 @@ static void __init rx3715_reserve(void) | |||
188 | memblock_reserve(0x30081000, 0x1000); | 190 | memblock_reserve(0x30081000, 0x1000); |
189 | } | 191 | } |
190 | 192 | ||
191 | static void __init rx3715_init_irq(void) | ||
192 | { | ||
193 | s3c24xx_init_irq(); | ||
194 | } | ||
195 | |||
196 | static void __init rx3715_init_machine(void) | 193 | static void __init rx3715_init_machine(void) |
197 | { | 194 | { |
198 | #ifdef CONFIG_PM_H1940 | 195 | #ifdef CONFIG_PM_H1940 |
@@ -210,8 +207,8 @@ MACHINE_START(RX3715, "IPAQ-RX3715") | |||
210 | .atag_offset = 0x100, | 207 | .atag_offset = 0x100, |
211 | .map_io = rx3715_map_io, | 208 | .map_io = rx3715_map_io, |
212 | .reserve = rx3715_reserve, | 209 | .reserve = rx3715_reserve, |
213 | .init_irq = rx3715_init_irq, | 210 | .init_irq = s3c2440_init_irq, |
214 | .init_machine = rx3715_init_machine, | 211 | .init_machine = rx3715_init_machine, |
215 | .init_time = s3c24xx_timer_init, | 212 | .init_time = samsung_timer_init, |
216 | .restart = s3c244x_restart, | 213 | .restart = s3c244x_restart, |
217 | MACHINE_END | 214 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c index e184bfa9613a..a773789e4f38 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c | |||
@@ -51,10 +51,10 @@ | |||
51 | 51 | ||
52 | #include <plat/devs.h> | 52 | #include <plat/devs.h> |
53 | #include <plat/cpu.h> | 53 | #include <plat/cpu.h> |
54 | 54 | #include <plat/samsung-time.h> | |
55 | #include <plat/common-smdk.h> | ||
56 | 55 | ||
57 | #include "common.h" | 56 | #include "common.h" |
57 | #include "common-smdk.h" | ||
58 | 58 | ||
59 | static struct map_desc smdk2410_iodesc[] __initdata = { | 59 | static struct map_desc smdk2410_iodesc[] __initdata = { |
60 | /* nothing here yet */ | 60 | /* nothing here yet */ |
@@ -101,6 +101,7 @@ static void __init smdk2410_map_io(void) | |||
101 | s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); | 101 | s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); |
102 | s3c24xx_init_clocks(0); | 102 | s3c24xx_init_clocks(0); |
103 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); | 103 | s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); |
104 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
104 | } | 105 | } |
105 | 106 | ||
106 | static void __init smdk2410_init(void) | 107 | static void __init smdk2410_init(void) |
@@ -115,8 +116,8 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc | |||
115 | /* Maintainer: Jonas Dietsche */ | 116 | /* Maintainer: Jonas Dietsche */ |
116 | .atag_offset = 0x100, | 117 | .atag_offset = 0x100, |
117 | .map_io = smdk2410_map_io, | 118 | .map_io = smdk2410_map_io, |
118 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
119 | .init_machine = smdk2410_init, | 120 | .init_machine = smdk2410_init, |
120 | .init_time = s3c24xx_timer_init, | 121 | .init_time = samsung_timer_init, |
121 | .restart = s3c2410_restart, | 122 | .restart = s3c2410_restart, |
122 | MACHINE_END | 123 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c index 86d7847c9d45..8146e920f10d 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2413.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c | |||
@@ -41,13 +41,13 @@ | |||
41 | #include <linux/platform_data/i2c-s3c2410.h> | 41 | #include <linux/platform_data/i2c-s3c2410.h> |
42 | #include <mach/fb.h> | 42 | #include <mach/fb.h> |
43 | 43 | ||
44 | #include <plat/s3c2410.h> | ||
45 | #include <plat/s3c2412.h> | ||
46 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
47 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
48 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
49 | 48 | ||
50 | #include <plat/common-smdk.h> | 49 | #include "common.h" |
50 | #include "common-smdk.h" | ||
51 | 51 | ||
52 | static struct map_desc smdk2413_iodesc[] __initdata = { | 52 | static struct map_desc smdk2413_iodesc[] __initdata = { |
53 | }; | 53 | }; |
@@ -106,6 +106,7 @@ static void __init smdk2413_map_io(void) | |||
106 | s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); | 106 | s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); |
107 | s3c24xx_init_clocks(12000000); | 107 | s3c24xx_init_clocks(12000000); |
108 | s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); | 108 | s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); |
109 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
109 | } | 110 | } |
110 | 111 | ||
111 | static void __init smdk2413_machine_init(void) | 112 | static void __init smdk2413_machine_init(void) |
@@ -129,10 +130,10 @@ MACHINE_START(S3C2413, "S3C2413") | |||
129 | .atag_offset = 0x100, | 130 | .atag_offset = 0x100, |
130 | 131 | ||
131 | .fixup = smdk2413_fixup, | 132 | .fixup = smdk2413_fixup, |
132 | .init_irq = s3c24xx_init_irq, | 133 | .init_irq = s3c2412_init_irq, |
133 | .map_io = smdk2413_map_io, | 134 | .map_io = smdk2413_map_io, |
134 | .init_machine = smdk2413_machine_init, | 135 | .init_machine = smdk2413_machine_init, |
135 | .init_time = s3c24xx_timer_init, | 136 | .init_time = samsung_timer_init, |
136 | .restart = s3c2412_restart, | 137 | .restart = s3c2412_restart, |
137 | MACHINE_END | 138 | MACHINE_END |
138 | 139 | ||
@@ -141,10 +142,10 @@ MACHINE_START(SMDK2412, "SMDK2412") | |||
141 | .atag_offset = 0x100, | 142 | .atag_offset = 0x100, |
142 | 143 | ||
143 | .fixup = smdk2413_fixup, | 144 | .fixup = smdk2413_fixup, |
144 | .init_irq = s3c24xx_init_irq, | 145 | .init_irq = s3c2412_init_irq, |
145 | .map_io = smdk2413_map_io, | 146 | .map_io = smdk2413_map_io, |
146 | .init_machine = smdk2413_machine_init, | 147 | .init_machine = smdk2413_machine_init, |
147 | .init_time = s3c24xx_timer_init, | 148 | .init_time = samsung_timer_init, |
148 | .restart = s3c2412_restart, | 149 | .restart = s3c2412_restart, |
149 | MACHINE_END | 150 | MACHINE_END |
150 | 151 | ||
@@ -153,9 +154,9 @@ MACHINE_START(SMDK2413, "SMDK2413") | |||
153 | .atag_offset = 0x100, | 154 | .atag_offset = 0x100, |
154 | 155 | ||
155 | .fixup = smdk2413_fixup, | 156 | .fixup = smdk2413_fixup, |
156 | .init_irq = s3c24xx_init_irq, | 157 | .init_irq = s3c2412_init_irq, |
157 | .map_io = smdk2413_map_io, | 158 | .map_io = smdk2413_map_io, |
158 | .init_machine = smdk2413_machine_init, | 159 | .init_machine = smdk2413_machine_init, |
159 | .init_time = s3c24xx_timer_init, | 160 | .init_time = samsung_timer_init, |
160 | .restart = s3c2412_restart, | 161 | .restart = s3c2412_restart, |
161 | MACHINE_END | 162 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c index ebb2e61f3d07..cb46847c66b4 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2416.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/platform_data/leds-s3c24xx.h> | 42 | #include <linux/platform_data/leds-s3c24xx.h> |
43 | #include <linux/platform_data/i2c-s3c2410.h> | 43 | #include <linux/platform_data/i2c-s3c2410.h> |
44 | 44 | ||
45 | #include <plat/s3c2416.h> | ||
46 | #include <plat/gpio-cfg.h> | 45 | #include <plat/gpio-cfg.h> |
47 | #include <plat/clock.h> | 46 | #include <plat/clock.h> |
48 | #include <plat/devs.h> | 47 | #include <plat/devs.h> |
@@ -51,10 +50,12 @@ | |||
51 | #include <plat/sdhci.h> | 50 | #include <plat/sdhci.h> |
52 | #include <linux/platform_data/usb-s3c2410_udc.h> | 51 | #include <linux/platform_data/usb-s3c2410_udc.h> |
53 | #include <linux/platform_data/s3c-hsudc.h> | 52 | #include <linux/platform_data/s3c-hsudc.h> |
53 | #include <plat/samsung-time.h> | ||
54 | 54 | ||
55 | #include <plat/fb.h> | 55 | #include <plat/fb.h> |
56 | 56 | ||
57 | #include <plat/common-smdk.h> | 57 | #include "common.h" |
58 | #include "common-smdk.h" | ||
58 | 59 | ||
59 | static struct map_desc smdk2416_iodesc[] __initdata = { | 60 | static struct map_desc smdk2416_iodesc[] __initdata = { |
60 | /* ISA IO Space map (memory space selected by A24) */ | 61 | /* ISA IO Space map (memory space selected by A24) */ |
@@ -221,6 +222,7 @@ static void __init smdk2416_map_io(void) | |||
221 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); | 222 | s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); |
222 | s3c24xx_init_clocks(12000000); | 223 | s3c24xx_init_clocks(12000000); |
223 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); | 224 | s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); |
225 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
224 | } | 226 | } |
225 | 227 | ||
226 | static void __init smdk2416_machine_init(void) | 228 | static void __init smdk2416_machine_init(void) |
@@ -253,6 +255,6 @@ MACHINE_START(SMDK2416, "SMDK2416") | |||
253 | .init_irq = s3c2416_init_irq, | 255 | .init_irq = s3c2416_init_irq, |
254 | .map_io = smdk2416_map_io, | 256 | .map_io = smdk2416_map_io, |
255 | .init_machine = smdk2416_machine_init, | 257 | .init_machine = smdk2416_machine_init, |
256 | .init_time = s3c24xx_timer_init, | 258 | .init_time = samsung_timer_init, |
257 | .restart = s3c2416_restart, | 259 | .restart = s3c2416_restart, |
258 | MACHINE_END | 260 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c index 08cc38c8a4ae..de2e5d39a847 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2440.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c | |||
@@ -38,15 +38,13 @@ | |||
38 | #include <mach/fb.h> | 38 | #include <mach/fb.h> |
39 | #include <linux/platform_data/i2c-s3c2410.h> | 39 | #include <linux/platform_data/i2c-s3c2410.h> |
40 | 40 | ||
41 | #include <plat/s3c2410.h> | ||
42 | #include <plat/s3c244x.h> | ||
43 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
44 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
45 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
46 | 44 | #include <plat/samsung-time.h> | |
47 | #include <plat/common-smdk.h> | ||
48 | 45 | ||
49 | #include "common.h" | 46 | #include "common.h" |
47 | #include "common-smdk.h" | ||
50 | 48 | ||
51 | static struct map_desc smdk2440_iodesc[] __initdata = { | 49 | static struct map_desc smdk2440_iodesc[] __initdata = { |
52 | /* ISA IO Space map (memory space selected by A24) */ | 50 | /* ISA IO Space map (memory space selected by A24) */ |
@@ -163,6 +161,7 @@ static void __init smdk2440_map_io(void) | |||
163 | s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); | 161 | s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); |
164 | s3c24xx_init_clocks(16934400); | 162 | s3c24xx_init_clocks(16934400); |
165 | s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); | 163 | s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); |
164 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
166 | } | 165 | } |
167 | 166 | ||
168 | static void __init smdk2440_machine_init(void) | 167 | static void __init smdk2440_machine_init(void) |
@@ -178,9 +177,9 @@ MACHINE_START(S3C2440, "SMDK2440") | |||
178 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ | 177 | /* Maintainer: Ben Dooks <ben-linux@fluff.org> */ |
179 | .atag_offset = 0x100, | 178 | .atag_offset = 0x100, |
180 | 179 | ||
181 | .init_irq = s3c24xx_init_irq, | 180 | .init_irq = s3c2440_init_irq, |
182 | .map_io = smdk2440_map_io, | 181 | .map_io = smdk2440_map_io, |
183 | .init_machine = smdk2440_machine_init, | 182 | .init_machine = smdk2440_machine_init, |
184 | .init_time = s3c24xx_timer_init, | 183 | .init_time = samsung_timer_init, |
185 | .restart = s3c244x_restart, | 184 | .restart = s3c244x_restart, |
186 | MACHINE_END | 185 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c index fc65d74d3c73..9435c3bef18a 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2443.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c | |||
@@ -38,13 +38,13 @@ | |||
38 | #include <mach/fb.h> | 38 | #include <mach/fb.h> |
39 | #include <linux/platform_data/i2c-s3c2410.h> | 39 | #include <linux/platform_data/i2c-s3c2410.h> |
40 | 40 | ||
41 | #include <plat/s3c2410.h> | ||
42 | #include <plat/s3c2443.h> | ||
43 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
44 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
45 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/samsung-time.h> | ||
46 | 45 | ||
47 | #include <plat/common-smdk.h> | 46 | #include "common.h" |
47 | #include "common-smdk.h" | ||
48 | 48 | ||
49 | static struct map_desc smdk2443_iodesc[] __initdata = { | 49 | static struct map_desc smdk2443_iodesc[] __initdata = { |
50 | /* ISA IO Space map (memory space selected by A24) */ | 50 | /* ISA IO Space map (memory space selected by A24) */ |
@@ -122,6 +122,7 @@ static void __init smdk2443_map_io(void) | |||
122 | s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); | 122 | s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); |
123 | s3c24xx_init_clocks(12000000); | 123 | s3c24xx_init_clocks(12000000); |
124 | s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); | 124 | s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); |
125 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
125 | } | 126 | } |
126 | 127 | ||
127 | static void __init smdk2443_machine_init(void) | 128 | static void __init smdk2443_machine_init(void) |
@@ -143,6 +144,6 @@ MACHINE_START(SMDK2443, "SMDK2443") | |||
143 | .init_irq = s3c2443_init_irq, | 144 | .init_irq = s3c2443_init_irq, |
144 | .map_io = smdk2443_map_io, | 145 | .map_io = smdk2443_map_io, |
145 | .init_machine = smdk2443_machine_init, | 146 | .init_machine = smdk2443_machine_init, |
146 | .init_time = s3c24xx_timer_init, | 147 | .init_time = samsung_timer_init, |
147 | .restart = s3c2443_restart, | 148 | .restart = s3c2443_restart, |
148 | MACHINE_END | 149 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 24b3d79e7b2c..7fad8f055cab 100644 --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/mtd/partitions.h> | 53 | #include <linux/mtd/partitions.h> |
54 | #include <linux/mtd/map.h> | 54 | #include <linux/mtd/map.h> |
55 | #include <linux/mtd/physmap.h> | 55 | #include <linux/mtd/physmap.h> |
56 | #include <plat/samsung-time.h> | ||
56 | 57 | ||
57 | #include "common.h" | 58 | #include "common.h" |
58 | 59 | ||
@@ -136,6 +137,7 @@ static void __init tct_hammer_map_io(void) | |||
136 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); | 137 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); |
137 | s3c24xx_init_clocks(0); | 138 | s3c24xx_init_clocks(0); |
138 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); | 139 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); |
140 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
139 | } | 141 | } |
140 | 142 | ||
141 | static void __init tct_hammer_init(void) | 143 | static void __init tct_hammer_init(void) |
@@ -147,8 +149,8 @@ static void __init tct_hammer_init(void) | |||
147 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") | 149 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") |
148 | .atag_offset = 0x100, | 150 | .atag_offset = 0x100, |
149 | .map_io = tct_hammer_map_io, | 151 | .map_io = tct_hammer_map_io, |
150 | .init_irq = s3c24xx_init_irq, | 152 | .init_irq = s3c2410_init_irq, |
151 | .init_machine = tct_hammer_init, | 153 | .init_machine = tct_hammer_init, |
152 | .init_time = s3c24xx_timer_init, | 154 | .init_time = samsung_timer_init, |
153 | .restart = s3c2410_restart, | 155 | .restart = s3c2410_restart, |
154 | MACHINE_END | 156 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c index ec42d1e4e465..42e7187fed60 100644 --- a/arch/arm/mach-s3c24xx/mach-vr1000.c +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
46 | #include <plat/devs.h> | 46 | #include <plat/devs.h> |
47 | #include <plat/regs-serial.h> | 47 | #include <plat/regs-serial.h> |
48 | #include <plat/samsung-time.h> | ||
48 | 49 | ||
49 | #include "bast.h" | 50 | #include "bast.h" |
50 | #include "common.h" | 51 | #include "common.h" |
@@ -332,6 +333,7 @@ static void __init vr1000_map_io(void) | |||
332 | s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); | 333 | s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); |
333 | s3c24xx_init_clocks(0); | 334 | s3c24xx_init_clocks(0); |
334 | s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); | 335 | s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); |
336 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
335 | } | 337 | } |
336 | 338 | ||
337 | static void __init vr1000_init(void) | 339 | static void __init vr1000_init(void) |
@@ -353,7 +355,7 @@ MACHINE_START(VR1000, "Thorcom-VR1000") | |||
353 | .atag_offset = 0x100, | 355 | .atag_offset = 0x100, |
354 | .map_io = vr1000_map_io, | 356 | .map_io = vr1000_map_io, |
355 | .init_machine = vr1000_init, | 357 | .init_machine = vr1000_init, |
356 | .init_irq = s3c24xx_init_irq, | 358 | .init_irq = s3c2410_init_irq, |
357 | .init_time = s3c24xx_timer_init, | 359 | .init_time = samsung_timer_init, |
358 | .restart = s3c2410_restart, | 360 | .restart = s3c2410_restart, |
359 | MACHINE_END | 361 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c index 3e2bfddc9df1..b66588428ec9 100644 --- a/arch/arm/mach-s3c24xx/mach-vstms.c +++ b/arch/arm/mach-s3c24xx/mach-vstms.c | |||
@@ -41,12 +41,12 @@ | |||
41 | #include <linux/platform_data/i2c-s3c2410.h> | 41 | #include <linux/platform_data/i2c-s3c2410.h> |
42 | #include <linux/platform_data/mtd-nand-s3c2410.h> | 42 | #include <linux/platform_data/mtd-nand-s3c2410.h> |
43 | 43 | ||
44 | #include <plat/s3c2410.h> | ||
45 | #include <plat/s3c2412.h> | ||
46 | #include <plat/clock.h> | 44 | #include <plat/clock.h> |
47 | #include <plat/devs.h> | 45 | #include <plat/devs.h> |
48 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/samsung-time.h> | ||
49 | 48 | ||
49 | #include "common.h" | ||
50 | 50 | ||
51 | static struct map_desc vstms_iodesc[] __initdata = { | 51 | static struct map_desc vstms_iodesc[] __initdata = { |
52 | }; | 52 | }; |
@@ -143,6 +143,7 @@ static void __init vstms_map_io(void) | |||
143 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); | 143 | s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); |
144 | s3c24xx_init_clocks(12000000); | 144 | s3c24xx_init_clocks(12000000); |
145 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); | 145 | s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); |
146 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
146 | } | 147 | } |
147 | 148 | ||
148 | static void __init vstms_init(void) | 149 | static void __init vstms_init(void) |
@@ -157,9 +158,9 @@ MACHINE_START(VSTMS, "VSTMS") | |||
157 | .atag_offset = 0x100, | 158 | .atag_offset = 0x100, |
158 | 159 | ||
159 | .fixup = vstms_fixup, | 160 | .fixup = vstms_fixup, |
160 | .init_irq = s3c24xx_init_irq, | 161 | .init_irq = s3c2412_init_irq, |
161 | .init_machine = vstms_init, | 162 | .init_machine = vstms_init, |
162 | .map_io = vstms_map_io, | 163 | .map_io = vstms_map_io, |
163 | .init_time = s3c24xx_timer_init, | 164 | .init_time = samsung_timer_init, |
164 | .restart = s3c2412_restart, | 165 | .restart = s3c2412_restart, |
165 | MACHINE_END | 166 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/pm-s3c2412.c b/arch/arm/mach-s3c24xx/pm-s3c2412.c index 668a78a8b195..d75f95e487ee 100644 --- a/arch/arm/mach-s3c24xx/pm-s3c2412.c +++ b/arch/arm/mach-s3c24xx/pm-s3c2412.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #include <plat/cpu.h> | 30 | #include <plat/cpu.h> |
31 | #include <plat/pm.h> | 31 | #include <plat/pm.h> |
32 | #include <plat/s3c2412.h> | 32 | #include <plat/wakeup-mask.h> |
33 | 33 | ||
34 | #include "regs-dsc.h" | 34 | #include "regs-dsc.h" |
35 | #include "s3c2412-power.h" | 35 | #include "s3c2412-power.h" |
@@ -52,8 +52,15 @@ static int s3c2412_cpu_suspend(unsigned long arg) | |||
52 | return 1; /* Aborting suspend */ | 52 | return 1; /* Aborting suspend */ |
53 | } | 53 | } |
54 | 54 | ||
55 | /* mapping of interrupts to parts of the wakeup mask */ | ||
56 | static struct samsung_wakeup_mask wake_irqs[] = { | ||
57 | { .irq = IRQ_RTC, .bit = S3C2412_PWRCFG_RTC_MASKIRQ, }, | ||
58 | }; | ||
59 | |||
55 | static void s3c2412_pm_prepare(void) | 60 | static void s3c2412_pm_prepare(void) |
56 | { | 61 | { |
62 | samsung_sync_wakemask(S3C2412_PWRCFG, | ||
63 | wake_irqs, ARRAY_SIZE(wake_irqs)); | ||
57 | } | 64 | } |
58 | 65 | ||
59 | static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) | 66 | static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) |
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c index 9ebef95da721..d850ea5adac2 100644 --- a/arch/arm/mach-s3c24xx/s3c2410.c +++ b/arch/arm/mach-s3c24xx/s3c2410.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <mach/regs-clock.h> | 37 | #include <mach/regs-clock.h> |
38 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
39 | 39 | ||
40 | #include <plat/s3c2410.h> | ||
41 | #include <plat/cpu.h> | 40 | #include <plat/cpu.h> |
42 | #include <plat/devs.h> | 41 | #include <plat/devs.h> |
43 | #include <plat/clock.h> | 42 | #include <plat/clock.h> |
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c index 0d592159a5c3..0f864d4c97de 100644 --- a/arch/arm/mach-s3c24xx/s3c2412.c +++ b/arch/arm/mach-s3c24xx/s3c2412.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <plat/pm.h> | 44 | #include <plat/pm.h> |
45 | #include <plat/regs-serial.h> | 45 | #include <plat/regs-serial.h> |
46 | #include <plat/regs-spi.h> | 46 | #include <plat/regs-spi.h> |
47 | #include <plat/s3c2412.h> | ||
48 | 47 | ||
49 | #include "common.h" | 48 | #include "common.h" |
50 | #include "regs-dsc.h" | 49 | #include "regs-dsc.h" |
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c index e30476db0295..b9c5d382dafb 100644 --- a/arch/arm/mach-s3c24xx/s3c2416.c +++ b/arch/arm/mach-s3c24xx/s3c2416.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <plat/gpio-core.h> | 50 | #include <plat/gpio-core.h> |
51 | #include <plat/gpio-cfg.h> | 51 | #include <plat/gpio-cfg.h> |
52 | #include <plat/gpio-cfg-helpers.h> | 52 | #include <plat/gpio-cfg-helpers.h> |
53 | #include <plat/s3c2416.h> | ||
54 | #include <plat/devs.h> | 53 | #include <plat/devs.h> |
55 | #include <plat/cpu.h> | 54 | #include <plat/cpu.h> |
56 | #include <plat/sdhci.h> | 55 | #include <plat/sdhci.h> |
diff --git a/arch/arm/mach-s3c24xx/s3c2440.c b/arch/arm/mach-s3c24xx/s3c2440.c index 559e394e8989..5f9d6569475d 100644 --- a/arch/arm/mach-s3c24xx/s3c2440.c +++ b/arch/arm/mach-s3c24xx/s3c2440.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <plat/devs.h> | 34 | #include <plat/devs.h> |
35 | #include <plat/cpu.h> | 35 | #include <plat/cpu.h> |
36 | #include <plat/s3c244x.h> | ||
37 | #include <plat/pm.h> | 36 | #include <plat/pm.h> |
38 | 37 | ||
39 | #include <plat/gpio-core.h> | 38 | #include <plat/gpio-core.h> |
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c index f732826c2359..6819961f6b19 100644 --- a/arch/arm/mach-s3c24xx/s3c2442.c +++ b/arch/arm/mach-s3c24xx/s3c2442.c | |||
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <plat/clock.h> | 45 | #include <plat/clock.h> |
46 | #include <plat/cpu.h> | 46 | #include <plat/cpu.h> |
47 | #include <plat/s3c244x.h> | ||
48 | #include <plat/pm.h> | 47 | #include <plat/pm.h> |
49 | 48 | ||
50 | #include <plat/gpio-core.h> | 49 | #include <plat/gpio-core.h> |
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c index 165b6a6b3daa..8328cd65bf3d 100644 --- a/arch/arm/mach-s3c24xx/s3c2443.c +++ b/arch/arm/mach-s3c24xx/s3c2443.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <plat/gpio-core.h> | 36 | #include <plat/gpio-core.h> |
37 | #include <plat/gpio-cfg.h> | 37 | #include <plat/gpio-cfg.h> |
38 | #include <plat/gpio-cfg-helpers.h> | 38 | #include <plat/gpio-cfg-helpers.h> |
39 | #include <plat/s3c2443.h> | ||
40 | #include <plat/devs.h> | 39 | #include <plat/devs.h> |
41 | #include <plat/cpu.h> | 40 | #include <plat/cpu.h> |
42 | #include <plat/fb-core.h> | 41 | #include <plat/fb-core.h> |
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c index ad2671baa910..2a35edb67354 100644 --- a/arch/arm/mach-s3c24xx/s3c244x.c +++ b/arch/arm/mach-s3c24xx/s3c244x.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include <plat/regs-serial.h> | 37 | #include <plat/regs-serial.h> |
38 | #include <mach/regs-gpio.h> | 38 | #include <mach/regs-gpio.h> |
39 | 39 | ||
40 | #include <plat/s3c2410.h> | ||
41 | #include <plat/s3c244x.h> | ||
42 | #include <plat/clock.h> | 40 | #include <plat/clock.h> |
43 | #include <plat/devs.h> | 41 | #include <plat/devs.h> |
44 | #include <plat/cpu.h> | 42 | #include <plat/cpu.h> |
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 131c86284711..283cb77d4721 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -17,11 +17,13 @@ config PLAT_S3C64XX | |||
17 | # Configuration options for the S3C6410 CPU | 17 | # Configuration options for the S3C6410 CPU |
18 | 18 | ||
19 | config CPU_S3C6400 | 19 | config CPU_S3C6400 |
20 | select SAMSUNG_HRT | ||
20 | bool | 21 | bool |
21 | help | 22 | help |
22 | Enable S3C6400 CPU support | 23 | Enable S3C6400 CPU support |
23 | 24 | ||
24 | config CPU_S3C6410 | 25 | config CPU_S3C6410 |
26 | select SAMSUNG_HRT | ||
25 | bool | 27 | bool |
26 | help | 28 | help |
27 | Enable S3C6410 CPU support | 29 | Enable S3C6410 CPU support |
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c index 728eef3296b2..35e3f54574ef 100644 --- a/arch/arm/mach-s3c64xx/mach-anw6410.c +++ b/arch/arm/mach-s3c64xx/mach-anw6410.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
51 | #include <mach/regs-gpio.h> | 51 | #include <mach/regs-gpio.h> |
52 | #include <plat/samsung-time.h> | ||
52 | 53 | ||
53 | #include "common.h" | 54 | #include "common.h" |
54 | #include "regs-modem.h" | 55 | #include "regs-modem.h" |
@@ -208,6 +209,7 @@ static void __init anw6410_map_io(void) | |||
208 | s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); | 209 | s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc)); |
209 | s3c24xx_init_clocks(12000000); | 210 | s3c24xx_init_clocks(12000000); |
210 | s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); | 211 | s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs)); |
212 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
211 | 213 | ||
212 | anw6410_lcd_mode_set(); | 214 | anw6410_lcd_mode_set(); |
213 | } | 215 | } |
@@ -232,6 +234,6 @@ MACHINE_START(ANW6410, "A&W6410") | |||
232 | .map_io = anw6410_map_io, | 234 | .map_io = anw6410_map_io, |
233 | .init_machine = anw6410_machine_init, | 235 | .init_machine = anw6410_machine_init, |
234 | .init_late = s3c64xx_init_late, | 236 | .init_late = s3c64xx_init_late, |
235 | .init_time = s3c24xx_timer_init, | 237 | .init_time = samsung_timer_init, |
236 | .restart = s3c64xx_restart, | 238 | .restart = s3c64xx_restart, |
237 | MACHINE_END | 239 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index 1acf02bace57..8ad88ace795a 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c | |||
@@ -64,6 +64,7 @@ | |||
64 | #include <plat/adc.h> | 64 | #include <plat/adc.h> |
65 | #include <linux/platform_data/i2c-s3c2410.h> | 65 | #include <linux/platform_data/i2c-s3c2410.h> |
66 | #include <plat/pm.h> | 66 | #include <plat/pm.h> |
67 | #include <plat/samsung-time.h> | ||
67 | 68 | ||
68 | #include "common.h" | 69 | #include "common.h" |
69 | #include "crag6410.h" | 70 | #include "crag6410.h" |
@@ -744,6 +745,7 @@ static void __init crag6410_map_io(void) | |||
744 | s3c64xx_init_io(NULL, 0); | 745 | s3c64xx_init_io(NULL, 0); |
745 | s3c24xx_init_clocks(12000000); | 746 | s3c24xx_init_clocks(12000000); |
746 | s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); | 747 | s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs)); |
748 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
747 | 749 | ||
748 | /* LCD type and Bypass set by bootloader */ | 750 | /* LCD type and Bypass set by bootloader */ |
749 | } | 751 | } |
@@ -868,6 +870,6 @@ MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410") | |||
868 | .map_io = crag6410_map_io, | 870 | .map_io = crag6410_map_io, |
869 | .init_machine = crag6410_machine_init, | 871 | .init_machine = crag6410_machine_init, |
870 | .init_late = s3c64xx_init_late, | 872 | .init_late = s3c64xx_init_late, |
871 | .init_time = s3c24xx_timer_init, | 873 | .init_time = samsung_timer_init, |
872 | .restart = s3c64xx_restart, | 874 | .restart = s3c64xx_restart, |
873 | MACHINE_END | 875 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c index 7212eb9cfeb9..5b7f357d8c22 100644 --- a/arch/arm/mach-s3c64xx/mach-hmt.c +++ b/arch/arm/mach-s3c64xx/mach-hmt.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <plat/clock.h> | 41 | #include <plat/clock.h> |
42 | #include <plat/devs.h> | 42 | #include <plat/devs.h> |
43 | #include <plat/cpu.h> | 43 | #include <plat/cpu.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | 47 | ||
@@ -248,6 +249,7 @@ static void __init hmt_map_io(void) | |||
248 | s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); | 249 | s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc)); |
249 | s3c24xx_init_clocks(12000000); | 250 | s3c24xx_init_clocks(12000000); |
250 | s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); | 251 | s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs)); |
252 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
251 | } | 253 | } |
252 | 254 | ||
253 | static void __init hmt_machine_init(void) | 255 | static void __init hmt_machine_init(void) |
@@ -275,6 +277,6 @@ MACHINE_START(HMT, "Airgoo-HMT") | |||
275 | .map_io = hmt_map_io, | 277 | .map_io = hmt_map_io, |
276 | .init_machine = hmt_machine_init, | 278 | .init_machine = hmt_machine_init, |
277 | .init_late = s3c64xx_init_late, | 279 | .init_late = s3c64xx_init_late, |
278 | .init_time = s3c24xx_timer_init, | 280 | .init_time = samsung_timer_init, |
279 | .restart = s3c64xx_restart, | 281 | .restart = s3c64xx_restart, |
280 | MACHINE_END | 282 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c index 4b41fcdaa7b6..fc043e3ecdf8 100644 --- a/arch/arm/mach-s3c64xx/mach-mini6410.c +++ b/arch/arm/mach-s3c64xx/mach-mini6410.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | #include <video/platform_lcd.h> | 42 | #include <video/platform_lcd.h> |
43 | #include <video/samsung_fimd.h> | 43 | #include <video/samsung_fimd.h> |
44 | #include <plat/samsung-time.h> | ||
44 | 45 | ||
45 | #include "common.h" | 46 | #include "common.h" |
46 | #include "regs-modem.h" | 47 | #include "regs-modem.h" |
@@ -232,6 +233,7 @@ static void __init mini6410_map_io(void) | |||
232 | s3c64xx_init_io(NULL, 0); | 233 | s3c64xx_init_io(NULL, 0); |
233 | s3c24xx_init_clocks(12000000); | 234 | s3c24xx_init_clocks(12000000); |
234 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); | 235 | s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); |
236 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
235 | 237 | ||
236 | /* set the LCD type */ | 238 | /* set the LCD type */ |
237 | tmp = __raw_readl(S3C64XX_SPCON); | 239 | tmp = __raw_readl(S3C64XX_SPCON); |
@@ -354,6 +356,6 @@ MACHINE_START(MINI6410, "MINI6410") | |||
354 | .map_io = mini6410_map_io, | 356 | .map_io = mini6410_map_io, |
355 | .init_machine = mini6410_machine_init, | 357 | .init_machine = mini6410_machine_init, |
356 | .init_late = s3c64xx_init_late, | 358 | .init_late = s3c64xx_init_late, |
357 | .init_time = s3c24xx_timer_init, | 359 | .init_time = samsung_timer_init, |
358 | .restart = s3c64xx_restart, | 360 | .restart = s3c64xx_restart, |
359 | MACHINE_END | 361 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c index 8d3cedd995ff..7e2c3908f1f8 100644 --- a/arch/arm/mach-s3c64xx/mach-ncp.c +++ b/arch/arm/mach-s3c64xx/mach-ncp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <plat/clock.h> | 43 | #include <plat/clock.h> |
44 | #include <plat/devs.h> | 44 | #include <plat/devs.h> |
45 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
46 | #include <plat/samsung-time.h> | ||
46 | 47 | ||
47 | #include "common.h" | 48 | #include "common.h" |
48 | 49 | ||
@@ -87,6 +88,7 @@ static void __init ncp_map_io(void) | |||
87 | s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); | 88 | s3c64xx_init_io(ncp_iodesc, ARRAY_SIZE(ncp_iodesc)); |
88 | s3c24xx_init_clocks(12000000); | 89 | s3c24xx_init_clocks(12000000); |
89 | s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); | 90 | s3c24xx_init_uarts(ncp_uartcfgs, ARRAY_SIZE(ncp_uartcfgs)); |
91 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | static void __init ncp_machine_init(void) | 94 | static void __init ncp_machine_init(void) |
@@ -103,6 +105,6 @@ MACHINE_START(NCP, "NCP") | |||
103 | .map_io = ncp_map_io, | 105 | .map_io = ncp_map_io, |
104 | .init_machine = ncp_machine_init, | 106 | .init_machine = ncp_machine_init, |
105 | .init_late = s3c64xx_init_late, | 107 | .init_late = s3c64xx_init_late, |
106 | .init_time = s3c24xx_timer_init, | 108 | .init_time = samsung_timer_init, |
107 | .restart = s3c64xx_restart, | 109 | .restart = s3c64xx_restart, |
108 | MACHINE_END | 110 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c index fa12bd21ad82..8bed37b3d5ac 100644 --- a/arch/arm/mach-s3c64xx/mach-real6410.c +++ b/arch/arm/mach-s3c64xx/mach-real6410.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #include <video/platform_lcd.h> | 43 | #include <video/platform_lcd.h> |
44 | #include <video/samsung_fimd.h> | 44 | #include <video/samsung_fimd.h> |
45 | #include <plat/samsung-time.h> | ||
45 | 46 | ||
46 | #include "common.h" | 47 | #include "common.h" |
47 | #include "regs-modem.h" | 48 | #include "regs-modem.h" |
@@ -211,6 +212,7 @@ static void __init real6410_map_io(void) | |||
211 | s3c64xx_init_io(NULL, 0); | 212 | s3c64xx_init_io(NULL, 0); |
212 | s3c24xx_init_clocks(12000000); | 213 | s3c24xx_init_clocks(12000000); |
213 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); | 214 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); |
215 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
214 | 216 | ||
215 | /* set the LCD type */ | 217 | /* set the LCD type */ |
216 | tmp = __raw_readl(S3C64XX_SPCON); | 218 | tmp = __raw_readl(S3C64XX_SPCON); |
@@ -333,6 +335,6 @@ MACHINE_START(REAL6410, "REAL6410") | |||
333 | .map_io = real6410_map_io, | 335 | .map_io = real6410_map_io, |
334 | .init_machine = real6410_machine_init, | 336 | .init_machine = real6410_machine_init, |
335 | .init_late = s3c64xx_init_late, | 337 | .init_late = s3c64xx_init_late, |
336 | .init_time = s3c24xx_timer_init, | 338 | .init_time = samsung_timer_init, |
337 | .restart = s3c64xx_restart, | 339 | .restart = s3c64xx_restart, |
338 | MACHINE_END | 340 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index fc3e9b32e26f..58ac99041274 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/platform_data/touchscreen-s3c2410.h> | 38 | #include <linux/platform_data/touchscreen-s3c2410.h> |
39 | 39 | ||
40 | #include <video/platform_lcd.h> | 40 | #include <video/platform_lcd.h> |
41 | #include <plat/samsung-time.h> | ||
41 | 42 | ||
42 | #include "common.h" | 43 | #include "common.h" |
43 | #include "regs-modem.h" | 44 | #include "regs-modem.h" |
@@ -378,6 +379,7 @@ void __init smartq_map_io(void) | |||
378 | s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); | 379 | s3c64xx_init_io(smartq_iodesc, ARRAY_SIZE(smartq_iodesc)); |
379 | s3c24xx_init_clocks(12000000); | 380 | s3c24xx_init_clocks(12000000); |
380 | s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); | 381 | s3c24xx_init_uarts(smartq_uartcfgs, ARRAY_SIZE(smartq_uartcfgs)); |
382 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
381 | 383 | ||
382 | smartq_lcd_mode_set(); | 384 | smartq_lcd_mode_set(); |
383 | } | 385 | } |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c index ca2afcfce573..8aca5daf3d05 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq5.c +++ b/arch/arm/mach-s3c64xx/mach-smartq5.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <plat/devs.h> | 28 | #include <plat/devs.h> |
29 | #include <plat/fb.h> | 29 | #include <plat/fb.h> |
30 | #include <plat/gpio-cfg.h> | 30 | #include <plat/gpio-cfg.h> |
31 | #include <plat/samsung-time.h> | ||
31 | 32 | ||
32 | #include "common.h" | 33 | #include "common.h" |
33 | #include "mach-smartq.h" | 34 | #include "mach-smartq.h" |
@@ -155,6 +156,6 @@ MACHINE_START(SMARTQ5, "SmartQ 5") | |||
155 | .map_io = smartq_map_io, | 156 | .map_io = smartq_map_io, |
156 | .init_machine = smartq5_machine_init, | 157 | .init_machine = smartq5_machine_init, |
157 | .init_late = s3c64xx_init_late, | 158 | .init_late = s3c64xx_init_late, |
158 | .init_time = s3c24xx_timer_init, | 159 | .init_time = samsung_timer_init, |
159 | .restart = s3c64xx_restart, | 160 | .restart = s3c64xx_restart, |
160 | MACHINE_END | 161 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c index 37bb0c632a5e..a052e107c0b4 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq7.c +++ b/arch/arm/mach-s3c64xx/mach-smartq7.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <plat/devs.h> | 28 | #include <plat/devs.h> |
29 | #include <plat/fb.h> | 29 | #include <plat/fb.h> |
30 | #include <plat/gpio-cfg.h> | 30 | #include <plat/gpio-cfg.h> |
31 | #include <plat/samsung-time.h> | ||
31 | 32 | ||
32 | #include "common.h" | 33 | #include "common.h" |
33 | #include "mach-smartq.h" | 34 | #include "mach-smartq.h" |
@@ -171,6 +172,6 @@ MACHINE_START(SMARTQ7, "SmartQ 7") | |||
171 | .map_io = smartq_map_io, | 172 | .map_io = smartq_map_io, |
172 | .init_machine = smartq7_machine_init, | 173 | .init_machine = smartq7_machine_init, |
173 | .init_late = s3c64xx_init_late, | 174 | .init_late = s3c64xx_init_late, |
174 | .init_time = s3c24xx_timer_init, | 175 | .init_time = samsung_timer_init, |
175 | .restart = s3c64xx_restart, | 176 | .restart = s3c64xx_restart, |
176 | MACHINE_END | 177 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c index a392869c8342..d70c0843aea2 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6400.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <plat/devs.h> | 35 | #include <plat/devs.h> |
36 | #include <plat/cpu.h> | 36 | #include <plat/cpu.h> |
37 | #include <linux/platform_data/i2c-s3c2410.h> | 37 | #include <linux/platform_data/i2c-s3c2410.h> |
38 | #include <plat/samsung-time.h> | ||
38 | 39 | ||
39 | #include "common.h" | 40 | #include "common.h" |
40 | 41 | ||
@@ -66,6 +67,7 @@ static void __init smdk6400_map_io(void) | |||
66 | s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); | 67 | s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc)); |
67 | s3c24xx_init_clocks(12000000); | 68 | s3c24xx_init_clocks(12000000); |
68 | s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); | 69 | s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs)); |
70 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
69 | } | 71 | } |
70 | 72 | ||
71 | static struct platform_device *smdk6400_devices[] __initdata = { | 73 | static struct platform_device *smdk6400_devices[] __initdata = { |
@@ -92,6 +94,6 @@ MACHINE_START(SMDK6400, "SMDK6400") | |||
92 | .map_io = smdk6400_map_io, | 94 | .map_io = smdk6400_map_io, |
93 | .init_machine = smdk6400_machine_init, | 95 | .init_machine = smdk6400_machine_init, |
94 | .init_late = s3c64xx_init_late, | 96 | .init_late = s3c64xx_init_late, |
95 | .init_time = s3c24xx_timer_init, | 97 | .init_time = samsung_timer_init, |
96 | .restart = s3c64xx_restart, | 98 | .restart = s3c64xx_restart, |
97 | MACHINE_END | 99 | MACHINE_END |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index ba7544e2d04d..bd3295a19ad7 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/platform_data/touchscreen-s3c2410.h> | 69 | #include <linux/platform_data/touchscreen-s3c2410.h> |
70 | #include <plat/keypad.h> | 70 | #include <plat/keypad.h> |
71 | #include <plat/backlight.h> | 71 | #include <plat/backlight.h> |
72 | #include <plat/samsung-time.h> | ||
72 | 73 | ||
73 | #include "common.h" | 74 | #include "common.h" |
74 | #include "regs-modem.h" | 75 | #include "regs-modem.h" |
@@ -634,6 +635,7 @@ static void __init smdk6410_map_io(void) | |||
634 | s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); | 635 | s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); |
635 | s3c24xx_init_clocks(12000000); | 636 | s3c24xx_init_clocks(12000000); |
636 | s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); | 637 | s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); |
638 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
637 | 639 | ||
638 | /* set the LCD type */ | 640 | /* set the LCD type */ |
639 | 641 | ||
@@ -702,6 +704,6 @@ MACHINE_START(SMDK6410, "SMDK6410") | |||
702 | .map_io = smdk6410_map_io, | 704 | .map_io = smdk6410_map_io, |
703 | .init_machine = smdk6410_machine_init, | 705 | .init_machine = smdk6410_machine_init, |
704 | .init_late = s3c64xx_init_late, | 706 | .init_late = s3c64xx_init_late, |
705 | .init_time = s3c24xx_timer_init, | 707 | .init_time = samsung_timer_init, |
706 | .restart = s3c64xx_restart, | 708 | .restart = s3c64xx_restart, |
707 | MACHINE_END | 709 | MACHINE_END |
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig index e8742cb7ddd9..5a707bdb9ea0 100644 --- a/arch/arm/mach-s5p64x0/Kconfig +++ b/arch/arm/mach-s5p64x0/Kconfig | |||
@@ -9,16 +9,16 @@ if ARCH_S5P64X0 | |||
9 | 9 | ||
10 | config CPU_S5P6440 | 10 | config CPU_S5P6440 |
11 | bool | 11 | bool |
12 | select S5P_HRT | ||
13 | select S5P_SLEEP if PM | 12 | select S5P_SLEEP if PM |
14 | select SAMSUNG_DMADEV | 13 | select SAMSUNG_DMADEV |
14 | select SAMSUNG_HRT | ||
15 | select SAMSUNG_WAKEMASK if PM | 15 | select SAMSUNG_WAKEMASK if PM |
16 | help | 16 | help |
17 | Enable S5P6440 CPU support | 17 | Enable S5P6440 CPU support |
18 | 18 | ||
19 | config CPU_S5P6450 | 19 | config CPU_S5P6450 |
20 | bool | 20 | bool |
21 | select S5P_HRT | 21 | select SAMSUNG_HRT |
22 | select S5P_SLEEP if PM | 22 | select S5P_SLEEP if PM |
23 | select SAMSUNG_DMADEV | 23 | select SAMSUNG_DMADEV |
24 | select SAMSUNG_WAKEMASK if PM | 24 | select SAMSUNG_WAKEMASK if PM |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index e23723a5a214..73f71a698a34 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <plat/pll.h> | 48 | #include <plat/pll.h> |
49 | #include <plat/adc.h> | 49 | #include <plat/adc.h> |
50 | #include <linux/platform_data/touchscreen-s3c2410.h> | 50 | #include <linux/platform_data/touchscreen-s3c2410.h> |
51 | #include <plat/s5p-time.h> | 51 | #include <plat/samsung-time.h> |
52 | #include <plat/backlight.h> | 52 | #include <plat/backlight.h> |
53 | #include <plat/fb.h> | 53 | #include <plat/fb.h> |
54 | #include <plat/sdhci.h> | 54 | #include <plat/sdhci.h> |
@@ -229,7 +229,7 @@ static void __init smdk6440_map_io(void) | |||
229 | s5p64x0_init_io(NULL, 0); | 229 | s5p64x0_init_io(NULL, 0); |
230 | s3c24xx_init_clocks(12000000); | 230 | s3c24xx_init_clocks(12000000); |
231 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); | 231 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); |
232 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 232 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
233 | } | 233 | } |
234 | 234 | ||
235 | static void s5p6440_set_lcd_interface(void) | 235 | static void s5p6440_set_lcd_interface(void) |
@@ -273,6 +273,6 @@ MACHINE_START(SMDK6440, "SMDK6440") | |||
273 | .init_irq = s5p6440_init_irq, | 273 | .init_irq = s5p6440_init_irq, |
274 | .map_io = smdk6440_map_io, | 274 | .map_io = smdk6440_map_io, |
275 | .init_machine = smdk6440_machine_init, | 275 | .init_machine = smdk6440_machine_init, |
276 | .init_time = s5p_timer_init, | 276 | .init_time = samsung_timer_init, |
277 | .restart = s5p64x0_restart, | 277 | .restart = s5p64x0_restart, |
278 | MACHINE_END | 278 | MACHINE_END |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index ca10963a959e..18303e12019f 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <plat/pll.h> | 48 | #include <plat/pll.h> |
49 | #include <plat/adc.h> | 49 | #include <plat/adc.h> |
50 | #include <linux/platform_data/touchscreen-s3c2410.h> | 50 | #include <linux/platform_data/touchscreen-s3c2410.h> |
51 | #include <plat/s5p-time.h> | 51 | #include <plat/samsung-time.h> |
52 | #include <plat/backlight.h> | 52 | #include <plat/backlight.h> |
53 | #include <plat/fb.h> | 53 | #include <plat/fb.h> |
54 | #include <plat/sdhci.h> | 54 | #include <plat/sdhci.h> |
@@ -248,7 +248,7 @@ static void __init smdk6450_map_io(void) | |||
248 | s5p64x0_init_io(NULL, 0); | 248 | s5p64x0_init_io(NULL, 0); |
249 | s3c24xx_init_clocks(19200000); | 249 | s3c24xx_init_clocks(19200000); |
250 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); | 250 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); |
251 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 251 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
252 | } | 252 | } |
253 | 253 | ||
254 | static void s5p6450_set_lcd_interface(void) | 254 | static void s5p6450_set_lcd_interface(void) |
@@ -292,6 +292,6 @@ MACHINE_START(SMDK6450, "SMDK6450") | |||
292 | .init_irq = s5p6450_init_irq, | 292 | .init_irq = s5p6450_init_irq, |
293 | .map_io = smdk6450_map_io, | 293 | .map_io = smdk6450_map_io, |
294 | .init_machine = smdk6450_machine_init, | 294 | .init_machine = smdk6450_machine_init, |
295 | .init_time = s5p_timer_init, | 295 | .init_time = samsung_timer_init, |
296 | .restart = s5p64x0_restart, | 296 | .restart = s5p64x0_restart, |
297 | MACHINE_END | 297 | MACHINE_END |
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index 15170be97a74..2f456a4533ba 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -11,6 +11,7 @@ config CPU_S5PC100 | |||
11 | bool | 11 | bool |
12 | select S5P_EXT_INT | 12 | select S5P_EXT_INT |
13 | select SAMSUNG_DMADEV | 13 | select SAMSUNG_DMADEV |
14 | select SAMSUNG_HRT | ||
14 | help | 15 | help |
15 | Enable S5PC100 CPU support | 16 | Enable S5PC100 CPU support |
16 | 17 | ||
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c index 185a19583898..8c880f76f274 100644 --- a/arch/arm/mach-s5pc100/mach-smdkc100.c +++ b/arch/arm/mach-s5pc100/mach-smdkc100.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/platform_data/touchscreen-s3c2410.h> | 51 | #include <linux/platform_data/touchscreen-s3c2410.h> |
52 | #include <linux/platform_data/asoc-s3c.h> | 52 | #include <linux/platform_data/asoc-s3c.h> |
53 | #include <plat/backlight.h> | 53 | #include <plat/backlight.h> |
54 | #include <plat/samsung-time.h> | ||
54 | 55 | ||
55 | #include "common.h" | 56 | #include "common.h" |
56 | 57 | ||
@@ -221,6 +222,7 @@ static void __init smdkc100_map_io(void) | |||
221 | s5pc100_init_io(NULL, 0); | 222 | s5pc100_init_io(NULL, 0); |
222 | s3c24xx_init_clocks(12000000); | 223 | s3c24xx_init_clocks(12000000); |
223 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); | 224 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); |
225 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); | ||
224 | } | 226 | } |
225 | 227 | ||
226 | static void __init smdkc100_machine_init(void) | 228 | static void __init smdkc100_machine_init(void) |
@@ -255,6 +257,6 @@ MACHINE_START(SMDKC100, "SMDKC100") | |||
255 | .init_irq = s5pc100_init_irq, | 257 | .init_irq = s5pc100_init_irq, |
256 | .map_io = smdkc100_map_io, | 258 | .map_io = smdkc100_map_io, |
257 | .init_machine = smdkc100_machine_init, | 259 | .init_machine = smdkc100_machine_init, |
258 | .init_time = s3c24xx_timer_init, | 260 | .init_time = samsung_timer_init, |
259 | .restart = s5pc100_restart, | 261 | .restart = s5pc100_restart, |
260 | MACHINE_END | 262 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 92ad72f0ef98..0963283a7c5d 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig | |||
@@ -12,10 +12,10 @@ if ARCH_S5PV210 | |||
12 | config CPU_S5PV210 | 12 | config CPU_S5PV210 |
13 | bool | 13 | bool |
14 | select S5P_EXT_INT | 14 | select S5P_EXT_INT |
15 | select S5P_HRT | ||
16 | select S5P_PM if PM | 15 | select S5P_PM if PM |
17 | select S5P_SLEEP if PM | 16 | select S5P_SLEEP if PM |
18 | select SAMSUNG_DMADEV | 17 | select SAMSUNG_DMADEV |
18 | select SAMSUNG_HRT | ||
19 | help | 19 | help |
20 | Enable S5PV210 CPU support | 20 | Enable S5PV210 CPU support |
21 | 21 | ||
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 11900a8e88a3..ed2b85485b9d 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include <plat/fb.h> | 38 | #include <plat/fb.h> |
39 | #include <plat/fimc-core.h> | 39 | #include <plat/fimc-core.h> |
40 | #include <plat/sdhci.h> | 40 | #include <plat/sdhci.h> |
41 | #include <plat/s5p-time.h> | 41 | #include <plat/samsung-time.h> |
42 | 42 | ||
43 | #include "common.h" | 43 | #include "common.h" |
44 | 44 | ||
@@ -651,7 +651,7 @@ static void __init aquila_map_io(void) | |||
651 | s5pv210_init_io(NULL, 0); | 651 | s5pv210_init_io(NULL, 0); |
652 | s3c24xx_init_clocks(24000000); | 652 | s3c24xx_init_clocks(24000000); |
653 | s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); | 653 | s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs)); |
654 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 654 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
655 | } | 655 | } |
656 | 656 | ||
657 | static void __init aquila_machine_init(void) | 657 | static void __init aquila_machine_init(void) |
@@ -686,6 +686,6 @@ MACHINE_START(AQUILA, "Aquila") | |||
686 | .init_irq = s5pv210_init_irq, | 686 | .init_irq = s5pv210_init_irq, |
687 | .map_io = aquila_map_io, | 687 | .map_io = aquila_map_io, |
688 | .init_machine = aquila_machine_init, | 688 | .init_machine = aquila_machine_init, |
689 | .init_time = s5p_timer_init, | 689 | .init_time = samsung_timer_init, |
690 | .restart = s5pv210_restart, | 690 | .restart = s5pv210_restart, |
691 | MACHINE_END | 691 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index e373de44a8b6..30b24ad84f49 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <plat/keypad.h> | 47 | #include <plat/keypad.h> |
48 | #include <plat/sdhci.h> | 48 | #include <plat/sdhci.h> |
49 | #include <plat/clock.h> | 49 | #include <plat/clock.h> |
50 | #include <plat/s5p-time.h> | 50 | #include <plat/samsung-time.h> |
51 | #include <plat/mfc.h> | 51 | #include <plat/mfc.h> |
52 | #include <plat/camport.h> | 52 | #include <plat/camport.h> |
53 | 53 | ||
@@ -908,7 +908,7 @@ static void __init goni_map_io(void) | |||
908 | s5pv210_init_io(NULL, 0); | 908 | s5pv210_init_io(NULL, 0); |
909 | s3c24xx_init_clocks(clk_xusbxti.rate); | 909 | s3c24xx_init_clocks(clk_xusbxti.rate); |
910 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); | 910 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); |
911 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 911 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
912 | } | 912 | } |
913 | 913 | ||
914 | static void __init goni_reserve(void) | 914 | static void __init goni_reserve(void) |
@@ -973,7 +973,7 @@ MACHINE_START(GONI, "GONI") | |||
973 | .init_irq = s5pv210_init_irq, | 973 | .init_irq = s5pv210_init_irq, |
974 | .map_io = goni_map_io, | 974 | .map_io = goni_map_io, |
975 | .init_machine = goni_machine_init, | 975 | .init_machine = goni_machine_init, |
976 | .init_time = s5p_timer_init, | 976 | .init_time = samsung_timer_init, |
977 | .reserve = &goni_reserve, | 977 | .reserve = &goni_reserve, |
978 | .restart = s5pv210_restart, | 978 | .restart = s5pv210_restart, |
979 | MACHINE_END | 979 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c index 28bd0248a3e2..7c0ed07a78a3 100644 --- a/arch/arm/mach-s5pv210/mach-smdkc110.c +++ b/arch/arm/mach-s5pv210/mach-smdkc110.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/platform_data/ata-samsung_cf.h> | 29 | #include <linux/platform_data/ata-samsung_cf.h> |
30 | #include <linux/platform_data/i2c-s3c2410.h> | 30 | #include <linux/platform_data/i2c-s3c2410.h> |
31 | #include <plat/pm.h> | 31 | #include <plat/pm.h> |
32 | #include <plat/s5p-time.h> | 32 | #include <plat/samsung-time.h> |
33 | #include <plat/mfc.h> | 33 | #include <plat/mfc.h> |
34 | 34 | ||
35 | #include "common.h" | 35 | #include "common.h" |
@@ -120,7 +120,7 @@ static void __init smdkc110_map_io(void) | |||
120 | s5pv210_init_io(NULL, 0); | 120 | s5pv210_init_io(NULL, 0); |
121 | s3c24xx_init_clocks(24000000); | 121 | s3c24xx_init_clocks(24000000); |
122 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); | 122 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); |
123 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 123 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void __init smdkc110_reserve(void) | 126 | static void __init smdkc110_reserve(void) |
@@ -153,7 +153,7 @@ MACHINE_START(SMDKC110, "SMDKC110") | |||
153 | .init_irq = s5pv210_init_irq, | 153 | .init_irq = s5pv210_init_irq, |
154 | .map_io = smdkc110_map_io, | 154 | .map_io = smdkc110_map_io, |
155 | .init_machine = smdkc110_machine_init, | 155 | .init_machine = smdkc110_machine_init, |
156 | .init_time = s5p_timer_init, | 156 | .init_time = samsung_timer_init, |
157 | .restart = s5pv210_restart, | 157 | .restart = s5pv210_restart, |
158 | .reserve = &smdkc110_reserve, | 158 | .reserve = &smdkc110_reserve, |
159 | MACHINE_END | 159 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c index 3c73f36869bb..d50b6f124465 100644 --- a/arch/arm/mach-s5pv210/mach-smdkv210.c +++ b/arch/arm/mach-s5pv210/mach-smdkv210.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <plat/keypad.h> | 44 | #include <plat/keypad.h> |
45 | #include <plat/pm.h> | 45 | #include <plat/pm.h> |
46 | #include <plat/fb.h> | 46 | #include <plat/fb.h> |
47 | #include <plat/s5p-time.h> | 47 | #include <plat/samsung-time.h> |
48 | #include <plat/backlight.h> | 48 | #include <plat/backlight.h> |
49 | #include <plat/mfc.h> | 49 | #include <plat/mfc.h> |
50 | #include <plat/clock.h> | 50 | #include <plat/clock.h> |
@@ -285,7 +285,7 @@ static void __init smdkv210_map_io(void) | |||
285 | s5pv210_init_io(NULL, 0); | 285 | s5pv210_init_io(NULL, 0); |
286 | s3c24xx_init_clocks(clk_xusbxti.rate); | 286 | s3c24xx_init_clocks(clk_xusbxti.rate); |
287 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); | 287 | s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs)); |
288 | s5p_set_timer_source(S5P_PWM2, S5P_PWM4); | 288 | samsung_set_timer_source(SAMSUNG_PWM2, SAMSUNG_PWM4); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void __init smdkv210_reserve(void) | 291 | static void __init smdkv210_reserve(void) |
@@ -329,7 +329,7 @@ MACHINE_START(SMDKV210, "SMDKV210") | |||
329 | .init_irq = s5pv210_init_irq, | 329 | .init_irq = s5pv210_init_irq, |
330 | .map_io = smdkv210_map_io, | 330 | .map_io = smdkv210_map_io, |
331 | .init_machine = smdkv210_machine_init, | 331 | .init_machine = smdkv210_machine_init, |
332 | .init_time = s5p_timer_init, | 332 | .init_time = samsung_timer_init, |
333 | .restart = s5pv210_restart, | 333 | .restart = s5pv210_restart, |
334 | .reserve = &smdkv210_reserve, | 334 | .reserve = &smdkv210_reserve, |
335 | MACHINE_END | 335 | MACHINE_END |
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c index 2d4c5531819c..579afe89842a 100644 --- a/arch/arm/mach-s5pv210/mach-torbreck.c +++ b/arch/arm/mach-s5pv210/mach-torbreck.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <plat/devs.h> | 26 | #include <plat/devs.h> |
27 | #include <plat/cpu.h> | 27 | #include <plat/cpu.h> |
28 | #include <linux/platform_data/i2c-s3c2410.h> | 28 | #include <linux/platform_data/i2c-s3c2410.h> |
29 | #include <plat/s5p-time.h> | 29 | #include <plat/samsung-time.h> |
30 | 30 | ||
31 | #include "common.h" | 31 | #include "common.h" |
32 | 32 | ||
@@ -106,7 +106,7 @@ static void __init torbreck_map_io(void) | |||
106 | s5pv210_init_io(NULL, 0); | 106 | s5pv210_init_io(NULL, 0); |
107 | s3c24xx_init_clocks(24000000); | 107 | s3c24xx_init_clocks(24000000); |
108 | s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); | 108 | s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs)); |
109 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 109 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void __init torbreck_machine_init(void) | 112 | static void __init torbreck_machine_init(void) |
@@ -130,6 +130,6 @@ MACHINE_START(TORBRECK, "TORBRECK") | |||
130 | .init_irq = s5pv210_init_irq, | 130 | .init_irq = s5pv210_init_irq, |
131 | .map_io = torbreck_map_io, | 131 | .map_io = torbreck_map_io, |
132 | .init_machine = torbreck_machine_init, | 132 | .init_machine = torbreck_machine_init, |
133 | .init_time = s5p_timer_init, | 133 | .init_time = samsung_timer_init, |
134 | .restart = s5pv210_restart, | 134 | .restart = s5pv210_restart, |
135 | MACHINE_END | 135 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 9255546e7bf6..75d413c004b6 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -16,6 +16,7 @@ config ARCH_SH73A0 | |||
16 | select CPU_V7 | 16 | select CPU_V7 |
17 | select I2C | 17 | select I2C |
18 | select SH_CLK_CPG | 18 | select SH_CLK_CPG |
19 | select RENESAS_INTC_IRQPIN | ||
19 | 20 | ||
20 | config ARCH_R8A7740 | 21 | config ARCH_R8A7740 |
21 | bool "R-Mobile A1 (R8A77400)" | 22 | bool "R-Mobile A1 (R8A77400)" |
@@ -31,6 +32,7 @@ config ARCH_R8A7779 | |||
31 | select SH_CLK_CPG | 32 | select SH_CLK_CPG |
32 | select USB_ARCH_HAS_EHCI | 33 | select USB_ARCH_HAS_EHCI |
33 | select USB_ARCH_HAS_OHCI | 34 | select USB_ARCH_HAS_OHCI |
35 | select RENESAS_INTC_IRQPIN | ||
34 | 36 | ||
35 | config ARCH_EMEV2 | 37 | config ARCH_EMEV2 |
36 | bool "Emma Mobile EV2" | 38 | bool "Emma Mobile EV2" |
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile index e1fac57514b9..b646ff4d742a 100644 --- a/arch/arm/mach-shmobile/Makefile +++ b/arch/arm/mach-shmobile/Makefile | |||
@@ -14,10 +14,9 @@ obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o clock-emev2.o | |||
14 | 14 | ||
15 | # SMP objects | 15 | # SMP objects |
16 | smp-y := platsmp.o headsmp.o | 16 | smp-y := platsmp.o headsmp.o |
17 | smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 17 | smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o |
18 | smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-sh73a0.o | 18 | smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o |
19 | smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o | 19 | smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o |
20 | smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o | ||
21 | 20 | ||
22 | # IRQ objects | 21 | # IRQ objects |
23 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o | 22 | obj-$(CONFIG_ARCH_SH7372) += entry-intc.o |
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c index c254782aa727..c016ccd92433 100644 --- a/arch/arm/mach-shmobile/board-kzm9d.c +++ b/arch/arm/mach-shmobile/board-kzm9d.c | |||
@@ -90,6 +90,5 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d") | |||
90 | .init_irq = emev2_init_irq, | 90 | .init_irq = emev2_init_irq, |
91 | .init_machine = kzm9d_add_standard_devices, | 91 | .init_machine = kzm9d_add_standard_devices, |
92 | .init_late = shmobile_init_late, | 92 | .init_late = shmobile_init_late, |
93 | .init_time = shmobile_timer_init, | ||
94 | .dt_compat = kzm9d_boards_compat_dt, | 93 | .dt_compat = kzm9d_boards_compat_dt, |
95 | MACHINE_END | 94 | MACHINE_END |
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 7f3a6b7e7b7c..d34d12ae496b 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -81,7 +81,7 @@ static struct resource smsc9221_resources[] = { | |||
81 | .flags = IORESOURCE_MEM, | 81 | .flags = IORESOURCE_MEM, |
82 | }, | 82 | }, |
83 | [1] = { | 83 | [1] = { |
84 | .start = intcs_evt2irq(0x260), /* IRQ3 */ | 84 | .start = irq_pin(3), /* IRQ3 */ |
85 | .flags = IORESOURCE_IRQ, | 85 | .flags = IORESOURCE_IRQ, |
86 | }, | 86 | }, |
87 | }; | 87 | }; |
@@ -115,7 +115,7 @@ static struct resource usb_resources[] = { | |||
115 | .flags = IORESOURCE_MEM, | 115 | .flags = IORESOURCE_MEM, |
116 | }, | 116 | }, |
117 | [1] = { | 117 | [1] = { |
118 | .start = intcs_evt2irq(0x220), /* IRQ1 */ | 118 | .start = irq_pin(1), /* IRQ1 */ |
119 | .flags = IORESOURCE_IRQ, | 119 | .flags = IORESOURCE_IRQ, |
120 | }, | 120 | }, |
121 | }; | 121 | }; |
@@ -138,7 +138,7 @@ struct usbhs_private { | |||
138 | struct renesas_usbhs_platform_info info; | 138 | struct renesas_usbhs_platform_info info; |
139 | }; | 139 | }; |
140 | 140 | ||
141 | #define IRQ15 intcs_evt2irq(0x03e0) | 141 | #define IRQ15 irq_pin(15) |
142 | #define USB_PHY_MODE (1 << 4) | 142 | #define USB_PHY_MODE (1 << 4) |
143 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) | 143 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) |
144 | #define USB_PHY_ON (1 << 1) | 144 | #define USB_PHY_ON (1 << 1) |
@@ -563,25 +563,25 @@ static struct i2c_board_info i2c0_devices[] = { | |||
563 | }, | 563 | }, |
564 | { | 564 | { |
565 | I2C_BOARD_INFO("ak8975", 0x0c), | 565 | I2C_BOARD_INFO("ak8975", 0x0c), |
566 | .irq = intcs_evt2irq(0x3380), /* IRQ28 */ | 566 | .irq = irq_pin(28), /* IRQ28 */ |
567 | }, | 567 | }, |
568 | { | 568 | { |
569 | I2C_BOARD_INFO("adxl34x", 0x1d), | 569 | I2C_BOARD_INFO("adxl34x", 0x1d), |
570 | .irq = intcs_evt2irq(0x3340), /* IRQ26 */ | 570 | .irq = irq_pin(26), /* IRQ26 */ |
571 | }, | 571 | }, |
572 | }; | 572 | }; |
573 | 573 | ||
574 | static struct i2c_board_info i2c1_devices[] = { | 574 | static struct i2c_board_info i2c1_devices[] = { |
575 | { | 575 | { |
576 | I2C_BOARD_INFO("st1232-ts", 0x55), | 576 | I2C_BOARD_INFO("st1232-ts", 0x55), |
577 | .irq = intcs_evt2irq(0x300), /* IRQ8 */ | 577 | .irq = irq_pin(8), /* IRQ8 */ |
578 | }, | 578 | }, |
579 | }; | 579 | }; |
580 | 580 | ||
581 | static struct i2c_board_info i2c3_devices[] = { | 581 | static struct i2c_board_info i2c3_devices[] = { |
582 | { | 582 | { |
583 | I2C_BOARD_INFO("pcf8575", 0x20), | 583 | I2C_BOARD_INFO("pcf8575", 0x20), |
584 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ | 584 | .irq = irq_pin(19), /* IRQ19 */ |
585 | .platform_data = &pcf8575_pdata, | 585 | .platform_data = &pcf8575_pdata, |
586 | }, | 586 | }, |
587 | }; | 587 | }; |
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c index 19ce885a3b43..1feb9a2286a8 100644 --- a/arch/arm/mach-shmobile/clock-r8a7740.c +++ b/arch/arm/mach-shmobile/clock-r8a7740.c | |||
@@ -593,29 +593,42 @@ static struct clk_lookup lookups[] = { | |||
593 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), | 593 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]), |
594 | 594 | ||
595 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), | 595 | CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), |
596 | CLKDEV_DEV_ID("e6c80000.sci", &mstp_clks[MSTP200]), | ||
596 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), | 597 | CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), |
598 | CLKDEV_DEV_ID("e6c70000.sci", &mstp_clks[MSTP201]), | ||
597 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), | 599 | CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), |
600 | CLKDEV_DEV_ID("e6c60000.sci", &mstp_clks[MSTP202]), | ||
598 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), | 601 | CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), |
602 | CLKDEV_DEV_ID("e6c50000.sci", &mstp_clks[MSTP203]), | ||
599 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), | 603 | CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), |
604 | CLKDEV_DEV_ID("e6c40000.sci", &mstp_clks[MSTP204]), | ||
600 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), | 605 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), |
606 | CLKDEV_DEV_ID("e6c30000.sci", &mstp_clks[MSTP206]), | ||
601 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), | 607 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), |
608 | CLKDEV_DEV_ID("e6cb0000.sci", &mstp_clks[MSTP207]), | ||
602 | CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), | 609 | CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]), |
603 | CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), | 610 | CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]), |
604 | CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), | 611 | CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), |
605 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), | 612 | CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), |
606 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), | 613 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), |
614 | CLKDEV_DEV_ID("e6cd0000.sci", &mstp_clks[MSTP222]), | ||
607 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), | 615 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), |
616 | CLKDEV_DEV_ID("e6cc0000.sci", &mstp_clks[MSTP230]), | ||
608 | 617 | ||
609 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), | 618 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), |
610 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), | 619 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), |
611 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), | 620 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), |
612 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), | 621 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), |
613 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), | 622 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), |
623 | CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]), | ||
614 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), | 624 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), |
625 | CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]), | ||
615 | CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), | 626 | CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), |
627 | CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), | ||
616 | CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), | 628 | CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), |
617 | 629 | ||
618 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), | 630 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), |
631 | CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]), | ||
619 | 632 | ||
620 | /* ICK */ | 633 | /* ICK */ |
621 | CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), | 634 | CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]), |
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c index 1db36537255c..d9edeaf66007 100644 --- a/arch/arm/mach-shmobile/clock-r8a7779.c +++ b/arch/arm/mach-shmobile/clock-r8a7779.c | |||
@@ -87,7 +87,8 @@ static struct clk div4_clks[DIV4_NR] = { | |||
87 | }; | 87 | }; |
88 | 88 | ||
89 | enum { MSTP323, MSTP322, MSTP321, MSTP320, | 89 | enum { MSTP323, MSTP322, MSTP321, MSTP320, |
90 | MSTP101, MSTP100, | 90 | MSTP115, |
91 | MSTP103, MSTP101, MSTP100, | ||
91 | MSTP030, | 92 | MSTP030, |
92 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, | 93 | MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, |
93 | MSTP016, MSTP015, MSTP014, | 94 | MSTP016, MSTP015, MSTP014, |
@@ -99,6 +100,8 @@ static struct clk mstp_clks[MSTP_NR] = { | |||
99 | [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ | 100 | [MSTP322] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 22, 0), /* SDHI1 */ |
100 | [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ | 101 | [MSTP321] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 21, 0), /* SDHI2 */ |
101 | [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ | 102 | [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR3, 20, 0), /* SDHI3 */ |
103 | [MSTP115] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 15, 0), /* SATA */ | ||
104 | [MSTP103] = SH_CLK_MSTP32(&div4_clks[DIV4_S], MSTPCR1, 3, 0), /* DU */ | ||
102 | [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ | 105 | [MSTP101] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 1, 0), /* USB2 */ |
103 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ | 106 | [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR1, 0, 0), /* USB0/1 */ |
104 | [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ | 107 | [MSTP030] = SH_CLK_MSTP32(&div4_clks[DIV4_P], MSTPCR0, 30, 0), /* I2C0 */ |
@@ -156,6 +159,8 @@ static struct clk_lookup lookups[] = { | |||
156 | CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), | 159 | CLKDEV_CON_ID("peripheral_clk", &div4_clks[DIV4_P]), |
157 | 160 | ||
158 | /* MSTP32 clocks */ | 161 | /* MSTP32 clocks */ |
162 | CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ | ||
163 | CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ | ||
159 | CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ | 164 | CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ |
160 | CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ | 165 | CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ |
161 | CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ | 166 | CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ |
@@ -180,6 +185,7 @@ static struct clk_lookup lookups[] = { | |||
180 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ | 185 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ |
181 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ | 186 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ |
182 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ | 187 | CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */ |
188 | CLKDEV_DEV_ID("rcar-du.0", &mstp_clks[MSTP103]), /* DU */ | ||
183 | }; | 189 | }; |
184 | 190 | ||
185 | void __init r8a7779_clock_init(void) | 191 | void __init r8a7779_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index afa5423a0f93..71843dd39e16 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -265,12 +265,12 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2, | |||
265 | 265 | ||
266 | static struct clk div4_clks[DIV4_NR] = { | 266 | static struct clk div4_clks[DIV4_NR] = { |
267 | [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT), | 267 | [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT), |
268 | [DIV4_ZG] = DIV4(FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT), | 268 | [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT), |
269 | [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), | 269 | [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), |
270 | [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT), | 270 | [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT), |
271 | [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0), | 271 | [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0), |
272 | [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0), | 272 | [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0), |
273 | [DIV4_Z] = DIV4(FRQCRB, 24, 0x97f, 0), | 273 | [DIV4_Z] = SH_CLK_DIV4(&pll0_clk, FRQCRB, 24, 0x97f, 0), |
274 | [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0), | 274 | [DIV4_ZTR] = DIV4(FRQCRB, 20, 0xdff, 0), |
275 | [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0), | 275 | [DIV4_ZT] = DIV4(FRQCRB, 16, 0xdff, 0), |
276 | [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0), | 276 | [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0), |
@@ -581,10 +581,13 @@ static struct clk_lookup lookups[] = { | |||
581 | CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ | 581 | CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ |
582 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ | 582 | CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */ |
583 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ | 583 | CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ |
584 | CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]), /* SDHI0 */ | ||
584 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ | 585 | CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ |
586 | CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]), /* SDHI1 */ | ||
585 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ | 587 | CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */ |
586 | CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ | 588 | CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */ |
587 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ | 589 | CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */ |
590 | CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP311]), /* SDHI2 */ | ||
588 | CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ | 591 | CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */ |
589 | CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ | 592 | CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */ |
590 | CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ | 593 | CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */ |
diff --git a/arch/arm/mach-shmobile/headsmp-sh73a0.S b/arch/arm/mach-shmobile/headsmp-scu.S index bec4c0d9b713..7d113f898e7f 100644 --- a/arch/arm/mach-shmobile/headsmp-sh73a0.S +++ b/arch/arm/mach-shmobile/headsmp-scu.S | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * SMP support for SoC sh73a0 | 2 | * Shared SCU setup for mach-shmobile |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Bastian Hecht | 4 | * Copyright (C) 2012 Bastian Hecht |
5 | * | 5 | * |
@@ -35,11 +35,12 @@ | |||
35 | * the physical address as the MMU is still turned off. | 35 | * the physical address as the MMU is still turned off. |
36 | */ | 36 | */ |
37 | .align 12 | 37 | .align 12 |
38 | ENTRY(sh73a0_secondary_vector) | 38 | ENTRY(shmobile_secondary_vector_scu) |
39 | mrc p15, 0, r0, c0, c0, 5 @ read MIPDR | 39 | mrc p15, 0, r0, c0, c0, 5 @ read MIPDR |
40 | and r0, r0, #3 @ mask out cpu ID | 40 | and r0, r0, #3 @ mask out cpu ID |
41 | lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits | 41 | lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits |
42 | mov r1, #0xf0000000 @ SCU base address | 42 | ldr r1, 2f |
43 | ldr r1, [r1] @ SCU base address | ||
43 | ldr r2, [r1, #8] @ SCU Power Status Register | 44 | ldr r2, [r1, #8] @ SCU Power Status Register |
44 | mov r3, #3 | 45 | mov r3, #3 |
45 | bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) | 46 | bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) |
@@ -47,4 +48,10 @@ ENTRY(sh73a0_secondary_vector) | |||
47 | 48 | ||
48 | ldr pc, 1f | 49 | ldr pc, 1f |
49 | 1: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET | 50 | 1: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET |
50 | ENDPROC(sh73a0_secondary_vector) | 51 | 2: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET |
52 | ENDPROC(shmobile_secondary_vector_scu) | ||
53 | |||
54 | .text | ||
55 | .globl shmobile_scu_base | ||
56 | shmobile_scu_base: | ||
57 | .space 4 | ||
diff --git a/arch/arm/mach-shmobile/hotplug.c b/arch/arm/mach-shmobile/hotplug.c deleted file mode 100644 index a1524e3367b0..000000000000 --- a/arch/arm/mach-shmobile/hotplug.c +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | /* | ||
2 | * SMP support for R-Mobile / SH-Mobile | ||
3 | * | ||
4 | * Copyright (C) 2010 Magnus Damm | ||
5 | * | ||
6 | * Based on realview, Copyright (C) 2002 ARM Ltd, All Rights Reserved | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/smp.h> | ||
15 | #include <linux/cpumask.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/of.h> | ||
18 | #include <mach/common.h> | ||
19 | #include <mach/r8a7779.h> | ||
20 | #include <mach/emev2.h> | ||
21 | #include <asm/cacheflush.h> | ||
22 | #include <asm/mach-types.h> | ||
23 | |||
24 | static cpumask_t dead_cpus; | ||
25 | |||
26 | void shmobile_cpu_die(unsigned int cpu) | ||
27 | { | ||
28 | /* hardware shutdown code running on the CPU that is being offlined */ | ||
29 | flush_cache_all(); | ||
30 | dsb(); | ||
31 | |||
32 | /* notify platform_cpu_kill() that hardware shutdown is finished */ | ||
33 | cpumask_set_cpu(cpu, &dead_cpus); | ||
34 | |||
35 | /* wait for SoC code in platform_cpu_kill() to shut off CPU core | ||
36 | * power. CPU bring up starts from the reset vector. | ||
37 | */ | ||
38 | while (1) { | ||
39 | /* | ||
40 | * here's the WFI | ||
41 | */ | ||
42 | asm(".word 0xe320f003\n" | ||
43 | : | ||
44 | : | ||
45 | : "memory", "cc"); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | int shmobile_cpu_disable(unsigned int cpu) | ||
50 | { | ||
51 | cpumask_clear_cpu(cpu, &dead_cpus); | ||
52 | /* | ||
53 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
54 | * e.g. clock tick interrupts) | ||
55 | */ | ||
56 | return cpu == 0 ? -EPERM : 0; | ||
57 | } | ||
58 | |||
59 | int shmobile_cpu_disable_any(unsigned int cpu) | ||
60 | { | ||
61 | cpumask_clear_cpu(cpu, &dead_cpus); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | int shmobile_cpu_is_dead(unsigned int cpu) | ||
66 | { | ||
67 | return cpumask_test_cpu(cpu, &dead_cpus); | ||
68 | } | ||
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index e48606d8a2be..03f73def2fc6 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -8,6 +8,7 @@ extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, | |||
8 | struct twd_local_timer; | 8 | struct twd_local_timer; |
9 | extern void shmobile_setup_console(void); | 9 | extern void shmobile_setup_console(void); |
10 | extern void shmobile_secondary_vector(void); | 10 | extern void shmobile_secondary_vector(void); |
11 | extern void shmobile_secondary_vector_scu(void); | ||
11 | struct clk; | 12 | struct clk; |
12 | extern int shmobile_clk_init(void); | 13 | extern int shmobile_clk_init(void); |
13 | extern void shmobile_handle_irq_intc(struct pt_regs *); | 14 | extern void shmobile_handle_irq_intc(struct pt_regs *); |
@@ -33,23 +34,23 @@ extern int sh7372_do_idle_sysc(unsigned long sleep_mode); | |||
33 | extern struct clk sh7372_extal1_clk; | 34 | extern struct clk sh7372_extal1_clk; |
34 | extern struct clk sh7372_extal2_clk; | 35 | extern struct clk sh7372_extal2_clk; |
35 | 36 | ||
37 | extern void sh73a0_init_delay(void); | ||
36 | extern void sh73a0_init_irq(void); | 38 | extern void sh73a0_init_irq(void); |
37 | extern void sh73a0_init_irq_dt(void); | 39 | extern void sh73a0_init_irq_dt(void); |
38 | extern void sh73a0_map_io(void); | 40 | extern void sh73a0_map_io(void); |
39 | extern void sh73a0_earlytimer_init(void); | 41 | extern void sh73a0_earlytimer_init(void); |
40 | extern void sh73a0_add_early_devices(void); | 42 | extern void sh73a0_add_early_devices(void); |
41 | extern void sh73a0_add_early_devices_dt(void); | ||
42 | extern void sh73a0_add_standard_devices(void); | 43 | extern void sh73a0_add_standard_devices(void); |
43 | extern void sh73a0_add_standard_devices_dt(void); | 44 | extern void sh73a0_add_standard_devices_dt(void); |
44 | extern void sh73a0_clock_init(void); | 45 | extern void sh73a0_clock_init(void); |
45 | extern void sh73a0_pinmux_init(void); | 46 | extern void sh73a0_pinmux_init(void); |
46 | extern void sh73a0_pm_init(void); | 47 | extern void sh73a0_pm_init(void); |
47 | extern void sh73a0_secondary_vector(void); | ||
48 | extern struct clk sh73a0_extal1_clk; | 48 | extern struct clk sh73a0_extal1_clk; |
49 | extern struct clk sh73a0_extal2_clk; | 49 | extern struct clk sh73a0_extal2_clk; |
50 | extern struct clk sh73a0_extcki_clk; | 50 | extern struct clk sh73a0_extcki_clk; |
51 | extern struct clk sh73a0_extalr_clk; | 51 | extern struct clk sh73a0_extalr_clk; |
52 | 52 | ||
53 | extern void r8a7740_meram_workaround(void); | ||
53 | extern void r8a7740_init_irq(void); | 54 | extern void r8a7740_init_irq(void); |
54 | extern void r8a7740_map_io(void); | 55 | extern void r8a7740_map_io(void); |
55 | extern void r8a7740_add_early_devices(void); | 56 | extern void r8a7740_add_early_devices(void); |
@@ -58,16 +59,18 @@ extern void r8a7740_clock_init(u8 md_ck); | |||
58 | extern void r8a7740_pinmux_init(void); | 59 | extern void r8a7740_pinmux_init(void); |
59 | extern void r8a7740_pm_init(void); | 60 | extern void r8a7740_pm_init(void); |
60 | 61 | ||
62 | extern void r8a7779_init_delay(void); | ||
61 | extern void r8a7779_init_irq(void); | 63 | extern void r8a7779_init_irq(void); |
64 | extern void r8a7779_init_irq_extpin(int irlm); | ||
65 | extern void r8a7779_init_irq_dt(void); | ||
62 | extern void r8a7779_map_io(void); | 66 | extern void r8a7779_map_io(void); |
63 | extern void r8a7779_earlytimer_init(void); | 67 | extern void r8a7779_earlytimer_init(void); |
64 | extern void r8a7779_add_early_devices(void); | 68 | extern void r8a7779_add_early_devices(void); |
65 | extern void r8a7779_add_standard_devices(void); | 69 | extern void r8a7779_add_standard_devices(void); |
70 | extern void r8a7779_add_standard_devices_dt(void); | ||
66 | extern void r8a7779_clock_init(void); | 71 | extern void r8a7779_clock_init(void); |
67 | extern void r8a7779_pinmux_init(void); | 72 | extern void r8a7779_pinmux_init(void); |
68 | extern void r8a7779_pm_init(void); | 73 | extern void r8a7779_pm_init(void); |
69 | extern void r8a7740_meram_workaround(void); | ||
70 | |||
71 | extern void r8a7779_register_twd(void); | 74 | extern void r8a7779_register_twd(void); |
72 | 75 | ||
73 | #ifdef CONFIG_SUSPEND | 76 | #ifdef CONFIG_SUSPEND |
@@ -82,16 +85,7 @@ int shmobile_cpuidle_init(void); | |||
82 | static inline int shmobile_cpuidle_init(void) { return 0; } | 85 | static inline int shmobile_cpuidle_init(void) { return 0; } |
83 | #endif | 86 | #endif |
84 | 87 | ||
85 | extern void shmobile_cpu_die(unsigned int cpu); | 88 | extern void __iomem *shmobile_scu_base; |
86 | extern int shmobile_cpu_disable(unsigned int cpu); | ||
87 | extern int shmobile_cpu_disable_any(unsigned int cpu); | ||
88 | |||
89 | #ifdef CONFIG_HOTPLUG_CPU | ||
90 | extern int shmobile_cpu_is_dead(unsigned int cpu); | ||
91 | #else | ||
92 | static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; } | ||
93 | #endif | ||
94 | |||
95 | extern void shmobile_smp_init_cpus(unsigned int ncores); | 89 | extern void shmobile_smp_init_cpus(unsigned int ncores); |
96 | 90 | ||
97 | static inline void __init shmobile_init_late(void) | 91 | static inline void __init shmobile_init_late(void) |
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h index 06a5da3c3050..b2074e2acb15 100644 --- a/arch/arm/mach-shmobile/include/mach/irqs.h +++ b/arch/arm/mach-shmobile/include/mach/irqs.h | |||
@@ -5,10 +5,15 @@ | |||
5 | 5 | ||
6 | /* GIC */ | 6 | /* GIC */ |
7 | #define gic_spi(nr) ((nr) + 32) | 7 | #define gic_spi(nr) ((nr) + 32) |
8 | #define gic_iid(nr) (nr) /* ICCIAR / interrupt ID */ | ||
8 | 9 | ||
9 | /* INTCS */ | 10 | /* INTCS */ |
10 | #define INTCS_VECT_BASE 0x3400 | 11 | #define INTCS_VECT_BASE 0x3400 |
11 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) | 12 | #define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) |
12 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) | 13 | #define intcs_evt2irq(evt) evt2irq(INTCS_VECT_BASE + (evt)) |
13 | 14 | ||
15 | /* External IRQ pins */ | ||
16 | #define IRQPIN_BASE 2000 | ||
17 | #define irq_pin(nr) ((nr) + IRQPIN_BASE) | ||
18 | |||
14 | #endif /* __ASM_MACH_IRQS_H */ | 19 | #endif /* __ASM_MACH_IRQS_H */ |
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c index 8807c27f71f9..b86dc8908724 100644 --- a/arch/arm/mach-shmobile/intc-r8a7779.c +++ b/arch/arm/mach-shmobile/intc-r8a7779.c | |||
@@ -19,12 +19,16 @@ | |||
19 | */ | 19 | */ |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/platform_device.h> | ||
22 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
25 | #include <linux/irqchip/arm-gic.h> | 26 | #include <linux/irqchip/arm-gic.h> |
27 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | ||
28 | #include <linux/irqchip.h> | ||
26 | #include <mach/common.h> | 29 | #include <mach/common.h> |
27 | #include <mach/intc.h> | 30 | #include <mach/intc.h> |
31 | #include <mach/irqs.h> | ||
28 | #include <mach/r8a7779.h> | 32 | #include <mach/r8a7779.h> |
29 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
@@ -38,18 +42,61 @@ | |||
38 | #define INT2NTSR0 IOMEM(0xfe700060) | 42 | #define INT2NTSR0 IOMEM(0xfe700060) |
39 | #define INT2NTSR1 IOMEM(0xfe700064) | 43 | #define INT2NTSR1 IOMEM(0xfe700064) |
40 | 44 | ||
45 | static struct renesas_intc_irqpin_config irqpin0_platform_data = { | ||
46 | .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ | ||
47 | .sense_bitfield_width = 2, | ||
48 | }; | ||
49 | |||
50 | static struct resource irqpin0_resources[] = { | ||
51 | DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */ | ||
52 | DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */ | ||
53 | DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */ | ||
54 | DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */ | ||
55 | DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */ | ||
56 | DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */ | ||
57 | DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */ | ||
58 | DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */ | ||
59 | DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */ | ||
60 | }; | ||
61 | |||
62 | static struct platform_device irqpin0_device = { | ||
63 | .name = "renesas_intc_irqpin", | ||
64 | .id = 0, | ||
65 | .resource = irqpin0_resources, | ||
66 | .num_resources = ARRAY_SIZE(irqpin0_resources), | ||
67 | .dev = { | ||
68 | .platform_data = &irqpin0_platform_data, | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | void __init r8a7779_init_irq_extpin(int irlm) | ||
73 | { | ||
74 | void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); | ||
75 | unsigned long tmp; | ||
76 | |||
77 | if (icr0) { | ||
78 | tmp = ioread32(icr0); | ||
79 | if (irlm) | ||
80 | tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */ | ||
81 | else | ||
82 | tmp &= ~(1 << 23); /* IRL mode - not supported */ | ||
83 | tmp |= (1 << 21); /* LVLMODE = 1 */ | ||
84 | iowrite32(tmp, icr0); | ||
85 | iounmap(icr0); | ||
86 | |||
87 | if (irlm) | ||
88 | platform_device_register(&irqpin0_device); | ||
89 | } else | ||
90 | pr_warn("r8a7779: unable to setup external irq pin mode\n"); | ||
91 | } | ||
92 | |||
41 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) | 93 | static int r8a7779_set_wake(struct irq_data *data, unsigned int on) |
42 | { | 94 | { |
43 | return 0; /* always allow wakeup */ | 95 | return 0; /* always allow wakeup */ |
44 | } | 96 | } |
45 | 97 | ||
46 | void __init r8a7779_init_irq(void) | 98 | static void __init r8a7779_init_irq_common(void) |
47 | { | 99 | { |
48 | void __iomem *gic_dist_base = IOMEM(0xf0001000); | ||
49 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); | ||
50 | |||
51 | /* use GIC to handle interrupts */ | ||
52 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | ||
53 | gic_arch_extn.irq_set_wake = r8a7779_set_wake; | 100 | gic_arch_extn.irq_set_wake = r8a7779_set_wake; |
54 | 101 | ||
55 | /* route all interrupts to ARM */ | 102 | /* route all interrupts to ARM */ |
@@ -63,3 +110,22 @@ void __init r8a7779_init_irq(void) | |||
63 | __raw_writel(0xbffffffc, INT2SMSKCR3); | 110 | __raw_writel(0xbffffffc, INT2SMSKCR3); |
64 | __raw_writel(0x003fee3f, INT2SMSKCR4); | 111 | __raw_writel(0x003fee3f, INT2SMSKCR4); |
65 | } | 112 | } |
113 | |||
114 | void __init r8a7779_init_irq(void) | ||
115 | { | ||
116 | void __iomem *gic_dist_base = IOMEM(0xf0001000); | ||
117 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); | ||
118 | |||
119 | /* use GIC to handle interrupts */ | ||
120 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | ||
121 | |||
122 | r8a7779_init_irq_common(); | ||
123 | } | ||
124 | |||
125 | #ifdef CONFIG_OF | ||
126 | void __init r8a7779_init_irq_dt(void) | ||
127 | { | ||
128 | irqchip_init(); | ||
129 | r8a7779_init_irq_common(); | ||
130 | } | ||
131 | #endif | ||
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c index 91faba666d46..19a26f4579b3 100644 --- a/arch/arm/mach-shmobile/intc-sh73a0.c +++ b/arch/arm/mach-shmobile/intc-sh73a0.c | |||
@@ -260,108 +260,6 @@ static int sh73a0_set_wake(struct irq_data *data, unsigned int on) | |||
260 | return 0; /* always allow wakeup */ | 260 | return 0; /* always allow wakeup */ |
261 | } | 261 | } |
262 | 262 | ||
263 | #define RELOC_BASE 0x1200 | ||
264 | |||
265 | /* INTCA IRQ pins at INTCS + RELOC_BASE to make space for GIC+INTC handling */ | ||
266 | #define INTCS_VECT_RELOC(n, vect) INTCS_VECT((n), (vect) + RELOC_BASE) | ||
267 | |||
268 | INTC_IRQ_PINS_32(intca_irq_pins, 0xe6900000, | ||
269 | INTCS_VECT_RELOC, "sh73a0-intca-irq-pins"); | ||
270 | |||
271 | static int to_gic_irq(struct irq_data *data) | ||
272 | { | ||
273 | unsigned int vect = irq2evt(data->irq) - INTCS_VECT_BASE; | ||
274 | |||
275 | if (vect >= 0x3200) | ||
276 | vect -= 0x3000; | ||
277 | else | ||
278 | vect -= 0x0200; | ||
279 | |||
280 | return gic_spi((vect >> 5) + 1); | ||
281 | } | ||
282 | |||
283 | static int to_intca_reloc_irq(struct irq_data *data) | ||
284 | { | ||
285 | return data->irq + (RELOC_BASE >> 5); | ||
286 | } | ||
287 | |||
288 | #define irq_cb(cb, irq) irq_get_chip(irq)->cb(irq_get_irq_data(irq)) | ||
289 | #define irq_cbp(cb, irq, p...) irq_get_chip(irq)->cb(irq_get_irq_data(irq), p) | ||
290 | |||
291 | static void intca_gic_enable(struct irq_data *data) | ||
292 | { | ||
293 | irq_cb(irq_unmask, to_intca_reloc_irq(data)); | ||
294 | irq_cb(irq_unmask, to_gic_irq(data)); | ||
295 | } | ||
296 | |||
297 | static void intca_gic_disable(struct irq_data *data) | ||
298 | { | ||
299 | irq_cb(irq_mask, to_gic_irq(data)); | ||
300 | irq_cb(irq_mask, to_intca_reloc_irq(data)); | ||
301 | } | ||
302 | |||
303 | static void intca_gic_mask_ack(struct irq_data *data) | ||
304 | { | ||
305 | irq_cb(irq_mask, to_gic_irq(data)); | ||
306 | irq_cb(irq_mask_ack, to_intca_reloc_irq(data)); | ||
307 | } | ||
308 | |||
309 | static void intca_gic_eoi(struct irq_data *data) | ||
310 | { | ||
311 | irq_cb(irq_eoi, to_gic_irq(data)); | ||
312 | } | ||
313 | |||
314 | static int intca_gic_set_type(struct irq_data *data, unsigned int type) | ||
315 | { | ||
316 | return irq_cbp(irq_set_type, to_intca_reloc_irq(data), type); | ||
317 | } | ||
318 | |||
319 | #ifdef CONFIG_SMP | ||
320 | static int intca_gic_set_affinity(struct irq_data *data, | ||
321 | const struct cpumask *cpumask, | ||
322 | bool force) | ||
323 | { | ||
324 | return irq_cbp(irq_set_affinity, to_gic_irq(data), cpumask, force); | ||
325 | } | ||
326 | #endif | ||
327 | |||
328 | struct irq_chip intca_gic_irq_chip = { | ||
329 | .name = "INTCA-GIC", | ||
330 | .irq_mask = intca_gic_disable, | ||
331 | .irq_unmask = intca_gic_enable, | ||
332 | .irq_mask_ack = intca_gic_mask_ack, | ||
333 | .irq_eoi = intca_gic_eoi, | ||
334 | .irq_enable = intca_gic_enable, | ||
335 | .irq_disable = intca_gic_disable, | ||
336 | .irq_shutdown = intca_gic_disable, | ||
337 | .irq_set_type = intca_gic_set_type, | ||
338 | .irq_set_wake = sh73a0_set_wake, | ||
339 | #ifdef CONFIG_SMP | ||
340 | .irq_set_affinity = intca_gic_set_affinity, | ||
341 | #endif | ||
342 | }; | ||
343 | |||
344 | static int to_intc_vect(int irq) | ||
345 | { | ||
346 | unsigned int irq_pin = irq - gic_spi(1); | ||
347 | unsigned int offs; | ||
348 | |||
349 | if (irq_pin < 16) | ||
350 | offs = 0x0200; | ||
351 | else | ||
352 | offs = 0x3000; | ||
353 | |||
354 | return offs + (irq_pin << 5); | ||
355 | } | ||
356 | |||
357 | static irqreturn_t sh73a0_irq_pin_demux(int irq, void *dev_id) | ||
358 | { | ||
359 | generic_handle_irq(intcs_evt2irq(to_intc_vect(irq))); | ||
360 | return IRQ_HANDLED; | ||
361 | } | ||
362 | |||
363 | static struct irqaction sh73a0_irq_pin_cascade[32]; | ||
364 | |||
365 | #define PINTER0_PHYS 0xe69000a0 | 263 | #define PINTER0_PHYS 0xe69000a0 |
366 | #define PINTER1_PHYS 0xe69000a4 | 264 | #define PINTER1_PHYS 0xe69000a4 |
367 | #define PINTER0_VIRT IOMEM(0xe69000a0) | 265 | #define PINTER0_VIRT IOMEM(0xe69000a0) |
@@ -422,13 +320,11 @@ void __init sh73a0_init_irq(void) | |||
422 | void __iomem *gic_dist_base = IOMEM(0xf0001000); | 320 | void __iomem *gic_dist_base = IOMEM(0xf0001000); |
423 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); | 321 | void __iomem *gic_cpu_base = IOMEM(0xf0000100); |
424 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); | 322 | void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); |
425 | int k, n; | ||
426 | 323 | ||
427 | gic_init(0, 29, gic_dist_base, gic_cpu_base); | 324 | gic_init(0, 29, gic_dist_base, gic_cpu_base); |
428 | gic_arch_extn.irq_set_wake = sh73a0_set_wake; | 325 | gic_arch_extn.irq_set_wake = sh73a0_set_wake; |
429 | 326 | ||
430 | register_intc_controller(&intcs_desc); | 327 | register_intc_controller(&intcs_desc); |
431 | register_intc_controller(&intca_irq_pins_desc); | ||
432 | register_intc_controller(&intc_pint0_desc); | 328 | register_intc_controller(&intc_pint0_desc); |
433 | register_intc_controller(&intc_pint1_desc); | 329 | register_intc_controller(&intc_pint1_desc); |
434 | 330 | ||
@@ -438,19 +334,6 @@ void __init sh73a0_init_irq(void) | |||
438 | sh73a0_intcs_cascade.dev_id = intevtsa; | 334 | sh73a0_intcs_cascade.dev_id = intevtsa; |
439 | setup_irq(gic_spi(50), &sh73a0_intcs_cascade); | 335 | setup_irq(gic_spi(50), &sh73a0_intcs_cascade); |
440 | 336 | ||
441 | /* IRQ pins require special handling through INTCA and GIC */ | ||
442 | for (k = 0; k < 32; k++) { | ||
443 | sh73a0_irq_pin_cascade[k].name = "INTCA-GIC cascade"; | ||
444 | sh73a0_irq_pin_cascade[k].handler = sh73a0_irq_pin_demux; | ||
445 | setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]); | ||
446 | |||
447 | n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k))); | ||
448 | WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n); | ||
449 | irq_set_chip_and_handler_name(n, &intca_gic_irq_chip, | ||
450 | handle_level_irq, "level"); | ||
451 | set_irq_flags(n, IRQF_VALID); /* yuck */ | ||
452 | } | ||
453 | |||
454 | /* PINT pins are sanely tied to the GIC as SPI */ | 337 | /* PINT pins are sanely tied to the GIC as SPI */ |
455 | sh73a0_pint0_cascade.name = "PINT0 cascade"; | 338 | sh73a0_pint0_cascade.name = "PINT0 cascade"; |
456 | sh73a0_pint0_cascade.handler = sh73a0_pint0_demux; | 339 | sh73a0_pint0_cascade.handler = sh73a0_pint0_demux; |
@@ -460,11 +343,3 @@ void __init sh73a0_init_irq(void) | |||
460 | sh73a0_pint1_cascade.handler = sh73a0_pint1_demux; | 343 | sh73a0_pint1_cascade.handler = sh73a0_pint1_demux; |
461 | setup_irq(gic_spi(34), &sh73a0_pint1_cascade); | 344 | setup_irq(gic_spi(34), &sh73a0_pint1_cascade); |
462 | } | 345 | } |
463 | |||
464 | #ifdef CONFIG_OF | ||
465 | void __init sh73a0_init_irq_dt(void) | ||
466 | { | ||
467 | irqchip_init(); | ||
468 | gic_arch_extn.irq_set_wake = sh73a0_set_wake; | ||
469 | } | ||
470 | #endif | ||
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c index 47662a581c0a..899a86c31ec9 100644 --- a/arch/arm/mach-shmobile/setup-emev2.c +++ b/arch/arm/mach-shmobile/setup-emev2.c | |||
@@ -404,7 +404,7 @@ void __init emev2_add_standard_devices(void) | |||
404 | ARRAY_SIZE(emev2_late_devices)); | 404 | ARRAY_SIZE(emev2_late_devices)); |
405 | } | 405 | } |
406 | 406 | ||
407 | void __init emev2_init_delay(void) | 407 | static void __init emev2_init_delay(void) |
408 | { | 408 | { |
409 | shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ | 409 | shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */ |
410 | } | 410 | } |
@@ -439,7 +439,7 @@ static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = { | |||
439 | { } | 439 | { } |
440 | }; | 440 | }; |
441 | 441 | ||
442 | void __init emev2_add_standard_devices_dt(void) | 442 | static void __init emev2_add_standard_devices_dt(void) |
443 | { | 443 | { |
444 | of_platform_populate(NULL, of_default_bus_match_table, | 444 | of_platform_populate(NULL, of_default_bus_match_table, |
445 | emev2_auxdata_lookup, NULL); | 445 | emev2_auxdata_lookup, NULL); |
@@ -456,7 +456,6 @@ DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)") | |||
456 | .nr_irqs = NR_IRQS_LEGACY, | 456 | .nr_irqs = NR_IRQS_LEGACY, |
457 | .init_irq = irqchip_init, | 457 | .init_irq = irqchip_init, |
458 | .init_machine = emev2_add_standard_devices_dt, | 458 | .init_machine = emev2_add_standard_devices_dt, |
459 | .init_time = shmobile_timer_init, | ||
460 | .dt_compat = emev2_boards_compat_dt, | 459 | .dt_compat = emev2_boards_compat_dt, |
461 | MACHINE_END | 460 | MACHINE_END |
462 | 461 | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c index 8b85d4d8fab6..104b474a2ccf 100644 --- a/arch/arm/mach-shmobile/setup-r8a7740.c +++ b/arch/arm/mach-shmobile/setup-r8a7740.c | |||
@@ -906,7 +906,6 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") | |||
906 | .init_irq = r8a7740_init_irq, | 906 | .init_irq = r8a7740_init_irq, |
907 | .handle_irq = shmobile_handle_irq_intc, | 907 | .handle_irq = shmobile_handle_irq_intc, |
908 | .init_machine = r8a7740_add_standard_devices_dt, | 908 | .init_machine = r8a7740_add_standard_devices_dt, |
909 | .init_time = shmobile_timer_init, | ||
910 | .dt_compat = r8a7740_boards_compat_dt, | 909 | .dt_compat = r8a7740_boards_compat_dt, |
911 | MACHINE_END | 910 | MACHINE_END |
912 | 911 | ||
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index c54ff9b29fe5..042df35e71a0 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/of_platform.h> | ||
24 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/input.h> | 27 | #include <linux/input.h> |
@@ -28,6 +29,7 @@ | |||
28 | #include <linux/serial_sci.h> | 29 | #include <linux/serial_sci.h> |
29 | #include <linux/sh_intc.h> | 30 | #include <linux/sh_intc.h> |
30 | #include <linux/sh_timer.h> | 31 | #include <linux/sh_timer.h> |
32 | #include <linux/dma-mapping.h> | ||
31 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
32 | #include <mach/irqs.h> | 34 | #include <mach/irqs.h> |
33 | #include <mach/r8a7779.h> | 35 | #include <mach/r8a7779.h> |
@@ -91,7 +93,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
91 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 93 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
92 | .scbrr_algo_id = SCBRR_ALGO_2, | 94 | .scbrr_algo_id = SCBRR_ALGO_2, |
93 | .type = PORT_SCIF, | 95 | .type = PORT_SCIF, |
94 | .irqs = SCIx_IRQ_MUXED(gic_spi(88)), | 96 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)), |
95 | }; | 97 | }; |
96 | 98 | ||
97 | static struct platform_device scif0_device = { | 99 | static struct platform_device scif0_device = { |
@@ -108,7 +110,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
108 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 110 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
109 | .scbrr_algo_id = SCBRR_ALGO_2, | 111 | .scbrr_algo_id = SCBRR_ALGO_2, |
110 | .type = PORT_SCIF, | 112 | .type = PORT_SCIF, |
111 | .irqs = SCIx_IRQ_MUXED(gic_spi(89)), | 113 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)), |
112 | }; | 114 | }; |
113 | 115 | ||
114 | static struct platform_device scif1_device = { | 116 | static struct platform_device scif1_device = { |
@@ -125,7 +127,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
125 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 127 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
126 | .scbrr_algo_id = SCBRR_ALGO_2, | 128 | .scbrr_algo_id = SCBRR_ALGO_2, |
127 | .type = PORT_SCIF, | 129 | .type = PORT_SCIF, |
128 | .irqs = SCIx_IRQ_MUXED(gic_spi(90)), | 130 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)), |
129 | }; | 131 | }; |
130 | 132 | ||
131 | static struct platform_device scif2_device = { | 133 | static struct platform_device scif2_device = { |
@@ -142,7 +144,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
142 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 144 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
143 | .scbrr_algo_id = SCBRR_ALGO_2, | 145 | .scbrr_algo_id = SCBRR_ALGO_2, |
144 | .type = PORT_SCIF, | 146 | .type = PORT_SCIF, |
145 | .irqs = SCIx_IRQ_MUXED(gic_spi(91)), | 147 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)), |
146 | }; | 148 | }; |
147 | 149 | ||
148 | static struct platform_device scif3_device = { | 150 | static struct platform_device scif3_device = { |
@@ -159,7 +161,7 @@ static struct plat_sci_port scif4_platform_data = { | |||
159 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 161 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
160 | .scbrr_algo_id = SCBRR_ALGO_2, | 162 | .scbrr_algo_id = SCBRR_ALGO_2, |
161 | .type = PORT_SCIF, | 163 | .type = PORT_SCIF, |
162 | .irqs = SCIx_IRQ_MUXED(gic_spi(92)), | 164 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)), |
163 | }; | 165 | }; |
164 | 166 | ||
165 | static struct platform_device scif4_device = { | 167 | static struct platform_device scif4_device = { |
@@ -176,7 +178,7 @@ static struct plat_sci_port scif5_platform_data = { | |||
176 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 178 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
177 | .scbrr_algo_id = SCBRR_ALGO_2, | 179 | .scbrr_algo_id = SCBRR_ALGO_2, |
178 | .type = PORT_SCIF, | 180 | .type = PORT_SCIF, |
179 | .irqs = SCIx_IRQ_MUXED(gic_spi(93)), | 181 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)), |
180 | }; | 182 | }; |
181 | 183 | ||
182 | static struct platform_device scif5_device = { | 184 | static struct platform_device scif5_device = { |
@@ -203,7 +205,7 @@ static struct resource tmu00_resources[] = { | |||
203 | .flags = IORESOURCE_MEM, | 205 | .flags = IORESOURCE_MEM, |
204 | }, | 206 | }, |
205 | [1] = { | 207 | [1] = { |
206 | .start = gic_spi(32), | 208 | .start = gic_iid(0x40), |
207 | .flags = IORESOURCE_IRQ, | 209 | .flags = IORESOURCE_IRQ, |
208 | }, | 210 | }, |
209 | }; | 211 | }; |
@@ -233,7 +235,7 @@ static struct resource tmu01_resources[] = { | |||
233 | .flags = IORESOURCE_MEM, | 235 | .flags = IORESOURCE_MEM, |
234 | }, | 236 | }, |
235 | [1] = { | 237 | [1] = { |
236 | .start = gic_spi(33), | 238 | .start = gic_iid(0x41), |
237 | .flags = IORESOURCE_IRQ, | 239 | .flags = IORESOURCE_IRQ, |
238 | }, | 240 | }, |
239 | }; | 241 | }; |
@@ -255,7 +257,7 @@ static struct resource rcar_i2c0_res[] = { | |||
255 | .end = 0xffc70fff, | 257 | .end = 0xffc70fff, |
256 | .flags = IORESOURCE_MEM, | 258 | .flags = IORESOURCE_MEM, |
257 | }, { | 259 | }, { |
258 | .start = gic_spi(79), | 260 | .start = gic_iid(0x6f), |
259 | .flags = IORESOURCE_IRQ, | 261 | .flags = IORESOURCE_IRQ, |
260 | }, | 262 | }, |
261 | }; | 263 | }; |
@@ -273,7 +275,7 @@ static struct resource rcar_i2c1_res[] = { | |||
273 | .end = 0xffc71fff, | 275 | .end = 0xffc71fff, |
274 | .flags = IORESOURCE_MEM, | 276 | .flags = IORESOURCE_MEM, |
275 | }, { | 277 | }, { |
276 | .start = gic_spi(82), | 278 | .start = gic_iid(0x72), |
277 | .flags = IORESOURCE_IRQ, | 279 | .flags = IORESOURCE_IRQ, |
278 | }, | 280 | }, |
279 | }; | 281 | }; |
@@ -291,7 +293,7 @@ static struct resource rcar_i2c2_res[] = { | |||
291 | .end = 0xffc72fff, | 293 | .end = 0xffc72fff, |
292 | .flags = IORESOURCE_MEM, | 294 | .flags = IORESOURCE_MEM, |
293 | }, { | 295 | }, { |
294 | .start = gic_spi(80), | 296 | .start = gic_iid(0x70), |
295 | .flags = IORESOURCE_IRQ, | 297 | .flags = IORESOURCE_IRQ, |
296 | }, | 298 | }, |
297 | }; | 299 | }; |
@@ -309,7 +311,7 @@ static struct resource rcar_i2c3_res[] = { | |||
309 | .end = 0xffc73fff, | 311 | .end = 0xffc73fff, |
310 | .flags = IORESOURCE_MEM, | 312 | .flags = IORESOURCE_MEM, |
311 | }, { | 313 | }, { |
312 | .start = gic_spi(81), | 314 | .start = gic_iid(0x71), |
313 | .flags = IORESOURCE_IRQ, | 315 | .flags = IORESOURCE_IRQ, |
314 | }, | 316 | }, |
315 | }; | 317 | }; |
@@ -321,7 +323,31 @@ static struct platform_device i2c3_device = { | |||
321 | .num_resources = ARRAY_SIZE(rcar_i2c3_res), | 323 | .num_resources = ARRAY_SIZE(rcar_i2c3_res), |
322 | }; | 324 | }; |
323 | 325 | ||
324 | static struct platform_device *r8a7779_early_devices[] __initdata = { | 326 | static struct resource sata_resources[] = { |
327 | [0] = { | ||
328 | .name = "rcar-sata", | ||
329 | .start = 0xfc600000, | ||
330 | .end = 0xfc601fff, | ||
331 | .flags = IORESOURCE_MEM, | ||
332 | }, | ||
333 | [1] = { | ||
334 | .start = gic_iid(0x84), | ||
335 | .flags = IORESOURCE_IRQ, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static struct platform_device sata_device = { | ||
340 | .name = "sata_rcar", | ||
341 | .id = -1, | ||
342 | .resource = sata_resources, | ||
343 | .num_resources = ARRAY_SIZE(sata_resources), | ||
344 | .dev = { | ||
345 | .dma_mask = &sata_device.dev.coherent_dma_mask, | ||
346 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | static struct platform_device *r8a7779_devices_dt[] __initdata = { | ||
325 | &scif0_device, | 351 | &scif0_device, |
326 | &scif1_device, | 352 | &scif1_device, |
327 | &scif2_device, | 353 | &scif2_device, |
@@ -330,13 +356,14 @@ static struct platform_device *r8a7779_early_devices[] __initdata = { | |||
330 | &scif5_device, | 356 | &scif5_device, |
331 | &tmu00_device, | 357 | &tmu00_device, |
332 | &tmu01_device, | 358 | &tmu01_device, |
359 | }; | ||
360 | |||
361 | static struct platform_device *r8a7779_late_devices[] __initdata = { | ||
333 | &i2c0_device, | 362 | &i2c0_device, |
334 | &i2c1_device, | 363 | &i2c1_device, |
335 | &i2c2_device, | 364 | &i2c2_device, |
336 | &i2c3_device, | 365 | &i2c3_device, |
337 | }; | 366 | &sata_device, |
338 | |||
339 | static struct platform_device *r8a7779_late_devices[] __initdata = { | ||
340 | }; | 367 | }; |
341 | 368 | ||
342 | void __init r8a7779_add_standard_devices(void) | 369 | void __init r8a7779_add_standard_devices(void) |
@@ -349,8 +376,8 @@ void __init r8a7779_add_standard_devices(void) | |||
349 | 376 | ||
350 | r8a7779_init_pm_domains(); | 377 | r8a7779_init_pm_domains(); |
351 | 378 | ||
352 | platform_add_devices(r8a7779_early_devices, | 379 | platform_add_devices(r8a7779_devices_dt, |
353 | ARRAY_SIZE(r8a7779_early_devices)); | 380 | ARRAY_SIZE(r8a7779_devices_dt)); |
354 | platform_add_devices(r8a7779_late_devices, | 381 | platform_add_devices(r8a7779_late_devices, |
355 | ARRAY_SIZE(r8a7779_late_devices)); | 382 | ARRAY_SIZE(r8a7779_late_devices)); |
356 | } | 383 | } |
@@ -367,8 +394,8 @@ void __init r8a7779_earlytimer_init(void) | |||
367 | 394 | ||
368 | void __init r8a7779_add_early_devices(void) | 395 | void __init r8a7779_add_early_devices(void) |
369 | { | 396 | { |
370 | early_platform_add_devices(r8a7779_early_devices, | 397 | early_platform_add_devices(r8a7779_devices_dt, |
371 | ARRAY_SIZE(r8a7779_early_devices)); | 398 | ARRAY_SIZE(r8a7779_devices_dt)); |
372 | 399 | ||
373 | /* Early serial console setup is not included here due to | 400 | /* Early serial console setup is not included here due to |
374 | * memory map collisions. The SCIF serial ports in r8a7779 | 401 | * memory map collisions. The SCIF serial ports in r8a7779 |
@@ -386,3 +413,40 @@ void __init r8a7779_add_early_devices(void) | |||
386 | * command line in case of the marzen board. | 413 | * command line in case of the marzen board. |
387 | */ | 414 | */ |
388 | } | 415 | } |
416 | |||
417 | #ifdef CONFIG_USE_OF | ||
418 | void __init r8a7779_init_delay(void) | ||
419 | { | ||
420 | shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */ | ||
421 | } | ||
422 | |||
423 | static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = { | ||
424 | {}, | ||
425 | }; | ||
426 | |||
427 | void __init r8a7779_add_standard_devices_dt(void) | ||
428 | { | ||
429 | /* clocks are setup late during boot in the case of DT */ | ||
430 | r8a7779_clock_init(); | ||
431 | |||
432 | platform_add_devices(r8a7779_devices_dt, | ||
433 | ARRAY_SIZE(r8a7779_devices_dt)); | ||
434 | of_platform_populate(NULL, of_default_bus_match_table, | ||
435 | r8a7779_auxdata_lookup, NULL); | ||
436 | } | ||
437 | |||
438 | static const char *r8a7779_compat_dt[] __initdata = { | ||
439 | "renesas,r8a7779", | ||
440 | NULL, | ||
441 | }; | ||
442 | |||
443 | DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") | ||
444 | .map_io = r8a7779_map_io, | ||
445 | .init_early = r8a7779_init_delay, | ||
446 | .nr_irqs = NR_IRQS_LEGACY, | ||
447 | .init_irq = r8a7779_init_irq_dt, | ||
448 | .init_machine = r8a7779_add_standard_devices_dt, | ||
449 | .init_time = shmobile_timer_init, | ||
450 | .dt_compat = r8a7779_compat_dt, | ||
451 | MACHINE_END | ||
452 | #endif /* CONFIG_USE_OF */ | ||
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c index 59c7146bf66f..5502d624aca6 100644 --- a/arch/arm/mach-shmobile/setup-sh7372.c +++ b/arch/arm/mach-shmobile/setup-sh7372.c | |||
@@ -1175,7 +1175,6 @@ DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)") | |||
1175 | .init_irq = sh7372_init_irq, | 1175 | .init_irq = sh7372_init_irq, |
1176 | .handle_irq = shmobile_handle_irq_intc, | 1176 | .handle_irq = shmobile_handle_irq_intc, |
1177 | .init_machine = sh7372_add_standard_devices_dt, | 1177 | .init_machine = sh7372_add_standard_devices_dt, |
1178 | .init_time = shmobile_timer_init, | ||
1179 | .dt_compat = sh7372_boards_compat_dt, | 1178 | .dt_compat = sh7372_boards_compat_dt, |
1180 | MACHINE_END | 1179 | MACHINE_END |
1181 | 1180 | ||
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index bdab575f88bc..fdf3894b1cc3 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/irqchip.h> | ||
25 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
26 | #include <linux/of_platform.h> | 27 | #include <linux/of_platform.h> |
27 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
@@ -32,6 +33,7 @@ | |||
32 | #include <linux/sh_intc.h> | 33 | #include <linux/sh_intc.h> |
33 | #include <linux/sh_timer.h> | 34 | #include <linux/sh_timer.h> |
34 | #include <linux/platform_data/sh_ipmmu.h> | 35 | #include <linux/platform_data/sh_ipmmu.h> |
36 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | ||
35 | #include <mach/dma-register.h> | 37 | #include <mach/dma-register.h> |
36 | #include <mach/hardware.h> | 38 | #include <mach/hardware.h> |
37 | #include <mach/irqs.h> | 39 | #include <mach/irqs.h> |
@@ -810,7 +812,128 @@ static struct platform_device ipmmu_device = { | |||
810 | .num_resources = ARRAY_SIZE(ipmmu_resources), | 812 | .num_resources = ARRAY_SIZE(ipmmu_resources), |
811 | }; | 813 | }; |
812 | 814 | ||
813 | static struct platform_device *sh73a0_early_devices_dt[] __initdata = { | 815 | static struct renesas_intc_irqpin_config irqpin0_platform_data = { |
816 | .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */ | ||
817 | }; | ||
818 | |||
819 | static struct resource irqpin0_resources[] = { | ||
820 | DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */ | ||
821 | DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */ | ||
822 | DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */ | ||
823 | DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */ | ||
824 | DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */ | ||
825 | DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */ | ||
826 | DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */ | ||
827 | DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */ | ||
828 | DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */ | ||
829 | DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */ | ||
830 | DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */ | ||
831 | DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */ | ||
832 | DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */ | ||
833 | }; | ||
834 | |||
835 | static struct platform_device irqpin0_device = { | ||
836 | .name = "renesas_intc_irqpin", | ||
837 | .id = 0, | ||
838 | .resource = irqpin0_resources, | ||
839 | .num_resources = ARRAY_SIZE(irqpin0_resources), | ||
840 | .dev = { | ||
841 | .platform_data = &irqpin0_platform_data, | ||
842 | }, | ||
843 | }; | ||
844 | |||
845 | static struct renesas_intc_irqpin_config irqpin1_platform_data = { | ||
846 | .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */ | ||
847 | .control_parent = true, /* Disable spurious IRQ10 */ | ||
848 | }; | ||
849 | |||
850 | static struct resource irqpin1_resources[] = { | ||
851 | DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */ | ||
852 | DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */ | ||
853 | DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */ | ||
854 | DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */ | ||
855 | DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */ | ||
856 | DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */ | ||
857 | DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */ | ||
858 | DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */ | ||
859 | DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */ | ||
860 | DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */ | ||
861 | DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */ | ||
862 | DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */ | ||
863 | DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */ | ||
864 | }; | ||
865 | |||
866 | static struct platform_device irqpin1_device = { | ||
867 | .name = "renesas_intc_irqpin", | ||
868 | .id = 1, | ||
869 | .resource = irqpin1_resources, | ||
870 | .num_resources = ARRAY_SIZE(irqpin1_resources), | ||
871 | .dev = { | ||
872 | .platform_data = &irqpin1_platform_data, | ||
873 | }, | ||
874 | }; | ||
875 | |||
876 | static struct renesas_intc_irqpin_config irqpin2_platform_data = { | ||
877 | .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */ | ||
878 | }; | ||
879 | |||
880 | static struct resource irqpin2_resources[] = { | ||
881 | DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */ | ||
882 | DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */ | ||
883 | DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */ | ||
884 | DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */ | ||
885 | DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */ | ||
886 | DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */ | ||
887 | DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */ | ||
888 | DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */ | ||
889 | DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */ | ||
890 | DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */ | ||
891 | DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */ | ||
892 | DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */ | ||
893 | DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */ | ||
894 | }; | ||
895 | |||
896 | static struct platform_device irqpin2_device = { | ||
897 | .name = "renesas_intc_irqpin", | ||
898 | .id = 2, | ||
899 | .resource = irqpin2_resources, | ||
900 | .num_resources = ARRAY_SIZE(irqpin2_resources), | ||
901 | .dev = { | ||
902 | .platform_data = &irqpin2_platform_data, | ||
903 | }, | ||
904 | }; | ||
905 | |||
906 | static struct renesas_intc_irqpin_config irqpin3_platform_data = { | ||
907 | .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */ | ||
908 | }; | ||
909 | |||
910 | static struct resource irqpin3_resources[] = { | ||
911 | DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */ | ||
912 | DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */ | ||
913 | DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */ | ||
914 | DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */ | ||
915 | DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */ | ||
916 | DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */ | ||
917 | DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */ | ||
918 | DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */ | ||
919 | DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */ | ||
920 | DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */ | ||
921 | DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */ | ||
922 | DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */ | ||
923 | DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */ | ||
924 | }; | ||
925 | |||
926 | static struct platform_device irqpin3_device = { | ||
927 | .name = "renesas_intc_irqpin", | ||
928 | .id = 3, | ||
929 | .resource = irqpin3_resources, | ||
930 | .num_resources = ARRAY_SIZE(irqpin3_resources), | ||
931 | .dev = { | ||
932 | .platform_data = &irqpin3_platform_data, | ||
933 | }, | ||
934 | }; | ||
935 | |||
936 | static struct platform_device *sh73a0_devices_dt[] __initdata = { | ||
814 | &scif0_device, | 937 | &scif0_device, |
815 | &scif1_device, | 938 | &scif1_device, |
816 | &scif2_device, | 939 | &scif2_device, |
@@ -838,6 +961,10 @@ static struct platform_device *sh73a0_late_devices[] __initdata = { | |||
838 | &dma0_device, | 961 | &dma0_device, |
839 | &mpdma0_device, | 962 | &mpdma0_device, |
840 | &pmu_device, | 963 | &pmu_device, |
964 | &irqpin0_device, | ||
965 | &irqpin1_device, | ||
966 | &irqpin2_device, | ||
967 | &irqpin3_device, | ||
841 | }; | 968 | }; |
842 | 969 | ||
843 | #define SRCR2 IOMEM(0xe61580b0) | 970 | #define SRCR2 IOMEM(0xe61580b0) |
@@ -847,8 +974,8 @@ void __init sh73a0_add_standard_devices(void) | |||
847 | /* Clear software reset bit on SY-DMAC module */ | 974 | /* Clear software reset bit on SY-DMAC module */ |
848 | __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); | 975 | __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2); |
849 | 976 | ||
850 | platform_add_devices(sh73a0_early_devices_dt, | 977 | platform_add_devices(sh73a0_devices_dt, |
851 | ARRAY_SIZE(sh73a0_early_devices_dt)); | 978 | ARRAY_SIZE(sh73a0_devices_dt)); |
852 | platform_add_devices(sh73a0_early_devices, | 979 | platform_add_devices(sh73a0_early_devices, |
853 | ARRAY_SIZE(sh73a0_early_devices)); | 980 | ARRAY_SIZE(sh73a0_early_devices)); |
854 | platform_add_devices(sh73a0_late_devices, | 981 | platform_add_devices(sh73a0_late_devices, |
@@ -867,8 +994,8 @@ void __init sh73a0_earlytimer_init(void) | |||
867 | 994 | ||
868 | void __init sh73a0_add_early_devices(void) | 995 | void __init sh73a0_add_early_devices(void) |
869 | { | 996 | { |
870 | early_platform_add_devices(sh73a0_early_devices_dt, | 997 | early_platform_add_devices(sh73a0_devices_dt, |
871 | ARRAY_SIZE(sh73a0_early_devices_dt)); | 998 | ARRAY_SIZE(sh73a0_devices_dt)); |
872 | early_platform_add_devices(sh73a0_early_devices, | 999 | early_platform_add_devices(sh73a0_early_devices, |
873 | ARRAY_SIZE(sh73a0_early_devices)); | 1000 | ARRAY_SIZE(sh73a0_early_devices)); |
874 | 1001 | ||
@@ -878,23 +1005,9 @@ void __init sh73a0_add_early_devices(void) | |||
878 | 1005 | ||
879 | #ifdef CONFIG_USE_OF | 1006 | #ifdef CONFIG_USE_OF |
880 | 1007 | ||
881 | /* Please note that the clock initialisation shcheme used in | 1008 | void __init sh73a0_init_delay(void) |
882 | * sh73a0_add_early_devices_dt() and sh73a0_add_standard_devices_dt() | ||
883 | * does not work with SMP as there is a yet to be resolved lock-up in | ||
884 | * workqueue initialisation. | ||
885 | * | ||
886 | * CONFIG_SMP should be disabled when using this code. | ||
887 | */ | ||
888 | |||
889 | void __init sh73a0_add_early_devices_dt(void) | ||
890 | { | 1009 | { |
891 | shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ | 1010 | shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */ |
892 | |||
893 | early_platform_add_devices(sh73a0_early_devices_dt, | ||
894 | ARRAY_SIZE(sh73a0_early_devices_dt)); | ||
895 | |||
896 | /* setup early console here as well */ | ||
897 | shmobile_setup_console(); | ||
898 | } | 1011 | } |
899 | 1012 | ||
900 | static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { | 1013 | static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { |
@@ -906,8 +1019,8 @@ void __init sh73a0_add_standard_devices_dt(void) | |||
906 | /* clocks are setup late during boot in the case of DT */ | 1019 | /* clocks are setup late during boot in the case of DT */ |
907 | sh73a0_clock_init(); | 1020 | sh73a0_clock_init(); |
908 | 1021 | ||
909 | platform_add_devices(sh73a0_early_devices_dt, | 1022 | platform_add_devices(sh73a0_devices_dt, |
910 | ARRAY_SIZE(sh73a0_early_devices_dt)); | 1023 | ARRAY_SIZE(sh73a0_devices_dt)); |
911 | of_platform_populate(NULL, of_default_bus_match_table, | 1024 | of_platform_populate(NULL, of_default_bus_match_table, |
912 | sh73a0_auxdata_lookup, NULL); | 1025 | sh73a0_auxdata_lookup, NULL); |
913 | } | 1026 | } |
@@ -918,12 +1031,12 @@ static const char *sh73a0_boards_compat_dt[] __initdata = { | |||
918 | }; | 1031 | }; |
919 | 1032 | ||
920 | DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") | 1033 | DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") |
1034 | .smp = smp_ops(sh73a0_smp_ops), | ||
921 | .map_io = sh73a0_map_io, | 1035 | .map_io = sh73a0_map_io, |
922 | .init_early = sh73a0_add_early_devices_dt, | 1036 | .init_early = sh73a0_init_delay, |
923 | .nr_irqs = NR_IRQS_LEGACY, | 1037 | .nr_irqs = NR_IRQS_LEGACY, |
924 | .init_irq = sh73a0_init_irq_dt, | 1038 | .init_irq = irqchip_init, |
925 | .init_machine = sh73a0_add_standard_devices_dt, | 1039 | .init_machine = sh73a0_add_standard_devices_dt, |
926 | .init_time = shmobile_timer_init, | ||
927 | .dt_compat = sh73a0_boards_compat_dt, | 1040 | .dt_compat = sh73a0_boards_compat_dt, |
928 | MACHINE_END | 1041 | MACHINE_END |
929 | #endif /* CONFIG_USE_OF */ | 1042 | #endif /* CONFIG_USE_OF */ |
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c index 953eb1f9388d..8225c16b371b 100644 --- a/arch/arm/mach-shmobile/smp-emev2.c +++ b/arch/arm/mach-shmobile/smp-emev2.c | |||
@@ -28,63 +28,9 @@ | |||
28 | #include <mach/emev2.h> | 28 | #include <mach/emev2.h> |
29 | #include <asm/smp_plat.h> | 29 | #include <asm/smp_plat.h> |
30 | #include <asm/smp_scu.h> | 30 | #include <asm/smp_scu.h> |
31 | #include <asm/cacheflush.h> | ||
32 | 31 | ||
33 | #define EMEV2_SCU_BASE 0x1e000000 | 32 | #define EMEV2_SCU_BASE 0x1e000000 |
34 | 33 | ||
35 | static DEFINE_SPINLOCK(scu_lock); | ||
36 | static void __iomem *scu_base; | ||
37 | |||
38 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) | ||
39 | { | ||
40 | unsigned long tmp; | ||
41 | |||
42 | /* we assume this code is running on a different cpu | ||
43 | * than the one that is changing coherency setting */ | ||
44 | spin_lock(&scu_lock); | ||
45 | tmp = readl(scu_base + 8); | ||
46 | tmp &= ~clr; | ||
47 | tmp |= set; | ||
48 | writel(tmp, scu_base + 8); | ||
49 | spin_unlock(&scu_lock); | ||
50 | |||
51 | } | ||
52 | |||
53 | static unsigned int __init emev2_get_core_count(void) | ||
54 | { | ||
55 | if (!scu_base) { | ||
56 | scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE); | ||
57 | emev2_clock_init(); /* need ioremapped SMU */ | ||
58 | } | ||
59 | |||
60 | WARN_ON_ONCE(!scu_base); | ||
61 | |||
62 | return scu_base ? scu_get_core_count(scu_base) : 1; | ||
63 | } | ||
64 | |||
65 | static int emev2_platform_cpu_kill(unsigned int cpu) | ||
66 | { | ||
67 | return 0; /* not supported yet */ | ||
68 | } | ||
69 | |||
70 | static int __maybe_unused emev2_cpu_kill(unsigned int cpu) | ||
71 | { | ||
72 | int k; | ||
73 | |||
74 | /* this function is running on another CPU than the offline target, | ||
75 | * here we need wait for shutdown code in platform_cpu_die() to | ||
76 | * finish before asking SoC-specific code to power off the CPU core. | ||
77 | */ | ||
78 | for (k = 0; k < 1000; k++) { | ||
79 | if (shmobile_cpu_is_dead(cpu)) | ||
80 | return emev2_platform_cpu_kill(cpu); | ||
81 | mdelay(1); | ||
82 | } | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | |||
88 | static void __cpuinit emev2_secondary_init(unsigned int cpu) | 34 | static void __cpuinit emev2_secondary_init(unsigned int cpu) |
89 | { | 35 | { |
90 | gic_secondary_init(0); | 36 | gic_secondary_init(0); |
@@ -92,31 +38,30 @@ static void __cpuinit emev2_secondary_init(unsigned int cpu) | |||
92 | 38 | ||
93 | static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) | 39 | static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) |
94 | { | 40 | { |
95 | cpu = cpu_logical_map(cpu); | 41 | arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu))); |
96 | |||
97 | /* enable cache coherency */ | ||
98 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | ||
99 | |||
100 | /* Tell ROM loader about our vector (in headsmp.S) */ | ||
101 | emev2_set_boot_vector(__pa(shmobile_secondary_vector)); | ||
102 | |||
103 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | ||
104 | return 0; | 42 | return 0; |
105 | } | 43 | } |
106 | 44 | ||
107 | static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) | 45 | static void __init emev2_smp_prepare_cpus(unsigned int max_cpus) |
108 | { | 46 | { |
109 | int cpu = cpu_logical_map(0); | 47 | scu_enable(shmobile_scu_base); |
110 | 48 | ||
111 | scu_enable(scu_base); | 49 | /* Tell ROM loader about our vector (in headsmp-scu.S) */ |
50 | emev2_set_boot_vector(__pa(shmobile_secondary_vector_scu)); | ||
112 | 51 | ||
113 | /* enable cache coherency on CPU0 */ | 52 | /* enable cache coherency on booting CPU */ |
114 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | 53 | scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); |
115 | } | 54 | } |
116 | 55 | ||
117 | static void __init emev2_smp_init_cpus(void) | 56 | static void __init emev2_smp_init_cpus(void) |
118 | { | 57 | { |
119 | unsigned int ncores = emev2_get_core_count(); | 58 | unsigned int ncores; |
59 | |||
60 | /* setup EMEV2 specific SCU base */ | ||
61 | shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE); | ||
62 | emev2_clock_init(); /* need ioremapped SMU */ | ||
63 | |||
64 | ncores = shmobile_scu_base ? scu_get_core_count(shmobile_scu_base) : 1; | ||
120 | 65 | ||
121 | shmobile_smp_init_cpus(ncores); | 66 | shmobile_smp_init_cpus(ncores); |
122 | } | 67 | } |
@@ -126,9 +71,4 @@ struct smp_operations emev2_smp_ops __initdata = { | |||
126 | .smp_prepare_cpus = emev2_smp_prepare_cpus, | 71 | .smp_prepare_cpus = emev2_smp_prepare_cpus, |
127 | .smp_secondary_init = emev2_secondary_init, | 72 | .smp_secondary_init = emev2_secondary_init, |
128 | .smp_boot_secondary = emev2_boot_secondary, | 73 | .smp_boot_secondary = emev2_boot_secondary, |
129 | #ifdef CONFIG_HOTPLUG_CPU | ||
130 | .cpu_kill = emev2_cpu_kill, | ||
131 | .cpu_die = shmobile_cpu_die, | ||
132 | .cpu_disable = shmobile_cpu_disable, | ||
133 | #endif | ||
134 | }; | 74 | }; |
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c index 3a4acf23edcf..ea4535a5c4e2 100644 --- a/arch/arm/mach-shmobile/smp-r8a7779.c +++ b/arch/arm/mach-shmobile/smp-r8a7779.c | |||
@@ -26,11 +26,13 @@ | |||
26 | #include <linux/irqchip/arm-gic.h> | 26 | #include <linux/irqchip/arm-gic.h> |
27 | #include <mach/common.h> | 27 | #include <mach/common.h> |
28 | #include <mach/r8a7779.h> | 28 | #include <mach/r8a7779.h> |
29 | #include <asm/cacheflush.h> | ||
29 | #include <asm/smp_plat.h> | 30 | #include <asm/smp_plat.h> |
30 | #include <asm/smp_scu.h> | 31 | #include <asm/smp_scu.h> |
31 | #include <asm/smp_twd.h> | 32 | #include <asm/smp_twd.h> |
32 | 33 | ||
33 | #define AVECR IOMEM(0xfe700040) | 34 | #define AVECR IOMEM(0xfe700040) |
35 | #define R8A7779_SCU_BASE 0xf0000000 | ||
34 | 36 | ||
35 | static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { | 37 | static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { |
36 | .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ | 38 | .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ |
@@ -56,44 +58,14 @@ static struct r8a7779_pm_ch *r8a7779_ch_cpu[4] = { | |||
56 | [3] = &r8a7779_ch_cpu3, | 58 | [3] = &r8a7779_ch_cpu3, |
57 | }; | 59 | }; |
58 | 60 | ||
59 | static void __iomem *scu_base_addr(void) | ||
60 | { | ||
61 | return (void __iomem *)0xf0000000; | ||
62 | } | ||
63 | |||
64 | static DEFINE_SPINLOCK(scu_lock); | ||
65 | static unsigned long tmp; | ||
66 | |||
67 | #ifdef CONFIG_HAVE_ARM_TWD | 61 | #ifdef CONFIG_HAVE_ARM_TWD |
68 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); | 62 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, R8A7779_SCU_BASE + 0x600, 29); |
69 | |||
70 | void __init r8a7779_register_twd(void) | 63 | void __init r8a7779_register_twd(void) |
71 | { | 64 | { |
72 | twd_local_timer_register(&twd_local_timer); | 65 | twd_local_timer_register(&twd_local_timer); |
73 | } | 66 | } |
74 | #endif | 67 | #endif |
75 | 68 | ||
76 | static void modify_scu_cpu_psr(unsigned long set, unsigned long clr) | ||
77 | { | ||
78 | void __iomem *scu_base = scu_base_addr(); | ||
79 | |||
80 | spin_lock(&scu_lock); | ||
81 | tmp = __raw_readl(scu_base + 8); | ||
82 | tmp &= ~clr; | ||
83 | tmp |= set; | ||
84 | spin_unlock(&scu_lock); | ||
85 | |||
86 | /* disable cache coherency after releasing the lock */ | ||
87 | __raw_writel(tmp, scu_base + 8); | ||
88 | } | ||
89 | |||
90 | static unsigned int __init r8a7779_get_core_count(void) | ||
91 | { | ||
92 | void __iomem *scu_base = scu_base_addr(); | ||
93 | |||
94 | return scu_get_core_count(scu_base); | ||
95 | } | ||
96 | |||
97 | static int r8a7779_platform_cpu_kill(unsigned int cpu) | 69 | static int r8a7779_platform_cpu_kill(unsigned int cpu) |
98 | { | 70 | { |
99 | struct r8a7779_pm_ch *ch = NULL; | 71 | struct r8a7779_pm_ch *ch = NULL; |
@@ -101,9 +73,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu) | |||
101 | 73 | ||
102 | cpu = cpu_logical_map(cpu); | 74 | cpu = cpu_logical_map(cpu); |
103 | 75 | ||
104 | /* disable cache coherency */ | ||
105 | modify_scu_cpu_psr(3 << (cpu * 8), 0); | ||
106 | |||
107 | if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) | 76 | if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) |
108 | ch = r8a7779_ch_cpu[cpu]; | 77 | ch = r8a7779_ch_cpu[cpu]; |
109 | 78 | ||
@@ -113,25 +82,6 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu) | |||
113 | return ret ? ret : 1; | 82 | return ret ? ret : 1; |
114 | } | 83 | } |
115 | 84 | ||
116 | static int __maybe_unused r8a7779_cpu_kill(unsigned int cpu) | ||
117 | { | ||
118 | int k; | ||
119 | |||
120 | /* this function is running on another CPU than the offline target, | ||
121 | * here we need wait for shutdown code in platform_cpu_die() to | ||
122 | * finish before asking SoC-specific code to power off the CPU core. | ||
123 | */ | ||
124 | for (k = 0; k < 1000; k++) { | ||
125 | if (shmobile_cpu_is_dead(cpu)) | ||
126 | return r8a7779_platform_cpu_kill(cpu); | ||
127 | |||
128 | mdelay(1); | ||
129 | } | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | |||
135 | static void __cpuinit r8a7779_secondary_init(unsigned int cpu) | 85 | static void __cpuinit r8a7779_secondary_init(unsigned int cpu) |
136 | { | 86 | { |
137 | gic_secondary_init(0); | 87 | gic_secondary_init(0); |
@@ -144,9 +94,6 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct | |||
144 | 94 | ||
145 | cpu = cpu_logical_map(cpu); | 95 | cpu = cpu_logical_map(cpu); |
146 | 96 | ||
147 | /* enable cache coherency */ | ||
148 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | ||
149 | |||
150 | if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) | 97 | if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) |
151 | ch = r8a7779_ch_cpu[cpu]; | 98 | ch = r8a7779_ch_cpu[cpu]; |
152 | 99 | ||
@@ -158,15 +105,13 @@ static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct | |||
158 | 105 | ||
159 | static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) | 106 | static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) |
160 | { | 107 | { |
161 | int cpu = cpu_logical_map(0); | 108 | scu_enable(shmobile_scu_base); |
162 | 109 | ||
163 | scu_enable(scu_base_addr()); | 110 | /* Map the reset vector (in headsmp-scu.S) */ |
111 | __raw_writel(__pa(shmobile_secondary_vector_scu), AVECR); | ||
164 | 112 | ||
165 | /* Map the reset vector (in headsmp.S) */ | 113 | /* enable cache coherency on booting CPU */ |
166 | __raw_writel(__pa(shmobile_secondary_vector), AVECR); | 114 | scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); |
167 | |||
168 | /* enable cache coherency on CPU0 */ | ||
169 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); | ||
170 | 115 | ||
171 | r8a7779_pm_init(); | 116 | r8a7779_pm_init(); |
172 | 117 | ||
@@ -178,10 +123,60 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus) | |||
178 | 123 | ||
179 | static void __init r8a7779_smp_init_cpus(void) | 124 | static void __init r8a7779_smp_init_cpus(void) |
180 | { | 125 | { |
181 | unsigned int ncores = r8a7779_get_core_count(); | 126 | /* setup r8a7779 specific SCU base */ |
127 | shmobile_scu_base = IOMEM(R8A7779_SCU_BASE); | ||
128 | |||
129 | shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base)); | ||
130 | } | ||
182 | 131 | ||
183 | shmobile_smp_init_cpus(ncores); | 132 | #ifdef CONFIG_HOTPLUG_CPU |
133 | static int r8a7779_scu_psr_core_disabled(int cpu) | ||
134 | { | ||
135 | unsigned long mask = 3 << (cpu * 8); | ||
136 | |||
137 | if ((__raw_readl(shmobile_scu_base + 8) & mask) == mask) | ||
138 | return 1; | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int r8a7779_cpu_kill(unsigned int cpu) | ||
144 | { | ||
145 | int k; | ||
146 | |||
147 | /* this function is running on another CPU than the offline target, | ||
148 | * here we need wait for shutdown code in platform_cpu_die() to | ||
149 | * finish before asking SoC-specific code to power off the CPU core. | ||
150 | */ | ||
151 | for (k = 0; k < 1000; k++) { | ||
152 | if (r8a7779_scu_psr_core_disabled(cpu)) | ||
153 | return r8a7779_platform_cpu_kill(cpu); | ||
154 | |||
155 | mdelay(1); | ||
156 | } | ||
157 | |||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static void r8a7779_cpu_die(unsigned int cpu) | ||
162 | { | ||
163 | dsb(); | ||
164 | flush_cache_all(); | ||
165 | |||
166 | /* disable cache coherency */ | ||
167 | scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF); | ||
168 | |||
169 | /* Endless loop until power off from r8a7779_cpu_kill() */ | ||
170 | while (1) | ||
171 | cpu_do_idle(); | ||
172 | } | ||
173 | |||
174 | static int r8a7779_cpu_disable(unsigned int cpu) | ||
175 | { | ||
176 | /* only CPU1->3 have power domains, do not allow hotplug of CPU0 */ | ||
177 | return cpu == 0 ? -EPERM : 0; | ||
184 | } | 178 | } |
179 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
185 | 180 | ||
186 | struct smp_operations r8a7779_smp_ops __initdata = { | 181 | struct smp_operations r8a7779_smp_ops __initdata = { |
187 | .smp_init_cpus = r8a7779_smp_init_cpus, | 182 | .smp_init_cpus = r8a7779_smp_init_cpus, |
@@ -190,7 +185,7 @@ struct smp_operations r8a7779_smp_ops __initdata = { | |||
190 | .smp_boot_secondary = r8a7779_boot_secondary, | 185 | .smp_boot_secondary = r8a7779_boot_secondary, |
191 | #ifdef CONFIG_HOTPLUG_CPU | 186 | #ifdef CONFIG_HOTPLUG_CPU |
192 | .cpu_kill = r8a7779_cpu_kill, | 187 | .cpu_kill = r8a7779_cpu_kill, |
193 | .cpu_die = shmobile_cpu_die, | 188 | .cpu_die = r8a7779_cpu_die, |
194 | .cpu_disable = shmobile_cpu_disable, | 189 | .cpu_disable = r8a7779_cpu_disable, |
195 | #endif | 190 | #endif |
196 | }; | 191 | }; |
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c index acb46a94ccdf..5ae502b16437 100644 --- a/arch/arm/mach-shmobile/smp-sh73a0.c +++ b/arch/arm/mach-shmobile/smp-sh73a0.c | |||
@@ -39,26 +39,16 @@ | |||
39 | 39 | ||
40 | #define PSTR_SHUTDOWN_MODE 3 | 40 | #define PSTR_SHUTDOWN_MODE 3 |
41 | 41 | ||
42 | static void __iomem *scu_base_addr(void) | 42 | #define SH73A0_SCU_BASE 0xf0000000 |
43 | { | ||
44 | return (void __iomem *)0xf0000000; | ||
45 | } | ||
46 | 43 | ||
47 | #ifdef CONFIG_HAVE_ARM_TWD | 44 | #ifdef CONFIG_HAVE_ARM_TWD |
48 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29); | 45 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, SH73A0_SCU_BASE + 0x600, 29); |
49 | void __init sh73a0_register_twd(void) | 46 | void __init sh73a0_register_twd(void) |
50 | { | 47 | { |
51 | twd_local_timer_register(&twd_local_timer); | 48 | twd_local_timer_register(&twd_local_timer); |
52 | } | 49 | } |
53 | #endif | 50 | #endif |
54 | 51 | ||
55 | static unsigned int __init sh73a0_get_core_count(void) | ||
56 | { | ||
57 | void __iomem *scu_base = scu_base_addr(); | ||
58 | |||
59 | return scu_get_core_count(scu_base); | ||
60 | } | ||
61 | |||
62 | static void __cpuinit sh73a0_secondary_init(unsigned int cpu) | 52 | static void __cpuinit sh73a0_secondary_init(unsigned int cpu) |
63 | { | 53 | { |
64 | gic_secondary_init(0); | 54 | gic_secondary_init(0); |
@@ -78,21 +68,22 @@ static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct | |||
78 | 68 | ||
79 | static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) | 69 | static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) |
80 | { | 70 | { |
81 | scu_enable(scu_base_addr()); | 71 | scu_enable(shmobile_scu_base); |
82 | 72 | ||
83 | /* Map the reset vector (in headsmp-sh73a0.S) */ | 73 | /* Map the reset vector (in headsmp-scu.S) */ |
84 | __raw_writel(0, APARMBAREA); /* 4k */ | 74 | __raw_writel(0, APARMBAREA); /* 4k */ |
85 | __raw_writel(__pa(sh73a0_secondary_vector), SBAR); | 75 | __raw_writel(__pa(shmobile_secondary_vector_scu), SBAR); |
86 | 76 | ||
87 | /* enable cache coherency on booting CPU */ | 77 | /* enable cache coherency on booting CPU */ |
88 | scu_power_mode(scu_base_addr(), SCU_PM_NORMAL); | 78 | scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); |
89 | } | 79 | } |
90 | 80 | ||
91 | static void __init sh73a0_smp_init_cpus(void) | 81 | static void __init sh73a0_smp_init_cpus(void) |
92 | { | 82 | { |
93 | unsigned int ncores = sh73a0_get_core_count(); | 83 | /* setup sh73a0 specific SCU base */ |
84 | shmobile_scu_base = IOMEM(SH73A0_SCU_BASE); | ||
94 | 85 | ||
95 | shmobile_smp_init_cpus(ncores); | 86 | shmobile_smp_init_cpus(scu_get_core_count(shmobile_scu_base)); |
96 | } | 87 | } |
97 | 88 | ||
98 | #ifdef CONFIG_HOTPLUG_CPU | 89 | #ifdef CONFIG_HOTPLUG_CPU |
@@ -128,11 +119,16 @@ static void sh73a0_cpu_die(unsigned int cpu) | |||
128 | flush_cache_all(); | 119 | flush_cache_all(); |
129 | 120 | ||
130 | /* Set power off mode. This takes the CPU out of the MP cluster */ | 121 | /* Set power off mode. This takes the CPU out of the MP cluster */ |
131 | scu_power_mode(scu_base_addr(), SCU_PM_POWEROFF); | 122 | scu_power_mode(shmobile_scu_base, SCU_PM_POWEROFF); |
132 | 123 | ||
133 | /* Enter shutdown mode */ | 124 | /* Enter shutdown mode */ |
134 | cpu_do_idle(); | 125 | cpu_do_idle(); |
135 | } | 126 | } |
127 | |||
128 | static int sh73a0_cpu_disable(unsigned int cpu) | ||
129 | { | ||
130 | return 0; /* CPU0 and CPU1 supported */ | ||
131 | } | ||
136 | #endif /* CONFIG_HOTPLUG_CPU */ | 132 | #endif /* CONFIG_HOTPLUG_CPU */ |
137 | 133 | ||
138 | struct smp_operations sh73a0_smp_ops __initdata = { | 134 | struct smp_operations sh73a0_smp_ops __initdata = { |
@@ -143,6 +139,6 @@ struct smp_operations sh73a0_smp_ops __initdata = { | |||
143 | #ifdef CONFIG_HOTPLUG_CPU | 139 | #ifdef CONFIG_HOTPLUG_CPU |
144 | .cpu_kill = sh73a0_cpu_kill, | 140 | .cpu_kill = sh73a0_cpu_kill, |
145 | .cpu_die = sh73a0_cpu_die, | 141 | .cpu_die = sh73a0_cpu_die, |
146 | .cpu_disable = shmobile_cpu_disable_any, | 142 | .cpu_disable = sh73a0_cpu_disable, |
147 | #endif | 143 | #endif |
148 | }; | 144 | }; |
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 3d16d4dff01b..f321dbeb2379 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
@@ -19,10 +19,8 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/clocksource.h> | ||
22 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
23 | #include <asm/arch_timer.h> | ||
24 | #include <asm/mach/time.h> | ||
25 | #include <asm/smp_twd.h> | ||
26 | 24 | ||
27 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | 25 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, |
28 | unsigned int mult, unsigned int div) | 26 | unsigned int mult, unsigned int div) |
@@ -63,6 +61,5 @@ void __init shmobile_earlytimer_init(void) | |||
63 | 61 | ||
64 | void __init shmobile_timer_init(void) | 62 | void __init shmobile_timer_init(void) |
65 | { | 63 | { |
66 | arch_timer_of_register(); | 64 | clocksource_of_init(); |
67 | arch_timer_sched_clock_init(); | ||
68 | } | 65 | } |
diff --git a/arch/arm/mach-spear/spear13xx.c b/arch/arm/mach-spear/spear13xx.c index 3975916666a0..3621599c38ad 100644 --- a/arch/arm/mach-spear/spear13xx.c +++ b/arch/arm/mach-spear/spear13xx.c | |||
@@ -15,13 +15,13 @@ | |||
15 | 15 | ||
16 | #include <linux/amba/pl022.h> | 16 | #include <linux/amba/pl022.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/clocksource.h> | ||
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/of.h> | 20 | #include <linux/of.h> |
20 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
21 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
22 | #include <asm/smp_twd.h> | ||
23 | #include "generic.h" | ||
24 | #include <mach/spear.h> | 23 | #include <mach/spear.h> |
24 | #include "generic.h" | ||
25 | 25 | ||
26 | void __init spear13xx_l2x0_init(void) | 26 | void __init spear13xx_l2x0_init(void) |
27 | { | 27 | { |
@@ -122,5 +122,5 @@ void __init spear13xx_timer_init(void) | |||
122 | clk_put(pclk); | 122 | clk_put(pclk); |
123 | 123 | ||
124 | spear_setup_of_timer(); | 124 | spear_setup_of_timer(); |
125 | twd_local_timer_of_register(); | 125 | clocksource_of_init(); |
126 | } | 126 | } |
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index f6b46ae2b7f8..e40326d0e29f 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -10,6 +10,7 @@ obj-y += pm.o | |||
10 | obj-y += reset.o | 10 | obj-y += reset.o |
11 | obj-y += reset-handler.o | 11 | obj-y += reset-handler.o |
12 | obj-y += sleep.o | 12 | obj-y += sleep.o |
13 | obj-y += tegra.o | ||
13 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | 14 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o |
14 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o | 15 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o |
15 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o | 16 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o |
@@ -27,9 +28,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | |||
27 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o | 28 | obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o |
28 | obj-$(CONFIG_TEGRA_PCI) += pcie.o | 29 | obj-$(CONFIG_TEGRA_PCI) += pcie.o |
29 | 30 | ||
30 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o | 31 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o |
31 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o | ||
32 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra114.o | ||
33 | ifeq ($(CONFIG_CPU_IDLE),y) | 32 | ifeq ($(CONFIG_CPU_IDLE),y) |
34 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o | 33 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o |
35 | endif | 34 | endif |
diff --git a/arch/arm/mach-tegra/board-dt-tegra114.c b/arch/arm/mach-tegra/board-dt-tegra114.c deleted file mode 100644 index 085d63637b62..000000000000 --- a/arch/arm/mach-tegra/board-dt-tegra114.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * NVIDIA Tegra114 device tree board support | ||
3 | * | ||
4 | * Copyright (C) 2013 NVIDIA Corporation | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/of.h> | ||
18 | #include <linux/of_platform.h> | ||
19 | #include <linux/clocksource.h> | ||
20 | |||
21 | #include <asm/mach/arch.h> | ||
22 | |||
23 | #include "board.h" | ||
24 | #include "common.h" | ||
25 | |||
26 | static void __init tegra114_dt_init(void) | ||
27 | { | ||
28 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
29 | } | ||
30 | |||
31 | static const char * const tegra114_dt_board_compat[] = { | ||
32 | "nvidia,tegra114", | ||
33 | NULL, | ||
34 | }; | ||
35 | |||
36 | DT_MACHINE_START(TEGRA114_DT, "NVIDIA Tegra114 (Flattened Device Tree)") | ||
37 | .smp = smp_ops(tegra_smp_ops), | ||
38 | .map_io = tegra_map_common_io, | ||
39 | .init_early = tegra114_init_early, | ||
40 | .init_irq = tegra_dt_init_irq, | ||
41 | .init_time = clocksource_of_init, | ||
42 | .init_machine = tegra114_dt_init, | ||
43 | .init_late = tegra_init_late, | ||
44 | .restart = tegra_assert_system_reset, | ||
45 | .dt_compat = tegra114_dt_board_compat, | ||
46 | MACHINE_END | ||
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c deleted file mode 100644 index bf68567e549d..000000000000 --- a/arch/arm/mach-tegra/board-dt-tegra30.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/board-dt-tegra30.c | ||
3 | * | ||
4 | * NVIDIA Tegra30 device tree board support | ||
5 | * | ||
6 | * Copyright (C) 2011 NVIDIA Corporation | ||
7 | * | ||
8 | * Derived from: | ||
9 | * | ||
10 | * arch/arm/mach-tegra/board-dt-tegra20.c | ||
11 | * | ||
12 | * Copyright (C) 2010 Secret Lab Technologies, Ltd. | ||
13 | * Copyright (C) 2010 Google, Inc. | ||
14 | * | ||
15 | * This software is licensed under the terms of the GNU General Public | ||
16 | * License version 2, as published by the Free Software Foundation, and | ||
17 | * may be copied, distributed, and modified under those terms. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | #include <linux/clocksource.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/of.h> | ||
29 | #include <linux/of_address.h> | ||
30 | #include <linux/of_fdt.h> | ||
31 | #include <linux/of_irq.h> | ||
32 | #include <linux/of_platform.h> | ||
33 | |||
34 | #include <asm/mach/arch.h> | ||
35 | |||
36 | #include "board.h" | ||
37 | #include "common.h" | ||
38 | #include "iomap.h" | ||
39 | |||
40 | static void __init tegra30_dt_init(void) | ||
41 | { | ||
42 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
43 | } | ||
44 | |||
45 | static const char *tegra30_dt_board_compat[] = { | ||
46 | "nvidia,tegra30", | ||
47 | NULL | ||
48 | }; | ||
49 | |||
50 | DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)") | ||
51 | .smp = smp_ops(tegra_smp_ops), | ||
52 | .map_io = tegra_map_common_io, | ||
53 | .init_early = tegra30_init_early, | ||
54 | .init_irq = tegra_dt_init_irq, | ||
55 | .init_time = clocksource_of_init, | ||
56 | .init_machine = tegra30_dt_init, | ||
57 | .init_late = tegra_init_late, | ||
58 | .restart = tegra_assert_system_reset, | ||
59 | .dt_compat = tegra30_dt_board_compat, | ||
60 | MACHINE_END | ||
diff --git a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c index 3cdc1bb8254c..035b240b9e15 100644 --- a/arch/arm/mach-tegra/board-harmony-pcie.c +++ b/arch/arm/mach-tegra/board-harmony-pcie.c | |||
@@ -56,13 +56,17 @@ int __init harmony_pcie_init(void) | |||
56 | gpio_direction_output(en_vdd_1v05, 1); | 56 | gpio_direction_output(en_vdd_1v05, 1); |
57 | 57 | ||
58 | regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk"); | 58 | regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk"); |
59 | if (IS_ERR_OR_NULL(regulator)) { | 59 | if (IS_ERR(regulator)) { |
60 | pr_err("%s: regulator_get failed: %d\n", __func__, | 60 | err = PTR_ERR(regulator); |
61 | (int)PTR_ERR(regulator)); | 61 | pr_err("%s: regulator_get failed: %d\n", __func__, err); |
62 | goto err_reg; | 62 | goto err_reg; |
63 | } | 63 | } |
64 | 64 | ||
65 | regulator_enable(regulator); | 65 | err = regulator_enable(regulator); |
66 | if (err) { | ||
67 | pr_err("%s: regulator_enable failed: %d\n", __func__, err); | ||
68 | goto err_en; | ||
69 | } | ||
66 | 70 | ||
67 | err = tegra_pcie_init(true, true); | 71 | err = tegra_pcie_init(true, true); |
68 | if (err) { | 72 | if (err) { |
@@ -74,6 +78,7 @@ int __init harmony_pcie_init(void) | |||
74 | 78 | ||
75 | err_pcie: | 79 | err_pcie: |
76 | regulator_disable(regulator); | 80 | regulator_disable(regulator); |
81 | err_en: | ||
77 | regulator_put(regulator); | 82 | regulator_put(regulator); |
78 | err_reg: | 83 | err_reg: |
79 | gpio_free(en_vdd_1v05); | 84 | gpio_free(en_vdd_1v05); |
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index 86851c81a350..60431de585ca 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h | |||
@@ -26,9 +26,7 @@ | |||
26 | 26 | ||
27 | void tegra_assert_system_reset(char mode, const char *cmd); | 27 | void tegra_assert_system_reset(char mode, const char *cmd); |
28 | 28 | ||
29 | void __init tegra20_init_early(void); | 29 | void __init tegra_init_early(void); |
30 | void __init tegra30_init_early(void); | ||
31 | void __init tegra114_init_early(void); | ||
32 | void __init tegra_map_common_io(void); | 30 | void __init tegra_map_common_io(void); |
33 | void __init tegra_init_irq(void); | 31 | void __init tegra_init_irq(void); |
34 | void __init tegra_dt_init_irq(void); | 32 | void __init tegra_dt_init_irq(void); |
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 5449a3f2977b..eb1f3c8c74cc 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "common.h" | 33 | #include "common.h" |
34 | #include "fuse.h" | 34 | #include "fuse.h" |
35 | #include "iomap.h" | 35 | #include "iomap.h" |
36 | #include "irq.h" | ||
36 | #include "pmc.h" | 37 | #include "pmc.h" |
37 | #include "apbio.h" | 38 | #include "apbio.h" |
38 | #include "sleep.h" | 39 | #include "sleep.h" |
@@ -61,8 +62,10 @@ u32 tegra_uart_config[4] = { | |||
61 | void __init tegra_dt_init_irq(void) | 62 | void __init tegra_dt_init_irq(void) |
62 | { | 63 | { |
63 | tegra_clocks_init(); | 64 | tegra_clocks_init(); |
65 | tegra_pmc_init(); | ||
64 | tegra_init_irq(); | 66 | tegra_init_irq(); |
65 | irqchip_init(); | 67 | irqchip_init(); |
68 | tegra_legacy_irq_syscore_init(); | ||
66 | } | 69 | } |
67 | #endif | 70 | #endif |
68 | 71 | ||
@@ -94,40 +97,18 @@ static void __init tegra_init_cache(void) | |||
94 | 97 | ||
95 | } | 98 | } |
96 | 99 | ||
97 | static void __init tegra_init_early(void) | 100 | void __init tegra_init_early(void) |
98 | { | 101 | { |
99 | tegra_cpu_reset_handler_init(); | 102 | tegra_cpu_reset_handler_init(); |
100 | tegra_apb_io_init(); | 103 | tegra_apb_io_init(); |
101 | tegra_init_fuse(); | 104 | tegra_init_fuse(); |
102 | tegra_init_cache(); | 105 | tegra_init_cache(); |
103 | tegra_pmc_init(); | ||
104 | tegra_powergate_init(); | 106 | tegra_powergate_init(); |
107 | tegra_hotplug_init(); | ||
105 | } | 108 | } |
106 | 109 | ||
107 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
108 | void __init tegra20_init_early(void) | ||
109 | { | ||
110 | tegra_init_early(); | ||
111 | tegra20_hotplug_init(); | ||
112 | } | ||
113 | #endif | ||
114 | |||
115 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
116 | void __init tegra30_init_early(void) | ||
117 | { | ||
118 | tegra_init_early(); | ||
119 | tegra30_hotplug_init(); | ||
120 | } | ||
121 | #endif | ||
122 | |||
123 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
124 | void __init tegra114_init_early(void) | ||
125 | { | ||
126 | tegra_init_early(); | ||
127 | } | ||
128 | #endif | ||
129 | |||
130 | void __init tegra_init_late(void) | 110 | void __init tegra_init_late(void) |
131 | { | 111 | { |
112 | tegra_init_suspend(); | ||
132 | tegra_powergate_debugfs_init(); | 113 | tegra_powergate_debugfs_init(); |
133 | } | 114 | } |
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c index 825ced4f7a40..8bbbdebed882 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra20.c +++ b/arch/arm/mach-tegra/cpuidle-tegra20.c | |||
@@ -130,10 +130,6 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev, | |||
130 | struct cpuidle_driver *drv, | 130 | struct cpuidle_driver *drv, |
131 | int index) | 131 | int index) |
132 | { | 132 | { |
133 | struct cpuidle_state *state = &drv->states[index]; | ||
134 | u32 cpu_on_time = state->exit_latency; | ||
135 | u32 cpu_off_time = state->target_residency - state->exit_latency; | ||
136 | |||
137 | while (tegra20_cpu_is_resettable_soon()) | 133 | while (tegra20_cpu_is_resettable_soon()) |
138 | cpu_relax(); | 134 | cpu_relax(); |
139 | 135 | ||
@@ -142,7 +138,7 @@ static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev, | |||
142 | 138 | ||
143 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); | 139 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); |
144 | 140 | ||
145 | tegra_idle_lp2_last(cpu_on_time, cpu_off_time); | 141 | tegra_idle_lp2_last(); |
146 | 142 | ||
147 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); | 143 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); |
148 | 144 | ||
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c index 8b50cf4ddd6f..c0931c8bb3e5 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra30.c +++ b/arch/arm/mach-tegra/cpuidle-tegra30.c | |||
@@ -72,10 +72,6 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev, | |||
72 | struct cpuidle_driver *drv, | 72 | struct cpuidle_driver *drv, |
73 | int index) | 73 | int index) |
74 | { | 74 | { |
75 | struct cpuidle_state *state = &drv->states[index]; | ||
76 | u32 cpu_on_time = state->exit_latency; | ||
77 | u32 cpu_off_time = state->target_residency - state->exit_latency; | ||
78 | |||
79 | /* All CPUs entering LP2 is not working. | 75 | /* All CPUs entering LP2 is not working. |
80 | * Don't let CPU0 enter LP2 when any secondary CPU is online. | 76 | * Don't let CPU0 enter LP2 when any secondary CPU is online. |
81 | */ | 77 | */ |
@@ -86,7 +82,7 @@ static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev, | |||
86 | 82 | ||
87 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); | 83 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); |
88 | 84 | ||
89 | tegra_idle_lp2_last(cpu_on_time, cpu_off_time); | 85 | tegra_idle_lp2_last(); |
90 | 86 | ||
91 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); | 87 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); |
92 | 88 | ||
@@ -102,12 +98,8 @@ static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev, | |||
102 | 98 | ||
103 | smp_wmb(); | 99 | smp_wmb(); |
104 | 100 | ||
105 | save_cpu_arch_register(); | ||
106 | |||
107 | cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); | 101 | cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); |
108 | 102 | ||
109 | restore_cpu_arch_register(); | ||
110 | |||
111 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); | 103 | clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); |
112 | 104 | ||
113 | return true; | 105 | return true; |
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c index f7db0782a6b6..e035cd284a6e 100644 --- a/arch/arm/mach-tegra/fuse.c +++ b/arch/arm/mach-tegra/fuse.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * arch/arm/mach-tegra/fuse.c | 2 | * arch/arm/mach-tegra/fuse.c |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010 Google, Inc. |
5 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | 6 | * |
6 | * Author: | 7 | * Author: |
7 | * Colin Cross <ccross@android.com> | 8 | * Colin Cross <ccross@android.com> |
@@ -137,6 +138,9 @@ void tegra_init_fuse(void) | |||
137 | tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT; | 138 | tegra_fuse_spare_bit = TEGRA30_FUSE_SPARE_BIT; |
138 | tegra_init_speedo_data = &tegra30_init_speedo_data; | 139 | tegra_init_speedo_data = &tegra30_init_speedo_data; |
139 | break; | 140 | break; |
141 | case TEGRA114: | ||
142 | tegra_init_speedo_data = &tegra114_init_speedo_data; | ||
143 | break; | ||
140 | default: | 144 | default: |
141 | pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id); | 145 | pr_warn("Tegra: unknown chip id %d\n", tegra_chip_id); |
142 | tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT; | 146 | tegra_fuse_spare_bit = TEGRA20_FUSE_SPARE_BIT; |
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h index da78434678c7..aacc00d05980 100644 --- a/arch/arm/mach-tegra/fuse.h +++ b/arch/arm/mach-tegra/fuse.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2010 Google, Inc. | 2 | * Copyright (C) 2010 Google, Inc. |
3 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | 4 | * |
4 | * Author: | 5 | * Author: |
5 | * Colin Cross <ccross@android.com> | 6 | * Colin Cross <ccross@android.com> |
@@ -66,4 +67,10 @@ void tegra30_init_speedo_data(void); | |||
66 | static inline void tegra30_init_speedo_data(void) {} | 67 | static inline void tegra30_init_speedo_data(void) {} |
67 | #endif | 68 | #endif |
68 | 69 | ||
70 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
71 | void tegra114_init_speedo_data(void); | ||
72 | #else | ||
73 | static inline void tegra114_init_speedo_data(void) {} | ||
74 | #endif | ||
75 | |||
69 | #endif | 76 | #endif |
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S index fd473f2b4c3d..045c16f2dd51 100644 --- a/arch/arm/mach-tegra/headsmp.S +++ b/arch/arm/mach-tegra/headsmp.S | |||
@@ -7,8 +7,5 @@ | |||
7 | 7 | ||
8 | ENTRY(tegra_secondary_startup) | 8 | ENTRY(tegra_secondary_startup) |
9 | bl v7_invalidate_l1 | 9 | bl v7_invalidate_l1 |
10 | /* Enable coresight */ | ||
11 | mov32 r0, 0xC5ACCE55 | ||
12 | mcr p14, 0, r0, c7, c12, 6 | ||
13 | b secondary_startup | 10 | b secondary_startup |
14 | ENDPROC(tegra_secondary_startup) | 11 | ENDPROC(tegra_secondary_startup) |
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index a599f6e36dea..8da9f78475da 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * | ||
3 | * Copyright (C) 2002 ARM Ltd. | 2 | * Copyright (C) 2002 ARM Ltd. |
4 | * All Rights Reserved | 3 | * All Rights Reserved |
5 | * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. | 4 | * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved. |
6 | * | 5 | * |
7 | * This program is free software; you can redistribute it and/or modify | 6 | * 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 | 7 | * it under the terms of the GNU General Public License version 2 as |
@@ -15,6 +14,7 @@ | |||
15 | #include <asm/cacheflush.h> | 14 | #include <asm/cacheflush.h> |
16 | #include <asm/smp_plat.h> | 15 | #include <asm/smp_plat.h> |
17 | 16 | ||
17 | #include "fuse.h" | ||
18 | #include "sleep.h" | 18 | #include "sleep.h" |
19 | 19 | ||
20 | static void (*tegra_hotplug_shutdown)(void); | 20 | static void (*tegra_hotplug_shutdown)(void); |
@@ -56,18 +56,13 @@ int tegra_cpu_disable(unsigned int cpu) | |||
56 | return cpu == 0 ? -EPERM : 0; | 56 | return cpu == 0 ? -EPERM : 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | 59 | void __init tegra_hotplug_init(void) |
60 | extern void tegra20_hotplug_shutdown(void); | ||
61 | void __init tegra20_hotplug_init(void) | ||
62 | { | 60 | { |
63 | tegra_hotplug_shutdown = tegra20_hotplug_shutdown; | 61 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) |
64 | } | 62 | return; |
65 | #endif | ||
66 | 63 | ||
67 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | 64 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) |
68 | extern void tegra30_hotplug_shutdown(void); | 65 | tegra_hotplug_shutdown = tegra20_hotplug_shutdown; |
69 | void __init tegra30_hotplug_init(void) | 66 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) |
70 | { | 67 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
71 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; | ||
72 | } | 68 | } |
73 | #endif | ||
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index 1952e82797cc..0de4eed1493d 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Author: | 4 | * Author: |
5 | * Colin Cross <ccross@android.com> | 5 | * Colin Cross <ccross@android.com> |
6 | * | 6 | * |
7 | * Copyright (C) 2010, NVIDIA Corporation | 7 | * Copyright (C) 2010,2013, NVIDIA Corporation |
8 | * | 8 | * |
9 | * This software is licensed under the terms of the GNU General Public | 9 | * This software is licensed under the terms of the GNU General Public |
10 | * License version 2, as published by the Free Software Foundation, and | 10 | * License version 2, as published by the Free Software Foundation, and |
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/of.h> | 24 | #include <linux/of.h> |
25 | #include <linux/irqchip/arm-gic.h> | 25 | #include <linux/irqchip/arm-gic.h> |
26 | #include <linux/syscore_ops.h> | ||
26 | 27 | ||
27 | #include "board.h" | 28 | #include "board.h" |
28 | #include "iomap.h" | 29 | #include "iomap.h" |
@@ -43,6 +44,7 @@ | |||
43 | #define ICTLR_COP_IEP_CLASS 0x3c | 44 | #define ICTLR_COP_IEP_CLASS 0x3c |
44 | 45 | ||
45 | #define FIRST_LEGACY_IRQ 32 | 46 | #define FIRST_LEGACY_IRQ 32 |
47 | #define TEGRA_MAX_NUM_ICTLRS 5 | ||
46 | 48 | ||
47 | #define SGI_MASK 0xFFFF | 49 | #define SGI_MASK 0xFFFF |
48 | 50 | ||
@@ -56,6 +58,15 @@ static void __iomem *ictlr_reg_base[] = { | |||
56 | IO_ADDRESS(TEGRA_QUINARY_ICTLR_BASE), | 58 | IO_ADDRESS(TEGRA_QUINARY_ICTLR_BASE), |
57 | }; | 59 | }; |
58 | 60 | ||
61 | #ifdef CONFIG_PM_SLEEP | ||
62 | static u32 cop_ier[TEGRA_MAX_NUM_ICTLRS]; | ||
63 | static u32 cop_iep[TEGRA_MAX_NUM_ICTLRS]; | ||
64 | static u32 cpu_ier[TEGRA_MAX_NUM_ICTLRS]; | ||
65 | static u32 cpu_iep[TEGRA_MAX_NUM_ICTLRS]; | ||
66 | |||
67 | static u32 ictlr_wake_mask[TEGRA_MAX_NUM_ICTLRS]; | ||
68 | #endif | ||
69 | |||
59 | bool tegra_pending_sgi(void) | 70 | bool tegra_pending_sgi(void) |
60 | { | 71 | { |
61 | u32 pending_set; | 72 | u32 pending_set; |
@@ -125,6 +136,87 @@ static int tegra_retrigger(struct irq_data *d) | |||
125 | return 1; | 136 | return 1; |
126 | } | 137 | } |
127 | 138 | ||
139 | #ifdef CONFIG_PM_SLEEP | ||
140 | static int tegra_set_wake(struct irq_data *d, unsigned int enable) | ||
141 | { | ||
142 | u32 irq = d->irq; | ||
143 | u32 index, mask; | ||
144 | |||
145 | if (irq < FIRST_LEGACY_IRQ || | ||
146 | irq >= FIRST_LEGACY_IRQ + num_ictlrs * 32) | ||
147 | return -EINVAL; | ||
148 | |||
149 | index = ((irq - FIRST_LEGACY_IRQ) / 32); | ||
150 | mask = BIT((irq - FIRST_LEGACY_IRQ) % 32); | ||
151 | if (enable) | ||
152 | ictlr_wake_mask[index] |= mask; | ||
153 | else | ||
154 | ictlr_wake_mask[index] &= ~mask; | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int tegra_legacy_irq_suspend(void) | ||
160 | { | ||
161 | unsigned long flags; | ||
162 | int i; | ||
163 | |||
164 | local_irq_save(flags); | ||
165 | for (i = 0; i < num_ictlrs; i++) { | ||
166 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
167 | /* Save interrupt state */ | ||
168 | cpu_ier[i] = readl_relaxed(ictlr + ICTLR_CPU_IER); | ||
169 | cpu_iep[i] = readl_relaxed(ictlr + ICTLR_CPU_IEP_CLASS); | ||
170 | cop_ier[i] = readl_relaxed(ictlr + ICTLR_COP_IER); | ||
171 | cop_iep[i] = readl_relaxed(ictlr + ICTLR_COP_IEP_CLASS); | ||
172 | |||
173 | /* Disable COP interrupts */ | ||
174 | writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); | ||
175 | |||
176 | /* Disable CPU interrupts */ | ||
177 | writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); | ||
178 | |||
179 | /* Enable the wakeup sources of ictlr */ | ||
180 | writel_relaxed(ictlr_wake_mask[i], ictlr + ICTLR_CPU_IER_SET); | ||
181 | } | ||
182 | local_irq_restore(flags); | ||
183 | |||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | static void tegra_legacy_irq_resume(void) | ||
188 | { | ||
189 | unsigned long flags; | ||
190 | int i; | ||
191 | |||
192 | local_irq_save(flags); | ||
193 | for (i = 0; i < num_ictlrs; i++) { | ||
194 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
195 | writel_relaxed(cpu_iep[i], ictlr + ICTLR_CPU_IEP_CLASS); | ||
196 | writel_relaxed(~0ul, ictlr + ICTLR_CPU_IER_CLR); | ||
197 | writel_relaxed(cpu_ier[i], ictlr + ICTLR_CPU_IER_SET); | ||
198 | writel_relaxed(cop_iep[i], ictlr + ICTLR_COP_IEP_CLASS); | ||
199 | writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR); | ||
200 | writel_relaxed(cop_ier[i], ictlr + ICTLR_COP_IER_SET); | ||
201 | } | ||
202 | local_irq_restore(flags); | ||
203 | } | ||
204 | |||
205 | static struct syscore_ops tegra_legacy_irq_syscore_ops = { | ||
206 | .suspend = tegra_legacy_irq_suspend, | ||
207 | .resume = tegra_legacy_irq_resume, | ||
208 | }; | ||
209 | |||
210 | int tegra_legacy_irq_syscore_init(void) | ||
211 | { | ||
212 | register_syscore_ops(&tegra_legacy_irq_syscore_ops); | ||
213 | |||
214 | return 0; | ||
215 | } | ||
216 | #else | ||
217 | #define tegra_set_wake NULL | ||
218 | #endif | ||
219 | |||
128 | void __init tegra_init_irq(void) | 220 | void __init tegra_init_irq(void) |
129 | { | 221 | { |
130 | int i; | 222 | int i; |
@@ -150,6 +242,8 @@ void __init tegra_init_irq(void) | |||
150 | gic_arch_extn.irq_mask = tegra_mask; | 242 | gic_arch_extn.irq_mask = tegra_mask; |
151 | gic_arch_extn.irq_unmask = tegra_unmask; | 243 | gic_arch_extn.irq_unmask = tegra_unmask; |
152 | gic_arch_extn.irq_retrigger = tegra_retrigger; | 244 | gic_arch_extn.irq_retrigger = tegra_retrigger; |
245 | gic_arch_extn.irq_set_wake = tegra_set_wake; | ||
246 | gic_arch_extn.flags = IRQCHIP_MASK_ON_SUSPEND; | ||
153 | 247 | ||
154 | /* | 248 | /* |
155 | * Check if there is a devicetree present, since the GIC will be | 249 | * Check if there is a devicetree present, since the GIC will be |
diff --git a/arch/arm/mach-tegra/irq.h b/arch/arm/mach-tegra/irq.h index 5142649bba05..bc05ce5613fb 100644 --- a/arch/arm/mach-tegra/irq.h +++ b/arch/arm/mach-tegra/irq.h | |||
@@ -19,4 +19,10 @@ | |||
19 | 19 | ||
20 | bool tegra_pending_sgi(void); | 20 | bool tegra_pending_sgi(void); |
21 | 21 | ||
22 | #ifdef CONFIG_PM_SLEEP | ||
23 | int tegra_legacy_irq_syscore_init(void); | ||
24 | #else | ||
25 | static inline int tegra_legacy_irq_syscore_init(void) { return 0; } | ||
26 | #endif | ||
27 | |||
22 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c index 2c6b3d55213b..516aab28fe34 100644 --- a/arch/arm/mach-tegra/platsmp.c +++ b/arch/arm/mach-tegra/platsmp.c | |||
@@ -26,22 +26,16 @@ | |||
26 | #include <asm/smp_scu.h> | 26 | #include <asm/smp_scu.h> |
27 | #include <asm/smp_plat.h> | 27 | #include <asm/smp_plat.h> |
28 | 28 | ||
29 | #include <mach/powergate.h> | ||
30 | |||
31 | #include "fuse.h" | 29 | #include "fuse.h" |
32 | #include "flowctrl.h" | 30 | #include "flowctrl.h" |
33 | #include "reset.h" | 31 | #include "reset.h" |
32 | #include "pmc.h" | ||
34 | 33 | ||
35 | #include "common.h" | 34 | #include "common.h" |
36 | #include "iomap.h" | 35 | #include "iomap.h" |
37 | 36 | ||
38 | extern void tegra_secondary_startup(void); | ||
39 | |||
40 | static cpumask_t tegra_cpu_init_mask; | 37 | static cpumask_t tegra_cpu_init_mask; |
41 | 38 | ||
42 | #define EVP_CPU_RESET_VECTOR \ | ||
43 | (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100) | ||
44 | |||
45 | static void __cpuinit tegra_secondary_init(unsigned int cpu) | 39 | static void __cpuinit tegra_secondary_init(unsigned int cpu) |
46 | { | 40 | { |
47 | /* | 41 | /* |
@@ -54,25 +48,43 @@ static void __cpuinit tegra_secondary_init(unsigned int cpu) | |||
54 | cpumask_set_cpu(cpu, &tegra_cpu_init_mask); | 48 | cpumask_set_cpu(cpu, &tegra_cpu_init_mask); |
55 | } | 49 | } |
56 | 50 | ||
57 | static int tegra20_power_up_cpu(unsigned int cpu) | 51 | |
52 | static int tegra20_boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
58 | { | 53 | { |
59 | /* Enable the CPU clock. */ | 54 | cpu = cpu_logical_map(cpu); |
60 | tegra_enable_cpu_clock(cpu); | 55 | |
56 | /* | ||
57 | * Force the CPU into reset. The CPU must remain in reset when | ||
58 | * the flow controller state is cleared (which will cause the | ||
59 | * flow controller to stop driving reset if the CPU has been | ||
60 | * power-gated via the flow controller). This will have no | ||
61 | * effect on first boot of the CPU since it should already be | ||
62 | * in reset. | ||
63 | */ | ||
64 | tegra_put_cpu_in_reset(cpu); | ||
61 | 65 | ||
62 | /* Clear flow controller CSR. */ | 66 | /* |
63 | flowctrl_write_cpu_csr(cpu, 0); | 67 | * Unhalt the CPU. If the flow controller was used to |
68 | * power-gate the CPU this will cause the flow controller to | ||
69 | * stop driving reset. The CPU will remain in reset because the | ||
70 | * clock and reset block is now driving reset. | ||
71 | */ | ||
72 | flowctrl_write_cpu_halt(cpu, 0); | ||
64 | 73 | ||
74 | tegra_enable_cpu_clock(cpu); | ||
75 | flowctrl_write_cpu_csr(cpu, 0); /* Clear flow controller CSR. */ | ||
76 | tegra_cpu_out_of_reset(cpu); | ||
65 | return 0; | 77 | return 0; |
66 | } | 78 | } |
67 | 79 | ||
68 | static int tegra30_power_up_cpu(unsigned int cpu) | 80 | static int tegra30_boot_secondary(unsigned int cpu, struct task_struct *idle) |
69 | { | 81 | { |
70 | int ret, pwrgateid; | 82 | int ret; |
71 | unsigned long timeout; | 83 | unsigned long timeout; |
72 | 84 | ||
73 | pwrgateid = tegra_cpu_powergate_id(cpu); | 85 | cpu = cpu_logical_map(cpu); |
74 | if (pwrgateid < 0) | 86 | tegra_put_cpu_in_reset(cpu); |
75 | return pwrgateid; | 87 | flowctrl_write_cpu_halt(cpu, 0); |
76 | 88 | ||
77 | /* | 89 | /* |
78 | * The power up sequence of cold boot CPU and warm boot CPU | 90 | * The power up sequence of cold boot CPU and warm boot CPU |
@@ -85,13 +97,13 @@ static int tegra30_power_up_cpu(unsigned int cpu) | |||
85 | * the IO clamps. | 97 | * the IO clamps. |
86 | * For cold boot CPU, do not wait. After the cold boot CPU be | 98 | * For cold boot CPU, do not wait. After the cold boot CPU be |
87 | * booted, it will run to tegra_secondary_init() and set | 99 | * booted, it will run to tegra_secondary_init() and set |
88 | * tegra_cpu_init_mask which influences what tegra30_power_up_cpu() | 100 | * tegra_cpu_init_mask which influences what tegra30_boot_secondary() |
89 | * next time around. | 101 | * next time around. |
90 | */ | 102 | */ |
91 | if (cpumask_test_cpu(cpu, &tegra_cpu_init_mask)) { | 103 | if (cpumask_test_cpu(cpu, &tegra_cpu_init_mask)) { |
92 | timeout = jiffies + msecs_to_jiffies(50); | 104 | timeout = jiffies + msecs_to_jiffies(50); |
93 | do { | 105 | do { |
94 | if (!tegra_powergate_is_powered(pwrgateid)) | 106 | if (tegra_pmc_cpu_is_powered(cpu)) |
95 | goto remove_clamps; | 107 | goto remove_clamps; |
96 | udelay(10); | 108 | udelay(10); |
97 | } while (time_before(jiffies, timeout)); | 109 | } while (time_before(jiffies, timeout)); |
@@ -103,14 +115,14 @@ static int tegra30_power_up_cpu(unsigned int cpu) | |||
103 | * be un-gated by un-toggling the power gate register | 115 | * be un-gated by un-toggling the power gate register |
104 | * manually. | 116 | * manually. |
105 | */ | 117 | */ |
106 | if (!tegra_powergate_is_powered(pwrgateid)) { | 118 | if (!tegra_pmc_cpu_is_powered(cpu)) { |
107 | ret = tegra_powergate_power_on(pwrgateid); | 119 | ret = tegra_pmc_cpu_power_on(cpu); |
108 | if (ret) | 120 | if (ret) |
109 | return ret; | 121 | return ret; |
110 | 122 | ||
111 | /* Wait for the power to come up. */ | 123 | /* Wait for the power to come up. */ |
112 | timeout = jiffies + msecs_to_jiffies(100); | 124 | timeout = jiffies + msecs_to_jiffies(100); |
113 | while (tegra_powergate_is_powered(pwrgateid)) { | 125 | while (tegra_pmc_cpu_is_powered(cpu)) { |
114 | if (time_after(jiffies, timeout)) | 126 | if (time_after(jiffies, timeout)) |
115 | return -ETIMEDOUT; | 127 | return -ETIMEDOUT; |
116 | udelay(10); | 128 | udelay(10); |
@@ -123,57 +135,34 @@ remove_clamps: | |||
123 | udelay(10); | 135 | udelay(10); |
124 | 136 | ||
125 | /* Remove I/O clamps. */ | 137 | /* Remove I/O clamps. */ |
126 | ret = tegra_powergate_remove_clamping(pwrgateid); | 138 | ret = tegra_pmc_cpu_remove_clamping(cpu); |
127 | udelay(10); | 139 | if (ret) |
140 | return ret; | ||
128 | 141 | ||
129 | /* Clear flow controller CSR. */ | 142 | udelay(10); |
130 | flowctrl_write_cpu_csr(cpu, 0); | ||
131 | 143 | ||
144 | flowctrl_write_cpu_csr(cpu, 0); /* Clear flow controller CSR. */ | ||
145 | tegra_cpu_out_of_reset(cpu); | ||
132 | return 0; | 146 | return 0; |
133 | } | 147 | } |
134 | 148 | ||
135 | static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *idle) | 149 | static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle) |
136 | { | 150 | { |
137 | int status; | ||
138 | |||
139 | cpu = cpu_logical_map(cpu); | 151 | cpu = cpu_logical_map(cpu); |
152 | return tegra_pmc_cpu_power_on(cpu); | ||
153 | } | ||
140 | 154 | ||
141 | /* | 155 | static int __cpuinit tegra_boot_secondary(unsigned int cpu, |
142 | * Force the CPU into reset. The CPU must remain in reset when the | 156 | struct task_struct *idle) |
143 | * flow controller state is cleared (which will cause the flow | 157 | { |
144 | * controller to stop driving reset if the CPU has been power-gated | 158 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) |
145 | * via the flow controller). This will have no effect on first boot | 159 | return tegra20_boot_secondary(cpu, idle); |
146 | * of the CPU since it should already be in reset. | 160 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) |
147 | */ | 161 | return tegra30_boot_secondary(cpu, idle); |
148 | tegra_put_cpu_in_reset(cpu); | 162 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) |
149 | 163 | return tegra114_boot_secondary(cpu, idle); | |
150 | /* | 164 | |
151 | * Unhalt the CPU. If the flow controller was used to power-gate the | 165 | return -EINVAL; |
152 | * CPU this will cause the flow controller to stop driving reset. | ||
153 | * The CPU will remain in reset because the clock and reset block | ||
154 | * is now driving reset. | ||
155 | */ | ||
156 | flowctrl_write_cpu_halt(cpu, 0); | ||
157 | |||
158 | switch (tegra_chip_id) { | ||
159 | case TEGRA20: | ||
160 | status = tegra20_power_up_cpu(cpu); | ||
161 | break; | ||
162 | case TEGRA30: | ||
163 | status = tegra30_power_up_cpu(cpu); | ||
164 | break; | ||
165 | default: | ||
166 | status = -EINVAL; | ||
167 | break; | ||
168 | } | ||
169 | |||
170 | if (status) | ||
171 | goto done; | ||
172 | |||
173 | /* Take the CPU out of reset. */ | ||
174 | tegra_cpu_out_of_reset(cpu); | ||
175 | done: | ||
176 | return status; | ||
177 | } | 166 | } |
178 | 167 | ||
179 | static void __init tegra_smp_prepare_cpus(unsigned int max_cpus) | 168 | static void __init tegra_smp_prepare_cpus(unsigned int max_cpus) |
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index 523604de666f..d0b7400e4606 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/cpumask.h> | 22 | #include <linux/cpumask.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/cpu_pm.h> | 24 | #include <linux/cpu_pm.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/suspend.h> |
26 | #include <linux/err.h> | 26 | #include <linux/err.h> |
27 | #include <linux/clk/tegra.h> | 27 | #include <linux/clk/tegra.h> |
28 | 28 | ||
@@ -37,67 +37,13 @@ | |||
37 | #include "reset.h" | 37 | #include "reset.h" |
38 | #include "flowctrl.h" | 38 | #include "flowctrl.h" |
39 | #include "fuse.h" | 39 | #include "fuse.h" |
40 | #include "pmc.h" | ||
40 | #include "sleep.h" | 41 | #include "sleep.h" |
41 | 42 | ||
42 | #define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */ | ||
43 | |||
44 | #define PMC_CTRL 0x0 | ||
45 | #define PMC_CPUPWRGOOD_TIMER 0xc8 | ||
46 | #define PMC_CPUPWROFF_TIMER 0xcc | ||
47 | |||
48 | #ifdef CONFIG_PM_SLEEP | 43 | #ifdef CONFIG_PM_SLEEP |
49 | static unsigned int g_diag_reg; | ||
50 | static DEFINE_SPINLOCK(tegra_lp2_lock); | 44 | static DEFINE_SPINLOCK(tegra_lp2_lock); |
51 | static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); | ||
52 | static struct clk *tegra_pclk; | ||
53 | void (*tegra_tear_down_cpu)(void); | 45 | void (*tegra_tear_down_cpu)(void); |
54 | 46 | ||
55 | void save_cpu_arch_register(void) | ||
56 | { | ||
57 | /* read diagnostic register */ | ||
58 | asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc"); | ||
59 | return; | ||
60 | } | ||
61 | |||
62 | void restore_cpu_arch_register(void) | ||
63 | { | ||
64 | /* write diagnostic register */ | ||
65 | asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc"); | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | static void set_power_timers(unsigned long us_on, unsigned long us_off) | ||
70 | { | ||
71 | unsigned long long ticks; | ||
72 | unsigned long long pclk; | ||
73 | unsigned long rate; | ||
74 | static unsigned long tegra_last_pclk; | ||
75 | |||
76 | if (tegra_pclk == NULL) { | ||
77 | tegra_pclk = clk_get_sys(NULL, "pclk"); | ||
78 | WARN_ON(IS_ERR(tegra_pclk)); | ||
79 | } | ||
80 | |||
81 | rate = clk_get_rate(tegra_pclk); | ||
82 | |||
83 | if (WARN_ON_ONCE(rate <= 0)) | ||
84 | pclk = 100000000; | ||
85 | else | ||
86 | pclk = rate; | ||
87 | |||
88 | if ((rate != tegra_last_pclk)) { | ||
89 | ticks = (us_on * pclk) + 999999ull; | ||
90 | do_div(ticks, 1000000); | ||
91 | writel((unsigned long)ticks, pmc + PMC_CPUPWRGOOD_TIMER); | ||
92 | |||
93 | ticks = (us_off * pclk) + 999999ull; | ||
94 | do_div(ticks, 1000000); | ||
95 | writel((unsigned long)ticks, pmc + PMC_CPUPWROFF_TIMER); | ||
96 | wmb(); | ||
97 | } | ||
98 | tegra_last_pclk = pclk; | ||
99 | } | ||
100 | |||
101 | /* | 47 | /* |
102 | * restore_cpu_complex | 48 | * restore_cpu_complex |
103 | * | 49 | * |
@@ -119,8 +65,6 @@ static void restore_cpu_complex(void) | |||
119 | tegra_cpu_clock_resume(); | 65 | tegra_cpu_clock_resume(); |
120 | 66 | ||
121 | flowctrl_cpu_suspend_exit(cpu); | 67 | flowctrl_cpu_suspend_exit(cpu); |
122 | |||
123 | restore_cpu_arch_register(); | ||
124 | } | 68 | } |
125 | 69 | ||
126 | /* | 70 | /* |
@@ -145,8 +89,6 @@ static void suspend_cpu_complex(void) | |||
145 | tegra_cpu_clock_suspend(); | 89 | tegra_cpu_clock_suspend(); |
146 | 90 | ||
147 | flowctrl_cpu_suspend_enter(cpu); | 91 | flowctrl_cpu_suspend_enter(cpu); |
148 | |||
149 | save_cpu_arch_register(); | ||
150 | } | 92 | } |
151 | 93 | ||
152 | void tegra_clear_cpu_in_lp2(int phy_cpu_id) | 94 | void tegra_clear_cpu_in_lp2(int phy_cpu_id) |
@@ -197,16 +139,9 @@ static int tegra_sleep_cpu(unsigned long v2p) | |||
197 | return 0; | 139 | return 0; |
198 | } | 140 | } |
199 | 141 | ||
200 | void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time) | 142 | void tegra_idle_lp2_last(void) |
201 | { | 143 | { |
202 | u32 mode; | 144 | tegra_pmc_pm_set(TEGRA_SUSPEND_LP2); |
203 | |||
204 | /* Only the last cpu down does the final suspend steps */ | ||
205 | mode = readl(pmc + PMC_CTRL); | ||
206 | mode |= TEGRA_POWER_CPU_PWRREQ_OE; | ||
207 | writel(mode, pmc + PMC_CTRL); | ||
208 | |||
209 | set_power_timers(cpu_on_time, cpu_off_time); | ||
210 | 145 | ||
211 | cpu_cluster_pm_enter(); | 146 | cpu_cluster_pm_enter(); |
212 | suspend_cpu_complex(); | 147 | suspend_cpu_complex(); |
@@ -216,4 +151,81 @@ void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time) | |||
216 | restore_cpu_complex(); | 151 | restore_cpu_complex(); |
217 | cpu_cluster_pm_exit(); | 152 | cpu_cluster_pm_exit(); |
218 | } | 153 | } |
154 | |||
155 | enum tegra_suspend_mode tegra_pm_validate_suspend_mode( | ||
156 | enum tegra_suspend_mode mode) | ||
157 | { | ||
158 | /* Tegra114 didn't support any suspending mode yet. */ | ||
159 | if (tegra_chip_id == TEGRA114) | ||
160 | return TEGRA_SUSPEND_NONE; | ||
161 | |||
162 | /* | ||
163 | * The Tegra devices only support suspending to LP2 currently. | ||
164 | */ | ||
165 | if (mode > TEGRA_SUSPEND_LP2) | ||
166 | return TEGRA_SUSPEND_LP2; | ||
167 | |||
168 | return mode; | ||
169 | } | ||
170 | |||
171 | static const char *lp_state[TEGRA_MAX_SUSPEND_MODE] = { | ||
172 | [TEGRA_SUSPEND_NONE] = "none", | ||
173 | [TEGRA_SUSPEND_LP2] = "LP2", | ||
174 | [TEGRA_SUSPEND_LP1] = "LP1", | ||
175 | [TEGRA_SUSPEND_LP0] = "LP0", | ||
176 | }; | ||
177 | |||
178 | static int __cpuinit tegra_suspend_enter(suspend_state_t state) | ||
179 | { | ||
180 | enum tegra_suspend_mode mode = tegra_pmc_get_suspend_mode(); | ||
181 | |||
182 | if (WARN_ON(mode < TEGRA_SUSPEND_NONE || | ||
183 | mode >= TEGRA_MAX_SUSPEND_MODE)) | ||
184 | return -EINVAL; | ||
185 | |||
186 | pr_info("Entering suspend state %s\n", lp_state[mode]); | ||
187 | |||
188 | tegra_pmc_pm_set(mode); | ||
189 | |||
190 | local_fiq_disable(); | ||
191 | |||
192 | suspend_cpu_complex(); | ||
193 | switch (mode) { | ||
194 | case TEGRA_SUSPEND_LP2: | ||
195 | tegra_set_cpu_in_lp2(0); | ||
196 | break; | ||
197 | default: | ||
198 | break; | ||
199 | } | ||
200 | |||
201 | cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu); | ||
202 | |||
203 | switch (mode) { | ||
204 | case TEGRA_SUSPEND_LP2: | ||
205 | tegra_clear_cpu_in_lp2(0); | ||
206 | break; | ||
207 | default: | ||
208 | break; | ||
209 | } | ||
210 | restore_cpu_complex(); | ||
211 | |||
212 | local_fiq_enable(); | ||
213 | |||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static const struct platform_suspend_ops tegra_suspend_ops = { | ||
218 | .valid = suspend_valid_only_mem, | ||
219 | .enter = tegra_suspend_enter, | ||
220 | }; | ||
221 | |||
222 | void __init tegra_init_suspend(void) | ||
223 | { | ||
224 | if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NONE) | ||
225 | return; | ||
226 | |||
227 | tegra_pmc_suspend_init(); | ||
228 | |||
229 | suspend_set_ops(&tegra_suspend_ops); | ||
230 | } | ||
219 | #endif | 231 | #endif |
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h index 787335cc964c..9d2d038bf12e 100644 --- a/arch/arm/mach-tegra/pm.h +++ b/arch/arm/mach-tegra/pm.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef _MACH_TEGRA_PM_H_ | 21 | #ifndef _MACH_TEGRA_PM_H_ |
22 | #define _MACH_TEGRA_PM_H_ | 22 | #define _MACH_TEGRA_PM_H_ |
23 | 23 | ||
24 | #include "pmc.h" | ||
25 | |||
24 | extern unsigned long l2x0_saved_regs_addr; | 26 | extern unsigned long l2x0_saved_regs_addr; |
25 | 27 | ||
26 | void save_cpu_arch_register(void); | 28 | void save_cpu_arch_register(void); |
@@ -29,7 +31,20 @@ void restore_cpu_arch_register(void); | |||
29 | void tegra_clear_cpu_in_lp2(int phy_cpu_id); | 31 | void tegra_clear_cpu_in_lp2(int phy_cpu_id); |
30 | bool tegra_set_cpu_in_lp2(int phy_cpu_id); | 32 | bool tegra_set_cpu_in_lp2(int phy_cpu_id); |
31 | 33 | ||
32 | void tegra_idle_lp2_last(u32 cpu_on_time, u32 cpu_off_time); | 34 | void tegra_idle_lp2_last(void); |
33 | extern void (*tegra_tear_down_cpu)(void); | 35 | extern void (*tegra_tear_down_cpu)(void); |
34 | 36 | ||
37 | #ifdef CONFIG_PM_SLEEP | ||
38 | enum tegra_suspend_mode tegra_pm_validate_suspend_mode( | ||
39 | enum tegra_suspend_mode mode); | ||
40 | void tegra_init_suspend(void); | ||
41 | #else | ||
42 | enum tegra_suspend_mode tegra_pm_validate_suspend_mode( | ||
43 | enum tegra_suspend_mode mode) | ||
44 | { | ||
45 | return TEGRA_SUSPEND_NONE; | ||
46 | } | ||
47 | static inline void tegra_init_suspend(void) {} | ||
48 | #endif | ||
49 | |||
35 | #endif /* _MACH_TEGRA_PM_H_ */ | 50 | #endif /* _MACH_TEGRA_PM_H_ */ |
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c index d4fdb5fcec20..32360e540ce6 100644 --- a/arch/arm/mach-tegra/pmc.c +++ b/arch/arm/mach-tegra/pmc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (C) 2012,2013 NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -16,59 +16,313 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/clk.h> | ||
19 | #include <linux/io.h> | 20 | #include <linux/io.h> |
20 | #include <linux/of.h> | 21 | #include <linux/of.h> |
22 | #include <linux/of_address.h> | ||
21 | 23 | ||
22 | #include "iomap.h" | 24 | #include "fuse.h" |
25 | #include "pm.h" | ||
26 | #include "pmc.h" | ||
27 | #include "sleep.h" | ||
23 | 28 | ||
24 | #define PMC_CTRL 0x0 | 29 | #define TEGRA_POWER_EFFECT_LP0 (1 << 14) /* LP0 when CPU pwr gated */ |
25 | #define PMC_CTRL_INTR_LOW (1 << 17) | 30 | #define TEGRA_POWER_CPU_PWRREQ_POLARITY (1 << 15) /* CPU pwr req polarity */ |
31 | #define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */ | ||
32 | |||
33 | #define PMC_CTRL 0x0 | ||
34 | #define PMC_CTRL_INTR_LOW (1 << 17) | ||
35 | #define PMC_PWRGATE_TOGGLE 0x30 | ||
36 | #define PMC_PWRGATE_TOGGLE_START (1 << 8) | ||
37 | #define PMC_REMOVE_CLAMPING 0x34 | ||
38 | #define PMC_PWRGATE_STATUS 0x38 | ||
39 | |||
40 | #define PMC_CPUPWRGOOD_TIMER 0xc8 | ||
41 | #define PMC_CPUPWROFF_TIMER 0xcc | ||
42 | |||
43 | #define TEGRA_POWERGATE_PCIE 3 | ||
44 | #define TEGRA_POWERGATE_VDEC 4 | ||
45 | #define TEGRA_POWERGATE_CPU1 9 | ||
46 | #define TEGRA_POWERGATE_CPU2 10 | ||
47 | #define TEGRA_POWERGATE_CPU3 11 | ||
48 | |||
49 | static u8 tegra_cpu_domains[] = { | ||
50 | 0xFF, /* not available for CPU0 */ | ||
51 | TEGRA_POWERGATE_CPU1, | ||
52 | TEGRA_POWERGATE_CPU2, | ||
53 | TEGRA_POWERGATE_CPU3, | ||
54 | }; | ||
55 | static DEFINE_SPINLOCK(tegra_powergate_lock); | ||
56 | |||
57 | static void __iomem *tegra_pmc_base; | ||
58 | static bool tegra_pmc_invert_interrupt; | ||
59 | static struct clk *tegra_pclk; | ||
60 | |||
61 | struct pmc_pm_data { | ||
62 | u32 cpu_good_time; /* CPU power good time in uS */ | ||
63 | u32 cpu_off_time; /* CPU power off time in uS */ | ||
64 | u32 core_osc_time; /* Core power good osc time in uS */ | ||
65 | u32 core_pmu_time; /* Core power good pmu time in uS */ | ||
66 | u32 core_off_time; /* Core power off time in uS */ | ||
67 | bool corereq_high; /* Core power request active-high */ | ||
68 | bool sysclkreq_high; /* System clock request active-high */ | ||
69 | bool combined_req; /* Combined pwr req for CPU & Core */ | ||
70 | bool cpu_pwr_good_en; /* CPU power good signal is enabled */ | ||
71 | u32 lp0_vec_phy_addr; /* The phy addr of LP0 warm boot code */ | ||
72 | u32 lp0_vec_size; /* The size of LP0 warm boot code */ | ||
73 | enum tegra_suspend_mode suspend_mode; | ||
74 | }; | ||
75 | static struct pmc_pm_data pmc_pm_data; | ||
26 | 76 | ||
27 | static inline u32 tegra_pmc_readl(u32 reg) | 77 | static inline u32 tegra_pmc_readl(u32 reg) |
28 | { | 78 | { |
29 | return readl(IO_ADDRESS(TEGRA_PMC_BASE + reg)); | 79 | return readl(tegra_pmc_base + reg); |
30 | } | 80 | } |
31 | 81 | ||
32 | static inline void tegra_pmc_writel(u32 val, u32 reg) | 82 | static inline void tegra_pmc_writel(u32 val, u32 reg) |
33 | { | 83 | { |
34 | writel(val, IO_ADDRESS(TEGRA_PMC_BASE + reg)); | 84 | writel(val, tegra_pmc_base + reg); |
85 | } | ||
86 | |||
87 | static int tegra_pmc_get_cpu_powerdomain_id(int cpuid) | ||
88 | { | ||
89 | if (cpuid <= 0 || cpuid >= num_possible_cpus()) | ||
90 | return -EINVAL; | ||
91 | return tegra_cpu_domains[cpuid]; | ||
92 | } | ||
93 | |||
94 | static bool tegra_pmc_powergate_is_powered(int id) | ||
95 | { | ||
96 | return (tegra_pmc_readl(PMC_PWRGATE_STATUS) >> id) & 1; | ||
97 | } | ||
98 | |||
99 | static int tegra_pmc_powergate_set(int id, bool new_state) | ||
100 | { | ||
101 | bool old_state; | ||
102 | unsigned long flags; | ||
103 | |||
104 | spin_lock_irqsave(&tegra_powergate_lock, flags); | ||
105 | |||
106 | old_state = tegra_pmc_powergate_is_powered(id); | ||
107 | WARN_ON(old_state == new_state); | ||
108 | |||
109 | tegra_pmc_writel(PMC_PWRGATE_TOGGLE_START | id, PMC_PWRGATE_TOGGLE); | ||
110 | |||
111 | spin_unlock_irqrestore(&tegra_powergate_lock, flags); | ||
112 | |||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | static int tegra_pmc_powergate_remove_clamping(int id) | ||
117 | { | ||
118 | u32 mask; | ||
119 | |||
120 | /* | ||
121 | * Tegra has a bug where PCIE and VDE clamping masks are | ||
122 | * swapped relatively to the partition ids. | ||
123 | */ | ||
124 | if (id == TEGRA_POWERGATE_VDEC) | ||
125 | mask = (1 << TEGRA_POWERGATE_PCIE); | ||
126 | else if (id == TEGRA_POWERGATE_PCIE) | ||
127 | mask = (1 << TEGRA_POWERGATE_VDEC); | ||
128 | else | ||
129 | mask = (1 << id); | ||
130 | |||
131 | tegra_pmc_writel(mask, PMC_REMOVE_CLAMPING); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | bool tegra_pmc_cpu_is_powered(int cpuid) | ||
137 | { | ||
138 | int id; | ||
139 | |||
140 | id = tegra_pmc_get_cpu_powerdomain_id(cpuid); | ||
141 | if (id < 0) | ||
142 | return false; | ||
143 | return tegra_pmc_powergate_is_powered(id); | ||
35 | } | 144 | } |
36 | 145 | ||
37 | #ifdef CONFIG_OF | 146 | int tegra_pmc_cpu_power_on(int cpuid) |
147 | { | ||
148 | int id; | ||
149 | |||
150 | id = tegra_pmc_get_cpu_powerdomain_id(cpuid); | ||
151 | if (id < 0) | ||
152 | return id; | ||
153 | return tegra_pmc_powergate_set(id, true); | ||
154 | } | ||
155 | |||
156 | int tegra_pmc_cpu_remove_clamping(int cpuid) | ||
157 | { | ||
158 | int id; | ||
159 | |||
160 | id = tegra_pmc_get_cpu_powerdomain_id(cpuid); | ||
161 | if (id < 0) | ||
162 | return id; | ||
163 | return tegra_pmc_powergate_remove_clamping(id); | ||
164 | } | ||
165 | |||
166 | #ifdef CONFIG_PM_SLEEP | ||
167 | static void set_power_timers(u32 us_on, u32 us_off, unsigned long rate) | ||
168 | { | ||
169 | unsigned long long ticks; | ||
170 | unsigned long long pclk; | ||
171 | static unsigned long tegra_last_pclk; | ||
172 | |||
173 | if (WARN_ON_ONCE(rate <= 0)) | ||
174 | pclk = 100000000; | ||
175 | else | ||
176 | pclk = rate; | ||
177 | |||
178 | if ((rate != tegra_last_pclk)) { | ||
179 | ticks = (us_on * pclk) + 999999ull; | ||
180 | do_div(ticks, 1000000); | ||
181 | tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWRGOOD_TIMER); | ||
182 | |||
183 | ticks = (us_off * pclk) + 999999ull; | ||
184 | do_div(ticks, 1000000); | ||
185 | tegra_pmc_writel((unsigned long)ticks, PMC_CPUPWROFF_TIMER); | ||
186 | wmb(); | ||
187 | } | ||
188 | tegra_last_pclk = pclk; | ||
189 | } | ||
190 | |||
191 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void) | ||
192 | { | ||
193 | return pmc_pm_data.suspend_mode; | ||
194 | } | ||
195 | |||
196 | void tegra_pmc_pm_set(enum tegra_suspend_mode mode) | ||
197 | { | ||
198 | u32 reg; | ||
199 | unsigned long rate = 0; | ||
200 | |||
201 | reg = tegra_pmc_readl(PMC_CTRL); | ||
202 | reg |= TEGRA_POWER_CPU_PWRREQ_OE; | ||
203 | reg &= ~TEGRA_POWER_EFFECT_LP0; | ||
204 | |||
205 | switch (mode) { | ||
206 | case TEGRA_SUSPEND_LP2: | ||
207 | rate = clk_get_rate(tegra_pclk); | ||
208 | break; | ||
209 | default: | ||
210 | break; | ||
211 | } | ||
212 | |||
213 | set_power_timers(pmc_pm_data.cpu_good_time, pmc_pm_data.cpu_off_time, | ||
214 | rate); | ||
215 | |||
216 | tegra_pmc_writel(reg, PMC_CTRL); | ||
217 | } | ||
218 | |||
219 | void tegra_pmc_suspend_init(void) | ||
220 | { | ||
221 | u32 reg; | ||
222 | |||
223 | /* Always enable CPU power request */ | ||
224 | reg = tegra_pmc_readl(PMC_CTRL); | ||
225 | reg |= TEGRA_POWER_CPU_PWRREQ_OE; | ||
226 | tegra_pmc_writel(reg, PMC_CTRL); | ||
227 | } | ||
228 | #endif | ||
229 | |||
38 | static const struct of_device_id matches[] __initconst = { | 230 | static const struct of_device_id matches[] __initconst = { |
231 | { .compatible = "nvidia,tegra114-pmc" }, | ||
232 | { .compatible = "nvidia,tegra30-pmc" }, | ||
39 | { .compatible = "nvidia,tegra20-pmc" }, | 233 | { .compatible = "nvidia,tegra20-pmc" }, |
40 | { } | 234 | { } |
41 | }; | 235 | }; |
42 | #endif | ||
43 | 236 | ||
44 | void __init tegra_pmc_init(void) | 237 | static void tegra_pmc_parse_dt(void) |
45 | { | 238 | { |
46 | /* | 239 | struct device_node *np; |
47 | * For now, Harmony is the only board that uses the PMC, and it wants | 240 | u32 prop; |
48 | * the signal inverted. Seaboard would too if it used the PMC. | 241 | enum tegra_suspend_mode suspend_mode; |
49 | * Hopefully by the time other boards want to use the PMC, everything | 242 | u32 core_good_time[2] = {0, 0}; |
50 | * will be device-tree, or they also want it inverted. | 243 | u32 lp0_vec[2] = {0, 0}; |
51 | */ | ||
52 | bool invert_interrupt = true; | ||
53 | u32 val; | ||
54 | 244 | ||
55 | #ifdef CONFIG_OF | 245 | np = of_find_matching_node(NULL, matches); |
56 | if (of_have_populated_dt()) { | 246 | BUG_ON(!np); |
57 | struct device_node *np; | ||
58 | 247 | ||
59 | invert_interrupt = false; | 248 | tegra_pmc_base = of_iomap(np, 0); |
60 | 249 | ||
61 | np = of_find_matching_node(NULL, matches); | 250 | tegra_pmc_invert_interrupt = of_property_read_bool(np, |
62 | if (np) { | 251 | "nvidia,invert-interrupt"); |
63 | if (of_find_property(np, "nvidia,invert-interrupt", | 252 | tegra_pclk = of_clk_get_by_name(np, "pclk"); |
64 | NULL)) | 253 | WARN_ON(IS_ERR(tegra_pclk)); |
65 | invert_interrupt = true; | 254 | |
255 | /* Grabbing the power management configurations */ | ||
256 | if (of_property_read_u32(np, "nvidia,suspend-mode", &prop)) { | ||
257 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
258 | } else { | ||
259 | switch (prop) { | ||
260 | case 0: | ||
261 | suspend_mode = TEGRA_SUSPEND_LP0; | ||
262 | break; | ||
263 | case 1: | ||
264 | suspend_mode = TEGRA_SUSPEND_LP1; | ||
265 | break; | ||
266 | case 2: | ||
267 | suspend_mode = TEGRA_SUSPEND_LP2; | ||
268 | break; | ||
269 | default: | ||
270 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
271 | break; | ||
66 | } | 272 | } |
67 | } | 273 | } |
68 | #endif | 274 | suspend_mode = tegra_pm_validate_suspend_mode(suspend_mode); |
275 | |||
276 | if (of_property_read_u32(np, "nvidia,cpu-pwr-good-time", &prop)) | ||
277 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
278 | pmc_pm_data.cpu_good_time = prop; | ||
279 | |||
280 | if (of_property_read_u32(np, "nvidia,cpu-pwr-off-time", &prop)) | ||
281 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
282 | pmc_pm_data.cpu_off_time = prop; | ||
283 | |||
284 | if (of_property_read_u32_array(np, "nvidia,core-pwr-good-time", | ||
285 | core_good_time, ARRAY_SIZE(core_good_time))) | ||
286 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
287 | pmc_pm_data.core_osc_time = core_good_time[0]; | ||
288 | pmc_pm_data.core_pmu_time = core_good_time[1]; | ||
289 | |||
290 | if (of_property_read_u32(np, "nvidia,core-pwr-off-time", | ||
291 | &prop)) | ||
292 | suspend_mode = TEGRA_SUSPEND_NONE; | ||
293 | pmc_pm_data.core_off_time = prop; | ||
294 | |||
295 | pmc_pm_data.corereq_high = of_property_read_bool(np, | ||
296 | "nvidia,core-power-req-active-high"); | ||
297 | |||
298 | pmc_pm_data.sysclkreq_high = of_property_read_bool(np, | ||
299 | "nvidia,sys-clock-req-active-high"); | ||
300 | |||
301 | pmc_pm_data.combined_req = of_property_read_bool(np, | ||
302 | "nvidia,combined-power-req"); | ||
303 | |||
304 | pmc_pm_data.cpu_pwr_good_en = of_property_read_bool(np, | ||
305 | "nvidia,cpu-pwr-good-en"); | ||
306 | |||
307 | if (of_property_read_u32_array(np, "nvidia,lp0-vec", lp0_vec, | ||
308 | ARRAY_SIZE(lp0_vec))) | ||
309 | if (suspend_mode == TEGRA_SUSPEND_LP0) | ||
310 | suspend_mode = TEGRA_SUSPEND_LP1; | ||
311 | |||
312 | pmc_pm_data.lp0_vec_phy_addr = lp0_vec[0]; | ||
313 | pmc_pm_data.lp0_vec_size = lp0_vec[1]; | ||
314 | |||
315 | pmc_pm_data.suspend_mode = suspend_mode; | ||
316 | } | ||
317 | |||
318 | void __init tegra_pmc_init(void) | ||
319 | { | ||
320 | u32 val; | ||
321 | |||
322 | tegra_pmc_parse_dt(); | ||
69 | 323 | ||
70 | val = tegra_pmc_readl(PMC_CTRL); | 324 | val = tegra_pmc_readl(PMC_CTRL); |
71 | if (invert_interrupt) | 325 | if (tegra_pmc_invert_interrupt) |
72 | val |= PMC_CTRL_INTR_LOW; | 326 | val |= PMC_CTRL_INTR_LOW; |
73 | else | 327 | else |
74 | val &= ~PMC_CTRL_INTR_LOW; | 328 | val &= ~PMC_CTRL_INTR_LOW; |
diff --git a/arch/arm/mach-tegra/pmc.h b/arch/arm/mach-tegra/pmc.h index 8995ee4a8768..e1c2df272f7d 100644 --- a/arch/arm/mach-tegra/pmc.h +++ b/arch/arm/mach-tegra/pmc.h | |||
@@ -18,6 +18,24 @@ | |||
18 | #ifndef __MACH_TEGRA_PMC_H | 18 | #ifndef __MACH_TEGRA_PMC_H |
19 | #define __MACH_TEGRA_PMC_H | 19 | #define __MACH_TEGRA_PMC_H |
20 | 20 | ||
21 | enum tegra_suspend_mode { | ||
22 | TEGRA_SUSPEND_NONE = 0, | ||
23 | TEGRA_SUSPEND_LP2, /* CPU voltage off */ | ||
24 | TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */ | ||
25 | TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */ | ||
26 | TEGRA_MAX_SUSPEND_MODE, | ||
27 | }; | ||
28 | |||
29 | #ifdef CONFIG_PM_SLEEP | ||
30 | enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void); | ||
31 | void tegra_pmc_pm_set(enum tegra_suspend_mode mode); | ||
32 | void tegra_pmc_suspend_init(void); | ||
33 | #endif | ||
34 | |||
35 | bool tegra_pmc_cpu_is_powered(int cpuid); | ||
36 | int tegra_pmc_cpu_power_on(int cpuid); | ||
37 | int tegra_pmc_cpu_remove_clamping(int cpuid); | ||
38 | |||
21 | void tegra_pmc_init(void); | 39 | void tegra_pmc_init(void); |
22 | 40 | ||
23 | #endif | 41 | #endif |
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S index 54382ceade4a..1676aba5e7b8 100644 --- a/arch/arm/mach-tegra/reset-handler.S +++ b/arch/arm/mach-tegra/reset-handler.S | |||
@@ -41,9 +41,6 @@ | |||
41 | */ | 41 | */ |
42 | ENTRY(tegra_resume) | 42 | ENTRY(tegra_resume) |
43 | bl v7_invalidate_l1 | 43 | bl v7_invalidate_l1 |
44 | /* Enable coresight */ | ||
45 | mov32 r0, 0xC5ACCE55 | ||
46 | mcr p14, 0, r0, c7, c12, 6 | ||
47 | 44 | ||
48 | cpu_id r0 | 45 | cpu_id r0 |
49 | cmp r0, #0 @ CPU0? | 46 | cmp r0, #0 @ CPU0? |
@@ -99,6 +96,8 @@ ENTRY(__tegra_cpu_reset_handler_start) | |||
99 | * | 96 | * |
100 | * Register usage within the reset handler: | 97 | * Register usage within the reset handler: |
101 | * | 98 | * |
99 | * Others: scratch | ||
100 | * R6 = SoC ID << 8 | ||
102 | * R7 = CPU present (to the OS) mask | 101 | * R7 = CPU present (to the OS) mask |
103 | * R8 = CPU in LP1 state mask | 102 | * R8 = CPU in LP1 state mask |
104 | * R9 = CPU in LP2 state mask | 103 | * R9 = CPU in LP2 state mask |
@@ -114,6 +113,40 @@ ENTRY(__tegra_cpu_reset_handler_start) | |||
114 | ENTRY(__tegra_cpu_reset_handler) | 113 | ENTRY(__tegra_cpu_reset_handler) |
115 | 114 | ||
116 | cpsid aif, 0x13 @ SVC mode, interrupts disabled | 115 | cpsid aif, 0x13 @ SVC mode, interrupts disabled |
116 | |||
117 | mov32 r6, TEGRA_APB_MISC_BASE | ||
118 | ldr r6, [r6, #APB_MISC_GP_HIDREV] | ||
119 | and r6, r6, #0xff00 | ||
120 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
121 | t20_check: | ||
122 | cmp r6, #(0x20 << 8) | ||
123 | bne after_t20_check | ||
124 | t20_errata: | ||
125 | # Tegra20 is a Cortex-A9 r1p1 | ||
126 | mrc p15, 0, r0, c1, c0, 0 @ read system control register | ||
127 | orr r0, r0, #1 << 14 @ erratum 716044 | ||
128 | mcr p15, 0, r0, c1, c0, 0 @ write system control register | ||
129 | mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register | ||
130 | orr r0, r0, #1 << 4 @ erratum 742230 | ||
131 | orr r0, r0, #1 << 11 @ erratum 751472 | ||
132 | mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register | ||
133 | b after_errata | ||
134 | after_t20_check: | ||
135 | #endif | ||
136 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
137 | t30_check: | ||
138 | cmp r6, #(0x30 << 8) | ||
139 | bne after_t30_check | ||
140 | t30_errata: | ||
141 | # Tegra30 is a Cortex-A9 r2p9 | ||
142 | mrc p15, 0, r0, c15, c0, 1 @ read diagnostic register | ||
143 | orr r0, r0, #1 << 6 @ erratum 743622 | ||
144 | orr r0, r0, #1 << 11 @ erratum 751472 | ||
145 | mcr p15, 0, r0, c15, c0, 1 @ write diagnostic register | ||
146 | b after_errata | ||
147 | after_t30_check: | ||
148 | #endif | ||
149 | after_errata: | ||
117 | mrc p15, 0, r10, c0, c0, 5 @ MPIDR | 150 | mrc p15, 0, r10, c0, c0, 5 @ MPIDR |
118 | and r10, r10, #0x3 @ R10 = CPU number | 151 | and r10, r10, #0x3 @ R10 = CPU number |
119 | mov r11, #1 | 152 | mov r11, #1 |
@@ -129,16 +162,13 @@ ENTRY(__tegra_cpu_reset_handler) | |||
129 | 162 | ||
130 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | 163 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC |
131 | /* Are we on Tegra20? */ | 164 | /* Are we on Tegra20? */ |
132 | mov32 r6, TEGRA_APB_MISC_BASE | 165 | cmp r6, #(0x20 << 8) |
133 | ldr r0, [r6, #APB_MISC_GP_HIDREV] | ||
134 | and r0, r0, #0xff00 | ||
135 | cmp r0, #(0x20 << 8) | ||
136 | bne 1f | 166 | bne 1f |
137 | /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */ | 167 | /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */ |
138 | mov32 r6, TEGRA_PMC_BASE | 168 | mov32 r5, TEGRA_PMC_BASE |
139 | mov r0, #0 | 169 | mov r0, #0 |
140 | cmp r10, #0 | 170 | cmp r10, #0 |
141 | strne r0, [r6, #PMC_SCRATCH41] | 171 | strne r0, [r5, #PMC_SCRATCH41] |
142 | 1: | 172 | 1: |
143 | #endif | 173 | #endif |
144 | 174 | ||
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h index 4ffae541726e..970ebd5138b9 100644 --- a/arch/arm/mach-tegra/sleep.h +++ b/arch/arm/mach-tegra/sleep.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved. | 2 | * Copyright (c) 2010-2013, NVIDIA Corporation. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -124,11 +124,11 @@ int tegra_sleep_cpu_finish(unsigned long); | |||
124 | void tegra_disable_clean_inv_dcache(void); | 124 | void tegra_disable_clean_inv_dcache(void); |
125 | 125 | ||
126 | #ifdef CONFIG_HOTPLUG_CPU | 126 | #ifdef CONFIG_HOTPLUG_CPU |
127 | void tegra20_hotplug_init(void); | 127 | void tegra20_hotplug_shutdown(void); |
128 | void tegra30_hotplug_init(void); | 128 | void tegra30_hotplug_shutdown(void); |
129 | void tegra_hotplug_init(void); | ||
129 | #else | 130 | #else |
130 | static inline void tegra20_hotplug_init(void) {} | 131 | static inline void tegra_hotplug_init(void) {} |
131 | static inline void tegra30_hotplug_init(void) {} | ||
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | void tegra20_cpu_shutdown(int cpu); | 134 | void tegra20_cpu_shutdown(int cpu); |
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/tegra.c index a0edf2510280..61749e2d8111 100644 --- a/arch/arm/mach-tegra/board-dt-tegra20.c +++ b/arch/arm/mach-tegra/tegra.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * nVidia Tegra device tree board support | 2 | * NVIDIA Tegra SoC device tree board support |
3 | * | 3 | * |
4 | * Copyright (C) 2011, 2013, NVIDIA Corporation | ||
4 | * Copyright (C) 2010 Secret Lab Technologies, Ltd. | 5 | * Copyright (C) 2010 Secret Lab Technologies, Ltd. |
5 | * Copyright (C) 2010 Google, Inc. | 6 | * Copyright (C) 2010 Google, Inc. |
6 | * | 7 | * |
@@ -32,7 +33,10 @@ | |||
32 | #include <linux/io.h> | 33 | #include <linux/io.h> |
33 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
34 | #include <linux/i2c-tegra.h> | 35 | #include <linux/i2c-tegra.h> |
36 | #include <linux/slab.h> | ||
37 | #include <linux/sys_soc.h> | ||
35 | #include <linux/usb/tegra_usb_phy.h> | 38 | #include <linux/usb/tegra_usb_phy.h> |
39 | #include <linux/clk/tegra.h> | ||
36 | 40 | ||
37 | #include <asm/mach-types.h> | 41 | #include <asm/mach-types.h> |
38 | #include <asm/mach/arch.h> | 42 | #include <asm/mach/arch.h> |
@@ -41,6 +45,7 @@ | |||
41 | 45 | ||
42 | #include "board.h" | 46 | #include "board.h" |
43 | #include "common.h" | 47 | #include "common.h" |
48 | #include "fuse.h" | ||
44 | #include "iomap.h" | 49 | #include "iomap.h" |
45 | 50 | ||
46 | static struct tegra_ehci_platform_data tegra_ehci1_pdata = { | 51 | static struct tegra_ehci_platform_data tegra_ehci1_pdata = { |
@@ -79,12 +84,38 @@ static struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { | |||
79 | 84 | ||
80 | static void __init tegra_dt_init(void) | 85 | static void __init tegra_dt_init(void) |
81 | { | 86 | { |
87 | struct soc_device_attribute *soc_dev_attr; | ||
88 | struct soc_device *soc_dev; | ||
89 | struct device *parent = NULL; | ||
90 | |||
91 | tegra_clocks_apply_init_table(); | ||
92 | |||
93 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | ||
94 | if (!soc_dev_attr) | ||
95 | goto out; | ||
96 | |||
97 | soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra"); | ||
98 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", tegra_revision); | ||
99 | soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%d", tegra_chip_id); | ||
100 | |||
101 | soc_dev = soc_device_register(soc_dev_attr); | ||
102 | if (IS_ERR(soc_dev)) { | ||
103 | kfree(soc_dev_attr->family); | ||
104 | kfree(soc_dev_attr->revision); | ||
105 | kfree(soc_dev_attr->soc_id); | ||
106 | kfree(soc_dev_attr); | ||
107 | goto out; | ||
108 | } | ||
109 | |||
110 | parent = soc_device_to_device(soc_dev); | ||
111 | |||
82 | /* | 112 | /* |
83 | * Finished with the static registrations now; fill in the missing | 113 | * Finished with the static registrations now; fill in the missing |
84 | * devices | 114 | * devices |
85 | */ | 115 | */ |
116 | out: | ||
86 | of_platform_populate(NULL, of_default_bus_match_table, | 117 | of_platform_populate(NULL, of_default_bus_match_table, |
87 | tegra20_auxdata_lookup, NULL); | 118 | tegra20_auxdata_lookup, parent); |
88 | } | 119 | } |
89 | 120 | ||
90 | static void __init trimslice_init(void) | 121 | static void __init trimslice_init(void) |
@@ -111,7 +142,8 @@ static void __init harmony_init(void) | |||
111 | 142 | ||
112 | static void __init paz00_init(void) | 143 | static void __init paz00_init(void) |
113 | { | 144 | { |
114 | tegra_paz00_wifikill_init(); | 145 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC)) |
146 | tegra_paz00_wifikill_init(); | ||
115 | } | 147 | } |
116 | 148 | ||
117 | static struct { | 149 | static struct { |
@@ -137,19 +169,21 @@ static void __init tegra_dt_init_late(void) | |||
137 | } | 169 | } |
138 | } | 170 | } |
139 | 171 | ||
140 | static const char *tegra20_dt_board_compat[] = { | 172 | static const char * const tegra_dt_board_compat[] = { |
173 | "nvidia,tegra114", | ||
174 | "nvidia,tegra30", | ||
141 | "nvidia,tegra20", | 175 | "nvidia,tegra20", |
142 | NULL | 176 | NULL |
143 | }; | 177 | }; |
144 | 178 | ||
145 | DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)") | 179 | DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegra SoC (Flattened Device Tree)") |
146 | .map_io = tegra_map_common_io, | 180 | .map_io = tegra_map_common_io, |
147 | .smp = smp_ops(tegra_smp_ops), | 181 | .smp = smp_ops(tegra_smp_ops), |
148 | .init_early = tegra20_init_early, | 182 | .init_early = tegra_init_early, |
149 | .init_irq = tegra_dt_init_irq, | 183 | .init_irq = tegra_dt_init_irq, |
150 | .init_time = clocksource_of_init, | 184 | .init_time = clocksource_of_init, |
151 | .init_machine = tegra_dt_init, | 185 | .init_machine = tegra_dt_init, |
152 | .init_late = tegra_dt_init_late, | 186 | .init_late = tegra_dt_init_late, |
153 | .restart = tegra_assert_system_reset, | 187 | .restart = tegra_assert_system_reset, |
154 | .dt_compat = tegra20_dt_board_compat, | 188 | .dt_compat = tegra_dt_board_compat, |
155 | MACHINE_END | 189 | MACHINE_END |
diff --git a/arch/arm/mach-tegra/tegra114_speedo.c b/arch/arm/mach-tegra/tegra114_speedo.c new file mode 100644 index 000000000000..5218d4853cd3 --- /dev/null +++ b/arch/arm/mach-tegra/tegra114_speedo.c | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, 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 | #include <linux/kernel.h> | ||
18 | #include <linux/bug.h> | ||
19 | |||
20 | #include "fuse.h" | ||
21 | |||
22 | #define CORE_PROCESS_CORNERS_NUM 2 | ||
23 | #define CPU_PROCESS_CORNERS_NUM 2 | ||
24 | |||
25 | enum { | ||
26 | THRESHOLD_INDEX_0, | ||
27 | THRESHOLD_INDEX_1, | ||
28 | THRESHOLD_INDEX_COUNT, | ||
29 | }; | ||
30 | |||
31 | static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = { | ||
32 | {1123, UINT_MAX}, | ||
33 | {0, UINT_MAX}, | ||
34 | }; | ||
35 | |||
36 | static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = { | ||
37 | {1695, UINT_MAX}, | ||
38 | {0, UINT_MAX}, | ||
39 | }; | ||
40 | |||
41 | static void rev_sku_to_speedo_ids(int rev, int sku, int *threshold) | ||
42 | { | ||
43 | u32 tmp; | ||
44 | |||
45 | switch (sku) { | ||
46 | case 0x00: | ||
47 | case 0x10: | ||
48 | case 0x05: | ||
49 | case 0x06: | ||
50 | tegra_cpu_speedo_id = 1; | ||
51 | tegra_soc_speedo_id = 0; | ||
52 | *threshold = THRESHOLD_INDEX_0; | ||
53 | break; | ||
54 | |||
55 | case 0x03: | ||
56 | case 0x04: | ||
57 | tegra_cpu_speedo_id = 2; | ||
58 | tegra_soc_speedo_id = 1; | ||
59 | *threshold = THRESHOLD_INDEX_1; | ||
60 | break; | ||
61 | |||
62 | default: | ||
63 | pr_err("Tegra114 Unknown SKU %d\n", sku); | ||
64 | tegra_cpu_speedo_id = 0; | ||
65 | tegra_soc_speedo_id = 0; | ||
66 | *threshold = THRESHOLD_INDEX_0; | ||
67 | break; | ||
68 | } | ||
69 | |||
70 | if (rev == TEGRA_REVISION_A01) { | ||
71 | tmp = tegra_fuse_readl(0x270) << 1; | ||
72 | tmp |= tegra_fuse_readl(0x26c); | ||
73 | if (!tmp) | ||
74 | tegra_cpu_speedo_id = 0; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | void tegra114_init_speedo_data(void) | ||
79 | { | ||
80 | u32 cpu_speedo_val; | ||
81 | u32 core_speedo_val; | ||
82 | int threshold; | ||
83 | int i; | ||
84 | |||
85 | BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) != | ||
86 | THRESHOLD_INDEX_COUNT); | ||
87 | BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) != | ||
88 | THRESHOLD_INDEX_COUNT); | ||
89 | |||
90 | rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id, &threshold); | ||
91 | |||
92 | cpu_speedo_val = tegra_fuse_readl(0x12c) + 1024; | ||
93 | core_speedo_val = tegra_fuse_readl(0x134); | ||
94 | |||
95 | for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++) | ||
96 | if (cpu_speedo_val < cpu_process_speedos[threshold][i]) | ||
97 | break; | ||
98 | tegra_cpu_process_id = i; | ||
99 | |||
100 | for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++) | ||
101 | if (core_speedo_val < core_process_speedos[threshold][i]) | ||
102 | break; | ||
103 | tegra_core_process_id = i; | ||
104 | } | ||
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c index ce7ce42a1ac9..9e8bdfa2b369 100644 --- a/arch/arm/mach-tegra/tegra2_emc.c +++ b/arch/arm/mach-tegra/tegra2_emc.c | |||
@@ -276,7 +276,7 @@ static struct tegra_emc_pdata *tegra_emc_fill_pdata(struct platform_device *pdev | |||
276 | int i; | 276 | int i; |
277 | 277 | ||
278 | WARN_ON(pdev->dev.platform_data); | 278 | WARN_ON(pdev->dev.platform_data); |
279 | BUG_ON(IS_ERR_OR_NULL(c)); | 279 | BUG_ON(IS_ERR(c)); |
280 | 280 | ||
281 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 281 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
282 | pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), | 282 | pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables), |
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c index 0a3f30df1eb8..152ae38cd18c 100644 --- a/arch/arm/mach-ux500/board-mop500-pins.c +++ b/arch/arm/mach-ux500/board-mop500-pins.c | |||
@@ -48,8 +48,12 @@ BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED| | |||
48 | PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); | 48 | PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE); |
49 | BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| | 49 | BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| |
50 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 50 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
51 | BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| | ||
52 | PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); | ||
51 | BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| | 53 | BIAS(slpm_wkup_pdis, PIN_SLEEPMODE_ENABLED| |
52 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); | 54 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); |
55 | BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| | ||
56 | PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); | ||
53 | BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| | 57 | BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| |
54 | PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); | 58 | PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); |
55 | BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| | 59 | BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED| |
@@ -78,9 +82,6 @@ BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE| | |||
78 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) | 82 | PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-db8500", group, func) |
79 | #define DB8500_PIN_HOG(pin,conf) \ | 83 | #define DB8500_PIN_HOG(pin,conf) \ |
80 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) | 84 | PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-db8500", pin, conf) |
81 | #define DB8500_PIN_SLEEP(pin, conf, dev) \ | ||
82 | PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_SLEEP, "pinctrl-db8500", \ | ||
83 | pin, conf) | ||
84 | 85 | ||
85 | /* These are default states associated with device and changed runtime */ | 86 | /* These are default states associated with device and changed runtime */ |
86 | #define DB8500_MUX(group,func,dev) \ | 87 | #define DB8500_MUX(group,func,dev) \ |
@@ -309,8 +310,23 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
309 | DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ | 310 | DB8500_PIN_SLEEP("GPIO207_AJ23", slpm_in_wkup_pdis, "sdi4"), /* DAT4 */ |
310 | 311 | ||
311 | /* Mux in USB pins, drive STP high */ | 312 | /* Mux in USB pins, drive STP high */ |
312 | DB8500_MUX("usb_a_1", "usb", "musb-ux500.0"), | 313 | /* USB default state */ |
313 | DB8500_PIN("GPIO257_AE29", out_hi, "musb-ux500.0"), /* STP */ | 314 | DB8500_MUX("usb_a_1", "usb", "ab8500-usb.0"), |
315 | DB8500_PIN("GPIO257_AE29", out_hi, "ab8500-usb.0"), /* STP */ | ||
316 | /* USB sleep state */ | ||
317 | DB8500_PIN_SLEEP("GPIO256_AF28", slpm_wkup_pdis_en, "ab8500-usb.0"), /* NXT */ | ||
318 | DB8500_PIN_SLEEP("GPIO257_AE29", slpm_out_hi_wkup_pdis, "ab8500-usb.0"), /* STP */ | ||
319 | DB8500_PIN_SLEEP("GPIO258_AD29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* XCLK */ | ||
320 | DB8500_PIN_SLEEP("GPIO259_AC29", slpm_wkup_pdis_en, "ab8500-usb.0"), /* DIR */ | ||
321 | DB8500_PIN_SLEEP("GPIO260_AD28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT7 */ | ||
322 | DB8500_PIN_SLEEP("GPIO261_AD26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT6 */ | ||
323 | DB8500_PIN_SLEEP("GPIO262_AE26", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT5 */ | ||
324 | DB8500_PIN_SLEEP("GPIO263_AG29", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT4 */ | ||
325 | DB8500_PIN_SLEEP("GPIO264_AE27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT3 */ | ||
326 | DB8500_PIN_SLEEP("GPIO265_AD27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT2 */ | ||
327 | DB8500_PIN_SLEEP("GPIO266_AC28", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT1 */ | ||
328 | DB8500_PIN_SLEEP("GPIO267_AC27", slpm_in_wkup_pdis_en, "ab8500-usb.0"), /* DAT0 */ | ||
329 | |||
314 | /* Mux in SPI2 pins on the "other C1" altfunction */ | 330 | /* Mux in SPI2 pins on the "other C1" altfunction */ |
315 | DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), | 331 | DB8500_MUX("spi2_oc1_2", "spi2", "spi2"), |
316 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ | 332 | DB8500_PIN("GPIO216_AG12", gpio_out_hi, "spi2"), /* FRM */ |
@@ -318,9 +334,9 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = { | |||
318 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ | 334 | DB8500_PIN("GPIO215_AH13", out_lo, "spi2"), /* TXD */ |
319 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ | 335 | DB8500_PIN("GPIO217_AH12", out_lo, "spi2"), /* CLK */ |
320 | /* SPI2 idle state */ | 336 | /* SPI2 idle state */ |
321 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ | 337 | DB8500_PIN_IDLE("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ |
322 | DB8500_PIN_SLEEP("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ | 338 | DB8500_PIN_IDLE("GPIO215_AH13", slpm_out_lo_wkup_pdis, "spi2"), /* TXD */ |
323 | DB8500_PIN_SLEEP("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ | 339 | DB8500_PIN_IDLE("GPIO217_AH12", slpm_wkup_pdis, "spi2"), /* CLK */ |
324 | /* SPI2 sleep state */ | 340 | /* SPI2 sleep state */ |
325 | DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ | 341 | DB8500_PIN_SLEEP("GPIO216_AG12", slpm_in_wkup_pdis, "spi2"), /* FRM */ |
326 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ | 342 | DB8500_PIN_SLEEP("GPIO218_AH11", slpm_in_wkup_pdis, "spi2"), /* RXD */ |
@@ -747,6 +763,8 @@ static struct pinctrl_map __initdata snowball_pinmap[] = { | |||
747 | DB8500_PIN_HOG("GPIO21_AB3", out_hi), | 763 | DB8500_PIN_HOG("GPIO21_AB3", out_hi), |
748 | /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ | 764 | /* Mux in "SM" which is used for the SMSC911x Ethernet adapter */ |
749 | DB8500_MUX_HOG("sm_b_1", "sm"), | 765 | DB8500_MUX_HOG("sm_b_1", "sm"), |
766 | /* User LED */ | ||
767 | DB8500_PIN_HOG("GPIO142_C11", gpio_out_hi), | ||
750 | /* Drive RSTn_LAN high */ | 768 | /* Drive RSTn_LAN high */ |
751 | DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), | 769 | DB8500_PIN_HOG("GPIO141_C12", gpio_out_hi), |
752 | /* Accelerometer/Magnetometer */ | 770 | /* Accelerometer/Magnetometer */ |
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 537870d3fea8..002da9a369d5 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
@@ -140,14 +140,13 @@ struct device * __init ux500_soc_device_init(const char *soc_id) | |||
140 | soc_info_populate(soc_dev_attr, soc_id); | 140 | soc_info_populate(soc_dev_attr, soc_id); |
141 | 141 | ||
142 | soc_dev = soc_device_register(soc_dev_attr); | 142 | soc_dev = soc_device_register(soc_dev_attr); |
143 | if (IS_ERR_OR_NULL(soc_dev)) { | 143 | if (IS_ERR(soc_dev)) { |
144 | kfree(soc_dev_attr); | 144 | kfree(soc_dev_attr); |
145 | return NULL; | 145 | return NULL; |
146 | } | 146 | } |
147 | 147 | ||
148 | parent = soc_device_to_device(soc_dev); | 148 | parent = soc_device_to_device(soc_dev); |
149 | if (!IS_ERR_OR_NULL(parent)) | 149 | device_create_file(parent, &ux500_soc_attr); |
150 | device_create_file(parent, &ux500_soc_attr); | ||
151 | 150 | ||
152 | return parent; | 151 | return parent; |
153 | } | 152 | } |
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index a6af0b8732ba..d07bbe7f04a6 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/io.h> | 7 | #include <linux/io.h> |
8 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
9 | #include <linux/clksrc-dbx500-prcmu.h> | 9 | #include <linux/clksrc-dbx500-prcmu.h> |
10 | #include <linux/clocksource.h> | ||
10 | #include <linux/of.h> | 11 | #include <linux/of.h> |
11 | #include <linux/of_address.h> | 12 | #include <linux/of_address.h> |
12 | #include <linux/platform_data/clocksource-nomadik-mtu.h> | 13 | #include <linux/platform_data/clocksource-nomadik-mtu.h> |
@@ -32,7 +33,7 @@ static void __init ux500_twd_init(void) | |||
32 | twd_local_timer = &u8500_twd_local_timer; | 33 | twd_local_timer = &u8500_twd_local_timer; |
33 | 34 | ||
34 | if (of_have_populated_dt()) | 35 | if (of_have_populated_dt()) |
35 | twd_local_timer_of_register(); | 36 | clocksource_of_init(); |
36 | else { | 37 | else { |
37 | err = twd_local_timer_register(twd_local_timer); | 38 | err = twd_local_timer_register(twd_local_timer); |
38 | if (err) | 39 | if (err) |
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 25160aeaa3b7..54bb80b012ac 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c | |||
@@ -749,12 +749,25 @@ void versatile_restart(char mode, const char *cmd) | |||
749 | /* Early initializations */ | 749 | /* Early initializations */ |
750 | void __init versatile_init_early(void) | 750 | void __init versatile_init_early(void) |
751 | { | 751 | { |
752 | u32 val; | ||
752 | void __iomem *sys = __io_address(VERSATILE_SYS_BASE); | 753 | void __iomem *sys = __io_address(VERSATILE_SYS_BASE); |
753 | 754 | ||
754 | osc4_clk.vcoreg = sys + VERSATILE_SYS_OSCCLCD_OFFSET; | 755 | osc4_clk.vcoreg = sys + VERSATILE_SYS_OSCCLCD_OFFSET; |
755 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 756 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
756 | 757 | ||
757 | versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000); | 758 | versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000); |
759 | |||
760 | /* | ||
761 | * set clock frequency: | ||
762 | * VERSATILE_REFCLK is 32KHz | ||
763 | * VERSATILE_TIMCLK is 1MHz | ||
764 | */ | ||
765 | val = readl(__io_address(VERSATILE_SCTL_BASE)); | ||
766 | writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | | ||
767 | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | | ||
768 | (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | | ||
769 | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, | ||
770 | __io_address(VERSATILE_SCTL_BASE)); | ||
758 | } | 771 | } |
759 | 772 | ||
760 | void __init versatile_init(void) | 773 | void __init versatile_init(void) |
@@ -785,19 +798,6 @@ void __init versatile_init(void) | |||
785 | */ | 798 | */ |
786 | void __init versatile_timer_init(void) | 799 | void __init versatile_timer_init(void) |
787 | { | 800 | { |
788 | u32 val; | ||
789 | |||
790 | /* | ||
791 | * set clock frequency: | ||
792 | * VERSATILE_REFCLK is 32KHz | ||
793 | * VERSATILE_TIMCLK is 1MHz | ||
794 | */ | ||
795 | val = readl(__io_address(VERSATILE_SCTL_BASE)); | ||
796 | writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | | ||
797 | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) | | ||
798 | (VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | | ||
799 | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val, | ||
800 | __io_address(VERSATILE_SCTL_BASE)); | ||
801 | 801 | ||
802 | /* | 802 | /* |
803 | * Initialise to a known state (all timers off) | 803 | * Initialise to a known state (all timers off) |
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c index 2558f2e957c3..3621b000a0f6 100644 --- a/arch/arm/mach-versatile/versatile_dt.c +++ b/arch/arm/mach-versatile/versatile_dt.c | |||
@@ -45,7 +45,6 @@ DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)") | |||
45 | .map_io = versatile_map_io, | 45 | .map_io = versatile_map_io, |
46 | .init_early = versatile_init_early, | 46 | .init_early = versatile_init_early, |
47 | .init_irq = versatile_init_irq, | 47 | .init_irq = versatile_init_irq, |
48 | .init_time = versatile_timer_init, | ||
49 | .init_machine = versatile_dt_init, | 48 | .init_machine = versatile_dt_init, |
50 | .dt_compat = versatile_dt_match, | 49 | .dt_compat = versatile_dt_match, |
51 | .restart = versatile_restart, | 50 | .restart = versatile_restart, |
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 915683cb67d6..09e571ddc984 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -1,10 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Versatile Express V2M Motherboard Support | 2 | * Versatile Express V2M Motherboard Support |
3 | */ | 3 | */ |
4 | #include <linux/clocksource.h> | ||
4 | #include <linux/device.h> | 5 | #include <linux/device.h> |
5 | #include <linux/amba/bus.h> | 6 | #include <linux/amba/bus.h> |
6 | #include <linux/amba/mmci.h> | 7 | #include <linux/amba/mmci.h> |
7 | #include <linux/io.h> | 8 | #include <linux/io.h> |
9 | #include <linux/clocksource.h> | ||
8 | #include <linux/smp.h> | 10 | #include <linux/smp.h> |
9 | #include <linux/init.h> | 11 | #include <linux/init.h> |
10 | #include <linux/irqchip.h> | 12 | #include <linux/irqchip.h> |
@@ -22,10 +24,8 @@ | |||
22 | #include <linux/regulator/machine.h> | 24 | #include <linux/regulator/machine.h> |
23 | #include <linux/vexpress.h> | 25 | #include <linux/vexpress.h> |
24 | 26 | ||
25 | #include <asm/arch_timer.h> | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/sizes.h> | 28 | #include <asm/sizes.h> |
28 | #include <asm/smp_twd.h> | ||
29 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
30 | #include <asm/mach/map.h> | 30 | #include <asm/mach/map.h> |
31 | #include <asm/mach/time.h> | 31 | #include <asm/mach/time.h> |
@@ -61,9 +61,6 @@ static void __init v2m_sp804_init(void __iomem *base, unsigned int irq) | |||
61 | if (WARN_ON(!base || irq == NO_IRQ)) | 61 | if (WARN_ON(!base || irq == NO_IRQ)) |
62 | return; | 62 | return; |
63 | 63 | ||
64 | writel(0, base + TIMER_1_BASE + TIMER_CTRL); | ||
65 | writel(0, base + TIMER_2_BASE + TIMER_CTRL); | ||
66 | |||
67 | sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1"); | 64 | sp804_clocksource_init(base + TIMER_2_BASE, "v2m-timer1"); |
68 | sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0"); | 65 | sp804_clockevents_init(base + TIMER_1_BASE, irq, "v2m-timer0"); |
69 | } | 66 | } |
@@ -431,25 +428,11 @@ void __init v2m_dt_init_early(void) | |||
431 | 428 | ||
432 | static void __init v2m_dt_timer_init(void) | 429 | static void __init v2m_dt_timer_init(void) |
433 | { | 430 | { |
434 | struct device_node *node = NULL; | ||
435 | |||
436 | vexpress_clk_of_init(); | 431 | vexpress_clk_of_init(); |
437 | 432 | ||
438 | do { | 433 | clocksource_of_init(); |
439 | node = of_find_compatible_node(node, NULL, "arm,sp804"); | ||
440 | } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB); | ||
441 | if (node) { | ||
442 | pr_info("Using SP804 '%s' as a clock & events source\n", | ||
443 | node->full_name); | ||
444 | v2m_sp804_init(of_iomap(node, 0), | ||
445 | irq_of_parse_and_map(node, 0)); | ||
446 | } | ||
447 | |||
448 | if (arch_timer_of_register() != 0) | ||
449 | twd_local_timer_of_register(); | ||
450 | 434 | ||
451 | if (arch_timer_sched_clock_init() != 0) | 435 | versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), |
452 | versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), | ||
453 | 24000000); | 436 | 24000000); |
454 | } | 437 | } |
455 | 438 | ||
diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c index 31666f6b4373..adc0945255ae 100644 --- a/arch/arm/mach-virt/virt.c +++ b/arch/arm/mach-virt/virt.c | |||
@@ -23,21 +23,13 @@ | |||
23 | #include <linux/of_platform.h> | 23 | #include <linux/of_platform.h> |
24 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
25 | 25 | ||
26 | #include <asm/arch_timer.h> | ||
27 | #include <asm/mach/arch.h> | 26 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/time.h> | ||
29 | 27 | ||
30 | static void __init virt_init(void) | 28 | static void __init virt_init(void) |
31 | { | 29 | { |
32 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 30 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
33 | } | 31 | } |
34 | 32 | ||
35 | static void __init virt_timer_init(void) | ||
36 | { | ||
37 | WARN_ON(arch_timer_of_register() != 0); | ||
38 | WARN_ON(arch_timer_sched_clock_init() != 0); | ||
39 | } | ||
40 | |||
41 | static const char *virt_dt_match[] = { | 33 | static const char *virt_dt_match[] = { |
42 | "linux,dummy-virt", | 34 | "linux,dummy-virt", |
43 | NULL | 35 | NULL |
@@ -47,7 +39,6 @@ extern struct smp_operations virt_smp_ops; | |||
47 | 39 | ||
48 | DT_MACHINE_START(VIRT, "Dummy Virtual Machine") | 40 | DT_MACHINE_START(VIRT, "Dummy Virtual Machine") |
49 | .init_irq = irqchip_init, | 41 | .init_irq = irqchip_init, |
50 | .init_time = virt_timer_init, | ||
51 | .init_machine = virt_init, | 42 | .init_machine = virt_init, |
52 | .smp = smp_ops(virt_smp_ops), | 43 | .smp = smp_ops(virt_smp_ops), |
53 | .dt_compat = virt_dt_match, | 44 | .dt_compat = virt_dt_match, |
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig index e3e94b2fa145..9b252934b206 100644 --- a/arch/arm/mach-vt8500/Kconfig +++ b/arch/arm/mach-vt8500/Kconfig | |||
@@ -7,6 +7,7 @@ config ARCH_VT8500 | |||
7 | select GENERIC_CLOCKEVENTS | 7 | select GENERIC_CLOCKEVENTS |
8 | select HAVE_CLK | 8 | select HAVE_CLK |
9 | select VT8500_TIMER | 9 | select VT8500_TIMER |
10 | select PINCTRL | ||
10 | help | 11 | help |
11 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. | 12 | Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. |
12 | 13 | ||
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig index adb6c0ea0e53..d70651e8b705 100644 --- a/arch/arm/mach-zynq/Kconfig +++ b/arch/arm/mach-zynq/Kconfig | |||
@@ -9,5 +9,6 @@ config ARCH_ZYNQ | |||
9 | select MIGHT_HAVE_CACHE_L2X0 | 9 | select MIGHT_HAVE_CACHE_L2X0 |
10 | select USE_OF | 10 | select USE_OF |
11 | select SPARSE_IRQ | 11 | select SPARSE_IRQ |
12 | select CADENCE_TTC_TIMER | ||
12 | help | 13 | help |
13 | Support for Xilinx Zynq ARM Cortex A9 Platform | 14 | Support for Xilinx Zynq ARM Cortex A9 Platform |
diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile index 397268c1b250..320faedeb484 100644 --- a/arch/arm/mach-zynq/Makefile +++ b/arch/arm/mach-zynq/Makefile | |||
@@ -3,4 +3,4 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | # Common support | 5 | # Common support |
6 | obj-y := common.o timer.o | 6 | obj-y := common.o |
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 5c8983218183..68e0907de5d0 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/clk/zynq.h> | 22 | #include <linux/clk/zynq.h> |
23 | #include <linux/clocksource.h> | ||
23 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
24 | #include <linux/of_irq.h> | 25 | #include <linux/of_irq.h> |
25 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
@@ -77,7 +78,7 @@ static void __init xilinx_zynq_timer_init(void) | |||
77 | 78 | ||
78 | xilinx_zynq_clocks_init(slcr); | 79 | xilinx_zynq_clocks_init(slcr); |
79 | 80 | ||
80 | xttcps_timer_init(); | 81 | clocksource_of_init(); |
81 | } | 82 | } |
82 | 83 | ||
83 | /** | 84 | /** |
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h index 8b4dbbaa01cf..5050bb10bb12 100644 --- a/arch/arm/mach-zynq/common.h +++ b/arch/arm/mach-zynq/common.h | |||
@@ -17,6 +17,4 @@ | |||
17 | #ifndef __MACH_ZYNQ_COMMON_H__ | 17 | #ifndef __MACH_ZYNQ_COMMON_H__ |
18 | #define __MACH_ZYNQ_COMMON_H__ | 18 | #define __MACH_ZYNQ_COMMON_H__ |
19 | 19 | ||
20 | void __init xttcps_timer_init(void); | ||
21 | |||
22 | #endif | 20 | #endif |
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c deleted file mode 100644 index f9fbc9c1e7a6..000000000000 --- a/arch/arm/mach-zynq/timer.c +++ /dev/null | |||
@@ -1,324 +0,0 @@ | |||
1 | /* | ||
2 | * This file contains driver for the Xilinx PS Timer Counter IP. | ||
3 | * | ||
4 | * Copyright (C) 2011 Xilinx | ||
5 | * | ||
6 | * based on arch/mips/kernel/time.c timer driver | ||
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 | #include <linux/interrupt.h> | ||
19 | #include <linux/clockchips.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/clk-provider.h> | ||
24 | #include "common.h" | ||
25 | |||
26 | /* | ||
27 | * Timer Register Offset Definitions of Timer 1, Increment base address by 4 | ||
28 | * and use same offsets for Timer 2 | ||
29 | */ | ||
30 | #define XTTCPS_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ | ||
31 | #define XTTCPS_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ | ||
32 | #define XTTCPS_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ | ||
33 | #define XTTCPS_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ | ||
34 | #define XTTCPS_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ | ||
35 | #define XTTCPS_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ | ||
36 | |||
37 | #define XTTCPS_CNT_CNTRL_DISABLE_MASK 0x1 | ||
38 | |||
39 | /* | ||
40 | * Setup the timers to use pre-scaling, using a fixed value for now that will | ||
41 | * work across most input frequency, but it may need to be more dynamic | ||
42 | */ | ||
43 | #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ | ||
44 | #define PRESCALE 2048 /* The exponent must match this */ | ||
45 | #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) | ||
46 | #define CLK_CNTRL_PRESCALE_EN 1 | ||
47 | #define CNT_CNTRL_RESET (1<<4) | ||
48 | |||
49 | /** | ||
50 | * struct xttcps_timer - This definition defines local timer structure | ||
51 | * | ||
52 | * @base_addr: Base address of timer | ||
53 | **/ | ||
54 | struct xttcps_timer { | ||
55 | void __iomem *base_addr; | ||
56 | }; | ||
57 | |||
58 | struct xttcps_timer_clocksource { | ||
59 | struct xttcps_timer xttc; | ||
60 | struct clocksource cs; | ||
61 | }; | ||
62 | |||
63 | #define to_xttcps_timer_clksrc(x) \ | ||
64 | container_of(x, struct xttcps_timer_clocksource, cs) | ||
65 | |||
66 | struct xttcps_timer_clockevent { | ||
67 | struct xttcps_timer xttc; | ||
68 | struct clock_event_device ce; | ||
69 | struct clk *clk; | ||
70 | }; | ||
71 | |||
72 | #define to_xttcps_timer_clkevent(x) \ | ||
73 | container_of(x, struct xttcps_timer_clockevent, ce) | ||
74 | |||
75 | /** | ||
76 | * xttcps_set_interval - Set the timer interval value | ||
77 | * | ||
78 | * @timer: Pointer to the timer instance | ||
79 | * @cycles: Timer interval ticks | ||
80 | **/ | ||
81 | static void xttcps_set_interval(struct xttcps_timer *timer, | ||
82 | unsigned long cycles) | ||
83 | { | ||
84 | u32 ctrl_reg; | ||
85 | |||
86 | /* Disable the counter, set the counter value and re-enable counter */ | ||
87 | ctrl_reg = __raw_readl(timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
88 | ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
89 | __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
90 | |||
91 | __raw_writel(cycles, timer->base_addr + XTTCPS_INTR_VAL_OFFSET); | ||
92 | |||
93 | /* | ||
94 | * Reset the counter (0x10) so that it starts from 0, one-shot | ||
95 | * mode makes this needed for timing to be right. | ||
96 | */ | ||
97 | ctrl_reg |= CNT_CNTRL_RESET; | ||
98 | ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
99 | __raw_writel(ctrl_reg, timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * xttcps_clock_event_interrupt - Clock event timer interrupt handler | ||
104 | * | ||
105 | * @irq: IRQ number of the Timer | ||
106 | * @dev_id: void pointer to the xttcps_timer instance | ||
107 | * | ||
108 | * returns: Always IRQ_HANDLED - success | ||
109 | **/ | ||
110 | static irqreturn_t xttcps_clock_event_interrupt(int irq, void *dev_id) | ||
111 | { | ||
112 | struct xttcps_timer_clockevent *xttce = dev_id; | ||
113 | struct xttcps_timer *timer = &xttce->xttc; | ||
114 | |||
115 | /* Acknowledge the interrupt and call event handler */ | ||
116 | __raw_readl(timer->base_addr + XTTCPS_ISR_OFFSET); | ||
117 | |||
118 | xttce->ce.event_handler(&xttce->ce); | ||
119 | |||
120 | return IRQ_HANDLED; | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * __xttc_clocksource_read - Reads the timer counter register | ||
125 | * | ||
126 | * returns: Current timer counter register value | ||
127 | **/ | ||
128 | static cycle_t __xttc_clocksource_read(struct clocksource *cs) | ||
129 | { | ||
130 | struct xttcps_timer *timer = &to_xttcps_timer_clksrc(cs)->xttc; | ||
131 | |||
132 | return (cycle_t)__raw_readl(timer->base_addr + | ||
133 | XTTCPS_COUNT_VAL_OFFSET); | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * xttcps_set_next_event - Sets the time interval for next event | ||
138 | * | ||
139 | * @cycles: Timer interval ticks | ||
140 | * @evt: Address of clock event instance | ||
141 | * | ||
142 | * returns: Always 0 - success | ||
143 | **/ | ||
144 | static int xttcps_set_next_event(unsigned long cycles, | ||
145 | struct clock_event_device *evt) | ||
146 | { | ||
147 | struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); | ||
148 | struct xttcps_timer *timer = &xttce->xttc; | ||
149 | |||
150 | xttcps_set_interval(timer, cycles); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * xttcps_set_mode - Sets the mode of timer | ||
156 | * | ||
157 | * @mode: Mode to be set | ||
158 | * @evt: Address of clock event instance | ||
159 | **/ | ||
160 | static void xttcps_set_mode(enum clock_event_mode mode, | ||
161 | struct clock_event_device *evt) | ||
162 | { | ||
163 | struct xttcps_timer_clockevent *xttce = to_xttcps_timer_clkevent(evt); | ||
164 | struct xttcps_timer *timer = &xttce->xttc; | ||
165 | u32 ctrl_reg; | ||
166 | |||
167 | switch (mode) { | ||
168 | case CLOCK_EVT_MODE_PERIODIC: | ||
169 | xttcps_set_interval(timer, | ||
170 | DIV_ROUND_CLOSEST(clk_get_rate(xttce->clk), | ||
171 | PRESCALE * HZ)); | ||
172 | break; | ||
173 | case CLOCK_EVT_MODE_ONESHOT: | ||
174 | case CLOCK_EVT_MODE_UNUSED: | ||
175 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
176 | ctrl_reg = __raw_readl(timer->base_addr + | ||
177 | XTTCPS_CNT_CNTRL_OFFSET); | ||
178 | ctrl_reg |= XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
179 | __raw_writel(ctrl_reg, | ||
180 | timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
181 | break; | ||
182 | case CLOCK_EVT_MODE_RESUME: | ||
183 | ctrl_reg = __raw_readl(timer->base_addr + | ||
184 | XTTCPS_CNT_CNTRL_OFFSET); | ||
185 | ctrl_reg &= ~XTTCPS_CNT_CNTRL_DISABLE_MASK; | ||
186 | __raw_writel(ctrl_reg, | ||
187 | timer->base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | static void __init zynq_ttc_setup_clocksource(struct device_node *np, | ||
193 | void __iomem *base) | ||
194 | { | ||
195 | struct xttcps_timer_clocksource *ttccs; | ||
196 | struct clk *clk; | ||
197 | int err; | ||
198 | u32 reg; | ||
199 | |||
200 | ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); | ||
201 | if (WARN_ON(!ttccs)) | ||
202 | return; | ||
203 | |||
204 | err = of_property_read_u32(np, "reg", ®); | ||
205 | if (WARN_ON(err)) | ||
206 | return; | ||
207 | |||
208 | clk = of_clk_get_by_name(np, "cpu_1x"); | ||
209 | if (WARN_ON(IS_ERR(clk))) | ||
210 | return; | ||
211 | |||
212 | err = clk_prepare_enable(clk); | ||
213 | if (WARN_ON(err)) | ||
214 | return; | ||
215 | |||
216 | ttccs->xttc.base_addr = base + reg * 4; | ||
217 | |||
218 | ttccs->cs.name = np->name; | ||
219 | ttccs->cs.rating = 200; | ||
220 | ttccs->cs.read = __xttc_clocksource_read; | ||
221 | ttccs->cs.mask = CLOCKSOURCE_MASK(16); | ||
222 | ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; | ||
223 | |||
224 | __raw_writel(0x0, ttccs->xttc.base_addr + XTTCPS_IER_OFFSET); | ||
225 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
226 | ttccs->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); | ||
227 | __raw_writel(CNT_CNTRL_RESET, | ||
228 | ttccs->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
229 | |||
230 | err = clocksource_register_hz(&ttccs->cs, clk_get_rate(clk) / PRESCALE); | ||
231 | if (WARN_ON(err)) | ||
232 | return; | ||
233 | } | ||
234 | |||
235 | static void __init zynq_ttc_setup_clockevent(struct device_node *np, | ||
236 | void __iomem *base) | ||
237 | { | ||
238 | struct xttcps_timer_clockevent *ttcce; | ||
239 | int err, irq; | ||
240 | u32 reg; | ||
241 | |||
242 | ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); | ||
243 | if (WARN_ON(!ttcce)) | ||
244 | return; | ||
245 | |||
246 | err = of_property_read_u32(np, "reg", ®); | ||
247 | if (WARN_ON(err)) | ||
248 | return; | ||
249 | |||
250 | ttcce->xttc.base_addr = base + reg * 4; | ||
251 | |||
252 | ttcce->clk = of_clk_get_by_name(np, "cpu_1x"); | ||
253 | if (WARN_ON(IS_ERR(ttcce->clk))) | ||
254 | return; | ||
255 | |||
256 | err = clk_prepare_enable(ttcce->clk); | ||
257 | if (WARN_ON(err)) | ||
258 | return; | ||
259 | |||
260 | irq = irq_of_parse_and_map(np, 0); | ||
261 | if (WARN_ON(!irq)) | ||
262 | return; | ||
263 | |||
264 | ttcce->ce.name = np->name; | ||
265 | ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
266 | ttcce->ce.set_next_event = xttcps_set_next_event; | ||
267 | ttcce->ce.set_mode = xttcps_set_mode; | ||
268 | ttcce->ce.rating = 200; | ||
269 | ttcce->ce.irq = irq; | ||
270 | ttcce->ce.cpumask = cpu_possible_mask; | ||
271 | |||
272 | __raw_writel(0x23, ttcce->xttc.base_addr + XTTCPS_CNT_CNTRL_OFFSET); | ||
273 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
274 | ttcce->xttc.base_addr + XTTCPS_CLK_CNTRL_OFFSET); | ||
275 | __raw_writel(0x1, ttcce->xttc.base_addr + XTTCPS_IER_OFFSET); | ||
276 | |||
277 | err = request_irq(irq, xttcps_clock_event_interrupt, IRQF_TIMER, | ||
278 | np->name, ttcce); | ||
279 | if (WARN_ON(err)) | ||
280 | return; | ||
281 | |||
282 | clockevents_config_and_register(&ttcce->ce, | ||
283 | clk_get_rate(ttcce->clk) / PRESCALE, | ||
284 | 1, 0xfffe); | ||
285 | } | ||
286 | |||
287 | static const __initconst struct of_device_id zynq_ttc_match[] = { | ||
288 | { .compatible = "xlnx,ttc-counter-clocksource", | ||
289 | .data = zynq_ttc_setup_clocksource, }, | ||
290 | { .compatible = "xlnx,ttc-counter-clockevent", | ||
291 | .data = zynq_ttc_setup_clockevent, }, | ||
292 | {} | ||
293 | }; | ||
294 | |||
295 | /** | ||
296 | * xttcps_timer_init - Initialize the timer | ||
297 | * | ||
298 | * Initializes the timer hardware and register the clock source and clock event | ||
299 | * timers with Linux kernal timer framework | ||
300 | **/ | ||
301 | void __init xttcps_timer_init(void) | ||
302 | { | ||
303 | struct device_node *np; | ||
304 | |||
305 | for_each_compatible_node(np, NULL, "xlnx,ttc") { | ||
306 | struct device_node *np_chld; | ||
307 | void __iomem *base; | ||
308 | |||
309 | base = of_iomap(np, 0); | ||
310 | if (WARN_ON(!base)) | ||
311 | return; | ||
312 | |||
313 | for_each_available_child_of_node(np, np_chld) { | ||
314 | int (*cb)(struct device_node *np, void __iomem *base); | ||
315 | const struct of_device_id *match; | ||
316 | |||
317 | match = of_match_node(zynq_ttc_match, np_chld); | ||
318 | if (match) { | ||
319 | cb = match->data; | ||
320 | cb(np_chld, base); | ||
321 | } | ||
322 | } | ||
323 | } | ||
324 | } | ||
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index a0daa2fb5de6..e6dbc8dbe6a6 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
@@ -140,8 +140,7 @@ static int omap_dm_timer_prepare(struct omap_dm_timer *timer) | |||
140 | */ | 140 | */ |
141 | if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) { | 141 | if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) { |
142 | timer->fclk = clk_get(&timer->pdev->dev, "fck"); | 142 | timer->fclk = clk_get(&timer->pdev->dev, "fck"); |
143 | if (WARN_ON_ONCE(IS_ERR_OR_NULL(timer->fclk))) { | 143 | if (WARN_ON_ONCE(IS_ERR(timer->fclk))) { |
144 | timer->fclk = NULL; | ||
145 | dev_err(&timer->pdev->dev, ": No fclk handle.\n"); | 144 | dev_err(&timer->pdev->dev, ": No fclk handle.\n"); |
146 | return -EINVAL; | 145 | return -EINVAL; |
147 | } | 146 | } |
@@ -373,7 +372,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); | |||
373 | 372 | ||
374 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) | 373 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) |
375 | { | 374 | { |
376 | if (timer) | 375 | if (timer && !IS_ERR(timer->fclk)) |
377 | return timer->fclk; | 376 | return timer->fclk; |
378 | return NULL; | 377 | return NULL; |
379 | } | 378 | } |
@@ -482,7 +481,7 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) | |||
482 | if (pdata && pdata->set_timer_src) | 481 | if (pdata && pdata->set_timer_src) |
483 | return pdata->set_timer_src(timer->pdev, source); | 482 | return pdata->set_timer_src(timer->pdev, source); |
484 | 483 | ||
485 | if (!timer->fclk) | 484 | if (IS_ERR(timer->fclk)) |
486 | return -EINVAL; | 485 | return -EINVAL; |
487 | 486 | ||
488 | switch (source) { | 487 | switch (source) { |
@@ -500,13 +499,13 @@ int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) | |||
500 | } | 499 | } |
501 | 500 | ||
502 | parent = clk_get(&timer->pdev->dev, parent_name); | 501 | parent = clk_get(&timer->pdev->dev, parent_name); |
503 | if (IS_ERR_OR_NULL(parent)) { | 502 | if (IS_ERR(parent)) { |
504 | pr_err("%s: %s not found\n", __func__, parent_name); | 503 | pr_err("%s: %s not found\n", __func__, parent_name); |
505 | return -EINVAL; | 504 | return -EINVAL; |
506 | } | 505 | } |
507 | 506 | ||
508 | ret = clk_set_parent(timer->fclk, parent); | 507 | ret = clk_set_parent(timer->fclk, parent); |
509 | if (IS_ERR_VALUE(ret)) | 508 | if (ret < 0) |
510 | pr_err("%s: failed to set %s as parent\n", __func__, | 509 | pr_err("%s: failed to set %s as parent\n", __func__, |
511 | parent_name); | 510 | parent_name); |
512 | 511 | ||
@@ -808,6 +807,7 @@ static int omap_dm_timer_probe(struct platform_device *pdev) | |||
808 | return -ENOMEM; | 807 | return -ENOMEM; |
809 | } | 808 | } |
810 | 809 | ||
810 | timer->fclk = ERR_PTR(-ENODEV); | ||
811 | timer->io_base = devm_ioremap_resource(dev, mem); | 811 | timer->io_base = devm_ioremap_resource(dev, mem); |
812 | if (IS_ERR(timer->io_base)) | 812 | if (IS_ERR(timer->io_base)) |
813 | return PTR_ERR(timer->io_base); | 813 | return PTR_ERR(timer->io_base); |
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index a9d52167e16e..b708b3e56d27 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -70,7 +70,7 @@ config S3C_LOWLEVEL_UART_PORT | |||
70 | 70 | ||
71 | # timer options | 71 | # timer options |
72 | 72 | ||
73 | config S5P_HRT | 73 | config SAMSUNG_HRT |
74 | bool | 74 | bool |
75 | select SAMSUNG_DEV_PWM | 75 | select SAMSUNG_DEV_PWM |
76 | help | 76 | help |
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 3a7c64d1814a..a23c460299a1 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile | |||
@@ -12,8 +12,7 @@ obj- := | |||
12 | # Objects we always build independent of SoC choice | 12 | # Objects we always build independent of SoC choice |
13 | 13 | ||
14 | obj-y += init.o cpu.o | 14 | obj-y += init.o cpu.o |
15 | obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o | 15 | obj-$(CONFIG_SAMSUNG_HRT) += samsung-time.o |
16 | obj-$(CONFIG_S5P_HRT) += s5p-time.o | ||
17 | 16 | ||
18 | obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o | 17 | obj-$(CONFIG_SAMSUNG_CLOCK) += clock.o |
19 | obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o | 18 | obj-$(CONFIG_SAMSUNG_CLOCK) += pwm-clock.o |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 37703ef6dfc7..989fefe18be6 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -23,6 +23,9 @@ extern unsigned long samsung_cpu_id; | |||
23 | #define S3C24XX_CPU_ID 0x32400000 | 23 | #define S3C24XX_CPU_ID 0x32400000 |
24 | #define S3C24XX_CPU_MASK 0xFFF00000 | 24 | #define S3C24XX_CPU_MASK 0xFFF00000 |
25 | 25 | ||
26 | #define S3C2412_CPU_ID 0x32412000 | ||
27 | #define S3C2412_CPU_MASK 0xFFFFF000 | ||
28 | |||
26 | #define S3C6400_CPU_ID 0x36400000 | 29 | #define S3C6400_CPU_ID 0x36400000 |
27 | #define S3C6410_CPU_ID 0x36410000 | 30 | #define S3C6410_CPU_ID 0x36410000 |
28 | #define S3C64XX_CPU_MASK 0xFFFFF000 | 31 | #define S3C64XX_CPU_MASK 0xFFFFF000 |
@@ -53,6 +56,7 @@ static inline int is_samsung_##name(void) \ | |||
53 | } | 56 | } |
54 | 57 | ||
55 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) | 58 | IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK) |
59 | IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK) | ||
56 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) | 60 | IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) |
57 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) | 61 | IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) |
58 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) | 62 | IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK) |
@@ -74,6 +78,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) | |||
74 | # define soc_is_s3c24xx() 0 | 78 | # define soc_is_s3c24xx() 0 |
75 | #endif | 79 | #endif |
76 | 80 | ||
81 | #if defined(CONFIG_CPU_S3C2412) | ||
82 | # define soc_is_s3c2412() is_samsung_s3c2412() | ||
83 | #else | ||
84 | # define soc_is_s3c2412() 0 | ||
85 | #endif | ||
86 | |||
77 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) | 87 | #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) |
78 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) | 88 | # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) |
79 | #else | 89 | #else |
@@ -173,7 +183,6 @@ extern void s3c_init_cpu(unsigned long idcode, | |||
173 | 183 | ||
174 | /* core initialisation functions */ | 184 | /* core initialisation functions */ |
175 | 185 | ||
176 | extern void s3c24xx_init_irq(void); | ||
177 | extern void s5p_init_irq(u32 *vic, u32 num_vic); | 186 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
178 | 187 | ||
179 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); | 188 | extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); |
@@ -192,10 +201,6 @@ extern void s3c24xx_init_uartdevs(char *name, | |||
192 | struct s3c24xx_uart_resources *res, | 201 | struct s3c24xx_uart_resources *res, |
193 | struct s3c2410_uartcfg *cfg, int no); | 202 | struct s3c2410_uartcfg *cfg, int no); |
194 | 203 | ||
195 | /* timer for 2410/2440 */ | ||
196 | |||
197 | extern void s3c24xx_timer_init(void); | ||
198 | |||
199 | extern struct syscore_ops s3c2410_pm_syscore_ops; | 204 | extern struct syscore_ops s3c2410_pm_syscore_ops; |
200 | extern struct syscore_ops s3c2412_pm_syscore_ops; | 205 | extern struct syscore_ops s3c2412_pm_syscore_ops; |
201 | extern struct syscore_ops s3c2416_pm_syscore_ops; | 206 | extern struct syscore_ops s3c2416_pm_syscore_ops; |
diff --git a/arch/arm/plat-samsung/include/plat/irq.h b/arch/arm/plat-samsung/include/plat/irq.h deleted file mode 100644 index e21a89bc26c9..000000000000 --- a/arch/arm/plat-samsung/include/plat/irq.h +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/irq.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for S3C24XX CPU IRQ support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/io.h> | ||
14 | |||
15 | #include <mach/hardware.h> | ||
16 | #include <mach/regs-irq.h> | ||
17 | #include <mach/regs-gpio.h> | ||
18 | |||
19 | #define irqdbf(x...) | ||
20 | #define irqdbf2(x...) | ||
21 | |||
22 | #define EXTINT_OFF (IRQ_EINT4 - 4) | ||
23 | |||
24 | /* these are exported for arch/arm/mach-* usage */ | ||
25 | extern struct irq_chip s3c_irq_level_chip; | ||
26 | extern struct irq_chip s3c_irq_chip; | ||
27 | |||
28 | static inline void s3c_irqsub_mask(unsigned int irqno, | ||
29 | unsigned int parentbit, | ||
30 | int subcheck) | ||
31 | { | ||
32 | unsigned long mask; | ||
33 | unsigned long submask; | ||
34 | |||
35 | submask = __raw_readl(S3C2410_INTSUBMSK); | ||
36 | mask = __raw_readl(S3C2410_INTMSK); | ||
37 | |||
38 | submask |= (1UL << (irqno - IRQ_S3CUART_RX0)); | ||
39 | |||
40 | /* check to see if we need to mask the parent IRQ */ | ||
41 | |||
42 | if ((submask & subcheck) == subcheck) | ||
43 | __raw_writel(mask | parentbit, S3C2410_INTMSK); | ||
44 | |||
45 | /* write back masks */ | ||
46 | __raw_writel(submask, S3C2410_INTSUBMSK); | ||
47 | |||
48 | } | ||
49 | |||
50 | static inline void s3c_irqsub_unmask(unsigned int irqno, | ||
51 | unsigned int parentbit) | ||
52 | { | ||
53 | unsigned long mask; | ||
54 | unsigned long submask; | ||
55 | |||
56 | submask = __raw_readl(S3C2410_INTSUBMSK); | ||
57 | mask = __raw_readl(S3C2410_INTMSK); | ||
58 | |||
59 | submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0)); | ||
60 | mask &= ~parentbit; | ||
61 | |||
62 | /* write back masks */ | ||
63 | __raw_writel(submask, S3C2410_INTSUBMSK); | ||
64 | __raw_writel(mask, S3C2410_INTMSK); | ||
65 | } | ||
66 | |||
67 | |||
68 | static inline void s3c_irqsub_maskack(unsigned int irqno, | ||
69 | unsigned int parentmask, | ||
70 | unsigned int group) | ||
71 | { | ||
72 | unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0); | ||
73 | |||
74 | s3c_irqsub_mask(irqno, parentmask, group); | ||
75 | |||
76 | __raw_writel(bit, S3C2410_SUBSRCPND); | ||
77 | |||
78 | /* only ack parent if we've got all the irqs (seems we must | ||
79 | * ack, all and hope that the irq system retriggers ok when | ||
80 | * the interrupt goes off again) | ||
81 | */ | ||
82 | |||
83 | if (1) { | ||
84 | __raw_writel(parentmask, S3C2410_SRCPND); | ||
85 | __raw_writel(parentmask, S3C2410_INTPND); | ||
86 | } | ||
87 | } | ||
88 | |||
89 | static inline void s3c_irqsub_ack(unsigned int irqno, | ||
90 | unsigned int parentmask, | ||
91 | unsigned int group) | ||
92 | { | ||
93 | unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0); | ||
94 | |||
95 | __raw_writel(bit, S3C2410_SUBSRCPND); | ||
96 | |||
97 | /* only ack parent if we've got all the irqs (seems we must | ||
98 | * ack, all and hope that the irq system retriggers ok when | ||
99 | * the interrupt goes off again) | ||
100 | */ | ||
101 | |||
102 | if (1) { | ||
103 | __raw_writel(parentmask, S3C2410_SRCPND); | ||
104 | __raw_writel(parentmask, S3C2410_INTPND); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | /* exported for use in arch/arm/mach-s3c2410 */ | ||
109 | |||
110 | #ifdef CONFIG_PM | ||
111 | extern int s3c_irq_wake(struct irq_data *data, unsigned int state); | ||
112 | #else | ||
113 | #define s3c_irq_wake NULL | ||
114 | #endif | ||
115 | |||
116 | extern int s3c_irqext_type(struct irq_data *d, unsigned int type); | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2410.h b/arch/arm/plat-samsung/include/plat/s3c2410.h deleted file mode 100644 index 55b0e5f51e97..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c2410.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2410.h | ||
2 | * | ||
3 | * Copyright (c) 2004 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2410 machine directory | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifdef CONFIG_CPU_S3C2410 | ||
15 | |||
16 | extern int s3c2410_init(void); | ||
17 | extern int s3c2410a_init(void); | ||
18 | |||
19 | extern void s3c2410_map_io(void); | ||
20 | |||
21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
22 | |||
23 | extern void s3c2410_init_clocks(int xtal); | ||
24 | |||
25 | #else | ||
26 | #define s3c2410_init_clocks NULL | ||
27 | #define s3c2410_init_uarts NULL | ||
28 | #define s3c2410_map_io NULL | ||
29 | #define s3c2410_init NULL | ||
30 | #define s3c2410a_init NULL | ||
31 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2412.h b/arch/arm/plat-samsung/include/plat/s3c2412.h deleted file mode 100644 index cbae50ddacc8..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c2412.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2412.h | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2412 cpu support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifdef CONFIG_CPU_S3C2412 | ||
14 | |||
15 | extern int s3c2412_init(void); | ||
16 | |||
17 | extern void s3c2412_map_io(void); | ||
18 | |||
19 | extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
20 | |||
21 | extern void s3c2412_init_clocks(int xtal); | ||
22 | |||
23 | extern int s3c2412_baseclk_add(void); | ||
24 | |||
25 | extern void s3c2412_restart(char mode, const char *cmd); | ||
26 | #else | ||
27 | #define s3c2412_init_clocks NULL | ||
28 | #define s3c2412_init_uarts NULL | ||
29 | #define s3c2412_map_io NULL | ||
30 | #define s3c2412_init NULL | ||
31 | #define s3c2412_restart NULL | ||
32 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2416.h b/arch/arm/plat-samsung/include/plat/s3c2416.h deleted file mode 100644 index f27399a3c68d..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c2416.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2416.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com> | ||
4 | * | ||
5 | * Header file for s3c2416 cpu support | ||
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 | #ifdef CONFIG_CPU_S3C2416 | ||
13 | |||
14 | struct s3c2410_uartcfg; | ||
15 | |||
16 | extern int s3c2416_init(void); | ||
17 | |||
18 | extern void s3c2416_map_io(void); | ||
19 | |||
20 | extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
21 | |||
22 | extern void s3c2416_init_clocks(int xtal); | ||
23 | |||
24 | extern int s3c2416_baseclk_add(void); | ||
25 | |||
26 | extern void s3c2416_restart(char mode, const char *cmd); | ||
27 | |||
28 | extern void s3c2416_init_irq(void); | ||
29 | extern struct syscore_ops s3c2416_irq_syscore_ops; | ||
30 | |||
31 | #else | ||
32 | #define s3c2416_init_clocks NULL | ||
33 | #define s3c2416_init_uarts NULL | ||
34 | #define s3c2416_map_io NULL | ||
35 | #define s3c2416_init NULL | ||
36 | #define s3c2416_restart NULL | ||
37 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c2443.h b/arch/arm/plat-samsung/include/plat/s3c2443.h deleted file mode 100644 index 71b88ec48956..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c2443.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c2443.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for s3c2443 cpu support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifdef CONFIG_CPU_S3C2443 | ||
14 | |||
15 | struct s3c2410_uartcfg; | ||
16 | |||
17 | extern int s3c2443_init(void); | ||
18 | |||
19 | extern void s3c2443_map_io(void); | ||
20 | |||
21 | extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
22 | |||
23 | extern void s3c2443_init_clocks(int xtal); | ||
24 | |||
25 | extern int s3c2443_baseclk_add(void); | ||
26 | |||
27 | extern void s3c2443_restart(char mode, const char *cmd); | ||
28 | |||
29 | extern void s3c2443_init_irq(void); | ||
30 | #else | ||
31 | #define s3c2443_init_clocks NULL | ||
32 | #define s3c2443_init_uarts NULL | ||
33 | #define s3c2443_map_io NULL | ||
34 | #define s3c2443_init NULL | ||
35 | #define s3c2443_restart NULL | ||
36 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s3c244x.h b/arch/arm/plat-samsung/include/plat/s3c244x.h deleted file mode 100644 index ea0c961b7603..000000000000 --- a/arch/arm/plat-samsung/include/plat/s3c244x.h +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s3c244x.h | ||
2 | * | ||
3 | * Copyright (c) 2004-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * Header file for S3C2440 and S3C2442 cpu support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) | ||
14 | |||
15 | extern void s3c244x_map_io(void); | ||
16 | |||
17 | extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
18 | |||
19 | extern void s3c244x_init_clocks(int xtal); | ||
20 | |||
21 | #else | ||
22 | #define s3c244x_init_clocks NULL | ||
23 | #define s3c244x_init_uarts NULL | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_CPU_S3C2440 | ||
27 | extern int s3c2440_init(void); | ||
28 | |||
29 | extern void s3c2440_map_io(void); | ||
30 | #else | ||
31 | #define s3c2440_init NULL | ||
32 | #define s3c2440_map_io NULL | ||
33 | #endif | ||
34 | |||
35 | #ifdef CONFIG_CPU_S3C2442 | ||
36 | extern int s3c2442_init(void); | ||
37 | |||
38 | extern void s3c2442_map_io(void); | ||
39 | #else | ||
40 | #define s3c2442_init NULL | ||
41 | #define s3c2442_map_io NULL | ||
42 | #endif | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p-time.h b/arch/arm/plat-samsung/include/plat/s5p-time.h deleted file mode 100644 index 9c96f3586ce0..000000000000 --- a/arch/arm/plat-samsung/include/plat/s5p-time.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p-time.h | ||
2 | * | ||
3 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p time support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_PLAT_S5P_TIME_H | ||
14 | #define __ASM_PLAT_S5P_TIME_H __FILE__ | ||
15 | |||
16 | /* S5P HR-Timer Clock mode */ | ||
17 | enum s5p_timer_mode { | ||
18 | S5P_PWM0, | ||
19 | S5P_PWM1, | ||
20 | S5P_PWM2, | ||
21 | S5P_PWM3, | ||
22 | S5P_PWM4, | ||
23 | }; | ||
24 | |||
25 | struct s5p_timer_source { | ||
26 | unsigned int event_id; | ||
27 | unsigned int source_id; | ||
28 | }; | ||
29 | |||
30 | /* Be able to sleep for atleast 4 seconds (usually more) */ | ||
31 | #define S5PTIMER_MIN_RANGE 4 | ||
32 | |||
33 | #define TCNT_MAX 0xffffffff | ||
34 | #define NON_PERIODIC 0 | ||
35 | #define PERIODIC 1 | ||
36 | |||
37 | extern void __init s5p_set_timer_source(enum s5p_timer_mode event, | ||
38 | enum s5p_timer_mode source); | ||
39 | extern void s5p_timer_init(void); | ||
40 | #endif /* __ASM_PLAT_S5P_TIME_H */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/samsung-time.h b/arch/arm/plat-samsung/include/plat/samsung-time.h new file mode 100644 index 000000000000..4cc99bb1f176 --- /dev/null +++ b/arch/arm/plat-samsung/include/plat/samsung-time.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/samsung-time.h | ||
2 | * | ||
3 | * Copyright 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for samsung s3c and s5p time support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __ASM_PLAT_SAMSUNG_TIME_H | ||
14 | #define __ASM_PLAT_SAMSUNG_TIME_H __FILE__ | ||
15 | |||
16 | /* SAMSUNG HR-Timer Clock mode */ | ||
17 | enum samsung_timer_mode { | ||
18 | SAMSUNG_PWM0, | ||
19 | SAMSUNG_PWM1, | ||
20 | SAMSUNG_PWM2, | ||
21 | SAMSUNG_PWM3, | ||
22 | SAMSUNG_PWM4, | ||
23 | }; | ||
24 | |||
25 | struct samsung_timer_source { | ||
26 | unsigned int event_id; | ||
27 | unsigned int source_id; | ||
28 | }; | ||
29 | |||
30 | /* Be able to sleep for atleast 4 seconds (usually more) */ | ||
31 | #define SAMSUNG_TIMER_MIN_RANGE 4 | ||
32 | |||
33 | #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S5PC100) | ||
34 | #define TCNT_MAX 0xffff | ||
35 | #define TSCALER_DIV 25 | ||
36 | #define TDIV 50 | ||
37 | #define TSIZE 16 | ||
38 | #else | ||
39 | #define TCNT_MAX 0xffffffff | ||
40 | #define TSCALER_DIV 2 | ||
41 | #define TDIV 2 | ||
42 | #define TSIZE 32 | ||
43 | #endif | ||
44 | |||
45 | #define NON_PERIODIC 0 | ||
46 | #define PERIODIC 1 | ||
47 | |||
48 | extern void __init samsung_set_timer_source(enum samsung_timer_mode event, | ||
49 | enum samsung_timer_mode source); | ||
50 | |||
51 | extern void __init samsung_timer_init(void); | ||
52 | |||
53 | #endif /* __ASM_PLAT_SAMSUNG_TIME_H */ | ||
diff --git a/arch/arm/plat-samsung/s5p-time.c b/arch/arm/plat-samsung/samsung-time.c index e92510cf82ee..f899cbc9b288 100644 --- a/arch/arm/plat-samsung/s5p-time.c +++ b/arch/arm/plat-samsung/samsung-time.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | 2 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
3 | * http://www.samsung.com/ | 3 | * http://www.samsung.com/ |
4 | * | 4 | * |
5 | * S5P - Common hr-timer support | 5 | * samsung - Common hr-timer support (s3c and s5p) |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -25,41 +25,41 @@ | |||
25 | #include <mach/map.h> | 25 | #include <mach/map.h> |
26 | #include <plat/devs.h> | 26 | #include <plat/devs.h> |
27 | #include <plat/regs-timer.h> | 27 | #include <plat/regs-timer.h> |
28 | #include <plat/s5p-time.h> | 28 | #include <plat/samsung-time.h> |
29 | 29 | ||
30 | static struct clk *tin_event; | 30 | static struct clk *tin_event; |
31 | static struct clk *tin_source; | 31 | static struct clk *tin_source; |
32 | static struct clk *tdiv_event; | 32 | static struct clk *tdiv_event; |
33 | static struct clk *tdiv_source; | 33 | static struct clk *tdiv_source; |
34 | static struct clk *timerclk; | 34 | static struct clk *timerclk; |
35 | static struct s5p_timer_source timer_source; | 35 | static struct samsung_timer_source timer_source; |
36 | static unsigned long clock_count_per_tick; | 36 | static unsigned long clock_count_per_tick; |
37 | static void s5p_timer_resume(void); | 37 | static void samsung_timer_resume(void); |
38 | 38 | ||
39 | static void s5p_time_stop(enum s5p_timer_mode mode) | 39 | static void samsung_time_stop(enum samsung_timer_mode mode) |
40 | { | 40 | { |
41 | unsigned long tcon; | 41 | unsigned long tcon; |
42 | 42 | ||
43 | tcon = __raw_readl(S3C2410_TCON); | 43 | tcon = __raw_readl(S3C2410_TCON); |
44 | 44 | ||
45 | switch (mode) { | 45 | switch (mode) { |
46 | case S5P_PWM0: | 46 | case SAMSUNG_PWM0: |
47 | tcon &= ~S3C2410_TCON_T0START; | 47 | tcon &= ~S3C2410_TCON_T0START; |
48 | break; | 48 | break; |
49 | 49 | ||
50 | case S5P_PWM1: | 50 | case SAMSUNG_PWM1: |
51 | tcon &= ~S3C2410_TCON_T1START; | 51 | tcon &= ~S3C2410_TCON_T1START; |
52 | break; | 52 | break; |
53 | 53 | ||
54 | case S5P_PWM2: | 54 | case SAMSUNG_PWM2: |
55 | tcon &= ~S3C2410_TCON_T2START; | 55 | tcon &= ~S3C2410_TCON_T2START; |
56 | break; | 56 | break; |
57 | 57 | ||
58 | case S5P_PWM3: | 58 | case SAMSUNG_PWM3: |
59 | tcon &= ~S3C2410_TCON_T3START; | 59 | tcon &= ~S3C2410_TCON_T3START; |
60 | break; | 60 | break; |
61 | 61 | ||
62 | case S5P_PWM4: | 62 | case SAMSUNG_PWM4: |
63 | tcon &= ~S3C2410_TCON_T4START; | 63 | tcon &= ~S3C2410_TCON_T4START; |
64 | break; | 64 | break; |
65 | 65 | ||
@@ -70,7 +70,7 @@ static void s5p_time_stop(enum s5p_timer_mode mode) | |||
70 | __raw_writel(tcon, S3C2410_TCON); | 70 | __raw_writel(tcon, S3C2410_TCON); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | 73 | static void samsung_time_setup(enum samsung_timer_mode mode, unsigned long tcnt) |
74 | { | 74 | { |
75 | unsigned long tcon; | 75 | unsigned long tcon; |
76 | 76 | ||
@@ -79,27 +79,27 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | |||
79 | tcnt--; | 79 | tcnt--; |
80 | 80 | ||
81 | switch (mode) { | 81 | switch (mode) { |
82 | case S5P_PWM0: | 82 | case SAMSUNG_PWM0: |
83 | tcon &= ~(0x0f << 0); | 83 | tcon &= ~(0x0f << 0); |
84 | tcon |= S3C2410_TCON_T0MANUALUPD; | 84 | tcon |= S3C2410_TCON_T0MANUALUPD; |
85 | break; | 85 | break; |
86 | 86 | ||
87 | case S5P_PWM1: | 87 | case SAMSUNG_PWM1: |
88 | tcon &= ~(0x0f << 8); | 88 | tcon &= ~(0x0f << 8); |
89 | tcon |= S3C2410_TCON_T1MANUALUPD; | 89 | tcon |= S3C2410_TCON_T1MANUALUPD; |
90 | break; | 90 | break; |
91 | 91 | ||
92 | case S5P_PWM2: | 92 | case SAMSUNG_PWM2: |
93 | tcon &= ~(0x0f << 12); | 93 | tcon &= ~(0x0f << 12); |
94 | tcon |= S3C2410_TCON_T2MANUALUPD; | 94 | tcon |= S3C2410_TCON_T2MANUALUPD; |
95 | break; | 95 | break; |
96 | 96 | ||
97 | case S5P_PWM3: | 97 | case SAMSUNG_PWM3: |
98 | tcon &= ~(0x0f << 16); | 98 | tcon &= ~(0x0f << 16); |
99 | tcon |= S3C2410_TCON_T3MANUALUPD; | 99 | tcon |= S3C2410_TCON_T3MANUALUPD; |
100 | break; | 100 | break; |
101 | 101 | ||
102 | case S5P_PWM4: | 102 | case SAMSUNG_PWM4: |
103 | tcon &= ~(0x07 << 20); | 103 | tcon &= ~(0x07 << 20); |
104 | tcon |= S3C2410_TCON_T4MANUALUPD; | 104 | tcon |= S3C2410_TCON_T4MANUALUPD; |
105 | break; | 105 | break; |
@@ -114,14 +114,14 @@ static void s5p_time_setup(enum s5p_timer_mode mode, unsigned long tcnt) | |||
114 | __raw_writel(tcon, S3C2410_TCON); | 114 | __raw_writel(tcon, S3C2410_TCON); |
115 | } | 115 | } |
116 | 116 | ||
117 | static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | 117 | static void samsung_time_start(enum samsung_timer_mode mode, bool periodic) |
118 | { | 118 | { |
119 | unsigned long tcon; | 119 | unsigned long tcon; |
120 | 120 | ||
121 | tcon = __raw_readl(S3C2410_TCON); | 121 | tcon = __raw_readl(S3C2410_TCON); |
122 | 122 | ||
123 | switch (mode) { | 123 | switch (mode) { |
124 | case S5P_PWM0: | 124 | case SAMSUNG_PWM0: |
125 | tcon |= S3C2410_TCON_T0START; | 125 | tcon |= S3C2410_TCON_T0START; |
126 | tcon &= ~S3C2410_TCON_T0MANUALUPD; | 126 | tcon &= ~S3C2410_TCON_T0MANUALUPD; |
127 | 127 | ||
@@ -131,7 +131,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
131 | tcon &= ~S3C2410_TCON_T0RELOAD; | 131 | tcon &= ~S3C2410_TCON_T0RELOAD; |
132 | break; | 132 | break; |
133 | 133 | ||
134 | case S5P_PWM1: | 134 | case SAMSUNG_PWM1: |
135 | tcon |= S3C2410_TCON_T1START; | 135 | tcon |= S3C2410_TCON_T1START; |
136 | tcon &= ~S3C2410_TCON_T1MANUALUPD; | 136 | tcon &= ~S3C2410_TCON_T1MANUALUPD; |
137 | 137 | ||
@@ -141,7 +141,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
141 | tcon &= ~S3C2410_TCON_T1RELOAD; | 141 | tcon &= ~S3C2410_TCON_T1RELOAD; |
142 | break; | 142 | break; |
143 | 143 | ||
144 | case S5P_PWM2: | 144 | case SAMSUNG_PWM2: |
145 | tcon |= S3C2410_TCON_T2START; | 145 | tcon |= S3C2410_TCON_T2START; |
146 | tcon &= ~S3C2410_TCON_T2MANUALUPD; | 146 | tcon &= ~S3C2410_TCON_T2MANUALUPD; |
147 | 147 | ||
@@ -151,7 +151,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
151 | tcon &= ~S3C2410_TCON_T2RELOAD; | 151 | tcon &= ~S3C2410_TCON_T2RELOAD; |
152 | break; | 152 | break; |
153 | 153 | ||
154 | case S5P_PWM3: | 154 | case SAMSUNG_PWM3: |
155 | tcon |= S3C2410_TCON_T3START; | 155 | tcon |= S3C2410_TCON_T3START; |
156 | tcon &= ~S3C2410_TCON_T3MANUALUPD; | 156 | tcon &= ~S3C2410_TCON_T3MANUALUPD; |
157 | 157 | ||
@@ -161,7 +161,7 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
161 | tcon &= ~S3C2410_TCON_T3RELOAD; | 161 | tcon &= ~S3C2410_TCON_T3RELOAD; |
162 | break; | 162 | break; |
163 | 163 | ||
164 | case S5P_PWM4: | 164 | case SAMSUNG_PWM4: |
165 | tcon |= S3C2410_TCON_T4START; | 165 | tcon |= S3C2410_TCON_T4START; |
166 | tcon &= ~S3C2410_TCON_T4MANUALUPD; | 166 | tcon &= ~S3C2410_TCON_T4MANUALUPD; |
167 | 167 | ||
@@ -178,24 +178,24 @@ static void s5p_time_start(enum s5p_timer_mode mode, bool periodic) | |||
178 | __raw_writel(tcon, S3C2410_TCON); | 178 | __raw_writel(tcon, S3C2410_TCON); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int s5p_set_next_event(unsigned long cycles, | 181 | static int samsung_set_next_event(unsigned long cycles, |
182 | struct clock_event_device *evt) | 182 | struct clock_event_device *evt) |
183 | { | 183 | { |
184 | s5p_time_setup(timer_source.event_id, cycles); | 184 | samsung_time_setup(timer_source.event_id, cycles); |
185 | s5p_time_start(timer_source.event_id, NON_PERIODIC); | 185 | samsung_time_start(timer_source.event_id, NON_PERIODIC); |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static void s5p_set_mode(enum clock_event_mode mode, | 190 | static void samsung_set_mode(enum clock_event_mode mode, |
191 | struct clock_event_device *evt) | 191 | struct clock_event_device *evt) |
192 | { | 192 | { |
193 | s5p_time_stop(timer_source.event_id); | 193 | samsung_time_stop(timer_source.event_id); |
194 | 194 | ||
195 | switch (mode) { | 195 | switch (mode) { |
196 | case CLOCK_EVT_MODE_PERIODIC: | 196 | case CLOCK_EVT_MODE_PERIODIC: |
197 | s5p_time_setup(timer_source.event_id, clock_count_per_tick); | 197 | samsung_time_setup(timer_source.event_id, clock_count_per_tick); |
198 | s5p_time_start(timer_source.event_id, PERIODIC); | 198 | samsung_time_start(timer_source.event_id, PERIODIC); |
199 | break; | 199 | break; |
200 | 200 | ||
201 | case CLOCK_EVT_MODE_ONESHOT: | 201 | case CLOCK_EVT_MODE_ONESHOT: |
@@ -206,24 +206,24 @@ static void s5p_set_mode(enum clock_event_mode mode, | |||
206 | break; | 206 | break; |
207 | 207 | ||
208 | case CLOCK_EVT_MODE_RESUME: | 208 | case CLOCK_EVT_MODE_RESUME: |
209 | s5p_timer_resume(); | 209 | samsung_timer_resume(); |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | static void s5p_timer_resume(void) | 214 | static void samsung_timer_resume(void) |
215 | { | 215 | { |
216 | /* event timer restart */ | 216 | /* event timer restart */ |
217 | s5p_time_setup(timer_source.event_id, clock_count_per_tick); | 217 | samsung_time_setup(timer_source.event_id, clock_count_per_tick); |
218 | s5p_time_start(timer_source.event_id, PERIODIC); | 218 | samsung_time_start(timer_source.event_id, PERIODIC); |
219 | 219 | ||
220 | /* source timer restart */ | 220 | /* source timer restart */ |
221 | s5p_time_setup(timer_source.source_id, TCNT_MAX); | 221 | samsung_time_setup(timer_source.source_id, TCNT_MAX); |
222 | s5p_time_start(timer_source.source_id, PERIODIC); | 222 | samsung_time_start(timer_source.source_id, PERIODIC); |
223 | } | 223 | } |
224 | 224 | ||
225 | void __init s5p_set_timer_source(enum s5p_timer_mode event, | 225 | void __init samsung_set_timer_source(enum samsung_timer_mode event, |
226 | enum s5p_timer_mode source) | 226 | enum samsung_timer_mode source) |
227 | { | 227 | { |
228 | s3c_device_timer[event].dev.bus = &platform_bus_type; | 228 | s3c_device_timer[event].dev.bus = &platform_bus_type; |
229 | s3c_device_timer[source].dev.bus = &platform_bus_type; | 229 | s3c_device_timer[source].dev.bus = &platform_bus_type; |
@@ -233,14 +233,14 @@ void __init s5p_set_timer_source(enum s5p_timer_mode event, | |||
233 | } | 233 | } |
234 | 234 | ||
235 | static struct clock_event_device time_event_device = { | 235 | static struct clock_event_device time_event_device = { |
236 | .name = "s5p_event_timer", | 236 | .name = "samsung_event_timer", |
237 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 237 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
238 | .rating = 200, | 238 | .rating = 200, |
239 | .set_next_event = s5p_set_next_event, | 239 | .set_next_event = samsung_set_next_event, |
240 | .set_mode = s5p_set_mode, | 240 | .set_mode = samsung_set_mode, |
241 | }; | 241 | }; |
242 | 242 | ||
243 | static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) | 243 | static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id) |
244 | { | 244 | { |
245 | struct clock_event_device *evt = dev_id; | 245 | struct clock_event_device *evt = dev_id; |
246 | 246 | ||
@@ -249,14 +249,14 @@ static irqreturn_t s5p_clock_event_isr(int irq, void *dev_id) | |||
249 | return IRQ_HANDLED; | 249 | return IRQ_HANDLED; |
250 | } | 250 | } |
251 | 251 | ||
252 | static struct irqaction s5p_clock_event_irq = { | 252 | static struct irqaction samsung_clock_event_irq = { |
253 | .name = "s5p_time_irq", | 253 | .name = "samsung_time_irq", |
254 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 254 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
255 | .handler = s5p_clock_event_isr, | 255 | .handler = samsung_clock_event_isr, |
256 | .dev_id = &time_event_device, | 256 | .dev_id = &time_event_device, |
257 | }; | 257 | }; |
258 | 258 | ||
259 | static void __init s5p_clockevent_init(void) | 259 | static void __init samsung_clockevent_init(void) |
260 | { | 260 | { |
261 | unsigned long pclk; | 261 | unsigned long pclk; |
262 | unsigned long clock_rate; | 262 | unsigned long clock_rate; |
@@ -267,8 +267,8 @@ static void __init s5p_clockevent_init(void) | |||
267 | 267 | ||
268 | tscaler = clk_get_parent(tdiv_event); | 268 | tscaler = clk_get_parent(tdiv_event); |
269 | 269 | ||
270 | clk_set_rate(tscaler, pclk / 2); | 270 | clk_set_rate(tscaler, pclk / TSCALER_DIV); |
271 | clk_set_rate(tdiv_event, pclk / 2); | 271 | clk_set_rate(tdiv_event, pclk / TDIV); |
272 | clk_set_parent(tin_event, tdiv_event); | 272 | clk_set_parent(tin_event, tdiv_event); |
273 | 273 | ||
274 | clock_rate = clk_get_rate(tin_event); | 274 | clock_rate = clk_get_rate(tin_event); |
@@ -278,22 +278,22 @@ static void __init s5p_clockevent_init(void) | |||
278 | clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); | 278 | clockevents_config_and_register(&time_event_device, clock_rate, 1, -1); |
279 | 279 | ||
280 | irq_number = timer_source.event_id + IRQ_TIMER0; | 280 | irq_number = timer_source.event_id + IRQ_TIMER0; |
281 | setup_irq(irq_number, &s5p_clock_event_irq); | 281 | setup_irq(irq_number, &samsung_clock_event_irq); |
282 | } | 282 | } |
283 | 283 | ||
284 | static void __iomem *s5p_timer_reg(void) | 284 | static void __iomem *samsung_timer_reg(void) |
285 | { | 285 | { |
286 | unsigned long offset = 0; | 286 | unsigned long offset = 0; |
287 | 287 | ||
288 | switch (timer_source.source_id) { | 288 | switch (timer_source.source_id) { |
289 | case S5P_PWM0: | 289 | case SAMSUNG_PWM0: |
290 | case S5P_PWM1: | 290 | case SAMSUNG_PWM1: |
291 | case S5P_PWM2: | 291 | case SAMSUNG_PWM2: |
292 | case S5P_PWM3: | 292 | case SAMSUNG_PWM3: |
293 | offset = (timer_source.source_id * 0x0c) + 0x14; | 293 | offset = (timer_source.source_id * 0x0c) + 0x14; |
294 | break; | 294 | break; |
295 | 295 | ||
296 | case S5P_PWM4: | 296 | case SAMSUNG_PWM4: |
297 | offset = 0x40; | 297 | offset = 0x40; |
298 | break; | 298 | break; |
299 | 299 | ||
@@ -312,9 +312,9 @@ static void __iomem *s5p_timer_reg(void) | |||
312 | * this wraps around for now, since it is just a relative time | 312 | * this wraps around for now, since it is just a relative time |
313 | * stamp. (Inspired by U300 implementation.) | 313 | * stamp. (Inspired by U300 implementation.) |
314 | */ | 314 | */ |
315 | static u32 notrace s5p_read_sched_clock(void) | 315 | static u32 notrace samsung_read_sched_clock(void) |
316 | { | 316 | { |
317 | void __iomem *reg = s5p_timer_reg(); | 317 | void __iomem *reg = samsung_timer_reg(); |
318 | 318 | ||
319 | if (!reg) | 319 | if (!reg) |
320 | return 0; | 320 | return 0; |
@@ -322,29 +322,29 @@ static u32 notrace s5p_read_sched_clock(void) | |||
322 | return ~__raw_readl(reg); | 322 | return ~__raw_readl(reg); |
323 | } | 323 | } |
324 | 324 | ||
325 | static void __init s5p_clocksource_init(void) | 325 | static void __init samsung_clocksource_init(void) |
326 | { | 326 | { |
327 | unsigned long pclk; | 327 | unsigned long pclk; |
328 | unsigned long clock_rate; | 328 | unsigned long clock_rate; |
329 | 329 | ||
330 | pclk = clk_get_rate(timerclk); | 330 | pclk = clk_get_rate(timerclk); |
331 | 331 | ||
332 | clk_set_rate(tdiv_source, pclk / 2); | 332 | clk_set_rate(tdiv_source, pclk / TDIV); |
333 | clk_set_parent(tin_source, tdiv_source); | 333 | clk_set_parent(tin_source, tdiv_source); |
334 | 334 | ||
335 | clock_rate = clk_get_rate(tin_source); | 335 | clock_rate = clk_get_rate(tin_source); |
336 | 336 | ||
337 | s5p_time_setup(timer_source.source_id, TCNT_MAX); | 337 | samsung_time_setup(timer_source.source_id, TCNT_MAX); |
338 | s5p_time_start(timer_source.source_id, PERIODIC); | 338 | samsung_time_start(timer_source.source_id, PERIODIC); |
339 | 339 | ||
340 | setup_sched_clock(s5p_read_sched_clock, 32, clock_rate); | 340 | setup_sched_clock(samsung_read_sched_clock, TSIZE, clock_rate); |
341 | 341 | ||
342 | if (clocksource_mmio_init(s5p_timer_reg(), "s5p_clocksource_timer", | 342 | if (clocksource_mmio_init(samsung_timer_reg(), "samsung_clocksource_timer", |
343 | clock_rate, 250, 32, clocksource_mmio_readl_down)) | 343 | clock_rate, 250, TSIZE, clocksource_mmio_readl_down)) |
344 | panic("s5p_clocksource_timer: can't register clocksource\n"); | 344 | panic("samsung_clocksource_timer: can't register clocksource\n"); |
345 | } | 345 | } |
346 | 346 | ||
347 | static void __init s5p_timer_resources(void) | 347 | static void __init samsung_timer_resources(void) |
348 | { | 348 | { |
349 | 349 | ||
350 | unsigned long event_id = timer_source.event_id; | 350 | unsigned long event_id = timer_source.event_id; |
@@ -386,9 +386,9 @@ static void __init s5p_timer_resources(void) | |||
386 | clk_enable(tin_source); | 386 | clk_enable(tin_source); |
387 | } | 387 | } |
388 | 388 | ||
389 | void __init s5p_timer_init(void) | 389 | void __init samsung_timer_init(void) |
390 | { | 390 | { |
391 | s5p_timer_resources(); | 391 | samsung_timer_resources(); |
392 | s5p_clockevent_init(); | 392 | samsung_clockevent_init(); |
393 | s5p_clocksource_init(); | 393 | samsung_clocksource_init(); |
394 | } | 394 | } |
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c deleted file mode 100644 index 73defd00c3e4..000000000000 --- a/arch/arm/plat-samsung/time.c +++ /dev/null | |||
@@ -1,287 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/time.c | ||
2 | * | ||
3 | * Copyright (C) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks, <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/err.h> | ||
27 | #include <linux/clk.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | #include <linux/syscore_ops.h> | ||
31 | |||
32 | #include <asm/mach-types.h> | ||
33 | |||
34 | #include <asm/irq.h> | ||
35 | #include <mach/map.h> | ||
36 | #include <plat/regs-timer.h> | ||
37 | #include <mach/regs-irq.h> | ||
38 | #include <asm/mach/time.h> | ||
39 | #include <mach/tick.h> | ||
40 | |||
41 | #include <plat/clock.h> | ||
42 | #include <plat/cpu.h> | ||
43 | |||
44 | static unsigned long timer_startval; | ||
45 | static unsigned long timer_usec_ticks; | ||
46 | |||
47 | #ifndef TICK_MAX | ||
48 | #define TICK_MAX (0xffff) | ||
49 | #endif | ||
50 | |||
51 | #define TIMER_USEC_SHIFT 16 | ||
52 | |||
53 | /* we use the shifted arithmetic to work out the ratio of timer ticks | ||
54 | * to usecs, as often the peripheral clock is not a nice even multiple | ||
55 | * of 1MHz. | ||
56 | * | ||
57 | * shift of 14 and 15 are too low for the 12MHz, 16 seems to be ok | ||
58 | * for the current HZ value of 200 without producing overflows. | ||
59 | * | ||
60 | * Original patch by Dimitry Andric, updated by Ben Dooks | ||
61 | */ | ||
62 | |||
63 | |||
64 | /* timer_mask_usec_ticks | ||
65 | * | ||
66 | * given a clock and divisor, make the value to pass into timer_ticks_to_usec | ||
67 | * to scale the ticks into usecs | ||
68 | */ | ||
69 | |||
70 | static inline unsigned long | ||
71 | timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk) | ||
72 | { | ||
73 | unsigned long den = pclk / 1000; | ||
74 | |||
75 | return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den; | ||
76 | } | ||
77 | |||
78 | /* timer_ticks_to_usec | ||
79 | * | ||
80 | * convert timer ticks to usec. | ||
81 | */ | ||
82 | |||
83 | static inline unsigned long timer_ticks_to_usec(unsigned long ticks) | ||
84 | { | ||
85 | unsigned long res; | ||
86 | |||
87 | res = ticks * timer_usec_ticks; | ||
88 | res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */ | ||
89 | |||
90 | return res >> TIMER_USEC_SHIFT; | ||
91 | } | ||
92 | |||
93 | /*** | ||
94 | * Returns microsecond since last clock interrupt. Note that interrupts | ||
95 | * will have been disabled by do_gettimeoffset() | ||
96 | * IRQs are disabled before entering here from do_gettimeofday() | ||
97 | */ | ||
98 | |||
99 | static u32 s3c2410_gettimeoffset(void) | ||
100 | { | ||
101 | unsigned long tdone; | ||
102 | unsigned long tval; | ||
103 | |||
104 | /* work out how many ticks have gone since last timer interrupt */ | ||
105 | |||
106 | tval = __raw_readl(S3C2410_TCNTO(4)); | ||
107 | tdone = timer_startval - tval; | ||
108 | |||
109 | /* check to see if there is an interrupt pending */ | ||
110 | |||
111 | if (s3c24xx_ostimer_pending()) { | ||
112 | /* re-read the timer, and try and fix up for the missed | ||
113 | * interrupt. Note, the interrupt may go off before the | ||
114 | * timer has re-loaded from wrapping. | ||
115 | */ | ||
116 | |||
117 | tval = __raw_readl(S3C2410_TCNTO(4)); | ||
118 | tdone = timer_startval - tval; | ||
119 | |||
120 | if (tval != 0) | ||
121 | tdone += timer_startval; | ||
122 | } | ||
123 | |||
124 | return timer_ticks_to_usec(tdone) * 1000; | ||
125 | } | ||
126 | |||
127 | |||
128 | /* | ||
129 | * IRQ handler for the timer | ||
130 | */ | ||
131 | static irqreturn_t | ||
132 | s3c2410_timer_interrupt(int irq, void *dev_id) | ||
133 | { | ||
134 | timer_tick(); | ||
135 | return IRQ_HANDLED; | ||
136 | } | ||
137 | |||
138 | static struct irqaction s3c2410_timer_irq = { | ||
139 | .name = "S3C2410 Timer Tick", | ||
140 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | ||
141 | .handler = s3c2410_timer_interrupt, | ||
142 | }; | ||
143 | |||
144 | #define use_tclk1_12() ( \ | ||
145 | machine_is_bast() || \ | ||
146 | machine_is_vr1000() || \ | ||
147 | machine_is_anubis() || \ | ||
148 | machine_is_osiris()) | ||
149 | |||
150 | static struct clk *tin; | ||
151 | static struct clk *tdiv; | ||
152 | static struct clk *timerclk; | ||
153 | |||
154 | /* | ||
155 | * Set up timer interrupt, and return the current time in seconds. | ||
156 | * | ||
157 | * Currently we only use timer4, as it is the only timer which has no | ||
158 | * other function that can be exploited externally | ||
159 | */ | ||
160 | static void s3c2410_timer_setup (void) | ||
161 | { | ||
162 | unsigned long tcon; | ||
163 | unsigned long tcnt; | ||
164 | unsigned long tcfg1; | ||
165 | unsigned long tcfg0; | ||
166 | |||
167 | tcnt = TICK_MAX; /* default value for tcnt */ | ||
168 | |||
169 | /* configure the system for whichever machine is in use */ | ||
170 | |||
171 | if (use_tclk1_12()) { | ||
172 | /* timer is at 12MHz, scaler is 1 */ | ||
173 | timer_usec_ticks = timer_mask_usec_ticks(1, 12000000); | ||
174 | tcnt = 12000000 / HZ; | ||
175 | |||
176 | tcfg1 = __raw_readl(S3C2410_TCFG1); | ||
177 | tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK; | ||
178 | tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1; | ||
179 | __raw_writel(tcfg1, S3C2410_TCFG1); | ||
180 | } else { | ||
181 | unsigned long pclk; | ||
182 | struct clk *tscaler; | ||
183 | |||
184 | /* for the h1940 (and others), we use the pclk from the core | ||
185 | * to generate the timer values. since values around 50 to | ||
186 | * 70MHz are not values we can directly generate the timer | ||
187 | * value from, we need to pre-scale and divide before using it. | ||
188 | * | ||
189 | * for instance, using 50.7MHz and dividing by 6 gives 8.45MHz | ||
190 | * (8.45 ticks per usec) | ||
191 | */ | ||
192 | |||
193 | pclk = clk_get_rate(timerclk); | ||
194 | |||
195 | /* configure clock tick */ | ||
196 | |||
197 | timer_usec_ticks = timer_mask_usec_ticks(6, pclk); | ||
198 | |||
199 | tscaler = clk_get_parent(tdiv); | ||
200 | |||
201 | clk_set_rate(tscaler, pclk / 3); | ||
202 | clk_set_rate(tdiv, pclk / 6); | ||
203 | clk_set_parent(tin, tdiv); | ||
204 | |||
205 | tcnt = clk_get_rate(tin) / HZ; | ||
206 | } | ||
207 | |||
208 | tcon = __raw_readl(S3C2410_TCON); | ||
209 | tcfg0 = __raw_readl(S3C2410_TCFG0); | ||
210 | tcfg1 = __raw_readl(S3C2410_TCFG1); | ||
211 | |||
212 | /* timers reload after counting zero, so reduce the count by 1 */ | ||
213 | |||
214 | tcnt--; | ||
215 | |||
216 | printk(KERN_DEBUG "timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n", | ||
217 | tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks); | ||
218 | |||
219 | /* check to see if timer is within 16bit range... */ | ||
220 | if (tcnt > TICK_MAX) { | ||
221 | panic("setup_timer: HZ is too small, cannot configure timer!"); | ||
222 | return; | ||
223 | } | ||
224 | |||
225 | __raw_writel(tcfg1, S3C2410_TCFG1); | ||
226 | __raw_writel(tcfg0, S3C2410_TCFG0); | ||
227 | |||
228 | timer_startval = tcnt; | ||
229 | __raw_writel(tcnt, S3C2410_TCNTB(4)); | ||
230 | |||
231 | /* ensure timer is stopped... */ | ||
232 | |||
233 | tcon &= ~(7<<20); | ||
234 | tcon |= S3C2410_TCON_T4RELOAD; | ||
235 | tcon |= S3C2410_TCON_T4MANUALUPD; | ||
236 | |||
237 | __raw_writel(tcon, S3C2410_TCON); | ||
238 | __raw_writel(tcnt, S3C2410_TCNTB(4)); | ||
239 | __raw_writel(tcnt, S3C2410_TCMPB(4)); | ||
240 | |||
241 | /* start the timer running */ | ||
242 | tcon |= S3C2410_TCON_T4START; | ||
243 | tcon &= ~S3C2410_TCON_T4MANUALUPD; | ||
244 | __raw_writel(tcon, S3C2410_TCON); | ||
245 | } | ||
246 | |||
247 | static void __init s3c2410_timer_resources(void) | ||
248 | { | ||
249 | struct platform_device tmpdev; | ||
250 | |||
251 | tmpdev.dev.bus = &platform_bus_type; | ||
252 | tmpdev.id = 4; | ||
253 | |||
254 | timerclk = clk_get(NULL, "timers"); | ||
255 | if (IS_ERR(timerclk)) | ||
256 | panic("failed to get clock for system timer"); | ||
257 | |||
258 | clk_enable(timerclk); | ||
259 | |||
260 | if (!use_tclk1_12()) { | ||
261 | tmpdev.id = 4; | ||
262 | tmpdev.dev.init_name = "s3c24xx-pwm.4"; | ||
263 | tin = clk_get(&tmpdev.dev, "pwm-tin"); | ||
264 | if (IS_ERR(tin)) | ||
265 | panic("failed to get pwm-tin clock for system timer"); | ||
266 | |||
267 | tdiv = clk_get(&tmpdev.dev, "pwm-tdiv"); | ||
268 | if (IS_ERR(tdiv)) | ||
269 | panic("failed to get pwm-tdiv clock for system timer"); | ||
270 | } | ||
271 | |||
272 | clk_enable(tin); | ||
273 | } | ||
274 | |||
275 | static struct syscore_ops s3c24xx_syscore_ops = { | ||
276 | .resume = s3c2410_timer_setup, | ||
277 | }; | ||
278 | |||
279 | void __init s3c24xx_timer_init(void) | ||
280 | { | ||
281 | arch_gettimeoffset = s3c2410_gettimeoffset; | ||
282 | |||
283 | s3c2410_timer_resources(); | ||
284 | s3c2410_timer_setup(); | ||
285 | setup_irq(IRQ_TIMER4, &s3c2410_timer_irq); | ||
286 | register_syscore_ops(&s3c24xx_syscore_ops); | ||
287 | } | ||
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h index 91e2a6a6fcd4..bf6ab242f047 100644 --- a/arch/arm64/include/asm/arch_timer.h +++ b/arch/arm64/include/asm/arch_timer.h | |||
@@ -130,4 +130,9 @@ static inline u64 arch_counter_get_cntvct(void) | |||
130 | return cval; | 130 | return cval; |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline int arch_timer_arch_init(void) | ||
134 | { | ||
135 | return 0; | ||
136 | } | ||
137 | |||
133 | #endif | 138 | #endif |
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c index b0ef18d14c3b..a551f88ae2c1 100644 --- a/arch/arm64/kernel/time.c +++ b/arch/arm64/kernel/time.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/irq.h> | 33 | #include <linux/irq.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/clocksource.h> | ||
35 | 36 | ||
36 | #include <clocksource/arm_arch_timer.h> | 37 | #include <clocksource/arm_arch_timer.h> |
37 | 38 | ||
@@ -77,10 +78,11 @@ void __init time_init(void) | |||
77 | { | 78 | { |
78 | u32 arch_timer_rate; | 79 | u32 arch_timer_rate; |
79 | 80 | ||
80 | if (arch_timer_init()) | 81 | clocksource_of_init(); |
81 | panic("Unable to initialise architected timer.\n"); | ||
82 | 82 | ||
83 | arch_timer_rate = arch_timer_get_rate(); | 83 | arch_timer_rate = arch_timer_get_rate(); |
84 | if (!arch_timer_rate) | ||
85 | panic("Unable to initialise architected timer.\n"); | ||
84 | 86 | ||
85 | /* Cache the sched_clock multiplier to save a divide in the hot path. */ | 87 | /* Cache the sched_clock multiplier to save a divide in the hot path. */ |
86 | sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; | 88 | sched_clock_mult = NSEC_PER_SEC / arch_timer_rate; |
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index b323d8d3185b..7c2f6685bf43 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1453,7 +1453,7 @@ static struct resource atmel_lcdfb0_resource[] = { | |||
1453 | }, | 1453 | }, |
1454 | }; | 1454 | }; |
1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); | 1455 | DEFINE_DEV_DATA(atmel_lcdfb, 0); |
1456 | DEV_CLK(hck1, atmel_lcdfb0, hsb, 7); | 1456 | DEV_CLK(hclk, atmel_lcdfb0, hsb, 7); |
1457 | static struct clk atmel_lcdfb0_pixclk = { | 1457 | static struct clk atmel_lcdfb0_pixclk = { |
1458 | .name = "lcdc_clk", | 1458 | .name = "lcdc_clk", |
1459 | .dev = &atmel_lcdfb0_device.dev, | 1459 | .dev = &atmel_lcdfb0_device.dev, |
@@ -1530,6 +1530,8 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data, | |||
1530 | memcpy(info, data, sizeof(struct atmel_lcdfb_info)); | 1530 | memcpy(info, data, sizeof(struct atmel_lcdfb_info)); |
1531 | info->default_monspecs = monspecs; | 1531 | info->default_monspecs = monspecs; |
1532 | 1532 | ||
1533 | pdev->name = "at32ap-lcdfb"; | ||
1534 | |||
1533 | platform_device_register(pdev); | 1535 | platform_device_register(pdev); |
1534 | return pdev; | 1536 | return pdev; |
1535 | 1537 | ||
@@ -2246,7 +2248,7 @@ static __initdata struct clk *init_clocks[] = { | |||
2246 | &atmel_twi0_pclk, | 2248 | &atmel_twi0_pclk, |
2247 | &atmel_mci0_pclk, | 2249 | &atmel_mci0_pclk, |
2248 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) | 2250 | #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) |
2249 | &atmel_lcdfb0_hck1, | 2251 | &atmel_lcdfb0_hclk, |
2250 | &atmel_lcdfb0_pixclk, | 2252 | &atmel_lcdfb0_pixclk, |
2251 | #endif | 2253 | #endif |
2252 | &ssc0_pclk, | 2254 | &ssc0_pclk, |
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index a47e6ee98b8c..a64caefdba12 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig | |||
@@ -63,6 +63,14 @@ config CLK_TWL6040 | |||
63 | McPDM. McPDM module is using the external bit clock on the McPDM bus | 63 | McPDM. McPDM module is using the external bit clock on the McPDM bus |
64 | as functional clock. | 64 | as functional clock. |
65 | 65 | ||
66 | config COMMON_CLK_AXI_CLKGEN | ||
67 | tristate "AXI clkgen driver" | ||
68 | depends on ARCH_ZYNQ || MICROBLAZE | ||
69 | help | ||
70 | ---help--- | ||
71 | Support for the Analog Devices axi-clkgen pcore clock generator for Xilinx | ||
72 | FPGAs. It is commonly used in Analog Devices' reference designs. | ||
73 | |||
66 | endmenu | 74 | endmenu |
67 | 75 | ||
68 | source "drivers/clk/mvebu/Kconfig" | 76 | source "drivers/clk/mvebu/Kconfig" |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 300d4775d926..79e98e416724 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_COMMON_CLK) += clk-fixed-factor.o | |||
7 | obj-$(CONFIG_COMMON_CLK) += clk-fixed-rate.o | 7 | obj-$(CONFIG_COMMON_CLK) += clk-fixed-rate.o |
8 | obj-$(CONFIG_COMMON_CLK) += clk-gate.o | 8 | obj-$(CONFIG_COMMON_CLK) += clk-gate.o |
9 | obj-$(CONFIG_COMMON_CLK) += clk-mux.o | 9 | obj-$(CONFIG_COMMON_CLK) += clk-mux.o |
10 | obj-$(CONFIG_COMMON_CLK) += clk-composite.o | ||
10 | 11 | ||
11 | # SoCs specific | 12 | # SoCs specific |
12 | obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o | 13 | obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o |
@@ -23,6 +24,7 @@ ifeq ($(CONFIG_COMMON_CLK), y) | |||
23 | obj-$(CONFIG_ARCH_MMP) += mmp/ | 24 | obj-$(CONFIG_ARCH_MMP) += mmp/ |
24 | endif | 25 | endif |
25 | obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o | 26 | obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o |
27 | obj-$(CONFIG_ARCH_SUNXI) += sunxi/ | ||
26 | obj-$(CONFIG_ARCH_U8500) += ux500/ | 28 | obj-$(CONFIG_ARCH_U8500) += ux500/ |
27 | obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o | 29 | obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o |
28 | obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o | 30 | obj-$(CONFIG_ARCH_ZYNQ) += clk-zynq.o |
@@ -31,6 +33,7 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/ | |||
31 | obj-$(CONFIG_X86) += x86/ | 33 | obj-$(CONFIG_X86) += x86/ |
32 | 34 | ||
33 | # Chip specific | 35 | # Chip specific |
36 | obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o | ||
34 | obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o | 37 | obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o |
35 | obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o | 38 | obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o |
36 | obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o | 39 | obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o |
diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c new file mode 100644 index 000000000000..8137327847c3 --- /dev/null +++ b/drivers/clk/clk-axi-clkgen.c | |||
@@ -0,0 +1,331 @@ | |||
1 | /* | ||
2 | * AXI clkgen driver | ||
3 | * | ||
4 | * Copyright 2012-2013 Analog Devices Inc. | ||
5 | * Author: Lars-Peter Clausen <lars@metafoo.de> | ||
6 | * | ||
7 | * Licensed under the GPL-2. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/clk-provider.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/slab.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/err.h> | ||
19 | |||
20 | #define AXI_CLKGEN_REG_UPDATE_ENABLE 0x04 | ||
21 | #define AXI_CLKGEN_REG_CLK_OUT1 0x08 | ||
22 | #define AXI_CLKGEN_REG_CLK_OUT2 0x0c | ||
23 | #define AXI_CLKGEN_REG_CLK_DIV 0x10 | ||
24 | #define AXI_CLKGEN_REG_CLK_FB1 0x14 | ||
25 | #define AXI_CLKGEN_REG_CLK_FB2 0x18 | ||
26 | #define AXI_CLKGEN_REG_LOCK1 0x1c | ||
27 | #define AXI_CLKGEN_REG_LOCK2 0x20 | ||
28 | #define AXI_CLKGEN_REG_LOCK3 0x24 | ||
29 | #define AXI_CLKGEN_REG_FILTER1 0x28 | ||
30 | #define AXI_CLKGEN_REG_FILTER2 0x2c | ||
31 | |||
32 | struct axi_clkgen { | ||
33 | void __iomem *base; | ||
34 | struct clk_hw clk_hw; | ||
35 | }; | ||
36 | |||
37 | static uint32_t axi_clkgen_lookup_filter(unsigned int m) | ||
38 | { | ||
39 | switch (m) { | ||
40 | case 0: | ||
41 | return 0x01001990; | ||
42 | case 1: | ||
43 | return 0x01001190; | ||
44 | case 2: | ||
45 | return 0x01009890; | ||
46 | case 3: | ||
47 | return 0x01001890; | ||
48 | case 4: | ||
49 | return 0x01008890; | ||
50 | case 5 ... 8: | ||
51 | return 0x01009090; | ||
52 | case 9 ... 11: | ||
53 | return 0x01000890; | ||
54 | case 12: | ||
55 | return 0x08009090; | ||
56 | case 13 ... 22: | ||
57 | return 0x01001090; | ||
58 | case 23 ... 36: | ||
59 | return 0x01008090; | ||
60 | case 37 ... 46: | ||
61 | return 0x08001090; | ||
62 | default: | ||
63 | return 0x08008090; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | static const uint32_t axi_clkgen_lock_table[] = { | ||
68 | 0x060603e8, 0x060603e8, 0x080803e8, 0x0b0b03e8, | ||
69 | 0x0e0e03e8, 0x111103e8, 0x131303e8, 0x161603e8, | ||
70 | 0x191903e8, 0x1c1c03e8, 0x1f1f0384, 0x1f1f0339, | ||
71 | 0x1f1f02ee, 0x1f1f02bc, 0x1f1f028a, 0x1f1f0271, | ||
72 | 0x1f1f023f, 0x1f1f0226, 0x1f1f020d, 0x1f1f01f4, | ||
73 | 0x1f1f01db, 0x1f1f01c2, 0x1f1f01a9, 0x1f1f0190, | ||
74 | 0x1f1f0190, 0x1f1f0177, 0x1f1f015e, 0x1f1f015e, | ||
75 | 0x1f1f0145, 0x1f1f0145, 0x1f1f012c, 0x1f1f012c, | ||
76 | 0x1f1f012c, 0x1f1f0113, 0x1f1f0113, 0x1f1f0113, | ||
77 | }; | ||
78 | |||
79 | static uint32_t axi_clkgen_lookup_lock(unsigned int m) | ||
80 | { | ||
81 | if (m < ARRAY_SIZE(axi_clkgen_lock_table)) | ||
82 | return axi_clkgen_lock_table[m]; | ||
83 | return 0x1f1f00fa; | ||
84 | } | ||
85 | |||
86 | static const unsigned int fpfd_min = 10000; | ||
87 | static const unsigned int fpfd_max = 300000; | ||
88 | static const unsigned int fvco_min = 600000; | ||
89 | static const unsigned int fvco_max = 1200000; | ||
90 | |||
91 | static void axi_clkgen_calc_params(unsigned long fin, unsigned long fout, | ||
92 | unsigned int *best_d, unsigned int *best_m, unsigned int *best_dout) | ||
93 | { | ||
94 | unsigned long d, d_min, d_max, _d_min, _d_max; | ||
95 | unsigned long m, m_min, m_max; | ||
96 | unsigned long f, dout, best_f, fvco; | ||
97 | |||
98 | fin /= 1000; | ||
99 | fout /= 1000; | ||
100 | |||
101 | best_f = ULONG_MAX; | ||
102 | *best_d = 0; | ||
103 | *best_m = 0; | ||
104 | *best_dout = 0; | ||
105 | |||
106 | d_min = max_t(unsigned long, DIV_ROUND_UP(fin, fpfd_max), 1); | ||
107 | d_max = min_t(unsigned long, fin / fpfd_min, 80); | ||
108 | |||
109 | m_min = max_t(unsigned long, DIV_ROUND_UP(fvco_min, fin) * d_min, 1); | ||
110 | m_max = min_t(unsigned long, fvco_max * d_max / fin, 64); | ||
111 | |||
112 | for (m = m_min; m <= m_max; m++) { | ||
113 | _d_min = max(d_min, DIV_ROUND_UP(fin * m, fvco_max)); | ||
114 | _d_max = min(d_max, fin * m / fvco_min); | ||
115 | |||
116 | for (d = _d_min; d <= _d_max; d++) { | ||
117 | fvco = fin * m / d; | ||
118 | |||
119 | dout = DIV_ROUND_CLOSEST(fvco, fout); | ||
120 | dout = clamp_t(unsigned long, dout, 1, 128); | ||
121 | f = fvco / dout; | ||
122 | if (abs(f - fout) < abs(best_f - fout)) { | ||
123 | best_f = f; | ||
124 | *best_d = d; | ||
125 | *best_m = m; | ||
126 | *best_dout = dout; | ||
127 | if (best_f == fout) | ||
128 | return; | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void axi_clkgen_calc_clk_params(unsigned int divider, unsigned int *low, | ||
135 | unsigned int *high, unsigned int *edge, unsigned int *nocount) | ||
136 | { | ||
137 | if (divider == 1) | ||
138 | *nocount = 1; | ||
139 | else | ||
140 | *nocount = 0; | ||
141 | |||
142 | *high = divider / 2; | ||
143 | *edge = divider % 2; | ||
144 | *low = divider - *high; | ||
145 | } | ||
146 | |||
147 | static void axi_clkgen_write(struct axi_clkgen *axi_clkgen, | ||
148 | unsigned int reg, unsigned int val) | ||
149 | { | ||
150 | writel(val, axi_clkgen->base + reg); | ||
151 | } | ||
152 | |||
153 | static void axi_clkgen_read(struct axi_clkgen *axi_clkgen, | ||
154 | unsigned int reg, unsigned int *val) | ||
155 | { | ||
156 | *val = readl(axi_clkgen->base + reg); | ||
157 | } | ||
158 | |||
159 | static struct axi_clkgen *clk_hw_to_axi_clkgen(struct clk_hw *clk_hw) | ||
160 | { | ||
161 | return container_of(clk_hw, struct axi_clkgen, clk_hw); | ||
162 | } | ||
163 | |||
164 | static int axi_clkgen_set_rate(struct clk_hw *clk_hw, | ||
165 | unsigned long rate, unsigned long parent_rate) | ||
166 | { | ||
167 | struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); | ||
168 | unsigned int d, m, dout; | ||
169 | unsigned int nocount; | ||
170 | unsigned int high; | ||
171 | unsigned int edge; | ||
172 | unsigned int low; | ||
173 | uint32_t filter; | ||
174 | uint32_t lock; | ||
175 | |||
176 | if (parent_rate == 0 || rate == 0) | ||
177 | return -EINVAL; | ||
178 | |||
179 | axi_clkgen_calc_params(parent_rate, rate, &d, &m, &dout); | ||
180 | |||
181 | if (d == 0 || dout == 0 || m == 0) | ||
182 | return -EINVAL; | ||
183 | |||
184 | filter = axi_clkgen_lookup_filter(m - 1); | ||
185 | lock = axi_clkgen_lookup_lock(m - 1); | ||
186 | |||
187 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_UPDATE_ENABLE, 0); | ||
188 | |||
189 | axi_clkgen_calc_clk_params(dout, &low, &high, &edge, &nocount); | ||
190 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_CLK_OUT1, | ||
191 | (high << 6) | low); | ||
192 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_CLK_OUT2, | ||
193 | (edge << 7) | (nocount << 6)); | ||
194 | |||
195 | axi_clkgen_calc_clk_params(d, &low, &high, &edge, &nocount); | ||
196 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_CLK_DIV, | ||
197 | (edge << 13) | (nocount << 12) | (high << 6) | low); | ||
198 | |||
199 | axi_clkgen_calc_clk_params(m, &low, &high, &edge, &nocount); | ||
200 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_CLK_FB1, | ||
201 | (high << 6) | low); | ||
202 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_CLK_FB2, | ||
203 | (edge << 7) | (nocount << 6)); | ||
204 | |||
205 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_LOCK1, lock & 0x3ff); | ||
206 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_LOCK2, | ||
207 | (((lock >> 16) & 0x1f) << 10) | 0x1); | ||
208 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_LOCK3, | ||
209 | (((lock >> 24) & 0x1f) << 10) | 0x3e9); | ||
210 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_FILTER1, filter >> 16); | ||
211 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_FILTER2, filter); | ||
212 | |||
213 | axi_clkgen_write(axi_clkgen, AXI_CLKGEN_REG_UPDATE_ENABLE, 1); | ||
214 | |||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static long axi_clkgen_round_rate(struct clk_hw *hw, unsigned long rate, | ||
219 | unsigned long *parent_rate) | ||
220 | { | ||
221 | unsigned int d, m, dout; | ||
222 | |||
223 | axi_clkgen_calc_params(*parent_rate, rate, &d, &m, &dout); | ||
224 | |||
225 | if (d == 0 || dout == 0 || m == 0) | ||
226 | return -EINVAL; | ||
227 | |||
228 | return *parent_rate / d * m / dout; | ||
229 | } | ||
230 | |||
231 | static unsigned long axi_clkgen_recalc_rate(struct clk_hw *clk_hw, | ||
232 | unsigned long parent_rate) | ||
233 | { | ||
234 | struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw); | ||
235 | unsigned int d, m, dout; | ||
236 | unsigned int reg; | ||
237 | unsigned long long tmp; | ||
238 | |||
239 | axi_clkgen_read(axi_clkgen, AXI_CLKGEN_REG_CLK_OUT1, ®); | ||
240 | dout = (reg & 0x3f) + ((reg >> 6) & 0x3f); | ||
241 | axi_clkgen_read(axi_clkgen, AXI_CLKGEN_REG_CLK_DIV, ®); | ||
242 | d = (reg & 0x3f) + ((reg >> 6) & 0x3f); | ||
243 | axi_clkgen_read(axi_clkgen, AXI_CLKGEN_REG_CLK_FB1, ®); | ||
244 | m = (reg & 0x3f) + ((reg >> 6) & 0x3f); | ||
245 | |||
246 | if (d == 0 || dout == 0) | ||
247 | return 0; | ||
248 | |||
249 | tmp = (unsigned long long)(parent_rate / d) * m; | ||
250 | do_div(tmp, dout); | ||
251 | |||
252 | if (tmp > ULONG_MAX) | ||
253 | return ULONG_MAX; | ||
254 | |||
255 | return tmp; | ||
256 | } | ||
257 | |||
258 | static const struct clk_ops axi_clkgen_ops = { | ||
259 | .recalc_rate = axi_clkgen_recalc_rate, | ||
260 | .round_rate = axi_clkgen_round_rate, | ||
261 | .set_rate = axi_clkgen_set_rate, | ||
262 | }; | ||
263 | |||
264 | static int axi_clkgen_probe(struct platform_device *pdev) | ||
265 | { | ||
266 | struct axi_clkgen *axi_clkgen; | ||
267 | struct clk_init_data init; | ||
268 | const char *parent_name; | ||
269 | const char *clk_name; | ||
270 | struct resource *mem; | ||
271 | struct clk *clk; | ||
272 | |||
273 | axi_clkgen = devm_kzalloc(&pdev->dev, sizeof(*axi_clkgen), GFP_KERNEL); | ||
274 | if (!axi_clkgen) | ||
275 | return -ENOMEM; | ||
276 | |||
277 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
278 | axi_clkgen->base = devm_ioremap_resource(&pdev->dev, mem); | ||
279 | if (IS_ERR(axi_clkgen->base)) | ||
280 | return PTR_ERR(axi_clkgen->base); | ||
281 | |||
282 | parent_name = of_clk_get_parent_name(pdev->dev.of_node, 0); | ||
283 | if (!parent_name) | ||
284 | return -EINVAL; | ||
285 | |||
286 | clk_name = pdev->dev.of_node->name; | ||
287 | of_property_read_string(pdev->dev.of_node, "clock-output-names", | ||
288 | &clk_name); | ||
289 | |||
290 | init.name = clk_name; | ||
291 | init.ops = &axi_clkgen_ops; | ||
292 | init.flags = 0; | ||
293 | init.parent_names = &parent_name; | ||
294 | init.num_parents = 1; | ||
295 | |||
296 | axi_clkgen->clk_hw.init = &init; | ||
297 | clk = devm_clk_register(&pdev->dev, &axi_clkgen->clk_hw); | ||
298 | if (IS_ERR(clk)) | ||
299 | return PTR_ERR(clk); | ||
300 | |||
301 | return of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, | ||
302 | clk); | ||
303 | } | ||
304 | |||
305 | static int axi_clkgen_remove(struct platform_device *pdev) | ||
306 | { | ||
307 | of_clk_del_provider(pdev->dev.of_node); | ||
308 | |||
309 | return 0; | ||
310 | } | ||
311 | |||
312 | static const struct of_device_id axi_clkgen_ids[] = { | ||
313 | { .compatible = "adi,axi-clkgen-1.00.a" }, | ||
314 | { }, | ||
315 | }; | ||
316 | MODULE_DEVICE_TABLE(of, axi_clkgen_ids); | ||
317 | |||
318 | static struct platform_driver axi_clkgen_driver = { | ||
319 | .driver = { | ||
320 | .name = "adi-axi-clkgen", | ||
321 | .owner = THIS_MODULE, | ||
322 | .of_match_table = axi_clkgen_ids, | ||
323 | }, | ||
324 | .probe = axi_clkgen_probe, | ||
325 | .remove = axi_clkgen_remove, | ||
326 | }; | ||
327 | module_platform_driver(axi_clkgen_driver); | ||
328 | |||
329 | MODULE_LICENSE("GPL v2"); | ||
330 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
331 | MODULE_DESCRIPTION("Driver for the Analog Devices' AXI clkgen pcore clock generator"); | ||
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c new file mode 100644 index 000000000000..097dee4fd209 --- /dev/null +++ b/drivers/clk/clk-composite.c | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 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 | #include <linux/clk.h> | ||
18 | #include <linux/clk-provider.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #define to_clk_composite(_hw) container_of(_hw, struct clk_composite, hw) | ||
23 | |||
24 | static u8 clk_composite_get_parent(struct clk_hw *hw) | ||
25 | { | ||
26 | struct clk_composite *composite = to_clk_composite(hw); | ||
27 | const struct clk_ops *mux_ops = composite->mux_ops; | ||
28 | struct clk_hw *mux_hw = composite->mux_hw; | ||
29 | |||
30 | mux_hw->clk = hw->clk; | ||
31 | |||
32 | return mux_ops->get_parent(mux_hw); | ||
33 | } | ||
34 | |||
35 | static int clk_composite_set_parent(struct clk_hw *hw, u8 index) | ||
36 | { | ||
37 | struct clk_composite *composite = to_clk_composite(hw); | ||
38 | const struct clk_ops *mux_ops = composite->mux_ops; | ||
39 | struct clk_hw *mux_hw = composite->mux_hw; | ||
40 | |||
41 | mux_hw->clk = hw->clk; | ||
42 | |||
43 | return mux_ops->set_parent(mux_hw, index); | ||
44 | } | ||
45 | |||
46 | static unsigned long clk_composite_recalc_rate(struct clk_hw *hw, | ||
47 | unsigned long parent_rate) | ||
48 | { | ||
49 | struct clk_composite *composite = to_clk_composite(hw); | ||
50 | const struct clk_ops *div_ops = composite->div_ops; | ||
51 | struct clk_hw *div_hw = composite->div_hw; | ||
52 | |||
53 | div_hw->clk = hw->clk; | ||
54 | |||
55 | return div_ops->recalc_rate(div_hw, parent_rate); | ||
56 | } | ||
57 | |||
58 | static long clk_composite_round_rate(struct clk_hw *hw, unsigned long rate, | ||
59 | unsigned long *prate) | ||
60 | { | ||
61 | struct clk_composite *composite = to_clk_composite(hw); | ||
62 | const struct clk_ops *div_ops = composite->div_ops; | ||
63 | struct clk_hw *div_hw = composite->div_hw; | ||
64 | |||
65 | div_hw->clk = hw->clk; | ||
66 | |||
67 | return div_ops->round_rate(div_hw, rate, prate); | ||
68 | } | ||
69 | |||
70 | static int clk_composite_set_rate(struct clk_hw *hw, unsigned long rate, | ||
71 | unsigned long parent_rate) | ||
72 | { | ||
73 | struct clk_composite *composite = to_clk_composite(hw); | ||
74 | const struct clk_ops *div_ops = composite->div_ops; | ||
75 | struct clk_hw *div_hw = composite->div_hw; | ||
76 | |||
77 | div_hw->clk = hw->clk; | ||
78 | |||
79 | return div_ops->set_rate(div_hw, rate, parent_rate); | ||
80 | } | ||
81 | |||
82 | static int clk_composite_is_enabled(struct clk_hw *hw) | ||
83 | { | ||
84 | struct clk_composite *composite = to_clk_composite(hw); | ||
85 | const struct clk_ops *gate_ops = composite->gate_ops; | ||
86 | struct clk_hw *gate_hw = composite->gate_hw; | ||
87 | |||
88 | gate_hw->clk = hw->clk; | ||
89 | |||
90 | return gate_ops->is_enabled(gate_hw); | ||
91 | } | ||
92 | |||
93 | static int clk_composite_enable(struct clk_hw *hw) | ||
94 | { | ||
95 | struct clk_composite *composite = to_clk_composite(hw); | ||
96 | const struct clk_ops *gate_ops = composite->gate_ops; | ||
97 | struct clk_hw *gate_hw = composite->gate_hw; | ||
98 | |||
99 | gate_hw->clk = hw->clk; | ||
100 | |||
101 | return gate_ops->enable(gate_hw); | ||
102 | } | ||
103 | |||
104 | static void clk_composite_disable(struct clk_hw *hw) | ||
105 | { | ||
106 | struct clk_composite *composite = to_clk_composite(hw); | ||
107 | const struct clk_ops *gate_ops = composite->gate_ops; | ||
108 | struct clk_hw *gate_hw = composite->gate_hw; | ||
109 | |||
110 | gate_hw->clk = hw->clk; | ||
111 | |||
112 | gate_ops->disable(gate_hw); | ||
113 | } | ||
114 | |||
115 | struct clk *clk_register_composite(struct device *dev, const char *name, | ||
116 | const char **parent_names, int num_parents, | ||
117 | struct clk_hw *mux_hw, const struct clk_ops *mux_ops, | ||
118 | struct clk_hw *div_hw, const struct clk_ops *div_ops, | ||
119 | struct clk_hw *gate_hw, const struct clk_ops *gate_ops, | ||
120 | unsigned long flags) | ||
121 | { | ||
122 | struct clk *clk; | ||
123 | struct clk_init_data init; | ||
124 | struct clk_composite *composite; | ||
125 | struct clk_ops *clk_composite_ops; | ||
126 | |||
127 | composite = kzalloc(sizeof(*composite), GFP_KERNEL); | ||
128 | if (!composite) { | ||
129 | pr_err("%s: could not allocate composite clk\n", __func__); | ||
130 | return ERR_PTR(-ENOMEM); | ||
131 | } | ||
132 | |||
133 | init.name = name; | ||
134 | init.flags = flags | CLK_IS_BASIC; | ||
135 | init.parent_names = parent_names; | ||
136 | init.num_parents = num_parents; | ||
137 | |||
138 | clk_composite_ops = &composite->ops; | ||
139 | |||
140 | if (mux_hw && mux_ops) { | ||
141 | if (!mux_ops->get_parent || !mux_ops->set_parent) { | ||
142 | clk = ERR_PTR(-EINVAL); | ||
143 | goto err; | ||
144 | } | ||
145 | |||
146 | composite->mux_hw = mux_hw; | ||
147 | composite->mux_ops = mux_ops; | ||
148 | clk_composite_ops->get_parent = clk_composite_get_parent; | ||
149 | clk_composite_ops->set_parent = clk_composite_set_parent; | ||
150 | } | ||
151 | |||
152 | if (div_hw && div_ops) { | ||
153 | if (!div_ops->recalc_rate || !div_ops->round_rate || | ||
154 | !div_ops->set_rate) { | ||
155 | clk = ERR_PTR(-EINVAL); | ||
156 | goto err; | ||
157 | } | ||
158 | |||
159 | composite->div_hw = div_hw; | ||
160 | composite->div_ops = div_ops; | ||
161 | clk_composite_ops->recalc_rate = clk_composite_recalc_rate; | ||
162 | clk_composite_ops->round_rate = clk_composite_round_rate; | ||
163 | clk_composite_ops->set_rate = clk_composite_set_rate; | ||
164 | } | ||
165 | |||
166 | if (gate_hw && gate_ops) { | ||
167 | if (!gate_ops->is_enabled || !gate_ops->enable || | ||
168 | !gate_ops->disable) { | ||
169 | clk = ERR_PTR(-EINVAL); | ||
170 | goto err; | ||
171 | } | ||
172 | |||
173 | composite->gate_hw = gate_hw; | ||
174 | composite->gate_ops = gate_ops; | ||
175 | clk_composite_ops->is_enabled = clk_composite_is_enabled; | ||
176 | clk_composite_ops->enable = clk_composite_enable; | ||
177 | clk_composite_ops->disable = clk_composite_disable; | ||
178 | } | ||
179 | |||
180 | init.ops = clk_composite_ops; | ||
181 | composite->hw.init = &init; | ||
182 | |||
183 | clk = clk_register(dev, &composite->hw); | ||
184 | if (IS_ERR(clk)) | ||
185 | goto err; | ||
186 | |||
187 | if (composite->mux_hw) | ||
188 | composite->mux_hw->clk = clk; | ||
189 | |||
190 | if (composite->div_hw) | ||
191 | composite->div_hw->clk = clk; | ||
192 | |||
193 | if (composite->gate_hw) | ||
194 | composite->gate_hw->clk = clk; | ||
195 | |||
196 | return clk; | ||
197 | |||
198 | err: | ||
199 | kfree(composite); | ||
200 | return clk; | ||
201 | } | ||
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 508c032edce4..25b1734560d0 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c | |||
@@ -32,6 +32,7 @@ | |||
32 | static u8 clk_mux_get_parent(struct clk_hw *hw) | 32 | static u8 clk_mux_get_parent(struct clk_hw *hw) |
33 | { | 33 | { |
34 | struct clk_mux *mux = to_clk_mux(hw); | 34 | struct clk_mux *mux = to_clk_mux(hw); |
35 | int num_parents = __clk_get_num_parents(hw->clk); | ||
35 | u32 val; | 36 | u32 val; |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -42,7 +43,16 @@ static u8 clk_mux_get_parent(struct clk_hw *hw) | |||
42 | * val = 0x4 really means "bit 2, index starts at bit 0" | 43 | * val = 0x4 really means "bit 2, index starts at bit 0" |
43 | */ | 44 | */ |
44 | val = readl(mux->reg) >> mux->shift; | 45 | val = readl(mux->reg) >> mux->shift; |
45 | val &= (1 << mux->width) - 1; | 46 | val &= mux->mask; |
47 | |||
48 | if (mux->table) { | ||
49 | int i; | ||
50 | |||
51 | for (i = 0; i < num_parents; i++) | ||
52 | if (mux->table[i] == val) | ||
53 | return i; | ||
54 | return -EINVAL; | ||
55 | } | ||
46 | 56 | ||
47 | if (val && (mux->flags & CLK_MUX_INDEX_BIT)) | 57 | if (val && (mux->flags & CLK_MUX_INDEX_BIT)) |
48 | val = ffs(val) - 1; | 58 | val = ffs(val) - 1; |
@@ -50,7 +60,7 @@ static u8 clk_mux_get_parent(struct clk_hw *hw) | |||
50 | if (val && (mux->flags & CLK_MUX_INDEX_ONE)) | 60 | if (val && (mux->flags & CLK_MUX_INDEX_ONE)) |
51 | val--; | 61 | val--; |
52 | 62 | ||
53 | if (val >= __clk_get_num_parents(hw->clk)) | 63 | if (val >= num_parents) |
54 | return -EINVAL; | 64 | return -EINVAL; |
55 | 65 | ||
56 | return val; | 66 | return val; |
@@ -62,17 +72,22 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) | |||
62 | u32 val; | 72 | u32 val; |
63 | unsigned long flags = 0; | 73 | unsigned long flags = 0; |
64 | 74 | ||
65 | if (mux->flags & CLK_MUX_INDEX_BIT) | 75 | if (mux->table) |
66 | index = (1 << ffs(index)); | 76 | index = mux->table[index]; |
67 | 77 | ||
68 | if (mux->flags & CLK_MUX_INDEX_ONE) | 78 | else { |
69 | index++; | 79 | if (mux->flags & CLK_MUX_INDEX_BIT) |
80 | index = (1 << ffs(index)); | ||
81 | |||
82 | if (mux->flags & CLK_MUX_INDEX_ONE) | ||
83 | index++; | ||
84 | } | ||
70 | 85 | ||
71 | if (mux->lock) | 86 | if (mux->lock) |
72 | spin_lock_irqsave(mux->lock, flags); | 87 | spin_lock_irqsave(mux->lock, flags); |
73 | 88 | ||
74 | val = readl(mux->reg); | 89 | val = readl(mux->reg); |
75 | val &= ~(((1 << mux->width) - 1) << mux->shift); | 90 | val &= ~(mux->mask << mux->shift); |
76 | val |= index << mux->shift; | 91 | val |= index << mux->shift; |
77 | writel(val, mux->reg); | 92 | writel(val, mux->reg); |
78 | 93 | ||
@@ -88,10 +103,10 @@ const struct clk_ops clk_mux_ops = { | |||
88 | }; | 103 | }; |
89 | EXPORT_SYMBOL_GPL(clk_mux_ops); | 104 | EXPORT_SYMBOL_GPL(clk_mux_ops); |
90 | 105 | ||
91 | struct clk *clk_register_mux(struct device *dev, const char *name, | 106 | struct clk *clk_register_mux_table(struct device *dev, const char *name, |
92 | const char **parent_names, u8 num_parents, unsigned long flags, | 107 | const char **parent_names, u8 num_parents, unsigned long flags, |
93 | void __iomem *reg, u8 shift, u8 width, | 108 | void __iomem *reg, u8 shift, u32 mask, |
94 | u8 clk_mux_flags, spinlock_t *lock) | 109 | u8 clk_mux_flags, u32 *table, spinlock_t *lock) |
95 | { | 110 | { |
96 | struct clk_mux *mux; | 111 | struct clk_mux *mux; |
97 | struct clk *clk; | 112 | struct clk *clk; |
@@ -113,9 +128,10 @@ struct clk *clk_register_mux(struct device *dev, const char *name, | |||
113 | /* struct clk_mux assignments */ | 128 | /* struct clk_mux assignments */ |
114 | mux->reg = reg; | 129 | mux->reg = reg; |
115 | mux->shift = shift; | 130 | mux->shift = shift; |
116 | mux->width = width; | 131 | mux->mask = mask; |
117 | mux->flags = clk_mux_flags; | 132 | mux->flags = clk_mux_flags; |
118 | mux->lock = lock; | 133 | mux->lock = lock; |
134 | mux->table = table; | ||
119 | mux->hw.init = &init; | 135 | mux->hw.init = &init; |
120 | 136 | ||
121 | clk = clk_register(dev, &mux->hw); | 137 | clk = clk_register(dev, &mux->hw); |
@@ -125,3 +141,15 @@ struct clk *clk_register_mux(struct device *dev, const char *name, | |||
125 | 141 | ||
126 | return clk; | 142 | return clk; |
127 | } | 143 | } |
144 | |||
145 | struct clk *clk_register_mux(struct device *dev, const char *name, | ||
146 | const char **parent_names, u8 num_parents, unsigned long flags, | ||
147 | void __iomem *reg, u8 shift, u8 width, | ||
148 | u8 clk_mux_flags, spinlock_t *lock) | ||
149 | { | ||
150 | u32 mask = BIT(width) - 1; | ||
151 | |||
152 | return clk_register_mux_table(dev, name, parent_names, num_parents, | ||
153 | flags, reg, shift, mask, clk_mux_flags, | ||
154 | NULL, lock); | ||
155 | } | ||
diff --git a/drivers/clk/clk-prima2.c b/drivers/clk/clk-prima2.c index f8e9d0c27be2..643ca653fef0 100644 --- a/drivers/clk/clk-prima2.c +++ b/drivers/clk/clk-prima2.c | |||
@@ -1113,7 +1113,7 @@ void __init sirfsoc_of_clk_init(void) | |||
1113 | 1113 | ||
1114 | for (i = pll1; i < maxclk; i++) { | 1114 | for (i = pll1; i < maxclk; i++) { |
1115 | prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]); | 1115 | prima2_clks[i] = clk_register(NULL, prima2_clk_hw_array[i]); |
1116 | BUG_ON(!prima2_clks[i]); | 1116 | BUG_ON(IS_ERR(prima2_clks[i])); |
1117 | } | 1117 | } |
1118 | clk_register_clkdev(prima2_clks[cpu], NULL, "cpu"); | 1118 | clk_register_clkdev(prima2_clks[cpu], NULL, "cpu"); |
1119 | clk_register_clkdev(prima2_clks[io], NULL, "io"); | 1119 | clk_register_clkdev(prima2_clks[io], NULL, "io"); |
diff --git a/drivers/clk/clk-zynq.c b/drivers/clk/clk-zynq.c index b14a25f39255..32062977f453 100644 --- a/drivers/clk/clk-zynq.c +++ b/drivers/clk/clk-zynq.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/clk-provider.h> | 22 | #include <linux/clk-provider.h> |
23 | #include <linux/clk/zynq.h> | ||
23 | 24 | ||
24 | static void __iomem *slcr_base; | 25 | static void __iomem *slcr_base; |
25 | 26 | ||
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index ed87b2405806..0230c9d95975 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -19,14 +19,77 @@ | |||
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/sched.h> | ||
22 | 23 | ||
23 | static DEFINE_SPINLOCK(enable_lock); | 24 | static DEFINE_SPINLOCK(enable_lock); |
24 | static DEFINE_MUTEX(prepare_lock); | 25 | static DEFINE_MUTEX(prepare_lock); |
25 | 26 | ||
27 | static struct task_struct *prepare_owner; | ||
28 | static struct task_struct *enable_owner; | ||
29 | |||
30 | static int prepare_refcnt; | ||
31 | static int enable_refcnt; | ||
32 | |||
26 | static HLIST_HEAD(clk_root_list); | 33 | static HLIST_HEAD(clk_root_list); |
27 | static HLIST_HEAD(clk_orphan_list); | 34 | static HLIST_HEAD(clk_orphan_list); |
28 | static LIST_HEAD(clk_notifier_list); | 35 | static LIST_HEAD(clk_notifier_list); |
29 | 36 | ||
37 | /*** locking ***/ | ||
38 | static void clk_prepare_lock(void) | ||
39 | { | ||
40 | if (!mutex_trylock(&prepare_lock)) { | ||
41 | if (prepare_owner == current) { | ||
42 | prepare_refcnt++; | ||
43 | return; | ||
44 | } | ||
45 | mutex_lock(&prepare_lock); | ||
46 | } | ||
47 | WARN_ON_ONCE(prepare_owner != NULL); | ||
48 | WARN_ON_ONCE(prepare_refcnt != 0); | ||
49 | prepare_owner = current; | ||
50 | prepare_refcnt = 1; | ||
51 | } | ||
52 | |||
53 | static void clk_prepare_unlock(void) | ||
54 | { | ||
55 | WARN_ON_ONCE(prepare_owner != current); | ||
56 | WARN_ON_ONCE(prepare_refcnt == 0); | ||
57 | |||
58 | if (--prepare_refcnt) | ||
59 | return; | ||
60 | prepare_owner = NULL; | ||
61 | mutex_unlock(&prepare_lock); | ||
62 | } | ||
63 | |||
64 | static unsigned long clk_enable_lock(void) | ||
65 | { | ||
66 | unsigned long flags; | ||
67 | |||
68 | if (!spin_trylock_irqsave(&enable_lock, flags)) { | ||
69 | if (enable_owner == current) { | ||
70 | enable_refcnt++; | ||
71 | return flags; | ||
72 | } | ||
73 | spin_lock_irqsave(&enable_lock, flags); | ||
74 | } | ||
75 | WARN_ON_ONCE(enable_owner != NULL); | ||
76 | WARN_ON_ONCE(enable_refcnt != 0); | ||
77 | enable_owner = current; | ||
78 | enable_refcnt = 1; | ||
79 | return flags; | ||
80 | } | ||
81 | |||
82 | static void clk_enable_unlock(unsigned long flags) | ||
83 | { | ||
84 | WARN_ON_ONCE(enable_owner != current); | ||
85 | WARN_ON_ONCE(enable_refcnt == 0); | ||
86 | |||
87 | if (--enable_refcnt) | ||
88 | return; | ||
89 | enable_owner = NULL; | ||
90 | spin_unlock_irqrestore(&enable_lock, flags); | ||
91 | } | ||
92 | |||
30 | /*** debugfs support ***/ | 93 | /*** debugfs support ***/ |
31 | 94 | ||
32 | #ifdef CONFIG_COMMON_CLK_DEBUG | 95 | #ifdef CONFIG_COMMON_CLK_DEBUG |
@@ -69,7 +132,7 @@ static int clk_summary_show(struct seq_file *s, void *data) | |||
69 | seq_printf(s, " clock enable_cnt prepare_cnt rate\n"); | 132 | seq_printf(s, " clock enable_cnt prepare_cnt rate\n"); |
70 | seq_printf(s, "---------------------------------------------------------------------\n"); | 133 | seq_printf(s, "---------------------------------------------------------------------\n"); |
71 | 134 | ||
72 | mutex_lock(&prepare_lock); | 135 | clk_prepare_lock(); |
73 | 136 | ||
74 | hlist_for_each_entry(c, &clk_root_list, child_node) | 137 | hlist_for_each_entry(c, &clk_root_list, child_node) |
75 | clk_summary_show_subtree(s, c, 0); | 138 | clk_summary_show_subtree(s, c, 0); |
@@ -77,7 +140,7 @@ static int clk_summary_show(struct seq_file *s, void *data) | |||
77 | hlist_for_each_entry(c, &clk_orphan_list, child_node) | 140 | hlist_for_each_entry(c, &clk_orphan_list, child_node) |
78 | clk_summary_show_subtree(s, c, 0); | 141 | clk_summary_show_subtree(s, c, 0); |
79 | 142 | ||
80 | mutex_unlock(&prepare_lock); | 143 | clk_prepare_unlock(); |
81 | 144 | ||
82 | return 0; | 145 | return 0; |
83 | } | 146 | } |
@@ -130,7 +193,7 @@ static int clk_dump(struct seq_file *s, void *data) | |||
130 | 193 | ||
131 | seq_printf(s, "{"); | 194 | seq_printf(s, "{"); |
132 | 195 | ||
133 | mutex_lock(&prepare_lock); | 196 | clk_prepare_lock(); |
134 | 197 | ||
135 | hlist_for_each_entry(c, &clk_root_list, child_node) { | 198 | hlist_for_each_entry(c, &clk_root_list, child_node) { |
136 | if (!first_node) | 199 | if (!first_node) |
@@ -144,7 +207,7 @@ static int clk_dump(struct seq_file *s, void *data) | |||
144 | clk_dump_subtree(s, c, 0); | 207 | clk_dump_subtree(s, c, 0); |
145 | } | 208 | } |
146 | 209 | ||
147 | mutex_unlock(&prepare_lock); | 210 | clk_prepare_unlock(); |
148 | 211 | ||
149 | seq_printf(s, "}"); | 212 | seq_printf(s, "}"); |
150 | return 0; | 213 | return 0; |
@@ -316,7 +379,7 @@ static int __init clk_debug_init(void) | |||
316 | if (!orphandir) | 379 | if (!orphandir) |
317 | return -ENOMEM; | 380 | return -ENOMEM; |
318 | 381 | ||
319 | mutex_lock(&prepare_lock); | 382 | clk_prepare_lock(); |
320 | 383 | ||
321 | hlist_for_each_entry(clk, &clk_root_list, child_node) | 384 | hlist_for_each_entry(clk, &clk_root_list, child_node) |
322 | clk_debug_create_subtree(clk, rootdir); | 385 | clk_debug_create_subtree(clk, rootdir); |
@@ -326,7 +389,7 @@ static int __init clk_debug_init(void) | |||
326 | 389 | ||
327 | inited = 1; | 390 | inited = 1; |
328 | 391 | ||
329 | mutex_unlock(&prepare_lock); | 392 | clk_prepare_unlock(); |
330 | 393 | ||
331 | return 0; | 394 | return 0; |
332 | } | 395 | } |
@@ -336,6 +399,31 @@ static inline int clk_debug_register(struct clk *clk) { return 0; } | |||
336 | #endif | 399 | #endif |
337 | 400 | ||
338 | /* caller must hold prepare_lock */ | 401 | /* caller must hold prepare_lock */ |
402 | static void clk_unprepare_unused_subtree(struct clk *clk) | ||
403 | { | ||
404 | struct clk *child; | ||
405 | |||
406 | if (!clk) | ||
407 | return; | ||
408 | |||
409 | hlist_for_each_entry(child, &clk->children, child_node) | ||
410 | clk_unprepare_unused_subtree(child); | ||
411 | |||
412 | if (clk->prepare_count) | ||
413 | return; | ||
414 | |||
415 | if (clk->flags & CLK_IGNORE_UNUSED) | ||
416 | return; | ||
417 | |||
418 | if (__clk_is_prepared(clk)) { | ||
419 | if (clk->ops->unprepare_unused) | ||
420 | clk->ops->unprepare_unused(clk->hw); | ||
421 | else if (clk->ops->unprepare) | ||
422 | clk->ops->unprepare(clk->hw); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | /* caller must hold prepare_lock */ | ||
339 | static void clk_disable_unused_subtree(struct clk *clk) | 427 | static void clk_disable_unused_subtree(struct clk *clk) |
340 | { | 428 | { |
341 | struct clk *child; | 429 | struct clk *child; |
@@ -347,7 +435,7 @@ static void clk_disable_unused_subtree(struct clk *clk) | |||
347 | hlist_for_each_entry(child, &clk->children, child_node) | 435 | hlist_for_each_entry(child, &clk->children, child_node) |
348 | clk_disable_unused_subtree(child); | 436 | clk_disable_unused_subtree(child); |
349 | 437 | ||
350 | spin_lock_irqsave(&enable_lock, flags); | 438 | flags = clk_enable_lock(); |
351 | 439 | ||
352 | if (clk->enable_count) | 440 | if (clk->enable_count) |
353 | goto unlock_out; | 441 | goto unlock_out; |
@@ -368,7 +456,7 @@ static void clk_disable_unused_subtree(struct clk *clk) | |||
368 | } | 456 | } |
369 | 457 | ||
370 | unlock_out: | 458 | unlock_out: |
371 | spin_unlock_irqrestore(&enable_lock, flags); | 459 | clk_enable_unlock(flags); |
372 | 460 | ||
373 | out: | 461 | out: |
374 | return; | 462 | return; |
@@ -378,7 +466,7 @@ static int clk_disable_unused(void) | |||
378 | { | 466 | { |
379 | struct clk *clk; | 467 | struct clk *clk; |
380 | 468 | ||
381 | mutex_lock(&prepare_lock); | 469 | clk_prepare_lock(); |
382 | 470 | ||
383 | hlist_for_each_entry(clk, &clk_root_list, child_node) | 471 | hlist_for_each_entry(clk, &clk_root_list, child_node) |
384 | clk_disable_unused_subtree(clk); | 472 | clk_disable_unused_subtree(clk); |
@@ -386,7 +474,13 @@ static int clk_disable_unused(void) | |||
386 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) | 474 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) |
387 | clk_disable_unused_subtree(clk); | 475 | clk_disable_unused_subtree(clk); |
388 | 476 | ||
389 | mutex_unlock(&prepare_lock); | 477 | hlist_for_each_entry(clk, &clk_root_list, child_node) |
478 | clk_unprepare_unused_subtree(clk); | ||
479 | |||
480 | hlist_for_each_entry(clk, &clk_orphan_list, child_node) | ||
481 | clk_unprepare_unused_subtree(clk); | ||
482 | |||
483 | clk_prepare_unlock(); | ||
390 | 484 | ||
391 | return 0; | 485 | return 0; |
392 | } | 486 | } |
@@ -451,6 +545,27 @@ unsigned long __clk_get_flags(struct clk *clk) | |||
451 | return !clk ? 0 : clk->flags; | 545 | return !clk ? 0 : clk->flags; |
452 | } | 546 | } |
453 | 547 | ||
548 | bool __clk_is_prepared(struct clk *clk) | ||
549 | { | ||
550 | int ret; | ||
551 | |||
552 | if (!clk) | ||
553 | return false; | ||
554 | |||
555 | /* | ||
556 | * .is_prepared is optional for clocks that can prepare | ||
557 | * fall back to software usage counter if it is missing | ||
558 | */ | ||
559 | if (!clk->ops->is_prepared) { | ||
560 | ret = clk->prepare_count ? 1 : 0; | ||
561 | goto out; | ||
562 | } | ||
563 | |||
564 | ret = clk->ops->is_prepared(clk->hw); | ||
565 | out: | ||
566 | return !!ret; | ||
567 | } | ||
568 | |||
454 | bool __clk_is_enabled(struct clk *clk) | 569 | bool __clk_is_enabled(struct clk *clk) |
455 | { | 570 | { |
456 | int ret; | 571 | int ret; |
@@ -548,9 +663,9 @@ void __clk_unprepare(struct clk *clk) | |||
548 | */ | 663 | */ |
549 | void clk_unprepare(struct clk *clk) | 664 | void clk_unprepare(struct clk *clk) |
550 | { | 665 | { |
551 | mutex_lock(&prepare_lock); | 666 | clk_prepare_lock(); |
552 | __clk_unprepare(clk); | 667 | __clk_unprepare(clk); |
553 | mutex_unlock(&prepare_lock); | 668 | clk_prepare_unlock(); |
554 | } | 669 | } |
555 | EXPORT_SYMBOL_GPL(clk_unprepare); | 670 | EXPORT_SYMBOL_GPL(clk_unprepare); |
556 | 671 | ||
@@ -596,9 +711,9 @@ int clk_prepare(struct clk *clk) | |||
596 | { | 711 | { |
597 | int ret; | 712 | int ret; |
598 | 713 | ||
599 | mutex_lock(&prepare_lock); | 714 | clk_prepare_lock(); |
600 | ret = __clk_prepare(clk); | 715 | ret = __clk_prepare(clk); |
601 | mutex_unlock(&prepare_lock); | 716 | clk_prepare_unlock(); |
602 | 717 | ||
603 | return ret; | 718 | return ret; |
604 | } | 719 | } |
@@ -640,9 +755,9 @@ void clk_disable(struct clk *clk) | |||
640 | { | 755 | { |
641 | unsigned long flags; | 756 | unsigned long flags; |
642 | 757 | ||
643 | spin_lock_irqsave(&enable_lock, flags); | 758 | flags = clk_enable_lock(); |
644 | __clk_disable(clk); | 759 | __clk_disable(clk); |
645 | spin_unlock_irqrestore(&enable_lock, flags); | 760 | clk_enable_unlock(flags); |
646 | } | 761 | } |
647 | EXPORT_SYMBOL_GPL(clk_disable); | 762 | EXPORT_SYMBOL_GPL(clk_disable); |
648 | 763 | ||
@@ -693,9 +808,9 @@ int clk_enable(struct clk *clk) | |||
693 | unsigned long flags; | 808 | unsigned long flags; |
694 | int ret; | 809 | int ret; |
695 | 810 | ||
696 | spin_lock_irqsave(&enable_lock, flags); | 811 | flags = clk_enable_lock(); |
697 | ret = __clk_enable(clk); | 812 | ret = __clk_enable(clk); |
698 | spin_unlock_irqrestore(&enable_lock, flags); | 813 | clk_enable_unlock(flags); |
699 | 814 | ||
700 | return ret; | 815 | return ret; |
701 | } | 816 | } |
@@ -740,9 +855,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate) | |||
740 | { | 855 | { |
741 | unsigned long ret; | 856 | unsigned long ret; |
742 | 857 | ||
743 | mutex_lock(&prepare_lock); | 858 | clk_prepare_lock(); |
744 | ret = __clk_round_rate(clk, rate); | 859 | ret = __clk_round_rate(clk, rate); |
745 | mutex_unlock(&prepare_lock); | 860 | clk_prepare_unlock(); |
746 | 861 | ||
747 | return ret; | 862 | return ret; |
748 | } | 863 | } |
@@ -837,13 +952,13 @@ unsigned long clk_get_rate(struct clk *clk) | |||
837 | { | 952 | { |
838 | unsigned long rate; | 953 | unsigned long rate; |
839 | 954 | ||
840 | mutex_lock(&prepare_lock); | 955 | clk_prepare_lock(); |
841 | 956 | ||
842 | if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) | 957 | if (clk && (clk->flags & CLK_GET_RATE_NOCACHE)) |
843 | __clk_recalc_rates(clk, 0); | 958 | __clk_recalc_rates(clk, 0); |
844 | 959 | ||
845 | rate = __clk_get_rate(clk); | 960 | rate = __clk_get_rate(clk); |
846 | mutex_unlock(&prepare_lock); | 961 | clk_prepare_unlock(); |
847 | 962 | ||
848 | return rate; | 963 | return rate; |
849 | } | 964 | } |
@@ -974,7 +1089,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even | |||
974 | int ret = NOTIFY_DONE; | 1089 | int ret = NOTIFY_DONE; |
975 | 1090 | ||
976 | if (clk->rate == clk->new_rate) | 1091 | if (clk->rate == clk->new_rate) |
977 | return 0; | 1092 | return NULL; |
978 | 1093 | ||
979 | if (clk->notifier_count) { | 1094 | if (clk->notifier_count) { |
980 | ret = __clk_notify(clk, event, clk->rate, clk->new_rate); | 1095 | ret = __clk_notify(clk, event, clk->rate, clk->new_rate); |
@@ -1048,7 +1163,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
1048 | int ret = 0; | 1163 | int ret = 0; |
1049 | 1164 | ||
1050 | /* prevent racing with updates to the clock topology */ | 1165 | /* prevent racing with updates to the clock topology */ |
1051 | mutex_lock(&prepare_lock); | 1166 | clk_prepare_lock(); |
1052 | 1167 | ||
1053 | /* bail early if nothing to do */ | 1168 | /* bail early if nothing to do */ |
1054 | if (rate == clk->rate) | 1169 | if (rate == clk->rate) |
@@ -1080,7 +1195,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) | |||
1080 | clk_change_rate(top); | 1195 | clk_change_rate(top); |
1081 | 1196 | ||
1082 | out: | 1197 | out: |
1083 | mutex_unlock(&prepare_lock); | 1198 | clk_prepare_unlock(); |
1084 | 1199 | ||
1085 | return ret; | 1200 | return ret; |
1086 | } | 1201 | } |
@@ -1096,9 +1211,9 @@ struct clk *clk_get_parent(struct clk *clk) | |||
1096 | { | 1211 | { |
1097 | struct clk *parent; | 1212 | struct clk *parent; |
1098 | 1213 | ||
1099 | mutex_lock(&prepare_lock); | 1214 | clk_prepare_lock(); |
1100 | parent = __clk_get_parent(clk); | 1215 | parent = __clk_get_parent(clk); |
1101 | mutex_unlock(&prepare_lock); | 1216 | clk_prepare_unlock(); |
1102 | 1217 | ||
1103 | return parent; | 1218 | return parent; |
1104 | } | 1219 | } |
@@ -1242,19 +1357,19 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent) | |||
1242 | __clk_prepare(parent); | 1357 | __clk_prepare(parent); |
1243 | 1358 | ||
1244 | /* FIXME replace with clk_is_enabled(clk) someday */ | 1359 | /* FIXME replace with clk_is_enabled(clk) someday */ |
1245 | spin_lock_irqsave(&enable_lock, flags); | 1360 | flags = clk_enable_lock(); |
1246 | if (clk->enable_count) | 1361 | if (clk->enable_count) |
1247 | __clk_enable(parent); | 1362 | __clk_enable(parent); |
1248 | spin_unlock_irqrestore(&enable_lock, flags); | 1363 | clk_enable_unlock(flags); |
1249 | 1364 | ||
1250 | /* change clock input source */ | 1365 | /* change clock input source */ |
1251 | ret = clk->ops->set_parent(clk->hw, i); | 1366 | ret = clk->ops->set_parent(clk->hw, i); |
1252 | 1367 | ||
1253 | /* clean up old prepare and enable */ | 1368 | /* clean up old prepare and enable */ |
1254 | spin_lock_irqsave(&enable_lock, flags); | 1369 | flags = clk_enable_lock(); |
1255 | if (clk->enable_count) | 1370 | if (clk->enable_count) |
1256 | __clk_disable(old_parent); | 1371 | __clk_disable(old_parent); |
1257 | spin_unlock_irqrestore(&enable_lock, flags); | 1372 | clk_enable_unlock(flags); |
1258 | 1373 | ||
1259 | if (clk->prepare_count) | 1374 | if (clk->prepare_count) |
1260 | __clk_unprepare(old_parent); | 1375 | __clk_unprepare(old_parent); |
@@ -1286,7 +1401,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
1286 | return -ENOSYS; | 1401 | return -ENOSYS; |
1287 | 1402 | ||
1288 | /* prevent racing with updates to the clock topology */ | 1403 | /* prevent racing with updates to the clock topology */ |
1289 | mutex_lock(&prepare_lock); | 1404 | clk_prepare_lock(); |
1290 | 1405 | ||
1291 | if (clk->parent == parent) | 1406 | if (clk->parent == parent) |
1292 | goto out; | 1407 | goto out; |
@@ -1315,7 +1430,7 @@ int clk_set_parent(struct clk *clk, struct clk *parent) | |||
1315 | __clk_reparent(clk, parent); | 1430 | __clk_reparent(clk, parent); |
1316 | 1431 | ||
1317 | out: | 1432 | out: |
1318 | mutex_unlock(&prepare_lock); | 1433 | clk_prepare_unlock(); |
1319 | 1434 | ||
1320 | return ret; | 1435 | return ret; |
1321 | } | 1436 | } |
@@ -1338,7 +1453,7 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1338 | if (!clk) | 1453 | if (!clk) |
1339 | return -EINVAL; | 1454 | return -EINVAL; |
1340 | 1455 | ||
1341 | mutex_lock(&prepare_lock); | 1456 | clk_prepare_lock(); |
1342 | 1457 | ||
1343 | /* check to see if a clock with this name is already registered */ | 1458 | /* check to see if a clock with this name is already registered */ |
1344 | if (__clk_lookup(clk->name)) { | 1459 | if (__clk_lookup(clk->name)) { |
@@ -1462,7 +1577,7 @@ int __clk_init(struct device *dev, struct clk *clk) | |||
1462 | clk_debug_register(clk); | 1577 | clk_debug_register(clk); |
1463 | 1578 | ||
1464 | out: | 1579 | out: |
1465 | mutex_unlock(&prepare_lock); | 1580 | clk_prepare_unlock(); |
1466 | 1581 | ||
1467 | return ret; | 1582 | return ret; |
1468 | } | 1583 | } |
@@ -1696,7 +1811,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) | |||
1696 | if (!clk || !nb) | 1811 | if (!clk || !nb) |
1697 | return -EINVAL; | 1812 | return -EINVAL; |
1698 | 1813 | ||
1699 | mutex_lock(&prepare_lock); | 1814 | clk_prepare_lock(); |
1700 | 1815 | ||
1701 | /* search the list of notifiers for this clk */ | 1816 | /* search the list of notifiers for this clk */ |
1702 | list_for_each_entry(cn, &clk_notifier_list, node) | 1817 | list_for_each_entry(cn, &clk_notifier_list, node) |
@@ -1720,7 +1835,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb) | |||
1720 | clk->notifier_count++; | 1835 | clk->notifier_count++; |
1721 | 1836 | ||
1722 | out: | 1837 | out: |
1723 | mutex_unlock(&prepare_lock); | 1838 | clk_prepare_unlock(); |
1724 | 1839 | ||
1725 | return ret; | 1840 | return ret; |
1726 | } | 1841 | } |
@@ -1745,7 +1860,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) | |||
1745 | if (!clk || !nb) | 1860 | if (!clk || !nb) |
1746 | return -EINVAL; | 1861 | return -EINVAL; |
1747 | 1862 | ||
1748 | mutex_lock(&prepare_lock); | 1863 | clk_prepare_lock(); |
1749 | 1864 | ||
1750 | list_for_each_entry(cn, &clk_notifier_list, node) | 1865 | list_for_each_entry(cn, &clk_notifier_list, node) |
1751 | if (cn->clk == clk) | 1866 | if (cn->clk == clk) |
@@ -1766,7 +1881,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) | |||
1766 | ret = -ENOENT; | 1881 | ret = -ENOENT; |
1767 | } | 1882 | } |
1768 | 1883 | ||
1769 | mutex_unlock(&prepare_lock); | 1884 | clk_prepare_unlock(); |
1770 | 1885 | ||
1771 | return ret; | 1886 | return ret; |
1772 | } | 1887 | } |
diff --git a/drivers/clk/mxs/clk.c b/drivers/clk/mxs/clk.c index b24d56067c80..5301bce8957b 100644 --- a/drivers/clk/mxs/clk.c +++ b/drivers/clk/mxs/clk.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/jiffies.h> | 14 | #include <linux/jiffies.h> |
15 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
16 | #include "clk.h" | ||
16 | 17 | ||
17 | DEFINE_SPINLOCK(mxs_lock); | 18 | DEFINE_SPINLOCK(mxs_lock); |
18 | 19 | ||
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c index 3ceb4507e95f..9d0b3949db30 100644 --- a/drivers/clk/spear/spear1340_clock.c +++ b/drivers/clk/spear/spear1340_clock.c | |||
@@ -959,47 +959,47 @@ void __init spear1340_clk_init(void __iomem *misc_base) | |||
959 | SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock); | 959 | SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock); |
960 | clk_register_clkdev(clk, NULL, "d0100000.spdif-in"); | 960 | clk_register_clkdev(clk, NULL, "d0100000.spdif-in"); |
961 | 961 | ||
962 | clk = clk_register_gate(NULL, "acp_clk", "acp_mclk", 0, | 962 | clk = clk_register_gate(NULL, "acp_clk", "ahb_clk", 0, |
963 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, | 963 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, |
964 | &_lock); | 964 | &_lock); |
965 | clk_register_clkdev(clk, NULL, "acp_clk"); | 965 | clk_register_clkdev(clk, NULL, "acp_clk"); |
966 | 966 | ||
967 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mclk", 0, | 967 | clk = clk_register_gate(NULL, "plgpio_clk", "ahb_clk", 0, |
968 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, | 968 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, |
969 | &_lock); | 969 | &_lock); |
970 | clk_register_clkdev(clk, NULL, "e2800000.gpio"); | 970 | clk_register_clkdev(clk, NULL, "e2800000.gpio"); |
971 | 971 | ||
972 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mclk", 0, | 972 | clk = clk_register_gate(NULL, "video_dec_clk", "ahb_clk", 0, |
973 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, | 973 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, |
974 | 0, &_lock); | 974 | 0, &_lock); |
975 | clk_register_clkdev(clk, NULL, "video_dec"); | 975 | clk_register_clkdev(clk, NULL, "video_dec"); |
976 | 976 | ||
977 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mclk", 0, | 977 | clk = clk_register_gate(NULL, "video_enc_clk", "ahb_clk", 0, |
978 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, | 978 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, |
979 | 0, &_lock); | 979 | 0, &_lock); |
980 | clk_register_clkdev(clk, NULL, "video_enc"); | 980 | clk_register_clkdev(clk, NULL, "video_enc"); |
981 | 981 | ||
982 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mclk", 0, | 982 | clk = clk_register_gate(NULL, "video_in_clk", "ahb_clk", 0, |
983 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, | 983 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, |
984 | &_lock); | 984 | &_lock); |
985 | clk_register_clkdev(clk, NULL, "spear_vip"); | 985 | clk_register_clkdev(clk, NULL, "spear_vip"); |
986 | 986 | ||
987 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mclk", 0, | 987 | clk = clk_register_gate(NULL, "cam0_clk", "ahb_clk", 0, |
988 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, | 988 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, |
989 | &_lock); | 989 | &_lock); |
990 | clk_register_clkdev(clk, NULL, "d0200000.cam0"); | 990 | clk_register_clkdev(clk, NULL, "d0200000.cam0"); |
991 | 991 | ||
992 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mclk", 0, | 992 | clk = clk_register_gate(NULL, "cam1_clk", "ahb_clk", 0, |
993 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, | 993 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, |
994 | &_lock); | 994 | &_lock); |
995 | clk_register_clkdev(clk, NULL, "d0300000.cam1"); | 995 | clk_register_clkdev(clk, NULL, "d0300000.cam1"); |
996 | 996 | ||
997 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mclk", 0, | 997 | clk = clk_register_gate(NULL, "cam2_clk", "ahb_clk", 0, |
998 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, | 998 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, |
999 | &_lock); | 999 | &_lock); |
1000 | clk_register_clkdev(clk, NULL, "d0400000.cam2"); | 1000 | clk_register_clkdev(clk, NULL, "d0400000.cam2"); |
1001 | 1001 | ||
1002 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mclk", 0, | 1002 | clk = clk_register_gate(NULL, "cam3_clk", "ahb_clk", 0, |
1003 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, | 1003 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, |
1004 | &_lock); | 1004 | &_lock); |
1005 | clk_register_clkdev(clk, NULL, "d0500000.cam3"); | 1005 | clk_register_clkdev(clk, NULL, "d0500000.cam3"); |
diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile new file mode 100644 index 000000000000..b5bac917612c --- /dev/null +++ b/drivers/clk/sunxi/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for sunxi specific clk | ||
3 | # | ||
4 | |||
5 | obj-y += clk-sunxi.o clk-factors.o | ||
diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c new file mode 100644 index 000000000000..88523f91d9b7 --- /dev/null +++ b/drivers/clk/sunxi/clk-factors.c | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Emilio López <emilio@elopez.com.ar> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Adjustable factor-based clock implementation | ||
9 | */ | ||
10 | |||
11 | #include <linux/clk-provider.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/string.h> | ||
17 | |||
18 | #include <linux/delay.h> | ||
19 | |||
20 | #include "clk-factors.h" | ||
21 | |||
22 | /* | ||
23 | * DOC: basic adjustable factor-based clock that cannot gate | ||
24 | * | ||
25 | * Traits of this clock: | ||
26 | * prepare - clk_prepare only ensures that parents are prepared | ||
27 | * enable - clk_enable only ensures that parents are enabled | ||
28 | * rate - rate is adjustable. | ||
29 | * clk->rate = (parent->rate * N * (K + 1) >> P) / (M + 1) | ||
30 | * parent - fixed parent. No clk_set_parent support | ||
31 | */ | ||
32 | |||
33 | struct clk_factors { | ||
34 | struct clk_hw hw; | ||
35 | void __iomem *reg; | ||
36 | struct clk_factors_config *config; | ||
37 | void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p); | ||
38 | spinlock_t *lock; | ||
39 | }; | ||
40 | |||
41 | #define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw) | ||
42 | |||
43 | #define SETMASK(len, pos) (((-1U) >> (31-len)) << (pos)) | ||
44 | #define CLRMASK(len, pos) (~(SETMASK(len, pos))) | ||
45 | #define FACTOR_GET(bit, len, reg) (((reg) & SETMASK(len, bit)) >> (bit)) | ||
46 | |||
47 | #define FACTOR_SET(bit, len, reg, val) \ | ||
48 | (((reg) & CLRMASK(len, bit)) | (val << (bit))) | ||
49 | |||
50 | static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, | ||
51 | unsigned long parent_rate) | ||
52 | { | ||
53 | u8 n = 1, k = 0, p = 0, m = 0; | ||
54 | u32 reg; | ||
55 | unsigned long rate; | ||
56 | struct clk_factors *factors = to_clk_factors(hw); | ||
57 | struct clk_factors_config *config = factors->config; | ||
58 | |||
59 | /* Fetch the register value */ | ||
60 | reg = readl(factors->reg); | ||
61 | |||
62 | /* Get each individual factor if applicable */ | ||
63 | if (config->nwidth != SUNXI_FACTORS_NOT_APPLICABLE) | ||
64 | n = FACTOR_GET(config->nshift, config->nwidth, reg); | ||
65 | if (config->kwidth != SUNXI_FACTORS_NOT_APPLICABLE) | ||
66 | k = FACTOR_GET(config->kshift, config->kwidth, reg); | ||
67 | if (config->mwidth != SUNXI_FACTORS_NOT_APPLICABLE) | ||
68 | m = FACTOR_GET(config->mshift, config->mwidth, reg); | ||
69 | if (config->pwidth != SUNXI_FACTORS_NOT_APPLICABLE) | ||
70 | p = FACTOR_GET(config->pshift, config->pwidth, reg); | ||
71 | |||
72 | /* Calculate the rate */ | ||
73 | rate = (parent_rate * n * (k + 1) >> p) / (m + 1); | ||
74 | |||
75 | return rate; | ||
76 | } | ||
77 | |||
78 | static long clk_factors_round_rate(struct clk_hw *hw, unsigned long rate, | ||
79 | unsigned long *parent_rate) | ||
80 | { | ||
81 | struct clk_factors *factors = to_clk_factors(hw); | ||
82 | factors->get_factors((u32 *)&rate, (u32)*parent_rate, | ||
83 | NULL, NULL, NULL, NULL); | ||
84 | |||
85 | return rate; | ||
86 | } | ||
87 | |||
88 | static int clk_factors_set_rate(struct clk_hw *hw, unsigned long rate, | ||
89 | unsigned long parent_rate) | ||
90 | { | ||
91 | u8 n, k, m, p; | ||
92 | u32 reg; | ||
93 | struct clk_factors *factors = to_clk_factors(hw); | ||
94 | struct clk_factors_config *config = factors->config; | ||
95 | unsigned long flags = 0; | ||
96 | |||
97 | factors->get_factors((u32 *)&rate, (u32)parent_rate, &n, &k, &m, &p); | ||
98 | |||
99 | if (factors->lock) | ||
100 | spin_lock_irqsave(factors->lock, flags); | ||
101 | |||
102 | /* Fetch the register value */ | ||
103 | reg = readl(factors->reg); | ||
104 | |||
105 | /* Set up the new factors - macros do not do anything if width is 0 */ | ||
106 | reg = FACTOR_SET(config->nshift, config->nwidth, reg, n); | ||
107 | reg = FACTOR_SET(config->kshift, config->kwidth, reg, k); | ||
108 | reg = FACTOR_SET(config->mshift, config->mwidth, reg, m); | ||
109 | reg = FACTOR_SET(config->pshift, config->pwidth, reg, p); | ||
110 | |||
111 | /* Apply them now */ | ||
112 | writel(reg, factors->reg); | ||
113 | |||
114 | /* delay 500us so pll stabilizes */ | ||
115 | __delay((rate >> 20) * 500 / 2); | ||
116 | |||
117 | if (factors->lock) | ||
118 | spin_unlock_irqrestore(factors->lock, flags); | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static const struct clk_ops clk_factors_ops = { | ||
124 | .recalc_rate = clk_factors_recalc_rate, | ||
125 | .round_rate = clk_factors_round_rate, | ||
126 | .set_rate = clk_factors_set_rate, | ||
127 | }; | ||
128 | |||
129 | /** | ||
130 | * clk_register_factors - register a factors clock with | ||
131 | * the clock framework | ||
132 | * @dev: device registering this clock | ||
133 | * @name: name of this clock | ||
134 | * @parent_name: name of clock's parent | ||
135 | * @flags: framework-specific flags | ||
136 | * @reg: register address to adjust factors | ||
137 | * @config: shift and width of factors n, k, m and p | ||
138 | * @get_factors: function to calculate the factors for a given frequency | ||
139 | * @lock: shared register lock for this clock | ||
140 | */ | ||
141 | struct clk *clk_register_factors(struct device *dev, const char *name, | ||
142 | const char *parent_name, | ||
143 | unsigned long flags, void __iomem *reg, | ||
144 | struct clk_factors_config *config, | ||
145 | void (*get_factors)(u32 *rate, u32 parent, | ||
146 | u8 *n, u8 *k, u8 *m, u8 *p), | ||
147 | spinlock_t *lock) | ||
148 | { | ||
149 | struct clk_factors *factors; | ||
150 | struct clk *clk; | ||
151 | struct clk_init_data init; | ||
152 | |||
153 | /* allocate the factors */ | ||
154 | factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL); | ||
155 | if (!factors) { | ||
156 | pr_err("%s: could not allocate factors clk\n", __func__); | ||
157 | return ERR_PTR(-ENOMEM); | ||
158 | } | ||
159 | |||
160 | init.name = name; | ||
161 | init.ops = &clk_factors_ops; | ||
162 | init.flags = flags; | ||
163 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
164 | init.num_parents = (parent_name ? 1 : 0); | ||
165 | |||
166 | /* struct clk_factors assignments */ | ||
167 | factors->reg = reg; | ||
168 | factors->config = config; | ||
169 | factors->lock = lock; | ||
170 | factors->hw.init = &init; | ||
171 | factors->get_factors = get_factors; | ||
172 | |||
173 | /* register the clock */ | ||
174 | clk = clk_register(dev, &factors->hw); | ||
175 | |||
176 | if (IS_ERR(clk)) | ||
177 | kfree(factors); | ||
178 | |||
179 | return clk; | ||
180 | } | ||
diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h new file mode 100644 index 000000000000..f49851cc4380 --- /dev/null +++ b/drivers/clk/sunxi/clk-factors.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __MACH_SUNXI_CLK_FACTORS_H | ||
2 | #define __MACH_SUNXI_CLK_FACTORS_H | ||
3 | |||
4 | #include <linux/clk-provider.h> | ||
5 | #include <linux/clkdev.h> | ||
6 | |||
7 | #define SUNXI_FACTORS_NOT_APPLICABLE (0) | ||
8 | |||
9 | struct clk_factors_config { | ||
10 | u8 nshift; | ||
11 | u8 nwidth; | ||
12 | u8 kshift; | ||
13 | u8 kwidth; | ||
14 | u8 mshift; | ||
15 | u8 mwidth; | ||
16 | u8 pshift; | ||
17 | u8 pwidth; | ||
18 | }; | ||
19 | |||
20 | struct clk *clk_register_factors(struct device *dev, const char *name, | ||
21 | const char *parent_name, | ||
22 | unsigned long flags, void __iomem *reg, | ||
23 | struct clk_factors_config *config, | ||
24 | void (*get_factors) (u32 *rate, u32 parent_rate, | ||
25 | u8 *n, u8 *k, u8 *m, u8 *p), | ||
26 | spinlock_t *lock); | ||
27 | #endif | ||
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c new file mode 100644 index 000000000000..d528a2496690 --- /dev/null +++ b/drivers/clk/sunxi/clk-sunxi.c | |||
@@ -0,0 +1,362 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Emilio López | ||
3 | * | ||
4 | * Emilio López <emilio@elopez.com.ar> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/clk-provider.h> | ||
18 | #include <linux/clkdev.h> | ||
19 | #include <linux/clk/sunxi.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | |||
23 | #include "clk-factors.h" | ||
24 | |||
25 | static DEFINE_SPINLOCK(clk_lock); | ||
26 | |||
27 | /** | ||
28 | * sunxi_osc_clk_setup() - Setup function for gatable oscillator | ||
29 | */ | ||
30 | |||
31 | #define SUNXI_OSC24M_GATE 0 | ||
32 | |||
33 | static void __init sunxi_osc_clk_setup(struct device_node *node) | ||
34 | { | ||
35 | struct clk *clk; | ||
36 | const char *clk_name = node->name; | ||
37 | const char *parent; | ||
38 | void *reg; | ||
39 | |||
40 | reg = of_iomap(node, 0); | ||
41 | |||
42 | parent = of_clk_get_parent_name(node, 0); | ||
43 | |||
44 | clk = clk_register_gate(NULL, clk_name, parent, CLK_IGNORE_UNUSED, | ||
45 | reg, SUNXI_OSC24M_GATE, 0, &clk_lock); | ||
46 | |||
47 | if (clk) { | ||
48 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
49 | clk_register_clkdev(clk, clk_name, NULL); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | |||
54 | |||
55 | /** | ||
56 | * sunxi_get_pll1_factors() - calculates n, k, m, p factors for PLL1 | ||
57 | * PLL1 rate is calculated as follows | ||
58 | * rate = (parent_rate * n * (k + 1) >> p) / (m + 1); | ||
59 | * parent_rate is always 24Mhz | ||
60 | */ | ||
61 | |||
62 | static void sunxi_get_pll1_factors(u32 *freq, u32 parent_rate, | ||
63 | u8 *n, u8 *k, u8 *m, u8 *p) | ||
64 | { | ||
65 | u8 div; | ||
66 | |||
67 | /* Normalize value to a 6M multiple */ | ||
68 | div = *freq / 6000000; | ||
69 | *freq = 6000000 * div; | ||
70 | |||
71 | /* we were called to round the frequency, we can now return */ | ||
72 | if (n == NULL) | ||
73 | return; | ||
74 | |||
75 | /* m is always zero for pll1 */ | ||
76 | *m = 0; | ||
77 | |||
78 | /* k is 1 only on these cases */ | ||
79 | if (*freq >= 768000000 || *freq == 42000000 || *freq == 54000000) | ||
80 | *k = 1; | ||
81 | else | ||
82 | *k = 0; | ||
83 | |||
84 | /* p will be 3 for divs under 10 */ | ||
85 | if (div < 10) | ||
86 | *p = 3; | ||
87 | |||
88 | /* p will be 2 for divs between 10 - 20 and odd divs under 32 */ | ||
89 | else if (div < 20 || (div < 32 && (div & 1))) | ||
90 | *p = 2; | ||
91 | |||
92 | /* p will be 1 for even divs under 32, divs under 40 and odd pairs | ||
93 | * of divs between 40-62 */ | ||
94 | else if (div < 40 || (div < 64 && (div & 2))) | ||
95 | *p = 1; | ||
96 | |||
97 | /* any other entries have p = 0 */ | ||
98 | else | ||
99 | *p = 0; | ||
100 | |||
101 | /* calculate a suitable n based on k and p */ | ||
102 | div <<= *p; | ||
103 | div /= (*k + 1); | ||
104 | *n = div / 4; | ||
105 | } | ||
106 | |||
107 | |||
108 | |||
109 | /** | ||
110 | * sunxi_get_apb1_factors() - calculates m, p factors for APB1 | ||
111 | * APB1 rate is calculated as follows | ||
112 | * rate = (parent_rate >> p) / (m + 1); | ||
113 | */ | ||
114 | |||
115 | static void sunxi_get_apb1_factors(u32 *freq, u32 parent_rate, | ||
116 | u8 *n, u8 *k, u8 *m, u8 *p) | ||
117 | { | ||
118 | u8 calcm, calcp; | ||
119 | |||
120 | if (parent_rate < *freq) | ||
121 | *freq = parent_rate; | ||
122 | |||
123 | parent_rate = (parent_rate + (*freq - 1)) / *freq; | ||
124 | |||
125 | /* Invalid rate! */ | ||
126 | if (parent_rate > 32) | ||
127 | return; | ||
128 | |||
129 | if (parent_rate <= 4) | ||
130 | calcp = 0; | ||
131 | else if (parent_rate <= 8) | ||
132 | calcp = 1; | ||
133 | else if (parent_rate <= 16) | ||
134 | calcp = 2; | ||
135 | else | ||
136 | calcp = 3; | ||
137 | |||
138 | calcm = (parent_rate >> calcp) - 1; | ||
139 | |||
140 | *freq = (parent_rate >> calcp) / (calcm + 1); | ||
141 | |||
142 | /* we were called to round the frequency, we can now return */ | ||
143 | if (n == NULL) | ||
144 | return; | ||
145 | |||
146 | *m = calcm; | ||
147 | *p = calcp; | ||
148 | } | ||
149 | |||
150 | |||
151 | |||
152 | /** | ||
153 | * sunxi_factors_clk_setup() - Setup function for factor clocks | ||
154 | */ | ||
155 | |||
156 | struct factors_data { | ||
157 | struct clk_factors_config *table; | ||
158 | void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p); | ||
159 | }; | ||
160 | |||
161 | static struct clk_factors_config pll1_config = { | ||
162 | .nshift = 8, | ||
163 | .nwidth = 5, | ||
164 | .kshift = 4, | ||
165 | .kwidth = 2, | ||
166 | .mshift = 0, | ||
167 | .mwidth = 2, | ||
168 | .pshift = 16, | ||
169 | .pwidth = 2, | ||
170 | }; | ||
171 | |||
172 | static struct clk_factors_config apb1_config = { | ||
173 | .mshift = 0, | ||
174 | .mwidth = 5, | ||
175 | .pshift = 16, | ||
176 | .pwidth = 2, | ||
177 | }; | ||
178 | |||
179 | static const __initconst struct factors_data pll1_data = { | ||
180 | .table = &pll1_config, | ||
181 | .getter = sunxi_get_pll1_factors, | ||
182 | }; | ||
183 | |||
184 | static const __initconst struct factors_data apb1_data = { | ||
185 | .table = &apb1_config, | ||
186 | .getter = sunxi_get_apb1_factors, | ||
187 | }; | ||
188 | |||
189 | static void __init sunxi_factors_clk_setup(struct device_node *node, | ||
190 | struct factors_data *data) | ||
191 | { | ||
192 | struct clk *clk; | ||
193 | const char *clk_name = node->name; | ||
194 | const char *parent; | ||
195 | void *reg; | ||
196 | |||
197 | reg = of_iomap(node, 0); | ||
198 | |||
199 | parent = of_clk_get_parent_name(node, 0); | ||
200 | |||
201 | clk = clk_register_factors(NULL, clk_name, parent, CLK_IGNORE_UNUSED, | ||
202 | reg, data->table, data->getter, &clk_lock); | ||
203 | |||
204 | if (clk) { | ||
205 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
206 | clk_register_clkdev(clk, clk_name, NULL); | ||
207 | } | ||
208 | } | ||
209 | |||
210 | |||
211 | |||
212 | /** | ||
213 | * sunxi_mux_clk_setup() - Setup function for muxes | ||
214 | */ | ||
215 | |||
216 | #define SUNXI_MUX_GATE_WIDTH 2 | ||
217 | |||
218 | struct mux_data { | ||
219 | u8 shift; | ||
220 | }; | ||
221 | |||
222 | static const __initconst struct mux_data cpu_data = { | ||
223 | .shift = 16, | ||
224 | }; | ||
225 | |||
226 | static const __initconst struct mux_data apb1_mux_data = { | ||
227 | .shift = 24, | ||
228 | }; | ||
229 | |||
230 | static void __init sunxi_mux_clk_setup(struct device_node *node, | ||
231 | struct mux_data *data) | ||
232 | { | ||
233 | struct clk *clk; | ||
234 | const char *clk_name = node->name; | ||
235 | const char **parents = kmalloc(sizeof(char *) * 5, GFP_KERNEL); | ||
236 | void *reg; | ||
237 | int i = 0; | ||
238 | |||
239 | reg = of_iomap(node, 0); | ||
240 | |||
241 | while (i < 5 && (parents[i] = of_clk_get_parent_name(node, i)) != NULL) | ||
242 | i++; | ||
243 | |||
244 | clk = clk_register_mux(NULL, clk_name, parents, i, 0, reg, | ||
245 | data->shift, SUNXI_MUX_GATE_WIDTH, | ||
246 | 0, &clk_lock); | ||
247 | |||
248 | if (clk) { | ||
249 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
250 | clk_register_clkdev(clk, clk_name, NULL); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | |||
255 | |||
256 | /** | ||
257 | * sunxi_divider_clk_setup() - Setup function for simple divider clocks | ||
258 | */ | ||
259 | |||
260 | #define SUNXI_DIVISOR_WIDTH 2 | ||
261 | |||
262 | struct div_data { | ||
263 | u8 shift; | ||
264 | u8 pow; | ||
265 | }; | ||
266 | |||
267 | static const __initconst struct div_data axi_data = { | ||
268 | .shift = 0, | ||
269 | .pow = 0, | ||
270 | }; | ||
271 | |||
272 | static const __initconst struct div_data ahb_data = { | ||
273 | .shift = 4, | ||
274 | .pow = 1, | ||
275 | }; | ||
276 | |||
277 | static const __initconst struct div_data apb0_data = { | ||
278 | .shift = 8, | ||
279 | .pow = 1, | ||
280 | }; | ||
281 | |||
282 | static void __init sunxi_divider_clk_setup(struct device_node *node, | ||
283 | struct div_data *data) | ||
284 | { | ||
285 | struct clk *clk; | ||
286 | const char *clk_name = node->name; | ||
287 | const char *clk_parent; | ||
288 | void *reg; | ||
289 | |||
290 | reg = of_iomap(node, 0); | ||
291 | |||
292 | clk_parent = of_clk_get_parent_name(node, 0); | ||
293 | |||
294 | clk = clk_register_divider(NULL, clk_name, clk_parent, 0, | ||
295 | reg, data->shift, SUNXI_DIVISOR_WIDTH, | ||
296 | data->pow ? CLK_DIVIDER_POWER_OF_TWO : 0, | ||
297 | &clk_lock); | ||
298 | if (clk) { | ||
299 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
300 | clk_register_clkdev(clk, clk_name, NULL); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | |||
305 | /* Matches for of_clk_init */ | ||
306 | static const __initconst struct of_device_id clk_match[] = { | ||
307 | {.compatible = "fixed-clock", .data = of_fixed_clk_setup,}, | ||
308 | {.compatible = "allwinner,sun4i-osc-clk", .data = sunxi_osc_clk_setup,}, | ||
309 | {} | ||
310 | }; | ||
311 | |||
312 | /* Matches for factors clocks */ | ||
313 | static const __initconst struct of_device_id clk_factors_match[] = { | ||
314 | {.compatible = "allwinner,sun4i-pll1-clk", .data = &pll1_data,}, | ||
315 | {.compatible = "allwinner,sun4i-apb1-clk", .data = &apb1_data,}, | ||
316 | {} | ||
317 | }; | ||
318 | |||
319 | /* Matches for divider clocks */ | ||
320 | static const __initconst struct of_device_id clk_div_match[] = { | ||
321 | {.compatible = "allwinner,sun4i-axi-clk", .data = &axi_data,}, | ||
322 | {.compatible = "allwinner,sun4i-ahb-clk", .data = &ahb_data,}, | ||
323 | {.compatible = "allwinner,sun4i-apb0-clk", .data = &apb0_data,}, | ||
324 | {} | ||
325 | }; | ||
326 | |||
327 | /* Matches for mux clocks */ | ||
328 | static const __initconst struct of_device_id clk_mux_match[] = { | ||
329 | {.compatible = "allwinner,sun4i-cpu-clk", .data = &cpu_data,}, | ||
330 | {.compatible = "allwinner,sun4i-apb1-mux-clk", .data = &apb1_mux_data,}, | ||
331 | {} | ||
332 | }; | ||
333 | |||
334 | static void __init of_sunxi_table_clock_setup(const struct of_device_id *clk_match, | ||
335 | void *function) | ||
336 | { | ||
337 | struct device_node *np; | ||
338 | const struct div_data *data; | ||
339 | const struct of_device_id *match; | ||
340 | void (*setup_function)(struct device_node *, const void *) = function; | ||
341 | |||
342 | for_each_matching_node(np, clk_match) { | ||
343 | match = of_match_node(clk_match, np); | ||
344 | data = match->data; | ||
345 | setup_function(np, data); | ||
346 | } | ||
347 | } | ||
348 | |||
349 | void __init sunxi_init_clocks(void) | ||
350 | { | ||
351 | /* Register all the simple sunxi clocks on DT */ | ||
352 | of_clk_init(clk_match); | ||
353 | |||
354 | /* Register factor clocks */ | ||
355 | of_sunxi_table_clock_setup(clk_factors_match, sunxi_factors_clk_setup); | ||
356 | |||
357 | /* Register divider clocks */ | ||
358 | of_sunxi_table_clock_setup(clk_div_match, sunxi_divider_clk_setup); | ||
359 | |||
360 | /* Register mux clocks */ | ||
361 | of_sunxi_table_clock_setup(clk_mux_match, sunxi_mux_clk_setup); | ||
362 | } | ||
diff --git a/drivers/clk/tegra/Makefile b/drivers/clk/tegra/Makefile index 2b41b0f4f731..f49fac2d193a 100644 --- a/drivers/clk/tegra/Makefile +++ b/drivers/clk/tegra/Makefile | |||
@@ -9,3 +9,4 @@ obj-y += clk-super.o | |||
9 | 9 | ||
10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o | 10 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o |
11 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o | 11 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o |
12 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o | ||
diff --git a/drivers/clk/tegra/clk-periph-gate.c b/drivers/clk/tegra/clk-periph-gate.c index 6dd533251e7b..bafee9895a24 100644 --- a/drivers/clk/tegra/clk-periph-gate.c +++ b/drivers/clk/tegra/clk-periph-gate.c | |||
@@ -41,7 +41,9 @@ static DEFINE_SPINLOCK(periph_ref_lock); | |||
41 | #define write_rst_clr(val, gate) \ | 41 | #define write_rst_clr(val, gate) \ |
42 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) | 42 | writel_relaxed(val, gate->clk_base + (gate->regs->rst_clr_reg)) |
43 | 43 | ||
44 | #define periph_clk_to_bit(periph) (1 << (gate->clk_num % 32)) | 44 | #define periph_clk_to_bit(gate) (1 << (gate->clk_num % 32)) |
45 | |||
46 | #define LVL2_CLK_GATE_OVRE 0x554 | ||
45 | 47 | ||
46 | /* Peripheral gate clock ops */ | 48 | /* Peripheral gate clock ops */ |
47 | static int clk_periph_is_enabled(struct clk_hw *hw) | 49 | static int clk_periph_is_enabled(struct clk_hw *hw) |
@@ -83,6 +85,13 @@ static int clk_periph_enable(struct clk_hw *hw) | |||
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
88 | if (gate->flags & TEGRA_PERIPH_WAR_1005168) { | ||
89 | writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
90 | writel_relaxed(BIT(22), gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
91 | udelay(1); | ||
92 | writel_relaxed(0, gate->clk_base + LVL2_CLK_GATE_OVRE); | ||
93 | } | ||
94 | |||
86 | spin_unlock_irqrestore(&periph_ref_lock, flags); | 95 | spin_unlock_irqrestore(&periph_ref_lock, flags); |
87 | 96 | ||
88 | return 0; | 97 | return 0; |
diff --git a/drivers/clk/tegra/clk-periph.c b/drivers/clk/tegra/clk-periph.c index 788486e6331a..b2309d37a963 100644 --- a/drivers/clk/tegra/clk-periph.c +++ b/drivers/clk/tegra/clk-periph.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/clk-provider.h> | 18 | #include <linux/clk-provider.h> |
19 | #include <linux/export.h> | ||
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/err.h> | 21 | #include <linux/err.h> |
21 | 22 | ||
@@ -128,6 +129,7 @@ void tegra_periph_reset_deassert(struct clk *c) | |||
128 | 129 | ||
129 | tegra_periph_reset(gate, 0); | 130 | tegra_periph_reset(gate, 0); |
130 | } | 131 | } |
132 | EXPORT_SYMBOL(tegra_periph_reset_deassert); | ||
131 | 133 | ||
132 | void tegra_periph_reset_assert(struct clk *c) | 134 | void tegra_periph_reset_assert(struct clk *c) |
133 | { | 135 | { |
@@ -147,6 +149,7 @@ void tegra_periph_reset_assert(struct clk *c) | |||
147 | 149 | ||
148 | tegra_periph_reset(gate, 1); | 150 | tegra_periph_reset(gate, 1); |
149 | } | 151 | } |
152 | EXPORT_SYMBOL(tegra_periph_reset_assert); | ||
150 | 153 | ||
151 | const struct clk_ops tegra_clk_periph_ops = { | 154 | const struct clk_ops tegra_clk_periph_ops = { |
152 | .get_parent = clk_periph_get_parent, | 155 | .get_parent = clk_periph_get_parent, |
@@ -170,14 +173,15 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = { | |||
170 | static struct clk *_tegra_clk_register_periph(const char *name, | 173 | static struct clk *_tegra_clk_register_periph(const char *name, |
171 | const char **parent_names, int num_parents, | 174 | const char **parent_names, int num_parents, |
172 | struct tegra_clk_periph *periph, | 175 | struct tegra_clk_periph *periph, |
173 | void __iomem *clk_base, u32 offset, bool div) | 176 | void __iomem *clk_base, u32 offset, bool div, |
177 | unsigned long flags) | ||
174 | { | 178 | { |
175 | struct clk *clk; | 179 | struct clk *clk; |
176 | struct clk_init_data init; | 180 | struct clk_init_data init; |
177 | 181 | ||
178 | init.name = name; | 182 | init.name = name; |
179 | init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; | 183 | init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; |
180 | init.flags = div ? 0 : CLK_SET_RATE_PARENT; | 184 | init.flags = flags; |
181 | init.parent_names = parent_names; | 185 | init.parent_names = parent_names; |
182 | init.num_parents = num_parents; | 186 | init.num_parents = num_parents; |
183 | 187 | ||
@@ -202,10 +206,10 @@ static struct clk *_tegra_clk_register_periph(const char *name, | |||
202 | struct clk *tegra_clk_register_periph(const char *name, | 206 | struct clk *tegra_clk_register_periph(const char *name, |
203 | const char **parent_names, int num_parents, | 207 | const char **parent_names, int num_parents, |
204 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 208 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
205 | u32 offset) | 209 | u32 offset, unsigned long flags) |
206 | { | 210 | { |
207 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 211 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
208 | periph, clk_base, offset, true); | 212 | periph, clk_base, offset, true, flags); |
209 | } | 213 | } |
210 | 214 | ||
211 | struct clk *tegra_clk_register_periph_nodiv(const char *name, | 215 | struct clk *tegra_clk_register_periph_nodiv(const char *name, |
@@ -214,5 +218,5 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, | |||
214 | u32 offset) | 218 | u32 offset) |
215 | { | 219 | { |
216 | return _tegra_clk_register_periph(name, parent_names, num_parents, | 220 | return _tegra_clk_register_periph(name, parent_names, num_parents, |
217 | periph, clk_base, offset, false); | 221 | periph, clk_base, offset, false, CLK_SET_RATE_PARENT); |
218 | } | 222 | } |
diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index 165f24734c1b..17c2cc086eb4 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -79,6 +79,48 @@ | |||
79 | #define PLLE_SS_CTRL 0x68 | 79 | #define PLLE_SS_CTRL 0x68 |
80 | #define PLLE_SS_DISABLE (7 << 10) | 80 | #define PLLE_SS_DISABLE (7 << 10) |
81 | 81 | ||
82 | #define PLLE_AUX_PLLP_SEL BIT(2) | ||
83 | #define PLLE_AUX_ENABLE_SWCTL BIT(4) | ||
84 | #define PLLE_AUX_SEQ_ENABLE BIT(24) | ||
85 | #define PLLE_AUX_PLLRE_SEL BIT(28) | ||
86 | |||
87 | #define PLLE_MISC_PLLE_PTS BIT(8) | ||
88 | #define PLLE_MISC_IDDQ_SW_VALUE BIT(13) | ||
89 | #define PLLE_MISC_IDDQ_SW_CTRL BIT(14) | ||
90 | #define PLLE_MISC_VREG_BG_CTRL_SHIFT 4 | ||
91 | #define PLLE_MISC_VREG_BG_CTRL_MASK (3 << PLLE_MISC_VREG_BG_CTRL_SHIFT) | ||
92 | #define PLLE_MISC_VREG_CTRL_SHIFT 2 | ||
93 | #define PLLE_MISC_VREG_CTRL_MASK (2 << PLLE_MISC_VREG_CTRL_SHIFT) | ||
94 | |||
95 | #define PLLCX_MISC_STROBE BIT(31) | ||
96 | #define PLLCX_MISC_RESET BIT(30) | ||
97 | #define PLLCX_MISC_SDM_DIV_SHIFT 28 | ||
98 | #define PLLCX_MISC_SDM_DIV_MASK (0x3 << PLLCX_MISC_SDM_DIV_SHIFT) | ||
99 | #define PLLCX_MISC_FILT_DIV_SHIFT 26 | ||
100 | #define PLLCX_MISC_FILT_DIV_MASK (0x3 << PLLCX_MISC_FILT_DIV_SHIFT) | ||
101 | #define PLLCX_MISC_ALPHA_SHIFT 18 | ||
102 | #define PLLCX_MISC_DIV_LOW_RANGE \ | ||
103 | ((0x1 << PLLCX_MISC_SDM_DIV_SHIFT) | \ | ||
104 | (0x1 << PLLCX_MISC_FILT_DIV_SHIFT)) | ||
105 | #define PLLCX_MISC_DIV_HIGH_RANGE \ | ||
106 | ((0x2 << PLLCX_MISC_SDM_DIV_SHIFT) | \ | ||
107 | (0x2 << PLLCX_MISC_FILT_DIV_SHIFT)) | ||
108 | #define PLLCX_MISC_COEF_LOW_RANGE \ | ||
109 | ((0x14 << PLLCX_MISC_KA_SHIFT) | (0x38 << PLLCX_MISC_KB_SHIFT)) | ||
110 | #define PLLCX_MISC_KA_SHIFT 2 | ||
111 | #define PLLCX_MISC_KB_SHIFT 9 | ||
112 | #define PLLCX_MISC_DEFAULT (PLLCX_MISC_COEF_LOW_RANGE | \ | ||
113 | (0x19 << PLLCX_MISC_ALPHA_SHIFT) | \ | ||
114 | PLLCX_MISC_DIV_LOW_RANGE | \ | ||
115 | PLLCX_MISC_RESET) | ||
116 | #define PLLCX_MISC1_DEFAULT 0x000d2308 | ||
117 | #define PLLCX_MISC2_DEFAULT 0x30211200 | ||
118 | #define PLLCX_MISC3_DEFAULT 0x200 | ||
119 | |||
120 | #define PMC_PLLM_WB0_OVERRIDE 0x1dc | ||
121 | #define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 | ||
122 | #define PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK BIT(27) | ||
123 | |||
82 | #define PMC_SATA_PWRGT 0x1ac | 124 | #define PMC_SATA_PWRGT 0x1ac |
83 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) | 125 | #define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5) |
84 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) | 126 | #define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) |
@@ -101,6 +143,24 @@ | |||
101 | #define divn_max(p) (divn_mask(p)) | 143 | #define divn_max(p) (divn_mask(p)) |
102 | #define divp_max(p) (1 << (divp_mask(p))) | 144 | #define divp_max(p) (1 << (divp_mask(p))) |
103 | 145 | ||
146 | |||
147 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
148 | /* PLLXC has 4-bit PDIV, but entry 15 is not allowed in h/w */ | ||
149 | #define PLLXC_PDIV_MAX 14 | ||
150 | |||
151 | /* non-monotonic mapping below is not a typo */ | ||
152 | static u8 pllxc_p[PLLXC_PDIV_MAX + 1] = { | ||
153 | /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ | ||
154 | /* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32 | ||
155 | }; | ||
156 | |||
157 | #define PLLCX_PDIV_MAX 7 | ||
158 | static u8 pllcx_p[PLLCX_PDIV_MAX + 1] = { | ||
159 | /* PDIV: 0, 1, 2, 3, 4, 5, 6, 7 */ | ||
160 | /* p: */ 1, 2, 3, 4, 6, 8, 12, 16 | ||
161 | }; | ||
162 | #endif | ||
163 | |||
104 | static void clk_pll_enable_lock(struct tegra_clk_pll *pll) | 164 | static void clk_pll_enable_lock(struct tegra_clk_pll *pll) |
105 | { | 165 | { |
106 | u32 val; | 166 | u32 val; |
@@ -108,25 +168,36 @@ static void clk_pll_enable_lock(struct tegra_clk_pll *pll) | |||
108 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) | 168 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) |
109 | return; | 169 | return; |
110 | 170 | ||
171 | if (!(pll->flags & TEGRA_PLL_HAS_LOCK_ENABLE)) | ||
172 | return; | ||
173 | |||
111 | val = pll_readl_misc(pll); | 174 | val = pll_readl_misc(pll); |
112 | val |= BIT(pll->params->lock_enable_bit_idx); | 175 | val |= BIT(pll->params->lock_enable_bit_idx); |
113 | pll_writel_misc(val, pll); | 176 | pll_writel_misc(val, pll); |
114 | } | 177 | } |
115 | 178 | ||
116 | static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll, | 179 | static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll) |
117 | void __iomem *lock_addr, u32 lock_bit_idx) | ||
118 | { | 180 | { |
119 | int i; | 181 | int i; |
120 | u32 val; | 182 | u32 val, lock_mask; |
183 | void __iomem *lock_addr; | ||
121 | 184 | ||
122 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { | 185 | if (!(pll->flags & TEGRA_PLL_USE_LOCK)) { |
123 | udelay(pll->params->lock_delay); | 186 | udelay(pll->params->lock_delay); |
124 | return 0; | 187 | return 0; |
125 | } | 188 | } |
126 | 189 | ||
190 | lock_addr = pll->clk_base; | ||
191 | if (pll->flags & TEGRA_PLL_LOCK_MISC) | ||
192 | lock_addr += pll->params->misc_reg; | ||
193 | else | ||
194 | lock_addr += pll->params->base_reg; | ||
195 | |||
196 | lock_mask = pll->params->lock_mask; | ||
197 | |||
127 | for (i = 0; i < pll->params->lock_delay; i++) { | 198 | for (i = 0; i < pll->params->lock_delay; i++) { |
128 | val = readl_relaxed(lock_addr); | 199 | val = readl_relaxed(lock_addr); |
129 | if (val & BIT(lock_bit_idx)) { | 200 | if ((val & lock_mask) == lock_mask) { |
130 | udelay(PLL_POST_LOCK_DELAY); | 201 | udelay(PLL_POST_LOCK_DELAY); |
131 | return 0; | 202 | return 0; |
132 | } | 203 | } |
@@ -155,7 +226,7 @@ static int clk_pll_is_enabled(struct clk_hw *hw) | |||
155 | return val & PLL_BASE_ENABLE ? 1 : 0; | 226 | return val & PLL_BASE_ENABLE ? 1 : 0; |
156 | } | 227 | } |
157 | 228 | ||
158 | static int _clk_pll_enable(struct clk_hw *hw) | 229 | static void _clk_pll_enable(struct clk_hw *hw) |
159 | { | 230 | { |
160 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 231 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
161 | u32 val; | 232 | u32 val; |
@@ -163,7 +234,8 @@ static int _clk_pll_enable(struct clk_hw *hw) | |||
163 | clk_pll_enable_lock(pll); | 234 | clk_pll_enable_lock(pll); |
164 | 235 | ||
165 | val = pll_readl_base(pll); | 236 | val = pll_readl_base(pll); |
166 | val &= ~PLL_BASE_BYPASS; | 237 | if (pll->flags & TEGRA_PLL_BYPASS) |
238 | val &= ~PLL_BASE_BYPASS; | ||
167 | val |= PLL_BASE_ENABLE; | 239 | val |= PLL_BASE_ENABLE; |
168 | pll_writel_base(val, pll); | 240 | pll_writel_base(val, pll); |
169 | 241 | ||
@@ -172,11 +244,6 @@ static int _clk_pll_enable(struct clk_hw *hw) | |||
172 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; | 244 | val |= PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE; |
173 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); | 245 | writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE); |
174 | } | 246 | } |
175 | |||
176 | clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->base_reg, | ||
177 | pll->params->lock_bit_idx); | ||
178 | |||
179 | return 0; | ||
180 | } | 247 | } |
181 | 248 | ||
182 | static void _clk_pll_disable(struct clk_hw *hw) | 249 | static void _clk_pll_disable(struct clk_hw *hw) |
@@ -185,7 +252,9 @@ static void _clk_pll_disable(struct clk_hw *hw) | |||
185 | u32 val; | 252 | u32 val; |
186 | 253 | ||
187 | val = pll_readl_base(pll); | 254 | val = pll_readl_base(pll); |
188 | val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); | 255 | if (pll->flags & TEGRA_PLL_BYPASS) |
256 | val &= ~PLL_BASE_BYPASS; | ||
257 | val &= ~PLL_BASE_ENABLE; | ||
189 | pll_writel_base(val, pll); | 258 | pll_writel_base(val, pll); |
190 | 259 | ||
191 | if (pll->flags & TEGRA_PLLM) { | 260 | if (pll->flags & TEGRA_PLLM) { |
@@ -204,7 +273,9 @@ static int clk_pll_enable(struct clk_hw *hw) | |||
204 | if (pll->lock) | 273 | if (pll->lock) |
205 | spin_lock_irqsave(pll->lock, flags); | 274 | spin_lock_irqsave(pll->lock, flags); |
206 | 275 | ||
207 | ret = _clk_pll_enable(hw); | 276 | _clk_pll_enable(hw); |
277 | |||
278 | ret = clk_pll_wait_for_lock(pll); | ||
208 | 279 | ||
209 | if (pll->lock) | 280 | if (pll->lock) |
210 | spin_unlock_irqrestore(pll->lock, flags); | 281 | spin_unlock_irqrestore(pll->lock, flags); |
@@ -241,8 +312,6 @@ static int _get_table_rate(struct clk_hw *hw, | |||
241 | if (sel->input_rate == 0) | 312 | if (sel->input_rate == 0) |
242 | return -EINVAL; | 313 | return -EINVAL; |
243 | 314 | ||
244 | BUG_ON(sel->p < 1); | ||
245 | |||
246 | cfg->input_rate = sel->input_rate; | 315 | cfg->input_rate = sel->input_rate; |
247 | cfg->output_rate = sel->output_rate; | 316 | cfg->output_rate = sel->output_rate; |
248 | cfg->m = sel->m; | 317 | cfg->m = sel->m; |
@@ -257,6 +326,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
257 | unsigned long rate, unsigned long parent_rate) | 326 | unsigned long rate, unsigned long parent_rate) |
258 | { | 327 | { |
259 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 328 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
329 | struct pdiv_map *p_tohw = pll->params->pdiv_tohw; | ||
260 | unsigned long cfreq; | 330 | unsigned long cfreq; |
261 | u32 p_div = 0; | 331 | u32 p_div = 0; |
262 | 332 | ||
@@ -290,88 +360,119 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | |||
290 | cfg->output_rate <<= 1) | 360 | cfg->output_rate <<= 1) |
291 | p_div++; | 361 | p_div++; |
292 | 362 | ||
293 | cfg->p = 1 << p_div; | ||
294 | cfg->m = parent_rate / cfreq; | 363 | cfg->m = parent_rate / cfreq; |
295 | cfg->n = cfg->output_rate / cfreq; | 364 | cfg->n = cfg->output_rate / cfreq; |
296 | cfg->cpcon = OUT_OF_TABLE_CPCON; | 365 | cfg->cpcon = OUT_OF_TABLE_CPCON; |
297 | 366 | ||
298 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || | 367 | if (cfg->m > divm_max(pll) || cfg->n > divn_max(pll) || |
299 | cfg->p > divp_max(pll) || cfg->output_rate > pll->params->vco_max) { | 368 | (1 << p_div) > divp_max(pll) |
369 | || cfg->output_rate > pll->params->vco_max) { | ||
300 | pr_err("%s: Failed to set %s rate %lu\n", | 370 | pr_err("%s: Failed to set %s rate %lu\n", |
301 | __func__, __clk_get_name(hw->clk), rate); | 371 | __func__, __clk_get_name(hw->clk), rate); |
302 | return -EINVAL; | 372 | return -EINVAL; |
303 | } | 373 | } |
304 | 374 | ||
375 | if (p_tohw) { | ||
376 | p_div = 1 << p_div; | ||
377 | while (p_tohw->pdiv) { | ||
378 | if (p_div <= p_tohw->pdiv) { | ||
379 | cfg->p = p_tohw->hw_val; | ||
380 | break; | ||
381 | } | ||
382 | p_tohw++; | ||
383 | } | ||
384 | if (!p_tohw->pdiv) | ||
385 | return -EINVAL; | ||
386 | } else | ||
387 | cfg->p = p_div; | ||
388 | |||
305 | return 0; | 389 | return 0; |
306 | } | 390 | } |
307 | 391 | ||
308 | static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | 392 | static void _update_pll_mnp(struct tegra_clk_pll *pll, |
309 | unsigned long rate) | 393 | struct tegra_clk_pll_freq_table *cfg) |
310 | { | 394 | { |
311 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 395 | u32 val; |
312 | unsigned long flags = 0; | ||
313 | u32 divp, val, old_base; | ||
314 | int state; | ||
315 | |||
316 | divp = __ffs(cfg->p); | ||
317 | |||
318 | if (pll->flags & TEGRA_PLLU) | ||
319 | divp ^= 1; | ||
320 | 396 | ||
321 | if (pll->lock) | 397 | val = pll_readl_base(pll); |
322 | spin_lock_irqsave(pll->lock, flags); | ||
323 | 398 | ||
324 | old_base = val = pll_readl_base(pll); | ||
325 | val &= ~((divm_mask(pll) << pll->divm_shift) | | 399 | val &= ~((divm_mask(pll) << pll->divm_shift) | |
326 | (divn_mask(pll) << pll->divn_shift) | | 400 | (divn_mask(pll) << pll->divn_shift) | |
327 | (divp_mask(pll) << pll->divp_shift)); | 401 | (divp_mask(pll) << pll->divp_shift)); |
328 | val |= ((cfg->m << pll->divm_shift) | | 402 | val |= ((cfg->m << pll->divm_shift) | |
329 | (cfg->n << pll->divn_shift) | | 403 | (cfg->n << pll->divn_shift) | |
330 | (divp << pll->divp_shift)); | 404 | (cfg->p << pll->divp_shift)); |
331 | if (val == old_base) { | 405 | |
332 | if (pll->lock) | 406 | pll_writel_base(val, pll); |
333 | spin_unlock_irqrestore(pll->lock, flags); | 407 | } |
334 | return 0; | 408 | |
409 | static void _get_pll_mnp(struct tegra_clk_pll *pll, | ||
410 | struct tegra_clk_pll_freq_table *cfg) | ||
411 | { | ||
412 | u32 val; | ||
413 | |||
414 | val = pll_readl_base(pll); | ||
415 | |||
416 | cfg->m = (val >> pll->divm_shift) & (divm_mask(pll)); | ||
417 | cfg->n = (val >> pll->divn_shift) & (divn_mask(pll)); | ||
418 | cfg->p = (val >> pll->divp_shift) & (divp_mask(pll)); | ||
419 | } | ||
420 | |||
421 | static void _update_pll_cpcon(struct tegra_clk_pll *pll, | ||
422 | struct tegra_clk_pll_freq_table *cfg, | ||
423 | unsigned long rate) | ||
424 | { | ||
425 | u32 val; | ||
426 | |||
427 | val = pll_readl_misc(pll); | ||
428 | |||
429 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); | ||
430 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; | ||
431 | |||
432 | if (pll->flags & TEGRA_PLL_SET_LFCON) { | ||
433 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); | ||
434 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) | ||
435 | val |= 1 << PLL_MISC_LFCON_SHIFT; | ||
436 | } else if (pll->flags & TEGRA_PLL_SET_DCCON) { | ||
437 | val &= ~(1 << PLL_MISC_DCCON_SHIFT); | ||
438 | if (rate >= (pll->params->vco_max >> 1)) | ||
439 | val |= 1 << PLL_MISC_DCCON_SHIFT; | ||
335 | } | 440 | } |
336 | 441 | ||
442 | pll_writel_misc(val, pll); | ||
443 | } | ||
444 | |||
445 | static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, | ||
446 | unsigned long rate) | ||
447 | { | ||
448 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
449 | int state, ret = 0; | ||
450 | |||
337 | state = clk_pll_is_enabled(hw); | 451 | state = clk_pll_is_enabled(hw); |
338 | 452 | ||
339 | if (state) { | 453 | if (state) |
340 | _clk_pll_disable(hw); | 454 | _clk_pll_disable(hw); |
341 | val &= ~(PLL_BASE_BYPASS | PLL_BASE_ENABLE); | ||
342 | } | ||
343 | pll_writel_base(val, pll); | ||
344 | 455 | ||
345 | if (pll->flags & TEGRA_PLL_HAS_CPCON) { | 456 | _update_pll_mnp(pll, cfg); |
346 | val = pll_readl_misc(pll); | ||
347 | val &= ~(PLL_MISC_CPCON_MASK << PLL_MISC_CPCON_SHIFT); | ||
348 | val |= cfg->cpcon << PLL_MISC_CPCON_SHIFT; | ||
349 | if (pll->flags & TEGRA_PLL_SET_LFCON) { | ||
350 | val &= ~(PLL_MISC_LFCON_MASK << PLL_MISC_LFCON_SHIFT); | ||
351 | if (cfg->n >= PLLDU_LFCON_SET_DIVN) | ||
352 | val |= 0x1 << PLL_MISC_LFCON_SHIFT; | ||
353 | } else if (pll->flags & TEGRA_PLL_SET_DCCON) { | ||
354 | val &= ~(0x1 << PLL_MISC_DCCON_SHIFT); | ||
355 | if (rate >= (pll->params->vco_max >> 1)) | ||
356 | val |= 0x1 << PLL_MISC_DCCON_SHIFT; | ||
357 | } | ||
358 | pll_writel_misc(val, pll); | ||
359 | } | ||
360 | 457 | ||
361 | if (pll->lock) | 458 | if (pll->flags & TEGRA_PLL_HAS_CPCON) |
362 | spin_unlock_irqrestore(pll->lock, flags); | 459 | _update_pll_cpcon(pll, cfg, rate); |
363 | 460 | ||
364 | if (state) | 461 | if (state) { |
365 | clk_pll_enable(hw); | 462 | _clk_pll_enable(hw); |
463 | ret = clk_pll_wait_for_lock(pll); | ||
464 | } | ||
366 | 465 | ||
367 | return 0; | 466 | return ret; |
368 | } | 467 | } |
369 | 468 | ||
370 | static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | 469 | static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, |
371 | unsigned long parent_rate) | 470 | unsigned long parent_rate) |
372 | { | 471 | { |
373 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 472 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
374 | struct tegra_clk_pll_freq_table cfg; | 473 | struct tegra_clk_pll_freq_table cfg, old_cfg; |
474 | unsigned long flags = 0; | ||
475 | int ret = 0; | ||
375 | 476 | ||
376 | if (pll->flags & TEGRA_PLL_FIXED) { | 477 | if (pll->flags & TEGRA_PLL_FIXED) { |
377 | if (rate != pll->fixed_rate) { | 478 | if (rate != pll->fixed_rate) { |
@@ -387,7 +488,18 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, | |||
387 | _calc_rate(hw, &cfg, rate, parent_rate)) | 488 | _calc_rate(hw, &cfg, rate, parent_rate)) |
388 | return -EINVAL; | 489 | return -EINVAL; |
389 | 490 | ||
390 | return _program_pll(hw, &cfg, rate); | 491 | if (pll->lock) |
492 | spin_lock_irqsave(pll->lock, flags); | ||
493 | |||
494 | _get_pll_mnp(pll, &old_cfg); | ||
495 | |||
496 | if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p) | ||
497 | ret = _program_pll(hw, &cfg, rate); | ||
498 | |||
499 | if (pll->lock) | ||
500 | spin_unlock_irqrestore(pll->lock, flags); | ||
501 | |||
502 | return ret; | ||
391 | } | 503 | } |
392 | 504 | ||
393 | static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | 505 | static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, |
@@ -409,7 +521,7 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, | |||
409 | return -EINVAL; | 521 | return -EINVAL; |
410 | 522 | ||
411 | output_rate *= cfg.n; | 523 | output_rate *= cfg.n; |
412 | do_div(output_rate, cfg.m * cfg.p); | 524 | do_div(output_rate, cfg.m * (1 << cfg.p)); |
413 | 525 | ||
414 | return output_rate; | 526 | return output_rate; |
415 | } | 527 | } |
@@ -418,11 +530,15 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | |||
418 | unsigned long parent_rate) | 530 | unsigned long parent_rate) |
419 | { | 531 | { |
420 | struct tegra_clk_pll *pll = to_clk_pll(hw); | 532 | struct tegra_clk_pll *pll = to_clk_pll(hw); |
421 | u32 val = pll_readl_base(pll); | 533 | struct tegra_clk_pll_freq_table cfg; |
422 | u32 divn = 0, divm = 0, divp = 0; | 534 | struct pdiv_map *p_tohw = pll->params->pdiv_tohw; |
535 | u32 val; | ||
423 | u64 rate = parent_rate; | 536 | u64 rate = parent_rate; |
537 | int pdiv; | ||
538 | |||
539 | val = pll_readl_base(pll); | ||
424 | 540 | ||
425 | if (val & PLL_BASE_BYPASS) | 541 | if ((pll->flags & TEGRA_PLL_BYPASS) && (val & PLL_BASE_BYPASS)) |
426 | return parent_rate; | 542 | return parent_rate; |
427 | 543 | ||
428 | if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { | 544 | if ((pll->flags & TEGRA_PLL_FIXED) && !(val & PLL_BASE_OVERRIDE)) { |
@@ -435,16 +551,29 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | |||
435 | return pll->fixed_rate; | 551 | return pll->fixed_rate; |
436 | } | 552 | } |
437 | 553 | ||
438 | divp = (val >> pll->divp_shift) & (divp_mask(pll)); | 554 | _get_pll_mnp(pll, &cfg); |
439 | if (pll->flags & TEGRA_PLLU) | ||
440 | divp ^= 1; | ||
441 | 555 | ||
442 | divn = (val >> pll->divn_shift) & (divn_mask(pll)); | 556 | if (p_tohw) { |
443 | divm = (val >> pll->divm_shift) & (divm_mask(pll)); | 557 | while (p_tohw->pdiv) { |
444 | divm *= (1 << divp); | 558 | if (cfg.p == p_tohw->hw_val) { |
559 | pdiv = p_tohw->pdiv; | ||
560 | break; | ||
561 | } | ||
562 | p_tohw++; | ||
563 | } | ||
564 | |||
565 | if (!p_tohw->pdiv) { | ||
566 | WARN_ON(1); | ||
567 | pdiv = 1; | ||
568 | } | ||
569 | } else | ||
570 | pdiv = 1 << cfg.p; | ||
571 | |||
572 | cfg.m *= pdiv; | ||
573 | |||
574 | rate *= cfg.n; | ||
575 | do_div(rate, cfg.m); | ||
445 | 576 | ||
446 | rate *= divn; | ||
447 | do_div(rate, divm); | ||
448 | return rate; | 577 | return rate; |
449 | } | 578 | } |
450 | 579 | ||
@@ -538,8 +667,8 @@ static int clk_plle_enable(struct clk_hw *hw) | |||
538 | val |= (PLL_BASE_BYPASS | PLL_BASE_ENABLE); | 667 | val |= (PLL_BASE_BYPASS | PLL_BASE_ENABLE); |
539 | pll_writel_base(val, pll); | 668 | pll_writel_base(val, pll); |
540 | 669 | ||
541 | clk_pll_wait_for_lock(pll, pll->clk_base + pll->params->misc_reg, | 670 | clk_pll_wait_for_lock(pll); |
542 | pll->params->lock_bit_idx); | 671 | |
543 | return 0; | 672 | return 0; |
544 | } | 673 | } |
545 | 674 | ||
@@ -577,28 +706,531 @@ const struct clk_ops tegra_clk_plle_ops = { | |||
577 | .enable = clk_plle_enable, | 706 | .enable = clk_plle_enable, |
578 | }; | 707 | }; |
579 | 708 | ||
580 | static struct clk *_tegra_clk_register_pll(const char *name, | 709 | #ifdef CONFIG_ARCH_TEGRA_114_SOC |
581 | const char *parent_name, void __iomem *clk_base, | 710 | |
582 | void __iomem *pmc, unsigned long flags, | 711 | static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params, |
583 | unsigned long fixed_rate, | 712 | unsigned long parent_rate) |
584 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 713 | { |
585 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock, | 714 | if (parent_rate > pll_params->cf_max) |
586 | const struct clk_ops *ops) | 715 | return 2; |
716 | else | ||
717 | return 1; | ||
718 | } | ||
719 | |||
720 | static int clk_pll_iddq_enable(struct clk_hw *hw) | ||
721 | { | ||
722 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
723 | unsigned long flags = 0; | ||
724 | |||
725 | u32 val; | ||
726 | int ret; | ||
727 | |||
728 | if (pll->lock) | ||
729 | spin_lock_irqsave(pll->lock, flags); | ||
730 | |||
731 | val = pll_readl(pll->params->iddq_reg, pll); | ||
732 | val &= ~BIT(pll->params->iddq_bit_idx); | ||
733 | pll_writel(val, pll->params->iddq_reg, pll); | ||
734 | udelay(2); | ||
735 | |||
736 | _clk_pll_enable(hw); | ||
737 | |||
738 | ret = clk_pll_wait_for_lock(pll); | ||
739 | |||
740 | if (pll->lock) | ||
741 | spin_unlock_irqrestore(pll->lock, flags); | ||
742 | |||
743 | return 0; | ||
744 | } | ||
745 | |||
746 | static void clk_pll_iddq_disable(struct clk_hw *hw) | ||
747 | { | ||
748 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
749 | unsigned long flags = 0; | ||
750 | u32 val; | ||
751 | |||
752 | if (pll->lock) | ||
753 | spin_lock_irqsave(pll->lock, flags); | ||
754 | |||
755 | _clk_pll_disable(hw); | ||
756 | |||
757 | val = pll_readl(pll->params->iddq_reg, pll); | ||
758 | val |= BIT(pll->params->iddq_bit_idx); | ||
759 | pll_writel(val, pll->params->iddq_reg, pll); | ||
760 | udelay(2); | ||
761 | |||
762 | if (pll->lock) | ||
763 | spin_unlock_irqrestore(pll->lock, flags); | ||
764 | } | ||
765 | |||
766 | static int _calc_dynamic_ramp_rate(struct clk_hw *hw, | ||
767 | struct tegra_clk_pll_freq_table *cfg, | ||
768 | unsigned long rate, unsigned long parent_rate) | ||
769 | { | ||
770 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
771 | unsigned int p; | ||
772 | |||
773 | if (!rate) | ||
774 | return -EINVAL; | ||
775 | |||
776 | p = DIV_ROUND_UP(pll->params->vco_min, rate); | ||
777 | cfg->m = _pll_fixed_mdiv(pll->params, parent_rate); | ||
778 | cfg->p = p; | ||
779 | cfg->output_rate = rate * cfg->p; | ||
780 | cfg->n = cfg->output_rate * cfg->m / parent_rate; | ||
781 | |||
782 | if (cfg->n > divn_max(pll) || cfg->output_rate > pll->params->vco_max) | ||
783 | return -EINVAL; | ||
784 | |||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static int _pll_ramp_calc_pll(struct clk_hw *hw, | ||
789 | struct tegra_clk_pll_freq_table *cfg, | ||
790 | unsigned long rate, unsigned long parent_rate) | ||
791 | { | ||
792 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
793 | int err = 0; | ||
794 | |||
795 | err = _get_table_rate(hw, cfg, rate, parent_rate); | ||
796 | if (err < 0) | ||
797 | err = _calc_dynamic_ramp_rate(hw, cfg, rate, parent_rate); | ||
798 | else if (cfg->m != _pll_fixed_mdiv(pll->params, parent_rate)) { | ||
799 | WARN_ON(1); | ||
800 | err = -EINVAL; | ||
801 | goto out; | ||
802 | } | ||
803 | |||
804 | if (!cfg->p || (cfg->p > pll->params->max_p)) | ||
805 | err = -EINVAL; | ||
806 | |||
807 | out: | ||
808 | return err; | ||
809 | } | ||
810 | |||
811 | static int clk_pllxc_set_rate(struct clk_hw *hw, unsigned long rate, | ||
812 | unsigned long parent_rate) | ||
813 | { | ||
814 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
815 | struct tegra_clk_pll_freq_table cfg, old_cfg; | ||
816 | unsigned long flags = 0; | ||
817 | int ret = 0; | ||
818 | u8 old_p; | ||
819 | |||
820 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
821 | if (ret < 0) | ||
822 | return ret; | ||
823 | |||
824 | if (pll->lock) | ||
825 | spin_lock_irqsave(pll->lock, flags); | ||
826 | |||
827 | _get_pll_mnp(pll, &old_cfg); | ||
828 | |||
829 | old_p = pllxc_p[old_cfg.p]; | ||
830 | if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_p != cfg.p) { | ||
831 | cfg.p -= 1; | ||
832 | ret = _program_pll(hw, &cfg, rate); | ||
833 | } | ||
834 | |||
835 | if (pll->lock) | ||
836 | spin_unlock_irqrestore(pll->lock, flags); | ||
837 | |||
838 | return ret; | ||
839 | } | ||
840 | |||
841 | static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate, | ||
842 | unsigned long *prate) | ||
843 | { | ||
844 | struct tegra_clk_pll_freq_table cfg; | ||
845 | int ret = 0; | ||
846 | u64 output_rate = *prate; | ||
847 | |||
848 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, *prate); | ||
849 | if (ret < 0) | ||
850 | return ret; | ||
851 | |||
852 | output_rate *= cfg.n; | ||
853 | do_div(output_rate, cfg.m * cfg.p); | ||
854 | |||
855 | return output_rate; | ||
856 | } | ||
857 | |||
858 | static int clk_pllm_set_rate(struct clk_hw *hw, unsigned long rate, | ||
859 | unsigned long parent_rate) | ||
860 | { | ||
861 | struct tegra_clk_pll_freq_table cfg; | ||
862 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
863 | unsigned long flags = 0; | ||
864 | int state, ret = 0; | ||
865 | u32 val; | ||
866 | |||
867 | if (pll->lock) | ||
868 | spin_lock_irqsave(pll->lock, flags); | ||
869 | |||
870 | state = clk_pll_is_enabled(hw); | ||
871 | if (state) { | ||
872 | if (rate != clk_get_rate(hw->clk)) { | ||
873 | pr_err("%s: Cannot change active PLLM\n", __func__); | ||
874 | ret = -EINVAL; | ||
875 | goto out; | ||
876 | } | ||
877 | goto out; | ||
878 | } | ||
879 | |||
880 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
881 | if (ret < 0) | ||
882 | goto out; | ||
883 | |||
884 | cfg.p -= 1; | ||
885 | |||
886 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
887 | if (val & PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE) { | ||
888 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); | ||
889 | val = cfg.p ? (val | PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK) : | ||
890 | (val & ~PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK); | ||
891 | writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE_2); | ||
892 | |||
893 | val = readl_relaxed(pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
894 | val &= ~(divn_mask(pll) | divm_mask(pll)); | ||
895 | val |= (cfg.m << pll->divm_shift) | (cfg.n << pll->divn_shift); | ||
896 | writel_relaxed(val, pll->pmc + PMC_PLLM_WB0_OVERRIDE); | ||
897 | } else | ||
898 | _update_pll_mnp(pll, &cfg); | ||
899 | |||
900 | |||
901 | out: | ||
902 | if (pll->lock) | ||
903 | spin_unlock_irqrestore(pll->lock, flags); | ||
904 | |||
905 | return ret; | ||
906 | } | ||
907 | |||
908 | static void _pllcx_strobe(struct tegra_clk_pll *pll) | ||
909 | { | ||
910 | u32 val; | ||
911 | |||
912 | val = pll_readl_misc(pll); | ||
913 | val |= PLLCX_MISC_STROBE; | ||
914 | pll_writel_misc(val, pll); | ||
915 | udelay(2); | ||
916 | |||
917 | val &= ~PLLCX_MISC_STROBE; | ||
918 | pll_writel_misc(val, pll); | ||
919 | } | ||
920 | |||
921 | static int clk_pllc_enable(struct clk_hw *hw) | ||
922 | { | ||
923 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
924 | u32 val; | ||
925 | int ret = 0; | ||
926 | unsigned long flags = 0; | ||
927 | |||
928 | if (pll->lock) | ||
929 | spin_lock_irqsave(pll->lock, flags); | ||
930 | |||
931 | _clk_pll_enable(hw); | ||
932 | udelay(2); | ||
933 | |||
934 | val = pll_readl_misc(pll); | ||
935 | val &= ~PLLCX_MISC_RESET; | ||
936 | pll_writel_misc(val, pll); | ||
937 | udelay(2); | ||
938 | |||
939 | _pllcx_strobe(pll); | ||
940 | |||
941 | ret = clk_pll_wait_for_lock(pll); | ||
942 | |||
943 | if (pll->lock) | ||
944 | spin_unlock_irqrestore(pll->lock, flags); | ||
945 | |||
946 | return ret; | ||
947 | } | ||
948 | |||
949 | static void _clk_pllc_disable(struct clk_hw *hw) | ||
950 | { | ||
951 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
952 | u32 val; | ||
953 | |||
954 | _clk_pll_disable(hw); | ||
955 | |||
956 | val = pll_readl_misc(pll); | ||
957 | val |= PLLCX_MISC_RESET; | ||
958 | pll_writel_misc(val, pll); | ||
959 | udelay(2); | ||
960 | } | ||
961 | |||
962 | static void clk_pllc_disable(struct clk_hw *hw) | ||
963 | { | ||
964 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
965 | unsigned long flags = 0; | ||
966 | |||
967 | if (pll->lock) | ||
968 | spin_lock_irqsave(pll->lock, flags); | ||
969 | |||
970 | _clk_pllc_disable(hw); | ||
971 | |||
972 | if (pll->lock) | ||
973 | spin_unlock_irqrestore(pll->lock, flags); | ||
974 | } | ||
975 | |||
976 | static int _pllcx_update_dynamic_coef(struct tegra_clk_pll *pll, | ||
977 | unsigned long input_rate, u32 n) | ||
978 | { | ||
979 | u32 val, n_threshold; | ||
980 | |||
981 | switch (input_rate) { | ||
982 | case 12000000: | ||
983 | n_threshold = 70; | ||
984 | break; | ||
985 | case 13000000: | ||
986 | case 26000000: | ||
987 | n_threshold = 71; | ||
988 | break; | ||
989 | case 16800000: | ||
990 | n_threshold = 55; | ||
991 | break; | ||
992 | case 19200000: | ||
993 | n_threshold = 48; | ||
994 | break; | ||
995 | default: | ||
996 | pr_err("%s: Unexpected reference rate %lu\n", | ||
997 | __func__, input_rate); | ||
998 | return -EINVAL; | ||
999 | } | ||
1000 | |||
1001 | val = pll_readl_misc(pll); | ||
1002 | val &= ~(PLLCX_MISC_SDM_DIV_MASK | PLLCX_MISC_FILT_DIV_MASK); | ||
1003 | val |= n <= n_threshold ? | ||
1004 | PLLCX_MISC_DIV_LOW_RANGE : PLLCX_MISC_DIV_HIGH_RANGE; | ||
1005 | pll_writel_misc(val, pll); | ||
1006 | |||
1007 | return 0; | ||
1008 | } | ||
1009 | |||
1010 | static int clk_pllc_set_rate(struct clk_hw *hw, unsigned long rate, | ||
1011 | unsigned long parent_rate) | ||
1012 | { | ||
1013 | struct tegra_clk_pll_freq_table cfg; | ||
1014 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1015 | unsigned long flags = 0; | ||
1016 | int state, ret = 0; | ||
1017 | u32 val; | ||
1018 | u16 old_m, old_n; | ||
1019 | u8 old_p; | ||
1020 | |||
1021 | if (pll->lock) | ||
1022 | spin_lock_irqsave(pll->lock, flags); | ||
1023 | |||
1024 | ret = _pll_ramp_calc_pll(hw, &cfg, rate, parent_rate); | ||
1025 | if (ret < 0) | ||
1026 | goto out; | ||
1027 | |||
1028 | val = pll_readl_base(pll); | ||
1029 | old_m = (val >> pll->divm_shift) & (divm_mask(pll)); | ||
1030 | old_n = (val >> pll->divn_shift) & (divn_mask(pll)); | ||
1031 | old_p = pllcx_p[(val >> pll->divp_shift) & (divp_mask(pll))]; | ||
1032 | |||
1033 | if (cfg.m != old_m) { | ||
1034 | WARN_ON(1); | ||
1035 | goto out; | ||
1036 | } | ||
1037 | |||
1038 | if (old_n == cfg.n && old_p == cfg.p) | ||
1039 | goto out; | ||
1040 | |||
1041 | cfg.p -= 1; | ||
1042 | |||
1043 | state = clk_pll_is_enabled(hw); | ||
1044 | if (state) | ||
1045 | _clk_pllc_disable(hw); | ||
1046 | |||
1047 | ret = _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); | ||
1048 | if (ret < 0) | ||
1049 | goto out; | ||
1050 | |||
1051 | _update_pll_mnp(pll, &cfg); | ||
1052 | |||
1053 | if (state) | ||
1054 | ret = clk_pllc_enable(hw); | ||
1055 | |||
1056 | out: | ||
1057 | if (pll->lock) | ||
1058 | spin_unlock_irqrestore(pll->lock, flags); | ||
1059 | |||
1060 | return ret; | ||
1061 | } | ||
1062 | |||
1063 | static long _pllre_calc_rate(struct tegra_clk_pll *pll, | ||
1064 | struct tegra_clk_pll_freq_table *cfg, | ||
1065 | unsigned long rate, unsigned long parent_rate) | ||
1066 | { | ||
1067 | u16 m, n; | ||
1068 | u64 output_rate = parent_rate; | ||
1069 | |||
1070 | m = _pll_fixed_mdiv(pll->params, parent_rate); | ||
1071 | n = rate * m / parent_rate; | ||
1072 | |||
1073 | output_rate *= n; | ||
1074 | do_div(output_rate, m); | ||
1075 | |||
1076 | if (cfg) { | ||
1077 | cfg->m = m; | ||
1078 | cfg->n = n; | ||
1079 | } | ||
1080 | |||
1081 | return output_rate; | ||
1082 | } | ||
1083 | static int clk_pllre_set_rate(struct clk_hw *hw, unsigned long rate, | ||
1084 | unsigned long parent_rate) | ||
1085 | { | ||
1086 | struct tegra_clk_pll_freq_table cfg, old_cfg; | ||
1087 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1088 | unsigned long flags = 0; | ||
1089 | int state, ret = 0; | ||
1090 | |||
1091 | if (pll->lock) | ||
1092 | spin_lock_irqsave(pll->lock, flags); | ||
1093 | |||
1094 | _pllre_calc_rate(pll, &cfg, rate, parent_rate); | ||
1095 | _get_pll_mnp(pll, &old_cfg); | ||
1096 | cfg.p = old_cfg.p; | ||
1097 | |||
1098 | if (cfg.m != old_cfg.m || cfg.n != old_cfg.n) { | ||
1099 | state = clk_pll_is_enabled(hw); | ||
1100 | if (state) | ||
1101 | _clk_pll_disable(hw); | ||
1102 | |||
1103 | _update_pll_mnp(pll, &cfg); | ||
1104 | |||
1105 | if (state) { | ||
1106 | _clk_pll_enable(hw); | ||
1107 | ret = clk_pll_wait_for_lock(pll); | ||
1108 | } | ||
1109 | } | ||
1110 | |||
1111 | if (pll->lock) | ||
1112 | spin_unlock_irqrestore(pll->lock, flags); | ||
1113 | |||
1114 | return ret; | ||
1115 | } | ||
1116 | |||
1117 | static unsigned long clk_pllre_recalc_rate(struct clk_hw *hw, | ||
1118 | unsigned long parent_rate) | ||
1119 | { | ||
1120 | struct tegra_clk_pll_freq_table cfg; | ||
1121 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1122 | u64 rate = parent_rate; | ||
1123 | |||
1124 | _get_pll_mnp(pll, &cfg); | ||
1125 | |||
1126 | rate *= cfg.n; | ||
1127 | do_div(rate, cfg.m); | ||
1128 | |||
1129 | return rate; | ||
1130 | } | ||
1131 | |||
1132 | static long clk_pllre_round_rate(struct clk_hw *hw, unsigned long rate, | ||
1133 | unsigned long *prate) | ||
1134 | { | ||
1135 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1136 | |||
1137 | return _pllre_calc_rate(pll, NULL, rate, *prate); | ||
1138 | } | ||
1139 | |||
1140 | static int clk_plle_tegra114_enable(struct clk_hw *hw) | ||
1141 | { | ||
1142 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1143 | struct tegra_clk_pll_freq_table sel; | ||
1144 | u32 val; | ||
1145 | int ret; | ||
1146 | unsigned long flags = 0; | ||
1147 | unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk)); | ||
1148 | |||
1149 | if (_get_table_rate(hw, &sel, pll->fixed_rate, input_rate)) | ||
1150 | return -EINVAL; | ||
1151 | |||
1152 | if (pll->lock) | ||
1153 | spin_lock_irqsave(pll->lock, flags); | ||
1154 | |||
1155 | val = pll_readl_base(pll); | ||
1156 | val &= ~BIT(29); /* Disable lock override */ | ||
1157 | pll_writel_base(val, pll); | ||
1158 | |||
1159 | val = pll_readl(pll->params->aux_reg, pll); | ||
1160 | val |= PLLE_AUX_ENABLE_SWCTL; | ||
1161 | val &= ~PLLE_AUX_SEQ_ENABLE; | ||
1162 | pll_writel(val, pll->params->aux_reg, pll); | ||
1163 | udelay(1); | ||
1164 | |||
1165 | val = pll_readl_misc(pll); | ||
1166 | val |= PLLE_MISC_LOCK_ENABLE; | ||
1167 | val |= PLLE_MISC_IDDQ_SW_CTRL; | ||
1168 | val &= ~PLLE_MISC_IDDQ_SW_VALUE; | ||
1169 | val |= PLLE_MISC_PLLE_PTS; | ||
1170 | val |= PLLE_MISC_VREG_BG_CTRL_MASK | PLLE_MISC_VREG_CTRL_MASK; | ||
1171 | pll_writel_misc(val, pll); | ||
1172 | udelay(5); | ||
1173 | |||
1174 | val = pll_readl(PLLE_SS_CTRL, pll); | ||
1175 | val |= PLLE_SS_DISABLE; | ||
1176 | pll_writel(val, PLLE_SS_CTRL, pll); | ||
1177 | |||
1178 | val = pll_readl_base(pll); | ||
1179 | val &= ~(divm_mask(pll) | divn_mask(pll) | divp_mask(pll)); | ||
1180 | val &= ~(PLLE_BASE_DIVCML_WIDTH << PLLE_BASE_DIVCML_SHIFT); | ||
1181 | val |= sel.m << pll->divm_shift; | ||
1182 | val |= sel.n << pll->divn_shift; | ||
1183 | val |= sel.cpcon << PLLE_BASE_DIVCML_SHIFT; | ||
1184 | pll_writel_base(val, pll); | ||
1185 | udelay(1); | ||
1186 | |||
1187 | _clk_pll_enable(hw); | ||
1188 | ret = clk_pll_wait_for_lock(pll); | ||
1189 | |||
1190 | if (ret < 0) | ||
1191 | goto out; | ||
1192 | |||
1193 | /* TODO: enable hw control of xusb brick pll */ | ||
1194 | |||
1195 | out: | ||
1196 | if (pll->lock) | ||
1197 | spin_unlock_irqrestore(pll->lock, flags); | ||
1198 | |||
1199 | return ret; | ||
1200 | } | ||
1201 | |||
1202 | static void clk_plle_tegra114_disable(struct clk_hw *hw) | ||
1203 | { | ||
1204 | struct tegra_clk_pll *pll = to_clk_pll(hw); | ||
1205 | unsigned long flags = 0; | ||
1206 | u32 val; | ||
1207 | |||
1208 | if (pll->lock) | ||
1209 | spin_lock_irqsave(pll->lock, flags); | ||
1210 | |||
1211 | _clk_pll_disable(hw); | ||
1212 | |||
1213 | val = pll_readl_misc(pll); | ||
1214 | val |= PLLE_MISC_IDDQ_SW_CTRL | PLLE_MISC_IDDQ_SW_VALUE; | ||
1215 | pll_writel_misc(val, pll); | ||
1216 | udelay(1); | ||
1217 | |||
1218 | if (pll->lock) | ||
1219 | spin_unlock_irqrestore(pll->lock, flags); | ||
1220 | } | ||
1221 | #endif | ||
1222 | |||
1223 | static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, | ||
1224 | void __iomem *pmc, unsigned long fixed_rate, | ||
1225 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, | ||
1226 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | ||
587 | { | 1227 | { |
588 | struct tegra_clk_pll *pll; | 1228 | struct tegra_clk_pll *pll; |
589 | struct clk *clk; | ||
590 | struct clk_init_data init; | ||
591 | 1229 | ||
592 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | 1230 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); |
593 | if (!pll) | 1231 | if (!pll) |
594 | return ERR_PTR(-ENOMEM); | 1232 | return ERR_PTR(-ENOMEM); |
595 | 1233 | ||
596 | init.name = name; | ||
597 | init.ops = ops; | ||
598 | init.flags = flags; | ||
599 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
600 | init.num_parents = (parent_name ? 1 : 0); | ||
601 | |||
602 | pll->clk_base = clk_base; | 1234 | pll->clk_base = clk_base; |
603 | pll->pmc = pmc; | 1235 | pll->pmc = pmc; |
604 | 1236 | ||
@@ -615,34 +1247,336 @@ static struct clk *_tegra_clk_register_pll(const char *name, | |||
615 | pll->divm_shift = PLL_BASE_DIVM_SHIFT; | 1247 | pll->divm_shift = PLL_BASE_DIVM_SHIFT; |
616 | pll->divm_width = PLL_BASE_DIVM_WIDTH; | 1248 | pll->divm_width = PLL_BASE_DIVM_WIDTH; |
617 | 1249 | ||
1250 | return pll; | ||
1251 | } | ||
1252 | |||
1253 | static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll, | ||
1254 | const char *name, const char *parent_name, unsigned long flags, | ||
1255 | const struct clk_ops *ops) | ||
1256 | { | ||
1257 | struct clk_init_data init; | ||
1258 | |||
1259 | init.name = name; | ||
1260 | init.ops = ops; | ||
1261 | init.flags = flags; | ||
1262 | init.parent_names = (parent_name ? &parent_name : NULL); | ||
1263 | init.num_parents = (parent_name ? 1 : 0); | ||
1264 | |||
618 | /* Data in .init is copied by clk_register(), so stack variable OK */ | 1265 | /* Data in .init is copied by clk_register(), so stack variable OK */ |
619 | pll->hw.init = &init; | 1266 | pll->hw.init = &init; |
620 | 1267 | ||
621 | clk = clk_register(NULL, &pll->hw); | 1268 | return clk_register(NULL, &pll->hw); |
622 | if (IS_ERR(clk)) | ||
623 | kfree(pll); | ||
624 | |||
625 | return clk; | ||
626 | } | 1269 | } |
627 | 1270 | ||
628 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 1271 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
629 | void __iomem *clk_base, void __iomem *pmc, | 1272 | void __iomem *clk_base, void __iomem *pmc, |
630 | unsigned long flags, unsigned long fixed_rate, | 1273 | unsigned long flags, unsigned long fixed_rate, |
631 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 1274 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
632 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | 1275 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) |
633 | { | 1276 | { |
634 | return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, | 1277 | struct tegra_clk_pll *pll; |
635 | flags, fixed_rate, pll_params, pll_flags, freq_table, | 1278 | struct clk *clk; |
636 | lock, &tegra_clk_pll_ops); | 1279 | |
1280 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1281 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1282 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1283 | freq_table, lock); | ||
1284 | if (IS_ERR(pll)) | ||
1285 | return ERR_CAST(pll); | ||
1286 | |||
1287 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1288 | &tegra_clk_pll_ops); | ||
1289 | if (IS_ERR(clk)) | ||
1290 | kfree(pll); | ||
1291 | |||
1292 | return clk; | ||
637 | } | 1293 | } |
638 | 1294 | ||
639 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 1295 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
640 | void __iomem *clk_base, void __iomem *pmc, | 1296 | void __iomem *clk_base, void __iomem *pmc, |
641 | unsigned long flags, unsigned long fixed_rate, | 1297 | unsigned long flags, unsigned long fixed_rate, |
642 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 1298 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
643 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) | 1299 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock) |
644 | { | 1300 | { |
645 | return _tegra_clk_register_pll(name, parent_name, clk_base, pmc, | 1301 | struct tegra_clk_pll *pll; |
646 | flags, fixed_rate, pll_params, pll_flags, freq_table, | 1302 | struct clk *clk; |
647 | lock, &tegra_clk_plle_ops); | 1303 | |
1304 | pll_flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS; | ||
1305 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1306 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1307 | freq_table, lock); | ||
1308 | if (IS_ERR(pll)) | ||
1309 | return ERR_CAST(pll); | ||
1310 | |||
1311 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1312 | &tegra_clk_plle_ops); | ||
1313 | if (IS_ERR(clk)) | ||
1314 | kfree(pll); | ||
1315 | |||
1316 | return clk; | ||
1317 | } | ||
1318 | |||
1319 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
1320 | const struct clk_ops tegra_clk_pllxc_ops = { | ||
1321 | .is_enabled = clk_pll_is_enabled, | ||
1322 | .enable = clk_pll_iddq_enable, | ||
1323 | .disable = clk_pll_iddq_disable, | ||
1324 | .recalc_rate = clk_pll_recalc_rate, | ||
1325 | .round_rate = clk_pll_ramp_round_rate, | ||
1326 | .set_rate = clk_pllxc_set_rate, | ||
1327 | }; | ||
1328 | |||
1329 | const struct clk_ops tegra_clk_pllm_ops = { | ||
1330 | .is_enabled = clk_pll_is_enabled, | ||
1331 | .enable = clk_pll_iddq_enable, | ||
1332 | .disable = clk_pll_iddq_disable, | ||
1333 | .recalc_rate = clk_pll_recalc_rate, | ||
1334 | .round_rate = clk_pll_ramp_round_rate, | ||
1335 | .set_rate = clk_pllm_set_rate, | ||
1336 | }; | ||
1337 | |||
1338 | const struct clk_ops tegra_clk_pllc_ops = { | ||
1339 | .is_enabled = clk_pll_is_enabled, | ||
1340 | .enable = clk_pllc_enable, | ||
1341 | .disable = clk_pllc_disable, | ||
1342 | .recalc_rate = clk_pll_recalc_rate, | ||
1343 | .round_rate = clk_pll_ramp_round_rate, | ||
1344 | .set_rate = clk_pllc_set_rate, | ||
1345 | }; | ||
1346 | |||
1347 | const struct clk_ops tegra_clk_pllre_ops = { | ||
1348 | .is_enabled = clk_pll_is_enabled, | ||
1349 | .enable = clk_pll_iddq_enable, | ||
1350 | .disable = clk_pll_iddq_disable, | ||
1351 | .recalc_rate = clk_pllre_recalc_rate, | ||
1352 | .round_rate = clk_pllre_round_rate, | ||
1353 | .set_rate = clk_pllre_set_rate, | ||
1354 | }; | ||
1355 | |||
1356 | const struct clk_ops tegra_clk_plle_tegra114_ops = { | ||
1357 | .is_enabled = clk_pll_is_enabled, | ||
1358 | .enable = clk_plle_tegra114_enable, | ||
1359 | .disable = clk_plle_tegra114_disable, | ||
1360 | .recalc_rate = clk_pll_recalc_rate, | ||
1361 | }; | ||
1362 | |||
1363 | |||
1364 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | ||
1365 | void __iomem *clk_base, void __iomem *pmc, | ||
1366 | unsigned long flags, unsigned long fixed_rate, | ||
1367 | struct tegra_clk_pll_params *pll_params, | ||
1368 | u32 pll_flags, | ||
1369 | struct tegra_clk_pll_freq_table *freq_table, | ||
1370 | spinlock_t *lock) | ||
1371 | { | ||
1372 | struct tegra_clk_pll *pll; | ||
1373 | struct clk *clk; | ||
1374 | |||
1375 | if (!pll_params->pdiv_tohw) | ||
1376 | return ERR_PTR(-EINVAL); | ||
1377 | |||
1378 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1379 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1380 | freq_table, lock); | ||
1381 | if (IS_ERR(pll)) | ||
1382 | return ERR_CAST(pll); | ||
1383 | |||
1384 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1385 | &tegra_clk_pllxc_ops); | ||
1386 | if (IS_ERR(clk)) | ||
1387 | kfree(pll); | ||
1388 | |||
1389 | return clk; | ||
1390 | } | ||
1391 | |||
1392 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | ||
1393 | void __iomem *clk_base, void __iomem *pmc, | ||
1394 | unsigned long flags, unsigned long fixed_rate, | ||
1395 | struct tegra_clk_pll_params *pll_params, | ||
1396 | u32 pll_flags, | ||
1397 | struct tegra_clk_pll_freq_table *freq_table, | ||
1398 | spinlock_t *lock, unsigned long parent_rate) | ||
1399 | { | ||
1400 | u32 val; | ||
1401 | struct tegra_clk_pll *pll; | ||
1402 | struct clk *clk; | ||
1403 | |||
1404 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1405 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1406 | freq_table, lock); | ||
1407 | if (IS_ERR(pll)) | ||
1408 | return ERR_CAST(pll); | ||
1409 | |||
1410 | /* program minimum rate by default */ | ||
1411 | |||
1412 | val = pll_readl_base(pll); | ||
1413 | if (val & PLL_BASE_ENABLE) | ||
1414 | WARN_ON(val & pll_params->iddq_bit_idx); | ||
1415 | else { | ||
1416 | int m; | ||
1417 | |||
1418 | m = _pll_fixed_mdiv(pll_params, parent_rate); | ||
1419 | val = m << PLL_BASE_DIVM_SHIFT; | ||
1420 | val |= (pll_params->vco_min / parent_rate) | ||
1421 | << PLL_BASE_DIVN_SHIFT; | ||
1422 | pll_writel_base(val, pll); | ||
1423 | } | ||
1424 | |||
1425 | /* disable lock override */ | ||
1426 | |||
1427 | val = pll_readl_misc(pll); | ||
1428 | val &= ~BIT(29); | ||
1429 | pll_writel_misc(val, pll); | ||
1430 | |||
1431 | pll_flags |= TEGRA_PLL_LOCK_MISC; | ||
1432 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1433 | &tegra_clk_pllre_ops); | ||
1434 | if (IS_ERR(clk)) | ||
1435 | kfree(pll); | ||
1436 | |||
1437 | return clk; | ||
1438 | } | ||
1439 | |||
1440 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | ||
1441 | void __iomem *clk_base, void __iomem *pmc, | ||
1442 | unsigned long flags, unsigned long fixed_rate, | ||
1443 | struct tegra_clk_pll_params *pll_params, | ||
1444 | u32 pll_flags, | ||
1445 | struct tegra_clk_pll_freq_table *freq_table, | ||
1446 | spinlock_t *lock) | ||
1447 | { | ||
1448 | struct tegra_clk_pll *pll; | ||
1449 | struct clk *clk; | ||
1450 | |||
1451 | if (!pll_params->pdiv_tohw) | ||
1452 | return ERR_PTR(-EINVAL); | ||
1453 | |||
1454 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1455 | pll_flags |= TEGRA_PLL_HAS_LOCK_ENABLE; | ||
1456 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1457 | freq_table, lock); | ||
1458 | if (IS_ERR(pll)) | ||
1459 | return ERR_CAST(pll); | ||
1460 | |||
1461 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1462 | &tegra_clk_pllm_ops); | ||
1463 | if (IS_ERR(clk)) | ||
1464 | kfree(pll); | ||
1465 | |||
1466 | return clk; | ||
1467 | } | ||
1468 | |||
1469 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | ||
1470 | void __iomem *clk_base, void __iomem *pmc, | ||
1471 | unsigned long flags, unsigned long fixed_rate, | ||
1472 | struct tegra_clk_pll_params *pll_params, | ||
1473 | u32 pll_flags, | ||
1474 | struct tegra_clk_pll_freq_table *freq_table, | ||
1475 | spinlock_t *lock) | ||
1476 | { | ||
1477 | struct clk *parent, *clk; | ||
1478 | struct pdiv_map *p_tohw = pll_params->pdiv_tohw; | ||
1479 | struct tegra_clk_pll *pll; | ||
1480 | struct tegra_clk_pll_freq_table cfg; | ||
1481 | unsigned long parent_rate; | ||
1482 | |||
1483 | if (!p_tohw) | ||
1484 | return ERR_PTR(-EINVAL); | ||
1485 | |||
1486 | parent = __clk_lookup(parent_name); | ||
1487 | if (IS_ERR(parent)) { | ||
1488 | WARN(1, "parent clk %s of %s must be registered first\n", | ||
1489 | name, parent_name); | ||
1490 | return ERR_PTR(-EINVAL); | ||
1491 | } | ||
1492 | |||
1493 | pll_flags |= TEGRA_PLL_BYPASS; | ||
1494 | pll = _tegra_init_pll(clk_base, pmc, fixed_rate, pll_params, pll_flags, | ||
1495 | freq_table, lock); | ||
1496 | if (IS_ERR(pll)) | ||
1497 | return ERR_CAST(pll); | ||
1498 | |||
1499 | parent_rate = __clk_get_rate(parent); | ||
1500 | |||
1501 | /* | ||
1502 | * Most of PLLC register fields are shadowed, and can not be read | ||
1503 | * directly from PLL h/w. Hence, actual PLLC boot state is unknown. | ||
1504 | * Initialize PLL to default state: disabled, reset; shadow registers | ||
1505 | * loaded with default parameters; dividers are preset for half of | ||
1506 | * minimum VCO rate (the latter assured that shadowed divider settings | ||
1507 | * are within supported range). | ||
1508 | */ | ||
1509 | |||
1510 | cfg.m = _pll_fixed_mdiv(pll_params, parent_rate); | ||
1511 | cfg.n = cfg.m * pll_params->vco_min / parent_rate; | ||
1512 | |||
1513 | while (p_tohw->pdiv) { | ||
1514 | if (p_tohw->pdiv == 2) { | ||
1515 | cfg.p = p_tohw->hw_val; | ||
1516 | break; | ||
1517 | } | ||
1518 | p_tohw++; | ||
1519 | } | ||
1520 | |||
1521 | if (!p_tohw->pdiv) { | ||
1522 | WARN_ON(1); | ||
1523 | return ERR_PTR(-EINVAL); | ||
1524 | } | ||
1525 | |||
1526 | pll_writel_base(0, pll); | ||
1527 | _update_pll_mnp(pll, &cfg); | ||
1528 | |||
1529 | pll_writel_misc(PLLCX_MISC_DEFAULT, pll); | ||
1530 | pll_writel(PLLCX_MISC1_DEFAULT, pll_params->ext_misc_reg[0], pll); | ||
1531 | pll_writel(PLLCX_MISC2_DEFAULT, pll_params->ext_misc_reg[1], pll); | ||
1532 | pll_writel(PLLCX_MISC3_DEFAULT, pll_params->ext_misc_reg[2], pll); | ||
1533 | |||
1534 | _pllcx_update_dynamic_coef(pll, parent_rate, cfg.n); | ||
1535 | |||
1536 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1537 | &tegra_clk_pllc_ops); | ||
1538 | if (IS_ERR(clk)) | ||
1539 | kfree(pll); | ||
1540 | |||
1541 | return clk; | ||
1542 | } | ||
1543 | |||
1544 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | ||
1545 | const char *parent_name, | ||
1546 | void __iomem *clk_base, unsigned long flags, | ||
1547 | unsigned long fixed_rate, | ||
1548 | struct tegra_clk_pll_params *pll_params, | ||
1549 | struct tegra_clk_pll_freq_table *freq_table, | ||
1550 | spinlock_t *lock) | ||
1551 | { | ||
1552 | struct tegra_clk_pll *pll; | ||
1553 | struct clk *clk; | ||
1554 | u32 val, val_aux; | ||
1555 | |||
1556 | pll = _tegra_init_pll(clk_base, NULL, fixed_rate, pll_params, | ||
1557 | TEGRA_PLL_HAS_LOCK_ENABLE, freq_table, lock); | ||
1558 | if (IS_ERR(pll)) | ||
1559 | return ERR_CAST(pll); | ||
1560 | |||
1561 | /* ensure parent is set to pll_re_vco */ | ||
1562 | |||
1563 | val = pll_readl_base(pll); | ||
1564 | val_aux = pll_readl(pll_params->aux_reg, pll); | ||
1565 | |||
1566 | if (val & PLL_BASE_ENABLE) { | ||
1567 | if (!(val_aux & PLLE_AUX_PLLRE_SEL)) | ||
1568 | WARN(1, "pll_e enabled with unsupported parent %s\n", | ||
1569 | (val & PLLE_AUX_PLLP_SEL) ? "pllp_out0" : "pll_ref"); | ||
1570 | } else { | ||
1571 | val_aux |= PLLE_AUX_PLLRE_SEL; | ||
1572 | pll_writel(val, pll_params->aux_reg, pll); | ||
1573 | } | ||
1574 | |||
1575 | clk = _tegra_clk_register_pll(pll, name, parent_name, flags, | ||
1576 | &tegra_clk_plle_tegra114_ops); | ||
1577 | if (IS_ERR(clk)) | ||
1578 | kfree(pll); | ||
1579 | |||
1580 | return clk; | ||
648 | } | 1581 | } |
1582 | #endif | ||
diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c new file mode 100644 index 000000000000..d78e16ee161c --- /dev/null +++ b/drivers/clk/tegra/clk-tegra114.c | |||
@@ -0,0 +1,2085 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2012, 2013, 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 | #include <linux/io.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/clk-provider.h> | ||
20 | #include <linux/clkdev.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_address.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/clk/tegra.h> | ||
25 | |||
26 | #include "clk.h" | ||
27 | |||
28 | #define RST_DEVICES_L 0x004 | ||
29 | #define RST_DEVICES_H 0x008 | ||
30 | #define RST_DEVICES_U 0x00C | ||
31 | #define RST_DEVICES_V 0x358 | ||
32 | #define RST_DEVICES_W 0x35C | ||
33 | #define RST_DEVICES_X 0x28C | ||
34 | #define RST_DEVICES_SET_L 0x300 | ||
35 | #define RST_DEVICES_CLR_L 0x304 | ||
36 | #define RST_DEVICES_SET_H 0x308 | ||
37 | #define RST_DEVICES_CLR_H 0x30c | ||
38 | #define RST_DEVICES_SET_U 0x310 | ||
39 | #define RST_DEVICES_CLR_U 0x314 | ||
40 | #define RST_DEVICES_SET_V 0x430 | ||
41 | #define RST_DEVICES_CLR_V 0x434 | ||
42 | #define RST_DEVICES_SET_W 0x438 | ||
43 | #define RST_DEVICES_CLR_W 0x43c | ||
44 | #define RST_DEVICES_NUM 5 | ||
45 | |||
46 | #define CLK_OUT_ENB_L 0x010 | ||
47 | #define CLK_OUT_ENB_H 0x014 | ||
48 | #define CLK_OUT_ENB_U 0x018 | ||
49 | #define CLK_OUT_ENB_V 0x360 | ||
50 | #define CLK_OUT_ENB_W 0x364 | ||
51 | #define CLK_OUT_ENB_X 0x280 | ||
52 | #define CLK_OUT_ENB_SET_L 0x320 | ||
53 | #define CLK_OUT_ENB_CLR_L 0x324 | ||
54 | #define CLK_OUT_ENB_SET_H 0x328 | ||
55 | #define CLK_OUT_ENB_CLR_H 0x32c | ||
56 | #define CLK_OUT_ENB_SET_U 0x330 | ||
57 | #define CLK_OUT_ENB_CLR_U 0x334 | ||
58 | #define CLK_OUT_ENB_SET_V 0x440 | ||
59 | #define CLK_OUT_ENB_CLR_V 0x444 | ||
60 | #define CLK_OUT_ENB_SET_W 0x448 | ||
61 | #define CLK_OUT_ENB_CLR_W 0x44c | ||
62 | #define CLK_OUT_ENB_SET_X 0x284 | ||
63 | #define CLK_OUT_ENB_CLR_X 0x288 | ||
64 | #define CLK_OUT_ENB_NUM 6 | ||
65 | |||
66 | #define PLLC_BASE 0x80 | ||
67 | #define PLLC_MISC2 0x88 | ||
68 | #define PLLC_MISC 0x8c | ||
69 | #define PLLC2_BASE 0x4e8 | ||
70 | #define PLLC2_MISC 0x4ec | ||
71 | #define PLLC3_BASE 0x4fc | ||
72 | #define PLLC3_MISC 0x500 | ||
73 | #define PLLM_BASE 0x90 | ||
74 | #define PLLM_MISC 0x9c | ||
75 | #define PLLP_BASE 0xa0 | ||
76 | #define PLLP_MISC 0xac | ||
77 | #define PLLX_BASE 0xe0 | ||
78 | #define PLLX_MISC 0xe4 | ||
79 | #define PLLX_MISC2 0x514 | ||
80 | #define PLLX_MISC3 0x518 | ||
81 | #define PLLD_BASE 0xd0 | ||
82 | #define PLLD_MISC 0xdc | ||
83 | #define PLLD2_BASE 0x4b8 | ||
84 | #define PLLD2_MISC 0x4bc | ||
85 | #define PLLE_BASE 0xe8 | ||
86 | #define PLLE_MISC 0xec | ||
87 | #define PLLA_BASE 0xb0 | ||
88 | #define PLLA_MISC 0xbc | ||
89 | #define PLLU_BASE 0xc0 | ||
90 | #define PLLU_MISC 0xcc | ||
91 | #define PLLRE_BASE 0x4c4 | ||
92 | #define PLLRE_MISC 0x4c8 | ||
93 | |||
94 | #define PLL_MISC_LOCK_ENABLE 18 | ||
95 | #define PLLC_MISC_LOCK_ENABLE 24 | ||
96 | #define PLLDU_MISC_LOCK_ENABLE 22 | ||
97 | #define PLLE_MISC_LOCK_ENABLE 9 | ||
98 | #define PLLRE_MISC_LOCK_ENABLE 30 | ||
99 | |||
100 | #define PLLC_IDDQ_BIT 26 | ||
101 | #define PLLX_IDDQ_BIT 3 | ||
102 | #define PLLRE_IDDQ_BIT 16 | ||
103 | |||
104 | #define PLL_BASE_LOCK BIT(27) | ||
105 | #define PLLE_MISC_LOCK BIT(11) | ||
106 | #define PLLRE_MISC_LOCK BIT(24) | ||
107 | #define PLLCX_BASE_LOCK (BIT(26)|BIT(27)) | ||
108 | |||
109 | #define PLLE_AUX 0x48c | ||
110 | #define PLLC_OUT 0x84 | ||
111 | #define PLLM_OUT 0x94 | ||
112 | #define PLLP_OUTA 0xa4 | ||
113 | #define PLLP_OUTB 0xa8 | ||
114 | #define PLLA_OUT 0xb4 | ||
115 | |||
116 | #define AUDIO_SYNC_CLK_I2S0 0x4a0 | ||
117 | #define AUDIO_SYNC_CLK_I2S1 0x4a4 | ||
118 | #define AUDIO_SYNC_CLK_I2S2 0x4a8 | ||
119 | #define AUDIO_SYNC_CLK_I2S3 0x4ac | ||
120 | #define AUDIO_SYNC_CLK_I2S4 0x4b0 | ||
121 | #define AUDIO_SYNC_CLK_SPDIF 0x4b4 | ||
122 | |||
123 | #define AUDIO_SYNC_DOUBLER 0x49c | ||
124 | |||
125 | #define PMC_CLK_OUT_CNTRL 0x1a8 | ||
126 | #define PMC_DPD_PADS_ORIDE 0x1c | ||
127 | #define PMC_DPD_PADS_ORIDE_BLINK_ENB 20 | ||
128 | #define PMC_CTRL 0 | ||
129 | #define PMC_CTRL_BLINK_ENB 7 | ||
130 | |||
131 | #define OSC_CTRL 0x50 | ||
132 | #define OSC_CTRL_OSC_FREQ_SHIFT 28 | ||
133 | #define OSC_CTRL_PLL_REF_DIV_SHIFT 26 | ||
134 | |||
135 | #define PLLXC_SW_MAX_P 6 | ||
136 | |||
137 | #define CCLKG_BURST_POLICY 0x368 | ||
138 | #define CCLKLP_BURST_POLICY 0x370 | ||
139 | #define SCLK_BURST_POLICY 0x028 | ||
140 | #define SYSTEM_CLK_RATE 0x030 | ||
141 | |||
142 | #define UTMIP_PLL_CFG2 0x488 | ||
143 | #define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6) | ||
144 | #define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18) | ||
145 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0) | ||
146 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2) | ||
147 | #define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4) | ||
148 | |||
149 | #define UTMIP_PLL_CFG1 0x484 | ||
150 | #define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6) | ||
151 | #define UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(x) (((x) & 0xfff) << 0) | ||
152 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP BIT(17) | ||
153 | #define UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN BIT(16) | ||
154 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP BIT(15) | ||
155 | #define UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN BIT(14) | ||
156 | #define UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN BIT(12) | ||
157 | |||
158 | #define UTMIPLL_HW_PWRDN_CFG0 0x52c | ||
159 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE BIT(25) | ||
160 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE BIT(24) | ||
161 | #define UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET BIT(6) | ||
162 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_RESET_INPUT_VALUE BIT(5) | ||
163 | #define UTMIPLL_HW_PWRDN_CFG0_SEQ_IN_SWCTL BIT(4) | ||
164 | #define UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL BIT(2) | ||
165 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1) | ||
166 | #define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) | ||
167 | |||
168 | #define CLK_SOURCE_I2S0 0x1d8 | ||
169 | #define CLK_SOURCE_I2S1 0x100 | ||
170 | #define CLK_SOURCE_I2S2 0x104 | ||
171 | #define CLK_SOURCE_NDFLASH 0x160 | ||
172 | #define CLK_SOURCE_I2S3 0x3bc | ||
173 | #define CLK_SOURCE_I2S4 0x3c0 | ||
174 | #define CLK_SOURCE_SPDIF_OUT 0x108 | ||
175 | #define CLK_SOURCE_SPDIF_IN 0x10c | ||
176 | #define CLK_SOURCE_PWM 0x110 | ||
177 | #define CLK_SOURCE_ADX 0x638 | ||
178 | #define CLK_SOURCE_AMX 0x63c | ||
179 | #define CLK_SOURCE_HDA 0x428 | ||
180 | #define CLK_SOURCE_HDA2CODEC_2X 0x3e4 | ||
181 | #define CLK_SOURCE_SBC1 0x134 | ||
182 | #define CLK_SOURCE_SBC2 0x118 | ||
183 | #define CLK_SOURCE_SBC3 0x11c | ||
184 | #define CLK_SOURCE_SBC4 0x1b4 | ||
185 | #define CLK_SOURCE_SBC5 0x3c8 | ||
186 | #define CLK_SOURCE_SBC6 0x3cc | ||
187 | #define CLK_SOURCE_SATA_OOB 0x420 | ||
188 | #define CLK_SOURCE_SATA 0x424 | ||
189 | #define CLK_SOURCE_NDSPEED 0x3f8 | ||
190 | #define CLK_SOURCE_VFIR 0x168 | ||
191 | #define CLK_SOURCE_SDMMC1 0x150 | ||
192 | #define CLK_SOURCE_SDMMC2 0x154 | ||
193 | #define CLK_SOURCE_SDMMC3 0x1bc | ||
194 | #define CLK_SOURCE_SDMMC4 0x164 | ||
195 | #define CLK_SOURCE_VDE 0x1c8 | ||
196 | #define CLK_SOURCE_CSITE 0x1d4 | ||
197 | #define CLK_SOURCE_LA 0x1f8 | ||
198 | #define CLK_SOURCE_TRACE 0x634 | ||
199 | #define CLK_SOURCE_OWR 0x1cc | ||
200 | #define CLK_SOURCE_NOR 0x1d0 | ||
201 | #define CLK_SOURCE_MIPI 0x174 | ||
202 | #define CLK_SOURCE_I2C1 0x124 | ||
203 | #define CLK_SOURCE_I2C2 0x198 | ||
204 | #define CLK_SOURCE_I2C3 0x1b8 | ||
205 | #define CLK_SOURCE_I2C4 0x3c4 | ||
206 | #define CLK_SOURCE_I2C5 0x128 | ||
207 | #define CLK_SOURCE_UARTA 0x178 | ||
208 | #define CLK_SOURCE_UARTB 0x17c | ||
209 | #define CLK_SOURCE_UARTC 0x1a0 | ||
210 | #define CLK_SOURCE_UARTD 0x1c0 | ||
211 | #define CLK_SOURCE_UARTE 0x1c4 | ||
212 | #define CLK_SOURCE_UARTA_DBG 0x178 | ||
213 | #define CLK_SOURCE_UARTB_DBG 0x17c | ||
214 | #define CLK_SOURCE_UARTC_DBG 0x1a0 | ||
215 | #define CLK_SOURCE_UARTD_DBG 0x1c0 | ||
216 | #define CLK_SOURCE_UARTE_DBG 0x1c4 | ||
217 | #define CLK_SOURCE_3D 0x158 | ||
218 | #define CLK_SOURCE_2D 0x15c | ||
219 | #define CLK_SOURCE_VI_SENSOR 0x1a8 | ||
220 | #define CLK_SOURCE_VI 0x148 | ||
221 | #define CLK_SOURCE_EPP 0x16c | ||
222 | #define CLK_SOURCE_MSENC 0x1f0 | ||
223 | #define CLK_SOURCE_TSEC 0x1f4 | ||
224 | #define CLK_SOURCE_HOST1X 0x180 | ||
225 | #define CLK_SOURCE_HDMI 0x18c | ||
226 | #define CLK_SOURCE_DISP1 0x138 | ||
227 | #define CLK_SOURCE_DISP2 0x13c | ||
228 | #define CLK_SOURCE_CILAB 0x614 | ||
229 | #define CLK_SOURCE_CILCD 0x618 | ||
230 | #define CLK_SOURCE_CILE 0x61c | ||
231 | #define CLK_SOURCE_DSIALP 0x620 | ||
232 | #define CLK_SOURCE_DSIBLP 0x624 | ||
233 | #define CLK_SOURCE_TSENSOR 0x3b8 | ||
234 | #define CLK_SOURCE_D_AUDIO 0x3d0 | ||
235 | #define CLK_SOURCE_DAM0 0x3d8 | ||
236 | #define CLK_SOURCE_DAM1 0x3dc | ||
237 | #define CLK_SOURCE_DAM2 0x3e0 | ||
238 | #define CLK_SOURCE_ACTMON 0x3e8 | ||
239 | #define CLK_SOURCE_EXTERN1 0x3ec | ||
240 | #define CLK_SOURCE_EXTERN2 0x3f0 | ||
241 | #define CLK_SOURCE_EXTERN3 0x3f4 | ||
242 | #define CLK_SOURCE_I2CSLOW 0x3fc | ||
243 | #define CLK_SOURCE_SE 0x42c | ||
244 | #define CLK_SOURCE_MSELECT 0x3b4 | ||
245 | #define CLK_SOURCE_SOC_THERM 0x644 | ||
246 | #define CLK_SOURCE_XUSB_HOST_SRC 0x600 | ||
247 | #define CLK_SOURCE_XUSB_FALCON_SRC 0x604 | ||
248 | #define CLK_SOURCE_XUSB_FS_SRC 0x608 | ||
249 | #define CLK_SOURCE_XUSB_SS_SRC 0x610 | ||
250 | #define CLK_SOURCE_XUSB_DEV_SRC 0x60c | ||
251 | #define CLK_SOURCE_EMC 0x19c | ||
252 | |||
253 | static int periph_clk_enb_refcnt[CLK_OUT_ENB_NUM * 32]; | ||
254 | |||
255 | static void __iomem *clk_base; | ||
256 | static void __iomem *pmc_base; | ||
257 | |||
258 | static DEFINE_SPINLOCK(pll_d_lock); | ||
259 | static DEFINE_SPINLOCK(pll_d2_lock); | ||
260 | static DEFINE_SPINLOCK(pll_u_lock); | ||
261 | static DEFINE_SPINLOCK(pll_div_lock); | ||
262 | static DEFINE_SPINLOCK(pll_re_lock); | ||
263 | static DEFINE_SPINLOCK(clk_doubler_lock); | ||
264 | static DEFINE_SPINLOCK(clk_out_lock); | ||
265 | static DEFINE_SPINLOCK(sysrate_lock); | ||
266 | |||
267 | static struct pdiv_map pllxc_p[] = { | ||
268 | { .pdiv = 1, .hw_val = 0 }, | ||
269 | { .pdiv = 2, .hw_val = 1 }, | ||
270 | { .pdiv = 3, .hw_val = 2 }, | ||
271 | { .pdiv = 4, .hw_val = 3 }, | ||
272 | { .pdiv = 5, .hw_val = 4 }, | ||
273 | { .pdiv = 6, .hw_val = 5 }, | ||
274 | { .pdiv = 8, .hw_val = 6 }, | ||
275 | { .pdiv = 10, .hw_val = 7 }, | ||
276 | { .pdiv = 12, .hw_val = 8 }, | ||
277 | { .pdiv = 16, .hw_val = 9 }, | ||
278 | { .pdiv = 12, .hw_val = 10 }, | ||
279 | { .pdiv = 16, .hw_val = 11 }, | ||
280 | { .pdiv = 20, .hw_val = 12 }, | ||
281 | { .pdiv = 24, .hw_val = 13 }, | ||
282 | { .pdiv = 32, .hw_val = 14 }, | ||
283 | { .pdiv = 0, .hw_val = 0 }, | ||
284 | }; | ||
285 | |||
286 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | ||
287 | { 12000000, 624000000, 104, 0, 2}, | ||
288 | { 12000000, 600000000, 100, 0, 2}, | ||
289 | { 13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ | ||
290 | { 16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ | ||
291 | { 19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ | ||
292 | { 26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
293 | { 0, 0, 0, 0, 0, 0 }, | ||
294 | }; | ||
295 | |||
296 | static struct tegra_clk_pll_params pll_c_params = { | ||
297 | .input_min = 12000000, | ||
298 | .input_max = 800000000, | ||
299 | .cf_min = 12000000, | ||
300 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
301 | .vco_min = 600000000, | ||
302 | .vco_max = 1400000000, | ||
303 | .base_reg = PLLC_BASE, | ||
304 | .misc_reg = PLLC_MISC, | ||
305 | .lock_mask = PLL_BASE_LOCK, | ||
306 | .lock_enable_bit_idx = PLLC_MISC_LOCK_ENABLE, | ||
307 | .lock_delay = 300, | ||
308 | .iddq_reg = PLLC_MISC, | ||
309 | .iddq_bit_idx = PLLC_IDDQ_BIT, | ||
310 | .max_p = PLLXC_SW_MAX_P, | ||
311 | .dyn_ramp_reg = PLLC_MISC2, | ||
312 | .stepa_shift = 17, | ||
313 | .stepb_shift = 9, | ||
314 | .pdiv_tohw = pllxc_p, | ||
315 | }; | ||
316 | |||
317 | static struct pdiv_map pllc_p[] = { | ||
318 | { .pdiv = 1, .hw_val = 0 }, | ||
319 | { .pdiv = 2, .hw_val = 1 }, | ||
320 | { .pdiv = 4, .hw_val = 3 }, | ||
321 | { .pdiv = 8, .hw_val = 5 }, | ||
322 | { .pdiv = 16, .hw_val = 7 }, | ||
323 | { .pdiv = 0, .hw_val = 0 }, | ||
324 | }; | ||
325 | |||
326 | static struct tegra_clk_pll_freq_table pll_cx_freq_table[] = { | ||
327 | {12000000, 600000000, 100, 0, 2}, | ||
328 | {13000000, 600000000, 92, 0, 2}, /* actual: 598.0 MHz */ | ||
329 | {16800000, 600000000, 71, 0, 2}, /* actual: 596.4 MHz */ | ||
330 | {19200000, 600000000, 62, 0, 2}, /* actual: 595.2 MHz */ | ||
331 | {26000000, 600000000, 92, 1, 2}, /* actual: 598.0 MHz */ | ||
332 | {0, 0, 0, 0, 0, 0}, | ||
333 | }; | ||
334 | |||
335 | static struct tegra_clk_pll_params pll_c2_params = { | ||
336 | .input_min = 12000000, | ||
337 | .input_max = 48000000, | ||
338 | .cf_min = 12000000, | ||
339 | .cf_max = 19200000, | ||
340 | .vco_min = 600000000, | ||
341 | .vco_max = 1200000000, | ||
342 | .base_reg = PLLC2_BASE, | ||
343 | .misc_reg = PLLC2_MISC, | ||
344 | .lock_mask = PLL_BASE_LOCK, | ||
345 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
346 | .lock_delay = 300, | ||
347 | .pdiv_tohw = pllc_p, | ||
348 | .ext_misc_reg[0] = 0x4f0, | ||
349 | .ext_misc_reg[1] = 0x4f4, | ||
350 | .ext_misc_reg[2] = 0x4f8, | ||
351 | }; | ||
352 | |||
353 | static struct tegra_clk_pll_params pll_c3_params = { | ||
354 | .input_min = 12000000, | ||
355 | .input_max = 48000000, | ||
356 | .cf_min = 12000000, | ||
357 | .cf_max = 19200000, | ||
358 | .vco_min = 600000000, | ||
359 | .vco_max = 1200000000, | ||
360 | .base_reg = PLLC3_BASE, | ||
361 | .misc_reg = PLLC3_MISC, | ||
362 | .lock_mask = PLL_BASE_LOCK, | ||
363 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
364 | .lock_delay = 300, | ||
365 | .pdiv_tohw = pllc_p, | ||
366 | .ext_misc_reg[0] = 0x504, | ||
367 | .ext_misc_reg[1] = 0x508, | ||
368 | .ext_misc_reg[2] = 0x50c, | ||
369 | }; | ||
370 | |||
371 | static struct pdiv_map pllm_p[] = { | ||
372 | { .pdiv = 1, .hw_val = 0 }, | ||
373 | { .pdiv = 2, .hw_val = 1 }, | ||
374 | { .pdiv = 0, .hw_val = 0 }, | ||
375 | }; | ||
376 | |||
377 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | ||
378 | {12000000, 800000000, 66, 0, 1}, /* actual: 792.0 MHz */ | ||
379 | {13000000, 800000000, 61, 0, 1}, /* actual: 793.0 MHz */ | ||
380 | {16800000, 800000000, 47, 0, 1}, /* actual: 789.6 MHz */ | ||
381 | {19200000, 800000000, 41, 0, 1}, /* actual: 787.2 MHz */ | ||
382 | {26000000, 800000000, 61, 1, 1}, /* actual: 793.0 MHz */ | ||
383 | {0, 0, 0, 0, 0, 0}, | ||
384 | }; | ||
385 | |||
386 | static struct tegra_clk_pll_params pll_m_params = { | ||
387 | .input_min = 12000000, | ||
388 | .input_max = 500000000, | ||
389 | .cf_min = 12000000, | ||
390 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
391 | .vco_min = 400000000, | ||
392 | .vco_max = 1066000000, | ||
393 | .base_reg = PLLM_BASE, | ||
394 | .misc_reg = PLLM_MISC, | ||
395 | .lock_mask = PLL_BASE_LOCK, | ||
396 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
397 | .lock_delay = 300, | ||
398 | .max_p = 2, | ||
399 | .pdiv_tohw = pllm_p, | ||
400 | }; | ||
401 | |||
402 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | ||
403 | {12000000, 216000000, 432, 12, 1, 8}, | ||
404 | {13000000, 216000000, 432, 13, 1, 8}, | ||
405 | {16800000, 216000000, 360, 14, 1, 8}, | ||
406 | {19200000, 216000000, 360, 16, 1, 8}, | ||
407 | {26000000, 216000000, 432, 26, 1, 8}, | ||
408 | {0, 0, 0, 0, 0, 0}, | ||
409 | }; | ||
410 | |||
411 | static struct tegra_clk_pll_params pll_p_params = { | ||
412 | .input_min = 2000000, | ||
413 | .input_max = 31000000, | ||
414 | .cf_min = 1000000, | ||
415 | .cf_max = 6000000, | ||
416 | .vco_min = 200000000, | ||
417 | .vco_max = 700000000, | ||
418 | .base_reg = PLLP_BASE, | ||
419 | .misc_reg = PLLP_MISC, | ||
420 | .lock_mask = PLL_BASE_LOCK, | ||
421 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
422 | .lock_delay = 300, | ||
423 | }; | ||
424 | |||
425 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | ||
426 | {9600000, 282240000, 147, 5, 0, 4}, | ||
427 | {9600000, 368640000, 192, 5, 0, 4}, | ||
428 | {9600000, 240000000, 200, 8, 0, 8}, | ||
429 | |||
430 | {28800000, 282240000, 245, 25, 0, 8}, | ||
431 | {28800000, 368640000, 320, 25, 0, 8}, | ||
432 | {28800000, 240000000, 200, 24, 0, 8}, | ||
433 | {0, 0, 0, 0, 0, 0}, | ||
434 | }; | ||
435 | |||
436 | |||
437 | static struct tegra_clk_pll_params pll_a_params = { | ||
438 | .input_min = 2000000, | ||
439 | .input_max = 31000000, | ||
440 | .cf_min = 1000000, | ||
441 | .cf_max = 6000000, | ||
442 | .vco_min = 200000000, | ||
443 | .vco_max = 700000000, | ||
444 | .base_reg = PLLA_BASE, | ||
445 | .misc_reg = PLLA_MISC, | ||
446 | .lock_mask = PLL_BASE_LOCK, | ||
447 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
448 | .lock_delay = 300, | ||
449 | }; | ||
450 | |||
451 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | ||
452 | {12000000, 216000000, 864, 12, 2, 12}, | ||
453 | {13000000, 216000000, 864, 13, 2, 12}, | ||
454 | {16800000, 216000000, 720, 14, 2, 12}, | ||
455 | {19200000, 216000000, 720, 16, 2, 12}, | ||
456 | {26000000, 216000000, 864, 26, 2, 12}, | ||
457 | |||
458 | {12000000, 594000000, 594, 12, 0, 12}, | ||
459 | {13000000, 594000000, 594, 13, 0, 12}, | ||
460 | {16800000, 594000000, 495, 14, 0, 12}, | ||
461 | {19200000, 594000000, 495, 16, 0, 12}, | ||
462 | {26000000, 594000000, 594, 26, 0, 12}, | ||
463 | |||
464 | {12000000, 1000000000, 1000, 12, 0, 12}, | ||
465 | {13000000, 1000000000, 1000, 13, 0, 12}, | ||
466 | {19200000, 1000000000, 625, 12, 0, 12}, | ||
467 | {26000000, 1000000000, 1000, 26, 0, 12}, | ||
468 | |||
469 | {0, 0, 0, 0, 0, 0}, | ||
470 | }; | ||
471 | |||
472 | static struct tegra_clk_pll_params pll_d_params = { | ||
473 | .input_min = 2000000, | ||
474 | .input_max = 40000000, | ||
475 | .cf_min = 1000000, | ||
476 | .cf_max = 6000000, | ||
477 | .vco_min = 500000000, | ||
478 | .vco_max = 1000000000, | ||
479 | .base_reg = PLLD_BASE, | ||
480 | .misc_reg = PLLD_MISC, | ||
481 | .lock_mask = PLL_BASE_LOCK, | ||
482 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
483 | .lock_delay = 1000, | ||
484 | }; | ||
485 | |||
486 | static struct tegra_clk_pll_params pll_d2_params = { | ||
487 | .input_min = 2000000, | ||
488 | .input_max = 40000000, | ||
489 | .cf_min = 1000000, | ||
490 | .cf_max = 6000000, | ||
491 | .vco_min = 500000000, | ||
492 | .vco_max = 1000000000, | ||
493 | .base_reg = PLLD2_BASE, | ||
494 | .misc_reg = PLLD2_MISC, | ||
495 | .lock_mask = PLL_BASE_LOCK, | ||
496 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
497 | .lock_delay = 1000, | ||
498 | }; | ||
499 | |||
500 | static struct pdiv_map pllu_p[] = { | ||
501 | { .pdiv = 1, .hw_val = 1 }, | ||
502 | { .pdiv = 2, .hw_val = 0 }, | ||
503 | { .pdiv = 0, .hw_val = 0 }, | ||
504 | }; | ||
505 | |||
506 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | ||
507 | {12000000, 480000000, 960, 12, 0, 12}, | ||
508 | {13000000, 480000000, 960, 13, 0, 12}, | ||
509 | {16800000, 480000000, 400, 7, 0, 5}, | ||
510 | {19200000, 480000000, 200, 4, 0, 3}, | ||
511 | {26000000, 480000000, 960, 26, 0, 12}, | ||
512 | {0, 0, 0, 0, 0, 0}, | ||
513 | }; | ||
514 | |||
515 | static struct tegra_clk_pll_params pll_u_params = { | ||
516 | .input_min = 2000000, | ||
517 | .input_max = 40000000, | ||
518 | .cf_min = 1000000, | ||
519 | .cf_max = 6000000, | ||
520 | .vco_min = 480000000, | ||
521 | .vco_max = 960000000, | ||
522 | .base_reg = PLLU_BASE, | ||
523 | .misc_reg = PLLU_MISC, | ||
524 | .lock_mask = PLL_BASE_LOCK, | ||
525 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | ||
526 | .lock_delay = 1000, | ||
527 | .pdiv_tohw = pllu_p, | ||
528 | }; | ||
529 | |||
530 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | ||
531 | /* 1 GHz */ | ||
532 | {12000000, 1000000000, 83, 0, 1}, /* actual: 996.0 MHz */ | ||
533 | {13000000, 1000000000, 76, 0, 1}, /* actual: 988.0 MHz */ | ||
534 | {16800000, 1000000000, 59, 0, 1}, /* actual: 991.2 MHz */ | ||
535 | {19200000, 1000000000, 52, 0, 1}, /* actual: 998.4 MHz */ | ||
536 | {26000000, 1000000000, 76, 1, 1}, /* actual: 988.0 MHz */ | ||
537 | |||
538 | {0, 0, 0, 0, 0, 0}, | ||
539 | }; | ||
540 | |||
541 | static struct tegra_clk_pll_params pll_x_params = { | ||
542 | .input_min = 12000000, | ||
543 | .input_max = 800000000, | ||
544 | .cf_min = 12000000, | ||
545 | .cf_max = 19200000, /* s/w policy, h/w capability 50 MHz */ | ||
546 | .vco_min = 700000000, | ||
547 | .vco_max = 2400000000U, | ||
548 | .base_reg = PLLX_BASE, | ||
549 | .misc_reg = PLLX_MISC, | ||
550 | .lock_mask = PLL_BASE_LOCK, | ||
551 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | ||
552 | .lock_delay = 300, | ||
553 | .iddq_reg = PLLX_MISC3, | ||
554 | .iddq_bit_idx = PLLX_IDDQ_BIT, | ||
555 | .max_p = PLLXC_SW_MAX_P, | ||
556 | .dyn_ramp_reg = PLLX_MISC2, | ||
557 | .stepa_shift = 16, | ||
558 | .stepb_shift = 24, | ||
559 | .pdiv_tohw = pllxc_p, | ||
560 | }; | ||
561 | |||
562 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | ||
563 | /* PLLE special case: use cpcon field to store cml divider value */ | ||
564 | {336000000, 100000000, 100, 21, 16, 11}, | ||
565 | {312000000, 100000000, 200, 26, 24, 13}, | ||
566 | {0, 0, 0, 0, 0, 0}, | ||
567 | }; | ||
568 | |||
569 | static struct tegra_clk_pll_params pll_e_params = { | ||
570 | .input_min = 12000000, | ||
571 | .input_max = 1000000000, | ||
572 | .cf_min = 12000000, | ||
573 | .cf_max = 75000000, | ||
574 | .vco_min = 1600000000, | ||
575 | .vco_max = 2400000000U, | ||
576 | .base_reg = PLLE_BASE, | ||
577 | .misc_reg = PLLE_MISC, | ||
578 | .aux_reg = PLLE_AUX, | ||
579 | .lock_mask = PLLE_MISC_LOCK, | ||
580 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | ||
581 | .lock_delay = 300, | ||
582 | }; | ||
583 | |||
584 | static struct tegra_clk_pll_params pll_re_vco_params = { | ||
585 | .input_min = 12000000, | ||
586 | .input_max = 1000000000, | ||
587 | .cf_min = 12000000, | ||
588 | .cf_max = 19200000, /* s/w policy, h/w capability 38 MHz */ | ||
589 | .vco_min = 300000000, | ||
590 | .vco_max = 600000000, | ||
591 | .base_reg = PLLRE_BASE, | ||
592 | .misc_reg = PLLRE_MISC, | ||
593 | .lock_mask = PLLRE_MISC_LOCK, | ||
594 | .lock_enable_bit_idx = PLLRE_MISC_LOCK_ENABLE, | ||
595 | .lock_delay = 300, | ||
596 | .iddq_reg = PLLRE_MISC, | ||
597 | .iddq_bit_idx = PLLRE_IDDQ_BIT, | ||
598 | }; | ||
599 | |||
600 | /* Peripheral clock registers */ | ||
601 | |||
602 | static struct tegra_clk_periph_regs periph_l_regs = { | ||
603 | .enb_reg = CLK_OUT_ENB_L, | ||
604 | .enb_set_reg = CLK_OUT_ENB_SET_L, | ||
605 | .enb_clr_reg = CLK_OUT_ENB_CLR_L, | ||
606 | .rst_reg = RST_DEVICES_L, | ||
607 | .rst_set_reg = RST_DEVICES_SET_L, | ||
608 | .rst_clr_reg = RST_DEVICES_CLR_L, | ||
609 | }; | ||
610 | |||
611 | static struct tegra_clk_periph_regs periph_h_regs = { | ||
612 | .enb_reg = CLK_OUT_ENB_H, | ||
613 | .enb_set_reg = CLK_OUT_ENB_SET_H, | ||
614 | .enb_clr_reg = CLK_OUT_ENB_CLR_H, | ||
615 | .rst_reg = RST_DEVICES_H, | ||
616 | .rst_set_reg = RST_DEVICES_SET_H, | ||
617 | .rst_clr_reg = RST_DEVICES_CLR_H, | ||
618 | }; | ||
619 | |||
620 | static struct tegra_clk_periph_regs periph_u_regs = { | ||
621 | .enb_reg = CLK_OUT_ENB_U, | ||
622 | .enb_set_reg = CLK_OUT_ENB_SET_U, | ||
623 | .enb_clr_reg = CLK_OUT_ENB_CLR_U, | ||
624 | .rst_reg = RST_DEVICES_U, | ||
625 | .rst_set_reg = RST_DEVICES_SET_U, | ||
626 | .rst_clr_reg = RST_DEVICES_CLR_U, | ||
627 | }; | ||
628 | |||
629 | static struct tegra_clk_periph_regs periph_v_regs = { | ||
630 | .enb_reg = CLK_OUT_ENB_V, | ||
631 | .enb_set_reg = CLK_OUT_ENB_SET_V, | ||
632 | .enb_clr_reg = CLK_OUT_ENB_CLR_V, | ||
633 | .rst_reg = RST_DEVICES_V, | ||
634 | .rst_set_reg = RST_DEVICES_SET_V, | ||
635 | .rst_clr_reg = RST_DEVICES_CLR_V, | ||
636 | }; | ||
637 | |||
638 | static struct tegra_clk_periph_regs periph_w_regs = { | ||
639 | .enb_reg = CLK_OUT_ENB_W, | ||
640 | .enb_set_reg = CLK_OUT_ENB_SET_W, | ||
641 | .enb_clr_reg = CLK_OUT_ENB_CLR_W, | ||
642 | .rst_reg = RST_DEVICES_W, | ||
643 | .rst_set_reg = RST_DEVICES_SET_W, | ||
644 | .rst_clr_reg = RST_DEVICES_CLR_W, | ||
645 | }; | ||
646 | |||
647 | /* possible OSC frequencies in Hz */ | ||
648 | static unsigned long tegra114_input_freq[] = { | ||
649 | [0] = 13000000, | ||
650 | [1] = 16800000, | ||
651 | [4] = 19200000, | ||
652 | [5] = 38400000, | ||
653 | [8] = 12000000, | ||
654 | [9] = 48000000, | ||
655 | [12] = 260000000, | ||
656 | }; | ||
657 | |||
658 | #define MASK(x) (BIT(x) - 1) | ||
659 | |||
660 | #define TEGRA_INIT_DATA_MUX(_name, _con_id, _dev_id, _parents, _offset, \ | ||
661 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
662 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
663 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
664 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
665 | _parents##_idx, 0) | ||
666 | |||
667 | #define TEGRA_INIT_DATA_MUX_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
668 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
669 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
670 | 30, MASK(2), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
671 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
672 | _parents##_idx, flags) | ||
673 | |||
674 | #define TEGRA_INIT_DATA_MUX8(_name, _con_id, _dev_id, _parents, _offset, \ | ||
675 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
676 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
677 | 29, MASK(3), 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
678 | periph_clk_enb_refcnt, _gate_flags, _clk_id, \ | ||
679 | _parents##_idx, 0) | ||
680 | |||
681 | #define TEGRA_INIT_DATA_INT(_name, _con_id, _dev_id, _parents, _offset, \ | ||
682 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
683 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
684 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
685 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
686 | _clk_id, _parents##_idx, 0) | ||
687 | |||
688 | #define TEGRA_INIT_DATA_INT_FLAGS(_name, _con_id, _dev_id, _parents, _offset,\ | ||
689 | _clk_num, _regs, _gate_flags, _clk_id, flags)\ | ||
690 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
691 | 30, MASK(2), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
692 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
693 | _clk_id, _parents##_idx, flags) | ||
694 | |||
695 | #define TEGRA_INIT_DATA_INT8(_name, _con_id, _dev_id, _parents, _offset,\ | ||
696 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
697 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
698 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs,\ | ||
699 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
700 | _clk_id, _parents##_idx, 0) | ||
701 | |||
702 | #define TEGRA_INIT_DATA_UART(_name, _con_id, _dev_id, _parents, _offset,\ | ||
703 | _clk_num, _regs, _clk_id) \ | ||
704 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
705 | 30, MASK(2), 0, 0, 16, 1, TEGRA_DIVIDER_UART, _regs,\ | ||
706 | _clk_num, periph_clk_enb_refcnt, 0, _clk_id, \ | ||
707 | _parents##_idx, 0) | ||
708 | |||
709 | #define TEGRA_INIT_DATA_I2C(_name, _con_id, _dev_id, _parents, _offset,\ | ||
710 | _clk_num, _regs, _clk_id) \ | ||
711 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
712 | 30, MASK(2), 0, 0, 16, 0, 0, _regs, _clk_num, \ | ||
713 | periph_clk_enb_refcnt, 0, _clk_id, _parents##_idx, 0) | ||
714 | |||
715 | #define TEGRA_INIT_DATA_NODIV(_name, _con_id, _dev_id, _parents, _offset, \ | ||
716 | _mux_shift, _mux_mask, _clk_num, _regs, \ | ||
717 | _gate_flags, _clk_id) \ | ||
718 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset,\ | ||
719 | _mux_shift, _mux_mask, 0, 0, 0, 0, 0, _regs, \ | ||
720 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
721 | _clk_id, _parents##_idx, 0) | ||
722 | |||
723 | #define TEGRA_INIT_DATA_XUSB(_name, _con_id, _dev_id, _parents, _offset, \ | ||
724 | _clk_num, _regs, _gate_flags, _clk_id) \ | ||
725 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parents, _offset, \ | ||
726 | 29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_INT, _regs, \ | ||
727 | _clk_num, periph_clk_enb_refcnt, _gate_flags, \ | ||
728 | _clk_id, _parents##_idx, 0) | ||
729 | |||
730 | #define TEGRA_INIT_DATA_AUDIO(_name, _con_id, _dev_id, _offset, _clk_num,\ | ||
731 | _regs, _gate_flags, _clk_id) \ | ||
732 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, mux_d_audio_clk, \ | ||
733 | _offset, 16, 0xE01F, 0, 0, 8, 1, 0, _regs, _clk_num, \ | ||
734 | periph_clk_enb_refcnt, _gate_flags , _clk_id, \ | ||
735 | mux_d_audio_clk_idx, 0) | ||
736 | |||
737 | enum tegra114_clk { | ||
738 | rtc = 4, timer = 5, uarta = 6, sdmmc2 = 9, i2s1 = 11, i2c1 = 12, | ||
739 | ndflash = 13, sdmmc1 = 14, sdmmc4 = 15, pwm = 17, i2s2 = 18, epp = 19, | ||
740 | gr_2d = 21, usbd = 22, isp = 23, gr_3d = 24, disp2 = 26, disp1 = 27, | ||
741 | host1x = 28, vcp = 29, i2s0 = 30, apbdma = 34, kbc = 36, kfuse = 40, | ||
742 | sbc1 = 41, nor = 42, sbc2 = 44, sbc3 = 46, i2c5 = 47, dsia = 48, | ||
743 | mipi = 50, hdmi = 51, csi = 52, i2c2 = 54, uartc = 55, mipi_cal = 56, | ||
744 | emc, usb2, usb3, vde = 61, bsea = 62, bsev = 63, uartd = 65, | ||
745 | i2c3 = 67, sbc4 = 68, sdmmc3 = 69, owr = 71, csite = 73, | ||
746 | la = 76, trace = 77, soc_therm = 78, dtv = 79, ndspeed = 80, | ||
747 | i2cslow = 81, dsib = 82, tsec = 83, xusb_host = 89, msenc = 91, | ||
748 | csus = 92, mselect = 99, tsensor = 100, i2s3 = 101, i2s4 = 102, | ||
749 | i2c4 = 103, sbc5 = 104, sbc6 = 105, d_audio, apbif = 107, dam0, dam1, | ||
750 | dam2, hda2codec_2x = 111, audio0_2x = 113, audio1_2x, audio2_2x, | ||
751 | audio3_2x, audio4_2x, spdif_2x, actmon = 119, extern1 = 120, | ||
752 | extern2 = 121, extern3 = 122, hda = 125, se = 127, hda2hdmi = 128, | ||
753 | cilab = 144, cilcd = 145, cile = 146, dsialp = 147, dsiblp = 148, | ||
754 | dds = 150, dp2 = 152, amx = 153, adx = 154, xusb_ss = 156, uartb = 192, | ||
755 | vfir, spdif_in, spdif_out, vi, vi_sensor, fuse, fuse_burn, clk_32k, | ||
756 | clk_m, clk_m_div2, clk_m_div4, pll_ref, pll_c, pll_c_out1, pll_c2, | ||
757 | pll_c3, pll_m, pll_m_out1, pll_p, pll_p_out1, pll_p_out2, pll_p_out3, | ||
758 | pll_p_out4, pll_a, pll_a_out0, pll_d, pll_d_out0, pll_d2, pll_d2_out0, | ||
759 | pll_u, pll_u_480M, pll_u_60M, pll_u_48M, pll_u_12M, pll_x, pll_x_out0, | ||
760 | pll_re_vco, pll_re_out, pll_e_out0, spdif_in_sync, i2s0_sync, | ||
761 | i2s1_sync, i2s2_sync, i2s3_sync, i2s4_sync, vimclk_sync, audio0, | ||
762 | audio1, audio2, audio3, audio4, spdif, clk_out_1, clk_out_2, clk_out_3, | ||
763 | blink, xusb_host_src = 252, xusb_falcon_src, xusb_fs_src, xusb_ss_src, | ||
764 | xusb_dev_src, xusb_dev, xusb_hs_src, sclk, hclk, pclk, cclk_g, cclk_lp, | ||
765 | |||
766 | /* Mux clocks */ | ||
767 | |||
768 | audio0_mux = 300, audio1_mux, audio2_mux, audio3_mux, audio4_mux, | ||
769 | spdif_mux, clk_out_1_mux, clk_out_2_mux, clk_out_3_mux, dsia_mux, | ||
770 | dsib_mux, clk_max, | ||
771 | }; | ||
772 | |||
773 | struct utmi_clk_param { | ||
774 | /* Oscillator Frequency in KHz */ | ||
775 | u32 osc_frequency; | ||
776 | /* UTMIP PLL Enable Delay Count */ | ||
777 | u8 enable_delay_count; | ||
778 | /* UTMIP PLL Stable count */ | ||
779 | u8 stable_count; | ||
780 | /* UTMIP PLL Active delay count */ | ||
781 | u8 active_delay_count; | ||
782 | /* UTMIP PLL Xtal frequency count */ | ||
783 | u8 xtal_freq_count; | ||
784 | }; | ||
785 | |||
786 | static const struct utmi_clk_param utmi_parameters[] = { | ||
787 | {.osc_frequency = 13000000, .enable_delay_count = 0x02, | ||
788 | .stable_count = 0x33, .active_delay_count = 0x05, | ||
789 | .xtal_freq_count = 0x7F}, | ||
790 | {.osc_frequency = 19200000, .enable_delay_count = 0x03, | ||
791 | .stable_count = 0x4B, .active_delay_count = 0x06, | ||
792 | .xtal_freq_count = 0xBB}, | ||
793 | {.osc_frequency = 12000000, .enable_delay_count = 0x02, | ||
794 | .stable_count = 0x2F, .active_delay_count = 0x04, | ||
795 | .xtal_freq_count = 0x76}, | ||
796 | {.osc_frequency = 26000000, .enable_delay_count = 0x04, | ||
797 | .stable_count = 0x66, .active_delay_count = 0x09, | ||
798 | .xtal_freq_count = 0xFE}, | ||
799 | {.osc_frequency = 16800000, .enable_delay_count = 0x03, | ||
800 | .stable_count = 0x41, .active_delay_count = 0x0A, | ||
801 | .xtal_freq_count = 0xA4}, | ||
802 | }; | ||
803 | |||
804 | /* peripheral mux definitions */ | ||
805 | |||
806 | #define MUX_I2S_SPDIF(_id) \ | ||
807 | static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \ | ||
808 | #_id, "pll_p",\ | ||
809 | "clk_m"}; | ||
810 | MUX_I2S_SPDIF(audio0) | ||
811 | MUX_I2S_SPDIF(audio1) | ||
812 | MUX_I2S_SPDIF(audio2) | ||
813 | MUX_I2S_SPDIF(audio3) | ||
814 | MUX_I2S_SPDIF(audio4) | ||
815 | MUX_I2S_SPDIF(audio) | ||
816 | |||
817 | #define mux_pllaout0_audio0_2x_pllp_clkm_idx NULL | ||
818 | #define mux_pllaout0_audio1_2x_pllp_clkm_idx NULL | ||
819 | #define mux_pllaout0_audio2_2x_pllp_clkm_idx NULL | ||
820 | #define mux_pllaout0_audio3_2x_pllp_clkm_idx NULL | ||
821 | #define mux_pllaout0_audio4_2x_pllp_clkm_idx NULL | ||
822 | #define mux_pllaout0_audio_2x_pllp_clkm_idx NULL | ||
823 | |||
824 | static const char *mux_pllp_pllc_pllm_clkm[] = { | ||
825 | "pll_p", "pll_c", "pll_m", "clk_m" | ||
826 | }; | ||
827 | #define mux_pllp_pllc_pllm_clkm_idx NULL | ||
828 | |||
829 | static const char *mux_pllp_pllc_pllm[] = { "pll_p", "pll_c", "pll_m" }; | ||
830 | #define mux_pllp_pllc_pllm_idx NULL | ||
831 | |||
832 | static const char *mux_pllp_pllc_clk32_clkm[] = { | ||
833 | "pll_p", "pll_c", "clk_32k", "clk_m" | ||
834 | }; | ||
835 | #define mux_pllp_pllc_clk32_clkm_idx NULL | ||
836 | |||
837 | static const char *mux_plla_pllc_pllp_clkm[] = { | ||
838 | "pll_a_out0", "pll_c", "pll_p", "clk_m" | ||
839 | }; | ||
840 | #define mux_plla_pllc_pllp_clkm_idx mux_pllp_pllc_pllm_clkm_idx | ||
841 | |||
842 | static const char *mux_pllp_pllc2_c_c3_pllm_clkm[] = { | ||
843 | "pll_p", "pll_c2", "pll_c", "pll_c3", "pll_m", "clk_m" | ||
844 | }; | ||
845 | static u32 mux_pllp_pllc2_c_c3_pllm_clkm_idx[] = { | ||
846 | [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, | ||
847 | }; | ||
848 | |||
849 | static const char *mux_pllp_clkm[] = { | ||
850 | "pll_p", "clk_m" | ||
851 | }; | ||
852 | static u32 mux_pllp_clkm_idx[] = { | ||
853 | [0] = 0, [1] = 3, | ||
854 | }; | ||
855 | |||
856 | static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = { | ||
857 | "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0" | ||
858 | }; | ||
859 | #define mux_pllm_pllc2_c_c3_pllp_plla_idx mux_pllp_pllc2_c_c3_pllm_clkm_idx | ||
860 | |||
861 | static const char *mux_pllp_pllm_plld_plla_pllc_plld2_clkm[] = { | ||
862 | "pll_p", "pll_m", "pll_d_out0", "pll_a_out0", "pll_c", | ||
863 | "pll_d2_out0", "clk_m" | ||
864 | }; | ||
865 | #define mux_pllp_pllm_plld_plla_pllc_plld2_clkm_idx NULL | ||
866 | |||
867 | static const char *mux_pllm_pllc_pllp_plla[] = { | ||
868 | "pll_m", "pll_c", "pll_p", "pll_a_out0" | ||
869 | }; | ||
870 | #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx | ||
871 | |||
872 | static const char *mux_pllp_pllc_clkm[] = { | ||
873 | "pll_p", "pll_c", "pll_m" | ||
874 | }; | ||
875 | static u32 mux_pllp_pllc_clkm_idx[] = { | ||
876 | [0] = 0, [1] = 1, [2] = 3, | ||
877 | }; | ||
878 | |||
879 | static const char *mux_pllp_pllc_clkm_clk32[] = { | ||
880 | "pll_p", "pll_c", "clk_m", "clk_32k" | ||
881 | }; | ||
882 | #define mux_pllp_pllc_clkm_clk32_idx NULL | ||
883 | |||
884 | static const char *mux_plla_clk32_pllp_clkm_plle[] = { | ||
885 | "pll_a_out0", "clk_32k", "pll_p", "clk_m", "pll_e_out0" | ||
886 | }; | ||
887 | #define mux_plla_clk32_pllp_clkm_plle_idx NULL | ||
888 | |||
889 | static const char *mux_clkm_pllp_pllc_pllre[] = { | ||
890 | "clk_m", "pll_p", "pll_c", "pll_re_out" | ||
891 | }; | ||
892 | static u32 mux_clkm_pllp_pllc_pllre_idx[] = { | ||
893 | [0] = 0, [1] = 1, [2] = 3, [3] = 5, | ||
894 | }; | ||
895 | |||
896 | static const char *mux_clkm_48M_pllp_480M[] = { | ||
897 | "clk_m", "pll_u_48M", "pll_p", "pll_u_480M" | ||
898 | }; | ||
899 | #define mux_clkm_48M_pllp_480M_idx NULL | ||
900 | |||
901 | static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = { | ||
902 | "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref" | ||
903 | }; | ||
904 | static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = { | ||
905 | [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7, | ||
906 | }; | ||
907 | |||
908 | static const char *mux_plld_out0_plld2_out0[] = { | ||
909 | "pll_d_out0", "pll_d2_out0", | ||
910 | }; | ||
911 | #define mux_plld_out0_plld2_out0_idx NULL | ||
912 | |||
913 | static const char *mux_d_audio_clk[] = { | ||
914 | "pll_a_out0", "pll_p", "clk_m", "spdif_in_sync", "i2s0_sync", | ||
915 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
916 | }; | ||
917 | static u32 mux_d_audio_clk_idx[] = { | ||
918 | [0] = 0, [1] = 0x8000, [2] = 0xc000, [3] = 0xE000, [4] = 0xE001, | ||
919 | [5] = 0xE002, [6] = 0xE003, [7] = 0xE004, [8] = 0xE005, [9] = 0xE007, | ||
920 | }; | ||
921 | |||
922 | static const char *mux_pllmcp_clkm[] = { | ||
923 | "pll_m_out0", "pll_c_out0", "pll_p_out0", "clk_m", "pll_m_ud", | ||
924 | }; | ||
925 | |||
926 | static const struct clk_div_table pll_re_div_table[] = { | ||
927 | { .val = 0, .div = 1 }, | ||
928 | { .val = 1, .div = 2 }, | ||
929 | { .val = 2, .div = 3 }, | ||
930 | { .val = 3, .div = 4 }, | ||
931 | { .val = 4, .div = 5 }, | ||
932 | { .val = 5, .div = 6 }, | ||
933 | { .val = 0, .div = 0 }, | ||
934 | }; | ||
935 | |||
936 | static struct clk *clks[clk_max]; | ||
937 | static struct clk_onecell_data clk_data; | ||
938 | |||
939 | static unsigned long osc_freq; | ||
940 | static unsigned long pll_ref_freq; | ||
941 | |||
942 | static int __init tegra114_osc_clk_init(void __iomem *clk_base) | ||
943 | { | ||
944 | struct clk *clk; | ||
945 | u32 val, pll_ref_div; | ||
946 | |||
947 | val = readl_relaxed(clk_base + OSC_CTRL); | ||
948 | |||
949 | osc_freq = tegra114_input_freq[val >> OSC_CTRL_OSC_FREQ_SHIFT]; | ||
950 | if (!osc_freq) { | ||
951 | WARN_ON(1); | ||
952 | return -EINVAL; | ||
953 | } | ||
954 | |||
955 | /* clk_m */ | ||
956 | clk = clk_register_fixed_rate(NULL, "clk_m", NULL, CLK_IS_ROOT, | ||
957 | osc_freq); | ||
958 | clk_register_clkdev(clk, "clk_m", NULL); | ||
959 | clks[clk_m] = clk; | ||
960 | |||
961 | /* pll_ref */ | ||
962 | val = (val >> OSC_CTRL_PLL_REF_DIV_SHIFT) & 3; | ||
963 | pll_ref_div = 1 << val; | ||
964 | clk = clk_register_fixed_factor(NULL, "pll_ref", "clk_m", | ||
965 | CLK_SET_RATE_PARENT, 1, pll_ref_div); | ||
966 | clk_register_clkdev(clk, "pll_ref", NULL); | ||
967 | clks[pll_ref] = clk; | ||
968 | |||
969 | pll_ref_freq = osc_freq / pll_ref_div; | ||
970 | |||
971 | return 0; | ||
972 | } | ||
973 | |||
974 | static void __init tegra114_fixed_clk_init(void __iomem *clk_base) | ||
975 | { | ||
976 | struct clk *clk; | ||
977 | |||
978 | /* clk_32k */ | ||
979 | clk = clk_register_fixed_rate(NULL, "clk_32k", NULL, CLK_IS_ROOT, | ||
980 | 32768); | ||
981 | clk_register_clkdev(clk, "clk_32k", NULL); | ||
982 | clks[clk_32k] = clk; | ||
983 | |||
984 | /* clk_m_div2 */ | ||
985 | clk = clk_register_fixed_factor(NULL, "clk_m_div2", "clk_m", | ||
986 | CLK_SET_RATE_PARENT, 1, 2); | ||
987 | clk_register_clkdev(clk, "clk_m_div2", NULL); | ||
988 | clks[clk_m_div2] = clk; | ||
989 | |||
990 | /* clk_m_div4 */ | ||
991 | clk = clk_register_fixed_factor(NULL, "clk_m_div4", "clk_m", | ||
992 | CLK_SET_RATE_PARENT, 1, 4); | ||
993 | clk_register_clkdev(clk, "clk_m_div4", NULL); | ||
994 | clks[clk_m_div4] = clk; | ||
995 | |||
996 | } | ||
997 | |||
998 | static __init void tegra114_utmi_param_configure(void __iomem *clk_base) | ||
999 | { | ||
1000 | u32 reg; | ||
1001 | int i; | ||
1002 | |||
1003 | for (i = 0; i < ARRAY_SIZE(utmi_parameters); i++) { | ||
1004 | if (osc_freq == utmi_parameters[i].osc_frequency) | ||
1005 | break; | ||
1006 | } | ||
1007 | |||
1008 | if (i >= ARRAY_SIZE(utmi_parameters)) { | ||
1009 | pr_err("%s: Unexpected oscillator freq %lu\n", __func__, | ||
1010 | osc_freq); | ||
1011 | return; | ||
1012 | } | ||
1013 | |||
1014 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG2); | ||
1015 | |||
1016 | /* Program UTMIP PLL stable and active counts */ | ||
1017 | /* [FIXME] arclk_rst.h says WRONG! This should be 1ms -> 0x50 Check! */ | ||
1018 | reg &= ~UTMIP_PLL_CFG2_STABLE_COUNT(~0); | ||
1019 | reg |= UTMIP_PLL_CFG2_STABLE_COUNT(utmi_parameters[i].stable_count); | ||
1020 | |||
1021 | reg &= ~UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(~0); | ||
1022 | |||
1023 | reg |= UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(utmi_parameters[i]. | ||
1024 | active_delay_count); | ||
1025 | |||
1026 | /* Remove power downs from UTMIP PLL control bits */ | ||
1027 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN; | ||
1028 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN; | ||
1029 | reg &= ~UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN; | ||
1030 | |||
1031 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG2); | ||
1032 | |||
1033 | /* Program UTMIP PLL delay and oscillator frequency counts */ | ||
1034 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1035 | reg &= ~UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(~0); | ||
1036 | |||
1037 | reg |= UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(utmi_parameters[i]. | ||
1038 | enable_delay_count); | ||
1039 | |||
1040 | reg &= ~UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(~0); | ||
1041 | reg |= UTMIP_PLL_CFG1_XTAL_FREQ_COUNT(utmi_parameters[i]. | ||
1042 | xtal_freq_count); | ||
1043 | |||
1044 | /* Remove power downs from UTMIP PLL control bits */ | ||
1045 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1046 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ACTIVE_POWERDOWN; | ||
1047 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERUP; | ||
1048 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLLU_POWERDOWN; | ||
1049 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1050 | |||
1051 | /* Setup HW control of UTMIPLL */ | ||
1052 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1053 | reg |= UTMIPLL_HW_PWRDN_CFG0_USE_LOCKDET; | ||
1054 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_CLK_ENABLE_SWCTL; | ||
1055 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_START_STATE; | ||
1056 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1057 | |||
1058 | reg = readl_relaxed(clk_base + UTMIP_PLL_CFG1); | ||
1059 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERUP; | ||
1060 | reg &= ~UTMIP_PLL_CFG1_FORCE_PLL_ENABLE_POWERDOWN; | ||
1061 | writel_relaxed(reg, clk_base + UTMIP_PLL_CFG1); | ||
1062 | |||
1063 | udelay(1); | ||
1064 | |||
1065 | /* Setup SW override of UTMIPLL assuming USB2.0 | ||
1066 | ports are assigned to USB2 */ | ||
1067 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1068 | reg |= UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL; | ||
1069 | reg &= ~UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE; | ||
1070 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1071 | |||
1072 | udelay(1); | ||
1073 | |||
1074 | /* Enable HW control UTMIPLL */ | ||
1075 | reg = readl_relaxed(clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1076 | reg |= UTMIPLL_HW_PWRDN_CFG0_SEQ_ENABLE; | ||
1077 | writel_relaxed(reg, clk_base + UTMIPLL_HW_PWRDN_CFG0); | ||
1078 | } | ||
1079 | |||
1080 | static void __init _clip_vco_min(struct tegra_clk_pll_params *pll_params) | ||
1081 | { | ||
1082 | pll_params->vco_min = | ||
1083 | DIV_ROUND_UP(pll_params->vco_min, pll_ref_freq) * pll_ref_freq; | ||
1084 | } | ||
1085 | |||
1086 | static int __init _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params, | ||
1087 | void __iomem *clk_base) | ||
1088 | { | ||
1089 | u32 val; | ||
1090 | u32 step_a, step_b; | ||
1091 | |||
1092 | switch (pll_ref_freq) { | ||
1093 | case 12000000: | ||
1094 | case 13000000: | ||
1095 | case 26000000: | ||
1096 | step_a = 0x2B; | ||
1097 | step_b = 0x0B; | ||
1098 | break; | ||
1099 | case 16800000: | ||
1100 | step_a = 0x1A; | ||
1101 | step_b = 0x09; | ||
1102 | break; | ||
1103 | case 19200000: | ||
1104 | step_a = 0x12; | ||
1105 | step_b = 0x08; | ||
1106 | break; | ||
1107 | default: | ||
1108 | pr_err("%s: Unexpected reference rate %lu\n", | ||
1109 | __func__, pll_ref_freq); | ||
1110 | WARN_ON(1); | ||
1111 | return -EINVAL; | ||
1112 | } | ||
1113 | |||
1114 | val = step_a << pll_params->stepa_shift; | ||
1115 | val |= step_b << pll_params->stepb_shift; | ||
1116 | writel_relaxed(val, clk_base + pll_params->dyn_ramp_reg); | ||
1117 | |||
1118 | return 0; | ||
1119 | } | ||
1120 | |||
1121 | static void __init _init_iddq(struct tegra_clk_pll_params *pll_params, | ||
1122 | void __iomem *clk_base) | ||
1123 | { | ||
1124 | u32 val, val_iddq; | ||
1125 | |||
1126 | val = readl_relaxed(clk_base + pll_params->base_reg); | ||
1127 | val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg); | ||
1128 | |||
1129 | if (val & BIT(30)) | ||
1130 | WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx)); | ||
1131 | else { | ||
1132 | val_iddq |= BIT(pll_params->iddq_bit_idx); | ||
1133 | writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | static void __init tegra114_pll_init(void __iomem *clk_base, | ||
1138 | void __iomem *pmc) | ||
1139 | { | ||
1140 | u32 val; | ||
1141 | struct clk *clk; | ||
1142 | |||
1143 | /* PLLC */ | ||
1144 | _clip_vco_min(&pll_c_params); | ||
1145 | if (_setup_dynamic_ramp(&pll_c_params, clk_base) >= 0) { | ||
1146 | _init_iddq(&pll_c_params, clk_base); | ||
1147 | clk = tegra_clk_register_pllxc("pll_c", "pll_ref", clk_base, | ||
1148 | pmc, 0, 0, &pll_c_params, TEGRA_PLL_USE_LOCK, | ||
1149 | pll_c_freq_table, NULL); | ||
1150 | clk_register_clkdev(clk, "pll_c", NULL); | ||
1151 | clks[pll_c] = clk; | ||
1152 | |||
1153 | /* PLLC_OUT1 */ | ||
1154 | clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", | ||
1155 | clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1156 | 8, 8, 1, NULL); | ||
1157 | clk = tegra_clk_register_pll_out("pll_c_out1", "pll_c_out1_div", | ||
1158 | clk_base + PLLC_OUT, 1, 0, | ||
1159 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1160 | clk_register_clkdev(clk, "pll_c_out1", NULL); | ||
1161 | clks[pll_c_out1] = clk; | ||
1162 | } | ||
1163 | |||
1164 | /* PLLC2 */ | ||
1165 | _clip_vco_min(&pll_c2_params); | ||
1166 | clk = tegra_clk_register_pllc("pll_c2", "pll_ref", clk_base, pmc, 0, 0, | ||
1167 | &pll_c2_params, TEGRA_PLL_USE_LOCK, | ||
1168 | pll_cx_freq_table, NULL); | ||
1169 | clk_register_clkdev(clk, "pll_c2", NULL); | ||
1170 | clks[pll_c2] = clk; | ||
1171 | |||
1172 | /* PLLC3 */ | ||
1173 | _clip_vco_min(&pll_c3_params); | ||
1174 | clk = tegra_clk_register_pllc("pll_c3", "pll_ref", clk_base, pmc, 0, 0, | ||
1175 | &pll_c3_params, TEGRA_PLL_USE_LOCK, | ||
1176 | pll_cx_freq_table, NULL); | ||
1177 | clk_register_clkdev(clk, "pll_c3", NULL); | ||
1178 | clks[pll_c3] = clk; | ||
1179 | |||
1180 | /* PLLP */ | ||
1181 | clk = tegra_clk_register_pll("pll_p", "pll_ref", clk_base, pmc, 0, | ||
1182 | 408000000, &pll_p_params, | ||
1183 | TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK, | ||
1184 | pll_p_freq_table, NULL); | ||
1185 | clk_register_clkdev(clk, "pll_p", NULL); | ||
1186 | clks[pll_p] = clk; | ||
1187 | |||
1188 | /* PLLP_OUT1 */ | ||
1189 | clk = tegra_clk_register_divider("pll_p_out1_div", "pll_p", | ||
1190 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1191 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1192 | clk = tegra_clk_register_pll_out("pll_p_out1", "pll_p_out1_div", | ||
1193 | clk_base + PLLP_OUTA, 1, 0, | ||
1194 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1195 | &pll_div_lock); | ||
1196 | clk_register_clkdev(clk, "pll_p_out1", NULL); | ||
1197 | clks[pll_p_out1] = clk; | ||
1198 | |||
1199 | /* PLLP_OUT2 */ | ||
1200 | clk = tegra_clk_register_divider("pll_p_out2_div", "pll_p", | ||
1201 | clk_base + PLLP_OUTA, 0, TEGRA_DIVIDER_FIXED | | ||
1202 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
1203 | &pll_div_lock); | ||
1204 | clk = tegra_clk_register_pll_out("pll_p_out2", "pll_p_out2_div", | ||
1205 | clk_base + PLLP_OUTA, 17, 16, | ||
1206 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1207 | &pll_div_lock); | ||
1208 | clk_register_clkdev(clk, "pll_p_out2", NULL); | ||
1209 | clks[pll_p_out2] = clk; | ||
1210 | |||
1211 | /* PLLP_OUT3 */ | ||
1212 | clk = tegra_clk_register_divider("pll_p_out3_div", "pll_p", | ||
1213 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1214 | TEGRA_DIVIDER_ROUND_UP, 8, 8, 1, &pll_div_lock); | ||
1215 | clk = tegra_clk_register_pll_out("pll_p_out3", "pll_p_out3_div", | ||
1216 | clk_base + PLLP_OUTB, 1, 0, | ||
1217 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1218 | &pll_div_lock); | ||
1219 | clk_register_clkdev(clk, "pll_p_out3", NULL); | ||
1220 | clks[pll_p_out3] = clk; | ||
1221 | |||
1222 | /* PLLP_OUT4 */ | ||
1223 | clk = tegra_clk_register_divider("pll_p_out4_div", "pll_p", | ||
1224 | clk_base + PLLP_OUTB, 0, TEGRA_DIVIDER_FIXED | | ||
1225 | TEGRA_DIVIDER_ROUND_UP, 24, 8, 1, | ||
1226 | &pll_div_lock); | ||
1227 | clk = tegra_clk_register_pll_out("pll_p_out4", "pll_p_out4_div", | ||
1228 | clk_base + PLLP_OUTB, 17, 16, | ||
1229 | CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0, | ||
1230 | &pll_div_lock); | ||
1231 | clk_register_clkdev(clk, "pll_p_out4", NULL); | ||
1232 | clks[pll_p_out4] = clk; | ||
1233 | |||
1234 | /* PLLM */ | ||
1235 | _clip_vco_min(&pll_m_params); | ||
1236 | clk = tegra_clk_register_pllm("pll_m", "pll_ref", clk_base, pmc, | ||
1237 | CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE, 0, | ||
1238 | &pll_m_params, TEGRA_PLL_USE_LOCK, | ||
1239 | pll_m_freq_table, NULL); | ||
1240 | clk_register_clkdev(clk, "pll_m", NULL); | ||
1241 | clks[pll_m] = clk; | ||
1242 | |||
1243 | /* PLLM_OUT1 */ | ||
1244 | clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", | ||
1245 | clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1246 | 8, 8, 1, NULL); | ||
1247 | clk = tegra_clk_register_pll_out("pll_m_out1", "pll_m_out1_div", | ||
1248 | clk_base + PLLM_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1249 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1250 | clk_register_clkdev(clk, "pll_m_out1", NULL); | ||
1251 | clks[pll_m_out1] = clk; | ||
1252 | |||
1253 | /* PLLM_UD */ | ||
1254 | clk = clk_register_fixed_factor(NULL, "pll_m_ud", "pll_m", | ||
1255 | CLK_SET_RATE_PARENT, 1, 1); | ||
1256 | |||
1257 | /* PLLX */ | ||
1258 | _clip_vco_min(&pll_x_params); | ||
1259 | if (_setup_dynamic_ramp(&pll_x_params, clk_base) >= 0) { | ||
1260 | _init_iddq(&pll_x_params, clk_base); | ||
1261 | clk = tegra_clk_register_pllxc("pll_x", "pll_ref", clk_base, | ||
1262 | pmc, CLK_IGNORE_UNUSED, 0, &pll_x_params, | ||
1263 | TEGRA_PLL_USE_LOCK, pll_x_freq_table, NULL); | ||
1264 | clk_register_clkdev(clk, "pll_x", NULL); | ||
1265 | clks[pll_x] = clk; | ||
1266 | } | ||
1267 | |||
1268 | /* PLLX_OUT0 */ | ||
1269 | clk = clk_register_fixed_factor(NULL, "pll_x_out0", "pll_x", | ||
1270 | CLK_SET_RATE_PARENT, 1, 2); | ||
1271 | clk_register_clkdev(clk, "pll_x_out0", NULL); | ||
1272 | clks[pll_x_out0] = clk; | ||
1273 | |||
1274 | /* PLLU */ | ||
1275 | val = readl(clk_base + pll_u_params.base_reg); | ||
1276 | val &= ~BIT(24); /* disable PLLU_OVERRIDE */ | ||
1277 | writel(val, clk_base + pll_u_params.base_reg); | ||
1278 | |||
1279 | clk = tegra_clk_register_pll("pll_u", "pll_ref", clk_base, pmc, 0, | ||
1280 | 0, &pll_u_params, TEGRA_PLLU | | ||
1281 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1282 | TEGRA_PLL_USE_LOCK, pll_u_freq_table, &pll_u_lock); | ||
1283 | clk_register_clkdev(clk, "pll_u", NULL); | ||
1284 | clks[pll_u] = clk; | ||
1285 | |||
1286 | tegra114_utmi_param_configure(clk_base); | ||
1287 | |||
1288 | /* PLLU_480M */ | ||
1289 | clk = clk_register_gate(NULL, "pll_u_480M", "pll_u", | ||
1290 | CLK_SET_RATE_PARENT, clk_base + PLLU_BASE, | ||
1291 | 22, 0, &pll_u_lock); | ||
1292 | clk_register_clkdev(clk, "pll_u_480M", NULL); | ||
1293 | clks[pll_u_480M] = clk; | ||
1294 | |||
1295 | /* PLLU_60M */ | ||
1296 | clk = clk_register_fixed_factor(NULL, "pll_u_60M", "pll_u", | ||
1297 | CLK_SET_RATE_PARENT, 1, 8); | ||
1298 | clk_register_clkdev(clk, "pll_u_60M", NULL); | ||
1299 | clks[pll_u_60M] = clk; | ||
1300 | |||
1301 | /* PLLU_48M */ | ||
1302 | clk = clk_register_fixed_factor(NULL, "pll_u_48M", "pll_u", | ||
1303 | CLK_SET_RATE_PARENT, 1, 10); | ||
1304 | clk_register_clkdev(clk, "pll_u_48M", NULL); | ||
1305 | clks[pll_u_48M] = clk; | ||
1306 | |||
1307 | /* PLLU_12M */ | ||
1308 | clk = clk_register_fixed_factor(NULL, "pll_u_12M", "pll_u", | ||
1309 | CLK_SET_RATE_PARENT, 1, 40); | ||
1310 | clk_register_clkdev(clk, "pll_u_12M", NULL); | ||
1311 | clks[pll_u_12M] = clk; | ||
1312 | |||
1313 | /* PLLD */ | ||
1314 | clk = tegra_clk_register_pll("pll_d", "pll_ref", clk_base, pmc, 0, | ||
1315 | 0, &pll_d_params, | ||
1316 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1317 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d_lock); | ||
1318 | clk_register_clkdev(clk, "pll_d", NULL); | ||
1319 | clks[pll_d] = clk; | ||
1320 | |||
1321 | /* PLLD_OUT0 */ | ||
1322 | clk = clk_register_fixed_factor(NULL, "pll_d_out0", "pll_d", | ||
1323 | CLK_SET_RATE_PARENT, 1, 2); | ||
1324 | clk_register_clkdev(clk, "pll_d_out0", NULL); | ||
1325 | clks[pll_d_out0] = clk; | ||
1326 | |||
1327 | /* PLLD2 */ | ||
1328 | clk = tegra_clk_register_pll("pll_d2", "pll_ref", clk_base, pmc, 0, | ||
1329 | 0, &pll_d2_params, | ||
1330 | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON | | ||
1331 | TEGRA_PLL_USE_LOCK, pll_d_freq_table, &pll_d2_lock); | ||
1332 | clk_register_clkdev(clk, "pll_d2", NULL); | ||
1333 | clks[pll_d2] = clk; | ||
1334 | |||
1335 | /* PLLD2_OUT0 */ | ||
1336 | clk = clk_register_fixed_factor(NULL, "pll_d2_out0", "pll_d2", | ||
1337 | CLK_SET_RATE_PARENT, 1, 2); | ||
1338 | clk_register_clkdev(clk, "pll_d2_out0", NULL); | ||
1339 | clks[pll_d2_out0] = clk; | ||
1340 | |||
1341 | /* PLLA */ | ||
1342 | clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base, pmc, 0, | ||
1343 | 0, &pll_a_params, TEGRA_PLL_HAS_CPCON | | ||
1344 | TEGRA_PLL_USE_LOCK, pll_a_freq_table, NULL); | ||
1345 | clk_register_clkdev(clk, "pll_a", NULL); | ||
1346 | clks[pll_a] = clk; | ||
1347 | |||
1348 | /* PLLA_OUT0 */ | ||
1349 | clk = tegra_clk_register_divider("pll_a_out0_div", "pll_a", | ||
1350 | clk_base + PLLA_OUT, 0, TEGRA_DIVIDER_ROUND_UP, | ||
1351 | 8, 8, 1, NULL); | ||
1352 | clk = tegra_clk_register_pll_out("pll_a_out0", "pll_a_out0_div", | ||
1353 | clk_base + PLLA_OUT, 1, 0, CLK_IGNORE_UNUSED | | ||
1354 | CLK_SET_RATE_PARENT, 0, NULL); | ||
1355 | clk_register_clkdev(clk, "pll_a_out0", NULL); | ||
1356 | clks[pll_a_out0] = clk; | ||
1357 | |||
1358 | /* PLLRE */ | ||
1359 | _clip_vco_min(&pll_re_vco_params); | ||
1360 | clk = tegra_clk_register_pllre("pll_re_vco", "pll_ref", clk_base, pmc, | ||
1361 | 0, 0, &pll_re_vco_params, TEGRA_PLL_USE_LOCK, | ||
1362 | NULL, &pll_re_lock, pll_ref_freq); | ||
1363 | clk_register_clkdev(clk, "pll_re_vco", NULL); | ||
1364 | clks[pll_re_vco] = clk; | ||
1365 | |||
1366 | clk = clk_register_divider_table(NULL, "pll_re_out", "pll_re_vco", 0, | ||
1367 | clk_base + PLLRE_BASE, 16, 4, 0, | ||
1368 | pll_re_div_table, &pll_re_lock); | ||
1369 | clk_register_clkdev(clk, "pll_re_out", NULL); | ||
1370 | clks[pll_re_out] = clk; | ||
1371 | |||
1372 | /* PLLE */ | ||
1373 | clk = tegra_clk_register_plle_tegra114("pll_e_out0", "pll_re_vco", | ||
1374 | clk_base, 0, 100000000, &pll_e_params, | ||
1375 | pll_e_freq_table, NULL); | ||
1376 | clk_register_clkdev(clk, "pll_e_out0", NULL); | ||
1377 | clks[pll_e_out0] = clk; | ||
1378 | } | ||
1379 | |||
1380 | static const char *mux_audio_sync_clk[] = { "spdif_in_sync", "i2s0_sync", | ||
1381 | "i2s1_sync", "i2s2_sync", "i2s3_sync", "i2s4_sync", "vimclk_sync", | ||
1382 | }; | ||
1383 | |||
1384 | static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2", | ||
1385 | "clk_m_div4", "extern1", | ||
1386 | }; | ||
1387 | |||
1388 | static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2", | ||
1389 | "clk_m_div4", "extern2", | ||
1390 | }; | ||
1391 | |||
1392 | static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2", | ||
1393 | "clk_m_div4", "extern3", | ||
1394 | }; | ||
1395 | |||
1396 | static void __init tegra114_audio_clk_init(void __iomem *clk_base) | ||
1397 | { | ||
1398 | struct clk *clk; | ||
1399 | |||
1400 | /* spdif_in_sync */ | ||
1401 | clk = tegra_clk_register_sync_source("spdif_in_sync", 24000000, | ||
1402 | 24000000); | ||
1403 | clk_register_clkdev(clk, "spdif_in_sync", NULL); | ||
1404 | clks[spdif_in_sync] = clk; | ||
1405 | |||
1406 | /* i2s0_sync */ | ||
1407 | clk = tegra_clk_register_sync_source("i2s0_sync", 24000000, 24000000); | ||
1408 | clk_register_clkdev(clk, "i2s0_sync", NULL); | ||
1409 | clks[i2s0_sync] = clk; | ||
1410 | |||
1411 | /* i2s1_sync */ | ||
1412 | clk = tegra_clk_register_sync_source("i2s1_sync", 24000000, 24000000); | ||
1413 | clk_register_clkdev(clk, "i2s1_sync", NULL); | ||
1414 | clks[i2s1_sync] = clk; | ||
1415 | |||
1416 | /* i2s2_sync */ | ||
1417 | clk = tegra_clk_register_sync_source("i2s2_sync", 24000000, 24000000); | ||
1418 | clk_register_clkdev(clk, "i2s2_sync", NULL); | ||
1419 | clks[i2s2_sync] = clk; | ||
1420 | |||
1421 | /* i2s3_sync */ | ||
1422 | clk = tegra_clk_register_sync_source("i2s3_sync", 24000000, 24000000); | ||
1423 | clk_register_clkdev(clk, "i2s3_sync", NULL); | ||
1424 | clks[i2s3_sync] = clk; | ||
1425 | |||
1426 | /* i2s4_sync */ | ||
1427 | clk = tegra_clk_register_sync_source("i2s4_sync", 24000000, 24000000); | ||
1428 | clk_register_clkdev(clk, "i2s4_sync", NULL); | ||
1429 | clks[i2s4_sync] = clk; | ||
1430 | |||
1431 | /* vimclk_sync */ | ||
1432 | clk = tegra_clk_register_sync_source("vimclk_sync", 24000000, 24000000); | ||
1433 | clk_register_clkdev(clk, "vimclk_sync", NULL); | ||
1434 | clks[vimclk_sync] = clk; | ||
1435 | |||
1436 | /* audio0 */ | ||
1437 | clk = clk_register_mux(NULL, "audio0_mux", mux_audio_sync_clk, | ||
1438 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1439 | clk_base + AUDIO_SYNC_CLK_I2S0, 0, 3, 0, | ||
1440 | NULL); | ||
1441 | clks[audio0_mux] = clk; | ||
1442 | clk = clk_register_gate(NULL, "audio0", "audio0_mux", 0, | ||
1443 | clk_base + AUDIO_SYNC_CLK_I2S0, 4, | ||
1444 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1445 | clk_register_clkdev(clk, "audio0", NULL); | ||
1446 | clks[audio0] = clk; | ||
1447 | |||
1448 | /* audio1 */ | ||
1449 | clk = clk_register_mux(NULL, "audio1_mux", mux_audio_sync_clk, | ||
1450 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1451 | clk_base + AUDIO_SYNC_CLK_I2S1, 0, 3, 0, | ||
1452 | NULL); | ||
1453 | clks[audio1_mux] = clk; | ||
1454 | clk = clk_register_gate(NULL, "audio1", "audio1_mux", 0, | ||
1455 | clk_base + AUDIO_SYNC_CLK_I2S1, 4, | ||
1456 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1457 | clk_register_clkdev(clk, "audio1", NULL); | ||
1458 | clks[audio1] = clk; | ||
1459 | |||
1460 | /* audio2 */ | ||
1461 | clk = clk_register_mux(NULL, "audio2_mux", mux_audio_sync_clk, | ||
1462 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1463 | clk_base + AUDIO_SYNC_CLK_I2S2, 0, 3, 0, | ||
1464 | NULL); | ||
1465 | clks[audio2_mux] = clk; | ||
1466 | clk = clk_register_gate(NULL, "audio2", "audio2_mux", 0, | ||
1467 | clk_base + AUDIO_SYNC_CLK_I2S2, 4, | ||
1468 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1469 | clk_register_clkdev(clk, "audio2", NULL); | ||
1470 | clks[audio2] = clk; | ||
1471 | |||
1472 | /* audio3 */ | ||
1473 | clk = clk_register_mux(NULL, "audio3_mux", mux_audio_sync_clk, | ||
1474 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1475 | clk_base + AUDIO_SYNC_CLK_I2S3, 0, 3, 0, | ||
1476 | NULL); | ||
1477 | clks[audio3_mux] = clk; | ||
1478 | clk = clk_register_gate(NULL, "audio3", "audio3_mux", 0, | ||
1479 | clk_base + AUDIO_SYNC_CLK_I2S3, 4, | ||
1480 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1481 | clk_register_clkdev(clk, "audio3", NULL); | ||
1482 | clks[audio3] = clk; | ||
1483 | |||
1484 | /* audio4 */ | ||
1485 | clk = clk_register_mux(NULL, "audio4_mux", mux_audio_sync_clk, | ||
1486 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1487 | clk_base + AUDIO_SYNC_CLK_I2S4, 0, 3, 0, | ||
1488 | NULL); | ||
1489 | clks[audio4_mux] = clk; | ||
1490 | clk = clk_register_gate(NULL, "audio4", "audio4_mux", 0, | ||
1491 | clk_base + AUDIO_SYNC_CLK_I2S4, 4, | ||
1492 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1493 | clk_register_clkdev(clk, "audio4", NULL); | ||
1494 | clks[audio4] = clk; | ||
1495 | |||
1496 | /* spdif */ | ||
1497 | clk = clk_register_mux(NULL, "spdif_mux", mux_audio_sync_clk, | ||
1498 | ARRAY_SIZE(mux_audio_sync_clk), 0, | ||
1499 | clk_base + AUDIO_SYNC_CLK_SPDIF, 0, 3, 0, | ||
1500 | NULL); | ||
1501 | clks[spdif_mux] = clk; | ||
1502 | clk = clk_register_gate(NULL, "spdif", "spdif_mux", 0, | ||
1503 | clk_base + AUDIO_SYNC_CLK_SPDIF, 4, | ||
1504 | CLK_GATE_SET_TO_DISABLE, NULL); | ||
1505 | clk_register_clkdev(clk, "spdif", NULL); | ||
1506 | clks[spdif] = clk; | ||
1507 | |||
1508 | /* audio0_2x */ | ||
1509 | clk = clk_register_fixed_factor(NULL, "audio0_doubler", "audio0", | ||
1510 | CLK_SET_RATE_PARENT, 2, 1); | ||
1511 | clk = tegra_clk_register_divider("audio0_div", "audio0_doubler", | ||
1512 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 24, 1, | ||
1513 | 0, &clk_doubler_lock); | ||
1514 | clk = tegra_clk_register_periph_gate("audio0_2x", "audio0_div", | ||
1515 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1516 | CLK_SET_RATE_PARENT, 113, &periph_v_regs, | ||
1517 | periph_clk_enb_refcnt); | ||
1518 | clk_register_clkdev(clk, "audio0_2x", NULL); | ||
1519 | clks[audio0_2x] = clk; | ||
1520 | |||
1521 | /* audio1_2x */ | ||
1522 | clk = clk_register_fixed_factor(NULL, "audio1_doubler", "audio1", | ||
1523 | CLK_SET_RATE_PARENT, 2, 1); | ||
1524 | clk = tegra_clk_register_divider("audio1_div", "audio1_doubler", | ||
1525 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 25, 1, | ||
1526 | 0, &clk_doubler_lock); | ||
1527 | clk = tegra_clk_register_periph_gate("audio1_2x", "audio1_div", | ||
1528 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1529 | CLK_SET_RATE_PARENT, 114, &periph_v_regs, | ||
1530 | periph_clk_enb_refcnt); | ||
1531 | clk_register_clkdev(clk, "audio1_2x", NULL); | ||
1532 | clks[audio1_2x] = clk; | ||
1533 | |||
1534 | /* audio2_2x */ | ||
1535 | clk = clk_register_fixed_factor(NULL, "audio2_doubler", "audio2", | ||
1536 | CLK_SET_RATE_PARENT, 2, 1); | ||
1537 | clk = tegra_clk_register_divider("audio2_div", "audio2_doubler", | ||
1538 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 26, 1, | ||
1539 | 0, &clk_doubler_lock); | ||
1540 | clk = tegra_clk_register_periph_gate("audio2_2x", "audio2_div", | ||
1541 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1542 | CLK_SET_RATE_PARENT, 115, &periph_v_regs, | ||
1543 | periph_clk_enb_refcnt); | ||
1544 | clk_register_clkdev(clk, "audio2_2x", NULL); | ||
1545 | clks[audio2_2x] = clk; | ||
1546 | |||
1547 | /* audio3_2x */ | ||
1548 | clk = clk_register_fixed_factor(NULL, "audio3_doubler", "audio3", | ||
1549 | CLK_SET_RATE_PARENT, 2, 1); | ||
1550 | clk = tegra_clk_register_divider("audio3_div", "audio3_doubler", | ||
1551 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 27, 1, | ||
1552 | 0, &clk_doubler_lock); | ||
1553 | clk = tegra_clk_register_periph_gate("audio3_2x", "audio3_div", | ||
1554 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1555 | CLK_SET_RATE_PARENT, 116, &periph_v_regs, | ||
1556 | periph_clk_enb_refcnt); | ||
1557 | clk_register_clkdev(clk, "audio3_2x", NULL); | ||
1558 | clks[audio3_2x] = clk; | ||
1559 | |||
1560 | /* audio4_2x */ | ||
1561 | clk = clk_register_fixed_factor(NULL, "audio4_doubler", "audio4", | ||
1562 | CLK_SET_RATE_PARENT, 2, 1); | ||
1563 | clk = tegra_clk_register_divider("audio4_div", "audio4_doubler", | ||
1564 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 28, 1, | ||
1565 | 0, &clk_doubler_lock); | ||
1566 | clk = tegra_clk_register_periph_gate("audio4_2x", "audio4_div", | ||
1567 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1568 | CLK_SET_RATE_PARENT, 117, &periph_v_regs, | ||
1569 | periph_clk_enb_refcnt); | ||
1570 | clk_register_clkdev(clk, "audio4_2x", NULL); | ||
1571 | clks[audio4_2x] = clk; | ||
1572 | |||
1573 | /* spdif_2x */ | ||
1574 | clk = clk_register_fixed_factor(NULL, "spdif_doubler", "spdif", | ||
1575 | CLK_SET_RATE_PARENT, 2, 1); | ||
1576 | clk = tegra_clk_register_divider("spdif_div", "spdif_doubler", | ||
1577 | clk_base + AUDIO_SYNC_DOUBLER, 0, 0, 29, 1, | ||
1578 | 0, &clk_doubler_lock); | ||
1579 | clk = tegra_clk_register_periph_gate("spdif_2x", "spdif_div", | ||
1580 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1581 | CLK_SET_RATE_PARENT, 118, | ||
1582 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1583 | clk_register_clkdev(clk, "spdif_2x", NULL); | ||
1584 | clks[spdif_2x] = clk; | ||
1585 | } | ||
1586 | |||
1587 | static void __init tegra114_pmc_clk_init(void __iomem *pmc_base) | ||
1588 | { | ||
1589 | struct clk *clk; | ||
1590 | |||
1591 | /* clk_out_1 */ | ||
1592 | clk = clk_register_mux(NULL, "clk_out_1_mux", clk_out1_parents, | ||
1593 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1594 | pmc_base + PMC_CLK_OUT_CNTRL, 6, 3, 0, | ||
1595 | &clk_out_lock); | ||
1596 | clks[clk_out_1_mux] = clk; | ||
1597 | clk = clk_register_gate(NULL, "clk_out_1", "clk_out_1_mux", 0, | ||
1598 | pmc_base + PMC_CLK_OUT_CNTRL, 2, 0, | ||
1599 | &clk_out_lock); | ||
1600 | clk_register_clkdev(clk, "extern1", "clk_out_1"); | ||
1601 | clks[clk_out_1] = clk; | ||
1602 | |||
1603 | /* clk_out_2 */ | ||
1604 | clk = clk_register_mux(NULL, "clk_out_2_mux", clk_out2_parents, | ||
1605 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1606 | pmc_base + PMC_CLK_OUT_CNTRL, 14, 3, 0, | ||
1607 | &clk_out_lock); | ||
1608 | clks[clk_out_2_mux] = clk; | ||
1609 | clk = clk_register_gate(NULL, "clk_out_2", "clk_out_2_mux", 0, | ||
1610 | pmc_base + PMC_CLK_OUT_CNTRL, 10, 0, | ||
1611 | &clk_out_lock); | ||
1612 | clk_register_clkdev(clk, "extern2", "clk_out_2"); | ||
1613 | clks[clk_out_2] = clk; | ||
1614 | |||
1615 | /* clk_out_3 */ | ||
1616 | clk = clk_register_mux(NULL, "clk_out_3_mux", clk_out3_parents, | ||
1617 | ARRAY_SIZE(clk_out1_parents), 0, | ||
1618 | pmc_base + PMC_CLK_OUT_CNTRL, 22, 3, 0, | ||
1619 | &clk_out_lock); | ||
1620 | clks[clk_out_3_mux] = clk; | ||
1621 | clk = clk_register_gate(NULL, "clk_out_3", "clk_out_3_mux", 0, | ||
1622 | pmc_base + PMC_CLK_OUT_CNTRL, 18, 0, | ||
1623 | &clk_out_lock); | ||
1624 | clk_register_clkdev(clk, "extern3", "clk_out_3"); | ||
1625 | clks[clk_out_3] = clk; | ||
1626 | |||
1627 | /* blink */ | ||
1628 | clk = clk_register_gate(NULL, "blink_override", "clk_32k", 0, | ||
1629 | pmc_base + PMC_DPD_PADS_ORIDE, | ||
1630 | PMC_DPD_PADS_ORIDE_BLINK_ENB, 0, NULL); | ||
1631 | clk = clk_register_gate(NULL, "blink", "blink_override", 0, | ||
1632 | pmc_base + PMC_CTRL, | ||
1633 | PMC_CTRL_BLINK_ENB, 0, NULL); | ||
1634 | clk_register_clkdev(clk, "blink", NULL); | ||
1635 | clks[blink] = clk; | ||
1636 | |||
1637 | } | ||
1638 | |||
1639 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", | ||
1640 | "pll_p_out3", "pll_p_out2", "unused", | ||
1641 | "clk_32k", "pll_m_out1" }; | ||
1642 | |||
1643 | static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1644 | "pll_p", "pll_p_out4", "unused", | ||
1645 | "unused", "pll_x" }; | ||
1646 | |||
1647 | static const char *cclk_lp_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | ||
1648 | "pll_p", "pll_p_out4", "unused", | ||
1649 | "unused", "pll_x", "pll_x_out0" }; | ||
1650 | |||
1651 | static void __init tegra114_super_clk_init(void __iomem *clk_base) | ||
1652 | { | ||
1653 | struct clk *clk; | ||
1654 | |||
1655 | /* CCLKG */ | ||
1656 | clk = tegra_clk_register_super_mux("cclk_g", cclk_g_parents, | ||
1657 | ARRAY_SIZE(cclk_g_parents), | ||
1658 | CLK_SET_RATE_PARENT, | ||
1659 | clk_base + CCLKG_BURST_POLICY, | ||
1660 | 0, 4, 0, 0, NULL); | ||
1661 | clk_register_clkdev(clk, "cclk_g", NULL); | ||
1662 | clks[cclk_g] = clk; | ||
1663 | |||
1664 | /* CCLKLP */ | ||
1665 | clk = tegra_clk_register_super_mux("cclk_lp", cclk_lp_parents, | ||
1666 | ARRAY_SIZE(cclk_lp_parents), | ||
1667 | CLK_SET_RATE_PARENT, | ||
1668 | clk_base + CCLKLP_BURST_POLICY, | ||
1669 | 0, 4, 8, 9, NULL); | ||
1670 | clk_register_clkdev(clk, "cclk_lp", NULL); | ||
1671 | clks[cclk_lp] = clk; | ||
1672 | |||
1673 | /* SCLK */ | ||
1674 | clk = tegra_clk_register_super_mux("sclk", sclk_parents, | ||
1675 | ARRAY_SIZE(sclk_parents), | ||
1676 | CLK_SET_RATE_PARENT, | ||
1677 | clk_base + SCLK_BURST_POLICY, | ||
1678 | 0, 4, 0, 0, NULL); | ||
1679 | clk_register_clkdev(clk, "sclk", NULL); | ||
1680 | clks[sclk] = clk; | ||
1681 | |||
1682 | /* HCLK */ | ||
1683 | clk = clk_register_divider(NULL, "hclk_div", "sclk", 0, | ||
1684 | clk_base + SYSTEM_CLK_RATE, 4, 2, 0, | ||
1685 | &sysrate_lock); | ||
1686 | clk = clk_register_gate(NULL, "hclk", "hclk_div", CLK_SET_RATE_PARENT | | ||
1687 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1688 | 7, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1689 | clk_register_clkdev(clk, "hclk", NULL); | ||
1690 | clks[hclk] = clk; | ||
1691 | |||
1692 | /* PCLK */ | ||
1693 | clk = clk_register_divider(NULL, "pclk_div", "hclk", 0, | ||
1694 | clk_base + SYSTEM_CLK_RATE, 0, 2, 0, | ||
1695 | &sysrate_lock); | ||
1696 | clk = clk_register_gate(NULL, "pclk", "pclk_div", CLK_SET_RATE_PARENT | | ||
1697 | CLK_IGNORE_UNUSED, clk_base + SYSTEM_CLK_RATE, | ||
1698 | 3, CLK_GATE_SET_TO_DISABLE, &sysrate_lock); | ||
1699 | clk_register_clkdev(clk, "pclk", NULL); | ||
1700 | clks[pclk] = clk; | ||
1701 | } | ||
1702 | |||
1703 | static struct tegra_periph_init_data tegra_periph_clk_list[] = { | ||
1704 | TEGRA_INIT_DATA_MUX("i2s0", NULL, "tegra30-i2s.0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s0), | ||
1705 | TEGRA_INIT_DATA_MUX("i2s1", NULL, "tegra30-i2s.1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s1), | ||
1706 | TEGRA_INIT_DATA_MUX("i2s2", NULL, "tegra30-i2s.2", mux_pllaout0_audio2_2x_pllp_clkm, CLK_SOURCE_I2S2, 18, &periph_l_regs, TEGRA_PERIPH_ON_APB, i2s2), | ||
1707 | TEGRA_INIT_DATA_MUX("i2s3", NULL, "tegra30-i2s.3", mux_pllaout0_audio3_2x_pllp_clkm, CLK_SOURCE_I2S3, 101, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s3), | ||
1708 | TEGRA_INIT_DATA_MUX("i2s4", NULL, "tegra30-i2s.4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, &periph_v_regs, TEGRA_PERIPH_ON_APB, i2s4), | ||
1709 | TEGRA_INIT_DATA_MUX("spdif_out", "spdif_out", "tegra30-spdif", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_out), | ||
1710 | TEGRA_INIT_DATA_MUX("spdif_in", "spdif_in", "tegra30-spdif", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, &periph_l_regs, TEGRA_PERIPH_ON_APB, spdif_in), | ||
1711 | TEGRA_INIT_DATA_MUX("pwm", NULL, "pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, &periph_l_regs, TEGRA_PERIPH_ON_APB, pwm), | ||
1712 | TEGRA_INIT_DATA_MUX("adx", NULL, "adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, &periph_w_regs, TEGRA_PERIPH_ON_APB, adx), | ||
1713 | TEGRA_INIT_DATA_MUX("amx", NULL, "amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, &periph_w_regs, TEGRA_PERIPH_ON_APB, amx), | ||
1714 | TEGRA_INIT_DATA_MUX("hda", "hda", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda), | ||
1715 | TEGRA_INIT_DATA_MUX("hda2codec_2x", "hda2codec", "tegra30-hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, &periph_v_regs, TEGRA_PERIPH_ON_APB, hda2codec_2x), | ||
1716 | TEGRA_INIT_DATA_MUX("sbc1", NULL, "tegra11-spi.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC1, 41, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc1), | ||
1717 | TEGRA_INIT_DATA_MUX("sbc2", NULL, "tegra11-spi.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC2, 44, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc2), | ||
1718 | TEGRA_INIT_DATA_MUX("sbc3", NULL, "tegra11-spi.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC3, 46, &periph_h_regs, TEGRA_PERIPH_ON_APB, sbc3), | ||
1719 | TEGRA_INIT_DATA_MUX("sbc4", NULL, "tegra11-spi.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC4, 68, &periph_u_regs, TEGRA_PERIPH_ON_APB, sbc4), | ||
1720 | TEGRA_INIT_DATA_MUX("sbc5", NULL, "tegra11-spi.4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC5, 104, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc5), | ||
1721 | TEGRA_INIT_DATA_MUX("sbc6", NULL, "tegra11-spi.5", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SBC6, 105, &periph_v_regs, TEGRA_PERIPH_ON_APB, sbc6), | ||
1722 | TEGRA_INIT_DATA_MUX8("ndflash", NULL, "tegra_nand", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), | ||
1723 | TEGRA_INIT_DATA_MUX8("ndspeed", NULL, "tegra_nand_speed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, &periph_u_regs, TEGRA_PERIPH_ON_APB, ndspeed), | ||
1724 | TEGRA_INIT_DATA_MUX("vfir", NULL, "vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, &periph_l_regs, TEGRA_PERIPH_ON_APB, vfir), | ||
1725 | TEGRA_INIT_DATA_MUX("sdmmc1", NULL, "sdhci-tegra.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, &periph_l_regs, 0, sdmmc1), | ||
1726 | TEGRA_INIT_DATA_MUX("sdmmc2", NULL, "sdhci-tegra.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, &periph_l_regs, 0, sdmmc2), | ||
1727 | TEGRA_INIT_DATA_MUX("sdmmc3", NULL, "sdhci-tegra.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, &periph_u_regs, 0, sdmmc3), | ||
1728 | TEGRA_INIT_DATA_MUX("sdmmc4", NULL, "sdhci-tegra.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, &periph_l_regs, 0, sdmmc4), | ||
1729 | TEGRA_INIT_DATA_INT("vde", NULL, "vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, &periph_h_regs, 0, vde), | ||
1730 | TEGRA_INIT_DATA_MUX_FLAGS("csite", NULL, "csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, &periph_u_regs, TEGRA_PERIPH_ON_APB, csite, CLK_IGNORE_UNUSED), | ||
1731 | TEGRA_INIT_DATA_MUX("la", NULL, "la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, &periph_u_regs, TEGRA_PERIPH_ON_APB, la), | ||
1732 | TEGRA_INIT_DATA_MUX("trace", NULL, "trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, &periph_u_regs, TEGRA_PERIPH_ON_APB, trace), | ||
1733 | TEGRA_INIT_DATA_MUX("owr", NULL, "tegra_w1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, &periph_u_regs, TEGRA_PERIPH_ON_APB, owr), | ||
1734 | TEGRA_INIT_DATA_MUX("nor", NULL, "tegra-nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, &periph_h_regs, 0, nor), | ||
1735 | TEGRA_INIT_DATA_MUX("mipi", NULL, "mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, &periph_h_regs, TEGRA_PERIPH_ON_APB, mipi), | ||
1736 | TEGRA_INIT_DATA_I2C("i2c1", "div-clk", "tegra11-i2c.0", mux_pllp_clkm, CLK_SOURCE_I2C1, 12, &periph_l_regs, i2c1), | ||
1737 | TEGRA_INIT_DATA_I2C("i2c2", "div-clk", "tegra11-i2c.1", mux_pllp_clkm, CLK_SOURCE_I2C2, 54, &periph_h_regs, i2c2), | ||
1738 | TEGRA_INIT_DATA_I2C("i2c3", "div-clk", "tegra11-i2c.2", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, &periph_u_regs, i2c3), | ||
1739 | TEGRA_INIT_DATA_I2C("i2c4", "div-clk", "tegra11-i2c.3", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, &periph_v_regs, i2c4), | ||
1740 | TEGRA_INIT_DATA_I2C("i2c5", "div-clk", "tegra11-i2c.4", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, &periph_h_regs, i2c5), | ||
1741 | TEGRA_INIT_DATA_UART("uarta", NULL, "tegra_uart.0", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, &periph_l_regs, uarta), | ||
1742 | TEGRA_INIT_DATA_UART("uartb", NULL, "tegra_uart.1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, &periph_l_regs, uartb), | ||
1743 | TEGRA_INIT_DATA_UART("uartc", NULL, "tegra_uart.2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, &periph_h_regs, uartc), | ||
1744 | TEGRA_INIT_DATA_UART("uartd", NULL, "tegra_uart.3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, &periph_u_regs, uartd), | ||
1745 | TEGRA_INIT_DATA_INT("3d", NULL, "3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, &periph_l_regs, 0, gr_3d), | ||
1746 | TEGRA_INIT_DATA_INT("2d", NULL, "2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, &periph_l_regs, 0, gr_2d), | ||
1747 | TEGRA_INIT_DATA_MUX("vi_sensor", "vi_sensor", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, &periph_l_regs, TEGRA_PERIPH_NO_RESET, vi_sensor), | ||
1748 | TEGRA_INIT_DATA_INT8("vi", "vi", "tegra_camera", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, &periph_l_regs, 0, vi), | ||
1749 | TEGRA_INIT_DATA_INT8("epp", NULL, "epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, &periph_l_regs, 0, epp), | ||
1750 | TEGRA_INIT_DATA_INT8("msenc", NULL, "msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, &periph_h_regs, TEGRA_PERIPH_WAR_1005168, msenc), | ||
1751 | TEGRA_INIT_DATA_INT8("tsec", NULL, "tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, &periph_u_regs, 0, tsec), | ||
1752 | TEGRA_INIT_DATA_INT8("host1x", NULL, "host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, &periph_l_regs, 0, host1x), | ||
1753 | TEGRA_INIT_DATA_MUX8("hdmi", NULL, "hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, &periph_h_regs, 0, hdmi), | ||
1754 | TEGRA_INIT_DATA_MUX("cilab", "cilab", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, &periph_w_regs, 0, cilab), | ||
1755 | TEGRA_INIT_DATA_MUX("cilcd", "cilcd", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, &periph_w_regs, 0, cilcd), | ||
1756 | TEGRA_INIT_DATA_MUX("cile", "cile", "tegra_camera", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, &periph_w_regs, 0, cile), | ||
1757 | TEGRA_INIT_DATA_MUX("dsialp", "dsialp", "tegradc.0", mux_pllp_pllc_clkm, CLK_SOURCE_DSIALP, 147, &periph_w_regs, 0, dsialp), | ||
1758 | TEGRA_INIT_DATA_MUX("dsiblp", "dsiblp", "tegradc.1", mux_pllp_pllc_clkm, CLK_SOURCE_DSIBLP, 148, &periph_w_regs, 0, dsiblp), | ||
1759 | TEGRA_INIT_DATA_MUX("tsensor", NULL, "tegra-tsensor", mux_pllp_pllc_clkm_clk32, CLK_SOURCE_TSENSOR, 100, &periph_v_regs, TEGRA_PERIPH_ON_APB, tsensor), | ||
1760 | TEGRA_INIT_DATA_MUX("actmon", NULL, "actmon", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_ACTMON, 119, &periph_v_regs, 0, actmon), | ||
1761 | TEGRA_INIT_DATA_MUX8("extern1", NULL, "extern1", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN1, 120, &periph_v_regs, 0, extern1), | ||
1762 | TEGRA_INIT_DATA_MUX8("extern2", NULL, "extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, &periph_v_regs, 0, extern2), | ||
1763 | TEGRA_INIT_DATA_MUX8("extern3", NULL, "extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, &periph_v_regs, 0, extern3), | ||
1764 | TEGRA_INIT_DATA_MUX("i2cslow", NULL, "i2cslow", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_I2CSLOW, 81, &periph_u_regs, TEGRA_PERIPH_ON_APB, i2cslow), | ||
1765 | TEGRA_INIT_DATA_INT8("se", NULL, "se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, &periph_v_regs, TEGRA_PERIPH_ON_APB, se), | ||
1766 | TEGRA_INIT_DATA_INT_FLAGS("mselect", NULL, "mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, &periph_v_regs, 0, mselect, CLK_IGNORE_UNUSED), | ||
1767 | TEGRA_INIT_DATA_MUX8("soc_therm", NULL, "soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, &periph_u_regs, TEGRA_PERIPH_ON_APB, soc_therm), | ||
1768 | TEGRA_INIT_DATA_XUSB("xusb_host_src", "host_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, &periph_w_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_host_src), | ||
1769 | TEGRA_INIT_DATA_XUSB("xusb_falcon_src", "falcon_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_falcon_src), | ||
1770 | TEGRA_INIT_DATA_XUSB("xusb_fs_src", "fs_src", "tegra_xhci", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_fs_src), | ||
1771 | TEGRA_INIT_DATA_XUSB("xusb_ss_src", "ss_src", "tegra_xhci", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, &periph_w_regs, TEGRA_PERIPH_NO_RESET, xusb_ss_src), | ||
1772 | TEGRA_INIT_DATA_XUSB("xusb_dev_src", "dev_src", "tegra_xhci", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, &periph_u_regs, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, xusb_dev_src), | ||
1773 | TEGRA_INIT_DATA_AUDIO("d_audio", "d_audio", "tegra30-ahub", CLK_SOURCE_D_AUDIO, 106, &periph_v_regs, TEGRA_PERIPH_ON_APB, d_audio), | ||
1774 | TEGRA_INIT_DATA_AUDIO("dam0", NULL, "tegra30-dam.0", CLK_SOURCE_DAM0, 108, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam0), | ||
1775 | TEGRA_INIT_DATA_AUDIO("dam1", NULL, "tegra30-dam.1", CLK_SOURCE_DAM1, 109, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam1), | ||
1776 | TEGRA_INIT_DATA_AUDIO("dam2", NULL, "tegra30-dam.2", CLK_SOURCE_DAM2, 110, &periph_v_regs, TEGRA_PERIPH_ON_APB, dam2), | ||
1777 | }; | ||
1778 | |||
1779 | static struct tegra_periph_init_data tegra_periph_nodiv_clk_list[] = { | ||
1780 | TEGRA_INIT_DATA_NODIV("disp1", NULL, "tegradc.0", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, &periph_l_regs, 0, disp1), | ||
1781 | TEGRA_INIT_DATA_NODIV("disp2", NULL, "tegradc.1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, &periph_l_regs, 0, disp2), | ||
1782 | }; | ||
1783 | |||
1784 | static __init void tegra114_periph_clk_init(void __iomem *clk_base) | ||
1785 | { | ||
1786 | struct tegra_periph_init_data *data; | ||
1787 | struct clk *clk; | ||
1788 | int i; | ||
1789 | u32 val; | ||
1790 | |||
1791 | /* apbdma */ | ||
1792 | clk = tegra_clk_register_periph_gate("apbdma", "clk_m", 0, clk_base, | ||
1793 | 0, 34, &periph_h_regs, | ||
1794 | periph_clk_enb_refcnt); | ||
1795 | clks[apbdma] = clk; | ||
1796 | |||
1797 | /* rtc */ | ||
1798 | clk = tegra_clk_register_periph_gate("rtc", "clk_32k", | ||
1799 | TEGRA_PERIPH_ON_APB | | ||
1800 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1801 | 0, 4, &periph_l_regs, | ||
1802 | periph_clk_enb_refcnt); | ||
1803 | clk_register_clkdev(clk, NULL, "rtc-tegra"); | ||
1804 | clks[rtc] = clk; | ||
1805 | |||
1806 | /* kbc */ | ||
1807 | clk = tegra_clk_register_periph_gate("kbc", "clk_32k", | ||
1808 | TEGRA_PERIPH_ON_APB | | ||
1809 | TEGRA_PERIPH_NO_RESET, clk_base, | ||
1810 | 0, 36, &periph_h_regs, | ||
1811 | periph_clk_enb_refcnt); | ||
1812 | clks[kbc] = clk; | ||
1813 | |||
1814 | /* timer */ | ||
1815 | clk = tegra_clk_register_periph_gate("timer", "clk_m", 0, clk_base, | ||
1816 | 0, 5, &periph_l_regs, | ||
1817 | periph_clk_enb_refcnt); | ||
1818 | clk_register_clkdev(clk, NULL, "timer"); | ||
1819 | clks[timer] = clk; | ||
1820 | |||
1821 | /* kfuse */ | ||
1822 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | ||
1823 | TEGRA_PERIPH_ON_APB, clk_base, 0, 40, | ||
1824 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1825 | clks[kfuse] = clk; | ||
1826 | |||
1827 | /* fuse */ | ||
1828 | clk = tegra_clk_register_periph_gate("fuse", "clk_m", | ||
1829 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1830 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1831 | clks[fuse] = clk; | ||
1832 | |||
1833 | /* fuse_burn */ | ||
1834 | clk = tegra_clk_register_periph_gate("fuse_burn", "clk_m", | ||
1835 | TEGRA_PERIPH_ON_APB, clk_base, 0, 39, | ||
1836 | &periph_h_regs, periph_clk_enb_refcnt); | ||
1837 | clks[fuse_burn] = clk; | ||
1838 | |||
1839 | /* apbif */ | ||
1840 | clk = tegra_clk_register_periph_gate("apbif", "clk_m", | ||
1841 | TEGRA_PERIPH_ON_APB, clk_base, 0, 107, | ||
1842 | &periph_v_regs, periph_clk_enb_refcnt); | ||
1843 | clks[apbif] = clk; | ||
1844 | |||
1845 | /* hda2hdmi */ | ||
1846 | clk = tegra_clk_register_periph_gate("hda2hdmi", "clk_m", | ||
1847 | TEGRA_PERIPH_ON_APB, clk_base, 0, 128, | ||
1848 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1849 | clks[hda2hdmi] = clk; | ||
1850 | |||
1851 | /* vcp */ | ||
1852 | clk = tegra_clk_register_periph_gate("vcp", "clk_m", 0, clk_base, 0, | ||
1853 | 29, &periph_l_regs, | ||
1854 | periph_clk_enb_refcnt); | ||
1855 | clks[vcp] = clk; | ||
1856 | |||
1857 | /* bsea */ | ||
1858 | clk = tegra_clk_register_periph_gate("bsea", "clk_m", 0, clk_base, | ||
1859 | 0, 62, &periph_h_regs, | ||
1860 | periph_clk_enb_refcnt); | ||
1861 | clks[bsea] = clk; | ||
1862 | |||
1863 | /* bsev */ | ||
1864 | clk = tegra_clk_register_periph_gate("bsev", "clk_m", 0, clk_base, | ||
1865 | 0, 63, &periph_h_regs, | ||
1866 | periph_clk_enb_refcnt); | ||
1867 | clks[bsev] = clk; | ||
1868 | |||
1869 | /* mipi-cal */ | ||
1870 | clk = tegra_clk_register_periph_gate("mipi-cal", "clk_m", 0, clk_base, | ||
1871 | 0, 56, &periph_h_regs, | ||
1872 | periph_clk_enb_refcnt); | ||
1873 | clks[mipi_cal] = clk; | ||
1874 | |||
1875 | /* usbd */ | ||
1876 | clk = tegra_clk_register_periph_gate("usbd", "clk_m", 0, clk_base, | ||
1877 | 0, 22, &periph_l_regs, | ||
1878 | periph_clk_enb_refcnt); | ||
1879 | clks[usbd] = clk; | ||
1880 | |||
1881 | /* usb2 */ | ||
1882 | clk = tegra_clk_register_periph_gate("usb2", "clk_m", 0, clk_base, | ||
1883 | 0, 58, &periph_h_regs, | ||
1884 | periph_clk_enb_refcnt); | ||
1885 | clks[usb2] = clk; | ||
1886 | |||
1887 | /* usb3 */ | ||
1888 | clk = tegra_clk_register_periph_gate("usb3", "clk_m", 0, clk_base, | ||
1889 | 0, 59, &periph_h_regs, | ||
1890 | periph_clk_enb_refcnt); | ||
1891 | clks[usb3] = clk; | ||
1892 | |||
1893 | /* csi */ | ||
1894 | clk = tegra_clk_register_periph_gate("csi", "pll_p_out3", 0, clk_base, | ||
1895 | 0, 52, &periph_h_regs, | ||
1896 | periph_clk_enb_refcnt); | ||
1897 | clks[csi] = clk; | ||
1898 | |||
1899 | /* isp */ | ||
1900 | clk = tegra_clk_register_periph_gate("isp", "clk_m", 0, clk_base, 0, | ||
1901 | 23, &periph_l_regs, | ||
1902 | periph_clk_enb_refcnt); | ||
1903 | clks[isp] = clk; | ||
1904 | |||
1905 | /* csus */ | ||
1906 | clk = tegra_clk_register_periph_gate("csus", "clk_m", | ||
1907 | TEGRA_PERIPH_NO_RESET, clk_base, 0, 92, | ||
1908 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1909 | clks[csus] = clk; | ||
1910 | |||
1911 | /* dds */ | ||
1912 | clk = tegra_clk_register_periph_gate("dds", "clk_m", | ||
1913 | TEGRA_PERIPH_ON_APB, clk_base, 0, 150, | ||
1914 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1915 | clks[dds] = clk; | ||
1916 | |||
1917 | /* dp2 */ | ||
1918 | clk = tegra_clk_register_periph_gate("dp2", "clk_m", | ||
1919 | TEGRA_PERIPH_ON_APB, clk_base, 0, 152, | ||
1920 | &periph_w_regs, periph_clk_enb_refcnt); | ||
1921 | clks[dp2] = clk; | ||
1922 | |||
1923 | /* dtv */ | ||
1924 | clk = tegra_clk_register_periph_gate("dtv", "clk_m", | ||
1925 | TEGRA_PERIPH_ON_APB, clk_base, 0, 79, | ||
1926 | &periph_u_regs, periph_clk_enb_refcnt); | ||
1927 | clks[dtv] = clk; | ||
1928 | |||
1929 | /* dsia */ | ||
1930 | clk = clk_register_mux(NULL, "dsia_mux", mux_plld_out0_plld2_out0, | ||
1931 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1932 | clk_base + PLLD_BASE, 25, 1, 0, &pll_d_lock); | ||
1933 | clks[dsia_mux] = clk; | ||
1934 | clk = tegra_clk_register_periph_gate("dsia", "dsia_mux", 0, clk_base, | ||
1935 | 0, 48, &periph_h_regs, | ||
1936 | periph_clk_enb_refcnt); | ||
1937 | clks[dsia] = clk; | ||
1938 | |||
1939 | /* dsib */ | ||
1940 | clk = clk_register_mux(NULL, "dsib_mux", mux_plld_out0_plld2_out0, | ||
1941 | ARRAY_SIZE(mux_plld_out0_plld2_out0), 0, | ||
1942 | clk_base + PLLD2_BASE, 25, 1, 0, &pll_d2_lock); | ||
1943 | clks[dsib_mux] = clk; | ||
1944 | clk = tegra_clk_register_periph_gate("dsib", "dsib_mux", 0, clk_base, | ||
1945 | 0, 82, &periph_u_regs, | ||
1946 | periph_clk_enb_refcnt); | ||
1947 | clks[dsib] = clk; | ||
1948 | |||
1949 | /* xusb_hs_src */ | ||
1950 | val = readl(clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1951 | val |= BIT(25); /* always select PLLU_60M */ | ||
1952 | writel(val, clk_base + CLK_SOURCE_XUSB_SS_SRC); | ||
1953 | |||
1954 | clk = clk_register_fixed_factor(NULL, "xusb_hs_src", "pll_u_60M", 0, | ||
1955 | 1, 1); | ||
1956 | clks[xusb_hs_src] = clk; | ||
1957 | |||
1958 | /* xusb_host */ | ||
1959 | clk = tegra_clk_register_periph_gate("xusb_host", "xusb_host_src", 0, | ||
1960 | clk_base, 0, 89, &periph_u_regs, | ||
1961 | periph_clk_enb_refcnt); | ||
1962 | clks[xusb_host] = clk; | ||
1963 | |||
1964 | /* xusb_ss */ | ||
1965 | clk = tegra_clk_register_periph_gate("xusb_ss", "xusb_ss_src", 0, | ||
1966 | clk_base, 0, 156, &periph_w_regs, | ||
1967 | periph_clk_enb_refcnt); | ||
1968 | clks[xusb_host] = clk; | ||
1969 | |||
1970 | /* xusb_dev */ | ||
1971 | clk = tegra_clk_register_periph_gate("xusb_dev", "xusb_dev_src", 0, | ||
1972 | clk_base, 0, 95, &periph_u_regs, | ||
1973 | periph_clk_enb_refcnt); | ||
1974 | clks[xusb_dev] = clk; | ||
1975 | |||
1976 | /* emc */ | ||
1977 | clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, | ||
1978 | ARRAY_SIZE(mux_pllmcp_clkm), 0, | ||
1979 | clk_base + CLK_SOURCE_EMC, | ||
1980 | 29, 3, 0, NULL); | ||
1981 | clk = tegra_clk_register_periph_gate("emc", "emc_mux", 0, clk_base, | ||
1982 | CLK_IGNORE_UNUSED, 57, &periph_h_regs, | ||
1983 | periph_clk_enb_refcnt); | ||
1984 | clks[emc] = clk; | ||
1985 | |||
1986 | for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) { | ||
1987 | data = &tegra_periph_clk_list[i]; | ||
1988 | clk = tegra_clk_register_periph(data->name, data->parent_names, | ||
1989 | data->num_parents, &data->periph, | ||
1990 | clk_base, data->offset, data->flags); | ||
1991 | clks[data->clk_id] = clk; | ||
1992 | } | ||
1993 | |||
1994 | for (i = 0; i < ARRAY_SIZE(tegra_periph_nodiv_clk_list); i++) { | ||
1995 | data = &tegra_periph_nodiv_clk_list[i]; | ||
1996 | clk = tegra_clk_register_periph_nodiv(data->name, | ||
1997 | data->parent_names, data->num_parents, | ||
1998 | &data->periph, clk_base, data->offset); | ||
1999 | clks[data->clk_id] = clk; | ||
2000 | } | ||
2001 | } | ||
2002 | |||
2003 | static struct tegra_cpu_car_ops tegra114_cpu_car_ops; | ||
2004 | |||
2005 | static const struct of_device_id pmc_match[] __initconst = { | ||
2006 | { .compatible = "nvidia,tegra114-pmc" }, | ||
2007 | {}, | ||
2008 | }; | ||
2009 | |||
2010 | static __initdata struct tegra_clk_init_table init_table[] = { | ||
2011 | {uarta, pll_p, 408000000, 0}, | ||
2012 | {uartb, pll_p, 408000000, 0}, | ||
2013 | {uartc, pll_p, 408000000, 0}, | ||
2014 | {uartd, pll_p, 408000000, 0}, | ||
2015 | {pll_a, clk_max, 564480000, 1}, | ||
2016 | {pll_a_out0, clk_max, 11289600, 1}, | ||
2017 | {extern1, pll_a_out0, 0, 1}, | ||
2018 | {clk_out_1_mux, extern1, 0, 1}, | ||
2019 | {clk_out_1, clk_max, 0, 1}, | ||
2020 | {i2s0, pll_a_out0, 11289600, 0}, | ||
2021 | {i2s1, pll_a_out0, 11289600, 0}, | ||
2022 | {i2s2, pll_a_out0, 11289600, 0}, | ||
2023 | {i2s3, pll_a_out0, 11289600, 0}, | ||
2024 | {i2s4, pll_a_out0, 11289600, 0}, | ||
2025 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | ||
2026 | }; | ||
2027 | |||
2028 | static void __init tegra114_clock_apply_init_table(void) | ||
2029 | { | ||
2030 | tegra_init_from_table(init_table, clks, clk_max); | ||
2031 | } | ||
2032 | |||
2033 | void __init tegra114_clock_init(struct device_node *np) | ||
2034 | { | ||
2035 | struct device_node *node; | ||
2036 | int i; | ||
2037 | |||
2038 | clk_base = of_iomap(np, 0); | ||
2039 | if (!clk_base) { | ||
2040 | pr_err("ioremap tegra114 CAR failed\n"); | ||
2041 | return; | ||
2042 | } | ||
2043 | |||
2044 | node = of_find_matching_node(NULL, pmc_match); | ||
2045 | if (!node) { | ||
2046 | pr_err("Failed to find pmc node\n"); | ||
2047 | WARN_ON(1); | ||
2048 | return; | ||
2049 | } | ||
2050 | |||
2051 | pmc_base = of_iomap(node, 0); | ||
2052 | if (!pmc_base) { | ||
2053 | pr_err("Can't map pmc registers\n"); | ||
2054 | WARN_ON(1); | ||
2055 | return; | ||
2056 | } | ||
2057 | |||
2058 | if (tegra114_osc_clk_init(clk_base) < 0) | ||
2059 | return; | ||
2060 | |||
2061 | tegra114_fixed_clk_init(clk_base); | ||
2062 | tegra114_pll_init(clk_base, pmc_base); | ||
2063 | tegra114_periph_clk_init(clk_base); | ||
2064 | tegra114_audio_clk_init(clk_base); | ||
2065 | tegra114_pmc_clk_init(pmc_base); | ||
2066 | tegra114_super_clk_init(clk_base); | ||
2067 | |||
2068 | for (i = 0; i < ARRAY_SIZE(clks); i++) { | ||
2069 | if (IS_ERR(clks[i])) { | ||
2070 | pr_err | ||
2071 | ("Tegra114 clk %d: register failed with %ld\n", | ||
2072 | i, PTR_ERR(clks[i])); | ||
2073 | } | ||
2074 | if (!clks[i]) | ||
2075 | clks[i] = ERR_PTR(-EINVAL); | ||
2076 | } | ||
2077 | |||
2078 | clk_data.clks = clks; | ||
2079 | clk_data.clk_num = ARRAY_SIZE(clks); | ||
2080 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | ||
2081 | |||
2082 | tegra_clk_apply_init_table = tegra114_clock_apply_init_table; | ||
2083 | |||
2084 | tegra_cpu_car_ops = &tegra114_cpu_car_ops; | ||
2085 | } | ||
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index f873dcefe0de..8292a00c3de9 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c | |||
@@ -86,8 +86,8 @@ | |||
86 | #define PLLE_BASE 0xe8 | 86 | #define PLLE_BASE 0xe8 |
87 | #define PLLE_MISC 0xec | 87 | #define PLLE_MISC 0xec |
88 | 88 | ||
89 | #define PLL_BASE_LOCK 27 | 89 | #define PLL_BASE_LOCK BIT(27) |
90 | #define PLLE_MISC_LOCK 11 | 90 | #define PLLE_MISC_LOCK BIT(11) |
91 | 91 | ||
92 | #define PLL_MISC_LOCK_ENABLE 18 | 92 | #define PLL_MISC_LOCK_ENABLE 18 |
93 | #define PLLDU_MISC_LOCK_ENABLE 22 | 93 | #define PLLDU_MISC_LOCK_ENABLE 22 |
@@ -236,7 +236,7 @@ enum tegra20_clk { | |||
236 | dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, | 236 | dvc, dsi, mipi = 50, hdmi, csi, tvdac, i2c2, uartc, emc = 57, usb2, |
237 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, | 237 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, |
238 | pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb, | 238 | pex, owr, afi, csite, pcie_xclk, avpucq = 75, la, irama = 84, iramb, |
239 | iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev1, cdev2, | 239 | iramc, iramd, cram2, audio_2x, clk_d, csus = 92, cdev2, cdev1, |
240 | uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve, | 240 | uartb = 96, vfir, spdif_in, spdif_out, vi, vi_sensor, tvo, cve, |
241 | osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0, | 241 | osc, clk_32k, clk_m, sclk, cclk, hclk, pclk, blink, pll_a, pll_a_out0, |
242 | pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, | 242 | pll_c, pll_c_out1, pll_d, pll_d_out0, pll_e, pll_m, pll_m_out1, |
@@ -248,125 +248,125 @@ static struct clk *clks[clk_max]; | |||
248 | static struct clk_onecell_data clk_data; | 248 | static struct clk_onecell_data clk_data; |
249 | 249 | ||
250 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | 250 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
251 | { 12000000, 600000000, 600, 12, 1, 8 }, | 251 | { 12000000, 600000000, 600, 12, 0, 8 }, |
252 | { 13000000, 600000000, 600, 13, 1, 8 }, | 252 | { 13000000, 600000000, 600, 13, 0, 8 }, |
253 | { 19200000, 600000000, 500, 16, 1, 6 }, | 253 | { 19200000, 600000000, 500, 16, 0, 6 }, |
254 | { 26000000, 600000000, 600, 26, 1, 8 }, | 254 | { 26000000, 600000000, 600, 26, 0, 8 }, |
255 | { 0, 0, 0, 0, 0, 0 }, | 255 | { 0, 0, 0, 0, 0, 0 }, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | 258 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { |
259 | { 12000000, 666000000, 666, 12, 1, 8}, | 259 | { 12000000, 666000000, 666, 12, 0, 8}, |
260 | { 13000000, 666000000, 666, 13, 1, 8}, | 260 | { 13000000, 666000000, 666, 13, 0, 8}, |
261 | { 19200000, 666000000, 555, 16, 1, 8}, | 261 | { 19200000, 666000000, 555, 16, 0, 8}, |
262 | { 26000000, 666000000, 666, 26, 1, 8}, | 262 | { 26000000, 666000000, 666, 26, 0, 8}, |
263 | { 12000000, 600000000, 600, 12, 1, 8}, | 263 | { 12000000, 600000000, 600, 12, 0, 8}, |
264 | { 13000000, 600000000, 600, 13, 1, 8}, | 264 | { 13000000, 600000000, 600, 13, 0, 8}, |
265 | { 19200000, 600000000, 375, 12, 1, 6}, | 265 | { 19200000, 600000000, 375, 12, 0, 6}, |
266 | { 26000000, 600000000, 600, 26, 1, 8}, | 266 | { 26000000, 600000000, 600, 26, 0, 8}, |
267 | { 0, 0, 0, 0, 0, 0 }, | 267 | { 0, 0, 0, 0, 0, 0 }, |
268 | }; | 268 | }; |
269 | 269 | ||
270 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 270 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
271 | { 12000000, 216000000, 432, 12, 2, 8}, | 271 | { 12000000, 216000000, 432, 12, 1, 8}, |
272 | { 13000000, 216000000, 432, 13, 2, 8}, | 272 | { 13000000, 216000000, 432, 13, 1, 8}, |
273 | { 19200000, 216000000, 90, 4, 2, 1}, | 273 | { 19200000, 216000000, 90, 4, 1, 1}, |
274 | { 26000000, 216000000, 432, 26, 2, 8}, | 274 | { 26000000, 216000000, 432, 26, 1, 8}, |
275 | { 12000000, 432000000, 432, 12, 1, 8}, | 275 | { 12000000, 432000000, 432, 12, 0, 8}, |
276 | { 13000000, 432000000, 432, 13, 1, 8}, | 276 | { 13000000, 432000000, 432, 13, 0, 8}, |
277 | { 19200000, 432000000, 90, 4, 1, 1}, | 277 | { 19200000, 432000000, 90, 4, 0, 1}, |
278 | { 26000000, 432000000, 432, 26, 1, 8}, | 278 | { 26000000, 432000000, 432, 26, 0, 8}, |
279 | { 0, 0, 0, 0, 0, 0 }, | 279 | { 0, 0, 0, 0, 0, 0 }, |
280 | }; | 280 | }; |
281 | 281 | ||
282 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | 282 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
283 | { 28800000, 56448000, 49, 25, 1, 1}, | 283 | { 28800000, 56448000, 49, 25, 0, 1}, |
284 | { 28800000, 73728000, 64, 25, 1, 1}, | 284 | { 28800000, 73728000, 64, 25, 0, 1}, |
285 | { 28800000, 24000000, 5, 6, 1, 1}, | 285 | { 28800000, 24000000, 5, 6, 0, 1}, |
286 | { 0, 0, 0, 0, 0, 0 }, | 286 | { 0, 0, 0, 0, 0, 0 }, |
287 | }; | 287 | }; |
288 | 288 | ||
289 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 289 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
290 | { 12000000, 216000000, 216, 12, 1, 4}, | 290 | { 12000000, 216000000, 216, 12, 0, 4}, |
291 | { 13000000, 216000000, 216, 13, 1, 4}, | 291 | { 13000000, 216000000, 216, 13, 0, 4}, |
292 | { 19200000, 216000000, 135, 12, 1, 3}, | 292 | { 19200000, 216000000, 135, 12, 0, 3}, |
293 | { 26000000, 216000000, 216, 26, 1, 4}, | 293 | { 26000000, 216000000, 216, 26, 0, 4}, |
294 | 294 | ||
295 | { 12000000, 594000000, 594, 12, 1, 8}, | 295 | { 12000000, 594000000, 594, 12, 0, 8}, |
296 | { 13000000, 594000000, 594, 13, 1, 8}, | 296 | { 13000000, 594000000, 594, 13, 0, 8}, |
297 | { 19200000, 594000000, 495, 16, 1, 8}, | 297 | { 19200000, 594000000, 495, 16, 0, 8}, |
298 | { 26000000, 594000000, 594, 26, 1, 8}, | 298 | { 26000000, 594000000, 594, 26, 0, 8}, |
299 | 299 | ||
300 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 300 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
301 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 301 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
302 | { 19200000, 1000000000, 625, 12, 1, 8}, | 302 | { 19200000, 1000000000, 625, 12, 0, 8}, |
303 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 303 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
304 | 304 | ||
305 | { 0, 0, 0, 0, 0, 0 }, | 305 | { 0, 0, 0, 0, 0, 0 }, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | 308 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { |
309 | { 12000000, 480000000, 960, 12, 2, 0}, | 309 | { 12000000, 480000000, 960, 12, 0, 0}, |
310 | { 13000000, 480000000, 960, 13, 2, 0}, | 310 | { 13000000, 480000000, 960, 13, 0, 0}, |
311 | { 19200000, 480000000, 200, 4, 2, 0}, | 311 | { 19200000, 480000000, 200, 4, 0, 0}, |
312 | { 26000000, 480000000, 960, 26, 2, 0}, | 312 | { 26000000, 480000000, 960, 26, 0, 0}, |
313 | { 0, 0, 0, 0, 0, 0 }, | 313 | { 0, 0, 0, 0, 0, 0 }, |
314 | }; | 314 | }; |
315 | 315 | ||
316 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | 316 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
317 | /* 1 GHz */ | 317 | /* 1 GHz */ |
318 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 318 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
319 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 319 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
320 | { 19200000, 1000000000, 625, 12, 1, 8}, | 320 | { 19200000, 1000000000, 625, 12, 0, 8}, |
321 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 321 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
322 | 322 | ||
323 | /* 912 MHz */ | 323 | /* 912 MHz */ |
324 | { 12000000, 912000000, 912, 12, 1, 12}, | 324 | { 12000000, 912000000, 912, 12, 0, 12}, |
325 | { 13000000, 912000000, 912, 13, 1, 12}, | 325 | { 13000000, 912000000, 912, 13, 0, 12}, |
326 | { 19200000, 912000000, 760, 16, 1, 8}, | 326 | { 19200000, 912000000, 760, 16, 0, 8}, |
327 | { 26000000, 912000000, 912, 26, 1, 12}, | 327 | { 26000000, 912000000, 912, 26, 0, 12}, |
328 | 328 | ||
329 | /* 816 MHz */ | 329 | /* 816 MHz */ |
330 | { 12000000, 816000000, 816, 12, 1, 12}, | 330 | { 12000000, 816000000, 816, 12, 0, 12}, |
331 | { 13000000, 816000000, 816, 13, 1, 12}, | 331 | { 13000000, 816000000, 816, 13, 0, 12}, |
332 | { 19200000, 816000000, 680, 16, 1, 8}, | 332 | { 19200000, 816000000, 680, 16, 0, 8}, |
333 | { 26000000, 816000000, 816, 26, 1, 12}, | 333 | { 26000000, 816000000, 816, 26, 0, 12}, |
334 | 334 | ||
335 | /* 760 MHz */ | 335 | /* 760 MHz */ |
336 | { 12000000, 760000000, 760, 12, 1, 12}, | 336 | { 12000000, 760000000, 760, 12, 0, 12}, |
337 | { 13000000, 760000000, 760, 13, 1, 12}, | 337 | { 13000000, 760000000, 760, 13, 0, 12}, |
338 | { 19200000, 760000000, 950, 24, 1, 8}, | 338 | { 19200000, 760000000, 950, 24, 0, 8}, |
339 | { 26000000, 760000000, 760, 26, 1, 12}, | 339 | { 26000000, 760000000, 760, 26, 0, 12}, |
340 | 340 | ||
341 | /* 750 MHz */ | 341 | /* 750 MHz */ |
342 | { 12000000, 750000000, 750, 12, 1, 12}, | 342 | { 12000000, 750000000, 750, 12, 0, 12}, |
343 | { 13000000, 750000000, 750, 13, 1, 12}, | 343 | { 13000000, 750000000, 750, 13, 0, 12}, |
344 | { 19200000, 750000000, 625, 16, 1, 8}, | 344 | { 19200000, 750000000, 625, 16, 0, 8}, |
345 | { 26000000, 750000000, 750, 26, 1, 12}, | 345 | { 26000000, 750000000, 750, 26, 0, 12}, |
346 | 346 | ||
347 | /* 608 MHz */ | 347 | /* 608 MHz */ |
348 | { 12000000, 608000000, 608, 12, 1, 12}, | 348 | { 12000000, 608000000, 608, 12, 0, 12}, |
349 | { 13000000, 608000000, 608, 13, 1, 12}, | 349 | { 13000000, 608000000, 608, 13, 0, 12}, |
350 | { 19200000, 608000000, 380, 12, 1, 8}, | 350 | { 19200000, 608000000, 380, 12, 0, 8}, |
351 | { 26000000, 608000000, 608, 26, 1, 12}, | 351 | { 26000000, 608000000, 608, 26, 0, 12}, |
352 | 352 | ||
353 | /* 456 MHz */ | 353 | /* 456 MHz */ |
354 | { 12000000, 456000000, 456, 12, 1, 12}, | 354 | { 12000000, 456000000, 456, 12, 0, 12}, |
355 | { 13000000, 456000000, 456, 13, 1, 12}, | 355 | { 13000000, 456000000, 456, 13, 0, 12}, |
356 | { 19200000, 456000000, 380, 16, 1, 8}, | 356 | { 19200000, 456000000, 380, 16, 0, 8}, |
357 | { 26000000, 456000000, 456, 26, 1, 12}, | 357 | { 26000000, 456000000, 456, 26, 0, 12}, |
358 | 358 | ||
359 | /* 312 MHz */ | 359 | /* 312 MHz */ |
360 | { 12000000, 312000000, 312, 12, 1, 12}, | 360 | { 12000000, 312000000, 312, 12, 0, 12}, |
361 | { 13000000, 312000000, 312, 13, 1, 12}, | 361 | { 13000000, 312000000, 312, 13, 0, 12}, |
362 | { 19200000, 312000000, 260, 16, 1, 8}, | 362 | { 19200000, 312000000, 260, 16, 0, 8}, |
363 | { 26000000, 312000000, 312, 26, 1, 12}, | 363 | { 26000000, 312000000, 312, 26, 0, 12}, |
364 | 364 | ||
365 | { 0, 0, 0, 0, 0, 0 }, | 365 | { 0, 0, 0, 0, 0, 0 }, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { | 368 | static struct tegra_clk_pll_freq_table pll_e_freq_table[] = { |
369 | { 12000000, 100000000, 200, 24, 1, 0 }, | 369 | { 12000000, 100000000, 200, 24, 0, 0 }, |
370 | { 0, 0, 0, 0, 0, 0 }, | 370 | { 0, 0, 0, 0, 0, 0 }, |
371 | }; | 371 | }; |
372 | 372 | ||
@@ -380,7 +380,7 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
380 | .vco_max = 1400000000, | 380 | .vco_max = 1400000000, |
381 | .base_reg = PLLC_BASE, | 381 | .base_reg = PLLC_BASE, |
382 | .misc_reg = PLLC_MISC, | 382 | .misc_reg = PLLC_MISC, |
383 | .lock_bit_idx = PLL_BASE_LOCK, | 383 | .lock_mask = PLL_BASE_LOCK, |
384 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 384 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
385 | .lock_delay = 300, | 385 | .lock_delay = 300, |
386 | }; | 386 | }; |
@@ -394,7 +394,7 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
394 | .vco_max = 1200000000, | 394 | .vco_max = 1200000000, |
395 | .base_reg = PLLM_BASE, | 395 | .base_reg = PLLM_BASE, |
396 | .misc_reg = PLLM_MISC, | 396 | .misc_reg = PLLM_MISC, |
397 | .lock_bit_idx = PLL_BASE_LOCK, | 397 | .lock_mask = PLL_BASE_LOCK, |
398 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 398 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
399 | .lock_delay = 300, | 399 | .lock_delay = 300, |
400 | }; | 400 | }; |
@@ -408,7 +408,7 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
408 | .vco_max = 1400000000, | 408 | .vco_max = 1400000000, |
409 | .base_reg = PLLP_BASE, | 409 | .base_reg = PLLP_BASE, |
410 | .misc_reg = PLLP_MISC, | 410 | .misc_reg = PLLP_MISC, |
411 | .lock_bit_idx = PLL_BASE_LOCK, | 411 | .lock_mask = PLL_BASE_LOCK, |
412 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 412 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
413 | .lock_delay = 300, | 413 | .lock_delay = 300, |
414 | }; | 414 | }; |
@@ -422,7 +422,7 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
422 | .vco_max = 1400000000, | 422 | .vco_max = 1400000000, |
423 | .base_reg = PLLA_BASE, | 423 | .base_reg = PLLA_BASE, |
424 | .misc_reg = PLLA_MISC, | 424 | .misc_reg = PLLA_MISC, |
425 | .lock_bit_idx = PLL_BASE_LOCK, | 425 | .lock_mask = PLL_BASE_LOCK, |
426 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 426 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
427 | .lock_delay = 300, | 427 | .lock_delay = 300, |
428 | }; | 428 | }; |
@@ -436,11 +436,17 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
436 | .vco_max = 1000000000, | 436 | .vco_max = 1000000000, |
437 | .base_reg = PLLD_BASE, | 437 | .base_reg = PLLD_BASE, |
438 | .misc_reg = PLLD_MISC, | 438 | .misc_reg = PLLD_MISC, |
439 | .lock_bit_idx = PLL_BASE_LOCK, | 439 | .lock_mask = PLL_BASE_LOCK, |
440 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 440 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
441 | .lock_delay = 1000, | 441 | .lock_delay = 1000, |
442 | }; | 442 | }; |
443 | 443 | ||
444 | static struct pdiv_map pllu_p[] = { | ||
445 | { .pdiv = 1, .hw_val = 1 }, | ||
446 | { .pdiv = 2, .hw_val = 0 }, | ||
447 | { .pdiv = 0, .hw_val = 0 }, | ||
448 | }; | ||
449 | |||
444 | static struct tegra_clk_pll_params pll_u_params = { | 450 | static struct tegra_clk_pll_params pll_u_params = { |
445 | .input_min = 2000000, | 451 | .input_min = 2000000, |
446 | .input_max = 40000000, | 452 | .input_max = 40000000, |
@@ -450,9 +456,10 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
450 | .vco_max = 960000000, | 456 | .vco_max = 960000000, |
451 | .base_reg = PLLU_BASE, | 457 | .base_reg = PLLU_BASE, |
452 | .misc_reg = PLLU_MISC, | 458 | .misc_reg = PLLU_MISC, |
453 | .lock_bit_idx = PLL_BASE_LOCK, | 459 | .lock_mask = PLL_BASE_LOCK, |
454 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 460 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
455 | .lock_delay = 1000, | 461 | .lock_delay = 1000, |
462 | .pdiv_tohw = pllu_p, | ||
456 | }; | 463 | }; |
457 | 464 | ||
458 | static struct tegra_clk_pll_params pll_x_params = { | 465 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -464,7 +471,7 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
464 | .vco_max = 1200000000, | 471 | .vco_max = 1200000000, |
465 | .base_reg = PLLX_BASE, | 472 | .base_reg = PLLX_BASE, |
466 | .misc_reg = PLLX_MISC, | 473 | .misc_reg = PLLX_MISC, |
467 | .lock_bit_idx = PLL_BASE_LOCK, | 474 | .lock_mask = PLL_BASE_LOCK, |
468 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 475 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
469 | .lock_delay = 300, | 476 | .lock_delay = 300, |
470 | }; | 477 | }; |
@@ -478,7 +485,7 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
478 | .vco_max = 0, | 485 | .vco_max = 0, |
479 | .base_reg = PLLE_BASE, | 486 | .base_reg = PLLE_BASE, |
480 | .misc_reg = PLLE_MISC, | 487 | .misc_reg = PLLE_MISC, |
481 | .lock_bit_idx = PLLE_MISC_LOCK, | 488 | .lock_mask = PLLE_MISC_LOCK, |
482 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 489 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
483 | .lock_delay = 0, | 490 | .lock_delay = 0, |
484 | }; | 491 | }; |
@@ -711,8 +718,8 @@ static void tegra20_pll_init(void) | |||
711 | } | 718 | } |
712 | 719 | ||
713 | static const char *cclk_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", | 720 | static const char *cclk_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", |
714 | "pll_p_cclk", "pll_p_out4_cclk", | 721 | "pll_p", "pll_p_out4", |
715 | "pll_p_out3_cclk", "clk_d", "pll_x" }; | 722 | "pll_p_out3", "clk_d", "pll_x" }; |
716 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", | 723 | static const char *sclk_parents[] = { "clk_m", "pll_c_out1", "pll_p_out4", |
717 | "pll_p_out3", "pll_p_out2", "clk_d", | 724 | "pll_p_out3", "pll_p_out2", "clk_d", |
718 | "clk_32k", "pll_m_out1" }; | 725 | "clk_32k", "pll_m_out1" }; |
@@ -721,38 +728,6 @@ static void tegra20_super_clk_init(void) | |||
721 | { | 728 | { |
722 | struct clk *clk; | 729 | struct clk *clk; |
723 | 730 | ||
724 | /* | ||
725 | * DIV_U71 dividers for CCLK, these dividers are used only | ||
726 | * if parent clock is fixed rate. | ||
727 | */ | ||
728 | |||
729 | /* | ||
730 | * Clock input to cclk divided from pll_p using | ||
731 | * U71 divider of cclk. | ||
732 | */ | ||
733 | clk = tegra_clk_register_divider("pll_p_cclk", "pll_p", | ||
734 | clk_base + SUPER_CCLK_DIVIDER, 0, | ||
735 | TEGRA_DIVIDER_INT, 16, 8, 1, NULL); | ||
736 | clk_register_clkdev(clk, "pll_p_cclk", NULL); | ||
737 | |||
738 | /* | ||
739 | * Clock input to cclk divided from pll_p_out3 using | ||
740 | * U71 divider of cclk. | ||
741 | */ | ||
742 | clk = tegra_clk_register_divider("pll_p_out3_cclk", "pll_p_out3", | ||
743 | clk_base + SUPER_CCLK_DIVIDER, 0, | ||
744 | TEGRA_DIVIDER_INT, 16, 8, 1, NULL); | ||
745 | clk_register_clkdev(clk, "pll_p_out3_cclk", NULL); | ||
746 | |||
747 | /* | ||
748 | * Clock input to cclk divided from pll_p_out4 using | ||
749 | * U71 divider of cclk. | ||
750 | */ | ||
751 | clk = tegra_clk_register_divider("pll_p_out4_cclk", "pll_p_out4", | ||
752 | clk_base + SUPER_CCLK_DIVIDER, 0, | ||
753 | TEGRA_DIVIDER_INT, 16, 8, 1, NULL); | ||
754 | clk_register_clkdev(clk, "pll_p_out4_cclk", NULL); | ||
755 | |||
756 | /* CCLK */ | 731 | /* CCLK */ |
757 | clk = tegra_clk_register_super_mux("cclk", cclk_parents, | 732 | clk = tegra_clk_register_super_mux("cclk", cclk_parents, |
758 | ARRAY_SIZE(cclk_parents), CLK_SET_RATE_PARENT, | 733 | ARRAY_SIZE(cclk_parents), CLK_SET_RATE_PARENT, |
@@ -1044,7 +1019,7 @@ static void __init tegra20_periph_clk_init(void) | |||
1044 | data = &tegra_periph_clk_list[i]; | 1019 | data = &tegra_periph_clk_list[i]; |
1045 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 1020 | clk = tegra_clk_register_periph(data->name, data->parent_names, |
1046 | data->num_parents, &data->periph, | 1021 | data->num_parents, &data->periph, |
1047 | clk_base, data->offset); | 1022 | clk_base, data->offset, data->flags); |
1048 | clk_register_clkdev(clk, data->con_id, data->dev_id); | 1023 | clk_register_clkdev(clk, data->con_id, data->dev_id); |
1049 | clks[data->clk_id] = clk; | 1024 | clks[data->clk_id] = clk; |
1050 | } | 1025 | } |
@@ -1279,9 +1254,16 @@ static __initdata struct tegra_clk_init_table init_table[] = { | |||
1279 | {host1x, pll_c, 150000000, 0}, | 1254 | {host1x, pll_c, 150000000, 0}, |
1280 | {disp1, pll_p, 600000000, 0}, | 1255 | {disp1, pll_p, 600000000, 0}, |
1281 | {disp2, pll_p, 600000000, 0}, | 1256 | {disp2, pll_p, 600000000, 0}, |
1257 | {gr2d, pll_c, 300000000, 0}, | ||
1258 | {gr3d, pll_c, 300000000, 0}, | ||
1282 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ | 1259 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry */ |
1283 | }; | 1260 | }; |
1284 | 1261 | ||
1262 | static void __init tegra20_clock_apply_init_table(void) | ||
1263 | { | ||
1264 | tegra_init_from_table(init_table, clks, clk_max); | ||
1265 | } | ||
1266 | |||
1285 | /* | 1267 | /* |
1286 | * Some clocks may be used by different drivers depending on the board | 1268 | * Some clocks may be used by different drivers depending on the board |
1287 | * configuration. List those here to register them twice in the clock lookup | 1269 | * configuration. List those here to register them twice in the clock lookup |
@@ -1348,7 +1330,7 @@ void __init tegra20_clock_init(struct device_node *np) | |||
1348 | clk_data.clk_num = ARRAY_SIZE(clks); | 1330 | clk_data.clk_num = ARRAY_SIZE(clks); |
1349 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 1331 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
1350 | 1332 | ||
1351 | tegra_init_from_table(init_table, clks, clk_max); | 1333 | tegra_clk_apply_init_table = tegra20_clock_apply_init_table; |
1352 | 1334 | ||
1353 | tegra_cpu_car_ops = &tegra20_cpu_car_ops; | 1335 | tegra_cpu_car_ops = &tegra20_cpu_car_ops; |
1354 | } | 1336 | } |
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index ba6f51bc9f3b..2dc0c5602613 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -116,8 +116,8 @@ | |||
116 | #define PLLDU_MISC_LOCK_ENABLE 22 | 116 | #define PLLDU_MISC_LOCK_ENABLE 22 |
117 | #define PLLE_MISC_LOCK_ENABLE 9 | 117 | #define PLLE_MISC_LOCK_ENABLE 9 |
118 | 118 | ||
119 | #define PLL_BASE_LOCK 27 | 119 | #define PLL_BASE_LOCK BIT(27) |
120 | #define PLLE_MISC_LOCK 11 | 120 | #define PLLE_MISC_LOCK BIT(11) |
121 | 121 | ||
122 | #define PLLE_AUX 0x48c | 122 | #define PLLE_AUX 0x48c |
123 | #define PLLC_OUT 0x84 | 123 | #define PLLC_OUT 0x84 |
@@ -330,7 +330,7 @@ enum tegra30_clk { | |||
330 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, | 330 | usb3, mpe, vde, bsea, bsev, speedo, uartd, uarte, i2c3, sbc4, sdmmc3, |
331 | pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, | 331 | pcie, owr, afi, csite, pciex, avpucq, la, dtv = 79, ndspeed, i2cslow, |
332 | dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, | 332 | dsib, irama = 84, iramb, iramc, iramd, cram2, audio_2x = 90, csus = 92, |
333 | cdev1, cdev2, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, | 333 | cdev2, cdev1, cpu_g = 96, cpu_lp, gr3d2, mselect, tsensor, i2s3, i2s4, |
334 | i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, | 334 | i2c4, sbc5, sbc6, d_audio, apbif, dam0, dam1, dam2, hda2codec_2x, |
335 | atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, | 335 | atomics, audio0_2x, audio1_2x, audio2_2x, audio3_2x, audio4_2x, |
336 | spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, | 336 | spdif_2x, actmon, extern1, extern2, extern3, sata_oob, sata, hda, |
@@ -374,164 +374,170 @@ static const struct utmi_clk_param utmi_parameters[] = { | |||
374 | }; | 374 | }; |
375 | 375 | ||
376 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { | 376 | static struct tegra_clk_pll_freq_table pll_c_freq_table[] = { |
377 | { 12000000, 1040000000, 520, 6, 1, 8}, | 377 | { 12000000, 1040000000, 520, 6, 0, 8}, |
378 | { 13000000, 1040000000, 480, 6, 1, 8}, | 378 | { 13000000, 1040000000, 480, 6, 0, 8}, |
379 | { 16800000, 1040000000, 495, 8, 1, 8}, /* actual: 1039.5 MHz */ | 379 | { 16800000, 1040000000, 495, 8, 0, 8}, /* actual: 1039.5 MHz */ |
380 | { 19200000, 1040000000, 325, 6, 1, 6}, | 380 | { 19200000, 1040000000, 325, 6, 0, 6}, |
381 | { 26000000, 1040000000, 520, 13, 1, 8}, | 381 | { 26000000, 1040000000, 520, 13, 0, 8}, |
382 | 382 | ||
383 | { 12000000, 832000000, 416, 6, 1, 8}, | 383 | { 12000000, 832000000, 416, 6, 0, 8}, |
384 | { 13000000, 832000000, 832, 13, 1, 8}, | 384 | { 13000000, 832000000, 832, 13, 0, 8}, |
385 | { 16800000, 832000000, 396, 8, 1, 8}, /* actual: 831.6 MHz */ | 385 | { 16800000, 832000000, 396, 8, 0, 8}, /* actual: 831.6 MHz */ |
386 | { 19200000, 832000000, 260, 6, 1, 8}, | 386 | { 19200000, 832000000, 260, 6, 0, 8}, |
387 | { 26000000, 832000000, 416, 13, 1, 8}, | 387 | { 26000000, 832000000, 416, 13, 0, 8}, |
388 | 388 | ||
389 | { 12000000, 624000000, 624, 12, 1, 8}, | 389 | { 12000000, 624000000, 624, 12, 0, 8}, |
390 | { 13000000, 624000000, 624, 13, 1, 8}, | 390 | { 13000000, 624000000, 624, 13, 0, 8}, |
391 | { 16800000, 600000000, 520, 14, 1, 8}, | 391 | { 16800000, 600000000, 520, 14, 0, 8}, |
392 | { 19200000, 624000000, 520, 16, 1, 8}, | 392 | { 19200000, 624000000, 520, 16, 0, 8}, |
393 | { 26000000, 624000000, 624, 26, 1, 8}, | 393 | { 26000000, 624000000, 624, 26, 0, 8}, |
394 | 394 | ||
395 | { 12000000, 600000000, 600, 12, 1, 8}, | 395 | { 12000000, 600000000, 600, 12, 0, 8}, |
396 | { 13000000, 600000000, 600, 13, 1, 8}, | 396 | { 13000000, 600000000, 600, 13, 0, 8}, |
397 | { 16800000, 600000000, 500, 14, 1, 8}, | 397 | { 16800000, 600000000, 500, 14, 0, 8}, |
398 | { 19200000, 600000000, 375, 12, 1, 6}, | 398 | { 19200000, 600000000, 375, 12, 0, 6}, |
399 | { 26000000, 600000000, 600, 26, 1, 8}, | 399 | { 26000000, 600000000, 600, 26, 0, 8}, |
400 | 400 | ||
401 | { 12000000, 520000000, 520, 12, 1, 8}, | 401 | { 12000000, 520000000, 520, 12, 0, 8}, |
402 | { 13000000, 520000000, 520, 13, 1, 8}, | 402 | { 13000000, 520000000, 520, 13, 0, 8}, |
403 | { 16800000, 520000000, 495, 16, 1, 8}, /* actual: 519.75 MHz */ | 403 | { 16800000, 520000000, 495, 16, 0, 8}, /* actual: 519.75 MHz */ |
404 | { 19200000, 520000000, 325, 12, 1, 6}, | 404 | { 19200000, 520000000, 325, 12, 0, 6}, |
405 | { 26000000, 520000000, 520, 26, 1, 8}, | 405 | { 26000000, 520000000, 520, 26, 0, 8}, |
406 | 406 | ||
407 | { 12000000, 416000000, 416, 12, 1, 8}, | 407 | { 12000000, 416000000, 416, 12, 0, 8}, |
408 | { 13000000, 416000000, 416, 13, 1, 8}, | 408 | { 13000000, 416000000, 416, 13, 0, 8}, |
409 | { 16800000, 416000000, 396, 16, 1, 8}, /* actual: 415.8 MHz */ | 409 | { 16800000, 416000000, 396, 16, 0, 8}, /* actual: 415.8 MHz */ |
410 | { 19200000, 416000000, 260, 12, 1, 6}, | 410 | { 19200000, 416000000, 260, 12, 0, 6}, |
411 | { 26000000, 416000000, 416, 26, 1, 8}, | 411 | { 26000000, 416000000, 416, 26, 0, 8}, |
412 | { 0, 0, 0, 0, 0, 0 }, | 412 | { 0, 0, 0, 0, 0, 0 }, |
413 | }; | 413 | }; |
414 | 414 | ||
415 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { | 415 | static struct tegra_clk_pll_freq_table pll_m_freq_table[] = { |
416 | { 12000000, 666000000, 666, 12, 1, 8}, | 416 | { 12000000, 666000000, 666, 12, 0, 8}, |
417 | { 13000000, 666000000, 666, 13, 1, 8}, | 417 | { 13000000, 666000000, 666, 13, 0, 8}, |
418 | { 16800000, 666000000, 555, 14, 1, 8}, | 418 | { 16800000, 666000000, 555, 14, 0, 8}, |
419 | { 19200000, 666000000, 555, 16, 1, 8}, | 419 | { 19200000, 666000000, 555, 16, 0, 8}, |
420 | { 26000000, 666000000, 666, 26, 1, 8}, | 420 | { 26000000, 666000000, 666, 26, 0, 8}, |
421 | { 12000000, 600000000, 600, 12, 1, 8}, | 421 | { 12000000, 600000000, 600, 12, 0, 8}, |
422 | { 13000000, 600000000, 600, 13, 1, 8}, | 422 | { 13000000, 600000000, 600, 13, 0, 8}, |
423 | { 16800000, 600000000, 500, 14, 1, 8}, | 423 | { 16800000, 600000000, 500, 14, 0, 8}, |
424 | { 19200000, 600000000, 375, 12, 1, 6}, | 424 | { 19200000, 600000000, 375, 12, 0, 6}, |
425 | { 26000000, 600000000, 600, 26, 1, 8}, | 425 | { 26000000, 600000000, 600, 26, 0, 8}, |
426 | { 0, 0, 0, 0, 0, 0 }, | 426 | { 0, 0, 0, 0, 0, 0 }, |
427 | }; | 427 | }; |
428 | 428 | ||
429 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { | 429 | static struct tegra_clk_pll_freq_table pll_p_freq_table[] = { |
430 | { 12000000, 216000000, 432, 12, 2, 8}, | 430 | { 12000000, 216000000, 432, 12, 1, 8}, |
431 | { 13000000, 216000000, 432, 13, 2, 8}, | 431 | { 13000000, 216000000, 432, 13, 1, 8}, |
432 | { 16800000, 216000000, 360, 14, 2, 8}, | 432 | { 16800000, 216000000, 360, 14, 1, 8}, |
433 | { 19200000, 216000000, 360, 16, 2, 8}, | 433 | { 19200000, 216000000, 360, 16, 1, 8}, |
434 | { 26000000, 216000000, 432, 26, 2, 8}, | 434 | { 26000000, 216000000, 432, 26, 1, 8}, |
435 | { 0, 0, 0, 0, 0, 0 }, | 435 | { 0, 0, 0, 0, 0, 0 }, |
436 | }; | 436 | }; |
437 | 437 | ||
438 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { | 438 | static struct tegra_clk_pll_freq_table pll_a_freq_table[] = { |
439 | { 9600000, 564480000, 294, 5, 1, 4}, | 439 | { 9600000, 564480000, 294, 5, 0, 4}, |
440 | { 9600000, 552960000, 288, 5, 1, 4}, | 440 | { 9600000, 552960000, 288, 5, 0, 4}, |
441 | { 9600000, 24000000, 5, 2, 1, 1}, | 441 | { 9600000, 24000000, 5, 2, 0, 1}, |
442 | 442 | ||
443 | { 28800000, 56448000, 49, 25, 1, 1}, | 443 | { 28800000, 56448000, 49, 25, 0, 1}, |
444 | { 28800000, 73728000, 64, 25, 1, 1}, | 444 | { 28800000, 73728000, 64, 25, 0, 1}, |
445 | { 28800000, 24000000, 5, 6, 1, 1}, | 445 | { 28800000, 24000000, 5, 6, 0, 1}, |
446 | { 0, 0, 0, 0, 0, 0 }, | 446 | { 0, 0, 0, 0, 0, 0 }, |
447 | }; | 447 | }; |
448 | 448 | ||
449 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { | 449 | static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { |
450 | { 12000000, 216000000, 216, 12, 1, 4}, | 450 | { 12000000, 216000000, 216, 12, 0, 4}, |
451 | { 13000000, 216000000, 216, 13, 1, 4}, | 451 | { 13000000, 216000000, 216, 13, 0, 4}, |
452 | { 16800000, 216000000, 180, 14, 1, 4}, | 452 | { 16800000, 216000000, 180, 14, 0, 4}, |
453 | { 19200000, 216000000, 180, 16, 1, 4}, | 453 | { 19200000, 216000000, 180, 16, 0, 4}, |
454 | { 26000000, 216000000, 216, 26, 1, 4}, | 454 | { 26000000, 216000000, 216, 26, 0, 4}, |
455 | 455 | ||
456 | { 12000000, 594000000, 594, 12, 1, 8}, | 456 | { 12000000, 594000000, 594, 12, 0, 8}, |
457 | { 13000000, 594000000, 594, 13, 1, 8}, | 457 | { 13000000, 594000000, 594, 13, 0, 8}, |
458 | { 16800000, 594000000, 495, 14, 1, 8}, | 458 | { 16800000, 594000000, 495, 14, 0, 8}, |
459 | { 19200000, 594000000, 495, 16, 1, 8}, | 459 | { 19200000, 594000000, 495, 16, 0, 8}, |
460 | { 26000000, 594000000, 594, 26, 1, 8}, | 460 | { 26000000, 594000000, 594, 26, 0, 8}, |
461 | 461 | ||
462 | { 12000000, 1000000000, 1000, 12, 1, 12}, | 462 | { 12000000, 1000000000, 1000, 12, 0, 12}, |
463 | { 13000000, 1000000000, 1000, 13, 1, 12}, | 463 | { 13000000, 1000000000, 1000, 13, 0, 12}, |
464 | { 19200000, 1000000000, 625, 12, 1, 8}, | 464 | { 19200000, 1000000000, 625, 12, 0, 8}, |
465 | { 26000000, 1000000000, 1000, 26, 1, 12}, | 465 | { 26000000, 1000000000, 1000, 26, 0, 12}, |
466 | 466 | ||
467 | { 0, 0, 0, 0, 0, 0 }, | 467 | { 0, 0, 0, 0, 0, 0 }, |
468 | }; | 468 | }; |
469 | 469 | ||
470 | static struct pdiv_map pllu_p[] = { | ||
471 | { .pdiv = 1, .hw_val = 1 }, | ||
472 | { .pdiv = 2, .hw_val = 0 }, | ||
473 | { .pdiv = 0, .hw_val = 0 }, | ||
474 | }; | ||
475 | |||
470 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { | 476 | static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { |
471 | { 12000000, 480000000, 960, 12, 2, 12}, | 477 | { 12000000, 480000000, 960, 12, 0, 12}, |
472 | { 13000000, 480000000, 960, 13, 2, 12}, | 478 | { 13000000, 480000000, 960, 13, 0, 12}, |
473 | { 16800000, 480000000, 400, 7, 2, 5}, | 479 | { 16800000, 480000000, 400, 7, 0, 5}, |
474 | { 19200000, 480000000, 200, 4, 2, 3}, | 480 | { 19200000, 480000000, 200, 4, 0, 3}, |
475 | { 26000000, 480000000, 960, 26, 2, 12}, | 481 | { 26000000, 480000000, 960, 26, 0, 12}, |
476 | { 0, 0, 0, 0, 0, 0 }, | 482 | { 0, 0, 0, 0, 0, 0 }, |
477 | }; | 483 | }; |
478 | 484 | ||
479 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { | 485 | static struct tegra_clk_pll_freq_table pll_x_freq_table[] = { |
480 | /* 1.7 GHz */ | 486 | /* 1.7 GHz */ |
481 | { 12000000, 1700000000, 850, 6, 1, 8}, | 487 | { 12000000, 1700000000, 850, 6, 0, 8}, |
482 | { 13000000, 1700000000, 915, 7, 1, 8}, /* actual: 1699.2 MHz */ | 488 | { 13000000, 1700000000, 915, 7, 0, 8}, /* actual: 1699.2 MHz */ |
483 | { 16800000, 1700000000, 708, 7, 1, 8}, /* actual: 1699.2 MHz */ | 489 | { 16800000, 1700000000, 708, 7, 0, 8}, /* actual: 1699.2 MHz */ |
484 | { 19200000, 1700000000, 885, 10, 1, 8}, /* actual: 1699.2 MHz */ | 490 | { 19200000, 1700000000, 885, 10, 0, 8}, /* actual: 1699.2 MHz */ |
485 | { 26000000, 1700000000, 850, 13, 1, 8}, | 491 | { 26000000, 1700000000, 850, 13, 0, 8}, |
486 | 492 | ||
487 | /* 1.6 GHz */ | 493 | /* 1.6 GHz */ |
488 | { 12000000, 1600000000, 800, 6, 1, 8}, | 494 | { 12000000, 1600000000, 800, 6, 0, 8}, |
489 | { 13000000, 1600000000, 738, 6, 1, 8}, /* actual: 1599.0 MHz */ | 495 | { 13000000, 1600000000, 738, 6, 0, 8}, /* actual: 1599.0 MHz */ |
490 | { 16800000, 1600000000, 857, 9, 1, 8}, /* actual: 1599.7 MHz */ | 496 | { 16800000, 1600000000, 857, 9, 0, 8}, /* actual: 1599.7 MHz */ |
491 | { 19200000, 1600000000, 500, 6, 1, 8}, | 497 | { 19200000, 1600000000, 500, 6, 0, 8}, |
492 | { 26000000, 1600000000, 800, 13, 1, 8}, | 498 | { 26000000, 1600000000, 800, 13, 0, 8}, |
493 | 499 | ||
494 | /* 1.5 GHz */ | 500 | /* 1.5 GHz */ |
495 | { 12000000, 1500000000, 750, 6, 1, 8}, | 501 | { 12000000, 1500000000, 750, 6, 0, 8}, |
496 | { 13000000, 1500000000, 923, 8, 1, 8}, /* actual: 1499.8 MHz */ | 502 | { 13000000, 1500000000, 923, 8, 0, 8}, /* actual: 1499.8 MHz */ |
497 | { 16800000, 1500000000, 625, 7, 1, 8}, | 503 | { 16800000, 1500000000, 625, 7, 0, 8}, |
498 | { 19200000, 1500000000, 625, 8, 1, 8}, | 504 | { 19200000, 1500000000, 625, 8, 0, 8}, |
499 | { 26000000, 1500000000, 750, 13, 1, 8}, | 505 | { 26000000, 1500000000, 750, 13, 0, 8}, |
500 | 506 | ||
501 | /* 1.4 GHz */ | 507 | /* 1.4 GHz */ |
502 | { 12000000, 1400000000, 700, 6, 1, 8}, | 508 | { 12000000, 1400000000, 700, 6, 0, 8}, |
503 | { 13000000, 1400000000, 969, 9, 1, 8}, /* actual: 1399.7 MHz */ | 509 | { 13000000, 1400000000, 969, 9, 0, 8}, /* actual: 1399.7 MHz */ |
504 | { 16800000, 1400000000, 1000, 12, 1, 8}, | 510 | { 16800000, 1400000000, 1000, 12, 0, 8}, |
505 | { 19200000, 1400000000, 875, 12, 1, 8}, | 511 | { 19200000, 1400000000, 875, 12, 0, 8}, |
506 | { 26000000, 1400000000, 700, 13, 1, 8}, | 512 | { 26000000, 1400000000, 700, 13, 0, 8}, |
507 | 513 | ||
508 | /* 1.3 GHz */ | 514 | /* 1.3 GHz */ |
509 | { 12000000, 1300000000, 975, 9, 1, 8}, | 515 | { 12000000, 1300000000, 975, 9, 0, 8}, |
510 | { 13000000, 1300000000, 1000, 10, 1, 8}, | 516 | { 13000000, 1300000000, 1000, 10, 0, 8}, |
511 | { 16800000, 1300000000, 928, 12, 1, 8}, /* actual: 1299.2 MHz */ | 517 | { 16800000, 1300000000, 928, 12, 0, 8}, /* actual: 1299.2 MHz */ |
512 | { 19200000, 1300000000, 812, 12, 1, 8}, /* actual: 1299.2 MHz */ | 518 | { 19200000, 1300000000, 812, 12, 0, 8}, /* actual: 1299.2 MHz */ |
513 | { 26000000, 1300000000, 650, 13, 1, 8}, | 519 | { 26000000, 1300000000, 650, 13, 0, 8}, |
514 | 520 | ||
515 | /* 1.2 GHz */ | 521 | /* 1.2 GHz */ |
516 | { 12000000, 1200000000, 1000, 10, 1, 8}, | 522 | { 12000000, 1200000000, 1000, 10, 0, 8}, |
517 | { 13000000, 1200000000, 923, 10, 1, 8}, /* actual: 1199.9 MHz */ | 523 | { 13000000, 1200000000, 923, 10, 0, 8}, /* actual: 1199.9 MHz */ |
518 | { 16800000, 1200000000, 1000, 14, 1, 8}, | 524 | { 16800000, 1200000000, 1000, 14, 0, 8}, |
519 | { 19200000, 1200000000, 1000, 16, 1, 8}, | 525 | { 19200000, 1200000000, 1000, 16, 0, 8}, |
520 | { 26000000, 1200000000, 600, 13, 1, 8}, | 526 | { 26000000, 1200000000, 600, 13, 0, 8}, |
521 | 527 | ||
522 | /* 1.1 GHz */ | 528 | /* 1.1 GHz */ |
523 | { 12000000, 1100000000, 825, 9, 1, 8}, | 529 | { 12000000, 1100000000, 825, 9, 0, 8}, |
524 | { 13000000, 1100000000, 846, 10, 1, 8}, /* actual: 1099.8 MHz */ | 530 | { 13000000, 1100000000, 846, 10, 0, 8}, /* actual: 1099.8 MHz */ |
525 | { 16800000, 1100000000, 982, 15, 1, 8}, /* actual: 1099.8 MHz */ | 531 | { 16800000, 1100000000, 982, 15, 0, 8}, /* actual: 1099.8 MHz */ |
526 | { 19200000, 1100000000, 859, 15, 1, 8}, /* actual: 1099.5 MHz */ | 532 | { 19200000, 1100000000, 859, 15, 0, 8}, /* actual: 1099.5 MHz */ |
527 | { 26000000, 1100000000, 550, 13, 1, 8}, | 533 | { 26000000, 1100000000, 550, 13, 0, 8}, |
528 | 534 | ||
529 | /* 1 GHz */ | 535 | /* 1 GHz */ |
530 | { 12000000, 1000000000, 1000, 12, 1, 8}, | 536 | { 12000000, 1000000000, 1000, 12, 0, 8}, |
531 | { 13000000, 1000000000, 1000, 13, 1, 8}, | 537 | { 13000000, 1000000000, 1000, 13, 0, 8}, |
532 | { 16800000, 1000000000, 833, 14, 1, 8}, /* actual: 999.6 MHz */ | 538 | { 16800000, 1000000000, 833, 14, 0, 8}, /* actual: 999.6 MHz */ |
533 | { 19200000, 1000000000, 625, 12, 1, 8}, | 539 | { 19200000, 1000000000, 625, 12, 0, 8}, |
534 | { 26000000, 1000000000, 1000, 26, 1, 8}, | 540 | { 26000000, 1000000000, 1000, 26, 0, 8}, |
535 | 541 | ||
536 | { 0, 0, 0, 0, 0, 0 }, | 542 | { 0, 0, 0, 0, 0, 0 }, |
537 | }; | 543 | }; |
@@ -553,7 +559,7 @@ static struct tegra_clk_pll_params pll_c_params = { | |||
553 | .vco_max = 1400000000, | 559 | .vco_max = 1400000000, |
554 | .base_reg = PLLC_BASE, | 560 | .base_reg = PLLC_BASE, |
555 | .misc_reg = PLLC_MISC, | 561 | .misc_reg = PLLC_MISC, |
556 | .lock_bit_idx = PLL_BASE_LOCK, | 562 | .lock_mask = PLL_BASE_LOCK, |
557 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 563 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
558 | .lock_delay = 300, | 564 | .lock_delay = 300, |
559 | }; | 565 | }; |
@@ -567,7 +573,7 @@ static struct tegra_clk_pll_params pll_m_params = { | |||
567 | .vco_max = 1200000000, | 573 | .vco_max = 1200000000, |
568 | .base_reg = PLLM_BASE, | 574 | .base_reg = PLLM_BASE, |
569 | .misc_reg = PLLM_MISC, | 575 | .misc_reg = PLLM_MISC, |
570 | .lock_bit_idx = PLL_BASE_LOCK, | 576 | .lock_mask = PLL_BASE_LOCK, |
571 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 577 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
572 | .lock_delay = 300, | 578 | .lock_delay = 300, |
573 | }; | 579 | }; |
@@ -581,7 +587,7 @@ static struct tegra_clk_pll_params pll_p_params = { | |||
581 | .vco_max = 1400000000, | 587 | .vco_max = 1400000000, |
582 | .base_reg = PLLP_BASE, | 588 | .base_reg = PLLP_BASE, |
583 | .misc_reg = PLLP_MISC, | 589 | .misc_reg = PLLP_MISC, |
584 | .lock_bit_idx = PLL_BASE_LOCK, | 590 | .lock_mask = PLL_BASE_LOCK, |
585 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 591 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
586 | .lock_delay = 300, | 592 | .lock_delay = 300, |
587 | }; | 593 | }; |
@@ -595,7 +601,7 @@ static struct tegra_clk_pll_params pll_a_params = { | |||
595 | .vco_max = 1400000000, | 601 | .vco_max = 1400000000, |
596 | .base_reg = PLLA_BASE, | 602 | .base_reg = PLLA_BASE, |
597 | .misc_reg = PLLA_MISC, | 603 | .misc_reg = PLLA_MISC, |
598 | .lock_bit_idx = PLL_BASE_LOCK, | 604 | .lock_mask = PLL_BASE_LOCK, |
599 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 605 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
600 | .lock_delay = 300, | 606 | .lock_delay = 300, |
601 | }; | 607 | }; |
@@ -609,7 +615,7 @@ static struct tegra_clk_pll_params pll_d_params = { | |||
609 | .vco_max = 1000000000, | 615 | .vco_max = 1000000000, |
610 | .base_reg = PLLD_BASE, | 616 | .base_reg = PLLD_BASE, |
611 | .misc_reg = PLLD_MISC, | 617 | .misc_reg = PLLD_MISC, |
612 | .lock_bit_idx = PLL_BASE_LOCK, | 618 | .lock_mask = PLL_BASE_LOCK, |
613 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 619 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
614 | .lock_delay = 1000, | 620 | .lock_delay = 1000, |
615 | }; | 621 | }; |
@@ -623,7 +629,7 @@ static struct tegra_clk_pll_params pll_d2_params = { | |||
623 | .vco_max = 1000000000, | 629 | .vco_max = 1000000000, |
624 | .base_reg = PLLD2_BASE, | 630 | .base_reg = PLLD2_BASE, |
625 | .misc_reg = PLLD2_MISC, | 631 | .misc_reg = PLLD2_MISC, |
626 | .lock_bit_idx = PLL_BASE_LOCK, | 632 | .lock_mask = PLL_BASE_LOCK, |
627 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 633 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
628 | .lock_delay = 1000, | 634 | .lock_delay = 1000, |
629 | }; | 635 | }; |
@@ -637,9 +643,10 @@ static struct tegra_clk_pll_params pll_u_params = { | |||
637 | .vco_max = 960000000, | 643 | .vco_max = 960000000, |
638 | .base_reg = PLLU_BASE, | 644 | .base_reg = PLLU_BASE, |
639 | .misc_reg = PLLU_MISC, | 645 | .misc_reg = PLLU_MISC, |
640 | .lock_bit_idx = PLL_BASE_LOCK, | 646 | .lock_mask = PLL_BASE_LOCK, |
641 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, | 647 | .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, |
642 | .lock_delay = 1000, | 648 | .lock_delay = 1000, |
649 | .pdiv_tohw = pllu_p, | ||
643 | }; | 650 | }; |
644 | 651 | ||
645 | static struct tegra_clk_pll_params pll_x_params = { | 652 | static struct tegra_clk_pll_params pll_x_params = { |
@@ -651,7 +658,7 @@ static struct tegra_clk_pll_params pll_x_params = { | |||
651 | .vco_max = 1700000000, | 658 | .vco_max = 1700000000, |
652 | .base_reg = PLLX_BASE, | 659 | .base_reg = PLLX_BASE, |
653 | .misc_reg = PLLX_MISC, | 660 | .misc_reg = PLLX_MISC, |
654 | .lock_bit_idx = PLL_BASE_LOCK, | 661 | .lock_mask = PLL_BASE_LOCK, |
655 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, | 662 | .lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE, |
656 | .lock_delay = 300, | 663 | .lock_delay = 300, |
657 | }; | 664 | }; |
@@ -665,7 +672,7 @@ static struct tegra_clk_pll_params pll_e_params = { | |||
665 | .vco_max = 2400000000U, | 672 | .vco_max = 2400000000U, |
666 | .base_reg = PLLE_BASE, | 673 | .base_reg = PLLE_BASE, |
667 | .misc_reg = PLLE_MISC, | 674 | .misc_reg = PLLE_MISC, |
668 | .lock_bit_idx = PLLE_MISC_LOCK, | 675 | .lock_mask = PLLE_MISC_LOCK, |
669 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, | 676 | .lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE, |
670 | .lock_delay = 300, | 677 | .lock_delay = 300, |
671 | }; | 678 | }; |
@@ -1661,7 +1668,7 @@ static void __init tegra30_periph_clk_init(void) | |||
1661 | data = &tegra_periph_clk_list[i]; | 1668 | data = &tegra_periph_clk_list[i]; |
1662 | clk = tegra_clk_register_periph(data->name, data->parent_names, | 1669 | clk = tegra_clk_register_periph(data->name, data->parent_names, |
1663 | data->num_parents, &data->periph, | 1670 | data->num_parents, &data->periph, |
1664 | clk_base, data->offset); | 1671 | clk_base, data->offset, data->flags); |
1665 | clk_register_clkdev(clk, data->con_id, data->dev_id); | 1672 | clk_register_clkdev(clk, data->con_id, data->dev_id); |
1666 | clks[data->clk_id] = clk; | 1673 | clks[data->clk_id] = clk; |
1667 | } | 1674 | } |
@@ -1911,9 +1918,16 @@ static __initdata struct tegra_clk_init_table init_table[] = { | |||
1911 | {disp1, pll_p, 600000000, 0}, | 1918 | {disp1, pll_p, 600000000, 0}, |
1912 | {disp2, pll_p, 600000000, 0}, | 1919 | {disp2, pll_p, 600000000, 0}, |
1913 | {twd, clk_max, 0, 1}, | 1920 | {twd, clk_max, 0, 1}, |
1921 | {gr2d, pll_c, 300000000, 0}, | ||
1922 | {gr3d, pll_c, 300000000, 0}, | ||
1914 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ | 1923 | {clk_max, clk_max, 0, 0}, /* This MUST be the last entry. */ |
1915 | }; | 1924 | }; |
1916 | 1925 | ||
1926 | static void __init tegra30_clock_apply_init_table(void) | ||
1927 | { | ||
1928 | tegra_init_from_table(init_table, clks, clk_max); | ||
1929 | } | ||
1930 | |||
1917 | /* | 1931 | /* |
1918 | * Some clocks may be used by different drivers depending on the board | 1932 | * Some clocks may be used by different drivers depending on the board |
1919 | * configuration. List those here to register them twice in the clock lookup | 1933 | * configuration. List those here to register them twice in the clock lookup |
@@ -1987,7 +2001,7 @@ void __init tegra30_clock_init(struct device_node *np) | |||
1987 | clk_data.clk_num = ARRAY_SIZE(clks); | 2001 | clk_data.clk_num = ARRAY_SIZE(clks); |
1988 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 2002 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
1989 | 2003 | ||
1990 | tegra_init_from_table(init_table, clks, clk_max); | 2004 | tegra_clk_apply_init_table = tegra30_clock_apply_init_table; |
1991 | 2005 | ||
1992 | tegra_cpu_car_ops = &tegra30_cpu_car_ops; | 2006 | tegra_cpu_car_ops = &tegra30_cpu_car_ops; |
1993 | } | 2007 | } |
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index a603b9af0ad3..923ca7ee4694 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c | |||
@@ -22,7 +22,8 @@ | |||
22 | #include "clk.h" | 22 | #include "clk.h" |
23 | 23 | ||
24 | /* Global data of Tegra CPU CAR ops */ | 24 | /* Global data of Tegra CPU CAR ops */ |
25 | struct tegra_cpu_car_ops *tegra_cpu_car_ops; | 25 | static struct tegra_cpu_car_ops dummy_car_ops; |
26 | struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; | ||
26 | 27 | ||
27 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, | 28 | void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list, |
28 | struct clk *clks[], int clk_max) | 29 | struct clk *clks[], int clk_max) |
@@ -76,6 +77,7 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, | |||
76 | static const struct of_device_id tegra_dt_clk_match[] = { | 77 | static const struct of_device_id tegra_dt_clk_match[] = { |
77 | { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, | 78 | { .compatible = "nvidia,tegra20-car", .data = tegra20_clock_init }, |
78 | { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, | 79 | { .compatible = "nvidia,tegra30-car", .data = tegra30_clock_init }, |
80 | { .compatible = "nvidia,tegra114-car", .data = tegra114_clock_init }, | ||
79 | { } | 81 | { } |
80 | }; | 82 | }; |
81 | 83 | ||
@@ -83,3 +85,13 @@ void __init tegra_clocks_init(void) | |||
83 | { | 85 | { |
84 | of_clk_init(tegra_dt_clk_match); | 86 | of_clk_init(tegra_dt_clk_match); |
85 | } | 87 | } |
88 | |||
89 | tegra_clk_apply_init_table_func tegra_clk_apply_init_table; | ||
90 | |||
91 | void __init tegra_clocks_apply_init_table(void) | ||
92 | { | ||
93 | if (!tegra_clk_apply_init_table) | ||
94 | return; | ||
95 | |||
96 | tegra_clk_apply_init_table(); | ||
97 | } | ||
diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h index 0744731c6229..e0565620d68e 100644 --- a/drivers/clk/tegra/clk.h +++ b/drivers/clk/tegra/clk.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
@@ -117,6 +117,17 @@ struct tegra_clk_pll_freq_table { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * struct pdiv_map - map post divider to hw value | ||
121 | * | ||
122 | * @pdiv: post divider | ||
123 | * @hw_val: value to be written to the PLL hw | ||
124 | */ | ||
125 | struct pdiv_map { | ||
126 | u8 pdiv; | ||
127 | u8 hw_val; | ||
128 | }; | ||
129 | |||
130 | /** | ||
120 | * struct clk_pll_params - PLL parameters | 131 | * struct clk_pll_params - PLL parameters |
121 | * | 132 | * |
122 | * @input_min: Minimum input frequency | 133 | * @input_min: Minimum input frequency |
@@ -143,9 +154,18 @@ struct tegra_clk_pll_params { | |||
143 | u32 base_reg; | 154 | u32 base_reg; |
144 | u32 misc_reg; | 155 | u32 misc_reg; |
145 | u32 lock_reg; | 156 | u32 lock_reg; |
146 | u32 lock_bit_idx; | 157 | u32 lock_mask; |
147 | u32 lock_enable_bit_idx; | 158 | u32 lock_enable_bit_idx; |
159 | u32 iddq_reg; | ||
160 | u32 iddq_bit_idx; | ||
161 | u32 aux_reg; | ||
162 | u32 dyn_ramp_reg; | ||
163 | u32 ext_misc_reg[3]; | ||
164 | int stepa_shift; | ||
165 | int stepb_shift; | ||
148 | int lock_delay; | 166 | int lock_delay; |
167 | int max_p; | ||
168 | struct pdiv_map *pdiv_tohw; | ||
149 | }; | 169 | }; |
150 | 170 | ||
151 | /** | 171 | /** |
@@ -182,12 +202,16 @@ struct tegra_clk_pll_params { | |||
182 | * TEGRA_PLL_FIXED - We are not supposed to change output frequency | 202 | * TEGRA_PLL_FIXED - We are not supposed to change output frequency |
183 | * of some plls. | 203 | * of some plls. |
184 | * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. | 204 | * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. |
205 | * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the | ||
206 | * base register. | ||
207 | * TEGRA_PLL_BYPASS - PLL has bypass bit | ||
208 | * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring | ||
185 | */ | 209 | */ |
186 | struct tegra_clk_pll { | 210 | struct tegra_clk_pll { |
187 | struct clk_hw hw; | 211 | struct clk_hw hw; |
188 | void __iomem *clk_base; | 212 | void __iomem *clk_base; |
189 | void __iomem *pmc; | 213 | void __iomem *pmc; |
190 | u8 flags; | 214 | u32 flags; |
191 | unsigned long fixed_rate; | 215 | unsigned long fixed_rate; |
192 | spinlock_t *lock; | 216 | spinlock_t *lock; |
193 | u8 divn_shift; | 217 | u8 divn_shift; |
@@ -210,20 +234,64 @@ struct tegra_clk_pll { | |||
210 | #define TEGRA_PLLM BIT(5) | 234 | #define TEGRA_PLLM BIT(5) |
211 | #define TEGRA_PLL_FIXED BIT(6) | 235 | #define TEGRA_PLL_FIXED BIT(6) |
212 | #define TEGRA_PLLE_CONFIGURE BIT(7) | 236 | #define TEGRA_PLLE_CONFIGURE BIT(7) |
237 | #define TEGRA_PLL_LOCK_MISC BIT(8) | ||
238 | #define TEGRA_PLL_BYPASS BIT(9) | ||
239 | #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10) | ||
213 | 240 | ||
214 | extern const struct clk_ops tegra_clk_pll_ops; | 241 | extern const struct clk_ops tegra_clk_pll_ops; |
215 | extern const struct clk_ops tegra_clk_plle_ops; | 242 | extern const struct clk_ops tegra_clk_plle_ops; |
216 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, | 243 | struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, |
217 | void __iomem *clk_base, void __iomem *pmc, | 244 | void __iomem *clk_base, void __iomem *pmc, |
218 | unsigned long flags, unsigned long fixed_rate, | 245 | unsigned long flags, unsigned long fixed_rate, |
219 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 246 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
220 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | 247 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); |
248 | |||
221 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, | 249 | struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, |
222 | void __iomem *clk_base, void __iomem *pmc, | 250 | void __iomem *clk_base, void __iomem *pmc, |
223 | unsigned long flags, unsigned long fixed_rate, | 251 | unsigned long flags, unsigned long fixed_rate, |
224 | struct tegra_clk_pll_params *pll_params, u8 pll_flags, | 252 | struct tegra_clk_pll_params *pll_params, u32 pll_flags, |
225 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); | 253 | struct tegra_clk_pll_freq_table *freq_table, spinlock_t *lock); |
226 | 254 | ||
255 | struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name, | ||
256 | void __iomem *clk_base, void __iomem *pmc, | ||
257 | unsigned long flags, unsigned long fixed_rate, | ||
258 | struct tegra_clk_pll_params *pll_params, | ||
259 | u32 pll_flags, | ||
260 | struct tegra_clk_pll_freq_table *freq_table, | ||
261 | spinlock_t *lock); | ||
262 | |||
263 | struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name, | ||
264 | void __iomem *clk_base, void __iomem *pmc, | ||
265 | unsigned long flags, unsigned long fixed_rate, | ||
266 | struct tegra_clk_pll_params *pll_params, | ||
267 | u32 pll_flags, | ||
268 | struct tegra_clk_pll_freq_table *freq_table, | ||
269 | spinlock_t *lock); | ||
270 | |||
271 | struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name, | ||
272 | void __iomem *clk_base, void __iomem *pmc, | ||
273 | unsigned long flags, unsigned long fixed_rate, | ||
274 | struct tegra_clk_pll_params *pll_params, | ||
275 | u32 pll_flags, | ||
276 | struct tegra_clk_pll_freq_table *freq_table, | ||
277 | spinlock_t *lock); | ||
278 | |||
279 | struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name, | ||
280 | void __iomem *clk_base, void __iomem *pmc, | ||
281 | unsigned long flags, unsigned long fixed_rate, | ||
282 | struct tegra_clk_pll_params *pll_params, | ||
283 | u32 pll_flags, | ||
284 | struct tegra_clk_pll_freq_table *freq_table, | ||
285 | spinlock_t *lock, unsigned long parent_rate); | ||
286 | |||
287 | struct clk *tegra_clk_register_plle_tegra114(const char *name, | ||
288 | const char *parent_name, | ||
289 | void __iomem *clk_base, unsigned long flags, | ||
290 | unsigned long fixed_rate, | ||
291 | struct tegra_clk_pll_params *pll_params, | ||
292 | struct tegra_clk_pll_freq_table *freq_table, | ||
293 | spinlock_t *lock); | ||
294 | |||
227 | /** | 295 | /** |
228 | * struct tegra_clk_pll_out - PLL divider down clock | 296 | * struct tegra_clk_pll_out - PLL divider down clock |
229 | * | 297 | * |
@@ -290,6 +358,7 @@ struct tegra_clk_periph_regs { | |||
290 | * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the | 358 | * TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the |
291 | * bus to flush the write operation in apb bus. This flag indicates | 359 | * bus to flush the write operation in apb bus. This flag indicates |
292 | * that this peripheral is in apb bus. | 360 | * that this peripheral is in apb bus. |
361 | * TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug | ||
293 | */ | 362 | */ |
294 | struct tegra_clk_periph_gate { | 363 | struct tegra_clk_periph_gate { |
295 | u32 magic; | 364 | u32 magic; |
@@ -309,6 +378,7 @@ struct tegra_clk_periph_gate { | |||
309 | #define TEGRA_PERIPH_NO_RESET BIT(0) | 378 | #define TEGRA_PERIPH_NO_RESET BIT(0) |
310 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) | 379 | #define TEGRA_PERIPH_MANUAL_RESET BIT(1) |
311 | #define TEGRA_PERIPH_ON_APB BIT(2) | 380 | #define TEGRA_PERIPH_ON_APB BIT(2) |
381 | #define TEGRA_PERIPH_WAR_1005168 BIT(3) | ||
312 | 382 | ||
313 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); | 383 | void tegra_periph_reset(struct tegra_clk_periph_gate *gate, bool assert); |
314 | extern const struct clk_ops tegra_clk_periph_gate_ops; | 384 | extern const struct clk_ops tegra_clk_periph_gate_ops; |
@@ -349,21 +419,22 @@ extern const struct clk_ops tegra_clk_periph_ops; | |||
349 | struct clk *tegra_clk_register_periph(const char *name, | 419 | struct clk *tegra_clk_register_periph(const char *name, |
350 | const char **parent_names, int num_parents, | 420 | const char **parent_names, int num_parents, |
351 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 421 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
352 | u32 offset); | 422 | u32 offset, unsigned long flags); |
353 | struct clk *tegra_clk_register_periph_nodiv(const char *name, | 423 | struct clk *tegra_clk_register_periph_nodiv(const char *name, |
354 | const char **parent_names, int num_parents, | 424 | const char **parent_names, int num_parents, |
355 | struct tegra_clk_periph *periph, void __iomem *clk_base, | 425 | struct tegra_clk_periph *periph, void __iomem *clk_base, |
356 | u32 offset); | 426 | u32 offset); |
357 | 427 | ||
358 | #define TEGRA_CLK_PERIPH(_mux_shift, _mux_width, _mux_flags, \ | 428 | #define TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, _mux_flags, \ |
359 | _div_shift, _div_width, _div_frac_width, \ | 429 | _div_shift, _div_width, _div_frac_width, \ |
360 | _div_flags, _clk_num, _enb_refcnt, _regs, \ | 430 | _div_flags, _clk_num, _enb_refcnt, _regs, \ |
361 | _gate_flags) \ | 431 | _gate_flags, _table) \ |
362 | { \ | 432 | { \ |
363 | .mux = { \ | 433 | .mux = { \ |
364 | .flags = _mux_flags, \ | 434 | .flags = _mux_flags, \ |
365 | .shift = _mux_shift, \ | 435 | .shift = _mux_shift, \ |
366 | .width = _mux_width, \ | 436 | .mask = _mux_mask, \ |
437 | .table = _table, \ | ||
367 | }, \ | 438 | }, \ |
368 | .divider = { \ | 439 | .divider = { \ |
369 | .flags = _div_flags, \ | 440 | .flags = _div_flags, \ |
@@ -391,28 +462,41 @@ struct tegra_periph_init_data { | |||
391 | u32 offset; | 462 | u32 offset; |
392 | const char *con_id; | 463 | const char *con_id; |
393 | const char *dev_id; | 464 | const char *dev_id; |
465 | unsigned long flags; | ||
394 | }; | 466 | }; |
395 | 467 | ||
396 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset, \ | 468 | #define TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ |
397 | _mux_shift, _mux_width, _mux_flags, _div_shift, \ | 469 | _mux_shift, _mux_mask, _mux_flags, _div_shift, \ |
398 | _div_width, _div_frac_width, _div_flags, _regs, \ | 470 | _div_width, _div_frac_width, _div_flags, _regs, \ |
399 | _clk_num, _enb_refcnt, _gate_flags, _clk_id) \ | 471 | _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\ |
472 | _flags) \ | ||
400 | { \ | 473 | { \ |
401 | .name = _name, \ | 474 | .name = _name, \ |
402 | .clk_id = _clk_id, \ | 475 | .clk_id = _clk_id, \ |
403 | .parent_names = _parent_names, \ | 476 | .parent_names = _parent_names, \ |
404 | .num_parents = ARRAY_SIZE(_parent_names), \ | 477 | .num_parents = ARRAY_SIZE(_parent_names), \ |
405 | .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_width, \ | 478 | .periph = TEGRA_CLK_PERIPH(_mux_shift, _mux_mask, \ |
406 | _mux_flags, _div_shift, \ | 479 | _mux_flags, _div_shift, \ |
407 | _div_width, _div_frac_width, \ | 480 | _div_width, _div_frac_width, \ |
408 | _div_flags, _clk_num, \ | 481 | _div_flags, _clk_num, \ |
409 | _enb_refcnt, _regs, \ | 482 | _enb_refcnt, _regs, \ |
410 | _gate_flags), \ | 483 | _gate_flags, _table), \ |
411 | .offset = _offset, \ | 484 | .offset = _offset, \ |
412 | .con_id = _con_id, \ | 485 | .con_id = _con_id, \ |
413 | .dev_id = _dev_id, \ | 486 | .dev_id = _dev_id, \ |
487 | .flags = _flags \ | ||
414 | } | 488 | } |
415 | 489 | ||
490 | #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\ | ||
491 | _mux_shift, _mux_width, _mux_flags, _div_shift, \ | ||
492 | _div_width, _div_frac_width, _div_flags, _regs, \ | ||
493 | _clk_num, _enb_refcnt, _gate_flags, _clk_id) \ | ||
494 | TEGRA_INIT_DATA_TABLE(_name, _con_id, _dev_id, _parent_names, _offset,\ | ||
495 | _mux_shift, BIT(_mux_width) - 1, _mux_flags, \ | ||
496 | _div_shift, _div_width, _div_frac_width, _div_flags, \ | ||
497 | _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ | ||
498 | NULL, 0) | ||
499 | |||
416 | /** | 500 | /** |
417 | * struct clk_super_mux - super clock | 501 | * struct clk_super_mux - super clock |
418 | * | 502 | * |
@@ -499,4 +583,13 @@ void tegra30_clock_init(struct device_node *np); | |||
499 | static inline void tegra30_clock_init(struct device_node *np) {} | 583 | static inline void tegra30_clock_init(struct device_node *np) {} |
500 | #endif /* CONFIG_ARCH_TEGRA_3x_SOC */ | 584 | #endif /* CONFIG_ARCH_TEGRA_3x_SOC */ |
501 | 585 | ||
586 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
587 | void tegra114_clock_init(struct device_node *np); | ||
588 | #else | ||
589 | static inline void tegra114_clock_init(struct device_node *np) {} | ||
590 | #endif /* CONFIG_ARCH_TEGRA114_SOC */ | ||
591 | |||
592 | typedef void (*tegra_clk_apply_init_table_func)(void); | ||
593 | extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table; | ||
594 | |||
502 | #endif /* TEGRA_CLK_H */ | 595 | #endif /* TEGRA_CLK_H */ |
diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c index 74faa7e3cf59..293a28854417 100644 --- a/drivers/clk/ux500/clk-prcmu.c +++ b/drivers/clk/ux500/clk-prcmu.c | |||
@@ -20,15 +20,23 @@ | |||
20 | struct clk_prcmu { | 20 | struct clk_prcmu { |
21 | struct clk_hw hw; | 21 | struct clk_hw hw; |
22 | u8 cg_sel; | 22 | u8 cg_sel; |
23 | int is_prepared; | ||
23 | int is_enabled; | 24 | int is_enabled; |
25 | int opp_requested; | ||
24 | }; | 26 | }; |
25 | 27 | ||
26 | /* PRCMU clock operations. */ | 28 | /* PRCMU clock operations. */ |
27 | 29 | ||
28 | static int clk_prcmu_prepare(struct clk_hw *hw) | 30 | static int clk_prcmu_prepare(struct clk_hw *hw) |
29 | { | 31 | { |
32 | int ret; | ||
30 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 33 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
31 | return prcmu_request_clock(clk->cg_sel, true); | 34 | |
35 | ret = prcmu_request_clock(clk->cg_sel, true); | ||
36 | if (!ret) | ||
37 | clk->is_prepared = 1; | ||
38 | |||
39 | return ret;; | ||
32 | } | 40 | } |
33 | 41 | ||
34 | static void clk_prcmu_unprepare(struct clk_hw *hw) | 42 | static void clk_prcmu_unprepare(struct clk_hw *hw) |
@@ -36,7 +44,15 @@ static void clk_prcmu_unprepare(struct clk_hw *hw) | |||
36 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 44 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
37 | if (prcmu_request_clock(clk->cg_sel, false)) | 45 | if (prcmu_request_clock(clk->cg_sel, false)) |
38 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, | 46 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, |
39 | hw->init->name); | 47 | __clk_get_name(hw->clk)); |
48 | else | ||
49 | clk->is_prepared = 0; | ||
50 | } | ||
51 | |||
52 | static int clk_prcmu_is_prepared(struct clk_hw *hw) | ||
53 | { | ||
54 | struct clk_prcmu *clk = to_clk_prcmu(hw); | ||
55 | return clk->is_prepared; | ||
40 | } | 56 | } |
41 | 57 | ||
42 | static int clk_prcmu_enable(struct clk_hw *hw) | 58 | static int clk_prcmu_enable(struct clk_hw *hw) |
@@ -79,58 +95,52 @@ static int clk_prcmu_set_rate(struct clk_hw *hw, unsigned long rate, | |||
79 | return prcmu_set_clock_rate(clk->cg_sel, rate); | 95 | return prcmu_set_clock_rate(clk->cg_sel, rate); |
80 | } | 96 | } |
81 | 97 | ||
82 | static int request_ape_opp100(bool enable) | ||
83 | { | ||
84 | static int reqs; | ||
85 | int err = 0; | ||
86 | |||
87 | if (enable) { | ||
88 | if (!reqs) | ||
89 | err = prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, | ||
90 | "clock", 100); | ||
91 | if (!err) | ||
92 | reqs++; | ||
93 | } else { | ||
94 | reqs--; | ||
95 | if (!reqs) | ||
96 | prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, | ||
97 | "clock"); | ||
98 | } | ||
99 | return err; | ||
100 | } | ||
101 | |||
102 | static int clk_prcmu_opp_prepare(struct clk_hw *hw) | 98 | static int clk_prcmu_opp_prepare(struct clk_hw *hw) |
103 | { | 99 | { |
104 | int err; | 100 | int err; |
105 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 101 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
106 | 102 | ||
107 | err = request_ape_opp100(true); | 103 | if (!clk->opp_requested) { |
108 | if (err) { | 104 | err = prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, |
109 | pr_err("clk_prcmu: %s failed to request APE OPP100 for %s.\n", | 105 | (char *)__clk_get_name(hw->clk), |
110 | __func__, hw->init->name); | 106 | 100); |
111 | return err; | 107 | if (err) { |
108 | pr_err("clk_prcmu: %s fail req APE OPP for %s.\n", | ||
109 | __func__, __clk_get_name(hw->clk)); | ||
110 | return err; | ||
111 | } | ||
112 | clk->opp_requested = 1; | ||
112 | } | 113 | } |
113 | 114 | ||
114 | err = prcmu_request_clock(clk->cg_sel, true); | 115 | err = prcmu_request_clock(clk->cg_sel, true); |
115 | if (err) | 116 | if (err) { |
116 | request_ape_opp100(false); | 117 | prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, |
118 | (char *)__clk_get_name(hw->clk)); | ||
119 | clk->opp_requested = 0; | ||
120 | return err; | ||
121 | } | ||
117 | 122 | ||
118 | return err; | 123 | clk->is_prepared = 1; |
124 | return 0; | ||
119 | } | 125 | } |
120 | 126 | ||
121 | static void clk_prcmu_opp_unprepare(struct clk_hw *hw) | 127 | static void clk_prcmu_opp_unprepare(struct clk_hw *hw) |
122 | { | 128 | { |
123 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 129 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
124 | 130 | ||
125 | if (prcmu_request_clock(clk->cg_sel, false)) | 131 | if (prcmu_request_clock(clk->cg_sel, false)) { |
126 | goto out_error; | 132 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, |
127 | if (request_ape_opp100(false)) | 133 | __clk_get_name(hw->clk)); |
128 | goto out_error; | 134 | return; |
129 | return; | 135 | } |
130 | 136 | ||
131 | out_error: | 137 | if (clk->opp_requested) { |
132 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, | 138 | prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, |
133 | hw->init->name); | 139 | (char *)__clk_get_name(hw->clk)); |
140 | clk->opp_requested = 0; | ||
141 | } | ||
142 | |||
143 | clk->is_prepared = 0; | ||
134 | } | 144 | } |
135 | 145 | ||
136 | static int clk_prcmu_opp_volt_prepare(struct clk_hw *hw) | 146 | static int clk_prcmu_opp_volt_prepare(struct clk_hw *hw) |
@@ -138,38 +148,49 @@ static int clk_prcmu_opp_volt_prepare(struct clk_hw *hw) | |||
138 | int err; | 148 | int err; |
139 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 149 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
140 | 150 | ||
141 | err = prcmu_request_ape_opp_100_voltage(true); | 151 | if (!clk->opp_requested) { |
142 | if (err) { | 152 | err = prcmu_request_ape_opp_100_voltage(true); |
143 | pr_err("clk_prcmu: %s failed to request APE OPP VOLT for %s.\n", | 153 | if (err) { |
144 | __func__, hw->init->name); | 154 | pr_err("clk_prcmu: %s fail req APE OPP VOLT for %s.\n", |
145 | return err; | 155 | __func__, __clk_get_name(hw->clk)); |
156 | return err; | ||
157 | } | ||
158 | clk->opp_requested = 1; | ||
146 | } | 159 | } |
147 | 160 | ||
148 | err = prcmu_request_clock(clk->cg_sel, true); | 161 | err = prcmu_request_clock(clk->cg_sel, true); |
149 | if (err) | 162 | if (err) { |
150 | prcmu_request_ape_opp_100_voltage(false); | 163 | prcmu_request_ape_opp_100_voltage(false); |
164 | clk->opp_requested = 0; | ||
165 | return err; | ||
166 | } | ||
151 | 167 | ||
152 | return err; | 168 | clk->is_prepared = 1; |
169 | return 0; | ||
153 | } | 170 | } |
154 | 171 | ||
155 | static void clk_prcmu_opp_volt_unprepare(struct clk_hw *hw) | 172 | static void clk_prcmu_opp_volt_unprepare(struct clk_hw *hw) |
156 | { | 173 | { |
157 | struct clk_prcmu *clk = to_clk_prcmu(hw); | 174 | struct clk_prcmu *clk = to_clk_prcmu(hw); |
158 | 175 | ||
159 | if (prcmu_request_clock(clk->cg_sel, false)) | 176 | if (prcmu_request_clock(clk->cg_sel, false)) { |
160 | goto out_error; | 177 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, |
161 | if (prcmu_request_ape_opp_100_voltage(false)) | 178 | __clk_get_name(hw->clk)); |
162 | goto out_error; | 179 | return; |
163 | return; | 180 | } |
164 | 181 | ||
165 | out_error: | 182 | if (clk->opp_requested) { |
166 | pr_err("clk_prcmu: %s failed to disable %s.\n", __func__, | 183 | prcmu_request_ape_opp_100_voltage(false); |
167 | hw->init->name); | 184 | clk->opp_requested = 0; |
185 | } | ||
186 | |||
187 | clk->is_prepared = 0; | ||
168 | } | 188 | } |
169 | 189 | ||
170 | static struct clk_ops clk_prcmu_scalable_ops = { | 190 | static struct clk_ops clk_prcmu_scalable_ops = { |
171 | .prepare = clk_prcmu_prepare, | 191 | .prepare = clk_prcmu_prepare, |
172 | .unprepare = clk_prcmu_unprepare, | 192 | .unprepare = clk_prcmu_unprepare, |
193 | .is_prepared = clk_prcmu_is_prepared, | ||
173 | .enable = clk_prcmu_enable, | 194 | .enable = clk_prcmu_enable, |
174 | .disable = clk_prcmu_disable, | 195 | .disable = clk_prcmu_disable, |
175 | .is_enabled = clk_prcmu_is_enabled, | 196 | .is_enabled = clk_prcmu_is_enabled, |
@@ -181,6 +202,7 @@ static struct clk_ops clk_prcmu_scalable_ops = { | |||
181 | static struct clk_ops clk_prcmu_gate_ops = { | 202 | static struct clk_ops clk_prcmu_gate_ops = { |
182 | .prepare = clk_prcmu_prepare, | 203 | .prepare = clk_prcmu_prepare, |
183 | .unprepare = clk_prcmu_unprepare, | 204 | .unprepare = clk_prcmu_unprepare, |
205 | .is_prepared = clk_prcmu_is_prepared, | ||
184 | .enable = clk_prcmu_enable, | 206 | .enable = clk_prcmu_enable, |
185 | .disable = clk_prcmu_disable, | 207 | .disable = clk_prcmu_disable, |
186 | .is_enabled = clk_prcmu_is_enabled, | 208 | .is_enabled = clk_prcmu_is_enabled, |
@@ -202,6 +224,7 @@ static struct clk_ops clk_prcmu_rate_ops = { | |||
202 | static struct clk_ops clk_prcmu_opp_gate_ops = { | 224 | static struct clk_ops clk_prcmu_opp_gate_ops = { |
203 | .prepare = clk_prcmu_opp_prepare, | 225 | .prepare = clk_prcmu_opp_prepare, |
204 | .unprepare = clk_prcmu_opp_unprepare, | 226 | .unprepare = clk_prcmu_opp_unprepare, |
227 | .is_prepared = clk_prcmu_is_prepared, | ||
205 | .enable = clk_prcmu_enable, | 228 | .enable = clk_prcmu_enable, |
206 | .disable = clk_prcmu_disable, | 229 | .disable = clk_prcmu_disable, |
207 | .is_enabled = clk_prcmu_is_enabled, | 230 | .is_enabled = clk_prcmu_is_enabled, |
@@ -211,6 +234,7 @@ static struct clk_ops clk_prcmu_opp_gate_ops = { | |||
211 | static struct clk_ops clk_prcmu_opp_volt_scalable_ops = { | 234 | static struct clk_ops clk_prcmu_opp_volt_scalable_ops = { |
212 | .prepare = clk_prcmu_opp_volt_prepare, | 235 | .prepare = clk_prcmu_opp_volt_prepare, |
213 | .unprepare = clk_prcmu_opp_volt_unprepare, | 236 | .unprepare = clk_prcmu_opp_volt_unprepare, |
237 | .is_prepared = clk_prcmu_is_prepared, | ||
214 | .enable = clk_prcmu_enable, | 238 | .enable = clk_prcmu_enable, |
215 | .disable = clk_prcmu_disable, | 239 | .disable = clk_prcmu_disable, |
216 | .is_enabled = clk_prcmu_is_enabled, | 240 | .is_enabled = clk_prcmu_is_enabled, |
@@ -242,7 +266,9 @@ static struct clk *clk_reg_prcmu(const char *name, | |||
242 | } | 266 | } |
243 | 267 | ||
244 | clk->cg_sel = cg_sel; | 268 | clk->cg_sel = cg_sel; |
269 | clk->is_prepared = 1; | ||
245 | clk->is_enabled = 1; | 270 | clk->is_enabled = 1; |
271 | clk->opp_requested = 0; | ||
246 | /* "rate" can be used for changing the initial frequency */ | 272 | /* "rate" can be used for changing the initial frequency */ |
247 | if (rate) | 273 | if (rate) |
248 | prcmu_set_clock_rate(cg_sel, rate); | 274 | prcmu_set_clock_rate(cg_sel, rate); |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index e507ab7df60b..29ba35e6a143 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -31,6 +31,9 @@ config SUNXI_TIMER | |||
31 | config VT8500_TIMER | 31 | config VT8500_TIMER |
32 | bool | 32 | bool |
33 | 33 | ||
34 | config CADENCE_TTC_TIMER | ||
35 | bool | ||
36 | |||
34 | config CLKSRC_NOMADIK_MTU | 37 | config CLKSRC_NOMADIK_MTU |
35 | bool | 38 | bool |
36 | depends on (ARCH_NOMADIK || ARCH_U8500) | 39 | depends on (ARCH_NOMADIK || ARCH_U8500) |
@@ -62,8 +65,14 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK | |||
62 | 65 | ||
63 | config ARM_ARCH_TIMER | 66 | config ARM_ARCH_TIMER |
64 | bool | 67 | bool |
68 | select CLKSRC_OF if OF | ||
65 | 69 | ||
66 | config CLKSRC_METAG_GENERIC | 70 | config CLKSRC_METAG_GENERIC |
67 | def_bool y if METAG | 71 | def_bool y if METAG |
68 | help | 72 | help |
69 | This option enables support for the Meta per-thread timers. | 73 | This option enables support for the Meta per-thread timers. |
74 | |||
75 | config CLKSRC_EXYNOS_MCT | ||
76 | def_bool y if ARCH_EXYNOS | ||
77 | help | ||
78 | Support for Multi Core Timer controller on Exynos SoCs. | ||
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 4d8283aec5b5..cd1f09cbd61a 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
@@ -19,6 +19,8 @@ obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o | |||
19 | obj-$(CONFIG_SUNXI_TIMER) += sunxi_timer.o | 19 | obj-$(CONFIG_SUNXI_TIMER) += sunxi_timer.o |
20 | obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o | 20 | obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o |
21 | obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o | 21 | obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o |
22 | obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o | ||
23 | obj-$(CONFIG_CLKSRC_EXYNOS_MCT) += exynos_mct.o | ||
22 | 24 | ||
23 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o | 25 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o |
24 | obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o | 26 | obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index d7ad425ab9b3..a2b254189782 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -248,14 +248,16 @@ static void __cpuinit arch_timer_stop(struct clock_event_device *clk) | |||
248 | static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, | 248 | static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, |
249 | unsigned long action, void *hcpu) | 249 | unsigned long action, void *hcpu) |
250 | { | 250 | { |
251 | struct clock_event_device *evt = this_cpu_ptr(arch_timer_evt); | 251 | /* |
252 | 252 | * Grab cpu pointer in each case to avoid spurious | |
253 | * preemptible warnings | ||
254 | */ | ||
253 | switch (action & ~CPU_TASKS_FROZEN) { | 255 | switch (action & ~CPU_TASKS_FROZEN) { |
254 | case CPU_STARTING: | 256 | case CPU_STARTING: |
255 | arch_timer_setup(evt); | 257 | arch_timer_setup(this_cpu_ptr(arch_timer_evt)); |
256 | break; | 258 | break; |
257 | case CPU_DYING: | 259 | case CPU_DYING: |
258 | arch_timer_stop(evt); | 260 | arch_timer_stop(this_cpu_ptr(arch_timer_evt)); |
259 | break; | 261 | break; |
260 | } | 262 | } |
261 | 263 | ||
@@ -337,22 +339,14 @@ out: | |||
337 | return err; | 339 | return err; |
338 | } | 340 | } |
339 | 341 | ||
340 | static const struct of_device_id arch_timer_of_match[] __initconst = { | 342 | static void __init arch_timer_init(struct device_node *np) |
341 | { .compatible = "arm,armv7-timer", }, | ||
342 | { .compatible = "arm,armv8-timer", }, | ||
343 | {}, | ||
344 | }; | ||
345 | |||
346 | int __init arch_timer_init(void) | ||
347 | { | 343 | { |
348 | struct device_node *np; | ||
349 | u32 freq; | 344 | u32 freq; |
350 | int i; | 345 | int i; |
351 | 346 | ||
352 | np = of_find_matching_node(NULL, arch_timer_of_match); | 347 | if (arch_timer_get_rate()) { |
353 | if (!np) { | 348 | pr_warn("arch_timer: multiple nodes in dt, skipping\n"); |
354 | pr_err("arch_timer: can't find DT node\n"); | 349 | return; |
355 | return -ENODEV; | ||
356 | } | 350 | } |
357 | 351 | ||
358 | /* Try to determine the frequency from the device tree or CNTFRQ */ | 352 | /* Try to determine the frequency from the device tree or CNTFRQ */ |
@@ -378,7 +372,7 @@ int __init arch_timer_init(void) | |||
378 | if (!arch_timer_ppi[PHYS_SECURE_PPI] || | 372 | if (!arch_timer_ppi[PHYS_SECURE_PPI] || |
379 | !arch_timer_ppi[PHYS_NONSECURE_PPI]) { | 373 | !arch_timer_ppi[PHYS_NONSECURE_PPI]) { |
380 | pr_warn("arch_timer: No interrupt available, giving up\n"); | 374 | pr_warn("arch_timer: No interrupt available, giving up\n"); |
381 | return -EINVAL; | 375 | return; |
382 | } | 376 | } |
383 | } | 377 | } |
384 | 378 | ||
@@ -387,5 +381,8 @@ int __init arch_timer_init(void) | |||
387 | else | 381 | else |
388 | arch_timer_read_counter = arch_counter_get_cntpct; | 382 | arch_timer_read_counter = arch_counter_get_cntpct; |
389 | 383 | ||
390 | return arch_timer_register(); | 384 | arch_timer_register(); |
385 | arch_timer_arch_init(); | ||
391 | } | 386 | } |
387 | CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init); | ||
388 | CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init); | ||
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c index 50c68fef944b..766611d29945 100644 --- a/drivers/clocksource/bcm2835_timer.c +++ b/drivers/clocksource/bcm2835_timer.c | |||
@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id) | |||
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | static struct of_device_id bcm2835_time_match[] __initconst = { | 98 | static void __init bcm2835_timer_init(struct device_node *node) |
99 | { .compatible = "brcm,bcm2835-system-timer" }, | ||
100 | {} | ||
101 | }; | ||
102 | |||
103 | static void __init bcm2835_timer_init(void) | ||
104 | { | 99 | { |
105 | struct device_node *node; | ||
106 | void __iomem *base; | 100 | void __iomem *base; |
107 | u32 freq; | 101 | u32 freq; |
108 | int irq; | 102 | int irq; |
109 | struct bcm2835_timer *timer; | 103 | struct bcm2835_timer *timer; |
110 | 104 | ||
111 | node = of_find_matching_node(NULL, bcm2835_time_match); | ||
112 | if (!node) | ||
113 | panic("No bcm2835 timer node"); | ||
114 | |||
115 | base = of_iomap(node, 0); | 105 | base = of_iomap(node, 0); |
116 | if (!base) | 106 | if (!base) |
117 | panic("Can't remap registers"); | 107 | panic("Can't remap registers"); |
diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c new file mode 100644 index 000000000000..685bc60e210a --- /dev/null +++ b/drivers/clocksource/cadence_ttc_timer.c | |||
@@ -0,0 +1,436 @@ | |||
1 | /* | ||
2 | * This file contains driver for the Cadence Triple Timer Counter Rev 06 | ||
3 | * | ||
4 | * Copyright (C) 2011-2013 Xilinx | ||
5 | * | ||
6 | * based on arch/mips/kernel/time.c timer driver | ||
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 | #include <linux/clk.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/clockchips.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/of_irq.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/clk-provider.h> | ||
25 | |||
26 | /* | ||
27 | * This driver configures the 2 16-bit count-up timers as follows: | ||
28 | * | ||
29 | * T1: Timer 1, clocksource for generic timekeeping | ||
30 | * T2: Timer 2, clockevent source for hrtimers | ||
31 | * T3: Timer 3, <unused> | ||
32 | * | ||
33 | * The input frequency to the timer module for emulation is 2.5MHz which is | ||
34 | * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32, | ||
35 | * the timers are clocked at 78.125KHz (12.8 us resolution). | ||
36 | |||
37 | * The input frequency to the timer module in silicon is configurable and | ||
38 | * obtained from device tree. The pre-scaler of 32 is used. | ||
39 | */ | ||
40 | |||
41 | /* | ||
42 | * Timer Register Offset Definitions of Timer 1, Increment base address by 4 | ||
43 | * and use same offsets for Timer 2 | ||
44 | */ | ||
45 | #define TTC_CLK_CNTRL_OFFSET 0x00 /* Clock Control Reg, RW */ | ||
46 | #define TTC_CNT_CNTRL_OFFSET 0x0C /* Counter Control Reg, RW */ | ||
47 | #define TTC_COUNT_VAL_OFFSET 0x18 /* Counter Value Reg, RO */ | ||
48 | #define TTC_INTR_VAL_OFFSET 0x24 /* Interval Count Reg, RW */ | ||
49 | #define TTC_ISR_OFFSET 0x54 /* Interrupt Status Reg, RO */ | ||
50 | #define TTC_IER_OFFSET 0x60 /* Interrupt Enable Reg, RW */ | ||
51 | |||
52 | #define TTC_CNT_CNTRL_DISABLE_MASK 0x1 | ||
53 | |||
54 | /* | ||
55 | * Setup the timers to use pre-scaling, using a fixed value for now that will | ||
56 | * work across most input frequency, but it may need to be more dynamic | ||
57 | */ | ||
58 | #define PRESCALE_EXPONENT 11 /* 2 ^ PRESCALE_EXPONENT = PRESCALE */ | ||
59 | #define PRESCALE 2048 /* The exponent must match this */ | ||
60 | #define CLK_CNTRL_PRESCALE ((PRESCALE_EXPONENT - 1) << 1) | ||
61 | #define CLK_CNTRL_PRESCALE_EN 1 | ||
62 | #define CNT_CNTRL_RESET (1 << 4) | ||
63 | |||
64 | /** | ||
65 | * struct ttc_timer - This definition defines local timer structure | ||
66 | * | ||
67 | * @base_addr: Base address of timer | ||
68 | * @clk: Associated clock source | ||
69 | * @clk_rate_change_nb Notifier block for clock rate changes | ||
70 | */ | ||
71 | struct ttc_timer { | ||
72 | void __iomem *base_addr; | ||
73 | struct clk *clk; | ||
74 | struct notifier_block clk_rate_change_nb; | ||
75 | }; | ||
76 | |||
77 | #define to_ttc_timer(x) \ | ||
78 | container_of(x, struct ttc_timer, clk_rate_change_nb) | ||
79 | |||
80 | struct ttc_timer_clocksource { | ||
81 | struct ttc_timer ttc; | ||
82 | struct clocksource cs; | ||
83 | }; | ||
84 | |||
85 | #define to_ttc_timer_clksrc(x) \ | ||
86 | container_of(x, struct ttc_timer_clocksource, cs) | ||
87 | |||
88 | struct ttc_timer_clockevent { | ||
89 | struct ttc_timer ttc; | ||
90 | struct clock_event_device ce; | ||
91 | }; | ||
92 | |||
93 | #define to_ttc_timer_clkevent(x) \ | ||
94 | container_of(x, struct ttc_timer_clockevent, ce) | ||
95 | |||
96 | /** | ||
97 | * ttc_set_interval - Set the timer interval value | ||
98 | * | ||
99 | * @timer: Pointer to the timer instance | ||
100 | * @cycles: Timer interval ticks | ||
101 | **/ | ||
102 | static void ttc_set_interval(struct ttc_timer *timer, | ||
103 | unsigned long cycles) | ||
104 | { | ||
105 | u32 ctrl_reg; | ||
106 | |||
107 | /* Disable the counter, set the counter value and re-enable counter */ | ||
108 | ctrl_reg = __raw_readl(timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
109 | ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; | ||
110 | __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
111 | |||
112 | __raw_writel(cycles, timer->base_addr + TTC_INTR_VAL_OFFSET); | ||
113 | |||
114 | /* | ||
115 | * Reset the counter (0x10) so that it starts from 0, one-shot | ||
116 | * mode makes this needed for timing to be right. | ||
117 | */ | ||
118 | ctrl_reg |= CNT_CNTRL_RESET; | ||
119 | ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; | ||
120 | __raw_writel(ctrl_reg, timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
121 | } | ||
122 | |||
123 | /** | ||
124 | * ttc_clock_event_interrupt - Clock event timer interrupt handler | ||
125 | * | ||
126 | * @irq: IRQ number of the Timer | ||
127 | * @dev_id: void pointer to the ttc_timer instance | ||
128 | * | ||
129 | * returns: Always IRQ_HANDLED - success | ||
130 | **/ | ||
131 | static irqreturn_t ttc_clock_event_interrupt(int irq, void *dev_id) | ||
132 | { | ||
133 | struct ttc_timer_clockevent *ttce = dev_id; | ||
134 | struct ttc_timer *timer = &ttce->ttc; | ||
135 | |||
136 | /* Acknowledge the interrupt and call event handler */ | ||
137 | __raw_readl(timer->base_addr + TTC_ISR_OFFSET); | ||
138 | |||
139 | ttce->ce.event_handler(&ttce->ce); | ||
140 | |||
141 | return IRQ_HANDLED; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * __ttc_clocksource_read - Reads the timer counter register | ||
146 | * | ||
147 | * returns: Current timer counter register value | ||
148 | **/ | ||
149 | static cycle_t __ttc_clocksource_read(struct clocksource *cs) | ||
150 | { | ||
151 | struct ttc_timer *timer = &to_ttc_timer_clksrc(cs)->ttc; | ||
152 | |||
153 | return (cycle_t)__raw_readl(timer->base_addr + | ||
154 | TTC_COUNT_VAL_OFFSET); | ||
155 | } | ||
156 | |||
157 | /** | ||
158 | * ttc_set_next_event - Sets the time interval for next event | ||
159 | * | ||
160 | * @cycles: Timer interval ticks | ||
161 | * @evt: Address of clock event instance | ||
162 | * | ||
163 | * returns: Always 0 - success | ||
164 | **/ | ||
165 | static int ttc_set_next_event(unsigned long cycles, | ||
166 | struct clock_event_device *evt) | ||
167 | { | ||
168 | struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); | ||
169 | struct ttc_timer *timer = &ttce->ttc; | ||
170 | |||
171 | ttc_set_interval(timer, cycles); | ||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * ttc_set_mode - Sets the mode of timer | ||
177 | * | ||
178 | * @mode: Mode to be set | ||
179 | * @evt: Address of clock event instance | ||
180 | **/ | ||
181 | static void ttc_set_mode(enum clock_event_mode mode, | ||
182 | struct clock_event_device *evt) | ||
183 | { | ||
184 | struct ttc_timer_clockevent *ttce = to_ttc_timer_clkevent(evt); | ||
185 | struct ttc_timer *timer = &ttce->ttc; | ||
186 | u32 ctrl_reg; | ||
187 | |||
188 | switch (mode) { | ||
189 | case CLOCK_EVT_MODE_PERIODIC: | ||
190 | ttc_set_interval(timer, | ||
191 | DIV_ROUND_CLOSEST(clk_get_rate(ttce->ttc.clk), | ||
192 | PRESCALE * HZ)); | ||
193 | break; | ||
194 | case CLOCK_EVT_MODE_ONESHOT: | ||
195 | case CLOCK_EVT_MODE_UNUSED: | ||
196 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
197 | ctrl_reg = __raw_readl(timer->base_addr + | ||
198 | TTC_CNT_CNTRL_OFFSET); | ||
199 | ctrl_reg |= TTC_CNT_CNTRL_DISABLE_MASK; | ||
200 | __raw_writel(ctrl_reg, | ||
201 | timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
202 | break; | ||
203 | case CLOCK_EVT_MODE_RESUME: | ||
204 | ctrl_reg = __raw_readl(timer->base_addr + | ||
205 | TTC_CNT_CNTRL_OFFSET); | ||
206 | ctrl_reg &= ~TTC_CNT_CNTRL_DISABLE_MASK; | ||
207 | __raw_writel(ctrl_reg, | ||
208 | timer->base_addr + TTC_CNT_CNTRL_OFFSET); | ||
209 | break; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | static int ttc_rate_change_clocksource_cb(struct notifier_block *nb, | ||
214 | unsigned long event, void *data) | ||
215 | { | ||
216 | struct clk_notifier_data *ndata = data; | ||
217 | struct ttc_timer *ttc = to_ttc_timer(nb); | ||
218 | struct ttc_timer_clocksource *ttccs = container_of(ttc, | ||
219 | struct ttc_timer_clocksource, ttc); | ||
220 | |||
221 | switch (event) { | ||
222 | case POST_RATE_CHANGE: | ||
223 | /* | ||
224 | * Do whatever is necessary to maintain a proper time base | ||
225 | * | ||
226 | * I cannot find a way to adjust the currently used clocksource | ||
227 | * to the new frequency. __clocksource_updatefreq_hz() sounds | ||
228 | * good, but does not work. Not sure what's that missing. | ||
229 | * | ||
230 | * This approach works, but triggers two clocksource switches. | ||
231 | * The first after unregister to clocksource jiffies. And | ||
232 | * another one after the register to the newly registered timer. | ||
233 | * | ||
234 | * Alternatively we could 'waste' another HW timer to ping pong | ||
235 | * between clock sources. That would also use one register and | ||
236 | * one unregister call, but only trigger one clocksource switch | ||
237 | * for the cost of another HW timer used by the OS. | ||
238 | */ | ||
239 | clocksource_unregister(&ttccs->cs); | ||
240 | clocksource_register_hz(&ttccs->cs, | ||
241 | ndata->new_rate / PRESCALE); | ||
242 | /* fall through */ | ||
243 | case PRE_RATE_CHANGE: | ||
244 | case ABORT_RATE_CHANGE: | ||
245 | default: | ||
246 | return NOTIFY_DONE; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) | ||
251 | { | ||
252 | struct ttc_timer_clocksource *ttccs; | ||
253 | int err; | ||
254 | |||
255 | ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL); | ||
256 | if (WARN_ON(!ttccs)) | ||
257 | return; | ||
258 | |||
259 | ttccs->ttc.clk = clk; | ||
260 | |||
261 | err = clk_prepare_enable(ttccs->ttc.clk); | ||
262 | if (WARN_ON(err)) { | ||
263 | kfree(ttccs); | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | ttccs->ttc.clk_rate_change_nb.notifier_call = | ||
268 | ttc_rate_change_clocksource_cb; | ||
269 | ttccs->ttc.clk_rate_change_nb.next = NULL; | ||
270 | if (clk_notifier_register(ttccs->ttc.clk, | ||
271 | &ttccs->ttc.clk_rate_change_nb)) | ||
272 | pr_warn("Unable to register clock notifier.\n"); | ||
273 | |||
274 | ttccs->ttc.base_addr = base; | ||
275 | ttccs->cs.name = "ttc_clocksource"; | ||
276 | ttccs->cs.rating = 200; | ||
277 | ttccs->cs.read = __ttc_clocksource_read; | ||
278 | ttccs->cs.mask = CLOCKSOURCE_MASK(16); | ||
279 | ttccs->cs.flags = CLOCK_SOURCE_IS_CONTINUOUS; | ||
280 | |||
281 | /* | ||
282 | * Setup the clock source counter to be an incrementing counter | ||
283 | * with no interrupt and it rolls over at 0xFFFF. Pre-scale | ||
284 | * it by 32 also. Let it start running now. | ||
285 | */ | ||
286 | __raw_writel(0x0, ttccs->ttc.base_addr + TTC_IER_OFFSET); | ||
287 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
288 | ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); | ||
289 | __raw_writel(CNT_CNTRL_RESET, | ||
290 | ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); | ||
291 | |||
292 | err = clocksource_register_hz(&ttccs->cs, | ||
293 | clk_get_rate(ttccs->ttc.clk) / PRESCALE); | ||
294 | if (WARN_ON(err)) { | ||
295 | kfree(ttccs); | ||
296 | return; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | static int ttc_rate_change_clockevent_cb(struct notifier_block *nb, | ||
301 | unsigned long event, void *data) | ||
302 | { | ||
303 | struct clk_notifier_data *ndata = data; | ||
304 | struct ttc_timer *ttc = to_ttc_timer(nb); | ||
305 | struct ttc_timer_clockevent *ttcce = container_of(ttc, | ||
306 | struct ttc_timer_clockevent, ttc); | ||
307 | |||
308 | switch (event) { | ||
309 | case POST_RATE_CHANGE: | ||
310 | { | ||
311 | unsigned long flags; | ||
312 | |||
313 | /* | ||
314 | * clockevents_update_freq should be called with IRQ disabled on | ||
315 | * the CPU the timer provides events for. The timer we use is | ||
316 | * common to both CPUs, not sure if we need to run on both | ||
317 | * cores. | ||
318 | */ | ||
319 | local_irq_save(flags); | ||
320 | clockevents_update_freq(&ttcce->ce, | ||
321 | ndata->new_rate / PRESCALE); | ||
322 | local_irq_restore(flags); | ||
323 | |||
324 | /* fall through */ | ||
325 | } | ||
326 | case PRE_RATE_CHANGE: | ||
327 | case ABORT_RATE_CHANGE: | ||
328 | default: | ||
329 | return NOTIFY_DONE; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static void __init ttc_setup_clockevent(struct clk *clk, | ||
334 | void __iomem *base, u32 irq) | ||
335 | { | ||
336 | struct ttc_timer_clockevent *ttcce; | ||
337 | int err; | ||
338 | |||
339 | ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL); | ||
340 | if (WARN_ON(!ttcce)) | ||
341 | return; | ||
342 | |||
343 | ttcce->ttc.clk = clk; | ||
344 | |||
345 | err = clk_prepare_enable(ttcce->ttc.clk); | ||
346 | if (WARN_ON(err)) { | ||
347 | kfree(ttcce); | ||
348 | return; | ||
349 | } | ||
350 | |||
351 | ttcce->ttc.clk_rate_change_nb.notifier_call = | ||
352 | ttc_rate_change_clockevent_cb; | ||
353 | ttcce->ttc.clk_rate_change_nb.next = NULL; | ||
354 | if (clk_notifier_register(ttcce->ttc.clk, | ||
355 | &ttcce->ttc.clk_rate_change_nb)) | ||
356 | pr_warn("Unable to register clock notifier.\n"); | ||
357 | |||
358 | ttcce->ttc.base_addr = base; | ||
359 | ttcce->ce.name = "ttc_clockevent"; | ||
360 | ttcce->ce.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | ||
361 | ttcce->ce.set_next_event = ttc_set_next_event; | ||
362 | ttcce->ce.set_mode = ttc_set_mode; | ||
363 | ttcce->ce.rating = 200; | ||
364 | ttcce->ce.irq = irq; | ||
365 | ttcce->ce.cpumask = cpu_possible_mask; | ||
366 | |||
367 | /* | ||
368 | * Setup the clock event timer to be an interval timer which | ||
369 | * is prescaled by 32 using the interval interrupt. Leave it | ||
370 | * disabled for now. | ||
371 | */ | ||
372 | __raw_writel(0x23, ttcce->ttc.base_addr + TTC_CNT_CNTRL_OFFSET); | ||
373 | __raw_writel(CLK_CNTRL_PRESCALE | CLK_CNTRL_PRESCALE_EN, | ||
374 | ttcce->ttc.base_addr + TTC_CLK_CNTRL_OFFSET); | ||
375 | __raw_writel(0x1, ttcce->ttc.base_addr + TTC_IER_OFFSET); | ||
376 | |||
377 | err = request_irq(irq, ttc_clock_event_interrupt, | ||
378 | IRQF_DISABLED | IRQF_TIMER, | ||
379 | ttcce->ce.name, ttcce); | ||
380 | if (WARN_ON(err)) { | ||
381 | kfree(ttcce); | ||
382 | return; | ||
383 | } | ||
384 | |||
385 | clockevents_config_and_register(&ttcce->ce, | ||
386 | clk_get_rate(ttcce->ttc.clk) / PRESCALE, 1, 0xfffe); | ||
387 | } | ||
388 | |||
389 | /** | ||
390 | * ttc_timer_init - Initialize the timer | ||
391 | * | ||
392 | * Initializes the timer hardware and register the clock source and clock event | ||
393 | * timers with Linux kernal timer framework | ||
394 | */ | ||
395 | static void __init ttc_timer_init(struct device_node *timer) | ||
396 | { | ||
397 | unsigned int irq; | ||
398 | void __iomem *timer_baseaddr; | ||
399 | struct clk *clk; | ||
400 | static int initialized; | ||
401 | |||
402 | if (initialized) | ||
403 | return; | ||
404 | |||
405 | initialized = 1; | ||
406 | |||
407 | /* | ||
408 | * Get the 1st Triple Timer Counter (TTC) block from the device tree | ||
409 | * and use it. Note that the event timer uses the interrupt and it's the | ||
410 | * 2nd TTC hence the irq_of_parse_and_map(,1) | ||
411 | */ | ||
412 | timer_baseaddr = of_iomap(timer, 0); | ||
413 | if (!timer_baseaddr) { | ||
414 | pr_err("ERROR: invalid timer base address\n"); | ||
415 | BUG(); | ||
416 | } | ||
417 | |||
418 | irq = irq_of_parse_and_map(timer, 1); | ||
419 | if (irq <= 0) { | ||
420 | pr_err("ERROR: invalid interrupt number\n"); | ||
421 | BUG(); | ||
422 | } | ||
423 | |||
424 | clk = of_clk_get_by_name(timer, "cpu_1x"); | ||
425 | if (IS_ERR(clk)) { | ||
426 | pr_err("ERROR: timer input clock not found\n"); | ||
427 | BUG(); | ||
428 | } | ||
429 | |||
430 | ttc_setup_clocksource(clk, timer_baseaddr); | ||
431 | ttc_setup_clockevent(clk, timer_baseaddr + 4, irq); | ||
432 | |||
433 | pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq); | ||
434 | } | ||
435 | |||
436 | CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init); | ||
diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c index bdabdaa8d00f..37f5325bec95 100644 --- a/drivers/clocksource/clksrc-of.c +++ b/drivers/clocksource/clksrc-of.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/clocksource.h> | ||
19 | 20 | ||
20 | extern struct of_device_id __clksrc_of_table[]; | 21 | extern struct of_device_id __clksrc_of_table[]; |
21 | 22 | ||
@@ -26,10 +27,10 @@ void __init clocksource_of_init(void) | |||
26 | { | 27 | { |
27 | struct device_node *np; | 28 | struct device_node *np; |
28 | const struct of_device_id *match; | 29 | const struct of_device_id *match; |
29 | void (*init_func)(void); | 30 | clocksource_of_init_fn init_func; |
30 | 31 | ||
31 | for_each_matching_node_and_match(np, __clksrc_of_table, &match) { | 32 | for_each_matching_node_and_match(np, __clksrc_of_table, &match) { |
32 | init_func = match->data; | 33 | init_func = match->data; |
33 | init_func(); | 34 | init_func(np); |
34 | } | 35 | } |
35 | } | 36 | } |
diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c index e6a553cb73e8..4329a29a5310 100644 --- a/drivers/clocksource/em_sti.c +++ b/drivers/clocksource/em_sti.c | |||
@@ -399,7 +399,18 @@ static struct platform_driver em_sti_device_driver = { | |||
399 | } | 399 | } |
400 | }; | 400 | }; |
401 | 401 | ||
402 | module_platform_driver(em_sti_device_driver); | 402 | static int __init em_sti_init(void) |
403 | { | ||
404 | return platform_driver_register(&em_sti_device_driver); | ||
405 | } | ||
406 | |||
407 | static void __exit em_sti_exit(void) | ||
408 | { | ||
409 | platform_driver_unregister(&em_sti_device_driver); | ||
410 | } | ||
411 | |||
412 | subsys_initcall(em_sti_init); | ||
413 | module_exit(em_sti_exit); | ||
403 | 414 | ||
404 | MODULE_AUTHOR("Magnus Damm"); | 415 | MODULE_AUTHOR("Magnus Damm"); |
405 | MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver"); | 416 | MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver"); |
diff --git a/arch/arm/mach-exynos/mct.c b/drivers/clocksource/exynos_mct.c index c9d6650f9b5d..b078d7cbc930 100644 --- a/arch/arm/mach-exynos/mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -20,17 +20,46 @@ | |||
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
22 | #include <linux/of.h> | 22 | #include <linux/of.h> |
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/of_address.h> | ||
25 | #include <linux/clocksource.h> | ||
23 | 26 | ||
24 | #include <asm/arch_timer.h> | ||
25 | #include <asm/localtimer.h> | 27 | #include <asm/localtimer.h> |
26 | 28 | ||
27 | #include <plat/cpu.h> | 29 | #include <plat/cpu.h> |
28 | 30 | ||
29 | #include <mach/map.h> | 31 | #include <mach/map.h> |
30 | #include <mach/irqs.h> | 32 | #include <mach/irqs.h> |
31 | #include <mach/regs-mct.h> | ||
32 | #include <asm/mach/time.h> | 33 | #include <asm/mach/time.h> |
33 | 34 | ||
35 | #define EXYNOS4_MCTREG(x) (x) | ||
36 | #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) | ||
37 | #define EXYNOS4_MCT_G_CNT_U EXYNOS4_MCTREG(0x104) | ||
38 | #define EXYNOS4_MCT_G_CNT_WSTAT EXYNOS4_MCTREG(0x110) | ||
39 | #define EXYNOS4_MCT_G_COMP0_L EXYNOS4_MCTREG(0x200) | ||
40 | #define EXYNOS4_MCT_G_COMP0_U EXYNOS4_MCTREG(0x204) | ||
41 | #define EXYNOS4_MCT_G_COMP0_ADD_INCR EXYNOS4_MCTREG(0x208) | ||
42 | #define EXYNOS4_MCT_G_TCON EXYNOS4_MCTREG(0x240) | ||
43 | #define EXYNOS4_MCT_G_INT_CSTAT EXYNOS4_MCTREG(0x244) | ||
44 | #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248) | ||
45 | #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C) | ||
46 | #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300) | ||
47 | #define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x)) | ||
48 | #define EXYNOS4_MCT_L_MASK (0xffffff00) | ||
49 | |||
50 | #define MCT_L_TCNTB_OFFSET (0x00) | ||
51 | #define MCT_L_ICNTB_OFFSET (0x08) | ||
52 | #define MCT_L_TCON_OFFSET (0x20) | ||
53 | #define MCT_L_INT_CSTAT_OFFSET (0x30) | ||
54 | #define MCT_L_INT_ENB_OFFSET (0x34) | ||
55 | #define MCT_L_WSTAT_OFFSET (0x40) | ||
56 | #define MCT_G_TCON_START (1 << 8) | ||
57 | #define MCT_G_TCON_COMP0_AUTO_INC (1 << 1) | ||
58 | #define MCT_G_TCON_COMP0_ENABLE (1 << 0) | ||
59 | #define MCT_L_TCON_INTERVAL_MODE (1 << 2) | ||
60 | #define MCT_L_TCON_INT_START (1 << 1) | ||
61 | #define MCT_L_TCON_TIMER_START (1 << 0) | ||
62 | |||
34 | #define TICK_BASE_CNT 1 | 63 | #define TICK_BASE_CNT 1 |
35 | 64 | ||
36 | enum { | 65 | enum { |
@@ -38,64 +67,75 @@ enum { | |||
38 | MCT_INT_PPI | 67 | MCT_INT_PPI |
39 | }; | 68 | }; |
40 | 69 | ||
70 | enum { | ||
71 | MCT_G0_IRQ, | ||
72 | MCT_G1_IRQ, | ||
73 | MCT_G2_IRQ, | ||
74 | MCT_G3_IRQ, | ||
75 | MCT_L0_IRQ, | ||
76 | MCT_L1_IRQ, | ||
77 | MCT_L2_IRQ, | ||
78 | MCT_L3_IRQ, | ||
79 | MCT_NR_IRQS, | ||
80 | }; | ||
81 | |||
82 | static void __iomem *reg_base; | ||
41 | static unsigned long clk_rate; | 83 | static unsigned long clk_rate; |
42 | static unsigned int mct_int_type; | 84 | static unsigned int mct_int_type; |
85 | static int mct_irqs[MCT_NR_IRQS]; | ||
43 | 86 | ||
44 | struct mct_clock_event_device { | 87 | struct mct_clock_event_device { |
45 | struct clock_event_device *evt; | 88 | struct clock_event_device *evt; |
46 | void __iomem *base; | 89 | unsigned long base; |
47 | char name[10]; | 90 | char name[10]; |
48 | }; | 91 | }; |
49 | 92 | ||
50 | static void exynos4_mct_write(unsigned int value, void *addr) | 93 | static void exynos4_mct_write(unsigned int value, unsigned long offset) |
51 | { | 94 | { |
52 | void __iomem *stat_addr; | 95 | unsigned long stat_addr; |
53 | u32 mask; | 96 | u32 mask; |
54 | u32 i; | 97 | u32 i; |
55 | 98 | ||
56 | __raw_writel(value, addr); | 99 | __raw_writel(value, reg_base + offset); |
57 | 100 | ||
58 | if (likely(addr >= EXYNOS4_MCT_L_BASE(0))) { | 101 | if (likely(offset >= EXYNOS4_MCT_L_BASE(0))) { |
59 | u32 base = (u32) addr & EXYNOS4_MCT_L_MASK; | 102 | stat_addr = (offset & ~EXYNOS4_MCT_L_MASK) + MCT_L_WSTAT_OFFSET; |
60 | switch ((u32) addr & ~EXYNOS4_MCT_L_MASK) { | 103 | switch (offset & EXYNOS4_MCT_L_MASK) { |
61 | case (u32) MCT_L_TCON_OFFSET: | 104 | case MCT_L_TCON_OFFSET: |
62 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
63 | mask = 1 << 3; /* L_TCON write status */ | 105 | mask = 1 << 3; /* L_TCON write status */ |
64 | break; | 106 | break; |
65 | case (u32) MCT_L_ICNTB_OFFSET: | 107 | case MCT_L_ICNTB_OFFSET: |
66 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
67 | mask = 1 << 1; /* L_ICNTB write status */ | 108 | mask = 1 << 1; /* L_ICNTB write status */ |
68 | break; | 109 | break; |
69 | case (u32) MCT_L_TCNTB_OFFSET: | 110 | case MCT_L_TCNTB_OFFSET: |
70 | stat_addr = (void __iomem *) base + MCT_L_WSTAT_OFFSET; | ||
71 | mask = 1 << 0; /* L_TCNTB write status */ | 111 | mask = 1 << 0; /* L_TCNTB write status */ |
72 | break; | 112 | break; |
73 | default: | 113 | default: |
74 | return; | 114 | return; |
75 | } | 115 | } |
76 | } else { | 116 | } else { |
77 | switch ((u32) addr) { | 117 | switch (offset) { |
78 | case (u32) EXYNOS4_MCT_G_TCON: | 118 | case EXYNOS4_MCT_G_TCON: |
79 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 119 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
80 | mask = 1 << 16; /* G_TCON write status */ | 120 | mask = 1 << 16; /* G_TCON write status */ |
81 | break; | 121 | break; |
82 | case (u32) EXYNOS4_MCT_G_COMP0_L: | 122 | case EXYNOS4_MCT_G_COMP0_L: |
83 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 123 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
84 | mask = 1 << 0; /* G_COMP0_L write status */ | 124 | mask = 1 << 0; /* G_COMP0_L write status */ |
85 | break; | 125 | break; |
86 | case (u32) EXYNOS4_MCT_G_COMP0_U: | 126 | case EXYNOS4_MCT_G_COMP0_U: |
87 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 127 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
88 | mask = 1 << 1; /* G_COMP0_U write status */ | 128 | mask = 1 << 1; /* G_COMP0_U write status */ |
89 | break; | 129 | break; |
90 | case (u32) EXYNOS4_MCT_G_COMP0_ADD_INCR: | 130 | case EXYNOS4_MCT_G_COMP0_ADD_INCR: |
91 | stat_addr = EXYNOS4_MCT_G_WSTAT; | 131 | stat_addr = EXYNOS4_MCT_G_WSTAT; |
92 | mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ | 132 | mask = 1 << 2; /* G_COMP0_ADD_INCR w status */ |
93 | break; | 133 | break; |
94 | case (u32) EXYNOS4_MCT_G_CNT_L: | 134 | case EXYNOS4_MCT_G_CNT_L: |
95 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | 135 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; |
96 | mask = 1 << 0; /* G_CNT_L write status */ | 136 | mask = 1 << 0; /* G_CNT_L write status */ |
97 | break; | 137 | break; |
98 | case (u32) EXYNOS4_MCT_G_CNT_U: | 138 | case EXYNOS4_MCT_G_CNT_U: |
99 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; | 139 | stat_addr = EXYNOS4_MCT_G_CNT_WSTAT; |
100 | mask = 1 << 1; /* G_CNT_U write status */ | 140 | mask = 1 << 1; /* G_CNT_U write status */ |
101 | break; | 141 | break; |
@@ -106,12 +146,12 @@ static void exynos4_mct_write(unsigned int value, void *addr) | |||
106 | 146 | ||
107 | /* Wait maximum 1 ms until written values are applied */ | 147 | /* Wait maximum 1 ms until written values are applied */ |
108 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) | 148 | for (i = 0; i < loops_per_jiffy / 1000 * HZ; i++) |
109 | if (__raw_readl(stat_addr) & mask) { | 149 | if (__raw_readl(reg_base + stat_addr) & mask) { |
110 | __raw_writel(mask, stat_addr); | 150 | __raw_writel(mask, reg_base + stat_addr); |
111 | return; | 151 | return; |
112 | } | 152 | } |
113 | 153 | ||
114 | panic("MCT hangs after writing %d (addr:0x%08x)\n", value, (u32)addr); | 154 | panic("MCT hangs after writing %d (offset:0x%lx)\n", value, offset); |
115 | } | 155 | } |
116 | 156 | ||
117 | /* Clocksource handling */ | 157 | /* Clocksource handling */ |
@@ -122,7 +162,7 @@ static void exynos4_mct_frc_start(u32 hi, u32 lo) | |||
122 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | 162 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); |
123 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | 163 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); |
124 | 164 | ||
125 | reg = __raw_readl(EXYNOS4_MCT_G_TCON); | 165 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
126 | reg |= MCT_G_TCON_START; | 166 | reg |= MCT_G_TCON_START; |
127 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | 167 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); |
128 | } | 168 | } |
@@ -130,12 +170,12 @@ static void exynos4_mct_frc_start(u32 hi, u32 lo) | |||
130 | static cycle_t exynos4_frc_read(struct clocksource *cs) | 170 | static cycle_t exynos4_frc_read(struct clocksource *cs) |
131 | { | 171 | { |
132 | unsigned int lo, hi; | 172 | unsigned int lo, hi; |
133 | u32 hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | 173 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
134 | 174 | ||
135 | do { | 175 | do { |
136 | hi = hi2; | 176 | hi = hi2; |
137 | lo = __raw_readl(EXYNOS4_MCT_G_CNT_L); | 177 | lo = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_L); |
138 | hi2 = __raw_readl(EXYNOS4_MCT_G_CNT_U); | 178 | hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
139 | } while (hi != hi2); | 179 | } while (hi != hi2); |
140 | 180 | ||
141 | return ((cycle_t)hi << 32) | lo; | 181 | return ((cycle_t)hi << 32) | lo; |
@@ -167,7 +207,7 @@ static void exynos4_mct_comp0_stop(void) | |||
167 | { | 207 | { |
168 | unsigned int tcon; | 208 | unsigned int tcon; |
169 | 209 | ||
170 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | 210 | tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
171 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); | 211 | tcon &= ~(MCT_G_TCON_COMP0_ENABLE | MCT_G_TCON_COMP0_AUTO_INC); |
172 | 212 | ||
173 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); | 213 | exynos4_mct_write(tcon, EXYNOS4_MCT_G_TCON); |
@@ -180,7 +220,7 @@ static void exynos4_mct_comp0_start(enum clock_event_mode mode, | |||
180 | unsigned int tcon; | 220 | unsigned int tcon; |
181 | cycle_t comp_cycle; | 221 | cycle_t comp_cycle; |
182 | 222 | ||
183 | tcon = __raw_readl(EXYNOS4_MCT_G_TCON); | 223 | tcon = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
184 | 224 | ||
185 | if (mode == CLOCK_EVT_MODE_PERIODIC) { | 225 | if (mode == CLOCK_EVT_MODE_PERIODIC) { |
186 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; | 226 | tcon |= MCT_G_TCON_COMP0_AUTO_INC; |
@@ -257,11 +297,7 @@ static void exynos4_clockevent_init(void) | |||
257 | mct_comp_device.cpumask = cpumask_of(0); | 297 | mct_comp_device.cpumask = cpumask_of(0); |
258 | clockevents_config_and_register(&mct_comp_device, clk_rate, | 298 | clockevents_config_and_register(&mct_comp_device, clk_rate, |
259 | 0xf, 0xffffffff); | 299 | 0xf, 0xffffffff); |
260 | 300 | setup_irq(mct_irqs[MCT_G0_IRQ], &mct_comp_event_irq); | |
261 | if (soc_is_exynos5250()) | ||
262 | setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq); | ||
263 | else | ||
264 | setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq); | ||
265 | } | 301 | } |
266 | 302 | ||
267 | #ifdef CONFIG_LOCAL_TIMERS | 303 | #ifdef CONFIG_LOCAL_TIMERS |
@@ -273,12 +309,12 @@ static void exynos4_mct_tick_stop(struct mct_clock_event_device *mevt) | |||
273 | { | 309 | { |
274 | unsigned long tmp; | 310 | unsigned long tmp; |
275 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; | 311 | unsigned long mask = MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START; |
276 | void __iomem *addr = mevt->base + MCT_L_TCON_OFFSET; | 312 | unsigned long offset = mevt->base + MCT_L_TCON_OFFSET; |
277 | 313 | ||
278 | tmp = __raw_readl(addr); | 314 | tmp = __raw_readl(reg_base + offset); |
279 | if (tmp & mask) { | 315 | if (tmp & mask) { |
280 | tmp &= ~mask; | 316 | tmp &= ~mask; |
281 | exynos4_mct_write(tmp, addr); | 317 | exynos4_mct_write(tmp, offset); |
282 | } | 318 | } |
283 | } | 319 | } |
284 | 320 | ||
@@ -297,7 +333,7 @@ static void exynos4_mct_tick_start(unsigned long cycles, | |||
297 | /* enable MCT tick interrupt */ | 333 | /* enable MCT tick interrupt */ |
298 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); | 334 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_ENB_OFFSET); |
299 | 335 | ||
300 | tmp = __raw_readl(mevt->base + MCT_L_TCON_OFFSET); | 336 | tmp = __raw_readl(reg_base + mevt->base + MCT_L_TCON_OFFSET); |
301 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | | 337 | tmp |= MCT_L_TCON_INT_START | MCT_L_TCON_TIMER_START | |
302 | MCT_L_TCON_INTERVAL_MODE; | 338 | MCT_L_TCON_INTERVAL_MODE; |
303 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); | 339 | exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET); |
@@ -349,7 +385,7 @@ static int exynos4_mct_tick_clear(struct mct_clock_event_device *mevt) | |||
349 | exynos4_mct_tick_stop(mevt); | 385 | exynos4_mct_tick_stop(mevt); |
350 | 386 | ||
351 | /* Clear the MCT tick interrupt */ | 387 | /* Clear the MCT tick interrupt */ |
352 | if (__raw_readl(mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { | 388 | if (__raw_readl(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1) { |
353 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); | 389 | exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET); |
354 | return 1; | 390 | return 1; |
355 | } else { | 391 | } else { |
@@ -385,7 +421,6 @@ static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) | |||
385 | { | 421 | { |
386 | struct mct_clock_event_device *mevt; | 422 | struct mct_clock_event_device *mevt; |
387 | unsigned int cpu = smp_processor_id(); | 423 | unsigned int cpu = smp_processor_id(); |
388 | int mct_lx_irq; | ||
389 | 424 | ||
390 | mevt = this_cpu_ptr(&percpu_mct_tick); | 425 | mevt = this_cpu_ptr(&percpu_mct_tick); |
391 | mevt->evt = evt; | 426 | mevt->evt = evt; |
@@ -406,21 +441,17 @@ static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt) | |||
406 | 441 | ||
407 | if (mct_int_type == MCT_INT_SPI) { | 442 | if (mct_int_type == MCT_INT_SPI) { |
408 | if (cpu == 0) { | 443 | if (cpu == 0) { |
409 | mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L0 : | ||
410 | EXYNOS5_IRQ_MCT_L0; | ||
411 | mct_tick0_event_irq.dev_id = mevt; | 444 | mct_tick0_event_irq.dev_id = mevt; |
412 | evt->irq = mct_lx_irq; | 445 | evt->irq = mct_irqs[MCT_L0_IRQ]; |
413 | setup_irq(mct_lx_irq, &mct_tick0_event_irq); | 446 | setup_irq(evt->irq, &mct_tick0_event_irq); |
414 | } else { | 447 | } else { |
415 | mct_lx_irq = soc_is_exynos4210() ? EXYNOS4_IRQ_MCT_L1 : | ||
416 | EXYNOS5_IRQ_MCT_L1; | ||
417 | mct_tick1_event_irq.dev_id = mevt; | 448 | mct_tick1_event_irq.dev_id = mevt; |
418 | evt->irq = mct_lx_irq; | 449 | evt->irq = mct_irqs[MCT_L1_IRQ]; |
419 | setup_irq(mct_lx_irq, &mct_tick1_event_irq); | 450 | setup_irq(evt->irq, &mct_tick1_event_irq); |
420 | irq_set_affinity(mct_lx_irq, cpumask_of(1)); | 451 | irq_set_affinity(evt->irq, cpumask_of(1)); |
421 | } | 452 | } |
422 | } else { | 453 | } else { |
423 | enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0); | 454 | enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); |
424 | } | 455 | } |
425 | 456 | ||
426 | return 0; | 457 | return 0; |
@@ -436,7 +467,7 @@ static void exynos4_local_timer_stop(struct clock_event_device *evt) | |||
436 | else | 467 | else |
437 | remove_irq(evt->irq, &mct_tick1_event_irq); | 468 | remove_irq(evt->irq, &mct_tick1_event_irq); |
438 | else | 469 | else |
439 | disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER); | 470 | disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); |
440 | } | 471 | } |
441 | 472 | ||
442 | static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { | 473 | static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { |
@@ -445,41 +476,80 @@ static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { | |||
445 | }; | 476 | }; |
446 | #endif /* CONFIG_LOCAL_TIMERS */ | 477 | #endif /* CONFIG_LOCAL_TIMERS */ |
447 | 478 | ||
448 | static void __init exynos4_timer_resources(void) | 479 | static void __init exynos4_timer_resources(void __iomem *base) |
449 | { | 480 | { |
450 | struct clk *mct_clk; | 481 | struct clk *mct_clk; |
451 | mct_clk = clk_get(NULL, "xtal"); | 482 | mct_clk = clk_get(NULL, "xtal"); |
452 | 483 | ||
453 | clk_rate = clk_get_rate(mct_clk); | 484 | clk_rate = clk_get_rate(mct_clk); |
454 | 485 | ||
486 | reg_base = base; | ||
487 | if (!reg_base) | ||
488 | panic("%s: unable to ioremap mct address space\n", __func__); | ||
489 | |||
455 | #ifdef CONFIG_LOCAL_TIMERS | 490 | #ifdef CONFIG_LOCAL_TIMERS |
456 | if (mct_int_type == MCT_INT_PPI) { | 491 | if (mct_int_type == MCT_INT_PPI) { |
457 | int err; | 492 | int err; |
458 | 493 | ||
459 | err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, | 494 | err = request_percpu_irq(mct_irqs[MCT_L0_IRQ], |
460 | exynos4_mct_tick_isr, "MCT", | 495 | exynos4_mct_tick_isr, "MCT", |
461 | &percpu_mct_tick); | 496 | &percpu_mct_tick); |
462 | WARN(err, "MCT: can't request IRQ %d (%d)\n", | 497 | WARN(err, "MCT: can't request IRQ %d (%d)\n", |
463 | EXYNOS_IRQ_MCT_LOCALTIMER, err); | 498 | mct_irqs[MCT_L0_IRQ], err); |
464 | } | 499 | } |
465 | 500 | ||
466 | local_timer_register(&exynos4_mct_tick_ops); | 501 | local_timer_register(&exynos4_mct_tick_ops); |
467 | #endif /* CONFIG_LOCAL_TIMERS */ | 502 | #endif /* CONFIG_LOCAL_TIMERS */ |
468 | } | 503 | } |
469 | 504 | ||
470 | void __init exynos4_timer_init(void) | 505 | void __init mct_init(void) |
471 | { | 506 | { |
472 | if (soc_is_exynos5440()) { | 507 | if (soc_is_exynos4210()) { |
473 | arch_timer_of_register(); | 508 | mct_irqs[MCT_G0_IRQ] = EXYNOS4_IRQ_MCT_G0; |
474 | return; | 509 | mct_irqs[MCT_L0_IRQ] = EXYNOS4_IRQ_MCT_L0; |
510 | mct_irqs[MCT_L1_IRQ] = EXYNOS4_IRQ_MCT_L1; | ||
511 | mct_int_type = MCT_INT_SPI; | ||
512 | } else { | ||
513 | panic("unable to determine mct controller type\n"); | ||
475 | } | 514 | } |
476 | 515 | ||
477 | if ((soc_is_exynos4210()) || (soc_is_exynos5250())) | 516 | exynos4_timer_resources(S5P_VA_SYSTIMER); |
478 | mct_int_type = MCT_INT_SPI; | 517 | exynos4_clocksource_init(); |
479 | else | 518 | exynos4_clockevent_init(); |
480 | mct_int_type = MCT_INT_PPI; | 519 | } |
481 | 520 | ||
482 | exynos4_timer_resources(); | 521 | static void __init mct_init_dt(struct device_node *np, unsigned int int_type) |
522 | { | ||
523 | u32 nr_irqs, i; | ||
524 | |||
525 | mct_int_type = int_type; | ||
526 | |||
527 | /* This driver uses only one global timer interrupt */ | ||
528 | mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ); | ||
529 | |||
530 | /* | ||
531 | * Find out the number of local irqs specified. The local | ||
532 | * timer irqs are specified after the four global timer | ||
533 | * irqs are specified. | ||
534 | */ | ||
535 | nr_irqs = of_irq_count(np); | ||
536 | for (i = MCT_L0_IRQ; i < nr_irqs; i++) | ||
537 | mct_irqs[i] = irq_of_parse_and_map(np, i); | ||
538 | |||
539 | exynos4_timer_resources(of_iomap(np, 0)); | ||
483 | exynos4_clocksource_init(); | 540 | exynos4_clocksource_init(); |
484 | exynos4_clockevent_init(); | 541 | exynos4_clockevent_init(); |
485 | } | 542 | } |
543 | |||
544 | |||
545 | static void __init mct_init_spi(struct device_node *np) | ||
546 | { | ||
547 | return mct_init_dt(np, MCT_INT_SPI); | ||
548 | } | ||
549 | |||
550 | static void __init mct_init_ppi(struct device_node *np) | ||
551 | { | ||
552 | return mct_init_dt(np, MCT_INT_PPI); | ||
553 | } | ||
554 | CLOCKSOURCE_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init_spi); | ||
555 | CLOCKSOURCE_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init_ppi); | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 488c14cc8dbf..08d0c418c94a 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -54,62 +54,100 @@ struct sh_cmt_priv { | |||
54 | struct clocksource cs; | 54 | struct clocksource cs; |
55 | unsigned long total_cycles; | 55 | unsigned long total_cycles; |
56 | bool cs_enabled; | 56 | bool cs_enabled; |
57 | |||
58 | /* callbacks for CMSTR and CMCSR access */ | ||
59 | unsigned long (*read_control)(void __iomem *base, unsigned long offs); | ||
60 | void (*write_control)(void __iomem *base, unsigned long offs, | ||
61 | unsigned long value); | ||
62 | |||
63 | /* callbacks for CMCNT and CMCOR access */ | ||
64 | unsigned long (*read_count)(void __iomem *base, unsigned long offs); | ||
65 | void (*write_count)(void __iomem *base, unsigned long offs, | ||
66 | unsigned long value); | ||
57 | }; | 67 | }; |
58 | 68 | ||
59 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); | 69 | /* Examples of supported CMT timer register layouts and I/O access widths: |
70 | * | ||
71 | * "16-bit counter and 16-bit control" as found on sh7263: | ||
72 | * CMSTR 0xfffec000 16-bit | ||
73 | * CMCSR 0xfffec002 16-bit | ||
74 | * CMCNT 0xfffec004 16-bit | ||
75 | * CMCOR 0xfffec006 16-bit | ||
76 | * | ||
77 | * "32-bit counter and 16-bit control" as found on sh7372, sh73a0, r8a7740: | ||
78 | * CMSTR 0xffca0000 16-bit | ||
79 | * CMCSR 0xffca0060 16-bit | ||
80 | * CMCNT 0xffca0064 32-bit | ||
81 | * CMCOR 0xffca0068 32-bit | ||
82 | */ | ||
83 | |||
84 | static unsigned long sh_cmt_read16(void __iomem *base, unsigned long offs) | ||
85 | { | ||
86 | return ioread16(base + (offs << 1)); | ||
87 | } | ||
88 | |||
89 | static unsigned long sh_cmt_read32(void __iomem *base, unsigned long offs) | ||
90 | { | ||
91 | return ioread32(base + (offs << 2)); | ||
92 | } | ||
93 | |||
94 | static void sh_cmt_write16(void __iomem *base, unsigned long offs, | ||
95 | unsigned long value) | ||
96 | { | ||
97 | iowrite16(value, base + (offs << 1)); | ||
98 | } | ||
99 | |||
100 | static void sh_cmt_write32(void __iomem *base, unsigned long offs, | ||
101 | unsigned long value) | ||
102 | { | ||
103 | iowrite32(value, base + (offs << 2)); | ||
104 | } | ||
60 | 105 | ||
61 | #define CMSTR -1 /* shared register */ | ||
62 | #define CMCSR 0 /* channel register */ | 106 | #define CMCSR 0 /* channel register */ |
63 | #define CMCNT 1 /* channel register */ | 107 | #define CMCNT 1 /* channel register */ |
64 | #define CMCOR 2 /* channel register */ | 108 | #define CMCOR 2 /* channel register */ |
65 | 109 | ||
66 | static inline unsigned long sh_cmt_read(struct sh_cmt_priv *p, int reg_nr) | 110 | static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_priv *p) |
67 | { | 111 | { |
68 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | 112 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; |
69 | void __iomem *base = p->mapbase; | ||
70 | unsigned long offs; | ||
71 | |||
72 | if (reg_nr == CMSTR) { | ||
73 | offs = 0; | ||
74 | base -= cfg->channel_offset; | ||
75 | } else | ||
76 | offs = reg_nr; | ||
77 | |||
78 | if (p->width == 16) | ||
79 | offs <<= 1; | ||
80 | else { | ||
81 | offs <<= 2; | ||
82 | if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) | ||
83 | return ioread32(base + offs); | ||
84 | } | ||
85 | 113 | ||
86 | return ioread16(base + offs); | 114 | return p->read_control(p->mapbase - cfg->channel_offset, 0); |
87 | } | 115 | } |
88 | 116 | ||
89 | static inline void sh_cmt_write(struct sh_cmt_priv *p, int reg_nr, | 117 | static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_priv *p) |
90 | unsigned long value) | 118 | { |
119 | return p->read_control(p->mapbase, CMCSR); | ||
120 | } | ||
121 | |||
122 | static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_priv *p) | ||
123 | { | ||
124 | return p->read_count(p->mapbase, CMCNT); | ||
125 | } | ||
126 | |||
127 | static inline void sh_cmt_write_cmstr(struct sh_cmt_priv *p, | ||
128 | unsigned long value) | ||
91 | { | 129 | { |
92 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; | 130 | struct sh_timer_config *cfg = p->pdev->dev.platform_data; |
93 | void __iomem *base = p->mapbase; | ||
94 | unsigned long offs; | ||
95 | |||
96 | if (reg_nr == CMSTR) { | ||
97 | offs = 0; | ||
98 | base -= cfg->channel_offset; | ||
99 | } else | ||
100 | offs = reg_nr; | ||
101 | |||
102 | if (p->width == 16) | ||
103 | offs <<= 1; | ||
104 | else { | ||
105 | offs <<= 2; | ||
106 | if ((reg_nr == CMCNT) || (reg_nr == CMCOR)) { | ||
107 | iowrite32(value, base + offs); | ||
108 | return; | ||
109 | } | ||
110 | } | ||
111 | 131 | ||
112 | iowrite16(value, base + offs); | 132 | p->write_control(p->mapbase - cfg->channel_offset, 0, value); |
133 | } | ||
134 | |||
135 | static inline void sh_cmt_write_cmcsr(struct sh_cmt_priv *p, | ||
136 | unsigned long value) | ||
137 | { | ||
138 | p->write_control(p->mapbase, CMCSR, value); | ||
139 | } | ||
140 | |||
141 | static inline void sh_cmt_write_cmcnt(struct sh_cmt_priv *p, | ||
142 | unsigned long value) | ||
143 | { | ||
144 | p->write_count(p->mapbase, CMCNT, value); | ||
145 | } | ||
146 | |||
147 | static inline void sh_cmt_write_cmcor(struct sh_cmt_priv *p, | ||
148 | unsigned long value) | ||
149 | { | ||
150 | p->write_count(p->mapbase, CMCOR, value); | ||
113 | } | 151 | } |
114 | 152 | ||
115 | static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | 153 | static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, |
@@ -118,15 +156,15 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | |||
118 | unsigned long v1, v2, v3; | 156 | unsigned long v1, v2, v3; |
119 | int o1, o2; | 157 | int o1, o2; |
120 | 158 | ||
121 | o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; | 159 | o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; |
122 | 160 | ||
123 | /* Make sure the timer value is stable. Stolen from acpi_pm.c */ | 161 | /* Make sure the timer value is stable. Stolen from acpi_pm.c */ |
124 | do { | 162 | do { |
125 | o2 = o1; | 163 | o2 = o1; |
126 | v1 = sh_cmt_read(p, CMCNT); | 164 | v1 = sh_cmt_read_cmcnt(p); |
127 | v2 = sh_cmt_read(p, CMCNT); | 165 | v2 = sh_cmt_read_cmcnt(p); |
128 | v3 = sh_cmt_read(p, CMCNT); | 166 | v3 = sh_cmt_read_cmcnt(p); |
129 | o1 = sh_cmt_read(p, CMCSR) & p->overflow_bit; | 167 | o1 = sh_cmt_read_cmcsr(p) & p->overflow_bit; |
130 | } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) | 168 | } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) |
131 | || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); | 169 | || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); |
132 | 170 | ||
@@ -134,6 +172,7 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p, | |||
134 | return v2; | 172 | return v2; |
135 | } | 173 | } |
136 | 174 | ||
175 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); | ||
137 | 176 | ||
138 | static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | 177 | static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) |
139 | { | 178 | { |
@@ -142,14 +181,14 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
142 | 181 | ||
143 | /* start stop register shared by multiple timer channels */ | 182 | /* start stop register shared by multiple timer channels */ |
144 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); | 183 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); |
145 | value = sh_cmt_read(p, CMSTR); | 184 | value = sh_cmt_read_cmstr(p); |
146 | 185 | ||
147 | if (start) | 186 | if (start) |
148 | value |= 1 << cfg->timer_bit; | 187 | value |= 1 << cfg->timer_bit; |
149 | else | 188 | else |
150 | value &= ~(1 << cfg->timer_bit); | 189 | value &= ~(1 << cfg->timer_bit); |
151 | 190 | ||
152 | sh_cmt_write(p, CMSTR, value); | 191 | sh_cmt_write_cmstr(p, value); |
153 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); | 192 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); |
154 | } | 193 | } |
155 | 194 | ||
@@ -173,14 +212,14 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
173 | /* configure channel, periodic mode and maximum timeout */ | 212 | /* configure channel, periodic mode and maximum timeout */ |
174 | if (p->width == 16) { | 213 | if (p->width == 16) { |
175 | *rate = clk_get_rate(p->clk) / 512; | 214 | *rate = clk_get_rate(p->clk) / 512; |
176 | sh_cmt_write(p, CMCSR, 0x43); | 215 | sh_cmt_write_cmcsr(p, 0x43); |
177 | } else { | 216 | } else { |
178 | *rate = clk_get_rate(p->clk) / 8; | 217 | *rate = clk_get_rate(p->clk) / 8; |
179 | sh_cmt_write(p, CMCSR, 0x01a4); | 218 | sh_cmt_write_cmcsr(p, 0x01a4); |
180 | } | 219 | } |
181 | 220 | ||
182 | sh_cmt_write(p, CMCOR, 0xffffffff); | 221 | sh_cmt_write_cmcor(p, 0xffffffff); |
183 | sh_cmt_write(p, CMCNT, 0); | 222 | sh_cmt_write_cmcnt(p, 0); |
184 | 223 | ||
185 | /* | 224 | /* |
186 | * According to the sh73a0 user's manual, as CMCNT can be operated | 225 | * According to the sh73a0 user's manual, as CMCNT can be operated |
@@ -194,12 +233,12 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
194 | * take RCLKx2 at maximum. | 233 | * take RCLKx2 at maximum. |
195 | */ | 234 | */ |
196 | for (k = 0; k < 100; k++) { | 235 | for (k = 0; k < 100; k++) { |
197 | if (!sh_cmt_read(p, CMCNT)) | 236 | if (!sh_cmt_read_cmcnt(p)) |
198 | break; | 237 | break; |
199 | udelay(1); | 238 | udelay(1); |
200 | } | 239 | } |
201 | 240 | ||
202 | if (sh_cmt_read(p, CMCNT)) { | 241 | if (sh_cmt_read_cmcnt(p)) { |
203 | dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); | 242 | dev_err(&p->pdev->dev, "cannot clear CMCNT\n"); |
204 | ret = -ETIMEDOUT; | 243 | ret = -ETIMEDOUT; |
205 | goto err1; | 244 | goto err1; |
@@ -222,7 +261,7 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) | |||
222 | sh_cmt_start_stop_ch(p, 0); | 261 | sh_cmt_start_stop_ch(p, 0); |
223 | 262 | ||
224 | /* disable interrupts in CMT block */ | 263 | /* disable interrupts in CMT block */ |
225 | sh_cmt_write(p, CMCSR, 0); | 264 | sh_cmt_write_cmcsr(p, 0); |
226 | 265 | ||
227 | /* stop clock */ | 266 | /* stop clock */ |
228 | clk_disable(p->clk); | 267 | clk_disable(p->clk); |
@@ -270,7 +309,7 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p, | |||
270 | if (new_match > p->max_match_value) | 309 | if (new_match > p->max_match_value) |
271 | new_match = p->max_match_value; | 310 | new_match = p->max_match_value; |
272 | 311 | ||
273 | sh_cmt_write(p, CMCOR, new_match); | 312 | sh_cmt_write_cmcor(p, new_match); |
274 | 313 | ||
275 | now = sh_cmt_get_counter(p, &has_wrapped); | 314 | now = sh_cmt_get_counter(p, &has_wrapped); |
276 | if (has_wrapped && (new_match > p->match_value)) { | 315 | if (has_wrapped && (new_match > p->match_value)) { |
@@ -346,7 +385,7 @@ static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) | |||
346 | struct sh_cmt_priv *p = dev_id; | 385 | struct sh_cmt_priv *p = dev_id; |
347 | 386 | ||
348 | /* clear flags */ | 387 | /* clear flags */ |
349 | sh_cmt_write(p, CMCSR, sh_cmt_read(p, CMCSR) & p->clear_bits); | 388 | sh_cmt_write_cmcsr(p, sh_cmt_read_cmcsr(p) & p->clear_bits); |
350 | 389 | ||
351 | /* update clock source counter to begin with if enabled | 390 | /* update clock source counter to begin with if enabled |
352 | * the wrap flag should be cleared by the timer specific | 391 | * the wrap flag should be cleared by the timer specific |
@@ -625,14 +664,6 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name, | |||
625 | unsigned long clockevent_rating, | 664 | unsigned long clockevent_rating, |
626 | unsigned long clocksource_rating) | 665 | unsigned long clocksource_rating) |
627 | { | 666 | { |
628 | if (p->width == (sizeof(p->max_match_value) * 8)) | ||
629 | p->max_match_value = ~0; | ||
630 | else | ||
631 | p->max_match_value = (1 << p->width) - 1; | ||
632 | |||
633 | p->match_value = p->max_match_value; | ||
634 | raw_spin_lock_init(&p->lock); | ||
635 | |||
636 | if (clockevent_rating) | 667 | if (clockevent_rating) |
637 | sh_cmt_register_clockevent(p, name, clockevent_rating); | 668 | sh_cmt_register_clockevent(p, name, clockevent_rating); |
638 | 669 | ||
@@ -657,8 +688,6 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
657 | goto err0; | 688 | goto err0; |
658 | } | 689 | } |
659 | 690 | ||
660 | platform_set_drvdata(pdev, p); | ||
661 | |||
662 | res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); | 691 | res = platform_get_resource(p->pdev, IORESOURCE_MEM, 0); |
663 | if (!res) { | 692 | if (!res) { |
664 | dev_err(&p->pdev->dev, "failed to get I/O memory\n"); | 693 | dev_err(&p->pdev->dev, "failed to get I/O memory\n"); |
@@ -693,32 +722,51 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
693 | goto err1; | 722 | goto err1; |
694 | } | 723 | } |
695 | 724 | ||
725 | p->read_control = sh_cmt_read16; | ||
726 | p->write_control = sh_cmt_write16; | ||
727 | |||
696 | if (resource_size(res) == 6) { | 728 | if (resource_size(res) == 6) { |
697 | p->width = 16; | 729 | p->width = 16; |
730 | p->read_count = sh_cmt_read16; | ||
731 | p->write_count = sh_cmt_write16; | ||
698 | p->overflow_bit = 0x80; | 732 | p->overflow_bit = 0x80; |
699 | p->clear_bits = ~0x80; | 733 | p->clear_bits = ~0x80; |
700 | } else { | 734 | } else { |
701 | p->width = 32; | 735 | p->width = 32; |
736 | p->read_count = sh_cmt_read32; | ||
737 | p->write_count = sh_cmt_write32; | ||
702 | p->overflow_bit = 0x8000; | 738 | p->overflow_bit = 0x8000; |
703 | p->clear_bits = ~0xc000; | 739 | p->clear_bits = ~0xc000; |
704 | } | 740 | } |
705 | 741 | ||
742 | if (p->width == (sizeof(p->max_match_value) * 8)) | ||
743 | p->max_match_value = ~0; | ||
744 | else | ||
745 | p->max_match_value = (1 << p->width) - 1; | ||
746 | |||
747 | p->match_value = p->max_match_value; | ||
748 | raw_spin_lock_init(&p->lock); | ||
749 | |||
706 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), | 750 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), |
707 | cfg->clockevent_rating, | 751 | cfg->clockevent_rating, |
708 | cfg->clocksource_rating); | 752 | cfg->clocksource_rating); |
709 | if (ret) { | 753 | if (ret) { |
710 | dev_err(&p->pdev->dev, "registration failed\n"); | 754 | dev_err(&p->pdev->dev, "registration failed\n"); |
711 | goto err1; | 755 | goto err2; |
712 | } | 756 | } |
713 | p->cs_enabled = false; | 757 | p->cs_enabled = false; |
714 | 758 | ||
715 | ret = setup_irq(irq, &p->irqaction); | 759 | ret = setup_irq(irq, &p->irqaction); |
716 | if (ret) { | 760 | if (ret) { |
717 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); | 761 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); |
718 | goto err1; | 762 | goto err2; |
719 | } | 763 | } |
720 | 764 | ||
765 | platform_set_drvdata(pdev, p); | ||
766 | |||
721 | return 0; | 767 | return 0; |
768 | err2: | ||
769 | clk_put(p->clk); | ||
722 | 770 | ||
723 | err1: | 771 | err1: |
724 | iounmap(p->mapbase); | 772 | iounmap(p->mapbase); |
@@ -751,7 +799,6 @@ static int sh_cmt_probe(struct platform_device *pdev) | |||
751 | ret = sh_cmt_setup(p, pdev); | 799 | ret = sh_cmt_setup(p, pdev); |
752 | if (ret) { | 800 | if (ret) { |
753 | kfree(p); | 801 | kfree(p); |
754 | platform_set_drvdata(pdev, NULL); | ||
755 | pm_runtime_idle(&pdev->dev); | 802 | pm_runtime_idle(&pdev->dev); |
756 | return ret; | 803 | return ret; |
757 | } | 804 | } |
@@ -791,7 +838,7 @@ static void __exit sh_cmt_exit(void) | |||
791 | } | 838 | } |
792 | 839 | ||
793 | early_platform_init("earlytimer", &sh_cmt_device_driver); | 840 | early_platform_init("earlytimer", &sh_cmt_device_driver); |
794 | module_init(sh_cmt_init); | 841 | subsys_initcall(sh_cmt_init); |
795 | module_exit(sh_cmt_exit); | 842 | module_exit(sh_cmt_exit); |
796 | 843 | ||
797 | MODULE_AUTHOR("Magnus Damm"); | 844 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index 83943e27cfac..4aac9ee0d0c0 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
@@ -386,7 +386,7 @@ static void __exit sh_mtu2_exit(void) | |||
386 | } | 386 | } |
387 | 387 | ||
388 | early_platform_init("earlytimer", &sh_mtu2_device_driver); | 388 | early_platform_init("earlytimer", &sh_mtu2_device_driver); |
389 | module_init(sh_mtu2_init); | 389 | subsys_initcall(sh_mtu2_init); |
390 | module_exit(sh_mtu2_exit); | 390 | module_exit(sh_mtu2_exit); |
391 | 391 | ||
392 | MODULE_AUTHOR("Magnus Damm"); | 392 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index b4502edce2a1..78b8dae49628 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -549,7 +549,7 @@ static void __exit sh_tmu_exit(void) | |||
549 | } | 549 | } |
550 | 550 | ||
551 | early_platform_init("earlytimer", &sh_tmu_device_driver); | 551 | early_platform_init("earlytimer", &sh_tmu_device_driver); |
552 | module_init(sh_tmu_init); | 552 | subsys_initcall(sh_tmu_init); |
553 | module_exit(sh_tmu_exit); | 553 | module_exit(sh_tmu_exit); |
554 | 554 | ||
555 | MODULE_AUTHOR("Magnus Damm"); | 555 | MODULE_AUTHOR("Magnus Damm"); |
diff --git a/drivers/clocksource/sunxi_timer.c b/drivers/clocksource/sunxi_timer.c index 4086b9167159..0ce85e29769b 100644 --- a/drivers/clocksource/sunxi_timer.c +++ b/drivers/clocksource/sunxi_timer.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/of_address.h> | 23 | #include <linux/of_address.h> |
24 | #include <linux/of_irq.h> | 24 | #include <linux/of_irq.h> |
25 | #include <linux/sunxi_timer.h> | 25 | #include <linux/sunxi_timer.h> |
26 | #include <linux/clk-provider.h> | 26 | #include <linux/clk/sunxi.h> |
27 | 27 | ||
28 | #define TIMER_CTL_REG 0x00 | 28 | #define TIMER_CTL_REG 0x00 |
29 | #define TIMER_CTL_ENABLE (1 << 0) | 29 | #define TIMER_CTL_ENABLE (1 << 0) |
@@ -123,7 +123,7 @@ void __init sunxi_timer_init(void) | |||
123 | if (irq <= 0) | 123 | if (irq <= 0) |
124 | panic("Can't parse IRQ"); | 124 | panic("Can't parse IRQ"); |
125 | 125 | ||
126 | of_clk_init(NULL); | 126 | sunxi_init_clocks(); |
127 | 127 | ||
128 | clk = of_clk_get(node, 0); | 128 | clk = of_clk_get(node, 0); |
129 | if (IS_ERR(clk)) | 129 | if (IS_ERR(clk)) |
diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c index 0bde03feb095..ae877b021b54 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c | |||
@@ -154,29 +154,12 @@ static struct irqaction tegra_timer_irq = { | |||
154 | .dev_id = &tegra_clockevent, | 154 | .dev_id = &tegra_clockevent, |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static const struct of_device_id timer_match[] __initconst = { | 157 | static void __init tegra20_init_timer(struct device_node *np) |
158 | { .compatible = "nvidia,tegra20-timer" }, | ||
159 | {} | ||
160 | }; | ||
161 | |||
162 | static const struct of_device_id rtc_match[] __initconst = { | ||
163 | { .compatible = "nvidia,tegra20-rtc" }, | ||
164 | {} | ||
165 | }; | ||
166 | |||
167 | static void __init tegra20_init_timer(void) | ||
168 | { | 158 | { |
169 | struct device_node *np; | ||
170 | struct clk *clk; | 159 | struct clk *clk; |
171 | unsigned long rate; | 160 | unsigned long rate; |
172 | int ret; | 161 | int ret; |
173 | 162 | ||
174 | np = of_find_matching_node(NULL, timer_match); | ||
175 | if (!np) { | ||
176 | pr_err("Failed to find timer DT node\n"); | ||
177 | BUG(); | ||
178 | } | ||
179 | |||
180 | timer_reg_base = of_iomap(np, 0); | 163 | timer_reg_base = of_iomap(np, 0); |
181 | if (!timer_reg_base) { | 164 | if (!timer_reg_base) { |
182 | pr_err("Can't map timer registers\n"); | 165 | pr_err("Can't map timer registers\n"); |
@@ -189,7 +172,7 @@ static void __init tegra20_init_timer(void) | |||
189 | BUG(); | 172 | BUG(); |
190 | } | 173 | } |
191 | 174 | ||
192 | clk = clk_get_sys("timer", NULL); | 175 | clk = of_clk_get(np, 0); |
193 | if (IS_ERR(clk)) { | 176 | if (IS_ERR(clk)) { |
194 | pr_warn("Unable to get timer clock. Assuming 12Mhz input clock.\n"); | 177 | pr_warn("Unable to get timer clock. Assuming 12Mhz input clock.\n"); |
195 | rate = 12000000; | 178 | rate = 12000000; |
@@ -200,30 +183,6 @@ static void __init tegra20_init_timer(void) | |||
200 | 183 | ||
201 | of_node_put(np); | 184 | of_node_put(np); |
202 | 185 | ||
203 | np = of_find_matching_node(NULL, rtc_match); | ||
204 | if (!np) { | ||
205 | pr_err("Failed to find RTC DT node\n"); | ||
206 | BUG(); | ||
207 | } | ||
208 | |||
209 | rtc_base = of_iomap(np, 0); | ||
210 | if (!rtc_base) { | ||
211 | pr_err("Can't map RTC registers"); | ||
212 | BUG(); | ||
213 | } | ||
214 | |||
215 | /* | ||
216 | * rtc registers are used by read_persistent_clock, keep the rtc clock | ||
217 | * enabled | ||
218 | */ | ||
219 | clk = clk_get_sys("rtc-tegra", NULL); | ||
220 | if (IS_ERR(clk)) | ||
221 | pr_warn("Unable to get rtc-tegra clock\n"); | ||
222 | else | ||
223 | clk_prepare_enable(clk); | ||
224 | |||
225 | of_node_put(np); | ||
226 | |||
227 | switch (rate) { | 186 | switch (rate) { |
228 | case 12000000: | 187 | case 12000000: |
229 | timer_writel(0x000b, TIMERUS_USEC_CFG); | 188 | timer_writel(0x000b, TIMERUS_USEC_CFG); |
@@ -259,12 +218,34 @@ static void __init tegra20_init_timer(void) | |||
259 | tegra_clockevent.irq = tegra_timer_irq.irq; | 218 | tegra_clockevent.irq = tegra_timer_irq.irq; |
260 | clockevents_config_and_register(&tegra_clockevent, 1000000, | 219 | clockevents_config_and_register(&tegra_clockevent, 1000000, |
261 | 0x1, 0x1fffffff); | 220 | 0x1, 0x1fffffff); |
262 | #ifdef CONFIG_HAVE_ARM_TWD | 221 | } |
263 | twd_local_timer_of_register(); | 222 | CLOCKSOURCE_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer); |
264 | #endif | 223 | |
224 | static void __init tegra20_init_rtc(struct device_node *np) | ||
225 | { | ||
226 | struct clk *clk; | ||
227 | |||
228 | rtc_base = of_iomap(np, 0); | ||
229 | if (!rtc_base) { | ||
230 | pr_err("Can't map RTC registers"); | ||
231 | BUG(); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * rtc registers are used by read_persistent_clock, keep the rtc clock | ||
236 | * enabled | ||
237 | */ | ||
238 | clk = of_clk_get(np, 0); | ||
239 | if (IS_ERR(clk)) | ||
240 | pr_warn("Unable to get rtc-tegra clock\n"); | ||
241 | else | ||
242 | clk_prepare_enable(clk); | ||
243 | |||
244 | of_node_put(np); | ||
245 | |||
265 | register_persistent_clock(NULL, tegra_read_persistent_clock); | 246 | register_persistent_clock(NULL, tegra_read_persistent_clock); |
266 | } | 247 | } |
267 | CLOCKSOURCE_OF_DECLARE(tegra20, "nvidia,tegra20-timer", tegra20_init_timer); | 248 | CLOCKSOURCE_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc); |
268 | 249 | ||
269 | #ifdef CONFIG_PM | 250 | #ifdef CONFIG_PM |
270 | static u32 usec_config; | 251 | static u32 usec_config; |
diff --git a/drivers/clocksource/vt8500_timer.c b/drivers/clocksource/vt8500_timer.c index 8efc86b5b5dd..64f553f04fa4 100644 --- a/drivers/clocksource/vt8500_timer.c +++ b/drivers/clocksource/vt8500_timer.c | |||
@@ -129,22 +129,10 @@ static struct irqaction irq = { | |||
129 | .dev_id = &clockevent, | 129 | .dev_id = &clockevent, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct of_device_id vt8500_timer_ids[] = { | 132 | static void __init vt8500_timer_init(struct device_node *np) |
133 | { .compatible = "via,vt8500-timer" }, | ||
134 | { } | ||
135 | }; | ||
136 | |||
137 | static void __init vt8500_timer_init(void) | ||
138 | { | 133 | { |
139 | struct device_node *np; | ||
140 | int timer_irq; | 134 | int timer_irq; |
141 | 135 | ||
142 | np = of_find_matching_node(NULL, vt8500_timer_ids); | ||
143 | if (!np) { | ||
144 | pr_err("%s: Timer description missing from Device Tree\n", | ||
145 | __func__); | ||
146 | return; | ||
147 | } | ||
148 | regbase = of_iomap(np, 0); | 136 | regbase = of_iomap(np, 0); |
149 | if (!regbase) { | 137 | if (!regbase) { |
150 | pr_err("%s: Missing iobase description in Device Tree\n", | 138 | pr_err("%s: Missing iobase description in Device Tree\n", |
@@ -177,4 +165,4 @@ static void __init vt8500_timer_init(void) | |||
177 | 4, 0xf0000000); | 165 | 4, 0xf0000000); |
178 | } | 166 | } |
179 | 167 | ||
180 | CLOCKSOURCE_OF_DECLARE(vt8500, "via,vt8500-timer", vt8500_timer_init) | 168 | CLOCKSOURCE_OF_DECLARE(vt8500, "via,vt8500-timer", vt8500_timer_init); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 93aaadf99f28..b166e30b3bc4 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -227,12 +227,6 @@ config GPIO_TS5500 | |||
227 | blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 | 227 | blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600 |
228 | LCD port. | 228 | LCD port. |
229 | 229 | ||
230 | config GPIO_VT8500 | ||
231 | bool "VIA/Wondermedia SoC GPIO Support" | ||
232 | depends on ARCH_VT8500 | ||
233 | help | ||
234 | Say yes here to support the VT8500/WM8505/WM8650 GPIO controller. | ||
235 | |||
236 | config GPIO_XILINX | 230 | config GPIO_XILINX |
237 | bool "Xilinx GPIO support" | 231 | bool "Xilinx GPIO support" |
238 | depends on PPC_OF || MICROBLAZE | 232 | depends on PPC_OF || MICROBLAZE |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 22e07bc9fcb5..a274d7df3c8c 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -80,7 +80,6 @@ obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o | |||
80 | obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o | 80 | obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o |
81 | obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o | 81 | obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o |
82 | obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o | 82 | obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o |
83 | obj-$(CONFIG_GPIO_VT8500) += gpio-vt8500.o | ||
84 | obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o | 83 | obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o |
85 | obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o | 84 | obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o |
86 | obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o | 85 | obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o |
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index b3643ff007e4..99e0fa49fcbd 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -1122,8 +1122,12 @@ int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset) | |||
1122 | #ifdef CONFIG_PLAT_S3C24XX | 1122 | #ifdef CONFIG_PLAT_S3C24XX |
1123 | static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset) | 1123 | static int s3c24xx_gpiolib_fbank_to_irq(struct gpio_chip *chip, unsigned offset) |
1124 | { | 1124 | { |
1125 | if (offset < 4) | 1125 | if (offset < 4) { |
1126 | return IRQ_EINT0 + offset; | 1126 | if (soc_is_s3c2412()) |
1127 | return IRQ_EINT0_2412 + offset; | ||
1128 | else | ||
1129 | return IRQ_EINT0 + offset; | ||
1130 | } | ||
1127 | 1131 | ||
1128 | if (offset < 8) | 1132 | if (offset < 8) |
1129 | return IRQ_EINT4 + offset - 4; | 1133 | return IRQ_EINT4 + offset - 4; |
@@ -3024,6 +3028,7 @@ static __init int samsung_gpiolib_init(void) | |||
3024 | static const struct of_device_id exynos_pinctrl_ids[] = { | 3028 | static const struct of_device_id exynos_pinctrl_ids[] = { |
3025 | { .compatible = "samsung,exynos4210-pinctrl", }, | 3029 | { .compatible = "samsung,exynos4210-pinctrl", }, |
3026 | { .compatible = "samsung,exynos4x12-pinctrl", }, | 3030 | { .compatible = "samsung,exynos4x12-pinctrl", }, |
3031 | { .compatible = "samsung,exynos5250-pinctrl", }, | ||
3027 | { .compatible = "samsung,exynos5440-pinctrl", }, | 3032 | { .compatible = "samsung,exynos5440-pinctrl", }, |
3028 | }; | 3033 | }; |
3029 | for_each_matching_node(pctrl_np, exynos_pinctrl_ids) | 3034 | for_each_matching_node(pctrl_np, exynos_pinctrl_ids) |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 414ad912232f..e3956359202c 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -72,6 +72,7 @@ struct tegra_gpio_bank { | |||
72 | u32 oe[4]; | 72 | u32 oe[4]; |
73 | u32 int_enb[4]; | 73 | u32 int_enb[4]; |
74 | u32 int_lvl[4]; | 74 | u32 int_lvl[4]; |
75 | u32 wake_enb[4]; | ||
75 | #endif | 76 | #endif |
76 | }; | 77 | }; |
77 | 78 | ||
@@ -333,15 +334,31 @@ static int tegra_gpio_suspend(struct device *dev) | |||
333 | bank->oe[p] = tegra_gpio_readl(GPIO_OE(gpio)); | 334 | bank->oe[p] = tegra_gpio_readl(GPIO_OE(gpio)); |
334 | bank->int_enb[p] = tegra_gpio_readl(GPIO_INT_ENB(gpio)); | 335 | bank->int_enb[p] = tegra_gpio_readl(GPIO_INT_ENB(gpio)); |
335 | bank->int_lvl[p] = tegra_gpio_readl(GPIO_INT_LVL(gpio)); | 336 | bank->int_lvl[p] = tegra_gpio_readl(GPIO_INT_LVL(gpio)); |
337 | |||
338 | /* Enable gpio irq for wake up source */ | ||
339 | tegra_gpio_writel(bank->wake_enb[p], | ||
340 | GPIO_INT_ENB(gpio)); | ||
336 | } | 341 | } |
337 | } | 342 | } |
338 | local_irq_restore(flags); | 343 | local_irq_restore(flags); |
339 | return 0; | 344 | return 0; |
340 | } | 345 | } |
341 | 346 | ||
342 | static int tegra_gpio_wake_enable(struct irq_data *d, unsigned int enable) | 347 | static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) |
343 | { | 348 | { |
344 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); | 349 | struct tegra_gpio_bank *bank = irq_data_get_irq_chip_data(d); |
350 | int gpio = d->hwirq; | ||
351 | u32 port, bit, mask; | ||
352 | |||
353 | port = GPIO_PORT(gpio); | ||
354 | bit = GPIO_BIT(gpio); | ||
355 | mask = BIT(bit); | ||
356 | |||
357 | if (enable) | ||
358 | bank->wake_enb[port] |= mask; | ||
359 | else | ||
360 | bank->wake_enb[port] &= ~mask; | ||
361 | |||
345 | return irq_set_irq_wake(bank->irq, enable); | 362 | return irq_set_irq_wake(bank->irq, enable); |
346 | } | 363 | } |
347 | #endif | 364 | #endif |
@@ -353,7 +370,7 @@ static struct irq_chip tegra_gpio_irq_chip = { | |||
353 | .irq_unmask = tegra_gpio_irq_unmask, | 370 | .irq_unmask = tegra_gpio_irq_unmask, |
354 | .irq_set_type = tegra_gpio_irq_set_type, | 371 | .irq_set_type = tegra_gpio_irq_set_type, |
355 | #ifdef CONFIG_PM_SLEEP | 372 | #ifdef CONFIG_PM_SLEEP |
356 | .irq_set_wake = tegra_gpio_wake_enable, | 373 | .irq_set_wake = tegra_gpio_irq_set_wake, |
357 | #endif | 374 | #endif |
358 | }; | 375 | }; |
359 | 376 | ||
diff --git a/drivers/gpio/gpio-vt8500.c b/drivers/gpio/gpio-vt8500.c deleted file mode 100644 index 81683ca35ac1..000000000000 --- a/drivers/gpio/gpio-vt8500.c +++ /dev/null | |||
@@ -1,355 +0,0 @@ | |||
1 | /* drivers/gpio/gpio-vt8500.c | ||
2 | * | ||
3 | * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz> | ||
4 | * Based on arch/arm/mach-vt8500/gpio.c: | ||
5 | * - Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/of.h> | ||
25 | #include <linux/of_address.h> | ||
26 | #include <linux/of_irq.h> | ||
27 | #include <linux/of_device.h> | ||
28 | |||
29 | /* | ||
30 | We handle GPIOs by bank, each bank containing up to 32 GPIOs covered | ||
31 | by one set of registers (although not all may be valid). | ||
32 | |||
33 | Because different SoC's have different register offsets, we pass the | ||
34 | register offsets as data in vt8500_gpio_dt_ids[]. | ||
35 | |||
36 | A value of NO_REG is used to indicate that this register is not | ||
37 | supported. Only used for ->en at the moment. | ||
38 | */ | ||
39 | |||
40 | #define NO_REG 0xFFFF | ||
41 | |||
42 | /* | ||
43 | * struct vt8500_gpio_bank_regoffsets | ||
44 | * @en: offset to enable register of the bank | ||
45 | * @dir: offset to direction register of the bank | ||
46 | * @data_out: offset to the data out register of the bank | ||
47 | * @data_in: offset to the data in register of the bank | ||
48 | * @ngpio: highest valid pin in this bank | ||
49 | */ | ||
50 | |||
51 | struct vt8500_gpio_bank_regoffsets { | ||
52 | unsigned int en; | ||
53 | unsigned int dir; | ||
54 | unsigned int data_out; | ||
55 | unsigned int data_in; | ||
56 | unsigned char ngpio; | ||
57 | }; | ||
58 | |||
59 | struct vt8500_gpio_data { | ||
60 | unsigned int num_banks; | ||
61 | struct vt8500_gpio_bank_regoffsets banks[]; | ||
62 | }; | ||
63 | |||
64 | #define VT8500_BANK(__en, __dir, __out, __in, __ngpio) \ | ||
65 | { \ | ||
66 | .en = __en, \ | ||
67 | .dir = __dir, \ | ||
68 | .data_out = __out, \ | ||
69 | .data_in = __in, \ | ||
70 | .ngpio = __ngpio, \ | ||
71 | } | ||
72 | |||
73 | static struct vt8500_gpio_data vt8500_data = { | ||
74 | .num_banks = 7, | ||
75 | .banks = { | ||
76 | VT8500_BANK(NO_REG, 0x3C, 0x5C, 0x7C, 9), | ||
77 | VT8500_BANK(0x00, 0x20, 0x40, 0x60, 26), | ||
78 | VT8500_BANK(0x04, 0x24, 0x44, 0x64, 28), | ||
79 | VT8500_BANK(0x08, 0x28, 0x48, 0x68, 31), | ||
80 | VT8500_BANK(0x0C, 0x2C, 0x4C, 0x6C, 19), | ||
81 | VT8500_BANK(0x10, 0x30, 0x50, 0x70, 19), | ||
82 | VT8500_BANK(0x14, 0x34, 0x54, 0x74, 23), | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct vt8500_gpio_data wm8505_data = { | ||
87 | .num_banks = 10, | ||
88 | .banks = { | ||
89 | VT8500_BANK(0x64, 0x8C, 0xB4, 0xDC, 22), | ||
90 | VT8500_BANK(0x40, 0x68, 0x90, 0xB8, 8), | ||
91 | VT8500_BANK(0x44, 0x6C, 0x94, 0xBC, 32), | ||
92 | VT8500_BANK(0x48, 0x70, 0x98, 0xC0, 6), | ||
93 | VT8500_BANK(0x4C, 0x74, 0x9C, 0xC4, 16), | ||
94 | VT8500_BANK(0x50, 0x78, 0xA0, 0xC8, 25), | ||
95 | VT8500_BANK(0x54, 0x7C, 0xA4, 0xCC, 5), | ||
96 | VT8500_BANK(0x58, 0x80, 0xA8, 0xD0, 5), | ||
97 | VT8500_BANK(0x5C, 0x84, 0xAC, 0xD4, 12), | ||
98 | VT8500_BANK(0x60, 0x88, 0xB0, 0xD8, 16), | ||
99 | VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), | ||
100 | }, | ||
101 | }; | ||
102 | |||
103 | /* | ||
104 | * No information about which bits are valid so we just make | ||
105 | * them all available until its figured out. | ||
106 | */ | ||
107 | static struct vt8500_gpio_data wm8650_data = { | ||
108 | .num_banks = 9, | ||
109 | .banks = { | ||
110 | VT8500_BANK(0x40, 0x80, 0xC0, 0x00, 32), | ||
111 | VT8500_BANK(0x44, 0x84, 0xC4, 0x04, 32), | ||
112 | VT8500_BANK(0x48, 0x88, 0xC8, 0x08, 32), | ||
113 | VT8500_BANK(0x4C, 0x8C, 0xCC, 0x0C, 32), | ||
114 | VT8500_BANK(0x50, 0x90, 0xD0, 0x10, 32), | ||
115 | VT8500_BANK(0x54, 0x94, 0xD4, 0x14, 32), | ||
116 | VT8500_BANK(0x58, 0x98, 0xD8, 0x18, 32), | ||
117 | VT8500_BANK(0x5C, 0x9C, 0xDC, 0x1C, 32), | ||
118 | VT8500_BANK(0x7C, 0xBC, 0xFC, 0x3C, 32), | ||
119 | VT8500_BANK(0x500, 0x504, 0x508, 0x50C, 6), | ||
120 | }, | ||
121 | }; | ||
122 | |||
123 | struct vt8500_gpio_chip { | ||
124 | struct gpio_chip chip; | ||
125 | |||
126 | const struct vt8500_gpio_bank_regoffsets *regs; | ||
127 | void __iomem *base; | ||
128 | }; | ||
129 | |||
130 | struct vt8500_data { | ||
131 | struct vt8500_gpio_chip *chip; | ||
132 | void __iomem *iobase; | ||
133 | int num_banks; | ||
134 | }; | ||
135 | |||
136 | |||
137 | #define to_vt8500(__chip) container_of(__chip, struct vt8500_gpio_chip, chip) | ||
138 | |||
139 | static int vt8500_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
140 | { | ||
141 | u32 val; | ||
142 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
143 | |||
144 | if (vt8500_chip->regs->en == NO_REG) | ||
145 | return 0; | ||
146 | |||
147 | val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); | ||
148 | val |= BIT(offset); | ||
149 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); | ||
150 | |||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static void vt8500_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
155 | { | ||
156 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
157 | u32 val; | ||
158 | |||
159 | if (vt8500_chip->regs->en == NO_REG) | ||
160 | return; | ||
161 | |||
162 | val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->en); | ||
163 | val &= ~BIT(offset); | ||
164 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->en); | ||
165 | } | ||
166 | |||
167 | static int vt8500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
168 | { | ||
169 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
170 | |||
171 | u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); | ||
172 | val &= ~BIT(offset); | ||
173 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static int vt8500_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | ||
179 | int value) | ||
180 | { | ||
181 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
182 | |||
183 | u32 val = readl_relaxed(vt8500_chip->base + vt8500_chip->regs->dir); | ||
184 | val |= BIT(offset); | ||
185 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->dir); | ||
186 | |||
187 | if (value) { | ||
188 | val = readl_relaxed(vt8500_chip->base + | ||
189 | vt8500_chip->regs->data_out); | ||
190 | val |= BIT(offset); | ||
191 | writel_relaxed(val, vt8500_chip->base + | ||
192 | vt8500_chip->regs->data_out); | ||
193 | } | ||
194 | return 0; | ||
195 | } | ||
196 | |||
197 | static int vt8500_gpio_get_value(struct gpio_chip *chip, unsigned offset) | ||
198 | { | ||
199 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
200 | |||
201 | return (readl_relaxed(vt8500_chip->base + vt8500_chip->regs->data_in) >> | ||
202 | offset) & 1; | ||
203 | } | ||
204 | |||
205 | static void vt8500_gpio_set_value(struct gpio_chip *chip, unsigned offset, | ||
206 | int value) | ||
207 | { | ||
208 | struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip); | ||
209 | |||
210 | u32 val = readl_relaxed(vt8500_chip->base + | ||
211 | vt8500_chip->regs->data_out); | ||
212 | if (value) | ||
213 | val |= BIT(offset); | ||
214 | else | ||
215 | val &= ~BIT(offset); | ||
216 | |||
217 | writel_relaxed(val, vt8500_chip->base + vt8500_chip->regs->data_out); | ||
218 | } | ||
219 | |||
220 | static int vt8500_of_xlate(struct gpio_chip *gc, | ||
221 | const struct of_phandle_args *gpiospec, u32 *flags) | ||
222 | { | ||
223 | /* bank if specificed in gpiospec->args[0] */ | ||
224 | if (flags) | ||
225 | *flags = gpiospec->args[2]; | ||
226 | |||
227 | return gpiospec->args[1]; | ||
228 | } | ||
229 | |||
230 | static int vt8500_add_chips(struct platform_device *pdev, void __iomem *base, | ||
231 | const struct vt8500_gpio_data *data) | ||
232 | { | ||
233 | struct vt8500_data *priv; | ||
234 | struct vt8500_gpio_chip *vtchip; | ||
235 | struct gpio_chip *chip; | ||
236 | int i; | ||
237 | int pin_cnt = 0; | ||
238 | |||
239 | priv = devm_kzalloc(&pdev->dev, sizeof(struct vt8500_data), GFP_KERNEL); | ||
240 | if (!priv) { | ||
241 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
242 | return -ENOMEM; | ||
243 | } | ||
244 | |||
245 | priv->chip = devm_kzalloc(&pdev->dev, | ||
246 | sizeof(struct vt8500_gpio_chip) * data->num_banks, | ||
247 | GFP_KERNEL); | ||
248 | if (!priv->chip) { | ||
249 | dev_err(&pdev->dev, "failed to allocate chip memory\n"); | ||
250 | return -ENOMEM; | ||
251 | } | ||
252 | |||
253 | priv->iobase = base; | ||
254 | priv->num_banks = data->num_banks; | ||
255 | platform_set_drvdata(pdev, priv); | ||
256 | |||
257 | vtchip = priv->chip; | ||
258 | |||
259 | for (i = 0; i < data->num_banks; i++) { | ||
260 | vtchip[i].base = base; | ||
261 | vtchip[i].regs = &data->banks[i]; | ||
262 | |||
263 | chip = &vtchip[i].chip; | ||
264 | |||
265 | chip->of_xlate = vt8500_of_xlate; | ||
266 | chip->of_gpio_n_cells = 3; | ||
267 | chip->of_node = pdev->dev.of_node; | ||
268 | |||
269 | chip->request = vt8500_gpio_request; | ||
270 | chip->free = vt8500_gpio_free; | ||
271 | chip->direction_input = vt8500_gpio_direction_input; | ||
272 | chip->direction_output = vt8500_gpio_direction_output; | ||
273 | chip->get = vt8500_gpio_get_value; | ||
274 | chip->set = vt8500_gpio_set_value; | ||
275 | chip->can_sleep = 0; | ||
276 | chip->base = pin_cnt; | ||
277 | chip->ngpio = data->banks[i].ngpio; | ||
278 | |||
279 | pin_cnt += data->banks[i].ngpio; | ||
280 | |||
281 | gpiochip_add(chip); | ||
282 | } | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static struct of_device_id vt8500_gpio_dt_ids[] = { | ||
287 | { .compatible = "via,vt8500-gpio", .data = &vt8500_data, }, | ||
288 | { .compatible = "wm,wm8505-gpio", .data = &wm8505_data, }, | ||
289 | { .compatible = "wm,wm8650-gpio", .data = &wm8650_data, }, | ||
290 | { /* Sentinel */ }, | ||
291 | }; | ||
292 | |||
293 | static int vt8500_gpio_probe(struct platform_device *pdev) | ||
294 | { | ||
295 | int ret; | ||
296 | void __iomem *gpio_base; | ||
297 | struct resource *res; | ||
298 | const struct of_device_id *of_id = | ||
299 | of_match_device(vt8500_gpio_dt_ids, &pdev->dev); | ||
300 | |||
301 | if (!of_id) { | ||
302 | dev_err(&pdev->dev, "No matching driver data\n"); | ||
303 | return -ENODEV; | ||
304 | } | ||
305 | |||
306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
307 | if (!res) { | ||
308 | dev_err(&pdev->dev, "Unable to get IO resource\n"); | ||
309 | return -ENODEV; | ||
310 | } | ||
311 | |||
312 | gpio_base = devm_request_and_ioremap(&pdev->dev, res); | ||
313 | if (!gpio_base) { | ||
314 | dev_err(&pdev->dev, "Unable to map GPIO registers\n"); | ||
315 | return -ENOMEM; | ||
316 | } | ||
317 | |||
318 | ret = vt8500_add_chips(pdev, gpio_base, of_id->data); | ||
319 | |||
320 | return ret; | ||
321 | } | ||
322 | |||
323 | static int vt8500_gpio_remove(struct platform_device *pdev) | ||
324 | { | ||
325 | int i; | ||
326 | int ret; | ||
327 | struct vt8500_data *priv = platform_get_drvdata(pdev); | ||
328 | struct vt8500_gpio_chip *vtchip = priv->chip; | ||
329 | |||
330 | for (i = 0; i < priv->num_banks; i++) { | ||
331 | ret = gpiochip_remove(&vtchip[i].chip); | ||
332 | if (ret) | ||
333 | dev_warn(&pdev->dev, "gpiochip_remove returned %d\n", | ||
334 | ret); | ||
335 | } | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static struct platform_driver vt8500_gpio_driver = { | ||
341 | .probe = vt8500_gpio_probe, | ||
342 | .remove = vt8500_gpio_remove, | ||
343 | .driver = { | ||
344 | .name = "vt8500-gpio", | ||
345 | .owner = THIS_MODULE, | ||
346 | .of_match_table = vt8500_gpio_dt_ids, | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | module_platform_driver(vt8500_gpio_driver); | ||
351 | |||
352 | MODULE_DESCRIPTION("VT8500 GPIO Driver"); | ||
353 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
354 | MODULE_LICENSE("GPL v2"); | ||
355 | MODULE_DEVICE_TABLE(of, vt8500_gpio_dt_ids); | ||
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index a350969e5efe..4a33351c25dc 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig | |||
@@ -25,6 +25,14 @@ config ARM_VIC_NR | |||
25 | The maximum number of VICs available in the system, for | 25 | The maximum number of VICs available in the system, for |
26 | power management. | 26 | power management. |
27 | 27 | ||
28 | config RENESAS_INTC_IRQPIN | ||
29 | bool | ||
30 | select IRQ_DOMAIN | ||
31 | |||
32 | config RENESAS_IRQC | ||
33 | bool | ||
34 | select IRQ_DOMAIN | ||
35 | |||
28 | config VERSATILE_FPGA_IRQ | 36 | config VERSATILE_FPGA_IRQ |
29 | bool | 37 | bool |
30 | select IRQ_DOMAIN | 38 | select IRQ_DOMAIN |
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index dae27a77c1e1..154722aa26cb 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -3,10 +3,13 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o | |||
3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o | 3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o |
4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o | 4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o |
5 | obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o | 5 | obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o |
6 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o | ||
6 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 7 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
7 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o | 8 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o |
8 | obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi.o | 9 | obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi.o |
9 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o | 10 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o |
10 | obj-$(CONFIG_ARM_GIC) += irq-gic.o | 11 | obj-$(CONFIG_ARM_GIC) += irq-gic.o |
11 | obj-$(CONFIG_ARM_VIC) += irq-vic.o | 12 | obj-$(CONFIG_ARM_VIC) += irq-vic.o |
13 | obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o | ||
14 | obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o | ||
12 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o | 15 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o |
diff --git a/drivers/irqchip/irq-renesas-intc-irqpin.c b/drivers/irqchip/irq-renesas-intc-irqpin.c new file mode 100644 index 000000000000..5a68e5accec1 --- /dev/null +++ b/drivers/irqchip/irq-renesas-intc-irqpin.c | |||
@@ -0,0 +1,547 @@ | |||
1 | /* | ||
2 | * Renesas INTC External IRQ Pin Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/irqdomain.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | ||
32 | |||
33 | #define INTC_IRQPIN_MAX 8 /* maximum 8 interrupts per driver instance */ | ||
34 | |||
35 | #define INTC_IRQPIN_REG_SENSE 0 /* ICRn */ | ||
36 | #define INTC_IRQPIN_REG_PRIO 1 /* INTPRInn */ | ||
37 | #define INTC_IRQPIN_REG_SOURCE 2 /* INTREQnn */ | ||
38 | #define INTC_IRQPIN_REG_MASK 3 /* INTMSKnn */ | ||
39 | #define INTC_IRQPIN_REG_CLEAR 4 /* INTMSKCLRnn */ | ||
40 | #define INTC_IRQPIN_REG_NR 5 | ||
41 | |||
42 | /* INTC external IRQ PIN hardware register access: | ||
43 | * | ||
44 | * SENSE is read-write 32-bit with 2-bits or 4-bits per IRQ (*) | ||
45 | * PRIO is read-write 32-bit with 4-bits per IRQ (**) | ||
46 | * SOURCE is read-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
47 | * MASK is write-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
48 | * CLEAR is write-only 32-bit or 8-bit with 1-bit per IRQ (***) | ||
49 | * | ||
50 | * (*) May be accessed by more than one driver instance - lock needed | ||
51 | * (**) Read-modify-write access by one driver instance - lock needed | ||
52 | * (***) Accessed by one driver instance only - no locking needed | ||
53 | */ | ||
54 | |||
55 | struct intc_irqpin_iomem { | ||
56 | void __iomem *iomem; | ||
57 | unsigned long (*read)(void __iomem *iomem); | ||
58 | void (*write)(void __iomem *iomem, unsigned long data); | ||
59 | int width; | ||
60 | }; | ||
61 | |||
62 | struct intc_irqpin_irq { | ||
63 | int hw_irq; | ||
64 | int requested_irq; | ||
65 | int domain_irq; | ||
66 | struct intc_irqpin_priv *p; | ||
67 | }; | ||
68 | |||
69 | struct intc_irqpin_priv { | ||
70 | struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR]; | ||
71 | struct intc_irqpin_irq irq[INTC_IRQPIN_MAX]; | ||
72 | struct renesas_intc_irqpin_config config; | ||
73 | unsigned int number_of_irqs; | ||
74 | struct platform_device *pdev; | ||
75 | struct irq_chip irq_chip; | ||
76 | struct irq_domain *irq_domain; | ||
77 | bool shared_irqs; | ||
78 | u8 shared_irq_mask; | ||
79 | }; | ||
80 | |||
81 | static unsigned long intc_irqpin_read32(void __iomem *iomem) | ||
82 | { | ||
83 | return ioread32(iomem); | ||
84 | } | ||
85 | |||
86 | static unsigned long intc_irqpin_read8(void __iomem *iomem) | ||
87 | { | ||
88 | return ioread8(iomem); | ||
89 | } | ||
90 | |||
91 | static void intc_irqpin_write32(void __iomem *iomem, unsigned long data) | ||
92 | { | ||
93 | iowrite32(data, iomem); | ||
94 | } | ||
95 | |||
96 | static void intc_irqpin_write8(void __iomem *iomem, unsigned long data) | ||
97 | { | ||
98 | iowrite8(data, iomem); | ||
99 | } | ||
100 | |||
101 | static inline unsigned long intc_irqpin_read(struct intc_irqpin_priv *p, | ||
102 | int reg) | ||
103 | { | ||
104 | struct intc_irqpin_iomem *i = &p->iomem[reg]; | ||
105 | |||
106 | return i->read(i->iomem); | ||
107 | } | ||
108 | |||
109 | static inline void intc_irqpin_write(struct intc_irqpin_priv *p, | ||
110 | int reg, unsigned long data) | ||
111 | { | ||
112 | struct intc_irqpin_iomem *i = &p->iomem[reg]; | ||
113 | |||
114 | i->write(i->iomem, data); | ||
115 | } | ||
116 | |||
117 | static inline unsigned long intc_irqpin_hwirq_mask(struct intc_irqpin_priv *p, | ||
118 | int reg, int hw_irq) | ||
119 | { | ||
120 | return BIT((p->iomem[reg].width - 1) - hw_irq); | ||
121 | } | ||
122 | |||
123 | static inline void intc_irqpin_irq_write_hwirq(struct intc_irqpin_priv *p, | ||
124 | int reg, int hw_irq) | ||
125 | { | ||
126 | intc_irqpin_write(p, reg, intc_irqpin_hwirq_mask(p, reg, hw_irq)); | ||
127 | } | ||
128 | |||
129 | static DEFINE_RAW_SPINLOCK(intc_irqpin_lock); /* only used by slow path */ | ||
130 | |||
131 | static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, | ||
132 | int reg, int shift, | ||
133 | int width, int value) | ||
134 | { | ||
135 | unsigned long flags; | ||
136 | unsigned long tmp; | ||
137 | |||
138 | raw_spin_lock_irqsave(&intc_irqpin_lock, flags); | ||
139 | |||
140 | tmp = intc_irqpin_read(p, reg); | ||
141 | tmp &= ~(((1 << width) - 1) << shift); | ||
142 | tmp |= value << shift; | ||
143 | intc_irqpin_write(p, reg, tmp); | ||
144 | |||
145 | raw_spin_unlock_irqrestore(&intc_irqpin_lock, flags); | ||
146 | } | ||
147 | |||
148 | static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, | ||
149 | int irq, int do_mask) | ||
150 | { | ||
151 | int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */ | ||
152 | int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */ | ||
153 | |||
154 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO, | ||
155 | shift, bitfield_width, | ||
156 | do_mask ? 0 : (1 << bitfield_width) - 1); | ||
157 | } | ||
158 | |||
159 | static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value) | ||
160 | { | ||
161 | int bitfield_width = p->config.sense_bitfield_width; | ||
162 | int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */ | ||
163 | |||
164 | dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value); | ||
165 | |||
166 | if (value >= (1 << bitfield_width)) | ||
167 | return -EINVAL; | ||
168 | |||
169 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_SENSE, shift, | ||
170 | bitfield_width, value); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static void intc_irqpin_dbg(struct intc_irqpin_irq *i, char *str) | ||
175 | { | ||
176 | dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", | ||
177 | str, i->requested_irq, i->hw_irq, i->domain_irq); | ||
178 | } | ||
179 | |||
180 | static void intc_irqpin_irq_enable(struct irq_data *d) | ||
181 | { | ||
182 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
183 | int hw_irq = irqd_to_hwirq(d); | ||
184 | |||
185 | intc_irqpin_dbg(&p->irq[hw_irq], "enable"); | ||
186 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); | ||
187 | } | ||
188 | |||
189 | static void intc_irqpin_irq_disable(struct irq_data *d) | ||
190 | { | ||
191 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
192 | int hw_irq = irqd_to_hwirq(d); | ||
193 | |||
194 | intc_irqpin_dbg(&p->irq[hw_irq], "disable"); | ||
195 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); | ||
196 | } | ||
197 | |||
198 | static void intc_irqpin_shared_irq_enable(struct irq_data *d) | ||
199 | { | ||
200 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
201 | int hw_irq = irqd_to_hwirq(d); | ||
202 | |||
203 | intc_irqpin_dbg(&p->irq[hw_irq], "shared enable"); | ||
204 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_CLEAR, hw_irq); | ||
205 | |||
206 | p->shared_irq_mask &= ~BIT(hw_irq); | ||
207 | } | ||
208 | |||
209 | static void intc_irqpin_shared_irq_disable(struct irq_data *d) | ||
210 | { | ||
211 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
212 | int hw_irq = irqd_to_hwirq(d); | ||
213 | |||
214 | intc_irqpin_dbg(&p->irq[hw_irq], "shared disable"); | ||
215 | intc_irqpin_irq_write_hwirq(p, INTC_IRQPIN_REG_MASK, hw_irq); | ||
216 | |||
217 | p->shared_irq_mask |= BIT(hw_irq); | ||
218 | } | ||
219 | |||
220 | static void intc_irqpin_irq_enable_force(struct irq_data *d) | ||
221 | { | ||
222 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
223 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; | ||
224 | |||
225 | intc_irqpin_irq_enable(d); | ||
226 | |||
227 | /* enable interrupt through parent interrupt controller, | ||
228 | * assumes non-shared interrupt with 1:1 mapping | ||
229 | * needed for busted IRQs on some SoCs like sh73a0 | ||
230 | */ | ||
231 | irq_get_chip(irq)->irq_unmask(irq_get_irq_data(irq)); | ||
232 | } | ||
233 | |||
234 | static void intc_irqpin_irq_disable_force(struct irq_data *d) | ||
235 | { | ||
236 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
237 | int irq = p->irq[irqd_to_hwirq(d)].requested_irq; | ||
238 | |||
239 | /* disable interrupt through parent interrupt controller, | ||
240 | * assumes non-shared interrupt with 1:1 mapping | ||
241 | * needed for busted IRQs on some SoCs like sh73a0 | ||
242 | */ | ||
243 | irq_get_chip(irq)->irq_mask(irq_get_irq_data(irq)); | ||
244 | intc_irqpin_irq_disable(d); | ||
245 | } | ||
246 | |||
247 | #define INTC_IRQ_SENSE_VALID 0x10 | ||
248 | #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) | ||
249 | |||
250 | static unsigned char intc_irqpin_sense[IRQ_TYPE_SENSE_MASK + 1] = { | ||
251 | [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x00), | ||
252 | [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x01), | ||
253 | [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x02), | ||
254 | [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x03), | ||
255 | [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x04), | ||
256 | }; | ||
257 | |||
258 | static int intc_irqpin_irq_set_type(struct irq_data *d, unsigned int type) | ||
259 | { | ||
260 | unsigned char value = intc_irqpin_sense[type & IRQ_TYPE_SENSE_MASK]; | ||
261 | struct intc_irqpin_priv *p = irq_data_get_irq_chip_data(d); | ||
262 | |||
263 | if (!(value & INTC_IRQ_SENSE_VALID)) | ||
264 | return -EINVAL; | ||
265 | |||
266 | return intc_irqpin_set_sense(p, irqd_to_hwirq(d), | ||
267 | value ^ INTC_IRQ_SENSE_VALID); | ||
268 | } | ||
269 | |||
270 | static irqreturn_t intc_irqpin_irq_handler(int irq, void *dev_id) | ||
271 | { | ||
272 | struct intc_irqpin_irq *i = dev_id; | ||
273 | struct intc_irqpin_priv *p = i->p; | ||
274 | unsigned long bit; | ||
275 | |||
276 | intc_irqpin_dbg(i, "demux1"); | ||
277 | bit = intc_irqpin_hwirq_mask(p, INTC_IRQPIN_REG_SOURCE, i->hw_irq); | ||
278 | |||
279 | if (intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE) & bit) { | ||
280 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, ~bit); | ||
281 | intc_irqpin_dbg(i, "demux2"); | ||
282 | generic_handle_irq(i->domain_irq); | ||
283 | return IRQ_HANDLED; | ||
284 | } | ||
285 | return IRQ_NONE; | ||
286 | } | ||
287 | |||
288 | static irqreturn_t intc_irqpin_shared_irq_handler(int irq, void *dev_id) | ||
289 | { | ||
290 | struct intc_irqpin_priv *p = dev_id; | ||
291 | unsigned int reg_source = intc_irqpin_read(p, INTC_IRQPIN_REG_SOURCE); | ||
292 | irqreturn_t status = IRQ_NONE; | ||
293 | int k; | ||
294 | |||
295 | for (k = 0; k < 8; k++) { | ||
296 | if (reg_source & BIT(7 - k)) { | ||
297 | if (BIT(k) & p->shared_irq_mask) | ||
298 | continue; | ||
299 | |||
300 | status |= intc_irqpin_irq_handler(irq, &p->irq[k]); | ||
301 | } | ||
302 | } | ||
303 | |||
304 | return status; | ||
305 | } | ||
306 | |||
307 | static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq, | ||
308 | irq_hw_number_t hw) | ||
309 | { | ||
310 | struct intc_irqpin_priv *p = h->host_data; | ||
311 | |||
312 | p->irq[hw].domain_irq = virq; | ||
313 | p->irq[hw].hw_irq = hw; | ||
314 | |||
315 | intc_irqpin_dbg(&p->irq[hw], "map"); | ||
316 | irq_set_chip_data(virq, h->host_data); | ||
317 | irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); | ||
318 | set_irq_flags(virq, IRQF_VALID); /* kill me now */ | ||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | static struct irq_domain_ops intc_irqpin_irq_domain_ops = { | ||
323 | .map = intc_irqpin_irq_domain_map, | ||
324 | .xlate = irq_domain_xlate_twocell, | ||
325 | }; | ||
326 | |||
327 | static int intc_irqpin_probe(struct platform_device *pdev) | ||
328 | { | ||
329 | struct renesas_intc_irqpin_config *pdata = pdev->dev.platform_data; | ||
330 | struct intc_irqpin_priv *p; | ||
331 | struct intc_irqpin_iomem *i; | ||
332 | struct resource *io[INTC_IRQPIN_REG_NR]; | ||
333 | struct resource *irq; | ||
334 | struct irq_chip *irq_chip; | ||
335 | void (*enable_fn)(struct irq_data *d); | ||
336 | void (*disable_fn)(struct irq_data *d); | ||
337 | const char *name = dev_name(&pdev->dev); | ||
338 | int ref_irq; | ||
339 | int ret; | ||
340 | int k; | ||
341 | |||
342 | p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL); | ||
343 | if (!p) { | ||
344 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
345 | ret = -ENOMEM; | ||
346 | goto err0; | ||
347 | } | ||
348 | |||
349 | /* deal with driver instance configuration */ | ||
350 | if (pdata) | ||
351 | memcpy(&p->config, pdata, sizeof(*pdata)); | ||
352 | if (!p->config.sense_bitfield_width) | ||
353 | p->config.sense_bitfield_width = 4; /* default to 4 bits */ | ||
354 | |||
355 | p->pdev = pdev; | ||
356 | platform_set_drvdata(pdev, p); | ||
357 | |||
358 | /* get hold of manadatory IOMEM */ | ||
359 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { | ||
360 | io[k] = platform_get_resource(pdev, IORESOURCE_MEM, k); | ||
361 | if (!io[k]) { | ||
362 | dev_err(&pdev->dev, "not enough IOMEM resources\n"); | ||
363 | ret = -EINVAL; | ||
364 | goto err0; | ||
365 | } | ||
366 | } | ||
367 | |||
368 | /* allow any number of IRQs between 1 and INTC_IRQPIN_MAX */ | ||
369 | for (k = 0; k < INTC_IRQPIN_MAX; k++) { | ||
370 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); | ||
371 | if (!irq) | ||
372 | break; | ||
373 | |||
374 | p->irq[k].p = p; | ||
375 | p->irq[k].requested_irq = irq->start; | ||
376 | } | ||
377 | |||
378 | p->number_of_irqs = k; | ||
379 | if (p->number_of_irqs < 1) { | ||
380 | dev_err(&pdev->dev, "not enough IRQ resources\n"); | ||
381 | ret = -EINVAL; | ||
382 | goto err0; | ||
383 | } | ||
384 | |||
385 | /* ioremap IOMEM and setup read/write callbacks */ | ||
386 | for (k = 0; k < INTC_IRQPIN_REG_NR; k++) { | ||
387 | i = &p->iomem[k]; | ||
388 | |||
389 | switch (resource_size(io[k])) { | ||
390 | case 1: | ||
391 | i->width = 8; | ||
392 | i->read = intc_irqpin_read8; | ||
393 | i->write = intc_irqpin_write8; | ||
394 | break; | ||
395 | case 4: | ||
396 | i->width = 32; | ||
397 | i->read = intc_irqpin_read32; | ||
398 | i->write = intc_irqpin_write32; | ||
399 | break; | ||
400 | default: | ||
401 | dev_err(&pdev->dev, "IOMEM size mismatch\n"); | ||
402 | ret = -EINVAL; | ||
403 | goto err0; | ||
404 | } | ||
405 | |||
406 | i->iomem = devm_ioremap_nocache(&pdev->dev, io[k]->start, | ||
407 | resource_size(io[k])); | ||
408 | if (!i->iomem) { | ||
409 | dev_err(&pdev->dev, "failed to remap IOMEM\n"); | ||
410 | ret = -ENXIO; | ||
411 | goto err0; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | /* mask all interrupts using priority */ | ||
416 | for (k = 0; k < p->number_of_irqs; k++) | ||
417 | intc_irqpin_mask_unmask_prio(p, k, 1); | ||
418 | |||
419 | /* clear all pending interrupts */ | ||
420 | intc_irqpin_write(p, INTC_IRQPIN_REG_SOURCE, 0x0); | ||
421 | |||
422 | /* scan for shared interrupt lines */ | ||
423 | ref_irq = p->irq[0].requested_irq; | ||
424 | p->shared_irqs = true; | ||
425 | for (k = 1; k < p->number_of_irqs; k++) { | ||
426 | if (ref_irq != p->irq[k].requested_irq) { | ||
427 | p->shared_irqs = false; | ||
428 | break; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | /* use more severe masking method if requested */ | ||
433 | if (p->config.control_parent) { | ||
434 | enable_fn = intc_irqpin_irq_enable_force; | ||
435 | disable_fn = intc_irqpin_irq_disable_force; | ||
436 | } else if (!p->shared_irqs) { | ||
437 | enable_fn = intc_irqpin_irq_enable; | ||
438 | disable_fn = intc_irqpin_irq_disable; | ||
439 | } else { | ||
440 | enable_fn = intc_irqpin_shared_irq_enable; | ||
441 | disable_fn = intc_irqpin_shared_irq_disable; | ||
442 | } | ||
443 | |||
444 | irq_chip = &p->irq_chip; | ||
445 | irq_chip->name = name; | ||
446 | irq_chip->irq_mask = disable_fn; | ||
447 | irq_chip->irq_unmask = enable_fn; | ||
448 | irq_chip->irq_enable = enable_fn; | ||
449 | irq_chip->irq_disable = disable_fn; | ||
450 | irq_chip->irq_set_type = intc_irqpin_irq_set_type; | ||
451 | irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; | ||
452 | |||
453 | p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, | ||
454 | p->number_of_irqs, | ||
455 | p->config.irq_base, | ||
456 | &intc_irqpin_irq_domain_ops, p); | ||
457 | if (!p->irq_domain) { | ||
458 | ret = -ENXIO; | ||
459 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | ||
460 | goto err0; | ||
461 | } | ||
462 | |||
463 | if (p->shared_irqs) { | ||
464 | /* request one shared interrupt */ | ||
465 | if (devm_request_irq(&pdev->dev, p->irq[0].requested_irq, | ||
466 | intc_irqpin_shared_irq_handler, | ||
467 | IRQF_SHARED, name, p)) { | ||
468 | dev_err(&pdev->dev, "failed to request low IRQ\n"); | ||
469 | ret = -ENOENT; | ||
470 | goto err1; | ||
471 | } | ||
472 | } else { | ||
473 | /* request interrupts one by one */ | ||
474 | for (k = 0; k < p->number_of_irqs; k++) { | ||
475 | if (devm_request_irq(&pdev->dev, | ||
476 | p->irq[k].requested_irq, | ||
477 | intc_irqpin_irq_handler, | ||
478 | 0, name, &p->irq[k])) { | ||
479 | dev_err(&pdev->dev, | ||
480 | "failed to request low IRQ\n"); | ||
481 | ret = -ENOENT; | ||
482 | goto err1; | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | |||
487 | /* unmask all interrupts on prio level */ | ||
488 | for (k = 0; k < p->number_of_irqs; k++) | ||
489 | intc_irqpin_mask_unmask_prio(p, k, 0); | ||
490 | |||
491 | dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); | ||
492 | |||
493 | /* warn in case of mismatch if irq base is specified */ | ||
494 | if (p->config.irq_base) { | ||
495 | if (p->config.irq_base != p->irq[0].domain_irq) | ||
496 | dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", | ||
497 | p->config.irq_base, p->irq[0].domain_irq); | ||
498 | } | ||
499 | |||
500 | return 0; | ||
501 | |||
502 | err1: | ||
503 | irq_domain_remove(p->irq_domain); | ||
504 | err0: | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | static int intc_irqpin_remove(struct platform_device *pdev) | ||
509 | { | ||
510 | struct intc_irqpin_priv *p = platform_get_drvdata(pdev); | ||
511 | |||
512 | irq_domain_remove(p->irq_domain); | ||
513 | |||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | static const struct of_device_id intc_irqpin_dt_ids[] = { | ||
518 | { .compatible = "renesas,intc-irqpin", }, | ||
519 | {}, | ||
520 | }; | ||
521 | MODULE_DEVICE_TABLE(of, intc_irqpin_dt_ids); | ||
522 | |||
523 | static struct platform_driver intc_irqpin_device_driver = { | ||
524 | .probe = intc_irqpin_probe, | ||
525 | .remove = intc_irqpin_remove, | ||
526 | .driver = { | ||
527 | .name = "renesas_intc_irqpin", | ||
528 | .of_match_table = intc_irqpin_dt_ids, | ||
529 | .owner = THIS_MODULE, | ||
530 | } | ||
531 | }; | ||
532 | |||
533 | static int __init intc_irqpin_init(void) | ||
534 | { | ||
535 | return platform_driver_register(&intc_irqpin_device_driver); | ||
536 | } | ||
537 | postcore_initcall(intc_irqpin_init); | ||
538 | |||
539 | static void __exit intc_irqpin_exit(void) | ||
540 | { | ||
541 | platform_driver_unregister(&intc_irqpin_device_driver); | ||
542 | } | ||
543 | module_exit(intc_irqpin_exit); | ||
544 | |||
545 | MODULE_AUTHOR("Magnus Damm"); | ||
546 | MODULE_DESCRIPTION("Renesas INTC External IRQ Pin Driver"); | ||
547 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c new file mode 100644 index 000000000000..927bff373aac --- /dev/null +++ b/drivers/irqchip/irq-renesas-irqc.c | |||
@@ -0,0 +1,307 @@ | |||
1 | /* | ||
2 | * Renesas IRQC Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/irqdomain.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/slab.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/platform_data/irq-renesas-irqc.h> | ||
32 | |||
33 | #define IRQC_IRQ_MAX 32 /* maximum 32 interrupts per driver instance */ | ||
34 | |||
35 | #define IRQC_REQ_STS 0x00 | ||
36 | #define IRQC_EN_STS 0x04 | ||
37 | #define IRQC_EN_SET 0x08 | ||
38 | #define IRQC_INT_CPU_BASE(n) (0x000 + ((n) * 0x10)) | ||
39 | #define DETECT_STATUS 0x100 | ||
40 | #define IRQC_CONFIG(n) (0x180 + ((n) * 0x04)) | ||
41 | |||
42 | struct irqc_irq { | ||
43 | int hw_irq; | ||
44 | int requested_irq; | ||
45 | int domain_irq; | ||
46 | struct irqc_priv *p; | ||
47 | }; | ||
48 | |||
49 | struct irqc_priv { | ||
50 | void __iomem *iomem; | ||
51 | void __iomem *cpu_int_base; | ||
52 | struct irqc_irq irq[IRQC_IRQ_MAX]; | ||
53 | struct renesas_irqc_config config; | ||
54 | unsigned int number_of_irqs; | ||
55 | struct platform_device *pdev; | ||
56 | struct irq_chip irq_chip; | ||
57 | struct irq_domain *irq_domain; | ||
58 | }; | ||
59 | |||
60 | static void irqc_dbg(struct irqc_irq *i, char *str) | ||
61 | { | ||
62 | dev_dbg(&i->p->pdev->dev, "%s (%d:%d:%d)\n", | ||
63 | str, i->requested_irq, i->hw_irq, i->domain_irq); | ||
64 | } | ||
65 | |||
66 | static void irqc_irq_enable(struct irq_data *d) | ||
67 | { | ||
68 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
69 | int hw_irq = irqd_to_hwirq(d); | ||
70 | |||
71 | irqc_dbg(&p->irq[hw_irq], "enable"); | ||
72 | iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_SET); | ||
73 | } | ||
74 | |||
75 | static void irqc_irq_disable(struct irq_data *d) | ||
76 | { | ||
77 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
78 | int hw_irq = irqd_to_hwirq(d); | ||
79 | |||
80 | irqc_dbg(&p->irq[hw_irq], "disable"); | ||
81 | iowrite32(BIT(hw_irq), p->cpu_int_base + IRQC_EN_STS); | ||
82 | } | ||
83 | |||
84 | #define INTC_IRQ_SENSE_VALID 0x10 | ||
85 | #define INTC_IRQ_SENSE(x) (x + INTC_IRQ_SENSE_VALID) | ||
86 | |||
87 | static unsigned char irqc_sense[IRQ_TYPE_SENSE_MASK + 1] = { | ||
88 | [IRQ_TYPE_LEVEL_LOW] = INTC_IRQ_SENSE(0x01), | ||
89 | [IRQ_TYPE_LEVEL_HIGH] = INTC_IRQ_SENSE(0x02), | ||
90 | [IRQ_TYPE_EDGE_FALLING] = INTC_IRQ_SENSE(0x04), /* Synchronous */ | ||
91 | [IRQ_TYPE_EDGE_RISING] = INTC_IRQ_SENSE(0x08), /* Synchronous */ | ||
92 | [IRQ_TYPE_EDGE_BOTH] = INTC_IRQ_SENSE(0x0c), /* Synchronous */ | ||
93 | }; | ||
94 | |||
95 | static int irqc_irq_set_type(struct irq_data *d, unsigned int type) | ||
96 | { | ||
97 | struct irqc_priv *p = irq_data_get_irq_chip_data(d); | ||
98 | int hw_irq = irqd_to_hwirq(d); | ||
99 | unsigned char value = irqc_sense[type & IRQ_TYPE_SENSE_MASK]; | ||
100 | unsigned long tmp; | ||
101 | |||
102 | irqc_dbg(&p->irq[hw_irq], "sense"); | ||
103 | |||
104 | if (!(value & INTC_IRQ_SENSE_VALID)) | ||
105 | return -EINVAL; | ||
106 | |||
107 | tmp = ioread32(p->iomem + IRQC_CONFIG(hw_irq)); | ||
108 | tmp &= ~0x3f; | ||
109 | tmp |= value ^ INTC_IRQ_SENSE_VALID; | ||
110 | iowrite32(tmp, p->iomem + IRQC_CONFIG(hw_irq)); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static irqreturn_t irqc_irq_handler(int irq, void *dev_id) | ||
115 | { | ||
116 | struct irqc_irq *i = dev_id; | ||
117 | struct irqc_priv *p = i->p; | ||
118 | unsigned long bit = BIT(i->hw_irq); | ||
119 | |||
120 | irqc_dbg(i, "demux1"); | ||
121 | |||
122 | if (ioread32(p->iomem + DETECT_STATUS) & bit) { | ||
123 | iowrite32(bit, p->iomem + DETECT_STATUS); | ||
124 | irqc_dbg(i, "demux2"); | ||
125 | generic_handle_irq(i->domain_irq); | ||
126 | return IRQ_HANDLED; | ||
127 | } | ||
128 | return IRQ_NONE; | ||
129 | } | ||
130 | |||
131 | static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq, | ||
132 | irq_hw_number_t hw) | ||
133 | { | ||
134 | struct irqc_priv *p = h->host_data; | ||
135 | |||
136 | p->irq[hw].domain_irq = virq; | ||
137 | p->irq[hw].hw_irq = hw; | ||
138 | |||
139 | irqc_dbg(&p->irq[hw], "map"); | ||
140 | irq_set_chip_data(virq, h->host_data); | ||
141 | irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); | ||
142 | set_irq_flags(virq, IRQF_VALID); /* kill me now */ | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static struct irq_domain_ops irqc_irq_domain_ops = { | ||
147 | .map = irqc_irq_domain_map, | ||
148 | .xlate = irq_domain_xlate_twocell, | ||
149 | }; | ||
150 | |||
151 | static int irqc_probe(struct platform_device *pdev) | ||
152 | { | ||
153 | struct renesas_irqc_config *pdata = pdev->dev.platform_data; | ||
154 | struct irqc_priv *p; | ||
155 | struct resource *io; | ||
156 | struct resource *irq; | ||
157 | struct irq_chip *irq_chip; | ||
158 | const char *name = dev_name(&pdev->dev); | ||
159 | int ret; | ||
160 | int k; | ||
161 | |||
162 | p = kzalloc(sizeof(*p), GFP_KERNEL); | ||
163 | if (!p) { | ||
164 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
165 | ret = -ENOMEM; | ||
166 | goto err0; | ||
167 | } | ||
168 | |||
169 | /* deal with driver instance configuration */ | ||
170 | if (pdata) | ||
171 | memcpy(&p->config, pdata, sizeof(*pdata)); | ||
172 | |||
173 | p->pdev = pdev; | ||
174 | platform_set_drvdata(pdev, p); | ||
175 | |||
176 | /* get hold of manadatory IOMEM */ | ||
177 | io = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
178 | if (!io) { | ||
179 | dev_err(&pdev->dev, "not enough IOMEM resources\n"); | ||
180 | ret = -EINVAL; | ||
181 | goto err1; | ||
182 | } | ||
183 | |||
184 | /* allow any number of IRQs between 1 and IRQC_IRQ_MAX */ | ||
185 | for (k = 0; k < IRQC_IRQ_MAX; k++) { | ||
186 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, k); | ||
187 | if (!irq) | ||
188 | break; | ||
189 | |||
190 | p->irq[k].p = p; | ||
191 | p->irq[k].requested_irq = irq->start; | ||
192 | } | ||
193 | |||
194 | p->number_of_irqs = k; | ||
195 | if (p->number_of_irqs < 1) { | ||
196 | dev_err(&pdev->dev, "not enough IRQ resources\n"); | ||
197 | ret = -EINVAL; | ||
198 | goto err1; | ||
199 | } | ||
200 | |||
201 | /* ioremap IOMEM and setup read/write callbacks */ | ||
202 | p->iomem = ioremap_nocache(io->start, resource_size(io)); | ||
203 | if (!p->iomem) { | ||
204 | dev_err(&pdev->dev, "failed to remap IOMEM\n"); | ||
205 | ret = -ENXIO; | ||
206 | goto err2; | ||
207 | } | ||
208 | |||
209 | p->cpu_int_base = p->iomem + IRQC_INT_CPU_BASE(0); /* SYS-SPI */ | ||
210 | |||
211 | irq_chip = &p->irq_chip; | ||
212 | irq_chip->name = name; | ||
213 | irq_chip->irq_mask = irqc_irq_disable; | ||
214 | irq_chip->irq_unmask = irqc_irq_enable; | ||
215 | irq_chip->irq_enable = irqc_irq_enable; | ||
216 | irq_chip->irq_disable = irqc_irq_disable; | ||
217 | irq_chip->irq_set_type = irqc_irq_set_type; | ||
218 | irq_chip->flags = IRQCHIP_SKIP_SET_WAKE; | ||
219 | |||
220 | p->irq_domain = irq_domain_add_simple(pdev->dev.of_node, | ||
221 | p->number_of_irqs, | ||
222 | p->config.irq_base, | ||
223 | &irqc_irq_domain_ops, p); | ||
224 | if (!p->irq_domain) { | ||
225 | ret = -ENXIO; | ||
226 | dev_err(&pdev->dev, "cannot initialize irq domain\n"); | ||
227 | goto err2; | ||
228 | } | ||
229 | |||
230 | /* request interrupts one by one */ | ||
231 | for (k = 0; k < p->number_of_irqs; k++) { | ||
232 | if (request_irq(p->irq[k].requested_irq, irqc_irq_handler, | ||
233 | 0, name, &p->irq[k])) { | ||
234 | dev_err(&pdev->dev, "failed to request IRQ\n"); | ||
235 | ret = -ENOENT; | ||
236 | goto err3; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | dev_info(&pdev->dev, "driving %d irqs\n", p->number_of_irqs); | ||
241 | |||
242 | /* warn in case of mismatch if irq base is specified */ | ||
243 | if (p->config.irq_base) { | ||
244 | if (p->config.irq_base != p->irq[0].domain_irq) | ||
245 | dev_warn(&pdev->dev, "irq base mismatch (%d/%d)\n", | ||
246 | p->config.irq_base, p->irq[0].domain_irq); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | err3: | ||
251 | for (; k >= 0; k--) | ||
252 | free_irq(p->irq[k - 1].requested_irq, &p->irq[k - 1]); | ||
253 | |||
254 | irq_domain_remove(p->irq_domain); | ||
255 | err2: | ||
256 | iounmap(p->iomem); | ||
257 | err1: | ||
258 | kfree(p); | ||
259 | err0: | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | static int irqc_remove(struct platform_device *pdev) | ||
264 | { | ||
265 | struct irqc_priv *p = platform_get_drvdata(pdev); | ||
266 | int k; | ||
267 | |||
268 | for (k = 0; k < p->number_of_irqs; k++) | ||
269 | free_irq(p->irq[k].requested_irq, &p->irq[k]); | ||
270 | |||
271 | irq_domain_remove(p->irq_domain); | ||
272 | iounmap(p->iomem); | ||
273 | kfree(p); | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static const struct of_device_id irqc_dt_ids[] = { | ||
278 | { .compatible = "renesas,irqc", }, | ||
279 | {}, | ||
280 | }; | ||
281 | MODULE_DEVICE_TABLE(of, irqc_dt_ids); | ||
282 | |||
283 | static struct platform_driver irqc_device_driver = { | ||
284 | .probe = irqc_probe, | ||
285 | .remove = irqc_remove, | ||
286 | .driver = { | ||
287 | .name = "renesas_irqc", | ||
288 | .of_match_table = irqc_dt_ids, | ||
289 | .owner = THIS_MODULE, | ||
290 | } | ||
291 | }; | ||
292 | |||
293 | static int __init irqc_init(void) | ||
294 | { | ||
295 | return platform_driver_register(&irqc_device_driver); | ||
296 | } | ||
297 | postcore_initcall(irqc_init); | ||
298 | |||
299 | static void __exit irqc_exit(void) | ||
300 | { | ||
301 | platform_driver_unregister(&irqc_device_driver); | ||
302 | } | ||
303 | module_exit(irqc_exit); | ||
304 | |||
305 | MODULE_AUTHOR("Magnus Damm"); | ||
306 | MODULE_DESCRIPTION("Renesas IRQC Driver"); | ||
307 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/arch/arm/mach-s3c24xx/irq.c b/drivers/irqchip/irq-s3c24xx.c index cb9f5e011e73..5e40b3424df8 100644 --- a/arch/arm/mach-s3c24xx/irq.c +++ b/drivers/irqchip/irq-s3c24xx.c | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <linux/ioport.h> | 25 | #include <linux/ioport.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/irqdomain.h> | 27 | #include <linux/irqdomain.h> |
28 | #include <linux/of.h> | ||
29 | #include <linux/of_irq.h> | ||
30 | #include <linux/of_address.h> | ||
28 | 31 | ||
32 | #include <asm/exception.h> | ||
29 | #include <asm/mach/irq.h> | 33 | #include <asm/mach/irq.h> |
30 | 34 | ||
31 | #include <mach/regs-irq.h> | 35 | #include <mach/regs-irq.h> |
@@ -34,7 +38,8 @@ | |||
34 | #include <plat/cpu.h> | 38 | #include <plat/cpu.h> |
35 | #include <plat/regs-irqtype.h> | 39 | #include <plat/regs-irqtype.h> |
36 | #include <plat/pm.h> | 40 | #include <plat/pm.h> |
37 | #include <plat/irq.h> | 41 | |
42 | #include "irqchip.h" | ||
38 | 43 | ||
39 | #define S3C_IRQTYPE_NONE 0 | 44 | #define S3C_IRQTYPE_NONE 0 |
40 | #define S3C_IRQTYPE_EINT 1 | 45 | #define S3C_IRQTYPE_EINT 1 |
@@ -43,6 +48,7 @@ | |||
43 | 48 | ||
44 | struct s3c_irq_data { | 49 | struct s3c_irq_data { |
45 | unsigned int type; | 50 | unsigned int type; |
51 | unsigned long offset; | ||
46 | unsigned long parent_irq; | 52 | unsigned long parent_irq; |
47 | 53 | ||
48 | /* data gets filled during init */ | 54 | /* data gets filled during init */ |
@@ -69,23 +75,34 @@ struct s3c_irq_intc { | |||
69 | struct s3c_irq_data *irqs; | 75 | struct s3c_irq_data *irqs; |
70 | }; | 76 | }; |
71 | 77 | ||
78 | /* | ||
79 | * Array holding pointers to the global controller structs | ||
80 | * [0] ... main_intc | ||
81 | * [1] ... sub_intc | ||
82 | * [2] ... main_intc2 on s3c2416 | ||
83 | */ | ||
84 | static struct s3c_irq_intc *s3c_intc[3]; | ||
85 | |||
72 | static void s3c_irq_mask(struct irq_data *data) | 86 | static void s3c_irq_mask(struct irq_data *data) |
73 | { | 87 | { |
74 | struct s3c_irq_intc *intc = data->domain->host_data; | 88 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
89 | struct s3c_irq_intc *intc = irq_data->intc; | ||
75 | struct s3c_irq_intc *parent_intc = intc->parent; | 90 | struct s3c_irq_intc *parent_intc = intc->parent; |
76 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
77 | struct s3c_irq_data *parent_data; | 91 | struct s3c_irq_data *parent_data; |
78 | unsigned long mask; | 92 | unsigned long mask; |
79 | unsigned int irqno; | 93 | unsigned int irqno; |
80 | 94 | ||
81 | mask = __raw_readl(intc->reg_mask); | 95 | mask = __raw_readl(intc->reg_mask); |
82 | mask |= (1UL << data->hwirq); | 96 | mask |= (1UL << irq_data->offset); |
83 | __raw_writel(mask, intc->reg_mask); | 97 | __raw_writel(mask, intc->reg_mask); |
84 | 98 | ||
85 | if (parent_intc && irq_data->parent_irq) { | 99 | if (parent_intc) { |
86 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; | 100 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; |
87 | 101 | ||
88 | /* check to see if we need to mask the parent IRQ */ | 102 | /* check to see if we need to mask the parent IRQ |
103 | * The parent_irq is always in main_intc, so the hwirq | ||
104 | * for find_mapping does not need an offset in any case. | ||
105 | */ | ||
89 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { | 106 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { |
90 | irqno = irq_find_mapping(parent_intc->domain, | 107 | irqno = irq_find_mapping(parent_intc->domain, |
91 | irq_data->parent_irq); | 108 | irq_data->parent_irq); |
@@ -96,17 +113,17 @@ static void s3c_irq_mask(struct irq_data *data) | |||
96 | 113 | ||
97 | static void s3c_irq_unmask(struct irq_data *data) | 114 | static void s3c_irq_unmask(struct irq_data *data) |
98 | { | 115 | { |
99 | struct s3c_irq_intc *intc = data->domain->host_data; | 116 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
117 | struct s3c_irq_intc *intc = irq_data->intc; | ||
100 | struct s3c_irq_intc *parent_intc = intc->parent; | 118 | struct s3c_irq_intc *parent_intc = intc->parent; |
101 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
102 | unsigned long mask; | 119 | unsigned long mask; |
103 | unsigned int irqno; | 120 | unsigned int irqno; |
104 | 121 | ||
105 | mask = __raw_readl(intc->reg_mask); | 122 | mask = __raw_readl(intc->reg_mask); |
106 | mask &= ~(1UL << data->hwirq); | 123 | mask &= ~(1UL << irq_data->offset); |
107 | __raw_writel(mask, intc->reg_mask); | 124 | __raw_writel(mask, intc->reg_mask); |
108 | 125 | ||
109 | if (parent_intc && irq_data->parent_irq) { | 126 | if (parent_intc) { |
110 | irqno = irq_find_mapping(parent_intc->domain, | 127 | irqno = irq_find_mapping(parent_intc->domain, |
111 | irq_data->parent_irq); | 128 | irq_data->parent_irq); |
112 | s3c_irq_unmask(irq_get_irq_data(irqno)); | 129 | s3c_irq_unmask(irq_get_irq_data(irqno)); |
@@ -115,14 +132,37 @@ static void s3c_irq_unmask(struct irq_data *data) | |||
115 | 132 | ||
116 | static inline void s3c_irq_ack(struct irq_data *data) | 133 | static inline void s3c_irq_ack(struct irq_data *data) |
117 | { | 134 | { |
118 | struct s3c_irq_intc *intc = data->domain->host_data; | 135 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
119 | unsigned long bitval = 1UL << data->hwirq; | 136 | struct s3c_irq_intc *intc = irq_data->intc; |
137 | unsigned long bitval = 1UL << irq_data->offset; | ||
120 | 138 | ||
121 | __raw_writel(bitval, intc->reg_pending); | 139 | __raw_writel(bitval, intc->reg_pending); |
122 | if (intc->reg_intpnd) | 140 | if (intc->reg_intpnd) |
123 | __raw_writel(bitval, intc->reg_intpnd); | 141 | __raw_writel(bitval, intc->reg_intpnd); |
124 | } | 142 | } |
125 | 143 | ||
144 | static int s3c_irq_type(struct irq_data *data, unsigned int type) | ||
145 | { | ||
146 | switch (type) { | ||
147 | case IRQ_TYPE_NONE: | ||
148 | break; | ||
149 | case IRQ_TYPE_EDGE_RISING: | ||
150 | case IRQ_TYPE_EDGE_FALLING: | ||
151 | case IRQ_TYPE_EDGE_BOTH: | ||
152 | irq_set_handler(data->irq, handle_edge_irq); | ||
153 | break; | ||
154 | case IRQ_TYPE_LEVEL_LOW: | ||
155 | case IRQ_TYPE_LEVEL_HIGH: | ||
156 | irq_set_handler(data->irq, handle_level_irq); | ||
157 | break; | ||
158 | default: | ||
159 | pr_err("No such irq type %d", type); | ||
160 | return -EINVAL; | ||
161 | } | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
126 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, | 166 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, |
127 | void __iomem *extint_reg, | 167 | void __iomem *extint_reg, |
128 | unsigned long gpcon_offset, | 168 | unsigned long gpcon_offset, |
@@ -175,8 +215,7 @@ static int s3c_irqext_type_set(void __iomem *gpcon_reg, | |||
175 | return 0; | 215 | return 0; |
176 | } | 216 | } |
177 | 217 | ||
178 | /* FIXME: make static when it's out of plat-samsung/irq.h */ | 218 | static int s3c_irqext_type(struct irq_data *data, unsigned int type) |
179 | int s3c_irqext_type(struct irq_data *data, unsigned int type) | ||
180 | { | 219 | { |
181 | void __iomem *extint_reg; | 220 | void __iomem *extint_reg; |
182 | void __iomem *gpcon_reg; | 221 | void __iomem *gpcon_reg; |
@@ -224,19 +263,21 @@ static int s3c_irqext0_type(struct irq_data *data, unsigned int type) | |||
224 | extint_offset, type); | 263 | extint_offset, type); |
225 | } | 264 | } |
226 | 265 | ||
227 | struct irq_chip s3c_irq_chip = { | 266 | static struct irq_chip s3c_irq_chip = { |
228 | .name = "s3c", | 267 | .name = "s3c", |
229 | .irq_ack = s3c_irq_ack, | 268 | .irq_ack = s3c_irq_ack, |
230 | .irq_mask = s3c_irq_mask, | 269 | .irq_mask = s3c_irq_mask, |
231 | .irq_unmask = s3c_irq_unmask, | 270 | .irq_unmask = s3c_irq_unmask, |
271 | .irq_set_type = s3c_irq_type, | ||
232 | .irq_set_wake = s3c_irq_wake | 272 | .irq_set_wake = s3c_irq_wake |
233 | }; | 273 | }; |
234 | 274 | ||
235 | struct irq_chip s3c_irq_level_chip = { | 275 | static struct irq_chip s3c_irq_level_chip = { |
236 | .name = "s3c-level", | 276 | .name = "s3c-level", |
237 | .irq_mask = s3c_irq_mask, | 277 | .irq_mask = s3c_irq_mask, |
238 | .irq_unmask = s3c_irq_unmask, | 278 | .irq_unmask = s3c_irq_unmask, |
239 | .irq_ack = s3c_irq_ack, | 279 | .irq_ack = s3c_irq_ack, |
280 | .irq_set_type = s3c_irq_type, | ||
240 | }; | 281 | }; |
241 | 282 | ||
242 | static struct irq_chip s3c_irqext_chip = { | 283 | static struct irq_chip s3c_irqext_chip = { |
@@ -260,12 +301,19 @@ static struct irq_chip s3c_irq_eint0t4 = { | |||
260 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | 301 | static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) |
261 | { | 302 | { |
262 | struct irq_chip *chip = irq_desc_get_chip(desc); | 303 | struct irq_chip *chip = irq_desc_get_chip(desc); |
263 | struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; | 304 | struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc); |
264 | struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; | 305 | struct s3c_irq_intc *intc = irq_data->intc; |
265 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; | 306 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; |
266 | unsigned long src; | 307 | unsigned long src; |
267 | unsigned long msk; | 308 | unsigned long msk; |
268 | unsigned int n; | 309 | unsigned int n; |
310 | unsigned int offset; | ||
311 | |||
312 | /* we're using individual domains for the non-dt case | ||
313 | * and one big domain for the dt case where the subintc | ||
314 | * starts at hwirq number 32. | ||
315 | */ | ||
316 | offset = (intc->domain->of_node) ? 32 : 0; | ||
269 | 317 | ||
270 | chained_irq_enter(chip, desc); | 318 | chained_irq_enter(chip, desc); |
271 | 319 | ||
@@ -278,12 +326,64 @@ static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
278 | while (src) { | 326 | while (src) { |
279 | n = __ffs(src); | 327 | n = __ffs(src); |
280 | src &= ~(1 << n); | 328 | src &= ~(1 << n); |
281 | generic_handle_irq(irq_find_mapping(sub_intc->domain, n)); | 329 | irq = irq_find_mapping(sub_intc->domain, offset + n); |
330 | generic_handle_irq(irq); | ||
282 | } | 331 | } |
283 | 332 | ||
284 | chained_irq_exit(chip, desc); | 333 | chained_irq_exit(chip, desc); |
285 | } | 334 | } |
286 | 335 | ||
336 | static inline int s3c24xx_handle_intc(struct s3c_irq_intc *intc, | ||
337 | struct pt_regs *regs, int intc_offset) | ||
338 | { | ||
339 | int pnd; | ||
340 | int offset; | ||
341 | int irq; | ||
342 | |||
343 | pnd = __raw_readl(intc->reg_intpnd); | ||
344 | if (!pnd) | ||
345 | return false; | ||
346 | |||
347 | /* non-dt machines use individual domains */ | ||
348 | if (!intc->domain->of_node) | ||
349 | intc_offset = 0; | ||
350 | |||
351 | /* We have a problem that the INTOFFSET register does not always | ||
352 | * show one interrupt. Occasionally we get two interrupts through | ||
353 | * the prioritiser, and this causes the INTOFFSET register to show | ||
354 | * what looks like the logical-or of the two interrupt numbers. | ||
355 | * | ||
356 | * Thanks to Klaus, Shannon, et al for helping to debug this problem | ||
357 | */ | ||
358 | offset = __raw_readl(intc->reg_intpnd + 4); | ||
359 | |||
360 | /* Find the bit manually, when the offset is wrong. | ||
361 | * The pending register only ever contains the one bit of the next | ||
362 | * interrupt to handle. | ||
363 | */ | ||
364 | if (!(pnd & (1 << offset))) | ||
365 | offset = __ffs(pnd); | ||
366 | |||
367 | irq = irq_find_mapping(intc->domain, intc_offset + offset); | ||
368 | handle_IRQ(irq, regs); | ||
369 | return true; | ||
370 | } | ||
371 | |||
372 | asmlinkage void __exception_irq_entry s3c24xx_handle_irq(struct pt_regs *regs) | ||
373 | { | ||
374 | do { | ||
375 | if (likely(s3c_intc[0])) | ||
376 | if (s3c24xx_handle_intc(s3c_intc[0], regs, 0)) | ||
377 | continue; | ||
378 | |||
379 | if (s3c_intc[2]) | ||
380 | if (s3c24xx_handle_intc(s3c_intc[2], regs, 64)) | ||
381 | continue; | ||
382 | |||
383 | break; | ||
384 | } while (1); | ||
385 | } | ||
386 | |||
287 | #ifdef CONFIG_FIQ | 387 | #ifdef CONFIG_FIQ |
288 | /** | 388 | /** |
289 | * s3c24xx_set_fiq - set the FIQ routing | 389 | * s3c24xx_set_fiq - set the FIQ routing |
@@ -326,25 +426,21 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
326 | struct s3c_irq_data *parent_irq_data; | 426 | struct s3c_irq_data *parent_irq_data; |
327 | unsigned int irqno; | 427 | unsigned int irqno; |
328 | 428 | ||
329 | if (!intc) { | ||
330 | pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); | ||
331 | return -EINVAL; | ||
332 | } | ||
333 | |||
334 | if (!irq_data) { | ||
335 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); | ||
336 | return -EINVAL; | ||
337 | } | ||
338 | |||
339 | /* attach controller pointer to irq_data */ | 429 | /* attach controller pointer to irq_data */ |
340 | irq_data->intc = intc; | 430 | irq_data->intc = intc; |
431 | irq_data->offset = hw; | ||
432 | |||
433 | parent_intc = intc->parent; | ||
341 | 434 | ||
342 | /* set handler and flags */ | 435 | /* set handler and flags */ |
343 | switch (irq_data->type) { | 436 | switch (irq_data->type) { |
344 | case S3C_IRQTYPE_NONE: | 437 | case S3C_IRQTYPE_NONE: |
345 | return 0; | 438 | return 0; |
346 | case S3C_IRQTYPE_EINT: | 439 | case S3C_IRQTYPE_EINT: |
347 | if (irq_data->parent_irq) | 440 | /* On the S3C2412, the EINT0to3 have a parent irq |
441 | * but need the s3c_irq_eint0t4 chip | ||
442 | */ | ||
443 | if (parent_intc && (!soc_is_s3c2412() || hw >= 4)) | ||
348 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, | 444 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, |
349 | handle_edge_irq); | 445 | handle_edge_irq); |
350 | else | 446 | else |
@@ -352,8 +448,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
352 | handle_edge_irq); | 448 | handle_edge_irq); |
353 | break; | 449 | break; |
354 | case S3C_IRQTYPE_EDGE: | 450 | case S3C_IRQTYPE_EDGE: |
355 | if (irq_data->parent_irq || | 451 | if (parent_intc || intc->reg_pending == S3C2416_SRCPND2) |
356 | intc->reg_pending == S3C2416_SRCPND2) | ||
357 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 452 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
358 | handle_edge_irq); | 453 | handle_edge_irq); |
359 | else | 454 | else |
@@ -361,7 +456,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
361 | handle_edge_irq); | 456 | handle_edge_irq); |
362 | break; | 457 | break; |
363 | case S3C_IRQTYPE_LEVEL: | 458 | case S3C_IRQTYPE_LEVEL: |
364 | if (irq_data->parent_irq) | 459 | if (parent_intc) |
365 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 460 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
366 | handle_level_irq); | 461 | handle_level_irq); |
367 | else | 462 | else |
@@ -372,23 +467,19 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
372 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); | 467 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); |
373 | return -EINVAL; | 468 | return -EINVAL; |
374 | } | 469 | } |
470 | |||
471 | irq_set_chip_data(virq, irq_data); | ||
472 | |||
375 | set_irq_flags(virq, IRQF_VALID); | 473 | set_irq_flags(virq, IRQF_VALID); |
376 | 474 | ||
377 | if (irq_data->parent_irq) { | 475 | if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) { |
378 | parent_intc = intc->parent; | 476 | if (irq_data->parent_irq > 31) { |
379 | if (!parent_intc) { | 477 | pr_err("irq-s3c24xx: parent irq %lu is out of range\n", |
380 | pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", | 478 | irq_data->parent_irq); |
381 | hw); | ||
382 | goto err; | 479 | goto err; |
383 | } | 480 | } |
384 | 481 | ||
385 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | 482 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; |
386 | if (!irq_data) { | ||
387 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", | ||
388 | hw); | ||
389 | goto err; | ||
390 | } | ||
391 | |||
392 | parent_irq_data->sub_intc = intc; | 483 | parent_irq_data->sub_intc = intc; |
393 | parent_irq_data->sub_bits |= (1UL << hw); | 484 | parent_irq_data->sub_bits |= (1UL << hw); |
394 | 485 | ||
@@ -443,7 +534,7 @@ static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) | |||
443 | } | 534 | } |
444 | } | 535 | } |
445 | 536 | ||
446 | struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | 537 | static struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, |
447 | struct s3c_irq_data *irq_data, | 538 | struct s3c_irq_data *irq_data, |
448 | struct s3c_irq_intc *parent, | 539 | struct s3c_irq_intc *parent, |
449 | unsigned long address) | 540 | unsigned long address) |
@@ -452,7 +543,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
452 | void __iomem *base = (void *)0xf6000000; /* static mapping */ | 543 | void __iomem *base = (void *)0xf6000000; /* static mapping */ |
453 | int irq_num; | 544 | int irq_num; |
454 | int irq_start; | 545 | int irq_start; |
455 | int irq_offset; | ||
456 | int ret; | 546 | int ret; |
457 | 547 | ||
458 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); | 548 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); |
@@ -476,7 +566,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
476 | intc->reg_intpnd = base + 0x10; | 566 | intc->reg_intpnd = base + 0x10; |
477 | irq_num = 32; | 567 | irq_num = 32; |
478 | irq_start = S3C2410_IRQ(0); | 568 | irq_start = S3C2410_IRQ(0); |
479 | irq_offset = 0; | ||
480 | break; | 569 | break; |
481 | case 0x4a000018: | 570 | case 0x4a000018: |
482 | pr_debug("irq: found subintc\n"); | 571 | pr_debug("irq: found subintc\n"); |
@@ -484,7 +573,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
484 | intc->reg_mask = base + 0x1c; | 573 | intc->reg_mask = base + 0x1c; |
485 | irq_num = 29; | 574 | irq_num = 29; |
486 | irq_start = S3C2410_IRQSUB(0); | 575 | irq_start = S3C2410_IRQSUB(0); |
487 | irq_offset = 0; | ||
488 | break; | 576 | break; |
489 | case 0x4a000040: | 577 | case 0x4a000040: |
490 | pr_debug("irq: found intc2\n"); | 578 | pr_debug("irq: found intc2\n"); |
@@ -493,7 +581,6 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
493 | intc->reg_intpnd = base + 0x50; | 581 | intc->reg_intpnd = base + 0x50; |
494 | irq_num = 8; | 582 | irq_num = 8; |
495 | irq_start = S3C2416_IRQ(0); | 583 | irq_start = S3C2416_IRQ(0); |
496 | irq_offset = 0; | ||
497 | break; | 584 | break; |
498 | case 0x560000a4: | 585 | case 0x560000a4: |
499 | pr_debug("irq: found eintc\n"); | 586 | pr_debug("irq: found eintc\n"); |
@@ -501,9 +588,8 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
501 | 588 | ||
502 | intc->reg_mask = base + 0xa4; | 589 | intc->reg_mask = base + 0xa4; |
503 | intc->reg_pending = base + 0x08; | 590 | intc->reg_pending = base + 0x08; |
504 | irq_num = 20; | 591 | irq_num = 24; |
505 | irq_start = S3C2410_IRQ(32); | 592 | irq_start = S3C2410_IRQ(32); |
506 | irq_offset = 4; | ||
507 | break; | 593 | break; |
508 | default: | 594 | default: |
509 | pr_err("irq: unsupported controller address\n"); | 595 | pr_err("irq: unsupported controller address\n"); |
@@ -514,7 +600,7 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
514 | /* now that all the data is complete, init the irq-domain */ | 600 | /* now that all the data is complete, init the irq-domain */ |
515 | s3c24xx_clear_intc(intc); | 601 | s3c24xx_clear_intc(intc); |
516 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, | 602 | intc->domain = irq_domain_add_legacy(np, irq_num, irq_start, |
517 | irq_offset, &s3c24xx_irq_ops, | 603 | 0, &s3c24xx_irq_ops, |
518 | intc); | 604 | intc); |
519 | if (!intc->domain) { | 605 | if (!intc->domain) { |
520 | pr_err("irq: could not create irq-domain\n"); | 606 | pr_err("irq: could not create irq-domain\n"); |
@@ -522,6 +608,8 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
522 | goto err; | 608 | goto err; |
523 | } | 609 | } |
524 | 610 | ||
611 | set_handle_irq(s3c24xx_handle_irq); | ||
612 | |||
525 | return intc; | 613 | return intc; |
526 | 614 | ||
527 | err: | 615 | err: |
@@ -529,12 +617,35 @@ err: | |||
529 | return ERR_PTR(ret); | 617 | return ERR_PTR(ret); |
530 | } | 618 | } |
531 | 619 | ||
532 | /* s3c24xx_init_irq | 620 | static struct s3c_irq_data init_eint[32] = { |
533 | * | 621 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
534 | * Initialise S3C2410 IRQ system | 622 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
535 | */ | 623 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
624 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
625 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | ||
626 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | ||
627 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | ||
628 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ | ||
629 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ | ||
630 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ | ||
631 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ | ||
632 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ | ||
633 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ | ||
634 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ | ||
635 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ | ||
636 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ | ||
637 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ | ||
638 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ | ||
639 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ | ||
640 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ | ||
641 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ | ||
642 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ | ||
643 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ | ||
644 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | ||
645 | }; | ||
536 | 646 | ||
537 | static struct s3c_irq_data init_base[32] = { | 647 | #ifdef CONFIG_CPU_S3C2410 |
648 | static struct s3c_irq_data init_s3c2410base[32] = { | ||
538 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | 649 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
539 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | 650 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
540 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | 651 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
@@ -569,11 +680,80 @@ static struct s3c_irq_data init_base[32] = { | |||
569 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | 680 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
570 | }; | 681 | }; |
571 | 682 | ||
572 | static struct s3c_irq_data init_eint[32] = { | 683 | static struct s3c_irq_data init_s3c2410subint[32] = { |
573 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 684 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
574 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 685 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
686 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
687 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
688 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
689 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
690 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
691 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
692 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
693 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
694 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
695 | }; | ||
696 | |||
697 | void __init s3c2410_init_irq(void) | ||
698 | { | ||
699 | #ifdef CONFIG_FIQ | ||
700 | init_FIQ(FIQ_START); | ||
701 | #endif | ||
702 | |||
703 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL, | ||
704 | 0x4a000000); | ||
705 | if (IS_ERR(s3c_intc[0])) { | ||
706 | pr_err("irq: could not create main interrupt controller\n"); | ||
707 | return; | ||
708 | } | ||
709 | |||
710 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0], | ||
711 | s3c_intc[0], 0x4a000018); | ||
712 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
713 | } | ||
714 | #endif | ||
715 | |||
716 | #ifdef CONFIG_CPU_S3C2412 | ||
717 | static struct s3c_irq_data init_s3c2412base[32] = { | ||
718 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT0 */ | ||
719 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT1 */ | ||
720 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT2 */ | ||
721 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT3 */ | ||
722 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
723 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
575 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 724 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
725 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
726 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
727 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ | ||
728 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
729 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
730 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
731 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
732 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
733 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
734 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
735 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
736 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
737 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
738 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
739 | { .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */ | ||
740 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
741 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
576 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | 742 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
743 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
744 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
745 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
746 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
747 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
748 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
749 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
750 | }; | ||
751 | |||
752 | static struct s3c_irq_data init_s3c2412eint[32] = { | ||
753 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 0 }, /* EINT0 */ | ||
754 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 1 }, /* EINT1 */ | ||
755 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 2 }, /* EINT2 */ | ||
756 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 3 }, /* EINT3 */ | ||
577 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | 757 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ |
578 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | 758 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ |
579 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | 759 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ |
@@ -596,7 +776,7 @@ static struct s3c_irq_data init_eint[32] = { | |||
596 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | 776 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ |
597 | }; | 777 | }; |
598 | 778 | ||
599 | static struct s3c_irq_data init_subint[32] = { | 779 | static struct s3c_irq_data init_s3c2412subint[32] = { |
600 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | 780 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
601 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | 781 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
602 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | 782 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
@@ -608,25 +788,32 @@ static struct s3c_irq_data init_subint[32] = { | |||
608 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | 788 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
609 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | 789 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
610 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | 790 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
791 | { .type = S3C_IRQTYPE_NONE, }, | ||
792 | { .type = S3C_IRQTYPE_NONE, }, | ||
793 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */ | ||
794 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */ | ||
611 | }; | 795 | }; |
612 | 796 | ||
613 | void __init s3c24xx_init_irq(void) | 797 | void s3c2412_init_irq(void) |
614 | { | 798 | { |
615 | struct s3c_irq_intc *main_intc; | 799 | pr_info("S3C2412: IRQ Support\n"); |
616 | 800 | ||
617 | #ifdef CONFIG_FIQ | 801 | #ifdef CONFIG_FIQ |
618 | init_FIQ(FIQ_START); | 802 | init_FIQ(FIQ_START); |
619 | #endif | 803 | #endif |
620 | 804 | ||
621 | main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); | 805 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, |
622 | if (IS_ERR(main_intc)) { | 806 | 0x4a000000); |
807 | if (IS_ERR(s3c_intc[0])) { | ||
623 | pr_err("irq: could not create main interrupt controller\n"); | 808 | pr_err("irq: could not create main interrupt controller\n"); |
624 | return; | 809 | return; |
625 | } | 810 | } |
626 | 811 | ||
627 | s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); | 812 | s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4); |
628 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 813 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0], |
814 | s3c_intc[0], 0x4a000018); | ||
629 | } | 815 | } |
816 | #endif | ||
630 | 817 | ||
631 | #ifdef CONFIG_CPU_S3C2416 | 818 | #ifdef CONFIG_CPU_S3C2416 |
632 | static struct s3c_irq_data init_s3c2416base[32] = { | 819 | static struct s3c_irq_data init_s3c2416base[32] = { |
@@ -698,37 +885,185 @@ static struct s3c_irq_data init_s3c2416subint[32] = { | |||
698 | 885 | ||
699 | static struct s3c_irq_data init_s3c2416_second[32] = { | 886 | static struct s3c_irq_data init_s3c2416_second[32] = { |
700 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ | 887 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ |
701 | { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ | 888 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
702 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 889 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
703 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 890 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
704 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ | 891 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ |
705 | { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ | 892 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
706 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ | 893 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ |
707 | { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ | ||
708 | }; | 894 | }; |
709 | 895 | ||
710 | void __init s3c2416_init_irq(void) | 896 | void __init s3c2416_init_irq(void) |
711 | { | 897 | { |
712 | struct s3c_irq_intc *main_intc; | ||
713 | |||
714 | pr_info("S3C2416: IRQ Support\n"); | 898 | pr_info("S3C2416: IRQ Support\n"); |
715 | 899 | ||
716 | #ifdef CONFIG_FIQ | 900 | #ifdef CONFIG_FIQ |
717 | init_FIQ(FIQ_START); | 901 | init_FIQ(FIQ_START); |
718 | #endif | 902 | #endif |
719 | 903 | ||
720 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); | 904 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, |
721 | if (IS_ERR(main_intc)) { | 905 | 0x4a000000); |
906 | if (IS_ERR(s3c_intc[0])) { | ||
722 | pr_err("irq: could not create main interrupt controller\n"); | 907 | pr_err("irq: could not create main interrupt controller\n"); |
723 | return; | 908 | return; |
724 | } | 909 | } |
725 | 910 | ||
726 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 911 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
727 | s3c24xx_init_intc(NULL, &init_s3c2416subint[0], main_intc, 0x4a000018); | 912 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2416subint[0], |
913 | s3c_intc[0], 0x4a000018); | ||
914 | |||
915 | s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0], | ||
916 | NULL, 0x4a000040); | ||
917 | } | ||
918 | |||
919 | #endif | ||
920 | |||
921 | #ifdef CONFIG_CPU_S3C2440 | ||
922 | static struct s3c_irq_data init_s3c2440base[32] = { | ||
923 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
924 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
925 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
926 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
927 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
928 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
929 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ | ||
930 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
931 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
932 | { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */ | ||
933 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
934 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
935 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
936 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
937 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
938 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
939 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
940 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
941 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
942 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
943 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
944 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ | ||
945 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
946 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
947 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ | ||
948 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
949 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
950 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
951 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
952 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
953 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
954 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
955 | }; | ||
956 | |||
957 | static struct s3c_irq_data init_s3c2440subint[32] = { | ||
958 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
959 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
960 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
961 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
962 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
963 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
964 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
965 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
966 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
967 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
968 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
969 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ | ||
970 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ | ||
971 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ | ||
972 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ | ||
973 | }; | ||
974 | |||
975 | void __init s3c2440_init_irq(void) | ||
976 | { | ||
977 | pr_info("S3C2440: IRQ Support\n"); | ||
728 | 978 | ||
729 | s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); | 979 | #ifdef CONFIG_FIQ |
980 | init_FIQ(FIQ_START); | ||
981 | #endif | ||
982 | |||
983 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, | ||
984 | 0x4a000000); | ||
985 | if (IS_ERR(s3c_intc[0])) { | ||
986 | pr_err("irq: could not create main interrupt controller\n"); | ||
987 | return; | ||
988 | } | ||
989 | |||
990 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
991 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0], | ||
992 | s3c_intc[0], 0x4a000018); | ||
730 | } | 993 | } |
994 | #endif | ||
731 | 995 | ||
996 | #ifdef CONFIG_CPU_S3C2442 | ||
997 | static struct s3c_irq_data init_s3c2442base[32] = { | ||
998 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | ||
999 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | ||
1000 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | ||
1001 | { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */ | ||
1002 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */ | ||
1003 | { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */ | ||
1004 | { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */ | ||
1005 | { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */ | ||
1006 | { .type = S3C_IRQTYPE_EDGE, }, /* TICK */ | ||
1007 | { .type = S3C_IRQTYPE_EDGE, }, /* WDT */ | ||
1008 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */ | ||
1009 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */ | ||
1010 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */ | ||
1011 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */ | ||
1012 | { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */ | ||
1013 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */ | ||
1014 | { .type = S3C_IRQTYPE_EDGE, }, /* LCD */ | ||
1015 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */ | ||
1016 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */ | ||
1017 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */ | ||
1018 | { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */ | ||
1019 | { .type = S3C_IRQTYPE_EDGE, }, /* SDI */ | ||
1020 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */ | ||
1021 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */ | ||
1022 | { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */ | ||
1023 | { .type = S3C_IRQTYPE_EDGE, }, /* USBD */ | ||
1024 | { .type = S3C_IRQTYPE_EDGE, }, /* USBH */ | ||
1025 | { .type = S3C_IRQTYPE_EDGE, }, /* IIC */ | ||
1026 | { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */ | ||
1027 | { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */ | ||
1028 | { .type = S3C_IRQTYPE_EDGE, }, /* RTC */ | ||
1029 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | ||
1030 | }; | ||
1031 | |||
1032 | static struct s3c_irq_data init_s3c2442subint[32] = { | ||
1033 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | ||
1034 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | ||
1035 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | ||
1036 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */ | ||
1037 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */ | ||
1038 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */ | ||
1039 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */ | ||
1040 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */ | ||
1041 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | ||
1042 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | ||
1043 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | ||
1044 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ | ||
1045 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ | ||
1046 | }; | ||
1047 | |||
1048 | void __init s3c2442_init_irq(void) | ||
1049 | { | ||
1050 | pr_info("S3C2442: IRQ Support\n"); | ||
1051 | |||
1052 | #ifdef CONFIG_FIQ | ||
1053 | init_FIQ(FIQ_START); | ||
1054 | #endif | ||
1055 | |||
1056 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, | ||
1057 | 0x4a000000); | ||
1058 | if (IS_ERR(s3c_intc[0])) { | ||
1059 | pr_err("irq: could not create main interrupt controller\n"); | ||
1060 | return; | ||
1061 | } | ||
1062 | |||
1063 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
1064 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0], | ||
1065 | s3c_intc[0], 0x4a000018); | ||
1066 | } | ||
732 | #endif | 1067 | #endif |
733 | 1068 | ||
734 | #ifdef CONFIG_CPU_S3C2443 | 1069 | #ifdef CONFIG_CPU_S3C2443 |
@@ -802,21 +1137,219 @@ static struct s3c_irq_data init_s3c2443subint[32] = { | |||
802 | 1137 | ||
803 | void __init s3c2443_init_irq(void) | 1138 | void __init s3c2443_init_irq(void) |
804 | { | 1139 | { |
805 | struct s3c_irq_intc *main_intc; | ||
806 | |||
807 | pr_info("S3C2443: IRQ Support\n"); | 1140 | pr_info("S3C2443: IRQ Support\n"); |
808 | 1141 | ||
809 | #ifdef CONFIG_FIQ | 1142 | #ifdef CONFIG_FIQ |
810 | init_FIQ(FIQ_START); | 1143 | init_FIQ(FIQ_START); |
811 | #endif | 1144 | #endif |
812 | 1145 | ||
813 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); | 1146 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, |
814 | if (IS_ERR(main_intc)) { | 1147 | 0x4a000000); |
1148 | if (IS_ERR(s3c_intc[0])) { | ||
815 | pr_err("irq: could not create main interrupt controller\n"); | 1149 | pr_err("irq: could not create main interrupt controller\n"); |
816 | return; | 1150 | return; |
817 | } | 1151 | } |
818 | 1152 | ||
819 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 1153 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
820 | s3c24xx_init_intc(NULL, &init_s3c2443subint[0], main_intc, 0x4a000018); | 1154 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2443subint[0], |
1155 | s3c_intc[0], 0x4a000018); | ||
1156 | } | ||
1157 | #endif | ||
1158 | |||
1159 | #ifdef CONFIG_OF | ||
1160 | static int s3c24xx_irq_map_of(struct irq_domain *h, unsigned int virq, | ||
1161 | irq_hw_number_t hw) | ||
1162 | { | ||
1163 | unsigned int ctrl_num = hw / 32; | ||
1164 | unsigned int intc_hw = hw % 32; | ||
1165 | struct s3c_irq_intc *intc = s3c_intc[ctrl_num]; | ||
1166 | struct s3c_irq_intc *parent_intc = intc->parent; | ||
1167 | struct s3c_irq_data *irq_data = &intc->irqs[intc_hw]; | ||
1168 | |||
1169 | /* attach controller pointer to irq_data */ | ||
1170 | irq_data->intc = intc; | ||
1171 | irq_data->offset = intc_hw; | ||
1172 | |||
1173 | if (!parent_intc) | ||
1174 | irq_set_chip_and_handler(virq, &s3c_irq_chip, handle_edge_irq); | ||
1175 | else | ||
1176 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | ||
1177 | handle_edge_irq); | ||
1178 | |||
1179 | irq_set_chip_data(virq, irq_data); | ||
1180 | |||
1181 | set_irq_flags(virq, IRQF_VALID); | ||
1182 | |||
1183 | return 0; | ||
1184 | } | ||
1185 | |||
1186 | /* Translate our of irq notation | ||
1187 | * format: <ctrl_num ctrl_irq parent_irq type> | ||
1188 | */ | ||
1189 | static int s3c24xx_irq_xlate_of(struct irq_domain *d, struct device_node *n, | ||
1190 | const u32 *intspec, unsigned int intsize, | ||
1191 | irq_hw_number_t *out_hwirq, unsigned int *out_type) | ||
1192 | { | ||
1193 | struct s3c_irq_intc *intc; | ||
1194 | struct s3c_irq_intc *parent_intc; | ||
1195 | struct s3c_irq_data *irq_data; | ||
1196 | struct s3c_irq_data *parent_irq_data; | ||
1197 | int irqno; | ||
1198 | |||
1199 | if (WARN_ON(intsize < 4)) | ||
1200 | return -EINVAL; | ||
1201 | |||
1202 | if (intspec[0] > 2 || !s3c_intc[intspec[0]]) { | ||
1203 | pr_err("controller number %d invalid\n", intspec[0]); | ||
1204 | return -EINVAL; | ||
1205 | } | ||
1206 | intc = s3c_intc[intspec[0]]; | ||
1207 | |||
1208 | *out_hwirq = intspec[0] * 32 + intspec[2]; | ||
1209 | *out_type = intspec[3] & IRQ_TYPE_SENSE_MASK; | ||
1210 | |||
1211 | parent_intc = intc->parent; | ||
1212 | if (parent_intc) { | ||
1213 | irq_data = &intc->irqs[intspec[2]]; | ||
1214 | irq_data->parent_irq = intspec[1]; | ||
1215 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | ||
1216 | parent_irq_data->sub_intc = intc; | ||
1217 | parent_irq_data->sub_bits |= (1UL << intspec[2]); | ||
1218 | |||
1219 | /* parent_intc is always s3c_intc[0], so no offset */ | ||
1220 | irqno = irq_create_mapping(parent_intc->domain, intspec[1]); | ||
1221 | if (irqno < 0) { | ||
1222 | pr_err("irq: could not map parent interrupt\n"); | ||
1223 | return irqno; | ||
1224 | } | ||
1225 | |||
1226 | irq_set_chained_handler(irqno, s3c_irq_demux); | ||
1227 | } | ||
1228 | |||
1229 | return 0; | ||
1230 | } | ||
1231 | |||
1232 | static struct irq_domain_ops s3c24xx_irq_ops_of = { | ||
1233 | .map = s3c24xx_irq_map_of, | ||
1234 | .xlate = s3c24xx_irq_xlate_of, | ||
1235 | }; | ||
1236 | |||
1237 | struct s3c24xx_irq_of_ctrl { | ||
1238 | char *name; | ||
1239 | unsigned long offset; | ||
1240 | struct s3c_irq_intc **handle; | ||
1241 | struct s3c_irq_intc **parent; | ||
1242 | struct irq_domain_ops *ops; | ||
1243 | }; | ||
1244 | |||
1245 | static int __init s3c_init_intc_of(struct device_node *np, | ||
1246 | struct device_node *interrupt_parent, | ||
1247 | struct s3c24xx_irq_of_ctrl *s3c_ctrl, int num_ctrl) | ||
1248 | { | ||
1249 | struct s3c_irq_intc *intc; | ||
1250 | struct s3c24xx_irq_of_ctrl *ctrl; | ||
1251 | struct irq_domain *domain; | ||
1252 | void __iomem *reg_base; | ||
1253 | int i; | ||
1254 | |||
1255 | reg_base = of_iomap(np, 0); | ||
1256 | if (!reg_base) { | ||
1257 | pr_err("irq-s3c24xx: could not map irq registers\n"); | ||
1258 | return -EINVAL; | ||
1259 | } | ||
1260 | |||
1261 | domain = irq_domain_add_linear(np, num_ctrl * 32, | ||
1262 | &s3c24xx_irq_ops_of, NULL); | ||
1263 | if (!domain) { | ||
1264 | pr_err("irq: could not create irq-domain\n"); | ||
1265 | return -EINVAL; | ||
1266 | } | ||
1267 | |||
1268 | for (i = 0; i < num_ctrl; i++) { | ||
1269 | ctrl = &s3c_ctrl[i]; | ||
1270 | |||
1271 | pr_debug("irq: found controller %s\n", ctrl->name); | ||
1272 | |||
1273 | intc = kzalloc(sizeof(struct s3c_irq_intc), GFP_KERNEL); | ||
1274 | if (!intc) | ||
1275 | return -ENOMEM; | ||
1276 | |||
1277 | intc->domain = domain; | ||
1278 | intc->irqs = kzalloc(sizeof(struct s3c_irq_data) * 32, | ||
1279 | GFP_KERNEL); | ||
1280 | if (!intc->irqs) { | ||
1281 | kfree(intc); | ||
1282 | return -ENOMEM; | ||
1283 | } | ||
1284 | |||
1285 | if (ctrl->parent) { | ||
1286 | intc->reg_pending = reg_base + ctrl->offset; | ||
1287 | intc->reg_mask = reg_base + ctrl->offset + 0x4; | ||
1288 | |||
1289 | if (*(ctrl->parent)) { | ||
1290 | intc->parent = *(ctrl->parent); | ||
1291 | } else { | ||
1292 | pr_warn("irq: parent of %s missing\n", | ||
1293 | ctrl->name); | ||
1294 | kfree(intc->irqs); | ||
1295 | kfree(intc); | ||
1296 | continue; | ||
1297 | } | ||
1298 | } else { | ||
1299 | intc->reg_pending = reg_base + ctrl->offset; | ||
1300 | intc->reg_mask = reg_base + ctrl->offset + 0x08; | ||
1301 | intc->reg_intpnd = reg_base + ctrl->offset + 0x10; | ||
1302 | } | ||
1303 | |||
1304 | s3c24xx_clear_intc(intc); | ||
1305 | s3c_intc[i] = intc; | ||
1306 | } | ||
1307 | |||
1308 | set_handle_irq(s3c24xx_handle_irq); | ||
1309 | |||
1310 | return 0; | ||
1311 | } | ||
1312 | |||
1313 | static struct s3c24xx_irq_of_ctrl s3c2410_ctrl[] = { | ||
1314 | { | ||
1315 | .name = "intc", | ||
1316 | .offset = 0, | ||
1317 | }, { | ||
1318 | .name = "subintc", | ||
1319 | .offset = 0x18, | ||
1320 | .parent = &s3c_intc[0], | ||
1321 | } | ||
1322 | }; | ||
1323 | |||
1324 | int __init s3c2410_init_intc_of(struct device_node *np, | ||
1325 | struct device_node *interrupt_parent, | ||
1326 | struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) | ||
1327 | { | ||
1328 | return s3c_init_intc_of(np, interrupt_parent, | ||
1329 | s3c2410_ctrl, ARRAY_SIZE(s3c2410_ctrl)); | ||
1330 | } | ||
1331 | IRQCHIP_DECLARE(s3c2410_irq, "samsung,s3c2410-irq", s3c2410_init_intc_of); | ||
1332 | |||
1333 | static struct s3c24xx_irq_of_ctrl s3c2416_ctrl[] = { | ||
1334 | { | ||
1335 | .name = "intc", | ||
1336 | .offset = 0, | ||
1337 | }, { | ||
1338 | .name = "subintc", | ||
1339 | .offset = 0x18, | ||
1340 | .parent = &s3c_intc[0], | ||
1341 | }, { | ||
1342 | .name = "intc2", | ||
1343 | .offset = 0x40, | ||
1344 | } | ||
1345 | }; | ||
1346 | |||
1347 | int __init s3c2416_init_intc_of(struct device_node *np, | ||
1348 | struct device_node *interrupt_parent, | ||
1349 | struct s3c24xx_irq_of_ctrl *ctrl, int num_ctrl) | ||
1350 | { | ||
1351 | return s3c_init_intc_of(np, interrupt_parent, | ||
1352 | s3c2416_ctrl, ARRAY_SIZE(s3c2416_ctrl)); | ||
821 | } | 1353 | } |
1354 | IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of); | ||
822 | #endif | 1355 | #endif |
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 63fb265e0da6..8d6794cdf899 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c | |||
@@ -25,14 +25,93 @@ | |||
25 | 25 | ||
26 | #include <mach/dma.h> | 26 | #include <mach/dma.h> |
27 | 27 | ||
28 | #include <mach/regs-sdi.h> | ||
29 | |||
30 | #include <linux/platform_data/mmc-s3cmci.h> | 28 | #include <linux/platform_data/mmc-s3cmci.h> |
31 | 29 | ||
32 | #include "s3cmci.h" | 30 | #include "s3cmci.h" |
33 | 31 | ||
34 | #define DRIVER_NAME "s3c-mci" | 32 | #define DRIVER_NAME "s3c-mci" |
35 | 33 | ||
34 | #define S3C2410_SDICON (0x00) | ||
35 | #define S3C2410_SDIPRE (0x04) | ||
36 | #define S3C2410_SDICMDARG (0x08) | ||
37 | #define S3C2410_SDICMDCON (0x0C) | ||
38 | #define S3C2410_SDICMDSTAT (0x10) | ||
39 | #define S3C2410_SDIRSP0 (0x14) | ||
40 | #define S3C2410_SDIRSP1 (0x18) | ||
41 | #define S3C2410_SDIRSP2 (0x1C) | ||
42 | #define S3C2410_SDIRSP3 (0x20) | ||
43 | #define S3C2410_SDITIMER (0x24) | ||
44 | #define S3C2410_SDIBSIZE (0x28) | ||
45 | #define S3C2410_SDIDCON (0x2C) | ||
46 | #define S3C2410_SDIDCNT (0x30) | ||
47 | #define S3C2410_SDIDSTA (0x34) | ||
48 | #define S3C2410_SDIFSTA (0x38) | ||
49 | |||
50 | #define S3C2410_SDIDATA (0x3C) | ||
51 | #define S3C2410_SDIIMSK (0x40) | ||
52 | |||
53 | #define S3C2440_SDIDATA (0x40) | ||
54 | #define S3C2440_SDIIMSK (0x3C) | ||
55 | |||
56 | #define S3C2440_SDICON_SDRESET (1 << 8) | ||
57 | #define S3C2410_SDICON_SDIOIRQ (1 << 3) | ||
58 | #define S3C2410_SDICON_FIFORESET (1 << 1) | ||
59 | #define S3C2410_SDICON_CLOCKTYPE (1 << 0) | ||
60 | |||
61 | #define S3C2410_SDICMDCON_LONGRSP (1 << 10) | ||
62 | #define S3C2410_SDICMDCON_WAITRSP (1 << 9) | ||
63 | #define S3C2410_SDICMDCON_CMDSTART (1 << 8) | ||
64 | #define S3C2410_SDICMDCON_SENDERHOST (1 << 6) | ||
65 | #define S3C2410_SDICMDCON_INDEX (0x3f) | ||
66 | |||
67 | #define S3C2410_SDICMDSTAT_CRCFAIL (1 << 12) | ||
68 | #define S3C2410_SDICMDSTAT_CMDSENT (1 << 11) | ||
69 | #define S3C2410_SDICMDSTAT_CMDTIMEOUT (1 << 10) | ||
70 | #define S3C2410_SDICMDSTAT_RSPFIN (1 << 9) | ||
71 | |||
72 | #define S3C2440_SDIDCON_DS_WORD (2 << 22) | ||
73 | #define S3C2410_SDIDCON_TXAFTERRESP (1 << 20) | ||
74 | #define S3C2410_SDIDCON_RXAFTERCMD (1 << 19) | ||
75 | #define S3C2410_SDIDCON_BLOCKMODE (1 << 17) | ||
76 | #define S3C2410_SDIDCON_WIDEBUS (1 << 16) | ||
77 | #define S3C2410_SDIDCON_DMAEN (1 << 15) | ||
78 | #define S3C2410_SDIDCON_STOP (1 << 14) | ||
79 | #define S3C2440_SDIDCON_DATSTART (1 << 14) | ||
80 | |||
81 | #define S3C2410_SDIDCON_XFER_RXSTART (2 << 12) | ||
82 | #define S3C2410_SDIDCON_XFER_TXSTART (3 << 12) | ||
83 | |||
84 | #define S3C2410_SDIDCON_BLKNUM_MASK (0xFFF) | ||
85 | |||
86 | #define S3C2410_SDIDSTA_SDIOIRQDETECT (1 << 9) | ||
87 | #define S3C2410_SDIDSTA_FIFOFAIL (1 << 8) | ||
88 | #define S3C2410_SDIDSTA_CRCFAIL (1 << 7) | ||
89 | #define S3C2410_SDIDSTA_RXCRCFAIL (1 << 6) | ||
90 | #define S3C2410_SDIDSTA_DATATIMEOUT (1 << 5) | ||
91 | #define S3C2410_SDIDSTA_XFERFINISH (1 << 4) | ||
92 | #define S3C2410_SDIDSTA_TXDATAON (1 << 1) | ||
93 | #define S3C2410_SDIDSTA_RXDATAON (1 << 0) | ||
94 | |||
95 | #define S3C2440_SDIFSTA_FIFORESET (1 << 16) | ||
96 | #define S3C2440_SDIFSTA_FIFOFAIL (3 << 14) | ||
97 | #define S3C2410_SDIFSTA_TFDET (1 << 13) | ||
98 | #define S3C2410_SDIFSTA_RFDET (1 << 12) | ||
99 | #define S3C2410_SDIFSTA_COUNTMASK (0x7f) | ||
100 | |||
101 | #define S3C2410_SDIIMSK_RESPONSECRC (1 << 17) | ||
102 | #define S3C2410_SDIIMSK_CMDSENT (1 << 16) | ||
103 | #define S3C2410_SDIIMSK_CMDTIMEOUT (1 << 15) | ||
104 | #define S3C2410_SDIIMSK_RESPONSEND (1 << 14) | ||
105 | #define S3C2410_SDIIMSK_SDIOIRQ (1 << 12) | ||
106 | #define S3C2410_SDIIMSK_FIFOFAIL (1 << 11) | ||
107 | #define S3C2410_SDIIMSK_CRCSTATUS (1 << 10) | ||
108 | #define S3C2410_SDIIMSK_DATACRC (1 << 9) | ||
109 | #define S3C2410_SDIIMSK_DATATIMEOUT (1 << 8) | ||
110 | #define S3C2410_SDIIMSK_DATAFINISH (1 << 7) | ||
111 | #define S3C2410_SDIIMSK_TXFIFOHALF (1 << 4) | ||
112 | #define S3C2410_SDIIMSK_RXFIFOLAST (1 << 2) | ||
113 | #define S3C2410_SDIIMSK_RXFIFOHALF (1 << 0) | ||
114 | |||
36 | enum dbg_channels { | 115 | enum dbg_channels { |
37 | dbg_err = (1 << 0), | 116 | dbg_err = (1 << 0), |
38 | dbg_debug = (1 << 1), | 117 | dbg_debug = (1 << 1), |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 321d3ef05006..c6443de58fb0 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -746,6 +746,64 @@ struct device_node *of_find_node_by_phandle(phandle handle) | |||
746 | EXPORT_SYMBOL(of_find_node_by_phandle); | 746 | EXPORT_SYMBOL(of_find_node_by_phandle); |
747 | 747 | ||
748 | /** | 748 | /** |
749 | * of_find_property_value_of_size | ||
750 | * | ||
751 | * @np: device node from which the property value is to be read. | ||
752 | * @propname: name of the property to be searched. | ||
753 | * @len: requested length of property value | ||
754 | * | ||
755 | * Search for a property in a device node and valid the requested size. | ||
756 | * Returns the property value on success, -EINVAL if the property does not | ||
757 | * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
758 | * property data isn't large enough. | ||
759 | * | ||
760 | */ | ||
761 | static void *of_find_property_value_of_size(const struct device_node *np, | ||
762 | const char *propname, u32 len) | ||
763 | { | ||
764 | struct property *prop = of_find_property(np, propname, NULL); | ||
765 | |||
766 | if (!prop) | ||
767 | return ERR_PTR(-EINVAL); | ||
768 | if (!prop->value) | ||
769 | return ERR_PTR(-ENODATA); | ||
770 | if (len > prop->length) | ||
771 | return ERR_PTR(-EOVERFLOW); | ||
772 | |||
773 | return prop->value; | ||
774 | } | ||
775 | |||
776 | /** | ||
777 | * of_property_read_u32_index - Find and read a u32 from a multi-value property. | ||
778 | * | ||
779 | * @np: device node from which the property value is to be read. | ||
780 | * @propname: name of the property to be searched. | ||
781 | * @index: index of the u32 in the list of values | ||
782 | * @out_value: pointer to return value, modified only if no error. | ||
783 | * | ||
784 | * Search for a property in a device node and read nth 32-bit value from | ||
785 | * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
786 | * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
787 | * property data isn't large enough. | ||
788 | * | ||
789 | * The out_value is modified only if a valid u32 value can be decoded. | ||
790 | */ | ||
791 | int of_property_read_u32_index(const struct device_node *np, | ||
792 | const char *propname, | ||
793 | u32 index, u32 *out_value) | ||
794 | { | ||
795 | const u32 *val = of_find_property_value_of_size(np, propname, | ||
796 | ((index + 1) * sizeof(*out_value))); | ||
797 | |||
798 | if (IS_ERR(val)) | ||
799 | return PTR_ERR(val); | ||
800 | |||
801 | *out_value = be32_to_cpup(((__be32 *)val) + index); | ||
802 | return 0; | ||
803 | } | ||
804 | EXPORT_SYMBOL_GPL(of_property_read_u32_index); | ||
805 | |||
806 | /** | ||
749 | * of_property_read_u8_array - Find and read an array of u8 from a property. | 807 | * of_property_read_u8_array - Find and read an array of u8 from a property. |
750 | * | 808 | * |
751 | * @np: device node from which the property value is to be read. | 809 | * @np: device node from which the property value is to be read. |
@@ -766,17 +824,12 @@ EXPORT_SYMBOL(of_find_node_by_phandle); | |||
766 | int of_property_read_u8_array(const struct device_node *np, | 824 | int of_property_read_u8_array(const struct device_node *np, |
767 | const char *propname, u8 *out_values, size_t sz) | 825 | const char *propname, u8 *out_values, size_t sz) |
768 | { | 826 | { |
769 | struct property *prop = of_find_property(np, propname, NULL); | 827 | const u8 *val = of_find_property_value_of_size(np, propname, |
770 | const u8 *val; | 828 | (sz * sizeof(*out_values))); |
771 | 829 | ||
772 | if (!prop) | 830 | if (IS_ERR(val)) |
773 | return -EINVAL; | 831 | return PTR_ERR(val); |
774 | if (!prop->value) | ||
775 | return -ENODATA; | ||
776 | if ((sz * sizeof(*out_values)) > prop->length) | ||
777 | return -EOVERFLOW; | ||
778 | 832 | ||
779 | val = prop->value; | ||
780 | while (sz--) | 833 | while (sz--) |
781 | *out_values++ = *val++; | 834 | *out_values++ = *val++; |
782 | return 0; | 835 | return 0; |
@@ -804,17 +857,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array); | |||
804 | int of_property_read_u16_array(const struct device_node *np, | 857 | int of_property_read_u16_array(const struct device_node *np, |
805 | const char *propname, u16 *out_values, size_t sz) | 858 | const char *propname, u16 *out_values, size_t sz) |
806 | { | 859 | { |
807 | struct property *prop = of_find_property(np, propname, NULL); | 860 | const __be16 *val = of_find_property_value_of_size(np, propname, |
808 | const __be16 *val; | 861 | (sz * sizeof(*out_values))); |
809 | 862 | ||
810 | if (!prop) | 863 | if (IS_ERR(val)) |
811 | return -EINVAL; | 864 | return PTR_ERR(val); |
812 | if (!prop->value) | ||
813 | return -ENODATA; | ||
814 | if ((sz * sizeof(*out_values)) > prop->length) | ||
815 | return -EOVERFLOW; | ||
816 | 865 | ||
817 | val = prop->value; | ||
818 | while (sz--) | 866 | while (sz--) |
819 | *out_values++ = be16_to_cpup(val++); | 867 | *out_values++ = be16_to_cpup(val++); |
820 | return 0; | 868 | return 0; |
@@ -841,17 +889,12 @@ int of_property_read_u32_array(const struct device_node *np, | |||
841 | const char *propname, u32 *out_values, | 889 | const char *propname, u32 *out_values, |
842 | size_t sz) | 890 | size_t sz) |
843 | { | 891 | { |
844 | struct property *prop = of_find_property(np, propname, NULL); | 892 | const __be32 *val = of_find_property_value_of_size(np, propname, |
845 | const __be32 *val; | 893 | (sz * sizeof(*out_values))); |
846 | 894 | ||
847 | if (!prop) | 895 | if (IS_ERR(val)) |
848 | return -EINVAL; | 896 | return PTR_ERR(val); |
849 | if (!prop->value) | ||
850 | return -ENODATA; | ||
851 | if ((sz * sizeof(*out_values)) > prop->length) | ||
852 | return -EOVERFLOW; | ||
853 | 897 | ||
854 | val = prop->value; | ||
855 | while (sz--) | 898 | while (sz--) |
856 | *out_values++ = be32_to_cpup(val++); | 899 | *out_values++ = be32_to_cpup(val++); |
857 | return 0; | 900 | return 0; |
@@ -874,15 +917,13 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array); | |||
874 | int of_property_read_u64(const struct device_node *np, const char *propname, | 917 | int of_property_read_u64(const struct device_node *np, const char *propname, |
875 | u64 *out_value) | 918 | u64 *out_value) |
876 | { | 919 | { |
877 | struct property *prop = of_find_property(np, propname, NULL); | 920 | const __be32 *val = of_find_property_value_of_size(np, propname, |
921 | sizeof(*out_value)); | ||
878 | 922 | ||
879 | if (!prop) | 923 | if (IS_ERR(val)) |
880 | return -EINVAL; | 924 | return PTR_ERR(val); |
881 | if (!prop->value) | 925 | |
882 | return -ENODATA; | 926 | *out_value = of_read_number(val, 2); |
883 | if (sizeof(*out_value) > prop->length) | ||
884 | return -EOVERFLOW; | ||
885 | *out_value = of_read_number(prop->value, 2); | ||
886 | return 0; | 927 | return 0; |
887 | } | 928 | } |
888 | EXPORT_SYMBOL_GPL(of_property_read_u64); | 929 | EXPORT_SYMBOL_GPL(of_property_read_u64); |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 34f51d2d90d2..35e94009829b 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -229,6 +229,7 @@ config PINCTRL_EXYNOS5440 | |||
229 | source "drivers/pinctrl/mvebu/Kconfig" | 229 | source "drivers/pinctrl/mvebu/Kconfig" |
230 | source "drivers/pinctrl/sh-pfc/Kconfig" | 230 | source "drivers/pinctrl/sh-pfc/Kconfig" |
231 | source "drivers/pinctrl/spear/Kconfig" | 231 | source "drivers/pinctrl/spear/Kconfig" |
232 | source "drivers/pinctrl/vt8500/Kconfig" | ||
232 | 233 | ||
233 | config PINCTRL_XWAY | 234 | config PINCTRL_XWAY |
234 | bool | 235 | bool |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index f82cc5baf767..a5a52c83c13a 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -52,3 +52,4 @@ obj-$(CONFIG_PLAT_ORION) += mvebu/ | |||
52 | obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ | 52 | obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ |
53 | obj-$(CONFIG_SUPERH) += sh-pfc/ | 53 | obj-$(CONFIG_SUPERH) += sh-pfc/ |
54 | obj-$(CONFIG_PLAT_SPEAR) += spear/ | 54 | obj-$(CONFIG_PLAT_SPEAR) += spear/ |
55 | obj-$(CONFIG_ARCH_VT8500) += vt8500/ | ||
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c index 4eb6d2c4e4df..2a2e427d765e 100644 --- a/drivers/pinctrl/pinctrl-bcm2835.c +++ b/drivers/pinctrl/pinctrl-bcm2835.c | |||
@@ -699,11 +699,6 @@ static int bcm2835_pctl_dt_node_to_map_pull(struct bcm2835_pinctrl *pc, | |||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
701 | 701 | ||
702 | static inline u32 prop_u32(struct property *p, int i) | ||
703 | { | ||
704 | return be32_to_cpup(((__be32 *)p->value) + i); | ||
705 | } | ||
706 | |||
707 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | 702 | static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, |
708 | struct device_node *np, | 703 | struct device_node *np, |
709 | struct pinctrl_map **map, unsigned *num_maps) | 704 | struct pinctrl_map **map, unsigned *num_maps) |
@@ -761,7 +756,9 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
761 | return -ENOMEM; | 756 | return -ENOMEM; |
762 | 757 | ||
763 | for (i = 0; i < num_pins; i++) { | 758 | for (i = 0; i < num_pins; i++) { |
764 | pin = prop_u32(pins, i); | 759 | err = of_property_read_u32_index(np, "brcm,pins", i, &pin); |
760 | if (err) | ||
761 | goto out; | ||
765 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { | 762 | if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { |
766 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", | 763 | dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", |
767 | of_node_full_name(np), pin); | 764 | of_node_full_name(np), pin); |
@@ -770,14 +767,20 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
770 | } | 767 | } |
771 | 768 | ||
772 | if (num_funcs) { | 769 | if (num_funcs) { |
773 | func = prop_u32(funcs, (num_funcs > 1) ? i : 0); | 770 | err = of_property_read_u32_index(np, "brcm,function", |
771 | (num_funcs > 1) ? i : 0, &func); | ||
772 | if (err) | ||
773 | goto out; | ||
774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, | 774 | err = bcm2835_pctl_dt_node_to_map_func(pc, np, pin, |
775 | func, &cur_map); | 775 | func, &cur_map); |
776 | if (err) | 776 | if (err) |
777 | goto out; | 777 | goto out; |
778 | } | 778 | } |
779 | if (num_pulls) { | 779 | if (num_pulls) { |
780 | pull = prop_u32(pulls, (num_pulls > 1) ? i : 0); | 780 | err = of_property_read_u32_index(np, "brcm,pull", |
781 | (num_funcs > 1) ? i : 0, &pull); | ||
782 | if (err) | ||
783 | goto out; | ||
781 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, | 784 | err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, |
782 | pull, &cur_map); | 785 | pull, &cur_map); |
783 | if (err) | 786 | if (err) |
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index 538b9ddaadf7..8738933a57d7 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c | |||
@@ -677,3 +677,111 @@ struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { | |||
677 | .label = "exynos4x12-gpio-ctrl3", | 677 | .label = "exynos4x12-gpio-ctrl3", |
678 | }, | 678 | }, |
679 | }; | 679 | }; |
680 | |||
681 | /* pin banks of exynos5250 pin-controller 0 */ | ||
682 | static struct samsung_pin_bank exynos5250_pin_banks0[] = { | ||
683 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), | ||
684 | EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), | ||
685 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08), | ||
686 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c), | ||
687 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10), | ||
688 | EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14), | ||
689 | EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18), | ||
690 | EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c), | ||
691 | EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc1", 0x20), | ||
692 | EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc2", 0x24), | ||
693 | EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc3", 0x28), | ||
694 | EXYNOS_PIN_BANK_EINTG(4, 0x160, "gpd0", 0x2c), | ||
695 | EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x30), | ||
696 | EXYNOS_PIN_BANK_EINTG(7, 0x2E0, "gpc4", 0x34), | ||
697 | EXYNOS_PIN_BANK_EINTN(6, 0x1A0, "gpy0"), | ||
698 | EXYNOS_PIN_BANK_EINTN(4, 0x1C0, "gpy1"), | ||
699 | EXYNOS_PIN_BANK_EINTN(6, 0x1E0, "gpy2"), | ||
700 | EXYNOS_PIN_BANK_EINTN(8, 0x200, "gpy3"), | ||
701 | EXYNOS_PIN_BANK_EINTN(8, 0x220, "gpy4"), | ||
702 | EXYNOS_PIN_BANK_EINTN(8, 0x240, "gpy5"), | ||
703 | EXYNOS_PIN_BANK_EINTN(8, 0x260, "gpy6"), | ||
704 | EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00), | ||
705 | EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04), | ||
706 | EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08), | ||
707 | EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c), | ||
708 | }; | ||
709 | |||
710 | /* pin banks of exynos5250 pin-controller 1 */ | ||
711 | static struct samsung_pin_bank exynos5250_pin_banks1[] = { | ||
712 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00), | ||
713 | EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04), | ||
714 | EXYNOS_PIN_BANK_EINTG(4, 0x040, "gpf0", 0x08), | ||
715 | EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpf1", 0x0c), | ||
716 | EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10), | ||
717 | EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14), | ||
718 | EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18), | ||
719 | EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gph0", 0x1c), | ||
720 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph1", 0x20), | ||
721 | }; | ||
722 | |||
723 | /* pin banks of exynos5250 pin-controller 2 */ | ||
724 | static struct samsung_pin_bank exynos5250_pin_banks2[] = { | ||
725 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00), | ||
726 | EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04), | ||
727 | EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08), | ||
728 | EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c), | ||
729 | EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10), | ||
730 | }; | ||
731 | |||
732 | /* pin banks of exynos5250 pin-controller 3 */ | ||
733 | static struct samsung_pin_bank exynos5250_pin_banks3[] = { | ||
734 | EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00), | ||
735 | }; | ||
736 | |||
737 | /* | ||
738 | * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes | ||
739 | * four gpio/pin-mux/pinconfig controllers. | ||
740 | */ | ||
741 | struct samsung_pin_ctrl exynos5250_pin_ctrl[] = { | ||
742 | { | ||
743 | /* pin-controller instance 0 data */ | ||
744 | .pin_banks = exynos5250_pin_banks0, | ||
745 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks0), | ||
746 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
747 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
748 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
749 | .weint_con = EXYNOS_WKUP_ECON_OFFSET, | ||
750 | .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, | ||
751 | .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, | ||
752 | .svc = EXYNOS_SVC_OFFSET, | ||
753 | .eint_gpio_init = exynos_eint_gpio_init, | ||
754 | .eint_wkup_init = exynos_eint_wkup_init, | ||
755 | .label = "exynos5250-gpio-ctrl0", | ||
756 | }, { | ||
757 | /* pin-controller instance 1 data */ | ||
758 | .pin_banks = exynos5250_pin_banks1, | ||
759 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks1), | ||
760 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
761 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
762 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
763 | .svc = EXYNOS_SVC_OFFSET, | ||
764 | .eint_gpio_init = exynos_eint_gpio_init, | ||
765 | .label = "exynos5250-gpio-ctrl1", | ||
766 | }, { | ||
767 | /* pin-controller instance 2 data */ | ||
768 | .pin_banks = exynos5250_pin_banks2, | ||
769 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks2), | ||
770 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
771 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
772 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
773 | .svc = EXYNOS_SVC_OFFSET, | ||
774 | .eint_gpio_init = exynos_eint_gpio_init, | ||
775 | .label = "exynos5250-gpio-ctrl2", | ||
776 | }, { | ||
777 | /* pin-controller instance 3 data */ | ||
778 | .pin_banks = exynos5250_pin_banks3, | ||
779 | .nr_banks = ARRAY_SIZE(exynos5250_pin_banks3), | ||
780 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, | ||
781 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, | ||
782 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, | ||
783 | .svc = EXYNOS_SVC_OFFSET, | ||
784 | .eint_gpio_init = exynos_eint_gpio_init, | ||
785 | .label = "exynos5250-gpio-ctrl3", | ||
786 | }, | ||
787 | }; | ||
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index f206df175656..3d5cf639aa46 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -948,6 +948,8 @@ static const struct of_device_id samsung_pinctrl_dt_match[] = { | |||
948 | .data = (void *)exynos4210_pin_ctrl }, | 948 | .data = (void *)exynos4210_pin_ctrl }, |
949 | { .compatible = "samsung,exynos4x12-pinctrl", | 949 | { .compatible = "samsung,exynos4x12-pinctrl", |
950 | .data = (void *)exynos4x12_pin_ctrl }, | 950 | .data = (void *)exynos4x12_pin_ctrl }, |
951 | { .compatible = "samsung,exynos5250-pinctrl", | ||
952 | .data = (void *)exynos5250_pin_ctrl }, | ||
951 | {}, | 953 | {}, |
952 | }; | 954 | }; |
953 | MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match); | 955 | MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match); |
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h index e2d4e67f7e88..ee964aadce0c 100644 --- a/drivers/pinctrl/pinctrl-samsung.h +++ b/drivers/pinctrl/pinctrl-samsung.h | |||
@@ -237,5 +237,6 @@ struct samsung_pmx_func { | |||
237 | /* list of all exported SoC specific data */ | 237 | /* list of all exported SoC specific data */ |
238 | extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; | 238 | extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; |
239 | extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; | 239 | extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; |
240 | extern struct samsung_pin_ctrl exynos5250_pin_ctrl[]; | ||
240 | 241 | ||
241 | #endif /* __PINCTRL_SAMSUNG_H */ | 242 | #endif /* __PINCTRL_SAMSUNG_H */ |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index 709008e94124..6f15c03077a0 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c | |||
@@ -2733,9 +2733,9 @@ static struct pinmux_data_reg pinmux_data_regs[] = { | |||
2733 | { }, | 2733 | { }, |
2734 | }; | 2734 | }; |
2735 | 2735 | ||
2736 | /* IRQ pins through INTCS with IRQ0->15 from 0x200 and IRQ16-31 from 0x3200 */ | 2736 | /* External IRQ pins mapped at IRQPIN_BASE */ |
2737 | #define EXT_IRQ16L(n) intcs_evt2irq(0x200 + ((n) << 5)) | 2737 | #define EXT_IRQ16L(n) irq_pin(n) |
2738 | #define EXT_IRQ16H(n) intcs_evt2irq(0x3200 + ((n - 16) << 5)) | 2738 | #define EXT_IRQ16H(n) irq_pin(n) |
2739 | 2739 | ||
2740 | static struct pinmux_irq pinmux_irqs[] = { | 2740 | static struct pinmux_irq pinmux_irqs[] = { |
2741 | PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), | 2741 | PINMUX_IRQ(EXT_IRQ16H(19), PORT9_FN0), |
diff --git a/drivers/pinctrl/vt8500/Kconfig b/drivers/pinctrl/vt8500/Kconfig new file mode 100644 index 000000000000..55724a73d94a --- /dev/null +++ b/drivers/pinctrl/vt8500/Kconfig | |||
@@ -0,0 +1,52 @@ | |||
1 | # | ||
2 | # VIA/Wondermedia PINCTRL drivers | ||
3 | # | ||
4 | |||
5 | if ARCH_VT8500 | ||
6 | |||
7 | config PINCTRL_WMT | ||
8 | bool | ||
9 | select PINMUX | ||
10 | select GENERIC_PINCONF | ||
11 | |||
12 | config PINCTRL_VT8500 | ||
13 | bool "VIA VT8500 pin controller driver" | ||
14 | depends on ARCH_WM8505 | ||
15 | select PINCTRL_WMT | ||
16 | help | ||
17 | Say yes here to support the gpio/pin control module on | ||
18 | VIA VT8500 SoCs. | ||
19 | |||
20 | config PINCTRL_WM8505 | ||
21 | bool "Wondermedia WM8505 pin controller driver" | ||
22 | depends on ARCH_WM8505 | ||
23 | select PINCTRL_WMT | ||
24 | help | ||
25 | Say yes here to support the gpio/pin control module on | ||
26 | Wondermedia WM8505 SoCs. | ||
27 | |||
28 | config PINCTRL_WM8650 | ||
29 | bool "Wondermedia WM8650 pin controller driver" | ||
30 | depends on ARCH_WM8505 | ||
31 | select PINCTRL_WMT | ||
32 | help | ||
33 | Say yes here to support the gpio/pin control module on | ||
34 | Wondermedia WM8650 SoCs. | ||
35 | |||
36 | config PINCTRL_WM8750 | ||
37 | bool "Wondermedia WM8750 pin controller driver" | ||
38 | depends on ARCH_WM8750 | ||
39 | select PINCTRL_WMT | ||
40 | help | ||
41 | Say yes here to support the gpio/pin control module on | ||
42 | Wondermedia WM8750 SoCs. | ||
43 | |||
44 | config PINCTRL_WM8850 | ||
45 | bool "Wondermedia WM8850 pin controller driver" | ||
46 | depends on ARCH_WM8850 | ||
47 | select PINCTRL_WMT | ||
48 | help | ||
49 | Say yes here to support the gpio/pin control module on | ||
50 | Wondermedia WM8850 SoCs. | ||
51 | |||
52 | endif | ||
diff --git a/drivers/pinctrl/vt8500/Makefile b/drivers/pinctrl/vt8500/Makefile new file mode 100644 index 000000000000..24ec45dd0d80 --- /dev/null +++ b/drivers/pinctrl/vt8500/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # VIA/Wondermedia pinctrl support | ||
2 | |||
3 | obj-$(CONFIG_PINCTRL_WMT) += pinctrl-wmt.o | ||
4 | obj-$(CONFIG_PINCTRL_VT8500) += pinctrl-vt8500.o | ||
5 | obj-$(CONFIG_PINCTRL_WM8505) += pinctrl-wm8505.o | ||
6 | obj-$(CONFIG_PINCTRL_WM8650) += pinctrl-wm8650.o | ||
7 | obj-$(CONFIG_PINCTRL_WM8750) += pinctrl-wm8750.o | ||
8 | obj-$(CONFIG_PINCTRL_WM8850) += pinctrl-wm8850.o | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-vt8500.c b/drivers/pinctrl/vt8500/pinctrl-vt8500.c new file mode 100644 index 000000000000..f2fe9f85cfa6 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-vt8500.c | |||
@@ -0,0 +1,501 @@ | |||
1 | /* | ||
2 | * Pinctrl data for VIA VT8500 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers vt8500_banks[] = { | ||
33 | WMT_PINCTRL_BANK(NO_REG, 0x3C, 0x5C, 0x7C, NO_REG, NO_REG), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x00, 0x20, 0x40, 0x60, NO_REG, NO_REG), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x04, 0x24, 0x44, 0x64, NO_REG, NO_REG), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x08, 0x28, 0x48, 0x68, NO_REG, NO_REG), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x0C, 0x2C, 0x4C, 0x6C, NO_REG, NO_REG), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x10, 0x30, 0x50, 0x70, NO_REG, NO_REG), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x14, 0x34, 0x54, 0x74, NO_REG, NO_REG), /* 6 */ | ||
40 | }; | ||
41 | |||
42 | /* Please keep sorted by bank/bit */ | ||
43 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
44 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
45 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
46 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
47 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
48 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
49 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
50 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
51 | #define WMT_PIN_EXTGPIO8 WMT_PIN(0, 8) | ||
52 | #define WMT_PIN_UART0RTS WMT_PIN(1, 0) | ||
53 | #define WMT_PIN_UART0TXD WMT_PIN(1, 1) | ||
54 | #define WMT_PIN_UART0CTS WMT_PIN(1, 2) | ||
55 | #define WMT_PIN_UART0RXD WMT_PIN(1, 3) | ||
56 | #define WMT_PIN_UART1RTS WMT_PIN(1, 4) | ||
57 | #define WMT_PIN_UART1TXD WMT_PIN(1, 5) | ||
58 | #define WMT_PIN_UART1CTS WMT_PIN(1, 6) | ||
59 | #define WMT_PIN_UART1RXD WMT_PIN(1, 7) | ||
60 | #define WMT_PIN_SPI0CLK WMT_PIN(1, 8) | ||
61 | #define WMT_PIN_SPI0SS WMT_PIN(1, 9) | ||
62 | #define WMT_PIN_SPI0MISO WMT_PIN(1, 10) | ||
63 | #define WMT_PIN_SPI0MOSI WMT_PIN(1, 11) | ||
64 | #define WMT_PIN_SPI1CLK WMT_PIN(1, 12) | ||
65 | #define WMT_PIN_SPI1SS WMT_PIN(1, 13) | ||
66 | #define WMT_PIN_SPI1MISO WMT_PIN(1, 14) | ||
67 | #define WMT_PIN_SPI1MOSI WMT_PIN(1, 15) | ||
68 | #define WMT_PIN_SPI2CLK WMT_PIN(1, 16) | ||
69 | #define WMT_PIN_SPI2SS WMT_PIN(1, 17) | ||
70 | #define WMT_PIN_SPI2MISO WMT_PIN(1, 18) | ||
71 | #define WMT_PIN_SPI2MOSI WMT_PIN(1, 19) | ||
72 | #define WMT_PIN_SDDATA0 WMT_PIN(2, 0) | ||
73 | #define WMT_PIN_SDDATA1 WMT_PIN(2, 1) | ||
74 | #define WMT_PIN_SDDATA2 WMT_PIN(2, 2) | ||
75 | #define WMT_PIN_SDDATA3 WMT_PIN(2, 3) | ||
76 | #define WMT_PIN_MMCDATA0 WMT_PIN(2, 4) | ||
77 | #define WMT_PIN_MMCDATA1 WMT_PIN(2, 5) | ||
78 | #define WMT_PIN_MMCDATA2 WMT_PIN(2, 6) | ||
79 | #define WMT_PIN_MMCDATA3 WMT_PIN(2, 7) | ||
80 | #define WMT_PIN_SDCLK WMT_PIN(2, 8) | ||
81 | #define WMT_PIN_SDWP WMT_PIN(2, 9) | ||
82 | #define WMT_PIN_SDCMD WMT_PIN(2, 10) | ||
83 | #define WMT_PIN_MSDATA0 WMT_PIN(2, 16) | ||
84 | #define WMT_PIN_MSDATA1 WMT_PIN(2, 17) | ||
85 | #define WMT_PIN_MSDATA2 WMT_PIN(2, 18) | ||
86 | #define WMT_PIN_MSDATA3 WMT_PIN(2, 19) | ||
87 | #define WMT_PIN_MSCLK WMT_PIN(2, 20) | ||
88 | #define WMT_PIN_MSBS WMT_PIN(2, 21) | ||
89 | #define WMT_PIN_MSINS WMT_PIN(2, 22) | ||
90 | #define WMT_PIN_I2C0SCL WMT_PIN(2, 24) | ||
91 | #define WMT_PIN_I2C0SDA WMT_PIN(2, 25) | ||
92 | #define WMT_PIN_I2C1SCL WMT_PIN(2, 26) | ||
93 | #define WMT_PIN_I2C1SDA WMT_PIN(2, 27) | ||
94 | #define WMT_PIN_MII0RXD0 WMT_PIN(3, 0) | ||
95 | #define WMT_PIN_MII0RXD1 WMT_PIN(3, 1) | ||
96 | #define WMT_PIN_MII0RXD2 WMT_PIN(3, 2) | ||
97 | #define WMT_PIN_MII0RXD3 WMT_PIN(3, 3) | ||
98 | #define WMT_PIN_MII0RXCLK WMT_PIN(3, 4) | ||
99 | #define WMT_PIN_MII0RXDV WMT_PIN(3, 5) | ||
100 | #define WMT_PIN_MII0RXERR WMT_PIN(3, 6) | ||
101 | #define WMT_PIN_MII0PHYRST WMT_PIN(3, 7) | ||
102 | #define WMT_PIN_MII0TXD0 WMT_PIN(3, 8) | ||
103 | #define WMT_PIN_MII0TXD1 WMT_PIN(3, 9) | ||
104 | #define WMT_PIN_MII0TXD2 WMT_PIN(3, 10) | ||
105 | #define WMT_PIN_MII0TXD3 WMT_PIN(3, 11) | ||
106 | #define WMT_PIN_MII0TXCLK WMT_PIN(3, 12) | ||
107 | #define WMT_PIN_MII0TXEN WMT_PIN(3, 13) | ||
108 | #define WMT_PIN_MII0TXERR WMT_PIN(3, 14) | ||
109 | #define WMT_PIN_MII0PHYPD WMT_PIN(3, 15) | ||
110 | #define WMT_PIN_MII0COL WMT_PIN(3, 16) | ||
111 | #define WMT_PIN_MII0CRS WMT_PIN(3, 17) | ||
112 | #define WMT_PIN_MII0MDIO WMT_PIN(3, 18) | ||
113 | #define WMT_PIN_MII0MDC WMT_PIN(3, 19) | ||
114 | #define WMT_PIN_SEECS WMT_PIN(3, 20) | ||
115 | #define WMT_PIN_SEECK WMT_PIN(3, 21) | ||
116 | #define WMT_PIN_SEEDI WMT_PIN(3, 22) | ||
117 | #define WMT_PIN_SEEDO WMT_PIN(3, 23) | ||
118 | #define WMT_PIN_IDEDREQ0 WMT_PIN(3, 24) | ||
119 | #define WMT_PIN_IDEDREQ1 WMT_PIN(3, 25) | ||
120 | #define WMT_PIN_IDEIOW WMT_PIN(3, 26) | ||
121 | #define WMT_PIN_IDEIOR WMT_PIN(3, 27) | ||
122 | #define WMT_PIN_IDEDACK WMT_PIN(3, 28) | ||
123 | #define WMT_PIN_IDEIORDY WMT_PIN(3, 29) | ||
124 | #define WMT_PIN_IDEINTRQ WMT_PIN(3, 30) | ||
125 | #define WMT_PIN_VDIN0 WMT_PIN(4, 0) | ||
126 | #define WMT_PIN_VDIN1 WMT_PIN(4, 1) | ||
127 | #define WMT_PIN_VDIN2 WMT_PIN(4, 2) | ||
128 | #define WMT_PIN_VDIN3 WMT_PIN(4, 3) | ||
129 | #define WMT_PIN_VDIN4 WMT_PIN(4, 4) | ||
130 | #define WMT_PIN_VDIN5 WMT_PIN(4, 5) | ||
131 | #define WMT_PIN_VDIN6 WMT_PIN(4, 6) | ||
132 | #define WMT_PIN_VDIN7 WMT_PIN(4, 7) | ||
133 | #define WMT_PIN_VDOUT0 WMT_PIN(4, 8) | ||
134 | #define WMT_PIN_VDOUT1 WMT_PIN(4, 9) | ||
135 | #define WMT_PIN_VDOUT2 WMT_PIN(4, 10) | ||
136 | #define WMT_PIN_VDOUT3 WMT_PIN(4, 11) | ||
137 | #define WMT_PIN_VDOUT4 WMT_PIN(4, 12) | ||
138 | #define WMT_PIN_VDOUT5 WMT_PIN(4, 13) | ||
139 | #define WMT_PIN_NANDCLE0 WMT_PIN(4, 14) | ||
140 | #define WMT_PIN_NANDCLE1 WMT_PIN(4, 15) | ||
141 | #define WMT_PIN_VDOUT6_7 WMT_PIN(4, 16) | ||
142 | #define WMT_PIN_VHSYNC WMT_PIN(4, 17) | ||
143 | #define WMT_PIN_VVSYNC WMT_PIN(4, 18) | ||
144 | #define WMT_PIN_TSDIN0 WMT_PIN(5, 8) | ||
145 | #define WMT_PIN_TSDIN1 WMT_PIN(5, 9) | ||
146 | #define WMT_PIN_TSDIN2 WMT_PIN(5, 10) | ||
147 | #define WMT_PIN_TSDIN3 WMT_PIN(5, 11) | ||
148 | #define WMT_PIN_TSDIN4 WMT_PIN(5, 12) | ||
149 | #define WMT_PIN_TSDIN5 WMT_PIN(5, 13) | ||
150 | #define WMT_PIN_TSDIN6 WMT_PIN(5, 14) | ||
151 | #define WMT_PIN_TSDIN7 WMT_PIN(5, 15) | ||
152 | #define WMT_PIN_TSSYNC WMT_PIN(5, 16) | ||
153 | #define WMT_PIN_TSVALID WMT_PIN(5, 17) | ||
154 | #define WMT_PIN_TSCLK WMT_PIN(5, 18) | ||
155 | #define WMT_PIN_LCDD0 WMT_PIN(6, 0) | ||
156 | #define WMT_PIN_LCDD1 WMT_PIN(6, 1) | ||
157 | #define WMT_PIN_LCDD2 WMT_PIN(6, 2) | ||
158 | #define WMT_PIN_LCDD3 WMT_PIN(6, 3) | ||
159 | #define WMT_PIN_LCDD4 WMT_PIN(6, 4) | ||
160 | #define WMT_PIN_LCDD5 WMT_PIN(6, 5) | ||
161 | #define WMT_PIN_LCDD6 WMT_PIN(6, 6) | ||
162 | #define WMT_PIN_LCDD7 WMT_PIN(6, 7) | ||
163 | #define WMT_PIN_LCDD8 WMT_PIN(6, 8) | ||
164 | #define WMT_PIN_LCDD9 WMT_PIN(6, 9) | ||
165 | #define WMT_PIN_LCDD10 WMT_PIN(6, 10) | ||
166 | #define WMT_PIN_LCDD11 WMT_PIN(6, 11) | ||
167 | #define WMT_PIN_LCDD12 WMT_PIN(6, 12) | ||
168 | #define WMT_PIN_LCDD13 WMT_PIN(6, 13) | ||
169 | #define WMT_PIN_LCDD14 WMT_PIN(6, 14) | ||
170 | #define WMT_PIN_LCDD15 WMT_PIN(6, 15) | ||
171 | #define WMT_PIN_LCDD16 WMT_PIN(6, 16) | ||
172 | #define WMT_PIN_LCDD17 WMT_PIN(6, 17) | ||
173 | #define WMT_PIN_LCDCLK WMT_PIN(6, 18) | ||
174 | #define WMT_PIN_LCDDEN WMT_PIN(6, 19) | ||
175 | #define WMT_PIN_LCDLINE WMT_PIN(6, 20) | ||
176 | #define WMT_PIN_LCDFRM WMT_PIN(6, 21) | ||
177 | #define WMT_PIN_LCDBIAS WMT_PIN(6, 22) | ||
178 | |||
179 | static const struct pinctrl_pin_desc vt8500_pins[] = { | ||
180 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
181 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
182 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
183 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
184 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
185 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
186 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
187 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
188 | PINCTRL_PIN(WMT_PIN_EXTGPIO8, "extgpio8"), | ||
189 | PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), | ||
190 | PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), | ||
191 | PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), | ||
192 | PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), | ||
193 | PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), | ||
194 | PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), | ||
195 | PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), | ||
196 | PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), | ||
197 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
198 | PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), | ||
199 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
200 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
201 | PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), | ||
202 | PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), | ||
203 | PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), | ||
204 | PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), | ||
205 | PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), | ||
206 | PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), | ||
207 | PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), | ||
208 | PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), | ||
209 | PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), | ||
210 | PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), | ||
211 | PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), | ||
212 | PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), | ||
213 | PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), | ||
214 | PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), | ||
215 | PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), | ||
216 | PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), | ||
217 | PINCTRL_PIN(WMT_PIN_SDCLK, "sd_clk"), | ||
218 | PINCTRL_PIN(WMT_PIN_SDWP, "sd_wp"), | ||
219 | PINCTRL_PIN(WMT_PIN_SDCMD, "sd_cmd"), | ||
220 | PINCTRL_PIN(WMT_PIN_MSDATA0, "ms_data0"), | ||
221 | PINCTRL_PIN(WMT_PIN_MSDATA1, "ms_data1"), | ||
222 | PINCTRL_PIN(WMT_PIN_MSDATA2, "ms_data2"), | ||
223 | PINCTRL_PIN(WMT_PIN_MSDATA3, "ms_data3"), | ||
224 | PINCTRL_PIN(WMT_PIN_MSCLK, "ms_clk"), | ||
225 | PINCTRL_PIN(WMT_PIN_MSBS, "ms_bs"), | ||
226 | PINCTRL_PIN(WMT_PIN_MSINS, "ms_ins"), | ||
227 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
228 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
229 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
230 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
231 | PINCTRL_PIN(WMT_PIN_MII0RXD0, "mii0_rxd0"), | ||
232 | PINCTRL_PIN(WMT_PIN_MII0RXD1, "mii0_rxd1"), | ||
233 | PINCTRL_PIN(WMT_PIN_MII0RXD2, "mii0_rxd2"), | ||
234 | PINCTRL_PIN(WMT_PIN_MII0RXD3, "mii0_rxd3"), | ||
235 | PINCTRL_PIN(WMT_PIN_MII0RXCLK, "mii0_rxclk"), | ||
236 | PINCTRL_PIN(WMT_PIN_MII0RXDV, "mii0_rxdv"), | ||
237 | PINCTRL_PIN(WMT_PIN_MII0RXERR, "mii0_rxerr"), | ||
238 | PINCTRL_PIN(WMT_PIN_MII0PHYRST, "mii0_phyrst"), | ||
239 | PINCTRL_PIN(WMT_PIN_MII0TXD0, "mii0_txd0"), | ||
240 | PINCTRL_PIN(WMT_PIN_MII0TXD1, "mii0_txd1"), | ||
241 | PINCTRL_PIN(WMT_PIN_MII0TXD2, "mii0_txd2"), | ||
242 | PINCTRL_PIN(WMT_PIN_MII0TXD3, "mii0_txd3"), | ||
243 | PINCTRL_PIN(WMT_PIN_MII0TXCLK, "mii0_txclk"), | ||
244 | PINCTRL_PIN(WMT_PIN_MII0TXEN, "mii0_txen"), | ||
245 | PINCTRL_PIN(WMT_PIN_MII0TXERR, "mii0_txerr"), | ||
246 | PINCTRL_PIN(WMT_PIN_MII0PHYPD, "mii0_phypd"), | ||
247 | PINCTRL_PIN(WMT_PIN_MII0COL, "mii0_col"), | ||
248 | PINCTRL_PIN(WMT_PIN_MII0CRS, "mii0_crs"), | ||
249 | PINCTRL_PIN(WMT_PIN_MII0MDIO, "mii0_mdio"), | ||
250 | PINCTRL_PIN(WMT_PIN_MII0MDC, "mii0_mdc"), | ||
251 | PINCTRL_PIN(WMT_PIN_SEECS, "see_cs"), | ||
252 | PINCTRL_PIN(WMT_PIN_SEECK, "see_ck"), | ||
253 | PINCTRL_PIN(WMT_PIN_SEEDI, "see_di"), | ||
254 | PINCTRL_PIN(WMT_PIN_SEEDO, "see_do"), | ||
255 | PINCTRL_PIN(WMT_PIN_IDEDREQ0, "ide_dreq0"), | ||
256 | PINCTRL_PIN(WMT_PIN_IDEDREQ1, "ide_dreq1"), | ||
257 | PINCTRL_PIN(WMT_PIN_IDEIOW, "ide_iow"), | ||
258 | PINCTRL_PIN(WMT_PIN_IDEIOR, "ide_ior"), | ||
259 | PINCTRL_PIN(WMT_PIN_IDEDACK, "ide_dack"), | ||
260 | PINCTRL_PIN(WMT_PIN_IDEIORDY, "ide_iordy"), | ||
261 | PINCTRL_PIN(WMT_PIN_IDEINTRQ, "ide_intrq"), | ||
262 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
263 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
264 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
265 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
266 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
267 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
268 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
269 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
270 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
271 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
272 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
273 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
274 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
275 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
276 | PINCTRL_PIN(WMT_PIN_NANDCLE0, "nand_cle0"), | ||
277 | PINCTRL_PIN(WMT_PIN_NANDCLE1, "nand_cle1"), | ||
278 | PINCTRL_PIN(WMT_PIN_VDOUT6_7, "vdout6_7"), | ||
279 | PINCTRL_PIN(WMT_PIN_VHSYNC, "vhsync"), | ||
280 | PINCTRL_PIN(WMT_PIN_VVSYNC, "vvsync"), | ||
281 | PINCTRL_PIN(WMT_PIN_TSDIN0, "tsdin0"), | ||
282 | PINCTRL_PIN(WMT_PIN_TSDIN1, "tsdin1"), | ||
283 | PINCTRL_PIN(WMT_PIN_TSDIN2, "tsdin2"), | ||
284 | PINCTRL_PIN(WMT_PIN_TSDIN3, "tsdin3"), | ||
285 | PINCTRL_PIN(WMT_PIN_TSDIN4, "tsdin4"), | ||
286 | PINCTRL_PIN(WMT_PIN_TSDIN5, "tsdin5"), | ||
287 | PINCTRL_PIN(WMT_PIN_TSDIN6, "tsdin6"), | ||
288 | PINCTRL_PIN(WMT_PIN_TSDIN7, "tsdin7"), | ||
289 | PINCTRL_PIN(WMT_PIN_TSSYNC, "tssync"), | ||
290 | PINCTRL_PIN(WMT_PIN_TSVALID, "tsvalid"), | ||
291 | PINCTRL_PIN(WMT_PIN_TSCLK, "tsclk"), | ||
292 | PINCTRL_PIN(WMT_PIN_LCDD0, "lcd_d0"), | ||
293 | PINCTRL_PIN(WMT_PIN_LCDD1, "lcd_d1"), | ||
294 | PINCTRL_PIN(WMT_PIN_LCDD2, "lcd_d2"), | ||
295 | PINCTRL_PIN(WMT_PIN_LCDD3, "lcd_d3"), | ||
296 | PINCTRL_PIN(WMT_PIN_LCDD4, "lcd_d4"), | ||
297 | PINCTRL_PIN(WMT_PIN_LCDD5, "lcd_d5"), | ||
298 | PINCTRL_PIN(WMT_PIN_LCDD6, "lcd_d6"), | ||
299 | PINCTRL_PIN(WMT_PIN_LCDD7, "lcd_d7"), | ||
300 | PINCTRL_PIN(WMT_PIN_LCDD8, "lcd_d8"), | ||
301 | PINCTRL_PIN(WMT_PIN_LCDD9, "lcd_d9"), | ||
302 | PINCTRL_PIN(WMT_PIN_LCDD10, "lcd_d10"), | ||
303 | PINCTRL_PIN(WMT_PIN_LCDD11, "lcd_d11"), | ||
304 | PINCTRL_PIN(WMT_PIN_LCDD12, "lcd_d12"), | ||
305 | PINCTRL_PIN(WMT_PIN_LCDD13, "lcd_d13"), | ||
306 | PINCTRL_PIN(WMT_PIN_LCDD14, "lcd_d14"), | ||
307 | PINCTRL_PIN(WMT_PIN_LCDD15, "lcd_d15"), | ||
308 | PINCTRL_PIN(WMT_PIN_LCDD16, "lcd_d16"), | ||
309 | PINCTRL_PIN(WMT_PIN_LCDD17, "lcd_d17"), | ||
310 | PINCTRL_PIN(WMT_PIN_LCDCLK, "lcd_clk"), | ||
311 | PINCTRL_PIN(WMT_PIN_LCDDEN, "lcd_den"), | ||
312 | PINCTRL_PIN(WMT_PIN_LCDLINE, "lcd_line"), | ||
313 | PINCTRL_PIN(WMT_PIN_LCDFRM, "lcd_frm"), | ||
314 | PINCTRL_PIN(WMT_PIN_LCDBIAS, "lcd_bias"), | ||
315 | }; | ||
316 | |||
317 | /* Order of these names must match the above list */ | ||
318 | static const char * const vt8500_groups[] = { | ||
319 | "extgpio0", | ||
320 | "extgpio1", | ||
321 | "extgpio2", | ||
322 | "extgpio3", | ||
323 | "extgpio4", | ||
324 | "extgpio5", | ||
325 | "extgpio6", | ||
326 | "extgpio7", | ||
327 | "extgpio8", | ||
328 | "uart0_rts", | ||
329 | "uart0_txd", | ||
330 | "uart0_cts", | ||
331 | "uart0_rxd", | ||
332 | "uart1_rts", | ||
333 | "uart1_txd", | ||
334 | "uart1_cts", | ||
335 | "uart1_rxd", | ||
336 | "spi0_clk", | ||
337 | "spi0_ss", | ||
338 | "spi0_miso", | ||
339 | "spi0_mosi", | ||
340 | "spi1_clk", | ||
341 | "spi1_ss", | ||
342 | "spi1_miso", | ||
343 | "spi1_mosi", | ||
344 | "spi2_clk", | ||
345 | "spi2_ss", | ||
346 | "spi2_miso", | ||
347 | "spi2_mosi", | ||
348 | "sd_data0", | ||
349 | "sd_data1", | ||
350 | "sd_data2", | ||
351 | "sd_data3", | ||
352 | "mmc_data0", | ||
353 | "mmc_data1", | ||
354 | "mmc_data2", | ||
355 | "mmc_data3", | ||
356 | "sd_clk", | ||
357 | "sd_wp", | ||
358 | "sd_cmd", | ||
359 | "ms_data0", | ||
360 | "ms_data1", | ||
361 | "ms_data2", | ||
362 | "ms_data3", | ||
363 | "ms_clk", | ||
364 | "ms_bs", | ||
365 | "ms_ins", | ||
366 | "i2c0_scl", | ||
367 | "i2c0_sda", | ||
368 | "i2c1_scl", | ||
369 | "i2c1_sda", | ||
370 | "mii0_rxd0", | ||
371 | "mii0_rxd1", | ||
372 | "mii0_rxd2", | ||
373 | "mii0_rxd3", | ||
374 | "mii0_rxclk", | ||
375 | "mii0_rxdv", | ||
376 | "mii0_rxerr", | ||
377 | "mii0_phyrst", | ||
378 | "mii0_txd0", | ||
379 | "mii0_txd1", | ||
380 | "mii0_txd2", | ||
381 | "mii0_txd3", | ||
382 | "mii0_txclk", | ||
383 | "mii0_txen", | ||
384 | "mii0_txerr", | ||
385 | "mii0_phypd", | ||
386 | "mii0_col", | ||
387 | "mii0_crs", | ||
388 | "mii0_mdio", | ||
389 | "mii0_mdc", | ||
390 | "see_cs", | ||
391 | "see_ck", | ||
392 | "see_di", | ||
393 | "see_do", | ||
394 | "ide_dreq0", | ||
395 | "ide_dreq1", | ||
396 | "ide_iow", | ||
397 | "ide_ior", | ||
398 | "ide_dack", | ||
399 | "ide_iordy", | ||
400 | "ide_intrq", | ||
401 | "vdin0", | ||
402 | "vdin1", | ||
403 | "vdin2", | ||
404 | "vdin3", | ||
405 | "vdin4", | ||
406 | "vdin5", | ||
407 | "vdin6", | ||
408 | "vdin7", | ||
409 | "vdout0", | ||
410 | "vdout1", | ||
411 | "vdout2", | ||
412 | "vdout3", | ||
413 | "vdout4", | ||
414 | "vdout5", | ||
415 | "nand_cle0", | ||
416 | "nand_cle1", | ||
417 | "vdout6_7", | ||
418 | "vhsync", | ||
419 | "vvsync", | ||
420 | "tsdin0", | ||
421 | "tsdin1", | ||
422 | "tsdin2", | ||
423 | "tsdin3", | ||
424 | "tsdin4", | ||
425 | "tsdin5", | ||
426 | "tsdin6", | ||
427 | "tsdin7", | ||
428 | "tssync", | ||
429 | "tsvalid", | ||
430 | "tsclk", | ||
431 | "lcd_d0", | ||
432 | "lcd_d1", | ||
433 | "lcd_d2", | ||
434 | "lcd_d3", | ||
435 | "lcd_d4", | ||
436 | "lcd_d5", | ||
437 | "lcd_d6", | ||
438 | "lcd_d7", | ||
439 | "lcd_d8", | ||
440 | "lcd_d9", | ||
441 | "lcd_d10", | ||
442 | "lcd_d11", | ||
443 | "lcd_d12", | ||
444 | "lcd_d13", | ||
445 | "lcd_d14", | ||
446 | "lcd_d15", | ||
447 | "lcd_d16", | ||
448 | "lcd_d17", | ||
449 | "lcd_clk", | ||
450 | "lcd_den", | ||
451 | "lcd_line", | ||
452 | "lcd_frm", | ||
453 | "lcd_bias", | ||
454 | }; | ||
455 | |||
456 | static int vt8500_pinctrl_probe(struct platform_device *pdev) | ||
457 | { | ||
458 | struct wmt_pinctrl_data *data; | ||
459 | |||
460 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
461 | if (!data) { | ||
462 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
463 | return -ENOMEM; | ||
464 | } | ||
465 | |||
466 | data->banks = vt8500_banks; | ||
467 | data->nbanks = ARRAY_SIZE(vt8500_banks); | ||
468 | data->pins = vt8500_pins; | ||
469 | data->npins = ARRAY_SIZE(vt8500_pins); | ||
470 | data->groups = vt8500_groups; | ||
471 | data->ngroups = ARRAY_SIZE(vt8500_groups); | ||
472 | |||
473 | return wmt_pinctrl_probe(pdev, data); | ||
474 | } | ||
475 | |||
476 | static int vt8500_pinctrl_remove(struct platform_device *pdev) | ||
477 | { | ||
478 | return wmt_pinctrl_remove(pdev); | ||
479 | } | ||
480 | |||
481 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
482 | { .compatible = "via,vt8500-pinctrl" }, | ||
483 | { /* sentinel */ }, | ||
484 | }; | ||
485 | |||
486 | static struct platform_driver wmt_pinctrl_driver = { | ||
487 | .probe = vt8500_pinctrl_probe, | ||
488 | .remove = vt8500_pinctrl_remove, | ||
489 | .driver = { | ||
490 | .name = "pinctrl-vt8500", | ||
491 | .owner = THIS_MODULE, | ||
492 | .of_match_table = wmt_pinctrl_of_match, | ||
493 | }, | ||
494 | }; | ||
495 | |||
496 | module_platform_driver(wmt_pinctrl_driver); | ||
497 | |||
498 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
499 | MODULE_DESCRIPTION("VIA VT8500 Pincontrol driver"); | ||
500 | MODULE_LICENSE("GPL v2"); | ||
501 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8505.c b/drivers/pinctrl/vt8500/pinctrl-wm8505.c new file mode 100644 index 000000000000..483ba732694e --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8505.c | |||
@@ -0,0 +1,532 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8505 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8505_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x64, 0x8C, 0xB4, 0xDC, NO_REG, NO_REG), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x40, 0x68, 0x90, 0xB8, NO_REG, NO_REG), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x44, 0x6C, 0x94, 0xBC, NO_REG, NO_REG), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x48, 0x70, 0x98, 0xC0, NO_REG, NO_REG), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x4C, 0x74, 0x9C, 0xC4, NO_REG, NO_REG), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x50, 0x78, 0xA0, 0xC8, NO_REG, NO_REG), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x54, 0x7C, 0xA4, 0xD0, NO_REG, NO_REG), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x58, 0x80, 0xA8, 0xD4, NO_REG, NO_REG), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x5C, 0x84, 0xAC, 0xD8, NO_REG, NO_REG), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x60, 0x88, 0xB0, 0xDC, NO_REG, NO_REG), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x500, 0x504, 0x508, 0x50C, NO_REG, NO_REG), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
57 | #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) | ||
58 | #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) | ||
59 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
60 | #define WMT_PIN_SDDATA0 WMT_PIN(1, 0) | ||
61 | #define WMT_PIN_SDDATA1 WMT_PIN(1, 1) | ||
62 | #define WMT_PIN_SDDATA2 WMT_PIN(1, 2) | ||
63 | #define WMT_PIN_SDDATA3 WMT_PIN(1, 3) | ||
64 | #define WMT_PIN_MMCDATA0 WMT_PIN(1, 4) | ||
65 | #define WMT_PIN_MMCDATA1 WMT_PIN(1, 5) | ||
66 | #define WMT_PIN_MMCDATA2 WMT_PIN(1, 6) | ||
67 | #define WMT_PIN_MMCDATA3 WMT_PIN(1, 7) | ||
68 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
69 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
70 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
71 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
72 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
73 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
74 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
75 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
76 | #define WMT_PIN_VDOUT0 WMT_PIN(2, 8) | ||
77 | #define WMT_PIN_VDOUT1 WMT_PIN(2, 9) | ||
78 | #define WMT_PIN_VDOUT2 WMT_PIN(2, 10) | ||
79 | #define WMT_PIN_VDOUT3 WMT_PIN(2, 11) | ||
80 | #define WMT_PIN_VDOUT4 WMT_PIN(2, 12) | ||
81 | #define WMT_PIN_VDOUT5 WMT_PIN(2, 13) | ||
82 | #define WMT_PIN_VDOUT6 WMT_PIN(2, 14) | ||
83 | #define WMT_PIN_VDOUT7 WMT_PIN(2, 15) | ||
84 | #define WMT_PIN_VDOUT8 WMT_PIN(2, 16) | ||
85 | #define WMT_PIN_VDOUT9 WMT_PIN(2, 17) | ||
86 | #define WMT_PIN_VDOUT10 WMT_PIN(2, 18) | ||
87 | #define WMT_PIN_VDOUT11 WMT_PIN(2, 19) | ||
88 | #define WMT_PIN_VDOUT12 WMT_PIN(2, 20) | ||
89 | #define WMT_PIN_VDOUT13 WMT_PIN(2, 21) | ||
90 | #define WMT_PIN_VDOUT14 WMT_PIN(2, 22) | ||
91 | #define WMT_PIN_VDOUT15 WMT_PIN(2, 23) | ||
92 | #define WMT_PIN_VDOUT16 WMT_PIN(2, 24) | ||
93 | #define WMT_PIN_VDOUT17 WMT_PIN(2, 25) | ||
94 | #define WMT_PIN_VDOUT18 WMT_PIN(2, 26) | ||
95 | #define WMT_PIN_VDOUT19 WMT_PIN(2, 27) | ||
96 | #define WMT_PIN_VDOUT20 WMT_PIN(2, 28) | ||
97 | #define WMT_PIN_VDOUT21 WMT_PIN(2, 29) | ||
98 | #define WMT_PIN_VDOUT22 WMT_PIN(2, 30) | ||
99 | #define WMT_PIN_VDOUT23 WMT_PIN(2, 31) | ||
100 | #define WMT_PIN_VHSYNC WMT_PIN(3, 0) | ||
101 | #define WMT_PIN_VVSYNC WMT_PIN(3, 1) | ||
102 | #define WMT_PIN_VGAHSYNC WMT_PIN(3, 2) | ||
103 | #define WMT_PIN_VGAVSYNC WMT_PIN(3, 3) | ||
104 | #define WMT_PIN_VDHSYNC WMT_PIN(3, 4) | ||
105 | #define WMT_PIN_VDVSYNC WMT_PIN(3, 5) | ||
106 | #define WMT_PIN_NORD0 WMT_PIN(4, 0) | ||
107 | #define WMT_PIN_NORD1 WMT_PIN(4, 1) | ||
108 | #define WMT_PIN_NORD2 WMT_PIN(4, 2) | ||
109 | #define WMT_PIN_NORD3 WMT_PIN(4, 3) | ||
110 | #define WMT_PIN_NORD4 WMT_PIN(4, 4) | ||
111 | #define WMT_PIN_NORD5 WMT_PIN(4, 5) | ||
112 | #define WMT_PIN_NORD6 WMT_PIN(4, 6) | ||
113 | #define WMT_PIN_NORD7 WMT_PIN(4, 7) | ||
114 | #define WMT_PIN_NORD8 WMT_PIN(4, 8) | ||
115 | #define WMT_PIN_NORD9 WMT_PIN(4, 9) | ||
116 | #define WMT_PIN_NORD10 WMT_PIN(4, 10) | ||
117 | #define WMT_PIN_NORD11 WMT_PIN(4, 11) | ||
118 | #define WMT_PIN_NORD12 WMT_PIN(4, 12) | ||
119 | #define WMT_PIN_NORD13 WMT_PIN(4, 13) | ||
120 | #define WMT_PIN_NORD14 WMT_PIN(4, 14) | ||
121 | #define WMT_PIN_NORD15 WMT_PIN(4, 15) | ||
122 | #define WMT_PIN_NORA0 WMT_PIN(5, 0) | ||
123 | #define WMT_PIN_NORA1 WMT_PIN(5, 1) | ||
124 | #define WMT_PIN_NORA2 WMT_PIN(5, 2) | ||
125 | #define WMT_PIN_NORA3 WMT_PIN(5, 3) | ||
126 | #define WMT_PIN_NORA4 WMT_PIN(5, 4) | ||
127 | #define WMT_PIN_NORA5 WMT_PIN(5, 5) | ||
128 | #define WMT_PIN_NORA6 WMT_PIN(5, 6) | ||
129 | #define WMT_PIN_NORA7 WMT_PIN(5, 7) | ||
130 | #define WMT_PIN_NORA8 WMT_PIN(5, 8) | ||
131 | #define WMT_PIN_NORA9 WMT_PIN(5, 9) | ||
132 | #define WMT_PIN_NORA10 WMT_PIN(5, 10) | ||
133 | #define WMT_PIN_NORA11 WMT_PIN(5, 11) | ||
134 | #define WMT_PIN_NORA12 WMT_PIN(5, 12) | ||
135 | #define WMT_PIN_NORA13 WMT_PIN(5, 13) | ||
136 | #define WMT_PIN_NORA14 WMT_PIN(5, 14) | ||
137 | #define WMT_PIN_NORA15 WMT_PIN(5, 15) | ||
138 | #define WMT_PIN_NORA16 WMT_PIN(5, 16) | ||
139 | #define WMT_PIN_NORA17 WMT_PIN(5, 17) | ||
140 | #define WMT_PIN_NORA18 WMT_PIN(5, 18) | ||
141 | #define WMT_PIN_NORA19 WMT_PIN(5, 19) | ||
142 | #define WMT_PIN_NORA20 WMT_PIN(5, 20) | ||
143 | #define WMT_PIN_NORA21 WMT_PIN(5, 21) | ||
144 | #define WMT_PIN_NORA22 WMT_PIN(5, 22) | ||
145 | #define WMT_PIN_NORA23 WMT_PIN(5, 23) | ||
146 | #define WMT_PIN_NORA24 WMT_PIN(5, 24) | ||
147 | #define WMT_PIN_AC97SDI WMT_PIN(6, 0) | ||
148 | #define WMT_PIN_AC97SYNC WMT_PIN(6, 1) | ||
149 | #define WMT_PIN_AC97SDO WMT_PIN(6, 2) | ||
150 | #define WMT_PIN_AC97BCLK WMT_PIN(6, 3) | ||
151 | #define WMT_PIN_AC97RST WMT_PIN(6, 4) | ||
152 | #define WMT_PIN_SFDO WMT_PIN(7, 0) | ||
153 | #define WMT_PIN_SFCS0 WMT_PIN(7, 1) | ||
154 | #define WMT_PIN_SFCS1 WMT_PIN(7, 2) | ||
155 | #define WMT_PIN_SFCLK WMT_PIN(7, 3) | ||
156 | #define WMT_PIN_SFDI WMT_PIN(7, 4) | ||
157 | #define WMT_PIN_SPI0CLK WMT_PIN(8, 0) | ||
158 | #define WMT_PIN_SPI0MISO WMT_PIN(8, 1) | ||
159 | #define WMT_PIN_SPI0MOSI WMT_PIN(8, 2) | ||
160 | #define WMT_PIN_SPI0SS WMT_PIN(8, 3) | ||
161 | #define WMT_PIN_SPI1CLK WMT_PIN(8, 4) | ||
162 | #define WMT_PIN_SPI1MISO WMT_PIN(8, 5) | ||
163 | #define WMT_PIN_SPI1MOSI WMT_PIN(8, 6) | ||
164 | #define WMT_PIN_SPI1SS WMT_PIN(8, 7) | ||
165 | #define WMT_PIN_SPI2CLK WMT_PIN(8, 8) | ||
166 | #define WMT_PIN_SPI2MISO WMT_PIN(8, 9) | ||
167 | #define WMT_PIN_SPI2MOSI WMT_PIN(8, 10) | ||
168 | #define WMT_PIN_SPI2SS WMT_PIN(8, 11) | ||
169 | #define WMT_PIN_UART0_RTS WMT_PIN(9, 0) | ||
170 | #define WMT_PIN_UART0_TXD WMT_PIN(9, 1) | ||
171 | #define WMT_PIN_UART0_CTS WMT_PIN(9, 2) | ||
172 | #define WMT_PIN_UART0_RXD WMT_PIN(9, 3) | ||
173 | #define WMT_PIN_UART1_RTS WMT_PIN(9, 4) | ||
174 | #define WMT_PIN_UART1_TXD WMT_PIN(9, 5) | ||
175 | #define WMT_PIN_UART1_CTS WMT_PIN(9, 6) | ||
176 | #define WMT_PIN_UART1_RXD WMT_PIN(9, 7) | ||
177 | #define WMT_PIN_UART2_RTS WMT_PIN(9, 8) | ||
178 | #define WMT_PIN_UART2_TXD WMT_PIN(9, 9) | ||
179 | #define WMT_PIN_UART2_CTS WMT_PIN(9, 10) | ||
180 | #define WMT_PIN_UART2_RXD WMT_PIN(9, 11) | ||
181 | #define WMT_PIN_UART3_RTS WMT_PIN(9, 12) | ||
182 | #define WMT_PIN_UART3_TXD WMT_PIN(9, 13) | ||
183 | #define WMT_PIN_UART3_CTS WMT_PIN(9, 14) | ||
184 | #define WMT_PIN_UART3_RXD WMT_PIN(9, 15) | ||
185 | #define WMT_PIN_I2C0SCL WMT_PIN(10, 0) | ||
186 | #define WMT_PIN_I2C0SDA WMT_PIN(10, 1) | ||
187 | #define WMT_PIN_I2C1SCL WMT_PIN(10, 2) | ||
188 | #define WMT_PIN_I2C1SDA WMT_PIN(10, 3) | ||
189 | #define WMT_PIN_I2C2SCL WMT_PIN(10, 4) | ||
190 | #define WMT_PIN_I2C2SDA WMT_PIN(10, 5) | ||
191 | |||
192 | static const struct pinctrl_pin_desc wm8505_pins[] = { | ||
193 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
194 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
195 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
196 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
197 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
198 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
199 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
200 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
201 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
202 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
203 | PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), | ||
204 | PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), | ||
205 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
206 | PINCTRL_PIN(WMT_PIN_SDDATA0, "sd_data0"), | ||
207 | PINCTRL_PIN(WMT_PIN_SDDATA1, "sd_data1"), | ||
208 | PINCTRL_PIN(WMT_PIN_SDDATA2, "sd_data2"), | ||
209 | PINCTRL_PIN(WMT_PIN_SDDATA3, "sd_data3"), | ||
210 | PINCTRL_PIN(WMT_PIN_MMCDATA0, "mmc_data0"), | ||
211 | PINCTRL_PIN(WMT_PIN_MMCDATA1, "mmc_data1"), | ||
212 | PINCTRL_PIN(WMT_PIN_MMCDATA2, "mmc_data2"), | ||
213 | PINCTRL_PIN(WMT_PIN_MMCDATA3, "mmc_data3"), | ||
214 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
215 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
216 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
217 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
218 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
219 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
220 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
221 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
222 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
223 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
224 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
225 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
226 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
227 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
228 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
229 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
230 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
231 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
232 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
233 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
234 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
235 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
236 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
237 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
238 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
239 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
240 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
241 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
242 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
243 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
244 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
245 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
246 | PINCTRL_PIN(WMT_PIN_VHSYNC, "v_hsync"), | ||
247 | PINCTRL_PIN(WMT_PIN_VVSYNC, "v_vsync"), | ||
248 | PINCTRL_PIN(WMT_PIN_VGAHSYNC, "vga_hsync"), | ||
249 | PINCTRL_PIN(WMT_PIN_VGAVSYNC, "vga_vsync"), | ||
250 | PINCTRL_PIN(WMT_PIN_VDHSYNC, "vd_hsync"), | ||
251 | PINCTRL_PIN(WMT_PIN_VDVSYNC, "vd_vsync"), | ||
252 | PINCTRL_PIN(WMT_PIN_NORD0, "nor_d0"), | ||
253 | PINCTRL_PIN(WMT_PIN_NORD1, "nor_d1"), | ||
254 | PINCTRL_PIN(WMT_PIN_NORD2, "nor_d2"), | ||
255 | PINCTRL_PIN(WMT_PIN_NORD3, "nor_d3"), | ||
256 | PINCTRL_PIN(WMT_PIN_NORD4, "nor_d4"), | ||
257 | PINCTRL_PIN(WMT_PIN_NORD5, "nor_d5"), | ||
258 | PINCTRL_PIN(WMT_PIN_NORD6, "nor_d6"), | ||
259 | PINCTRL_PIN(WMT_PIN_NORD7, "nor_d7"), | ||
260 | PINCTRL_PIN(WMT_PIN_NORD8, "nor_d8"), | ||
261 | PINCTRL_PIN(WMT_PIN_NORD9, "nor_d9"), | ||
262 | PINCTRL_PIN(WMT_PIN_NORD10, "nor_d10"), | ||
263 | PINCTRL_PIN(WMT_PIN_NORD11, "nor_d11"), | ||
264 | PINCTRL_PIN(WMT_PIN_NORD12, "nor_d12"), | ||
265 | PINCTRL_PIN(WMT_PIN_NORD13, "nor_d13"), | ||
266 | PINCTRL_PIN(WMT_PIN_NORD14, "nor_d14"), | ||
267 | PINCTRL_PIN(WMT_PIN_NORD15, "nor_d15"), | ||
268 | PINCTRL_PIN(WMT_PIN_NORA0, "nor_a0"), | ||
269 | PINCTRL_PIN(WMT_PIN_NORA1, "nor_a1"), | ||
270 | PINCTRL_PIN(WMT_PIN_NORA2, "nor_a2"), | ||
271 | PINCTRL_PIN(WMT_PIN_NORA3, "nor_a3"), | ||
272 | PINCTRL_PIN(WMT_PIN_NORA4, "nor_a4"), | ||
273 | PINCTRL_PIN(WMT_PIN_NORA5, "nor_a5"), | ||
274 | PINCTRL_PIN(WMT_PIN_NORA6, "nor_a6"), | ||
275 | PINCTRL_PIN(WMT_PIN_NORA7, "nor_a7"), | ||
276 | PINCTRL_PIN(WMT_PIN_NORA8, "nor_a8"), | ||
277 | PINCTRL_PIN(WMT_PIN_NORA9, "nor_a9"), | ||
278 | PINCTRL_PIN(WMT_PIN_NORA10, "nor_a10"), | ||
279 | PINCTRL_PIN(WMT_PIN_NORA11, "nor_a11"), | ||
280 | PINCTRL_PIN(WMT_PIN_NORA12, "nor_a12"), | ||
281 | PINCTRL_PIN(WMT_PIN_NORA13, "nor_a13"), | ||
282 | PINCTRL_PIN(WMT_PIN_NORA14, "nor_a14"), | ||
283 | PINCTRL_PIN(WMT_PIN_NORA15, "nor_a15"), | ||
284 | PINCTRL_PIN(WMT_PIN_NORA16, "nor_a16"), | ||
285 | PINCTRL_PIN(WMT_PIN_NORA17, "nor_a17"), | ||
286 | PINCTRL_PIN(WMT_PIN_NORA18, "nor_a18"), | ||
287 | PINCTRL_PIN(WMT_PIN_NORA19, "nor_a19"), | ||
288 | PINCTRL_PIN(WMT_PIN_NORA20, "nor_a20"), | ||
289 | PINCTRL_PIN(WMT_PIN_NORA21, "nor_a21"), | ||
290 | PINCTRL_PIN(WMT_PIN_NORA22, "nor_a22"), | ||
291 | PINCTRL_PIN(WMT_PIN_NORA23, "nor_a23"), | ||
292 | PINCTRL_PIN(WMT_PIN_NORA24, "nor_a24"), | ||
293 | PINCTRL_PIN(WMT_PIN_AC97SDI, "ac97_sdi"), | ||
294 | PINCTRL_PIN(WMT_PIN_AC97SYNC, "ac97_sync"), | ||
295 | PINCTRL_PIN(WMT_PIN_AC97SDO, "ac97_sdo"), | ||
296 | PINCTRL_PIN(WMT_PIN_AC97BCLK, "ac97_bclk"), | ||
297 | PINCTRL_PIN(WMT_PIN_AC97RST, "ac97_rst"), | ||
298 | PINCTRL_PIN(WMT_PIN_SFDO, "sf_do"), | ||
299 | PINCTRL_PIN(WMT_PIN_SFCS0, "sf_cs0"), | ||
300 | PINCTRL_PIN(WMT_PIN_SFCS1, "sf_cs1"), | ||
301 | PINCTRL_PIN(WMT_PIN_SFCLK, "sf_clk"), | ||
302 | PINCTRL_PIN(WMT_PIN_SFDI, "sf_di"), | ||
303 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
304 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
305 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
306 | PINCTRL_PIN(WMT_PIN_SPI0SS, "spi0_ss"), | ||
307 | PINCTRL_PIN(WMT_PIN_SPI1CLK, "spi1_clk"), | ||
308 | PINCTRL_PIN(WMT_PIN_SPI1MISO, "spi1_miso"), | ||
309 | PINCTRL_PIN(WMT_PIN_SPI1MOSI, "spi1_mosi"), | ||
310 | PINCTRL_PIN(WMT_PIN_SPI1SS, "spi1_ss"), | ||
311 | PINCTRL_PIN(WMT_PIN_SPI2CLK, "spi2_clk"), | ||
312 | PINCTRL_PIN(WMT_PIN_SPI2MISO, "spi2_miso"), | ||
313 | PINCTRL_PIN(WMT_PIN_SPI2MOSI, "spi2_mosi"), | ||
314 | PINCTRL_PIN(WMT_PIN_SPI2SS, "spi2_ss"), | ||
315 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
316 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
317 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
318 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
319 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
320 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
321 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
322 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
323 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
324 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
325 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
326 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
327 | PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), | ||
328 | PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), | ||
329 | PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), | ||
330 | PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), | ||
331 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
332 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
333 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
334 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
335 | PINCTRL_PIN(WMT_PIN_I2C2SCL, "i2c2_scl"), | ||
336 | PINCTRL_PIN(WMT_PIN_I2C2SDA, "i2c2_sda"), | ||
337 | }; | ||
338 | |||
339 | /* Order of these names must match the above list */ | ||
340 | static const char * const wm8505_groups[] = { | ||
341 | "extgpio0", | ||
342 | "extgpio1", | ||
343 | "extgpio2", | ||
344 | "extgpio3", | ||
345 | "extgpio4", | ||
346 | "extgpio5", | ||
347 | "extgpio6", | ||
348 | "extgpio7", | ||
349 | "wakeup0", | ||
350 | "wakeup1", | ||
351 | "wakeup2", | ||
352 | "wakeup3", | ||
353 | "susgpio0", | ||
354 | "sd_data0", | ||
355 | "sd_data1", | ||
356 | "sd_data2", | ||
357 | "sd_data3", | ||
358 | "mmc_data0", | ||
359 | "mmc_data1", | ||
360 | "mmc_data2", | ||
361 | "mmc_data3", | ||
362 | "vdin0", | ||
363 | "vdin1", | ||
364 | "vdin2", | ||
365 | "vdin3", | ||
366 | "vdin4", | ||
367 | "vdin5", | ||
368 | "vdin6", | ||
369 | "vdin7", | ||
370 | "vdout0", | ||
371 | "vdout1", | ||
372 | "vdout2", | ||
373 | "vdout3", | ||
374 | "vdout4", | ||
375 | "vdout5", | ||
376 | "vdout6", | ||
377 | "vdout7", | ||
378 | "vdout8", | ||
379 | "vdout9", | ||
380 | "vdout10", | ||
381 | "vdout11", | ||
382 | "vdout12", | ||
383 | "vdout13", | ||
384 | "vdout14", | ||
385 | "vdout15", | ||
386 | "vdout16", | ||
387 | "vdout17", | ||
388 | "vdout18", | ||
389 | "vdout19", | ||
390 | "vdout20", | ||
391 | "vdout21", | ||
392 | "vdout22", | ||
393 | "vdout23", | ||
394 | "v_hsync", | ||
395 | "v_vsync", | ||
396 | "vga_hsync", | ||
397 | "vga_vsync", | ||
398 | "vd_hsync", | ||
399 | "vd_vsync", | ||
400 | "nor_d0", | ||
401 | "nor_d1", | ||
402 | "nor_d2", | ||
403 | "nor_d3", | ||
404 | "nor_d4", | ||
405 | "nor_d5", | ||
406 | "nor_d6", | ||
407 | "nor_d7", | ||
408 | "nor_d8", | ||
409 | "nor_d9", | ||
410 | "nor_d10", | ||
411 | "nor_d11", | ||
412 | "nor_d12", | ||
413 | "nor_d13", | ||
414 | "nor_d14", | ||
415 | "nor_d15", | ||
416 | "nor_a0", | ||
417 | "nor_a1", | ||
418 | "nor_a2", | ||
419 | "nor_a3", | ||
420 | "nor_a4", | ||
421 | "nor_a5", | ||
422 | "nor_a6", | ||
423 | "nor_a7", | ||
424 | "nor_a8", | ||
425 | "nor_a9", | ||
426 | "nor_a10", | ||
427 | "nor_a11", | ||
428 | "nor_a12", | ||
429 | "nor_a13", | ||
430 | "nor_a14", | ||
431 | "nor_a15", | ||
432 | "nor_a16", | ||
433 | "nor_a17", | ||
434 | "nor_a18", | ||
435 | "nor_a19", | ||
436 | "nor_a20", | ||
437 | "nor_a21", | ||
438 | "nor_a22", | ||
439 | "nor_a23", | ||
440 | "nor_a24", | ||
441 | "ac97_sdi", | ||
442 | "ac97_sync", | ||
443 | "ac97_sdo", | ||
444 | "ac97_bclk", | ||
445 | "ac97_rst", | ||
446 | "sf_do", | ||
447 | "sf_cs0", | ||
448 | "sf_cs1", | ||
449 | "sf_clk", | ||
450 | "sf_di", | ||
451 | "spi0_clk", | ||
452 | "spi0_miso", | ||
453 | "spi0_mosi", | ||
454 | "spi0_ss", | ||
455 | "spi1_clk", | ||
456 | "spi1_miso", | ||
457 | "spi1_mosi", | ||
458 | "spi1_ss", | ||
459 | "spi2_clk", | ||
460 | "spi2_miso", | ||
461 | "spi2_mosi", | ||
462 | "spi2_ss", | ||
463 | "uart0_rts", | ||
464 | "uart0_txd", | ||
465 | "uart0_cts", | ||
466 | "uart0_rxd", | ||
467 | "uart1_rts", | ||
468 | "uart1_txd", | ||
469 | "uart1_cts", | ||
470 | "uart1_rxd", | ||
471 | "uart2_rts", | ||
472 | "uart2_txd", | ||
473 | "uart2_cts", | ||
474 | "uart2_rxd", | ||
475 | "uart3_rts", | ||
476 | "uart3_txd", | ||
477 | "uart3_cts", | ||
478 | "uart3_rxd", | ||
479 | "i2c0_scl", | ||
480 | "i2c0_sda", | ||
481 | "i2c1_scl", | ||
482 | "i2c1_sda", | ||
483 | "i2c2_scl", | ||
484 | "i2c2_sda", | ||
485 | }; | ||
486 | |||
487 | static int wm8505_pinctrl_probe(struct platform_device *pdev) | ||
488 | { | ||
489 | struct wmt_pinctrl_data *data; | ||
490 | |||
491 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
492 | if (!data) { | ||
493 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
494 | return -ENOMEM; | ||
495 | } | ||
496 | |||
497 | data->banks = wm8505_banks; | ||
498 | data->nbanks = ARRAY_SIZE(wm8505_banks); | ||
499 | data->pins = wm8505_pins; | ||
500 | data->npins = ARRAY_SIZE(wm8505_pins); | ||
501 | data->groups = wm8505_groups; | ||
502 | data->ngroups = ARRAY_SIZE(wm8505_groups); | ||
503 | |||
504 | return wmt_pinctrl_probe(pdev, data); | ||
505 | } | ||
506 | |||
507 | static int wm8505_pinctrl_remove(struct platform_device *pdev) | ||
508 | { | ||
509 | return wmt_pinctrl_remove(pdev); | ||
510 | } | ||
511 | |||
512 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
513 | { .compatible = "wm,wm8505-pinctrl" }, | ||
514 | { /* sentinel */ }, | ||
515 | }; | ||
516 | |||
517 | static struct platform_driver wmt_pinctrl_driver = { | ||
518 | .probe = wm8505_pinctrl_probe, | ||
519 | .remove = wm8505_pinctrl_remove, | ||
520 | .driver = { | ||
521 | .name = "pinctrl-wm8505", | ||
522 | .owner = THIS_MODULE, | ||
523 | .of_match_table = wmt_pinctrl_of_match, | ||
524 | }, | ||
525 | }; | ||
526 | |||
527 | module_platform_driver(wmt_pinctrl_driver); | ||
528 | |||
529 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
530 | MODULE_DESCRIPTION("Wondermedia WM8505 Pincontrol driver"); | ||
531 | MODULE_LICENSE("GPL v2"); | ||
532 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8650.c b/drivers/pinctrl/vt8500/pinctrl-wm8650.c new file mode 100644 index 000000000000..7de57f063153 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8650.c | |||
@@ -0,0 +1,370 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8650 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8650_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | }; | ||
42 | |||
43 | /* Please keep sorted by bank/bit */ | ||
44 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
45 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
46 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
47 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
48 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
49 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
50 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
51 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
52 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
53 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
54 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
55 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
56 | #define WMT_PIN_SD1CD WMT_PIN(0, 29) | ||
57 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
58 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
59 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
60 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
61 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
62 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
63 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
64 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
65 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
66 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
67 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
68 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
69 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
70 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
71 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
72 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
73 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
74 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
75 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
76 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
77 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
78 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
79 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
80 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
81 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
82 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
83 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
84 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
85 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
86 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
87 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
88 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
89 | #define WMT_PIN_I2C1SCL WMT_PIN(2, 12) | ||
90 | #define WMT_PIN_I2C1SDA WMT_PIN(2, 13) | ||
91 | #define WMT_PIN_SPI0MOSI WMT_PIN(2, 24) | ||
92 | #define WMT_PIN_SPI0MISO WMT_PIN(2, 25) | ||
93 | #define WMT_PIN_SPI0SS0 WMT_PIN(2, 26) | ||
94 | #define WMT_PIN_SPI0CLK WMT_PIN(2, 27) | ||
95 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 8) | ||
96 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 9) | ||
97 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 10) | ||
98 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 11) | ||
99 | #define WMT_PIN_SD0CLK WMT_PIN(3, 12) | ||
100 | #define WMT_PIN_SD0WP WMT_PIN(3, 13) | ||
101 | #define WMT_PIN_SD0CMD WMT_PIN(3, 14) | ||
102 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
103 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
104 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
105 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
106 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
107 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
108 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
109 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
110 | #define WMT_PIN_I2C0SCL WMT_PIN(5, 8) | ||
111 | #define WMT_PIN_I2C0SDA WMT_PIN(5, 9) | ||
112 | #define WMT_PIN_UART0RTS WMT_PIN(5, 16) | ||
113 | #define WMT_PIN_UART0TXD WMT_PIN(5, 17) | ||
114 | #define WMT_PIN_UART0CTS WMT_PIN(5, 18) | ||
115 | #define WMT_PIN_UART0RXD WMT_PIN(5, 19) | ||
116 | #define WMT_PIN_UART1RTS WMT_PIN(5, 20) | ||
117 | #define WMT_PIN_UART1TXD WMT_PIN(5, 21) | ||
118 | #define WMT_PIN_UART1CTS WMT_PIN(5, 22) | ||
119 | #define WMT_PIN_UART1RXD WMT_PIN(5, 23) | ||
120 | #define WMT_PIN_UART2RTS WMT_PIN(5, 24) | ||
121 | #define WMT_PIN_UART2TXD WMT_PIN(5, 25) | ||
122 | #define WMT_PIN_UART2CTS WMT_PIN(5, 26) | ||
123 | #define WMT_PIN_UART2RXD WMT_PIN(5, 27) | ||
124 | #define WMT_PIN_UART3RTS WMT_PIN(5, 28) | ||
125 | #define WMT_PIN_UART3TXD WMT_PIN(5, 29) | ||
126 | #define WMT_PIN_UART3CTS WMT_PIN(5, 30) | ||
127 | #define WMT_PIN_UART3RXD WMT_PIN(5, 31) | ||
128 | #define WMT_PIN_KPADROW0 WMT_PIN(6, 16) | ||
129 | #define WMT_PIN_KPADROW1 WMT_PIN(6, 17) | ||
130 | #define WMT_PIN_KPADCOL0 WMT_PIN(6, 18) | ||
131 | #define WMT_PIN_KPADCOL1 WMT_PIN(6, 19) | ||
132 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
133 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
134 | #define WMT_PIN_SD1WP WMT_PIN(7, 13) | ||
135 | |||
136 | static const struct pinctrl_pin_desc wm8650_pins[] = { | ||
137 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
138 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
139 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
140 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
141 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
142 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
143 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
144 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
145 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
146 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
147 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
148 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
149 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
150 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
151 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
152 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
153 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
154 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
155 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
156 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
157 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
158 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
159 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
160 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
161 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
162 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
182 | PINCTRL_PIN(WMT_PIN_I2C1SCL, "i2c1_scl"), | ||
183 | PINCTRL_PIN(WMT_PIN_I2C1SDA, "i2c1_sda"), | ||
184 | PINCTRL_PIN(WMT_PIN_SPI0MOSI, "spi0_mosi"), | ||
185 | PINCTRL_PIN(WMT_PIN_SPI0MISO, "spi0_miso"), | ||
186 | PINCTRL_PIN(WMT_PIN_SPI0SS0, "spi0_ss0"), | ||
187 | PINCTRL_PIN(WMT_PIN_SPI0CLK, "spi0_clk"), | ||
188 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
189 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
190 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
191 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
192 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
193 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
194 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
195 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
196 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
197 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
198 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
199 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
203 | PINCTRL_PIN(WMT_PIN_I2C0SCL, "i2c0_scl"), | ||
204 | PINCTRL_PIN(WMT_PIN_I2C0SDA, "i2c0_sda"), | ||
205 | PINCTRL_PIN(WMT_PIN_UART0RTS, "uart0_rts"), | ||
206 | PINCTRL_PIN(WMT_PIN_UART0TXD, "uart0_txd"), | ||
207 | PINCTRL_PIN(WMT_PIN_UART0CTS, "uart0_cts"), | ||
208 | PINCTRL_PIN(WMT_PIN_UART0RXD, "uart0_rxd"), | ||
209 | PINCTRL_PIN(WMT_PIN_UART1RTS, "uart1_rts"), | ||
210 | PINCTRL_PIN(WMT_PIN_UART1TXD, "uart1_txd"), | ||
211 | PINCTRL_PIN(WMT_PIN_UART1CTS, "uart1_cts"), | ||
212 | PINCTRL_PIN(WMT_PIN_UART1RXD, "uart1_rxd"), | ||
213 | PINCTRL_PIN(WMT_PIN_UART2RTS, "uart2_rts"), | ||
214 | PINCTRL_PIN(WMT_PIN_UART2TXD, "uart2_txd"), | ||
215 | PINCTRL_PIN(WMT_PIN_UART2CTS, "uart2_cts"), | ||
216 | PINCTRL_PIN(WMT_PIN_UART2RXD, "uart2_rxd"), | ||
217 | PINCTRL_PIN(WMT_PIN_UART3RTS, "uart3_rts"), | ||
218 | PINCTRL_PIN(WMT_PIN_UART3TXD, "uart3_txd"), | ||
219 | PINCTRL_PIN(WMT_PIN_UART3CTS, "uart3_cts"), | ||
220 | PINCTRL_PIN(WMT_PIN_UART3RXD, "uart3_rxd"), | ||
221 | PINCTRL_PIN(WMT_PIN_KPADROW0, "kpadrow0"), | ||
222 | PINCTRL_PIN(WMT_PIN_KPADROW1, "kpadrow1"), | ||
223 | PINCTRL_PIN(WMT_PIN_KPADCOL0, "kpadcol0"), | ||
224 | PINCTRL_PIN(WMT_PIN_KPADCOL1, "kpadcol1"), | ||
225 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
226 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
227 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
228 | }; | ||
229 | |||
230 | /* Order of these names must match the above list */ | ||
231 | static const char * const wm8650_groups[] = { | ||
232 | "extgpio0", | ||
233 | "extgpio1", | ||
234 | "extgpio2", | ||
235 | "extgpio3", | ||
236 | "extgpio4", | ||
237 | "extgpio5", | ||
238 | "extgpio6", | ||
239 | "extgpio7", | ||
240 | "wakeup0", | ||
241 | "wakeup1", | ||
242 | "susgpio0", | ||
243 | "sd0_cd", | ||
244 | "sd1_cd", | ||
245 | "vdout0", | ||
246 | "vdout1", | ||
247 | "vdout2", | ||
248 | "vdout3", | ||
249 | "vdout4", | ||
250 | "vdout5", | ||
251 | "vdout6", | ||
252 | "vdout7", | ||
253 | "vdout8", | ||
254 | "vdout9", | ||
255 | "vdout10", | ||
256 | "vdout11", | ||
257 | "vdout12", | ||
258 | "vdout13", | ||
259 | "vdout14", | ||
260 | "vdout15", | ||
261 | "vdout16", | ||
262 | "vdout17", | ||
263 | "vdout18", | ||
264 | "vdout19", | ||
265 | "vdout20", | ||
266 | "vdout21", | ||
267 | "vdout22", | ||
268 | "vdout23", | ||
269 | "vdin0", | ||
270 | "vdin1", | ||
271 | "vdin2", | ||
272 | "vdin3", | ||
273 | "vdin4", | ||
274 | "vdin5", | ||
275 | "vdin6", | ||
276 | "vdin7", | ||
277 | "i2c1_scl", | ||
278 | "i2c1_sda", | ||
279 | "spi0_mosi", | ||
280 | "spi0_miso", | ||
281 | "spi0_ss0", | ||
282 | "spi0_clk", | ||
283 | "sd0_data0", | ||
284 | "sd0_data1", | ||
285 | "sd0_data2", | ||
286 | "sd0_data3", | ||
287 | "sd0_clk", | ||
288 | "sd0_wp", | ||
289 | "sd0_cmd", | ||
290 | "sd1_data0", | ||
291 | "sd1_data1", | ||
292 | "sd1_data2", | ||
293 | "sd1_data3", | ||
294 | "sd1_data4", | ||
295 | "sd1_data5", | ||
296 | "sd1_data6", | ||
297 | "sd1_data7", | ||
298 | "i2c0_scl", | ||
299 | "i2c0_sda", | ||
300 | "uart0_rts", | ||
301 | "uart0_txd", | ||
302 | "uart0_cts", | ||
303 | "uart0_rxd", | ||
304 | "uart1_rts", | ||
305 | "uart1_txd", | ||
306 | "uart1_cts", | ||
307 | "uart1_rxd", | ||
308 | "uart2_rts", | ||
309 | "uart2_txd", | ||
310 | "uart2_cts", | ||
311 | "uart2_rxd", | ||
312 | "uart3_rts", | ||
313 | "uart3_txd", | ||
314 | "uart3_cts", | ||
315 | "uart3_rxd", | ||
316 | "kpadrow0", | ||
317 | "kpadrow1", | ||
318 | "kpadcol0", | ||
319 | "kpadcol1", | ||
320 | "sd1_clk", | ||
321 | "sd1_cmd", | ||
322 | "sd1_wp", | ||
323 | }; | ||
324 | |||
325 | static int wm8650_pinctrl_probe(struct platform_device *pdev) | ||
326 | { | ||
327 | struct wmt_pinctrl_data *data; | ||
328 | |||
329 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
330 | if (!data) { | ||
331 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
332 | return -ENOMEM; | ||
333 | } | ||
334 | |||
335 | data->banks = wm8650_banks; | ||
336 | data->nbanks = ARRAY_SIZE(wm8650_banks); | ||
337 | data->pins = wm8650_pins; | ||
338 | data->npins = ARRAY_SIZE(wm8650_pins); | ||
339 | data->groups = wm8650_groups; | ||
340 | data->ngroups = ARRAY_SIZE(wm8650_groups); | ||
341 | |||
342 | return wmt_pinctrl_probe(pdev, data); | ||
343 | } | ||
344 | |||
345 | static int wm8650_pinctrl_remove(struct platform_device *pdev) | ||
346 | { | ||
347 | return wmt_pinctrl_remove(pdev); | ||
348 | } | ||
349 | |||
350 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
351 | { .compatible = "wm,wm8650-pinctrl" }, | ||
352 | { /* sentinel */ }, | ||
353 | }; | ||
354 | |||
355 | static struct platform_driver wmt_pinctrl_driver = { | ||
356 | .probe = wm8650_pinctrl_probe, | ||
357 | .remove = wm8650_pinctrl_remove, | ||
358 | .driver = { | ||
359 | .name = "pinctrl-wm8650", | ||
360 | .owner = THIS_MODULE, | ||
361 | .of_match_table = wmt_pinctrl_of_match, | ||
362 | }, | ||
363 | }; | ||
364 | |||
365 | module_platform_driver(wmt_pinctrl_driver); | ||
366 | |||
367 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
368 | MODULE_DESCRIPTION("Wondermedia WM8650 Pincontrol driver"); | ||
369 | MODULE_LICENSE("GPL v2"); | ||
370 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8750.c b/drivers/pinctrl/vt8500/pinctrl-wm8750.c new file mode 100644 index 000000000000..b964cc550568 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8750.c | |||
@@ -0,0 +1,409 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8750 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8750_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 16) | ||
57 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
58 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
59 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
60 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
61 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
62 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
63 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
64 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
65 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
66 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
67 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
68 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
69 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
70 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
71 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
72 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
73 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
74 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
75 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
76 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
77 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
78 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
79 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
80 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
81 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
82 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
83 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
84 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
85 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
86 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
87 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
88 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
89 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
90 | #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) | ||
91 | #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) | ||
92 | #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) | ||
93 | #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) | ||
94 | #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) | ||
95 | #define WMT_PIN_SD0CLK WMT_PIN(3, 17) | ||
96 | #define WMT_PIN_SD0CMD WMT_PIN(3, 18) | ||
97 | #define WMT_PIN_SD0WP WMT_PIN(3, 19) | ||
98 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) | ||
99 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) | ||
100 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) | ||
101 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) | ||
102 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
103 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
104 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
105 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
106 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
107 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
108 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
109 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
110 | #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) | ||
111 | #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) | ||
112 | #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) | ||
113 | #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) | ||
114 | #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) | ||
115 | #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) | ||
116 | #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) | ||
117 | #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) | ||
118 | #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) | ||
119 | #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) | ||
120 | #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) | ||
121 | #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) | ||
122 | #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) | ||
123 | #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) | ||
124 | #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) | ||
125 | #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) | ||
126 | #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) | ||
127 | #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) | ||
128 | #define WMT_PIN_UART3_RTS WMT_PIN(5, 28) | ||
129 | #define WMT_PIN_UART3_TXD WMT_PIN(5, 29) | ||
130 | #define WMT_PIN_UART3_CTS WMT_PIN(5, 30) | ||
131 | #define WMT_PIN_UART3_RXD WMT_PIN(5, 31) | ||
132 | #define WMT_PIN_SD2CD WMT_PIN(6, 0) | ||
133 | #define WMT_PIN_SD2DATA3 WMT_PIN(6, 1) | ||
134 | #define WMT_PIN_SD2DATA0 WMT_PIN(6, 2) | ||
135 | #define WMT_PIN_SD2WP WMT_PIN(6, 3) | ||
136 | #define WMT_PIN_SD2DATA1 WMT_PIN(6, 4) | ||
137 | #define WMT_PIN_SD2DATA2 WMT_PIN(6, 5) | ||
138 | #define WMT_PIN_SD2CMD WMT_PIN(6, 6) | ||
139 | #define WMT_PIN_SD2CLK WMT_PIN(6, 7) | ||
140 | #define WMT_PIN_SD2PWR WMT_PIN(6, 9) | ||
141 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
142 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
143 | #define WMT_PIN_SD1PWR WMT_PIN(7, 10) | ||
144 | #define WMT_PIN_SD1WP WMT_PIN(7, 11) | ||
145 | #define WMT_PIN_SD1CD WMT_PIN(7, 12) | ||
146 | #define WMT_PIN_SPI0SS3 WMT_PIN(7, 24) | ||
147 | #define WMT_PIN_SPI0SS2 WMT_PIN(7, 25) | ||
148 | #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) | ||
149 | #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) | ||
150 | |||
151 | static const struct pinctrl_pin_desc wm8750_pins[] = { | ||
152 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
153 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
154 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
155 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
156 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
157 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
158 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
159 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
160 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
161 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
162 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
182 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
183 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
184 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
185 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
186 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
187 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
188 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
189 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
190 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
191 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
192 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
193 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
194 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
195 | PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), | ||
196 | PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), | ||
197 | PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), | ||
198 | PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), | ||
199 | PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
203 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
204 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
205 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
206 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
207 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
208 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
209 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
210 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
211 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
212 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
213 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
214 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
215 | PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), | ||
216 | PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), | ||
217 | PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), | ||
218 | PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), | ||
219 | PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), | ||
220 | PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), | ||
221 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
222 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
223 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
224 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
225 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
226 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
227 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
228 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
229 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
230 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
231 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
232 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
233 | PINCTRL_PIN(WMT_PIN_UART3_RTS, "uart3_rts"), | ||
234 | PINCTRL_PIN(WMT_PIN_UART3_TXD, "uart3_txd"), | ||
235 | PINCTRL_PIN(WMT_PIN_UART3_CTS, "uart3_cts"), | ||
236 | PINCTRL_PIN(WMT_PIN_UART3_RXD, "uart3_rxd"), | ||
237 | PINCTRL_PIN(WMT_PIN_SD2CD, "sd2_cd"), | ||
238 | PINCTRL_PIN(WMT_PIN_SD2DATA3, "sd2_data3"), | ||
239 | PINCTRL_PIN(WMT_PIN_SD2DATA0, "sd2_data0"), | ||
240 | PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), | ||
241 | PINCTRL_PIN(WMT_PIN_SD2DATA1, "sd2_data1"), | ||
242 | PINCTRL_PIN(WMT_PIN_SD2DATA2, "sd2_data2"), | ||
243 | PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), | ||
244 | PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), | ||
245 | PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), | ||
246 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
247 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
248 | PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), | ||
249 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
250 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
251 | PINCTRL_PIN(WMT_PIN_SPI0SS3, "spi0_ss3"), | ||
252 | PINCTRL_PIN(WMT_PIN_SPI0SS2, "spi0_ss2"), | ||
253 | PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), | ||
254 | PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), | ||
255 | }; | ||
256 | |||
257 | /* Order of these names must match the above list */ | ||
258 | static const char * const wm8750_groups[] = { | ||
259 | "extgpio0", | ||
260 | "extgpio1", | ||
261 | "extgpio2", | ||
262 | "extgpio3", | ||
263 | "extgpio4", | ||
264 | "extgpio5", | ||
265 | "extgpio6", | ||
266 | "extgpio7", | ||
267 | "wakeup0", | ||
268 | "wakeup1", | ||
269 | "sd0_cd", | ||
270 | "vdout0", | ||
271 | "vdout1", | ||
272 | "vdout2", | ||
273 | "vdout3", | ||
274 | "vdout4", | ||
275 | "vdout5", | ||
276 | "vdout6", | ||
277 | "vdout7", | ||
278 | "vdout8", | ||
279 | "vdout9", | ||
280 | "vdout10", | ||
281 | "vdout11", | ||
282 | "vdout12", | ||
283 | "vdout13", | ||
284 | "vdout14", | ||
285 | "vdout15", | ||
286 | "vdout16", | ||
287 | "vdout17", | ||
288 | "vdout18", | ||
289 | "vdout19", | ||
290 | "vdout20", | ||
291 | "vdout21", | ||
292 | "vdout22", | ||
293 | "vdout23", | ||
294 | "vdin0", | ||
295 | "vdin1", | ||
296 | "vdin2", | ||
297 | "vdin3", | ||
298 | "vdin4", | ||
299 | "vdin5", | ||
300 | "vdin6", | ||
301 | "vdin7", | ||
302 | "spi0_mosi", | ||
303 | "spi0_miso", | ||
304 | "spi0_ss", | ||
305 | "spi0_clk", | ||
306 | "spi0_ssb", | ||
307 | "sd0_clk", | ||
308 | "sd0_cmd", | ||
309 | "sd0_wp", | ||
310 | "sd0_data0", | ||
311 | "sd0_data1", | ||
312 | "sd0_data2", | ||
313 | "sd0_data3", | ||
314 | "sd1_data0", | ||
315 | "sd1_data1", | ||
316 | "sd1_data2", | ||
317 | "sd1_data3", | ||
318 | "sd1_data4", | ||
319 | "sd1_data5", | ||
320 | "sd1_data6", | ||
321 | "sd1_data7", | ||
322 | "i2c0_scl", | ||
323 | "i2c0_sda", | ||
324 | "i2c1_scl", | ||
325 | "i2c1_sda", | ||
326 | "i2c2_scl", | ||
327 | "i2c2_sda", | ||
328 | "uart0_rts", | ||
329 | "uart0_txd", | ||
330 | "uart0_cts", | ||
331 | "uart0_rxd", | ||
332 | "uart1_rts", | ||
333 | "uart1_txd", | ||
334 | "uart1_cts", | ||
335 | "uart1_rxd", | ||
336 | "uart2_rts", | ||
337 | "uart2_txd", | ||
338 | "uart2_cts", | ||
339 | "uart2_rxd", | ||
340 | "uart3_rts", | ||
341 | "uart3_txd", | ||
342 | "uart3_cts", | ||
343 | "uart3_rxd", | ||
344 | "sd2_cd", | ||
345 | "sd2_data3", | ||
346 | "sd2_data0", | ||
347 | "sd2_wp", | ||
348 | "sd2_data1", | ||
349 | "sd2_data2", | ||
350 | "sd2_cmd", | ||
351 | "sd2_clk", | ||
352 | "sd2_pwr", | ||
353 | "sd1_clk", | ||
354 | "sd1_cmd", | ||
355 | "sd1_pwr", | ||
356 | "sd1_wp", | ||
357 | "sd1_cd", | ||
358 | "spi0_ss3", | ||
359 | "spi0_ss2", | ||
360 | "pwmout1", | ||
361 | "pwmout0", | ||
362 | }; | ||
363 | |||
364 | static int wm8750_pinctrl_probe(struct platform_device *pdev) | ||
365 | { | ||
366 | struct wmt_pinctrl_data *data; | ||
367 | |||
368 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
369 | if (!data) { | ||
370 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
371 | return -ENOMEM; | ||
372 | } | ||
373 | |||
374 | data->banks = wm8750_banks; | ||
375 | data->nbanks = ARRAY_SIZE(wm8750_banks); | ||
376 | data->pins = wm8750_pins; | ||
377 | data->npins = ARRAY_SIZE(wm8750_pins); | ||
378 | data->groups = wm8750_groups; | ||
379 | data->ngroups = ARRAY_SIZE(wm8750_groups); | ||
380 | |||
381 | return wmt_pinctrl_probe(pdev, data); | ||
382 | } | ||
383 | |||
384 | static int wm8750_pinctrl_remove(struct platform_device *pdev) | ||
385 | { | ||
386 | return wmt_pinctrl_remove(pdev); | ||
387 | } | ||
388 | |||
389 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
390 | { .compatible = "wm,wm8750-pinctrl" }, | ||
391 | { /* sentinel */ }, | ||
392 | }; | ||
393 | |||
394 | static struct platform_driver wmt_pinctrl_driver = { | ||
395 | .probe = wm8750_pinctrl_probe, | ||
396 | .remove = wm8750_pinctrl_remove, | ||
397 | .driver = { | ||
398 | .name = "pinctrl-wm8750", | ||
399 | .owner = THIS_MODULE, | ||
400 | .of_match_table = wmt_pinctrl_of_match, | ||
401 | }, | ||
402 | }; | ||
403 | |||
404 | module_platform_driver(wmt_pinctrl_driver); | ||
405 | |||
406 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
407 | MODULE_DESCRIPTION("Wondermedia WM8750 Pincontrol driver"); | ||
408 | MODULE_LICENSE("GPL v2"); | ||
409 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wm8850.c b/drivers/pinctrl/vt8500/pinctrl-wm8850.c new file mode 100644 index 000000000000..ecadce9c91d5 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wm8850.c | |||
@@ -0,0 +1,388 @@ | |||
1 | /* | ||
2 | * Pinctrl data for Wondermedia WM8850 SoC | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/pinctrl/pinctrl.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include "pinctrl-wmt.h" | ||
23 | |||
24 | /* | ||
25 | * Describe the register offsets within the GPIO memory space | ||
26 | * The dedicated external GPIO's should always be listed in bank 0 | ||
27 | * so they are exported in the 0..31 range which is what users | ||
28 | * expect. | ||
29 | * | ||
30 | * Do not reorder these banks as it will change the pin numbering | ||
31 | */ | ||
32 | static const struct wmt_pinctrl_bank_registers wm8850_banks[] = { | ||
33 | WMT_PINCTRL_BANK(0x40, 0x80, 0xC0, 0x00, 0x480, 0x4C0), /* 0 */ | ||
34 | WMT_PINCTRL_BANK(0x44, 0x84, 0xC4, 0x04, 0x484, 0x4C4), /* 1 */ | ||
35 | WMT_PINCTRL_BANK(0x48, 0x88, 0xC8, 0x08, 0x488, 0x4C8), /* 2 */ | ||
36 | WMT_PINCTRL_BANK(0x4C, 0x8C, 0xCC, 0x0C, 0x48C, 0x4CC), /* 3 */ | ||
37 | WMT_PINCTRL_BANK(0x50, 0x90, 0xD0, 0x10, 0x490, 0x4D0), /* 4 */ | ||
38 | WMT_PINCTRL_BANK(0x54, 0x94, 0xD4, 0x14, 0x494, 0x4D4), /* 5 */ | ||
39 | WMT_PINCTRL_BANK(0x58, 0x98, 0xD8, 0x18, 0x498, 0x4D8), /* 6 */ | ||
40 | WMT_PINCTRL_BANK(0x5C, 0x9C, 0xDC, 0x1C, 0x49C, 0x4DC), /* 7 */ | ||
41 | WMT_PINCTRL_BANK(0x60, 0xA0, 0xE0, 0x20, 0x4A0, 0x4E0), /* 8 */ | ||
42 | WMT_PINCTRL_BANK(0x70, 0xB0, 0xF0, 0x30, 0x4B0, 0x4F0), /* 9 */ | ||
43 | WMT_PINCTRL_BANK(0x7C, 0xBC, 0xDC, 0x3C, 0x4BC, 0x4FC), /* 10 */ | ||
44 | }; | ||
45 | |||
46 | /* Please keep sorted by bank/bit */ | ||
47 | #define WMT_PIN_EXTGPIO0 WMT_PIN(0, 0) | ||
48 | #define WMT_PIN_EXTGPIO1 WMT_PIN(0, 1) | ||
49 | #define WMT_PIN_EXTGPIO2 WMT_PIN(0, 2) | ||
50 | #define WMT_PIN_EXTGPIO3 WMT_PIN(0, 3) | ||
51 | #define WMT_PIN_EXTGPIO4 WMT_PIN(0, 4) | ||
52 | #define WMT_PIN_EXTGPIO5 WMT_PIN(0, 5) | ||
53 | #define WMT_PIN_EXTGPIO6 WMT_PIN(0, 6) | ||
54 | #define WMT_PIN_EXTGPIO7 WMT_PIN(0, 7) | ||
55 | #define WMT_PIN_WAKEUP0 WMT_PIN(0, 16) | ||
56 | #define WMT_PIN_WAKEUP1 WMT_PIN(0, 17) | ||
57 | #define WMT_PIN_WAKEUP2 WMT_PIN(0, 18) | ||
58 | #define WMT_PIN_WAKEUP3 WMT_PIN(0, 19) | ||
59 | #define WMT_PIN_SUSGPIO0 WMT_PIN(0, 21) | ||
60 | #define WMT_PIN_SUSGPIO1 WMT_PIN(0, 22) | ||
61 | #define WMT_PIN_SD0CD WMT_PIN(0, 28) | ||
62 | #define WMT_PIN_VDOUT0 WMT_PIN(1, 0) | ||
63 | #define WMT_PIN_VDOUT1 WMT_PIN(1, 1) | ||
64 | #define WMT_PIN_VDOUT2 WMT_PIN(1, 2) | ||
65 | #define WMT_PIN_VDOUT3 WMT_PIN(1, 3) | ||
66 | #define WMT_PIN_VDOUT4 WMT_PIN(1, 4) | ||
67 | #define WMT_PIN_VDOUT5 WMT_PIN(1, 5) | ||
68 | #define WMT_PIN_VDOUT6 WMT_PIN(1, 6) | ||
69 | #define WMT_PIN_VDOUT7 WMT_PIN(1, 7) | ||
70 | #define WMT_PIN_VDOUT8 WMT_PIN(1, 8) | ||
71 | #define WMT_PIN_VDOUT9 WMT_PIN(1, 9) | ||
72 | #define WMT_PIN_VDOUT10 WMT_PIN(1, 10) | ||
73 | #define WMT_PIN_VDOUT11 WMT_PIN(1, 11) | ||
74 | #define WMT_PIN_VDOUT12 WMT_PIN(1, 12) | ||
75 | #define WMT_PIN_VDOUT13 WMT_PIN(1, 13) | ||
76 | #define WMT_PIN_VDOUT14 WMT_PIN(1, 14) | ||
77 | #define WMT_PIN_VDOUT15 WMT_PIN(1, 15) | ||
78 | #define WMT_PIN_VDOUT16 WMT_PIN(1, 16) | ||
79 | #define WMT_PIN_VDOUT17 WMT_PIN(1, 17) | ||
80 | #define WMT_PIN_VDOUT18 WMT_PIN(1, 18) | ||
81 | #define WMT_PIN_VDOUT19 WMT_PIN(1, 19) | ||
82 | #define WMT_PIN_VDOUT20 WMT_PIN(1, 20) | ||
83 | #define WMT_PIN_VDOUT21 WMT_PIN(1, 21) | ||
84 | #define WMT_PIN_VDOUT22 WMT_PIN(1, 22) | ||
85 | #define WMT_PIN_VDOUT23 WMT_PIN(1, 23) | ||
86 | #define WMT_PIN_VDIN0 WMT_PIN(2, 0) | ||
87 | #define WMT_PIN_VDIN1 WMT_PIN(2, 1) | ||
88 | #define WMT_PIN_VDIN2 WMT_PIN(2, 2) | ||
89 | #define WMT_PIN_VDIN3 WMT_PIN(2, 3) | ||
90 | #define WMT_PIN_VDIN4 WMT_PIN(2, 4) | ||
91 | #define WMT_PIN_VDIN5 WMT_PIN(2, 5) | ||
92 | #define WMT_PIN_VDIN6 WMT_PIN(2, 6) | ||
93 | #define WMT_PIN_VDIN7 WMT_PIN(2, 7) | ||
94 | #define WMT_PIN_SPI0_MOSI WMT_PIN(2, 24) | ||
95 | #define WMT_PIN_SPI0_MISO WMT_PIN(2, 25) | ||
96 | #define WMT_PIN_SPI0_SS WMT_PIN(2, 26) | ||
97 | #define WMT_PIN_SPI0_CLK WMT_PIN(2, 27) | ||
98 | #define WMT_PIN_SPI0_SSB WMT_PIN(2, 28) | ||
99 | #define WMT_PIN_SD0CLK WMT_PIN(3, 17) | ||
100 | #define WMT_PIN_SD0CMD WMT_PIN(3, 18) | ||
101 | #define WMT_PIN_SD0WP WMT_PIN(3, 19) | ||
102 | #define WMT_PIN_SD0DATA0 WMT_PIN(3, 20) | ||
103 | #define WMT_PIN_SD0DATA1 WMT_PIN(3, 21) | ||
104 | #define WMT_PIN_SD0DATA2 WMT_PIN(3, 22) | ||
105 | #define WMT_PIN_SD0DATA3 WMT_PIN(3, 23) | ||
106 | #define WMT_PIN_SD1DATA0 WMT_PIN(3, 24) | ||
107 | #define WMT_PIN_SD1DATA1 WMT_PIN(3, 25) | ||
108 | #define WMT_PIN_SD1DATA2 WMT_PIN(3, 26) | ||
109 | #define WMT_PIN_SD1DATA3 WMT_PIN(3, 27) | ||
110 | #define WMT_PIN_SD1DATA4 WMT_PIN(3, 28) | ||
111 | #define WMT_PIN_SD1DATA5 WMT_PIN(3, 29) | ||
112 | #define WMT_PIN_SD1DATA6 WMT_PIN(3, 30) | ||
113 | #define WMT_PIN_SD1DATA7 WMT_PIN(3, 31) | ||
114 | #define WMT_PIN_I2C0_SCL WMT_PIN(5, 8) | ||
115 | #define WMT_PIN_I2C0_SDA WMT_PIN(5, 9) | ||
116 | #define WMT_PIN_I2C1_SCL WMT_PIN(5, 10) | ||
117 | #define WMT_PIN_I2C1_SDA WMT_PIN(5, 11) | ||
118 | #define WMT_PIN_I2C2_SCL WMT_PIN(5, 12) | ||
119 | #define WMT_PIN_I2C2_SDA WMT_PIN(5, 13) | ||
120 | #define WMT_PIN_UART0_RTS WMT_PIN(5, 16) | ||
121 | #define WMT_PIN_UART0_TXD WMT_PIN(5, 17) | ||
122 | #define WMT_PIN_UART0_CTS WMT_PIN(5, 18) | ||
123 | #define WMT_PIN_UART0_RXD WMT_PIN(5, 19) | ||
124 | #define WMT_PIN_UART1_RTS WMT_PIN(5, 20) | ||
125 | #define WMT_PIN_UART1_TXD WMT_PIN(5, 21) | ||
126 | #define WMT_PIN_UART1_CTS WMT_PIN(5, 22) | ||
127 | #define WMT_PIN_UART1_RXD WMT_PIN(5, 23) | ||
128 | #define WMT_PIN_UART2_RTS WMT_PIN(5, 24) | ||
129 | #define WMT_PIN_UART2_TXD WMT_PIN(5, 25) | ||
130 | #define WMT_PIN_UART2_CTS WMT_PIN(5, 26) | ||
131 | #define WMT_PIN_UART2_RXD WMT_PIN(5, 27) | ||
132 | #define WMT_PIN_SD2WP WMT_PIN(6, 3) | ||
133 | #define WMT_PIN_SD2CMD WMT_PIN(6, 6) | ||
134 | #define WMT_PIN_SD2CLK WMT_PIN(6, 7) | ||
135 | #define WMT_PIN_SD2PWR WMT_PIN(6, 9) | ||
136 | #define WMT_PIN_SD1CLK WMT_PIN(7, 0) | ||
137 | #define WMT_PIN_SD1CMD WMT_PIN(7, 1) | ||
138 | #define WMT_PIN_SD1PWR WMT_PIN(7, 10) | ||
139 | #define WMT_PIN_SD1WP WMT_PIN(7, 11) | ||
140 | #define WMT_PIN_SD1CD WMT_PIN(7, 12) | ||
141 | #define WMT_PIN_PWMOUT1 WMT_PIN(7, 26) | ||
142 | #define WMT_PIN_PWMOUT0 WMT_PIN(7, 27) | ||
143 | |||
144 | static const struct pinctrl_pin_desc wm8850_pins[] = { | ||
145 | PINCTRL_PIN(WMT_PIN_EXTGPIO0, "extgpio0"), | ||
146 | PINCTRL_PIN(WMT_PIN_EXTGPIO1, "extgpio1"), | ||
147 | PINCTRL_PIN(WMT_PIN_EXTGPIO2, "extgpio2"), | ||
148 | PINCTRL_PIN(WMT_PIN_EXTGPIO3, "extgpio3"), | ||
149 | PINCTRL_PIN(WMT_PIN_EXTGPIO4, "extgpio4"), | ||
150 | PINCTRL_PIN(WMT_PIN_EXTGPIO5, "extgpio5"), | ||
151 | PINCTRL_PIN(WMT_PIN_EXTGPIO6, "extgpio6"), | ||
152 | PINCTRL_PIN(WMT_PIN_EXTGPIO7, "extgpio7"), | ||
153 | PINCTRL_PIN(WMT_PIN_WAKEUP0, "wakeup0"), | ||
154 | PINCTRL_PIN(WMT_PIN_WAKEUP1, "wakeup1"), | ||
155 | PINCTRL_PIN(WMT_PIN_WAKEUP2, "wakeup2"), | ||
156 | PINCTRL_PIN(WMT_PIN_WAKEUP3, "wakeup3"), | ||
157 | PINCTRL_PIN(WMT_PIN_SUSGPIO0, "susgpio0"), | ||
158 | PINCTRL_PIN(WMT_PIN_SUSGPIO1, "susgpio1"), | ||
159 | PINCTRL_PIN(WMT_PIN_SD0CD, "sd0_cd"), | ||
160 | PINCTRL_PIN(WMT_PIN_VDOUT0, "vdout0"), | ||
161 | PINCTRL_PIN(WMT_PIN_VDOUT1, "vdout1"), | ||
162 | PINCTRL_PIN(WMT_PIN_VDOUT2, "vdout2"), | ||
163 | PINCTRL_PIN(WMT_PIN_VDOUT3, "vdout3"), | ||
164 | PINCTRL_PIN(WMT_PIN_VDOUT4, "vdout4"), | ||
165 | PINCTRL_PIN(WMT_PIN_VDOUT5, "vdout5"), | ||
166 | PINCTRL_PIN(WMT_PIN_VDOUT6, "vdout6"), | ||
167 | PINCTRL_PIN(WMT_PIN_VDOUT7, "vdout7"), | ||
168 | PINCTRL_PIN(WMT_PIN_VDOUT8, "vdout8"), | ||
169 | PINCTRL_PIN(WMT_PIN_VDOUT9, "vdout9"), | ||
170 | PINCTRL_PIN(WMT_PIN_VDOUT10, "vdout10"), | ||
171 | PINCTRL_PIN(WMT_PIN_VDOUT11, "vdout11"), | ||
172 | PINCTRL_PIN(WMT_PIN_VDOUT12, "vdout12"), | ||
173 | PINCTRL_PIN(WMT_PIN_VDOUT13, "vdout13"), | ||
174 | PINCTRL_PIN(WMT_PIN_VDOUT14, "vdout14"), | ||
175 | PINCTRL_PIN(WMT_PIN_VDOUT15, "vdout15"), | ||
176 | PINCTRL_PIN(WMT_PIN_VDOUT16, "vdout16"), | ||
177 | PINCTRL_PIN(WMT_PIN_VDOUT17, "vdout17"), | ||
178 | PINCTRL_PIN(WMT_PIN_VDOUT18, "vdout18"), | ||
179 | PINCTRL_PIN(WMT_PIN_VDOUT19, "vdout19"), | ||
180 | PINCTRL_PIN(WMT_PIN_VDOUT20, "vdout20"), | ||
181 | PINCTRL_PIN(WMT_PIN_VDOUT21, "vdout21"), | ||
182 | PINCTRL_PIN(WMT_PIN_VDOUT22, "vdout22"), | ||
183 | PINCTRL_PIN(WMT_PIN_VDOUT23, "vdout23"), | ||
184 | PINCTRL_PIN(WMT_PIN_VDIN0, "vdin0"), | ||
185 | PINCTRL_PIN(WMT_PIN_VDIN1, "vdin1"), | ||
186 | PINCTRL_PIN(WMT_PIN_VDIN2, "vdin2"), | ||
187 | PINCTRL_PIN(WMT_PIN_VDIN3, "vdin3"), | ||
188 | PINCTRL_PIN(WMT_PIN_VDIN4, "vdin4"), | ||
189 | PINCTRL_PIN(WMT_PIN_VDIN5, "vdin5"), | ||
190 | PINCTRL_PIN(WMT_PIN_VDIN6, "vdin6"), | ||
191 | PINCTRL_PIN(WMT_PIN_VDIN7, "vdin7"), | ||
192 | PINCTRL_PIN(WMT_PIN_SPI0_MOSI, "spi0_mosi"), | ||
193 | PINCTRL_PIN(WMT_PIN_SPI0_MISO, "spi0_miso"), | ||
194 | PINCTRL_PIN(WMT_PIN_SPI0_SS, "spi0_ss"), | ||
195 | PINCTRL_PIN(WMT_PIN_SPI0_CLK, "spi0_clk"), | ||
196 | PINCTRL_PIN(WMT_PIN_SPI0_SSB, "spi0_ssb"), | ||
197 | PINCTRL_PIN(WMT_PIN_SD0CLK, "sd0_clk"), | ||
198 | PINCTRL_PIN(WMT_PIN_SD0CMD, "sd0_cmd"), | ||
199 | PINCTRL_PIN(WMT_PIN_SD0WP, "sd0_wp"), | ||
200 | PINCTRL_PIN(WMT_PIN_SD0DATA0, "sd0_data0"), | ||
201 | PINCTRL_PIN(WMT_PIN_SD0DATA1, "sd0_data1"), | ||
202 | PINCTRL_PIN(WMT_PIN_SD0DATA2, "sd0_data2"), | ||
203 | PINCTRL_PIN(WMT_PIN_SD0DATA3, "sd0_data3"), | ||
204 | PINCTRL_PIN(WMT_PIN_SD1DATA0, "sd1_data0"), | ||
205 | PINCTRL_PIN(WMT_PIN_SD1DATA1, "sd1_data1"), | ||
206 | PINCTRL_PIN(WMT_PIN_SD1DATA2, "sd1_data2"), | ||
207 | PINCTRL_PIN(WMT_PIN_SD1DATA3, "sd1_data3"), | ||
208 | PINCTRL_PIN(WMT_PIN_SD1DATA4, "sd1_data4"), | ||
209 | PINCTRL_PIN(WMT_PIN_SD1DATA5, "sd1_data5"), | ||
210 | PINCTRL_PIN(WMT_PIN_SD1DATA6, "sd1_data6"), | ||
211 | PINCTRL_PIN(WMT_PIN_SD1DATA7, "sd1_data7"), | ||
212 | PINCTRL_PIN(WMT_PIN_I2C0_SCL, "i2c0_scl"), | ||
213 | PINCTRL_PIN(WMT_PIN_I2C0_SDA, "i2c0_sda"), | ||
214 | PINCTRL_PIN(WMT_PIN_I2C1_SCL, "i2c1_scl"), | ||
215 | PINCTRL_PIN(WMT_PIN_I2C1_SDA, "i2c1_sda"), | ||
216 | PINCTRL_PIN(WMT_PIN_I2C2_SCL, "i2c2_scl"), | ||
217 | PINCTRL_PIN(WMT_PIN_I2C2_SDA, "i2c2_sda"), | ||
218 | PINCTRL_PIN(WMT_PIN_UART0_RTS, "uart0_rts"), | ||
219 | PINCTRL_PIN(WMT_PIN_UART0_TXD, "uart0_txd"), | ||
220 | PINCTRL_PIN(WMT_PIN_UART0_CTS, "uart0_cts"), | ||
221 | PINCTRL_PIN(WMT_PIN_UART0_RXD, "uart0_rxd"), | ||
222 | PINCTRL_PIN(WMT_PIN_UART1_RTS, "uart1_rts"), | ||
223 | PINCTRL_PIN(WMT_PIN_UART1_TXD, "uart1_txd"), | ||
224 | PINCTRL_PIN(WMT_PIN_UART1_CTS, "uart1_cts"), | ||
225 | PINCTRL_PIN(WMT_PIN_UART1_RXD, "uart1_rxd"), | ||
226 | PINCTRL_PIN(WMT_PIN_UART2_RTS, "uart2_rts"), | ||
227 | PINCTRL_PIN(WMT_PIN_UART2_TXD, "uart2_txd"), | ||
228 | PINCTRL_PIN(WMT_PIN_UART2_CTS, "uart2_cts"), | ||
229 | PINCTRL_PIN(WMT_PIN_UART2_RXD, "uart2_rxd"), | ||
230 | PINCTRL_PIN(WMT_PIN_SD2WP, "sd2_wp"), | ||
231 | PINCTRL_PIN(WMT_PIN_SD2CMD, "sd2_cmd"), | ||
232 | PINCTRL_PIN(WMT_PIN_SD2CLK, "sd2_clk"), | ||
233 | PINCTRL_PIN(WMT_PIN_SD2PWR, "sd2_pwr"), | ||
234 | PINCTRL_PIN(WMT_PIN_SD1CLK, "sd1_clk"), | ||
235 | PINCTRL_PIN(WMT_PIN_SD1CMD, "sd1_cmd"), | ||
236 | PINCTRL_PIN(WMT_PIN_SD1PWR, "sd1_pwr"), | ||
237 | PINCTRL_PIN(WMT_PIN_SD1WP, "sd1_wp"), | ||
238 | PINCTRL_PIN(WMT_PIN_SD1CD, "sd1_cd"), | ||
239 | PINCTRL_PIN(WMT_PIN_PWMOUT1, "pwmout1"), | ||
240 | PINCTRL_PIN(WMT_PIN_PWMOUT0, "pwmout0"), | ||
241 | }; | ||
242 | |||
243 | /* Order of these names must match the above list */ | ||
244 | static const char * const wm8850_groups[] = { | ||
245 | "extgpio0", | ||
246 | "extgpio1", | ||
247 | "extgpio2", | ||
248 | "extgpio3", | ||
249 | "extgpio4", | ||
250 | "extgpio5", | ||
251 | "extgpio6", | ||
252 | "extgpio7", | ||
253 | "wakeup0", | ||
254 | "wakeup1", | ||
255 | "wakeup2", | ||
256 | "wakeup3", | ||
257 | "susgpio0", | ||
258 | "susgpio1", | ||
259 | "sd0_cd", | ||
260 | "vdout0", | ||
261 | "vdout1", | ||
262 | "vdout2", | ||
263 | "vdout3", | ||
264 | "vdout4", | ||
265 | "vdout5", | ||
266 | "vdout6", | ||
267 | "vdout7", | ||
268 | "vdout8", | ||
269 | "vdout9", | ||
270 | "vdout10", | ||
271 | "vdout11", | ||
272 | "vdout12", | ||
273 | "vdout13", | ||
274 | "vdout14", | ||
275 | "vdout15", | ||
276 | "vdout16", | ||
277 | "vdout17", | ||
278 | "vdout18", | ||
279 | "vdout19", | ||
280 | "vdout20", | ||
281 | "vdout21", | ||
282 | "vdout22", | ||
283 | "vdout23", | ||
284 | "vdin0", | ||
285 | "vdin1", | ||
286 | "vdin2", | ||
287 | "vdin3", | ||
288 | "vdin4", | ||
289 | "vdin5", | ||
290 | "vdin6", | ||
291 | "vdin7", | ||
292 | "spi0_mosi", | ||
293 | "spi0_miso", | ||
294 | "spi0_ss", | ||
295 | "spi0_clk", | ||
296 | "spi0_ssb", | ||
297 | "sd0_clk", | ||
298 | "sd0_cmd", | ||
299 | "sd0_wp", | ||
300 | "sd0_data0", | ||
301 | "sd0_data1", | ||
302 | "sd0_data2", | ||
303 | "sd0_data3", | ||
304 | "sd1_data0", | ||
305 | "sd1_data1", | ||
306 | "sd1_data2", | ||
307 | "sd1_data3", | ||
308 | "sd1_data4", | ||
309 | "sd1_data5", | ||
310 | "sd1_data6", | ||
311 | "sd1_data7", | ||
312 | "i2c0_scl", | ||
313 | "i2c0_sda", | ||
314 | "i2c1_scl", | ||
315 | "i2c1_sda", | ||
316 | "i2c2_scl", | ||
317 | "i2c2_sda", | ||
318 | "uart0_rts", | ||
319 | "uart0_txd", | ||
320 | "uart0_cts", | ||
321 | "uart0_rxd", | ||
322 | "uart1_rts", | ||
323 | "uart1_txd", | ||
324 | "uart1_cts", | ||
325 | "uart1_rxd", | ||
326 | "uart2_rts", | ||
327 | "uart2_txd", | ||
328 | "uart2_cts", | ||
329 | "uart2_rxd", | ||
330 | "sd2_wp", | ||
331 | "sd2_cmd", | ||
332 | "sd2_clk", | ||
333 | "sd2_pwr", | ||
334 | "sd1_clk", | ||
335 | "sd1_cmd", | ||
336 | "sd1_pwr", | ||
337 | "sd1_wp", | ||
338 | "sd1_cd", | ||
339 | "pwmout1", | ||
340 | "pwmout0", | ||
341 | }; | ||
342 | |||
343 | static int wm8850_pinctrl_probe(struct platform_device *pdev) | ||
344 | { | ||
345 | struct wmt_pinctrl_data *data; | ||
346 | |||
347 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
348 | if (!data) { | ||
349 | dev_err(&pdev->dev, "failed to allocate data\n"); | ||
350 | return -ENOMEM; | ||
351 | } | ||
352 | |||
353 | data->banks = wm8850_banks; | ||
354 | data->nbanks = ARRAY_SIZE(wm8850_banks); | ||
355 | data->pins = wm8850_pins; | ||
356 | data->npins = ARRAY_SIZE(wm8850_pins); | ||
357 | data->groups = wm8850_groups; | ||
358 | data->ngroups = ARRAY_SIZE(wm8850_groups); | ||
359 | |||
360 | return wmt_pinctrl_probe(pdev, data); | ||
361 | } | ||
362 | |||
363 | static int wm8850_pinctrl_remove(struct platform_device *pdev) | ||
364 | { | ||
365 | return wmt_pinctrl_remove(pdev); | ||
366 | } | ||
367 | |||
368 | static struct of_device_id wmt_pinctrl_of_match[] = { | ||
369 | { .compatible = "wm,wm8850-pinctrl" }, | ||
370 | { /* sentinel */ }, | ||
371 | }; | ||
372 | |||
373 | static struct platform_driver wmt_pinctrl_driver = { | ||
374 | .probe = wm8850_pinctrl_probe, | ||
375 | .remove = wm8850_pinctrl_remove, | ||
376 | .driver = { | ||
377 | .name = "pinctrl-wm8850", | ||
378 | .owner = THIS_MODULE, | ||
379 | .of_match_table = wmt_pinctrl_of_match, | ||
380 | }, | ||
381 | }; | ||
382 | |||
383 | module_platform_driver(wmt_pinctrl_driver); | ||
384 | |||
385 | MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); | ||
386 | MODULE_DESCRIPTION("Wondermedia WM8850 Pincontrol driver"); | ||
387 | MODULE_LICENSE("GPL v2"); | ||
388 | MODULE_DEVICE_TABLE(of, wmt_pinctrl_of_match); | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c new file mode 100644 index 000000000000..14400a7974bd --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c | |||
@@ -0,0 +1,632 @@ | |||
1 | /* | ||
2 | * Pinctrl driver for the Wondermedia SoC's | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/err.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/pinctrl/consumer.h> | ||
25 | #include <linux/pinctrl/machine.h> | ||
26 | #include <linux/pinctrl/pinconf.h> | ||
27 | #include <linux/pinctrl/pinconf-generic.h> | ||
28 | #include <linux/pinctrl/pinctrl.h> | ||
29 | #include <linux/pinctrl/pinmux.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/slab.h> | ||
32 | |||
33 | #include "pinctrl-wmt.h" | ||
34 | |||
35 | static inline void wmt_setbits(struct wmt_pinctrl_data *data, u32 reg, | ||
36 | u32 mask) | ||
37 | { | ||
38 | u32 val; | ||
39 | |||
40 | val = readl_relaxed(data->base + reg); | ||
41 | val |= mask; | ||
42 | writel_relaxed(val, data->base + reg); | ||
43 | } | ||
44 | |||
45 | static inline void wmt_clearbits(struct wmt_pinctrl_data *data, u32 reg, | ||
46 | u32 mask) | ||
47 | { | ||
48 | u32 val; | ||
49 | |||
50 | val = readl_relaxed(data->base + reg); | ||
51 | val &= ~mask; | ||
52 | writel_relaxed(val, data->base + reg); | ||
53 | } | ||
54 | |||
55 | enum wmt_func_sel { | ||
56 | WMT_FSEL_GPIO_IN = 0, | ||
57 | WMT_FSEL_GPIO_OUT = 1, | ||
58 | WMT_FSEL_ALT = 2, | ||
59 | WMT_FSEL_COUNT = 3, | ||
60 | }; | ||
61 | |||
62 | static const char * const wmt_functions[WMT_FSEL_COUNT] = { | ||
63 | [WMT_FSEL_GPIO_IN] = "gpio_in", | ||
64 | [WMT_FSEL_GPIO_OUT] = "gpio_out", | ||
65 | [WMT_FSEL_ALT] = "alt", | ||
66 | }; | ||
67 | |||
68 | static int wmt_pmx_get_functions_count(struct pinctrl_dev *pctldev) | ||
69 | { | ||
70 | return WMT_FSEL_COUNT; | ||
71 | } | ||
72 | |||
73 | static const char *wmt_pmx_get_function_name(struct pinctrl_dev *pctldev, | ||
74 | unsigned selector) | ||
75 | { | ||
76 | return wmt_functions[selector]; | ||
77 | } | ||
78 | |||
79 | static int wmt_pmx_get_function_groups(struct pinctrl_dev *pctldev, | ||
80 | unsigned selector, | ||
81 | const char * const **groups, | ||
82 | unsigned * const num_groups) | ||
83 | { | ||
84 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
85 | |||
86 | /* every pin does every function */ | ||
87 | *groups = data->groups; | ||
88 | *num_groups = data->ngroups; | ||
89 | |||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | static int wmt_set_pinmux(struct wmt_pinctrl_data *data, unsigned func, | ||
94 | unsigned pin) | ||
95 | { | ||
96 | u32 bank = WMT_BANK_FROM_PIN(pin); | ||
97 | u32 bit = WMT_BIT_FROM_PIN(pin); | ||
98 | u32 reg_en = data->banks[bank].reg_en; | ||
99 | u32 reg_dir = data->banks[bank].reg_dir; | ||
100 | |||
101 | if (reg_dir == NO_REG) { | ||
102 | dev_err(data->dev, "pin:%d no direction register defined\n", | ||
103 | pin); | ||
104 | return -EINVAL; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * If reg_en == NO_REG, we assume it is a dedicated GPIO and cannot be | ||
109 | * disabled (as on VT8500) and that no alternate function is available. | ||
110 | */ | ||
111 | switch (func) { | ||
112 | case WMT_FSEL_GPIO_IN: | ||
113 | if (reg_en != NO_REG) | ||
114 | wmt_setbits(data, reg_en, BIT(bit)); | ||
115 | wmt_clearbits(data, reg_dir, BIT(bit)); | ||
116 | break; | ||
117 | case WMT_FSEL_GPIO_OUT: | ||
118 | if (reg_en != NO_REG) | ||
119 | wmt_setbits(data, reg_en, BIT(bit)); | ||
120 | wmt_setbits(data, reg_dir, BIT(bit)); | ||
121 | break; | ||
122 | case WMT_FSEL_ALT: | ||
123 | if (reg_en == NO_REG) { | ||
124 | dev_err(data->dev, "pin:%d no alt function available\n", | ||
125 | pin); | ||
126 | return -EINVAL; | ||
127 | } | ||
128 | wmt_clearbits(data, reg_en, BIT(bit)); | ||
129 | } | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static int wmt_pmx_enable(struct pinctrl_dev *pctldev, | ||
135 | unsigned func_selector, | ||
136 | unsigned group_selector) | ||
137 | { | ||
138 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
139 | u32 pinnum = data->pins[group_selector].number; | ||
140 | |||
141 | return wmt_set_pinmux(data, func_selector, pinnum); | ||
142 | } | ||
143 | |||
144 | static void wmt_pmx_disable(struct pinctrl_dev *pctldev, | ||
145 | unsigned func_selector, | ||
146 | unsigned group_selector) | ||
147 | { | ||
148 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
149 | u32 pinnum = data->pins[group_selector].number; | ||
150 | |||
151 | /* disable by setting GPIO_IN */ | ||
152 | wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, pinnum); | ||
153 | } | ||
154 | |||
155 | static void wmt_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, | ||
156 | struct pinctrl_gpio_range *range, | ||
157 | unsigned offset) | ||
158 | { | ||
159 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
160 | |||
161 | /* disable by setting GPIO_IN */ | ||
162 | wmt_set_pinmux(data, WMT_FSEL_GPIO_IN, offset); | ||
163 | } | ||
164 | |||
165 | static int wmt_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, | ||
166 | struct pinctrl_gpio_range *range, | ||
167 | unsigned offset, | ||
168 | bool input) | ||
169 | { | ||
170 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
171 | |||
172 | wmt_set_pinmux(data, (input ? WMT_FSEL_GPIO_IN : WMT_FSEL_GPIO_OUT), | ||
173 | offset); | ||
174 | |||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static struct pinmux_ops wmt_pinmux_ops = { | ||
179 | .get_functions_count = wmt_pmx_get_functions_count, | ||
180 | .get_function_name = wmt_pmx_get_function_name, | ||
181 | .get_function_groups = wmt_pmx_get_function_groups, | ||
182 | .enable = wmt_pmx_enable, | ||
183 | .disable = wmt_pmx_disable, | ||
184 | .gpio_disable_free = wmt_pmx_gpio_disable_free, | ||
185 | .gpio_set_direction = wmt_pmx_gpio_set_direction, | ||
186 | }; | ||
187 | |||
188 | static int wmt_get_groups_count(struct pinctrl_dev *pctldev) | ||
189 | { | ||
190 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
191 | |||
192 | return data->ngroups; | ||
193 | } | ||
194 | |||
195 | static const char *wmt_get_group_name(struct pinctrl_dev *pctldev, | ||
196 | unsigned selector) | ||
197 | { | ||
198 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
199 | |||
200 | return data->groups[selector]; | ||
201 | } | ||
202 | |||
203 | static int wmt_get_group_pins(struct pinctrl_dev *pctldev, | ||
204 | unsigned selector, | ||
205 | const unsigned **pins, | ||
206 | unsigned *num_pins) | ||
207 | { | ||
208 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
209 | |||
210 | *pins = &data->pins[selector].number; | ||
211 | *num_pins = 1; | ||
212 | |||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static int wmt_pctl_find_group_by_pin(struct wmt_pinctrl_data *data, u32 pin) | ||
217 | { | ||
218 | int i; | ||
219 | |||
220 | for (i = 0; i < data->npins; i++) { | ||
221 | if (data->pins[i].number == pin) | ||
222 | return i; | ||
223 | } | ||
224 | |||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
228 | static int wmt_pctl_dt_node_to_map_func(struct wmt_pinctrl_data *data, | ||
229 | struct device_node *np, | ||
230 | u32 pin, u32 fnum, | ||
231 | struct pinctrl_map **maps) | ||
232 | { | ||
233 | int group; | ||
234 | struct pinctrl_map *map = *maps; | ||
235 | |||
236 | if (fnum >= ARRAY_SIZE(wmt_functions)) { | ||
237 | dev_err(data->dev, "invalid wm,function %d\n", fnum); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | |||
241 | group = wmt_pctl_find_group_by_pin(data, pin); | ||
242 | if (group < 0) { | ||
243 | dev_err(data->dev, "unable to match pin %d to group\n", pin); | ||
244 | return group; | ||
245 | } | ||
246 | |||
247 | map->type = PIN_MAP_TYPE_MUX_GROUP; | ||
248 | map->data.mux.group = data->groups[group]; | ||
249 | map->data.mux.function = wmt_functions[fnum]; | ||
250 | (*maps)++; | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data, | ||
256 | struct device_node *np, | ||
257 | u32 pin, u32 pull, | ||
258 | struct pinctrl_map **maps) | ||
259 | { | ||
260 | int group; | ||
261 | unsigned long *configs; | ||
262 | struct pinctrl_map *map = *maps; | ||
263 | |||
264 | if (pull > 2) { | ||
265 | dev_err(data->dev, "invalid wm,pull %d\n", pull); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | group = wmt_pctl_find_group_by_pin(data, pin); | ||
270 | if (group < 0) { | ||
271 | dev_err(data->dev, "unable to match pin %d to group\n", pin); | ||
272 | return group; | ||
273 | } | ||
274 | |||
275 | configs = kzalloc(sizeof(*configs), GFP_KERNEL); | ||
276 | if (!configs) | ||
277 | return -ENOMEM; | ||
278 | |||
279 | configs[0] = pull; | ||
280 | |||
281 | map->type = PIN_MAP_TYPE_CONFIGS_PIN; | ||
282 | map->data.configs.group_or_pin = data->groups[group]; | ||
283 | map->data.configs.configs = configs; | ||
284 | map->data.configs.num_configs = 1; | ||
285 | (*maps)++; | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static void wmt_pctl_dt_free_map(struct pinctrl_dev *pctldev, | ||
291 | struct pinctrl_map *maps, | ||
292 | unsigned num_maps) | ||
293 | { | ||
294 | int i; | ||
295 | |||
296 | for (i = 0; i < num_maps; i++) | ||
297 | if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) | ||
298 | kfree(maps[i].data.configs.configs); | ||
299 | |||
300 | kfree(maps); | ||
301 | } | ||
302 | |||
303 | static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, | ||
304 | struct device_node *np, | ||
305 | struct pinctrl_map **map, | ||
306 | unsigned *num_maps) | ||
307 | { | ||
308 | struct pinctrl_map *maps, *cur_map; | ||
309 | struct property *pins, *funcs, *pulls; | ||
310 | u32 pin, func, pull; | ||
311 | int num_pins, num_funcs, num_pulls, maps_per_pin; | ||
312 | int i, err; | ||
313 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
314 | |||
315 | pins = of_find_property(np, "wm,pins", NULL); | ||
316 | if (!pins) { | ||
317 | dev_err(data->dev, "missing wmt,pins property\n"); | ||
318 | return -EINVAL; | ||
319 | } | ||
320 | |||
321 | funcs = of_find_property(np, "wm,function", NULL); | ||
322 | pulls = of_find_property(np, "wm,pull", NULL); | ||
323 | |||
324 | if (!funcs && !pulls) { | ||
325 | dev_err(data->dev, "neither wm,function nor wm,pull specified\n"); | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | |||
329 | /* | ||
330 | * The following lines calculate how many values are defined for each | ||
331 | * of the properties. | ||
332 | */ | ||
333 | num_pins = pins->length / sizeof(u32); | ||
334 | num_funcs = funcs ? (funcs->length / sizeof(u32)) : 0; | ||
335 | num_pulls = pulls ? (pulls->length / sizeof(u32)) : 0; | ||
336 | |||
337 | if (num_funcs > 1 && num_funcs != num_pins) { | ||
338 | dev_err(data->dev, "wm,function must have 1 or %d entries\n", | ||
339 | num_pins); | ||
340 | return -EINVAL; | ||
341 | } | ||
342 | |||
343 | if (num_pulls > 1 && num_pulls != num_pins) { | ||
344 | dev_err(data->dev, "wm,pull must have 1 or %d entries\n", | ||
345 | num_pins); | ||
346 | return -EINVAL; | ||
347 | } | ||
348 | |||
349 | maps_per_pin = 0; | ||
350 | if (num_funcs) | ||
351 | maps_per_pin++; | ||
352 | if (num_pulls) | ||
353 | maps_per_pin++; | ||
354 | |||
355 | cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), | ||
356 | GFP_KERNEL); | ||
357 | if (!maps) | ||
358 | return -ENOMEM; | ||
359 | |||
360 | for (i = 0; i < num_pins; i++) { | ||
361 | err = of_property_read_u32_index(np, "wm,pins", i, &pin); | ||
362 | if (err) | ||
363 | goto fail; | ||
364 | |||
365 | if (pin >= (data->nbanks * 32)) { | ||
366 | dev_err(data->dev, "invalid wm,pins value\n"); | ||
367 | err = -EINVAL; | ||
368 | goto fail; | ||
369 | } | ||
370 | |||
371 | if (num_funcs) { | ||
372 | err = of_property_read_u32_index(np, "wm,function", | ||
373 | (num_funcs > 1 ? i : 0), &func); | ||
374 | if (err) | ||
375 | goto fail; | ||
376 | |||
377 | err = wmt_pctl_dt_node_to_map_func(data, np, pin, func, | ||
378 | &cur_map); | ||
379 | if (err) | ||
380 | goto fail; | ||
381 | } | ||
382 | |||
383 | if (num_pulls) { | ||
384 | err = of_property_read_u32_index(np, "wm,pull", | ||
385 | (num_pulls > 1 ? i : 0), &pull); | ||
386 | if (err) | ||
387 | goto fail; | ||
388 | |||
389 | err = wmt_pctl_dt_node_to_map_pull(data, np, pin, pull, | ||
390 | &cur_map); | ||
391 | if (err) | ||
392 | goto fail; | ||
393 | } | ||
394 | } | ||
395 | *map = maps; | ||
396 | *num_maps = num_pins * maps_per_pin; | ||
397 | return 0; | ||
398 | |||
399 | /* | ||
400 | * The fail path removes any maps that have been allocated. The fail path is | ||
401 | * only called from code after maps has been kzalloc'd. It is also safe to | ||
402 | * pass 'num_pins * maps_per_pin' as the map count even though we probably | ||
403 | * failed before all the mappings were read as all maps are allocated at once, | ||
404 | * and configs are only allocated for .type = PIN_MAP_TYPE_CONFIGS_PIN - there | ||
405 | * is no failpath where a config can be allocated without .type being set. | ||
406 | */ | ||
407 | fail: | ||
408 | wmt_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin); | ||
409 | return err; | ||
410 | } | ||
411 | |||
412 | static struct pinctrl_ops wmt_pctl_ops = { | ||
413 | .get_groups_count = wmt_get_groups_count, | ||
414 | .get_group_name = wmt_get_group_name, | ||
415 | .get_group_pins = wmt_get_group_pins, | ||
416 | .dt_node_to_map = wmt_pctl_dt_node_to_map, | ||
417 | .dt_free_map = wmt_pctl_dt_free_map, | ||
418 | }; | ||
419 | |||
420 | static int wmt_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, | ||
421 | unsigned long *config) | ||
422 | { | ||
423 | return -ENOTSUPP; | ||
424 | } | ||
425 | |||
426 | static int wmt_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin, | ||
427 | unsigned long config) | ||
428 | { | ||
429 | struct wmt_pinctrl_data *data = pinctrl_dev_get_drvdata(pctldev); | ||
430 | enum pin_config_param param = pinconf_to_config_param(config); | ||
431 | u16 arg = pinconf_to_config_argument(config); | ||
432 | u32 bank = WMT_BANK_FROM_PIN(pin); | ||
433 | u32 bit = WMT_BIT_FROM_PIN(pin); | ||
434 | u32 reg_pull_en = data->banks[bank].reg_pull_en; | ||
435 | u32 reg_pull_cfg = data->banks[bank].reg_pull_cfg; | ||
436 | |||
437 | if ((reg_pull_en == NO_REG) || (reg_pull_cfg == NO_REG)) { | ||
438 | dev_err(data->dev, "bias functions not supported on pin %d\n", | ||
439 | pin); | ||
440 | return -EINVAL; | ||
441 | } | ||
442 | |||
443 | if ((param == PIN_CONFIG_BIAS_PULL_DOWN) || | ||
444 | (param == PIN_CONFIG_BIAS_PULL_UP)) { | ||
445 | if (arg == 0) | ||
446 | param = PIN_CONFIG_BIAS_DISABLE; | ||
447 | } | ||
448 | |||
449 | switch (param) { | ||
450 | case PIN_CONFIG_BIAS_DISABLE: | ||
451 | wmt_clearbits(data, reg_pull_en, BIT(bit)); | ||
452 | break; | ||
453 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
454 | wmt_clearbits(data, reg_pull_cfg, BIT(bit)); | ||
455 | wmt_setbits(data, reg_pull_en, BIT(bit)); | ||
456 | break; | ||
457 | case PIN_CONFIG_BIAS_PULL_UP: | ||
458 | wmt_setbits(data, reg_pull_cfg, BIT(bit)); | ||
459 | wmt_setbits(data, reg_pull_en, BIT(bit)); | ||
460 | break; | ||
461 | default: | ||
462 | dev_err(data->dev, "unknown pinconf param\n"); | ||
463 | return -EINVAL; | ||
464 | } | ||
465 | |||
466 | return 0; | ||
467 | } | ||
468 | |||
469 | static struct pinconf_ops wmt_pinconf_ops = { | ||
470 | .pin_config_get = wmt_pinconf_get, | ||
471 | .pin_config_set = wmt_pinconf_set, | ||
472 | }; | ||
473 | |||
474 | static struct pinctrl_desc wmt_desc = { | ||
475 | .owner = THIS_MODULE, | ||
476 | .name = "pinctrl-wmt", | ||
477 | .pctlops = &wmt_pctl_ops, | ||
478 | .pmxops = &wmt_pinmux_ops, | ||
479 | .confops = &wmt_pinconf_ops, | ||
480 | }; | ||
481 | |||
482 | static int wmt_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
483 | { | ||
484 | return pinctrl_request_gpio(chip->base + offset); | ||
485 | } | ||
486 | |||
487 | static void wmt_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
488 | { | ||
489 | pinctrl_free_gpio(chip->base + offset); | ||
490 | } | ||
491 | |||
492 | static int wmt_gpio_get_direction(struct gpio_chip *chip, unsigned offset) | ||
493 | { | ||
494 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
495 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
496 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
497 | u32 reg_dir = data->banks[bank].reg_dir; | ||
498 | u32 val; | ||
499 | |||
500 | val = readl_relaxed(data->base + reg_dir); | ||
501 | if (val & BIT(bit)) | ||
502 | return GPIOF_DIR_OUT; | ||
503 | else | ||
504 | return GPIOF_DIR_IN; | ||
505 | } | ||
506 | |||
507 | static int wmt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
508 | { | ||
509 | return pinctrl_gpio_direction_input(chip->base + offset); | ||
510 | } | ||
511 | |||
512 | static int wmt_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | ||
513 | int value) | ||
514 | { | ||
515 | return pinctrl_gpio_direction_output(chip->base + offset); | ||
516 | } | ||
517 | |||
518 | static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset) | ||
519 | { | ||
520 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
521 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
522 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
523 | u32 reg_data_in = data->banks[bank].reg_data_in; | ||
524 | |||
525 | if (reg_data_in == NO_REG) { | ||
526 | dev_err(data->dev, "no data in register defined\n"); | ||
527 | return -EINVAL; | ||
528 | } | ||
529 | |||
530 | return !!(readl_relaxed(data->base + reg_data_in) & BIT(bit)); | ||
531 | } | ||
532 | |||
533 | static void wmt_gpio_set_value(struct gpio_chip *chip, unsigned offset, | ||
534 | int val) | ||
535 | { | ||
536 | struct wmt_pinctrl_data *data = dev_get_drvdata(chip->dev); | ||
537 | u32 bank = WMT_BANK_FROM_PIN(offset); | ||
538 | u32 bit = WMT_BIT_FROM_PIN(offset); | ||
539 | u32 reg_data_out = data->banks[bank].reg_data_out; | ||
540 | |||
541 | if (reg_data_out == NO_REG) { | ||
542 | dev_err(data->dev, "no data out register defined\n"); | ||
543 | return; | ||
544 | } | ||
545 | |||
546 | if (val) | ||
547 | wmt_setbits(data, reg_data_out, BIT(bit)); | ||
548 | else | ||
549 | wmt_clearbits(data, reg_data_out, BIT(bit)); | ||
550 | } | ||
551 | |||
552 | static struct gpio_chip wmt_gpio_chip = { | ||
553 | .label = "gpio-wmt", | ||
554 | .owner = THIS_MODULE, | ||
555 | .request = wmt_gpio_request, | ||
556 | .free = wmt_gpio_free, | ||
557 | .get_direction = wmt_gpio_get_direction, | ||
558 | .direction_input = wmt_gpio_direction_input, | ||
559 | .direction_output = wmt_gpio_direction_output, | ||
560 | .get = wmt_gpio_get_value, | ||
561 | .set = wmt_gpio_set_value, | ||
562 | .can_sleep = 0, | ||
563 | }; | ||
564 | |||
565 | int wmt_pinctrl_probe(struct platform_device *pdev, | ||
566 | struct wmt_pinctrl_data *data) | ||
567 | { | ||
568 | int err; | ||
569 | struct resource *res; | ||
570 | |||
571 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
572 | data->base = devm_request_and_ioremap(&pdev->dev, res); | ||
573 | if (!data->base) { | ||
574 | dev_err(&pdev->dev, "failed to map memory resource\n"); | ||
575 | return -EBUSY; | ||
576 | } | ||
577 | |||
578 | wmt_desc.pins = data->pins; | ||
579 | wmt_desc.npins = data->npins; | ||
580 | |||
581 | data->gpio_chip = wmt_gpio_chip; | ||
582 | data->gpio_chip.dev = &pdev->dev; | ||
583 | data->gpio_chip.of_node = pdev->dev.of_node; | ||
584 | data->gpio_chip.ngpio = data->nbanks * 32; | ||
585 | |||
586 | platform_set_drvdata(pdev, data); | ||
587 | |||
588 | data->dev = &pdev->dev; | ||
589 | |||
590 | data->pctl_dev = pinctrl_register(&wmt_desc, &pdev->dev, data); | ||
591 | if (IS_ERR(data->pctl_dev)) { | ||
592 | dev_err(&pdev->dev, "Failed to register pinctrl\n"); | ||
593 | return -EINVAL; | ||
594 | } | ||
595 | |||
596 | err = gpiochip_add(&data->gpio_chip); | ||
597 | if (err) { | ||
598 | dev_err(&pdev->dev, "could not add GPIO chip\n"); | ||
599 | goto fail_gpio; | ||
600 | } | ||
601 | |||
602 | err = gpiochip_add_pin_range(&data->gpio_chip, dev_name(data->dev), | ||
603 | 0, 0, data->nbanks * 32); | ||
604 | if (err) | ||
605 | goto fail_range; | ||
606 | |||
607 | dev_info(&pdev->dev, "Pin controller initialized\n"); | ||
608 | |||
609 | return 0; | ||
610 | |||
611 | fail_range: | ||
612 | err = gpiochip_remove(&data->gpio_chip); | ||
613 | if (err) | ||
614 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
615 | fail_gpio: | ||
616 | pinctrl_unregister(data->pctl_dev); | ||
617 | return err; | ||
618 | } | ||
619 | |||
620 | int wmt_pinctrl_remove(struct platform_device *pdev) | ||
621 | { | ||
622 | struct wmt_pinctrl_data *data = platform_get_drvdata(pdev); | ||
623 | int err; | ||
624 | |||
625 | err = gpiochip_remove(&data->gpio_chip); | ||
626 | if (err) | ||
627 | dev_err(&pdev->dev, "failed to remove gpio chip\n"); | ||
628 | |||
629 | pinctrl_unregister(data->pctl_dev); | ||
630 | |||
631 | return 0; | ||
632 | } | ||
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.h b/drivers/pinctrl/vt8500/pinctrl-wmt.h new file mode 100644 index 000000000000..41f5f2deb5d6 --- /dev/null +++ b/drivers/pinctrl/vt8500/pinctrl-wmt.h | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | * Pinctrl driver for the Wondermedia SoC's | ||
3 | * | ||
4 | * Copyright (c) 2013 Tony Prisk <linux@prisktech.co.nz> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/gpio.h> | ||
17 | |||
18 | /* VT8500 has no enable register in the extgpio bank. */ | ||
19 | #define NO_REG 0xFFFF | ||
20 | |||
21 | #define WMT_PINCTRL_BANK(__en, __dir, __dout, __din, __pen, __pcfg) \ | ||
22 | { \ | ||
23 | .reg_en = __en, \ | ||
24 | .reg_dir = __dir, \ | ||
25 | .reg_data_out = __dout, \ | ||
26 | .reg_data_in = __din, \ | ||
27 | .reg_pull_en = __pen, \ | ||
28 | .reg_pull_cfg = __pcfg, \ | ||
29 | } | ||
30 | |||
31 | /* Encode/decode the bank/bit pairs into a pin value */ | ||
32 | #define WMT_PIN(__bank, __offset) ((__bank << 5) | __offset) | ||
33 | #define WMT_BANK_FROM_PIN(__pin) (__pin >> 5) | ||
34 | #define WMT_BIT_FROM_PIN(__pin) (__pin & 0x1f) | ||
35 | |||
36 | #define WMT_GROUP(__name, __data) \ | ||
37 | { \ | ||
38 | .name = __name, \ | ||
39 | .pins = __data, \ | ||
40 | .npins = ARRAY_SIZE(__data), \ | ||
41 | } | ||
42 | |||
43 | struct wmt_pinctrl_bank_registers { | ||
44 | u32 reg_en; | ||
45 | u32 reg_dir; | ||
46 | u32 reg_data_out; | ||
47 | u32 reg_data_in; | ||
48 | |||
49 | u32 reg_pull_en; | ||
50 | u32 reg_pull_cfg; | ||
51 | }; | ||
52 | |||
53 | struct wmt_pinctrl_group { | ||
54 | const char *name; | ||
55 | const unsigned int *pins; | ||
56 | const unsigned npins; | ||
57 | }; | ||
58 | |||
59 | struct wmt_pinctrl_data { | ||
60 | struct device *dev; | ||
61 | struct pinctrl_dev *pctl_dev; | ||
62 | |||
63 | /* must be initialized before calling wmt_pinctrl_probe */ | ||
64 | void __iomem *base; | ||
65 | const struct wmt_pinctrl_bank_registers *banks; | ||
66 | const struct pinctrl_pin_desc *pins; | ||
67 | const char * const *groups; | ||
68 | |||
69 | u32 nbanks; | ||
70 | u32 npins; | ||
71 | u32 ngroups; | ||
72 | |||
73 | struct gpio_chip gpio_chip; | ||
74 | struct pinctrl_gpio_range gpio_range; | ||
75 | }; | ||
76 | |||
77 | int wmt_pinctrl_probe(struct platform_device *pdev, | ||
78 | struct wmt_pinctrl_data *data); | ||
79 | int wmt_pinctrl_remove(struct platform_device *pdev); | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 025428e04c33..c1a2914447e1 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -34,6 +34,77 @@ | |||
34 | #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ | 34 | #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */ |
35 | #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ | 35 | #define ATMEL_LCDC_FIFO_SIZE 512 /* words */ |
36 | 36 | ||
37 | struct atmel_lcdfb_config { | ||
38 | bool have_alt_pixclock; | ||
39 | bool have_hozval; | ||
40 | bool have_intensity_bit; | ||
41 | }; | ||
42 | |||
43 | static struct atmel_lcdfb_config at91sam9261_config = { | ||
44 | .have_hozval = true, | ||
45 | .have_intensity_bit = true, | ||
46 | }; | ||
47 | |||
48 | static struct atmel_lcdfb_config at91sam9263_config = { | ||
49 | .have_intensity_bit = true, | ||
50 | }; | ||
51 | |||
52 | static struct atmel_lcdfb_config at91sam9g10_config = { | ||
53 | .have_hozval = true, | ||
54 | }; | ||
55 | |||
56 | static struct atmel_lcdfb_config at91sam9g45_config = { | ||
57 | .have_alt_pixclock = true, | ||
58 | }; | ||
59 | |||
60 | static struct atmel_lcdfb_config at91sam9g45es_config = { | ||
61 | }; | ||
62 | |||
63 | static struct atmel_lcdfb_config at91sam9rl_config = { | ||
64 | .have_intensity_bit = true, | ||
65 | }; | ||
66 | |||
67 | static struct atmel_lcdfb_config at32ap_config = { | ||
68 | .have_hozval = true, | ||
69 | }; | ||
70 | |||
71 | static const struct platform_device_id atmel_lcdfb_devtypes[] = { | ||
72 | { | ||
73 | .name = "at91sam9261-lcdfb", | ||
74 | .driver_data = (unsigned long)&at91sam9261_config, | ||
75 | }, { | ||
76 | .name = "at91sam9263-lcdfb", | ||
77 | .driver_data = (unsigned long)&at91sam9263_config, | ||
78 | }, { | ||
79 | .name = "at91sam9g10-lcdfb", | ||
80 | .driver_data = (unsigned long)&at91sam9g10_config, | ||
81 | }, { | ||
82 | .name = "at91sam9g45-lcdfb", | ||
83 | .driver_data = (unsigned long)&at91sam9g45_config, | ||
84 | }, { | ||
85 | .name = "at91sam9g45es-lcdfb", | ||
86 | .driver_data = (unsigned long)&at91sam9g45es_config, | ||
87 | }, { | ||
88 | .name = "at91sam9rl-lcdfb", | ||
89 | .driver_data = (unsigned long)&at91sam9rl_config, | ||
90 | }, { | ||
91 | .name = "at32ap-lcdfb", | ||
92 | .driver_data = (unsigned long)&at32ap_config, | ||
93 | }, { | ||
94 | /* terminator */ | ||
95 | } | ||
96 | }; | ||
97 | |||
98 | static struct atmel_lcdfb_config * | ||
99 | atmel_lcdfb_get_config(struct platform_device *pdev) | ||
100 | { | ||
101 | unsigned long data; | ||
102 | |||
103 | data = platform_get_device_id(pdev)->driver_data; | ||
104 | |||
105 | return (struct atmel_lcdfb_config *)data; | ||
106 | } | ||
107 | |||
37 | #if defined(CONFIG_ARCH_AT91) | 108 | #if defined(CONFIG_ARCH_AT91) |
38 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ | 109 | #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \ |
39 | | FBINFO_PARTIAL_PAN_OK \ | 110 | | FBINFO_PARTIAL_PAN_OK \ |
@@ -193,14 +264,16 @@ static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = { | |||
193 | .accel = FB_ACCEL_NONE, | 264 | .accel = FB_ACCEL_NONE, |
194 | }; | 265 | }; |
195 | 266 | ||
196 | static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2) | 267 | static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo, |
268 | unsigned long xres) | ||
197 | { | 269 | { |
270 | unsigned long lcdcon2; | ||
198 | unsigned long value; | 271 | unsigned long value; |
199 | 272 | ||
200 | if (!(cpu_is_at91sam9261() || cpu_is_at91sam9g10() | 273 | if (!sinfo->config->have_hozval) |
201 | || cpu_is_at32ap7000())) | ||
202 | return xres; | 274 | return xres; |
203 | 275 | ||
276 | lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2); | ||
204 | value = xres; | 277 | value = xres; |
205 | if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { | 278 | if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) { |
206 | /* STN display */ | 279 | /* STN display */ |
@@ -423,7 +496,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
423 | break; | 496 | break; |
424 | case 16: | 497 | case 16: |
425 | /* Older SOCs use IBGR:555 rather than BGR:565. */ | 498 | /* Older SOCs use IBGR:555 rather than BGR:565. */ |
426 | if (sinfo->have_intensity_bit) | 499 | if (sinfo->config->have_intensity_bit) |
427 | var->green.length = 5; | 500 | var->green.length = 5; |
428 | else | 501 | else |
429 | var->green.length = 6; | 502 | var->green.length = 6; |
@@ -531,7 +604,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
531 | /* Now, the LCDC core... */ | 604 | /* Now, the LCDC core... */ |
532 | 605 | ||
533 | /* Set pixel clock */ | 606 | /* Set pixel clock */ |
534 | if (cpu_is_at91sam9g45() && !cpu_is_at91sam9g45es()) | 607 | if (sinfo->config->have_alt_pixclock) |
535 | pix_factor = 1; | 608 | pix_factor = 1; |
536 | 609 | ||
537 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; | 610 | clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000; |
@@ -591,8 +664,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
591 | lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); | 664 | lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value); |
592 | 665 | ||
593 | /* Horizontal value (aka line size) */ | 666 | /* Horizontal value (aka line size) */ |
594 | hozval_linesz = compute_hozval(info->var.xres, | 667 | hozval_linesz = compute_hozval(sinfo, info->var.xres); |
595 | lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2)); | ||
596 | 668 | ||
597 | /* Display size */ | 669 | /* Display size */ |
598 | value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; | 670 | value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET; |
@@ -684,7 +756,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
684 | 756 | ||
685 | case FB_VISUAL_PSEUDOCOLOR: | 757 | case FB_VISUAL_PSEUDOCOLOR: |
686 | if (regno < 256) { | 758 | if (regno < 256) { |
687 | if (sinfo->have_intensity_bit) { | 759 | if (sinfo->config->have_intensity_bit) { |
688 | /* old style I+BGR:555 */ | 760 | /* old style I+BGR:555 */ |
689 | val = ((red >> 11) & 0x001f); | 761 | val = ((red >> 11) & 0x001f); |
690 | val |= ((green >> 6) & 0x03e0); | 762 | val |= ((green >> 6) & 0x03e0); |
@@ -821,15 +893,13 @@ static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) | |||
821 | 893 | ||
822 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) | 894 | static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo) |
823 | { | 895 | { |
824 | if (sinfo->bus_clk) | 896 | clk_enable(sinfo->bus_clk); |
825 | clk_enable(sinfo->bus_clk); | ||
826 | clk_enable(sinfo->lcdc_clk); | 897 | clk_enable(sinfo->lcdc_clk); |
827 | } | 898 | } |
828 | 899 | ||
829 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) | 900 | static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo) |
830 | { | 901 | { |
831 | if (sinfo->bus_clk) | 902 | clk_disable(sinfo->bus_clk); |
832 | clk_disable(sinfo->bus_clk); | ||
833 | clk_disable(sinfo->lcdc_clk); | 903 | clk_disable(sinfo->lcdc_clk); |
834 | } | 904 | } |
835 | 905 | ||
@@ -874,10 +944,9 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
874 | } | 944 | } |
875 | sinfo->info = info; | 945 | sinfo->info = info; |
876 | sinfo->pdev = pdev; | 946 | sinfo->pdev = pdev; |
877 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || | 947 | sinfo->config = atmel_lcdfb_get_config(pdev); |
878 | cpu_is_at91sam9rl()) { | 948 | if (!sinfo->config) |
879 | sinfo->have_intensity_bit = true; | 949 | goto free_info; |
880 | } | ||
881 | 950 | ||
882 | strcpy(info->fix.id, sinfo->pdev->name); | 951 | strcpy(info->fix.id, sinfo->pdev->name); |
883 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 952 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |
@@ -888,13 +957,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
888 | info->fix = atmel_lcdfb_fix; | 957 | info->fix = atmel_lcdfb_fix; |
889 | 958 | ||
890 | /* Enable LCDC Clocks */ | 959 | /* Enable LCDC Clocks */ |
891 | if (cpu_is_at91sam9261() || cpu_is_at91sam9g10() | 960 | sinfo->bus_clk = clk_get(dev, "hclk"); |
892 | || cpu_is_at32ap7000()) { | 961 | if (IS_ERR(sinfo->bus_clk)) { |
893 | sinfo->bus_clk = clk_get(dev, "hck1"); | 962 | ret = PTR_ERR(sinfo->bus_clk); |
894 | if (IS_ERR(sinfo->bus_clk)) { | 963 | goto free_info; |
895 | ret = PTR_ERR(sinfo->bus_clk); | ||
896 | goto free_info; | ||
897 | } | ||
898 | } | 964 | } |
899 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); | 965 | sinfo->lcdc_clk = clk_get(dev, "lcdc_clk"); |
900 | if (IS_ERR(sinfo->lcdc_clk)) { | 966 | if (IS_ERR(sinfo->lcdc_clk)) { |
@@ -1055,8 +1121,7 @@ stop_clk: | |||
1055 | atmel_lcdfb_stop_clock(sinfo); | 1121 | atmel_lcdfb_stop_clock(sinfo); |
1056 | clk_put(sinfo->lcdc_clk); | 1122 | clk_put(sinfo->lcdc_clk); |
1057 | put_bus_clk: | 1123 | put_bus_clk: |
1058 | if (sinfo->bus_clk) | 1124 | clk_put(sinfo->bus_clk); |
1059 | clk_put(sinfo->bus_clk); | ||
1060 | free_info: | 1125 | free_info: |
1061 | framebuffer_release(info); | 1126 | framebuffer_release(info); |
1062 | out: | 1127 | out: |
@@ -1081,8 +1146,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) | |||
1081 | unregister_framebuffer(info); | 1146 | unregister_framebuffer(info); |
1082 | atmel_lcdfb_stop_clock(sinfo); | 1147 | atmel_lcdfb_stop_clock(sinfo); |
1083 | clk_put(sinfo->lcdc_clk); | 1148 | clk_put(sinfo->lcdc_clk); |
1084 | if (sinfo->bus_clk) | 1149 | clk_put(sinfo->bus_clk); |
1085 | clk_put(sinfo->bus_clk); | ||
1086 | fb_dealloc_cmap(&info->cmap); | 1150 | fb_dealloc_cmap(&info->cmap); |
1087 | free_irq(sinfo->irq_base, info); | 1151 | free_irq(sinfo->irq_base, info); |
1088 | iounmap(sinfo->mmio); | 1152 | iounmap(sinfo->mmio); |
@@ -1151,7 +1215,7 @@ static struct platform_driver atmel_lcdfb_driver = { | |||
1151 | .remove = __exit_p(atmel_lcdfb_remove), | 1215 | .remove = __exit_p(atmel_lcdfb_remove), |
1152 | .suspend = atmel_lcdfb_suspend, | 1216 | .suspend = atmel_lcdfb_suspend, |
1153 | .resume = atmel_lcdfb_resume, | 1217 | .resume = atmel_lcdfb_resume, |
1154 | 1218 | .id_table = atmel_lcdfb_devtypes, | |
1155 | .driver = { | 1219 | .driver = { |
1156 | .name = "atmel_lcdfb", | 1220 | .name = "atmel_lcdfb", |
1157 | .owner = THIS_MODULE, | 1221 | .owner = THIS_MODULE, |
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h index 2603267b1a29..e6c9c4cc9b23 100644 --- a/include/clocksource/arm_arch_timer.h +++ b/include/clocksource/arm_arch_timer.h | |||
@@ -31,18 +31,12 @@ | |||
31 | 31 | ||
32 | #ifdef CONFIG_ARM_ARCH_TIMER | 32 | #ifdef CONFIG_ARM_ARCH_TIMER |
33 | 33 | ||
34 | extern int arch_timer_init(void); | ||
35 | extern u32 arch_timer_get_rate(void); | 34 | extern u32 arch_timer_get_rate(void); |
36 | extern u64 (*arch_timer_read_counter)(void); | 35 | extern u64 (*arch_timer_read_counter)(void); |
37 | extern struct timecounter *arch_timer_get_timecounter(void); | 36 | extern struct timecounter *arch_timer_get_timecounter(void); |
38 | 37 | ||
39 | #else | 38 | #else |
40 | 39 | ||
41 | static inline int arch_timer_init(void) | ||
42 | { | ||
43 | return -ENXIO; | ||
44 | } | ||
45 | |||
46 | static inline u32 arch_timer_get_rate(void) | 40 | static inline u32 arch_timer_get_rate(void) |
47 | { | 41 | { |
48 | return 0; | 42 | return 0; |
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index 9c7f5807824b..dd7adff76e81 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h | |||
@@ -152,7 +152,7 @@ struct clk { | |||
152 | }, \ | 152 | }, \ |
153 | .reg = _reg, \ | 153 | .reg = _reg, \ |
154 | .shift = _shift, \ | 154 | .shift = _shift, \ |
155 | .width = _width, \ | 155 | .mask = BIT(_width) - 1, \ |
156 | .flags = _mux_flags, \ | 156 | .flags = _mux_flags, \ |
157 | .lock = _lock, \ | 157 | .lock = _lock, \ |
158 | }; \ | 158 | }; \ |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7f197d7addb0..1f0352802794 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -45,6 +45,14 @@ struct clk_hw; | |||
45 | * undo any work done in the @prepare callback. Called with | 45 | * undo any work done in the @prepare callback. Called with |
46 | * prepare_lock held. | 46 | * prepare_lock held. |
47 | * | 47 | * |
48 | * @is_prepared: Queries the hardware to determine if the clock is prepared. | ||
49 | * This function is allowed to sleep. Optional, if this op is not | ||
50 | * set then the prepare count will be used. | ||
51 | * | ||
52 | * @unprepare_unused: Unprepare the clock atomically. Only called from | ||
53 | * clk_disable_unused for prepare clocks with special needs. | ||
54 | * Called with prepare mutex held. This function may sleep. | ||
55 | * | ||
48 | * @enable: Enable the clock atomically. This must not return until the | 56 | * @enable: Enable the clock atomically. This must not return until the |
49 | * clock is generating a valid clock signal, usable by consumer | 57 | * clock is generating a valid clock signal, usable by consumer |
50 | * devices. Called with enable_lock held. This function must not | 58 | * devices. Called with enable_lock held. This function must not |
@@ -108,6 +116,8 @@ struct clk_hw; | |||
108 | struct clk_ops { | 116 | struct clk_ops { |
109 | int (*prepare)(struct clk_hw *hw); | 117 | int (*prepare)(struct clk_hw *hw); |
110 | void (*unprepare)(struct clk_hw *hw); | 118 | void (*unprepare)(struct clk_hw *hw); |
119 | int (*is_prepared)(struct clk_hw *hw); | ||
120 | void (*unprepare_unused)(struct clk_hw *hw); | ||
111 | int (*enable)(struct clk_hw *hw); | 121 | int (*enable)(struct clk_hw *hw); |
112 | void (*disable)(struct clk_hw *hw); | 122 | void (*disable)(struct clk_hw *hw); |
113 | int (*is_enabled)(struct clk_hw *hw); | 123 | int (*is_enabled)(struct clk_hw *hw); |
@@ -287,8 +297,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name, | |||
287 | struct clk_mux { | 297 | struct clk_mux { |
288 | struct clk_hw hw; | 298 | struct clk_hw hw; |
289 | void __iomem *reg; | 299 | void __iomem *reg; |
300 | u32 *table; | ||
301 | u32 mask; | ||
290 | u8 shift; | 302 | u8 shift; |
291 | u8 width; | ||
292 | u8 flags; | 303 | u8 flags; |
293 | spinlock_t *lock; | 304 | spinlock_t *lock; |
294 | }; | 305 | }; |
@@ -297,11 +308,17 @@ struct clk_mux { | |||
297 | #define CLK_MUX_INDEX_BIT BIT(1) | 308 | #define CLK_MUX_INDEX_BIT BIT(1) |
298 | 309 | ||
299 | extern const struct clk_ops clk_mux_ops; | 310 | extern const struct clk_ops clk_mux_ops; |
311 | |||
300 | struct clk *clk_register_mux(struct device *dev, const char *name, | 312 | struct clk *clk_register_mux(struct device *dev, const char *name, |
301 | const char **parent_names, u8 num_parents, unsigned long flags, | 313 | const char **parent_names, u8 num_parents, unsigned long flags, |
302 | void __iomem *reg, u8 shift, u8 width, | 314 | void __iomem *reg, u8 shift, u8 width, |
303 | u8 clk_mux_flags, spinlock_t *lock); | 315 | u8 clk_mux_flags, spinlock_t *lock); |
304 | 316 | ||
317 | struct clk *clk_register_mux_table(struct device *dev, const char *name, | ||
318 | const char **parent_names, u8 num_parents, unsigned long flags, | ||
319 | void __iomem *reg, u8 shift, u32 mask, | ||
320 | u8 clk_mux_flags, u32 *table, spinlock_t *lock); | ||
321 | |||
305 | /** | 322 | /** |
306 | * struct clk_fixed_factor - fixed multiplier and divider clock | 323 | * struct clk_fixed_factor - fixed multiplier and divider clock |
307 | * | 324 | * |
@@ -325,6 +342,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, | |||
325 | const char *parent_name, unsigned long flags, | 342 | const char *parent_name, unsigned long flags, |
326 | unsigned int mult, unsigned int div); | 343 | unsigned int mult, unsigned int div); |
327 | 344 | ||
345 | /*** | ||
346 | * struct clk_composite - aggregate clock of mux, divider and gate clocks | ||
347 | * | ||
348 | * @hw: handle between common and hardware-specific interfaces | ||
349 | * @mux_hw: handle between composite and hardware-specifix mux clock | ||
350 | * @div_hw: handle between composite and hardware-specifix divider clock | ||
351 | * @gate_hw: handle between composite and hardware-specifix gate clock | ||
352 | * @mux_ops: clock ops for mux | ||
353 | * @div_ops: clock ops for divider | ||
354 | * @gate_ops: clock ops for gate | ||
355 | */ | ||
356 | struct clk_composite { | ||
357 | struct clk_hw hw; | ||
358 | struct clk_ops ops; | ||
359 | |||
360 | struct clk_hw *mux_hw; | ||
361 | struct clk_hw *div_hw; | ||
362 | struct clk_hw *gate_hw; | ||
363 | |||
364 | const struct clk_ops *mux_ops; | ||
365 | const struct clk_ops *div_ops; | ||
366 | const struct clk_ops *gate_ops; | ||
367 | }; | ||
368 | |||
369 | struct clk *clk_register_composite(struct device *dev, const char *name, | ||
370 | const char **parent_names, int num_parents, | ||
371 | struct clk_hw *mux_hw, const struct clk_ops *mux_ops, | ||
372 | struct clk_hw *div_hw, const struct clk_ops *div_ops, | ||
373 | struct clk_hw *gate_hw, const struct clk_ops *gate_ops, | ||
374 | unsigned long flags); | ||
375 | |||
328 | /** | 376 | /** |
329 | * clk_register - allocate a new clock, register it and return an opaque cookie | 377 | * clk_register - allocate a new clock, register it and return an opaque cookie |
330 | * @dev: device that is registering this clock | 378 | * @dev: device that is registering this clock |
@@ -351,6 +399,7 @@ unsigned int __clk_get_enable_count(struct clk *clk); | |||
351 | unsigned int __clk_get_prepare_count(struct clk *clk); | 399 | unsigned int __clk_get_prepare_count(struct clk *clk); |
352 | unsigned long __clk_get_rate(struct clk *clk); | 400 | unsigned long __clk_get_rate(struct clk *clk); |
353 | unsigned long __clk_get_flags(struct clk *clk); | 401 | unsigned long __clk_get_flags(struct clk *clk); |
402 | bool __clk_is_prepared(struct clk *clk); | ||
354 | bool __clk_is_enabled(struct clk *clk); | 403 | bool __clk_is_enabled(struct clk *clk); |
355 | struct clk *__clk_lookup(const char *name); | 404 | struct clk *__clk_lookup(const char *name); |
356 | 405 | ||
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h new file mode 100644 index 000000000000..e074fdd5a236 --- /dev/null +++ b/include/linux/clk/sunxi.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Maxime Ripard | ||
3 | * | ||
4 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #ifndef __LINUX_CLK_SUNXI_H_ | ||
18 | #define __LINUX_CLK_SUNXI_H_ | ||
19 | |||
20 | void __init sunxi_init_clocks(void); | ||
21 | |||
22 | #endif | ||
diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 404d6f940872..642789baec74 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h | |||
@@ -123,5 +123,6 @@ static inline void tegra_cpu_clock_resume(void) | |||
123 | void tegra_periph_reset_deassert(struct clk *c); | 123 | void tegra_periph_reset_deassert(struct clk *c); |
124 | void tegra_periph_reset_assert(struct clk *c); | 124 | void tegra_periph_reset_assert(struct clk *c); |
125 | void tegra_clocks_init(void); | 125 | void tegra_clocks_init(void); |
126 | void tegra_clocks_apply_init_table(void); | ||
126 | 127 | ||
127 | #endif /* __LINUX_CLK_TEGRA_H_ */ | 128 | #endif /* __LINUX_CLK_TEGRA_H_ */ |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 27cfda427dd9..192d6d1771ee 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -332,15 +332,23 @@ extern int clocksource_mmio_init(void __iomem *, const char *, | |||
332 | 332 | ||
333 | extern int clocksource_i8253_init(void); | 333 | extern int clocksource_i8253_init(void); |
334 | 334 | ||
335 | struct device_node; | ||
336 | typedef void(*clocksource_of_init_fn)(struct device_node *); | ||
335 | #ifdef CONFIG_CLKSRC_OF | 337 | #ifdef CONFIG_CLKSRC_OF |
336 | extern void clocksource_of_init(void); | 338 | extern void clocksource_of_init(void); |
337 | 339 | ||
338 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | 340 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
339 | static const struct of_device_id __clksrc_of_table_##name \ | 341 | static const struct of_device_id __clksrc_of_table_##name \ |
340 | __used __section(__clksrc_of_table) \ | 342 | __used __section(__clksrc_of_table) \ |
341 | = { .compatible = compat, .data = fn }; | 343 | = { .compatible = compat, \ |
344 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
342 | #else | 345 | #else |
343 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) | 346 | static inline void clocksource_of_init(void) {} |
347 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | ||
348 | static const struct of_device_id __clksrc_of_table_##name \ | ||
349 | __attribute__((unused)) \ | ||
350 | = { .compatible = compat, \ | ||
351 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
344 | #endif | 352 | #endif |
345 | 353 | ||
346 | #endif /* _LINUX_CLOCKSOURCE_H */ | 354 | #endif /* _LINUX_CLOCKSOURCE_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h index a0f129284948..b0f3bbd0216b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property( | |||
235 | extern struct property *of_find_property(const struct device_node *np, | 235 | extern struct property *of_find_property(const struct device_node *np, |
236 | const char *name, | 236 | const char *name, |
237 | int *lenp); | 237 | int *lenp); |
238 | extern int of_property_read_u32_index(const struct device_node *np, | ||
239 | const char *propname, | ||
240 | u32 index, u32 *out_value); | ||
238 | extern int of_property_read_u8_array(const struct device_node *np, | 241 | extern int of_property_read_u8_array(const struct device_node *np, |
239 | const char *propname, u8 *out_values, size_t sz); | 242 | const char *propname, u8 *out_values, size_t sz); |
240 | extern int of_property_read_u16_array(const struct device_node *np, | 243 | extern int of_property_read_u16_array(const struct device_node *np, |
@@ -379,6 +382,11 @@ static inline int of_device_is_compatible(const struct device_node *device, | |||
379 | return 0; | 382 | return 0; |
380 | } | 383 | } |
381 | 384 | ||
385 | static inline int of_device_is_available(const struct device_node *device) | ||
386 | { | ||
387 | return 0; | ||
388 | } | ||
389 | |||
382 | static inline struct property *of_find_property(const struct device_node *np, | 390 | static inline struct property *of_find_property(const struct device_node *np, |
383 | const char *name, | 391 | const char *name, |
384 | int *lenp) | 392 | int *lenp) |
@@ -394,6 +402,12 @@ static inline struct device_node *of_find_compatible_node( | |||
394 | return NULL; | 402 | return NULL; |
395 | } | 403 | } |
396 | 404 | ||
405 | static inline int of_property_read_u32_index(const struct device_node *np, | ||
406 | const char *propname, u32 index, u32 *out_value) | ||
407 | { | ||
408 | return -ENOSYS; | ||
409 | } | ||
410 | |||
397 | static inline int of_property_read_u8_array(const struct device_node *np, | 411 | static inline int of_property_read_u8_array(const struct device_node *np, |
398 | const char *propname, u8 *out_values, size_t sz) | 412 | const char *propname, u8 *out_values, size_t sz) |
399 | { | 413 | { |
diff --git a/include/linux/platform_data/irq-renesas-intc-irqpin.h b/include/linux/platform_data/irq-renesas-intc-irqpin.h new file mode 100644 index 000000000000..e4cb911066a6 --- /dev/null +++ b/include/linux/platform_data/irq-renesas-intc-irqpin.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Renesas INTC External IRQ Pin Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
21 | #define __IRQ_RENESAS_INTC_IRQPIN_H__ | ||
22 | |||
23 | struct renesas_intc_irqpin_config { | ||
24 | unsigned int sense_bitfield_width; | ||
25 | unsigned int irq_base; | ||
26 | bool control_parent; | ||
27 | }; | ||
28 | |||
29 | #endif /* __IRQ_RENESAS_INTC_IRQPIN_H__ */ | ||
diff --git a/include/linux/platform_data/irq-renesas-irqc.h b/include/linux/platform_data/irq-renesas-irqc.h new file mode 100644 index 000000000000..3ae17b3e00ed --- /dev/null +++ b/include/linux/platform_data/irq-renesas-irqc.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Renesas IRQC Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Magnus Damm | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __IRQ_RENESAS_IRQC_H__ | ||
21 | #define __IRQ_RENESAS_IRQC_H__ | ||
22 | |||
23 | struct renesas_irqc_config { | ||
24 | unsigned int irq_base; | ||
25 | }; | ||
26 | |||
27 | #endif /* __IRQ_RENESAS_IRQC_H__ */ | ||
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h index 28884c717411..148d35171aac 100644 --- a/include/linux/usb/nop-usb-xceiv.h +++ b/include/linux/usb/nop-usb-xceiv.h | |||
@@ -5,6 +5,11 @@ | |||
5 | 5 | ||
6 | struct nop_usb_xceiv_platform_data { | 6 | struct nop_usb_xceiv_platform_data { |
7 | enum usb_phy_type type; | 7 | enum usb_phy_type type; |
8 | unsigned long clk_rate; | ||
9 | |||
10 | /* if set fails with -EPROBE_DEFER if can't get regulator */ | ||
11 | unsigned int needs_vcc:1; | ||
12 | unsigned int needs_reset:1; | ||
8 | }; | 13 | }; |
9 | 14 | ||
10 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 15 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index 8deb22672ada..0f5a2fc69af9 100644 --- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define ATMEL_LCDC_WIRING_BGR 0 | 31 | #define ATMEL_LCDC_WIRING_BGR 0 |
32 | #define ATMEL_LCDC_WIRING_RGB 1 | 32 | #define ATMEL_LCDC_WIRING_RGB 1 |
33 | 33 | ||
34 | struct atmel_lcdfb_config; | ||
34 | 35 | ||
35 | /* LCD Controller info data structure, stored in device platform_data */ | 36 | /* LCD Controller info data structure, stored in device platform_data */ |
36 | struct atmel_lcdfb_info { | 37 | struct atmel_lcdfb_info { |
@@ -61,7 +62,8 @@ struct atmel_lcdfb_info { | |||
61 | void (*atmel_lcdfb_power_control)(int on); | 62 | void (*atmel_lcdfb_power_control)(int on); |
62 | struct fb_monspecs *default_monspecs; | 63 | struct fb_monspecs *default_monspecs; |
63 | u32 pseudo_palette[16]; | 64 | u32 pseudo_palette[16]; |
64 | bool have_intensity_bit; | 65 | |
66 | struct atmel_lcdfb_config *config; | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | #define ATMEL_LCDC_DMABADDR1 0x00 | 69 | #define ATMEL_LCDC_DMABADDR1 0x00 |