diff options
572 files changed, 14955 insertions, 5510 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/primecell.txt b/Documentation/devicetree/bindings/arm/primecell.txt index 64fc82bc8928..0df6acacfaea 100644 --- a/Documentation/devicetree/bindings/arm/primecell.txt +++ b/Documentation/devicetree/bindings/arm/primecell.txt | |||
@@ -16,14 +16,31 @@ Optional properties: | |||
16 | - clocks : From common clock binding. First clock is phandle to clock for apb | 16 | - clocks : From common clock binding. First clock is phandle to clock for apb |
17 | pclk. Additional clocks are optional and specific to those peripherals. | 17 | pclk. Additional clocks are optional and specific to those peripherals. |
18 | - clock-names : From common clock binding. Shall be "apb_pclk" for first clock. | 18 | - clock-names : From common clock binding. Shall be "apb_pclk" for first clock. |
19 | - dmas : From common DMA binding. If present, refers to one or more dma channels. | ||
20 | - dma-names : From common DMA binding, needs to match the 'dmas' property. | ||
21 | Devices with exactly one receive and transmit channel shall name | ||
22 | these "rx" and "tx", respectively. | ||
23 | - pinctrl-<n> : Pinctrl states as described in bindings/pinctrl/pinctrl-bindings.txt | ||
24 | - pinctrl-names : Names corresponding to the numbered pinctrl states | ||
25 | - interrupts : one or more interrupt specifiers | ||
26 | - interrupt-names : names corresponding to the interrupts properties | ||
19 | 27 | ||
20 | Example: | 28 | Example: |
21 | 29 | ||
22 | serial@fff36000 { | 30 | serial@fff36000 { |
23 | compatible = "arm,pl011", "arm,primecell"; | 31 | compatible = "arm,pl011", "arm,primecell"; |
24 | arm,primecell-periphid = <0x00341011>; | 32 | arm,primecell-periphid = <0x00341011>; |
33 | |||
25 | clocks = <&pclk>; | 34 | clocks = <&pclk>; |
26 | clock-names = "apb_pclk"; | 35 | clock-names = "apb_pclk"; |
27 | 36 | ||
37 | dmas = <&dma-controller 4>, <&dma-controller 5>; | ||
38 | dma-names = "rx", "tx"; | ||
39 | |||
40 | pinctrl-0 = <&uart0_default_mux>, <&uart0_default_mode>; | ||
41 | pinctrl-1 = <&uart0_sleep_mode>; | ||
42 | pinctrl-names = "default","sleep"; | ||
43 | |||
44 | interrupts = <0 11 0x4>; | ||
28 | }; | 45 | }; |
29 | 46 | ||
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/ata/pata-arasan.txt b/Documentation/devicetree/bindings/ata/pata-arasan.txt index 95ec7f825ede..2aff154be84e 100644 --- a/Documentation/devicetree/bindings/ata/pata-arasan.txt +++ b/Documentation/devicetree/bindings/ata/pata-arasan.txt | |||
@@ -6,6 +6,26 @@ Required properties: | |||
6 | - interrupt-parent: Should be the phandle for the interrupt controller | 6 | - interrupt-parent: Should be the phandle for the interrupt controller |
7 | that services interrupts for this device | 7 | that services interrupts for this device |
8 | - interrupt: Should contain the CF interrupt number | 8 | - interrupt: Should contain the CF interrupt number |
9 | - clock-frequency: Interface clock rate, in Hz, one of | ||
10 | 25000000 | ||
11 | 33000000 | ||
12 | 40000000 | ||
13 | 50000000 | ||
14 | 66000000 | ||
15 | 75000000 | ||
16 | 100000000 | ||
17 | 125000000 | ||
18 | 150000000 | ||
19 | 166000000 | ||
20 | 200000000 | ||
21 | |||
22 | Optional properties: | ||
23 | - arasan,broken-udma: if present, UDMA mode is unusable | ||
24 | - arasan,broken-mwdma: if present, MWDMA mode is unusable | ||
25 | - arasan,broken-pio: if present, PIO mode is unusable | ||
26 | - dmas: one DMA channel, as described in bindings/dma/dma.txt | ||
27 | required unless both UDMA and MWDMA mode are broken | ||
28 | - dma-names: the corresponding channel name, must be "data" | ||
9 | 29 | ||
10 | Example: | 30 | Example: |
11 | 31 | ||
@@ -14,4 +34,6 @@ Example: | |||
14 | reg = <0xfc000000 0x1000>; | 34 | reg = <0xfc000000 0x1000>; |
15 | interrupt-parent = <&vic1>; | 35 | interrupt-parent = <&vic1>; |
16 | interrupts = <12>; | 36 | interrupts = <12>; |
37 | dmas = <&dma-controller 23>; | ||
38 | dma-names = "data"; | ||
17 | }; | 39 | }; |
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/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/serial/pl011.txt b/Documentation/devicetree/bindings/serial/pl011.txt new file mode 100644 index 000000000000..5d2e840ae65c --- /dev/null +++ b/Documentation/devicetree/bindings/serial/pl011.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | * ARM AMBA Primecell PL011 serial UART | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: must be "arm,primecell", "arm,pl011" | ||
5 | - reg: exactly one register range with length 0x1000 | ||
6 | - interrupts: exactly one interrupt specifier | ||
7 | |||
8 | Optional properties: | ||
9 | - pinctrl: When present, must have one state named "sleep" | ||
10 | and one state named "default" | ||
11 | - clocks: When present, must refer to exactly one clock named | ||
12 | "apb_pclk" | ||
13 | - dmas: When present, may have one or two dma channels. | ||
14 | The first one must be named "rx", the second one | ||
15 | must be named "tx". | ||
16 | |||
17 | See also bindings/arm/primecell.txt | ||
diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt b/Documentation/devicetree/bindings/spi/spi_pl022.txt index f158fd31cfda..22ed6797216d 100644 --- a/Documentation/devicetree/bindings/spi/spi_pl022.txt +++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt | |||
@@ -16,6 +16,11 @@ Optional properties: | |||
16 | device will be suspended immediately | 16 | device will be suspended immediately |
17 | - pl022,rt : indicates the controller should run the message pump with realtime | 17 | - pl022,rt : indicates the controller should run the message pump with realtime |
18 | priority to minimise the transfer latency on the bus (boolean) | 18 | priority to minimise the transfer latency on the bus (boolean) |
19 | - dmas : Two or more DMA channel specifiers following the convention outlined | ||
20 | in bindings/dma/dma.txt | ||
21 | - dma-names: Names for the dma channels, if present. There must be at | ||
22 | least one channel named "tx" for transmit and named "rx" for | ||
23 | receive. | ||
19 | 24 | ||
20 | 25 | ||
21 | SPI slave nodes must be children of the SPI master node and can | 26 | SPI slave nodes must be children of the SPI master node and can |
@@ -32,3 +37,34 @@ contain the following properties. | |||
32 | - pl022,wait-state : Microwire interface: Wait state | 37 | - pl022,wait-state : Microwire interface: Wait state |
33 | - pl022,duplex : Microwire interface: Full/Half duplex | 38 | - pl022,duplex : Microwire interface: Full/Half duplex |
34 | 39 | ||
40 | |||
41 | Example: | ||
42 | |||
43 | spi@e0100000 { | ||
44 | compatible = "arm,pl022", "arm,primecell"; | ||
45 | reg = <0xe0100000 0x1000>; | ||
46 | #address-cells = <1>; | ||
47 | #size-cells = <0>; | ||
48 | interrupts = <0 31 0x4>; | ||
49 | dmas = <&dma-controller 23 1>, | ||
50 | <&dma-controller 24 0>; | ||
51 | dma-names = "rx", "tx"; | ||
52 | |||
53 | m25p80@1 { | ||
54 | compatible = "st,m25p80"; | ||
55 | reg = <1>; | ||
56 | spi-max-frequency = <12000000>; | ||
57 | spi-cpol; | ||
58 | spi-cpha; | ||
59 | pl022,hierarchy = <0>; | ||
60 | pl022,interface = <0>; | ||
61 | pl022,slave-tx-disable; | ||
62 | pl022,com-mode = <0x2>; | ||
63 | pl022,rx-level-trig = <0>; | ||
64 | pl022,tx-level-trig = <0>; | ||
65 | pl022,ctrl-len = <0x11>; | ||
66 | pl022,wait-state = <0>; | ||
67 | pl022,duplex = <0>; | ||
68 | }; | ||
69 | }; | ||
70 | |||
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/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/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 4499bd948860..95731a08f257 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -890,9 +890,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
890 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) | 890 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) |
891 | power_save - Automatic power-saving timeout (in second, 0 = | 891 | power_save - Automatic power-saving timeout (in second, 0 = |
892 | disable) | 892 | disable) |
893 | power_save_controller - Support runtime D3 of HD-audio controller | 893 | power_save_controller - Reset HD-audio controller in power-saving mode |
894 | (-1 = on for supported chip (default), false = off, | 894 | (default = on) |
895 | true = force to on even for unsupported hardware) | ||
896 | align_buffer_size - Force rounding of buffer/period sizes to multiples | 895 | align_buffer_size - Force rounding of buffer/period sizes to multiples |
897 | of 128 bytes. This is more efficient in terms of memory | 896 | of 128 bytes. This is more efficient in terms of memory |
898 | access but isn't required by the HDA spec and prevents | 897 | access but isn't required by the HDA spec and prevents |
diff --git a/MAINTAINERS b/MAINTAINERS index 74e58a4d035b..836a6183c37f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5065,9 +5065,8 @@ S: Maintained | |||
5065 | F: drivers/net/ethernet/marvell/sk* | 5065 | F: drivers/net/ethernet/marvell/sk* |
5066 | 5066 | ||
5067 | MARVELL LIBERTAS WIRELESS DRIVER | 5067 | MARVELL LIBERTAS WIRELESS DRIVER |
5068 | M: Dan Williams <dcbw@redhat.com> | ||
5069 | L: libertas-dev@lists.infradead.org | 5068 | L: libertas-dev@lists.infradead.org |
5070 | S: Maintained | 5069 | S: Orphan |
5071 | F: drivers/net/wireless/libertas/ | 5070 | F: drivers/net/wireless/libertas/ |
5072 | 5071 | ||
5073 | MARVELL MV643XX ETHERNET DRIVER | 5072 | MARVELL MV643XX ETHERNET DRIVER |
@@ -5569,6 +5568,7 @@ F: include/uapi/linux/if_* | |||
5569 | F: include/uapi/linux/netdevice.h | 5568 | F: include/uapi/linux/netdevice.h |
5570 | 5569 | ||
5571 | NETXEN (1/10) GbE SUPPORT | 5570 | NETXEN (1/10) GbE SUPPORT |
5571 | M: Manish Chopra <manish.chopra@qlogic.com> | ||
5572 | M: Sony Chacko <sony.chacko@qlogic.com> | 5572 | M: Sony Chacko <sony.chacko@qlogic.com> |
5573 | M: Rajesh Borundia <rajesh.borundia@qlogic.com> | 5573 | M: Rajesh Borundia <rajesh.borundia@qlogic.com> |
5574 | L: netdev@vger.kernel.org | 5574 | L: netdev@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 9 | 2 | PATCHLEVEL = 9 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc6 |
5 | NAME = Unicycling Gorilla | 5 | NAME = Unicycling Gorilla |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile index 4759fe751aa1..2cc3cc519c54 100644 --- a/arch/alpha/Makefile +++ b/arch/alpha/Makefile | |||
@@ -12,7 +12,7 @@ NM := $(NM) -B | |||
12 | 12 | ||
13 | LDFLAGS_vmlinux := -static -N #-relax | 13 | LDFLAGS_vmlinux := -static -N #-relax |
14 | CHECKFLAGS += -D__alpha__ -m64 | 14 | CHECKFLAGS += -D__alpha__ -m64 |
15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data | 15 | cflags-y := -pipe -mno-fp-regs -ffixed-8 |
16 | cflags-y += $(call cc-option, -fno-jump-tables) | 16 | cflags-y += $(call cc-option, -fno-jump-tables) |
17 | 17 | ||
18 | cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 | 18 | cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4 |
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h index 46cefbd50e73..bae97eb19d26 100644 --- a/arch/alpha/include/asm/floppy.h +++ b/arch/alpha/include/asm/floppy.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) | 26 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) |
27 | #define fd_cacheflush(addr,size) /* nothing */ | 27 | #define fd_cacheflush(addr,size) /* nothing */ |
28 | #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ | 28 | #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\ |
29 | IRQF_DISABLED, "floppy", NULL) | 29 | 0, "floppy", NULL) |
30 | #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) | 30 | #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL) |
31 | 31 | ||
32 | #ifdef CONFIG_PCI | 32 | #ifdef CONFIG_PCI |
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 2872accd2215..7b2be251c30f 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c | |||
@@ -117,13 +117,6 @@ handle_irq(int irq) | |||
117 | return; | 117 | return; |
118 | } | 118 | } |
119 | 119 | ||
120 | /* | ||
121 | * From here we must proceed with IPL_MAX. Note that we do not | ||
122 | * explicitly enable interrupts afterwards - some MILO PALcode | ||
123 | * (namely LX164 one) seems to have severe problems with RTI | ||
124 | * at IPL 0. | ||
125 | */ | ||
126 | local_irq_disable(); | ||
127 | irq_enter(); | 120 | irq_enter(); |
128 | generic_handle_irq_desc(irq, desc); | 121 | generic_handle_irq_desc(irq, desc); |
129 | irq_exit(); | 122 | irq_exit(); |
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index 772ddfdb71a8..f433fc11877a 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c | |||
@@ -45,6 +45,14 @@ do_entInt(unsigned long type, unsigned long vector, | |||
45 | unsigned long la_ptr, struct pt_regs *regs) | 45 | unsigned long la_ptr, struct pt_regs *regs) |
46 | { | 46 | { |
47 | struct pt_regs *old_regs; | 47 | struct pt_regs *old_regs; |
48 | |||
49 | /* | ||
50 | * Disable interrupts during IRQ handling. | ||
51 | * Note that there is no matching local_irq_enable() due to | ||
52 | * severe problems with RTI at IPL0 and some MILO PALcode | ||
53 | * (namely LX164). | ||
54 | */ | ||
55 | local_irq_disable(); | ||
48 | switch (type) { | 56 | switch (type) { |
49 | case 0: | 57 | case 0: |
50 | #ifdef CONFIG_SMP | 58 | #ifdef CONFIG_SMP |
@@ -62,7 +70,6 @@ do_entInt(unsigned long type, unsigned long vector, | |||
62 | { | 70 | { |
63 | long cpu; | 71 | long cpu; |
64 | 72 | ||
65 | local_irq_disable(); | ||
66 | smp_percpu_timer_interrupt(regs); | 73 | smp_percpu_timer_interrupt(regs); |
67 | cpu = smp_processor_id(); | 74 | cpu = smp_processor_id(); |
68 | if (cpu != boot_cpuid) { | 75 | if (cpu != boot_cpuid) { |
@@ -222,7 +229,6 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr, | |||
222 | 229 | ||
223 | struct irqaction timer_irqaction = { | 230 | struct irqaction timer_irqaction = { |
224 | .handler = timer_interrupt, | 231 | .handler = timer_interrupt, |
225 | .flags = IRQF_DISABLED, | ||
226 | .name = "timer", | 232 | .name = "timer", |
227 | }; | 233 | }; |
228 | 234 | ||
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 4d4c046f708d..1383f8601a93 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -188,6 +188,10 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr) | |||
188 | extern void free_reserved_mem(void *, void *); | 188 | extern void free_reserved_mem(void *, void *); |
189 | extern void pcibios_claim_one_bus(struct pci_bus *); | 189 | extern void pcibios_claim_one_bus(struct pci_bus *); |
190 | 190 | ||
191 | static struct resource irongate_io = { | ||
192 | .name = "Irongate PCI IO", | ||
193 | .flags = IORESOURCE_IO, | ||
194 | }; | ||
191 | static struct resource irongate_mem = { | 195 | static struct resource irongate_mem = { |
192 | .name = "Irongate PCI MEM", | 196 | .name = "Irongate PCI MEM", |
193 | .flags = IORESOURCE_MEM, | 197 | .flags = IORESOURCE_MEM, |
@@ -209,6 +213,7 @@ nautilus_init_pci(void) | |||
209 | 213 | ||
210 | irongate = pci_get_bus_and_slot(0, 0); | 214 | irongate = pci_get_bus_and_slot(0, 0); |
211 | bus->self = irongate; | 215 | bus->self = irongate; |
216 | bus->resource[0] = &irongate_io; | ||
212 | bus->resource[1] = &irongate_mem; | 217 | bus->resource[1] = &irongate_mem; |
213 | 218 | ||
214 | pci_bus_size_bridges(bus); | 219 | pci_bus_size_bridges(bus); |
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index 5cf4a481b8c5..a53cf03f49d5 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c | |||
@@ -280,15 +280,15 @@ titan_late_init(void) | |||
280 | * all reported to the kernel as machine checks, so the handler | 280 | * all reported to the kernel as machine checks, so the handler |
281 | * is a nop so it can be called to count the individual events. | 281 | * is a nop so it can be called to count the individual events. |
282 | */ | 282 | */ |
283 | titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED, | 283 | titan_request_irq(63+16, titan_intr_nop, 0, |
284 | "CChip Error", NULL); | 284 | "CChip Error", NULL); |
285 | titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED, | 285 | titan_request_irq(62+16, titan_intr_nop, 0, |
286 | "PChip 0 H_Error", NULL); | 286 | "PChip 0 H_Error", NULL); |
287 | titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED, | 287 | titan_request_irq(61+16, titan_intr_nop, 0, |
288 | "PChip 1 H_Error", NULL); | 288 | "PChip 1 H_Error", NULL); |
289 | titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED, | 289 | titan_request_irq(60+16, titan_intr_nop, 0, |
290 | "PChip 0 C_Error", NULL); | 290 | "PChip 0 C_Error", NULL); |
291 | titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED, | 291 | titan_request_irq(59+16, titan_intr_nop, 0, |
292 | "PChip 1 C_Error", NULL); | 292 | "PChip 1 C_Error", NULL); |
293 | 293 | ||
294 | /* | 294 | /* |
@@ -348,9 +348,9 @@ privateer_init_pci(void) | |||
348 | * Hook a couple of extra err interrupts that the | 348 | * Hook a couple of extra err interrupts that the |
349 | * common titan code won't. | 349 | * common titan code won't. |
350 | */ | 350 | */ |
351 | titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED, | 351 | titan_request_irq(53+16, titan_intr_nop, 0, |
352 | "NMI", NULL); | 352 | "NMI", NULL); |
353 | titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED, | 353 | titan_request_irq(50+16, titan_intr_nop, 0, |
354 | "Temperature Warning", NULL); | 354 | "Temperature Warning", NULL); |
355 | 355 | ||
356 | /* | 356 | /* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index eb91022b90ba..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 |
@@ -777,6 +778,7 @@ config ARCH_S3C24XX | |||
777 | select HAVE_S3C2410_I2C if I2C | 778 | select HAVE_S3C2410_I2C if I2C |
778 | select HAVE_S3C2410_WATCHDOG if WATCHDOG | 779 | select HAVE_S3C2410_WATCHDOG if WATCHDOG |
779 | select HAVE_S3C_RTC if RTC_CLASS | 780 | select HAVE_S3C_RTC if RTC_CLASS |
781 | select MULTI_IRQ_HANDLER | ||
780 | select NEED_MACH_GPIO_H | 782 | select NEED_MACH_GPIO_H |
781 | select NEED_MACH_IO_H | 783 | select NEED_MACH_IO_H |
782 | help | 784 | help |
@@ -938,16 +940,8 @@ config ARCH_NOMADIK | |||
938 | help | 940 | help |
939 | Support for the Nomadik platform by ST-Ericsson | 941 | Support for the Nomadik platform by ST-Ericsson |
940 | 942 | ||
941 | config PLAT_SPEAR | 943 | config PLAT_SPEAR_SINGLE |
942 | bool "ST SPEAr" | 944 | bool "ST SPEAr" |
943 | select ARCH_HAS_CPUFREQ | ||
944 | select ARCH_REQUIRE_GPIOLIB | ||
945 | select ARM_AMBA | ||
946 | select CLKDEV_LOOKUP | ||
947 | select CLKSRC_MMIO | ||
948 | select COMMON_CLK | ||
949 | select GENERIC_CLOCKEVENTS | ||
950 | select HAVE_CLK | ||
951 | help | 945 | help |
952 | Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). | 946 | Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). |
953 | 947 | ||
@@ -1109,7 +1103,7 @@ source "arch/arm/plat-samsung/Kconfig" | |||
1109 | 1103 | ||
1110 | source "arch/arm/mach-socfpga/Kconfig" | 1104 | source "arch/arm/mach-socfpga/Kconfig" |
1111 | 1105 | ||
1112 | source "arch/arm/plat-spear/Kconfig" | 1106 | source "arch/arm/mach-spear/Kconfig" |
1113 | 1107 | ||
1114 | source "arch/arm/mach-s3c24xx/Kconfig" | 1108 | source "arch/arm/mach-s3c24xx/Kconfig" |
1115 | 1109 | ||
@@ -1178,6 +1172,7 @@ config PLAT_VERSATILE | |||
1178 | config ARM_TIMER_SP804 | 1172 | config ARM_TIMER_SP804 |
1179 | bool | 1173 | bool |
1180 | select CLKSRC_MMIO | 1174 | select CLKSRC_MMIO |
1175 | select CLKSRC_OF if OF | ||
1181 | select HAVE_SCHED_CLOCK | 1176 | select HAVE_SCHED_CLOCK |
1182 | 1177 | ||
1183 | source arch/arm/mm/Kconfig | 1178 | source arch/arm/mm/Kconfig |
@@ -1188,9 +1183,9 @@ config ARM_NR_BANKS | |||
1188 | default 8 | 1183 | default 8 |
1189 | 1184 | ||
1190 | config IWMMXT | 1185 | config IWMMXT |
1191 | bool "Enable iWMMXt support" | 1186 | bool "Enable iWMMXt support" if !CPU_PJ4 |
1192 | depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 | 1187 | depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 |
1193 | default y if PXA27x || PXA3xx || ARCH_MMP | 1188 | default y if PXA27x || PXA3xx || ARCH_MMP || CPU_PJ4 |
1194 | help | 1189 | help |
1195 | Enable support for iWMMXt context switching at run time if | 1190 | Enable support for iWMMXt context switching at run time if |
1196 | running on a CPU that supports it. | 1191 | running on a CPU that supports it. |
@@ -1444,6 +1439,16 @@ config ARM_ERRATA_775420 | |||
1444 | to deadlock. This workaround puts DSB before executing ISB if | 1439 | to deadlock. This workaround puts DSB before executing ISB if |
1445 | an abort may occur on cache maintenance. | 1440 | an abort may occur on cache maintenance. |
1446 | 1441 | ||
1442 | config ARM_ERRATA_798181 | ||
1443 | bool "ARM errata: TLBI/DSB failure on Cortex-A15" | ||
1444 | depends on CPU_V7 && SMP | ||
1445 | help | ||
1446 | On Cortex-A15 (r0p0..r3p2) the TLBI*IS/DSB operations are not | ||
1447 | adequately shooting down all use of the old entries. This | ||
1448 | option enables the Linux kernel workaround for this erratum | ||
1449 | which sends an IPI to the CPUs that are running the same ASID | ||
1450 | as the one being invalidated. | ||
1451 | |||
1447 | endmenu | 1452 | endmenu |
1448 | 1453 | ||
1449 | source "arch/arm/common/Kconfig" | 1454 | source "arch/arm/common/Kconfig" |
@@ -1652,7 +1657,7 @@ config LOCAL_TIMERS | |||
1652 | bool "Use local timer interrupts" | 1657 | bool "Use local timer interrupts" |
1653 | depends on SMP | 1658 | depends on SMP |
1654 | default y | 1659 | default y |
1655 | select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT) | 1660 | select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !CLKSRC_EXYNOS_MCT) |
1656 | help | 1661 | help |
1657 | Enable support for local timers on SMP platforms, rather then the | 1662 | Enable support for local timers on SMP platforms, rather then the |
1658 | legacy IPI broadcast method. Local timers allows the system | 1663 | legacy IPI broadcast method. Local timers allows the system |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index ee4605f400b0..8276536815a8 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -191,9 +191,7 @@ machine-$(CONFIG_ARCH_VT8500) += vt8500 | |||
191 | machine-$(CONFIG_ARCH_W90X900) += w90x900 | 191 | machine-$(CONFIG_ARCH_W90X900) += w90x900 |
192 | machine-$(CONFIG_FOOTBRIDGE) += footbridge | 192 | machine-$(CONFIG_FOOTBRIDGE) += footbridge |
193 | machine-$(CONFIG_ARCH_SOCFPGA) += socfpga | 193 | machine-$(CONFIG_ARCH_SOCFPGA) += socfpga |
194 | machine-$(CONFIG_ARCH_SPEAR13XX) += spear13xx | 194 | machine-$(CONFIG_PLAT_SPEAR) += spear |
195 | machine-$(CONFIG_ARCH_SPEAR3XX) += spear3xx | ||
196 | machine-$(CONFIG_MACH_SPEAR600) += spear6xx | ||
197 | machine-$(CONFIG_ARCH_VIRT) += virt | 195 | machine-$(CONFIG_ARCH_VIRT) += virt |
198 | machine-$(CONFIG_ARCH_ZYNQ) += zynq | 196 | machine-$(CONFIG_ARCH_ZYNQ) += zynq |
199 | machine-$(CONFIG_ARCH_SUNXI) += sunxi | 197 | machine-$(CONFIG_ARCH_SUNXI) += sunxi |
@@ -207,7 +205,6 @@ plat-$(CONFIG_PLAT_ORION) += orion | |||
207 | plat-$(CONFIG_PLAT_PXA) += pxa | 205 | plat-$(CONFIG_PLAT_PXA) += pxa |
208 | plat-$(CONFIG_PLAT_S3C24XX) += samsung | 206 | plat-$(CONFIG_PLAT_S3C24XX) += samsung |
209 | plat-$(CONFIG_PLAT_S5P) += samsung | 207 | plat-$(CONFIG_PLAT_S5P) += samsung |
210 | plat-$(CONFIG_PLAT_SPEAR) += spear | ||
211 | plat-$(CONFIG_PLAT_VERSATILE) += versatile | 208 | plat-$(CONFIG_PLAT_VERSATILE) += versatile |
212 | 209 | ||
213 | ifeq ($(CONFIG_ARCH_EBSA110),y) | 210 | ifeq ($(CONFIG_ARCH_EBSA110),y) |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 9c6255884cbb..e35b0a7ac77b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -31,6 +31,11 @@ dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb | |||
31 | dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb | 31 | dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb |
32 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb | 32 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb |
33 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb | 33 | dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb |
34 | # sama5d3 | ||
35 | dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb | ||
36 | dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb | ||
37 | dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb | ||
38 | dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb | ||
34 | 39 | ||
35 | dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb | 40 | dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb |
36 | dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb | 41 | dtb-$(CONFIG_ARCH_BCM) += bcm11351-brt.dtb |
@@ -165,6 +170,8 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ | |||
165 | tegra30-cardhu-a04.dtb \ | 170 | tegra30-cardhu-a04.dtb \ |
166 | tegra114-dalmore.dtb \ | 171 | tegra114-dalmore.dtb \ |
167 | tegra114-pluto.dtb | 172 | tegra114-pluto.dtb |
173 | dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ | ||
174 | versatile-pb.dtb | ||
168 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ | 175 | dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ |
169 | vexpress-v2p-ca9.dtb \ | 176 | vexpress-v2p-ca9.dtb \ |
170 | vexpress-v2p-ca15-tc1.dtb \ | 177 | vexpress-v2p-ca15-tc1.dtb \ |
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts index dd0c57dd9f30..3234875824dc 100644 --- a/arch/arm/boot/dts/armada-370-mirabox.dts +++ b/arch/arm/boot/dts/armada-370-mirabox.dts | |||
@@ -54,7 +54,7 @@ | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | mvsdio@d00d4000 { | 56 | mvsdio@d00d4000 { |
57 | pinctrl-0 = <&sdio_pins2>; | 57 | pinctrl-0 = <&sdio_pins3>; |
58 | pinctrl-names = "default"; | 58 | pinctrl-names = "default"; |
59 | status = "okay"; | 59 | status = "okay"; |
60 | /* | 60 | /* |
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi index 8188d138020e..a195debb67d3 100644 --- a/arch/arm/boot/dts/armada-370.dtsi +++ b/arch/arm/boot/dts/armada-370.dtsi | |||
@@ -59,6 +59,12 @@ | |||
59 | "mpp50", "mpp51", "mpp52"; | 59 | "mpp50", "mpp51", "mpp52"; |
60 | marvell,function = "sd0"; | 60 | marvell,function = "sd0"; |
61 | }; | 61 | }; |
62 | |||
63 | sdio_pins3: sdio-pins3 { | ||
64 | marvell,pins = "mpp48", "mpp49", "mpp50", | ||
65 | "mpp51", "mpp52", "mpp53"; | ||
66 | marvell,function = "sd0"; | ||
67 | }; | ||
62 | }; | 68 | }; |
63 | 69 | ||
64 | gpio0: gpio@d0018100 { | 70 | gpio0: gpio@d0018100 { |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index 6b1d4cab24c2..2b6e30cbc48b 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -108,6 +108,7 @@ | |||
108 | compatible = "atmel,at91sam9g45-dma"; | 108 | compatible = "atmel,at91sam9g45-dma"; |
109 | reg = <0xffffec00 0x200>; | 109 | reg = <0xffffec00 0x200>; |
110 | interrupts = <21 4 0>; | 110 | interrupts = <21 4 0>; |
111 | #dma-cells = <2>; | ||
111 | }; | 112 | }; |
112 | 113 | ||
113 | pinctrl@fffff200 { | 114 | pinctrl@fffff200 { |
@@ -512,6 +513,8 @@ | |||
512 | compatible = "atmel,hsmci"; | 513 | compatible = "atmel,hsmci"; |
513 | reg = <0xfff80000 0x600>; | 514 | reg = <0xfff80000 0x600>; |
514 | interrupts = <11 4 0>; | 515 | interrupts = <11 4 0>; |
516 | dmas = <&dma 1 0>; | ||
517 | dma-names = "rxtx"; | ||
515 | #address-cells = <1>; | 518 | #address-cells = <1>; |
516 | #size-cells = <0>; | 519 | #size-cells = <0>; |
517 | status = "disabled"; | 520 | status = "disabled"; |
@@ -521,6 +524,8 @@ | |||
521 | compatible = "atmel,hsmci"; | 524 | compatible = "atmel,hsmci"; |
522 | reg = <0xfffd0000 0x600>; | 525 | reg = <0xfffd0000 0x600>; |
523 | interrupts = <29 4 0>; | 526 | interrupts = <29 4 0>; |
527 | dmas = <&dma 1 13>; | ||
528 | dma-names = "rxtx"; | ||
524 | #address-cells = <1>; | 529 | #address-cells = <1>; |
525 | #size-cells = <0>; | 530 | #size-cells = <0>; |
526 | status = "disabled"; | 531 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 7750f98dd764..b0bd70485f87 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
@@ -89,6 +89,8 @@ | |||
89 | compatible = "atmel,hsmci"; | 89 | compatible = "atmel,hsmci"; |
90 | reg = <0xf0008000 0x600>; | 90 | reg = <0xf0008000 0x600>; |
91 | interrupts = <12 4 0>; | 91 | interrupts = <12 4 0>; |
92 | dmas = <&dma 1 0>; | ||
93 | dma-names = "rxtx"; | ||
92 | #address-cells = <1>; | 94 | #address-cells = <1>; |
93 | #size-cells = <0>; | 95 | #size-cells = <0>; |
94 | status = "disabled"; | 96 | status = "disabled"; |
@@ -110,6 +112,7 @@ | |||
110 | compatible = "atmel,at91sam9g45-dma"; | 112 | compatible = "atmel,at91sam9g45-dma"; |
111 | reg = <0xffffec00 0x200>; | 113 | reg = <0xffffec00 0x200>; |
112 | interrupts = <20 4 0>; | 114 | interrupts = <20 4 0>; |
115 | #dma-cells = <2>; | ||
113 | }; | 116 | }; |
114 | 117 | ||
115 | pinctrl@fffff400 { | 118 | pinctrl@fffff400 { |
@@ -360,6 +363,9 @@ | |||
360 | compatible = "atmel,at91sam9x5-i2c"; | 363 | compatible = "atmel,at91sam9x5-i2c"; |
361 | reg = <0xf8010000 0x100>; | 364 | reg = <0xf8010000 0x100>; |
362 | interrupts = <9 4 6>; | 365 | interrupts = <9 4 6>; |
366 | dmas = <&dma 1 13>, | ||
367 | <&dma 1 14>; | ||
368 | dma-names = "tx", "rx"; | ||
363 | #address-cells = <1>; | 369 | #address-cells = <1>; |
364 | #size-cells = <0>; | 370 | #size-cells = <0>; |
365 | status = "disabled"; | 371 | status = "disabled"; |
@@ -369,6 +375,9 @@ | |||
369 | compatible = "atmel,at91sam9x5-i2c"; | 375 | compatible = "atmel,at91sam9x5-i2c"; |
370 | reg = <0xf8014000 0x100>; | 376 | reg = <0xf8014000 0x100>; |
371 | interrupts = <10 4 6>; | 377 | interrupts = <10 4 6>; |
378 | dmas = <&dma 1 15>, | ||
379 | <&dma 1 16>; | ||
380 | dma-names = "tx", "rx"; | ||
372 | #address-cells = <1>; | 381 | #address-cells = <1>; |
373 | #size-cells = <0>; | 382 | #size-cells = <0>; |
374 | status = "disabled"; | 383 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index a98c0d50fbbe..cbb94732786c 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -104,12 +104,14 @@ | |||
104 | compatible = "atmel,at91sam9g45-dma"; | 104 | compatible = "atmel,at91sam9g45-dma"; |
105 | reg = <0xffffec00 0x200>; | 105 | reg = <0xffffec00 0x200>; |
106 | interrupts = <20 4 0>; | 106 | interrupts = <20 4 0>; |
107 | #dma-cells = <2>; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | dma1: dma-controller@ffffee00 { | 110 | dma1: dma-controller@ffffee00 { |
110 | compatible = "atmel,at91sam9g45-dma"; | 111 | compatible = "atmel,at91sam9g45-dma"; |
111 | reg = <0xffffee00 0x200>; | 112 | reg = <0xffffee00 0x200>; |
112 | interrupts = <21 4 0>; | 113 | interrupts = <21 4 0>; |
114 | #dma-cells = <2>; | ||
113 | }; | 115 | }; |
114 | 116 | ||
115 | pinctrl@fffff400 { | 117 | pinctrl@fffff400 { |
@@ -399,6 +401,8 @@ | |||
399 | compatible = "atmel,hsmci"; | 401 | compatible = "atmel,hsmci"; |
400 | reg = <0xf0008000 0x600>; | 402 | reg = <0xf0008000 0x600>; |
401 | interrupts = <12 4 0>; | 403 | interrupts = <12 4 0>; |
404 | dmas = <&dma0 1 0>; | ||
405 | dma-names = "rxtx"; | ||
402 | #address-cells = <1>; | 406 | #address-cells = <1>; |
403 | #size-cells = <0>; | 407 | #size-cells = <0>; |
404 | status = "disabled"; | 408 | status = "disabled"; |
@@ -408,6 +412,8 @@ | |||
408 | compatible = "atmel,hsmci"; | 412 | compatible = "atmel,hsmci"; |
409 | reg = <0xf000c000 0x600>; | 413 | reg = <0xf000c000 0x600>; |
410 | interrupts = <26 4 0>; | 414 | interrupts = <26 4 0>; |
415 | dmas = <&dma1 1 0>; | ||
416 | dma-names = "rxtx"; | ||
411 | #address-cells = <1>; | 417 | #address-cells = <1>; |
412 | #size-cells = <0>; | 418 | #size-cells = <0>; |
413 | status = "disabled"; | 419 | status = "disabled"; |
@@ -469,6 +475,9 @@ | |||
469 | compatible = "atmel,at91sam9x5-i2c"; | 475 | compatible = "atmel,at91sam9x5-i2c"; |
470 | reg = <0xf8010000 0x100>; | 476 | reg = <0xf8010000 0x100>; |
471 | interrupts = <9 4 6>; | 477 | interrupts = <9 4 6>; |
478 | dmas = <&dma0 1 7>, | ||
479 | <&dma0 1 8>; | ||
480 | dma-names = "tx", "rx"; | ||
472 | #address-cells = <1>; | 481 | #address-cells = <1>; |
473 | #size-cells = <0>; | 482 | #size-cells = <0>; |
474 | status = "disabled"; | 483 | status = "disabled"; |
@@ -478,6 +487,9 @@ | |||
478 | compatible = "atmel,at91sam9x5-i2c"; | 487 | compatible = "atmel,at91sam9x5-i2c"; |
479 | reg = <0xf8014000 0x100>; | 488 | reg = <0xf8014000 0x100>; |
480 | interrupts = <10 4 6>; | 489 | interrupts = <10 4 6>; |
490 | dmas = <&dma1 1 5>, | ||
491 | <&dma1 1 6>; | ||
492 | dma-names = "tx", "rx"; | ||
481 | #address-cells = <1>; | 493 | #address-cells = <1>; |
482 | #size-cells = <0>; | 494 | #size-cells = <0>; |
483 | status = "disabled"; | 495 | status = "disabled"; |
@@ -487,6 +499,9 @@ | |||
487 | compatible = "atmel,at91sam9x5-i2c"; | 499 | compatible = "atmel,at91sam9x5-i2c"; |
488 | reg = <0xf8018000 0x100>; | 500 | reg = <0xf8018000 0x100>; |
489 | interrupts = <11 4 6>; | 501 | interrupts = <11 4 6>; |
502 | dmas = <&dma0 1 9>, | ||
503 | <&dma0 1 10>; | ||
504 | dma-names = "tx", "rx"; | ||
490 | #address-cells = <1>; | 505 | #address-cells = <1>; |
491 | #size-cells = <0>; | 506 | #size-cells = <0>; |
492 | status = "disabled"; | 507 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi index 9de93096601a..aaa63d0a8096 100644 --- a/arch/arm/boot/dts/dbx5x0.dtsi +++ b/arch/arm/boot/dts/dbx5x0.dtsi | |||
@@ -191,8 +191,8 @@ | |||
191 | 191 | ||
192 | prcmu: prcmu@80157000 { | 192 | prcmu: prcmu@80157000 { |
193 | compatible = "stericsson,db8500-prcmu"; | 193 | compatible = "stericsson,db8500-prcmu"; |
194 | reg = <0x80157000 0x1000>; | 194 | reg = <0x80157000 0x1000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>; |
195 | reg-names = "prcmu"; | 195 | reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm"; |
196 | interrupts = <0 47 0x4>; | 196 | interrupts = <0 47 0x4>; |
197 | #address-cells = <1>; | 197 | #address-cells = <1>; |
198 | #size-cells = <1>; | 198 | #size-cells = <1>; |
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/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts index bd83b8fc7c83..c3573be7b92c 100644 --- a/arch/arm/boot/dts/kirkwood-goflexnet.dts +++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts | |||
@@ -77,6 +77,7 @@ | |||
77 | }; | 77 | }; |
78 | 78 | ||
79 | nand@3000000 { | 79 | nand@3000000 { |
80 | chip-delay = <40>; | ||
80 | status = "okay"; | 81 | status = "okay"; |
81 | 82 | ||
82 | partition@0 { | 83 | partition@0 { |
diff --git a/arch/arm/boot/dts/orion5x.dtsi b/arch/arm/boot/dts/orion5x.dtsi index 8aad00f81ed9..f7bec3b1ba32 100644 --- a/arch/arm/boot/dts/orion5x.dtsi +++ b/arch/arm/boot/dts/orion5x.dtsi | |||
@@ -13,6 +13,9 @@ | |||
13 | compatible = "marvell,orion5x"; | 13 | compatible = "marvell,orion5x"; |
14 | interrupt-parent = <&intc>; | 14 | interrupt-parent = <&intc>; |
15 | 15 | ||
16 | aliases { | ||
17 | gpio0 = &gpio0; | ||
18 | }; | ||
16 | intc: interrupt-controller { | 19 | intc: interrupt-controller { |
17 | compatible = "marvell,orion-intc", "marvell,intc"; | 20 | compatible = "marvell,orion-intc", "marvell,intc"; |
18 | interrupt-controller; | 21 | interrupt-controller; |
@@ -32,7 +35,9 @@ | |||
32 | #gpio-cells = <2>; | 35 | #gpio-cells = <2>; |
33 | gpio-controller; | 36 | gpio-controller; |
34 | reg = <0x10100 0x40>; | 37 | reg = <0x10100 0x40>; |
35 | ngpio = <32>; | 38 | ngpios = <32>; |
39 | interrupt-controller; | ||
40 | #interrupt-cells = <2>; | ||
36 | interrupts = <6>, <7>, <8>, <9>; | 41 | interrupts = <6>, <7>, <8>, <9>; |
37 | }; | 42 | }; |
38 | 43 | ||
@@ -91,7 +96,7 @@ | |||
91 | reg = <0x90000 0x10000>, | 96 | reg = <0x90000 0x10000>, |
92 | <0xf2200000 0x800>; | 97 | <0xf2200000 0x800>; |
93 | reg-names = "regs", "sram"; | 98 | reg-names = "regs", "sram"; |
94 | interrupts = <22>; | 99 | interrupts = <28>; |
95 | status = "okay"; | 100 | status = "okay"; |
96 | }; | 101 | }; |
97 | }; | 102 | }; |
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi new file mode 100644 index 000000000000..2e643ea51cce --- /dev/null +++ b/arch/arm/boot/dts/sama5d3.dtsi | |||
@@ -0,0 +1,1046 @@ | |||
1 | /* | ||
2 | * sama5d3.dtsi - Device Tree Include file for SAMA5D3 family SoC | ||
3 | * applies to SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35 SoC | ||
4 | * | ||
5 | * Copyright (C) 2013 Atmel, | ||
6 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
7 | * | ||
8 | * Licensed under GPLv2 or later. | ||
9 | */ | ||
10 | |||
11 | /include/ "skeleton.dtsi" | ||
12 | |||
13 | / { | ||
14 | model = "Atmel SAMA5D3 family SoC"; | ||
15 | compatible = "atmel,sama5d3", "atmel,sama5"; | ||
16 | interrupt-parent = <&aic>; | ||
17 | |||
18 | aliases { | ||
19 | serial0 = &dbgu; | ||
20 | serial1 = &usart0; | ||
21 | serial2 = &usart1; | ||
22 | serial3 = &usart2; | ||
23 | serial4 = &usart3; | ||
24 | gpio0 = &pioA; | ||
25 | gpio1 = &pioB; | ||
26 | gpio2 = &pioC; | ||
27 | gpio3 = &pioD; | ||
28 | gpio4 = &pioE; | ||
29 | tcb0 = &tcb0; | ||
30 | tcb1 = &tcb1; | ||
31 | i2c0 = &i2c0; | ||
32 | i2c1 = &i2c1; | ||
33 | i2c2 = &i2c2; | ||
34 | ssc0 = &ssc0; | ||
35 | ssc1 = &ssc1; | ||
36 | }; | ||
37 | cpus { | ||
38 | cpu@0 { | ||
39 | compatible = "arm,cortex-a5"; | ||
40 | }; | ||
41 | }; | ||
42 | |||
43 | memory { | ||
44 | reg = <0x20000000 0x8000000>; | ||
45 | }; | ||
46 | |||
47 | ahb { | ||
48 | compatible = "simple-bus"; | ||
49 | #address-cells = <1>; | ||
50 | #size-cells = <1>; | ||
51 | ranges; | ||
52 | |||
53 | apb { | ||
54 | compatible = "simple-bus"; | ||
55 | #address-cells = <1>; | ||
56 | #size-cells = <1>; | ||
57 | ranges; | ||
58 | |||
59 | mmc0: mmc@f0000000 { | ||
60 | compatible = "atmel,hsmci"; | ||
61 | reg = <0xf0000000 0x600>; | ||
62 | interrupts = <21 4 0>; | ||
63 | dmas = <&dma0 2 0>; | ||
64 | dma-names = "rxtx"; | ||
65 | pinctrl-names = "default"; | ||
66 | pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7>; | ||
67 | status = "disabled"; | ||
68 | #address-cells = <1>; | ||
69 | #size-cells = <0>; | ||
70 | }; | ||
71 | |||
72 | spi0: spi@f0004000 { | ||
73 | #address-cells = <1>; | ||
74 | #size-cells = <0>; | ||
75 | compatible = "atmel,at91sam9x5-spi"; | ||
76 | reg = <0xf0004000 0x100>; | ||
77 | interrupts = <24 4 3>; | ||
78 | cs-gpios = <&pioD 13 0 | ||
79 | &pioD 14 0 /* conflicts with SCK0 and CANRX0 */ | ||
80 | &pioD 15 0 /* conflicts with CTS0 and CANTX0 */ | ||
81 | &pioD 16 0 /* conflicts with RTS0 and PWMFI3 */ | ||
82 | >; | ||
83 | pinctrl-names = "default"; | ||
84 | pinctrl-0 = <&pinctrl_spi0>; | ||
85 | status = "disabled"; | ||
86 | }; | ||
87 | |||
88 | ssc0: ssc@f0008000 { | ||
89 | compatible = "atmel,at91sam9g45-ssc"; | ||
90 | reg = <0xf0008000 0x4000>; | ||
91 | interrupts = <38 4 4>; | ||
92 | pinctrl-names = "default"; | ||
93 | pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; | ||
94 | status = "disabled"; | ||
95 | }; | ||
96 | |||
97 | can0: can@f000c000 { | ||
98 | compatible = "atmel,at91sam9x5-can"; | ||
99 | reg = <0xf000c000 0x300>; | ||
100 | interrupts = <40 4 3>; | ||
101 | pinctrl-names = "default"; | ||
102 | pinctrl-0 = <&pinctrl_can0_rx_tx>; | ||
103 | status = "disabled"; | ||
104 | }; | ||
105 | |||
106 | tcb0: timer@f0010000 { | ||
107 | compatible = "atmel,at91sam9x5-tcb"; | ||
108 | reg = <0xf0010000 0x100>; | ||
109 | interrupts = <26 4 0>; | ||
110 | }; | ||
111 | |||
112 | i2c0: i2c@f0014000 { | ||
113 | compatible = "atmel,at91sam9x5-i2c"; | ||
114 | reg = <0xf0014000 0x4000>; | ||
115 | interrupts = <18 4 6>; | ||
116 | dmas = <&dma0 2 7>, | ||
117 | <&dma0 2 8>; | ||
118 | dma-names = "tx", "rx"; | ||
119 | pinctrl-names = "default"; | ||
120 | pinctrl-0 = <&pinctrl_i2c0>; | ||
121 | #address-cells = <1>; | ||
122 | #size-cells = <0>; | ||
123 | status = "disabled"; | ||
124 | }; | ||
125 | |||
126 | i2c1: i2c@f0018000 { | ||
127 | compatible = "atmel,at91sam9x5-i2c"; | ||
128 | reg = <0xf0018000 0x4000>; | ||
129 | interrupts = <19 4 6>; | ||
130 | dmas = <&dma0 2 9>, | ||
131 | <&dma0 2 10>; | ||
132 | dma-names = "tx", "rx"; | ||
133 | pinctrl-names = "default"; | ||
134 | pinctrl-0 = <&pinctrl_i2c1>; | ||
135 | #address-cells = <1>; | ||
136 | #size-cells = <0>; | ||
137 | status = "disabled"; | ||
138 | }; | ||
139 | |||
140 | usart0: serial@f001c000 { | ||
141 | compatible = "atmel,at91sam9260-usart"; | ||
142 | reg = <0xf001c000 0x100>; | ||
143 | interrupts = <12 4 5>; | ||
144 | pinctrl-names = "default"; | ||
145 | pinctrl-0 = <&pinctrl_usart0>; | ||
146 | status = "disabled"; | ||
147 | }; | ||
148 | |||
149 | usart1: serial@f0020000 { | ||
150 | compatible = "atmel,at91sam9260-usart"; | ||
151 | reg = <0xf0020000 0x100>; | ||
152 | interrupts = <13 4 5>; | ||
153 | pinctrl-names = "default"; | ||
154 | pinctrl-0 = <&pinctrl_usart1>; | ||
155 | status = "disabled"; | ||
156 | }; | ||
157 | |||
158 | macb0: ethernet@f0028000 { | ||
159 | compatible = "cnds,pc302-gem", "cdns,gem"; | ||
160 | reg = <0xf0028000 0x100>; | ||
161 | interrupts = <34 4 3>; | ||
162 | pinctrl-names = "default"; | ||
163 | pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; | ||
164 | status = "disabled"; | ||
165 | }; | ||
166 | |||
167 | isi: isi@f0034000 { | ||
168 | compatible = "atmel,at91sam9g45-isi"; | ||
169 | reg = <0xf0034000 0x4000>; | ||
170 | interrupts = <37 4 5>; | ||
171 | status = "disabled"; | ||
172 | }; | ||
173 | |||
174 | mmc1: mmc@f8000000 { | ||
175 | compatible = "atmel,hsmci"; | ||
176 | reg = <0xf8000000 0x600>; | ||
177 | interrupts = <22 4 0>; | ||
178 | dmas = <&dma1 2 0>; | ||
179 | dma-names = "rxtx"; | ||
180 | pinctrl-names = "default"; | ||
181 | pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>; | ||
182 | status = "disabled"; | ||
183 | #address-cells = <1>; | ||
184 | #size-cells = <0>; | ||
185 | }; | ||
186 | |||
187 | mmc2: mmc@f8004000 { | ||
188 | compatible = "atmel,hsmci"; | ||
189 | reg = <0xf8004000 0x600>; | ||
190 | interrupts = <23 4 0>; | ||
191 | dmas = <&dma1 2 1>; | ||
192 | dma-names = "rxtx"; | ||
193 | pinctrl-names = "default"; | ||
194 | pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; | ||
195 | status = "disabled"; | ||
196 | #address-cells = <1>; | ||
197 | #size-cells = <0>; | ||
198 | }; | ||
199 | |||
200 | spi1: spi@f8008000 { | ||
201 | #address-cells = <1>; | ||
202 | #size-cells = <0>; | ||
203 | compatible = "atmel,at91sam9x5-spi"; | ||
204 | reg = <0xf8008000 0x100>; | ||
205 | interrupts = <25 4 3>; | ||
206 | cs-gpios = <&pioC 25 0 | ||
207 | &pioC 26 0 /* conflitcs with TWD1 and ISI_D11 */ | ||
208 | &pioC 27 0 /* conflitcs with TWCK1 and ISI_D10 */ | ||
209 | &pioC 28 0 /* conflitcs with PWMFI0 and ISI_D9 */ | ||
210 | >; | ||
211 | pinctrl-names = "default"; | ||
212 | pinctrl-0 = <&pinctrl_spi1>; | ||
213 | status = "disabled"; | ||
214 | }; | ||
215 | |||
216 | ssc1: ssc@f800c000 { | ||
217 | compatible = "atmel,at91sam9g45-ssc"; | ||
218 | reg = <0xf800c000 0x4000>; | ||
219 | interrupts = <39 4 4>; | ||
220 | pinctrl-names = "default"; | ||
221 | pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; | ||
222 | status = "disabled"; | ||
223 | }; | ||
224 | |||
225 | can1: can@f8010000 { | ||
226 | compatible = "atmel,at91sam9x5-can"; | ||
227 | reg = <0xf8010000 0x300>; | ||
228 | interrupts = <41 4 3>; | ||
229 | pinctrl-names = "default"; | ||
230 | pinctrl-0 = <&pinctrl_can1_rx_tx>; | ||
231 | }; | ||
232 | |||
233 | tcb1: timer@f8014000 { | ||
234 | compatible = "atmel,at91sam9x5-tcb"; | ||
235 | reg = <0xf8014000 0x100>; | ||
236 | interrupts = <27 4 0>; | ||
237 | }; | ||
238 | |||
239 | adc0: adc@f8018000 { | ||
240 | compatible = "atmel,at91sam9260-adc"; | ||
241 | reg = <0xf8018000 0x100>; | ||
242 | interrupts = <29 4 5>; | ||
243 | pinctrl-names = "default"; | ||
244 | pinctrl-0 = < | ||
245 | &pinctrl_adc0_adtrg | ||
246 | &pinctrl_adc0_ad0 | ||
247 | &pinctrl_adc0_ad1 | ||
248 | &pinctrl_adc0_ad2 | ||
249 | &pinctrl_adc0_ad3 | ||
250 | &pinctrl_adc0_ad4 | ||
251 | &pinctrl_adc0_ad5 | ||
252 | &pinctrl_adc0_ad6 | ||
253 | &pinctrl_adc0_ad7 | ||
254 | &pinctrl_adc0_ad8 | ||
255 | &pinctrl_adc0_ad9 | ||
256 | &pinctrl_adc0_ad10 | ||
257 | &pinctrl_adc0_ad11 | ||
258 | >; | ||
259 | atmel,adc-channel-base = <0x50>; | ||
260 | atmel,adc-channels-used = <0xfff>; | ||
261 | atmel,adc-drdy-mask = <0x1000000>; | ||
262 | atmel,adc-num-channels = <12>; | ||
263 | atmel,adc-startup-time = <40>; | ||
264 | atmel,adc-status-register = <0x30>; | ||
265 | atmel,adc-trigger-register = <0xc0>; | ||
266 | atmel,adc-use-external; | ||
267 | atmel,adc-vref = <3000>; | ||
268 | atmel,adc-res = <10 12>; | ||
269 | atmel,adc-res-names = "lowres", "highres"; | ||
270 | status = "disabled"; | ||
271 | |||
272 | trigger@0 { | ||
273 | trigger-name = "external-rising"; | ||
274 | trigger-value = <0x1>; | ||
275 | trigger-external; | ||
276 | }; | ||
277 | trigger@1 { | ||
278 | trigger-name = "external-falling"; | ||
279 | trigger-value = <0x2>; | ||
280 | trigger-external; | ||
281 | }; | ||
282 | trigger@2 { | ||
283 | trigger-name = "external-any"; | ||
284 | trigger-value = <0x3>; | ||
285 | trigger-external; | ||
286 | }; | ||
287 | trigger@3 { | ||
288 | trigger-name = "continuous"; | ||
289 | trigger-value = <0x6>; | ||
290 | }; | ||
291 | }; | ||
292 | |||
293 | tsadcc: tsadcc@f8018000 { | ||
294 | compatible = "atmel,at91sam9x5-tsadcc"; | ||
295 | reg = <0xf8018000 0x4000>; | ||
296 | interrupts = <29 4 5>; | ||
297 | atmel,tsadcc_clock = <300000>; | ||
298 | atmel,filtering_average = <0x03>; | ||
299 | atmel,pendet_debounce = <0x08>; | ||
300 | atmel,pendet_sensitivity = <0x02>; | ||
301 | atmel,ts_sample_hold_time = <0x0a>; | ||
302 | status = "disabled"; | ||
303 | }; | ||
304 | |||
305 | i2c2: i2c@f801c000 { | ||
306 | compatible = "atmel,at91sam9x5-i2c"; | ||
307 | reg = <0xf801c000 0x4000>; | ||
308 | interrupts = <20 4 6>; | ||
309 | dmas = <&dma1 2 11>, | ||
310 | <&dma1 2 12>; | ||
311 | dma-names = "tx", "rx"; | ||
312 | #address-cells = <1>; | ||
313 | #size-cells = <0>; | ||
314 | status = "disabled"; | ||
315 | }; | ||
316 | |||
317 | usart2: serial@f8020000 { | ||
318 | compatible = "atmel,at91sam9260-usart"; | ||
319 | reg = <0xf8020000 0x100>; | ||
320 | interrupts = <14 4 5>; | ||
321 | pinctrl-names = "default"; | ||
322 | pinctrl-0 = <&pinctrl_usart2>; | ||
323 | status = "disabled"; | ||
324 | }; | ||
325 | |||
326 | usart3: serial@f8024000 { | ||
327 | compatible = "atmel,at91sam9260-usart"; | ||
328 | reg = <0xf8024000 0x100>; | ||
329 | interrupts = <15 4 5>; | ||
330 | pinctrl-names = "default"; | ||
331 | pinctrl-0 = <&pinctrl_usart3>; | ||
332 | status = "disabled"; | ||
333 | }; | ||
334 | |||
335 | macb1: ethernet@f802c000 { | ||
336 | compatible = "cdns,at32ap7000-macb", "cdns,macb"; | ||
337 | reg = <0xf802c000 0x100>; | ||
338 | interrupts = <35 4 3>; | ||
339 | pinctrl-names = "default"; | ||
340 | pinctrl-0 = <&pinctrl_macb1_rmii>; | ||
341 | status = "disabled"; | ||
342 | }; | ||
343 | |||
344 | sha@f8034000 { | ||
345 | compatible = "atmel,sam9g46-sha"; | ||
346 | reg = <0xf8034000 0x100>; | ||
347 | interrupts = <42 4 0>; | ||
348 | }; | ||
349 | |||
350 | aes@f8038000 { | ||
351 | compatible = "atmel,sam9g46-aes"; | ||
352 | reg = <0xf8038000 0x100>; | ||
353 | interrupts = <43 4 0>; | ||
354 | }; | ||
355 | |||
356 | tdes@f803c000 { | ||
357 | compatible = "atmel,sam9g46-tdes"; | ||
358 | reg = <0xf803c000 0x100>; | ||
359 | interrupts = <44 4 0>; | ||
360 | }; | ||
361 | |||
362 | dma0: dma-controller@ffffe600 { | ||
363 | compatible = "atmel,at91sam9g45-dma"; | ||
364 | reg = <0xffffe600 0x200>; | ||
365 | interrupts = <30 4 0>; | ||
366 | #dma-cells = <2>; | ||
367 | }; | ||
368 | |||
369 | dma1: dma-controller@ffffe800 { | ||
370 | compatible = "atmel,at91sam9g45-dma"; | ||
371 | reg = <0xffffe800 0x200>; | ||
372 | interrupts = <31 4 0>; | ||
373 | #dma-cells = <2>; | ||
374 | }; | ||
375 | |||
376 | ramc0: ramc@ffffea00 { | ||
377 | compatible = "atmel,at91sam9g45-ddramc"; | ||
378 | reg = <0xffffea00 0x200>; | ||
379 | }; | ||
380 | |||
381 | dbgu: serial@ffffee00 { | ||
382 | compatible = "atmel,at91sam9260-usart"; | ||
383 | reg = <0xffffee00 0x200>; | ||
384 | interrupts = <2 4 7>; | ||
385 | pinctrl-names = "default"; | ||
386 | pinctrl-0 = <&pinctrl_dbgu>; | ||
387 | status = "disabled"; | ||
388 | }; | ||
389 | |||
390 | aic: interrupt-controller@fffff000 { | ||
391 | #interrupt-cells = <3>; | ||
392 | compatible = "atmel,sama5d3-aic"; | ||
393 | interrupt-controller; | ||
394 | reg = <0xfffff000 0x200>; | ||
395 | atmel,external-irqs = <47>; | ||
396 | }; | ||
397 | |||
398 | pinctrl@fffff200 { | ||
399 | #address-cells = <1>; | ||
400 | #size-cells = <1>; | ||
401 | compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus"; | ||
402 | ranges = <0xfffff200 0xfffff200 0xa00>; | ||
403 | atmel,mux-mask = < | ||
404 | /* A B C */ | ||
405 | 0xffffffff 0xc0fc0000 0xc0ff0000 /* pioA */ | ||
406 | 0xffffffff 0x0ff8ffff 0x00000000 /* pioB */ | ||
407 | 0xffffffff 0xbc00f1ff 0x7c00fc00 /* pioC */ | ||
408 | 0xffffffff 0xc001c0e0 0x0001c1e0 /* pioD */ | ||
409 | 0xffffffff 0xbf9f8000 0x18000000 /* pioE */ | ||
410 | >; | ||
411 | |||
412 | /* shared pinctrl settings */ | ||
413 | adc0 { | ||
414 | pinctrl_adc0_adtrg: adc0_adtrg { | ||
415 | atmel,pins = | ||
416 | <3 19 0x1 0x0>; /* PD19 periph A ADTRG */ | ||
417 | }; | ||
418 | pinctrl_adc0_ad0: adc0_ad0 { | ||
419 | atmel,pins = | ||
420 | <3 20 0x1 0x0>; /* PD20 periph A AD0 */ | ||
421 | }; | ||
422 | pinctrl_adc0_ad1: adc0_ad1 { | ||
423 | atmel,pins = | ||
424 | <3 21 0x1 0x0>; /* PD21 periph A AD1 */ | ||
425 | }; | ||
426 | pinctrl_adc0_ad2: adc0_ad2 { | ||
427 | atmel,pins = | ||
428 | <3 22 0x1 0x0>; /* PD22 periph A AD2 */ | ||
429 | }; | ||
430 | pinctrl_adc0_ad3: adc0_ad3 { | ||
431 | atmel,pins = | ||
432 | <3 23 0x1 0x0>; /* PD23 periph A AD3 */ | ||
433 | }; | ||
434 | pinctrl_adc0_ad4: adc0_ad4 { | ||
435 | atmel,pins = | ||
436 | <3 24 0x1 0x0>; /* PD24 periph A AD4 */ | ||
437 | }; | ||
438 | pinctrl_adc0_ad5: adc0_ad5 { | ||
439 | atmel,pins = | ||
440 | <3 25 0x1 0x0>; /* PD25 periph A AD5 */ | ||
441 | }; | ||
442 | pinctrl_adc0_ad6: adc0_ad6 { | ||
443 | atmel,pins = | ||
444 | <3 26 0x1 0x0>; /* PD26 periph A AD6 */ | ||
445 | }; | ||
446 | pinctrl_adc0_ad7: adc0_ad7 { | ||
447 | atmel,pins = | ||
448 | <3 27 0x1 0x0>; /* PD27 periph A AD7 */ | ||
449 | }; | ||
450 | pinctrl_adc0_ad8: adc0_ad8 { | ||
451 | atmel,pins = | ||
452 | <3 28 0x1 0x0>; /* PD28 periph A AD8 */ | ||
453 | }; | ||
454 | pinctrl_adc0_ad9: adc0_ad9 { | ||
455 | atmel,pins = | ||
456 | <3 29 0x1 0x0>; /* PD29 periph A AD9 */ | ||
457 | }; | ||
458 | pinctrl_adc0_ad10: adc0_ad10 { | ||
459 | atmel,pins = | ||
460 | <3 30 0x1 0x0>; /* PD30 periph A AD10, conflicts with PCK0 */ | ||
461 | }; | ||
462 | pinctrl_adc0_ad11: adc0_ad11 { | ||
463 | atmel,pins = | ||
464 | <3 31 0x1 0x0>; /* PD31 periph A AD11, conflicts with PCK1 */ | ||
465 | }; | ||
466 | }; | ||
467 | |||
468 | can0 { | ||
469 | pinctrl_can0_rx_tx: can0_rx_tx { | ||
470 | atmel,pins = | ||
471 | <3 14 0x3 0x0 /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */ | ||
472 | 3 15 0x3 0x0>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */ | ||
473 | }; | ||
474 | }; | ||
475 | |||
476 | can1 { | ||
477 | pinctrl_can1_rx_tx: can1_rx_tx { | ||
478 | atmel,pins = | ||
479 | <1 14 0x2 0x0 /* PB14 periph B RX, conflicts with GCRS */ | ||
480 | 1 15 0x2 0x0>; /* PB15 periph B TX, conflicts with GCOL */ | ||
481 | }; | ||
482 | }; | ||
483 | |||
484 | dbgu { | ||
485 | pinctrl_dbgu: dbgu-0 { | ||
486 | atmel,pins = | ||
487 | <1 30 0x1 0x0 /* PB30 periph A */ | ||
488 | 1 31 0x1 0x1>; /* PB31 periph A with pullup */ | ||
489 | }; | ||
490 | }; | ||
491 | |||
492 | i2c0 { | ||
493 | pinctrl_i2c0: i2c0-0 { | ||
494 | atmel,pins = | ||
495 | <0 30 0x1 0x0 /* PA30 periph A TWD0 pin, conflicts with URXD1, ISI_VSYNC */ | ||
496 | 0 31 0x1 0x0>; /* PA31 periph A TWCK0 pin, conflicts with UTXD1, ISI_HSYNC */ | ||
497 | }; | ||
498 | }; | ||
499 | |||
500 | i2c1 { | ||
501 | pinctrl_i2c1: i2c1-0 { | ||
502 | atmel,pins = | ||
503 | <2 26 0x2 0x0 /* PC26 periph B TWD1 pin, conflicts with SPI1_NPCS1, ISI_D11 */ | ||
504 | 2 27 0x2 0x0>; /* PC27 periph B TWCK1 pin, conflicts with SPI1_NPCS2, ISI_D10 */ | ||
505 | }; | ||
506 | }; | ||
507 | |||
508 | isi { | ||
509 | pinctrl_isi: isi-0 { | ||
510 | atmel,pins = | ||
511 | <0 16 0x3 0x0 /* PA16 periph C ISI_D0, conflicts with LCDDAT16 */ | ||
512 | 0 17 0x3 0x0 /* PA17 periph C ISI_D1, conflicts with LCDDAT17 */ | ||
513 | 0 18 0x3 0x0 /* PA18 periph C ISI_D2, conflicts with LCDDAT18, TWD2 */ | ||
514 | 0 19 0x3 0x0 /* PA19 periph C ISI_D3, conflicts with LCDDAT19, TWCK2 */ | ||
515 | 0 20 0x3 0x0 /* PA20 periph C ISI_D4, conflicts with LCDDAT20, PWMH0 */ | ||
516 | 0 21 0x3 0x0 /* PA21 periph C ISI_D5, conflicts with LCDDAT21, PWML0 */ | ||
517 | 0 22 0x3 0x0 /* PA22 periph C ISI_D6, conflicts with LCDDAT22, PWMH1 */ | ||
518 | 0 23 0x3 0x0 /* PA23 periph C ISI_D7, conflicts with LCDDAT23, PWML1 */ | ||
519 | 2 30 0x3 0x0 /* PC30 periph C ISI_PCK, conflicts with UTXD0 */ | ||
520 | 0 31 0x3 0x0 /* PA31 periph C ISI_HSYNC, conflicts with TWCK0, UTXD1 */ | ||
521 | 0 30 0x3 0x0 /* PA30 periph C ISI_VSYNC, conflicts with TWD0, URXD1 */ | ||
522 | 2 29 0x3 0x0 /* PC29 periph C ISI_PD8, conflicts with URXD0, PWMFI2 */ | ||
523 | 2 28 0x3 0x0>; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */ | ||
524 | }; | ||
525 | pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { | ||
526 | atmel,pins = | ||
527 | <3 31 0x2 0x0>; /* PD31 periph B ISI_MCK */ | ||
528 | }; | ||
529 | }; | ||
530 | |||
531 | lcd { | ||
532 | pinctrl_lcd: lcd-0 { | ||
533 | atmel,pins = | ||
534 | <0 24 0x1 0x0 /* PA24 periph A LCDPWM */ | ||
535 | 0 26 0x1 0x0 /* PA26 periph A LCDVSYNC */ | ||
536 | 0 27 0x1 0x0 /* PA27 periph A LCDHSYNC */ | ||
537 | 0 25 0x1 0x0 /* PA25 periph A LCDDISP */ | ||
538 | 0 29 0x1 0x0 /* PA29 periph A LCDDEN */ | ||
539 | 0 28 0x1 0x0 /* PA28 periph A LCDPCK */ | ||
540 | 0 0 0x1 0x0 /* PA0 periph A LCDD0 pin */ | ||
541 | 0 1 0x1 0x0 /* PA1 periph A LCDD1 pin */ | ||
542 | 0 2 0x1 0x0 /* PA2 periph A LCDD2 pin */ | ||
543 | 0 3 0x1 0x0 /* PA3 periph A LCDD3 pin */ | ||
544 | 0 4 0x1 0x0 /* PA4 periph A LCDD4 pin */ | ||
545 | 0 5 0x1 0x0 /* PA5 periph A LCDD5 pin */ | ||
546 | 0 6 0x1 0x0 /* PA6 periph A LCDD6 pin */ | ||
547 | 0 7 0x1 0x0 /* PA7 periph A LCDD7 pin */ | ||
548 | 0 8 0x1 0x0 /* PA8 periph A LCDD8 pin */ | ||
549 | 0 9 0x1 0x0 /* PA9 periph A LCDD9 pin */ | ||
550 | 0 10 0x1 0x0 /* PA10 periph A LCDD10 pin */ | ||
551 | 0 11 0x1 0x0 /* PA11 periph A LCDD11 pin */ | ||
552 | 0 12 0x1 0x0 /* PA12 periph A LCDD12 pin */ | ||
553 | 0 13 0x1 0x0 /* PA13 periph A LCDD13 pin */ | ||
554 | 0 14 0x1 0x0 /* PA14 periph A LCDD14 pin */ | ||
555 | 0 15 0x1 0x0 /* PA15 periph A LCDD15 pin */ | ||
556 | 2 14 0x3 0x0 /* PC14 periph C LCDD16 pin */ | ||
557 | 2 13 0x3 0x0 /* PC13 periph C LCDD17 pin */ | ||
558 | 2 12 0x3 0x0 /* PC12 periph C LCDD18 pin */ | ||
559 | 2 11 0x3 0x0 /* PC11 periph C LCDD19 pin */ | ||
560 | 2 10 0x3 0x0 /* PC10 periph C LCDD20 pin */ | ||
561 | 2 15 0x3 0x0 /* PC15 periph C LCDD21 pin */ | ||
562 | 4 27 0x3 0x0 /* PE27 periph C LCDD22 pin */ | ||
563 | 4 28 0x3 0x0>; /* PE28 periph C LCDD23 pin */ | ||
564 | }; | ||
565 | }; | ||
566 | |||
567 | macb0 { | ||
568 | pinctrl_macb0_data_rgmii: macb0_data_rgmii { | ||
569 | atmel,pins = | ||
570 | <1 0 0x1 0x0 /* PB0 periph A GTX0, conflicts with PWMH0 */ | ||
571 | 1 1 0x1 0x0 /* PB1 periph A GTX1, conflicts with PWML0 */ | ||
572 | 1 2 0x1 0x0 /* PB2 periph A GTX2, conflicts with TK1 */ | ||
573 | 1 3 0x1 0x0 /* PB3 periph A GTX3, conflicts with TF1 */ | ||
574 | 1 4 0x1 0x0 /* PB4 periph A GRX0, conflicts with PWMH1 */ | ||
575 | 1 5 0x1 0x0 /* PB5 periph A GRX1, conflicts with PWML1 */ | ||
576 | 1 6 0x1 0x0 /* PB6 periph A GRX2, conflicts with TD1 */ | ||
577 | 1 7 0x1 0x0>; /* PB7 periph A GRX3, conflicts with RK1 */ | ||
578 | }; | ||
579 | pinctrl_macb0_data_gmii: macb0_data_gmii { | ||
580 | atmel,pins = | ||
581 | <1 19 0x2 0x0 /* PB19 periph B GTX4, conflicts with MCI1_CDA */ | ||
582 | 1 20 0x2 0x0 /* PB20 periph B GTX5, conflicts with MCI1_DA0 */ | ||
583 | 1 21 0x2 0x0 /* PB21 periph B GTX6, conflicts with MCI1_DA1 */ | ||
584 | 1 22 0x2 0x0 /* PB22 periph B GTX7, conflicts with MCI1_DA2 */ | ||
585 | 1 23 0x2 0x0 /* PB23 periph B GRX4, conflicts with MCI1_DA3 */ | ||
586 | 1 24 0x2 0x0 /* PB24 periph B GRX5, conflicts with MCI1_CK */ | ||
587 | 1 25 0x2 0x0 /* PB25 periph B GRX6, conflicts with SCK1 */ | ||
588 | 1 26 0x2 0x0>; /* PB26 periph B GRX7, conflicts with CTS1 */ | ||
589 | }; | ||
590 | pinctrl_macb0_signal_rgmii: macb0_signal_rgmii { | ||
591 | atmel,pins = | ||
592 | <1 8 0x1 0x0 /* PB8 periph A GTXCK, conflicts with PWMH2 */ | ||
593 | 1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */ | ||
594 | 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */ | ||
595 | 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */ | ||
596 | 1 16 0x1 0x0 /* PB16 periph A GMDC */ | ||
597 | 1 17 0x1 0x0 /* PB17 periph A GMDIO */ | ||
598 | 1 18 0x1 0x0>; /* PB18 periph A G125CK */ | ||
599 | }; | ||
600 | pinctrl_macb0_signal_gmii: macb0_signal_gmii { | ||
601 | atmel,pins = | ||
602 | <1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */ | ||
603 | 1 10 0x1 0x0 /* PB10 periph A GTXER, conflicts with RF1 */ | ||
604 | 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */ | ||
605 | 1 12 0x1 0x0 /* PB12 periph A GRXDV, conflicts with PWMH3 */ | ||
606 | 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */ | ||
607 | 1 14 0x1 0x0 /* PB14 periph A GCRS, conflicts with CANRX1 */ | ||
608 | 1 15 0x1 0x0 /* PB15 periph A GCOL, conflicts with CANTX1 */ | ||
609 | 1 16 0x1 0x0 /* PB16 periph A GMDC */ | ||
610 | 1 17 0x1 0x0 /* PB17 periph A GMDIO */ | ||
611 | 1 27 0x2 0x0>; /* PB27 periph B G125CKO */ | ||
612 | }; | ||
613 | |||
614 | }; | ||
615 | |||
616 | macb1 { | ||
617 | pinctrl_macb1_rmii: macb1_rmii-0 { | ||
618 | atmel,pins = | ||
619 | <2 0 0x1 0x0 /* PC0 periph A ETX0, conflicts with TIOA3 */ | ||
620 | 2 1 0x1 0x0 /* PC1 periph A ETX1, conflicts with TIOB3 */ | ||
621 | 2 2 0x1 0x0 /* PC2 periph A ERX0, conflicts with TCLK3 */ | ||
622 | 2 3 0x1 0x0 /* PC3 periph A ERX1, conflicts with TIOA4 */ | ||
623 | 2 4 0x1 0x0 /* PC4 periph A ETXEN, conflicts with TIOB4 */ | ||
624 | 2 5 0x1 0x0 /* PC5 periph A ECRSDV,conflicts with TCLK4 */ | ||
625 | 2 6 0x1 0x0 /* PC6 periph A ERXER, conflicts with TIOA5 */ | ||
626 | 2 7 0x1 0x0 /* PC7 periph A EREFCK, conflicts with TIOB5 */ | ||
627 | 2 8 0x1 0x0 /* PC8 periph A EMDC, conflicts with TCLK5 */ | ||
628 | 2 9 0x1 0x0>; /* PC9 periph A EMDIO */ | ||
629 | }; | ||
630 | }; | ||
631 | |||
632 | mmc0 { | ||
633 | pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 { | ||
634 | atmel,pins = | ||
635 | <3 9 0x1 0x0 /* PD9 periph A MCI0_CK */ | ||
636 | 3 0 0x1 0x1 /* PD0 periph A MCI0_CDA with pullup */ | ||
637 | 3 1 0x1 0x1>; /* PD1 periph A MCI0_DA0 with pullup */ | ||
638 | }; | ||
639 | pinctrl_mmc0_dat1_3: mmc0_dat1_3 { | ||
640 | atmel,pins = | ||
641 | <3 2 0x1 0x1 /* PD2 periph A MCI0_DA1 with pullup */ | ||
642 | 3 3 0x1 0x1 /* PD3 periph A MCI0_DA2 with pullup */ | ||
643 | 3 4 0x1 0x1>; /* PD4 periph A MCI0_DA3 with pullup */ | ||
644 | }; | ||
645 | pinctrl_mmc0_dat4_7: mmc0_dat4_7 { | ||
646 | atmel,pins = | ||
647 | <3 5 0x1 0x1 /* PD5 periph A MCI0_DA4 with pullup, conflicts with TIOA0, PWMH2 */ | ||
648 | 3 6 0x1 0x1 /* PD6 periph A MCI0_DA5 with pullup, conflicts with TIOB0, PWML2 */ | ||
649 | 3 7 0x1 0x1 /* PD7 periph A MCI0_DA6 with pullup, conlicts with TCLK0, PWMH3 */ | ||
650 | 3 8 0x1 0x1>; /* PD8 periph A MCI0_DA7 with pullup, conflicts with PWML3 */ | ||
651 | }; | ||
652 | }; | ||
653 | |||
654 | mmc1 { | ||
655 | pinctrl_mmc1_clk_cmd_dat0: mmc1_clk_cmd_dat0 { | ||
656 | atmel,pins = | ||
657 | <1 24 0x1 0x0 /* PB24 periph A MCI1_CK, conflicts with GRX5 */ | ||
658 | 1 19 0x1 0x1 /* PB19 periph A MCI1_CDA with pullup, conflicts with GTX4 */ | ||
659 | 1 20 0x1 0x1>; /* PB20 periph A MCI1_DA0 with pullup, conflicts with GTX5 */ | ||
660 | }; | ||
661 | pinctrl_mmc1_dat1_3: mmc1_dat1_3 { | ||
662 | atmel,pins = | ||
663 | <1 21 0x1 0x1 /* PB21 periph A MCI1_DA1 with pullup, conflicts with GTX6 */ | ||
664 | 1 22 0x1 0x1 /* PB22 periph A MCI1_DA2 with pullup, conflicts with GTX7 */ | ||
665 | 1 23 0x1 0x1>; /* PB23 periph A MCI1_DA3 with pullup, conflicts with GRX4 */ | ||
666 | }; | ||
667 | }; | ||
668 | |||
669 | mmc2 { | ||
670 | pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 { | ||
671 | atmel,pins = | ||
672 | <2 15 0x1 0x0 /* PC15 periph A MCI2_CK, conflicts with PCK2 */ | ||
673 | 2 10 0x1 0x1 /* PC10 periph A MCI2_CDA with pullup */ | ||
674 | 2 11 0x1 0x1>; /* PC11 periph A MCI2_DA0 with pullup */ | ||
675 | }; | ||
676 | pinctrl_mmc2_dat1_3: mmc2_dat1_3 { | ||
677 | atmel,pins = | ||
678 | <2 12 0x1 0x0 /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */ | ||
679 | 2 13 0x1 0x0 /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */ | ||
680 | 2 14 0x1 0x0>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */ | ||
681 | }; | ||
682 | }; | ||
683 | |||
684 | nand0 { | ||
685 | pinctrl_nand0_ale_cle: nand0_ale_cle-0 { | ||
686 | atmel,pins = | ||
687 | <4 21 0x1 0x1 /* PE21 periph A with pullup */ | ||
688 | 4 22 0x1 0x1>; /* PE22 periph A with pullup */ | ||
689 | }; | ||
690 | }; | ||
691 | |||
692 | pioA: gpio@fffff200 { | ||
693 | compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | ||
694 | reg = <0xfffff200 0x100>; | ||
695 | interrupts = <6 4 1>; | ||
696 | #gpio-cells = <2>; | ||
697 | gpio-controller; | ||
698 | interrupt-controller; | ||
699 | #interrupt-cells = <2>; | ||
700 | }; | ||
701 | |||
702 | pioB: gpio@fffff400 { | ||
703 | compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | ||
704 | reg = <0xfffff400 0x100>; | ||
705 | interrupts = <7 4 1>; | ||
706 | #gpio-cells = <2>; | ||
707 | gpio-controller; | ||
708 | interrupt-controller; | ||
709 | #interrupt-cells = <2>; | ||
710 | }; | ||
711 | |||
712 | pioC: gpio@fffff600 { | ||
713 | compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | ||
714 | reg = <0xfffff600 0x100>; | ||
715 | interrupts = <8 4 1>; | ||
716 | #gpio-cells = <2>; | ||
717 | gpio-controller; | ||
718 | interrupt-controller; | ||
719 | #interrupt-cells = <2>; | ||
720 | }; | ||
721 | |||
722 | pioD: gpio@fffff800 { | ||
723 | compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | ||
724 | reg = <0xfffff800 0x100>; | ||
725 | interrupts = <9 4 1>; | ||
726 | #gpio-cells = <2>; | ||
727 | gpio-controller; | ||
728 | interrupt-controller; | ||
729 | #interrupt-cells = <2>; | ||
730 | }; | ||
731 | |||
732 | pioE: gpio@fffffa00 { | ||
733 | compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; | ||
734 | reg = <0xfffffa00 0x100>; | ||
735 | interrupts = <10 4 1>; | ||
736 | #gpio-cells = <2>; | ||
737 | gpio-controller; | ||
738 | interrupt-controller; | ||
739 | #interrupt-cells = <2>; | ||
740 | }; | ||
741 | |||
742 | spi0 { | ||
743 | pinctrl_spi0: spi0-0 { | ||
744 | atmel,pins = | ||
745 | <3 10 0x1 0x0 /* PD10 periph A SPI0_MISO pin */ | ||
746 | 3 11 0x1 0x0 /* PD11 periph A SPI0_MOSI pin */ | ||
747 | 3 12 0x1 0x0 /* PD12 periph A SPI0_SPCK pin */ | ||
748 | 3 13 0x0 0x0>; /* PD13 GPIO SPI0_NPCS0 pin */ | ||
749 | }; | ||
750 | }; | ||
751 | |||
752 | spi1 { | ||
753 | pinctrl_spi1: spi1-0 { | ||
754 | atmel,pins = | ||
755 | <2 22 0x1 0x0 /* PC22 periph A SPI1_MISO pin */ | ||
756 | 2 23 0x1 0x0 /* PC23 periph A SPI1_MOSI pin */ | ||
757 | 2 24 0x1 0x0 /* PC24 periph A SPI1_SPCK pin */ | ||
758 | 2 25 0x0 0x0>; /* PC25 GPIO SPI1_NPCS0 pin */ | ||
759 | }; | ||
760 | }; | ||
761 | |||
762 | ssc0 { | ||
763 | pinctrl_ssc0_tx: ssc0_tx { | ||
764 | atmel,pins = | ||
765 | <2 16 0x1 0x0 /* PC16 periph A TK0 */ | ||
766 | 2 17 0x1 0x0 /* PC17 periph A TF0 */ | ||
767 | 2 18 0x1 0x0>; /* PC18 periph A TD0 */ | ||
768 | }; | ||
769 | |||
770 | pinctrl_ssc0_rx: ssc0_rx { | ||
771 | atmel,pins = | ||
772 | <2 19 0x1 0x0 /* PC19 periph A RK0 */ | ||
773 | 2 20 0x1 0x0 /* PC20 periph A RF0 */ | ||
774 | 2 21 0x1 0x0>; /* PC21 periph A RD0 */ | ||
775 | }; | ||
776 | }; | ||
777 | |||
778 | ssc1 { | ||
779 | pinctrl_ssc1_tx: ssc1_tx { | ||
780 | atmel,pins = | ||
781 | <1 2 0x2 0x0 /* PB2 periph B TK1, conflicts with GTX2 */ | ||
782 | 1 3 0x2 0x0 /* PB3 periph B TF1, conflicts with GTX3 */ | ||
783 | 1 6 0x2 0x0>; /* PB6 periph B TD1, conflicts with TD1 */ | ||
784 | }; | ||
785 | |||
786 | pinctrl_ssc1_rx: ssc1_rx { | ||
787 | atmel,pins = | ||
788 | <1 7 0x2 0x0 /* PB7 periph B RK1, conflicts with EREFCK */ | ||
789 | 1 10 0x2 0x0 /* PB10 periph B RF1, conflicts with GTXER */ | ||
790 | 1 11 0x2 0x0>; /* PB11 periph B RD1, conflicts with GRXCK */ | ||
791 | }; | ||
792 | }; | ||
793 | |||
794 | uart0 { | ||
795 | pinctrl_uart0: uart0-0 { | ||
796 | atmel,pins = | ||
797 | <2 29 0x1 0x0 /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */ | ||
798 | 2 30 0x1 0x1>; /* PC30 periph A with pullup, conflicts with ISI_PCK */ | ||
799 | }; | ||
800 | }; | ||
801 | |||
802 | uart1 { | ||
803 | pinctrl_uart1: uart1-0 { | ||
804 | atmel,pins = | ||
805 | <0 30 0x2 0x0 /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */ | ||
806 | 0 31 0x2 0x1>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */ | ||
807 | }; | ||
808 | }; | ||
809 | |||
810 | usart0 { | ||
811 | pinctrl_usart0: usart0-0 { | ||
812 | atmel,pins = | ||
813 | <3 17 0x1 0x0 /* PD17 periph A */ | ||
814 | 3 18 0x1 0x1>; /* PD18 periph A with pullup */ | ||
815 | }; | ||
816 | |||
817 | pinctrl_usart0_rts_cts: usart0_rts_cts-0 { | ||
818 | atmel,pins = | ||
819 | <3 15 0x1 0x0 /* PD15 periph A, conflicts with SPI0_NPCS2, CANTX0 */ | ||
820 | 3 16 0x1 0x0>; /* PD16 periph A, conflicts with SPI0_NPCS3, PWMFI3 */ | ||
821 | }; | ||
822 | }; | ||
823 | |||
824 | usart1 { | ||
825 | pinctrl_usart1: usart1-0 { | ||
826 | atmel,pins = | ||
827 | <1 28 0x1 0x0 /* PB28 periph A */ | ||
828 | 1 29 0x1 0x1>; /* PB29 periph A with pullup */ | ||
829 | }; | ||
830 | |||
831 | pinctrl_usart1_rts_cts: usart1_rts_cts-0 { | ||
832 | atmel,pins = | ||
833 | <1 26 0x1 0x0 /* PB26 periph A, conflicts with GRX7 */ | ||
834 | 1 27 0x1 0x0>; /* PB27 periph A, conflicts with G125CKO */ | ||
835 | }; | ||
836 | }; | ||
837 | |||
838 | usart2 { | ||
839 | pinctrl_usart2: usart2-0 { | ||
840 | atmel,pins = | ||
841 | <4 25 0x2 0x0 /* PE25 periph B, conflicts with A25 */ | ||
842 | 4 26 0x2 0x1>; /* PE26 periph B with pullup, conflicts NCS0 */ | ||
843 | }; | ||
844 | |||
845 | pinctrl_usart2_rts_cts: usart2_rts_cts-0 { | ||
846 | atmel,pins = | ||
847 | <4 23 0x2 0x0 /* PE23 periph B, conflicts with A23 */ | ||
848 | 4 24 0x2 0x0>; /* PE24 periph B, conflicts with A24 */ | ||
849 | }; | ||
850 | }; | ||
851 | |||
852 | usart3 { | ||
853 | pinctrl_usart3: usart3-0 { | ||
854 | atmel,pins = | ||
855 | <4 18 0x2 0x0 /* PE18 periph B, conflicts with A18 */ | ||
856 | 4 19 0x2 0x1>; /* PE19 periph B with pullup, conflicts with A19 */ | ||
857 | }; | ||
858 | |||
859 | pinctrl_usart3_rts_cts: usart3_rts_cts-0 { | ||
860 | atmel,pins = | ||
861 | <4 16 0x2 0x0 /* PE16 periph B, conflicts with A16 */ | ||
862 | 4 17 0x2 0x0>; /* PE17 periph B, conflicts with A17 */ | ||
863 | }; | ||
864 | }; | ||
865 | }; | ||
866 | |||
867 | pmc: pmc@fffffc00 { | ||
868 | compatible = "atmel,at91rm9200-pmc"; | ||
869 | reg = <0xfffffc00 0x120>; | ||
870 | }; | ||
871 | |||
872 | rstc@fffffe00 { | ||
873 | compatible = "atmel,at91sam9g45-rstc"; | ||
874 | reg = <0xfffffe00 0x10>; | ||
875 | }; | ||
876 | |||
877 | pit: timer@fffffe30 { | ||
878 | compatible = "atmel,at91sam9260-pit"; | ||
879 | reg = <0xfffffe30 0xf>; | ||
880 | interrupts = <3 4 5>; | ||
881 | }; | ||
882 | |||
883 | watchdog@fffffe40 { | ||
884 | compatible = "atmel,at91sam9260-wdt"; | ||
885 | reg = <0xfffffe40 0x10>; | ||
886 | status = "disabled"; | ||
887 | }; | ||
888 | |||
889 | rtc@fffffeb0 { | ||
890 | compatible = "atmel,at91rm9200-rtc"; | ||
891 | reg = <0xfffffeb0 0x30>; | ||
892 | interrupts = <1 4 7>; | ||
893 | }; | ||
894 | }; | ||
895 | |||
896 | usb0: gadget@00500000 { | ||
897 | #address-cells = <1>; | ||
898 | #size-cells = <0>; | ||
899 | compatible = "atmel,at91sam9rl-udc"; | ||
900 | reg = <0x00500000 0x100000 | ||
901 | 0xf8030000 0x4000>; | ||
902 | interrupts = <33 4 2>; | ||
903 | status = "disabled"; | ||
904 | |||
905 | ep0 { | ||
906 | reg = <0>; | ||
907 | atmel,fifo-size = <64>; | ||
908 | atmel,nb-banks = <1>; | ||
909 | }; | ||
910 | |||
911 | ep1 { | ||
912 | reg = <1>; | ||
913 | atmel,fifo-size = <1024>; | ||
914 | atmel,nb-banks = <3>; | ||
915 | atmel,can-dma; | ||
916 | atmel,can-isoc; | ||
917 | }; | ||
918 | |||
919 | ep2 { | ||
920 | reg = <2>; | ||
921 | atmel,fifo-size = <1024>; | ||
922 | atmel,nb-banks = <3>; | ||
923 | atmel,can-dma; | ||
924 | atmel,can-isoc; | ||
925 | }; | ||
926 | |||
927 | ep3 { | ||
928 | reg = <3>; | ||
929 | atmel,fifo-size = <1024>; | ||
930 | atmel,nb-banks = <2>; | ||
931 | atmel,can-dma; | ||
932 | }; | ||
933 | |||
934 | ep4 { | ||
935 | reg = <4>; | ||
936 | atmel,fifo-size = <1024>; | ||
937 | atmel,nb-banks = <2>; | ||
938 | atmel,can-dma; | ||
939 | }; | ||
940 | |||
941 | ep5 { | ||
942 | reg = <5>; | ||
943 | atmel,fifo-size = <1024>; | ||
944 | atmel,nb-banks = <2>; | ||
945 | atmel,can-dma; | ||
946 | }; | ||
947 | |||
948 | ep6 { | ||
949 | reg = <6>; | ||
950 | atmel,fifo-size = <1024>; | ||
951 | atmel,nb-banks = <2>; | ||
952 | atmel,can-dma; | ||
953 | }; | ||
954 | |||
955 | ep7 { | ||
956 | reg = <7>; | ||
957 | atmel,fifo-size = <1024>; | ||
958 | atmel,nb-banks = <2>; | ||
959 | atmel,can-dma; | ||
960 | }; | ||
961 | |||
962 | ep8 { | ||
963 | reg = <8>; | ||
964 | atmel,fifo-size = <1024>; | ||
965 | atmel,nb-banks = <2>; | ||
966 | }; | ||
967 | |||
968 | ep9 { | ||
969 | reg = <9>; | ||
970 | atmel,fifo-size = <1024>; | ||
971 | atmel,nb-banks = <2>; | ||
972 | }; | ||
973 | |||
974 | ep10 { | ||
975 | reg = <10>; | ||
976 | atmel,fifo-size = <1024>; | ||
977 | atmel,nb-banks = <2>; | ||
978 | }; | ||
979 | |||
980 | ep11 { | ||
981 | reg = <11>; | ||
982 | atmel,fifo-size = <1024>; | ||
983 | atmel,nb-banks = <2>; | ||
984 | }; | ||
985 | |||
986 | ep12 { | ||
987 | reg = <12>; | ||
988 | atmel,fifo-size = <1024>; | ||
989 | atmel,nb-banks = <2>; | ||
990 | }; | ||
991 | |||
992 | ep13 { | ||
993 | reg = <13>; | ||
994 | atmel,fifo-size = <1024>; | ||
995 | atmel,nb-banks = <2>; | ||
996 | }; | ||
997 | |||
998 | ep14 { | ||
999 | reg = <14>; | ||
1000 | atmel,fifo-size = <1024>; | ||
1001 | atmel,nb-banks = <2>; | ||
1002 | }; | ||
1003 | |||
1004 | ep15 { | ||
1005 | reg = <15>; | ||
1006 | atmel,fifo-size = <1024>; | ||
1007 | atmel,nb-banks = <2>; | ||
1008 | }; | ||
1009 | }; | ||
1010 | |||
1011 | usb1: ohci@00600000 { | ||
1012 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | ||
1013 | reg = <0x00600000 0x100000>; | ||
1014 | interrupts = <32 4 2>; | ||
1015 | status = "disabled"; | ||
1016 | }; | ||
1017 | |||
1018 | usb2: ehci@00700000 { | ||
1019 | compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; | ||
1020 | reg = <0x00700000 0x100000>; | ||
1021 | interrupts = <32 4 2>; | ||
1022 | status = "disabled"; | ||
1023 | }; | ||
1024 | |||
1025 | nand0: nand@60000000 { | ||
1026 | compatible = "atmel,at91rm9200-nand"; | ||
1027 | #address-cells = <1>; | ||
1028 | #size-cells = <1>; | ||
1029 | reg = < 0x60000000 0x01000000 /* EBI CS3 */ | ||
1030 | 0xffffc070 0x00000490 /* SMC PMECC regs */ | ||
1031 | 0xffffc500 0x00000100 /* SMC PMECC Error Location regs */ | ||
1032 | 0x00100000 0x00100000 /* ROM code */ | ||
1033 | 0x70000000 0x10000000 /* NFC Command Registers */ | ||
1034 | 0xffffc000 0x00000070 /* NFC HSMC regs */ | ||
1035 | 0x00200000 0x00100000 /* NFC SRAM banks */ | ||
1036 | >; | ||
1037 | interrupts = <5 4 6>; | ||
1038 | atmel,nand-addr-offset = <21>; | ||
1039 | atmel,nand-cmd-offset = <22>; | ||
1040 | pinctrl-names = "default"; | ||
1041 | pinctrl-0 = <&pinctrl_nand0_ale_cle>; | ||
1042 | atmel,pmecc-lookup-table-offset = <0x10000 0x18000>; | ||
1043 | status = "disabled"; | ||
1044 | }; | ||
1045 | }; | ||
1046 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d31ek.dts b/arch/arm/boot/dts/sama5d31ek.dts new file mode 100644 index 000000000000..fa5d216f1db7 --- /dev/null +++ b/arch/arm/boot/dts/sama5d31ek.dts | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * sama5d31ek.dts - Device Tree file for SAMA5D31-EK board | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /dts-v1/; | ||
10 | /include/ "sama5d3xmb.dtsi" | ||
11 | /include/ "sama5d3xdm.dtsi" | ||
12 | |||
13 | / { | ||
14 | model = "Atmel SAMA5D31-EK"; | ||
15 | compatible = "atmel,sama5d31ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
16 | |||
17 | ahb { | ||
18 | apb { | ||
19 | spi0: spi@f0004000 { | ||
20 | status = "okay"; | ||
21 | }; | ||
22 | |||
23 | ssc0: ssc@f0008000 { | ||
24 | status = "okay"; | ||
25 | }; | ||
26 | |||
27 | i2c0: i2c@f0014000 { | ||
28 | status = "okay"; | ||
29 | }; | ||
30 | |||
31 | i2c1: i2c@f0018000 { | ||
32 | status = "okay"; | ||
33 | }; | ||
34 | |||
35 | macb1: ethernet@f802c000 { | ||
36 | status = "okay"; | ||
37 | }; | ||
38 | }; | ||
39 | }; | ||
40 | |||
41 | leds { | ||
42 | d3 { | ||
43 | label = "d3"; | ||
44 | gpios = <&pioE 24 0>; | ||
45 | }; | ||
46 | }; | ||
47 | |||
48 | sound { | ||
49 | status = "okay"; | ||
50 | }; | ||
51 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d33ek.dts b/arch/arm/boot/dts/sama5d33ek.dts new file mode 100644 index 000000000000..c38c9433d7a5 --- /dev/null +++ b/arch/arm/boot/dts/sama5d33ek.dts | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * sama5d33ek.dts - Device Tree file for SAMA5D33-EK board | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /dts-v1/; | ||
10 | /include/ "sama5d3xmb.dtsi" | ||
11 | /include/ "sama5d3xdm.dtsi" | ||
12 | |||
13 | / { | ||
14 | model = "Atmel SAMA5D33-EK"; | ||
15 | compatible = "atmel,sama5d33ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
16 | |||
17 | ahb { | ||
18 | apb { | ||
19 | spi0: spi@f0004000 { | ||
20 | status = "okay"; | ||
21 | }; | ||
22 | |||
23 | ssc0: ssc@f0008000 { | ||
24 | status = "okay"; | ||
25 | }; | ||
26 | |||
27 | i2c0: i2c@f0014000 { | ||
28 | status = "okay"; | ||
29 | }; | ||
30 | |||
31 | i2c1: i2c@f0018000 { | ||
32 | status = "okay"; | ||
33 | }; | ||
34 | |||
35 | macb0: ethernet@f0028000 { | ||
36 | status = "okay"; | ||
37 | }; | ||
38 | }; | ||
39 | }; | ||
40 | |||
41 | sound { | ||
42 | status = "okay"; | ||
43 | }; | ||
44 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d34ek.dts b/arch/arm/boot/dts/sama5d34ek.dts new file mode 100644 index 000000000000..6bebfcdcb1d1 --- /dev/null +++ b/arch/arm/boot/dts/sama5d34ek.dts | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * sama5d34ek.dts - Device Tree file for SAMA5D34-EK board | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /dts-v1/; | ||
10 | /include/ "sama5d3xmb.dtsi" | ||
11 | /include/ "sama5d3xdm.dtsi" | ||
12 | |||
13 | / { | ||
14 | model = "Atmel SAMA5D34-EK"; | ||
15 | compatible = "atmel,sama5d34ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
16 | |||
17 | ahb { | ||
18 | apb { | ||
19 | spi0: spi@f0004000 { | ||
20 | status = "okay"; | ||
21 | }; | ||
22 | |||
23 | ssc0: ssc@f0008000 { | ||
24 | status = "okay"; | ||
25 | }; | ||
26 | |||
27 | can0: can@f000c000 { | ||
28 | status = "okay"; | ||
29 | }; | ||
30 | |||
31 | i2c0: i2c@f0014000 { | ||
32 | status = "okay"; | ||
33 | }; | ||
34 | |||
35 | i2c1: i2c@f0018000 { | ||
36 | status = "okay"; | ||
37 | |||
38 | 24c256@50 { | ||
39 | compatible = "24c256"; | ||
40 | reg = <0x50>; | ||
41 | pagesize = <64>; | ||
42 | }; | ||
43 | }; | ||
44 | |||
45 | macb0: ethernet@f0028000 { | ||
46 | status = "okay"; | ||
47 | }; | ||
48 | }; | ||
49 | }; | ||
50 | |||
51 | leds { | ||
52 | d3 { | ||
53 | label = "d3"; | ||
54 | gpios = <&pioE 24 0>; | ||
55 | }; | ||
56 | }; | ||
57 | |||
58 | sound { | ||
59 | status = "okay"; | ||
60 | }; | ||
61 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d35ek.dts b/arch/arm/boot/dts/sama5d35ek.dts new file mode 100644 index 000000000000..a488fc4e9777 --- /dev/null +++ b/arch/arm/boot/dts/sama5d35ek.dts | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * sama5d35ek.dts - Device Tree file for SAMA5D35-EK board | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /dts-v1/; | ||
10 | /include/ "sama5d3xmb.dtsi" | ||
11 | |||
12 | / { | ||
13 | model = "Atmel SAMA5D35-EK"; | ||
14 | compatible = "atmel,sama5d35ek", "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
15 | |||
16 | ahb { | ||
17 | apb { | ||
18 | spi0: spi@f0004000 { | ||
19 | status = "okay"; | ||
20 | }; | ||
21 | |||
22 | can0: can@f000c000 { | ||
23 | status = "okay"; | ||
24 | }; | ||
25 | |||
26 | i2c1: i2c@f0018000 { | ||
27 | status = "okay"; | ||
28 | }; | ||
29 | |||
30 | macb0: ethernet@f0028000 { | ||
31 | status = "okay"; | ||
32 | }; | ||
33 | |||
34 | isi: isi@f0034000 { | ||
35 | status = "okay"; | ||
36 | }; | ||
37 | |||
38 | macb1: ethernet@f802c000 { | ||
39 | status = "okay"; | ||
40 | }; | ||
41 | }; | ||
42 | }; | ||
43 | |||
44 | gpio_keys { | ||
45 | compatible = "gpio-keys"; | ||
46 | #address-cells = <1>; | ||
47 | #size-cells = <0>; | ||
48 | |||
49 | pb_user1 { | ||
50 | label = "pb_user1"; | ||
51 | gpios = <&pioE 27 0>; | ||
52 | linux,code = <0x100>; | ||
53 | gpio-key,wakeup; | ||
54 | }; | ||
55 | }; | ||
56 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi new file mode 100644 index 000000000000..1f8ed404626c --- /dev/null +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * sama5d3xcm.dtsi - Device Tree Include file for SAMA5D3x CPU Module | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /include/ "sama5d3.dtsi" | ||
10 | |||
11 | / { | ||
12 | compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
13 | |||
14 | chosen { | ||
15 | bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs"; | ||
16 | }; | ||
17 | |||
18 | memory { | ||
19 | reg = <0x20000000 0x20000000>; | ||
20 | }; | ||
21 | |||
22 | clocks { | ||
23 | #address-cells = <1>; | ||
24 | #size-cells = <1>; | ||
25 | ranges; | ||
26 | |||
27 | main_clock: clock@0 { | ||
28 | compatible = "atmel,osc", "fixed-clock"; | ||
29 | clock-frequency = <12000000>; | ||
30 | }; | ||
31 | }; | ||
32 | |||
33 | ahb { | ||
34 | apb { | ||
35 | macb0: ethernet@f0028000 { | ||
36 | phy-mode = "rgmii"; | ||
37 | }; | ||
38 | }; | ||
39 | |||
40 | nand0: nand@60000000 { | ||
41 | nand-bus-width = <8>; | ||
42 | nand-ecc-mode = "hw"; | ||
43 | atmel,has-pmecc; | ||
44 | atmel,pmecc-cap = <4>; | ||
45 | atmel,pmecc-sector-size = <512>; | ||
46 | atmel,has-nfc; | ||
47 | atmel,use-nfc-sram; | ||
48 | nand-on-flash-bbt; | ||
49 | status = "okay"; | ||
50 | |||
51 | at91bootstrap@0 { | ||
52 | label = "at91bootstrap"; | ||
53 | reg = <0x0 0x40000>; | ||
54 | }; | ||
55 | |||
56 | bootloader@40000 { | ||
57 | label = "bootloader"; | ||
58 | reg = <0x40000 0x80000>; | ||
59 | }; | ||
60 | |||
61 | bootloaderenv@c0000 { | ||
62 | label = "bootloader env"; | ||
63 | reg = <0xc0000 0xc0000>; | ||
64 | }; | ||
65 | |||
66 | dtb@180000 { | ||
67 | label = "device tree"; | ||
68 | reg = <0x180000 0x80000>; | ||
69 | }; | ||
70 | |||
71 | kernel@200000 { | ||
72 | label = "kernel"; | ||
73 | reg = <0x200000 0x600000>; | ||
74 | }; | ||
75 | |||
76 | rootfs@800000 { | ||
77 | label = "rootfs"; | ||
78 | reg = <0x800000 0x0f800000>; | ||
79 | }; | ||
80 | }; | ||
81 | }; | ||
82 | |||
83 | leds { | ||
84 | compatible = "gpio-leds"; | ||
85 | |||
86 | d2 { | ||
87 | label = "d2"; | ||
88 | gpios = <&pioE 25 1>; /* PE25, conflicts with A25, RXD2 */ | ||
89 | }; | ||
90 | }; | ||
91 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d3xdm.dtsi b/arch/arm/boot/dts/sama5d3xdm.dtsi new file mode 100644 index 000000000000..4b8830eb2060 --- /dev/null +++ b/arch/arm/boot/dts/sama5d3xdm.dtsi | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * sama5d3dm.dtsi - Device Tree file for SAMA5 display module | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | |||
10 | / { | ||
11 | ahb { | ||
12 | apb { | ||
13 | i2c1: i2c@f0018000 { | ||
14 | qt1070: keyboard@1b { | ||
15 | compatible = "qt1070"; | ||
16 | reg = <0x1b>; | ||
17 | interrupt-parent = <&pioE>; | ||
18 | interrupts = <31 0x0>; | ||
19 | pinctrl-names = "default"; | ||
20 | pinctrl-0 = <&pinctrl_qt1070_irq>; | ||
21 | }; | ||
22 | }; | ||
23 | |||
24 | adc0: adc@f8018000 { | ||
25 | status = "disabled"; | ||
26 | }; | ||
27 | |||
28 | tsadcc: tsadcc@f8018000 { | ||
29 | status = "okay"; | ||
30 | }; | ||
31 | |||
32 | pinctrl@fffff200 { | ||
33 | board { | ||
34 | pinctrl_qt1070_irq: qt1070_irq { | ||
35 | atmel,pins = | ||
36 | <4 31 0x0 0x5>; /* PE31 GPIO with pull up deglith */ | ||
37 | }; | ||
38 | }; | ||
39 | }; | ||
40 | }; | ||
41 | }; | ||
42 | }; | ||
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi new file mode 100644 index 000000000000..661d7ca9c309 --- /dev/null +++ b/arch/arm/boot/dts/sama5d3xmb.dtsi | |||
@@ -0,0 +1,166 @@ | |||
1 | /* | ||
2 | * sama5d3xmb.dts - Device Tree file for SAMA5D3x mother board | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | /include/ "sama5d3xcm.dtsi" | ||
10 | |||
11 | / { | ||
12 | compatible = "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; | ||
13 | |||
14 | ahb { | ||
15 | apb { | ||
16 | mmc0: mmc@f0000000 { | ||
17 | pinctrl-names = "default"; | ||
18 | pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_cd>; | ||
19 | status = "okay"; | ||
20 | slot@0 { | ||
21 | reg = <0>; | ||
22 | bus-width = <4>; | ||
23 | cd-gpios = <&pioD 17 0>; | ||
24 | }; | ||
25 | }; | ||
26 | |||
27 | spi0: spi@f0004000 { | ||
28 | m25p80@0 { | ||
29 | compatible = "atmel,at25df321a"; | ||
30 | spi-max-frequency = <50000000>; | ||
31 | reg = <0>; | ||
32 | }; | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * i2c0 conflicts with ISI: | ||
37 | * disable it to allow the use of ISI | ||
38 | * can not enable audio when i2c0 disabled | ||
39 | */ | ||
40 | i2c0: i2c@f0014000 { | ||
41 | wm8904: wm8904@1a { | ||
42 | compatible = "wm8904"; | ||
43 | reg = <0x1a>; | ||
44 | }; | ||
45 | }; | ||
46 | |||
47 | usart1: serial@f0020000 { | ||
48 | pinctrl-names = "default"; | ||
49 | pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>; | ||
50 | status = "okay"; | ||
51 | }; | ||
52 | |||
53 | isi: isi@f0034000 { | ||
54 | pinctrl-names = "default"; | ||
55 | pinctrl-0 = <&pinctrl_isi &pinctrl_isi_pck_as_mck &pinctrl_isi_power &pinctrl_isi_reset>; | ||
56 | }; | ||
57 | |||
58 | mmc1: mmc@f8000000 { | ||
59 | pinctrl-names = "default"; | ||
60 | pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3 &pinctrl_mmc1_cd>; | ||
61 | status = "okay"; | ||
62 | slot@0 { | ||
63 | reg = <0>; | ||
64 | bus-width = <4>; | ||
65 | cd-gpios = <&pioD 18 0>; | ||
66 | }; | ||
67 | }; | ||
68 | |||
69 | adc0: adc@f8018000 { | ||
70 | pinctrl-names = "default"; | ||
71 | pinctrl-0 = < | ||
72 | &pinctrl_adc0_adtrg | ||
73 | &pinctrl_adc0_ad0 | ||
74 | &pinctrl_adc0_ad1 | ||
75 | &pinctrl_adc0_ad2 | ||
76 | &pinctrl_adc0_ad3 | ||
77 | &pinctrl_adc0_ad4 | ||
78 | >; | ||
79 | status = "okay"; | ||
80 | }; | ||
81 | |||
82 | macb1: ethernet@f802c000 { | ||
83 | phy-mode = "rmii"; | ||
84 | }; | ||
85 | |||
86 | pinctrl@fffff200 { | ||
87 | board { | ||
88 | pinctrl_mmc0_cd: mmc0_cd { | ||
89 | atmel,pins = | ||
90 | <3 17 0x0 0x5>; /* PD17 GPIO with pullup deglitch */ | ||
91 | }; | ||
92 | |||
93 | pinctrl_mmc1_cd: mmc1_cd { | ||
94 | atmel,pins = | ||
95 | <3 18 0x0 0x5>; /* PD18 GPIO with pullup deglitch */ | ||
96 | }; | ||
97 | |||
98 | pinctrl_pck0_as_audio_mck: pck0_as_audio_mck { | ||
99 | atmel,pins = | ||
100 | <3 30 0x2 0x0>; /* PD30 periph B */ | ||
101 | }; | ||
102 | |||
103 | pinctrl_isi_reset: isi_reset-0 { | ||
104 | atmel,pins = | ||
105 | <4 24 0x0 0x0>; /* PE24 gpio */ | ||
106 | }; | ||
107 | |||
108 | pinctrl_isi_power: isi_power-0 { | ||
109 | atmel,pins = | ||
110 | <4 29 0x0 0x0>; /* PE29 gpio */ | ||
111 | }; | ||
112 | |||
113 | pinctrl_usba_vbus: usba_vbus { | ||
114 | atmel,pins = | ||
115 | <3 29 0x0 0x4>; /* PD29 GPIO with deglitch */ | ||
116 | }; | ||
117 | }; | ||
118 | }; | ||
119 | |||
120 | dbgu: serial@ffffee00 { | ||
121 | status = "okay"; | ||
122 | }; | ||
123 | |||
124 | watchdog@fffffe40 { | ||
125 | status = "okay"; | ||
126 | }; | ||
127 | }; | ||
128 | |||
129 | usb0: gadget@00500000 { | ||
130 | atmel,vbus-gpio = <&pioD 29 0>; | ||
131 | pinctrl-names = "default"; | ||
132 | pinctrl-0 = <&pinctrl_usba_vbus>; | ||
133 | status = "okay"; | ||
134 | }; | ||
135 | |||
136 | usb1: ohci@00600000 { | ||
137 | num-ports = <3>; | ||
138 | atmel,vbus-gpio = <&pioD 25 0 | ||
139 | &pioD 26 1 | ||
140 | &pioD 27 1 | ||
141 | >; | ||
142 | status = "okay"; | ||
143 | }; | ||
144 | |||
145 | usb2: ehci@00700000 { | ||
146 | status = "okay"; | ||
147 | }; | ||
148 | }; | ||
149 | |||
150 | sound { | ||
151 | compatible = "atmel,sama5d3ek-wm8904"; | ||
152 | pinctrl-names = "default"; | ||
153 | pinctrl-0 = <&pinctrl_pck0_as_audio_mck>; | ||
154 | |||
155 | atmel,model = "wm8904 @ SAMA5D3EK"; | ||
156 | atmel,audio-routing = | ||
157 | "Headphone Jack", "HPOUTL", | ||
158 | "Headphone Jack", "HPOUTR", | ||
159 | "IN2L", "Line In Jack", | ||
160 | "IN2R", "Line In Jack", | ||
161 | "IN1L", "Mic"; | ||
162 | |||
163 | atmel,ssc-controller = <&ssc0>; | ||
164 | atmel,audio-codec = <&wm8904>; | ||
165 | }; | ||
166 | }; | ||
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi index 34da11aa6795..e1786a0b2fcd 100644 --- a/arch/arm/boot/dts/spear1340.dtsi +++ b/arch/arm/boot/dts/spear1340.dtsi | |||
@@ -113,6 +113,9 @@ | |||
113 | reg = <0xb4100000 0x1000>; | 113 | reg = <0xb4100000 0x1000>; |
114 | interrupts = <0 105 0x4>; | 114 | interrupts = <0 105 0x4>; |
115 | status = "disabled"; | 115 | status = "disabled"; |
116 | dmas = <&dwdma0 0x600 0 0 1>, /* 0xC << 11 */ | ||
117 | <&dwdma0 0x680 0 1 0>; /* 0xD << 7 */ | ||
118 | dma-names = "tx", "rx"; | ||
116 | }; | 119 | }; |
117 | 120 | ||
118 | thermal@e07008c4 { | 121 | thermal@e07008c4 { |
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi index b4ca60f4eb42..45597fd91050 100644 --- a/arch/arm/boot/dts/spear13xx.dtsi +++ b/arch/arm/boot/dts/spear13xx.dtsi | |||
@@ -98,13 +98,24 @@ | |||
98 | reg = <0xb2800000 0x1000>; | 98 | reg = <0xb2800000 0x1000>; |
99 | interrupts = <0 29 0x4>; | 99 | interrupts = <0 29 0x4>; |
100 | status = "disabled"; | 100 | status = "disabled"; |
101 | dmas = <&dwdma0 0 0 0 0>; | ||
102 | dma-names = "data"; | ||
101 | }; | 103 | }; |
102 | 104 | ||
103 | dma@ea800000 { | 105 | dwdma0: dma@ea800000 { |
104 | compatible = "snps,dma-spear1340"; | 106 | compatible = "snps,dma-spear1340"; |
105 | reg = <0xea800000 0x1000>; | 107 | reg = <0xea800000 0x1000>; |
106 | interrupts = <0 19 0x4>; | 108 | interrupts = <0 19 0x4>; |
107 | status = "disabled"; | 109 | status = "disabled"; |
110 | |||
111 | dma-channels = <8>; | ||
112 | #dma-cells = <3>; | ||
113 | dma-requests = <32>; | ||
114 | chan_allocation_order = <1>; | ||
115 | chan_priority = <1>; | ||
116 | block_size = <0xfff>; | ||
117 | dma-masters = <2>; | ||
118 | data_width = <3 3 0 0>; | ||
108 | }; | 119 | }; |
109 | 120 | ||
110 | dma@eb000000 { | 121 | dma@eb000000 { |
@@ -112,6 +123,15 @@ | |||
112 | reg = <0xeb000000 0x1000>; | 123 | reg = <0xeb000000 0x1000>; |
113 | interrupts = <0 59 0x4>; | 124 | interrupts = <0 59 0x4>; |
114 | status = "disabled"; | 125 | status = "disabled"; |
126 | |||
127 | dma-requests = <32>; | ||
128 | dma-channels = <8>; | ||
129 | dma-masters = <2>; | ||
130 | #dma-cells = <3>; | ||
131 | chan_allocation_order = <1>; | ||
132 | chan_priority = <1>; | ||
133 | block_size = <0xfff>; | ||
134 | data_width = <3 3 0 0>; | ||
115 | }; | 135 | }; |
116 | 136 | ||
117 | fsmc: flash@b0000000 { | 137 | fsmc: flash@b0000000 { |
@@ -261,6 +281,9 @@ | |||
261 | #size-cells = <0>; | 281 | #size-cells = <0>; |
262 | interrupts = <0 31 0x4>; | 282 | interrupts = <0 31 0x4>; |
263 | status = "disabled"; | 283 | status = "disabled"; |
284 | dmas = <&dwdma0 0x2000 0 0 0>, /* 0x4 << 11 */ | ||
285 | <&dwdma0 0x0280 0 0 0>; /* 0x5 << 7 */ | ||
286 | dma-names = "tx", "rx"; | ||
264 | }; | 287 | }; |
265 | 288 | ||
266 | rtc@e0580000 { | 289 | rtc@e0580000 { |
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/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/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index 1ea959019fcd..047f2a415309 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig | |||
@@ -20,7 +20,7 @@ CONFIG_SOC_AT91SAM9263=y | |||
20 | CONFIG_SOC_AT91SAM9G45=y | 20 | CONFIG_SOC_AT91SAM9G45=y |
21 | CONFIG_SOC_AT91SAM9X5=y | 21 | CONFIG_SOC_AT91SAM9X5=y |
22 | CONFIG_SOC_AT91SAM9N12=y | 22 | CONFIG_SOC_AT91SAM9N12=y |
23 | CONFIG_MACH_AT91SAM_DT=y | 23 | CONFIG_MACH_AT91SAM9_DT=y |
24 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 24 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
25 | CONFIG_AT91_TIMER_HZ=128 | 25 | CONFIG_AT91_TIMER_HZ=128 |
26 | CONFIG_AEABI=y | 26 | CONFIG_AEABI=y |
diff --git a/arch/arm/configs/at91sam9260_defconfig b/arch/arm/configs/at91sam9260_defconfig index 0ea5d2c97fc4..05618eb694f8 100644 --- a/arch/arm/configs/at91sam9260_defconfig +++ b/arch/arm/configs/at91sam9260_defconfig | |||
@@ -22,7 +22,7 @@ CONFIG_MACH_QIL_A9260=y | |||
22 | CONFIG_MACH_CPU9260=y | 22 | CONFIG_MACH_CPU9260=y |
23 | CONFIG_MACH_FLEXIBITY=y | 23 | CONFIG_MACH_FLEXIBITY=y |
24 | CONFIG_MACH_SNAPPER_9260=y | 24 | CONFIG_MACH_SNAPPER_9260=y |
25 | CONFIG_MACH_AT91SAM_DT=y | 25 | CONFIG_MACH_AT91SAM9_DT=y |
26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
27 | # CONFIG_ARM_THUMB is not set | 27 | # CONFIG_ARM_THUMB is not set |
28 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 28 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig index 3b1881033ad8..892e8287ed73 100644 --- a/arch/arm/configs/at91sam9g20_defconfig +++ b/arch/arm/configs/at91sam9g20_defconfig | |||
@@ -22,7 +22,7 @@ CONFIG_MACH_PCONTROL_G20=y | |||
22 | CONFIG_MACH_GSIA18S=y | 22 | CONFIG_MACH_GSIA18S=y |
23 | CONFIG_MACH_USB_A9G20=y | 23 | CONFIG_MACH_USB_A9G20=y |
24 | CONFIG_MACH_SNAPPER_9260=y | 24 | CONFIG_MACH_SNAPPER_9260=y |
25 | CONFIG_MACH_AT91SAM_DT=y | 25 | CONFIG_MACH_AT91SAM9_DT=y |
26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 26 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
27 | # CONFIG_ARM_THUMB is not set | 27 | # CONFIG_ARM_THUMB is not set |
28 | CONFIG_AEABI=y | 28 | CONFIG_AEABI=y |
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig index 606d48f3b8f8..5f551b76cb65 100644 --- a/arch/arm/configs/at91sam9g45_defconfig +++ b/arch/arm/configs/at91sam9g45_defconfig | |||
@@ -18,7 +18,7 @@ CONFIG_MODULE_UNLOAD=y | |||
18 | CONFIG_ARCH_AT91=y | 18 | CONFIG_ARCH_AT91=y |
19 | CONFIG_ARCH_AT91SAM9G45=y | 19 | CONFIG_ARCH_AT91SAM9G45=y |
20 | CONFIG_MACH_AT91SAM9M10G45EK=y | 20 | CONFIG_MACH_AT91SAM9M10G45EK=y |
21 | CONFIG_MACH_AT91SAM_DT=y | 21 | CONFIG_MACH_AT91SAM9_DT=y |
22 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | 22 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y |
23 | CONFIG_AT91_SLOW_CLOCK=y | 23 | CONFIG_AT91_SLOW_CLOCK=y |
24 | CONFIG_AEABI=y | 24 | CONFIG_AEABI=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index e31d442343c8..3bf0c543216a 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -10,6 +10,10 @@ CONFIG_ARCH_SUNXI=y | |||
10 | # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set | 10 | # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set |
11 | CONFIG_ARCH_ZYNQ=y | 11 | CONFIG_ARCH_ZYNQ=y |
12 | CONFIG_ARM_ERRATA_754322=y | 12 | CONFIG_ARM_ERRATA_754322=y |
13 | CONFIG_PLAT_SPEAR=y | ||
14 | CONFIG_ARCH_SPEAR13XX=y | ||
15 | CONFIG_MACH_SPEAR1310=y | ||
16 | CONFIG_MACH_SPEAR1340=y | ||
13 | CONFIG_SMP=y | 17 | CONFIG_SMP=y |
14 | CONFIG_ARM_ARCH_TIMER=y | 18 | CONFIG_ARM_ARCH_TIMER=y |
15 | CONFIG_AEABI=y | 19 | CONFIG_AEABI=y |
@@ -23,6 +27,7 @@ CONFIG_BLK_DEV_SD=y | |||
23 | CONFIG_ATA=y | 27 | CONFIG_ATA=y |
24 | CONFIG_SATA_HIGHBANK=y | 28 | CONFIG_SATA_HIGHBANK=y |
25 | CONFIG_SATA_MV=y | 29 | CONFIG_SATA_MV=y |
30 | CONFIG_SATA_AHCI_PLATFORM=y | ||
26 | CONFIG_NETDEVICES=y | 31 | CONFIG_NETDEVICES=y |
27 | CONFIG_NET_CALXEDA_XGMAC=y | 32 | CONFIG_NET_CALXEDA_XGMAC=y |
28 | CONFIG_SMSC911X=y | 33 | CONFIG_SMSC911X=y |
@@ -31,6 +36,7 @@ CONFIG_SERIO_AMBAKMI=y | |||
31 | CONFIG_SERIAL_8250=y | 36 | CONFIG_SERIAL_8250=y |
32 | CONFIG_SERIAL_8250_CONSOLE=y | 37 | CONFIG_SERIAL_8250_CONSOLE=y |
33 | CONFIG_SERIAL_8250_DW=y | 38 | CONFIG_SERIAL_8250_DW=y |
39 | CONFIG_KEYBOARD_SPEAR=y | ||
34 | CONFIG_SERIAL_AMBA_PL011=y | 40 | CONFIG_SERIAL_AMBA_PL011=y |
35 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | 41 | CONFIG_SERIAL_AMBA_PL011_CONSOLE=y |
36 | CONFIG_SERIAL_OF_PLATFORM=y | 42 | CONFIG_SERIAL_OF_PLATFORM=y |
@@ -40,6 +46,7 @@ CONFIG_I2C=y | |||
40 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | 46 | CONFIG_I2C_DESIGNWARE_PLATFORM=y |
41 | CONFIG_SPI=y | 47 | CONFIG_SPI=y |
42 | CONFIG_SPI_PL022=y | 48 | CONFIG_SPI_PL022=y |
49 | CONFIG_GPIO_PL061=y | ||
43 | CONFIG_FB=y | 50 | CONFIG_FB=y |
44 | CONFIG_FB_ARMCLCD=y | 51 | CONFIG_FB_ARMCLCD=y |
45 | CONFIG_FRAMEBUFFER_CONSOLE=y | 52 | CONFIG_FRAMEBUFFER_CONSOLE=y |
@@ -50,6 +57,7 @@ CONFIG_MMC=y | |||
50 | CONFIG_MMC_ARMMMCI=y | 57 | CONFIG_MMC_ARMMMCI=y |
51 | CONFIG_MMC_SDHCI=y | 58 | CONFIG_MMC_SDHCI=y |
52 | CONFIG_MMC_SDHCI_PLTFM=y | 59 | CONFIG_MMC_SDHCI_PLTFM=y |
60 | CONFIG_MMC_SDHCI_SPEAR=y | ||
53 | CONFIG_EDAC=y | 61 | CONFIG_EDAC=y |
54 | CONFIG_EDAC_MM_EDAC=y | 62 | CONFIG_EDAC_MM_EDAC=y |
55 | CONFIG_EDAC_HIGHBANK_MC=y | 63 | CONFIG_EDAC_HIGHBANK_MC=y |
@@ -58,3 +66,4 @@ CONFIG_RTC_CLASS=y | |||
58 | CONFIG_RTC_DRV_PL031=y | 66 | CONFIG_RTC_DRV_PL031=y |
59 | CONFIG_DMADEVICES=y | 67 | CONFIG_DMADEVICES=y |
60 | CONFIG_PL330_DMA=y | 68 | CONFIG_PL330_DMA=y |
69 | CONFIG_DW_DMAC=y | ||
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index bd07864f14a0..33903ca0d879 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -93,6 +93,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 | |||
93 | CONFIG_SENSORS_LIS3LV02D=m | 93 | CONFIG_SENSORS_LIS3LV02D=m |
94 | CONFIG_SENSORS_TSL2550=m | 94 | CONFIG_SENSORS_TSL2550=m |
95 | CONFIG_SENSORS_LIS3_I2C=m | 95 | CONFIG_SENSORS_LIS3_I2C=m |
96 | CONFIG_BMP085_I2C=m | ||
96 | CONFIG_SCSI=y | 97 | CONFIG_SCSI=y |
97 | CONFIG_BLK_DEV_SD=y | 98 | CONFIG_BLK_DEV_SD=y |
98 | CONFIG_SCSI_MULTI_LUN=y | 99 | CONFIG_SCSI_MULTI_LUN=y |
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig new file mode 100644 index 000000000000..4d0dc3c16063 --- /dev/null +++ b/arch/arm/configs/sama5_defconfig | |||
@@ -0,0 +1,181 @@ | |||
1 | # CONFIG_LOCALVERSION_AUTO is not set | ||
2 | # CONFIG_SWAP is not set | ||
3 | CONFIG_SYSVIPC=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_LOG_BUF_SHIFT=14 | ||
6 | CONFIG_SYSFS_DEPRECATED=y | ||
7 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
8 | CONFIG_BLK_DEV_INITRD=y | ||
9 | CONFIG_EMBEDDED=y | ||
10 | CONFIG_SLAB=y | ||
11 | CONFIG_MODULES=y | ||
12 | CONFIG_MODULE_FORCE_LOAD=y | ||
13 | CONFIG_MODULE_UNLOAD=y | ||
14 | CONFIG_MODULE_FORCE_UNLOAD=y | ||
15 | # CONFIG_LBDAF is not set | ||
16 | # CONFIG_BLK_DEV_BSG is not set | ||
17 | # CONFIG_IOSCHED_DEADLINE is not set | ||
18 | # CONFIG_IOSCHED_CFQ is not set | ||
19 | CONFIG_ARCH_AT91=y | ||
20 | CONFIG_SOC_SAM_V7=y | ||
21 | CONFIG_SOC_SAMA5D3=y | ||
22 | CONFIG_MACH_SAMA5_DT=y | ||
23 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
24 | CONFIG_AEABI=y | ||
25 | # CONFIG_OABI_COMPAT is not set | ||
26 | CONFIG_UACCESS_WITH_MEMCPY=y | ||
27 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
28 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
29 | CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw" | ||
30 | CONFIG_AUTO_ZRELADDR=y | ||
31 | CONFIG_VFP=y | ||
32 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
33 | CONFIG_PM_RUNTIME=y | ||
34 | CONFIG_PM_DEBUG=y | ||
35 | CONFIG_PM_ADVANCED_DEBUG=y | ||
36 | CONFIG_NET=y | ||
37 | CONFIG_PACKET=y | ||
38 | CONFIG_UNIX=y | ||
39 | CONFIG_INET=y | ||
40 | CONFIG_IP_MULTICAST=y | ||
41 | CONFIG_IP_PNP=y | ||
42 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
43 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
44 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
45 | # CONFIG_INET_LRO is not set | ||
46 | # CONFIG_INET_DIAG is not set | ||
47 | CONFIG_IPV6=y | ||
48 | # CONFIG_INET6_XFRM_MODE_TRANSPORT is not set | ||
49 | # CONFIG_INET6_XFRM_MODE_TUNNEL is not set | ||
50 | # CONFIG_INET6_XFRM_MODE_BEET is not set | ||
51 | CONFIG_IPV6_SIT_6RD=y | ||
52 | CONFIG_CAN=y | ||
53 | CONFIG_CAN_AT91=y | ||
54 | CONFIG_CFG80211=y | ||
55 | CONFIG_MAC80211=y | ||
56 | CONFIG_MAC80211_LEDS=y | ||
57 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
58 | CONFIG_DEVTMPFS=y | ||
59 | CONFIG_DEVTMPFS_MOUNT=y | ||
60 | # CONFIG_STANDALONE is not set | ||
61 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set | ||
62 | CONFIG_MTD=y | ||
63 | CONFIG_MTD_CMDLINE_PARTS=y | ||
64 | CONFIG_MTD_CHAR=y | ||
65 | CONFIG_MTD_BLOCK=y | ||
66 | CONFIG_MTD_CFI=y | ||
67 | CONFIG_MTD_M25P80=y | ||
68 | CONFIG_MTD_NAND=y | ||
69 | CONFIG_MTD_NAND_ATMEL=y | ||
70 | CONFIG_MTD_UBI=y | ||
71 | CONFIG_BLK_DEV_LOOP=y | ||
72 | CONFIG_BLK_DEV_RAM=y | ||
73 | CONFIG_BLK_DEV_RAM_COUNT=4 | ||
74 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
75 | CONFIG_ATMEL_TCLIB=y | ||
76 | CONFIG_ATMEL_SSC=y | ||
77 | CONFIG_EEPROM_AT24=y | ||
78 | CONFIG_SCSI=y | ||
79 | CONFIG_BLK_DEV_SD=y | ||
80 | CONFIG_SCSI_MULTI_LUN=y | ||
81 | # CONFIG_SCSI_LOWLEVEL is not set | ||
82 | CONFIG_NETDEVICES=y | ||
83 | CONFIG_MII=y | ||
84 | CONFIG_MACB=y | ||
85 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
86 | # CONFIG_NET_VENDOR_CIRRUS is not set | ||
87 | # CONFIG_NET_VENDOR_FARADAY is not set | ||
88 | # CONFIG_NET_VENDOR_INTEL is not set | ||
89 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
90 | # CONFIG_NET_VENDOR_MICREL is not set | ||
91 | # CONFIG_NET_VENDOR_MICROCHIP is not set | ||
92 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
93 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
94 | # CONFIG_NET_VENDOR_SMSC is not set | ||
95 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
96 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
97 | CONFIG_MICREL_PHY=y | ||
98 | # CONFIG_WLAN is not set | ||
99 | # CONFIG_INPUT_MOUSEDEV is not set | ||
100 | CONFIG_INPUT_EVDEV=y | ||
101 | # CONFIG_KEYBOARD_ATKBD is not set | ||
102 | CONFIG_KEYBOARD_QT1070=y | ||
103 | CONFIG_KEYBOARD_GPIO=y | ||
104 | # CONFIG_INPUT_MOUSE is not set | ||
105 | CONFIG_INPUT_TOUCHSCREEN=y | ||
106 | CONFIG_TOUCHSCREEN_ATMEL_MXT=y | ||
107 | CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y | ||
108 | # CONFIG_SERIO is not set | ||
109 | CONFIG_LEGACY_PTY_COUNT=4 | ||
110 | CONFIG_SERIAL_ATMEL=y | ||
111 | CONFIG_SERIAL_ATMEL_CONSOLE=y | ||
112 | CONFIG_HW_RANDOM=y | ||
113 | CONFIG_I2C=y | ||
114 | CONFIG_I2C_CHARDEV=y | ||
115 | CONFIG_I2C_AT91=y | ||
116 | CONFIG_I2C_GPIO=y | ||
117 | CONFIG_SPI=y | ||
118 | CONFIG_SPI_ATMEL=y | ||
119 | CONFIG_SPI_GPIO=y | ||
120 | CONFIG_GPIO_SYSFS=y | ||
121 | # CONFIG_HWMON is not set | ||
122 | CONFIG_SSB=m | ||
123 | CONFIG_FB=y | ||
124 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
125 | # CONFIG_LCD_CLASS_DEVICE is not set | ||
126 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
127 | # CONFIG_BACKLIGHT_GENERIC is not set | ||
128 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
129 | # CONFIG_HID_GENERIC is not set | ||
130 | CONFIG_USB=y | ||
131 | CONFIG_USB_ANNOUNCE_NEW_DEVICES=y | ||
132 | CONFIG_USB_EHCI_HCD=y | ||
133 | CONFIG_USB_OHCI_HCD=y | ||
134 | CONFIG_USB_ACM=y | ||
135 | CONFIG_USB_STORAGE=y | ||
136 | CONFIG_USB_GADGET=y | ||
137 | CONFIG_USB_AT91=y | ||
138 | CONFIG_USB_MASS_STORAGE=m | ||
139 | CONFIG_MMC=y | ||
140 | # CONFIG_MMC_BLOCK_BOUNCE is not set | ||
141 | CONFIG_MMC_ATMELMCI=y | ||
142 | CONFIG_NEW_LEDS=y | ||
143 | CONFIG_LEDS_CLASS=y | ||
144 | CONFIG_LEDS_GPIO=y | ||
145 | CONFIG_LEDS_TRIGGER_TIMER=y | ||
146 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
147 | CONFIG_LEDS_TRIGGER_GPIO=y | ||
148 | CONFIG_RTC_CLASS=y | ||
149 | CONFIG_RTC_DRV_AT91RM9200=y | ||
150 | CONFIG_DMADEVICES=y | ||
151 | # CONFIG_IOMMU_SUPPORT is not set | ||
152 | CONFIG_IIO=y | ||
153 | CONFIG_AT91_ADC=y | ||
154 | CONFIG_EXT2_FS=y | ||
155 | CONFIG_FANOTIFY=y | ||
156 | CONFIG_VFAT_FS=y | ||
157 | CONFIG_TMPFS=y | ||
158 | CONFIG_JFFS2_FS=y | ||
159 | CONFIG_JFFS2_SUMMARY=y | ||
160 | CONFIG_UBIFS_FS=y | ||
161 | CONFIG_NFS_FS=y | ||
162 | CONFIG_ROOT_NFS=y | ||
163 | CONFIG_NLS_CODEPAGE_437=y | ||
164 | CONFIG_NLS_CODEPAGE_850=y | ||
165 | CONFIG_NLS_ISO8859_1=y | ||
166 | CONFIG_STRIP_ASM_SYMS=y | ||
167 | CONFIG_DEBUG_FS=y | ||
168 | # CONFIG_SCHED_DEBUG is not set | ||
169 | CONFIG_DEBUG_MEMORY_INIT=y | ||
170 | # CONFIG_FTRACE is not set | ||
171 | CONFIG_DEBUG_USER=y | ||
172 | CONFIG_DEBUG_LL=y | ||
173 | CONFIG_EARLY_PRINTK=y | ||
174 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | ||
175 | CONFIG_CRYPTO_USER_API_HASH=m | ||
176 | CONFIG_CRYPTO_USER_API_SKCIPHER=m | ||
177 | CONFIG_CRYPTO_DEV_ATMEL_AES=y | ||
178 | CONFIG_CRYPTO_DEV_ATMEL_TDES=y | ||
179 | CONFIG_CRYPTO_DEV_ATMEL_SHA=y | ||
180 | CONFIG_CRC_CCITT=m | ||
181 | CONFIG_CRC_ITU_T=m | ||
diff --git a/arch/arm/configs/spear3xx_defconfig b/arch/arm/configs/spear3xx_defconfig index 865980c5f212..7ff23a077f5d 100644 --- a/arch/arm/configs/spear3xx_defconfig +++ b/arch/arm/configs/spear3xx_defconfig | |||
@@ -6,7 +6,9 @@ CONFIG_MODULES=y | |||
6 | CONFIG_MODULE_UNLOAD=y | 6 | CONFIG_MODULE_UNLOAD=y |
7 | CONFIG_MODVERSIONS=y | 7 | CONFIG_MODVERSIONS=y |
8 | CONFIG_PARTITION_ADVANCED=y | 8 | CONFIG_PARTITION_ADVANCED=y |
9 | # CONFIG_ARCH_MULTI_V7 is not set | ||
9 | CONFIG_PLAT_SPEAR=y | 10 | CONFIG_PLAT_SPEAR=y |
11 | CONFIG_ARCH_SPEAR3XX=y | ||
10 | CONFIG_MACH_SPEAR300=y | 12 | CONFIG_MACH_SPEAR300=y |
11 | CONFIG_MACH_SPEAR310=y | 13 | CONFIG_MACH_SPEAR310=y |
12 | CONFIG_MACH_SPEAR320=y | 14 | CONFIG_MACH_SPEAR320=y |
diff --git a/arch/arm/configs/spear6xx_defconfig b/arch/arm/configs/spear6xx_defconfig index a2a1265f86b6..7822980d7d55 100644 --- a/arch/arm/configs/spear6xx_defconfig +++ b/arch/arm/configs/spear6xx_defconfig | |||
@@ -6,6 +6,7 @@ CONFIG_MODULES=y | |||
6 | CONFIG_MODULE_UNLOAD=y | 6 | CONFIG_MODULE_UNLOAD=y |
7 | CONFIG_MODVERSIONS=y | 7 | CONFIG_MODVERSIONS=y |
8 | CONFIG_PARTITION_ADVANCED=y | 8 | CONFIG_PARTITION_ADVANCED=y |
9 | # CONFIG_ARCH_MULTI_V7 is not set | ||
9 | CONFIG_PLAT_SPEAR=y | 10 | CONFIG_PLAT_SPEAR=y |
10 | CONFIG_ARCH_SPEAR6XX=y | 11 | CONFIG_ARCH_SPEAR6XX=y |
11 | CONFIG_BINFMT_MISC=y | 12 | CONFIG_BINFMT_MISC=y |
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/delay.h b/arch/arm/include/asm/delay.h index 720799fd3a81..dff714d886d5 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h | |||
@@ -24,7 +24,7 @@ extern struct arm_delay_ops { | |||
24 | void (*delay)(unsigned long); | 24 | void (*delay)(unsigned long); |
25 | void (*const_udelay)(unsigned long); | 25 | void (*const_udelay)(unsigned long); |
26 | void (*udelay)(unsigned long); | 26 | void (*udelay)(unsigned long); |
27 | bool const_clock; | 27 | unsigned long ticks_per_jiffy; |
28 | } arm_delay_ops; | 28 | } arm_delay_ops; |
29 | 29 | ||
30 | #define __delay(n) arm_delay_ops.delay(n) | 30 | #define __delay(n) arm_delay_ops.delay(n) |
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/highmem.h b/arch/arm/include/asm/highmem.h index 8c5e828f484d..91b99abe7a95 100644 --- a/arch/arm/include/asm/highmem.h +++ b/arch/arm/include/asm/highmem.h | |||
@@ -41,6 +41,13 @@ extern void kunmap_high(struct page *page); | |||
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* | ||
45 | * Needed to be able to broadcast the TLB invalidation for kmap. | ||
46 | */ | ||
47 | #ifdef CONFIG_ARM_ERRATA_798181 | ||
48 | #undef ARCH_NEEDS_KMAP_HIGH_GET | ||
49 | #endif | ||
50 | |||
44 | #ifdef ARCH_NEEDS_KMAP_HIGH_GET | 51 | #ifdef ARCH_NEEDS_KMAP_HIGH_GET |
45 | extern void *kmap_high_get(struct page *page); | 52 | extern void *kmap_high_get(struct page *page); |
46 | #else | 53 | #else |
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index 863a6611323c..a7b85e0d0cc1 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -27,6 +27,8 @@ void __check_vmalloc_seq(struct mm_struct *mm); | |||
27 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); | 27 | void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); |
28 | #define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) | 28 | #define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) |
29 | 29 | ||
30 | DECLARE_PER_CPU(atomic64_t, active_asids); | ||
31 | |||
30 | #else /* !CONFIG_CPU_HAS_ASID */ | 32 | #else /* !CONFIG_CPU_HAS_ASID */ |
31 | 33 | ||
32 | #ifdef CONFIG_MMU | 34 | #ifdef CONFIG_MMU |
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/tlbflush.h b/arch/arm/include/asm/tlbflush.h index 4db8c8820f0d..9e9c041358ca 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -450,6 +450,21 @@ static inline void local_flush_bp_all(void) | |||
450 | isb(); | 450 | isb(); |
451 | } | 451 | } |
452 | 452 | ||
453 | #ifdef CONFIG_ARM_ERRATA_798181 | ||
454 | static inline void dummy_flush_tlb_a15_erratum(void) | ||
455 | { | ||
456 | /* | ||
457 | * Dummy TLBIMVAIS. Using the unmapped address 0 and ASID 0. | ||
458 | */ | ||
459 | asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0)); | ||
460 | dsb(); | ||
461 | } | ||
462 | #else | ||
463 | static inline void dummy_flush_tlb_a15_erratum(void) | ||
464 | { | ||
465 | } | ||
466 | #endif | ||
467 | |||
453 | /* | 468 | /* |
454 | * flush_pmd_entry | 469 | * flush_pmd_entry |
455 | * | 470 | * |
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-common.S b/arch/arm/kernel/entry-common.S index 3248cde504ed..fefd7f971437 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -276,7 +276,13 @@ ENDPROC(ftrace_graph_caller_old) | |||
276 | */ | 276 | */ |
277 | 277 | ||
278 | .macro mcount_enter | 278 | .macro mcount_enter |
279 | /* | ||
280 | * This pad compensates for the push {lr} at the call site. Note that we are | ||
281 | * unable to unwind through a function which does not otherwise save its lr. | ||
282 | */ | ||
283 | UNWIND(.pad #4) | ||
279 | stmdb sp!, {r0-r3, lr} | 284 | stmdb sp!, {r0-r3, lr} |
285 | UNWIND(.save {r0-r3, lr}) | ||
280 | .endm | 286 | .endm |
281 | 287 | ||
282 | .macro mcount_get_lr reg | 288 | .macro mcount_get_lr reg |
@@ -289,6 +295,7 @@ ENDPROC(ftrace_graph_caller_old) | |||
289 | .endm | 295 | .endm |
290 | 296 | ||
291 | ENTRY(__gnu_mcount_nc) | 297 | ENTRY(__gnu_mcount_nc) |
298 | UNWIND(.fnstart) | ||
292 | #ifdef CONFIG_DYNAMIC_FTRACE | 299 | #ifdef CONFIG_DYNAMIC_FTRACE |
293 | mov ip, lr | 300 | mov ip, lr |
294 | ldmia sp!, {lr} | 301 | ldmia sp!, {lr} |
@@ -296,17 +303,22 @@ ENTRY(__gnu_mcount_nc) | |||
296 | #else | 303 | #else |
297 | __mcount | 304 | __mcount |
298 | #endif | 305 | #endif |
306 | UNWIND(.fnend) | ||
299 | ENDPROC(__gnu_mcount_nc) | 307 | ENDPROC(__gnu_mcount_nc) |
300 | 308 | ||
301 | #ifdef CONFIG_DYNAMIC_FTRACE | 309 | #ifdef CONFIG_DYNAMIC_FTRACE |
302 | ENTRY(ftrace_caller) | 310 | ENTRY(ftrace_caller) |
311 | UNWIND(.fnstart) | ||
303 | __ftrace_caller | 312 | __ftrace_caller |
313 | UNWIND(.fnend) | ||
304 | ENDPROC(ftrace_caller) | 314 | ENDPROC(ftrace_caller) |
305 | #endif | 315 | #endif |
306 | 316 | ||
307 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 317 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
308 | ENTRY(ftrace_graph_caller) | 318 | ENTRY(ftrace_graph_caller) |
319 | UNWIND(.fnstart) | ||
309 | __ftrace_graph_caller | 320 | __ftrace_graph_caller |
321 | UNWIND(.fnend) | ||
310 | ENDPROC(ftrace_graph_caller) | 322 | ENDPROC(ftrace_graph_caller) |
311 | #endif | 323 | #endif |
312 | 324 | ||
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index e0eb9a1cae77..8bac553fe213 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -267,7 +267,7 @@ __create_page_tables: | |||
267 | addne r6, r6, #1 << SECTION_SHIFT | 267 | addne r6, r6, #1 << SECTION_SHIFT |
268 | strne r6, [r3] | 268 | strne r6, [r3] |
269 | 269 | ||
270 | #if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) | 270 | #if defined(CONFIG_ARM_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) |
271 | sub r4, r4, #4 @ Fixup page table pointer | 271 | sub r4, r4, #4 @ Fixup page table pointer |
272 | @ for 64-bit descriptors | 272 | @ for 64-bit descriptors |
273 | #endif | 273 | #endif |
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index 96093b75ab90..5dc1aa6f0f7d 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c | |||
@@ -966,7 +966,7 @@ static void reset_ctrl_regs(void *unused) | |||
966 | } | 966 | } |
967 | 967 | ||
968 | if (err) { | 968 | if (err) { |
969 | pr_warning("CPU %d debug is powered down!\n", cpu); | 969 | pr_warn_once("CPU %d debug is powered down!\n", cpu); |
970 | cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); | 970 | cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); |
971 | return; | 971 | return; |
972 | } | 972 | } |
@@ -987,7 +987,7 @@ clear_vcr: | |||
987 | isb(); | 987 | isb(); |
988 | 988 | ||
989 | if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { | 989 | if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { |
990 | pr_warning("CPU %d failed to disable vector catch\n", cpu); | 990 | pr_warn_once("CPU %d failed to disable vector catch\n", cpu); |
991 | return; | 991 | return; |
992 | } | 992 | } |
993 | 993 | ||
@@ -1007,7 +1007,7 @@ clear_vcr: | |||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { | 1009 | if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { |
1010 | pr_warning("CPU %d failed to clear debug register pairs\n", cpu); | 1010 | pr_warn_once("CPU %d failed to clear debug register pairs\n", cpu); |
1011 | return; | 1011 | return; |
1012 | } | 1012 | } |
1013 | 1013 | ||
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/setup.c b/arch/arm/kernel/setup.c index 3f6cbb2e3eda..d343a6c3a6d1 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -353,6 +353,23 @@ void __init early_print(const char *str, ...) | |||
353 | printk("%s", buf); | 353 | printk("%s", buf); |
354 | } | 354 | } |
355 | 355 | ||
356 | static void __init cpuid_init_hwcaps(void) | ||
357 | { | ||
358 | unsigned int divide_instrs; | ||
359 | |||
360 | if (cpu_architecture() < CPU_ARCH_ARMv7) | ||
361 | return; | ||
362 | |||
363 | divide_instrs = (read_cpuid_ext(CPUID_EXT_ISAR0) & 0x0f000000) >> 24; | ||
364 | |||
365 | switch (divide_instrs) { | ||
366 | case 2: | ||
367 | elf_hwcap |= HWCAP_IDIVA; | ||
368 | case 1: | ||
369 | elf_hwcap |= HWCAP_IDIVT; | ||
370 | } | ||
371 | } | ||
372 | |||
356 | static void __init feat_v6_fixup(void) | 373 | static void __init feat_v6_fixup(void) |
357 | { | 374 | { |
358 | int id = read_cpuid_id(); | 375 | int id = read_cpuid_id(); |
@@ -483,8 +500,11 @@ static void __init setup_processor(void) | |||
483 | snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c", | 500 | snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c", |
484 | list->elf_name, ENDIANNESS); | 501 | list->elf_name, ENDIANNESS); |
485 | elf_hwcap = list->elf_hwcap; | 502 | elf_hwcap = list->elf_hwcap; |
503 | |||
504 | cpuid_init_hwcaps(); | ||
505 | |||
486 | #ifndef CONFIG_ARM_THUMB | 506 | #ifndef CONFIG_ARM_THUMB |
487 | elf_hwcap &= ~HWCAP_THUMB; | 507 | elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT); |
488 | #endif | 508 | #endif |
489 | 509 | ||
490 | feat_v6_fixup(); | 510 | feat_v6_fixup(); |
@@ -524,7 +544,7 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size) | |||
524 | size -= start & ~PAGE_MASK; | 544 | size -= start & ~PAGE_MASK; |
525 | bank->start = PAGE_ALIGN(start); | 545 | bank->start = PAGE_ALIGN(start); |
526 | 546 | ||
527 | #ifndef CONFIG_LPAE | 547 | #ifndef CONFIG_ARM_LPAE |
528 | if (bank->start + size < bank->start) { | 548 | if (bank->start + size < bank->start) { |
529 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " | 549 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " |
530 | "32-bit physical address space\n", (long long)start); | 550 | "32-bit physical address space\n", (long long)start); |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 79078edbb9bc..1f2ccccaf009 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -673,9 +673,6 @@ static int cpufreq_callback(struct notifier_block *nb, | |||
673 | if (freq->flags & CPUFREQ_CONST_LOOPS) | 673 | if (freq->flags & CPUFREQ_CONST_LOOPS) |
674 | return NOTIFY_OK; | 674 | return NOTIFY_OK; |
675 | 675 | ||
676 | if (arm_delay_ops.const_clock) | ||
677 | return NOTIFY_OK; | ||
678 | |||
679 | if (!per_cpu(l_p_j_ref, cpu)) { | 676 | if (!per_cpu(l_p_j_ref, cpu)) { |
680 | per_cpu(l_p_j_ref, cpu) = | 677 | per_cpu(l_p_j_ref, cpu) = |
681 | per_cpu(cpu_data, cpu).loops_per_jiffy; | 678 | per_cpu(cpu_data, cpu).loops_per_jiffy; |
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c index bd0300531399..e82e1d248772 100644 --- a/arch/arm/kernel/smp_tlb.c +++ b/arch/arm/kernel/smp_tlb.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/smp_plat.h> | 13 | #include <asm/smp_plat.h> |
14 | #include <asm/tlbflush.h> | 14 | #include <asm/tlbflush.h> |
15 | #include <asm/mmu_context.h> | ||
15 | 16 | ||
16 | /**********************************************************************/ | 17 | /**********************************************************************/ |
17 | 18 | ||
@@ -69,12 +70,72 @@ static inline void ipi_flush_bp_all(void *ignored) | |||
69 | local_flush_bp_all(); | 70 | local_flush_bp_all(); |
70 | } | 71 | } |
71 | 72 | ||
73 | #ifdef CONFIG_ARM_ERRATA_798181 | ||
74 | static int erratum_a15_798181(void) | ||
75 | { | ||
76 | unsigned int midr = read_cpuid_id(); | ||
77 | |||
78 | /* Cortex-A15 r0p0..r3p2 affected */ | ||
79 | if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2) | ||
80 | return 0; | ||
81 | return 1; | ||
82 | } | ||
83 | #else | ||
84 | static int erratum_a15_798181(void) | ||
85 | { | ||
86 | return 0; | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | static void ipi_flush_tlb_a15_erratum(void *arg) | ||
91 | { | ||
92 | dmb(); | ||
93 | } | ||
94 | |||
95 | static void broadcast_tlb_a15_erratum(void) | ||
96 | { | ||
97 | if (!erratum_a15_798181()) | ||
98 | return; | ||
99 | |||
100 | dummy_flush_tlb_a15_erratum(); | ||
101 | smp_call_function_many(cpu_online_mask, ipi_flush_tlb_a15_erratum, | ||
102 | NULL, 1); | ||
103 | } | ||
104 | |||
105 | static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm) | ||
106 | { | ||
107 | int cpu; | ||
108 | cpumask_t mask = { CPU_BITS_NONE }; | ||
109 | |||
110 | if (!erratum_a15_798181()) | ||
111 | return; | ||
112 | |||
113 | dummy_flush_tlb_a15_erratum(); | ||
114 | for_each_online_cpu(cpu) { | ||
115 | if (cpu == smp_processor_id()) | ||
116 | continue; | ||
117 | /* | ||
118 | * We only need to send an IPI if the other CPUs are running | ||
119 | * the same ASID as the one being invalidated. There is no | ||
120 | * need for locking around the active_asids check since the | ||
121 | * switch_mm() function has at least one dmb() (as required by | ||
122 | * this workaround) in case a context switch happens on | ||
123 | * another CPU after the condition below. | ||
124 | */ | ||
125 | if (atomic64_read(&mm->context.id) == | ||
126 | atomic64_read(&per_cpu(active_asids, cpu))) | ||
127 | cpumask_set_cpu(cpu, &mask); | ||
128 | } | ||
129 | smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1); | ||
130 | } | ||
131 | |||
72 | void flush_tlb_all(void) | 132 | void flush_tlb_all(void) |
73 | { | 133 | { |
74 | if (tlb_ops_need_broadcast()) | 134 | if (tlb_ops_need_broadcast()) |
75 | on_each_cpu(ipi_flush_tlb_all, NULL, 1); | 135 | on_each_cpu(ipi_flush_tlb_all, NULL, 1); |
76 | else | 136 | else |
77 | local_flush_tlb_all(); | 137 | local_flush_tlb_all(); |
138 | broadcast_tlb_a15_erratum(); | ||
78 | } | 139 | } |
79 | 140 | ||
80 | void flush_tlb_mm(struct mm_struct *mm) | 141 | void flush_tlb_mm(struct mm_struct *mm) |
@@ -83,6 +144,7 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
83 | on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1); | 144 | on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1); |
84 | else | 145 | else |
85 | local_flush_tlb_mm(mm); | 146 | local_flush_tlb_mm(mm); |
147 | broadcast_tlb_mm_a15_erratum(mm); | ||
86 | } | 148 | } |
87 | 149 | ||
88 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | 150 | void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) |
@@ -95,6 +157,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) | |||
95 | &ta, 1); | 157 | &ta, 1); |
96 | } else | 158 | } else |
97 | local_flush_tlb_page(vma, uaddr); | 159 | local_flush_tlb_page(vma, uaddr); |
160 | broadcast_tlb_mm_a15_erratum(vma->vm_mm); | ||
98 | } | 161 | } |
99 | 162 | ||
100 | void flush_tlb_kernel_page(unsigned long kaddr) | 163 | void flush_tlb_kernel_page(unsigned long kaddr) |
@@ -105,6 +168,7 @@ void flush_tlb_kernel_page(unsigned long kaddr) | |||
105 | on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1); | 168 | on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1); |
106 | } else | 169 | } else |
107 | local_flush_tlb_kernel_page(kaddr); | 170 | local_flush_tlb_kernel_page(kaddr); |
171 | broadcast_tlb_a15_erratum(); | ||
108 | } | 172 | } |
109 | 173 | ||
110 | void flush_tlb_range(struct vm_area_struct *vma, | 174 | void flush_tlb_range(struct vm_area_struct *vma, |
@@ -119,6 +183,7 @@ void flush_tlb_range(struct vm_area_struct *vma, | |||
119 | &ta, 1); | 183 | &ta, 1); |
120 | } else | 184 | } else |
121 | local_flush_tlb_range(vma, start, end); | 185 | local_flush_tlb_range(vma, start, end); |
186 | broadcast_tlb_mm_a15_erratum(vma->vm_mm); | ||
122 | } | 187 | } |
123 | 188 | ||
124 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) | 189 | void flush_tlb_kernel_range(unsigned long start, unsigned long end) |
@@ -130,6 +195,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end) | |||
130 | on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1); | 195 | on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1); |
131 | } else | 196 | } else |
132 | local_flush_tlb_kernel_range(start, end); | 197 | local_flush_tlb_kernel_range(start, end); |
198 | broadcast_tlb_a15_erratum(); | ||
133 | } | 199 | } |
134 | 200 | ||
135 | void flush_bp_all(void) | 201 | void flush_bp_all(void) |
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/kvm/vgic.c b/arch/arm/kvm/vgic.c index c9a17316e9fe..0e4cfe123b38 100644 --- a/arch/arm/kvm/vgic.c +++ b/arch/arm/kvm/vgic.c | |||
@@ -883,8 +883,7 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq) | |||
883 | lr, irq, vgic_cpu->vgic_lr[lr]); | 883 | lr, irq, vgic_cpu->vgic_lr[lr]); |
884 | BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); | 884 | BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); |
885 | vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT; | 885 | vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT; |
886 | 886 | return true; | |
887 | goto out; | ||
888 | } | 887 | } |
889 | 888 | ||
890 | /* Try to use another LR for this interrupt */ | 889 | /* Try to use another LR for this interrupt */ |
@@ -898,7 +897,6 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq) | |||
898 | vgic_cpu->vgic_irq_lr_map[irq] = lr; | 897 | vgic_cpu->vgic_irq_lr_map[irq] = lr; |
899 | set_bit(lr, vgic_cpu->lr_used); | 898 | set_bit(lr, vgic_cpu->lr_used); |
900 | 899 | ||
901 | out: | ||
902 | if (!vgic_irq_is_edge(vcpu, irq)) | 900 | if (!vgic_irq_is_edge(vcpu, irq)) |
903 | vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI; | 901 | vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI; |
904 | 902 | ||
@@ -1018,21 +1016,6 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) | |||
1018 | 1016 | ||
1019 | kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr); | 1017 | kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr); |
1020 | 1018 | ||
1021 | /* | ||
1022 | * We do not need to take the distributor lock here, since the only | ||
1023 | * action we perform is clearing the irq_active_bit for an EOIed | ||
1024 | * level interrupt. There is a potential race with | ||
1025 | * the queuing of an interrupt in __kvm_vgic_flush_hwstate(), where we | ||
1026 | * check if the interrupt is already active. Two possibilities: | ||
1027 | * | ||
1028 | * - The queuing is occurring on the same vcpu: cannot happen, | ||
1029 | * as we're already in the context of this vcpu, and | ||
1030 | * executing the handler | ||
1031 | * - The interrupt has been migrated to another vcpu, and we | ||
1032 | * ignore this interrupt for this run. Big deal. It is still | ||
1033 | * pending though, and will get considered when this vcpu | ||
1034 | * exits. | ||
1035 | */ | ||
1036 | if (vgic_cpu->vgic_misr & GICH_MISR_EOI) { | 1019 | if (vgic_cpu->vgic_misr & GICH_MISR_EOI) { |
1037 | /* | 1020 | /* |
1038 | * Some level interrupts have been EOIed. Clear their | 1021 | * Some level interrupts have been EOIed. Clear their |
@@ -1054,6 +1037,13 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) | |||
1054 | } else { | 1037 | } else { |
1055 | vgic_cpu_irq_clear(vcpu, irq); | 1038 | vgic_cpu_irq_clear(vcpu, irq); |
1056 | } | 1039 | } |
1040 | |||
1041 | /* | ||
1042 | * Despite being EOIed, the LR may not have | ||
1043 | * been marked as empty. | ||
1044 | */ | ||
1045 | set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr); | ||
1046 | vgic_cpu->vgic_lr[lr] &= ~GICH_LR_ACTIVE_BIT; | ||
1057 | } | 1047 | } |
1058 | } | 1048 | } |
1059 | 1049 | ||
@@ -1064,9 +1054,8 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) | |||
1064 | } | 1054 | } |
1065 | 1055 | ||
1066 | /* | 1056 | /* |
1067 | * Sync back the VGIC state after a guest run. We do not really touch | 1057 | * Sync back the VGIC state after a guest run. The distributor lock is |
1068 | * the distributor here (the irq_pending_on_cpu bit is safe to set), | 1058 | * needed so we don't get preempted in the middle of the state processing. |
1069 | * so there is no need for taking its lock. | ||
1070 | */ | 1059 | */ |
1071 | static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) | 1060 | static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) |
1072 | { | 1061 | { |
@@ -1112,10 +1101,14 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) | |||
1112 | 1101 | ||
1113 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) | 1102 | void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) |
1114 | { | 1103 | { |
1104 | struct vgic_dist *dist = &vcpu->kvm->arch.vgic; | ||
1105 | |||
1115 | if (!irqchip_in_kernel(vcpu->kvm)) | 1106 | if (!irqchip_in_kernel(vcpu->kvm)) |
1116 | return; | 1107 | return; |
1117 | 1108 | ||
1109 | spin_lock(&dist->lock); | ||
1118 | __kvm_vgic_sync_hwstate(vcpu); | 1110 | __kvm_vgic_sync_hwstate(vcpu); |
1111 | spin_unlock(&dist->lock); | ||
1119 | } | 1112 | } |
1120 | 1113 | ||
1121 | int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu) | 1114 | int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu) |
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index 6b93f6a1a3c7..64dbfa57204a 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c | |||
@@ -58,7 +58,7 @@ static void __timer_delay(unsigned long cycles) | |||
58 | static void __timer_const_udelay(unsigned long xloops) | 58 | static void __timer_const_udelay(unsigned long xloops) |
59 | { | 59 | { |
60 | unsigned long long loops = xloops; | 60 | unsigned long long loops = xloops; |
61 | loops *= loops_per_jiffy; | 61 | loops *= arm_delay_ops.ticks_per_jiffy; |
62 | __timer_delay(loops >> UDELAY_SHIFT); | 62 | __timer_delay(loops >> UDELAY_SHIFT); |
63 | } | 63 | } |
64 | 64 | ||
@@ -73,11 +73,13 @@ void __init register_current_timer_delay(const struct delay_timer *timer) | |||
73 | pr_info("Switching to timer-based delay loop\n"); | 73 | pr_info("Switching to timer-based delay loop\n"); |
74 | delay_timer = timer; | 74 | delay_timer = timer; |
75 | lpj_fine = timer->freq / HZ; | 75 | lpj_fine = timer->freq / HZ; |
76 | loops_per_jiffy = lpj_fine; | 76 | |
77 | /* cpufreq may scale loops_per_jiffy, so keep a private copy */ | ||
78 | arm_delay_ops.ticks_per_jiffy = lpj_fine; | ||
77 | arm_delay_ops.delay = __timer_delay; | 79 | arm_delay_ops.delay = __timer_delay; |
78 | arm_delay_ops.const_udelay = __timer_const_udelay; | 80 | arm_delay_ops.const_udelay = __timer_const_udelay; |
79 | arm_delay_ops.udelay = __timer_udelay; | 81 | arm_delay_ops.udelay = __timer_udelay; |
80 | arm_delay_ops.const_clock = true; | 82 | |
81 | delay_calibrated = true; | 83 | delay_calibrated = true; |
82 | } else { | 84 | } else { |
83 | pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); | 85 | pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 6071f4c3d654..02802386b894 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -1,14 +1,15 @@ | |||
1 | if ARCH_AT91 | 1 | if ARCH_AT91 |
2 | 2 | ||
3 | config HAVE_AT91_DATAFLASH_CARD | ||
4 | bool | ||
5 | |||
6 | config HAVE_AT91_DBGU0 | 3 | config HAVE_AT91_DBGU0 |
7 | bool | 4 | bool |
8 | 5 | ||
9 | config HAVE_AT91_DBGU1 | 6 | config HAVE_AT91_DBGU1 |
10 | bool | 7 | bool |
11 | 8 | ||
9 | config AT91_PMC_UNIT | ||
10 | bool | ||
11 | default !ARCH_AT91X40 | ||
12 | |||
12 | config AT91_SAM9_ALT_RESET | 13 | config AT91_SAM9_ALT_RESET |
13 | bool | 14 | bool |
14 | default !ARCH_AT91X40 | 15 | default !ARCH_AT91X40 |
@@ -17,17 +18,59 @@ config AT91_SAM9G45_RESET | |||
17 | bool | 18 | bool |
18 | default !ARCH_AT91X40 | 19 | default !ARCH_AT91X40 |
19 | 20 | ||
21 | config AT91_SAM9_TIME | ||
22 | bool | ||
23 | |||
20 | config SOC_AT91SAM9 | 24 | config SOC_AT91SAM9 |
21 | bool | 25 | bool |
26 | select AT91_SAM9_TIME | ||
22 | select CPU_ARM926T | 27 | select CPU_ARM926T |
23 | select GENERIC_CLOCKEVENTS | 28 | select GENERIC_CLOCKEVENTS |
24 | select MULTI_IRQ_HANDLER | 29 | select MULTI_IRQ_HANDLER |
25 | select SPARSE_IRQ | 30 | select SPARSE_IRQ |
26 | 31 | ||
32 | config SOC_SAMA5 | ||
33 | bool | ||
34 | select AT91_SAM9_TIME | ||
35 | select CPU_V7 | ||
36 | select GENERIC_CLOCKEVENTS | ||
37 | select MULTI_IRQ_HANDLER | ||
38 | select SPARSE_IRQ | ||
39 | |||
27 | menu "Atmel AT91 System-on-Chip" | 40 | menu "Atmel AT91 System-on-Chip" |
28 | 41 | ||
42 | choice | ||
43 | |||
44 | prompt "Core type" | ||
45 | |||
46 | config SOC_SAM_V4_V5 | ||
47 | bool "ARM7/ARM9" | ||
48 | help | ||
49 | Select this if you are using one of Atmel's AT91SAM9, AT91RM9200 | ||
50 | or AT91X40 SoC. | ||
51 | |||
52 | config SOC_SAM_V7 | ||
53 | bool "Cortex A5" | ||
54 | help | ||
55 | Select this if you are using one of Atmel's SAMA5D3 SoC. | ||
56 | |||
57 | endchoice | ||
58 | |||
29 | comment "Atmel AT91 Processor" | 59 | comment "Atmel AT91 Processor" |
30 | 60 | ||
61 | if SOC_SAM_V7 | ||
62 | config SOC_SAMA5D3 | ||
63 | bool "SAMA5D3 family" | ||
64 | depends on SOC_SAM_V7 | ||
65 | select SOC_SAMA5 | ||
66 | select HAVE_FB_ATMEL | ||
67 | select HAVE_AT91_DBGU1 | ||
68 | help | ||
69 | Select this if you are using one of Atmel's SAMA5D3 family SoC. | ||
70 | This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. | ||
71 | endif | ||
72 | |||
73 | if SOC_SAM_V4_V5 | ||
31 | config SOC_AT91RM9200 | 74 | config SOC_AT91RM9200 |
32 | bool "AT91RM9200" | 75 | bool "AT91RM9200" |
33 | select CPU_ARM920T | 76 | select CPU_ARM920T |
@@ -93,394 +136,10 @@ config SOC_AT91SAM9N12 | |||
93 | help | 136 | help |
94 | Select this if you are using Atmel's AT91SAM9N12 SoC. | 137 | Select this if you are using Atmel's AT91SAM9N12 SoC. |
95 | 138 | ||
96 | choice | ||
97 | prompt "Atmel AT91 Processor Devices for non DT boards" | ||
98 | |||
99 | config ARCH_AT91_NONE | ||
100 | bool "None" | ||
101 | |||
102 | config ARCH_AT91RM9200 | ||
103 | bool "AT91RM9200" | ||
104 | select SOC_AT91RM9200 | ||
105 | |||
106 | config ARCH_AT91SAM9260 | ||
107 | bool "AT91SAM9260 or AT91SAM9XE" | ||
108 | select SOC_AT91SAM9260 | ||
109 | |||
110 | config ARCH_AT91SAM9261 | ||
111 | bool "AT91SAM9261" | ||
112 | select SOC_AT91SAM9261 | ||
113 | |||
114 | config ARCH_AT91SAM9G10 | ||
115 | bool "AT91SAM9G10" | ||
116 | select SOC_AT91SAM9261 | ||
117 | |||
118 | config ARCH_AT91SAM9263 | ||
119 | bool "AT91SAM9263" | ||
120 | select SOC_AT91SAM9263 | ||
121 | |||
122 | config ARCH_AT91SAM9RL | ||
123 | bool "AT91SAM9RL" | ||
124 | select SOC_AT91SAM9RL | ||
125 | |||
126 | config ARCH_AT91SAM9G20 | ||
127 | bool "AT91SAM9G20" | ||
128 | select SOC_AT91SAM9260 | ||
129 | |||
130 | config ARCH_AT91SAM9G45 | ||
131 | bool "AT91SAM9G45" | ||
132 | select SOC_AT91SAM9G45 | ||
133 | |||
134 | config ARCH_AT91X40 | ||
135 | bool "AT91x40" | ||
136 | depends on !MMU | ||
137 | select ARCH_USES_GETTIMEOFFSET | ||
138 | select MULTI_IRQ_HANDLER | ||
139 | select SPARSE_IRQ | ||
140 | |||
141 | endchoice | ||
142 | |||
143 | config AT91_PMC_UNIT | ||
144 | bool | ||
145 | default !ARCH_AT91X40 | ||
146 | |||
147 | # ---------------------------------------------------------- | ||
148 | |||
149 | if ARCH_AT91RM9200 | ||
150 | |||
151 | comment "AT91RM9200 Board Type" | ||
152 | |||
153 | config MACH_ONEARM | ||
154 | bool "Ajeco 1ARM Single Board Computer" | ||
155 | help | ||
156 | Select this if you are using Ajeco's 1ARM Single Board Computer. | ||
157 | <http://www.ajeco.fi/> | ||
158 | |||
159 | config ARCH_AT91RM9200DK | ||
160 | bool "Atmel AT91RM9200-DK Development board" | ||
161 | select HAVE_AT91_DATAFLASH_CARD | ||
162 | help | ||
163 | Select this if you are using Atmel's AT91RM9200-DK Development board. | ||
164 | (Discontinued) | ||
165 | |||
166 | config MACH_AT91RM9200EK | ||
167 | bool "Atmel AT91RM9200-EK Evaluation Kit" | ||
168 | select HAVE_AT91_DATAFLASH_CARD | ||
169 | help | ||
170 | Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit. | ||
171 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507> | ||
172 | |||
173 | config MACH_CSB337 | ||
174 | bool "Cogent CSB337" | ||
175 | help | ||
176 | Select this if you are using Cogent's CSB337 board. | ||
177 | <http://www.cogcomp.com/csb_csb337.htm> | ||
178 | |||
179 | config MACH_CSB637 | ||
180 | bool "Cogent CSB637" | ||
181 | help | ||
182 | Select this if you are using Cogent's CSB637 board. | ||
183 | <http://www.cogcomp.com/csb_csb637.htm> | ||
184 | |||
185 | config MACH_CARMEVA | ||
186 | bool "Conitec ARM&EVA" | ||
187 | help | ||
188 | Select this if you are using Conitec's AT91RM9200-MCU-Module. | ||
189 | <http://www.conitec.net/english/linuxboard.php> | ||
190 | |||
191 | config MACH_ATEB9200 | ||
192 | bool "Embest ATEB9200" | ||
193 | help | ||
194 | Select this if you are using Embest's ATEB9200 board. | ||
195 | <http://www.embedinfo.com/english/product/ATEB9200.asp> | ||
196 | |||
197 | config MACH_KB9200 | ||
198 | bool "KwikByte KB920x" | ||
199 | help | ||
200 | Select this if you are using KwikByte's KB920x board. | ||
201 | <http://www.kwikbyte.com/KB9202.html> | ||
202 | |||
203 | config MACH_PICOTUX2XX | ||
204 | bool "picotux 200" | ||
205 | help | ||
206 | Select this if you are using a picotux 200. | ||
207 | <http://www.picotux.com/> | ||
208 | |||
209 | config MACH_KAFA | ||
210 | bool "Sperry-Sun KAFA board" | ||
211 | help | ||
212 | Select this if you are using Sperry-Sun's KAFA board. | ||
213 | |||
214 | config MACH_ECBAT91 | ||
215 | bool "emQbit ECB_AT91 SBC" | ||
216 | select HAVE_AT91_DATAFLASH_CARD | ||
217 | help | ||
218 | Select this if you are using emQbit's ECB_AT91 board. | ||
219 | <http://wiki.emqbit.com/free-ecb-at91> | ||
220 | |||
221 | config MACH_YL9200 | ||
222 | bool "ucDragon YL-9200" | ||
223 | help | ||
224 | Select this if you are using the ucDragon YL-9200 board. | ||
225 | |||
226 | config MACH_CPUAT91 | ||
227 | bool "Eukrea CPUAT91" | ||
228 | help | ||
229 | Select this if you are using the Eukrea Electromatique's | ||
230 | CPUAT91 board <http://www.eukrea.com/>. | ||
231 | |||
232 | config MACH_ECO920 | ||
233 | bool "eco920" | ||
234 | help | ||
235 | Select this if you are using the eco920 board | ||
236 | |||
237 | config MACH_RSI_EWS | ||
238 | bool "RSI Embedded Webserver" | ||
239 | depends on ARCH_AT91RM9200 | ||
240 | help | ||
241 | Select this if you are using RSIs EWS board. | ||
242 | endif | ||
243 | |||
244 | # ---------------------------------------------------------- | ||
245 | |||
246 | if ARCH_AT91SAM9260 | ||
247 | |||
248 | comment "AT91SAM9260 Variants" | ||
249 | |||
250 | comment "AT91SAM9260 / AT91SAM9XE Board Type" | ||
251 | |||
252 | config MACH_AT91SAM9260EK | ||
253 | bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit" | ||
254 | select HAVE_AT91_DATAFLASH_CARD | ||
255 | help | ||
256 | Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit | ||
257 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933> | ||
258 | |||
259 | config MACH_CAM60 | ||
260 | bool "KwikByte KB9260 (CAM60) board" | ||
261 | help | ||
262 | Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260. | ||
263 | <http://www.kwikbyte.com/KB9260.html> | ||
264 | |||
265 | config MACH_SAM9_L9260 | ||
266 | bool "Olimex SAM9-L9260 board" | ||
267 | select HAVE_AT91_DATAFLASH_CARD | ||
268 | help | ||
269 | Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260. | ||
270 | <http://www.olimex.com/dev/sam9-L9260.html> | ||
271 | |||
272 | config MACH_AFEB9260 | ||
273 | bool "Custom afeb9260 board v1" | ||
274 | help | ||
275 | Select this if you are using custom afeb9260 board based on | ||
276 | open hardware design. Select this for revision 1 of the board. | ||
277 | <svn://194.85.238.22/home/users/george/svn/arm9eb> | ||
278 | <http://groups.google.com/group/arm9fpga-evolution-board> | ||
279 | |||
280 | config MACH_USB_A9260 | ||
281 | bool "CALAO USB-A9260" | ||
282 | help | ||
283 | Select this if you are using a Calao Systems USB-A9260. | ||
284 | <http://www.calao-systems.com> | ||
285 | |||
286 | config MACH_QIL_A9260 | ||
287 | bool "CALAO QIL-A9260 board" | ||
288 | help | ||
289 | Select this if you are using a Calao Systems QIL-A9260 Board. | ||
290 | <http://www.calao-systems.com> | ||
291 | |||
292 | config MACH_CPU9260 | ||
293 | bool "Eukrea CPU9260 board" | ||
294 | help | ||
295 | Select this if you are using a Eukrea Electromatique's | ||
296 | CPU9260 Board <http://www.eukrea.com/> | ||
297 | |||
298 | config MACH_FLEXIBITY | ||
299 | bool "Flexibity Connect board" | ||
300 | help | ||
301 | Select this if you are using Flexibity Connect board | ||
302 | <http://www.flexibity.com> | ||
303 | |||
304 | endif | ||
305 | |||
306 | # ---------------------------------------------------------- | ||
307 | |||
308 | if ARCH_AT91SAM9261 | ||
309 | |||
310 | comment "AT91SAM9261 Board Type" | ||
311 | |||
312 | config MACH_AT91SAM9261EK | ||
313 | bool "Atmel AT91SAM9261-EK Evaluation Kit" | ||
314 | select HAVE_AT91_DATAFLASH_CARD | ||
315 | help | ||
316 | Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit. | ||
317 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820> | ||
318 | |||
319 | endif | ||
320 | |||
321 | # ---------------------------------------------------------- | ||
322 | |||
323 | if ARCH_AT91SAM9G10 | ||
324 | |||
325 | comment "AT91SAM9G10 Board Type" | ||
326 | |||
327 | config MACH_AT91SAM9G10EK | ||
328 | bool "Atmel AT91SAM9G10-EK Evaluation Kit" | ||
329 | select HAVE_AT91_DATAFLASH_CARD | ||
330 | help | ||
331 | Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit. | ||
332 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588> | ||
333 | |||
334 | endif | ||
335 | |||
336 | # ---------------------------------------------------------- | ||
337 | |||
338 | if ARCH_AT91SAM9263 | ||
339 | |||
340 | comment "AT91SAM9263 Board Type" | ||
341 | |||
342 | config MACH_AT91SAM9263EK | ||
343 | bool "Atmel AT91SAM9263-EK Evaluation Kit" | ||
344 | select HAVE_AT91_DATAFLASH_CARD | ||
345 | help | ||
346 | Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit. | ||
347 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057> | ||
348 | |||
349 | config MACH_USB_A9263 | ||
350 | bool "CALAO USB-A9263" | ||
351 | help | ||
352 | Select this if you are using a Calao Systems USB-A9263. | ||
353 | <http://www.calao-systems.com> | ||
354 | |||
355 | endif | ||
356 | |||
357 | # ---------------------------------------------------------- | ||
358 | |||
359 | if ARCH_AT91SAM9RL | ||
360 | |||
361 | comment "AT91SAM9RL Board Type" | ||
362 | |||
363 | config MACH_AT91SAM9RLEK | ||
364 | bool "Atmel AT91SAM9RL-EK Evaluation Kit" | ||
365 | help | ||
366 | Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit. | ||
367 | |||
368 | endif | ||
369 | |||
370 | # ---------------------------------------------------------- | 139 | # ---------------------------------------------------------- |
371 | 140 | ||
372 | if ARCH_AT91SAM9G20 | 141 | source arch/arm/mach-at91/Kconfig.non_dt |
373 | 142 | endif # SOC_SAM_V4_V5 | |
374 | comment "AT91SAM9G20 Board Type" | ||
375 | |||
376 | config MACH_AT91SAM9G20EK | ||
377 | bool "Atmel AT91SAM9G20-EK Evaluation Kit" | ||
378 | select HAVE_AT91_DATAFLASH_CARD | ||
379 | help | ||
380 | Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit | ||
381 | that embeds only one SD/MMC slot. | ||
382 | |||
383 | config MACH_AT91SAM9G20EK_2MMC | ||
384 | depends on MACH_AT91SAM9G20EK | ||
385 | bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots" | ||
386 | help | ||
387 | Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit | ||
388 | with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and | ||
389 | onwards. | ||
390 | <http://www.atmel.com/tools/SAM9G20-EK.aspx> | ||
391 | |||
392 | config MACH_CPU9G20 | ||
393 | bool "Eukrea CPU9G20 board" | ||
394 | help | ||
395 | Select this if you are using a Eukrea Electromatique's | ||
396 | CPU9G20 Board <http://www.eukrea.com/> | ||
397 | |||
398 | config MACH_ACMENETUSFOXG20 | ||
399 | bool "Acme Systems srl FOX Board G20" | ||
400 | help | ||
401 | Select this if you are using Acme Systems | ||
402 | FOX Board G20 <http://www.acmesystems.it> | ||
403 | |||
404 | config MACH_PORTUXG20 | ||
405 | bool "taskit PortuxG20" | ||
406 | help | ||
407 | Select this if you are using taskit's PortuxG20. | ||
408 | <http://www.taskit.de/en/> | ||
409 | |||
410 | config MACH_STAMP9G20 | ||
411 | bool "taskit Stamp9G20 CPU module" | ||
412 | help | ||
413 | Select this if you are using taskit's Stamp9G20 CPU module on its | ||
414 | evaluation board. | ||
415 | <http://www.taskit.de/en/> | ||
416 | |||
417 | config MACH_PCONTROL_G20 | ||
418 | bool "PControl G20 CPU module" | ||
419 | help | ||
420 | Select this if you are using taskit's Stamp9G20 CPU module on this | ||
421 | carrier board, beeing the decentralized unit of a building automation | ||
422 | system; featuring nvram, eth-switch, iso-rs485, display, io | ||
423 | |||
424 | config MACH_GSIA18S | ||
425 | bool "GS_IA18_S board" | ||
426 | help | ||
427 | This enables support for the GS_IA18_S board | ||
428 | produced by GeoSIG Ltd company. This is an internet accelerograph. | ||
429 | <http://www.geosig.com> | ||
430 | |||
431 | config MACH_USB_A9G20 | ||
432 | bool "CALAO USB-A9G20" | ||
433 | depends on ARCH_AT91SAM9G20 | ||
434 | help | ||
435 | Select this if you are using a Calao Systems USB-A9G20. | ||
436 | <http://www.calao-systems.com> | ||
437 | |||
438 | endif | ||
439 | |||
440 | if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) | ||
441 | comment "AT91SAM9260/AT91SAM9G20 boards" | ||
442 | |||
443 | config MACH_SNAPPER_9260 | ||
444 | bool "Bluewater Systems Snapper 9260/9G20 module" | ||
445 | help | ||
446 | Select this if you are using the Bluewater Systems Snapper 9260 or | ||
447 | Snapper 9G20 modules. | ||
448 | <http://www.bluewatersys.com/> | ||
449 | endif | ||
450 | |||
451 | # ---------------------------------------------------------- | ||
452 | |||
453 | if ARCH_AT91SAM9G45 | ||
454 | |||
455 | comment "AT91SAM9G45 Board Type" | ||
456 | |||
457 | config MACH_AT91SAM9M10G45EK | ||
458 | bool "Atmel AT91SAM9M10G45-EK Evaluation Kits" | ||
459 | help | ||
460 | Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit. | ||
461 | Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10 | ||
462 | families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. | ||
463 | <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx> | ||
464 | |||
465 | endif | ||
466 | |||
467 | # ---------------------------------------------------------- | ||
468 | |||
469 | if ARCH_AT91X40 | ||
470 | |||
471 | comment "AT91X40 Board Type" | ||
472 | |||
473 | config MACH_AT91EB01 | ||
474 | bool "Atmel AT91EB01 Evaluation Kit" | ||
475 | help | ||
476 | Select this if you are using Atmel's AT91EB01 Evaluation Kit. | ||
477 | It is also a popular target for simulators such as GDB's | ||
478 | ARM simulator (commonly known as the ARMulator) and the | ||
479 | Skyeye simulator. | ||
480 | |||
481 | endif | ||
482 | |||
483 | # ---------------------------------------------------------- | ||
484 | 143 | ||
485 | comment "Generic Board Type" | 144 | comment "Generic Board Type" |
486 | 145 | ||
@@ -492,7 +151,7 @@ config MACH_AT91RM9200_DT | |||
492 | Select this if you want to experiment device-tree with | 151 | Select this if you want to experiment device-tree with |
493 | an Atmel RM9200 Evaluation Kit. | 152 | an Atmel RM9200 Evaluation Kit. |
494 | 153 | ||
495 | config MACH_AT91SAM_DT | 154 | config MACH_AT91SAM9_DT |
496 | bool "Atmel AT91SAM Evaluation Kits with device-tree support" | 155 | bool "Atmel AT91SAM Evaluation Kits with device-tree support" |
497 | depends on SOC_AT91SAM9 | 156 | depends on SOC_AT91SAM9 |
498 | select USE_OF | 157 | select USE_OF |
@@ -500,15 +159,13 @@ config MACH_AT91SAM_DT | |||
500 | Select this if you want to experiment device-tree with | 159 | Select this if you want to experiment device-tree with |
501 | an Atmel Evaluation Kit. | 160 | an Atmel Evaluation Kit. |
502 | 161 | ||
503 | # ---------------------------------------------------------- | 162 | config MACH_SAMA5_DT |
504 | 163 | bool "Atmel SAMA5 Evaluation Kits with device-tree support" | |
505 | comment "AT91 Board Options" | 164 | depends on SOC_SAMA5 |
506 | 165 | select USE_OF | |
507 | config MTD_AT91_DATAFLASH_CARD | ||
508 | bool "Enable DataFlash Card support" | ||
509 | depends on HAVE_AT91_DATAFLASH_CARD | ||
510 | help | 166 | help |
511 | Enable support for the DataFlash card. | 167 | Select this if you want to experiment device-tree with |
168 | an Atmel Evaluation Kit. | ||
512 | 169 | ||
513 | # ---------------------------------------------------------- | 170 | # ---------------------------------------------------------- |
514 | 171 | ||
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt new file mode 100644 index 000000000000..6c24985515a2 --- /dev/null +++ b/arch/arm/mach-at91/Kconfig.non_dt | |||
@@ -0,0 +1,399 @@ | |||
1 | menu "Atmel Non-DT world" | ||
2 | |||
3 | config HAVE_AT91_DATAFLASH_CARD | ||
4 | bool | ||
5 | |||
6 | choice | ||
7 | prompt "Atmel AT91 Processor Devices for non DT boards" | ||
8 | |||
9 | config ARCH_AT91_NONE | ||
10 | bool "None" | ||
11 | |||
12 | config ARCH_AT91RM9200 | ||
13 | bool "AT91RM9200" | ||
14 | select SOC_AT91RM9200 | ||
15 | |||
16 | config ARCH_AT91SAM9260 | ||
17 | bool "AT91SAM9260 or AT91SAM9XE" | ||
18 | select SOC_AT91SAM9260 | ||
19 | |||
20 | config ARCH_AT91SAM9261 | ||
21 | bool "AT91SAM9261" | ||
22 | select SOC_AT91SAM9261 | ||
23 | |||
24 | config ARCH_AT91SAM9G10 | ||
25 | bool "AT91SAM9G10" | ||
26 | select SOC_AT91SAM9261 | ||
27 | |||
28 | config ARCH_AT91SAM9263 | ||
29 | bool "AT91SAM9263" | ||
30 | select SOC_AT91SAM9263 | ||
31 | |||
32 | config ARCH_AT91SAM9RL | ||
33 | bool "AT91SAM9RL" | ||
34 | select SOC_AT91SAM9RL | ||
35 | |||
36 | config ARCH_AT91SAM9G20 | ||
37 | bool "AT91SAM9G20" | ||
38 | select SOC_AT91SAM9260 | ||
39 | |||
40 | config ARCH_AT91SAM9G45 | ||
41 | bool "AT91SAM9G45" | ||
42 | select SOC_AT91SAM9G45 | ||
43 | |||
44 | config ARCH_AT91X40 | ||
45 | bool "AT91x40" | ||
46 | depends on !MMU | ||
47 | select ARCH_USES_GETTIMEOFFSET | ||
48 | select MULTI_IRQ_HANDLER | ||
49 | select SPARSE_IRQ | ||
50 | |||
51 | endchoice | ||
52 | |||
53 | # ---------------------------------------------------------- | ||
54 | |||
55 | if ARCH_AT91RM9200 | ||
56 | |||
57 | comment "AT91RM9200 Board Type" | ||
58 | |||
59 | config MACH_ONEARM | ||
60 | bool "Ajeco 1ARM Single Board Computer" | ||
61 | help | ||
62 | Select this if you are using Ajeco's 1ARM Single Board Computer. | ||
63 | <http://www.ajeco.fi/> | ||
64 | |||
65 | config ARCH_AT91RM9200DK | ||
66 | bool "Atmel AT91RM9200-DK Development board" | ||
67 | select HAVE_AT91_DATAFLASH_CARD | ||
68 | help | ||
69 | Select this if you are using Atmel's AT91RM9200-DK Development board. | ||
70 | (Discontinued) | ||
71 | |||
72 | config MACH_AT91RM9200EK | ||
73 | bool "Atmel AT91RM9200-EK Evaluation Kit" | ||
74 | select HAVE_AT91_DATAFLASH_CARD | ||
75 | help | ||
76 | Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit. | ||
77 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507> | ||
78 | |||
79 | config MACH_CSB337 | ||
80 | bool "Cogent CSB337" | ||
81 | help | ||
82 | Select this if you are using Cogent's CSB337 board. | ||
83 | <http://www.cogcomp.com/csb_csb337.htm> | ||
84 | |||
85 | config MACH_CSB637 | ||
86 | bool "Cogent CSB637" | ||
87 | help | ||
88 | Select this if you are using Cogent's CSB637 board. | ||
89 | <http://www.cogcomp.com/csb_csb637.htm> | ||
90 | |||
91 | config MACH_CARMEVA | ||
92 | bool "Conitec ARM&EVA" | ||
93 | help | ||
94 | Select this if you are using Conitec's AT91RM9200-MCU-Module. | ||
95 | <http://www.conitec.net/english/linuxboard.php> | ||
96 | |||
97 | config MACH_ATEB9200 | ||
98 | bool "Embest ATEB9200" | ||
99 | help | ||
100 | Select this if you are using Embest's ATEB9200 board. | ||
101 | <http://www.embedinfo.com/english/product/ATEB9200.asp> | ||
102 | |||
103 | config MACH_KB9200 | ||
104 | bool "KwikByte KB920x" | ||
105 | help | ||
106 | Select this if you are using KwikByte's KB920x board. | ||
107 | <http://www.kwikbyte.com/KB9202.html> | ||
108 | |||
109 | config MACH_PICOTUX2XX | ||
110 | bool "picotux 200" | ||
111 | help | ||
112 | Select this if you are using a picotux 200. | ||
113 | <http://www.picotux.com/> | ||
114 | |||
115 | config MACH_KAFA | ||
116 | bool "Sperry-Sun KAFA board" | ||
117 | help | ||
118 | Select this if you are using Sperry-Sun's KAFA board. | ||
119 | |||
120 | config MACH_ECBAT91 | ||
121 | bool "emQbit ECB_AT91 SBC" | ||
122 | select HAVE_AT91_DATAFLASH_CARD | ||
123 | help | ||
124 | Select this if you are using emQbit's ECB_AT91 board. | ||
125 | <http://wiki.emqbit.com/free-ecb-at91> | ||
126 | |||
127 | config MACH_YL9200 | ||
128 | bool "ucDragon YL-9200" | ||
129 | help | ||
130 | Select this if you are using the ucDragon YL-9200 board. | ||
131 | |||
132 | config MACH_CPUAT91 | ||
133 | bool "Eukrea CPUAT91" | ||
134 | help | ||
135 | Select this if you are using the Eukrea Electromatique's | ||
136 | CPUAT91 board <http://www.eukrea.com/>. | ||
137 | |||
138 | config MACH_ECO920 | ||
139 | bool "eco920" | ||
140 | help | ||
141 | Select this if you are using the eco920 board | ||
142 | |||
143 | config MACH_RSI_EWS | ||
144 | bool "RSI Embedded Webserver" | ||
145 | depends on ARCH_AT91RM9200 | ||
146 | help | ||
147 | Select this if you are using RSIs EWS board. | ||
148 | endif | ||
149 | |||
150 | # ---------------------------------------------------------- | ||
151 | |||
152 | if ARCH_AT91SAM9260 | ||
153 | |||
154 | comment "AT91SAM9260 Variants" | ||
155 | |||
156 | comment "AT91SAM9260 / AT91SAM9XE Board Type" | ||
157 | |||
158 | config MACH_AT91SAM9260EK | ||
159 | bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit" | ||
160 | select HAVE_AT91_DATAFLASH_CARD | ||
161 | help | ||
162 | Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit | ||
163 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933> | ||
164 | |||
165 | config MACH_CAM60 | ||
166 | bool "KwikByte KB9260 (CAM60) board" | ||
167 | help | ||
168 | Select this if you are using KwikByte's KB9260 (CAM60) board based on the Atmel AT91SAM9260. | ||
169 | <http://www.kwikbyte.com/KB9260.html> | ||
170 | |||
171 | config MACH_SAM9_L9260 | ||
172 | bool "Olimex SAM9-L9260 board" | ||
173 | select HAVE_AT91_DATAFLASH_CARD | ||
174 | help | ||
175 | Select this if you are using Olimex's SAM9-L9260 board based on the Atmel AT91SAM9260. | ||
176 | <http://www.olimex.com/dev/sam9-L9260.html> | ||
177 | |||
178 | config MACH_AFEB9260 | ||
179 | bool "Custom afeb9260 board v1" | ||
180 | help | ||
181 | Select this if you are using custom afeb9260 board based on | ||
182 | open hardware design. Select this for revision 1 of the board. | ||
183 | <svn://194.85.238.22/home/users/george/svn/arm9eb> | ||
184 | <http://groups.google.com/group/arm9fpga-evolution-board> | ||
185 | |||
186 | config MACH_USB_A9260 | ||
187 | bool "CALAO USB-A9260" | ||
188 | help | ||
189 | Select this if you are using a Calao Systems USB-A9260. | ||
190 | <http://www.calao-systems.com> | ||
191 | |||
192 | config MACH_QIL_A9260 | ||
193 | bool "CALAO QIL-A9260 board" | ||
194 | help | ||
195 | Select this if you are using a Calao Systems QIL-A9260 Board. | ||
196 | <http://www.calao-systems.com> | ||
197 | |||
198 | config MACH_CPU9260 | ||
199 | bool "Eukrea CPU9260 board" | ||
200 | help | ||
201 | Select this if you are using a Eukrea Electromatique's | ||
202 | CPU9260 Board <http://www.eukrea.com/> | ||
203 | |||
204 | config MACH_FLEXIBITY | ||
205 | bool "Flexibity Connect board" | ||
206 | help | ||
207 | Select this if you are using Flexibity Connect board | ||
208 | <http://www.flexibity.com> | ||
209 | |||
210 | endif | ||
211 | |||
212 | # ---------------------------------------------------------- | ||
213 | |||
214 | if ARCH_AT91SAM9261 | ||
215 | |||
216 | comment "AT91SAM9261 Board Type" | ||
217 | |||
218 | config MACH_AT91SAM9261EK | ||
219 | bool "Atmel AT91SAM9261-EK Evaluation Kit" | ||
220 | select HAVE_AT91_DATAFLASH_CARD | ||
221 | help | ||
222 | Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit. | ||
223 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820> | ||
224 | |||
225 | endif | ||
226 | |||
227 | # ---------------------------------------------------------- | ||
228 | |||
229 | if ARCH_AT91SAM9G10 | ||
230 | |||
231 | comment "AT91SAM9G10 Board Type" | ||
232 | |||
233 | config MACH_AT91SAM9G10EK | ||
234 | bool "Atmel AT91SAM9G10-EK Evaluation Kit" | ||
235 | select HAVE_AT91_DATAFLASH_CARD | ||
236 | help | ||
237 | Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit. | ||
238 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588> | ||
239 | |||
240 | endif | ||
241 | |||
242 | # ---------------------------------------------------------- | ||
243 | |||
244 | if ARCH_AT91SAM9263 | ||
245 | |||
246 | comment "AT91SAM9263 Board Type" | ||
247 | |||
248 | config MACH_AT91SAM9263EK | ||
249 | bool "Atmel AT91SAM9263-EK Evaluation Kit" | ||
250 | select HAVE_AT91_DATAFLASH_CARD | ||
251 | help | ||
252 | Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit. | ||
253 | <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057> | ||
254 | |||
255 | config MACH_USB_A9263 | ||
256 | bool "CALAO USB-A9263" | ||
257 | help | ||
258 | Select this if you are using a Calao Systems USB-A9263. | ||
259 | <http://www.calao-systems.com> | ||
260 | |||
261 | endif | ||
262 | |||
263 | # ---------------------------------------------------------- | ||
264 | |||
265 | if ARCH_AT91SAM9RL | ||
266 | |||
267 | comment "AT91SAM9RL Board Type" | ||
268 | |||
269 | config MACH_AT91SAM9RLEK | ||
270 | bool "Atmel AT91SAM9RL-EK Evaluation Kit" | ||
271 | help | ||
272 | Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit. | ||
273 | |||
274 | endif | ||
275 | |||
276 | # ---------------------------------------------------------- | ||
277 | |||
278 | if ARCH_AT91SAM9G20 | ||
279 | |||
280 | comment "AT91SAM9G20 Board Type" | ||
281 | |||
282 | config MACH_AT91SAM9G20EK | ||
283 | bool "Atmel AT91SAM9G20-EK Evaluation Kit" | ||
284 | select HAVE_AT91_DATAFLASH_CARD | ||
285 | help | ||
286 | Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit | ||
287 | that embeds only one SD/MMC slot. | ||
288 | |||
289 | config MACH_AT91SAM9G20EK_2MMC | ||
290 | depends on MACH_AT91SAM9G20EK | ||
291 | bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots" | ||
292 | help | ||
293 | Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit | ||
294 | with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and | ||
295 | onwards. | ||
296 | <http://www.atmel.com/tools/SAM9G20-EK.aspx> | ||
297 | |||
298 | config MACH_CPU9G20 | ||
299 | bool "Eukrea CPU9G20 board" | ||
300 | help | ||
301 | Select this if you are using a Eukrea Electromatique's | ||
302 | CPU9G20 Board <http://www.eukrea.com/> | ||
303 | |||
304 | config MACH_ACMENETUSFOXG20 | ||
305 | bool "Acme Systems srl FOX Board G20" | ||
306 | help | ||
307 | Select this if you are using Acme Systems | ||
308 | FOX Board G20 <http://www.acmesystems.it> | ||
309 | |||
310 | config MACH_PORTUXG20 | ||
311 | bool "taskit PortuxG20" | ||
312 | help | ||
313 | Select this if you are using taskit's PortuxG20. | ||
314 | <http://www.taskit.de/en/> | ||
315 | |||
316 | config MACH_STAMP9G20 | ||
317 | bool "taskit Stamp9G20 CPU module" | ||
318 | help | ||
319 | Select this if you are using taskit's Stamp9G20 CPU module on its | ||
320 | evaluation board. | ||
321 | <http://www.taskit.de/en/> | ||
322 | |||
323 | config MACH_PCONTROL_G20 | ||
324 | bool "PControl G20 CPU module" | ||
325 | help | ||
326 | Select this if you are using taskit's Stamp9G20 CPU module on this | ||
327 | carrier board, beeing the decentralized unit of a building automation | ||
328 | system; featuring nvram, eth-switch, iso-rs485, display, io | ||
329 | |||
330 | config MACH_GSIA18S | ||
331 | bool "GS_IA18_S board" | ||
332 | help | ||
333 | This enables support for the GS_IA18_S board | ||
334 | produced by GeoSIG Ltd company. This is an internet accelerograph. | ||
335 | <http://www.geosig.com> | ||
336 | |||
337 | config MACH_USB_A9G20 | ||
338 | bool "CALAO USB-A9G20" | ||
339 | depends on ARCH_AT91SAM9G20 | ||
340 | help | ||
341 | Select this if you are using a Calao Systems USB-A9G20. | ||
342 | <http://www.calao-systems.com> | ||
343 | |||
344 | endif | ||
345 | |||
346 | if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) | ||
347 | comment "AT91SAM9260/AT91SAM9G20 boards" | ||
348 | |||
349 | config MACH_SNAPPER_9260 | ||
350 | bool "Bluewater Systems Snapper 9260/9G20 module" | ||
351 | help | ||
352 | Select this if you are using the Bluewater Systems Snapper 9260 or | ||
353 | Snapper 9G20 modules. | ||
354 | <http://www.bluewatersys.com/> | ||
355 | endif | ||
356 | |||
357 | # ---------------------------------------------------------- | ||
358 | |||
359 | if ARCH_AT91SAM9G45 | ||
360 | |||
361 | comment "AT91SAM9G45 Board Type" | ||
362 | |||
363 | config MACH_AT91SAM9M10G45EK | ||
364 | bool "Atmel AT91SAM9M10G45-EK Evaluation Kits" | ||
365 | help | ||
366 | Select this if you are using Atmel's AT91SAM9M10G45-EK Evaluation Kit. | ||
367 | Those boards can be populated with any SoC of AT91SAM9G45 or AT91SAM9M10 | ||
368 | families: AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. | ||
369 | <http://www.atmel.com/tools/SAM9M10-G45-EK.aspx> | ||
370 | |||
371 | endif | ||
372 | |||
373 | # ---------------------------------------------------------- | ||
374 | |||
375 | if ARCH_AT91X40 | ||
376 | |||
377 | comment "AT91X40 Board Type" | ||
378 | |||
379 | config MACH_AT91EB01 | ||
380 | bool "Atmel AT91EB01 Evaluation Kit" | ||
381 | help | ||
382 | Select this if you are using Atmel's AT91EB01 Evaluation Kit. | ||
383 | It is also a popular target for simulators such as GDB's | ||
384 | ARM simulator (commonly known as the ARMulator) and the | ||
385 | Skyeye simulator. | ||
386 | |||
387 | endif | ||
388 | |||
389 | # ---------------------------------------------------------- | ||
390 | |||
391 | comment "AT91 Board Options" | ||
392 | |||
393 | config MTD_AT91_DATAFLASH_CARD | ||
394 | bool "Enable DataFlash Card support" | ||
395 | depends on HAVE_AT91_DATAFLASH_CARD | ||
396 | help | ||
397 | Enable support for the DataFlash card. | ||
398 | |||
399 | endmenu | ||
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 39218ca6d8e8..788562dccb43 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -10,7 +10,8 @@ obj- := | |||
10 | obj-$(CONFIG_AT91_PMC_UNIT) += clock.o | 10 | obj-$(CONFIG_AT91_PMC_UNIT) += clock.o |
11 | obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o | 11 | obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o |
12 | obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o | 12 | obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o |
13 | obj-$(CONFIG_SOC_AT91SAM9) += at91sam926x_time.o sam9_smc.o | 13 | obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o |
14 | obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o | ||
14 | 15 | ||
15 | # CPU-specific support | 16 | # CPU-specific support |
16 | obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o | 17 | obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o |
@@ -21,6 +22,7 @@ obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o | |||
21 | obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o | 22 | obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o |
22 | obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o | 23 | obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o |
23 | obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o | 24 | obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o |
25 | obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o | ||
24 | 26 | ||
25 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o | 27 | obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o |
26 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o | 28 | obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o |
@@ -87,8 +89,11 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o | |||
87 | obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o | 89 | obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o |
88 | 90 | ||
89 | # AT91SAM board with device-tree | 91 | # AT91SAM board with device-tree |
90 | obj-$(CONFIG_MACH_AT91RM9200_DT) += board-rm9200-dt.o | 92 | obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o |
91 | obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o | 93 | obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o |
94 | |||
95 | # SAMA5 board with device-tree | ||
96 | obj-$(CONFIG_MACH_SAMA5_DT) += board-dt-sama5.o | ||
92 | 97 | ||
93 | # AT91X40 board-specific support | 98 | # AT91X40 board-specific support |
94 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o | 99 | obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o |
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 9706c000f294..ccce7592dbd3 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -384,7 +384,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
384 | 0 /* Advanced Interrupt Controller (IRQ6) */ | 384 | 0 /* Advanced Interrupt Controller (IRQ6) */ |
385 | }; | 385 | }; |
386 | 386 | ||
387 | AT91_SOC_START(rm9200) | 387 | AT91_SOC_START(at91rm9200) |
388 | .map_io = at91rm9200_map_io, | 388 | .map_io = at91rm9200_map_io, |
389 | .default_irq_priority = at91rm9200_default_irq_priority, | 389 | .default_irq_priority = at91rm9200_default_irq_priority, |
390 | .ioremap_registers = at91rm9200_ioremap_registers, | 390 | .ioremap_registers = at91rm9200_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index b67cd5374117..1833b4c365df 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
@@ -395,7 +395,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
395 | 0, /* Advanced Interrupt Controller */ | 395 | 0, /* Advanced Interrupt Controller */ |
396 | }; | 396 | }; |
397 | 397 | ||
398 | AT91_SOC_START(sam9260) | 398 | AT91_SOC_START(at91sam9260) |
399 | .map_io = at91sam9260_map_io, | 399 | .map_io = at91sam9260_map_io, |
400 | .default_irq_priority = at91sam9260_default_irq_priority, | 400 | .default_irq_priority = at91sam9260_default_irq_priority, |
401 | .ioremap_registers = at91sam9260_ioremap_registers, | 401 | .ioremap_registers = at91sam9260_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 0204f4cc9ebf..25efb5ac30f1 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -339,7 +339,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
339 | 0, /* Advanced Interrupt Controller */ | 339 | 0, /* Advanced Interrupt Controller */ |
340 | }; | 340 | }; |
341 | 341 | ||
342 | AT91_SOC_START(sam9261) | 342 | AT91_SOC_START(at91sam9261) |
343 | .map_io = at91sam9261_map_io, | 343 | .map_io = at91sam9261_map_io, |
344 | .default_irq_priority = at91sam9261_default_irq_priority, | 344 | .default_irq_priority = at91sam9261_default_irq_priority, |
345 | .ioremap_registers = at91sam9261_ioremap_registers, | 345 | .ioremap_registers = at91sam9261_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index 2282fd7ad3e3..f44ffd2105a7 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -375,7 +375,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
375 | 0, /* Advanced Interrupt Controller (IRQ1) */ | 375 | 0, /* Advanced Interrupt Controller (IRQ1) */ |
376 | }; | 376 | }; |
377 | 377 | ||
378 | AT91_SOC_START(sam9263) | 378 | AT91_SOC_START(at91sam9263) |
379 | .map_io = at91sam9263_map_io, | 379 | .map_io = at91sam9263_map_io, |
380 | .default_irq_priority = at91sam9263_default_irq_priority, | 380 | .default_irq_priority = at91sam9263_default_irq_priority, |
381 | .ioremap_registers = at91sam9263_ioremap_registers, | 381 | .ioremap_registers = at91sam9263_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index c68960d82247..dc49c2c45d49 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -420,7 +420,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
420 | 0, /* Advanced Interrupt Controller (IRQ0) */ | 420 | 0, /* Advanced Interrupt Controller (IRQ0) */ |
421 | }; | 421 | }; |
422 | 422 | ||
423 | AT91_SOC_START(sam9g45) | 423 | AT91_SOC_START(at91sam9g45) |
424 | .map_io = at91sam9g45_map_io, | 424 | .map_io = at91sam9g45_map_io, |
425 | .default_irq_priority = at91sam9g45_default_irq_priority, | 425 | .default_irq_priority = at91sam9g45_default_irq_priority, |
426 | .ioremap_registers = at91sam9g45_ioremap_registers, | 426 | .ioremap_registers = at91sam9g45_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c index 5dfc8fd87103..2c7a2f4a7568 100644 --- a/arch/arm/mach-at91/at91sam9n12.c +++ b/arch/arm/mach-at91/at91sam9n12.c | |||
@@ -226,7 +226,7 @@ void __init at91sam9n12_initialize(void) | |||
226 | at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0); | 226 | at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0); |
227 | } | 227 | } |
228 | 228 | ||
229 | AT91_SOC_START(sam9n12) | 229 | AT91_SOC_START(at91sam9n12) |
230 | .map_io = at91sam9n12_map_io, | 230 | .map_io = at91sam9n12_map_io, |
231 | .register_clocks = at91sam9n12_register_clocks, | 231 | .register_clocks = at91sam9n12_register_clocks, |
232 | .init = at91sam9n12_initialize, | 232 | .init = at91sam9n12_initialize, |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index 3de3e04d0f81..f77fae5591bc 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -341,7 +341,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
341 | 0, /* Advanced Interrupt Controller */ | 341 | 0, /* Advanced Interrupt Controller */ |
342 | }; | 342 | }; |
343 | 343 | ||
344 | AT91_SOC_START(sam9rl) | 344 | AT91_SOC_START(at91sam9rl) |
345 | .map_io = at91sam9rl_map_io, | 345 | .map_io = at91sam9rl_map_io, |
346 | .default_irq_priority = at91sam9rl_default_irq_priority, | 346 | .default_irq_priority = at91sam9rl_default_irq_priority, |
347 | .ioremap_registers = at91sam9rl_ioremap_registers, | 347 | .ioremap_registers = at91sam9rl_ioremap_registers, |
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index 44a9a62dcc13..3a1a7993c125 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c | |||
@@ -320,7 +320,7 @@ static void __init at91sam9x5_map_io(void) | |||
320 | * Interrupt initialization | 320 | * Interrupt initialization |
321 | * -------------------------------------------------------------------- */ | 321 | * -------------------------------------------------------------------- */ |
322 | 322 | ||
323 | AT91_SOC_START(sam9x5) | 323 | AT91_SOC_START(at91sam9x5) |
324 | .map_io = at91sam9x5_map_io, | 324 | .map_io = at91sam9x5_map_io, |
325 | .register_clocks = at91sam9x5_register_clocks, | 325 | .register_clocks = at91sam9x5_register_clocks, |
326 | AT91_SOC_END | 326 | AT91_SOC_END |
diff --git a/arch/arm/mach-at91/board-rm9200-dt.c b/arch/arm/mach-at91/board-dt-rm9200.c index 3fcb6623a33e..3fcb6623a33e 100644 --- a/arch/arm/mach-at91/board-rm9200-dt.c +++ b/arch/arm/mach-at91/board-dt-rm9200.c | |||
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt-sam9.c index 8db30132abed..8db30132abed 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt-sam9.c | |||
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c new file mode 100644 index 000000000000..705305e62bbc --- /dev/null +++ b/arch/arm/mach-at91/board-dt-sama5.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* | ||
2 | * Setup code for SAMA5 Evaluation Kits with Device Tree support | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/gpio.h> | ||
14 | #include <linux/micrel_phy.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_irq.h> | ||
17 | #include <linux/of_platform.h> | ||
18 | #include <linux/phy.h> | ||
19 | |||
20 | #include <asm/setup.h> | ||
21 | #include <asm/irq.h> | ||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach/map.h> | ||
24 | #include <asm/mach/irq.h> | ||
25 | |||
26 | #include "at91_aic.h" | ||
27 | #include "generic.h" | ||
28 | |||
29 | |||
30 | static const struct of_device_id irq_of_match[] __initconst = { | ||
31 | |||
32 | { .compatible = "atmel,sama5d3-aic", .data = at91_aic5_of_init }, | ||
33 | { /*sentinel*/ } | ||
34 | }; | ||
35 | |||
36 | static void __init at91_dt_init_irq(void) | ||
37 | { | ||
38 | of_irq_init(irq_of_match); | ||
39 | } | ||
40 | |||
41 | static int ksz9021rn_phy_fixup(struct phy_device *phy) | ||
42 | { | ||
43 | int value; | ||
44 | |||
45 | #define GMII_RCCPSR 260 | ||
46 | #define GMII_RRDPSR 261 | ||
47 | #define GMII_ERCR 11 | ||
48 | #define GMII_ERDWR 12 | ||
49 | |||
50 | /* Set delay values */ | ||
51 | value = GMII_RCCPSR | 0x8000; | ||
52 | phy_write(phy, GMII_ERCR, value); | ||
53 | value = 0xF2F4; | ||
54 | phy_write(phy, GMII_ERDWR, value); | ||
55 | value = GMII_RRDPSR | 0x8000; | ||
56 | phy_write(phy, GMII_ERCR, value); | ||
57 | value = 0x2222; | ||
58 | phy_write(phy, GMII_ERDWR, value); | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static void __init sama5_dt_device_init(void) | ||
64 | { | ||
65 | if (of_machine_is_compatible("atmel,sama5d3xcm")) | ||
66 | phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, | ||
67 | ksz9021rn_phy_fixup); | ||
68 | |||
69 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
70 | } | ||
71 | |||
72 | static const char *sama5_dt_board_compat[] __initdata = { | ||
73 | "atmel,sama5", | ||
74 | NULL | ||
75 | }; | ||
76 | |||
77 | DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") | ||
78 | /* Maintainer: Atmel */ | ||
79 | .init_time = at91sam926x_pit_init, | ||
80 | .map_io = at91_map_io, | ||
81 | .handle_irq = at91_aic5_handle_irq, | ||
82 | .init_early = at91_dt_initialize, | ||
83 | .init_irq = at91_dt_init_irq, | ||
84 | .init_machine = sama5_dt_device_init, | ||
85 | .dt_compat = sama5_dt_board_compat, | ||
86 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c index 33361505c0cd..da841885d01c 100644 --- a/arch/arm/mach-at91/clock.c +++ b/arch/arm/mach-at91/clock.c | |||
@@ -54,7 +54,10 @@ EXPORT_SYMBOL_GPL(at91_pmc_base); | |||
54 | */ | 54 | */ |
55 | #define cpu_has_utmi() ( cpu_is_at91sam9rl() \ | 55 | #define cpu_has_utmi() ( cpu_is_at91sam9rl() \ |
56 | || cpu_is_at91sam9g45() \ | 56 | || cpu_is_at91sam9g45() \ |
57 | || cpu_is_at91sam9x5()) | 57 | || cpu_is_at91sam9x5() \ |
58 | || cpu_is_sama5d3()) | ||
59 | |||
60 | #define cpu_has_1056M_plla() (cpu_is_sama5d3()) | ||
58 | 61 | ||
59 | #define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ | 62 | #define cpu_has_800M_plla() ( cpu_is_at91sam9g20() \ |
60 | || cpu_is_at91sam9g45() \ | 63 | || cpu_is_at91sam9g45() \ |
@@ -75,7 +78,8 @@ EXPORT_SYMBOL_GPL(at91_pmc_base); | |||
75 | || cpu_is_at91sam9n12())) | 78 | || cpu_is_at91sam9n12())) |
76 | 79 | ||
77 | #define cpu_has_upll() (cpu_is_at91sam9g45() \ | 80 | #define cpu_has_upll() (cpu_is_at91sam9g45() \ |
78 | || cpu_is_at91sam9x5()) | 81 | || cpu_is_at91sam9x5() \ |
82 | || cpu_is_sama5d3()) | ||
79 | 83 | ||
80 | /* USB host HS & FS */ | 84 | /* USB host HS & FS */ |
81 | #define cpu_has_uhp() (!cpu_is_at91sam9rl()) | 85 | #define cpu_has_uhp() (!cpu_is_at91sam9rl()) |
@@ -83,18 +87,22 @@ EXPORT_SYMBOL_GPL(at91_pmc_base); | |||
83 | /* USB device FS only */ | 87 | /* USB device FS only */ |
84 | #define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \ | 88 | #define cpu_has_udpfs() (!(cpu_is_at91sam9rl() \ |
85 | || cpu_is_at91sam9g45() \ | 89 | || cpu_is_at91sam9g45() \ |
86 | || cpu_is_at91sam9x5())) | 90 | || cpu_is_at91sam9x5() \ |
91 | || cpu_is_sama5d3())) | ||
87 | 92 | ||
88 | #define cpu_has_plladiv2() (cpu_is_at91sam9g45() \ | 93 | #define cpu_has_plladiv2() (cpu_is_at91sam9g45() \ |
89 | || cpu_is_at91sam9x5() \ | 94 | || cpu_is_at91sam9x5() \ |
90 | || cpu_is_at91sam9n12()) | 95 | || cpu_is_at91sam9n12() \ |
96 | || cpu_is_sama5d3()) | ||
91 | 97 | ||
92 | #define cpu_has_mdiv3() (cpu_is_at91sam9g45() \ | 98 | #define cpu_has_mdiv3() (cpu_is_at91sam9g45() \ |
93 | || cpu_is_at91sam9x5() \ | 99 | || cpu_is_at91sam9x5() \ |
94 | || cpu_is_at91sam9n12()) | 100 | || cpu_is_at91sam9n12() \ |
101 | || cpu_is_sama5d3()) | ||
95 | 102 | ||
96 | #define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \ | 103 | #define cpu_has_alt_prescaler() (cpu_is_at91sam9x5() \ |
97 | || cpu_is_at91sam9n12()) | 104 | || cpu_is_at91sam9n12() \ |
105 | || cpu_is_sama5d3()) | ||
98 | 106 | ||
99 | static LIST_HEAD(clocks); | 107 | static LIST_HEAD(clocks); |
100 | static DEFINE_SPINLOCK(clk_lock); | 108 | static DEFINE_SPINLOCK(clk_lock); |
@@ -210,10 +218,26 @@ struct clk mck = { | |||
210 | 218 | ||
211 | static void pmc_periph_mode(struct clk *clk, int is_on) | 219 | static void pmc_periph_mode(struct clk *clk, int is_on) |
212 | { | 220 | { |
213 | if (is_on) | 221 | u32 regval = 0; |
214 | at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask); | 222 | |
215 | else | 223 | /* |
216 | at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask); | 224 | * With sama5d3 devices, we are managing clock division so we have to |
225 | * use the Peripheral Control Register introduced from at91sam9x5 | ||
226 | * devices. | ||
227 | */ | ||
228 | if (cpu_is_sama5d3()) { | ||
229 | regval |= AT91_PMC_PCR_CMD; /* write command */ | ||
230 | regval |= clk->pid & AT91_PMC_PCR_PID; /* peripheral selection */ | ||
231 | regval |= AT91_PMC_PCR_DIV(clk->div); | ||
232 | if (is_on) | ||
233 | regval |= AT91_PMC_PCR_EN; /* enable clock */ | ||
234 | at91_pmc_write(AT91_PMC_PCR, regval); | ||
235 | } else { | ||
236 | if (is_on) | ||
237 | at91_pmc_write(AT91_PMC_PCER, clk->pmc_mask); | ||
238 | else | ||
239 | at91_pmc_write(AT91_PMC_PCDR, clk->pmc_mask); | ||
240 | } | ||
217 | } | 241 | } |
218 | 242 | ||
219 | static struct clk __init *at91_css_to_clk(unsigned long css) | 243 | static struct clk __init *at91_css_to_clk(unsigned long css) |
@@ -443,14 +467,18 @@ static void __init init_programmable_clock(struct clk *clk) | |||
443 | 467 | ||
444 | static int at91_clk_show(struct seq_file *s, void *unused) | 468 | static int at91_clk_show(struct seq_file *s, void *unused) |
445 | { | 469 | { |
446 | u32 scsr, pcsr, uckr = 0, sr; | 470 | u32 scsr, pcsr, pcsr1 = 0, uckr = 0, sr; |
447 | struct clk *clk; | 471 | struct clk *clk; |
448 | 472 | ||
449 | scsr = at91_pmc_read(AT91_PMC_SCSR); | 473 | scsr = at91_pmc_read(AT91_PMC_SCSR); |
450 | pcsr = at91_pmc_read(AT91_PMC_PCSR); | 474 | pcsr = at91_pmc_read(AT91_PMC_PCSR); |
475 | if (cpu_is_sama5d3()) | ||
476 | pcsr1 = at91_pmc_read(AT91_PMC_PCSR1); | ||
451 | sr = at91_pmc_read(AT91_PMC_SR); | 477 | sr = at91_pmc_read(AT91_PMC_SR); |
452 | seq_printf(s, "SCSR = %8x\n", scsr); | 478 | seq_printf(s, "SCSR = %8x\n", scsr); |
453 | seq_printf(s, "PCSR = %8x\n", pcsr); | 479 | seq_printf(s, "PCSR = %8x\n", pcsr); |
480 | if (cpu_is_sama5d3()) | ||
481 | seq_printf(s, "PCSR1 = %8x\n", pcsr1); | ||
454 | seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR)); | 482 | seq_printf(s, "MOR = %8x\n", at91_pmc_read(AT91_CKGR_MOR)); |
455 | seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR)); | 483 | seq_printf(s, "MCFR = %8x\n", at91_pmc_read(AT91_CKGR_MCFR)); |
456 | seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR)); | 484 | seq_printf(s, "PLLA = %8x\n", at91_pmc_read(AT91_CKGR_PLLAR)); |
@@ -470,20 +498,30 @@ static int at91_clk_show(struct seq_file *s, void *unused) | |||
470 | list_for_each_entry(clk, &clocks, node) { | 498 | list_for_each_entry(clk, &clocks, node) { |
471 | char *state; | 499 | char *state; |
472 | 500 | ||
473 | if (clk->mode == pmc_sys_mode) | 501 | if (clk->mode == pmc_sys_mode) { |
474 | state = (scsr & clk->pmc_mask) ? "on" : "off"; | 502 | state = (scsr & clk->pmc_mask) ? "on" : "off"; |
475 | else if (clk->mode == pmc_periph_mode) | 503 | } else if (clk->mode == pmc_periph_mode) { |
476 | state = (pcsr & clk->pmc_mask) ? "on" : "off"; | 504 | if (cpu_is_sama5d3()) { |
477 | else if (clk->mode == pmc_uckr_mode) | 505 | u32 pmc_mask = 1 << (clk->pid % 32); |
506 | |||
507 | if (clk->pid > 31) | ||
508 | state = (pcsr1 & pmc_mask) ? "on" : "off"; | ||
509 | else | ||
510 | state = (pcsr & pmc_mask) ? "on" : "off"; | ||
511 | } else { | ||
512 | state = (pcsr & clk->pmc_mask) ? "on" : "off"; | ||
513 | } | ||
514 | } else if (clk->mode == pmc_uckr_mode) { | ||
478 | state = (uckr & clk->pmc_mask) ? "on" : "off"; | 515 | state = (uckr & clk->pmc_mask) ? "on" : "off"; |
479 | else if (clk->pmc_mask) | 516 | } else if (clk->pmc_mask) { |
480 | state = (sr & clk->pmc_mask) ? "on" : "off"; | 517 | state = (sr & clk->pmc_mask) ? "on" : "off"; |
481 | else if (clk == &clk32k || clk == &main_clk) | 518 | } else if (clk == &clk32k || clk == &main_clk) { |
482 | state = "on"; | 519 | state = "on"; |
483 | else | 520 | } else { |
484 | state = ""; | 521 | state = ""; |
522 | } | ||
485 | 523 | ||
486 | seq_printf(s, "%-10s users=%2d %-3s %9ld Hz %s\n", | 524 | seq_printf(s, "%-10s users=%2d %-3s %9lu Hz %s\n", |
487 | clk->name, clk->users, state, clk_get_rate(clk), | 525 | clk->name, clk->users, state, clk_get_rate(clk), |
488 | clk->parent ? clk->parent->name : ""); | 526 | clk->parent ? clk->parent->name : ""); |
489 | } | 527 | } |
@@ -530,6 +568,9 @@ int __init clk_register(struct clk *clk) | |||
530 | if (clk_is_peripheral(clk)) { | 568 | if (clk_is_peripheral(clk)) { |
531 | if (!clk->parent) | 569 | if (!clk->parent) |
532 | clk->parent = &mck; | 570 | clk->parent = &mck; |
571 | if (cpu_is_sama5d3()) | ||
572 | clk->rate_hz = DIV_ROUND_UP(clk->parent->rate_hz, | ||
573 | 1 << clk->div); | ||
533 | clk->mode = pmc_periph_mode; | 574 | clk->mode = pmc_periph_mode; |
534 | } | 575 | } |
535 | else if (clk_is_sys(clk)) { | 576 | else if (clk_is_sys(clk)) { |
@@ -555,7 +596,11 @@ static u32 __init at91_pll_rate(struct clk *pll, u32 freq, u32 reg) | |||
555 | unsigned mul, div; | 596 | unsigned mul, div; |
556 | 597 | ||
557 | div = reg & 0xff; | 598 | div = reg & 0xff; |
558 | mul = (reg >> 16) & 0x7ff; | 599 | if (cpu_is_sama5d3()) |
600 | mul = AT91_PMC3_MUL_GET(reg); | ||
601 | else | ||
602 | mul = AT91_PMC_MUL_GET(reg); | ||
603 | |||
559 | if (div && mul) { | 604 | if (div && mul) { |
560 | freq /= div; | 605 | freq /= div; |
561 | freq *= mul + 1; | 606 | freq *= mul + 1; |
@@ -706,12 +751,15 @@ static int __init at91_pmc_init(unsigned long main_clock) | |||
706 | 751 | ||
707 | /* report if PLLA is more than mildly overclocked */ | 752 | /* report if PLLA is more than mildly overclocked */ |
708 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR)); | 753 | plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_pmc_read(AT91_CKGR_PLLAR)); |
709 | if (cpu_has_300M_plla()) { | 754 | if (cpu_has_1056M_plla()) { |
710 | if (plla.rate_hz > 300000000) | 755 | if (plla.rate_hz > 1056000000) |
711 | pll_overclock = true; | 756 | pll_overclock = true; |
712 | } else if (cpu_has_800M_plla()) { | 757 | } else if (cpu_has_800M_plla()) { |
713 | if (plla.rate_hz > 800000000) | 758 | if (plla.rate_hz > 800000000) |
714 | pll_overclock = true; | 759 | pll_overclock = true; |
760 | } else if (cpu_has_300M_plla()) { | ||
761 | if (plla.rate_hz > 300000000) | ||
762 | pll_overclock = true; | ||
715 | } else if (cpu_has_240M_plla()) { | 763 | } else if (cpu_has_240M_plla()) { |
716 | if (plla.rate_hz > 240000000) | 764 | if (plla.rate_hz > 240000000) |
717 | pll_overclock = true; | 765 | pll_overclock = true; |
@@ -872,6 +920,7 @@ int __init at91_clock_init(unsigned long main_clock) | |||
872 | static int __init at91_clock_reset(void) | 920 | static int __init at91_clock_reset(void) |
873 | { | 921 | { |
874 | unsigned long pcdr = 0; | 922 | unsigned long pcdr = 0; |
923 | unsigned long pcdr1 = 0; | ||
875 | unsigned long scdr = 0; | 924 | unsigned long scdr = 0; |
876 | struct clk *clk; | 925 | struct clk *clk; |
877 | 926 | ||
@@ -879,8 +928,17 @@ static int __init at91_clock_reset(void) | |||
879 | if (clk->users > 0) | 928 | if (clk->users > 0) |
880 | continue; | 929 | continue; |
881 | 930 | ||
882 | if (clk->mode == pmc_periph_mode) | 931 | if (clk->mode == pmc_periph_mode) { |
883 | pcdr |= clk->pmc_mask; | 932 | if (cpu_is_sama5d3()) { |
933 | u32 pmc_mask = 1 << (clk->pid % 32); | ||
934 | |||
935 | if (clk->pid > 31) | ||
936 | pcdr1 |= pmc_mask; | ||
937 | else | ||
938 | pcdr |= pmc_mask; | ||
939 | } else | ||
940 | pcdr |= clk->pmc_mask; | ||
941 | } | ||
884 | 942 | ||
885 | if (clk->mode == pmc_sys_mode) | 943 | if (clk->mode == pmc_sys_mode) |
886 | scdr |= clk->pmc_mask; | 944 | scdr |= clk->pmc_mask; |
@@ -888,8 +946,9 @@ static int __init at91_clock_reset(void) | |||
888 | pr_debug("Clocks: disable unused %s\n", clk->name); | 946 | pr_debug("Clocks: disable unused %s\n", clk->name); |
889 | } | 947 | } |
890 | 948 | ||
891 | at91_pmc_write(AT91_PMC_PCDR, pcdr); | ||
892 | at91_pmc_write(AT91_PMC_SCDR, scdr); | 949 | at91_pmc_write(AT91_PMC_SCDR, scdr); |
950 | if (cpu_is_sama5d3()) | ||
951 | at91_pmc_write(AT91_PMC_PCDR1, pcdr1); | ||
893 | 952 | ||
894 | return 0; | 953 | return 0; |
895 | } | 954 | } |
diff --git a/arch/arm/mach-at91/clock.h b/arch/arm/mach-at91/clock.h index c2e63e47dcbe..a98a39bbd883 100644 --- a/arch/arm/mach-at91/clock.h +++ b/arch/arm/mach-at91/clock.h | |||
@@ -20,7 +20,9 @@ struct clk { | |||
20 | const char *name; /* unique clock name */ | 20 | const char *name; /* unique clock name */ |
21 | struct clk_lookup cl; | 21 | struct clk_lookup cl; |
22 | unsigned long rate_hz; | 22 | unsigned long rate_hz; |
23 | unsigned div; /* parent clock divider */ | ||
23 | struct clk *parent; | 24 | struct clk *parent; |
25 | unsigned pid; /* peripheral ID */ | ||
24 | u32 pmc_mask; | 26 | u32 pmc_mask; |
25 | void (*mode)(struct clk *, int); | 27 | void (*mode)(struct clk *, int); |
26 | unsigned id:3; /* PCK0..4, or 32k/main/a/b */ | 28 | unsigned id:3; /* PCK0..4, or 32k/main/a/b */ |
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c index 0c6381516a5a..4c6794603780 100644 --- a/arch/arm/mach-at91/cpuidle.c +++ b/arch/arm/mach-at91/cpuidle.c | |||
@@ -38,6 +38,8 @@ static int at91_enter_idle(struct cpuidle_device *dev, | |||
38 | at91rm9200_standby(); | 38 | at91rm9200_standby(); |
39 | else if (cpu_is_at91sam9g45()) | 39 | else if (cpu_is_at91sam9g45()) |
40 | at91sam9g45_standby(); | 40 | at91sam9g45_standby(); |
41 | else if (cpu_is_at91sam9263()) | ||
42 | at91sam9263_standby(); | ||
41 | else | 43 | else |
42 | at91sam9_standby(); | 44 | at91sam9_standby(); |
43 | 45 | ||
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h index ea2c57a86ca6..31df12029c4e 100644 --- a/arch/arm/mach-at91/include/mach/at91_pmc.h +++ b/arch/arm/mach-at91/include/mach/at91_pmc.h | |||
@@ -75,6 +75,9 @@ extern void __iomem *at91_pmc_base; | |||
75 | #define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ | 75 | #define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */ |
76 | #define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ | 76 | #define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */ |
77 | #define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */ | 77 | #define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */ |
78 | #define AT91_PMC_MUL_GET(n) ((n) >> 16 & 0x7ff) | ||
79 | #define AT91_PMC3_MUL (0x7f << 18) /* PLL Multiplier [SAMA5 only] */ | ||
80 | #define AT91_PMC3_MUL_GET(n) ((n) >> 18 & 0x7f) | ||
78 | #define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */ | 81 | #define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */ |
79 | #define AT91_PMC_USBDIV_1 (0 << 28) | 82 | #define AT91_PMC_USBDIV_1 (0 << 28) |
80 | #define AT91_PMC_USBDIV_2 (1 << 28) | 83 | #define AT91_PMC_USBDIV_2 (1 << 28) |
@@ -167,11 +170,18 @@ extern void __iomem *at91_pmc_base; | |||
167 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ | 170 | #define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */ |
168 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ | 171 | #define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */ |
169 | 172 | ||
170 | #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9] */ | 173 | #define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/ |
174 | #define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */ | ||
175 | #define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */ | ||
176 | |||
177 | #define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */ | ||
171 | #define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ | 178 | #define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */ |
172 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command */ | 179 | #define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */ |
173 | #define AT91_PMC_PCR_DIV (0x3 << 16) /* Divisor Value */ | 180 | #define AT91_PMC_PCR_DIV(n) ((n) << 16) /* Divisor Value */ |
174 | #define AT91_PMC_PCRDIV(n) (((n) << 16) & AT91_PMC_PCR_DIV) | 181 | #define AT91_PMC_PCR_DIV0 0x0 /* Peripheral clock is MCK */ |
182 | #define AT91_PMC_PCR_DIV2 0x2 /* Peripheral clock is MCK/2 */ | ||
183 | #define AT91_PMC_PCR_DIV4 0x4 /* Peripheral clock is MCK/4 */ | ||
184 | #define AT91_PMC_PCR_DIV8 0x8 /* Peripheral clock is MCK/8 */ | ||
175 | #define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ | 185 | #define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */ |
176 | 186 | ||
177 | #endif | 187 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h index b6504c19d55c..d3d7b993846b 100644 --- a/arch/arm/mach-at91/include/mach/cpu.h +++ b/arch/arm/mach-at91/include/mach/cpu.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #define ARCH_ID_AT91M40807 0x14080745 | 36 | #define ARCH_ID_AT91M40807 0x14080745 |
37 | #define ARCH_ID_AT91R40008 0x44000840 | 37 | #define ARCH_ID_AT91R40008 0x44000840 |
38 | 38 | ||
39 | #define ARCH_ID_SAMA5D3 0x8A5C07C0 | ||
40 | |||
39 | #define ARCH_EXID_AT91SAM9M11 0x00000001 | 41 | #define ARCH_EXID_AT91SAM9M11 0x00000001 |
40 | #define ARCH_EXID_AT91SAM9M10 0x00000002 | 42 | #define ARCH_EXID_AT91SAM9M10 0x00000002 |
41 | #define ARCH_EXID_AT91SAM9G46 0x00000003 | 43 | #define ARCH_EXID_AT91SAM9G46 0x00000003 |
@@ -47,6 +49,11 @@ | |||
47 | #define ARCH_EXID_AT91SAM9G25 0x00000003 | 49 | #define ARCH_EXID_AT91SAM9G25 0x00000003 |
48 | #define ARCH_EXID_AT91SAM9X25 0x00000004 | 50 | #define ARCH_EXID_AT91SAM9X25 0x00000004 |
49 | 51 | ||
52 | #define ARCH_EXID_SAMA5D31 0x00444300 | ||
53 | #define ARCH_EXID_SAMA5D33 0x00414300 | ||
54 | #define ARCH_EXID_SAMA5D34 0x00414301 | ||
55 | #define ARCH_EXID_SAMA5D35 0x00584300 | ||
56 | |||
50 | #define ARCH_FAMILY_AT91X92 0x09200000 | 57 | #define ARCH_FAMILY_AT91X92 0x09200000 |
51 | #define ARCH_FAMILY_AT91SAM9 0x01900000 | 58 | #define ARCH_FAMILY_AT91SAM9 0x01900000 |
52 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 | 59 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 |
@@ -75,8 +82,11 @@ enum at91_soc_type { | |||
75 | /* SAM9N12 */ | 82 | /* SAM9N12 */ |
76 | AT91_SOC_SAM9N12, | 83 | AT91_SOC_SAM9N12, |
77 | 84 | ||
85 | /* SAMA5D3 */ | ||
86 | AT91_SOC_SAMA5D3, | ||
87 | |||
78 | /* Unknown type */ | 88 | /* Unknown type */ |
79 | AT91_SOC_NONE | 89 | AT91_SOC_UNKNOWN, |
80 | }; | 90 | }; |
81 | 91 | ||
82 | enum at91_soc_subtype { | 92 | enum at91_soc_subtype { |
@@ -93,8 +103,15 @@ enum at91_soc_subtype { | |||
93 | AT91_SOC_SAM9G15, AT91_SOC_SAM9G35, AT91_SOC_SAM9X35, | 103 | AT91_SOC_SAM9G15, AT91_SOC_SAM9G35, AT91_SOC_SAM9X35, |
94 | AT91_SOC_SAM9G25, AT91_SOC_SAM9X25, | 104 | AT91_SOC_SAM9G25, AT91_SOC_SAM9X25, |
95 | 105 | ||
106 | /* SAMA5D3 */ | ||
107 | AT91_SOC_SAMA5D31, AT91_SOC_SAMA5D33, AT91_SOC_SAMA5D34, | ||
108 | AT91_SOC_SAMA5D35, | ||
109 | |||
110 | /* No subtype for this SoC */ | ||
111 | AT91_SOC_SUBTYPE_NONE, | ||
112 | |||
96 | /* Unknown subtype */ | 113 | /* Unknown subtype */ |
97 | AT91_SOC_SUBTYPE_NONE | 114 | AT91_SOC_SUBTYPE_UNKNOWN, |
98 | }; | 115 | }; |
99 | 116 | ||
100 | struct at91_socinfo { | 117 | struct at91_socinfo { |
@@ -108,7 +125,7 @@ const char *at91_get_soc_subtype(struct at91_socinfo *c); | |||
108 | 125 | ||
109 | static inline int at91_soc_is_detected(void) | 126 | static inline int at91_soc_is_detected(void) |
110 | { | 127 | { |
111 | return at91_soc_initdata.type != AT91_SOC_NONE; | 128 | return at91_soc_initdata.type != AT91_SOC_UNKNOWN; |
112 | } | 129 | } |
113 | 130 | ||
114 | #ifdef CONFIG_SOC_AT91RM9200 | 131 | #ifdef CONFIG_SOC_AT91RM9200 |
@@ -187,6 +204,12 @@ static inline int at91_soc_is_detected(void) | |||
187 | #define cpu_is_at91sam9n12() (0) | 204 | #define cpu_is_at91sam9n12() (0) |
188 | #endif | 205 | #endif |
189 | 206 | ||
207 | #ifdef CONFIG_SOC_SAMA5D3 | ||
208 | #define cpu_is_sama5d3() (at91_soc_initdata.type == AT91_SOC_SAMA5D3) | ||
209 | #else | ||
210 | #define cpu_is_sama5d3() (0) | ||
211 | #endif | ||
212 | |||
190 | /* | 213 | /* |
191 | * Since this is ARM, we will never run on any AVR32 CPU. But these | 214 | * Since this is ARM, we will never run on any AVR32 CPU. But these |
192 | * definitions may reduce clutter in common drivers. | 215 | * definitions may reduce clutter in common drivers. |
diff --git a/arch/arm/mach-at91/include/mach/sama5d3.h b/arch/arm/mach-at91/include/mach/sama5d3.h new file mode 100644 index 000000000000..6dc81ee38048 --- /dev/null +++ b/arch/arm/mach-at91/include/mach/sama5d3.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * Chip-specific header file for the SAMA5D3 family | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Common definitions. | ||
8 | * Based on SAMA5D3 datasheet. | ||
9 | * | ||
10 | * Licensed under GPLv2 or later. | ||
11 | */ | ||
12 | |||
13 | #ifndef SAMA5D3_H | ||
14 | #define SAMA5D3_H | ||
15 | |||
16 | /* | ||
17 | * Peripheral identifiers/interrupts. | ||
18 | */ | ||
19 | #define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ | ||
20 | #define AT91_ID_SYS 1 /* System Peripherals */ | ||
21 | #define SAMA5D3_ID_DBGU 2 /* debug Unit (usually no special interrupt line) */ | ||
22 | #define AT91_ID_PIT 3 /* PIT */ | ||
23 | #define SAMA5D3_ID_WDT 4 /* Watchdog Timer Interrupt */ | ||
24 | #define SAMA5D3_ID_HSMC 5 /* Static Memory Controller */ | ||
25 | #define SAMA5D3_ID_PIOA 6 /* PIOA */ | ||
26 | #define SAMA5D3_ID_PIOB 7 /* PIOB */ | ||
27 | #define SAMA5D3_ID_PIOC 8 /* PIOC */ | ||
28 | #define SAMA5D3_ID_PIOD 9 /* PIOD */ | ||
29 | #define SAMA5D3_ID_PIOE 10 /* PIOE */ | ||
30 | #define SAMA5D3_ID_SMD 11 /* SMD Soft Modem */ | ||
31 | #define SAMA5D3_ID_USART0 12 /* USART0 */ | ||
32 | #define SAMA5D3_ID_USART1 13 /* USART1 */ | ||
33 | #define SAMA5D3_ID_USART2 14 /* USART2 */ | ||
34 | #define SAMA5D3_ID_USART3 15 /* USART3 */ | ||
35 | #define SAMA5D3_ID_UART0 16 /* UART 0 */ | ||
36 | #define SAMA5D3_ID_UART1 17 /* UART 1 */ | ||
37 | #define SAMA5D3_ID_TWI0 18 /* Two-Wire Interface 0 */ | ||
38 | #define SAMA5D3_ID_TWI1 19 /* Two-Wire Interface 1 */ | ||
39 | #define SAMA5D3_ID_TWI2 20 /* Two-Wire Interface 2 */ | ||
40 | #define SAMA5D3_ID_HSMCI0 21 /* MCI */ | ||
41 | #define SAMA5D3_ID_HSMCI1 22 /* MCI */ | ||
42 | #define SAMA5D3_ID_HSMCI2 23 /* MCI */ | ||
43 | #define SAMA5D3_ID_SPI0 24 /* Serial Peripheral Interface 0 */ | ||
44 | #define SAMA5D3_ID_SPI1 25 /* Serial Peripheral Interface 1 */ | ||
45 | #define SAMA5D3_ID_TC0 26 /* Timer Counter 0 */ | ||
46 | #define SAMA5D3_ID_TC1 27 /* Timer Counter 2 */ | ||
47 | #define SAMA5D3_ID_PWM 28 /* Pulse Width Modulation Controller */ | ||
48 | #define SAMA5D3_ID_ADC 29 /* Touch Screen ADC Controller */ | ||
49 | #define SAMA5D3_ID_DMA0 30 /* DMA Controller 0 */ | ||
50 | #define SAMA5D3_ID_DMA1 31 /* DMA Controller 1 */ | ||
51 | #define SAMA5D3_ID_UHPHS 32 /* USB Host High Speed */ | ||
52 | #define SAMA5D3_ID_UDPHS 33 /* USB Device High Speed */ | ||
53 | #define SAMA5D3_ID_GMAC 34 /* Gigabit Ethernet MAC */ | ||
54 | #define SAMA5D3_ID_EMAC 35 /* Ethernet MAC */ | ||
55 | #define SAMA5D3_ID_LCDC 36 /* LCD Controller */ | ||
56 | #define SAMA5D3_ID_ISI 37 /* Image Sensor Interface */ | ||
57 | #define SAMA5D3_ID_SSC0 38 /* Synchronous Serial Controller 0 */ | ||
58 | #define SAMA5D3_ID_SSC1 39 /* Synchronous Serial Controller 1 */ | ||
59 | #define SAMA5D3_ID_CAN0 40 /* CAN Controller 0 */ | ||
60 | #define SAMA5D3_ID_CAN1 41 /* CAN Controller 1 */ | ||
61 | #define SAMA5D3_ID_SHA 42 /* Secure Hash Algorithm */ | ||
62 | #define SAMA5D3_ID_AES 43 /* Advanced Encryption Standard */ | ||
63 | #define SAMA5D3_ID_TDES 44 /* Triple Data Encryption Standard */ | ||
64 | #define SAMA5D3_ID_TRNG 45 /* True Random Generator Number */ | ||
65 | #define SAMA5D3_ID_IRQ0 47 /* Advanced Interrupt Controller (IRQ0) */ | ||
66 | |||
67 | /* | ||
68 | * Internal Memory | ||
69 | */ | ||
70 | #define SAMA5D3_SRAM_BASE 0x00300000 /* Internal SRAM base address */ | ||
71 | #define SAMA5D3_SRAM_SIZE (128 * SZ_1K) /* Internal SRAM size (128Kb) */ | ||
72 | |||
73 | #endif | ||
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 73f1f250403a..530db304ec5e 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -270,6 +270,8 @@ static int at91_pm_enter(suspend_state_t state) | |||
270 | at91rm9200_standby(); | 270 | at91rm9200_standby(); |
271 | else if (cpu_is_at91sam9g45()) | 271 | else if (cpu_is_at91sam9g45()) |
272 | at91sam9g45_standby(); | 272 | at91sam9g45_standby(); |
273 | else if (cpu_is_at91sam9263()) | ||
274 | at91sam9263_standby(); | ||
273 | else | 275 | else |
274 | at91sam9_standby(); | 276 | at91sam9_standby(); |
275 | break; | 277 | break; |
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h index 38f467c6b710..2f5908f0b8c5 100644 --- a/arch/arm/mach-at91/pm.h +++ b/arch/arm/mach-at91/pm.h | |||
@@ -70,13 +70,31 @@ static inline void at91sam9g45_standby(void) | |||
70 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); | 70 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); |
71 | } | 71 | } |
72 | 72 | ||
73 | #ifdef CONFIG_SOC_AT91SAM9263 | 73 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to |
74 | /* | 74 | * remember. |
75 | * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; | ||
76 | * handle those cases both here and in the Suspend-To-RAM support. | ||
77 | */ | 75 | */ |
78 | #warning Assuming EB1 SDRAM controller is *NOT* used | 76 | static inline void at91sam9263_standby(void) |
79 | #endif | 77 | { |
78 | u32 lpr0, lpr1; | ||
79 | u32 saved_lpr0, saved_lpr1; | ||
80 | |||
81 | saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); | ||
82 | lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; | ||
83 | lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
84 | |||
85 | saved_lpr0 = at91_ramc_read(0, AT91_SDRAMC_LPR); | ||
86 | lpr0 = saved_lpr0 & ~AT91_SDRAMC_LPCB; | ||
87 | lpr0 |= AT91_SDRAMC_LPCB_SELF_REFRESH; | ||
88 | |||
89 | /* self-refresh mode now */ | ||
90 | at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); | ||
91 | at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); | ||
92 | |||
93 | cpu_do_idle(); | ||
94 | |||
95 | at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); | ||
96 | at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); | ||
97 | } | ||
80 | 98 | ||
81 | static inline void at91sam9_standby(void) | 99 | static inline void at91sam9_standby(void) |
82 | { | 100 | { |
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c new file mode 100644 index 000000000000..401279715ab1 --- /dev/null +++ b/arch/arm/mach-at91/sama5d3.c | |||
@@ -0,0 +1,377 @@ | |||
1 | /* | ||
2 | * Chip-specific setup code for the SAMA5D3 family | ||
3 | * | ||
4 | * Copyright (C) 2013 Atmel, | ||
5 | * 2013 Ludovic Desroches <ludovic.desroches@atmel.com> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later. | ||
8 | */ | ||
9 | |||
10 | #include <linux/module.h> | ||
11 | #include <linux/dma-mapping.h> | ||
12 | |||
13 | #include <asm/irq.h> | ||
14 | #include <asm/mach/arch.h> | ||
15 | #include <asm/mach/map.h> | ||
16 | #include <mach/sama5d3.h> | ||
17 | #include <mach/at91_pmc.h> | ||
18 | #include <mach/cpu.h> | ||
19 | |||
20 | #include "soc.h" | ||
21 | #include "generic.h" | ||
22 | #include "clock.h" | ||
23 | #include "sam9_smc.h" | ||
24 | |||
25 | /* -------------------------------------------------------------------- | ||
26 | * Clocks | ||
27 | * -------------------------------------------------------------------- */ | ||
28 | |||
29 | /* | ||
30 | * The peripheral clocks. | ||
31 | */ | ||
32 | |||
33 | static struct clk pioA_clk = { | ||
34 | .name = "pioA_clk", | ||
35 | .pid = SAMA5D3_ID_PIOA, | ||
36 | .type = CLK_TYPE_PERIPHERAL, | ||
37 | }; | ||
38 | static struct clk pioB_clk = { | ||
39 | .name = "pioB_clk", | ||
40 | .pid = SAMA5D3_ID_PIOB, | ||
41 | .type = CLK_TYPE_PERIPHERAL, | ||
42 | }; | ||
43 | static struct clk pioC_clk = { | ||
44 | .name = "pioC_clk", | ||
45 | .pid = SAMA5D3_ID_PIOC, | ||
46 | .type = CLK_TYPE_PERIPHERAL, | ||
47 | }; | ||
48 | static struct clk pioD_clk = { | ||
49 | .name = "pioD_clk", | ||
50 | .pid = SAMA5D3_ID_PIOD, | ||
51 | .type = CLK_TYPE_PERIPHERAL, | ||
52 | }; | ||
53 | static struct clk pioE_clk = { | ||
54 | .name = "pioE_clk", | ||
55 | .pid = SAMA5D3_ID_PIOE, | ||
56 | .type = CLK_TYPE_PERIPHERAL, | ||
57 | }; | ||
58 | static struct clk usart0_clk = { | ||
59 | .name = "usart0_clk", | ||
60 | .pid = SAMA5D3_ID_USART0, | ||
61 | .type = CLK_TYPE_PERIPHERAL, | ||
62 | .div = AT91_PMC_PCR_DIV2, | ||
63 | }; | ||
64 | static struct clk usart1_clk = { | ||
65 | .name = "usart1_clk", | ||
66 | .pid = SAMA5D3_ID_USART1, | ||
67 | .type = CLK_TYPE_PERIPHERAL, | ||
68 | .div = AT91_PMC_PCR_DIV2, | ||
69 | }; | ||
70 | static struct clk usart2_clk = { | ||
71 | .name = "usart2_clk", | ||
72 | .pid = SAMA5D3_ID_USART2, | ||
73 | .type = CLK_TYPE_PERIPHERAL, | ||
74 | .div = AT91_PMC_PCR_DIV2, | ||
75 | }; | ||
76 | static struct clk usart3_clk = { | ||
77 | .name = "usart3_clk", | ||
78 | .pid = SAMA5D3_ID_USART3, | ||
79 | .type = CLK_TYPE_PERIPHERAL, | ||
80 | .div = AT91_PMC_PCR_DIV2, | ||
81 | }; | ||
82 | static struct clk uart0_clk = { | ||
83 | .name = "uart0_clk", | ||
84 | .pid = SAMA5D3_ID_UART0, | ||
85 | .type = CLK_TYPE_PERIPHERAL, | ||
86 | .div = AT91_PMC_PCR_DIV2, | ||
87 | }; | ||
88 | static struct clk uart1_clk = { | ||
89 | .name = "uart1_clk", | ||
90 | .pid = SAMA5D3_ID_UART1, | ||
91 | .type = CLK_TYPE_PERIPHERAL, | ||
92 | .div = AT91_PMC_PCR_DIV2, | ||
93 | }; | ||
94 | static struct clk twi0_clk = { | ||
95 | .name = "twi0_clk", | ||
96 | .pid = SAMA5D3_ID_TWI0, | ||
97 | .type = CLK_TYPE_PERIPHERAL, | ||
98 | .div = AT91_PMC_PCR_DIV2, | ||
99 | }; | ||
100 | static struct clk twi1_clk = { | ||
101 | .name = "twi1_clk", | ||
102 | .pid = SAMA5D3_ID_TWI1, | ||
103 | .type = CLK_TYPE_PERIPHERAL, | ||
104 | .div = AT91_PMC_PCR_DIV2, | ||
105 | }; | ||
106 | static struct clk twi2_clk = { | ||
107 | .name = "twi2_clk", | ||
108 | .pid = SAMA5D3_ID_TWI2, | ||
109 | .type = CLK_TYPE_PERIPHERAL, | ||
110 | .div = AT91_PMC_PCR_DIV2, | ||
111 | }; | ||
112 | static struct clk mmc0_clk = { | ||
113 | .name = "mci0_clk", | ||
114 | .pid = SAMA5D3_ID_HSMCI0, | ||
115 | .type = CLK_TYPE_PERIPHERAL, | ||
116 | }; | ||
117 | static struct clk mmc1_clk = { | ||
118 | .name = "mci1_clk", | ||
119 | .pid = SAMA5D3_ID_HSMCI1, | ||
120 | .type = CLK_TYPE_PERIPHERAL, | ||
121 | }; | ||
122 | static struct clk mmc2_clk = { | ||
123 | .name = "mci2_clk", | ||
124 | .pid = SAMA5D3_ID_HSMCI2, | ||
125 | .type = CLK_TYPE_PERIPHERAL, | ||
126 | }; | ||
127 | static struct clk spi0_clk = { | ||
128 | .name = "spi0_clk", | ||
129 | .pid = SAMA5D3_ID_SPI0, | ||
130 | .type = CLK_TYPE_PERIPHERAL, | ||
131 | }; | ||
132 | static struct clk spi1_clk = { | ||
133 | .name = "spi1_clk", | ||
134 | .pid = SAMA5D3_ID_SPI1, | ||
135 | .type = CLK_TYPE_PERIPHERAL, | ||
136 | }; | ||
137 | static struct clk tcb0_clk = { | ||
138 | .name = "tcb0_clk", | ||
139 | .pid = SAMA5D3_ID_TC0, | ||
140 | .type = CLK_TYPE_PERIPHERAL, | ||
141 | .div = AT91_PMC_PCR_DIV2, | ||
142 | }; | ||
143 | static struct clk tcb1_clk = { | ||
144 | .name = "tcb1_clk", | ||
145 | .pid = SAMA5D3_ID_TC1, | ||
146 | .type = CLK_TYPE_PERIPHERAL, | ||
147 | .div = AT91_PMC_PCR_DIV2, | ||
148 | }; | ||
149 | static struct clk adc_clk = { | ||
150 | .name = "adc_clk", | ||
151 | .pid = SAMA5D3_ID_ADC, | ||
152 | .type = CLK_TYPE_PERIPHERAL, | ||
153 | .div = AT91_PMC_PCR_DIV2, | ||
154 | }; | ||
155 | static struct clk adc_op_clk = { | ||
156 | .name = "adc_op_clk", | ||
157 | .type = CLK_TYPE_PERIPHERAL, | ||
158 | .rate_hz = 5000000, | ||
159 | }; | ||
160 | static struct clk dma0_clk = { | ||
161 | .name = "dma0_clk", | ||
162 | .pid = SAMA5D3_ID_DMA0, | ||
163 | .type = CLK_TYPE_PERIPHERAL, | ||
164 | }; | ||
165 | static struct clk dma1_clk = { | ||
166 | .name = "dma1_clk", | ||
167 | .pid = SAMA5D3_ID_DMA1, | ||
168 | .type = CLK_TYPE_PERIPHERAL, | ||
169 | }; | ||
170 | static struct clk uhphs_clk = { | ||
171 | .name = "uhphs", | ||
172 | .pid = SAMA5D3_ID_UHPHS, | ||
173 | .type = CLK_TYPE_PERIPHERAL, | ||
174 | }; | ||
175 | static struct clk udphs_clk = { | ||
176 | .name = "udphs_clk", | ||
177 | .pid = SAMA5D3_ID_UDPHS, | ||
178 | .type = CLK_TYPE_PERIPHERAL, | ||
179 | }; | ||
180 | /* gmac only for sama5d33, sama5d34, sama5d35 */ | ||
181 | static struct clk macb0_clk = { | ||
182 | .name = "macb0_clk", | ||
183 | .pid = SAMA5D3_ID_GMAC, | ||
184 | .type = CLK_TYPE_PERIPHERAL, | ||
185 | }; | ||
186 | /* emac only for sama5d31, sama5d35 */ | ||
187 | static struct clk macb1_clk = { | ||
188 | .name = "macb1_clk", | ||
189 | .pid = SAMA5D3_ID_EMAC, | ||
190 | .type = CLK_TYPE_PERIPHERAL, | ||
191 | }; | ||
192 | /* lcd only for sama5d31, sama5d33, sama5d34 */ | ||
193 | static struct clk lcdc_clk = { | ||
194 | .name = "lcdc_clk", | ||
195 | .pid = SAMA5D3_ID_LCDC, | ||
196 | .type = CLK_TYPE_PERIPHERAL, | ||
197 | }; | ||
198 | /* isi only for sama5d33, sama5d35 */ | ||
199 | static struct clk isi_clk = { | ||
200 | .name = "isi_clk", | ||
201 | .pid = SAMA5D3_ID_ISI, | ||
202 | .type = CLK_TYPE_PERIPHERAL, | ||
203 | }; | ||
204 | static struct clk can0_clk = { | ||
205 | .name = "can0_clk", | ||
206 | .pid = SAMA5D3_ID_CAN0, | ||
207 | .type = CLK_TYPE_PERIPHERAL, | ||
208 | .div = AT91_PMC_PCR_DIV2, | ||
209 | }; | ||
210 | static struct clk can1_clk = { | ||
211 | .name = "can1_clk", | ||
212 | .pid = SAMA5D3_ID_CAN1, | ||
213 | .type = CLK_TYPE_PERIPHERAL, | ||
214 | .div = AT91_PMC_PCR_DIV2, | ||
215 | }; | ||
216 | static struct clk ssc0_clk = { | ||
217 | .name = "ssc0_clk", | ||
218 | .pid = SAMA5D3_ID_SSC0, | ||
219 | .type = CLK_TYPE_PERIPHERAL, | ||
220 | .div = AT91_PMC_PCR_DIV2, | ||
221 | }; | ||
222 | static struct clk ssc1_clk = { | ||
223 | .name = "ssc1_clk", | ||
224 | .pid = SAMA5D3_ID_SSC1, | ||
225 | .type = CLK_TYPE_PERIPHERAL, | ||
226 | .div = AT91_PMC_PCR_DIV2, | ||
227 | }; | ||
228 | static struct clk sha_clk = { | ||
229 | .name = "sha_clk", | ||
230 | .pid = SAMA5D3_ID_SHA, | ||
231 | .type = CLK_TYPE_PERIPHERAL, | ||
232 | .div = AT91_PMC_PCR_DIV8, | ||
233 | }; | ||
234 | static struct clk aes_clk = { | ||
235 | .name = "aes_clk", | ||
236 | .pid = SAMA5D3_ID_AES, | ||
237 | .type = CLK_TYPE_PERIPHERAL, | ||
238 | }; | ||
239 | static struct clk tdes_clk = { | ||
240 | .name = "tdes_clk", | ||
241 | .pid = SAMA5D3_ID_TDES, | ||
242 | .type = CLK_TYPE_PERIPHERAL, | ||
243 | }; | ||
244 | |||
245 | static struct clk *periph_clocks[] __initdata = { | ||
246 | &pioA_clk, | ||
247 | &pioB_clk, | ||
248 | &pioC_clk, | ||
249 | &pioD_clk, | ||
250 | &pioE_clk, | ||
251 | &usart0_clk, | ||
252 | &usart1_clk, | ||
253 | &usart2_clk, | ||
254 | &usart3_clk, | ||
255 | &uart0_clk, | ||
256 | &uart1_clk, | ||
257 | &twi0_clk, | ||
258 | &twi1_clk, | ||
259 | &twi2_clk, | ||
260 | &mmc0_clk, | ||
261 | &mmc1_clk, | ||
262 | &mmc2_clk, | ||
263 | &spi0_clk, | ||
264 | &spi1_clk, | ||
265 | &tcb0_clk, | ||
266 | &tcb1_clk, | ||
267 | &adc_clk, | ||
268 | &adc_op_clk, | ||
269 | &dma0_clk, | ||
270 | &dma1_clk, | ||
271 | &uhphs_clk, | ||
272 | &udphs_clk, | ||
273 | &macb0_clk, | ||
274 | &macb1_clk, | ||
275 | &lcdc_clk, | ||
276 | &isi_clk, | ||
277 | &can0_clk, | ||
278 | &can1_clk, | ||
279 | &ssc0_clk, | ||
280 | &ssc1_clk, | ||
281 | &sha_clk, | ||
282 | &aes_clk, | ||
283 | &tdes_clk, | ||
284 | }; | ||
285 | |||
286 | static struct clk pck0 = { | ||
287 | .name = "pck0", | ||
288 | .pmc_mask = AT91_PMC_PCK0, | ||
289 | .type = CLK_TYPE_PROGRAMMABLE, | ||
290 | .id = 0, | ||
291 | }; | ||
292 | |||
293 | static struct clk pck1 = { | ||
294 | .name = "pck1", | ||
295 | .pmc_mask = AT91_PMC_PCK1, | ||
296 | .type = CLK_TYPE_PROGRAMMABLE, | ||
297 | .id = 1, | ||
298 | }; | ||
299 | |||
300 | static struct clk pck2 = { | ||
301 | .name = "pck2", | ||
302 | .pmc_mask = AT91_PMC_PCK2, | ||
303 | .type = CLK_TYPE_PROGRAMMABLE, | ||
304 | .id = 2, | ||
305 | }; | ||
306 | |||
307 | static struct clk_lookup periph_clocks_lookups[] = { | ||
308 | /* lookup table for DT entries */ | ||
309 | CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), | ||
310 | CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk), | ||
311 | CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk), | ||
312 | CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk), | ||
313 | CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk), | ||
314 | CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk), | ||
315 | CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk), | ||
316 | CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk), | ||
317 | CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk), | ||
318 | CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk), | ||
319 | CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk), | ||
320 | CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk), | ||
321 | CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk), | ||
322 | CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk), | ||
323 | CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk), | ||
324 | CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk), | ||
325 | CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk), | ||
326 | CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk), | ||
327 | CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk), | ||
328 | CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk), | ||
329 | CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk), | ||
330 | CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk), | ||
331 | CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk), | ||
332 | CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk), | ||
333 | CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk), | ||
334 | CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk), | ||
335 | CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk), | ||
336 | CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk), | ||
337 | CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk), | ||
338 | CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk), | ||
339 | CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk), | ||
340 | CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk), | ||
341 | CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk), | ||
342 | CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk), | ||
343 | CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk), | ||
344 | CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk), | ||
345 | CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk), | ||
346 | CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk), | ||
347 | CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk), | ||
348 | }; | ||
349 | |||
350 | static void __init sama5d3_register_clocks(void) | ||
351 | { | ||
352 | int i; | ||
353 | |||
354 | for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) | ||
355 | clk_register(periph_clocks[i]); | ||
356 | |||
357 | clkdev_add_table(periph_clocks_lookups, | ||
358 | ARRAY_SIZE(periph_clocks_lookups)); | ||
359 | |||
360 | clk_register(&pck0); | ||
361 | clk_register(&pck1); | ||
362 | clk_register(&pck2); | ||
363 | } | ||
364 | |||
365 | /* -------------------------------------------------------------------- | ||
366 | * AT91SAM9x5 processor initialization | ||
367 | * -------------------------------------------------------------------- */ | ||
368 | |||
369 | static void __init sama5d3_map_io(void) | ||
370 | { | ||
371 | at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE); | ||
372 | } | ||
373 | |||
374 | AT91_SOC_START(sama5d3) | ||
375 | .map_io = sama5d3_map_io, | ||
376 | .register_clocks = sama5d3_register_clocks, | ||
377 | AT91_SOC_END | ||
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 4b678478cf95..fd00a09da86b 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -105,28 +105,32 @@ static void __init soc_detect(u32 dbgu_base) | |||
105 | switch (socid) { | 105 | switch (socid) { |
106 | case ARCH_ID_AT91RM9200: | 106 | case ARCH_ID_AT91RM9200: |
107 | at91_soc_initdata.type = AT91_SOC_RM9200; | 107 | at91_soc_initdata.type = AT91_SOC_RM9200; |
108 | if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_NONE) | 108 | if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_UNKNOWN) |
109 | at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; | 109 | at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; |
110 | at91_boot_soc = at91rm9200_soc; | 110 | at91_boot_soc = at91rm9200_soc; |
111 | break; | 111 | break; |
112 | 112 | ||
113 | case ARCH_ID_AT91SAM9260: | 113 | case ARCH_ID_AT91SAM9260: |
114 | at91_soc_initdata.type = AT91_SOC_SAM9260; | 114 | at91_soc_initdata.type = AT91_SOC_SAM9260; |
115 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
115 | at91_boot_soc = at91sam9260_soc; | 116 | at91_boot_soc = at91sam9260_soc; |
116 | break; | 117 | break; |
117 | 118 | ||
118 | case ARCH_ID_AT91SAM9261: | 119 | case ARCH_ID_AT91SAM9261: |
119 | at91_soc_initdata.type = AT91_SOC_SAM9261; | 120 | at91_soc_initdata.type = AT91_SOC_SAM9261; |
121 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
120 | at91_boot_soc = at91sam9261_soc; | 122 | at91_boot_soc = at91sam9261_soc; |
121 | break; | 123 | break; |
122 | 124 | ||
123 | case ARCH_ID_AT91SAM9263: | 125 | case ARCH_ID_AT91SAM9263: |
124 | at91_soc_initdata.type = AT91_SOC_SAM9263; | 126 | at91_soc_initdata.type = AT91_SOC_SAM9263; |
127 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
125 | at91_boot_soc = at91sam9263_soc; | 128 | at91_boot_soc = at91sam9263_soc; |
126 | break; | 129 | break; |
127 | 130 | ||
128 | case ARCH_ID_AT91SAM9G20: | 131 | case ARCH_ID_AT91SAM9G20: |
129 | at91_soc_initdata.type = AT91_SOC_SAM9G20; | 132 | at91_soc_initdata.type = AT91_SOC_SAM9G20; |
133 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
130 | at91_boot_soc = at91sam9260_soc; | 134 | at91_boot_soc = at91sam9260_soc; |
131 | break; | 135 | break; |
132 | 136 | ||
@@ -139,6 +143,7 @@ static void __init soc_detect(u32 dbgu_base) | |||
139 | 143 | ||
140 | case ARCH_ID_AT91SAM9RL64: | 144 | case ARCH_ID_AT91SAM9RL64: |
141 | at91_soc_initdata.type = AT91_SOC_SAM9RL; | 145 | at91_soc_initdata.type = AT91_SOC_SAM9RL; |
146 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
142 | at91_boot_soc = at91sam9rl_soc; | 147 | at91_boot_soc = at91sam9rl_soc; |
143 | break; | 148 | break; |
144 | 149 | ||
@@ -151,11 +156,17 @@ static void __init soc_detect(u32 dbgu_base) | |||
151 | at91_soc_initdata.type = AT91_SOC_SAM9N12; | 156 | at91_soc_initdata.type = AT91_SOC_SAM9N12; |
152 | at91_boot_soc = at91sam9n12_soc; | 157 | at91_boot_soc = at91sam9n12_soc; |
153 | break; | 158 | break; |
159 | |||
160 | case ARCH_ID_SAMA5D3: | ||
161 | at91_soc_initdata.type = AT91_SOC_SAMA5D3; | ||
162 | at91_boot_soc = sama5d3_soc; | ||
163 | break; | ||
154 | } | 164 | } |
155 | 165 | ||
156 | /* at91sam9g10 */ | 166 | /* at91sam9g10 */ |
157 | if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { | 167 | if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { |
158 | at91_soc_initdata.type = AT91_SOC_SAM9G10; | 168 | at91_soc_initdata.type = AT91_SOC_SAM9G10; |
169 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | ||
159 | at91_boot_soc = at91sam9261_soc; | 170 | at91_boot_soc = at91sam9261_soc; |
160 | } | 171 | } |
161 | /* at91sam9xe */ | 172 | /* at91sam9xe */ |
@@ -206,6 +217,23 @@ static void __init soc_detect(u32 dbgu_base) | |||
206 | break; | 217 | break; |
207 | } | 218 | } |
208 | } | 219 | } |
220 | |||
221 | if (at91_soc_initdata.type == AT91_SOC_SAMA5D3) { | ||
222 | switch (at91_soc_initdata.exid) { | ||
223 | case ARCH_EXID_SAMA5D31: | ||
224 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D31; | ||
225 | break; | ||
226 | case ARCH_EXID_SAMA5D33: | ||
227 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D33; | ||
228 | break; | ||
229 | case ARCH_EXID_SAMA5D34: | ||
230 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D34; | ||
231 | break; | ||
232 | case ARCH_EXID_SAMA5D35: | ||
233 | at91_soc_initdata.subtype = AT91_SOC_SAMA5D35; | ||
234 | break; | ||
235 | } | ||
236 | } | ||
209 | } | 237 | } |
210 | 238 | ||
211 | static const char *soc_name[] = { | 239 | static const char *soc_name[] = { |
@@ -219,7 +247,8 @@ static const char *soc_name[] = { | |||
219 | [AT91_SOC_SAM9RL] = "at91sam9rl", | 247 | [AT91_SOC_SAM9RL] = "at91sam9rl", |
220 | [AT91_SOC_SAM9X5] = "at91sam9x5", | 248 | [AT91_SOC_SAM9X5] = "at91sam9x5", |
221 | [AT91_SOC_SAM9N12] = "at91sam9n12", | 249 | [AT91_SOC_SAM9N12] = "at91sam9n12", |
222 | [AT91_SOC_NONE] = "Unknown" | 250 | [AT91_SOC_SAMA5D3] = "sama5d3", |
251 | [AT91_SOC_UNKNOWN] = "Unknown", | ||
223 | }; | 252 | }; |
224 | 253 | ||
225 | const char *at91_get_soc_type(struct at91_socinfo *c) | 254 | const char *at91_get_soc_type(struct at91_socinfo *c) |
@@ -241,7 +270,12 @@ static const char *soc_subtype_name[] = { | |||
241 | [AT91_SOC_SAM9X35] = "at91sam9x35", | 270 | [AT91_SOC_SAM9X35] = "at91sam9x35", |
242 | [AT91_SOC_SAM9G25] = "at91sam9g25", | 271 | [AT91_SOC_SAM9G25] = "at91sam9g25", |
243 | [AT91_SOC_SAM9X25] = "at91sam9x25", | 272 | [AT91_SOC_SAM9X25] = "at91sam9x25", |
244 | [AT91_SOC_SUBTYPE_NONE] = "Unknown" | 273 | [AT91_SOC_SAMA5D31] = "sama5d31", |
274 | [AT91_SOC_SAMA5D33] = "sama5d33", | ||
275 | [AT91_SOC_SAMA5D34] = "sama5d34", | ||
276 | [AT91_SOC_SAMA5D35] = "sama5d35", | ||
277 | [AT91_SOC_SUBTYPE_NONE] = "None", | ||
278 | [AT91_SOC_SUBTYPE_UNKNOWN] = "Unknown", | ||
245 | }; | 279 | }; |
246 | 280 | ||
247 | const char *at91_get_soc_subtype(struct at91_socinfo *c) | 281 | const char *at91_get_soc_subtype(struct at91_socinfo *c) |
@@ -255,8 +289,8 @@ void __init at91_map_io(void) | |||
255 | /* Map peripherals */ | 289 | /* Map peripherals */ |
256 | iotable_init(&at91_io_desc, 1); | 290 | iotable_init(&at91_io_desc, 1); |
257 | 291 | ||
258 | at91_soc_initdata.type = AT91_SOC_NONE; | 292 | at91_soc_initdata.type = AT91_SOC_UNKNOWN; |
259 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | 293 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_UNKNOWN; |
260 | 294 | ||
261 | soc_detect(AT91_BASE_DBGU0); | 295 | soc_detect(AT91_BASE_DBGU0); |
262 | if (!at91_soc_is_detected()) | 296 | if (!at91_soc_is_detected()) |
@@ -267,8 +301,9 @@ void __init at91_map_io(void) | |||
267 | 301 | ||
268 | pr_info("AT91: Detected soc type: %s\n", | 302 | pr_info("AT91: Detected soc type: %s\n", |
269 | at91_get_soc_type(&at91_soc_initdata)); | 303 | at91_get_soc_type(&at91_soc_initdata)); |
270 | pr_info("AT91: Detected soc subtype: %s\n", | 304 | if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) |
271 | at91_get_soc_subtype(&at91_soc_initdata)); | 305 | pr_info("AT91: Detected soc subtype: %s\n", |
306 | at91_get_soc_subtype(&at91_soc_initdata)); | ||
272 | 307 | ||
273 | if (!at91_soc_is_enabled()) | 308 | if (!at91_soc_is_enabled()) |
274 | panic("AT91: Soc not enabled"); | 309 | panic("AT91: Soc not enabled"); |
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h index 9c6d3d4f9a23..43a225f9e713 100644 --- a/arch/arm/mach-at91/soc.h +++ b/arch/arm/mach-at91/soc.h | |||
@@ -22,9 +22,10 @@ extern struct at91_init_soc at91sam9g45_soc; | |||
22 | extern struct at91_init_soc at91sam9rl_soc; | 22 | extern struct at91_init_soc at91sam9rl_soc; |
23 | extern struct at91_init_soc at91sam9x5_soc; | 23 | extern struct at91_init_soc at91sam9x5_soc; |
24 | extern struct at91_init_soc at91sam9n12_soc; | 24 | extern struct at91_init_soc at91sam9n12_soc; |
25 | extern struct at91_init_soc sama5d3_soc; | ||
25 | 26 | ||
26 | #define AT91_SOC_START(_name) \ | 27 | #define AT91_SOC_START(_name) \ |
27 | struct at91_init_soc __initdata at91##_name##_soc \ | 28 | struct at91_init_soc __initdata _name##_soc \ |
28 | __used \ | 29 | __used \ |
29 | = { \ | 30 | = { \ |
30 | .builtin = 1, \ | 31 | .builtin = 1, \ |
@@ -68,3 +69,7 @@ static inline int at91_soc_is_enabled(void) | |||
68 | #if !defined(CONFIG_SOC_AT91SAM9N12) | 69 | #if !defined(CONFIG_SOC_AT91SAM9N12) |
69 | #define at91sam9n12_soc at91_boot_soc | 70 | #define at91sam9n12_soc at91_boot_soc |
70 | #endif | 71 | #endif |
72 | |||
73 | #if !defined(CONFIG_SOC_SAMA5D3) | ||
74 | #define sama5d3_soc at91_boot_soc | ||
75 | #endif | ||
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c index e698f26cc0cb..52e4bb5cf12d 100644 --- a/arch/arm/mach-cns3xxx/core.c +++ b/arch/arm/mach-cns3xxx/core.c | |||
@@ -22,19 +22,9 @@ | |||
22 | 22 | ||
23 | static struct map_desc cns3xxx_io_desc[] __initdata = { | 23 | static struct map_desc cns3xxx_io_desc[] __initdata = { |
24 | { | 24 | { |
25 | .virtual = CNS3XXX_TC11MP_TWD_BASE_VIRT, | 25 | .virtual = CNS3XXX_TC11MP_SCU_BASE_VIRT, |
26 | .pfn = __phys_to_pfn(CNS3XXX_TC11MP_TWD_BASE), | 26 | .pfn = __phys_to_pfn(CNS3XXX_TC11MP_SCU_BASE), |
27 | .length = SZ_4K, | 27 | .length = SZ_8K, |
28 | .type = MT_DEVICE, | ||
29 | }, { | ||
30 | .virtual = CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT, | ||
31 | .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_CPU_BASE), | ||
32 | .length = SZ_4K, | ||
33 | .type = MT_DEVICE, | ||
34 | }, { | ||
35 | .virtual = CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT, | ||
36 | .pfn = __phys_to_pfn(CNS3XXX_TC11MP_GIC_DIST_BASE), | ||
37 | .length = SZ_4K, | ||
38 | .type = MT_DEVICE, | 28 | .type = MT_DEVICE, |
39 | }, { | 29 | }, { |
40 | .virtual = CNS3XXX_TIMER1_2_3_BASE_VIRT, | 30 | .virtual = CNS3XXX_TIMER1_2_3_BASE_VIRT, |
diff --git a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h index 191c8e57f289..b1021aafa481 100644 --- a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h +++ b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h | |||
@@ -94,10 +94,10 @@ | |||
94 | #define RTC_INTR_STS_OFFSET 0x34 | 94 | #define RTC_INTR_STS_OFFSET 0x34 |
95 | 95 | ||
96 | #define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */ | 96 | #define CNS3XXX_MISC_BASE 0x76000000 /* Misc Control */ |
97 | #define CNS3XXX_MISC_BASE_VIRT 0xFFF07000 /* Misc Control */ | 97 | #define CNS3XXX_MISC_BASE_VIRT 0xFB000000 /* Misc Control */ |
98 | 98 | ||
99 | #define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */ | 99 | #define CNS3XXX_PM_BASE 0x77000000 /* Power Management Control */ |
100 | #define CNS3XXX_PM_BASE_VIRT 0xFFF08000 | 100 | #define CNS3XXX_PM_BASE_VIRT 0xFB001000 |
101 | 101 | ||
102 | #define PM_CLK_GATE_OFFSET 0x00 | 102 | #define PM_CLK_GATE_OFFSET 0x00 |
103 | #define PM_SOFT_RST_OFFSET 0x04 | 103 | #define PM_SOFT_RST_OFFSET 0x04 |
@@ -109,7 +109,7 @@ | |||
109 | #define PM_PLL_HM_PD_OFFSET 0x1C | 109 | #define PM_PLL_HM_PD_OFFSET 0x1C |
110 | 110 | ||
111 | #define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */ | 111 | #define CNS3XXX_UART0_BASE 0x78000000 /* UART 0 */ |
112 | #define CNS3XXX_UART0_BASE_VIRT 0xFFF09000 | 112 | #define CNS3XXX_UART0_BASE_VIRT 0xFB002000 |
113 | 113 | ||
114 | #define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */ | 114 | #define CNS3XXX_UART1_BASE 0x78400000 /* UART 1 */ |
115 | #define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000 | 115 | #define CNS3XXX_UART1_BASE_VIRT 0xFFF0A000 |
@@ -130,7 +130,7 @@ | |||
130 | #define CNS3XXX_I2S_BASE_VIRT 0xFFF10000 | 130 | #define CNS3XXX_I2S_BASE_VIRT 0xFFF10000 |
131 | 131 | ||
132 | #define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */ | 132 | #define CNS3XXX_TIMER1_2_3_BASE 0x7C800000 /* Timer */ |
133 | #define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFFF10800 | 133 | #define CNS3XXX_TIMER1_2_3_BASE_VIRT 0xFB003000 |
134 | 134 | ||
135 | #define TIMER1_COUNTER_OFFSET 0x00 | 135 | #define TIMER1_COUNTER_OFFSET 0x00 |
136 | #define TIMER1_AUTO_RELOAD_OFFSET 0x04 | 136 | #define TIMER1_AUTO_RELOAD_OFFSET 0x04 |
@@ -227,16 +227,16 @@ | |||
227 | * Testchip peripheral and fpga gic regions | 227 | * Testchip peripheral and fpga gic regions |
228 | */ | 228 | */ |
229 | #define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */ | 229 | #define CNS3XXX_TC11MP_SCU_BASE 0x90000000 /* IRQ, Test chip */ |
230 | #define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFF000000 | 230 | #define CNS3XXX_TC11MP_SCU_BASE_VIRT 0xFB004000 |
231 | 231 | ||
232 | #define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */ | 232 | #define CNS3XXX_TC11MP_GIC_CPU_BASE 0x90000100 /* Test chip interrupt controller CPU interface */ |
233 | #define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT 0xFF000100 | 233 | #define CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x100) |
234 | 234 | ||
235 | #define CNS3XXX_TC11MP_TWD_BASE 0x90000600 | 235 | #define CNS3XXX_TC11MP_TWD_BASE 0x90000600 |
236 | #define CNS3XXX_TC11MP_TWD_BASE_VIRT 0xFF000600 | 236 | #define CNS3XXX_TC11MP_TWD_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x600) |
237 | 237 | ||
238 | #define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */ | 238 | #define CNS3XXX_TC11MP_GIC_DIST_BASE 0x90001000 /* Test chip interrupt controller distributor */ |
239 | #define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT 0xFF001000 | 239 | #define CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT (CNS3XXX_TC11MP_SCU_BASE_VIRT + 0x1000) |
240 | 240 | ||
241 | #define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */ | 241 | #define CNS3XXX_TC11MP_L220_BASE 0x92002000 /* L220 registers */ |
242 | #define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000 | 242 | #define CNS3XXX_TC11MP_L220_BASE_VIRT 0xFF002000 |
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h index d2afb4dd82ab..b5cc77d2380b 100644 --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h +++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h | |||
@@ -47,9 +47,13 @@ static void __raw_writel(unsigned int value, unsigned int ptr) | |||
47 | 47 | ||
48 | static inline void putc(int c) | 48 | static inline void putc(int c) |
49 | { | 49 | { |
50 | /* Transmit fifo not full? */ | 50 | int i; |
51 | while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF) | 51 | |
52 | ; | 52 | for (i = 0; i < 10000; i++) { |
53 | /* Transmit fifo not full? */ | ||
54 | if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)) | ||
55 | break; | ||
56 | } | ||
53 | 57 | ||
54 | __raw_writeb(c, PHYS_UART_DATA); | 58 | __raw_writeb(c, PHYS_UART_DATA); |
55 | } | 59 | } |
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 2f45906d6ee5..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 |
@@ -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 bdd957978d9b..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, |
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-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 76c1170b3528..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,12 +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/hardware/arm_timer.h> | ||
36 | #include <asm/hardware/timer-sp.h> | ||
37 | #include <asm/hardware/cache-l2x0.h> | 35 | #include <asm/hardware/cache-l2x0.h> |
38 | #include <asm/mach/arch.h> | 36 | #include <asm/mach/arch.h> |
39 | #include <asm/mach/map.h> | 37 | #include <asm/mach/map.h> |
@@ -90,36 +88,16 @@ static void __init highbank_init_irq(void) | |||
90 | #endif | 88 | #endif |
91 | } | 89 | } |
92 | 90 | ||
93 | static struct clk_lookup lookup = { | ||
94 | .dev_id = "sp804", | ||
95 | .con_id = NULL, | ||
96 | }; | ||
97 | |||
98 | static void __init highbank_timer_init(void) | 91 | static void __init highbank_timer_init(void) |
99 | { | 92 | { |
100 | int irq; | ||
101 | struct device_node *np; | 93 | struct device_node *np; |
102 | void __iomem *timer_base; | ||
103 | 94 | ||
104 | /* Map system registers */ | 95 | /* Map system registers */ |
105 | np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); | 96 | np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs"); |
106 | sregs_base = of_iomap(np, 0); | 97 | sregs_base = of_iomap(np, 0); |
107 | WARN_ON(!sregs_base); | 98 | WARN_ON(!sregs_base); |
108 | 99 | ||
109 | np = of_find_compatible_node(NULL, NULL, "arm,sp804"); | ||
110 | timer_base = of_iomap(np, 0); | ||
111 | WARN_ON(!timer_base); | ||
112 | irq = irq_of_parse_and_map(np, 0); | ||
113 | |||
114 | of_clk_init(NULL); | 100 | of_clk_init(NULL); |
115 | lookup.clk = of_clk_get(np, 0); | ||
116 | clkdev_add(&lookup); | ||
117 | |||
118 | sp804_clocksource_and_sched_clock_init(timer_base + 0x20, "timer1"); | ||
119 | sp804_clockevents_init(timer_base, irq, "timer0"); | ||
120 | |||
121 | arch_timer_of_register(); | ||
122 | arch_timer_sched_clock_init(); | ||
123 | 101 | ||
124 | clocksource_of_init(); | 102 | clocksource_of_init(); |
125 | } | 103 | } |
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/common.h b/arch/arm/mach-imx/common.h index 5a800bfcec5b..5bf4a97ab241 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h | |||
@@ -110,6 +110,8 @@ void tzic_handle_irq(struct pt_regs *); | |||
110 | 110 | ||
111 | extern void imx_enable_cpu(int cpu, bool enable); | 111 | extern void imx_enable_cpu(int cpu, bool enable); |
112 | extern void imx_set_cpu_jump(int cpu, void *jump_addr); | 112 | extern void imx_set_cpu_jump(int cpu, void *jump_addr); |
113 | extern u32 imx_get_cpu_arg(int cpu); | ||
114 | extern void imx_set_cpu_arg(int cpu, u32 arg); | ||
113 | extern void v7_cpu_resume(void); | 115 | extern void v7_cpu_resume(void); |
114 | extern u32 *pl310_get_save_ptr(void); | 116 | extern u32 *pl310_get_save_ptr(void); |
115 | #ifdef CONFIG_SMP | 117 | #ifdef CONFIG_SMP |
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c index 7bc5fe15dda2..361a253e2b63 100644 --- a/arch/arm/mach-imx/hotplug.c +++ b/arch/arm/mach-imx/hotplug.c | |||
@@ -46,11 +46,23 @@ static inline void cpu_enter_lowpower(void) | |||
46 | void imx_cpu_die(unsigned int cpu) | 46 | void imx_cpu_die(unsigned int cpu) |
47 | { | 47 | { |
48 | cpu_enter_lowpower(); | 48 | cpu_enter_lowpower(); |
49 | /* | ||
50 | * We use the cpu jumping argument register to sync with | ||
51 | * imx_cpu_kill() which is running on cpu0 and waiting for | ||
52 | * the register being cleared to kill the cpu. | ||
53 | */ | ||
54 | imx_set_cpu_arg(cpu, ~0); | ||
49 | cpu_do_idle(); | 55 | cpu_do_idle(); |
50 | } | 56 | } |
51 | 57 | ||
52 | int imx_cpu_kill(unsigned int cpu) | 58 | int imx_cpu_kill(unsigned int cpu) |
53 | { | 59 | { |
60 | unsigned long timeout = jiffies + msecs_to_jiffies(50); | ||
61 | |||
62 | while (imx_get_cpu_arg(cpu) == 0) | ||
63 | if (time_after(jiffies, timeout)) | ||
64 | return 0; | ||
54 | imx_enable_cpu(cpu, false); | 65 | imx_enable_cpu(cpu, false); |
66 | imx_set_cpu_arg(cpu, 0); | ||
55 | return 1; | 67 | return 1; |
56 | } | 68 | } |
diff --git a/arch/arm/mach-imx/src.c b/arch/arm/mach-imx/src.c index e15f1555c59b..09a742f8c7ab 100644 --- a/arch/arm/mach-imx/src.c +++ b/arch/arm/mach-imx/src.c | |||
@@ -43,6 +43,18 @@ void imx_set_cpu_jump(int cpu, void *jump_addr) | |||
43 | src_base + SRC_GPR1 + cpu * 8); | 43 | src_base + SRC_GPR1 + cpu * 8); |
44 | } | 44 | } |
45 | 45 | ||
46 | u32 imx_get_cpu_arg(int cpu) | ||
47 | { | ||
48 | cpu = cpu_logical_map(cpu); | ||
49 | return readl_relaxed(src_base + SRC_GPR1 + cpu * 8 + 4); | ||
50 | } | ||
51 | |||
52 | void imx_set_cpu_arg(int cpu, u32 arg) | ||
53 | { | ||
54 | cpu = cpu_logical_map(cpu); | ||
55 | writel_relaxed(arg, src_base + SRC_GPR1 + cpu * 8 + 4); | ||
56 | } | ||
57 | |||
46 | void imx_src_prepare_restart(void) | 58 | void imx_src_prepare_restart(void) |
47 | { | 59 | { |
48 | u32 val; | 60 | u32 val; |
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index da1091be0887..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 */ } |
@@ -383,7 +350,6 @@ DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") | |||
383 | .init_early = intcp_init_early, | 350 | .init_early = intcp_init_early, |
384 | .init_irq = intcp_init_irq_of, | 351 | .init_irq = intcp_init_irq_of, |
385 | .handle_irq = fpga_handle_irq, | 352 | .handle_irq = fpga_handle_irq, |
386 | .init_time = cp_of_timer_init, | ||
387 | .init_machine = intcp_init_of, | 353 | .init_machine = intcp_init_of, |
388 | .restart = integrator_restart, | 354 | .restart = integrator_restart, |
389 | .dt_compat = intcp_dt_board_compat, | 355 | .dt_compat = intcp_dt_board_compat, |
diff --git a/arch/arm/mach-kirkwood/guruplug-setup.c b/arch/arm/mach-kirkwood/guruplug-setup.c index 1c6e736cbbf8..08dd739aa709 100644 --- a/arch/arm/mach-kirkwood/guruplug-setup.c +++ b/arch/arm/mach-kirkwood/guruplug-setup.c | |||
@@ -53,6 +53,8 @@ static struct mv_sata_platform_data guruplug_sata_data = { | |||
53 | 53 | ||
54 | static struct mvsdio_platform_data guruplug_mvsdio_data = { | 54 | static struct mvsdio_platform_data guruplug_mvsdio_data = { |
55 | /* unfortunately the CD signal has not been connected */ | 55 | /* unfortunately the CD signal has not been connected */ |
56 | .gpio_card_detect = -1, | ||
57 | .gpio_write_protect = -1, | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | static struct gpio_led guruplug_led_pins[] = { | 60 | static struct gpio_led guruplug_led_pins[] = { |
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c index 8ddd69fdc937..6a6eb548307d 100644 --- a/arch/arm/mach-kirkwood/openrd-setup.c +++ b/arch/arm/mach-kirkwood/openrd-setup.c | |||
@@ -55,6 +55,7 @@ static struct mv_sata_platform_data openrd_sata_data = { | |||
55 | 55 | ||
56 | static struct mvsdio_platform_data openrd_mvsdio_data = { | 56 | static struct mvsdio_platform_data openrd_mvsdio_data = { |
57 | .gpio_card_detect = 29, /* MPP29 used as SD card detect */ | 57 | .gpio_card_detect = 29, /* MPP29 used as SD card detect */ |
58 | .gpio_write_protect = -1, | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | static unsigned int openrd_mpp_config[] __initdata = { | 61 | static unsigned int openrd_mpp_config[] __initdata = { |
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index c7d93b48926b..d24223166e06 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c | |||
@@ -69,6 +69,7 @@ static struct mv_sata_platform_data rd88f6281_sata_data = { | |||
69 | 69 | ||
70 | static struct mvsdio_platform_data rd88f6281_mvsdio_data = { | 70 | static struct mvsdio_platform_data rd88f6281_mvsdio_data = { |
71 | .gpio_card_detect = 28, | 71 | .gpio_card_detect = 28, |
72 | .gpio_write_protect = -1, | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | static unsigned int rd88f6281_mpp_config[] __initdata = { | 75 | static unsigned int rd88f6281_mpp_config[] __initdata = { |
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c index 2969027f02fa..f9fd77e8f1f5 100644 --- a/arch/arm/mach-msm/timer.c +++ b/arch/arm/mach-msm/timer.c | |||
@@ -62,7 +62,10 @@ static int msm_timer_set_next_event(unsigned long cycles, | |||
62 | { | 62 | { |
63 | u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); | 63 | u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); |
64 | 64 | ||
65 | writel_relaxed(0, event_base + TIMER_CLEAR); | 65 | ctrl &= ~TIMER_ENABLE_EN; |
66 | writel_relaxed(ctrl, event_base + TIMER_ENABLE); | ||
67 | |||
68 | writel_relaxed(ctrl, event_base + TIMER_CLEAR); | ||
66 | writel_relaxed(cycles, event_base + TIMER_MATCH_VAL); | 69 | writel_relaxed(cycles, event_base + TIMER_MATCH_VAL); |
67 | writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE); | 70 | writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE); |
68 | return 0; | 71 | return 0; |
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile index da93bcbc74c1..c3be068f1c96 100644 --- a/arch/arm/mach-mvebu/Makefile +++ b/arch/arm/mach-mvebu/Makefile | |||
@@ -5,6 +5,6 @@ AFLAGS_coherency_ll.o := -Wa,-march=armv7-a | |||
5 | 5 | ||
6 | obj-y += system-controller.o | 6 | obj-y += system-controller.o |
7 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o | 7 | obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o |
8 | obj-$(CONFIG_ARCH_MVEBU) += addr-map.o coherency.o coherency_ll.o pmsu.o irq-armada-370-xp.o | 8 | obj-$(CONFIG_ARCH_MVEBU) += addr-map.o coherency.o coherency_ll.o pmsu.o |
9 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o | 9 | obj-$(CONFIG_SMP) += platsmp.o headsmp.o |
10 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | 10 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o |
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index a5ea616d6d12..433e8c5343b2 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/time-armada-370-xp.h> | 19 | #include <linux/time-armada-370-xp.h> |
20 | #include <linux/clk/mvebu.h> | 20 | #include <linux/clk/mvebu.h> |
21 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
22 | #include <linux/irqchip.h> | ||
23 | #include <asm/hardware/cache-l2x0.h> | ||
22 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
23 | #include <asm/mach/map.h> | 25 | #include <asm/mach/map.h> |
24 | #include <asm/mach/time.h> | 26 | #include <asm/mach/time.h> |
@@ -54,6 +56,10 @@ void __init armada_370_xp_init_early(void) | |||
54 | * to make sure such the allocations won't fail. | 56 | * to make sure such the allocations won't fail. |
55 | */ | 57 | */ |
56 | init_dma_coherent_pool_size(SZ_1M); | 58 | init_dma_coherent_pool_size(SZ_1M); |
59 | |||
60 | #ifdef CONFIG_CACHE_L2X0 | ||
61 | l2x0_of_init(0, ~0UL); | ||
62 | #endif | ||
57 | } | 63 | } |
58 | 64 | ||
59 | static void __init armada_370_xp_dt_init(void) | 65 | static void __init armada_370_xp_dt_init(void) |
@@ -72,8 +78,7 @@ DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)") | |||
72 | .init_machine = armada_370_xp_dt_init, | 78 | .init_machine = armada_370_xp_dt_init, |
73 | .map_io = armada_370_xp_map_io, | 79 | .map_io = armada_370_xp_map_io, |
74 | .init_early = armada_370_xp_init_early, | 80 | .init_early = armada_370_xp_init_early, |
75 | .init_irq = armada_370_xp_init_irq, | 81 | .init_irq = irqchip_init, |
76 | .handle_irq = armada_370_xp_handle_irq, | ||
77 | .init_time = armada_370_xp_timer_and_clk_init, | 82 | .init_time = armada_370_xp_timer_and_clk_init, |
78 | .restart = mvebu_restart, | 83 | .restart = mvebu_restart, |
79 | .dt_compat = armada_370_xp_dt_compat, | 84 | .dt_compat = armada_370_xp_dt_compat, |
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index cb7c6ae2e3fc..6c4f766365a2 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c | |||
@@ -543,15 +543,6 @@ static struct clk usb_dc_ck = { | |||
543 | /* Direct from ULPD, no parent */ | 543 | /* Direct from ULPD, no parent */ |
544 | .rate = 48000000, | 544 | .rate = 48000000, |
545 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | 545 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), |
546 | .enable_bit = USB_REQ_EN_SHIFT, | ||
547 | }; | ||
548 | |||
549 | static struct clk usb_dc_ck7xx = { | ||
550 | .name = "usb_dc_ck", | ||
551 | .ops = &clkops_generic, | ||
552 | /* Direct from ULPD, no parent */ | ||
553 | .rate = 48000000, | ||
554 | .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG), | ||
555 | .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, | 546 | .enable_bit = SOFT_USB_OTG_DPLL_REQ_SHIFT, |
556 | }; | 547 | }; |
557 | 548 | ||
@@ -727,8 +718,7 @@ static struct omap_clk omap_clks[] = { | |||
727 | CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310), | 718 | CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310), |
728 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), | 719 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310), |
729 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), | 720 | CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX), |
730 | CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX), | 721 | CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX | CK_7XX), |
731 | CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX), | ||
732 | CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), | 722 | CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310), |
733 | CLK(NULL, "mclk", &mclk_16xx, CK_16XX), | 723 | CLK(NULL, "mclk", &mclk_16xx, CK_16XX), |
734 | CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), | 724 | CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310), |
diff --git a/arch/arm/mach-omap1/include/mach/usb.h b/arch/arm/mach-omap1/include/mach/usb.h index 753cd5ce6949..45e5ac707cbb 100644 --- a/arch/arm/mach-omap1/include/mach/usb.h +++ b/arch/arm/mach-omap1/include/mach/usb.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * FIXME correct answer depends on hmc_mode, | 2 | * FIXME correct answer depends on hmc_mode, |
3 | * as does (on omap1) any nonzero value for config->otg port number | 3 | * as does (on omap1) any nonzero value for config->otg port number |
4 | */ | 4 | */ |
5 | #ifdef CONFIG_USB_GADGET_OMAP | 5 | #if IS_ENABLED(CONFIG_USB_OMAP) |
6 | #define is_usb0_device(config) 1 | 6 | #define is_usb0_device(config) 1 |
7 | #else | 7 | #else |
8 | #define is_usb0_device(config) 0 | 8 | #define is_usb0_device(config) 0 |
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c index 1a1db5971cd9..4118db50d5e8 100644 --- a/arch/arm/mach-omap1/usb.c +++ b/arch/arm/mach-omap1/usb.c | |||
@@ -123,7 +123,7 @@ omap_otg_init(struct omap_usb_config *config) | |||
123 | syscon = omap_readl(OTG_SYSCON_1); | 123 | syscon = omap_readl(OTG_SYSCON_1); |
124 | syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; | 124 | syscon |= HST_IDLE_EN|DEV_IDLE_EN|OTG_IDLE_EN; |
125 | 125 | ||
126 | #ifdef CONFIG_USB_GADGET_OMAP | 126 | #if IS_ENABLED(CONFIG_USB_OMAP) |
127 | if (config->otg || config->register_dev) { | 127 | if (config->otg || config->register_dev) { |
128 | struct platform_device *udc_device = config->udc_device; | 128 | struct platform_device *udc_device = config->udc_device; |
129 | int status; | 129 | int status; |
@@ -169,7 +169,7 @@ omap_otg_init(struct omap_usb_config *config) | |||
169 | void omap_otg_init(struct omap_usb_config *config) {} | 169 | void omap_otg_init(struct omap_usb_config *config) {} |
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | #ifdef CONFIG_USB_GADGET_OMAP | 172 | #if IS_ENABLED(CONFIG_USB_OMAP) |
173 | 173 | ||
174 | static struct resource udc_resources[] = { | 174 | static struct resource udc_resources[] = { |
175 | /* order is significant! */ | 175 | /* order is significant! */ |
@@ -600,7 +600,7 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config) | |||
600 | while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) | 600 | while (!(omap_readw(ULPD_DPLL_CTRL) & DPLL_LOCK)) |
601 | cpu_relax(); | 601 | cpu_relax(); |
602 | 602 | ||
603 | #ifdef CONFIG_USB_GADGET_OMAP | 603 | #if IS_ENABLED(CONFIG_USB_OMAP) |
604 | if (config->register_dev) { | 604 | if (config->register_dev) { |
605 | int status; | 605 | int status; |
606 | 606 | ||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index b068b7fe99ef..62bb352c2d37 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -229,7 +229,6 @@ obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o | |||
229 | obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o | 229 | obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o |
230 | obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o | 230 | obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o |
231 | obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o | 231 | obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o |
232 | obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o | ||
233 | obj-$(CONFIG_MACH_OVERO) += board-overo.o | 232 | obj-$(CONFIG_MACH_OVERO) += board-overo.o |
234 | obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o | 233 | obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o |
235 | obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o | 234 | obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o |
@@ -255,8 +254,6 @@ obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o | |||
255 | obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o | 254 | obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o |
256 | obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o | 255 | obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o |
257 | 256 | ||
258 | obj-$(CONFIG_MACH_PCM049) += board-omap4pcm049.o | ||
259 | |||
260 | obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o | 257 | obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o |
261 | 258 | ||
262 | obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o | 259 | obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o |
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index cb0596b631cf..244d8a5aa54b 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #include "gpmc-smc91x.h" | 38 | #include "gpmc-smc91x.h" |
39 | 39 | ||
40 | #include <video/omapdss.h> | 40 | #include <video/omapdss.h> |
41 | #include <video/omap-panel-generic-dpi.h> | 41 | #include <video/omap-panel-data.h> |
42 | 42 | ||
43 | #include "mux.h" | 43 | #include "mux.h" |
44 | #include "hsmmc.h" | 44 | #include "hsmmc.h" |
@@ -108,24 +108,13 @@ static struct platform_device *sdp2430_devices[] __initdata = { | |||
108 | #define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91 | 108 | #define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91 |
109 | #define SDP2430_LCD_PANEL_ENABLE_GPIO 154 | 109 | #define SDP2430_LCD_PANEL_ENABLE_GPIO 154 |
110 | 110 | ||
111 | static int sdp2430_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
112 | { | ||
113 | gpio_direction_output(SDP2430_LCD_PANEL_ENABLE_GPIO, 1); | ||
114 | gpio_direction_output(SDP2430_LCD_PANEL_BACKLIGHT_GPIO, 1); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static void sdp2430_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
120 | { | ||
121 | gpio_direction_output(SDP2430_LCD_PANEL_ENABLE_GPIO, 0); | ||
122 | gpio_direction_output(SDP2430_LCD_PANEL_BACKLIGHT_GPIO, 0); | ||
123 | } | ||
124 | |||
125 | static struct panel_generic_dpi_data sdp2430_panel_data = { | 111 | static struct panel_generic_dpi_data sdp2430_panel_data = { |
126 | .name = "nec_nl2432dr22-11b", | 112 | .name = "nec_nl2432dr22-11b", |
127 | .platform_enable = sdp2430_panel_enable_lcd, | 113 | .num_gpios = 2, |
128 | .platform_disable = sdp2430_panel_disable_lcd, | 114 | .gpios = { |
115 | SDP2430_LCD_PANEL_ENABLE_GPIO, | ||
116 | SDP2430_LCD_PANEL_BACKLIGHT_GPIO, | ||
117 | }, | ||
129 | }; | 118 | }; |
130 | 119 | ||
131 | static struct omap_dss_device sdp2430_lcd_device = { | 120 | static struct omap_dss_device sdp2430_lcd_device = { |
@@ -146,26 +135,6 @@ static struct omap_dss_board_info sdp2430_dss_data = { | |||
146 | .default_device = &sdp2430_lcd_device, | 135 | .default_device = &sdp2430_lcd_device, |
147 | }; | 136 | }; |
148 | 137 | ||
149 | static void __init sdp2430_display_init(void) | ||
150 | { | ||
151 | int r; | ||
152 | |||
153 | static struct gpio gpios[] __initdata = { | ||
154 | { SDP2430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, | ||
155 | "LCD reset" }, | ||
156 | { SDP2430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, | ||
157 | "LCD Backlight" }, | ||
158 | }; | ||
159 | |||
160 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
161 | if (r) { | ||
162 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | omap_display_init(&sdp2430_dss_data); | ||
167 | } | ||
168 | |||
169 | #if IS_ENABLED(CONFIG_SMC91X) | 138 | #if IS_ENABLED(CONFIG_SMC91X) |
170 | 139 | ||
171 | static struct omap_smc91x_platform_data board_smc91x_data = { | 140 | static struct omap_smc91x_platform_data board_smc91x_data = { |
@@ -273,7 +242,7 @@ static void __init omap_2430sdp_init(void) | |||
273 | gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW, | 242 | gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW, |
274 | "Secondary LCD backlight"); | 243 | "Secondary LCD backlight"); |
275 | 244 | ||
276 | sdp2430_display_init(); | 245 | omap_display_init(&sdp2430_dss_data); |
277 | } | 246 | } |
278 | 247 | ||
279 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") | 248 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") |
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 7eb9651dd0f7..23b004afa3f8 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "common.h" | 35 | #include "common.h" |
36 | #include <linux/omap-dma.h> | 36 | #include <linux/omap-dma.h> |
37 | #include <video/omapdss.h> | 37 | #include <video/omapdss.h> |
38 | #include <video/omap-panel-tfp410.h> | 38 | #include <video/omap-panel-data.h> |
39 | 39 | ||
40 | #include "gpmc.h" | 40 | #include "gpmc.h" |
41 | #include "gpmc-smc91x.h" | 41 | #include "gpmc-smc91x.h" |
@@ -108,53 +108,38 @@ static struct twl4030_keypad_data sdp3430_kp_data = { | |||
108 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 | 108 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 |
109 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 | 109 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 |
110 | 110 | ||
111 | static struct gpio sdp3430_dss_gpios[] __initdata = { | ||
112 | {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" }, | ||
113 | {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, | ||
114 | }; | ||
115 | |||
116 | static void __init sdp3430_display_init(void) | 111 | static void __init sdp3430_display_init(void) |
117 | { | 112 | { |
118 | int r; | 113 | int r; |
119 | 114 | ||
120 | r = gpio_request_array(sdp3430_dss_gpios, | 115 | /* |
121 | ARRAY_SIZE(sdp3430_dss_gpios)); | 116 | * the backlight GPIO doesn't directly go to the panel, it enables |
117 | * an internal circuit on 3430sdp to create the signal V_BKL_28V, | ||
118 | * this is connected to LED+ pin of the sharp panel. This GPIO | ||
119 | * is left enabled in the board file, and not passed to the panel | ||
120 | * as platform_data. | ||
121 | */ | ||
122 | r = gpio_request_one(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, | ||
123 | GPIOF_OUT_INIT_HIGH, "LCD Backlight"); | ||
122 | if (r) | 124 | if (r) |
123 | printk(KERN_ERR "failed to get LCD control GPIOs\n"); | 125 | pr_err("failed to get LCD Backlight GPIO\n"); |
124 | |||
125 | } | ||
126 | 126 | ||
127 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
128 | { | ||
129 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); | ||
130 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); | ||
131 | |||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
136 | { | ||
137 | gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); | ||
138 | gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); | ||
139 | } | ||
140 | |||
141 | static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) | ||
142 | { | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev) | ||
147 | { | ||
148 | } | 127 | } |
149 | 128 | ||
129 | static struct panel_sharp_ls037v7dw01_data sdp3430_lcd_data = { | ||
130 | .resb_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO, | ||
131 | .ini_gpio = -1, | ||
132 | .mo_gpio = -1, | ||
133 | .lr_gpio = -1, | ||
134 | .ud_gpio = -1, | ||
135 | }; | ||
150 | 136 | ||
151 | static struct omap_dss_device sdp3430_lcd_device = { | 137 | static struct omap_dss_device sdp3430_lcd_device = { |
152 | .name = "lcd", | 138 | .name = "lcd", |
153 | .driver_name = "sharp_ls_panel", | 139 | .driver_name = "sharp_ls_panel", |
154 | .type = OMAP_DISPLAY_TYPE_DPI, | 140 | .type = OMAP_DISPLAY_TYPE_DPI, |
155 | .phy.dpi.data_lines = 16, | 141 | .phy.dpi.data_lines = 16, |
156 | .platform_enable = sdp3430_panel_enable_lcd, | 142 | .data = &sdp3430_lcd_data, |
157 | .platform_disable = sdp3430_panel_disable_lcd, | ||
158 | }; | 143 | }; |
159 | 144 | ||
160 | static struct tfp410_platform_data dvi_panel = { | 145 | static struct tfp410_platform_data dvi_panel = { |
@@ -175,8 +160,6 @@ static struct omap_dss_device sdp3430_tv_device = { | |||
175 | .driver_name = "venc", | 160 | .driver_name = "venc", |
176 | .type = OMAP_DISPLAY_TYPE_VENC, | 161 | .type = OMAP_DISPLAY_TYPE_VENC, |
177 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 162 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
178 | .platform_enable = sdp3430_panel_enable_tv, | ||
179 | .platform_disable = sdp3430_panel_disable_tv, | ||
180 | }; | 163 | }; |
181 | 164 | ||
182 | 165 | ||
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 306df0b40935..56a9a4f855c7 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -291,6 +291,10 @@ static struct platform_device sdp4430_leds_pwm = { | |||
291 | }, | 291 | }, |
292 | }; | 292 | }; |
293 | 293 | ||
294 | /* Dummy regulator for pwm-backlight driver */ | ||
295 | static struct regulator_consumer_supply backlight_supply = | ||
296 | REGULATOR_SUPPLY("enable", "pwm-backlight"); | ||
297 | |||
294 | static struct platform_pwm_backlight_data sdp4430_backlight_data = { | 298 | static struct platform_pwm_backlight_data sdp4430_backlight_data = { |
295 | .max_brightness = 127, | 299 | .max_brightness = 127, |
296 | .dft_brightness = 127, | 300 | .dft_brightness = 127, |
@@ -718,6 +722,8 @@ static void __init omap_4430sdp_init(void) | |||
718 | 722 | ||
719 | omap4_i2c_init(); | 723 | omap4_i2c_init(); |
720 | omap_sfh7741prox_init(); | 724 | omap_sfh7741prox_init(); |
725 | regulator_register_always_on(0, "backlight-enable", | ||
726 | &backlight_supply, 1, 0); | ||
721 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); | 727 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
722 | omap_serial_init(); | 728 | omap_serial_init(); |
723 | omap_sdrc_init(NULL, NULL); | 729 | omap_sdrc_init(NULL, NULL); |
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c index 191f9762ba63..d63f14b534b5 100644 --- a/arch/arm/mach-omap2/board-am3517evm.c +++ b/arch/arm/mach-omap2/board-am3517evm.c | |||
@@ -35,8 +35,7 @@ | |||
35 | 35 | ||
36 | #include "common.h" | 36 | #include "common.h" |
37 | #include <video/omapdss.h> | 37 | #include <video/omapdss.h> |
38 | #include <video/omap-panel-generic-dpi.h> | 38 | #include <video/omap-panel-data.h> |
39 | #include <video/omap-panel-tfp410.h> | ||
40 | 39 | ||
41 | #include "am35xx-emac.h" | 40 | #include "am35xx-emac.h" |
42 | #include "mux.h" | 41 | #include "mux.h" |
@@ -121,63 +120,14 @@ static int __init am3517_evm_i2c_init(void) | |||
121 | return 0; | 120 | return 0; |
122 | } | 121 | } |
123 | 122 | ||
124 | static int lcd_enabled; | ||
125 | static int dvi_enabled; | ||
126 | |||
127 | #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ | ||
128 | defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) | ||
129 | static struct gpio am3517_evm_dss_gpios[] __initdata = { | ||
130 | /* GPIO 182 = LCD Backlight Power */ | ||
131 | { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" }, | ||
132 | /* GPIO 181 = LCD Panel PWM */ | ||
133 | { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, | ||
134 | /* GPIO 176 = LCD Panel Power enable pin */ | ||
135 | { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" }, | ||
136 | }; | ||
137 | |||
138 | static void __init am3517_evm_display_init(void) | ||
139 | { | ||
140 | int r; | ||
141 | |||
142 | omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); | ||
143 | omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); | ||
144 | omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); | ||
145 | |||
146 | r = gpio_request_array(am3517_evm_dss_gpios, | ||
147 | ARRAY_SIZE(am3517_evm_dss_gpios)); | ||
148 | if (r) { | ||
149 | printk(KERN_ERR "failed to get DSS panel control GPIOs\n"); | ||
150 | return; | ||
151 | } | ||
152 | |||
153 | printk(KERN_INFO "Display initialized successfully\n"); | ||
154 | } | ||
155 | #else | ||
156 | static void __init am3517_evm_display_init(void) {} | ||
157 | #endif | ||
158 | |||
159 | static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
160 | { | ||
161 | if (dvi_enabled) { | ||
162 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
163 | return -EINVAL; | ||
164 | } | ||
165 | gpio_set_value(LCD_PANEL_PWR, 1); | ||
166 | lcd_enabled = 1; | ||
167 | |||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
172 | { | ||
173 | gpio_set_value(LCD_PANEL_PWR, 0); | ||
174 | lcd_enabled = 0; | ||
175 | } | ||
176 | |||
177 | static struct panel_generic_dpi_data lcd_panel = { | 123 | static struct panel_generic_dpi_data lcd_panel = { |
178 | .name = "sharp_lq", | 124 | .name = "sharp_lq", |
179 | .platform_enable = am3517_evm_panel_enable_lcd, | 125 | .num_gpios = 3, |
180 | .platform_disable = am3517_evm_panel_disable_lcd, | 126 | .gpios = { |
127 | LCD_PANEL_PWR, | ||
128 | LCD_PANEL_BKLIGHT_PWR, | ||
129 | LCD_PANEL_PWM, | ||
130 | }, | ||
181 | }; | 131 | }; |
182 | 132 | ||
183 | static struct omap_dss_device am3517_evm_lcd_device = { | 133 | static struct omap_dss_device am3517_evm_lcd_device = { |
@@ -188,22 +138,11 @@ static struct omap_dss_device am3517_evm_lcd_device = { | |||
188 | .phy.dpi.data_lines = 16, | 138 | .phy.dpi.data_lines = 16, |
189 | }; | 139 | }; |
190 | 140 | ||
191 | static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev) | ||
192 | { | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev) | ||
197 | { | ||
198 | } | ||
199 | |||
200 | static struct omap_dss_device am3517_evm_tv_device = { | 141 | static struct omap_dss_device am3517_evm_tv_device = { |
201 | .type = OMAP_DISPLAY_TYPE_VENC, | 142 | .type = OMAP_DISPLAY_TYPE_VENC, |
202 | .name = "tv", | 143 | .name = "tv", |
203 | .driver_name = "venc", | 144 | .driver_name = "venc", |
204 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 145 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
205 | .platform_enable = am3517_evm_panel_enable_tv, | ||
206 | .platform_disable = am3517_evm_panel_disable_tv, | ||
207 | }; | 146 | }; |
208 | 147 | ||
209 | static struct tfp410_platform_data dvi_panel = { | 148 | static struct tfp410_platform_data dvi_panel = { |
@@ -366,8 +305,6 @@ static void __init am3517_evm_init(void) | |||
366 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); | 305 | usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data)); |
367 | usbhs_init(&usbhs_bdata); | 306 | usbhs_init(&usbhs_bdata); |
368 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); | 307 | am3517_evm_hecc_init(&am3517_evm_hecc_pdata); |
369 | /* DSS */ | ||
370 | am3517_evm_display_init(); | ||
371 | 308 | ||
372 | /* RTC - S35390A */ | 309 | /* RTC - S35390A */ |
373 | am3517_evm_rtc_init(); | 310 | am3517_evm_rtc_init(); |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 7fda3f5f8a7f..ee6218c74807 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -41,8 +41,7 @@ | |||
41 | 41 | ||
42 | #include <linux/platform_data/mtd-nand-omap2.h> | 42 | #include <linux/platform_data/mtd-nand-omap2.h> |
43 | #include <video/omapdss.h> | 43 | #include <video/omapdss.h> |
44 | #include <video/omap-panel-generic-dpi.h> | 44 | #include <video/omap-panel-data.h> |
45 | #include <video/omap-panel-tfp410.h> | ||
46 | #include <linux/platform_data/spi-omap2-mcspi.h> | 45 | #include <linux/platform_data/spi-omap2-mcspi.h> |
47 | 46 | ||
48 | #include "common.h" | 47 | #include "common.h" |
@@ -191,45 +190,12 @@ static inline void cm_t35_init_nand(void) {} | |||
191 | #define CM_T35_LCD_BL_GPIO 58 | 190 | #define CM_T35_LCD_BL_GPIO 58 |
192 | #define CM_T35_DVI_EN_GPIO 54 | 191 | #define CM_T35_DVI_EN_GPIO 54 |
193 | 192 | ||
194 | static int lcd_enabled; | ||
195 | static int dvi_enabled; | ||
196 | |||
197 | static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
198 | { | ||
199 | if (dvi_enabled) { | ||
200 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
201 | return -EINVAL; | ||
202 | } | ||
203 | |||
204 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); | ||
205 | gpio_set_value(CM_T35_LCD_BL_GPIO, 1); | ||
206 | |||
207 | lcd_enabled = 1; | ||
208 | |||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
213 | { | ||
214 | lcd_enabled = 0; | ||
215 | |||
216 | gpio_set_value(CM_T35_LCD_BL_GPIO, 0); | ||
217 | gpio_set_value(CM_T35_LCD_EN_GPIO, 0); | ||
218 | } | ||
219 | |||
220 | static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev) | ||
221 | { | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static void cm_t35_panel_disable_tv(struct omap_dss_device *dssdev) | ||
226 | { | ||
227 | } | ||
228 | |||
229 | static struct panel_generic_dpi_data lcd_panel = { | 193 | static struct panel_generic_dpi_data lcd_panel = { |
230 | .name = "toppoly_tdo35s", | 194 | .name = "toppoly_tdo35s", |
231 | .platform_enable = cm_t35_panel_enable_lcd, | 195 | .num_gpios = 1, |
232 | .platform_disable = cm_t35_panel_disable_lcd, | 196 | .gpios = { |
197 | CM_T35_LCD_BL_GPIO, | ||
198 | }, | ||
233 | }; | 199 | }; |
234 | 200 | ||
235 | static struct omap_dss_device cm_t35_lcd_device = { | 201 | static struct omap_dss_device cm_t35_lcd_device = { |
@@ -258,8 +224,6 @@ static struct omap_dss_device cm_t35_tv_device = { | |||
258 | .driver_name = "venc", | 224 | .driver_name = "venc", |
259 | .type = OMAP_DISPLAY_TYPE_VENC, | 225 | .type = OMAP_DISPLAY_TYPE_VENC, |
260 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 226 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
261 | .platform_enable = cm_t35_panel_enable_tv, | ||
262 | .platform_disable = cm_t35_panel_disable_tv, | ||
263 | }; | 227 | }; |
264 | 228 | ||
265 | static struct omap_dss_device *cm_t35_dss_devices[] = { | 229 | static struct omap_dss_device *cm_t35_dss_devices[] = { |
@@ -293,11 +257,6 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = { | |||
293 | }, | 257 | }, |
294 | }; | 258 | }; |
295 | 259 | ||
296 | static struct gpio cm_t35_dss_gpios[] __initdata = { | ||
297 | { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, | ||
298 | { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, | ||
299 | }; | ||
300 | |||
301 | static void __init cm_t35_init_display(void) | 260 | static void __init cm_t35_init_display(void) |
302 | { | 261 | { |
303 | int err; | 262 | int err; |
@@ -305,23 +264,21 @@ static void __init cm_t35_init_display(void) | |||
305 | spi_register_board_info(cm_t35_lcd_spi_board_info, | 264 | spi_register_board_info(cm_t35_lcd_spi_board_info, |
306 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); | 265 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); |
307 | 266 | ||
308 | err = gpio_request_array(cm_t35_dss_gpios, | 267 | |
309 | ARRAY_SIZE(cm_t35_dss_gpios)); | 268 | err = gpio_request_one(CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, |
269 | "lcd bl enable"); | ||
310 | if (err) { | 270 | if (err) { |
311 | pr_err("CM-T35: failed to request DSS control GPIOs\n"); | 271 | pr_err("CM-T35: failed to request LCD EN GPIO\n"); |
312 | return; | 272 | return; |
313 | } | 273 | } |
314 | 274 | ||
315 | gpio_export(CM_T35_LCD_EN_GPIO, 0); | ||
316 | gpio_export(CM_T35_LCD_BL_GPIO, 0); | ||
317 | |||
318 | msleep(50); | 275 | msleep(50); |
319 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); | 276 | gpio_set_value(CM_T35_LCD_EN_GPIO, 1); |
320 | 277 | ||
321 | err = omap_display_init(&cm_t35_dss_data); | 278 | err = omap_display_init(&cm_t35_dss_data); |
322 | if (err) { | 279 | if (err) { |
323 | pr_err("CM-T35: failed to register DSS device\n"); | 280 | pr_err("CM-T35: failed to register DSS device\n"); |
324 | gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios)); | 281 | gpio_free(CM_T35_LCD_EN_GPIO); |
325 | } | 282 | } |
326 | } | 283 | } |
327 | 284 | ||
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c index 42fbf1ef12a9..576420544178 100644 --- a/arch/arm/mach-omap2/board-devkit8000.c +++ b/arch/arm/mach-omap2/board-devkit8000.c | |||
@@ -43,8 +43,7 @@ | |||
43 | #include "gpmc.h" | 43 | #include "gpmc.h" |
44 | #include <linux/platform_data/mtd-nand-omap2.h> | 44 | #include <linux/platform_data/mtd-nand-omap2.h> |
45 | #include <video/omapdss.h> | 45 | #include <video/omapdss.h> |
46 | #include <video/omap-panel-generic-dpi.h> | 46 | #include <video/omap-panel-data.h> |
47 | #include <video/omap-panel-tfp410.h> | ||
48 | 47 | ||
49 | #include <linux/platform_data/spi-omap2-mcspi.h> | 48 | #include <linux/platform_data/spi-omap2-mcspi.h> |
50 | #include <linux/input/matrix_keypad.h> | 49 | #include <linux/input/matrix_keypad.h> |
@@ -104,19 +103,6 @@ static struct omap2_hsmmc_info mmc[] = { | |||
104 | {} /* Terminator */ | 103 | {} /* Terminator */ |
105 | }; | 104 | }; |
106 | 105 | ||
107 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
108 | { | ||
109 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
110 | gpio_set_value_cansleep(dssdev->reset_gpio, 1); | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
115 | { | ||
116 | if (gpio_is_valid(dssdev->reset_gpio)) | ||
117 | gpio_set_value_cansleep(dssdev->reset_gpio, 0); | ||
118 | } | ||
119 | |||
120 | static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { | 106 | static struct regulator_consumer_supply devkit8000_vmmc1_supply[] = { |
121 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), | 107 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"), |
122 | }; | 108 | }; |
@@ -128,8 +114,7 @@ static struct regulator_consumer_supply devkit8000_vio_supply[] = { | |||
128 | 114 | ||
129 | static struct panel_generic_dpi_data lcd_panel = { | 115 | static struct panel_generic_dpi_data lcd_panel = { |
130 | .name = "innolux_at070tn83", | 116 | .name = "innolux_at070tn83", |
131 | .platform_enable = devkit8000_panel_enable_lcd, | 117 | /* gpios filled in code */ |
132 | .platform_disable = devkit8000_panel_disable_lcd, | ||
133 | }; | 118 | }; |
134 | 119 | ||
135 | static struct omap_dss_device devkit8000_lcd_device = { | 120 | static struct omap_dss_device devkit8000_lcd_device = { |
@@ -211,8 +196,6 @@ static struct gpio_led gpio_leds[]; | |||
211 | static int devkit8000_twl_gpio_setup(struct device *dev, | 196 | static int devkit8000_twl_gpio_setup(struct device *dev, |
212 | unsigned gpio, unsigned ngpio) | 197 | unsigned gpio, unsigned ngpio) |
213 | { | 198 | { |
214 | int ret; | ||
215 | |||
216 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 199 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
217 | mmc[0].gpio_cd = gpio + 0; | 200 | mmc[0].gpio_cd = gpio + 0; |
218 | omap_hsmmc_late_init(mmc); | 201 | omap_hsmmc_late_init(mmc); |
@@ -221,13 +204,8 @@ static int devkit8000_twl_gpio_setup(struct device *dev, | |||
221 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 204 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
222 | 205 | ||
223 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ | 206 | /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ |
224 | devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; | 207 | lcd_panel.num_gpios = 1; |
225 | ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, | 208 | lcd_panel.gpios[0] = gpio + TWL4030_GPIO_MAX + 0; |
226 | GPIOF_OUT_INIT_LOW, "LCD_PWREN"); | ||
227 | if (ret < 0) { | ||
228 | devkit8000_lcd_device.reset_gpio = -EINVAL; | ||
229 | printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); | ||
230 | } | ||
231 | 209 | ||
232 | /* gpio + 7 is "DVI_PD" (out, active low) */ | 210 | /* gpio + 7 is "DVI_PD" (out, active low) */ |
233 | dvi_panel.power_down_gpio = gpio + 7; | 211 | dvi_panel.power_down_gpio = gpio + 7; |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 5b4ec51c385f..69c0acf5aa63 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
35 | 35 | ||
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | #include <video/omap-panel-generic-dpi.h> | 37 | #include <video/omap-panel-data.h> |
38 | 38 | ||
39 | #include "common.h" | 39 | #include "common.h" |
40 | #include "mux.h" | 40 | #include "mux.h" |
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 95ccec0eeab9..b54562d1235e 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <video/omap-panel-tfp410.h> | 34 | #include <video/omap-panel-data.h> |
35 | #include <linux/platform_data/mtd-onenand-omap2.h> | 35 | #include <linux/platform_data/mtd-onenand-omap2.h> |
36 | 36 | ||
37 | #include "common.h" | 37 | #include "common.h" |
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c index b12fe966a7b9..d0d17bc58d9b 100644 --- a/arch/arm/mach-omap2/board-ldp.c +++ b/arch/arm/mach-omap2/board-ldp.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "gpmc-smsc911x.h" | 41 | #include "gpmc-smsc911x.h" |
42 | 42 | ||
43 | #include <video/omapdss.h> | 43 | #include <video/omapdss.h> |
44 | #include <video/omap-panel-generic-dpi.h> | 44 | #include <video/omap-panel-data.h> |
45 | 45 | ||
46 | #include "board-flash.h" | 46 | #include "board-flash.h" |
47 | #include "mux.h" | 47 | #include "mux.h" |
@@ -181,34 +181,13 @@ static inline void __init ldp_init_smsc911x(void) | |||
181 | 181 | ||
182 | /* LCD */ | 182 | /* LCD */ |
183 | 183 | ||
184 | static int ldp_backlight_gpio; | ||
185 | static int ldp_lcd_enable_gpio; | ||
186 | |||
187 | #define LCD_PANEL_RESET_GPIO 55 | 184 | #define LCD_PANEL_RESET_GPIO 55 |
188 | #define LCD_PANEL_QVGA_GPIO 56 | 185 | #define LCD_PANEL_QVGA_GPIO 56 |
189 | 186 | ||
190 | static int ldp_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
191 | { | ||
192 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
193 | gpio_direction_output(ldp_lcd_enable_gpio, 1); | ||
194 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
195 | gpio_direction_output(ldp_backlight_gpio, 1); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void ldp_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
201 | { | ||
202 | if (gpio_is_valid(ldp_lcd_enable_gpio)) | ||
203 | gpio_direction_output(ldp_lcd_enable_gpio, 0); | ||
204 | if (gpio_is_valid(ldp_backlight_gpio)) | ||
205 | gpio_direction_output(ldp_backlight_gpio, 0); | ||
206 | } | ||
207 | |||
208 | static struct panel_generic_dpi_data ldp_panel_data = { | 187 | static struct panel_generic_dpi_data ldp_panel_data = { |
209 | .name = "nec_nl2432dr22-11b", | 188 | .name = "nec_nl2432dr22-11b", |
210 | .platform_enable = ldp_panel_enable_lcd, | 189 | .num_gpios = 4, |
211 | .platform_disable = ldp_panel_disable_lcd, | 190 | /* gpios filled in code */ |
212 | }; | 191 | }; |
213 | 192 | ||
214 | static struct omap_dss_device ldp_lcd_device = { | 193 | static struct omap_dss_device ldp_lcd_device = { |
@@ -231,41 +210,19 @@ static struct omap_dss_board_info ldp_dss_data = { | |||
231 | 210 | ||
232 | static void __init ldp_display_init(void) | 211 | static void __init ldp_display_init(void) |
233 | { | 212 | { |
234 | int r; | 213 | ldp_panel_data.gpios[2] = LCD_PANEL_RESET_GPIO; |
235 | 214 | ldp_panel_data.gpios[3] = LCD_PANEL_QVGA_GPIO; | |
236 | static struct gpio gpios[] __initdata = { | ||
237 | {LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "LCD RESET"}, | ||
238 | {LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "LCD QVGA"}, | ||
239 | }; | ||
240 | |||
241 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
242 | if (r) { | ||
243 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
244 | return; | ||
245 | } | ||
246 | 215 | ||
247 | omap_display_init(&ldp_dss_data); | 216 | omap_display_init(&ldp_dss_data); |
248 | } | 217 | } |
249 | 218 | ||
250 | static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) | 219 | static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) |
251 | { | 220 | { |
252 | int r; | 221 | ldp_panel_data.gpios[0] = gpio + 7; |
253 | 222 | ldp_panel_data.gpio_invert[0] = true; | |
254 | struct gpio gpios[] = { | 223 | |
255 | {gpio + 7 , GPIOF_OUT_INIT_LOW, "LCD ENABLE"}, | 224 | ldp_panel_data.gpios[1] = gpio + 15; |
256 | {gpio + 15, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT"}, | 225 | ldp_panel_data.gpio_invert[1] = true; |
257 | }; | ||
258 | |||
259 | r = gpio_request_array(gpios, ARRAY_SIZE(gpios)); | ||
260 | if (r) { | ||
261 | pr_err("Cannot request LCD GPIOs, error %d\n", r); | ||
262 | ldp_backlight_gpio = -EINVAL; | ||
263 | ldp_lcd_enable_gpio = -EINVAL; | ||
264 | return r; | ||
265 | } | ||
266 | |||
267 | ldp_backlight_gpio = gpio + 15; | ||
268 | ldp_lcd_enable_gpio = gpio + 7; | ||
269 | 226 | ||
270 | return 0; | 227 | return 0; |
271 | } | 228 | } |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 6955a428f534..6de78605c0af 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <asm/mach/flash.h> | 44 | #include <asm/mach/flash.h> |
45 | 45 | ||
46 | #include <video/omapdss.h> | 46 | #include <video/omapdss.h> |
47 | #include <video/omap-panel-tfp410.h> | 47 | #include <video/omap-panel-data.h> |
48 | #include <linux/platform_data/mtd-nand-omap2.h> | 48 | #include <linux/platform_data/mtd-nand-omap2.h> |
49 | 49 | ||
50 | #include "common.h" | 50 | #include "common.h" |
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 2de92facc8a3..f76d0de7b406 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include "common.h" | 51 | #include "common.h" |
52 | #include <linux/platform_data/spi-omap2-mcspi.h> | 52 | #include <linux/platform_data/spi-omap2-mcspi.h> |
53 | #include <video/omapdss.h> | 53 | #include <video/omapdss.h> |
54 | #include <video/omap-panel-tfp410.h> | 54 | #include <video/omap-panel-data.h> |
55 | 55 | ||
56 | #include "soc.h" | 56 | #include "soc.h" |
57 | #include "mux.h" | 57 | #include "mux.h" |
@@ -155,61 +155,43 @@ static inline void __init omap3evm_init_smsc911x(void) { return; } | |||
155 | #define OMAP3EVM_LCD_PANEL_LR 2 | 155 | #define OMAP3EVM_LCD_PANEL_LR 2 |
156 | #define OMAP3EVM_LCD_PANEL_UD 3 | 156 | #define OMAP3EVM_LCD_PANEL_UD 3 |
157 | #define OMAP3EVM_LCD_PANEL_INI 152 | 157 | #define OMAP3EVM_LCD_PANEL_INI 152 |
158 | #define OMAP3EVM_LCD_PANEL_ENVDD 153 | ||
159 | #define OMAP3EVM_LCD_PANEL_QVGA 154 | 158 | #define OMAP3EVM_LCD_PANEL_QVGA 154 |
160 | #define OMAP3EVM_LCD_PANEL_RESB 155 | 159 | #define OMAP3EVM_LCD_PANEL_RESB 155 |
160 | |||
161 | #define OMAP3EVM_LCD_PANEL_ENVDD 153 | ||
161 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 | 162 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 |
163 | |||
164 | /* | ||
165 | * OMAP3EVM DVI control signals | ||
166 | */ | ||
162 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 | 167 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 |
163 | 168 | ||
164 | static struct gpio omap3_evm_dss_gpios[] __initdata = { | 169 | static struct panel_sharp_ls037v7dw01_data omap3_evm_lcd_data = { |
165 | { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" }, | 170 | .resb_gpio = OMAP3EVM_LCD_PANEL_RESB, |
166 | { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" }, | 171 | .ini_gpio = OMAP3EVM_LCD_PANEL_INI, |
167 | { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" }, | 172 | .mo_gpio = OMAP3EVM_LCD_PANEL_QVGA, |
168 | { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" }, | 173 | .lr_gpio = OMAP3EVM_LCD_PANEL_LR, |
169 | { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" }, | 174 | .ud_gpio = OMAP3EVM_LCD_PANEL_UD, |
170 | { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" }, | ||
171 | }; | 175 | }; |
172 | 176 | ||
173 | static int lcd_enabled; | ||
174 | static int dvi_enabled; | ||
175 | |||
176 | static void __init omap3_evm_display_init(void) | 177 | static void __init omap3_evm_display_init(void) |
177 | { | 178 | { |
178 | int r; | 179 | int r; |
179 | 180 | ||
180 | r = gpio_request_array(omap3_evm_dss_gpios, | 181 | r = gpio_request_one(OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, |
181 | ARRAY_SIZE(omap3_evm_dss_gpios)); | 182 | "lcd_panel_envdd"); |
182 | if (r) | 183 | if (r) |
183 | printk(KERN_ERR "failed to get lcd_panel_* gpios\n"); | 184 | pr_err("failed to get lcd_panel_envdd GPIO\n"); |
184 | } | ||
185 | 185 | ||
186 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) | 186 | r = gpio_request_one(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, |
187 | { | 187 | GPIOF_OUT_INIT_LOW, "lcd_panel_bklight"); |
188 | if (dvi_enabled) { | 188 | if (r) |
189 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | 189 | pr_err("failed to get lcd_panel_bklight GPIO\n"); |
190 | return -EINVAL; | ||
191 | } | ||
192 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0); | ||
193 | 190 | ||
194 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) | 191 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) |
195 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); | 192 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); |
196 | else | 193 | else |
197 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); | 194 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); |
198 | |||
199 | lcd_enabled = 1; | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev) | ||
204 | { | ||
205 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1); | ||
206 | |||
207 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) | ||
208 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); | ||
209 | else | ||
210 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); | ||
211 | |||
212 | lcd_enabled = 0; | ||
213 | } | 195 | } |
214 | 196 | ||
215 | static struct omap_dss_device omap3_evm_lcd_device = { | 197 | static struct omap_dss_device omap3_evm_lcd_device = { |
@@ -217,26 +199,14 @@ static struct omap_dss_device omap3_evm_lcd_device = { | |||
217 | .driver_name = "sharp_ls_panel", | 199 | .driver_name = "sharp_ls_panel", |
218 | .type = OMAP_DISPLAY_TYPE_DPI, | 200 | .type = OMAP_DISPLAY_TYPE_DPI, |
219 | .phy.dpi.data_lines = 18, | 201 | .phy.dpi.data_lines = 18, |
220 | .platform_enable = omap3_evm_enable_lcd, | 202 | .data = &omap3_evm_lcd_data, |
221 | .platform_disable = omap3_evm_disable_lcd, | ||
222 | }; | 203 | }; |
223 | 204 | ||
224 | static int omap3_evm_enable_tv(struct omap_dss_device *dssdev) | ||
225 | { | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | static void omap3_evm_disable_tv(struct omap_dss_device *dssdev) | ||
230 | { | ||
231 | } | ||
232 | |||
233 | static struct omap_dss_device omap3_evm_tv_device = { | 205 | static struct omap_dss_device omap3_evm_tv_device = { |
234 | .name = "tv", | 206 | .name = "tv", |
235 | .driver_name = "venc", | 207 | .driver_name = "venc", |
236 | .type = OMAP_DISPLAY_TYPE_VENC, | 208 | .type = OMAP_DISPLAY_TYPE_VENC, |
237 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 209 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
238 | .platform_enable = omap3_evm_enable_tv, | ||
239 | .platform_disable = omap3_evm_disable_tv, | ||
240 | }; | 210 | }; |
241 | 211 | ||
242 | static struct tfp410_platform_data dvi_panel = { | 212 | static struct tfp410_platform_data dvi_panel = { |
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 1004d2aaa68f..28133d5b4fed 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include "common.h" | 45 | #include "common.h" |
46 | #include <video/omapdss.h> | 46 | #include <video/omapdss.h> |
47 | #include <video/omap-panel-data.h> | ||
47 | #include <linux/platform_data/mtd-nand-omap2.h> | 48 | #include <linux/platform_data/mtd-nand-omap2.h> |
48 | 49 | ||
49 | #include "mux.h" | 50 | #include "mux.h" |
@@ -230,12 +231,16 @@ static struct twl4030_keypad_data pandora_kp_data = { | |||
230 | .rep = 1, | 231 | .rep = 1, |
231 | }; | 232 | }; |
232 | 233 | ||
234 | static struct panel_tpo_td043_data lcd_data = { | ||
235 | .nreset_gpio = 157, | ||
236 | }; | ||
237 | |||
233 | static struct omap_dss_device pandora_lcd_device = { | 238 | static struct omap_dss_device pandora_lcd_device = { |
234 | .name = "lcd", | 239 | .name = "lcd", |
235 | .driver_name = "tpo_td043mtea1_panel", | 240 | .driver_name = "tpo_td043mtea1_panel", |
236 | .type = OMAP_DISPLAY_TYPE_DPI, | 241 | .type = OMAP_DISPLAY_TYPE_DPI, |
237 | .phy.dpi.data_lines = 24, | 242 | .phy.dpi.data_lines = 24, |
238 | .reset_gpio = 157, | 243 | .data = &lcd_data, |
239 | }; | 244 | }; |
240 | 245 | ||
241 | static struct omap_dss_device pandora_tv_device = { | 246 | static struct omap_dss_device pandora_tv_device = { |
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c index bf0956489899..d37e6b187ae4 100644 --- a/arch/arm/mach-omap2/board-omap3stalker.c +++ b/arch/arm/mach-omap2/board-omap3stalker.c | |||
@@ -44,8 +44,7 @@ | |||
44 | #include "gpmc.h" | 44 | #include "gpmc.h" |
45 | #include <linux/platform_data/mtd-nand-omap2.h> | 45 | #include <linux/platform_data/mtd-nand-omap2.h> |
46 | #include <video/omapdss.h> | 46 | #include <video/omapdss.h> |
47 | #include <video/omap-panel-generic-dpi.h> | 47 | #include <video/omap-panel-data.h> |
48 | #include <video/omap-panel-tfp410.h> | ||
49 | 48 | ||
50 | #include <linux/platform_data/spi-omap2-mcspi.h> | 49 | #include <linux/platform_data/spi-omap2-mcspi.h> |
51 | 50 | ||
@@ -95,15 +94,6 @@ static void __init omap3_stalker_display_init(void) | |||
95 | return; | 94 | return; |
96 | } | 95 | } |
97 | 96 | ||
98 | static int omap3_stalker_enable_tv(struct omap_dss_device *dssdev) | ||
99 | { | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static void omap3_stalker_disable_tv(struct omap_dss_device *dssdev) | ||
104 | { | ||
105 | } | ||
106 | |||
107 | static struct omap_dss_device omap3_stalker_tv_device = { | 97 | static struct omap_dss_device omap3_stalker_tv_device = { |
108 | .name = "tv", | 98 | .name = "tv", |
109 | .driver_name = "venc", | 99 | .driver_name = "venc", |
@@ -113,8 +103,6 @@ static struct omap_dss_device omap3_stalker_tv_device = { | |||
113 | #elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE) | 103 | #elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE) |
114 | .u.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE, | 104 | .u.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE, |
115 | #endif | 105 | #endif |
116 | .platform_enable = omap3_stalker_enable_tv, | ||
117 | .platform_disable = omap3_stalker_disable_tv, | ||
118 | }; | 106 | }; |
119 | 107 | ||
120 | static struct tfp410_platform_data dvi_panel = { | 108 | static struct tfp410_platform_data dvi_panel = { |
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index ab79a4422bcc..4ca6b680aa72 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c | |||
@@ -47,8 +47,7 @@ | |||
47 | #include <asm/mach/map.h> | 47 | #include <asm/mach/map.h> |
48 | 48 | ||
49 | #include <video/omapdss.h> | 49 | #include <video/omapdss.h> |
50 | #include <video/omap-panel-generic-dpi.h> | 50 | #include <video/omap-panel-data.h> |
51 | #include <video/omap-panel-tfp410.h> | ||
52 | 51 | ||
53 | #include "common.h" | 52 | #include "common.h" |
54 | #include "mux.h" | 53 | #include "mux.h" |
@@ -146,28 +145,9 @@ static inline void __init overo_init_smsc911x(void) { return; } | |||
146 | #endif | 145 | #endif |
147 | 146 | ||
148 | /* DSS */ | 147 | /* DSS */ |
149 | static int lcd_enabled; | ||
150 | static int dvi_enabled; | ||
151 | |||
152 | #define OVERO_GPIO_LCD_EN 144 | 148 | #define OVERO_GPIO_LCD_EN 144 |
153 | #define OVERO_GPIO_LCD_BL 145 | 149 | #define OVERO_GPIO_LCD_BL 145 |
154 | 150 | ||
155 | static struct gpio overo_dss_gpios[] __initdata = { | ||
156 | { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" }, | ||
157 | { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" }, | ||
158 | }; | ||
159 | |||
160 | static void __init overo_display_init(void) | ||
161 | { | ||
162 | if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) { | ||
163 | printk(KERN_ERR "could not obtain DSS control GPIOs\n"); | ||
164 | return; | ||
165 | } | ||
166 | |||
167 | gpio_export(OVERO_GPIO_LCD_EN, 0); | ||
168 | gpio_export(OVERO_GPIO_LCD_BL, 0); | ||
169 | } | ||
170 | |||
171 | static struct tfp410_platform_data dvi_panel = { | 151 | static struct tfp410_platform_data dvi_panel = { |
172 | .i2c_bus_num = 3, | 152 | .i2c_bus_num = 3, |
173 | .power_down_gpio = -1, | 153 | .power_down_gpio = -1, |
@@ -188,30 +168,13 @@ static struct omap_dss_device overo_tv_device = { | |||
188 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 168 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
189 | }; | 169 | }; |
190 | 170 | ||
191 | static int overo_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
192 | { | ||
193 | if (dvi_enabled) { | ||
194 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
195 | return -EINVAL; | ||
196 | } | ||
197 | |||
198 | gpio_set_value(OVERO_GPIO_LCD_EN, 1); | ||
199 | gpio_set_value(OVERO_GPIO_LCD_BL, 1); | ||
200 | lcd_enabled = 1; | ||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void overo_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
205 | { | ||
206 | gpio_set_value(OVERO_GPIO_LCD_EN, 0); | ||
207 | gpio_set_value(OVERO_GPIO_LCD_BL, 0); | ||
208 | lcd_enabled = 0; | ||
209 | } | ||
210 | |||
211 | static struct panel_generic_dpi_data lcd43_panel = { | 171 | static struct panel_generic_dpi_data lcd43_panel = { |
212 | .name = "samsung_lte430wq_f0c", | 172 | .name = "samsung_lte430wq_f0c", |
213 | .platform_enable = overo_panel_enable_lcd, | 173 | .num_gpios = 2, |
214 | .platform_disable = overo_panel_disable_lcd, | 174 | .gpios = { |
175 | OVERO_GPIO_LCD_EN, | ||
176 | OVERO_GPIO_LCD_BL | ||
177 | }, | ||
215 | }; | 178 | }; |
216 | 179 | ||
217 | static struct omap_dss_device overo_lcd43_device = { | 180 | static struct omap_dss_device overo_lcd43_device = { |
@@ -224,13 +187,20 @@ static struct omap_dss_device overo_lcd43_device = { | |||
224 | 187 | ||
225 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ | 188 | #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ |
226 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) | 189 | defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) |
190 | static struct panel_generic_dpi_data lcd35_panel = { | ||
191 | .num_gpios = 2, | ||
192 | .gpios = { | ||
193 | OVERO_GPIO_LCD_EN, | ||
194 | OVERO_GPIO_LCD_BL | ||
195 | }, | ||
196 | }; | ||
197 | |||
227 | static struct omap_dss_device overo_lcd35_device = { | 198 | static struct omap_dss_device overo_lcd35_device = { |
228 | .type = OMAP_DISPLAY_TYPE_DPI, | 199 | .type = OMAP_DISPLAY_TYPE_DPI, |
229 | .name = "lcd35", | 200 | .name = "lcd35", |
230 | .driver_name = "lgphilips_lb035q02_panel", | 201 | .driver_name = "lgphilips_lb035q02_panel", |
231 | .phy.dpi.data_lines = 24, | 202 | .phy.dpi.data_lines = 24, |
232 | .platform_enable = overo_panel_enable_lcd, | 203 | .data = &lcd35_panel, |
233 | .platform_disable = overo_panel_disable_lcd, | ||
234 | }; | 204 | }; |
235 | #endif | 205 | #endif |
236 | 206 | ||
@@ -509,7 +479,6 @@ static void __init overo_init(void) | |||
509 | usbhs_init(&usbhs_bdata); | 479 | usbhs_init(&usbhs_bdata); |
510 | overo_spi_init(); | 480 | overo_spi_init(); |
511 | overo_init_smsc911x(); | 481 | overo_init_smsc911x(); |
512 | overo_display_init(); | ||
513 | overo_init_led(); | 482 | overo_init_led(); |
514 | overo_init_keys(); | 483 | overo_init_keys(); |
515 | omap_twl4030_audio_init("overo", NULL); | 484 | omap_twl4030_audio_init("overo", NULL); |
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index 3a077df6b8df..1a884670a6c4 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c | |||
@@ -547,12 +547,16 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = { | |||
547 | REGULATOR_SUPPLY("DVDD", "2-0019"), | 547 | REGULATOR_SUPPLY("DVDD", "2-0019"), |
548 | /* Si4713 IO supply */ | 548 | /* Si4713 IO supply */ |
549 | REGULATOR_SUPPLY("vio", "2-0063"), | 549 | REGULATOR_SUPPLY("vio", "2-0063"), |
550 | /* lis3lv02d */ | ||
551 | REGULATOR_SUPPLY("Vdd_IO", "3-001d"), | ||
550 | }; | 552 | }; |
551 | 553 | ||
552 | static struct regulator_consumer_supply rx51_vaux1_consumers[] = { | 554 | static struct regulator_consumer_supply rx51_vaux1_consumers[] = { |
553 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), | 555 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), |
554 | /* Si4713 supply */ | 556 | /* Si4713 supply */ |
555 | REGULATOR_SUPPLY("vdd", "2-0063"), | 557 | REGULATOR_SUPPLY("vdd", "2-0063"), |
558 | /* lis3lv02d */ | ||
559 | REGULATOR_SUPPLY("Vdd", "3-001d"), | ||
556 | }; | 560 | }; |
557 | 561 | ||
558 | static struct regulator_init_data rx51_vaux1 = { | 562 | static struct regulator_init_data rx51_vaux1 = { |
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c index eb667261df08..bd74f9f6063b 100644 --- a/arch/arm/mach-omap2/board-rx51-video.c +++ b/arch/arm/mach-omap2/board-rx51-video.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
18 | #include <video/omapdss.h> | 18 | #include <video/omapdss.h> |
19 | #include <video/omap-panel-data.h> | ||
20 | |||
19 | #include <linux/platform_data/spi-omap2-mcspi.h> | 21 | #include <linux/platform_data/spi-omap2-mcspi.h> |
20 | 22 | ||
21 | #include "soc.h" | 23 | #include "soc.h" |
@@ -27,25 +29,16 @@ | |||
27 | 29 | ||
28 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) | 30 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
29 | 31 | ||
30 | static int rx51_lcd_enable(struct omap_dss_device *dssdev) | 32 | static struct panel_acx565akm_data lcd_data = { |
31 | { | 33 | .reset_gpio = RX51_LCD_RESET_GPIO, |
32 | gpio_set_value(dssdev->reset_gpio, 1); | 34 | }; |
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static void rx51_lcd_disable(struct omap_dss_device *dssdev) | ||
37 | { | ||
38 | gpio_set_value(dssdev->reset_gpio, 0); | ||
39 | } | ||
40 | 35 | ||
41 | static struct omap_dss_device rx51_lcd_device = { | 36 | static struct omap_dss_device rx51_lcd_device = { |
42 | .name = "lcd", | 37 | .name = "lcd", |
43 | .driver_name = "panel-acx565akm", | 38 | .driver_name = "panel-acx565akm", |
44 | .type = OMAP_DISPLAY_TYPE_SDI, | 39 | .type = OMAP_DISPLAY_TYPE_SDI, |
45 | .phy.sdi.datapairs = 2, | 40 | .phy.sdi.datapairs = 2, |
46 | .reset_gpio = RX51_LCD_RESET_GPIO, | 41 | .data = &lcd_data, |
47 | .platform_enable = rx51_lcd_enable, | ||
48 | .platform_disable = rx51_lcd_disable, | ||
49 | }; | 42 | }; |
50 | 43 | ||
51 | static struct omap_dss_device rx51_tv_device = { | 44 | static struct omap_dss_device rx51_tv_device = { |
@@ -76,13 +69,8 @@ static int __init rx51_video_init(void) | |||
76 | return 0; | 69 | return 0; |
77 | } | 70 | } |
78 | 71 | ||
79 | if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH, | ||
80 | "LCD ACX565AKM reset")) { | ||
81 | pr_err("%s failed to get LCD Reset GPIO\n", __func__); | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | omap_display_init(&rx51_dss_board_info); | 72 | omap_display_init(&rx51_dss_board_info); |
73 | |||
86 | return 0; | 74 | return 0; |
87 | } | 75 | } |
88 | 76 | ||
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c index 8cef477d6b00..c2a079cb76fc 100644 --- a/arch/arm/mach-omap2/board-zoom-display.c +++ b/arch/arm/mach-omap2/board-zoom-display.c | |||
@@ -12,12 +12,12 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/gpio.h> | 14 | #include <linux/gpio.h> |
15 | #include <linux/i2c/twl.h> | ||
16 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
17 | #include <linux/platform_data/spi-omap2-mcspi.h> | 16 | #include <linux/platform_data/spi-omap2-mcspi.h> |
18 | #include <video/omapdss.h> | 17 | #include <video/omapdss.h> |
19 | #include "board-zoom.h" | 18 | #include <video/omap-panel-data.h> |
20 | 19 | ||
20 | #include "board-zoom.h" | ||
21 | #include "soc.h" | 21 | #include "soc.h" |
22 | #include "common.h" | 22 | #include "common.h" |
23 | 23 | ||
@@ -25,92 +25,17 @@ | |||
25 | #define LCD_PANEL_RESET_GPIO_PILOT 55 | 25 | #define LCD_PANEL_RESET_GPIO_PILOT 55 |
26 | #define LCD_PANEL_QVGA_GPIO 56 | 26 | #define LCD_PANEL_QVGA_GPIO 56 |
27 | 27 | ||
28 | static struct gpio zoom_lcd_gpios[] __initdata = { | 28 | static struct panel_nec_nl8048_data zoom_lcd_data = { |
29 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" }, | 29 | /* res_gpio filled in code */ |
30 | { LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "lcd qvga" }, | 30 | .qvga_gpio = LCD_PANEL_QVGA_GPIO, |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static void __init zoom_lcd_panel_init(void) | ||
34 | { | ||
35 | zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? | ||
36 | LCD_PANEL_RESET_GPIO_PROD : | ||
37 | LCD_PANEL_RESET_GPIO_PILOT; | ||
38 | |||
39 | if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios))) | ||
40 | pr_err("%s: Failed to get LCD GPIOs.\n", __func__); | ||
41 | } | ||
42 | |||
43 | static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
44 | { | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | /* Register offsets in TWL4030_MODULE_INTBR */ | ||
53 | #define TWL_INTBR_PMBR1 0xD | ||
54 | #define TWL_INTBR_GPBR1 0xC | ||
55 | |||
56 | /* Register offsets in TWL_MODULE_PWM */ | ||
57 | #define TWL_LED_PWMON 0x3 | ||
58 | #define TWL_LED_PWMOFF 0x4 | ||
59 | |||
60 | static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level) | ||
61 | { | ||
62 | #ifdef CONFIG_TWL4030_CORE | ||
63 | unsigned char c; | ||
64 | u8 mux_pwm, enb_pwm; | ||
65 | |||
66 | if (level > 100) | ||
67 | return -1; | ||
68 | |||
69 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &mux_pwm, TWL_INTBR_PMBR1); | ||
70 | twl_i2c_read_u8(TWL4030_MODULE_INTBR, &enb_pwm, TWL_INTBR_GPBR1); | ||
71 | |||
72 | if (level == 0) { | ||
73 | /* disable pwm1 output and clock */ | ||
74 | enb_pwm = enb_pwm & 0xF5; | ||
75 | /* change pwm1 pin to gpio pin */ | ||
76 | mux_pwm = mux_pwm & 0xCF; | ||
77 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
78 | enb_pwm, TWL_INTBR_GPBR1); | ||
79 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
80 | mux_pwm, TWL_INTBR_PMBR1); | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) { | ||
85 | /* change gpio pin to pwm1 pin */ | ||
86 | mux_pwm = mux_pwm | 0x30; | ||
87 | /* enable pwm1 output and clock*/ | ||
88 | enb_pwm = enb_pwm | 0x0A; | ||
89 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
90 | mux_pwm, TWL_INTBR_PMBR1); | ||
91 | twl_i2c_write_u8(TWL4030_MODULE_INTBR, | ||
92 | enb_pwm, TWL_INTBR_GPBR1); | ||
93 | } | ||
94 | |||
95 | c = ((50 * (100 - level)) / 100) + 1; | ||
96 | twl_i2c_write_u8(TWL_MODULE_PWM, 0x7F, TWL_LED_PWMOFF); | ||
97 | twl_i2c_write_u8(TWL_MODULE_PWM, c, TWL_LED_PWMON); | ||
98 | #else | ||
99 | pr_warn("Backlight not enabled\n"); | ||
100 | #endif | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static struct omap_dss_device zoom_lcd_device = { | 33 | static struct omap_dss_device zoom_lcd_device = { |
106 | .name = "lcd", | 34 | .name = "lcd", |
107 | .driver_name = "NEC_8048_panel", | 35 | .driver_name = "NEC_8048_panel", |
108 | .type = OMAP_DISPLAY_TYPE_DPI, | 36 | .type = OMAP_DISPLAY_TYPE_DPI, |
109 | .phy.dpi.data_lines = 24, | 37 | .phy.dpi.data_lines = 24, |
110 | .platform_enable = zoom_panel_enable_lcd, | 38 | .data = &zoom_lcd_data, |
111 | .platform_disable = zoom_panel_disable_lcd, | ||
112 | .max_backlight_level = 100, | ||
113 | .set_backlight = zoom_set_bl_intensity, | ||
114 | }; | 39 | }; |
115 | 40 | ||
116 | static struct omap_dss_device *zoom_dss_devices[] = { | 41 | static struct omap_dss_device *zoom_dss_devices[] = { |
@@ -123,6 +48,13 @@ static struct omap_dss_board_info zoom_dss_data = { | |||
123 | .default_device = &zoom_lcd_device, | 48 | .default_device = &zoom_lcd_device, |
124 | }; | 49 | }; |
125 | 50 | ||
51 | static void __init zoom_lcd_panel_init(void) | ||
52 | { | ||
53 | zoom_lcd_data.res_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? | ||
54 | LCD_PANEL_RESET_GPIO_PROD : | ||
55 | LCD_PANEL_RESET_GPIO_PILOT; | ||
56 | } | ||
57 | |||
126 | static struct omap2_mcspi_device_config dss_lcd_mcspi_config = { | 58 | static struct omap2_mcspi_device_config dss_lcd_mcspi_config = { |
127 | .turbo_mode = 1, | 59 | .turbo_mode = 1, |
128 | }; | 60 | }; |
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index cdc0c1021863..a90375d5b2b6 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #include <linux/platform_data/gpio-omap.h> | 22 | #include <linux/platform_data/gpio-omap.h> |
23 | #include <linux/platform_data/omap-twl4030.h> | 23 | #include <linux/platform_data/omap-twl4030.h> |
24 | #include <linux/usb/phy.h> | 24 | #include <linux/usb/phy.h> |
25 | #include <linux/pwm.h> | ||
26 | #include <linux/leds_pwm.h> | ||
27 | #include <linux/pwm_backlight.h> | ||
25 | 28 | ||
26 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
27 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
@@ -193,6 +196,53 @@ static struct platform_device omap_vwlan_device = { | |||
193 | }, | 196 | }, |
194 | }; | 197 | }; |
195 | 198 | ||
199 | static struct pwm_lookup zoom_pwm_lookup[] = { | ||
200 | PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "zoom::keypad"), | ||
201 | PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", "backlight"), | ||
202 | }; | ||
203 | |||
204 | static struct led_pwm zoom_pwm_leds[] = { | ||
205 | { | ||
206 | .name = "zoom::keypad", | ||
207 | .max_brightness = 127, | ||
208 | .pwm_period_ns = 7812500, | ||
209 | }, | ||
210 | }; | ||
211 | |||
212 | static struct led_pwm_platform_data zoom_pwm_data = { | ||
213 | .num_leds = ARRAY_SIZE(zoom_pwm_leds), | ||
214 | .leds = zoom_pwm_leds, | ||
215 | }; | ||
216 | |||
217 | static struct platform_device zoom_leds_pwm = { | ||
218 | .name = "leds_pwm", | ||
219 | .id = -1, | ||
220 | .dev = { | ||
221 | .platform_data = &zoom_pwm_data, | ||
222 | }, | ||
223 | }; | ||
224 | |||
225 | static struct platform_pwm_backlight_data zoom_backlight_data = { | ||
226 | .pwm_id = 1, | ||
227 | .max_brightness = 127, | ||
228 | .dft_brightness = 127, | ||
229 | .pwm_period_ns = 7812500, | ||
230 | }; | ||
231 | |||
232 | static struct platform_device zoom_backlight_pwm = { | ||
233 | .name = "pwm-backlight", | ||
234 | .id = -1, | ||
235 | .dev = { | ||
236 | .platform_data = &zoom_backlight_data, | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | static struct platform_device *zoom_devices[] __initdata = { | ||
241 | &omap_vwlan_device, | ||
242 | &zoom_leds_pwm, | ||
243 | &zoom_backlight_pwm, | ||
244 | }; | ||
245 | |||
196 | static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { | 246 | static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { |
197 | .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ | 247 | .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */ |
198 | }; | 248 | }; |
@@ -301,7 +351,8 @@ void __init zoom_peripherals_init(void) | |||
301 | 351 | ||
302 | omap_hsmmc_init(mmc); | 352 | omap_hsmmc_init(mmc); |
303 | omap_i2c_init(); | 353 | omap_i2c_init(); |
304 | platform_device_register(&omap_vwlan_device); | 354 | pwm_add_table(zoom_pwm_lookup, ARRAY_SIZE(zoom_pwm_lookup)); |
355 | platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices)); | ||
305 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); | 356 | usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb"); |
306 | usb_musb_init(NULL); | 357 | usb_musb_init(NULL); |
307 | enable_board_wakeup_source(); | 358 | enable_board_wakeup_source(); |
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c index 3d58f335f173..0c6834ae1fc4 100644 --- a/arch/arm/mach-omap2/cclock44xx_data.c +++ b/arch/arm/mach-omap2/cclock44xx_data.c | |||
@@ -52,6 +52,13 @@ | |||
52 | */ | 52 | */ |
53 | #define OMAP4_DPLL_ABE_DEFFREQ 98304000 | 53 | #define OMAP4_DPLL_ABE_DEFFREQ 98304000 |
54 | 54 | ||
55 | /* | ||
56 | * OMAP4 USB DPLL default frequency. In OMAP4430 TRM version V, section | ||
57 | * "3.6.3.9.5 DPLL_USB Preferred Settings" shows that the preferred | ||
58 | * locked frequency for the USB DPLL is 960MHz. | ||
59 | */ | ||
60 | #define OMAP4_DPLL_USB_DEFFREQ 960000000 | ||
61 | |||
55 | /* Root clocks */ | 62 | /* Root clocks */ |
56 | 63 | ||
57 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); | 64 | DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0); |
@@ -1011,6 +1018,10 @@ DEFINE_CLK_OMAP_MUX(hsmmc2_fclk, "l3_init_clkdm", hsmmc1_fclk_sel, | |||
1011 | OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK, | 1018 | OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK, |
1012 | hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops); | 1019 | hsmmc1_fclk_parents, func_dmic_abe_gfclk_ops); |
1013 | 1020 | ||
1021 | DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0, | ||
1022 | OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL, | ||
1023 | OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL); | ||
1024 | |||
1014 | DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0, | 1025 | DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0, |
1015 | OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL, | 1026 | OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL, |
1016 | OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL); | 1027 | OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL); |
@@ -1538,6 +1549,7 @@ static struct omap_clk omap44xx_clks[] = { | |||
1538 | CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk, CK_443X), | 1549 | CLK(NULL, "per_mcbsp4_gfclk", &per_mcbsp4_gfclk, CK_443X), |
1539 | CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk, CK_443X), | 1550 | CLK(NULL, "hsmmc1_fclk", &hsmmc1_fclk, CK_443X), |
1540 | CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk, CK_443X), | 1551 | CLK(NULL, "hsmmc2_fclk", &hsmmc2_fclk, CK_443X), |
1552 | CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X), | ||
1541 | CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X), | 1553 | CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X), |
1542 | CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X), | 1554 | CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X), |
1543 | CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X), | 1555 | CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X), |
@@ -1705,5 +1717,13 @@ int __init omap4xxx_clk_init(void) | |||
1705 | if (rc) | 1717 | if (rc) |
1706 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); | 1718 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); |
1707 | 1719 | ||
1720 | /* | ||
1721 | * Lock USB DPLL on OMAP4 devices so that the L3INIT power | ||
1722 | * domain can transition to retention state when not in use. | ||
1723 | */ | ||
1724 | rc = clk_set_rate(&dpll_usb_ck, OMAP4_DPLL_USB_DEFFREQ); | ||
1725 | if (rc) | ||
1726 | pr_err("%s: failed to configure USB DPLL!\n", __func__); | ||
1727 | |||
1708 | return 0; | 1728 | return 0; |
1709 | } | 1729 | } |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index bf70e2b57ff8..272490e72ee0 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -292,5 +292,8 @@ extern void omap_reserve(void); | |||
292 | struct omap_hwmod; | 292 | struct omap_hwmod; |
293 | extern int omap_dss_reset(struct omap_hwmod *); | 293 | extern int omap_dss_reset(struct omap_hwmod *); |
294 | 294 | ||
295 | /* SoC specific clock initializer */ | ||
296 | extern int (*omap_clk_init)(void); | ||
297 | |||
295 | #endif /* __ASSEMBLER__ */ | 298 | #endif /* __ASSEMBLER__ */ |
296 | #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ | 299 | #endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ |
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c index 4be5cfc81ab8..393aeefaebb0 100644 --- a/arch/arm/mach-omap2/dss-common.c +++ b/arch/arm/mach-omap2/dss-common.c | |||
@@ -27,9 +27,7 @@ | |||
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | 28 | ||
29 | #include <video/omapdss.h> | 29 | #include <video/omapdss.h> |
30 | #include <video/omap-panel-tfp410.h> | 30 | #include <video/omap-panel-data.h> |
31 | #include <video/omap-panel-nokia-dsi.h> | ||
32 | #include <video/omap-panel-picodlp.h> | ||
33 | 31 | ||
34 | #include "soc.h" | 32 | #include "soc.h" |
35 | #include "dss-common.h" | 33 | #include "dss-common.h" |
@@ -54,7 +52,6 @@ static struct omap_dss_device omap4_panda_dvi_device = { | |||
54 | .driver_name = "tfp410", | 52 | .driver_name = "tfp410", |
55 | .data = &omap4_dvi_panel, | 53 | .data = &omap4_dvi_panel, |
56 | .phy.dpi.data_lines = 24, | 54 | .phy.dpi.data_lines = 24, |
57 | .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, | ||
58 | .channel = OMAP_DSS_CHANNEL_LCD2, | 55 | .channel = OMAP_DSS_CHANNEL_LCD2, |
59 | }; | 56 | }; |
60 | 57 | ||
@@ -179,45 +176,12 @@ static struct picodlp_panel_data sdp4430_picodlp_pdata = { | |||
179 | .pwrgood_gpio = 45, | 176 | .pwrgood_gpio = 45, |
180 | }; | 177 | }; |
181 | 178 | ||
182 | static void sdp4430_picodlp_init(void) | ||
183 | { | ||
184 | int r; | ||
185 | const struct gpio picodlp_gpios[] = { | ||
186 | {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW, | ||
187 | "DLP POWER ON"}, | ||
188 | {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN, | ||
189 | "DLP EMU DONE"}, | ||
190 | {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW, | ||
191 | "DLP PWRGOOD"}, | ||
192 | }; | ||
193 | |||
194 | r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios)); | ||
195 | if (r) | ||
196 | pr_err("Cannot request PicoDLP GPIOs, error %d\n", r); | ||
197 | } | ||
198 | |||
199 | static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev) | ||
200 | { | ||
201 | gpio_set_value(DISPLAY_SEL_GPIO, 0); | ||
202 | gpio_set_value(DLP_POWER_ON_GPIO, 1); | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev) | ||
208 | { | ||
209 | gpio_set_value(DLP_POWER_ON_GPIO, 0); | ||
210 | gpio_set_value(DISPLAY_SEL_GPIO, 1); | ||
211 | } | ||
212 | |||
213 | static struct omap_dss_device sdp4430_picodlp_device = { | 179 | static struct omap_dss_device sdp4430_picodlp_device = { |
214 | .name = "picodlp", | 180 | .name = "picodlp", |
215 | .driver_name = "picodlp_panel", | 181 | .driver_name = "picodlp_panel", |
216 | .type = OMAP_DISPLAY_TYPE_DPI, | 182 | .type = OMAP_DISPLAY_TYPE_DPI, |
217 | .phy.dpi.data_lines = 24, | 183 | .phy.dpi.data_lines = 24, |
218 | .channel = OMAP_DSS_CHANNEL_LCD2, | 184 | .channel = OMAP_DSS_CHANNEL_LCD2, |
219 | .platform_enable = sdp4430_panel_enable_picodlp, | ||
220 | .platform_disable = sdp4430_panel_disable_picodlp, | ||
221 | .data = &sdp4430_picodlp_pdata, | 185 | .data = &sdp4430_picodlp_pdata, |
222 | }; | 186 | }; |
223 | 187 | ||
@@ -234,17 +198,26 @@ static struct omap_dss_board_info sdp4430_dss_data = { | |||
234 | .default_device = &sdp4430_lcd_device, | 198 | .default_device = &sdp4430_lcd_device, |
235 | }; | 199 | }; |
236 | 200 | ||
201 | /* | ||
202 | * we select LCD2 by default (instead of Pico DLP) by setting DISPLAY_SEL_GPIO. | ||
203 | * Setting DLP_POWER_ON gpio enables the VDLP_2V5 VDLP_1V8 and VDLP_1V0 rails | ||
204 | * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is | ||
205 | * selected by default | ||
206 | */ | ||
237 | void __init omap_4430sdp_display_init(void) | 207 | void __init omap_4430sdp_display_init(void) |
238 | { | 208 | { |
239 | int r; | 209 | int r; |
240 | 210 | ||
241 | /* Enable LCD2 by default (instead of Pico DLP) */ | ||
242 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, | 211 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, |
243 | "display_sel"); | 212 | "display_sel"); |
244 | if (r) | 213 | if (r) |
245 | pr_err("%s: Could not get display_sel GPIO\n", __func__); | 214 | pr_err("%s: Could not get display_sel GPIO\n", __func__); |
246 | 215 | ||
247 | sdp4430_picodlp_init(); | 216 | r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW, |
217 | "DLP POWER ON"); | ||
218 | if (r) | ||
219 | pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__); | ||
220 | |||
248 | omap_display_init(&sdp4430_dss_data); | 221 | omap_display_init(&sdp4430_dss_data); |
249 | /* | 222 | /* |
250 | * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and | 223 | * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and |
@@ -264,12 +237,15 @@ void __init omap_4430sdp_display_init_of(void) | |||
264 | { | 237 | { |
265 | int r; | 238 | int r; |
266 | 239 | ||
267 | /* Enable LCD2 by default (instead of Pico DLP) */ | ||
268 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, | 240 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, |
269 | "display_sel"); | 241 | "display_sel"); |
270 | if (r) | 242 | if (r) |
271 | pr_err("%s: Could not get display_sel GPIO\n", __func__); | 243 | pr_err("%s: Could not get display_sel GPIO\n", __func__); |
272 | 244 | ||
273 | sdp4430_picodlp_init(); | 245 | r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW, |
246 | "DLP POWER ON"); | ||
247 | if (r) | ||
248 | pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__); | ||
249 | |||
274 | omap_display_init(&sdp4430_dss_data); | 250 | omap_display_init(&sdp4430_dss_data); |
275 | } | 251 | } |
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 0d75889c0a6f..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,11 +272,19 @@ 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 (ret < 0) | 288 | if (ret < 0) |
307 | return ret; | 289 | return ret; |
308 | 290 | ||
@@ -322,9 +304,25 @@ 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 | } | ||
326 | 318 | ||
327 | ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t); | 319 | omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq); |
320 | |||
321 | ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync); | ||
322 | if (ret < 0) | ||
323 | return ret; | ||
324 | |||
325 | ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t); | ||
328 | if (ret < 0) | 326 | if (ret < 0) |
329 | return ret; | 327 | return ret; |
330 | 328 | ||
@@ -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 6de31739b45c..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 | { |
@@ -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 (rc < 0) { | 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,18 +1596,27 @@ 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 (rc < 0) { | ||
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 (gpmc_setup_irq() < 0) | 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"); |
@@ -1383,6 +1624,9 @@ static int gpmc_probe(struct platform_device *pdev) | |||
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/io.c b/arch/arm/mach-omap2/io.c index 2bef5a7e6af8..e210fa830f8d 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -55,6 +55,12 @@ | |||
55 | #include "prm44xx.h" | 55 | #include "prm44xx.h" |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * omap_clk_init: points to a function that does the SoC-specific | ||
59 | * clock initializations | ||
60 | */ | ||
61 | int (*omap_clk_init)(void); | ||
62 | |||
63 | /* | ||
58 | * The machine specific code may provide the extra mapping besides the | 64 | * The machine specific code may provide the extra mapping besides the |
59 | * default mapping provided here. | 65 | * default mapping provided here. |
60 | */ | 66 | */ |
@@ -406,7 +412,7 @@ void __init omap2420_init_early(void) | |||
406 | omap242x_clockdomains_init(); | 412 | omap242x_clockdomains_init(); |
407 | omap2420_hwmod_init(); | 413 | omap2420_hwmod_init(); |
408 | omap_hwmod_init_postsetup(); | 414 | omap_hwmod_init_postsetup(); |
409 | omap2420_clk_init(); | 415 | omap_clk_init = omap2420_clk_init; |
410 | } | 416 | } |
411 | 417 | ||
412 | void __init omap2420_init_late(void) | 418 | void __init omap2420_init_late(void) |
@@ -436,7 +442,7 @@ void __init omap2430_init_early(void) | |||
436 | omap243x_clockdomains_init(); | 442 | omap243x_clockdomains_init(); |
437 | omap2430_hwmod_init(); | 443 | omap2430_hwmod_init(); |
438 | omap_hwmod_init_postsetup(); | 444 | omap_hwmod_init_postsetup(); |
439 | omap2430_clk_init(); | 445 | omap_clk_init = omap2430_clk_init; |
440 | } | 446 | } |
441 | 447 | ||
442 | void __init omap2430_init_late(void) | 448 | void __init omap2430_init_late(void) |
@@ -471,7 +477,7 @@ void __init omap3_init_early(void) | |||
471 | omap3xxx_clockdomains_init(); | 477 | omap3xxx_clockdomains_init(); |
472 | omap3xxx_hwmod_init(); | 478 | omap3xxx_hwmod_init(); |
473 | omap_hwmod_init_postsetup(); | 479 | omap_hwmod_init_postsetup(); |
474 | omap3xxx_clk_init(); | 480 | omap_clk_init = omap3xxx_clk_init; |
475 | } | 481 | } |
476 | 482 | ||
477 | void __init omap3430_init_early(void) | 483 | void __init omap3430_init_early(void) |
@@ -509,7 +515,7 @@ void __init ti81xx_init_early(void) | |||
509 | omap3xxx_clockdomains_init(); | 515 | omap3xxx_clockdomains_init(); |
510 | omap3xxx_hwmod_init(); | 516 | omap3xxx_hwmod_init(); |
511 | omap_hwmod_init_postsetup(); | 517 | omap_hwmod_init_postsetup(); |
512 | omap3xxx_clk_init(); | 518 | omap_clk_init = omap3xxx_clk_init; |
513 | } | 519 | } |
514 | 520 | ||
515 | void __init omap3_init_late(void) | 521 | void __init omap3_init_late(void) |
@@ -577,7 +583,7 @@ void __init am33xx_init_early(void) | |||
577 | am33xx_clockdomains_init(); | 583 | am33xx_clockdomains_init(); |
578 | am33xx_hwmod_init(); | 584 | am33xx_hwmod_init(); |
579 | omap_hwmod_init_postsetup(); | 585 | omap_hwmod_init_postsetup(); |
580 | am33xx_clk_init(); | 586 | omap_clk_init = am33xx_clk_init; |
581 | } | 587 | } |
582 | #endif | 588 | #endif |
583 | 589 | ||
@@ -602,7 +608,7 @@ void __init omap4430_init_early(void) | |||
602 | omap44xx_clockdomains_init(); | 608 | omap44xx_clockdomains_init(); |
603 | omap44xx_hwmod_init(); | 609 | omap44xx_hwmod_init(); |
604 | omap_hwmod_init_postsetup(); | 610 | omap_hwmod_init_postsetup(); |
605 | omap4xxx_clk_init(); | 611 | omap_clk_init = omap4xxx_clk_init; |
606 | } | 612 | } |
607 | 613 | ||
608 | void __init omap4430_init_late(void) | 614 | void __init omap4430_init_late(void) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 2520d46c8508..3f50f680372e 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1364,7 +1364,9 @@ static void _enable_sysc(struct omap_hwmod *oh) | |||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | if (sf & SYSC_HAS_MIDLEMODE) { | 1366 | if (sf & SYSC_HAS_MIDLEMODE) { |
1367 | if (oh->flags & HWMOD_SWSUP_MSTANDBY) { | 1367 | if (oh->flags & HWMOD_FORCE_MSTANDBY) { |
1368 | idlemode = HWMOD_IDLEMODE_FORCE; | ||
1369 | } else if (oh->flags & HWMOD_SWSUP_MSTANDBY) { | ||
1368 | idlemode = HWMOD_IDLEMODE_NO; | 1370 | idlemode = HWMOD_IDLEMODE_NO; |
1369 | } else { | 1371 | } else { |
1370 | if (sf & SYSC_HAS_ENAWAKEUP) | 1372 | if (sf & SYSC_HAS_ENAWAKEUP) |
@@ -1436,7 +1438,8 @@ static void _idle_sysc(struct omap_hwmod *oh) | |||
1436 | } | 1438 | } |
1437 | 1439 | ||
1438 | if (sf & SYSC_HAS_MIDLEMODE) { | 1440 | if (sf & SYSC_HAS_MIDLEMODE) { |
1439 | if (oh->flags & HWMOD_SWSUP_MSTANDBY) { | 1441 | if ((oh->flags & HWMOD_SWSUP_MSTANDBY) || |
1442 | (oh->flags & HWMOD_FORCE_MSTANDBY)) { | ||
1440 | idlemode = HWMOD_IDLEMODE_FORCE; | 1443 | idlemode = HWMOD_IDLEMODE_FORCE; |
1441 | } else { | 1444 | } else { |
1442 | if (sf & SYSC_HAS_ENAWAKEUP) | 1445 | if (sf & SYSC_HAS_ENAWAKEUP) |
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index 28f4dea0512e..fe5962921f07 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h | |||
@@ -427,8 +427,8 @@ struct omap_hwmod_omap4_prcm { | |||
427 | * | 427 | * |
428 | * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out | 428 | * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out |
429 | * of idle, rather than relying on module smart-idle | 429 | * of idle, rather than relying on module smart-idle |
430 | * HWMOD_SWSUP_MSTDBY: omap_hwmod code should manually bring module in and out | 430 | * HWMOD_SWSUP_MSTANDBY: omap_hwmod code should manually bring module in and |
431 | * of standby, rather than relying on module smart-standby | 431 | * out of standby, rather than relying on module smart-standby |
432 | * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for | 432 | * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for |
433 | * SDRAM controller, etc. XXX probably belongs outside the main hwmod file | 433 | * SDRAM controller, etc. XXX probably belongs outside the main hwmod file |
434 | * XXX Should be HWMOD_SETUP_NO_RESET | 434 | * XXX Should be HWMOD_SETUP_NO_RESET |
@@ -459,6 +459,10 @@ struct omap_hwmod_omap4_prcm { | |||
459 | * correctly, or this is being abused to deal with some PM latency | 459 | * correctly, or this is being abused to deal with some PM latency |
460 | * issues -- but we're currently suffering from a shortage of | 460 | * issues -- but we're currently suffering from a shortage of |
461 | * folks who are able to track these issues down properly. | 461 | * folks who are able to track these issues down properly. |
462 | * HWMOD_FORCE_MSTANDBY: Always keep MIDLEMODE bits cleared so that device | ||
463 | * is kept in force-standby mode. Failing to do so causes PM problems | ||
464 | * with musb on OMAP3630 at least. Note that musb has a dedicated register | ||
465 | * to control MSTANDBY signal when MIDLEMODE is set to force-standby. | ||
462 | */ | 466 | */ |
463 | #define HWMOD_SWSUP_SIDLE (1 << 0) | 467 | #define HWMOD_SWSUP_SIDLE (1 << 0) |
464 | #define HWMOD_SWSUP_MSTANDBY (1 << 1) | 468 | #define HWMOD_SWSUP_MSTANDBY (1 << 1) |
@@ -471,6 +475,7 @@ struct omap_hwmod_omap4_prcm { | |||
471 | #define HWMOD_16BIT_REG (1 << 8) | 475 | #define HWMOD_16BIT_REG (1 << 8) |
472 | #define HWMOD_EXT_OPT_MAIN_CLK (1 << 9) | 476 | #define HWMOD_EXT_OPT_MAIN_CLK (1 << 9) |
473 | #define HWMOD_BLOCK_WFI (1 << 10) | 477 | #define HWMOD_BLOCK_WFI (1 << 10) |
478 | #define HWMOD_FORCE_MSTANDBY (1 << 11) | ||
474 | 479 | ||
475 | /* | 480 | /* |
476 | * omap_hwmod._int_flags definitions | 481 | * omap_hwmod._int_flags definitions |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index ac7e03ec952f..5112d04e7b79 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -1707,9 +1707,14 @@ static struct omap_hwmod omap3xxx_usbhsotg_hwmod = { | |||
1707 | * Erratum ID: i479 idle_req / idle_ack mechanism potentially | 1707 | * Erratum ID: i479 idle_req / idle_ack mechanism potentially |
1708 | * broken when autoidle is enabled | 1708 | * broken when autoidle is enabled |
1709 | * workaround is to disable the autoidle bit at module level. | 1709 | * workaround is to disable the autoidle bit at module level. |
1710 | * | ||
1711 | * Enabling the device in any other MIDLEMODE setting but force-idle | ||
1712 | * causes core_pwrdm not enter idle states at least on OMAP3630. | ||
1713 | * Note that musb has OTG_FORCESTDBY register that controls MSTANDBY | ||
1714 | * signal when MIDLEMODE is set to force-idle. | ||
1710 | */ | 1715 | */ |
1711 | .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE | 1716 | .flags = HWMOD_NO_OCP_AUTOIDLE | HWMOD_SWSUP_SIDLE |
1712 | | HWMOD_SWSUP_MSTANDBY, | 1717 | | HWMOD_FORCE_MSTANDBY, |
1713 | }; | 1718 | }; |
1714 | 1719 | ||
1715 | /* usb_otg_hs */ | 1720 | /* usb_otg_hs */ |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 0e47d2e1687c..9e0576569e07 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -2714,6 +2714,10 @@ static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = { | |||
2714 | { } | 2714 | { } |
2715 | }; | 2715 | }; |
2716 | 2716 | ||
2717 | static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = { | ||
2718 | { .role = "48mhz", .clk = "ocp2scp_usb_phy_phy_48m" }, | ||
2719 | }; | ||
2720 | |||
2717 | /* ocp2scp_usb_phy */ | 2721 | /* ocp2scp_usb_phy */ |
2718 | static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { | 2722 | static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { |
2719 | .name = "ocp2scp_usb_phy", | 2723 | .name = "ocp2scp_usb_phy", |
@@ -2728,6 +2732,8 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { | |||
2728 | }, | 2732 | }, |
2729 | }, | 2733 | }, |
2730 | .dev_attr = ocp2scp_dev_attr, | 2734 | .dev_attr = ocp2scp_dev_attr, |
2735 | .opt_clks = ocp2scp_usb_phy_opt_clks, | ||
2736 | .opt_clks_cnt = ARRAY_SIZE(ocp2scp_usb_phy_opt_clks), | ||
2731 | }; | 2737 | }; |
2732 | 2738 | ||
2733 | /* | 2739 | /* |
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index 31ae76481737..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> |
@@ -626,14 +625,10 @@ void __init omap4_local_timer_init(void) | |||
626 | #ifdef CONFIG_SOC_OMAP5 | 625 | #ifdef CONFIG_SOC_OMAP5 |
627 | void __init omap5_realtime_timer_init(void) | 626 | void __init omap5_realtime_timer_init(void) |
628 | { | 627 | { |
629 | int err; | ||
630 | |||
631 | omap4_sync32k_timer_init(); | 628 | omap4_sync32k_timer_init(); |
632 | realtime_counter_init(); | 629 | realtime_counter_init(); |
633 | 630 | ||
634 | err = arch_timer_of_register(); | 631 | clocksource_of_init(); |
635 | if (err) | ||
636 | pr_err("%s: arch_timer_register failed %d\n", __func__, err); | ||
637 | } | 632 | } |
638 | #endif /* CONFIG_SOC_OMAP5 */ | 633 | #endif /* CONFIG_SOC_OMAP5 */ |
639 | 634 | ||
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-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile index be6e4d0e6f1a..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 |
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h index abefeb38bba4..307c3714be55 100644 --- a/arch/arm/mach-s3c24xx/common.h +++ b/arch/arm/mach-s3c24xx/common.h | |||
@@ -21,6 +21,7 @@ extern void s3c2410_map_io(void); | |||
21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); | 21 | extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); |
22 | extern void s3c2410_init_clocks(int xtal); | 22 | extern void s3c2410_init_clocks(int xtal); |
23 | extern void s3c2410_restart(char mode, const char *cmd); | 23 | extern void s3c2410_restart(char mode, const char *cmd); |
24 | extern void s3c2410_init_irq(void); | ||
24 | #else | 25 | #else |
25 | #define s3c2410_init_clocks NULL | 26 | #define s3c2410_init_clocks NULL |
26 | #define s3c2410_init_uarts NULL | 27 | #define s3c2410_init_uarts NULL |
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/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c index 432144cb54ae..e27b5c91b3db 100644 --- a/arch/arm/mach-s3c24xx/mach-amlm5900.c +++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c | |||
@@ -238,7 +238,7 @@ static void __init amlm5900_init(void) | |||
238 | MACHINE_START(AML_M5900, "AML_M5900") | 238 | MACHINE_START(AML_M5900, "AML_M5900") |
239 | .atag_offset = 0x100, | 239 | .atag_offset = 0x100, |
240 | .map_io = amlm5900_map_io, | 240 | .map_io = amlm5900_map_io, |
241 | .init_irq = s3c24xx_init_irq, | 241 | .init_irq = s3c2410_init_irq, |
242 | .init_machine = amlm5900_init, | 242 | .init_machine = amlm5900_init, |
243 | .init_time = samsung_timer_init, | 243 | .init_time = samsung_timer_init, |
244 | .restart = s3c2410_restart, | 244 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c index eabe2db42ef6..22d6ae926d91 100644 --- a/arch/arm/mach-s3c24xx/mach-bast.c +++ b/arch/arm/mach-s3c24xx/mach-bast.c | |||
@@ -605,7 +605,7 @@ MACHINE_START(BAST, "Simtec-BAST") | |||
605 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ | 605 | /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ |
606 | .atag_offset = 0x100, | 606 | .atag_offset = 0x100, |
607 | .map_io = bast_map_io, | 607 | .map_io = bast_map_io, |
608 | .init_irq = s3c24xx_init_irq, | 608 | .init_irq = s3c2410_init_irq, |
609 | .init_machine = bast_init, | 609 | .init_machine = bast_init, |
610 | .init_time = samsung_timer_init, | 610 | .init_time = samsung_timer_init, |
611 | .restart = s3c2410_restart, | 611 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c index 8dd660102846..af4334d6b4d5 100644 --- a/arch/arm/mach-s3c24xx/mach-h1940.c +++ b/arch/arm/mach-s3c24xx/mach-h1940.c | |||
@@ -667,11 +667,6 @@ static void __init h1940_reserve(void) | |||
667 | memblock_reserve(0x30081000, 0x1000); | 667 | memblock_reserve(0x30081000, 0x1000); |
668 | } | 668 | } |
669 | 669 | ||
670 | static void __init h1940_init_irq(void) | ||
671 | { | ||
672 | s3c24xx_init_irq(); | ||
673 | } | ||
674 | |||
675 | static void __init h1940_init(void) | 670 | static void __init h1940_init(void) |
676 | { | 671 | { |
677 | u32 tmp; | 672 | u32 tmp; |
@@ -740,7 +735,7 @@ MACHINE_START(H1940, "IPAQ-H1940") | |||
740 | .atag_offset = 0x100, | 735 | .atag_offset = 0x100, |
741 | .map_io = h1940_map_io, | 736 | .map_io = h1940_map_io, |
742 | .reserve = h1940_reserve, | 737 | .reserve = h1940_reserve, |
743 | .init_irq = h1940_init_irq, | 738 | .init_irq = s3c2410_init_irq, |
744 | .init_machine = h1940_init, | 739 | .init_machine = h1940_init, |
745 | .init_time = samsung_timer_init, | 740 | .init_time = samsung_timer_init, |
746 | .restart = s3c2410_restart, | 741 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c index 73a690f431e6..2cb46c37c920 100644 --- a/arch/arm/mach-s3c24xx/mach-n30.c +++ b/arch/arm/mach-s3c24xx/mach-n30.c | |||
@@ -592,7 +592,7 @@ MACHINE_START(N30, "Acer-N30") | |||
592 | .atag_offset = 0x100, | 592 | .atag_offset = 0x100, |
593 | .init_time = samsung_timer_init, | 593 | .init_time = samsung_timer_init, |
594 | .init_machine = n30_init, | 594 | .init_machine = n30_init, |
595 | .init_irq = s3c24xx_init_irq, | 595 | .init_irq = s3c2410_init_irq, |
596 | .map_io = n30_map_io, | 596 | .map_io = n30_map_io, |
597 | .restart = s3c2410_restart, | 597 | .restart = s3c2410_restart, |
598 | MACHINE_END | 598 | MACHINE_END |
@@ -603,7 +603,7 @@ MACHINE_START(N35, "Acer-N35") | |||
603 | .atag_offset = 0x100, | 603 | .atag_offset = 0x100, |
604 | .init_time = samsung_timer_init, | 604 | .init_time = samsung_timer_init, |
605 | .init_machine = n30_init, | 605 | .init_machine = n30_init, |
606 | .init_irq = s3c24xx_init_irq, | 606 | .init_irq = s3c2410_init_irq, |
607 | .map_io = n30_map_io, | 607 | .map_io = n30_map_io, |
608 | .restart = s3c2410_restart, | 608 | .restart = s3c2410_restart, |
609 | MACHINE_END | 609 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c index 7b8670746b6a..7e16b0740ec1 100644 --- a/arch/arm/mach-s3c24xx/mach-otom.c +++ b/arch/arm/mach-s3c24xx/mach-otom.c | |||
@@ -116,7 +116,7 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1") | |||
116 | .atag_offset = 0x100, | 116 | .atag_offset = 0x100, |
117 | .map_io = otom11_map_io, | 117 | .map_io = otom11_map_io, |
118 | .init_machine = otom11_init, | 118 | .init_machine = otom11_init, |
119 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
120 | .init_time = samsung_timer_init, | 120 | .init_time = samsung_timer_init, |
121 | .restart = s3c2410_restart, | 121 | .restart = s3c2410_restart, |
122 | MACHINE_END | 122 | MACHINE_END |
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c index 71cf29b12d1f..f8feaeadb55a 100644 --- a/arch/arm/mach-s3c24xx/mach-qt2410.c +++ b/arch/arm/mach-s3c24xx/mach-qt2410.c | |||
@@ -343,7 +343,7 @@ static void __init qt2410_machine_init(void) | |||
343 | MACHINE_START(QT2410, "QT2410") | 343 | MACHINE_START(QT2410, "QT2410") |
344 | .atag_offset = 0x100, | 344 | .atag_offset = 0x100, |
345 | .map_io = qt2410_map_io, | 345 | .map_io = qt2410_map_io, |
346 | .init_irq = s3c24xx_init_irq, | 346 | .init_irq = s3c2410_init_irq, |
347 | .init_machine = qt2410_machine_init, | 347 | .init_machine = qt2410_machine_init, |
348 | .init_time = samsung_timer_init, | 348 | .init_time = samsung_timer_init, |
349 | .restart = s3c2410_restart, | 349 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c index fd96f7fc330c..a773789e4f38 100644 --- a/arch/arm/mach-s3c24xx/mach-smdk2410.c +++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c | |||
@@ -116,7 +116,7 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc | |||
116 | /* Maintainer: Jonas Dietsche */ | 116 | /* Maintainer: Jonas Dietsche */ |
117 | .atag_offset = 0x100, | 117 | .atag_offset = 0x100, |
118 | .map_io = smdk2410_map_io, | 118 | .map_io = smdk2410_map_io, |
119 | .init_irq = s3c24xx_init_irq, | 119 | .init_irq = s3c2410_init_irq, |
120 | .init_machine = smdk2410_init, | 120 | .init_machine = smdk2410_init, |
121 | .init_time = samsung_timer_init, | 121 | .init_time = samsung_timer_init, |
122 | .restart = s3c2410_restart, | 122 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c index 31dfe589e349..7fad8f055cab 100644 --- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c +++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c | |||
@@ -149,7 +149,7 @@ static void __init tct_hammer_init(void) | |||
149 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") | 149 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") |
150 | .atag_offset = 0x100, | 150 | .atag_offset = 0x100, |
151 | .map_io = tct_hammer_map_io, | 151 | .map_io = tct_hammer_map_io, |
152 | .init_irq = s3c24xx_init_irq, | 152 | .init_irq = s3c2410_init_irq, |
153 | .init_machine = tct_hammer_init, | 153 | .init_machine = tct_hammer_init, |
154 | .init_time = samsung_timer_init, | 154 | .init_time = samsung_timer_init, |
155 | .restart = s3c2410_restart, | 155 | .restart = s3c2410_restart, |
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c index deeb8a0a4034..42e7187fed60 100644 --- a/arch/arm/mach-s3c24xx/mach-vr1000.c +++ b/arch/arm/mach-s3c24xx/mach-vr1000.c | |||
@@ -355,7 +355,7 @@ MACHINE_START(VR1000, "Thorcom-VR1000") | |||
355 | .atag_offset = 0x100, | 355 | .atag_offset = 0x100, |
356 | .map_io = vr1000_map_io, | 356 | .map_io = vr1000_map_io, |
357 | .init_machine = vr1000_init, | 357 | .init_machine = vr1000_init, |
358 | .init_irq = s3c24xx_init_irq, | 358 | .init_irq = s3c2410_init_irq, |
359 | .init_time = samsung_timer_init, | 359 | .init_time = samsung_timer_init, |
360 | .restart = s3c2410_restart, | 360 | .restart = s3c2410_restart, |
361 | MACHINE_END | 361 | MACHINE_END |
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/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c index e4545c152722..899a86c31ec9 100644 --- a/arch/arm/mach-shmobile/setup-emev2.c +++ b/arch/arm/mach-shmobile/setup-emev2.c | |||
@@ -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-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 e8cd93a5c550..fdf3894b1cc3 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c | |||
@@ -1037,7 +1037,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") | |||
1037 | .nr_irqs = NR_IRQS_LEGACY, | 1037 | .nr_irqs = NR_IRQS_LEGACY, |
1038 | .init_irq = irqchip_init, | 1038 | .init_irq = irqchip_init, |
1039 | .init_machine = sh73a0_add_standard_devices_dt, | 1039 | .init_machine = sh73a0_add_standard_devices_dt, |
1040 | .init_time = shmobile_timer_init, | ||
1041 | .dt_compat = sh73a0_boards_compat_dt, | 1040 | .dt_compat = sh73a0_boards_compat_dt, |
1042 | MACHINE_END | 1041 | MACHINE_END |
1043 | #endif /* CONFIG_USE_OF */ | 1042 | #endif /* CONFIG_USE_OF */ |
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/Kconfig b/arch/arm/mach-spear/Kconfig new file mode 100644 index 000000000000..5412aeb377ac --- /dev/null +++ b/arch/arm/mach-spear/Kconfig | |||
@@ -0,0 +1,103 @@ | |||
1 | # | ||
2 | # SPEAr Platform configuration file | ||
3 | # | ||
4 | |||
5 | menuconfig PLAT_SPEAR | ||
6 | bool "ST SPEAr Family" if ARCH_MULTI_V7 || ARCH_MULTI_V5 | ||
7 | default PLAT_SPEAR_SINGLE | ||
8 | select ARCH_REQUIRE_GPIOLIB | ||
9 | select ARM_AMBA | ||
10 | select CLKDEV_LOOKUP | ||
11 | select CLKSRC_MMIO | ||
12 | select COMMON_CLK | ||
13 | select GENERIC_CLOCKEVENTS | ||
14 | select HAVE_CLK | ||
15 | |||
16 | if PLAT_SPEAR | ||
17 | |||
18 | config ARCH_SPEAR13XX | ||
19 | bool "ST SPEAr13xx" | ||
20 | depends on ARCH_MULTI_V7 || PLAT_SPEAR_SINGLE | ||
21 | select ARCH_HAS_CPUFREQ | ||
22 | select ARM_GIC | ||
23 | select CPU_V7 | ||
24 | select GPIO_SPEAR_SPICS | ||
25 | select HAVE_SMP | ||
26 | select MIGHT_HAVE_CACHE_L2X0 | ||
27 | select PINCTRL | ||
28 | select USE_OF | ||
29 | help | ||
30 | Supports for ARM's SPEAR13XX family | ||
31 | |||
32 | if ARCH_SPEAR13XX | ||
33 | |||
34 | config MACH_SPEAR1310 | ||
35 | bool "SPEAr1310 Machine support with Device Tree" | ||
36 | select PINCTRL_SPEAR1310 | ||
37 | help | ||
38 | Supports ST SPEAr1310 machine configured via the device-tree | ||
39 | |||
40 | config MACH_SPEAR1340 | ||
41 | bool "SPEAr1340 Machine support with Device Tree" | ||
42 | select PINCTRL_SPEAR1340 | ||
43 | help | ||
44 | Supports ST SPEAr1340 machine configured via the device-tree | ||
45 | |||
46 | endif #ARCH_SPEAR13XX | ||
47 | |||
48 | config ARCH_SPEAR3XX | ||
49 | bool "ST SPEAr3xx" | ||
50 | depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE | ||
51 | depends on !ARCH_SPEAR13XX | ||
52 | select ARM_VIC | ||
53 | select CPU_ARM926T | ||
54 | select PINCTRL | ||
55 | select USE_OF | ||
56 | help | ||
57 | Supports for ARM's SPEAR3XX family | ||
58 | |||
59 | if ARCH_SPEAR3XX | ||
60 | |||
61 | config MACH_SPEAR300 | ||
62 | bool "SPEAr300 Machine support with Device Tree" | ||
63 | select PINCTRL_SPEAR300 | ||
64 | help | ||
65 | Supports ST SPEAr300 machine configured via the device-tree | ||
66 | |||
67 | config MACH_SPEAR310 | ||
68 | bool "SPEAr310 Machine support with Device Tree" | ||
69 | select PINCTRL_SPEAR310 | ||
70 | help | ||
71 | Supports ST SPEAr310 machine configured via the device-tree | ||
72 | |||
73 | config MACH_SPEAR320 | ||
74 | bool "SPEAr320 Machine support with Device Tree" | ||
75 | select PINCTRL_SPEAR320 | ||
76 | help | ||
77 | Supports ST SPEAr320 machine configured via the device-tree | ||
78 | |||
79 | endif | ||
80 | |||
81 | config ARCH_SPEAR6XX | ||
82 | bool "ST SPEAr6XX" | ||
83 | depends on ARCH_MULTI_V5 || PLAT_SPEAR_SINGLE | ||
84 | depends on !ARCH_SPEAR13XX | ||
85 | select ARM_VIC | ||
86 | select CPU_ARM926T | ||
87 | help | ||
88 | Supports for ARM's SPEAR6XX family | ||
89 | |||
90 | config MACH_SPEAR600 | ||
91 | def_bool y | ||
92 | depends on ARCH_SPEAR6XX | ||
93 | select USE_OF | ||
94 | help | ||
95 | Supports ST SPEAr600 boards configured via the device-treesource "arch/arm/mach-spear6xx/Kconfig" | ||
96 | |||
97 | config ARCH_SPEAR_AUTO | ||
98 | def_bool PLAT_SPEAR_SINGLE | ||
99 | depends on !ARCH_SPEAR13XX && !ARCH_SPEAR6XX | ||
100 | select ARCH_SPEAR3XX | ||
101 | |||
102 | endif | ||
103 | |||
diff --git a/arch/arm/mach-spear/Makefile b/arch/arm/mach-spear/Makefile new file mode 100644 index 000000000000..8aaf724e1ea4 --- /dev/null +++ b/arch/arm/mach-spear/Makefile | |||
@@ -0,0 +1,24 @@ | |||
1 | # | ||
2 | # SPEAr Platform specific Makefile | ||
3 | # | ||
4 | |||
5 | ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include | ||
6 | |||
7 | # Common support | ||
8 | obj-y := restart.o time.o | ||
9 | |||
10 | smp-$(CONFIG_SMP) += headsmp.o platsmp.o | ||
11 | smp-$(CONFIG_HOTPLUG_CPU) += hotplug.o | ||
12 | |||
13 | obj-$(CONFIG_ARCH_SPEAR13XX) += spear13xx.o $(smp-y) | ||
14 | obj-$(CONFIG_MACH_SPEAR1310) += spear1310.o | ||
15 | obj-$(CONFIG_MACH_SPEAR1340) += spear1340.o | ||
16 | |||
17 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o | ||
18 | obj-$(CONFIG_ARCH_SPEAR3XX) += pl080.o | ||
19 | obj-$(CONFIG_MACH_SPEAR300) += spear300.o | ||
20 | obj-$(CONFIG_MACH_SPEAR310) += spear310.o | ||
21 | obj-$(CONFIG_MACH_SPEAR320) += spear320.o | ||
22 | |||
23 | obj-$(CONFIG_ARCH_SPEAR6XX) += spear6xx.o | ||
24 | obj-$(CONFIG_ARCH_SPEAR6XX) += pl080.o | ||
diff --git a/arch/arm/mach-spear13xx/Makefile.boot b/arch/arm/mach-spear/Makefile.boot index 4674a4c221db..4674a4c221db 100644 --- a/arch/arm/mach-spear13xx/Makefile.boot +++ b/arch/arm/mach-spear/Makefile.boot | |||
diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear/generic.h index 633e678e01a3..a9fd45362fee 100644 --- a/arch/arm/mach-spear13xx/include/mach/generic.h +++ b/arch/arm/mach-spear/generic.h | |||
@@ -1,9 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-spear13xx/include/mach/generic.h | 2 | * spear machine family generic header file |
3 | * | 3 | * |
4 | * spear13xx machine family generic header file | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
5 | * | 5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> |
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | 6 | * Viresh Kumar <viresh.linux@gmail.com> |
8 | * | 7 | * |
9 | * This file is licensed under the terms of the GNU General Public | 8 | * This file is licensed under the terms of the GNU General Public |
@@ -15,37 +14,41 @@ | |||
15 | #define __MACH_GENERIC_H | 14 | #define __MACH_GENERIC_H |
16 | 15 | ||
17 | #include <linux/dmaengine.h> | 16 | #include <linux/dmaengine.h> |
17 | #include <linux/amba/pl08x.h> | ||
18 | #include <linux/init.h> | ||
18 | #include <asm/mach/time.h> | 19 | #include <asm/mach/time.h> |
19 | 20 | ||
20 | /* Add spear13xx structure declarations here */ | ||
21 | extern void spear13xx_timer_init(void); | 21 | extern void spear13xx_timer_init(void); |
22 | extern void spear3xx_timer_init(void); | ||
22 | extern struct pl022_ssp_controller pl022_plat_data; | 23 | extern struct pl022_ssp_controller pl022_plat_data; |
23 | extern struct dw_dma_platform_data dmac_plat_data; | 24 | extern struct pl08x_platform_data pl080_plat_data; |
24 | extern struct dw_dma_slave cf_dma_priv; | ||
25 | extern struct dw_dma_slave nand_read_dma_priv; | ||
26 | extern struct dw_dma_slave nand_write_dma_priv; | ||
27 | 25 | ||
28 | /* Add spear13xx family function declarations here */ | ||
29 | void __init spear_setup_of_timer(void); | 26 | void __init spear_setup_of_timer(void); |
27 | void __init spear3xx_clk_init(void __iomem *misc_base, | ||
28 | void __iomem *soc_config_base); | ||
29 | void __init spear3xx_map_io(void); | ||
30 | void __init spear3xx_dt_init_irq(void); | ||
31 | void __init spear6xx_clk_init(void __iomem *misc_base); | ||
30 | void __init spear13xx_map_io(void); | 32 | void __init spear13xx_map_io(void); |
31 | void __init spear13xx_l2x0_init(void); | 33 | void __init spear13xx_l2x0_init(void); |
32 | bool dw_dma_filter(struct dma_chan *chan, void *slave); | 34 | |
33 | void spear_restart(char, const char *); | 35 | void spear_restart(char, const char *); |
36 | |||
34 | void spear13xx_secondary_startup(void); | 37 | void spear13xx_secondary_startup(void); |
35 | void __cpuinit spear13xx_cpu_die(unsigned int cpu); | 38 | void __cpuinit spear13xx_cpu_die(unsigned int cpu); |
36 | 39 | ||
37 | extern struct smp_operations spear13xx_smp_ops; | 40 | extern struct smp_operations spear13xx_smp_ops; |
38 | 41 | ||
39 | #ifdef CONFIG_MACH_SPEAR1310 | 42 | #ifdef CONFIG_MACH_SPEAR1310 |
40 | void __init spear1310_clk_init(void); | 43 | void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base); |
41 | #else | 44 | #else |
42 | static inline void spear1310_clk_init(void) {} | 45 | static inline void spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base) {} |
43 | #endif | 46 | #endif |
44 | 47 | ||
45 | #ifdef CONFIG_MACH_SPEAR1340 | 48 | #ifdef CONFIG_MACH_SPEAR1340 |
46 | void __init spear1340_clk_init(void); | 49 | void __init spear1340_clk_init(void __iomem *misc_base); |
47 | #else | 50 | #else |
48 | static inline void spear1340_clk_init(void) {} | 51 | static inline void spear1340_clk_init(void __iomem *misc_base) {} |
49 | #endif | 52 | #endif |
50 | 53 | ||
51 | #endif /* __MACH_GENERIC_H */ | 54 | #endif /* __MACH_GENERIC_H */ |
diff --git a/arch/arm/mach-spear13xx/headsmp.S b/arch/arm/mach-spear/headsmp.S index ed85473a047f..ed85473a047f 100644 --- a/arch/arm/mach-spear13xx/headsmp.S +++ b/arch/arm/mach-spear/headsmp.S | |||
diff --git a/arch/arm/mach-spear13xx/hotplug.c b/arch/arm/mach-spear/hotplug.c index a7d2dd11a4f2..a7d2dd11a4f2 100644 --- a/arch/arm/mach-spear13xx/hotplug.c +++ b/arch/arm/mach-spear/hotplug.c | |||
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/mach-spear/include/mach/debug-macro.S index 75b05ad0fbad..75b05ad0fbad 100644 --- a/arch/arm/plat-spear/include/plat/debug-macro.S +++ b/arch/arm/mach-spear/include/mach/debug-macro.S | |||
diff --git a/arch/arm/mach-spear6xx/include/mach/irqs.h b/arch/arm/mach-spear/include/mach/irqs.h index 37a5c411a866..92da0a8c6bce 100644 --- a/arch/arm/mach-spear6xx/include/mach/irqs.h +++ b/arch/arm/mach-spear/include/mach/irqs.h | |||
@@ -1,10 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-spear6xx/include/mach/irqs.h | 2 | * IRQ helper macros for spear machine family |
3 | * | 3 | * |
4 | * IRQ helper macros for SPEAr6xx machine family | 4 | * Copyright (C) 2009-2012 ST Microelectronics |
5 | * | 5 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> |
6 | * Copyright (C) 2009 ST Microelectronics | 6 | * Viresh Kumar <viresh.linux@gmail.com> |
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | 7 | * |
9 | * This file is licensed under the terms of the GNU General Public | 8 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 9 | * License version 2. This program is licensed "as is" without any |
@@ -14,6 +13,11 @@ | |||
14 | #ifndef __MACH_IRQS_H | 13 | #ifndef __MACH_IRQS_H |
15 | #define __MACH_IRQS_H | 14 | #define __MACH_IRQS_H |
16 | 15 | ||
16 | #ifdef CONFIG_ARCH_SPEAR3XX | ||
17 | #define NR_IRQS 256 | ||
18 | #endif | ||
19 | |||
20 | #ifdef CONFIG_ARCH_SPEAR6XX | ||
17 | /* IRQ definitions */ | 21 | /* IRQ definitions */ |
18 | /* VIC 1 */ | 22 | /* VIC 1 */ |
19 | #define IRQ_VIC_END 64 | 23 | #define IRQ_VIC_END 64 |
@@ -21,5 +25,11 @@ | |||
21 | /* GPIO pins virtual irqs */ | 25 | /* GPIO pins virtual irqs */ |
22 | #define VIRTUAL_IRQS 24 | 26 | #define VIRTUAL_IRQS 24 |
23 | #define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS) | 27 | #define NR_IRQS (IRQ_VIC_END + VIRTUAL_IRQS) |
28 | #endif | ||
29 | |||
30 | #ifdef CONFIG_ARCH_SPEAR13XX | ||
31 | #define IRQ_GIC_END 160 | ||
32 | #define NR_IRQS IRQ_GIC_END | ||
33 | #endif | ||
24 | 34 | ||
25 | #endif /* __MACH_IRQS_H */ | 35 | #endif /* __MACH_IRQS_H */ |
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear/include/mach/misc_regs.h index 6309bf68d6f8..935639ce59ba 100644 --- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h +++ b/arch/arm/mach-spear/include/mach/misc_regs.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #include <mach/spear.h> | 17 | #include <mach/spear.h> |
18 | 18 | ||
19 | #define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE) | 19 | #define MISC_BASE (VA_SPEAR_ICM3_MISC_REG_BASE) |
20 | #define DMA_CHN_CFG (MISC_BASE + 0x0A0) | 20 | #define DMA_CHN_CFG (MISC_BASE + 0x0A0) |
21 | 21 | ||
22 | #endif /* __MACH_MISC_REGS_H */ | 22 | #endif /* __MACH_MISC_REGS_H */ |
diff --git a/arch/arm/mach-spear/include/mach/spear.h b/arch/arm/mach-spear/include/mach/spear.h new file mode 100644 index 000000000000..cf3a5369eeca --- /dev/null +++ b/arch/arm/mach-spear/include/mach/spear.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * SPEAr3xx/6xx Machine family specific definition | ||
3 | * | ||
4 | * Copyright (C) 2009,2012 ST Microelectronics | ||
5 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
6 | * Viresh Kumar <viresh.linux@gmail.com> | ||
7 | * | ||
8 | * This file is licensed under the terms of the GNU General Public | ||
9 | * License version 2. This program is licensed "as is" without any | ||
10 | * warranty of any kind, whether express or implied. | ||
11 | */ | ||
12 | |||
13 | #ifndef __MACH_SPEAR_H | ||
14 | #define __MACH_SPEAR_H | ||
15 | |||
16 | #include <asm/memory.h> | ||
17 | |||
18 | #if defined(CONFIG_ARCH_SPEAR3XX) || defined (CONFIG_ARCH_SPEAR6XX) | ||
19 | |||
20 | /* ICM1 - Low speed connection */ | ||
21 | #define SPEAR_ICM1_2_BASE UL(0xD0000000) | ||
22 | #define VA_SPEAR_ICM1_2_BASE IOMEM(0xFD000000) | ||
23 | #define SPEAR_ICM1_UART_BASE UL(0xD0000000) | ||
24 | #define VA_SPEAR_ICM1_UART_BASE (VA_SPEAR_ICM1_2_BASE - SPEAR_ICM1_2_BASE + SPEAR_ICM1_UART_BASE) | ||
25 | #define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) | ||
26 | |||
27 | /* ML-1, 2 - Multi Layer CPU Subsystem */ | ||
28 | #define SPEAR_ICM3_ML1_2_BASE UL(0xF0000000) | ||
29 | #define VA_SPEAR6XX_ML_CPU_BASE IOMEM(0xF0000000) | ||
30 | |||
31 | /* ICM3 - Basic Subsystem */ | ||
32 | #define SPEAR_ICM3_SMI_CTRL_BASE UL(0xFC000000) | ||
33 | #define VA_SPEAR_ICM3_SMI_CTRL_BASE IOMEM(0xFC000000) | ||
34 | #define SPEAR_ICM3_DMA_BASE UL(0xFC400000) | ||
35 | #define SPEAR_ICM3_SYS_CTRL_BASE UL(0xFCA00000) | ||
36 | #define VA_SPEAR_ICM3_SYS_CTRL_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE - SPEAR_ICM3_SMI_CTRL_BASE + SPEAR_ICM3_SYS_CTRL_BASE) | ||
37 | #define SPEAR_ICM3_MISC_REG_BASE UL(0xFCA80000) | ||
38 | #define VA_SPEAR_ICM3_MISC_REG_BASE (VA_SPEAR_ICM3_SMI_CTRL_BASE - SPEAR_ICM3_SMI_CTRL_BASE + SPEAR_ICM3_MISC_REG_BASE) | ||
39 | |||
40 | /* Debug uart for linux, will be used for debug and uncompress messages */ | ||
41 | #define SPEAR_DBG_UART_BASE SPEAR_ICM1_UART_BASE | ||
42 | #define VA_SPEAR_DBG_UART_BASE VA_SPEAR_ICM1_UART_BASE | ||
43 | |||
44 | /* Sysctl base for spear platform */ | ||
45 | #define SPEAR_SYS_CTRL_BASE SPEAR_ICM3_SYS_CTRL_BASE | ||
46 | #define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR_ICM3_SYS_CTRL_BASE | ||
47 | #endif /* SPEAR3xx || SPEAR6XX */ | ||
48 | |||
49 | /* SPEAr320 Macros */ | ||
50 | #define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000) | ||
51 | #define VA_SPEAR320_SOC_CONFIG_BASE IOMEM(0xFE000000) | ||
52 | |||
53 | #ifdef CONFIG_ARCH_SPEAR13XX | ||
54 | |||
55 | #define PERIP_GRP2_BASE UL(0xB3000000) | ||
56 | #define VA_PERIP_GRP2_BASE IOMEM(0xFE000000) | ||
57 | #define MCIF_SDHCI_BASE UL(0xB3000000) | ||
58 | #define SYSRAM0_BASE UL(0xB3800000) | ||
59 | #define VA_SYSRAM0_BASE IOMEM(0xFE800000) | ||
60 | #define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600) | ||
61 | |||
62 | #define PERIP_GRP1_BASE UL(0xE0000000) | ||
63 | #define VA_PERIP_GRP1_BASE IOMEM(0xFD000000) | ||
64 | #define UART_BASE UL(0xE0000000) | ||
65 | #define VA_UART_BASE IOMEM(0xFD000000) | ||
66 | #define SSP_BASE UL(0xE0100000) | ||
67 | #define MISC_BASE UL(0xE0700000) | ||
68 | #define VA_MISC_BASE IOMEM(0xFD700000) | ||
69 | |||
70 | #define A9SM_AND_MPMC_BASE UL(0xEC000000) | ||
71 | #define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000) | ||
72 | |||
73 | #define SPEAR1310_RAS_BASE UL(0xD8400000) | ||
74 | #define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000)) | ||
75 | |||
76 | /* A9SM peripheral offsets */ | ||
77 | #define A9SM_PERIP_BASE UL(0xEC800000) | ||
78 | #define VA_A9SM_PERIP_BASE IOMEM(0xFC800000) | ||
79 | #define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00) | ||
80 | |||
81 | #define L2CC_BASE UL(0xED000000) | ||
82 | #define VA_L2CC_BASE IOMEM(UL(0xFB000000)) | ||
83 | |||
84 | /* others */ | ||
85 | #define MCIF_CF_BASE UL(0xB2800000) | ||
86 | |||
87 | /* Debug uart for linux, will be used for debug and uncompress messages */ | ||
88 | #define SPEAR_DBG_UART_BASE UART_BASE | ||
89 | #define VA_SPEAR_DBG_UART_BASE VA_UART_BASE | ||
90 | |||
91 | #endif /* SPEAR13XX */ | ||
92 | |||
93 | #endif /* __MACH_SPEAR_H */ | ||
diff --git a/arch/arm/plat-spear/include/plat/timex.h b/arch/arm/mach-spear/include/mach/timex.h index ef95e5b780bd..ef95e5b780bd 100644 --- a/arch/arm/plat-spear/include/plat/timex.h +++ b/arch/arm/mach-spear/include/mach/timex.h | |||
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/mach-spear/include/mach/uncompress.h index 51b2dc93e4da..51b2dc93e4da 100644 --- a/arch/arm/plat-spear/include/plat/uncompress.h +++ b/arch/arm/mach-spear/include/mach/uncompress.h | |||
diff --git a/arch/arm/plat-spear/pl080.c b/arch/arm/mach-spear/pl080.c index cfa1199d0f4a..cfa1199d0f4a 100644 --- a/arch/arm/plat-spear/pl080.c +++ b/arch/arm/mach-spear/pl080.c | |||
diff --git a/arch/arm/plat-spear/include/plat/pl080.h b/arch/arm/mach-spear/pl080.h index eb6590ded40d..eb6590ded40d 100644 --- a/arch/arm/plat-spear/include/plat/pl080.h +++ b/arch/arm/mach-spear/pl080.h | |||
diff --git a/arch/arm/mach-spear13xx/platsmp.c b/arch/arm/mach-spear/platsmp.c index af4ade61cd95..927979e26b4d 100644 --- a/arch/arm/mach-spear13xx/platsmp.c +++ b/arch/arm/mach-spear/platsmp.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/cacheflush.h> | 19 | #include <asm/cacheflush.h> |
20 | #include <asm/smp_scu.h> | 20 | #include <asm/smp_scu.h> |
21 | #include <mach/spear.h> | 21 | #include <mach/spear.h> |
22 | #include <mach/generic.h> | 22 | #include "generic.h" |
23 | 23 | ||
24 | static DEFINE_SPINLOCK(boot_lock); | 24 | static DEFINE_SPINLOCK(boot_lock); |
25 | 25 | ||
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/mach-spear/restart.c index 7d4616d5df11..2b44500bb718 100644 --- a/arch/arm/plat-spear/restart.c +++ b/arch/arm/mach-spear/restart.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/amba/sp810.h> | 14 | #include <linux/amba/sp810.h> |
15 | #include <asm/system_misc.h> | 15 | #include <asm/system_misc.h> |
16 | #include <mach/spear.h> | 16 | #include <mach/spear.h> |
17 | #include <mach/generic.h> | 17 | #include "generic.h" |
18 | 18 | ||
19 | #define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) | 19 | #define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) |
20 | void spear_restart(char mode, const char *cmd) | 20 | void spear_restart(char mode, const char *cmd) |
@@ -26,7 +26,8 @@ void spear_restart(char mode, const char *cmd) | |||
26 | /* hardware reset, Use on-chip reset capability */ | 26 | /* hardware reset, Use on-chip reset capability */ |
27 | #ifdef CONFIG_ARCH_SPEAR13XX | 27 | #ifdef CONFIG_ARCH_SPEAR13XX |
28 | writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES); | 28 | writel_relaxed(0x01, SPEAR13XX_SYS_SW_RES); |
29 | #else | 29 | #endif |
30 | #if defined(CONFIG_ARCH_SPEAR3XX) || defined(CONFIG_ARCH_SPEAR6XX) | ||
30 | sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE); | 31 | sysctl_soft_reset((void __iomem *)VA_SPEAR_SYS_CTRL_BASE); |
31 | #endif | 32 | #endif |
32 | } | 33 | } |
diff --git a/arch/arm/mach-spear13xx/spear1310.c b/arch/arm/mach-spear/spear1310.c index 56214d1076ef..9eaac2c881ea 100644 --- a/arch/arm/mach-spear13xx/spear1310.c +++ b/arch/arm/mach-spear/spear1310.c | |||
@@ -19,46 +19,16 @@ | |||
19 | #include <linux/pata_arasan_cf_data.h> | 19 | #include <linux/pata_arasan_cf_data.h> |
20 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
21 | #include <asm/mach/map.h> | 21 | #include <asm/mach/map.h> |
22 | #include <mach/generic.h> | 22 | #include "generic.h" |
23 | #include <mach/spear.h> | 23 | #include <mach/spear.h> |
24 | 24 | ||
25 | /* Base addresses */ | 25 | /* Base addresses */ |
26 | #define SPEAR1310_SSP1_BASE UL(0x5D400000) | ||
27 | #define SPEAR1310_SATA0_BASE UL(0xB1000000) | ||
28 | #define SPEAR1310_SATA1_BASE UL(0xB1800000) | ||
29 | #define SPEAR1310_SATA2_BASE UL(0xB4000000) | ||
30 | |||
31 | #define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000) | 26 | #define SPEAR1310_RAS_GRP1_BASE UL(0xD8000000) |
32 | #define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000) | 27 | #define VA_SPEAR1310_RAS_GRP1_BASE UL(0xFA000000) |
33 | #define SPEAR1310_RAS_BASE UL(0xD8400000) | ||
34 | #define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000)) | ||
35 | |||
36 | static struct arasan_cf_pdata cf_pdata = { | ||
37 | .cf_if_clk = CF_IF_CLK_166M, | ||
38 | .quirk = CF_BROKEN_UDMA, | ||
39 | .dma_priv = &cf_dma_priv, | ||
40 | }; | ||
41 | |||
42 | /* ssp device registration */ | ||
43 | static struct pl022_ssp_controller ssp1_plat_data = { | ||
44 | .enable_dma = 0, | ||
45 | }; | ||
46 | |||
47 | /* Add SPEAr1310 auxdata to pass platform data */ | ||
48 | static struct of_dev_auxdata spear1310_auxdata_lookup[] __initdata = { | ||
49 | OF_DEV_AUXDATA("arasan,cf-spear1340", MCIF_CF_BASE, NULL, &cf_pdata), | ||
50 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC0_BASE, NULL, &dmac_plat_data), | ||
51 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC1_BASE, NULL, &dmac_plat_data), | ||
52 | OF_DEV_AUXDATA("arm,pl022", SSP_BASE, NULL, &pl022_plat_data), | ||
53 | |||
54 | OF_DEV_AUXDATA("arm,pl022", SPEAR1310_SSP1_BASE, NULL, &ssp1_plat_data), | ||
55 | {} | ||
56 | }; | ||
57 | 28 | ||
58 | static void __init spear1310_dt_init(void) | 29 | static void __init spear1310_dt_init(void) |
59 | { | 30 | { |
60 | of_platform_populate(NULL, of_default_bus_match_table, | 31 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
61 | spear1310_auxdata_lookup, NULL); | ||
62 | } | 32 | } |
63 | 33 | ||
64 | static const char * const spear1310_dt_board_compat[] = { | 34 | static const char * const spear1310_dt_board_compat[] = { |
diff --git a/arch/arm/mach-spear13xx/spear1340.c b/arch/arm/mach-spear/spear1340.c index 9a28beb2a113..a04a7fe76f71 100644 --- a/arch/arm/mach-spear13xx/spear1340.c +++ b/arch/arm/mach-spear/spear1340.c | |||
@@ -16,17 +16,16 @@ | |||
16 | #include <linux/ahci_platform.h> | 16 | #include <linux/ahci_platform.h> |
17 | #include <linux/amba/serial.h> | 17 | #include <linux/amba/serial.h> |
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | #include <linux/dw_dmac.h> | ||
20 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
21 | #include <linux/irqchip.h> | 20 | #include <linux/irqchip.h> |
22 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
23 | #include <mach/dma.h> | 22 | #include "generic.h" |
24 | #include <mach/generic.h> | ||
25 | #include <mach/spear.h> | 23 | #include <mach/spear.h> |
26 | 24 | ||
25 | /* FIXME: Move SATA PHY code into a standalone driver */ | ||
26 | |||
27 | /* Base addresses */ | 27 | /* Base addresses */ |
28 | #define SPEAR1340_SATA_BASE UL(0xB1000000) | 28 | #define SPEAR1340_SATA_BASE UL(0xB1000000) |
29 | #define SPEAR1340_UART1_BASE UL(0xB4100000) | ||
30 | 29 | ||
31 | /* Power Management Registers */ | 30 | /* Power Management Registers */ |
32 | #define SPEAR1340_PCM_CFG (VA_MISC_BASE + 0x100) | 31 | #define SPEAR1340_PCM_CFG (VA_MISC_BASE + 0x100) |
@@ -78,28 +77,6 @@ | |||
78 | (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \ | 77 | (SPEAR1340_MIPHY_OSC_BYPASS_EXT | \ |
79 | SPEAR1340_MIPHY_PLL_RATIO_TOP(25)) | 78 | SPEAR1340_MIPHY_PLL_RATIO_TOP(25)) |
80 | 79 | ||
81 | static struct dw_dma_slave uart1_dma_param[] = { | ||
82 | { | ||
83 | /* Tx */ | ||
84 | .cfg_hi = DWC_CFGH_DST_PER(SPEAR1340_DMA_REQ_UART1_TX), | ||
85 | .cfg_lo = 0, | ||
86 | .src_master = DMA_MASTER_MEMORY, | ||
87 | .dst_master = SPEAR1340_DMA_MASTER_UART1, | ||
88 | }, { | ||
89 | /* Rx */ | ||
90 | .cfg_hi = DWC_CFGH_SRC_PER(SPEAR1340_DMA_REQ_UART1_RX), | ||
91 | .cfg_lo = 0, | ||
92 | .src_master = SPEAR1340_DMA_MASTER_UART1, | ||
93 | .dst_master = DMA_MASTER_MEMORY, | ||
94 | } | ||
95 | }; | ||
96 | |||
97 | static struct amba_pl011_data uart1_data = { | ||
98 | .dma_filter = dw_dma_filter, | ||
99 | .dma_tx_param = &uart1_dma_param[0], | ||
100 | .dma_rx_param = &uart1_dma_param[1], | ||
101 | }; | ||
102 | |||
103 | /* SATA device registration */ | 80 | /* SATA device registration */ |
104 | static int sata_miphy_init(struct device *dev, void __iomem *addr) | 81 | static int sata_miphy_init(struct device *dev, void __iomem *addr) |
105 | { | 82 | { |
@@ -158,14 +135,8 @@ static struct ahci_platform_data sata_pdata = { | |||
158 | 135 | ||
159 | /* Add SPEAr1340 auxdata to pass platform data */ | 136 | /* Add SPEAr1340 auxdata to pass platform data */ |
160 | static struct of_dev_auxdata spear1340_auxdata_lookup[] __initdata = { | 137 | static struct of_dev_auxdata spear1340_auxdata_lookup[] __initdata = { |
161 | OF_DEV_AUXDATA("arasan,cf-spear1340", MCIF_CF_BASE, NULL, &cf_dma_priv), | ||
162 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC0_BASE, NULL, &dmac_plat_data), | ||
163 | OF_DEV_AUXDATA("snps,dma-spear1340", DMAC1_BASE, NULL, &dmac_plat_data), | ||
164 | OF_DEV_AUXDATA("arm,pl022", SSP_BASE, NULL, &pl022_plat_data), | ||
165 | |||
166 | OF_DEV_AUXDATA("snps,spear-ahci", SPEAR1340_SATA_BASE, NULL, | 138 | OF_DEV_AUXDATA("snps,spear-ahci", SPEAR1340_SATA_BASE, NULL, |
167 | &sata_pdata), | 139 | &sata_pdata), |
168 | OF_DEV_AUXDATA("arm,pl011", SPEAR1340_UART1_BASE, NULL, &uart1_data), | ||
169 | {} | 140 | {} |
170 | }; | 141 | }; |
171 | 142 | ||
diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear/spear13xx.c index 25a10191b021..3621599c38ad 100644 --- a/arch/arm/mach-spear13xx/spear13xx.c +++ b/arch/arm/mach-spear/spear13xx.c | |||
@@ -16,69 +16,12 @@ | |||
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/clocksource.h> |
19 | #include <linux/dw_dmac.h> | ||
20 | #include <linux/err.h> | 19 | #include <linux/err.h> |
21 | #include <linux/of.h> | 20 | #include <linux/of.h> |
22 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
23 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
24 | #include <mach/dma.h> | ||
25 | #include <mach/generic.h> | ||
26 | #include <mach/spear.h> | 23 | #include <mach/spear.h> |
27 | 24 | #include "generic.h" | |
28 | /* common dw_dma filter routine to be used by peripherals */ | ||
29 | bool dw_dma_filter(struct dma_chan *chan, void *slave) | ||
30 | { | ||
31 | struct dw_dma_slave *dws = (struct dw_dma_slave *)slave; | ||
32 | |||
33 | if (chan->device->dev == dws->dma_dev) { | ||
34 | chan->private = slave; | ||
35 | return true; | ||
36 | } else { | ||
37 | return false; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | /* ssp device registration */ | ||
42 | static struct dw_dma_slave ssp_dma_param[] = { | ||
43 | { | ||
44 | /* Tx */ | ||
45 | .cfg_hi = DWC_CFGH_DST_PER(DMA_REQ_SSP0_TX), | ||
46 | .cfg_lo = 0, | ||
47 | .src_master = DMA_MASTER_MEMORY, | ||
48 | .dst_master = DMA_MASTER_SSP0, | ||
49 | }, { | ||
50 | /* Rx */ | ||
51 | .cfg_hi = DWC_CFGH_SRC_PER(DMA_REQ_SSP0_RX), | ||
52 | .cfg_lo = 0, | ||
53 | .src_master = DMA_MASTER_SSP0, | ||
54 | .dst_master = DMA_MASTER_MEMORY, | ||
55 | } | ||
56 | }; | ||
57 | |||
58 | struct pl022_ssp_controller pl022_plat_data = { | ||
59 | .enable_dma = 1, | ||
60 | .dma_filter = dw_dma_filter, | ||
61 | .dma_rx_param = &ssp_dma_param[1], | ||
62 | .dma_tx_param = &ssp_dma_param[0], | ||
63 | }; | ||
64 | |||
65 | /* CF device registration */ | ||
66 | struct dw_dma_slave cf_dma_priv = { | ||
67 | .cfg_hi = 0, | ||
68 | .cfg_lo = 0, | ||
69 | .src_master = 0, | ||
70 | .dst_master = 0, | ||
71 | }; | ||
72 | |||
73 | /* dmac device registeration */ | ||
74 | struct dw_dma_platform_data dmac_plat_data = { | ||
75 | .nr_channels = 8, | ||
76 | .chan_allocation_order = CHAN_ALLOCATION_DESCENDING, | ||
77 | .chan_priority = CHAN_PRIORITY_DESCENDING, | ||
78 | .block_size = 4095U, | ||
79 | .nr_masters = 2, | ||
80 | .data_width = { 3, 3, 0, 0 }, | ||
81 | }; | ||
82 | 25 | ||
83 | void __init spear13xx_l2x0_init(void) | 26 | void __init spear13xx_l2x0_init(void) |
84 | { | 27 | { |
@@ -145,9 +88,9 @@ void __init spear13xx_map_io(void) | |||
145 | static void __init spear13xx_clk_init(void) | 88 | static void __init spear13xx_clk_init(void) |
146 | { | 89 | { |
147 | if (of_machine_is_compatible("st,spear1310")) | 90 | if (of_machine_is_compatible("st,spear1310")) |
148 | spear1310_clk_init(); | 91 | spear1310_clk_init(VA_MISC_BASE, VA_SPEAR1310_RAS_BASE); |
149 | else if (of_machine_is_compatible("st,spear1340")) | 92 | else if (of_machine_is_compatible("st,spear1340")) |
150 | spear1340_clk_init(); | 93 | spear1340_clk_init(VA_MISC_BASE); |
151 | else | 94 | else |
152 | pr_err("%s: Unknown machine\n", __func__); | 95 | pr_err("%s: Unknown machine\n", __func__); |
153 | } | 96 | } |
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear/spear300.c index bbc9b7e9c62c..bac56e845f7a 100644 --- a/arch/arm/mach-spear3xx/spear300.c +++ b/arch/arm/mach-spear/spear300.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/irqchip.h> | 17 | #include <linux/irqchip.h> |
18 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
19 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
20 | #include <mach/generic.h> | 20 | #include "generic.h" |
21 | #include <mach/spear.h> | 21 | #include <mach/spear.h> |
22 | 22 | ||
23 | /* DMAC platform data's slave info */ | 23 | /* DMAC platform data's slave info */ |
@@ -185,7 +185,7 @@ struct pl08x_channel_data spear300_dma_info[] = { | |||
185 | static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = { | 185 | static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = { |
186 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, | 186 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, |
187 | &pl022_plat_data), | 187 | &pl022_plat_data), |
188 | OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, | 188 | OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL, |
189 | &pl080_plat_data), | 189 | &pl080_plat_data), |
190 | {} | 190 | {} |
191 | }; | 191 | }; |
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear/spear310.c index c13a434a8195..6ffbc63d516d 100644 --- a/arch/arm/mach-spear3xx/spear310.c +++ b/arch/arm/mach-spear/spear310.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/irqchip.h> | 18 | #include <linux/irqchip.h> |
19 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
20 | #include <asm/mach/arch.h> | 20 | #include <asm/mach/arch.h> |
21 | #include <mach/generic.h> | 21 | #include "generic.h" |
22 | #include <mach/spear.h> | 22 | #include <mach/spear.h> |
23 | 23 | ||
24 | #define SPEAR310_UART1_BASE UL(0xB2000000) | 24 | #define SPEAR310_UART1_BASE UL(0xB2000000) |
@@ -217,7 +217,7 @@ static struct amba_pl011_data spear310_uart_data[] = { | |||
217 | static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = { | 217 | static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = { |
218 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, | 218 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, |
219 | &pl022_plat_data), | 219 | &pl022_plat_data), |
220 | OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, | 220 | OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL, |
221 | &pl080_plat_data), | 221 | &pl080_plat_data), |
222 | OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL, | 222 | OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL, |
223 | &spear310_uart_data[0]), | 223 | &spear310_uart_data[0]), |
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear/spear320.c index e1c77079a3e5..6eb3eec65f96 100644 --- a/arch/arm/mach-spear3xx/spear320.c +++ b/arch/arm/mach-spear/spear320.c | |||
@@ -19,7 +19,8 @@ | |||
19 | #include <linux/irqchip.h> | 19 | #include <linux/irqchip.h> |
20 | #include <linux/of_platform.h> | 20 | #include <linux/of_platform.h> |
21 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
22 | #include <mach/generic.h> | 22 | #include <asm/mach/map.h> |
23 | #include "generic.h" | ||
23 | #include <mach/spear.h> | 24 | #include <mach/spear.h> |
24 | 25 | ||
25 | #define SPEAR320_UART1_BASE UL(0xA3000000) | 26 | #define SPEAR320_UART1_BASE UL(0xA3000000) |
@@ -222,7 +223,7 @@ static struct amba_pl011_data spear320_uart_data[] = { | |||
222 | static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = { | 223 | static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = { |
223 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, | 224 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, |
224 | &pl022_plat_data), | 225 | &pl022_plat_data), |
225 | OF_DEV_AUXDATA("arm,pl080", SPEAR3XX_ICM3_DMA_BASE, NULL, | 226 | OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL, |
226 | &pl080_plat_data), | 227 | &pl080_plat_data), |
227 | OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL, | 228 | OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL, |
228 | &spear320_ssp_data[0]), | 229 | &spear320_ssp_data[0]), |
@@ -253,7 +254,7 @@ static const char * const spear320_dt_board_compat[] = { | |||
253 | 254 | ||
254 | struct map_desc spear320_io_desc[] __initdata = { | 255 | struct map_desc spear320_io_desc[] __initdata = { |
255 | { | 256 | { |
256 | .virtual = VA_SPEAR320_SOC_CONFIG_BASE, | 257 | .virtual = (unsigned long)VA_SPEAR320_SOC_CONFIG_BASE, |
257 | .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE), | 258 | .pfn = __phys_to_pfn(SPEAR320_SOC_CONFIG_BASE), |
258 | .length = SZ_16M, | 259 | .length = SZ_16M, |
259 | .type = MT_DEVICE | 260 | .type = MT_DEVICE |
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear/spear3xx.c index d2b3937c4014..0227c97797cd 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear/spear3xx.c | |||
@@ -15,10 +15,13 @@ | |||
15 | 15 | ||
16 | #include <linux/amba/pl022.h> | 16 | #include <linux/amba/pl022.h> |
17 | #include <linux/amba/pl080.h> | 17 | #include <linux/amba/pl080.h> |
18 | #include <linux/clk.h> | ||
18 | #include <linux/io.h> | 19 | #include <linux/io.h> |
19 | #include <plat/pl080.h> | 20 | #include <asm/mach/map.h> |
20 | #include <mach/generic.h> | 21 | #include "pl080.h" |
22 | #include "generic.h" | ||
21 | #include <mach/spear.h> | 23 | #include <mach/spear.h> |
24 | #include <mach/misc_regs.h> | ||
22 | 25 | ||
23 | /* ssp device registration */ | 26 | /* ssp device registration */ |
24 | struct pl022_ssp_controller pl022_plat_data = { | 27 | struct pl022_ssp_controller pl022_plat_data = { |
@@ -65,13 +68,13 @@ struct pl08x_platform_data pl080_plat_data = { | |||
65 | */ | 68 | */ |
66 | struct map_desc spear3xx_io_desc[] __initdata = { | 69 | struct map_desc spear3xx_io_desc[] __initdata = { |
67 | { | 70 | { |
68 | .virtual = VA_SPEAR3XX_ICM1_2_BASE, | 71 | .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE, |
69 | .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE), | 72 | .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE), |
70 | .length = SZ_16M, | 73 | .length = SZ_16M, |
71 | .type = MT_DEVICE | 74 | .type = MT_DEVICE |
72 | }, { | 75 | }, { |
73 | .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE, | 76 | .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE, |
74 | .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE), | 77 | .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE), |
75 | .length = SZ_16M, | 78 | .length = SZ_16M, |
76 | .type = MT_DEVICE | 79 | .type = MT_DEVICE |
77 | }, | 80 | }, |
@@ -88,7 +91,7 @@ void __init spear3xx_timer_init(void) | |||
88 | char pclk_name[] = "pll3_clk"; | 91 | char pclk_name[] = "pll3_clk"; |
89 | struct clk *gpt_clk, *pclk; | 92 | struct clk *gpt_clk, *pclk; |
90 | 93 | ||
91 | spear3xx_clk_init(); | 94 | spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE); |
92 | 95 | ||
93 | /* get the system timer clock */ | 96 | /* get the system timer clock */ |
94 | gpt_clk = clk_get_sys("gpt0", NULL); | 97 | gpt_clk = clk_get_sys("gpt0", NULL); |
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear/spear6xx.c index 8904d8a52d84..ec8eefbbdfad 100644 --- a/arch/arm/mach-spear6xx/spear6xx.c +++ b/arch/arm/mach-spear/spear6xx.c | |||
@@ -24,9 +24,10 @@ | |||
24 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/time.h> | 25 | #include <asm/mach/time.h> |
26 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
27 | #include <plat/pl080.h> | 27 | #include "pl080.h" |
28 | #include <mach/generic.h> | 28 | #include "generic.h" |
29 | #include <mach/spear.h> | 29 | #include <mach/spear.h> |
30 | #include <mach/misc_regs.h> | ||
30 | 31 | ||
31 | /* dmac device registration */ | 32 | /* dmac device registration */ |
32 | static struct pl08x_channel_data spear600_dma_info[] = { | 33 | static struct pl08x_channel_data spear600_dma_info[] = { |
@@ -321,7 +322,7 @@ static struct pl08x_channel_data spear600_dma_info[] = { | |||
321 | }, | 322 | }, |
322 | }; | 323 | }; |
323 | 324 | ||
324 | struct pl08x_platform_data pl080_plat_data = { | 325 | static struct pl08x_platform_data spear6xx_pl080_plat_data = { |
325 | .memcpy_channel = { | 326 | .memcpy_channel = { |
326 | .bus_id = "memcpy", | 327 | .bus_id = "memcpy", |
327 | .cctl_memcpy = | 328 | .cctl_memcpy = |
@@ -350,18 +351,18 @@ struct pl08x_platform_data pl080_plat_data = { | |||
350 | */ | 351 | */ |
351 | struct map_desc spear6xx_io_desc[] __initdata = { | 352 | struct map_desc spear6xx_io_desc[] __initdata = { |
352 | { | 353 | { |
353 | .virtual = VA_SPEAR6XX_ML_CPU_BASE, | 354 | .virtual = (unsigned long)VA_SPEAR6XX_ML_CPU_BASE, |
354 | .pfn = __phys_to_pfn(SPEAR6XX_ML_CPU_BASE), | 355 | .pfn = __phys_to_pfn(SPEAR_ICM3_ML1_2_BASE), |
355 | .length = 2 * SZ_16M, | 356 | .length = 2 * SZ_16M, |
356 | .type = MT_DEVICE | 357 | .type = MT_DEVICE |
357 | }, { | 358 | }, { |
358 | .virtual = VA_SPEAR6XX_ICM1_BASE, | 359 | .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE, |
359 | .pfn = __phys_to_pfn(SPEAR6XX_ICM1_BASE), | 360 | .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE), |
360 | .length = SZ_16M, | 361 | .length = SZ_16M, |
361 | .type = MT_DEVICE | 362 | .type = MT_DEVICE |
362 | }, { | 363 | }, { |
363 | .virtual = VA_SPEAR6XX_ICM3_SMI_CTRL_BASE, | 364 | .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE, |
364 | .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SMI_CTRL_BASE), | 365 | .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE), |
365 | .length = SZ_16M, | 366 | .length = SZ_16M, |
366 | .type = MT_DEVICE | 367 | .type = MT_DEVICE |
367 | }, | 368 | }, |
@@ -378,7 +379,7 @@ void __init spear6xx_timer_init(void) | |||
378 | char pclk_name[] = "pll3_clk"; | 379 | char pclk_name[] = "pll3_clk"; |
379 | struct clk *gpt_clk, *pclk; | 380 | struct clk *gpt_clk, *pclk; |
380 | 381 | ||
381 | spear6xx_clk_init(); | 382 | spear6xx_clk_init(MISC_BASE); |
382 | 383 | ||
383 | /* get the system timer clock */ | 384 | /* get the system timer clock */ |
384 | gpt_clk = clk_get_sys("gpt0", NULL); | 385 | gpt_clk = clk_get_sys("gpt0", NULL); |
@@ -404,8 +405,8 @@ void __init spear6xx_timer_init(void) | |||
404 | 405 | ||
405 | /* Add auxdata to pass platform data */ | 406 | /* Add auxdata to pass platform data */ |
406 | struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = { | 407 | struct of_dev_auxdata spear6xx_auxdata_lookup[] __initdata = { |
407 | OF_DEV_AUXDATA("arm,pl080", SPEAR6XX_ICM3_DMA_BASE, NULL, | 408 | OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL, |
408 | &pl080_plat_data), | 409 | &spear6xx_pl080_plat_data), |
409 | {} | 410 | {} |
410 | }; | 411 | }; |
411 | 412 | ||
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/mach-spear/time.c index bd5c53cd6962..d449673e40f7 100644 --- a/arch/arm/plat-spear/time.c +++ b/arch/arm/mach-spear/time.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/time.h> | 23 | #include <linux/time.h> |
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <asm/mach/time.h> | 25 | #include <asm/mach/time.h> |
26 | #include <mach/generic.h> | 26 | #include "generic.h" |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * We would use TIMER0 and TIMER1 as clockevent and clocksource. | 29 | * We would use TIMER0 and TIMER1 as clockevent and clocksource. |
diff --git a/arch/arm/mach-spear13xx/Kconfig b/arch/arm/mach-spear13xx/Kconfig deleted file mode 100644 index eaadc66d96b3..000000000000 --- a/arch/arm/mach-spear13xx/Kconfig +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | # | ||
2 | # SPEAr13XX Machine configuration file | ||
3 | # | ||
4 | |||
5 | if ARCH_SPEAR13XX | ||
6 | |||
7 | menu "SPEAr13xx Implementations" | ||
8 | config MACH_SPEAR1310 | ||
9 | bool "SPEAr1310 Machine support with Device Tree" | ||
10 | select PINCTRL_SPEAR1310 | ||
11 | help | ||
12 | Supports ST SPEAr1310 machine configured via the device-tree | ||
13 | |||
14 | config MACH_SPEAR1340 | ||
15 | bool "SPEAr1340 Machine support with Device Tree" | ||
16 | select PINCTRL_SPEAR1340 | ||
17 | help | ||
18 | Supports ST SPEAr1340 machine configured via the device-tree | ||
19 | endmenu | ||
20 | endif #ARCH_SPEAR13XX | ||
diff --git a/arch/arm/mach-spear13xx/Makefile b/arch/arm/mach-spear13xx/Makefile deleted file mode 100644 index 3435ea78c15d..000000000000 --- a/arch/arm/mach-spear13xx/Makefile +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for SPEAr13XX machine series | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_SMP) += headsmp.o platsmp.o | ||
6 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o | ||
7 | |||
8 | obj-$(CONFIG_ARCH_SPEAR13XX) += spear13xx.o | ||
9 | obj-$(CONFIG_MACH_SPEAR1310) += spear1310.o | ||
10 | obj-$(CONFIG_MACH_SPEAR1340) += spear1340.o | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/debug-macro.S b/arch/arm/mach-spear13xx/include/mach/debug-macro.S deleted file mode 100644 index 9e3ae6bfe50d..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/debug-macro.S +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear13xx/include/mach/debug-macro.S | ||
3 | * | ||
4 | * Debugging macro include header spear13xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/dma.h b/arch/arm/mach-spear13xx/include/mach/dma.h deleted file mode 100644 index d50bdb605925..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/dma.h +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear13xx/include/mach/dma.h | ||
3 | * | ||
4 | * DMA information for SPEAr13xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_DMA_H | ||
15 | #define __MACH_DMA_H | ||
16 | |||
17 | /* request id of all the peripherals */ | ||
18 | enum dma_master_info { | ||
19 | /* Accessible from only one master */ | ||
20 | DMA_MASTER_MCIF = 0, | ||
21 | DMA_MASTER_FSMC = 1, | ||
22 | /* Accessible from both 0 & 1 */ | ||
23 | DMA_MASTER_MEMORY = 0, | ||
24 | DMA_MASTER_ADC = 0, | ||
25 | DMA_MASTER_UART0 = 0, | ||
26 | DMA_MASTER_SSP0 = 0, | ||
27 | DMA_MASTER_I2C0 = 0, | ||
28 | |||
29 | #ifdef CONFIG_MACH_SPEAR1310 | ||
30 | /* Accessible from only one master */ | ||
31 | SPEAR1310_DMA_MASTER_JPEG = 1, | ||
32 | |||
33 | /* Accessible from both 0 & 1 */ | ||
34 | SPEAR1310_DMA_MASTER_I2S = 0, | ||
35 | SPEAR1310_DMA_MASTER_UART1 = 0, | ||
36 | SPEAR1310_DMA_MASTER_UART2 = 0, | ||
37 | SPEAR1310_DMA_MASTER_UART3 = 0, | ||
38 | SPEAR1310_DMA_MASTER_UART4 = 0, | ||
39 | SPEAR1310_DMA_MASTER_UART5 = 0, | ||
40 | SPEAR1310_DMA_MASTER_I2C1 = 0, | ||
41 | SPEAR1310_DMA_MASTER_I2C2 = 0, | ||
42 | SPEAR1310_DMA_MASTER_I2C3 = 0, | ||
43 | SPEAR1310_DMA_MASTER_I2C4 = 0, | ||
44 | SPEAR1310_DMA_MASTER_I2C5 = 0, | ||
45 | SPEAR1310_DMA_MASTER_I2C6 = 0, | ||
46 | SPEAR1310_DMA_MASTER_I2C7 = 0, | ||
47 | SPEAR1310_DMA_MASTER_SSP1 = 0, | ||
48 | #endif | ||
49 | |||
50 | #ifdef CONFIG_MACH_SPEAR1340 | ||
51 | /* Accessible from only one master */ | ||
52 | SPEAR1340_DMA_MASTER_I2S_PLAY = 1, | ||
53 | SPEAR1340_DMA_MASTER_I2S_REC = 1, | ||
54 | SPEAR1340_DMA_MASTER_I2C1 = 1, | ||
55 | SPEAR1340_DMA_MASTER_UART1 = 1, | ||
56 | |||
57 | /* following are accessible from both master 0 & 1 */ | ||
58 | SPEAR1340_DMA_MASTER_SPDIF = 0, | ||
59 | SPEAR1340_DMA_MASTER_CAM = 1, | ||
60 | SPEAR1340_DMA_MASTER_VIDEO_IN = 0, | ||
61 | SPEAR1340_DMA_MASTER_MALI = 0, | ||
62 | #endif | ||
63 | }; | ||
64 | |||
65 | enum request_id { | ||
66 | DMA_REQ_ADC = 0, | ||
67 | DMA_REQ_SSP0_TX = 4, | ||
68 | DMA_REQ_SSP0_RX = 5, | ||
69 | DMA_REQ_UART0_TX = 6, | ||
70 | DMA_REQ_UART0_RX = 7, | ||
71 | DMA_REQ_I2C0_TX = 8, | ||
72 | DMA_REQ_I2C0_RX = 9, | ||
73 | |||
74 | #ifdef CONFIG_MACH_SPEAR1310 | ||
75 | SPEAR1310_DMA_REQ_FROM_JPEG = 2, | ||
76 | SPEAR1310_DMA_REQ_TO_JPEG = 3, | ||
77 | SPEAR1310_DMA_REQ_I2S_TX = 10, | ||
78 | SPEAR1310_DMA_REQ_I2S_RX = 11, | ||
79 | |||
80 | SPEAR1310_DMA_REQ_I2C1_RX = 0, | ||
81 | SPEAR1310_DMA_REQ_I2C1_TX = 1, | ||
82 | SPEAR1310_DMA_REQ_I2C2_RX = 2, | ||
83 | SPEAR1310_DMA_REQ_I2C2_TX = 3, | ||
84 | SPEAR1310_DMA_REQ_I2C3_RX = 4, | ||
85 | SPEAR1310_DMA_REQ_I2C3_TX = 5, | ||
86 | SPEAR1310_DMA_REQ_I2C4_RX = 6, | ||
87 | SPEAR1310_DMA_REQ_I2C4_TX = 7, | ||
88 | SPEAR1310_DMA_REQ_I2C5_RX = 8, | ||
89 | SPEAR1310_DMA_REQ_I2C5_TX = 9, | ||
90 | SPEAR1310_DMA_REQ_I2C6_RX = 10, | ||
91 | SPEAR1310_DMA_REQ_I2C6_TX = 11, | ||
92 | SPEAR1310_DMA_REQ_UART1_RX = 12, | ||
93 | SPEAR1310_DMA_REQ_UART1_TX = 13, | ||
94 | SPEAR1310_DMA_REQ_UART2_RX = 14, | ||
95 | SPEAR1310_DMA_REQ_UART2_TX = 15, | ||
96 | SPEAR1310_DMA_REQ_UART5_RX = 16, | ||
97 | SPEAR1310_DMA_REQ_UART5_TX = 17, | ||
98 | SPEAR1310_DMA_REQ_SSP1_RX = 18, | ||
99 | SPEAR1310_DMA_REQ_SSP1_TX = 19, | ||
100 | SPEAR1310_DMA_REQ_I2C7_RX = 20, | ||
101 | SPEAR1310_DMA_REQ_I2C7_TX = 21, | ||
102 | SPEAR1310_DMA_REQ_UART3_RX = 28, | ||
103 | SPEAR1310_DMA_REQ_UART3_TX = 29, | ||
104 | SPEAR1310_DMA_REQ_UART4_RX = 30, | ||
105 | SPEAR1310_DMA_REQ_UART4_TX = 31, | ||
106 | #endif | ||
107 | |||
108 | #ifdef CONFIG_MACH_SPEAR1340 | ||
109 | SPEAR1340_DMA_REQ_SPDIF_TX = 2, | ||
110 | SPEAR1340_DMA_REQ_SPDIF_RX = 3, | ||
111 | SPEAR1340_DMA_REQ_I2S_TX = 10, | ||
112 | SPEAR1340_DMA_REQ_I2S_RX = 11, | ||
113 | SPEAR1340_DMA_REQ_UART1_TX = 12, | ||
114 | SPEAR1340_DMA_REQ_UART1_RX = 13, | ||
115 | SPEAR1340_DMA_REQ_I2C1_TX = 14, | ||
116 | SPEAR1340_DMA_REQ_I2C1_RX = 15, | ||
117 | SPEAR1340_DMA_REQ_CAM0_EVEN = 0, | ||
118 | SPEAR1340_DMA_REQ_CAM0_ODD = 1, | ||
119 | SPEAR1340_DMA_REQ_CAM1_EVEN = 2, | ||
120 | SPEAR1340_DMA_REQ_CAM1_ODD = 3, | ||
121 | SPEAR1340_DMA_REQ_CAM2_EVEN = 4, | ||
122 | SPEAR1340_DMA_REQ_CAM2_ODD = 5, | ||
123 | SPEAR1340_DMA_REQ_CAM3_EVEN = 6, | ||
124 | SPEAR1340_DMA_REQ_CAM3_ODD = 7, | ||
125 | #endif | ||
126 | }; | ||
127 | |||
128 | #endif /* __MACH_DMA_H */ | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/hardware.h b/arch/arm/mach-spear13xx/include/mach/hardware.h deleted file mode 100644 index 40a8c178f10d..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/hardware.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | /* empty */ | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/irqs.h b/arch/arm/mach-spear13xx/include/mach/irqs.h deleted file mode 100644 index 271a62b4cd31..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/irqs.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear13xx/include/mach/irqs.h | ||
3 | * | ||
4 | * IRQ helper macros for spear13xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_IRQS_H | ||
15 | #define __MACH_IRQS_H | ||
16 | |||
17 | #define IRQ_GIC_END 160 | ||
18 | #define NR_IRQS IRQ_GIC_END | ||
19 | |||
20 | #endif /* __MACH_IRQS_H */ | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/spear.h b/arch/arm/mach-spear13xx/include/mach/spear.h deleted file mode 100644 index 7cfa6818865a..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/spear.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear13xx/include/mach/spear.h | ||
3 | * | ||
4 | * spear13xx Machine family specific definition | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_SPEAR13XX_H | ||
15 | #define __MACH_SPEAR13XX_H | ||
16 | |||
17 | #include <asm/memory.h> | ||
18 | |||
19 | #define PERIP_GRP2_BASE UL(0xB3000000) | ||
20 | #define VA_PERIP_GRP2_BASE IOMEM(0xFE000000) | ||
21 | #define MCIF_SDHCI_BASE UL(0xB3000000) | ||
22 | #define SYSRAM0_BASE UL(0xB3800000) | ||
23 | #define VA_SYSRAM0_BASE IOMEM(0xFE800000) | ||
24 | #define SYS_LOCATION (VA_SYSRAM0_BASE + 0x600) | ||
25 | |||
26 | #define PERIP_GRP1_BASE UL(0xE0000000) | ||
27 | #define VA_PERIP_GRP1_BASE IOMEM(0xFD000000) | ||
28 | #define UART_BASE UL(0xE0000000) | ||
29 | #define VA_UART_BASE IOMEM(0xFD000000) | ||
30 | #define SSP_BASE UL(0xE0100000) | ||
31 | #define MISC_BASE UL(0xE0700000) | ||
32 | #define VA_MISC_BASE IOMEM(0xFD700000) | ||
33 | |||
34 | #define A9SM_AND_MPMC_BASE UL(0xEC000000) | ||
35 | #define VA_A9SM_AND_MPMC_BASE IOMEM(0xFC000000) | ||
36 | |||
37 | /* A9SM peripheral offsets */ | ||
38 | #define A9SM_PERIP_BASE UL(0xEC800000) | ||
39 | #define VA_A9SM_PERIP_BASE IOMEM(0xFC800000) | ||
40 | #define VA_SCU_BASE (VA_A9SM_PERIP_BASE + 0x00) | ||
41 | |||
42 | #define L2CC_BASE UL(0xED000000) | ||
43 | #define VA_L2CC_BASE IOMEM(UL(0xFB000000)) | ||
44 | |||
45 | /* others */ | ||
46 | #define DMAC0_BASE UL(0xEA800000) | ||
47 | #define DMAC1_BASE UL(0xEB000000) | ||
48 | #define MCIF_CF_BASE UL(0xB2800000) | ||
49 | |||
50 | /* Debug uart for linux, will be used for debug and uncompress messages */ | ||
51 | #define SPEAR_DBG_UART_BASE UART_BASE | ||
52 | #define VA_SPEAR_DBG_UART_BASE VA_UART_BASE | ||
53 | |||
54 | #endif /* __MACH_SPEAR13XX_H */ | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/timex.h b/arch/arm/mach-spear13xx/include/mach/timex.h deleted file mode 100644 index 3a58b8284a6a..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/timex.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/timex.h | ||
3 | * | ||
4 | * SPEAr3XX machine family specific timex definitions | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_TIMEX_H | ||
15 | #define __MACH_TIMEX_H | ||
16 | |||
17 | #include <plat/timex.h> | ||
18 | |||
19 | #endif /* __MACH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-spear13xx/include/mach/uncompress.h b/arch/arm/mach-spear13xx/include/mach/uncompress.h deleted file mode 100644 index 70fe72f05dea..000000000000 --- a/arch/arm/mach-spear13xx/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear13xx/include/mach/uncompress.h | ||
3 | * | ||
4 | * Serial port stubs for kernel decompress status messages | ||
5 | * | ||
6 | * Copyright (C) 2012 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_UNCOMPRESS_H | ||
15 | #define __MACH_UNCOMPRESS_H | ||
16 | |||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | #endif /* __MACH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-spear3xx/Kconfig b/arch/arm/mach-spear3xx/Kconfig deleted file mode 100644 index 8bd37291fa4f..000000000000 --- a/arch/arm/mach-spear3xx/Kconfig +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | # | ||
2 | # SPEAr3XX Machine configuration file | ||
3 | # | ||
4 | |||
5 | if ARCH_SPEAR3XX | ||
6 | |||
7 | menu "SPEAr3xx Implementations" | ||
8 | config MACH_SPEAR300 | ||
9 | bool "SPEAr300 Machine support with Device Tree" | ||
10 | select PINCTRL_SPEAR300 | ||
11 | help | ||
12 | Supports ST SPEAr300 machine configured via the device-tree | ||
13 | |||
14 | config MACH_SPEAR310 | ||
15 | bool "SPEAr310 Machine support with Device Tree" | ||
16 | select PINCTRL_SPEAR310 | ||
17 | help | ||
18 | Supports ST SPEAr310 machine configured via the device-tree | ||
19 | |||
20 | config MACH_SPEAR320 | ||
21 | bool "SPEAr320 Machine support with Device Tree" | ||
22 | select PINCTRL_SPEAR320 | ||
23 | help | ||
24 | Supports ST SPEAr320 machine configured via the device-tree | ||
25 | endmenu | ||
26 | endif #ARCH_SPEAR3XX | ||
diff --git a/arch/arm/mach-spear3xx/Makefile b/arch/arm/mach-spear3xx/Makefile deleted file mode 100644 index 8d12faa178fd..000000000000 --- a/arch/arm/mach-spear3xx/Makefile +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for SPEAr3XX machine series | ||
3 | # | ||
4 | |||
5 | # common files | ||
6 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o | ||
7 | |||
8 | # spear300 specific files | ||
9 | obj-$(CONFIG_MACH_SPEAR300) += spear300.o | ||
10 | |||
11 | # spear310 specific files | ||
12 | obj-$(CONFIG_MACH_SPEAR310) += spear310.o | ||
13 | |||
14 | # spear320 specific files | ||
15 | obj-$(CONFIG_MACH_SPEAR320) += spear320.o | ||
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot deleted file mode 100644 index 4674a4c221db..000000000000 --- a/arch/arm/mach-spear3xx/Makefile.boot +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | zreladdr-y += 0x00008000 | ||
2 | params_phys-y := 0x00000100 | ||
3 | initrd_phys-y := 0x00800000 | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/debug-macro.S b/arch/arm/mach-spear3xx/include/mach/debug-macro.S deleted file mode 100644 index 0a6381fad5d9..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/debug-macro.S +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/debug-macro.S | ||
3 | * | ||
4 | * Debugging macro include header spear3xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar<viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h deleted file mode 100644 index df310799e416..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/generic.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/generic.h | ||
3 | * | ||
4 | * SPEAr3XX machine family generic header file | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar<viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_GENERIC_H | ||
15 | #define __MACH_GENERIC_H | ||
16 | |||
17 | #include <linux/amba/pl08x.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/amba/bus.h> | ||
21 | #include <asm/mach/time.h> | ||
22 | #include <asm/mach/map.h> | ||
23 | |||
24 | /* Add spear3xx family device structure declarations here */ | ||
25 | extern void spear3xx_timer_init(void); | ||
26 | extern struct pl022_ssp_controller pl022_plat_data; | ||
27 | extern struct pl08x_platform_data pl080_plat_data; | ||
28 | |||
29 | /* Add spear3xx family function declarations here */ | ||
30 | void __init spear_setup_of_timer(void); | ||
31 | void __init spear3xx_clk_init(void); | ||
32 | void __init spear3xx_map_io(void); | ||
33 | |||
34 | void spear_restart(char, const char *); | ||
35 | |||
36 | #endif /* __MACH_GENERIC_H */ | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h deleted file mode 100644 index 40a8c178f10d..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/hardware.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | /* empty */ | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h deleted file mode 100644 index f95e5b2b6686..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/irqs.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/irqs.h | ||
3 | * | ||
4 | * IRQ helper macros for SPEAr3xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_IRQS_H | ||
15 | #define __MACH_IRQS_H | ||
16 | |||
17 | #define NR_IRQS 256 | ||
18 | |||
19 | #endif /* __MACH_IRQS_H */ | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h deleted file mode 100644 index 8cca95193d4d..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/spear.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/spear.h | ||
3 | * | ||
4 | * SPEAr3xx Machine family specific definition | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_SPEAR3XX_H | ||
15 | #define __MACH_SPEAR3XX_H | ||
16 | |||
17 | #include <asm/memory.h> | ||
18 | |||
19 | /* ICM1 - Low speed connection */ | ||
20 | #define SPEAR3XX_ICM1_2_BASE UL(0xD0000000) | ||
21 | #define VA_SPEAR3XX_ICM1_2_BASE UL(0xFD000000) | ||
22 | #define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000) | ||
23 | #define VA_SPEAR3XX_ICM1_UART_BASE (VA_SPEAR3XX_ICM1_2_BASE | SPEAR3XX_ICM1_UART_BASE) | ||
24 | #define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) | ||
25 | |||
26 | /* ML1 - Multi Layer CPU Subsystem */ | ||
27 | #define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) | ||
28 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | ||
29 | |||
30 | /* ICM3 - Basic Subsystem */ | ||
31 | #define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | ||
32 | #define VA_SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | ||
33 | #define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000) | ||
34 | #define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) | ||
35 | #define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_SYS_CTRL_BASE) | ||
36 | #define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000) | ||
37 | #define VA_SPEAR3XX_ICM3_MISC_REG_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_MISC_REG_BASE) | ||
38 | |||
39 | /* Debug uart for linux, will be used for debug and uncompress messages */ | ||
40 | #define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE | ||
41 | #define VA_SPEAR_DBG_UART_BASE VA_SPEAR3XX_ICM1_UART_BASE | ||
42 | |||
43 | /* Sysctl base for spear platform */ | ||
44 | #define SPEAR_SYS_CTRL_BASE SPEAR3XX_ICM3_SYS_CTRL_BASE | ||
45 | #define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR3XX_ICM3_SYS_CTRL_BASE | ||
46 | |||
47 | /* SPEAr320 Macros */ | ||
48 | #define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000) | ||
49 | #define VA_SPEAR320_SOC_CONFIG_BASE UL(0xFE000000) | ||
50 | #define SPEAR320_CONTROL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE) | ||
51 | #define SPEAR320_EXT_CTRL_REG IOMEM(VA_SPEAR320_SOC_CONFIG_BASE + 0x0018) | ||
52 | #define SPEAR320_UARTX_PCLK_MASK 0x1 | ||
53 | #define SPEAR320_UART2_PCLK_SHIFT 8 | ||
54 | #define SPEAR320_UART3_PCLK_SHIFT 9 | ||
55 | #define SPEAR320_UART4_PCLK_SHIFT 10 | ||
56 | #define SPEAR320_UART5_PCLK_SHIFT 11 | ||
57 | #define SPEAR320_UART6_PCLK_SHIFT 12 | ||
58 | #define SPEAR320_RS485_PCLK_SHIFT 13 | ||
59 | |||
60 | #endif /* __MACH_SPEAR3XX_H */ | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/timex.h b/arch/arm/mach-spear3xx/include/mach/timex.h deleted file mode 100644 index 9f5d08bd0c44..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/timex.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/timex.h | ||
3 | * | ||
4 | * SPEAr3XX machine family specific timex definitions | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_TIMEX_H | ||
15 | #define __MACH_TIMEX_H | ||
16 | |||
17 | #include <plat/timex.h> | ||
18 | |||
19 | #endif /* __MACH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-spear3xx/include/mach/uncompress.h b/arch/arm/mach-spear3xx/include/mach/uncompress.h deleted file mode 100644 index b909b011f7c8..000000000000 --- a/arch/arm/mach-spear3xx/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear3xx/include/mach/uncompress.h | ||
3 | * | ||
4 | * Serial port stubs for kernel decompress status messages | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_UNCOMPRESS_H | ||
15 | #define __MACH_UNCOMPRESS_H | ||
16 | |||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | #endif /* __MACH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-spear6xx/Kconfig b/arch/arm/mach-spear6xx/Kconfig deleted file mode 100644 index 339f397dea70..000000000000 --- a/arch/arm/mach-spear6xx/Kconfig +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # | ||
2 | # SPEAr6XX Machine configuration file | ||
3 | # | ||
4 | |||
5 | config MACH_SPEAR600 | ||
6 | def_bool y | ||
7 | depends on ARCH_SPEAR6XX | ||
8 | select USE_OF | ||
9 | help | ||
10 | Supports ST SPEAr600 boards configured via the device-tree | ||
diff --git a/arch/arm/mach-spear6xx/Makefile b/arch/arm/mach-spear6xx/Makefile deleted file mode 100644 index 898831d93f37..000000000000 --- a/arch/arm/mach-spear6xx/Makefile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for SPEAr6XX machine series | ||
3 | # | ||
4 | |||
5 | # common files | ||
6 | obj-y += spear6xx.o | ||
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot deleted file mode 100644 index 4674a4c221db..000000000000 --- a/arch/arm/mach-spear6xx/Makefile.boot +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | zreladdr-y += 0x00008000 | ||
2 | params_phys-y := 0x00000100 | ||
3 | initrd_phys-y := 0x00800000 | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/debug-macro.S b/arch/arm/mach-spear6xx/include/mach/debug-macro.S deleted file mode 100644 index 0f3ea39edd96..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/debug-macro.S +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/debug-macro.S | ||
3 | * | ||
4 | * Debugging macro include header for SPEAr6xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h deleted file mode 100644 index 65514b159370..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/generic.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/generic.h | ||
3 | * | ||
4 | * SPEAr6XX machine family specific generic header file | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_GENERIC_H | ||
15 | #define __MACH_GENERIC_H | ||
16 | |||
17 | #include <linux/init.h> | ||
18 | |||
19 | void __init spear_setup_of_timer(void); | ||
20 | void spear_restart(char, const char *); | ||
21 | void __init spear6xx_clk_init(void); | ||
22 | |||
23 | #endif /* __MACH_GENERIC_H */ | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/hardware.h b/arch/arm/mach-spear6xx/include/mach/hardware.h deleted file mode 100644 index 40a8c178f10d..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/hardware.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | /* empty */ | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h deleted file mode 100644 index c34acc201d34..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/misc_regs.h | ||
3 | * | ||
4 | * Miscellaneous registers definitions for SPEAr6xx machine family | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Viresh Kumar <viresh.linux@gmail.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_MISC_REGS_H | ||
15 | #define __MACH_MISC_REGS_H | ||
16 | |||
17 | #include <mach/spear.h> | ||
18 | |||
19 | #define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE) | ||
20 | #define DMA_CHN_CFG (MISC_BASE + 0x0A0) | ||
21 | |||
22 | #endif /* __MACH_MISC_REGS_H */ | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h deleted file mode 100644 index cb8ed2f4dc85..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/spear.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/spear.h | ||
3 | * | ||
4 | * SPEAr6xx Machine family specific definition | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_SPEAR6XX_H | ||
15 | #define __MACH_SPEAR6XX_H | ||
16 | |||
17 | #include <asm/memory.h> | ||
18 | |||
19 | /* ICM1 - Low speed connection */ | ||
20 | #define SPEAR6XX_ICM1_BASE UL(0xD0000000) | ||
21 | #define VA_SPEAR6XX_ICM1_BASE UL(0xFD000000) | ||
22 | #define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000) | ||
23 | #define VA_SPEAR6XX_ICM1_UART0_BASE (VA_SPEAR6XX_ICM1_2_BASE | SPEAR6XX_ICM1_UART0_BASE) | ||
24 | |||
25 | /* ML-1, 2 - Multi Layer CPU Subsystem */ | ||
26 | #define SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | ||
27 | #define VA_SPEAR6XX_ML_CPU_BASE UL(0xF0000000) | ||
28 | |||
29 | /* ICM3 - Basic Subsystem */ | ||
30 | #define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | ||
31 | #define VA_SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) | ||
32 | #define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000) | ||
33 | #define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) | ||
34 | #define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_SYS_CTRL_BASE) | ||
35 | #define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000) | ||
36 | #define VA_SPEAR6XX_ICM3_MISC_REG_BASE (VA_SPEAR6XX_ICM3_SMI_CTRL_BASE | SPEAR6XX_ICM3_MISC_REG_BASE) | ||
37 | |||
38 | /* Debug uart for linux, will be used for debug and uncompress messages */ | ||
39 | #define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE | ||
40 | #define VA_SPEAR_DBG_UART_BASE VA_SPEAR6XX_ICM1_UART0_BASE | ||
41 | |||
42 | /* Sysctl base for spear platform */ | ||
43 | #define SPEAR_SYS_CTRL_BASE SPEAR6XX_ICM3_SYS_CTRL_BASE | ||
44 | #define VA_SPEAR_SYS_CTRL_BASE VA_SPEAR6XX_ICM3_SYS_CTRL_BASE | ||
45 | |||
46 | #endif /* __MACH_SPEAR6XX_H */ | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/timex.h b/arch/arm/mach-spear6xx/include/mach/timex.h deleted file mode 100644 index ac1c5b005695..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/timex.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/timex.h | ||
3 | * | ||
4 | * SPEAr6XX machine family specific timex definitions | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_TIMEX_H | ||
15 | #define __MACH_TIMEX_H | ||
16 | |||
17 | #include <plat/timex.h> | ||
18 | |||
19 | #endif /* __MACH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-spear6xx/include/mach/uncompress.h b/arch/arm/mach-spear6xx/include/mach/uncompress.h deleted file mode 100644 index 77f0765e21e1..000000000000 --- a/arch/arm/mach-spear6xx/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-spear6xx/include/mach/uncompress.h | ||
3 | * | ||
4 | * Serial port stubs for kernel decompress status messages | ||
5 | * | ||
6 | * Copyright (C) 2009 ST Microelectronics | ||
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public | ||
10 | * License version 2. This program is licensed "as is" without any | ||
11 | * warranty of any kind, whether express or implied. | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_UNCOMPRESS_H | ||
15 | #define __MACH_UNCOMPRESS_H | ||
16 | |||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | #endif /* __MACH_UNCOMPRESS_H */ | ||
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 6d29e6a39540..035b240b9e15 100644 --- a/arch/arm/mach-tegra/board-harmony-pcie.c +++ b/arch/arm/mach-tegra/board-harmony-pcie.c | |||
@@ -62,7 +62,11 @@ int __init harmony_pcie_init(void) | |||
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-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/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index 051b62c27102..7f2cb6c5e2c1 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c | |||
@@ -81,7 +81,6 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | struct mmci_platform_data mop500_sdi0_data = { | 83 | struct mmci_platform_data mop500_sdi0_data = { |
84 | .ios_handler = mop500_sdi0_ios_handler, | ||
85 | .ocr_mask = MMC_VDD_29_30, | 84 | .ocr_mask = MMC_VDD_29_30, |
86 | .f_max = 50000000, | 85 | .f_max = 50000000, |
87 | .capabilities = MMC_CAP_4_BIT_DATA | | 86 | .capabilities = MMC_CAP_4_BIT_DATA | |
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index b03457881c4b..87d2d7b38ce9 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | 16 | #include <linux/io.h> |
16 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
17 | #include <linux/platform_data/i2c-nomadik.h> | 18 | #include <linux/platform_data/i2c-nomadik.h> |
@@ -439,6 +440,15 @@ static void mop500_prox_deactivate(struct device *dev) | |||
439 | regulator_put(prox_regulator); | 440 | regulator_put(prox_regulator); |
440 | } | 441 | } |
441 | 442 | ||
443 | void mop500_snowball_ethernet_clock_enable(void) | ||
444 | { | ||
445 | struct clk *clk; | ||
446 | |||
447 | clk = clk_get_sys("fsmc", NULL); | ||
448 | if (!IS_ERR(clk)) | ||
449 | clk_prepare_enable(clk); | ||
450 | } | ||
451 | |||
442 | static struct cryp_platform_data u8500_cryp1_platform_data = { | 452 | static struct cryp_platform_data u8500_cryp1_platform_data = { |
443 | .mem_to_engine = { | 453 | .mem_to_engine = { |
444 | .dir = STEDMA40_MEM_TO_PERIPH, | 454 | .dir = STEDMA40_MEM_TO_PERIPH, |
@@ -683,6 +693,8 @@ static void __init snowball_init_machine(void) | |||
683 | mop500_audio_init(parent); | 693 | mop500_audio_init(parent); |
684 | mop500_uart_init(parent); | 694 | mop500_uart_init(parent); |
685 | 695 | ||
696 | mop500_snowball_ethernet_clock_enable(); | ||
697 | |||
686 | /* This board has full regulator constraints */ | 698 | /* This board has full regulator constraints */ |
687 | regulator_has_full_constraints(); | 699 | regulator_has_full_constraints(); |
688 | } | 700 | } |
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index eaa605f5d90d..d38951be70df 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -104,6 +104,7 @@ void __init mop500_pinmaps_init(void); | |||
104 | void __init snowball_pinmaps_init(void); | 104 | void __init snowball_pinmaps_init(void); |
105 | void __init hrefv60_pinmaps_init(void); | 105 | void __init hrefv60_pinmaps_init(void); |
106 | void mop500_audio_init(struct device *parent); | 106 | void mop500_audio_init(struct device *parent); |
107 | void mop500_snowball_ethernet_clock_enable(void); | ||
107 | 108 | ||
108 | int __init mop500_uib_init(void); | 109 | int __init mop500_uib_init(void); |
109 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, | 110 | void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, |
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 19235cf7bbe3..f1a581844372 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c | |||
@@ -312,9 +312,10 @@ static void __init u8500_init_machine(void) | |||
312 | /* Pinmaps must be in place before devices register */ | 312 | /* Pinmaps must be in place before devices register */ |
313 | if (of_machine_is_compatible("st-ericsson,mop500")) | 313 | if (of_machine_is_compatible("st-ericsson,mop500")) |
314 | mop500_pinmaps_init(); | 314 | mop500_pinmaps_init(); |
315 | else if (of_machine_is_compatible("calaosystems,snowball-a9500")) | 315 | else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { |
316 | snowball_pinmaps_init(); | 316 | snowball_pinmaps_init(); |
317 | else if (of_machine_is_compatible("st-ericsson,hrefv60+")) | 317 | mop500_snowball_ethernet_clock_enable(); |
318 | } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) | ||
318 | hrefv60_pinmaps_init(); | 319 | hrefv60_pinmaps_init(); |
319 | else if (of_machine_is_compatible("st-ericsson,ccu9540")) {} | 320 | else if (of_machine_is_compatible("st-ericsson,ccu9540")) {} |
320 | /* TODO: Add pinmaps for ccu9540 board. */ | 321 | /* TODO: Add pinmaps for ccu9540 board. */ |
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 d0ad78998cb6..09e571ddc984 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c | |||
@@ -1,6 +1,7 @@ | |||
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> |
@@ -23,7 +24,6 @@ | |||
23 | #include <linux/regulator/machine.h> | 24 | #include <linux/regulator/machine.h> |
24 | #include <linux/vexpress.h> | 25 | #include <linux/vexpress.h> |
25 | 26 | ||
26 | #include <asm/arch_timer.h> | ||
27 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
28 | #include <asm/sizes.h> | 28 | #include <asm/sizes.h> |
29 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.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 | clocksource_of_init(); | 433 | clocksource_of_init(); |
439 | do { | ||
440 | node = of_find_compatible_node(node, NULL, "arm,sp804"); | ||
441 | } while (node && vexpress_get_site_by_node(node) != VEXPRESS_SITE_MB); | ||
442 | if (node) { | ||
443 | pr_info("Using SP804 '%s' as a clock & events source\n", | ||
444 | node->full_name); | ||
445 | v2m_sp804_init(of_iomap(node, 0), | ||
446 | irq_of_parse_and_map(node, 0)); | ||
447 | } | ||
448 | |||
449 | arch_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/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index c2f37390308a..c465faca51b0 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -299,7 +299,7 @@ static void l2x0_unlock(u32 cache_id) | |||
299 | int lockregs; | 299 | int lockregs; |
300 | int i; | 300 | int i; |
301 | 301 | ||
302 | switch (cache_id) { | 302 | switch (cache_id & L2X0_CACHE_ID_PART_MASK) { |
303 | case L2X0_CACHE_ID_PART_L310: | 303 | case L2X0_CACHE_ID_PART_L310: |
304 | lockregs = 8; | 304 | lockregs = 8; |
305 | break; | 305 | break; |
@@ -333,15 +333,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) | |||
333 | if (cache_id_part_number_from_dt) | 333 | if (cache_id_part_number_from_dt) |
334 | cache_id = cache_id_part_number_from_dt; | 334 | cache_id = cache_id_part_number_from_dt; |
335 | else | 335 | else |
336 | cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID) | 336 | cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID); |
337 | & L2X0_CACHE_ID_PART_MASK; | ||
338 | aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | 337 | aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); |
339 | 338 | ||
340 | aux &= aux_mask; | 339 | aux &= aux_mask; |
341 | aux |= aux_val; | 340 | aux |= aux_val; |
342 | 341 | ||
343 | /* Determine the number of ways */ | 342 | /* Determine the number of ways */ |
344 | switch (cache_id) { | 343 | switch (cache_id & L2X0_CACHE_ID_PART_MASK) { |
345 | case L2X0_CACHE_ID_PART_L310: | 344 | case L2X0_CACHE_ID_PART_L310: |
346 | if (aux & (1 << 16)) | 345 | if (aux & (1 << 16)) |
347 | ways = 16; | 346 | ways = 16; |
@@ -725,7 +724,6 @@ static const struct l2x0_of_data pl310_data = { | |||
725 | .flush_all = l2x0_flush_all, | 724 | .flush_all = l2x0_flush_all, |
726 | .inv_all = l2x0_inv_all, | 725 | .inv_all = l2x0_inv_all, |
727 | .disable = l2x0_disable, | 726 | .disable = l2x0_disable, |
728 | .set_debug = pl310_set_debug, | ||
729 | }, | 727 | }, |
730 | }; | 728 | }; |
731 | 729 | ||
@@ -814,9 +812,8 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | |||
814 | data->save(); | 812 | data->save(); |
815 | 813 | ||
816 | of_init = true; | 814 | of_init = true; |
817 | l2x0_init(l2x0_base, aux_val, aux_mask); | ||
818 | |||
819 | memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache)); | 815 | memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache)); |
816 | l2x0_init(l2x0_base, aux_val, aux_mask); | ||
820 | 817 | ||
821 | return 0; | 818 | return 0; |
822 | } | 819 | } |
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c index a5a4b2bc42ba..2ac37372ef52 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c | |||
@@ -48,7 +48,7 @@ static DEFINE_RAW_SPINLOCK(cpu_asid_lock); | |||
48 | static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION); | 48 | static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION); |
49 | static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); | 49 | static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); |
50 | 50 | ||
51 | static DEFINE_PER_CPU(atomic64_t, active_asids); | 51 | DEFINE_PER_CPU(atomic64_t, active_asids); |
52 | static DEFINE_PER_CPU(u64, reserved_asids); | 52 | static DEFINE_PER_CPU(u64, reserved_asids); |
53 | static cpumask_t tlb_flush_pending; | 53 | static cpumask_t tlb_flush_pending; |
54 | 54 | ||
@@ -215,6 +215,7 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) | |||
215 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { | 215 | if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { |
216 | local_flush_bp_all(); | 216 | local_flush_bp_all(); |
217 | local_flush_tlb_all(); | 217 | local_flush_tlb_all(); |
218 | dummy_flush_tlb_a15_erratum(); | ||
218 | } | 219 | } |
219 | 220 | ||
220 | atomic64_set(&per_cpu(active_asids, cpu), asid); | 221 | atomic64_set(&per_cpu(active_asids, cpu), asid); |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index e95a996ab78f..78978945492a 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -598,39 +598,60 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, | |||
598 | } while (pte++, addr += PAGE_SIZE, addr != end); | 598 | } while (pte++, addr += PAGE_SIZE, addr != end); |
599 | } | 599 | } |
600 | 600 | ||
601 | static void __init alloc_init_section(pud_t *pud, unsigned long addr, | 601 | static void __init map_init_section(pmd_t *pmd, unsigned long addr, |
602 | unsigned long end, phys_addr_t phys, | 602 | unsigned long end, phys_addr_t phys, |
603 | const struct mem_type *type) | 603 | const struct mem_type *type) |
604 | { | 604 | { |
605 | pmd_t *pmd = pmd_offset(pud, addr); | 605 | #ifndef CONFIG_ARM_LPAE |
606 | |||
607 | /* | 606 | /* |
608 | * Try a section mapping - end, addr and phys must all be aligned | 607 | * In classic MMU format, puds and pmds are folded in to |
609 | * to a section boundary. Note that PMDs refer to the individual | 608 | * the pgds. pmd_offset gives the PGD entry. PGDs refer to a |
610 | * L1 entries, whereas PGDs refer to a group of L1 entries making | 609 | * group of L1 entries making up one logical pointer to |
611 | * up one logical pointer to an L2 table. | 610 | * an L2 table (2MB), where as PMDs refer to the individual |
611 | * L1 entries (1MB). Hence increment to get the correct | ||
612 | * offset for odd 1MB sections. | ||
613 | * (See arch/arm/include/asm/pgtable-2level.h) | ||
612 | */ | 614 | */ |
613 | if (type->prot_sect && ((addr | end | phys) & ~SECTION_MASK) == 0) { | 615 | if (addr & SECTION_SIZE) |
614 | pmd_t *p = pmd; | 616 | pmd++; |
615 | |||
616 | #ifndef CONFIG_ARM_LPAE | ||
617 | if (addr & SECTION_SIZE) | ||
618 | pmd++; | ||
619 | #endif | 617 | #endif |
618 | do { | ||
619 | *pmd = __pmd(phys | type->prot_sect); | ||
620 | phys += SECTION_SIZE; | ||
621 | } while (pmd++, addr += SECTION_SIZE, addr != end); | ||
620 | 622 | ||
621 | do { | 623 | flush_pmd_entry(pmd); |
622 | *pmd = __pmd(phys | type->prot_sect); | 624 | } |
623 | phys += SECTION_SIZE; | ||
624 | } while (pmd++, addr += SECTION_SIZE, addr != end); | ||
625 | 625 | ||
626 | flush_pmd_entry(p); | 626 | static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, |
627 | } else { | 627 | unsigned long end, phys_addr_t phys, |
628 | const struct mem_type *type) | ||
629 | { | ||
630 | pmd_t *pmd = pmd_offset(pud, addr); | ||
631 | unsigned long next; | ||
632 | |||
633 | do { | ||
628 | /* | 634 | /* |
629 | * No need to loop; pte's aren't interested in the | 635 | * With LPAE, we must loop over to map |
630 | * individual L1 entries. | 636 | * all the pmds for the given range. |
631 | */ | 637 | */ |
632 | alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type); | 638 | next = pmd_addr_end(addr, end); |
633 | } | 639 | |
640 | /* | ||
641 | * Try a section mapping - addr, next and phys must all be | ||
642 | * aligned to a section boundary. | ||
643 | */ | ||
644 | if (type->prot_sect && | ||
645 | ((addr | next | phys) & ~SECTION_MASK) == 0) { | ||
646 | map_init_section(pmd, addr, next, phys, type); | ||
647 | } else { | ||
648 | alloc_init_pte(pmd, addr, next, | ||
649 | __phys_to_pfn(phys), type); | ||
650 | } | ||
651 | |||
652 | phys += next - addr; | ||
653 | |||
654 | } while (pmd++, addr = next, addr != end); | ||
634 | } | 655 | } |
635 | 656 | ||
636 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, | 657 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, |
@@ -641,7 +662,7 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, | |||
641 | 662 | ||
642 | do { | 663 | do { |
643 | next = pud_addr_end(addr, end); | 664 | next = pud_addr_end(addr, end); |
644 | alloc_init_section(pud, addr, next, phys, type); | 665 | alloc_init_pmd(pud, addr, next, phys, type); |
645 | phys += next - addr; | 666 | phys += next - addr; |
646 | } while (pud++, addr = next, addr != end); | 667 | } while (pud++, addr = next, addr != end); |
647 | } | 668 | } |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 3a3c015f8d5c..f584d3f5b37c 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -420,7 +420,7 @@ __v7_pj4b_proc_info: | |||
420 | __v7_ca7mp_proc_info: | 420 | __v7_ca7mp_proc_info: |
421 | .long 0x410fc070 | 421 | .long 0x410fc070 |
422 | .long 0xff0ffff0 | 422 | .long 0xff0ffff0 |
423 | __v7_proc __v7_ca7mp_setup, hwcaps = HWCAP_IDIV | 423 | __v7_proc __v7_ca7mp_setup |
424 | .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info | 424 | .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info |
425 | 425 | ||
426 | /* | 426 | /* |
@@ -430,10 +430,25 @@ __v7_ca7mp_proc_info: | |||
430 | __v7_ca15mp_proc_info: | 430 | __v7_ca15mp_proc_info: |
431 | .long 0x410fc0f0 | 431 | .long 0x410fc0f0 |
432 | .long 0xff0ffff0 | 432 | .long 0xff0ffff0 |
433 | __v7_proc __v7_ca15mp_setup, hwcaps = HWCAP_IDIV | 433 | __v7_proc __v7_ca15mp_setup |
434 | .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info | 434 | .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info |
435 | 435 | ||
436 | /* | 436 | /* |
437 | * Qualcomm Inc. Krait processors. | ||
438 | */ | ||
439 | .type __krait_proc_info, #object | ||
440 | __krait_proc_info: | ||
441 | .long 0x510f0400 @ Required ID value | ||
442 | .long 0xff0ffc00 @ Mask for ID | ||
443 | /* | ||
444 | * Some Krait processors don't indicate support for SDIV and UDIV | ||
445 | * instructions in the ARM instruction set, even though they actually | ||
446 | * do support them. | ||
447 | */ | ||
448 | __v7_proc __v7_setup, hwcaps = HWCAP_IDIV | ||
449 | .size __krait_proc_info, . - __krait_proc_info | ||
450 | |||
451 | /* | ||
437 | * Match any ARMv7 processor core. | 452 | * Match any ARMv7 processor core. |
438 | */ | 453 | */ |
439 | .type __v7_proc_info, #object | 454 | .type __v7_proc_info, #object |
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 0f6c47a6475b..989fefe18be6 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h | |||
@@ -183,7 +183,6 @@ extern void s3c_init_cpu(unsigned long idcode, | |||
183 | 183 | ||
184 | /* core initialisation functions */ | 184 | /* core initialisation functions */ |
185 | 185 | ||
186 | extern void s3c24xx_init_irq(void); | ||
187 | extern void s5p_init_irq(u32 *vic, u32 num_vic); | 186 | extern void s5p_init_irq(u32 *vic, u32 num_vic); |
188 | 187 | ||
189 | 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); |
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig deleted file mode 100644 index 8a08c31b5e20..000000000000 --- a/arch/arm/plat-spear/Kconfig +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | # | ||
2 | # SPEAr Platform configuration file | ||
3 | # | ||
4 | |||
5 | if PLAT_SPEAR | ||
6 | |||
7 | choice | ||
8 | prompt "ST SPEAr Family" | ||
9 | default ARCH_SPEAR3XX | ||
10 | |||
11 | config ARCH_SPEAR13XX | ||
12 | bool "ST SPEAr13xx with Device Tree" | ||
13 | select ARCH_HAS_CPUFREQ | ||
14 | select ARM_GIC | ||
15 | select CPU_V7 | ||
16 | select GPIO_SPEAR_SPICS | ||
17 | select HAVE_SMP | ||
18 | select MIGHT_HAVE_CACHE_L2X0 | ||
19 | select PINCTRL | ||
20 | select USE_OF | ||
21 | help | ||
22 | Supports for ARM's SPEAR13XX family | ||
23 | |||
24 | config ARCH_SPEAR3XX | ||
25 | bool "ST SPEAr3xx with Device Tree" | ||
26 | select ARM_VIC | ||
27 | select CPU_ARM926T | ||
28 | select PINCTRL | ||
29 | select USE_OF | ||
30 | help | ||
31 | Supports for ARM's SPEAR3XX family | ||
32 | |||
33 | config ARCH_SPEAR6XX | ||
34 | bool "SPEAr6XX" | ||
35 | select ARM_VIC | ||
36 | select CPU_ARM926T | ||
37 | help | ||
38 | Supports for ARM's SPEAR6XX family | ||
39 | |||
40 | endchoice | ||
41 | |||
42 | # Adding SPEAr machine specific configuration files | ||
43 | source "arch/arm/mach-spear13xx/Kconfig" | ||
44 | source "arch/arm/mach-spear3xx/Kconfig" | ||
45 | source "arch/arm/mach-spear6xx/Kconfig" | ||
46 | |||
47 | endif | ||
diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile deleted file mode 100644 index 01e88532a5db..000000000000 --- a/arch/arm/plat-spear/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # SPEAr Platform specific Makefile | ||
3 | # | ||
4 | |||
5 | # Common support | ||
6 | obj-y := restart.o time.o | ||
7 | |||
8 | obj-$(CONFIG_ARCH_SPEAR3XX) += pl080.o | ||
9 | obj-$(CONFIG_ARCH_SPEAR6XX) += pl080.o | ||
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/mips/Kconfig b/arch/mips/Kconfig index cd2e21ff562a..51244bf97271 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -18,7 +18,7 @@ config MIPS | |||
18 | select HAVE_KRETPROBES | 18 | select HAVE_KRETPROBES |
19 | select HAVE_DEBUG_KMEMLEAK | 19 | select HAVE_DEBUG_KMEMLEAK |
20 | select ARCH_BINFMT_ELF_RANDOMIZE_PIE | 20 | select ARCH_BINFMT_ELF_RANDOMIZE_PIE |
21 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE | 21 | select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES && 64BIT |
22 | select RTC_LIB if !MACH_LOONGSON | 22 | select RTC_LIB if !MACH_LOONGSON |
23 | select GENERIC_ATOMIC64 if !64BIT | 23 | select GENERIC_ATOMIC64 if !64BIT |
24 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE | 24 | select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE |
@@ -657,7 +657,7 @@ config SNI_RM | |||
657 | bool "SNI RM200/300/400" | 657 | bool "SNI RM200/300/400" |
658 | select FW_ARC if CPU_LITTLE_ENDIAN | 658 | select FW_ARC if CPU_LITTLE_ENDIAN |
659 | select FW_ARC32 if CPU_LITTLE_ENDIAN | 659 | select FW_ARC32 if CPU_LITTLE_ENDIAN |
660 | select SNIPROM if CPU_BIG_ENDIAN | 660 | select FW_SNIPROM if CPU_BIG_ENDIAN |
661 | select ARCH_MAY_HAVE_PC_FDC | 661 | select ARCH_MAY_HAVE_PC_FDC |
662 | select BOOT_ELF32 | 662 | select BOOT_ELF32 |
663 | select CEVT_R4K | 663 | select CEVT_R4K |
@@ -1144,7 +1144,7 @@ config DEFAULT_SGI_PARTITION | |||
1144 | config FW_ARC32 | 1144 | config FW_ARC32 |
1145 | bool | 1145 | bool |
1146 | 1146 | ||
1147 | config SNIPROM | 1147 | config FW_SNIPROM |
1148 | bool | 1148 | bool |
1149 | 1149 | ||
1150 | config BOOT_ELF32 | 1150 | config BOOT_ELF32 |
@@ -1493,7 +1493,6 @@ config CPU_XLP | |||
1493 | select CPU_SUPPORTS_32BIT_KERNEL | 1493 | select CPU_SUPPORTS_32BIT_KERNEL |
1494 | select CPU_SUPPORTS_64BIT_KERNEL | 1494 | select CPU_SUPPORTS_64BIT_KERNEL |
1495 | select CPU_SUPPORTS_HIGHMEM | 1495 | select CPU_SUPPORTS_HIGHMEM |
1496 | select CPU_HAS_LLSC | ||
1497 | select WEAK_ORDERING | 1496 | select WEAK_ORDERING |
1498 | select WEAK_REORDERING_BEYOND_LLSC | 1497 | select WEAK_REORDERING_BEYOND_LLSC |
1499 | select CPU_HAS_PREFETCH | 1498 | select CPU_HAS_PREFETCH |
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index ed1949c29508..9aa7d44898ed 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c | |||
@@ -745,10 +745,7 @@ void __init board_prom_init(void) | |||
745 | strcpy(cfe_version, "unknown"); | 745 | strcpy(cfe_version, "unknown"); |
746 | printk(KERN_INFO PFX "CFE version: %s\n", cfe_version); | 746 | printk(KERN_INFO PFX "CFE version: %s\n", cfe_version); |
747 | 747 | ||
748 | if (bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET)) { | 748 | bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET); |
749 | printk(KERN_ERR PFX "invalid nvram checksum\n"); | ||
750 | return; | ||
751 | } | ||
752 | 749 | ||
753 | board_name = bcm63xx_nvram_get_name(); | 750 | board_name = bcm63xx_nvram_get_name(); |
754 | /* find board by name */ | 751 | /* find board by name */ |
diff --git a/arch/mips/bcm63xx/nvram.c b/arch/mips/bcm63xx/nvram.c index 620611680839..a4b8864f9307 100644 --- a/arch/mips/bcm63xx/nvram.c +++ b/arch/mips/bcm63xx/nvram.c | |||
@@ -38,7 +38,7 @@ struct bcm963xx_nvram { | |||
38 | static struct bcm963xx_nvram nvram; | 38 | static struct bcm963xx_nvram nvram; |
39 | static int mac_addr_used; | 39 | static int mac_addr_used; |
40 | 40 | ||
41 | int __init bcm63xx_nvram_init(void *addr) | 41 | void __init bcm63xx_nvram_init(void *addr) |
42 | { | 42 | { |
43 | unsigned int check_len; | 43 | unsigned int check_len; |
44 | u32 crc, expected_crc; | 44 | u32 crc, expected_crc; |
@@ -60,9 +60,8 @@ int __init bcm63xx_nvram_init(void *addr) | |||
60 | crc = crc32_le(~0, (u8 *)&nvram, check_len); | 60 | crc = crc32_le(~0, (u8 *)&nvram, check_len); |
61 | 61 | ||
62 | if (crc != expected_crc) | 62 | if (crc != expected_crc) |
63 | return -EINVAL; | 63 | pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n", |
64 | 64 | expected_crc, crc); | |
65 | return 0; | ||
66 | } | 65 | } |
67 | 66 | ||
68 | u8 *bcm63xx_nvram_get_name(void) | 67 | u8 *bcm63xx_nvram_get_name(void) |
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c index 314231be788c..35e18e98beb9 100644 --- a/arch/mips/bcm63xx/setup.c +++ b/arch/mips/bcm63xx/setup.c | |||
@@ -157,4 +157,4 @@ int __init bcm63xx_register_devices(void) | |||
157 | return board_register_devices(); | 157 | return board_register_devices(); |
158 | } | 158 | } |
159 | 159 | ||
160 | device_initcall(bcm63xx_register_devices); | 160 | arch_initcall(bcm63xx_register_devices); |
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index c594a3d4f743..b0baa299f899 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -174,7 +174,10 @@ static int octeon_kexec_prepare(struct kimage *image) | |||
174 | 174 | ||
175 | static void octeon_generic_shutdown(void) | 175 | static void octeon_generic_shutdown(void) |
176 | { | 176 | { |
177 | int cpu, i; | 177 | int i; |
178 | #ifdef CONFIG_SMP | ||
179 | int cpu; | ||
180 | #endif | ||
178 | struct cvmx_bootmem_desc *bootmem_desc; | 181 | struct cvmx_bootmem_desc *bootmem_desc; |
179 | void *named_block_array_ptr; | 182 | void *named_block_array_ptr; |
180 | 183 | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h index 62d6a3b4d3b7..4e0b6bc1165e 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | |||
@@ -9,10 +9,8 @@ | |||
9 | * | 9 | * |
10 | * Initialized the local nvram copy from the target address and checks | 10 | * Initialized the local nvram copy from the target address and checks |
11 | * its checksum. | 11 | * its checksum. |
12 | * | ||
13 | * Returns 0 on success. | ||
14 | */ | 12 | */ |
15 | int __init bcm63xx_nvram_init(void *nvram); | 13 | void bcm63xx_nvram_init(void *nvram); |
16 | 14 | ||
17 | /** | 15 | /** |
18 | * bcm63xx_nvram_get_name() - returns the board name according to nvram | 16 | * bcm63xx_nvram_get_name() - returns the board name according to nvram |
diff --git a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h b/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h index d9c828419037..193c0912d38e 100644 --- a/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-sead3/cpu-feature-overrides.h | |||
@@ -28,11 +28,7 @@ | |||
28 | /* #define cpu_has_prefetch ? */ | 28 | /* #define cpu_has_prefetch ? */ |
29 | #define cpu_has_mcheck 1 | 29 | #define cpu_has_mcheck 1 |
30 | /* #define cpu_has_ejtag ? */ | 30 | /* #define cpu_has_ejtag ? */ |
31 | #ifdef CONFIG_CPU_HAS_LLSC | ||
32 | #define cpu_has_llsc 1 | 31 | #define cpu_has_llsc 1 |
33 | #else | ||
34 | #define cpu_has_llsc 0 | ||
35 | #endif | ||
36 | /* #define cpu_has_vtag_icache ? */ | 32 | /* #define cpu_has_vtag_icache ? */ |
37 | /* #define cpu_has_dc_aliases ? */ | 33 | /* #define cpu_has_dc_aliases ? */ |
38 | /* #define cpu_has_ic_fills_f_dc ? */ | 34 | /* #define cpu_has_ic_fills_f_dc ? */ |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 12b70c25906a..0da44d422f5b 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -1166,7 +1166,10 @@ do { \ | |||
1166 | unsigned int __dspctl; \ | 1166 | unsigned int __dspctl; \ |
1167 | \ | 1167 | \ |
1168 | __asm__ __volatile__( \ | 1168 | __asm__ __volatile__( \ |
1169 | " .set push \n" \ | ||
1170 | " .set dsp \n" \ | ||
1169 | " rddsp %0, %x1 \n" \ | 1171 | " rddsp %0, %x1 \n" \ |
1172 | " .set pop \n" \ | ||
1170 | : "=r" (__dspctl) \ | 1173 | : "=r" (__dspctl) \ |
1171 | : "i" (mask)); \ | 1174 | : "i" (mask)); \ |
1172 | __dspctl; \ | 1175 | __dspctl; \ |
@@ -1175,30 +1178,198 @@ do { \ | |||
1175 | #define wrdsp(val, mask) \ | 1178 | #define wrdsp(val, mask) \ |
1176 | do { \ | 1179 | do { \ |
1177 | __asm__ __volatile__( \ | 1180 | __asm__ __volatile__( \ |
1181 | " .set push \n" \ | ||
1182 | " .set dsp \n" \ | ||
1178 | " wrdsp %0, %x1 \n" \ | 1183 | " wrdsp %0, %x1 \n" \ |
1184 | " .set pop \n" \ | ||
1179 | : \ | 1185 | : \ |
1180 | : "r" (val), "i" (mask)); \ | 1186 | : "r" (val), "i" (mask)); \ |
1181 | } while (0) | 1187 | } while (0) |
1182 | 1188 | ||
1183 | #define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;}) | 1189 | #define mflo0() \ |
1184 | #define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;}) | 1190 | ({ \ |
1185 | #define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;}) | 1191 | long mflo0; \ |
1186 | #define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;}) | 1192 | __asm__( \ |
1187 | 1193 | " .set push \n" \ | |
1188 | #define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;}) | 1194 | " .set dsp \n" \ |
1189 | #define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;}) | 1195 | " mflo %0, $ac0 \n" \ |
1190 | #define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;}) | 1196 | " .set pop \n" \ |
1191 | #define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;}) | 1197 | : "=r" (mflo0)); \ |
1192 | 1198 | mflo0; \ | |
1193 | #define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x)) | 1199 | }) |
1194 | #define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x)) | 1200 | |
1195 | #define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x)) | 1201 | #define mflo1() \ |
1196 | #define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x)) | 1202 | ({ \ |
1197 | 1203 | long mflo1; \ | |
1198 | #define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x)) | 1204 | __asm__( \ |
1199 | #define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x)) | 1205 | " .set push \n" \ |
1200 | #define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x)) | 1206 | " .set dsp \n" \ |
1201 | #define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x)) | 1207 | " mflo %0, $ac1 \n" \ |
1208 | " .set pop \n" \ | ||
1209 | : "=r" (mflo1)); \ | ||
1210 | mflo1; \ | ||
1211 | }) | ||
1212 | |||
1213 | #define mflo2() \ | ||
1214 | ({ \ | ||
1215 | long mflo2; \ | ||
1216 | __asm__( \ | ||
1217 | " .set push \n" \ | ||
1218 | " .set dsp \n" \ | ||
1219 | " mflo %0, $ac2 \n" \ | ||
1220 | " .set pop \n" \ | ||
1221 | : "=r" (mflo2)); \ | ||
1222 | mflo2; \ | ||
1223 | }) | ||
1224 | |||
1225 | #define mflo3() \ | ||
1226 | ({ \ | ||
1227 | long mflo3; \ | ||
1228 | __asm__( \ | ||
1229 | " .set push \n" \ | ||
1230 | " .set dsp \n" \ | ||
1231 | " mflo %0, $ac3 \n" \ | ||
1232 | " .set pop \n" \ | ||
1233 | : "=r" (mflo3)); \ | ||
1234 | mflo3; \ | ||
1235 | }) | ||
1236 | |||
1237 | #define mfhi0() \ | ||
1238 | ({ \ | ||
1239 | long mfhi0; \ | ||
1240 | __asm__( \ | ||
1241 | " .set push \n" \ | ||
1242 | " .set dsp \n" \ | ||
1243 | " mfhi %0, $ac0 \n" \ | ||
1244 | " .set pop \n" \ | ||
1245 | : "=r" (mfhi0)); \ | ||
1246 | mfhi0; \ | ||
1247 | }) | ||
1248 | |||
1249 | #define mfhi1() \ | ||
1250 | ({ \ | ||
1251 | long mfhi1; \ | ||
1252 | __asm__( \ | ||
1253 | " .set push \n" \ | ||
1254 | " .set dsp \n" \ | ||
1255 | " mfhi %0, $ac1 \n" \ | ||
1256 | " .set pop \n" \ | ||
1257 | : "=r" (mfhi1)); \ | ||
1258 | mfhi1; \ | ||
1259 | }) | ||
1260 | |||
1261 | #define mfhi2() \ | ||
1262 | ({ \ | ||
1263 | long mfhi2; \ | ||
1264 | __asm__( \ | ||
1265 | " .set push \n" \ | ||
1266 | " .set dsp \n" \ | ||
1267 | " mfhi %0, $ac2 \n" \ | ||
1268 | " .set pop \n" \ | ||
1269 | : "=r" (mfhi2)); \ | ||
1270 | mfhi2; \ | ||
1271 | }) | ||
1272 | |||
1273 | #define mfhi3() \ | ||
1274 | ({ \ | ||
1275 | long mfhi3; \ | ||
1276 | __asm__( \ | ||
1277 | " .set push \n" \ | ||
1278 | " .set dsp \n" \ | ||
1279 | " mfhi %0, $ac3 \n" \ | ||
1280 | " .set pop \n" \ | ||
1281 | : "=r" (mfhi3)); \ | ||
1282 | mfhi3; \ | ||
1283 | }) | ||
1284 | |||
1285 | |||
1286 | #define mtlo0(x) \ | ||
1287 | ({ \ | ||
1288 | __asm__( \ | ||
1289 | " .set push \n" \ | ||
1290 | " .set dsp \n" \ | ||
1291 | " mtlo %0, $ac0 \n" \ | ||
1292 | " .set pop \n" \ | ||
1293 | : \ | ||
1294 | : "r" (x)); \ | ||
1295 | }) | ||
1296 | |||
1297 | #define mtlo1(x) \ | ||
1298 | ({ \ | ||
1299 | __asm__( \ | ||
1300 | " .set push \n" \ | ||
1301 | " .set dsp \n" \ | ||
1302 | " mtlo %0, $ac1 \n" \ | ||
1303 | " .set pop \n" \ | ||
1304 | : \ | ||
1305 | : "r" (x)); \ | ||
1306 | }) | ||
1307 | |||
1308 | #define mtlo2(x) \ | ||
1309 | ({ \ | ||
1310 | __asm__( \ | ||
1311 | " .set push \n" \ | ||
1312 | " .set dsp \n" \ | ||
1313 | " mtlo %0, $ac2 \n" \ | ||
1314 | " .set pop \n" \ | ||
1315 | : \ | ||
1316 | : "r" (x)); \ | ||
1317 | }) | ||
1318 | |||
1319 | #define mtlo3(x) \ | ||
1320 | ({ \ | ||
1321 | __asm__( \ | ||
1322 | " .set push \n" \ | ||
1323 | " .set dsp \n" \ | ||
1324 | " mtlo %0, $ac3 \n" \ | ||
1325 | " .set pop \n" \ | ||
1326 | : \ | ||
1327 | : "r" (x)); \ | ||
1328 | }) | ||
1329 | |||
1330 | #define mthi0(x) \ | ||
1331 | ({ \ | ||
1332 | __asm__( \ | ||
1333 | " .set push \n" \ | ||
1334 | " .set dsp \n" \ | ||
1335 | " mthi %0, $ac0 \n" \ | ||
1336 | " .set pop \n" \ | ||
1337 | : \ | ||
1338 | : "r" (x)); \ | ||
1339 | }) | ||
1340 | |||
1341 | #define mthi1(x) \ | ||
1342 | ({ \ | ||
1343 | __asm__( \ | ||
1344 | " .set push \n" \ | ||
1345 | " .set dsp \n" \ | ||
1346 | " mthi %0, $ac1 \n" \ | ||
1347 | " .set pop \n" \ | ||
1348 | : \ | ||
1349 | : "r" (x)); \ | ||
1350 | }) | ||
1351 | |||
1352 | #define mthi2(x) \ | ||
1353 | ({ \ | ||
1354 | __asm__( \ | ||
1355 | " .set push \n" \ | ||
1356 | " .set dsp \n" \ | ||
1357 | " mthi %0, $ac2 \n" \ | ||
1358 | " .set pop \n" \ | ||
1359 | : \ | ||
1360 | : "r" (x)); \ | ||
1361 | }) | ||
1362 | |||
1363 | #define mthi3(x) \ | ||
1364 | ({ \ | ||
1365 | __asm__( \ | ||
1366 | " .set push \n" \ | ||
1367 | " .set dsp \n" \ | ||
1368 | " mthi %0, $ac3 \n" \ | ||
1369 | " .set pop \n" \ | ||
1370 | : \ | ||
1371 | : "r" (x)); \ | ||
1372 | }) | ||
1202 | 1373 | ||
1203 | #else | 1374 | #else |
1204 | 1375 | ||
diff --git a/arch/mips/include/asm/signal.h b/arch/mips/include/asm/signal.h index 197f6367c201..8efe5a9e2c3e 100644 --- a/arch/mips/include/asm/signal.h +++ b/arch/mips/include/asm/signal.h | |||
@@ -21,6 +21,6 @@ | |||
21 | #include <asm/sigcontext.h> | 21 | #include <asm/sigcontext.h> |
22 | #include <asm/siginfo.h> | 22 | #include <asm/siginfo.h> |
23 | 23 | ||
24 | #define __ARCH_HAS_ODD_SIGACTION | 24 | #define __ARCH_HAS_IRIX_SIGACTION |
25 | 25 | ||
26 | #endif /* _ASM_SIGNAL_H */ | 26 | #endif /* _ASM_SIGNAL_H */ |
diff --git a/arch/mips/include/uapi/asm/signal.h b/arch/mips/include/uapi/asm/signal.h index d6b18b4d0f3a..addb9f556b71 100644 --- a/arch/mips/include/uapi/asm/signal.h +++ b/arch/mips/include/uapi/asm/signal.h | |||
@@ -72,6 +72,12 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */ | |||
72 | * | 72 | * |
73 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | 73 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single |
74 | * Unix names RESETHAND and NODEFER respectively. | 74 | * Unix names RESETHAND and NODEFER respectively. |
75 | * | ||
76 | * SA_RESTORER used to be defined as 0x04000000 but only the O32 ABI ever | ||
77 | * supported its use and no libc was using it, so the entire sa-restorer | ||
78 | * functionality was removed with lmo commit 39bffc12c3580ab for 2.5.48 | ||
79 | * retaining only the SA_RESTORER definition as a reminder to avoid | ||
80 | * accidental reuse of the mask bit. | ||
75 | */ | 81 | */ |
76 | #define SA_ONSTACK 0x08000000 | 82 | #define SA_ONSTACK 0x08000000 |
77 | #define SA_RESETHAND 0x80000000 | 83 | #define SA_RESETHAND 0x80000000 |
@@ -84,8 +90,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */ | |||
84 | #define SA_NOMASK SA_NODEFER | 90 | #define SA_NOMASK SA_NODEFER |
85 | #define SA_ONESHOT SA_RESETHAND | 91 | #define SA_ONESHOT SA_RESETHAND |
86 | 92 | ||
87 | #define SA_RESTORER 0x04000000 /* Only for o32 */ | ||
88 | |||
89 | #define MINSIGSTKSZ 2048 | 93 | #define MINSIGSTKSZ 2048 |
90 | #define SIGSTKSZ 8192 | 94 | #define SIGSTKSZ 8192 |
91 | 95 | ||
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index f81d98f6184c..de75fb50562b 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -100,29 +100,16 @@ obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_mipsxx.o | |||
100 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o | 100 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
101 | 101 | ||
102 | # | 102 | # |
103 | # DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is safe | 103 | # DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not |
104 | # to enable DSP assembler support here even if the MIPS Release 2 CPU we | 104 | # safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches |
105 | # are targetting does not support DSP because all code-paths making use of | 105 | # here because the compiler may use DSP ASE instructions (such as lwx) in |
106 | # it properly check that the running CPU *actually does* support these | 106 | # code paths where we cannot check that the CPU we are running on supports it. |
107 | # instructions. | 107 | # Proper abstraction using HAVE_AS_DSP and macros is done in |
108 | # arch/mips/include/asm/mipsregs.h. | ||
108 | # | 109 | # |
109 | ifeq ($(CONFIG_CPU_MIPSR2), y) | 110 | ifeq ($(CONFIG_CPU_MIPSR2), y) |
110 | CFLAGS_DSP = -DHAVE_AS_DSP | 111 | CFLAGS_DSP = -DHAVE_AS_DSP |
111 | 112 | ||
112 | # | ||
113 | # Check if assembler supports DSP ASE | ||
114 | # | ||
115 | ifeq ($(call cc-option-yn,-mdsp), y) | ||
116 | CFLAGS_DSP += -mdsp | ||
117 | endif | ||
118 | |||
119 | # | ||
120 | # Check if assembler supports DSP ASE Rev2 | ||
121 | # | ||
122 | ifeq ($(call cc-option-yn,-mdspr2), y) | ||
123 | CFLAGS_DSP += -mdspr2 | ||
124 | endif | ||
125 | |||
126 | CFLAGS_signal.o = $(CFLAGS_DSP) | 113 | CFLAGS_signal.o = $(CFLAGS_DSP) |
127 | CFLAGS_signal32.o = $(CFLAGS_DSP) | 114 | CFLAGS_signal32.o = $(CFLAGS_DSP) |
128 | CFLAGS_process.o = $(CFLAGS_DSP) | 115 | CFLAGS_process.o = $(CFLAGS_DSP) |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 6bfccc227a95..5fe66a0c3224 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -580,6 +580,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
580 | c->tlbsize = 48; | 580 | c->tlbsize = 48; |
581 | break; | 581 | break; |
582 | case PRID_IMP_VR41XX: | 582 | case PRID_IMP_VR41XX: |
583 | set_isa(c, MIPS_CPU_ISA_III); | ||
584 | c->options = R4K_OPTS; | ||
585 | c->tlbsize = 32; | ||
583 | switch (c->processor_id & 0xf0) { | 586 | switch (c->processor_id & 0xf0) { |
584 | case PRID_REV_VR4111: | 587 | case PRID_REV_VR4111: |
585 | c->cputype = CPU_VR4111; | 588 | c->cputype = CPU_VR4111; |
@@ -604,6 +607,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
604 | __cpu_name[cpu] = "NEC VR4131"; | 607 | __cpu_name[cpu] = "NEC VR4131"; |
605 | } else { | 608 | } else { |
606 | c->cputype = CPU_VR4133; | 609 | c->cputype = CPU_VR4133; |
610 | c->options |= MIPS_CPU_LLSC; | ||
607 | __cpu_name[cpu] = "NEC VR4133"; | 611 | __cpu_name[cpu] = "NEC VR4133"; |
608 | } | 612 | } |
609 | break; | 613 | break; |
@@ -613,9 +617,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) | |||
613 | __cpu_name[cpu] = "NEC Vr41xx"; | 617 | __cpu_name[cpu] = "NEC Vr41xx"; |
614 | break; | 618 | break; |
615 | } | 619 | } |
616 | set_isa(c, MIPS_CPU_ISA_III); | ||
617 | c->options = R4K_OPTS; | ||
618 | c->tlbsize = 32; | ||
619 | break; | 620 | break; |
620 | case PRID_IMP_R4300: | 621 | case PRID_IMP_R4300: |
621 | c->cputype = CPU_R4300; | 622 | c->cputype = CPU_R4300; |
@@ -1226,10 +1227,8 @@ __cpuinit void cpu_probe(void) | |||
1226 | if (c->options & MIPS_CPU_FPU) { | 1227 | if (c->options & MIPS_CPU_FPU) { |
1227 | c->fpu_id = cpu_get_fpu_id(); | 1228 | c->fpu_id = cpu_get_fpu_id(); |
1228 | 1229 | ||
1229 | if (c->isa_level == MIPS_CPU_ISA_M32R1 || | 1230 | if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 | |
1230 | c->isa_level == MIPS_CPU_ISA_M32R2 || | 1231 | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) { |
1231 | c->isa_level == MIPS_CPU_ISA_M64R1 || | ||
1232 | c->isa_level == MIPS_CPU_ISA_M64R2) { | ||
1233 | if (c->fpu_id & MIPS_FPIR_3D) | 1232 | if (c->fpu_id & MIPS_FPIR_3D) |
1234 | c->ases |= MIPS_ASE_MIPS3D; | 1233 | c->ases |= MIPS_ASE_MIPS3D; |
1235 | } | 1234 | } |
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 8eeee1c860c0..db9655f08892 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -171,7 +171,7 @@ SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third, | |||
171 | err = compat_sys_shmctl(first, second, compat_ptr(ptr)); | 171 | err = compat_sys_shmctl(first, second, compat_ptr(ptr)); |
172 | break; | 172 | break; |
173 | default: | 173 | default: |
174 | err = -EINVAL; | 174 | err = -ENOSYS; |
175 | break; | 175 | break; |
176 | } | 176 | } |
177 | 177 | ||
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S index 165867673357..33d067148e61 100644 --- a/arch/mips/kernel/mcount.S +++ b/arch/mips/kernel/mcount.S | |||
@@ -46,10 +46,9 @@ | |||
46 | PTR_L a5, PT_R9(sp) | 46 | PTR_L a5, PT_R9(sp) |
47 | PTR_L a6, PT_R10(sp) | 47 | PTR_L a6, PT_R10(sp) |
48 | PTR_L a7, PT_R11(sp) | 48 | PTR_L a7, PT_R11(sp) |
49 | #else | ||
50 | PTR_ADDIU sp, PT_SIZE | ||
51 | #endif | 49 | #endif |
52 | .endm | 50 | PTR_ADDIU sp, PT_SIZE |
51 | .endm | ||
53 | 52 | ||
54 | .macro RETURN_BACK | 53 | .macro RETURN_BACK |
55 | jr ra | 54 | jr ra |
@@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra) | |||
68 | .globl _mcount | 67 | .globl _mcount |
69 | _mcount: | 68 | _mcount: |
70 | b ftrace_stub | 69 | b ftrace_stub |
71 | addiu sp,sp,8 | 70 | #ifdef CONFIG_32BIT |
71 | addiu sp,sp,8 | ||
72 | #else | ||
73 | nop | ||
74 | #endif | ||
72 | 75 | ||
73 | /* When tracing is activated, it calls ftrace_caller+8 (aka here) */ | 76 | /* When tracing is activated, it calls ftrace_caller+8 (aka here) */ |
74 | lw t1, function_trace_stop | 77 | lw t1, function_trace_stop |
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c index 135c4aadccbe..7a54f74b7818 100644 --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c | |||
@@ -67,7 +67,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
67 | if (cpu_has_mips_r) { | 67 | if (cpu_has_mips_r) { |
68 | seq_printf(m, "isa\t\t\t:"); | 68 | seq_printf(m, "isa\t\t\t:"); |
69 | if (cpu_has_mips_1) | 69 | if (cpu_has_mips_1) |
70 | seq_printf(m, "%s", "mips1"); | 70 | seq_printf(m, "%s", " mips1"); |
71 | if (cpu_has_mips_2) | 71 | if (cpu_has_mips_2) |
72 | seq_printf(m, "%s", " mips2"); | 72 | seq_printf(m, "%s", " mips2"); |
73 | if (cpu_has_mips_3) | 73 | if (cpu_has_mips_3) |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index a200b5bdbb87..c3abb88170fc 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
@@ -1571,7 +1571,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu) | |||
1571 | #ifdef CONFIG_64BIT | 1571 | #ifdef CONFIG_64BIT |
1572 | status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX; | 1572 | status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX; |
1573 | #endif | 1573 | #endif |
1574 | if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) | 1574 | if (current_cpu_data.isa_level & MIPS_CPU_ISA_IV) |
1575 | status_set |= ST0_XX; | 1575 | status_set |= ST0_XX; |
1576 | if (cpu_has_dsp) | 1576 | if (cpu_has_dsp) |
1577 | status_set |= ST0_MX; | 1577 | status_set |= ST0_MX; |
diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c index 81f1dcfdcab8..a64daee740ee 100644 --- a/arch/mips/lib/bitops.c +++ b/arch/mips/lib/bitops.c | |||
@@ -90,12 +90,12 @@ int __mips_test_and_set_bit(unsigned long nr, | |||
90 | unsigned bit = nr & SZLONG_MASK; | 90 | unsigned bit = nr & SZLONG_MASK; |
91 | unsigned long mask; | 91 | unsigned long mask; |
92 | unsigned long flags; | 92 | unsigned long flags; |
93 | unsigned long res; | 93 | int res; |
94 | 94 | ||
95 | a += nr >> SZLONG_LOG; | 95 | a += nr >> SZLONG_LOG; |
96 | mask = 1UL << bit; | 96 | mask = 1UL << bit; |
97 | raw_local_irq_save(flags); | 97 | raw_local_irq_save(flags); |
98 | res = (mask & *a); | 98 | res = (mask & *a) != 0; |
99 | *a |= mask; | 99 | *a |= mask; |
100 | raw_local_irq_restore(flags); | 100 | raw_local_irq_restore(flags); |
101 | return res; | 101 | return res; |
@@ -116,12 +116,12 @@ int __mips_test_and_set_bit_lock(unsigned long nr, | |||
116 | unsigned bit = nr & SZLONG_MASK; | 116 | unsigned bit = nr & SZLONG_MASK; |
117 | unsigned long mask; | 117 | unsigned long mask; |
118 | unsigned long flags; | 118 | unsigned long flags; |
119 | unsigned long res; | 119 | int res; |
120 | 120 | ||
121 | a += nr >> SZLONG_LOG; | 121 | a += nr >> SZLONG_LOG; |
122 | mask = 1UL << bit; | 122 | mask = 1UL << bit; |
123 | raw_local_irq_save(flags); | 123 | raw_local_irq_save(flags); |
124 | res = (mask & *a); | 124 | res = (mask & *a) != 0; |
125 | *a |= mask; | 125 | *a |= mask; |
126 | raw_local_irq_restore(flags); | 126 | raw_local_irq_restore(flags); |
127 | return res; | 127 | return res; |
@@ -141,12 +141,12 @@ int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
141 | unsigned bit = nr & SZLONG_MASK; | 141 | unsigned bit = nr & SZLONG_MASK; |
142 | unsigned long mask; | 142 | unsigned long mask; |
143 | unsigned long flags; | 143 | unsigned long flags; |
144 | unsigned long res; | 144 | int res; |
145 | 145 | ||
146 | a += nr >> SZLONG_LOG; | 146 | a += nr >> SZLONG_LOG; |
147 | mask = 1UL << bit; | 147 | mask = 1UL << bit; |
148 | raw_local_irq_save(flags); | 148 | raw_local_irq_save(flags); |
149 | res = (mask & *a); | 149 | res = (mask & *a) != 0; |
150 | *a &= ~mask; | 150 | *a &= ~mask; |
151 | raw_local_irq_restore(flags); | 151 | raw_local_irq_restore(flags); |
152 | return res; | 152 | return res; |
@@ -166,12 +166,12 @@ int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr) | |||
166 | unsigned bit = nr & SZLONG_MASK; | 166 | unsigned bit = nr & SZLONG_MASK; |
167 | unsigned long mask; | 167 | unsigned long mask; |
168 | unsigned long flags; | 168 | unsigned long flags; |
169 | unsigned long res; | 169 | int res; |
170 | 170 | ||
171 | a += nr >> SZLONG_LOG; | 171 | a += nr >> SZLONG_LOG; |
172 | mask = 1UL << bit; | 172 | mask = 1UL << bit; |
173 | raw_local_irq_save(flags); | 173 | raw_local_irq_save(flags); |
174 | res = (mask & *a); | 174 | res = (mask & *a) != 0; |
175 | *a ^= mask; | 175 | *a ^= mask; |
176 | raw_local_irq_restore(flags); | 176 | raw_local_irq_restore(flags); |
177 | return res; | 177 | return res; |
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S index 507147aebd41..a6adffbb4e5f 100644 --- a/arch/mips/lib/csum_partial.S +++ b/arch/mips/lib/csum_partial.S | |||
@@ -270,7 +270,7 @@ LEAF(csum_partial) | |||
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | /* odd buffer alignment? */ | 272 | /* odd buffer alignment? */ |
273 | #ifdef CPU_MIPSR2 | 273 | #ifdef CONFIG_CPU_MIPSR2 |
274 | wsbh v1, sum | 274 | wsbh v1, sum |
275 | movn sum, v1, t7 | 275 | movn sum, v1, t7 |
276 | #else | 276 | #else |
@@ -670,7 +670,7 @@ EXC( sb t0, NBYTES-2(dst), .Ls_exc) | |||
670 | addu sum, v1 | 670 | addu sum, v1 |
671 | #endif | 671 | #endif |
672 | 672 | ||
673 | #ifdef CPU_MIPSR2 | 673 | #ifdef CONFIG_CPU_MIPSR2 |
674 | wsbh v1, sum | 674 | wsbh v1, sum |
675 | movn sum, v1, odd | 675 | movn sum, v1, odd |
676 | #else | 676 | #else |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index ecca559b8d7b..2078915eacb9 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -1247,10 +1247,8 @@ static void __cpuinit setup_scache(void) | |||
1247 | return; | 1247 | return; |
1248 | 1248 | ||
1249 | default: | 1249 | default: |
1250 | if (c->isa_level == MIPS_CPU_ISA_M32R1 || | 1250 | if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 | |
1251 | c->isa_level == MIPS_CPU_ISA_M32R2 || | 1251 | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) { |
1252 | c->isa_level == MIPS_CPU_ISA_M64R1 || | ||
1253 | c->isa_level == MIPS_CPU_ISA_M64R2) { | ||
1254 | #ifdef CONFIG_MIPS_CPU_SCACHE | 1252 | #ifdef CONFIG_MIPS_CPU_SCACHE |
1255 | if (mips_sc_init ()) { | 1253 | if (mips_sc_init ()) { |
1256 | scache_size = c->scache.ways * c->scache.sets * c->scache.linesz; | 1254 | scache_size = c->scache.ways * c->scache.sets * c->scache.linesz; |
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index 93d937b4b1ba..df96da7e939b 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c | |||
@@ -98,10 +98,8 @@ static inline int __init mips_sc_probe(void) | |||
98 | c->scache.flags |= MIPS_CACHE_NOT_PRESENT; | 98 | c->scache.flags |= MIPS_CACHE_NOT_PRESENT; |
99 | 99 | ||
100 | /* Ignore anything but MIPSxx processors */ | 100 | /* Ignore anything but MIPSxx processors */ |
101 | if (c->isa_level != MIPS_CPU_ISA_M32R1 && | 101 | if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 | |
102 | c->isa_level != MIPS_CPU_ISA_M32R2 && | 102 | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2))) |
103 | c->isa_level != MIPS_CPU_ISA_M64R1 && | ||
104 | c->isa_level != MIPS_CPU_ISA_M64R2) | ||
105 | return 0; | 103 | return 0; |
106 | 104 | ||
107 | /* Does this MIPS32/MIPS64 CPU have a config2 register? */ | 105 | /* Does this MIPS32/MIPS64 CPU have a config2 register? */ |
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c index 38a80c83fd67..d1faece21b6a 100644 --- a/arch/mips/pci/pci-alchemy.c +++ b/arch/mips/pci/pci-alchemy.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <asm/mach-au1x00/au1000.h> | 19 | #include <asm/mach-au1x00/au1000.h> |
20 | #include <asm/tlbmisc.h> | 20 | #include <asm/tlbmisc.h> |
21 | 21 | ||
22 | #ifdef CONFIG_DEBUG_PCI | 22 | #ifdef CONFIG_PCI_DEBUG |
23 | #define DBG(x...) printk(KERN_DEBUG x) | 23 | #define DBG(x...) printk(KERN_DEBUG x) |
24 | #else | 24 | #else |
25 | #define DBG(x...) do {} while (0) | 25 | #define DBG(x...) do {} while (0) |
@@ -162,7 +162,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus, | |||
162 | if (status & (1 << 29)) { | 162 | if (status & (1 << 29)) { |
163 | *data = 0xffffffff; | 163 | *data = 0xffffffff; |
164 | error = -1; | 164 | error = -1; |
165 | DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d", | 165 | DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d\n", |
166 | access_type, bus->number, device); | 166 | access_type, bus->number, device); |
167 | } else if ((status >> 28) & 0xf) { | 167 | } else if ((status >> 28) & 0xf) { |
168 | DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n", | 168 | DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n", |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 4a2930844d43..4a5443118cfb 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -344,6 +344,7 @@ extern unsigned long MODULES_END; | |||
344 | #define _REGION3_ENTRY_CO 0x100 /* change-recording override */ | 344 | #define _REGION3_ENTRY_CO 0x100 /* change-recording override */ |
345 | 345 | ||
346 | /* Bits in the segment table entry */ | 346 | /* Bits in the segment table entry */ |
347 | #define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */ | ||
347 | #define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ | 348 | #define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ |
348 | #define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */ | 349 | #define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */ |
349 | #define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */ | 350 | #define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */ |
@@ -1531,7 +1532,8 @@ extern int s390_enable_sie(void); | |||
1531 | /* | 1532 | /* |
1532 | * No page table caches to initialise | 1533 | * No page table caches to initialise |
1533 | */ | 1534 | */ |
1534 | #define pgtable_cache_init() do { } while (0) | 1535 | static inline void pgtable_cache_init(void) { } |
1536 | static inline void check_pgt_cache(void) { } | ||
1535 | 1537 | ||
1536 | #include <asm-generic/pgtable.h> | 1538 | #include <asm-generic/pgtable.h> |
1537 | 1539 | ||
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c index dff631d34b45..466fb3383960 100644 --- a/arch/s390/lib/uaccess_pt.c +++ b/arch/s390/lib/uaccess_pt.c | |||
@@ -77,42 +77,69 @@ static size_t copy_in_kernel(size_t count, void __user *to, | |||
77 | * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address | 77 | * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address |
78 | * contains the (negative) exception code. | 78 | * contains the (negative) exception code. |
79 | */ | 79 | */ |
80 | static __always_inline unsigned long follow_table(struct mm_struct *mm, | 80 | #ifdef CONFIG_64BIT |
81 | unsigned long addr, int write) | 81 | static unsigned long follow_table(struct mm_struct *mm, |
82 | unsigned long address, int write) | ||
82 | { | 83 | { |
83 | pgd_t *pgd; | 84 | unsigned long *table = (unsigned long *)__pa(mm->pgd); |
84 | pud_t *pud; | 85 | |
85 | pmd_t *pmd; | 86 | switch (mm->context.asce_bits & _ASCE_TYPE_MASK) { |
86 | pte_t *ptep; | 87 | case _ASCE_TYPE_REGION1: |
88 | table = table + ((address >> 53) & 0x7ff); | ||
89 | if (unlikely(*table & _REGION_ENTRY_INV)) | ||
90 | return -0x39UL; | ||
91 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
92 | case _ASCE_TYPE_REGION2: | ||
93 | table = table + ((address >> 42) & 0x7ff); | ||
94 | if (unlikely(*table & _REGION_ENTRY_INV)) | ||
95 | return -0x3aUL; | ||
96 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
97 | case _ASCE_TYPE_REGION3: | ||
98 | table = table + ((address >> 31) & 0x7ff); | ||
99 | if (unlikely(*table & _REGION_ENTRY_INV)) | ||
100 | return -0x3bUL; | ||
101 | table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); | ||
102 | case _ASCE_TYPE_SEGMENT: | ||
103 | table = table + ((address >> 20) & 0x7ff); | ||
104 | if (unlikely(*table & _SEGMENT_ENTRY_INV)) | ||
105 | return -0x10UL; | ||
106 | if (unlikely(*table & _SEGMENT_ENTRY_LARGE)) { | ||
107 | if (write && (*table & _SEGMENT_ENTRY_RO)) | ||
108 | return -0x04UL; | ||
109 | return (*table & _SEGMENT_ENTRY_ORIGIN_LARGE) + | ||
110 | (address & ~_SEGMENT_ENTRY_ORIGIN_LARGE); | ||
111 | } | ||
112 | table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN); | ||
113 | } | ||
114 | table = table + ((address >> 12) & 0xff); | ||
115 | if (unlikely(*table & _PAGE_INVALID)) | ||
116 | return -0x11UL; | ||
117 | if (write && (*table & _PAGE_RO)) | ||
118 | return -0x04UL; | ||
119 | return (*table & PAGE_MASK) + (address & ~PAGE_MASK); | ||
120 | } | ||
87 | 121 | ||
88 | pgd = pgd_offset(mm, addr); | 122 | #else /* CONFIG_64BIT */ |
89 | if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) | ||
90 | return -0x3aUL; | ||
91 | 123 | ||
92 | pud = pud_offset(pgd, addr); | 124 | static unsigned long follow_table(struct mm_struct *mm, |
93 | if (pud_none(*pud) || unlikely(pud_bad(*pud))) | 125 | unsigned long address, int write) |
94 | return -0x3bUL; | 126 | { |
127 | unsigned long *table = (unsigned long *)__pa(mm->pgd); | ||
95 | 128 | ||
96 | pmd = pmd_offset(pud, addr); | 129 | table = table + ((address >> 20) & 0x7ff); |
97 | if (pmd_none(*pmd)) | 130 | if (unlikely(*table & _SEGMENT_ENTRY_INV)) |
98 | return -0x10UL; | 131 | return -0x10UL; |
99 | if (pmd_large(*pmd)) { | 132 | table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN); |
100 | if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO)) | 133 | table = table + ((address >> 12) & 0xff); |
101 | return -0x04UL; | 134 | if (unlikely(*table & _PAGE_INVALID)) |
102 | return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK); | ||
103 | } | ||
104 | if (unlikely(pmd_bad(*pmd))) | ||
105 | return -0x10UL; | ||
106 | |||
107 | ptep = pte_offset_map(pmd, addr); | ||
108 | if (!pte_present(*ptep)) | ||
109 | return -0x11UL; | 135 | return -0x11UL; |
110 | if (write && (!pte_write(*ptep) || !pte_dirty(*ptep))) | 136 | if (write && (*table & _PAGE_RO)) |
111 | return -0x04UL; | 137 | return -0x04UL; |
112 | 138 | return (*table & PAGE_MASK) + (address & ~PAGE_MASK); | |
113 | return (pte_val(*ptep) & PAGE_MASK) + (addr & ~PAGE_MASK); | ||
114 | } | 139 | } |
115 | 140 | ||
141 | #endif /* CONFIG_64BIT */ | ||
142 | |||
116 | static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, | 143 | static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, |
117 | size_t n, int write_user) | 144 | size_t n, int write_user) |
118 | { | 145 | { |
@@ -197,7 +224,7 @@ size_t copy_to_user_pt(size_t n, void __user *to, const void *from) | |||
197 | 224 | ||
198 | static size_t clear_user_pt(size_t n, void __user *to) | 225 | static size_t clear_user_pt(size_t n, void __user *to) |
199 | { | 226 | { |
200 | void *zpage = &empty_zero_page; | 227 | void *zpage = (void *) empty_zero_page; |
201 | long done, size, ret; | 228 | long done, size, ret; |
202 | 229 | ||
203 | done = 0; | 230 | done = 0; |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index d1e15f7b59c6..7a5aa1a7864e 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -1004,15 +1004,8 @@ void __cpuinit setup_cpu(int boot) | |||
1004 | 1004 | ||
1005 | #ifdef CONFIG_BLK_DEV_INITRD | 1005 | #ifdef CONFIG_BLK_DEV_INITRD |
1006 | 1006 | ||
1007 | /* | ||
1008 | * Note that the kernel can potentially support other compression | ||
1009 | * techniques than gz, though we don't do so by default. If we ever | ||
1010 | * decide to do so we can either look for other filename extensions, | ||
1011 | * or just allow a file with this name to be compressed with an | ||
1012 | * arbitrary compressor (somewhat counterintuitively). | ||
1013 | */ | ||
1014 | static int __initdata set_initramfs_file; | 1007 | static int __initdata set_initramfs_file; |
1015 | static char __initdata initramfs_file[128] = "initramfs.cpio.gz"; | 1008 | static char __initdata initramfs_file[128] = "initramfs"; |
1016 | 1009 | ||
1017 | static int __init setup_initramfs_file(char *str) | 1010 | static int __init setup_initramfs_file(char *str) |
1018 | { | 1011 | { |
@@ -1026,9 +1019,9 @@ static int __init setup_initramfs_file(char *str) | |||
1026 | early_param("initramfs_file", setup_initramfs_file); | 1019 | early_param("initramfs_file", setup_initramfs_file); |
1027 | 1020 | ||
1028 | /* | 1021 | /* |
1029 | * We look for an "initramfs.cpio.gz" file in the hvfs. | 1022 | * We look for a file called "initramfs" in the hvfs. If there is one, we |
1030 | * If there is one, we allocate some memory for it and it will be | 1023 | * allocate some memory for it and it will be unpacked to the initramfs. |
1031 | * unpacked to the initramfs. | 1024 | * If it's compressed, the initd code will uncompress it first. |
1032 | */ | 1025 | */ |
1033 | static void __init load_hv_initrd(void) | 1026 | static void __init load_hv_initrd(void) |
1034 | { | 1027 | { |
@@ -1038,10 +1031,16 @@ static void __init load_hv_initrd(void) | |||
1038 | 1031 | ||
1039 | fd = hv_fs_findfile((HV_VirtAddr) initramfs_file); | 1032 | fd = hv_fs_findfile((HV_VirtAddr) initramfs_file); |
1040 | if (fd == HV_ENOENT) { | 1033 | if (fd == HV_ENOENT) { |
1041 | if (set_initramfs_file) | 1034 | if (set_initramfs_file) { |
1042 | pr_warning("No such hvfs initramfs file '%s'\n", | 1035 | pr_warning("No such hvfs initramfs file '%s'\n", |
1043 | initramfs_file); | 1036 | initramfs_file); |
1044 | return; | 1037 | return; |
1038 | } else { | ||
1039 | /* Try old backwards-compatible name. */ | ||
1040 | fd = hv_fs_findfile((HV_VirtAddr)"initramfs.cpio.gz"); | ||
1041 | if (fd == HV_ENOENT) | ||
1042 | return; | ||
1043 | } | ||
1045 | } | 1044 | } |
1046 | BUG_ON(fd < 0); | 1045 | BUG_ON(fd < 0); |
1047 | stat = hv_fs_fstat(fd); | 1046 | stat = hv_fs_fstat(fd); |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 8a84501acb1b..5ef205c5f37b 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # create a compressed vmlinux image from the original vmlinux | 4 | # create a compressed vmlinux image from the original vmlinux |
5 | # | 5 | # |
6 | 6 | ||
7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo |
8 | 8 | ||
9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
@@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ | |||
29 | $(obj)/piggy.o | 29 | $(obj)/piggy.o |
30 | 30 | ||
31 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | 31 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
32 | $(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone | ||
33 | 32 | ||
34 | ifeq ($(CONFIG_EFI_STUB), y) | 33 | ifeq ($(CONFIG_EFI_STUB), y) |
35 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o | 34 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o |
@@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S | |||
43 | $(obj)/vmlinux.bin: vmlinux FORCE | 42 | $(obj)/vmlinux.bin: vmlinux FORCE |
44 | $(call if_changed,objcopy) | 43 | $(call if_changed,objcopy) |
45 | 44 | ||
46 | targets += vmlinux.bin.all vmlinux.relocs | 45 | targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs |
47 | 46 | ||
48 | CMD_RELOCS = arch/x86/tools/relocs | 47 | CMD_RELOCS = arch/x86/tools/relocs |
49 | quiet_cmd_relocs = RELOCS $@ | 48 | quiet_cmd_relocs = RELOCS $@ |
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h index 1ace47b62592..2e188d68397c 100644 --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h | |||
@@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[]; | |||
29 | */ | 29 | */ |
30 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) | 30 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) |
31 | { | 31 | { |
32 | return regs->orig_ax & __SYSCALL_MASK; | 32 | return regs->orig_ax; |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline void syscall_rollback(struct task_struct *task, | 35 | static inline void syscall_rollback(struct task_struct *task, |
36 | struct pt_regs *regs) | 36 | struct pt_regs *regs) |
37 | { | 37 | { |
38 | regs->ax = regs->orig_ax & __SYSCALL_MASK; | 38 | regs->ax = regs->orig_ax; |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline long syscall_get_error(struct task_struct *task, | 41 | static inline long syscall_get_error(struct task_struct *task, |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 02b51dd4e4ad..f77df1c5de6e 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1857,7 +1857,7 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data) | |||
1857 | if (!pv_eoi_enabled(vcpu)) | 1857 | if (!pv_eoi_enabled(vcpu)) |
1858 | return 0; | 1858 | return 0; |
1859 | return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, | 1859 | return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, |
1860 | addr); | 1860 | addr, sizeof(u8)); |
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | void kvm_lapic_init(void) | 1863 | void kvm_lapic_init(void) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f19ac0aca60d..e1721324c271 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1823,7 +1823,8 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1823 | return 0; | 1823 | return 0; |
1824 | } | 1824 | } |
1825 | 1825 | ||
1826 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa)) | 1826 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa, |
1827 | sizeof(u32))) | ||
1827 | return 1; | 1828 | return 1; |
1828 | 1829 | ||
1829 | vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); | 1830 | vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); |
@@ -1952,12 +1953,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1952 | 1953 | ||
1953 | gpa_offset = data & ~(PAGE_MASK | 1); | 1954 | gpa_offset = data & ~(PAGE_MASK | 1); |
1954 | 1955 | ||
1955 | /* Check that the address is 32-byte aligned. */ | ||
1956 | if (gpa_offset & (sizeof(struct pvclock_vcpu_time_info) - 1)) | ||
1957 | break; | ||
1958 | |||
1959 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, | 1956 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
1960 | &vcpu->arch.pv_time, data & ~1ULL)) | 1957 | &vcpu->arch.pv_time, data & ~1ULL, |
1958 | sizeof(struct pvclock_vcpu_time_info))) | ||
1961 | vcpu->arch.pv_time_enabled = false; | 1959 | vcpu->arch.pv_time_enabled = false; |
1962 | else | 1960 | else |
1963 | vcpu->arch.pv_time_enabled = true; | 1961 | vcpu->arch.pv_time_enabled = true; |
@@ -1977,7 +1975,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1977 | return 1; | 1975 | return 1; |
1978 | 1976 | ||
1979 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, | 1977 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, |
1980 | data & KVM_STEAL_VALID_BITS)) | 1978 | data & KVM_STEAL_VALID_BITS, |
1979 | sizeof(struct kvm_steal_time))) | ||
1981 | return 1; | 1980 | return 1; |
1982 | 1981 | ||
1983 | vcpu->arch.st.msr_val = data; | 1982 | vcpu->arch.st.msr_val = data; |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 92ed9692c47e..4bf68c8d4797 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -396,7 +396,7 @@ config ACPI_CUSTOM_METHOD | |||
396 | 396 | ||
397 | config ACPI_BGRT | 397 | config ACPI_BGRT |
398 | bool "Boottime Graphics Resource Table support" | 398 | bool "Boottime Graphics Resource Table support" |
399 | depends on EFI | 399 | depends on EFI && X86 |
400 | help | 400 | help |
401 | This driver adds support for exposing the ACPI Boottime Graphics | 401 | This driver adds support for exposing the ACPI Boottime Graphics |
402 | Resource Table, which allows the operating system to obtain | 402 | Resource Table, which allows the operating system to obtain |
diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c index 82045e3f5cac..a82c7626aa9b 100644 --- a/drivers/acpi/acpi_i2c.c +++ b/drivers/acpi/acpi_i2c.c | |||
@@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adapter) | |||
90 | acpi_handle handle; | 90 | acpi_handle handle; |
91 | acpi_status status; | 91 | acpi_status status; |
92 | 92 | ||
93 | handle = ACPI_HANDLE(&adapter->dev); | 93 | handle = ACPI_HANDLE(adapter->dev.parent); |
94 | if (!handle) | 94 | if (!handle) |
95 | return; | 95 | return; |
96 | 96 | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 5ff173066127..6ae5e440436e 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -415,7 +415,6 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
415 | struct acpi_pci_root *root; | 415 | struct acpi_pci_root *root; |
416 | struct acpi_pci_driver *driver; | 416 | struct acpi_pci_driver *driver; |
417 | u32 flags, base_flags; | 417 | u32 flags, base_flags; |
418 | bool is_osc_granted = false; | ||
419 | 418 | ||
420 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 419 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
421 | if (!root) | 420 | if (!root) |
@@ -476,6 +475,30 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
476 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | 475 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; |
477 | acpi_pci_osc_support(root, flags); | 476 | acpi_pci_osc_support(root, flags); |
478 | 477 | ||
478 | /* | ||
479 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
480 | */ | ||
481 | |||
482 | mutex_lock(&acpi_pci_root_lock); | ||
483 | list_add_tail(&root->node, &acpi_pci_roots); | ||
484 | mutex_unlock(&acpi_pci_root_lock); | ||
485 | |||
486 | /* | ||
487 | * Scan the Root Bridge | ||
488 | * -------------------- | ||
489 | * Must do this prior to any attempt to bind the root device, as the | ||
490 | * PCI namespace does not get created until this call is made (and | ||
491 | * thus the root bridge's pci_dev does not exist). | ||
492 | */ | ||
493 | root->bus = pci_acpi_scan_root(root); | ||
494 | if (!root->bus) { | ||
495 | printk(KERN_ERR PREFIX | ||
496 | "Bus %04x:%02x not present in PCI namespace\n", | ||
497 | root->segment, (unsigned int)root->secondary.start); | ||
498 | result = -ENODEV; | ||
499 | goto out_del_root; | ||
500 | } | ||
501 | |||
479 | /* Indicate support for various _OSC capabilities. */ | 502 | /* Indicate support for various _OSC capabilities. */ |
480 | if (pci_ext_cfg_avail()) | 503 | if (pci_ext_cfg_avail()) |
481 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | 504 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; |
@@ -494,6 +517,7 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
494 | flags = base_flags; | 517 | flags = base_flags; |
495 | } | 518 | } |
496 | } | 519 | } |
520 | |||
497 | if (!pcie_ports_disabled | 521 | if (!pcie_ports_disabled |
498 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | 522 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { |
499 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | 523 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
@@ -514,54 +538,28 @@ static int acpi_pci_root_add(struct acpi_device *device, | |||
514 | status = acpi_pci_osc_control_set(device->handle, &flags, | 538 | status = acpi_pci_osc_control_set(device->handle, &flags, |
515 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 539 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); |
516 | if (ACPI_SUCCESS(status)) { | 540 | if (ACPI_SUCCESS(status)) { |
517 | is_osc_granted = true; | ||
518 | dev_info(&device->dev, | 541 | dev_info(&device->dev, |
519 | "ACPI _OSC control (0x%02x) granted\n", flags); | 542 | "ACPI _OSC control (0x%02x) granted\n", flags); |
543 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
544 | /* | ||
545 | * We have ASPM control, but the FADT indicates | ||
546 | * that it's unsupported. Clear it. | ||
547 | */ | ||
548 | pcie_clear_aspm(root->bus); | ||
549 | } | ||
520 | } else { | 550 | } else { |
521 | is_osc_granted = false; | ||
522 | dev_info(&device->dev, | 551 | dev_info(&device->dev, |
523 | "ACPI _OSC request failed (%s), " | 552 | "ACPI _OSC request failed (%s), " |
524 | "returned control mask: 0x%02x\n", | 553 | "returned control mask: 0x%02x\n", |
525 | acpi_format_exception(status), flags); | 554 | acpi_format_exception(status), flags); |
555 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
556 | "disabling ASPM\n"); | ||
557 | pcie_no_aspm(); | ||
526 | } | 558 | } |
527 | } else { | 559 | } else { |
528 | dev_info(&device->dev, | 560 | dev_info(&device->dev, |
529 | "Unable to request _OSC control " | 561 | "Unable to request _OSC control " |
530 | "(_OSC support mask: 0x%02x)\n", flags); | 562 | "(_OSC support mask: 0x%02x)\n", flags); |
531 | } | ||
532 | |||
533 | /* | ||
534 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
535 | */ | ||
536 | |||
537 | mutex_lock(&acpi_pci_root_lock); | ||
538 | list_add_tail(&root->node, &acpi_pci_roots); | ||
539 | mutex_unlock(&acpi_pci_root_lock); | ||
540 | |||
541 | /* | ||
542 | * Scan the Root Bridge | ||
543 | * -------------------- | ||
544 | * Must do this prior to any attempt to bind the root device, as the | ||
545 | * PCI namespace does not get created until this call is made (and | ||
546 | * thus the root bridge's pci_dev does not exist). | ||
547 | */ | ||
548 | root->bus = pci_acpi_scan_root(root); | ||
549 | if (!root->bus) { | ||
550 | printk(KERN_ERR PREFIX | ||
551 | "Bus %04x:%02x not present in PCI namespace\n", | ||
552 | root->segment, (unsigned int)root->secondary.start); | ||
553 | result = -ENODEV; | ||
554 | goto out_del_root; | ||
555 | } | ||
556 | |||
557 | /* ASPM setting */ | ||
558 | if (is_osc_granted) { | ||
559 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | ||
560 | pcie_clear_aspm(root->bus); | ||
561 | } else { | ||
562 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
563 | "disabling ASPM\n"); | ||
564 | pcie_no_aspm(); | ||
565 | } | 563 | } |
566 | 564 | ||
567 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 565 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index fc95308e9a11..ee255c60bdac 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -66,7 +66,8 @@ module_param(latency_factor, uint, 0644); | |||
66 | 66 | ||
67 | static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); | 67 | static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); |
68 | 68 | ||
69 | static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX]; | 69 | static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX], |
70 | acpi_cstate); | ||
70 | 71 | ||
71 | static int disabled_by_idle_boot_param(void) | 72 | static int disabled_by_idle_boot_param(void) |
72 | { | 73 | { |
@@ -722,7 +723,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
722 | struct cpuidle_driver *drv, int index) | 723 | struct cpuidle_driver *drv, int index) |
723 | { | 724 | { |
724 | struct acpi_processor *pr; | 725 | struct acpi_processor *pr; |
725 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 726 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
726 | 727 | ||
727 | pr = __this_cpu_read(processors); | 728 | pr = __this_cpu_read(processors); |
728 | 729 | ||
@@ -745,7 +746,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
745 | */ | 746 | */ |
746 | static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) | 747 | static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) |
747 | { | 748 | { |
748 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 749 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
749 | 750 | ||
750 | ACPI_FLUSH_CPU_CACHE(); | 751 | ACPI_FLUSH_CPU_CACHE(); |
751 | 752 | ||
@@ -775,7 +776,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
775 | struct cpuidle_driver *drv, int index) | 776 | struct cpuidle_driver *drv, int index) |
776 | { | 777 | { |
777 | struct acpi_processor *pr; | 778 | struct acpi_processor *pr; |
778 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 779 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
779 | 780 | ||
780 | pr = __this_cpu_read(processors); | 781 | pr = __this_cpu_read(processors); |
781 | 782 | ||
@@ -833,7 +834,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
833 | struct cpuidle_driver *drv, int index) | 834 | struct cpuidle_driver *drv, int index) |
834 | { | 835 | { |
835 | struct acpi_processor *pr; | 836 | struct acpi_processor *pr; |
836 | struct acpi_processor_cx *cx = acpi_cstate[index]; | 837 | struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu); |
837 | 838 | ||
838 | pr = __this_cpu_read(processors); | 839 | pr = __this_cpu_read(processors); |
839 | 840 | ||
@@ -960,7 +961,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, | |||
960 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) | 961 | !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) |
961 | continue; | 962 | continue; |
962 | #endif | 963 | #endif |
963 | acpi_cstate[count] = cx; | 964 | per_cpu(acpi_cstate[count], dev->cpu) = cx; |
964 | 965 | ||
965 | count++; | 966 | count++; |
966 | if (count == CPUIDLE_STATE_MAX) | 967 | if (count == CPUIDLE_STATE_MAX) |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 405022d302c3..7638121cb5d1 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -209,8 +209,6 @@ struct arasan_cf_dev { | |||
209 | struct dma_chan *dma_chan; | 209 | struct dma_chan *dma_chan; |
210 | /* Mask for DMA transfers */ | 210 | /* Mask for DMA transfers */ |
211 | dma_cap_mask_t mask; | 211 | dma_cap_mask_t mask; |
212 | /* dma channel private data */ | ||
213 | void *dma_priv; | ||
214 | /* DMA transfer work */ | 212 | /* DMA transfer work */ |
215 | struct work_struct work; | 213 | struct work_struct work; |
216 | /* DMA delayed finish work */ | 214 | /* DMA delayed finish work */ |
@@ -308,6 +306,7 @@ static void cf_card_detect(struct arasan_cf_dev *acdev, bool hotplugged) | |||
308 | static int cf_init(struct arasan_cf_dev *acdev) | 306 | static int cf_init(struct arasan_cf_dev *acdev) |
309 | { | 307 | { |
310 | struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); | 308 | struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); |
309 | unsigned int if_clk; | ||
311 | unsigned long flags; | 310 | unsigned long flags; |
312 | int ret = 0; | 311 | int ret = 0; |
313 | 312 | ||
@@ -325,8 +324,12 @@ static int cf_init(struct arasan_cf_dev *acdev) | |||
325 | 324 | ||
326 | spin_lock_irqsave(&acdev->host->lock, flags); | 325 | spin_lock_irqsave(&acdev->host->lock, flags); |
327 | /* configure CF interface clock */ | 326 | /* configure CF interface clock */ |
328 | writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : | 327 | /* TODO: read from device tree */ |
329 | CF_IF_CLK_166M, acdev->vbase + CLK_CFG); | 328 | if_clk = CF_IF_CLK_166M; |
329 | if (pdata && pdata->cf_if_clk <= CF_IF_CLK_200M) | ||
330 | if_clk = pdata->cf_if_clk; | ||
331 | |||
332 | writel(if_clk, acdev->vbase + CLK_CFG); | ||
330 | 333 | ||
331 | writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); | 334 | writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); |
332 | cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); | 335 | cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); |
@@ -357,12 +360,6 @@ static void dma_callback(void *dev) | |||
357 | complete(&acdev->dma_completion); | 360 | complete(&acdev->dma_completion); |
358 | } | 361 | } |
359 | 362 | ||
360 | static bool filter(struct dma_chan *chan, void *slave) | ||
361 | { | ||
362 | chan->private = slave; | ||
363 | return true; | ||
364 | } | ||
365 | |||
366 | static inline void dma_complete(struct arasan_cf_dev *acdev) | 363 | static inline void dma_complete(struct arasan_cf_dev *acdev) |
367 | { | 364 | { |
368 | struct ata_queued_cmd *qc = acdev->qc; | 365 | struct ata_queued_cmd *qc = acdev->qc; |
@@ -530,8 +527,7 @@ static void data_xfer(struct work_struct *work) | |||
530 | 527 | ||
531 | /* request dma channels */ | 528 | /* request dma channels */ |
532 | /* dma_request_channel may sleep, so calling from process context */ | 529 | /* dma_request_channel may sleep, so calling from process context */ |
533 | acdev->dma_chan = dma_request_channel(acdev->mask, filter, | 530 | acdev->dma_chan = dma_request_slave_channel(acdev->host->dev, "data"); |
534 | acdev->dma_priv); | ||
535 | if (!acdev->dma_chan) { | 531 | if (!acdev->dma_chan) { |
536 | dev_err(acdev->host->dev, "Unable to get dma_chan\n"); | 532 | dev_err(acdev->host->dev, "Unable to get dma_chan\n"); |
537 | goto chan_request_fail; | 533 | goto chan_request_fail; |
@@ -798,6 +794,7 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
798 | struct ata_host *host; | 794 | struct ata_host *host; |
799 | struct ata_port *ap; | 795 | struct ata_port *ap; |
800 | struct resource *res; | 796 | struct resource *res; |
797 | u32 quirk; | ||
801 | irq_handler_t irq_handler = NULL; | 798 | irq_handler_t irq_handler = NULL; |
802 | int ret = 0; | 799 | int ret = 0; |
803 | 800 | ||
@@ -817,12 +814,17 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
817 | return -ENOMEM; | 814 | return -ENOMEM; |
818 | } | 815 | } |
819 | 816 | ||
817 | if (pdata) | ||
818 | quirk = pdata->quirk; | ||
819 | else | ||
820 | quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */ | ||
821 | |||
820 | /* if irq is 0, support only PIO */ | 822 | /* if irq is 0, support only PIO */ |
821 | acdev->irq = platform_get_irq(pdev, 0); | 823 | acdev->irq = platform_get_irq(pdev, 0); |
822 | if (acdev->irq) | 824 | if (acdev->irq) |
823 | irq_handler = arasan_cf_interrupt; | 825 | irq_handler = arasan_cf_interrupt; |
824 | else | 826 | else |
825 | pdata->quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; | 827 | quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; |
826 | 828 | ||
827 | acdev->pbase = res->start; | 829 | acdev->pbase = res->start; |
828 | acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, | 830 | acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, |
@@ -859,17 +861,16 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
859 | INIT_WORK(&acdev->work, data_xfer); | 861 | INIT_WORK(&acdev->work, data_xfer); |
860 | INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); | 862 | INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); |
861 | dma_cap_set(DMA_MEMCPY, acdev->mask); | 863 | dma_cap_set(DMA_MEMCPY, acdev->mask); |
862 | acdev->dma_priv = pdata->dma_priv; | ||
863 | 864 | ||
864 | /* Handle platform specific quirks */ | 865 | /* Handle platform specific quirks */ |
865 | if (pdata->quirk) { | 866 | if (quirk) { |
866 | if (pdata->quirk & CF_BROKEN_PIO) { | 867 | if (quirk & CF_BROKEN_PIO) { |
867 | ap->ops->set_piomode = NULL; | 868 | ap->ops->set_piomode = NULL; |
868 | ap->pio_mask = 0; | 869 | ap->pio_mask = 0; |
869 | } | 870 | } |
870 | if (pdata->quirk & CF_BROKEN_MWDMA) | 871 | if (quirk & CF_BROKEN_MWDMA) |
871 | ap->mwdma_mask = 0; | 872 | ap->mwdma_mask = 0; |
872 | if (pdata->quirk & CF_BROKEN_UDMA) | 873 | if (quirk & CF_BROKEN_UDMA) |
873 | ap->udma_mask = 0; | 874 | ap->udma_mask = 0; |
874 | } | 875 | } |
875 | ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; | 876 | ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; |
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 5f74587ef258..71671c42ef45 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "power.h" | 46 | #include "power.h" |
47 | 47 | ||
48 | static DEFINE_MUTEX(dev_pm_qos_mtx); | 48 | static DEFINE_MUTEX(dev_pm_qos_mtx); |
49 | static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx); | ||
49 | 50 | ||
50 | static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); | 51 | static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); |
51 | 52 | ||
@@ -216,12 +217,17 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
216 | struct pm_qos_constraints *c; | 217 | struct pm_qos_constraints *c; |
217 | struct pm_qos_flags *f; | 218 | struct pm_qos_flags *f; |
218 | 219 | ||
219 | mutex_lock(&dev_pm_qos_mtx); | 220 | mutex_lock(&dev_pm_qos_sysfs_mtx); |
220 | 221 | ||
221 | /* | 222 | /* |
222 | * If the device's PM QoS resume latency limit or PM QoS flags have been | 223 | * If the device's PM QoS resume latency limit or PM QoS flags have been |
223 | * exposed to user space, they have to be hidden at this point. | 224 | * exposed to user space, they have to be hidden at this point. |
224 | */ | 225 | */ |
226 | pm_qos_sysfs_remove_latency(dev); | ||
227 | pm_qos_sysfs_remove_flags(dev); | ||
228 | |||
229 | mutex_lock(&dev_pm_qos_mtx); | ||
230 | |||
225 | __dev_pm_qos_hide_latency_limit(dev); | 231 | __dev_pm_qos_hide_latency_limit(dev); |
226 | __dev_pm_qos_hide_flags(dev); | 232 | __dev_pm_qos_hide_flags(dev); |
227 | 233 | ||
@@ -254,6 +260,8 @@ void dev_pm_qos_constraints_destroy(struct device *dev) | |||
254 | 260 | ||
255 | out: | 261 | out: |
256 | mutex_unlock(&dev_pm_qos_mtx); | 262 | mutex_unlock(&dev_pm_qos_mtx); |
263 | |||
264 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
257 | } | 265 | } |
258 | 266 | ||
259 | /** | 267 | /** |
@@ -558,6 +566,14 @@ static void __dev_pm_qos_drop_user_request(struct device *dev, | |||
558 | kfree(req); | 566 | kfree(req); |
559 | } | 567 | } |
560 | 568 | ||
569 | static void dev_pm_qos_drop_user_request(struct device *dev, | ||
570 | enum dev_pm_qos_req_type type) | ||
571 | { | ||
572 | mutex_lock(&dev_pm_qos_mtx); | ||
573 | __dev_pm_qos_drop_user_request(dev, type); | ||
574 | mutex_unlock(&dev_pm_qos_mtx); | ||
575 | } | ||
576 | |||
561 | /** | 577 | /** |
562 | * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. | 578 | * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. |
563 | * @dev: Device whose PM QoS latency limit is to be exposed to user space. | 579 | * @dev: Device whose PM QoS latency limit is to be exposed to user space. |
@@ -581,6 +597,8 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
581 | return ret; | 597 | return ret; |
582 | } | 598 | } |
583 | 599 | ||
600 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
601 | |||
584 | mutex_lock(&dev_pm_qos_mtx); | 602 | mutex_lock(&dev_pm_qos_mtx); |
585 | 603 | ||
586 | if (IS_ERR_OR_NULL(dev->power.qos)) | 604 | if (IS_ERR_OR_NULL(dev->power.qos)) |
@@ -591,26 +609,27 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value) | |||
591 | if (ret < 0) { | 609 | if (ret < 0) { |
592 | __dev_pm_qos_remove_request(req); | 610 | __dev_pm_qos_remove_request(req); |
593 | kfree(req); | 611 | kfree(req); |
612 | mutex_unlock(&dev_pm_qos_mtx); | ||
594 | goto out; | 613 | goto out; |
595 | } | 614 | } |
596 | |||
597 | dev->power.qos->latency_req = req; | 615 | dev->power.qos->latency_req = req; |
616 | |||
617 | mutex_unlock(&dev_pm_qos_mtx); | ||
618 | |||
598 | ret = pm_qos_sysfs_add_latency(dev); | 619 | ret = pm_qos_sysfs_add_latency(dev); |
599 | if (ret) | 620 | if (ret) |
600 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 621 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); |
601 | 622 | ||
602 | out: | 623 | out: |
603 | mutex_unlock(&dev_pm_qos_mtx); | 624 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
604 | return ret; | 625 | return ret; |
605 | } | 626 | } |
606 | EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); | 627 | EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); |
607 | 628 | ||
608 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) | 629 | static void __dev_pm_qos_hide_latency_limit(struct device *dev) |
609 | { | 630 | { |
610 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { | 631 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) |
611 | pm_qos_sysfs_remove_latency(dev); | ||
612 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); | 632 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); |
613 | } | ||
614 | } | 633 | } |
615 | 634 | ||
616 | /** | 635 | /** |
@@ -619,9 +638,15 @@ static void __dev_pm_qos_hide_latency_limit(struct device *dev) | |||
619 | */ | 638 | */ |
620 | void dev_pm_qos_hide_latency_limit(struct device *dev) | 639 | void dev_pm_qos_hide_latency_limit(struct device *dev) |
621 | { | 640 | { |
641 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
642 | |||
643 | pm_qos_sysfs_remove_latency(dev); | ||
644 | |||
622 | mutex_lock(&dev_pm_qos_mtx); | 645 | mutex_lock(&dev_pm_qos_mtx); |
623 | __dev_pm_qos_hide_latency_limit(dev); | 646 | __dev_pm_qos_hide_latency_limit(dev); |
624 | mutex_unlock(&dev_pm_qos_mtx); | 647 | mutex_unlock(&dev_pm_qos_mtx); |
648 | |||
649 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
625 | } | 650 | } |
626 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); | 651 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); |
627 | 652 | ||
@@ -649,6 +674,8 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val) | |||
649 | } | 674 | } |
650 | 675 | ||
651 | pm_runtime_get_sync(dev); | 676 | pm_runtime_get_sync(dev); |
677 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
678 | |||
652 | mutex_lock(&dev_pm_qos_mtx); | 679 | mutex_lock(&dev_pm_qos_mtx); |
653 | 680 | ||
654 | if (IS_ERR_OR_NULL(dev->power.qos)) | 681 | if (IS_ERR_OR_NULL(dev->power.qos)) |
@@ -659,16 +686,19 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val) | |||
659 | if (ret < 0) { | 686 | if (ret < 0) { |
660 | __dev_pm_qos_remove_request(req); | 687 | __dev_pm_qos_remove_request(req); |
661 | kfree(req); | 688 | kfree(req); |
689 | mutex_unlock(&dev_pm_qos_mtx); | ||
662 | goto out; | 690 | goto out; |
663 | } | 691 | } |
664 | |||
665 | dev->power.qos->flags_req = req; | 692 | dev->power.qos->flags_req = req; |
693 | |||
694 | mutex_unlock(&dev_pm_qos_mtx); | ||
695 | |||
666 | ret = pm_qos_sysfs_add_flags(dev); | 696 | ret = pm_qos_sysfs_add_flags(dev); |
667 | if (ret) | 697 | if (ret) |
668 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); | 698 | dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); |
669 | 699 | ||
670 | out: | 700 | out: |
671 | mutex_unlock(&dev_pm_qos_mtx); | 701 | mutex_unlock(&dev_pm_qos_sysfs_mtx); |
672 | pm_runtime_put(dev); | 702 | pm_runtime_put(dev); |
673 | return ret; | 703 | return ret; |
674 | } | 704 | } |
@@ -676,10 +706,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags); | |||
676 | 706 | ||
677 | static void __dev_pm_qos_hide_flags(struct device *dev) | 707 | static void __dev_pm_qos_hide_flags(struct device *dev) |
678 | { | 708 | { |
679 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { | 709 | if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) |
680 | pm_qos_sysfs_remove_flags(dev); | ||
681 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); | 710 | __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); |
682 | } | ||
683 | } | 711 | } |
684 | 712 | ||
685 | /** | 713 | /** |
@@ -689,9 +717,15 @@ static void __dev_pm_qos_hide_flags(struct device *dev) | |||
689 | void dev_pm_qos_hide_flags(struct device *dev) | 717 | void dev_pm_qos_hide_flags(struct device *dev) |
690 | { | 718 | { |
691 | pm_runtime_get_sync(dev); | 719 | pm_runtime_get_sync(dev); |
720 | mutex_lock(&dev_pm_qos_sysfs_mtx); | ||
721 | |||
722 | pm_qos_sysfs_remove_flags(dev); | ||
723 | |||
692 | mutex_lock(&dev_pm_qos_mtx); | 724 | mutex_lock(&dev_pm_qos_mtx); |
693 | __dev_pm_qos_hide_flags(dev); | 725 | __dev_pm_qos_hide_flags(dev); |
694 | mutex_unlock(&dev_pm_qos_mtx); | 726 | mutex_unlock(&dev_pm_qos_mtx); |
727 | |||
728 | mutex_unlock(&dev_pm_qos_sysfs_mtx); | ||
695 | pm_runtime_put(dev); | 729 | pm_runtime_put(dev); |
696 | } | 730 | } |
697 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); | 731 | EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index e6732cf7c06e..79f4fca9877a 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
398 | base = 0; | 398 | base = 0; |
399 | 399 | ||
400 | if (max < rbnode->base_reg + rbnode->blklen) | 400 | if (max < rbnode->base_reg + rbnode->blklen) |
401 | end = rbnode->base_reg + rbnode->blklen - max; | 401 | end = max - rbnode->base_reg + 1; |
402 | else | 402 | else |
403 | end = rbnode->blklen; | 403 | end = rbnode->blklen; |
404 | 404 | ||
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 3d2367501fd0..d34adef1e63e 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -710,12 +710,12 @@ skip_format_initialization: | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | regmap_debugfs_init(map, config->name); | ||
714 | |||
713 | ret = regcache_init(map, config); | 715 | ret = regcache_init(map, config); |
714 | if (ret != 0) | 716 | if (ret != 0) |
715 | goto err_range; | 717 | goto err_range; |
716 | 718 | ||
717 | regmap_debugfs_init(map, config->name); | ||
718 | |||
719 | /* Add a devres resource for dev_get_regmap() */ | 719 | /* Add a devres resource for dev_get_regmap() */ |
720 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); | 720 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); |
721 | if (!m) { | 721 | if (!m) { |
@@ -943,8 +943,7 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
943 | unsigned int ival; | 943 | unsigned int ival; |
944 | int val_bytes = map->format.val_bytes; | 944 | int val_bytes = map->format.val_bytes; |
945 | for (i = 0; i < val_len / val_bytes; i++) { | 945 | for (i = 0; i < val_len / val_bytes; i++) { |
946 | memcpy(map->work_buf, val + (i * val_bytes), val_bytes); | 946 | ival = map->format.parse_val(val + (i * val_bytes)); |
947 | ival = map->format.parse_val(map->work_buf); | ||
948 | ret = regcache_write(map, reg + (i * map->reg_stride), | 947 | ret = regcache_write(map, reg + (i * map->reg_stride), |
949 | ival); | 948 | ival); |
950 | if (ret) { | 949 | if (ret) { |
@@ -1036,6 +1035,8 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
1036 | kfree(async->work_buf); | 1035 | kfree(async->work_buf); |
1037 | kfree(async); | 1036 | kfree(async); |
1038 | } | 1037 | } |
1038 | |||
1039 | return ret; | ||
1039 | } | 1040 | } |
1040 | 1041 | ||
1041 | trace_regmap_hw_write_start(map->dev, reg, | 1042 | trace_regmap_hw_write_start(map->dev, reg, |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 25ef5c014fca..92b6d7c51e39 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -51,8 +51,9 @@ new_skb(ulong len) | |||
51 | { | 51 | { |
52 | struct sk_buff *skb; | 52 | struct sk_buff *skb; |
53 | 53 | ||
54 | skb = alloc_skb(len, GFP_ATOMIC); | 54 | skb = alloc_skb(len + MAX_HEADER, GFP_ATOMIC); |
55 | if (skb) { | 55 | if (skb) { |
56 | skb_reserve(skb, MAX_HEADER); | ||
56 | skb_reset_mac_header(skb); | 57 | skb_reset_mac_header(skb); |
57 | skb_reset_network_header(skb); | 58 | skb_reset_network_header(skb); |
58 | skb->protocol = __constant_htons(ETH_P_AOE); | 59 | skb->protocol = __constant_htons(ETH_P_AOE); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index fe5f6403417f..2c127f9c3f3b 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -922,6 +922,11 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode, | |||
922 | lo->lo_flags |= LO_FLAGS_PARTSCAN; | 922 | lo->lo_flags |= LO_FLAGS_PARTSCAN; |
923 | if (lo->lo_flags & LO_FLAGS_PARTSCAN) | 923 | if (lo->lo_flags & LO_FLAGS_PARTSCAN) |
924 | ioctl_by_bdev(bdev, BLKRRPART, 0); | 924 | ioctl_by_bdev(bdev, BLKRRPART, 0); |
925 | |||
926 | /* Grab the block_device to prevent its destruction after we | ||
927 | * put /dev/loopXX inode. Later in loop_clr_fd() we bdput(bdev). | ||
928 | */ | ||
929 | bdgrab(bdev); | ||
925 | return 0; | 930 | return 0; |
926 | 931 | ||
927 | out_clr: | 932 | out_clr: |
@@ -1031,8 +1036,10 @@ static int loop_clr_fd(struct loop_device *lo) | |||
1031 | memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); | 1036 | memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE); |
1032 | memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); | 1037 | memset(lo->lo_crypt_name, 0, LO_NAME_SIZE); |
1033 | memset(lo->lo_file_name, 0, LO_NAME_SIZE); | 1038 | memset(lo->lo_file_name, 0, LO_NAME_SIZE); |
1034 | if (bdev) | 1039 | if (bdev) { |
1040 | bdput(bdev); | ||
1035 | invalidate_bdev(bdev); | 1041 | invalidate_bdev(bdev); |
1042 | } | ||
1036 | set_capacity(lo->lo_disk, 0); | 1043 | set_capacity(lo->lo_disk, 0); |
1037 | loop_sysfs_exit(lo); | 1044 | loop_sysfs_exit(lo); |
1038 | if (bdev) { | 1045 | if (bdev) { |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 69ae5972713c..a0f7724852eb 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng) | |||
380 | } | 380 | } |
381 | EXPORT_SYMBOL_GPL(hwrng_unregister); | 381 | EXPORT_SYMBOL_GPL(hwrng_unregister); |
382 | 382 | ||
383 | static void __exit hwrng_exit(void) | ||
384 | { | ||
385 | mutex_lock(&rng_mutex); | ||
386 | BUG_ON(current_rng); | ||
387 | kfree(rng_buffer); | ||
388 | mutex_unlock(&rng_mutex); | ||
389 | } | ||
390 | |||
391 | module_exit(hwrng_exit); | ||
383 | 392 | ||
384 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | 393 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); |
385 | MODULE_LICENSE("GPL"); | 394 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e905d5f53051..ce5f3fc25d6d 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -149,7 +149,8 @@ struct ports_device { | |||
149 | spinlock_t ports_lock; | 149 | spinlock_t ports_lock; |
150 | 150 | ||
151 | /* To protect the vq operations for the control channel */ | 151 | /* To protect the vq operations for the control channel */ |
152 | spinlock_t cvq_lock; | 152 | spinlock_t c_ivq_lock; |
153 | spinlock_t c_ovq_lock; | ||
153 | 154 | ||
154 | /* The current config space is stored here */ | 155 | /* The current config space is stored here */ |
155 | struct virtio_console_config config; | 156 | struct virtio_console_config config; |
@@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, | |||
569 | vq = portdev->c_ovq; | 570 | vq = portdev->c_ovq; |
570 | 571 | ||
571 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | 572 | sg_init_one(sg, &cpkt, sizeof(cpkt)); |
573 | |||
574 | spin_lock(&portdev->c_ovq_lock); | ||
572 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { | 575 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { |
573 | virtqueue_kick(vq); | 576 | virtqueue_kick(vq); |
574 | while (!virtqueue_get_buf(vq, &len)) | 577 | while (!virtqueue_get_buf(vq, &len)) |
575 | cpu_relax(); | 578 | cpu_relax(); |
576 | } | 579 | } |
580 | spin_unlock(&portdev->c_ovq_lock); | ||
577 | return 0; | 581 | return 0; |
578 | } | 582 | } |
579 | 583 | ||
@@ -1436,7 +1440,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1436 | * rproc_serial does not want the console port, only | 1440 | * rproc_serial does not want the console port, only |
1437 | * the generic port implementation. | 1441 | * the generic port implementation. |
1438 | */ | 1442 | */ |
1439 | port->host_connected = port->guest_connected = true; | 1443 | port->host_connected = true; |
1440 | else if (!use_multiport(port->portdev)) { | 1444 | else if (!use_multiport(port->portdev)) { |
1441 | /* | 1445 | /* |
1442 | * If we're not using multiport support, | 1446 | * If we're not using multiport support, |
@@ -1709,23 +1713,23 @@ static void control_work_handler(struct work_struct *work) | |||
1709 | portdev = container_of(work, struct ports_device, control_work); | 1713 | portdev = container_of(work, struct ports_device, control_work); |
1710 | vq = portdev->c_ivq; | 1714 | vq = portdev->c_ivq; |
1711 | 1715 | ||
1712 | spin_lock(&portdev->cvq_lock); | 1716 | spin_lock(&portdev->c_ivq_lock); |
1713 | while ((buf = virtqueue_get_buf(vq, &len))) { | 1717 | while ((buf = virtqueue_get_buf(vq, &len))) { |
1714 | spin_unlock(&portdev->cvq_lock); | 1718 | spin_unlock(&portdev->c_ivq_lock); |
1715 | 1719 | ||
1716 | buf->len = len; | 1720 | buf->len = len; |
1717 | buf->offset = 0; | 1721 | buf->offset = 0; |
1718 | 1722 | ||
1719 | handle_control_message(portdev, buf); | 1723 | handle_control_message(portdev, buf); |
1720 | 1724 | ||
1721 | spin_lock(&portdev->cvq_lock); | 1725 | spin_lock(&portdev->c_ivq_lock); |
1722 | if (add_inbuf(portdev->c_ivq, buf) < 0) { | 1726 | if (add_inbuf(portdev->c_ivq, buf) < 0) { |
1723 | dev_warn(&portdev->vdev->dev, | 1727 | dev_warn(&portdev->vdev->dev, |
1724 | "Error adding buffer to queue\n"); | 1728 | "Error adding buffer to queue\n"); |
1725 | free_buf(buf, false); | 1729 | free_buf(buf, false); |
1726 | } | 1730 | } |
1727 | } | 1731 | } |
1728 | spin_unlock(&portdev->cvq_lock); | 1732 | spin_unlock(&portdev->c_ivq_lock); |
1729 | } | 1733 | } |
1730 | 1734 | ||
1731 | static void out_intr(struct virtqueue *vq) | 1735 | static void out_intr(struct virtqueue *vq) |
@@ -1752,13 +1756,23 @@ static void in_intr(struct virtqueue *vq) | |||
1752 | port->inbuf = get_inbuf(port); | 1756 | port->inbuf = get_inbuf(port); |
1753 | 1757 | ||
1754 | /* | 1758 | /* |
1755 | * Don't queue up data when port is closed. This condition | 1759 | * Normally the port should not accept data when the port is |
1760 | * closed. For generic serial ports, the host won't (shouldn't) | ||
1761 | * send data till the guest is connected. But this condition | ||
1756 | * can be reached when a console port is not yet connected (no | 1762 | * can be reached when a console port is not yet connected (no |
1757 | * tty is spawned) and the host sends out data to console | 1763 | * tty is spawned) and the other side sends out data over the |
1758 | * ports. For generic serial ports, the host won't | 1764 | * vring, or when a remote devices start sending data before |
1759 | * (shouldn't) send data till the guest is connected. | 1765 | * the ports are opened. |
1766 | * | ||
1767 | * A generic serial port will discard data if not connected, | ||
1768 | * while console ports and rproc-serial ports accepts data at | ||
1769 | * any time. rproc-serial is initiated with guest_connected to | ||
1770 | * false because port_fops_open expects this. Console ports are | ||
1771 | * hooked up with an HVC console and is initialized with | ||
1772 | * guest_connected to true. | ||
1760 | */ | 1773 | */ |
1761 | if (!port->guest_connected) | 1774 | |
1775 | if (!port->guest_connected && !is_rproc_serial(port->portdev->vdev)) | ||
1762 | discard_port_data(port); | 1776 | discard_port_data(port); |
1763 | 1777 | ||
1764 | spin_unlock_irqrestore(&port->inbuf_lock, flags); | 1778 | spin_unlock_irqrestore(&port->inbuf_lock, flags); |
@@ -1986,10 +2000,12 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
1986 | if (multiport) { | 2000 | if (multiport) { |
1987 | unsigned int nr_added_bufs; | 2001 | unsigned int nr_added_bufs; |
1988 | 2002 | ||
1989 | spin_lock_init(&portdev->cvq_lock); | 2003 | spin_lock_init(&portdev->c_ivq_lock); |
2004 | spin_lock_init(&portdev->c_ovq_lock); | ||
1990 | INIT_WORK(&portdev->control_work, &control_work_handler); | 2005 | INIT_WORK(&portdev->control_work, &control_work_handler); |
1991 | 2006 | ||
1992 | nr_added_bufs = fill_queue(portdev->c_ivq, &portdev->cvq_lock); | 2007 | nr_added_bufs = fill_queue(portdev->c_ivq, |
2008 | &portdev->c_ivq_lock); | ||
1993 | if (!nr_added_bufs) { | 2009 | if (!nr_added_bufs) { |
1994 | dev_err(&vdev->dev, | 2010 | dev_err(&vdev->dev, |
1995 | "Error allocating buffers for control queue\n"); | 2011 | "Error allocating buffers for control queue\n"); |
@@ -2140,7 +2156,7 @@ static int virtcons_restore(struct virtio_device *vdev) | |||
2140 | return ret; | 2156 | return ret; |
2141 | 2157 | ||
2142 | if (use_multiport(portdev)) | 2158 | if (use_multiport(portdev)) |
2143 | fill_queue(portdev->c_ivq, &portdev->cvq_lock); | 2159 | fill_queue(portdev->c_ivq, &portdev->c_ivq_lock); |
2144 | 2160 | ||
2145 | list_for_each_entry(port, &portdev->ports, list) { | 2161 | list_for_each_entry(port, &portdev->ports, list) { |
2146 | port->in_vq = portdev->in_vqs[port->id]; | 2162 | port->in_vq = portdev->in_vqs[port->id]; |
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/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c index ed9af4278619..aedbbe12f321 100644 --- a/drivers/clk/spear/spear1310_clock.c +++ b/drivers/clk/spear/spear1310_clock.c | |||
@@ -17,12 +17,10 @@ | |||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
19 | #include <linux/spinlock_types.h> | 19 | #include <linux/spinlock_types.h> |
20 | #include <mach/spear.h> | ||
21 | #include "clk.h" | 20 | #include "clk.h" |
22 | 21 | ||
23 | #define VA_SPEAR1310_RAS_BASE IOMEM(UL(0xFA400000)) | ||
24 | /* PLL related registers and bit values */ | 22 | /* PLL related registers and bit values */ |
25 | #define SPEAR1310_PLL_CFG (VA_MISC_BASE + 0x210) | 23 | #define SPEAR1310_PLL_CFG (misc_base + 0x210) |
26 | /* PLL_CFG bit values */ | 24 | /* PLL_CFG bit values */ |
27 | #define SPEAR1310_CLCD_SYNT_CLK_MASK 1 | 25 | #define SPEAR1310_CLCD_SYNT_CLK_MASK 1 |
28 | #define SPEAR1310_CLCD_SYNT_CLK_SHIFT 31 | 26 | #define SPEAR1310_CLCD_SYNT_CLK_SHIFT 31 |
@@ -35,15 +33,15 @@ | |||
35 | #define SPEAR1310_PLL2_CLK_SHIFT 22 | 33 | #define SPEAR1310_PLL2_CLK_SHIFT 22 |
36 | #define SPEAR1310_PLL1_CLK_SHIFT 20 | 34 | #define SPEAR1310_PLL1_CLK_SHIFT 20 |
37 | 35 | ||
38 | #define SPEAR1310_PLL1_CTR (VA_MISC_BASE + 0x214) | 36 | #define SPEAR1310_PLL1_CTR (misc_base + 0x214) |
39 | #define SPEAR1310_PLL1_FRQ (VA_MISC_BASE + 0x218) | 37 | #define SPEAR1310_PLL1_FRQ (misc_base + 0x218) |
40 | #define SPEAR1310_PLL2_CTR (VA_MISC_BASE + 0x220) | 38 | #define SPEAR1310_PLL2_CTR (misc_base + 0x220) |
41 | #define SPEAR1310_PLL2_FRQ (VA_MISC_BASE + 0x224) | 39 | #define SPEAR1310_PLL2_FRQ (misc_base + 0x224) |
42 | #define SPEAR1310_PLL3_CTR (VA_MISC_BASE + 0x22C) | 40 | #define SPEAR1310_PLL3_CTR (misc_base + 0x22C) |
43 | #define SPEAR1310_PLL3_FRQ (VA_MISC_BASE + 0x230) | 41 | #define SPEAR1310_PLL3_FRQ (misc_base + 0x230) |
44 | #define SPEAR1310_PLL4_CTR (VA_MISC_BASE + 0x238) | 42 | #define SPEAR1310_PLL4_CTR (misc_base + 0x238) |
45 | #define SPEAR1310_PLL4_FRQ (VA_MISC_BASE + 0x23C) | 43 | #define SPEAR1310_PLL4_FRQ (misc_base + 0x23C) |
46 | #define SPEAR1310_PERIP_CLK_CFG (VA_MISC_BASE + 0x244) | 44 | #define SPEAR1310_PERIP_CLK_CFG (misc_base + 0x244) |
47 | /* PERIP_CLK_CFG bit values */ | 45 | /* PERIP_CLK_CFG bit values */ |
48 | #define SPEAR1310_GPT_OSC24_VAL 0 | 46 | #define SPEAR1310_GPT_OSC24_VAL 0 |
49 | #define SPEAR1310_GPT_APB_VAL 1 | 47 | #define SPEAR1310_GPT_APB_VAL 1 |
@@ -65,7 +63,7 @@ | |||
65 | #define SPEAR1310_C3_CLK_MASK 1 | 63 | #define SPEAR1310_C3_CLK_MASK 1 |
66 | #define SPEAR1310_C3_CLK_SHIFT 1 | 64 | #define SPEAR1310_C3_CLK_SHIFT 1 |
67 | 65 | ||
68 | #define SPEAR1310_GMAC_CLK_CFG (VA_MISC_BASE + 0x248) | 66 | #define SPEAR1310_GMAC_CLK_CFG (misc_base + 0x248) |
69 | #define SPEAR1310_GMAC_PHY_IF_SEL_MASK 3 | 67 | #define SPEAR1310_GMAC_PHY_IF_SEL_MASK 3 |
70 | #define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT 4 | 68 | #define SPEAR1310_GMAC_PHY_IF_SEL_SHIFT 4 |
71 | #define SPEAR1310_GMAC_PHY_CLK_MASK 1 | 69 | #define SPEAR1310_GMAC_PHY_CLK_MASK 1 |
@@ -73,7 +71,7 @@ | |||
73 | #define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK 2 | 71 | #define SPEAR1310_GMAC_PHY_INPUT_CLK_MASK 2 |
74 | #define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT 1 | 72 | #define SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT 1 |
75 | 73 | ||
76 | #define SPEAR1310_I2S_CLK_CFG (VA_MISC_BASE + 0x24C) | 74 | #define SPEAR1310_I2S_CLK_CFG (misc_base + 0x24C) |
77 | /* I2S_CLK_CFG register mask */ | 75 | /* I2S_CLK_CFG register mask */ |
78 | #define SPEAR1310_I2S_SCLK_X_MASK 0x1F | 76 | #define SPEAR1310_I2S_SCLK_X_MASK 0x1F |
79 | #define SPEAR1310_I2S_SCLK_X_SHIFT 27 | 77 | #define SPEAR1310_I2S_SCLK_X_SHIFT 27 |
@@ -91,21 +89,21 @@ | |||
91 | #define SPEAR1310_I2S_SRC_CLK_MASK 2 | 89 | #define SPEAR1310_I2S_SRC_CLK_MASK 2 |
92 | #define SPEAR1310_I2S_SRC_CLK_SHIFT 0 | 90 | #define SPEAR1310_I2S_SRC_CLK_SHIFT 0 |
93 | 91 | ||
94 | #define SPEAR1310_C3_CLK_SYNT (VA_MISC_BASE + 0x250) | 92 | #define SPEAR1310_C3_CLK_SYNT (misc_base + 0x250) |
95 | #define SPEAR1310_UART_CLK_SYNT (VA_MISC_BASE + 0x254) | 93 | #define SPEAR1310_UART_CLK_SYNT (misc_base + 0x254) |
96 | #define SPEAR1310_GMAC_CLK_SYNT (VA_MISC_BASE + 0x258) | 94 | #define SPEAR1310_GMAC_CLK_SYNT (misc_base + 0x258) |
97 | #define SPEAR1310_SDHCI_CLK_SYNT (VA_MISC_BASE + 0x25C) | 95 | #define SPEAR1310_SDHCI_CLK_SYNT (misc_base + 0x25C) |
98 | #define SPEAR1310_CFXD_CLK_SYNT (VA_MISC_BASE + 0x260) | 96 | #define SPEAR1310_CFXD_CLK_SYNT (misc_base + 0x260) |
99 | #define SPEAR1310_ADC_CLK_SYNT (VA_MISC_BASE + 0x264) | 97 | #define SPEAR1310_ADC_CLK_SYNT (misc_base + 0x264) |
100 | #define SPEAR1310_AMBA_CLK_SYNT (VA_MISC_BASE + 0x268) | 98 | #define SPEAR1310_AMBA_CLK_SYNT (misc_base + 0x268) |
101 | #define SPEAR1310_CLCD_CLK_SYNT (VA_MISC_BASE + 0x270) | 99 | #define SPEAR1310_CLCD_CLK_SYNT (misc_base + 0x270) |
102 | #define SPEAR1310_RAS_CLK_SYNT0 (VA_MISC_BASE + 0x280) | 100 | #define SPEAR1310_RAS_CLK_SYNT0 (misc_base + 0x280) |
103 | #define SPEAR1310_RAS_CLK_SYNT1 (VA_MISC_BASE + 0x288) | 101 | #define SPEAR1310_RAS_CLK_SYNT1 (misc_base + 0x288) |
104 | #define SPEAR1310_RAS_CLK_SYNT2 (VA_MISC_BASE + 0x290) | 102 | #define SPEAR1310_RAS_CLK_SYNT2 (misc_base + 0x290) |
105 | #define SPEAR1310_RAS_CLK_SYNT3 (VA_MISC_BASE + 0x298) | 103 | #define SPEAR1310_RAS_CLK_SYNT3 (misc_base + 0x298) |
106 | /* Check Fractional synthesizer reg masks */ | 104 | /* Check Fractional synthesizer reg masks */ |
107 | 105 | ||
108 | #define SPEAR1310_PERIP1_CLK_ENB (VA_MISC_BASE + 0x300) | 106 | #define SPEAR1310_PERIP1_CLK_ENB (misc_base + 0x300) |
109 | /* PERIP1_CLK_ENB register masks */ | 107 | /* PERIP1_CLK_ENB register masks */ |
110 | #define SPEAR1310_RTC_CLK_ENB 31 | 108 | #define SPEAR1310_RTC_CLK_ENB 31 |
111 | #define SPEAR1310_ADC_CLK_ENB 30 | 109 | #define SPEAR1310_ADC_CLK_ENB 30 |
@@ -138,7 +136,7 @@ | |||
138 | #define SPEAR1310_SYSROM_CLK_ENB 1 | 136 | #define SPEAR1310_SYSROM_CLK_ENB 1 |
139 | #define SPEAR1310_BUS_CLK_ENB 0 | 137 | #define SPEAR1310_BUS_CLK_ENB 0 |
140 | 138 | ||
141 | #define SPEAR1310_PERIP2_CLK_ENB (VA_MISC_BASE + 0x304) | 139 | #define SPEAR1310_PERIP2_CLK_ENB (misc_base + 0x304) |
142 | /* PERIP2_CLK_ENB register masks */ | 140 | /* PERIP2_CLK_ENB register masks */ |
143 | #define SPEAR1310_THSENS_CLK_ENB 8 | 141 | #define SPEAR1310_THSENS_CLK_ENB 8 |
144 | #define SPEAR1310_I2S_REF_PAD_CLK_ENB 7 | 142 | #define SPEAR1310_I2S_REF_PAD_CLK_ENB 7 |
@@ -150,7 +148,7 @@ | |||
150 | #define SPEAR1310_DDR_CORE_CLK_ENB 1 | 148 | #define SPEAR1310_DDR_CORE_CLK_ENB 1 |
151 | #define SPEAR1310_DDR_CTRL_CLK_ENB 0 | 149 | #define SPEAR1310_DDR_CTRL_CLK_ENB 0 |
152 | 150 | ||
153 | #define SPEAR1310_RAS_CLK_ENB (VA_MISC_BASE + 0x310) | 151 | #define SPEAR1310_RAS_CLK_ENB (misc_base + 0x310) |
154 | /* RAS_CLK_ENB register masks */ | 152 | /* RAS_CLK_ENB register masks */ |
155 | #define SPEAR1310_SYNT3_CLK_ENB 17 | 153 | #define SPEAR1310_SYNT3_CLK_ENB 17 |
156 | #define SPEAR1310_SYNT2_CLK_ENB 16 | 154 | #define SPEAR1310_SYNT2_CLK_ENB 16 |
@@ -172,7 +170,7 @@ | |||
172 | #define SPEAR1310_ACLK_CLK_ENB 0 | 170 | #define SPEAR1310_ACLK_CLK_ENB 0 |
173 | 171 | ||
174 | /* RAS Area Control Register */ | 172 | /* RAS Area Control Register */ |
175 | #define SPEAR1310_RAS_CTRL_REG0 (VA_SPEAR1310_RAS_BASE + 0x000) | 173 | #define SPEAR1310_RAS_CTRL_REG0 (ras_base + 0x000) |
176 | #define SPEAR1310_SSP1_CLK_MASK 3 | 174 | #define SPEAR1310_SSP1_CLK_MASK 3 |
177 | #define SPEAR1310_SSP1_CLK_SHIFT 26 | 175 | #define SPEAR1310_SSP1_CLK_SHIFT 26 |
178 | #define SPEAR1310_TDM_CLK_MASK 1 | 176 | #define SPEAR1310_TDM_CLK_MASK 1 |
@@ -197,12 +195,12 @@ | |||
197 | #define SPEAR1310_PCI_CLK_MASK 1 | 195 | #define SPEAR1310_PCI_CLK_MASK 1 |
198 | #define SPEAR1310_PCI_CLK_SHIFT 0 | 196 | #define SPEAR1310_PCI_CLK_SHIFT 0 |
199 | 197 | ||
200 | #define SPEAR1310_RAS_CTRL_REG1 (VA_SPEAR1310_RAS_BASE + 0x004) | 198 | #define SPEAR1310_RAS_CTRL_REG1 (ras_base + 0x004) |
201 | #define SPEAR1310_PHY_CLK_MASK 0x3 | 199 | #define SPEAR1310_PHY_CLK_MASK 0x3 |
202 | #define SPEAR1310_RMII_PHY_CLK_SHIFT 0 | 200 | #define SPEAR1310_RMII_PHY_CLK_SHIFT 0 |
203 | #define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT 2 | 201 | #define SPEAR1310_SMII_RGMII_PHY_CLK_SHIFT 2 |
204 | 202 | ||
205 | #define SPEAR1310_RAS_SW_CLK_CTRL (VA_SPEAR1310_RAS_BASE + 0x0148) | 203 | #define SPEAR1310_RAS_SW_CLK_CTRL (ras_base + 0x0148) |
206 | #define SPEAR1310_CAN1_CLK_ENB 25 | 204 | #define SPEAR1310_CAN1_CLK_ENB 25 |
207 | #define SPEAR1310_CAN0_CLK_ENB 24 | 205 | #define SPEAR1310_CAN0_CLK_ENB 24 |
208 | #define SPEAR1310_GPT64_CLK_ENB 23 | 206 | #define SPEAR1310_GPT64_CLK_ENB 23 |
@@ -385,7 +383,7 @@ static const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk", | |||
385 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", }; | 383 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", }; |
386 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", }; | 384 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", }; |
387 | 385 | ||
388 | void __init spear1310_clk_init(void) | 386 | void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base) |
389 | { | 387 | { |
390 | struct clk *clk, *clk1; | 388 | struct clk *clk, *clk1; |
391 | 389 | ||
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c index 82abea366b78..9d0b3949db30 100644 --- a/drivers/clk/spear/spear1340_clock.c +++ b/drivers/clk/spear/spear1340_clock.c | |||
@@ -17,18 +17,17 @@ | |||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
19 | #include <linux/spinlock_types.h> | 19 | #include <linux/spinlock_types.h> |
20 | #include <mach/spear.h> | ||
21 | #include "clk.h" | 20 | #include "clk.h" |
22 | 21 | ||
23 | /* Clock Configuration Registers */ | 22 | /* Clock Configuration Registers */ |
24 | #define SPEAR1340_SYS_CLK_CTRL (VA_MISC_BASE + 0x200) | 23 | #define SPEAR1340_SYS_CLK_CTRL (misc_base + 0x200) |
25 | #define SPEAR1340_HCLK_SRC_SEL_SHIFT 27 | 24 | #define SPEAR1340_HCLK_SRC_SEL_SHIFT 27 |
26 | #define SPEAR1340_HCLK_SRC_SEL_MASK 1 | 25 | #define SPEAR1340_HCLK_SRC_SEL_MASK 1 |
27 | #define SPEAR1340_SCLK_SRC_SEL_SHIFT 23 | 26 | #define SPEAR1340_SCLK_SRC_SEL_SHIFT 23 |
28 | #define SPEAR1340_SCLK_SRC_SEL_MASK 3 | 27 | #define SPEAR1340_SCLK_SRC_SEL_MASK 3 |
29 | 28 | ||
30 | /* PLL related registers and bit values */ | 29 | /* PLL related registers and bit values */ |
31 | #define SPEAR1340_PLL_CFG (VA_MISC_BASE + 0x210) | 30 | #define SPEAR1340_PLL_CFG (misc_base + 0x210) |
32 | /* PLL_CFG bit values */ | 31 | /* PLL_CFG bit values */ |
33 | #define SPEAR1340_CLCD_SYNT_CLK_MASK 1 | 32 | #define SPEAR1340_CLCD_SYNT_CLK_MASK 1 |
34 | #define SPEAR1340_CLCD_SYNT_CLK_SHIFT 31 | 33 | #define SPEAR1340_CLCD_SYNT_CLK_SHIFT 31 |
@@ -40,15 +39,15 @@ | |||
40 | #define SPEAR1340_PLL2_CLK_SHIFT 22 | 39 | #define SPEAR1340_PLL2_CLK_SHIFT 22 |
41 | #define SPEAR1340_PLL1_CLK_SHIFT 20 | 40 | #define SPEAR1340_PLL1_CLK_SHIFT 20 |
42 | 41 | ||
43 | #define SPEAR1340_PLL1_CTR (VA_MISC_BASE + 0x214) | 42 | #define SPEAR1340_PLL1_CTR (misc_base + 0x214) |
44 | #define SPEAR1340_PLL1_FRQ (VA_MISC_BASE + 0x218) | 43 | #define SPEAR1340_PLL1_FRQ (misc_base + 0x218) |
45 | #define SPEAR1340_PLL2_CTR (VA_MISC_BASE + 0x220) | 44 | #define SPEAR1340_PLL2_CTR (misc_base + 0x220) |
46 | #define SPEAR1340_PLL2_FRQ (VA_MISC_BASE + 0x224) | 45 | #define SPEAR1340_PLL2_FRQ (misc_base + 0x224) |
47 | #define SPEAR1340_PLL3_CTR (VA_MISC_BASE + 0x22C) | 46 | #define SPEAR1340_PLL3_CTR (misc_base + 0x22C) |
48 | #define SPEAR1340_PLL3_FRQ (VA_MISC_BASE + 0x230) | 47 | #define SPEAR1340_PLL3_FRQ (misc_base + 0x230) |
49 | #define SPEAR1340_PLL4_CTR (VA_MISC_BASE + 0x238) | 48 | #define SPEAR1340_PLL4_CTR (misc_base + 0x238) |
50 | #define SPEAR1340_PLL4_FRQ (VA_MISC_BASE + 0x23C) | 49 | #define SPEAR1340_PLL4_FRQ (misc_base + 0x23C) |
51 | #define SPEAR1340_PERIP_CLK_CFG (VA_MISC_BASE + 0x244) | 50 | #define SPEAR1340_PERIP_CLK_CFG (misc_base + 0x244) |
52 | /* PERIP_CLK_CFG bit values */ | 51 | /* PERIP_CLK_CFG bit values */ |
53 | #define SPEAR1340_SPDIF_CLK_MASK 1 | 52 | #define SPEAR1340_SPDIF_CLK_MASK 1 |
54 | #define SPEAR1340_SPDIF_OUT_CLK_SHIFT 15 | 53 | #define SPEAR1340_SPDIF_OUT_CLK_SHIFT 15 |
@@ -66,13 +65,13 @@ | |||
66 | #define SPEAR1340_C3_CLK_MASK 1 | 65 | #define SPEAR1340_C3_CLK_MASK 1 |
67 | #define SPEAR1340_C3_CLK_SHIFT 1 | 66 | #define SPEAR1340_C3_CLK_SHIFT 1 |
68 | 67 | ||
69 | #define SPEAR1340_GMAC_CLK_CFG (VA_MISC_BASE + 0x248) | 68 | #define SPEAR1340_GMAC_CLK_CFG (misc_base + 0x248) |
70 | #define SPEAR1340_GMAC_PHY_CLK_MASK 1 | 69 | #define SPEAR1340_GMAC_PHY_CLK_MASK 1 |
71 | #define SPEAR1340_GMAC_PHY_CLK_SHIFT 2 | 70 | #define SPEAR1340_GMAC_PHY_CLK_SHIFT 2 |
72 | #define SPEAR1340_GMAC_PHY_INPUT_CLK_MASK 2 | 71 | #define SPEAR1340_GMAC_PHY_INPUT_CLK_MASK 2 |
73 | #define SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT 0 | 72 | #define SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT 0 |
74 | 73 | ||
75 | #define SPEAR1340_I2S_CLK_CFG (VA_MISC_BASE + 0x24C) | 74 | #define SPEAR1340_I2S_CLK_CFG (misc_base + 0x24C) |
76 | /* I2S_CLK_CFG register mask */ | 75 | /* I2S_CLK_CFG register mask */ |
77 | #define SPEAR1340_I2S_SCLK_X_MASK 0x1F | 76 | #define SPEAR1340_I2S_SCLK_X_MASK 0x1F |
78 | #define SPEAR1340_I2S_SCLK_X_SHIFT 27 | 77 | #define SPEAR1340_I2S_SCLK_X_SHIFT 27 |
@@ -90,21 +89,21 @@ | |||
90 | #define SPEAR1340_I2S_SRC_CLK_MASK 2 | 89 | #define SPEAR1340_I2S_SRC_CLK_MASK 2 |
91 | #define SPEAR1340_I2S_SRC_CLK_SHIFT 0 | 90 | #define SPEAR1340_I2S_SRC_CLK_SHIFT 0 |
92 | 91 | ||
93 | #define SPEAR1340_C3_CLK_SYNT (VA_MISC_BASE + 0x250) | 92 | #define SPEAR1340_C3_CLK_SYNT (misc_base + 0x250) |
94 | #define SPEAR1340_UART0_CLK_SYNT (VA_MISC_BASE + 0x254) | 93 | #define SPEAR1340_UART0_CLK_SYNT (misc_base + 0x254) |
95 | #define SPEAR1340_UART1_CLK_SYNT (VA_MISC_BASE + 0x258) | 94 | #define SPEAR1340_UART1_CLK_SYNT (misc_base + 0x258) |
96 | #define SPEAR1340_GMAC_CLK_SYNT (VA_MISC_BASE + 0x25C) | 95 | #define SPEAR1340_GMAC_CLK_SYNT (misc_base + 0x25C) |
97 | #define SPEAR1340_SDHCI_CLK_SYNT (VA_MISC_BASE + 0x260) | 96 | #define SPEAR1340_SDHCI_CLK_SYNT (misc_base + 0x260) |
98 | #define SPEAR1340_CFXD_CLK_SYNT (VA_MISC_BASE + 0x264) | 97 | #define SPEAR1340_CFXD_CLK_SYNT (misc_base + 0x264) |
99 | #define SPEAR1340_ADC_CLK_SYNT (VA_MISC_BASE + 0x270) | 98 | #define SPEAR1340_ADC_CLK_SYNT (misc_base + 0x270) |
100 | #define SPEAR1340_AMBA_CLK_SYNT (VA_MISC_BASE + 0x274) | 99 | #define SPEAR1340_AMBA_CLK_SYNT (misc_base + 0x274) |
101 | #define SPEAR1340_CLCD_CLK_SYNT (VA_MISC_BASE + 0x27C) | 100 | #define SPEAR1340_CLCD_CLK_SYNT (misc_base + 0x27C) |
102 | #define SPEAR1340_SYS_CLK_SYNT (VA_MISC_BASE + 0x284) | 101 | #define SPEAR1340_SYS_CLK_SYNT (misc_base + 0x284) |
103 | #define SPEAR1340_GEN_CLK_SYNT0 (VA_MISC_BASE + 0x28C) | 102 | #define SPEAR1340_GEN_CLK_SYNT0 (misc_base + 0x28C) |
104 | #define SPEAR1340_GEN_CLK_SYNT1 (VA_MISC_BASE + 0x294) | 103 | #define SPEAR1340_GEN_CLK_SYNT1 (misc_base + 0x294) |
105 | #define SPEAR1340_GEN_CLK_SYNT2 (VA_MISC_BASE + 0x29C) | 104 | #define SPEAR1340_GEN_CLK_SYNT2 (misc_base + 0x29C) |
106 | #define SPEAR1340_GEN_CLK_SYNT3 (VA_MISC_BASE + 0x304) | 105 | #define SPEAR1340_GEN_CLK_SYNT3 (misc_base + 0x304) |
107 | #define SPEAR1340_PERIP1_CLK_ENB (VA_MISC_BASE + 0x30C) | 106 | #define SPEAR1340_PERIP1_CLK_ENB (misc_base + 0x30C) |
108 | #define SPEAR1340_RTC_CLK_ENB 31 | 107 | #define SPEAR1340_RTC_CLK_ENB 31 |
109 | #define SPEAR1340_ADC_CLK_ENB 30 | 108 | #define SPEAR1340_ADC_CLK_ENB 30 |
110 | #define SPEAR1340_C3_CLK_ENB 29 | 109 | #define SPEAR1340_C3_CLK_ENB 29 |
@@ -133,7 +132,7 @@ | |||
133 | #define SPEAR1340_SYSROM_CLK_ENB 1 | 132 | #define SPEAR1340_SYSROM_CLK_ENB 1 |
134 | #define SPEAR1340_BUS_CLK_ENB 0 | 133 | #define SPEAR1340_BUS_CLK_ENB 0 |
135 | 134 | ||
136 | #define SPEAR1340_PERIP2_CLK_ENB (VA_MISC_BASE + 0x310) | 135 | #define SPEAR1340_PERIP2_CLK_ENB (misc_base + 0x310) |
137 | #define SPEAR1340_THSENS_CLK_ENB 8 | 136 | #define SPEAR1340_THSENS_CLK_ENB 8 |
138 | #define SPEAR1340_I2S_REF_PAD_CLK_ENB 7 | 137 | #define SPEAR1340_I2S_REF_PAD_CLK_ENB 7 |
139 | #define SPEAR1340_ACP_CLK_ENB 6 | 138 | #define SPEAR1340_ACP_CLK_ENB 6 |
@@ -144,7 +143,7 @@ | |||
144 | #define SPEAR1340_DDR_CORE_CLK_ENB 1 | 143 | #define SPEAR1340_DDR_CORE_CLK_ENB 1 |
145 | #define SPEAR1340_DDR_CTRL_CLK_ENB 0 | 144 | #define SPEAR1340_DDR_CTRL_CLK_ENB 0 |
146 | 145 | ||
147 | #define SPEAR1340_PERIP3_CLK_ENB (VA_MISC_BASE + 0x314) | 146 | #define SPEAR1340_PERIP3_CLK_ENB (misc_base + 0x314) |
148 | #define SPEAR1340_PLGPIO_CLK_ENB 18 | 147 | #define SPEAR1340_PLGPIO_CLK_ENB 18 |
149 | #define SPEAR1340_VIDEO_DEC_CLK_ENB 16 | 148 | #define SPEAR1340_VIDEO_DEC_CLK_ENB 16 |
150 | #define SPEAR1340_VIDEO_ENC_CLK_ENB 15 | 149 | #define SPEAR1340_VIDEO_ENC_CLK_ENB 15 |
@@ -441,7 +440,7 @@ static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", | |||
441 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco2div2_clk", | 440 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco2div2_clk", |
442 | "pll2_clk", }; | 441 | "pll2_clk", }; |
443 | 442 | ||
444 | void __init spear1340_clk_init(void) | 443 | void __init spear1340_clk_init(void __iomem *misc_base) |
445 | { | 444 | { |
446 | struct clk *clk, *clk1; | 445 | struct clk *clk, *clk1; |
447 | 446 | ||
@@ -960,47 +959,47 @@ void __init spear1340_clk_init(void) | |||
960 | SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock); | 959 | SPEAR1340_SPDIF_IN_CLK_ENB, 0, &_lock); |
961 | clk_register_clkdev(clk, NULL, "d0100000.spdif-in"); | 960 | clk_register_clkdev(clk, NULL, "d0100000.spdif-in"); |
962 | 961 | ||
963 | clk = clk_register_gate(NULL, "acp_clk", "acp_mclk", 0, | 962 | clk = clk_register_gate(NULL, "acp_clk", "ahb_clk", 0, |
964 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, | 963 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, |
965 | &_lock); | 964 | &_lock); |
966 | clk_register_clkdev(clk, NULL, "acp_clk"); | 965 | clk_register_clkdev(clk, NULL, "acp_clk"); |
967 | 966 | ||
968 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mclk", 0, | 967 | clk = clk_register_gate(NULL, "plgpio_clk", "ahb_clk", 0, |
969 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, | 968 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, |
970 | &_lock); | 969 | &_lock); |
971 | clk_register_clkdev(clk, NULL, "e2800000.gpio"); | 970 | clk_register_clkdev(clk, NULL, "e2800000.gpio"); |
972 | 971 | ||
973 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mclk", 0, | 972 | clk = clk_register_gate(NULL, "video_dec_clk", "ahb_clk", 0, |
974 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, | 973 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, |
975 | 0, &_lock); | 974 | 0, &_lock); |
976 | clk_register_clkdev(clk, NULL, "video_dec"); | 975 | clk_register_clkdev(clk, NULL, "video_dec"); |
977 | 976 | ||
978 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mclk", 0, | 977 | clk = clk_register_gate(NULL, "video_enc_clk", "ahb_clk", 0, |
979 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, | 978 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, |
980 | 0, &_lock); | 979 | 0, &_lock); |
981 | clk_register_clkdev(clk, NULL, "video_enc"); | 980 | clk_register_clkdev(clk, NULL, "video_enc"); |
982 | 981 | ||
983 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mclk", 0, | 982 | clk = clk_register_gate(NULL, "video_in_clk", "ahb_clk", 0, |
984 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, | 983 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, |
985 | &_lock); | 984 | &_lock); |
986 | clk_register_clkdev(clk, NULL, "spear_vip"); | 985 | clk_register_clkdev(clk, NULL, "spear_vip"); |
987 | 986 | ||
988 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mclk", 0, | 987 | clk = clk_register_gate(NULL, "cam0_clk", "ahb_clk", 0, |
989 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, | 988 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, |
990 | &_lock); | 989 | &_lock); |
991 | clk_register_clkdev(clk, NULL, "d0200000.cam0"); | 990 | clk_register_clkdev(clk, NULL, "d0200000.cam0"); |
992 | 991 | ||
993 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mclk", 0, | 992 | clk = clk_register_gate(NULL, "cam1_clk", "ahb_clk", 0, |
994 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, | 993 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, |
995 | &_lock); | 994 | &_lock); |
996 | clk_register_clkdev(clk, NULL, "d0300000.cam1"); | 995 | clk_register_clkdev(clk, NULL, "d0300000.cam1"); |
997 | 996 | ||
998 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mclk", 0, | 997 | clk = clk_register_gate(NULL, "cam2_clk", "ahb_clk", 0, |
999 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, | 998 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, |
1000 | &_lock); | 999 | &_lock); |
1001 | clk_register_clkdev(clk, NULL, "d0400000.cam2"); | 1000 | clk_register_clkdev(clk, NULL, "d0400000.cam2"); |
1002 | 1001 | ||
1003 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mclk", 0, | 1002 | clk = clk_register_gate(NULL, "cam3_clk", "ahb_clk", 0, |
1004 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, | 1003 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, |
1005 | &_lock); | 1004 | &_lock); |
1006 | clk_register_clkdev(clk, NULL, "d0500000.cam3"); | 1005 | clk_register_clkdev(clk, NULL, "d0500000.cam3"); |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index 33d3ac588da7..f9ec43fd1320 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -15,21 +15,20 @@ | |||
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/of_platform.h> | 16 | #include <linux/of_platform.h> |
17 | #include <linux/spinlock_types.h> | 17 | #include <linux/spinlock_types.h> |
18 | #include <mach/misc_regs.h> | ||
19 | #include "clk.h" | 18 | #include "clk.h" |
20 | 19 | ||
21 | static DEFINE_SPINLOCK(_lock); | 20 | static DEFINE_SPINLOCK(_lock); |
22 | 21 | ||
23 | #define PLL1_CTR (MISC_BASE + 0x008) | 22 | #define PLL1_CTR (misc_base + 0x008) |
24 | #define PLL1_FRQ (MISC_BASE + 0x00C) | 23 | #define PLL1_FRQ (misc_base + 0x00C) |
25 | #define PLL2_CTR (MISC_BASE + 0x014) | 24 | #define PLL2_CTR (misc_base + 0x014) |
26 | #define PLL2_FRQ (MISC_BASE + 0x018) | 25 | #define PLL2_FRQ (misc_base + 0x018) |
27 | #define PLL_CLK_CFG (MISC_BASE + 0x020) | 26 | #define PLL_CLK_CFG (misc_base + 0x020) |
28 | /* PLL_CLK_CFG register masks */ | 27 | /* PLL_CLK_CFG register masks */ |
29 | #define MCTR_CLK_SHIFT 28 | 28 | #define MCTR_CLK_SHIFT 28 |
30 | #define MCTR_CLK_MASK 3 | 29 | #define MCTR_CLK_MASK 3 |
31 | 30 | ||
32 | #define CORE_CLK_CFG (MISC_BASE + 0x024) | 31 | #define CORE_CLK_CFG (misc_base + 0x024) |
33 | /* CORE CLK CFG register masks */ | 32 | /* CORE CLK CFG register masks */ |
34 | #define GEN_SYNTH2_3_CLK_SHIFT 18 | 33 | #define GEN_SYNTH2_3_CLK_SHIFT 18 |
35 | #define GEN_SYNTH2_3_CLK_MASK 1 | 34 | #define GEN_SYNTH2_3_CLK_MASK 1 |
@@ -39,7 +38,7 @@ static DEFINE_SPINLOCK(_lock); | |||
39 | #define PCLK_RATIO_SHIFT 8 | 38 | #define PCLK_RATIO_SHIFT 8 |
40 | #define PCLK_RATIO_MASK 2 | 39 | #define PCLK_RATIO_MASK 2 |
41 | 40 | ||
42 | #define PERIP_CLK_CFG (MISC_BASE + 0x028) | 41 | #define PERIP_CLK_CFG (misc_base + 0x028) |
43 | /* PERIP_CLK_CFG register masks */ | 42 | /* PERIP_CLK_CFG register masks */ |
44 | #define UART_CLK_SHIFT 4 | 43 | #define UART_CLK_SHIFT 4 |
45 | #define UART_CLK_MASK 1 | 44 | #define UART_CLK_MASK 1 |
@@ -50,7 +49,7 @@ static DEFINE_SPINLOCK(_lock); | |||
50 | #define GPT2_CLK_SHIFT 12 | 49 | #define GPT2_CLK_SHIFT 12 |
51 | #define GPT_CLK_MASK 1 | 50 | #define GPT_CLK_MASK 1 |
52 | 51 | ||
53 | #define PERIP1_CLK_ENB (MISC_BASE + 0x02C) | 52 | #define PERIP1_CLK_ENB (misc_base + 0x02C) |
54 | /* PERIP1_CLK_ENB register masks */ | 53 | /* PERIP1_CLK_ENB register masks */ |
55 | #define UART_CLK_ENB 3 | 54 | #define UART_CLK_ENB 3 |
56 | #define SSP_CLK_ENB 5 | 55 | #define SSP_CLK_ENB 5 |
@@ -69,7 +68,7 @@ static DEFINE_SPINLOCK(_lock); | |||
69 | #define USBH_CLK_ENB 25 | 68 | #define USBH_CLK_ENB 25 |
70 | #define C3_CLK_ENB 31 | 69 | #define C3_CLK_ENB 31 |
71 | 70 | ||
72 | #define RAS_CLK_ENB (MISC_BASE + 0x034) | 71 | #define RAS_CLK_ENB (misc_base + 0x034) |
73 | #define RAS_AHB_CLK_ENB 0 | 72 | #define RAS_AHB_CLK_ENB 0 |
74 | #define RAS_PLL1_CLK_ENB 1 | 73 | #define RAS_PLL1_CLK_ENB 1 |
75 | #define RAS_APB_CLK_ENB 2 | 74 | #define RAS_APB_CLK_ENB 2 |
@@ -82,20 +81,20 @@ static DEFINE_SPINLOCK(_lock); | |||
82 | #define RAS_SYNT2_CLK_ENB 10 | 81 | #define RAS_SYNT2_CLK_ENB 10 |
83 | #define RAS_SYNT3_CLK_ENB 11 | 82 | #define RAS_SYNT3_CLK_ENB 11 |
84 | 83 | ||
85 | #define PRSC0_CLK_CFG (MISC_BASE + 0x044) | 84 | #define PRSC0_CLK_CFG (misc_base + 0x044) |
86 | #define PRSC1_CLK_CFG (MISC_BASE + 0x048) | 85 | #define PRSC1_CLK_CFG (misc_base + 0x048) |
87 | #define PRSC2_CLK_CFG (MISC_BASE + 0x04C) | 86 | #define PRSC2_CLK_CFG (misc_base + 0x04C) |
88 | #define AMEM_CLK_CFG (MISC_BASE + 0x050) | 87 | #define AMEM_CLK_CFG (misc_base + 0x050) |
89 | #define AMEM_CLK_ENB 0 | 88 | #define AMEM_CLK_ENB 0 |
90 | 89 | ||
91 | #define CLCD_CLK_SYNT (MISC_BASE + 0x05C) | 90 | #define CLCD_CLK_SYNT (misc_base + 0x05C) |
92 | #define FIRDA_CLK_SYNT (MISC_BASE + 0x060) | 91 | #define FIRDA_CLK_SYNT (misc_base + 0x060) |
93 | #define UART_CLK_SYNT (MISC_BASE + 0x064) | 92 | #define UART_CLK_SYNT (misc_base + 0x064) |
94 | #define GMAC_CLK_SYNT (MISC_BASE + 0x068) | 93 | #define GMAC_CLK_SYNT (misc_base + 0x068) |
95 | #define GEN0_CLK_SYNT (MISC_BASE + 0x06C) | 94 | #define GEN0_CLK_SYNT (misc_base + 0x06C) |
96 | #define GEN1_CLK_SYNT (MISC_BASE + 0x070) | 95 | #define GEN1_CLK_SYNT (misc_base + 0x070) |
97 | #define GEN2_CLK_SYNT (MISC_BASE + 0x074) | 96 | #define GEN2_CLK_SYNT (misc_base + 0x074) |
98 | #define GEN3_CLK_SYNT (MISC_BASE + 0x078) | 97 | #define GEN3_CLK_SYNT (misc_base + 0x078) |
99 | 98 | ||
100 | /* pll rate configuration table, in ascending order of rates */ | 99 | /* pll rate configuration table, in ascending order of rates */ |
101 | static struct pll_rate_tbl pll_rtbl[] = { | 100 | static struct pll_rate_tbl pll_rtbl[] = { |
@@ -211,6 +210,17 @@ static inline void spear310_clk_init(void) { } | |||
211 | 210 | ||
212 | /* array of all spear 320 clock lookups */ | 211 | /* array of all spear 320 clock lookups */ |
213 | #ifdef CONFIG_MACH_SPEAR320 | 212 | #ifdef CONFIG_MACH_SPEAR320 |
213 | |||
214 | #define SPEAR320_CONTROL_REG (soc_config_base + 0x0000) | ||
215 | #define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018) | ||
216 | |||
217 | #define SPEAR320_UARTX_PCLK_MASK 0x1 | ||
218 | #define SPEAR320_UART2_PCLK_SHIFT 8 | ||
219 | #define SPEAR320_UART3_PCLK_SHIFT 9 | ||
220 | #define SPEAR320_UART4_PCLK_SHIFT 10 | ||
221 | #define SPEAR320_UART5_PCLK_SHIFT 11 | ||
222 | #define SPEAR320_UART6_PCLK_SHIFT 12 | ||
223 | #define SPEAR320_RS485_PCLK_SHIFT 13 | ||
214 | #define SMII_PCLK_SHIFT 18 | 224 | #define SMII_PCLK_SHIFT 18 |
215 | #define SMII_PCLK_MASK 2 | 225 | #define SMII_PCLK_MASK 2 |
216 | #define SMII_PCLK_VAL_PAD 0x0 | 226 | #define SMII_PCLK_VAL_PAD 0x0 |
@@ -235,7 +245,7 @@ static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", | |||
235 | "ras_syn0_gclk", }; | 245 | "ras_syn0_gclk", }; |
236 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; | 246 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; |
237 | 247 | ||
238 | static void __init spear320_clk_init(void) | 248 | static void __init spear320_clk_init(void __iomem *soc_config_base) |
239 | { | 249 | { |
240 | struct clk *clk; | 250 | struct clk *clk; |
241 | 251 | ||
@@ -362,7 +372,7 @@ static void __init spear320_clk_init(void) | |||
362 | static inline void spear320_clk_init(void) { } | 372 | static inline void spear320_clk_init(void) { } |
363 | #endif | 373 | #endif |
364 | 374 | ||
365 | void __init spear3xx_clk_init(void) | 375 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) |
366 | { | 376 | { |
367 | struct clk *clk, *clk1; | 377 | struct clk *clk, *clk1; |
368 | 378 | ||
@@ -634,5 +644,5 @@ void __init spear3xx_clk_init(void) | |||
634 | else if (of_machine_is_compatible("st,spear310")) | 644 | else if (of_machine_is_compatible("st,spear310")) |
635 | spear310_clk_init(); | 645 | spear310_clk_init(); |
636 | else if (of_machine_is_compatible("st,spear320")) | 646 | else if (of_machine_is_compatible("st,spear320")) |
637 | spear320_clk_init(); | 647 | spear320_clk_init(soc_config_base); |
638 | } | 648 | } |
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c index e862a333ad30..9406f2426d64 100644 --- a/drivers/clk/spear/spear6xx_clock.c +++ b/drivers/clk/spear/spear6xx_clock.c | |||
@@ -13,28 +13,27 @@ | |||
13 | #include <linux/clkdev.h> | 13 | #include <linux/clkdev.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/spinlock_types.h> | 15 | #include <linux/spinlock_types.h> |
16 | #include <mach/misc_regs.h> | ||
17 | #include "clk.h" | 16 | #include "clk.h" |
18 | 17 | ||
19 | static DEFINE_SPINLOCK(_lock); | 18 | static DEFINE_SPINLOCK(_lock); |
20 | 19 | ||
21 | #define PLL1_CTR (MISC_BASE + 0x008) | 20 | #define PLL1_CTR (misc_base + 0x008) |
22 | #define PLL1_FRQ (MISC_BASE + 0x00C) | 21 | #define PLL1_FRQ (misc_base + 0x00C) |
23 | #define PLL2_CTR (MISC_BASE + 0x014) | 22 | #define PLL2_CTR (misc_base + 0x014) |
24 | #define PLL2_FRQ (MISC_BASE + 0x018) | 23 | #define PLL2_FRQ (misc_base + 0x018) |
25 | #define PLL_CLK_CFG (MISC_BASE + 0x020) | 24 | #define PLL_CLK_CFG (misc_base + 0x020) |
26 | /* PLL_CLK_CFG register masks */ | 25 | /* PLL_CLK_CFG register masks */ |
27 | #define MCTR_CLK_SHIFT 28 | 26 | #define MCTR_CLK_SHIFT 28 |
28 | #define MCTR_CLK_MASK 3 | 27 | #define MCTR_CLK_MASK 3 |
29 | 28 | ||
30 | #define CORE_CLK_CFG (MISC_BASE + 0x024) | 29 | #define CORE_CLK_CFG (misc_base + 0x024) |
31 | /* CORE CLK CFG register masks */ | 30 | /* CORE CLK CFG register masks */ |
32 | #define HCLK_RATIO_SHIFT 10 | 31 | #define HCLK_RATIO_SHIFT 10 |
33 | #define HCLK_RATIO_MASK 2 | 32 | #define HCLK_RATIO_MASK 2 |
34 | #define PCLK_RATIO_SHIFT 8 | 33 | #define PCLK_RATIO_SHIFT 8 |
35 | #define PCLK_RATIO_MASK 2 | 34 | #define PCLK_RATIO_MASK 2 |
36 | 35 | ||
37 | #define PERIP_CLK_CFG (MISC_BASE + 0x028) | 36 | #define PERIP_CLK_CFG (misc_base + 0x028) |
38 | /* PERIP_CLK_CFG register masks */ | 37 | /* PERIP_CLK_CFG register masks */ |
39 | #define CLCD_CLK_SHIFT 2 | 38 | #define CLCD_CLK_SHIFT 2 |
40 | #define CLCD_CLK_MASK 2 | 39 | #define CLCD_CLK_MASK 2 |
@@ -48,7 +47,7 @@ static DEFINE_SPINLOCK(_lock); | |||
48 | #define GPT3_CLK_SHIFT 12 | 47 | #define GPT3_CLK_SHIFT 12 |
49 | #define GPT_CLK_MASK 1 | 48 | #define GPT_CLK_MASK 1 |
50 | 49 | ||
51 | #define PERIP1_CLK_ENB (MISC_BASE + 0x02C) | 50 | #define PERIP1_CLK_ENB (misc_base + 0x02C) |
52 | /* PERIP1_CLK_ENB register masks */ | 51 | /* PERIP1_CLK_ENB register masks */ |
53 | #define UART0_CLK_ENB 3 | 52 | #define UART0_CLK_ENB 3 |
54 | #define UART1_CLK_ENB 4 | 53 | #define UART1_CLK_ENB 4 |
@@ -74,13 +73,13 @@ static DEFINE_SPINLOCK(_lock); | |||
74 | #define USBH0_CLK_ENB 25 | 73 | #define USBH0_CLK_ENB 25 |
75 | #define USBH1_CLK_ENB 26 | 74 | #define USBH1_CLK_ENB 26 |
76 | 75 | ||
77 | #define PRSC0_CLK_CFG (MISC_BASE + 0x044) | 76 | #define PRSC0_CLK_CFG (misc_base + 0x044) |
78 | #define PRSC1_CLK_CFG (MISC_BASE + 0x048) | 77 | #define PRSC1_CLK_CFG (misc_base + 0x048) |
79 | #define PRSC2_CLK_CFG (MISC_BASE + 0x04C) | 78 | #define PRSC2_CLK_CFG (misc_base + 0x04C) |
80 | 79 | ||
81 | #define CLCD_CLK_SYNT (MISC_BASE + 0x05C) | 80 | #define CLCD_CLK_SYNT (misc_base + 0x05C) |
82 | #define FIRDA_CLK_SYNT (MISC_BASE + 0x060) | 81 | #define FIRDA_CLK_SYNT (misc_base + 0x060) |
83 | #define UART_CLK_SYNT (MISC_BASE + 0x064) | 82 | #define UART_CLK_SYNT (misc_base + 0x064) |
84 | 83 | ||
85 | /* vco rate configuration table, in ascending order of rates */ | 84 | /* vco rate configuration table, in ascending order of rates */ |
86 | static struct pll_rate_tbl pll_rtbl[] = { | 85 | static struct pll_rate_tbl pll_rtbl[] = { |
@@ -115,7 +114,7 @@ static struct gpt_rate_tbl gpt_rtbl[] = { | |||
115 | {.mscale = 1, .nscale = 0}, /* 83 MHz */ | 114 | {.mscale = 1, .nscale = 0}, /* 83 MHz */ |
116 | }; | 115 | }; |
117 | 116 | ||
118 | void __init spear6xx_clk_init(void) | 117 | void __init spear6xx_clk_init(void __iomem *misc_base) |
119 | { | 118 | { |
120 | struct clk *clk, *clk1; | 119 | struct clk *clk, *clk1; |
121 | 120 | ||
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 1e2de7305362..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 | }; |
@@ -703,7 +710,7 @@ static void tegra20_pll_init(void) | |||
703 | clks[pll_a_out0] = clk; | 710 | clks[pll_a_out0] = clk; |
704 | 711 | ||
705 | /* PLLE */ | 712 | /* PLLE */ |
706 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, NULL, | 713 | clk = tegra_clk_register_plle("pll_e", "pll_ref", clk_base, pmc_base, |
707 | 0, 100000000, &pll_e_params, | 714 | 0, 100000000, &pll_e_params, |
708 | 0, pll_e_freq_table, NULL); | 715 | 0, pll_e_freq_table, NULL); |
709 | clk_register_clkdev(clk, "pll_e", NULL); | 716 | clk_register_clkdev(clk, "pll_e", NULL); |
@@ -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 3167fda9bbb3..29ba35e6a143 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -65,8 +65,14 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK | |||
65 | 65 | ||
66 | config ARM_ARCH_TIMER | 66 | config ARM_ARCH_TIMER |
67 | bool | 67 | bool |
68 | select CLKSRC_OF if OF | ||
68 | 69 | ||
69 | config CLKSRC_METAG_GENERIC | 70 | config CLKSRC_METAG_GENERIC |
70 | def_bool y if METAG | 71 | def_bool y if METAG |
71 | help | 72 | help |
72 | 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 e74c8ce26bf0..cd1f09cbd61a 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
@@ -19,7 +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 | 22 | obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o |
23 | obj-$(CONFIG_CLKSRC_EXYNOS_MCT) += exynos_mct.o | ||
23 | 24 | ||
24 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o | 25 | obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o |
25 | 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/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/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 2e4d8a666c36..ae877b021b54 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c | |||
@@ -172,7 +172,7 @@ static void __init tegra20_init_timer(struct device_node *np) | |||
172 | BUG(); | 172 | BUG(); |
173 | } | 173 | } |
174 | 174 | ||
175 | clk = clk_get_sys("timer", NULL); | 175 | clk = of_clk_get(np, 0); |
176 | if (IS_ERR(clk)) { | 176 | if (IS_ERR(clk)) { |
177 | 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"); |
178 | rate = 12000000; | 178 | rate = 12000000; |
@@ -235,7 +235,7 @@ static void __init tegra20_init_rtc(struct device_node *np) | |||
235 | * rtc registers are used by read_persistent_clock, keep the rtc clock | 235 | * rtc registers are used by read_persistent_clock, keep the rtc clock |
236 | * enabled | 236 | * enabled |
237 | */ | 237 | */ |
238 | clk = clk_get_sys("rtc-tegra", NULL); | 238 | clk = of_clk_get(np, 0); |
239 | if (IS_ERR(clk)) | 239 | if (IS_ERR(clk)) |
240 | pr_warn("Unable to get rtc-tegra clock\n"); | 240 | pr_warn("Unable to get rtc-tegra clock\n"); |
241 | else | 241 | else |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 4e5b7fb8927c..37d23a0f8c56 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -178,10 +178,16 @@ static struct cpufreq_driver cpu0_cpufreq_driver = { | |||
178 | 178 | ||
179 | static int cpu0_cpufreq_probe(struct platform_device *pdev) | 179 | static int cpu0_cpufreq_probe(struct platform_device *pdev) |
180 | { | 180 | { |
181 | struct device_node *np; | 181 | struct device_node *np, *parent; |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | for_each_child_of_node(of_find_node_by_path("/cpus"), np) { | 184 | parent = of_find_node_by_path("/cpus"); |
185 | if (!parent) { | ||
186 | pr_err("failed to find OF /cpus\n"); | ||
187 | return -ENOENT; | ||
188 | } | ||
189 | |||
190 | for_each_child_of_node(parent, np) { | ||
185 | if (of_get_property(np, "operating-points", NULL)) | 191 | if (of_get_property(np, "operating-points", NULL)) |
186 | break; | 192 | break; |
187 | } | 193 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 46bde01eee62..cc4bd2f6838a 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -14,8 +14,8 @@ | |||
14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef _CPUFREQ_GOVERNER_H | 17 | #ifndef _CPUFREQ_GOVERNOR_H |
18 | #define _CPUFREQ_GOVERNER_H | 18 | #define _CPUFREQ_GOVERNOR_H |
19 | 19 | ||
20 | #include <linux/cpufreq.h> | 20 | #include <linux/cpufreq.h> |
21 | #include <linux/kobject.h> | 21 | #include <linux/kobject.h> |
@@ -175,4 +175,4 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs, | |||
175 | unsigned int sampling_rate); | 175 | unsigned int sampling_rate); |
176 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, | 176 | int cpufreq_governor_dbs(struct dbs_data *dbs_data, |
177 | struct cpufreq_policy *policy, unsigned int event); | 177 | struct cpufreq_policy *policy, unsigned int event); |
178 | #endif /* _CPUFREQ_GOVERNER_H */ | 178 | #endif /* _CPUFREQ_GOVERNOR_H */ |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 80b69971cf28..aeaea32bcfda 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA | |||
83 | 83 | ||
84 | config DW_DMAC | 84 | config DW_DMAC |
85 | tristate "Synopsys DesignWare AHB DMA support" | 85 | tristate "Synopsys DesignWare AHB DMA support" |
86 | depends on GENERIC_HARDIRQS | ||
86 | select DMA_ENGINE | 87 | select DMA_ENGINE |
87 | default y if CPU_AT32AP7000 | 88 | default y if CPU_AT32AP7000 |
88 | help | 89 | help |
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c index cdae207028a7..6c3fca97d346 100644 --- a/drivers/eisa/pci_eisa.c +++ b/drivers/eisa/pci_eisa.c | |||
@@ -19,10 +19,10 @@ | |||
19 | /* There is only *one* pci_eisa device per machine, right ? */ | 19 | /* There is only *one* pci_eisa device per machine, right ? */ |
20 | static struct eisa_root_device pci_eisa_root; | 20 | static struct eisa_root_device pci_eisa_root; |
21 | 21 | ||
22 | static int __init pci_eisa_init(struct pci_dev *pdev, | 22 | static int __init pci_eisa_init(struct pci_dev *pdev) |
23 | const struct pci_device_id *ent) | ||
24 | { | 23 | { |
25 | int rc; | 24 | int rc, i; |
25 | struct resource *res, *bus_res = NULL; | ||
26 | 26 | ||
27 | if ((rc = pci_enable_device (pdev))) { | 27 | if ((rc = pci_enable_device (pdev))) { |
28 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", | 28 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", |
@@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev, | |||
30 | return rc; | 30 | return rc; |
31 | } | 31 | } |
32 | 32 | ||
33 | /* | ||
34 | * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI | ||
35 | * device, so the resources available on EISA are the same as those | ||
36 | * available on the 82375 bus. This works the same as a PCI-PCI | ||
37 | * bridge in subtractive-decode mode (see pci_read_bridge_bases()). | ||
38 | * We assume other PCI-EISA bridges are similar. | ||
39 | * | ||
40 | * eisa_root_register() can only deal with a single io port resource, | ||
41 | * so we use the first valid io port resource. | ||
42 | */ | ||
43 | pci_bus_for_each_resource(pdev->bus, res, i) | ||
44 | if (res && (res->flags & IORESOURCE_IO)) { | ||
45 | bus_res = res; | ||
46 | break; | ||
47 | } | ||
48 | |||
49 | if (!bus_res) { | ||
50 | dev_err(&pdev->dev, "No resources available\n"); | ||
51 | return -1; | ||
52 | } | ||
53 | |||
33 | pci_eisa_root.dev = &pdev->dev; | 54 | pci_eisa_root.dev = &pdev->dev; |
34 | pci_eisa_root.res = pdev->bus->resource[0]; | 55 | pci_eisa_root.res = bus_res; |
35 | pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; | 56 | pci_eisa_root.bus_base_addr = bus_res->start; |
36 | pci_eisa_root.slots = EISA_MAX_SLOTS; | 57 | pci_eisa_root.slots = EISA_MAX_SLOTS; |
37 | pci_eisa_root.dma_mask = pdev->dma_mask; | 58 | pci_eisa_root.dma_mask = pdev->dma_mask; |
38 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); | 59 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); |
@@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev, | |||
45 | return 0; | 66 | return 0; |
46 | } | 67 | } |
47 | 68 | ||
48 | static struct pci_device_id pci_eisa_pci_tbl[] = { | 69 | /* |
49 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 70 | * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init(). |
50 | PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 }, | 71 | * Otherwise pnp resource will get enabled early and could prevent eisa |
51 | { 0, } | 72 | * to be initialized. |
52 | }; | 73 | * Also need to make sure pci_eisa_init_early() is called after |
74 | * x86/pci_subsys_init(). | ||
75 | * So need to use subsys_initcall_sync with it. | ||
76 | */ | ||
77 | static int __init pci_eisa_init_early(void) | ||
78 | { | ||
79 | struct pci_dev *dev = NULL; | ||
80 | int ret; | ||
53 | 81 | ||
54 | static struct pci_driver __refdata pci_eisa_driver = { | 82 | for_each_pci_dev(dev) |
55 | .name = "pci_eisa", | 83 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) { |
56 | .id_table = pci_eisa_pci_tbl, | 84 | ret = pci_eisa_init(dev); |
57 | .probe = pci_eisa_init, | 85 | if (ret) |
58 | }; | 86 | return ret; |
87 | } | ||
59 | 88 | ||
60 | static int __init pci_eisa_init_module (void) | 89 | return 0; |
61 | { | ||
62 | return pci_register_driver (&pci_eisa_driver); | ||
63 | } | 90 | } |
64 | 91 | subsys_initcall_sync(pci_eisa_init_early); | |
65 | device_initcall(pci_eisa_init_module); | ||
66 | MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl); | ||
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c index f9dbd503fc40..de3c317bd3e2 100644 --- a/drivers/gpio/gpio-ich.c +++ b/drivers/gpio/gpio-ich.c | |||
@@ -214,7 +214,7 @@ static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr) | |||
214 | * If it can't be trusted, assume that the pin can be used as a GPIO. | 214 | * If it can't be trusted, assume that the pin can be used as a GPIO. |
215 | */ | 215 | */ |
216 | if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) | 216 | if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) |
217 | return 1; | 217 | return 0; |
218 | 218 | ||
219 | return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; | 219 | return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; |
220 | } | 220 | } |
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 770476a9da87..3ce5bc38ac31 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c | |||
@@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = { | |||
307 | .xlate = irq_domain_xlate_twocell, | 307 | .xlate = irq_domain_xlate_twocell, |
308 | }; | 308 | }; |
309 | 309 | ||
310 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio) | 310 | static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio, |
311 | struct device_node *np) | ||
311 | { | 312 | { |
312 | int base = stmpe_gpio->irq_base; | 313 | int base = 0; |
313 | 314 | ||
314 | stmpe_gpio->domain = irq_domain_add_simple(NULL, | 315 | if (!np) |
316 | base = stmpe_gpio->irq_base; | ||
317 | |||
318 | stmpe_gpio->domain = irq_domain_add_simple(np, | ||
315 | stmpe_gpio->chip.ngpio, base, | 319 | stmpe_gpio->chip.ngpio, base, |
316 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); | 320 | &stmpe_gpio_irq_simple_ops, stmpe_gpio); |
317 | if (!stmpe_gpio->domain) { | 321 | if (!stmpe_gpio->domain) { |
@@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
346 | stmpe_gpio->chip = template_chip; | 350 | stmpe_gpio->chip = template_chip; |
347 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; | 351 | stmpe_gpio->chip.ngpio = stmpe->num_gpios; |
348 | stmpe_gpio->chip.dev = &pdev->dev; | 352 | stmpe_gpio->chip.dev = &pdev->dev; |
353 | #ifdef CONFIG_OF | ||
354 | stmpe_gpio->chip.of_node = np; | ||
355 | #endif | ||
349 | stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; | 356 | stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; |
350 | 357 | ||
351 | if (pdata) | 358 | if (pdata) |
@@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) | |||
366 | goto out_free; | 373 | goto out_free; |
367 | 374 | ||
368 | if (irq >= 0) { | 375 | if (irq >= 0) { |
369 | ret = stmpe_gpio_irq_init(stmpe_gpio); | 376 | ret = stmpe_gpio_irq_init(stmpe_gpio, np); |
370 | if (ret) | 377 | if (ret) |
371 | goto out_disable; | 378 | goto out_disable; |
372 | 379 | ||
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/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 792c3e3795ca..dd64a06dc5b4 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2326,7 +2326,6 @@ int drm_mode_addfb(struct drm_device *dev, | |||
2326 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); | 2326 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); |
2327 | if (IS_ERR(fb)) { | 2327 | if (IS_ERR(fb)) { |
2328 | DRM_DEBUG_KMS("could not create framebuffer\n"); | 2328 | DRM_DEBUG_KMS("could not create framebuffer\n"); |
2329 | drm_modeset_unlock_all(dev); | ||
2330 | return PTR_ERR(fb); | 2329 | return PTR_ERR(fb); |
2331 | } | 2330 | } |
2332 | 2331 | ||
@@ -2506,7 +2505,6 @@ int drm_mode_addfb2(struct drm_device *dev, | |||
2506 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); | 2505 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); |
2507 | if (IS_ERR(fb)) { | 2506 | if (IS_ERR(fb)) { |
2508 | DRM_DEBUG_KMS("could not create framebuffer\n"); | 2507 | DRM_DEBUG_KMS("could not create framebuffer\n"); |
2509 | drm_modeset_unlock_all(dev); | ||
2510 | return PTR_ERR(fb); | 2508 | return PTR_ERR(fb); |
2511 | } | 2509 | } |
2512 | 2510 | ||
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 13fdcd10a605..429e07d0b0f1 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct file *filp) | |||
123 | int retcode = 0; | 123 | int retcode = 0; |
124 | int need_setup = 0; | 124 | int need_setup = 0; |
125 | struct address_space *old_mapping; | 125 | struct address_space *old_mapping; |
126 | struct address_space *old_imapping; | ||
126 | 127 | ||
127 | minor = idr_find(&drm_minors_idr, minor_id); | 128 | minor = idr_find(&drm_minors_idr, minor_id); |
128 | if (!minor) | 129 | if (!minor) |
@@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct file *filp) | |||
137 | if (!dev->open_count++) | 138 | if (!dev->open_count++) |
138 | need_setup = 1; | 139 | need_setup = 1; |
139 | mutex_lock(&dev->struct_mutex); | 140 | mutex_lock(&dev->struct_mutex); |
141 | old_imapping = inode->i_mapping; | ||
140 | old_mapping = dev->dev_mapping; | 142 | old_mapping = dev->dev_mapping; |
141 | if (old_mapping == NULL) | 143 | if (old_mapping == NULL) |
142 | dev->dev_mapping = &inode->i_data; | 144 | dev->dev_mapping = &inode->i_data; |
@@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct file *filp) | |||
159 | 161 | ||
160 | err_undo: | 162 | err_undo: |
161 | mutex_lock(&dev->struct_mutex); | 163 | mutex_lock(&dev->struct_mutex); |
162 | filp->f_mapping = old_mapping; | 164 | filp->f_mapping = old_imapping; |
163 | inode->i_mapping = old_mapping; | 165 | inode->i_mapping = old_imapping; |
164 | iput(container_of(dev->dev_mapping, struct inode, i_data)); | 166 | iput(container_of(dev->dev_mapping, struct inode, i_data)); |
165 | dev->dev_mapping = old_mapping; | 167 | dev->dev_mapping = old_mapping; |
166 | mutex_unlock(&dev->struct_mutex); | 168 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 3b11ab0fbc96..9a48e1a2d417 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -57,7 +57,7 @@ eb_create(struct drm_i915_gem_execbuffer2 *args) | |||
57 | if (eb == NULL) { | 57 | if (eb == NULL) { |
58 | int size = args->buffer_count; | 58 | int size = args->buffer_count; |
59 | int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; | 59 | int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; |
60 | BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head))); | 60 | BUILD_BUG_ON_NOT_POWER_OF_2(PAGE_SIZE / sizeof(struct hlist_head)); |
61 | while (count > 2*size) | 61 | while (count > 2*size) |
62 | count >>= 1; | 62 | count >>= 1; |
63 | eb = kzalloc(count*sizeof(struct hlist_head) + | 63 | eb = kzalloc(count*sizeof(struct hlist_head) + |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 32a3693905ec..1ce45a0a2d3e 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -45,6 +45,9 @@ | |||
45 | 45 | ||
46 | struct intel_crt { | 46 | struct intel_crt { |
47 | struct intel_encoder base; | 47 | struct intel_encoder base; |
48 | /* DPMS state is stored in the connector, which we need in the | ||
49 | * encoder's enable/disable callbacks */ | ||
50 | struct intel_connector *connector; | ||
48 | bool force_hotplug_required; | 51 | bool force_hotplug_required; |
49 | u32 adpa_reg; | 52 | u32 adpa_reg; |
50 | }; | 53 | }; |
@@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder, | |||
81 | return true; | 84 | return true; |
82 | } | 85 | } |
83 | 86 | ||
84 | static void intel_disable_crt(struct intel_encoder *encoder) | ||
85 | { | ||
86 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
87 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
88 | u32 temp; | ||
89 | |||
90 | temp = I915_READ(crt->adpa_reg); | ||
91 | temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE; | ||
92 | temp &= ~ADPA_DAC_ENABLE; | ||
93 | I915_WRITE(crt->adpa_reg, temp); | ||
94 | } | ||
95 | |||
96 | static void intel_enable_crt(struct intel_encoder *encoder) | ||
97 | { | ||
98 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | ||
99 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
100 | u32 temp; | ||
101 | |||
102 | temp = I915_READ(crt->adpa_reg); | ||
103 | temp |= ADPA_DAC_ENABLE; | ||
104 | I915_WRITE(crt->adpa_reg, temp); | ||
105 | } | ||
106 | |||
107 | /* Note: The caller is required to filter out dpms modes not supported by the | 87 | /* Note: The caller is required to filter out dpms modes not supported by the |
108 | * platform. */ | 88 | * platform. */ |
109 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) | 89 | static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) |
@@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) | |||
135 | I915_WRITE(crt->adpa_reg, temp); | 115 | I915_WRITE(crt->adpa_reg, temp); |
136 | } | 116 | } |
137 | 117 | ||
118 | static void intel_disable_crt(struct intel_encoder *encoder) | ||
119 | { | ||
120 | intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF); | ||
121 | } | ||
122 | |||
123 | static void intel_enable_crt(struct intel_encoder *encoder) | ||
124 | { | ||
125 | struct intel_crt *crt = intel_encoder_to_crt(encoder); | ||
126 | |||
127 | intel_crt_set_dpms(encoder, crt->connector->base.dpms); | ||
128 | } | ||
129 | |||
130 | |||
138 | static void intel_crt_dpms(struct drm_connector *connector, int mode) | 131 | static void intel_crt_dpms(struct drm_connector *connector, int mode) |
139 | { | 132 | { |
140 | struct drm_device *dev = connector->dev; | 133 | struct drm_device *dev = connector->dev; |
@@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *dev) | |||
746 | } | 739 | } |
747 | 740 | ||
748 | connector = &intel_connector->base; | 741 | connector = &intel_connector->base; |
742 | crt->connector = intel_connector; | ||
749 | drm_connector_init(dev, &intel_connector->base, | 743 | drm_connector_init(dev, &intel_connector->base, |
750 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | 744 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); |
751 | 745 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index d7d4afe01341..8fc93f90a7cd 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -2559,12 +2559,15 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
2559 | { | 2559 | { |
2560 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); | 2560 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
2561 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 2561 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
2562 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
2562 | 2563 | ||
2563 | i2c_del_adapter(&intel_dp->adapter); | 2564 | i2c_del_adapter(&intel_dp->adapter); |
2564 | drm_encoder_cleanup(encoder); | 2565 | drm_encoder_cleanup(encoder); |
2565 | if (is_edp(intel_dp)) { | 2566 | if (is_edp(intel_dp)) { |
2566 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 2567 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
2568 | mutex_lock(&dev->mode_config.mutex); | ||
2567 | ironlake_panel_vdd_off_sync(intel_dp); | 2569 | ironlake_panel_vdd_off_sync(intel_dp); |
2570 | mutex_unlock(&dev->mode_config.mutex); | ||
2568 | } | 2571 | } |
2569 | kfree(intel_dig_port); | 2572 | kfree(intel_dig_port); |
2570 | } | 2573 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index e816f06637a7..0e2c1a4f1659 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -248,6 +248,22 @@ nouveau_bios_shadow_pci(struct nouveau_bios *bios) | |||
248 | } | 248 | } |
249 | } | 249 | } |
250 | 250 | ||
251 | static void | ||
252 | nouveau_bios_shadow_platform(struct nouveau_bios *bios) | ||
253 | { | ||
254 | struct pci_dev *pdev = nv_device(bios)->pdev; | ||
255 | size_t size; | ||
256 | |||
257 | void __iomem *rom = pci_platform_rom(pdev, &size); | ||
258 | if (rom && size) { | ||
259 | bios->data = kmalloc(size, GFP_KERNEL); | ||
260 | if (bios->data) { | ||
261 | memcpy_fromio(bios->data, rom, size); | ||
262 | bios->size = size; | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | |||
251 | static int | 267 | static int |
252 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) | 268 | nouveau_bios_score(struct nouveau_bios *bios, const bool writeable) |
253 | { | 269 | { |
@@ -288,6 +304,7 @@ nouveau_bios_shadow(struct nouveau_bios *bios) | |||
288 | { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, | 304 | { "PROM", nouveau_bios_shadow_prom, false, 0, 0, NULL }, |
289 | { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, | 305 | { "ACPI", nouveau_bios_shadow_acpi, true, 0, 0, NULL }, |
290 | { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, | 306 | { "PCIROM", nouveau_bios_shadow_pci, true, 0, 0, NULL }, |
307 | { "PLATFORM", nouveau_bios_shadow_platform, true, 0, 0, NULL }, | ||
291 | {} | 308 | {} |
292 | }; | 309 | }; |
293 | struct methods *mthd, *best; | 310 | struct methods *mthd, *best; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index 3b6dc883e150..5eb3e0da7c6e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
@@ -391,7 +391,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
391 | struct nouveau_drm *drm = nouveau_drm(dev); | 391 | struct nouveau_drm *drm = nouveau_drm(dev); |
392 | struct nouveau_device *device = nv_device(drm->device); | 392 | struct nouveau_device *device = nv_device(drm->device); |
393 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 393 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
394 | struct nouveau_abi16_chan *chan, *temp; | 394 | struct nouveau_abi16_chan *chan = NULL, *temp; |
395 | struct nouveau_abi16_ntfy *ntfy; | 395 | struct nouveau_abi16_ntfy *ntfy; |
396 | struct nouveau_object *object; | 396 | struct nouveau_object *object; |
397 | struct nv_dma_class args = {}; | 397 | struct nv_dma_class args = {}; |
@@ -404,10 +404,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) | |||
404 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) | 404 | if (unlikely(nv_device(abi16->device)->card_type >= NV_C0)) |
405 | return nouveau_abi16_put(abi16, -EINVAL); | 405 | return nouveau_abi16_put(abi16, -EINVAL); |
406 | 406 | ||
407 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 407 | list_for_each_entry(temp, &abi16->channels, head) { |
408 | if (chan->chan->handle == (NVDRM_CHAN | info->channel)) | 408 | if (temp->chan->handle == (NVDRM_CHAN | info->channel)) { |
409 | chan = temp; | ||
409 | break; | 410 | break; |
410 | chan = NULL; | 411 | } |
411 | } | 412 | } |
412 | 413 | ||
413 | if (!chan) | 414 | if (!chan) |
@@ -459,17 +460,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS) | |||
459 | { | 460 | { |
460 | struct drm_nouveau_gpuobj_free *fini = data; | 461 | struct drm_nouveau_gpuobj_free *fini = data; |
461 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); | 462 | struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev); |
462 | struct nouveau_abi16_chan *chan, *temp; | 463 | struct nouveau_abi16_chan *chan = NULL, *temp; |
463 | struct nouveau_abi16_ntfy *ntfy; | 464 | struct nouveau_abi16_ntfy *ntfy; |
464 | int ret; | 465 | int ret; |
465 | 466 | ||
466 | if (unlikely(!abi16)) | 467 | if (unlikely(!abi16)) |
467 | return -ENOMEM; | 468 | return -ENOMEM; |
468 | 469 | ||
469 | list_for_each_entry_safe(chan, temp, &abi16->channels, head) { | 470 | list_for_each_entry(temp, &abi16->channels, head) { |
470 | if (chan->chan->handle == (NVDRM_CHAN | fini->channel)) | 471 | if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) { |
472 | chan = temp; | ||
471 | break; | 473 | break; |
472 | chan = NULL; | 474 | } |
473 | } | 475 | } |
474 | 476 | ||
475 | if (!chan) | 477 | if (!chan) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index d1099365bfc1..c95decf543e9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -72,11 +72,25 @@ module_param_named(modeset, nouveau_modeset, int, 0400); | |||
72 | static struct drm_driver driver; | 72 | static struct drm_driver driver; |
73 | 73 | ||
74 | static int | 74 | static int |
75 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | ||
76 | { | ||
77 | struct nouveau_drm *drm = | ||
78 | container_of(event, struct nouveau_drm, vblank[head]); | ||
79 | drm_handle_vblank(drm->dev, head); | ||
80 | return NVKM_EVENT_KEEP; | ||
81 | } | ||
82 | |||
83 | static int | ||
75 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) | 84 | nouveau_drm_vblank_enable(struct drm_device *dev, int head) |
76 | { | 85 | { |
77 | struct nouveau_drm *drm = nouveau_drm(dev); | 86 | struct nouveau_drm *drm = nouveau_drm(dev); |
78 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
79 | nouveau_event_get(pdisp->vblank, head, &drm->vblank); | 88 | |
89 | if (WARN_ON_ONCE(head > ARRAY_SIZE(drm->vblank))) | ||
90 | return -EIO; | ||
91 | WARN_ON_ONCE(drm->vblank[head].func); | ||
92 | drm->vblank[head].func = nouveau_drm_vblank_handler; | ||
93 | nouveau_event_get(pdisp->vblank, head, &drm->vblank[head]); | ||
80 | return 0; | 94 | return 0; |
81 | } | 95 | } |
82 | 96 | ||
@@ -85,16 +99,11 @@ nouveau_drm_vblank_disable(struct drm_device *dev, int head) | |||
85 | { | 99 | { |
86 | struct nouveau_drm *drm = nouveau_drm(dev); | 100 | struct nouveau_drm *drm = nouveau_drm(dev); |
87 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 101 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
88 | nouveau_event_put(pdisp->vblank, head, &drm->vblank); | 102 | if (drm->vblank[head].func) |
89 | } | 103 | nouveau_event_put(pdisp->vblank, head, &drm->vblank[head]); |
90 | 104 | else | |
91 | static int | 105 | WARN_ON_ONCE(1); |
92 | nouveau_drm_vblank_handler(struct nouveau_eventh *event, int head) | 106 | drm->vblank[head].func = NULL; |
93 | { | ||
94 | struct nouveau_drm *drm = | ||
95 | container_of(event, struct nouveau_drm, vblank); | ||
96 | drm_handle_vblank(drm->dev, head); | ||
97 | return NVKM_EVENT_KEEP; | ||
98 | } | 107 | } |
99 | 108 | ||
100 | static u64 | 109 | static u64 |
@@ -292,7 +301,6 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) | |||
292 | 301 | ||
293 | dev->dev_private = drm; | 302 | dev->dev_private = drm; |
294 | drm->dev = dev; | 303 | drm->dev = dev; |
295 | drm->vblank.func = nouveau_drm_vblank_handler; | ||
296 | 304 | ||
297 | INIT_LIST_HEAD(&drm->clients); | 305 | INIT_LIST_HEAD(&drm->clients); |
298 | spin_lock_init(&drm->tile.lock); | 306 | spin_lock_init(&drm->tile.lock); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index b25df374c901..9c39bafbef2c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -113,7 +113,7 @@ struct nouveau_drm { | |||
113 | struct nvbios vbios; | 113 | struct nvbios vbios; |
114 | struct nouveau_display *display; | 114 | struct nouveau_display *display; |
115 | struct backlight_device *backlight; | 115 | struct backlight_device *backlight; |
116 | struct nouveau_eventh vblank; | 116 | struct nouveau_eventh vblank[4]; |
117 | 117 | ||
118 | /* power management */ | 118 | /* power management */ |
119 | struct nouveau_pm *pm; | 119 | struct nouveau_pm *pm; |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index b8015913d382..fa3c56fba294 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -99,6 +99,29 @@ static bool radeon_read_bios(struct radeon_device *rdev) | |||
99 | return true; | 99 | return true; |
100 | } | 100 | } |
101 | 101 | ||
102 | static bool radeon_read_platform_bios(struct radeon_device *rdev) | ||
103 | { | ||
104 | uint8_t __iomem *bios; | ||
105 | size_t size; | ||
106 | |||
107 | rdev->bios = NULL; | ||
108 | |||
109 | bios = pci_platform_rom(rdev->pdev, &size); | ||
110 | if (!bios) { | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | ||
115 | return false; | ||
116 | } | ||
117 | rdev->bios = kmemdup(bios, size, GFP_KERNEL); | ||
118 | if (rdev->bios == NULL) { | ||
119 | return false; | ||
120 | } | ||
121 | |||
122 | return true; | ||
123 | } | ||
124 | |||
102 | #ifdef CONFIG_ACPI | 125 | #ifdef CONFIG_ACPI |
103 | /* ATRM is used to get the BIOS on the discrete cards in | 126 | /* ATRM is used to get the BIOS on the discrete cards in |
104 | * dual-gpu systems. | 127 | * dual-gpu systems. |
@@ -620,6 +643,9 @@ bool radeon_get_bios(struct radeon_device *rdev) | |||
620 | if (r == false) { | 643 | if (r == false) { |
621 | r = radeon_read_disabled_bios(rdev); | 644 | r = radeon_read_disabled_bios(rdev); |
622 | } | 645 | } |
646 | if (r == false) { | ||
647 | r = radeon_read_platform_bios(rdev); | ||
648 | } | ||
623 | if (r == false || rdev->bios == NULL) { | 649 | if (r == false || rdev->bios == NULL) { |
624 | DRM_ERROR("Unable to locate a BIOS ROM\n"); | 650 | DRM_ERROR("Unable to locate a BIOS ROM\n"); |
625 | rdev->bios = NULL; | 651 | rdev->bios = NULL; |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 512b01c04ea7..aa341d135867 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 2077 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2078 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | 2079 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, |
2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) }, | ||
2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2080 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2081 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
2083 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2082 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev) | |||
2244 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) | 2243 | hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) |
2245 | return true; | 2244 | return true; |
2246 | break; | 2245 | break; |
2246 | case USB_VENDOR_ID_ATMEL_V_USB: | ||
2247 | /* Masterkit MA901 usb radio based on Atmel tiny85 chip and | ||
2248 | * it has the same USB ID as many Atmel V-USB devices. This | ||
2249 | * usb radio is handled by radio-ma901.c driver so we want | ||
2250 | * ignore the hid. Check the name, bus, product and ignore | ||
2251 | * if we have MA901 usb radio. | ||
2252 | */ | ||
2253 | if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB && | ||
2254 | hdev->bus == BUS_USB && | ||
2255 | strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0) | ||
2256 | return true; | ||
2257 | break; | ||
2247 | } | 2258 | } |
2248 | 2259 | ||
2249 | if (hdev->type == HID_TYPE_USBMOUSE && | 2260 | if (hdev->type == HID_TYPE_USBMOUSE && |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index c4388776f4e4..5309fd5eb0eb 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -158,6 +158,8 @@ | |||
158 | #define USB_VENDOR_ID_ATMEL 0x03eb | 158 | #define USB_VENDOR_ID_ATMEL 0x03eb |
159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 159 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 | 160 | #define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 |
161 | #define USB_VENDOR_ID_ATMEL_V_USB 0x16c0 | ||
162 | #define USB_DEVICE_ID_ATMEL_V_USB 0x05df | ||
161 | 163 | ||
162 | #define USB_VENDOR_ID_AUREAL 0x0755 | 164 | #define USB_VENDOR_ID_AUREAL 0x0755 |
163 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 | 165 | #define USB_DEVICE_ID_AUREAL_W01RN 0x2626 |
@@ -557,9 +559,6 @@ | |||
557 | #define USB_VENDOR_ID_MADCATZ 0x0738 | 559 | #define USB_VENDOR_ID_MADCATZ 0x0738 |
558 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | 560 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 |
559 | 561 | ||
560 | #define USB_VENDOR_ID_MASTERKIT 0x16c0 | ||
561 | #define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df | ||
562 | |||
563 | #define USB_VENDOR_ID_MCC 0x09db | 562 | #define USB_VENDOR_ID_MCC 0x09db |
564 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 563 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
565 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 564 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index f7f113ba083e..a8ce44296cfd 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev, | |||
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
464 | 464 | ||
465 | static void magicmouse_input_configured(struct hid_device *hdev, | ||
466 | struct hid_input *hi) | ||
467 | |||
468 | { | ||
469 | struct magicmouse_sc *msc = hid_get_drvdata(hdev); | ||
470 | |||
471 | int ret = magicmouse_setup_input(msc->input, hdev); | ||
472 | if (ret) { | ||
473 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
474 | /* clean msc->input to notify probe() of the failure */ | ||
475 | msc->input = NULL; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | |||
465 | static int magicmouse_probe(struct hid_device *hdev, | 480 | static int magicmouse_probe(struct hid_device *hdev, |
466 | const struct hid_device_id *id) | 481 | const struct hid_device_id *id) |
467 | { | 482 | { |
@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
493 | goto err_free; | 508 | goto err_free; |
494 | } | 509 | } |
495 | 510 | ||
496 | /* We do this after hid-input is done parsing reports so that | 511 | if (!msc->input) { |
497 | * hid-input uses the most natural button and axis IDs. | 512 | hid_err(hdev, "magicmouse input not registered\n"); |
498 | */ | 513 | ret = -ENOMEM; |
499 | if (msc->input) { | 514 | goto err_stop_hw; |
500 | ret = magicmouse_setup_input(msc->input, hdev); | ||
501 | if (ret) { | ||
502 | hid_err(hdev, "magicmouse setup input failed (%d)\n", ret); | ||
503 | goto err_stop_hw; | ||
504 | } | ||
505 | } | 515 | } |
506 | 516 | ||
507 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) | 517 | if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) |
@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = { | |||
568 | .remove = magicmouse_remove, | 578 | .remove = magicmouse_remove, |
569 | .raw_event = magicmouse_raw_event, | 579 | .raw_event = magicmouse_raw_event, |
570 | .input_mapping = magicmouse_input_mapping, | 580 | .input_mapping = magicmouse_input_mapping, |
581 | .input_configured = magicmouse_input_configured, | ||
571 | }; | 582 | }; |
572 | module_hid_driver(magicmouse_driver); | 583 | module_hid_driver(magicmouse_driver); |
573 | 584 | ||
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 0ceb6e1b0f65..e3085c487ace 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -182,7 +182,6 @@ static int dw_i2c_probe(struct platform_device *pdev) | |||
182 | adap->algo = &i2c_dw_algo; | 182 | adap->algo = &i2c_dw_algo; |
183 | adap->dev.parent = &pdev->dev; | 183 | adap->dev.parent = &pdev->dev; |
184 | adap->dev.of_node = pdev->dev.of_node; | 184 | adap->dev.of_node = pdev->dev.of_node; |
185 | ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev)); | ||
186 | 185 | ||
187 | r = i2c_add_numbered_adapter(adap); | 186 | r = i2c_add_numbered_adapter(adap); |
188 | if (r) { | 187 | if (r) { |
diff --git a/drivers/infiniband/hw/qib/qib_sd7220.c b/drivers/infiniband/hw/qib/qib_sd7220.c index 08a6c6d39e56..911205d3d5a0 100644 --- a/drivers/infiniband/hw/qib/qib_sd7220.c +++ b/drivers/infiniband/hw/qib/qib_sd7220.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include "qib.h" | 44 | #include "qib.h" |
45 | #include "qib_7220.h" | 45 | #include "qib_7220.h" |
46 | 46 | ||
47 | #define SD7220_FW_NAME "intel/sd7220.fw" | 47 | #define SD7220_FW_NAME "qlogic/sd7220.fw" |
48 | MODULE_FIRMWARE(SD7220_FW_NAME); | 48 | MODULE_FIRMWARE(SD7220_FW_NAME); |
49 | 49 | ||
50 | /* | 50 | /* |
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index e41ceb9bec22..154722aa26cb 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -2,6 +2,8 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o | |||
2 | 2 | ||
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 | ||
6 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o | ||
5 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 7 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
6 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o | 8 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o |
7 | obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi.o | 9 | obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi.o |
diff --git a/arch/arm/mach-mvebu/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index 274ff58271de..ad1e6422a732 100644 --- a/arch/arm/mach-mvebu/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -25,7 +25,9 @@ | |||
25 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
26 | #include <asm/exception.h> | 26 | #include <asm/exception.h> |
27 | #include <asm/smp_plat.h> | 27 | #include <asm/smp_plat.h> |
28 | #include <asm/hardware/cache-l2x0.h> | 28 | #include <asm/mach/irq.h> |
29 | |||
30 | #include "irqchip.h" | ||
29 | 31 | ||
30 | /* Interrupt Controller Registers Map */ | 32 | /* Interrupt Controller Registers Map */ |
31 | #define ARMADA_370_XP_INT_SET_MASK_OFFS (0x48) | 33 | #define ARMADA_370_XP_INT_SET_MASK_OFFS (0x48) |
@@ -44,7 +46,11 @@ | |||
44 | 46 | ||
45 | #define ARMADA_370_XP_MAX_PER_CPU_IRQS (28) | 47 | #define ARMADA_370_XP_MAX_PER_CPU_IRQS (28) |
46 | 48 | ||
47 | #define ACTIVE_DOORBELLS (8) | 49 | #define ARMADA_370_XP_TIMER0_PER_CPU_IRQ (5) |
50 | |||
51 | #define IPI_DOORBELL_START (0) | ||
52 | #define IPI_DOORBELL_END (8) | ||
53 | #define IPI_DOORBELL_MASK 0xFF | ||
48 | 54 | ||
49 | static DEFINE_RAW_SPINLOCK(irq_controller_lock); | 55 | static DEFINE_RAW_SPINLOCK(irq_controller_lock); |
50 | 56 | ||
@@ -62,7 +68,7 @@ static void armada_370_xp_irq_mask(struct irq_data *d) | |||
62 | #ifdef CONFIG_SMP | 68 | #ifdef CONFIG_SMP |
63 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | 69 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
64 | 70 | ||
65 | if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS) | 71 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) |
66 | writel(hwirq, main_int_base + | 72 | writel(hwirq, main_int_base + |
67 | ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); | 73 | ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); |
68 | else | 74 | else |
@@ -79,7 +85,7 @@ static void armada_370_xp_irq_unmask(struct irq_data *d) | |||
79 | #ifdef CONFIG_SMP | 85 | #ifdef CONFIG_SMP |
80 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | 86 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
81 | 87 | ||
82 | if (hwirq > ARMADA_370_XP_MAX_PER_CPU_IRQS) | 88 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) |
83 | writel(hwirq, main_int_base + | 89 | writel(hwirq, main_int_base + |
84 | ARMADA_370_XP_INT_SET_ENABLE_OFFS); | 90 | ARMADA_370_XP_INT_SET_ENABLE_OFFS); |
85 | else | 91 | else |
@@ -147,7 +153,7 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h, | |||
147 | writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); | 153 | writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); |
148 | irq_set_status_flags(virq, IRQ_LEVEL); | 154 | irq_set_status_flags(virq, IRQ_LEVEL); |
149 | 155 | ||
150 | if (hw < ARMADA_370_XP_MAX_PER_CPU_IRQS) { | 156 | if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) { |
151 | irq_set_percpu_devid(virq); | 157 | irq_set_percpu_devid(virq); |
152 | irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip, | 158 | irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip, |
153 | handle_percpu_devid_irq); | 159 | handle_percpu_devid_irq); |
@@ -188,7 +194,7 @@ void armada_xp_mpic_smp_cpu_init(void) | |||
188 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | 194 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); |
189 | 195 | ||
190 | /* Enable first 8 IPIs */ | 196 | /* Enable first 8 IPIs */ |
191 | writel((1 << ACTIVE_DOORBELLS) - 1, per_cpu_int_base + | 197 | writel(IPI_DOORBELL_MASK, per_cpu_int_base + |
192 | ARMADA_370_XP_IN_DRBEL_MSK_OFFS); | 198 | ARMADA_370_XP_IN_DRBEL_MSK_OFFS); |
193 | 199 | ||
194 | /* Unmask IPI interrupt */ | 200 | /* Unmask IPI interrupt */ |
@@ -201,46 +207,8 @@ static struct irq_domain_ops armada_370_xp_mpic_irq_ops = { | |||
201 | .xlate = irq_domain_xlate_onecell, | 207 | .xlate = irq_domain_xlate_onecell, |
202 | }; | 208 | }; |
203 | 209 | ||
204 | static int __init armada_370_xp_mpic_of_init(struct device_node *node, | 210 | static asmlinkage void __exception_irq_entry |
205 | struct device_node *parent) | 211 | armada_370_xp_handle_irq(struct pt_regs *regs) |
206 | { | ||
207 | u32 control; | ||
208 | |||
209 | main_int_base = of_iomap(node, 0); | ||
210 | per_cpu_int_base = of_iomap(node, 1); | ||
211 | |||
212 | BUG_ON(!main_int_base); | ||
213 | BUG_ON(!per_cpu_int_base); | ||
214 | |||
215 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
216 | |||
217 | armada_370_xp_mpic_domain = | ||
218 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | ||
219 | &armada_370_xp_mpic_irq_ops, NULL); | ||
220 | |||
221 | if (!armada_370_xp_mpic_domain) | ||
222 | panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n"); | ||
223 | |||
224 | irq_set_default_host(armada_370_xp_mpic_domain); | ||
225 | |||
226 | #ifdef CONFIG_SMP | ||
227 | armada_xp_mpic_smp_cpu_init(); | ||
228 | |||
229 | /* | ||
230 | * Set the default affinity from all CPUs to the boot cpu. | ||
231 | * This is required since the MPIC doesn't limit several CPUs | ||
232 | * from acknowledging the same interrupt. | ||
233 | */ | ||
234 | cpumask_clear(irq_default_affinity); | ||
235 | cpumask_set_cpu(smp_processor_id(), irq_default_affinity); | ||
236 | |||
237 | #endif | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | asmlinkage void __exception_irq_entry armada_370_xp_handle_irq(struct pt_regs | ||
243 | *regs) | ||
244 | { | 212 | { |
245 | u32 irqstat, irqnr; | 213 | u32 irqstat, irqnr; |
246 | 214 | ||
@@ -265,13 +233,14 @@ asmlinkage void __exception_irq_entry armada_370_xp_handle_irq(struct pt_regs | |||
265 | 233 | ||
266 | ipimask = readl_relaxed(per_cpu_int_base + | 234 | ipimask = readl_relaxed(per_cpu_int_base + |
267 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS) | 235 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS) |
268 | & 0xFF; | 236 | & IPI_DOORBELL_MASK; |
269 | 237 | ||
270 | writel(0x0, per_cpu_int_base + | 238 | writel(~IPI_DOORBELL_MASK, per_cpu_int_base + |
271 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | 239 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); |
272 | 240 | ||
273 | /* Handle all pending doorbells */ | 241 | /* Handle all pending doorbells */ |
274 | for (ipinr = 0; ipinr < ACTIVE_DOORBELLS; ipinr++) { | 242 | for (ipinr = IPI_DOORBELL_START; |
243 | ipinr < IPI_DOORBELL_END; ipinr++) { | ||
275 | if (ipimask & (0x1 << ipinr)) | 244 | if (ipimask & (0x1 << ipinr)) |
276 | handle_IPI(ipinr, regs); | 245 | handle_IPI(ipinr, regs); |
277 | } | 246 | } |
@@ -282,15 +251,44 @@ asmlinkage void __exception_irq_entry armada_370_xp_handle_irq(struct pt_regs | |||
282 | } while (1); | 251 | } while (1); |
283 | } | 252 | } |
284 | 253 | ||
285 | static const struct of_device_id mpic_of_match[] __initconst = { | 254 | static int __init armada_370_xp_mpic_of_init(struct device_node *node, |
286 | {.compatible = "marvell,mpic", .data = armada_370_xp_mpic_of_init}, | 255 | struct device_node *parent) |
287 | {}, | ||
288 | }; | ||
289 | |||
290 | void __init armada_370_xp_init_irq(void) | ||
291 | { | 256 | { |
292 | of_irq_init(mpic_of_match); | 257 | u32 control; |
293 | #ifdef CONFIG_CACHE_L2X0 | 258 | |
294 | l2x0_of_init(0, ~0UL); | 259 | main_int_base = of_iomap(node, 0); |
260 | per_cpu_int_base = of_iomap(node, 1); | ||
261 | |||
262 | BUG_ON(!main_int_base); | ||
263 | BUG_ON(!per_cpu_int_base); | ||
264 | |||
265 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
266 | |||
267 | armada_370_xp_mpic_domain = | ||
268 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | ||
269 | &armada_370_xp_mpic_irq_ops, NULL); | ||
270 | |||
271 | if (!armada_370_xp_mpic_domain) | ||
272 | panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n"); | ||
273 | |||
274 | irq_set_default_host(armada_370_xp_mpic_domain); | ||
275 | |||
276 | #ifdef CONFIG_SMP | ||
277 | armada_xp_mpic_smp_cpu_init(); | ||
278 | |||
279 | /* | ||
280 | * Set the default affinity from all CPUs to the boot cpu. | ||
281 | * This is required since the MPIC doesn't limit several CPUs | ||
282 | * from acknowledging the same interrupt. | ||
283 | */ | ||
284 | cpumask_clear(irq_default_affinity); | ||
285 | cpumask_set_cpu(smp_processor_id(), irq_default_affinity); | ||
286 | |||
295 | #endif | 287 | #endif |
288 | |||
289 | set_handle_irq(armada_370_xp_handle_irq); | ||
290 | |||
291 | return 0; | ||
296 | } | 292 | } |
293 | |||
294 | IRQCHIP_DECLARE(armada_370_xp_mpic, "marvell,mpic", armada_370_xp_mpic_of_init); | ||
diff --git a/arch/arm/mach-s3c24xx/irq.c b/drivers/irqchip/irq-s3c24xx.c index 3f3de7492094..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> |
@@ -35,6 +39,8 @@ | |||
35 | #include <plat/regs-irqtype.h> | 39 | #include <plat/regs-irqtype.h> |
36 | #include <plat/pm.h> | 40 | #include <plat/pm.h> |
37 | 41 | ||
42 | #include "irqchip.h" | ||
43 | |||
38 | #define S3C_IRQTYPE_NONE 0 | 44 | #define S3C_IRQTYPE_NONE 0 |
39 | #define S3C_IRQTYPE_EINT 1 | 45 | #define S3C_IRQTYPE_EINT 1 |
40 | #define S3C_IRQTYPE_EDGE 2 | 46 | #define S3C_IRQTYPE_EDGE 2 |
@@ -42,6 +48,7 @@ | |||
42 | 48 | ||
43 | struct s3c_irq_data { | 49 | struct s3c_irq_data { |
44 | unsigned int type; | 50 | unsigned int type; |
51 | unsigned long offset; | ||
45 | unsigned long parent_irq; | 52 | unsigned long parent_irq; |
46 | 53 | ||
47 | /* data gets filled during init */ | 54 | /* data gets filled during init */ |
@@ -68,23 +75,34 @@ struct s3c_irq_intc { | |||
68 | struct s3c_irq_data *irqs; | 75 | struct s3c_irq_data *irqs; |
69 | }; | 76 | }; |
70 | 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 | |||
71 | static void s3c_irq_mask(struct irq_data *data) | 86 | static void s3c_irq_mask(struct irq_data *data) |
72 | { | 87 | { |
73 | 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; | ||
74 | struct s3c_irq_intc *parent_intc = intc->parent; | 90 | struct s3c_irq_intc *parent_intc = intc->parent; |
75 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
76 | struct s3c_irq_data *parent_data; | 91 | struct s3c_irq_data *parent_data; |
77 | unsigned long mask; | 92 | unsigned long mask; |
78 | unsigned int irqno; | 93 | unsigned int irqno; |
79 | 94 | ||
80 | mask = __raw_readl(intc->reg_mask); | 95 | mask = __raw_readl(intc->reg_mask); |
81 | mask |= (1UL << data->hwirq); | 96 | mask |= (1UL << irq_data->offset); |
82 | __raw_writel(mask, intc->reg_mask); | 97 | __raw_writel(mask, intc->reg_mask); |
83 | 98 | ||
84 | if (parent_intc && irq_data->parent_irq) { | 99 | if (parent_intc) { |
85 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; | 100 | parent_data = &parent_intc->irqs[irq_data->parent_irq]; |
86 | 101 | ||
87 | /* 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 | */ | ||
88 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { | 106 | if ((mask & parent_data->sub_bits) == parent_data->sub_bits) { |
89 | irqno = irq_find_mapping(parent_intc->domain, | 107 | irqno = irq_find_mapping(parent_intc->domain, |
90 | irq_data->parent_irq); | 108 | irq_data->parent_irq); |
@@ -95,17 +113,17 @@ static void s3c_irq_mask(struct irq_data *data) | |||
95 | 113 | ||
96 | static void s3c_irq_unmask(struct irq_data *data) | 114 | static void s3c_irq_unmask(struct irq_data *data) |
97 | { | 115 | { |
98 | 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; | ||
99 | struct s3c_irq_intc *parent_intc = intc->parent; | 118 | struct s3c_irq_intc *parent_intc = intc->parent; |
100 | struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq]; | ||
101 | unsigned long mask; | 119 | unsigned long mask; |
102 | unsigned int irqno; | 120 | unsigned int irqno; |
103 | 121 | ||
104 | mask = __raw_readl(intc->reg_mask); | 122 | mask = __raw_readl(intc->reg_mask); |
105 | mask &= ~(1UL << data->hwirq); | 123 | mask &= ~(1UL << irq_data->offset); |
106 | __raw_writel(mask, intc->reg_mask); | 124 | __raw_writel(mask, intc->reg_mask); |
107 | 125 | ||
108 | if (parent_intc && irq_data->parent_irq) { | 126 | if (parent_intc) { |
109 | irqno = irq_find_mapping(parent_intc->domain, | 127 | irqno = irq_find_mapping(parent_intc->domain, |
110 | irq_data->parent_irq); | 128 | irq_data->parent_irq); |
111 | s3c_irq_unmask(irq_get_irq_data(irqno)); | 129 | s3c_irq_unmask(irq_get_irq_data(irqno)); |
@@ -114,14 +132,37 @@ static void s3c_irq_unmask(struct irq_data *data) | |||
114 | 132 | ||
115 | static inline void s3c_irq_ack(struct irq_data *data) | 133 | static inline void s3c_irq_ack(struct irq_data *data) |
116 | { | 134 | { |
117 | struct s3c_irq_intc *intc = data->domain->host_data; | 135 | struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data); |
118 | unsigned long bitval = 1UL << data->hwirq; | 136 | struct s3c_irq_intc *intc = irq_data->intc; |
137 | unsigned long bitval = 1UL << irq_data->offset; | ||
119 | 138 | ||
120 | __raw_writel(bitval, intc->reg_pending); | 139 | __raw_writel(bitval, intc->reg_pending); |
121 | if (intc->reg_intpnd) | 140 | if (intc->reg_intpnd) |
122 | __raw_writel(bitval, intc->reg_intpnd); | 141 | __raw_writel(bitval, intc->reg_intpnd); |
123 | } | 142 | } |
124 | 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 | |||
125 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, | 166 | static int s3c_irqext_type_set(void __iomem *gpcon_reg, |
126 | void __iomem *extint_reg, | 167 | void __iomem *extint_reg, |
127 | unsigned long gpcon_offset, | 168 | unsigned long gpcon_offset, |
@@ -227,6 +268,7 @@ static struct irq_chip s3c_irq_chip = { | |||
227 | .irq_ack = s3c_irq_ack, | 268 | .irq_ack = s3c_irq_ack, |
228 | .irq_mask = s3c_irq_mask, | 269 | .irq_mask = s3c_irq_mask, |
229 | .irq_unmask = s3c_irq_unmask, | 270 | .irq_unmask = s3c_irq_unmask, |
271 | .irq_set_type = s3c_irq_type, | ||
230 | .irq_set_wake = s3c_irq_wake | 272 | .irq_set_wake = s3c_irq_wake |
231 | }; | 273 | }; |
232 | 274 | ||
@@ -235,6 +277,7 @@ static struct irq_chip s3c_irq_level_chip = { | |||
235 | .irq_mask = s3c_irq_mask, | 277 | .irq_mask = s3c_irq_mask, |
236 | .irq_unmask = s3c_irq_unmask, | 278 | .irq_unmask = s3c_irq_unmask, |
237 | .irq_ack = s3c_irq_ack, | 279 | .irq_ack = s3c_irq_ack, |
280 | .irq_set_type = s3c_irq_type, | ||
238 | }; | 281 | }; |
239 | 282 | ||
240 | static struct irq_chip s3c_irqext_chip = { | 283 | static struct irq_chip s3c_irqext_chip = { |
@@ -258,12 +301,19 @@ static struct irq_chip s3c_irq_eint0t4 = { | |||
258 | 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) |
259 | { | 302 | { |
260 | struct irq_chip *chip = irq_desc_get_chip(desc); | 303 | struct irq_chip *chip = irq_desc_get_chip(desc); |
261 | struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; | 304 | struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc); |
262 | struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq]; | 305 | struct s3c_irq_intc *intc = irq_data->intc; |
263 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; | 306 | struct s3c_irq_intc *sub_intc = irq_data->sub_intc; |
264 | unsigned long src; | 307 | unsigned long src; |
265 | unsigned long msk; | 308 | unsigned long msk; |
266 | 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; | ||
267 | 317 | ||
268 | chained_irq_enter(chip, desc); | 318 | chained_irq_enter(chip, desc); |
269 | 319 | ||
@@ -276,12 +326,64 @@ static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
276 | while (src) { | 326 | while (src) { |
277 | n = __ffs(src); | 327 | n = __ffs(src); |
278 | src &= ~(1 << n); | 328 | src &= ~(1 << n); |
279 | 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); | ||
280 | } | 331 | } |
281 | 332 | ||
282 | chained_irq_exit(chip, desc); | 333 | chained_irq_exit(chip, desc); |
283 | } | 334 | } |
284 | 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 | |||
285 | #ifdef CONFIG_FIQ | 387 | #ifdef CONFIG_FIQ |
286 | /** | 388 | /** |
287 | * s3c24xx_set_fiq - set the FIQ routing | 389 | * s3c24xx_set_fiq - set the FIQ routing |
@@ -324,18 +426,11 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
324 | struct s3c_irq_data *parent_irq_data; | 426 | struct s3c_irq_data *parent_irq_data; |
325 | unsigned int irqno; | 427 | unsigned int irqno; |
326 | 428 | ||
327 | if (!intc) { | ||
328 | pr_err("irq-s3c24xx: no controller found for hwirq %lu\n", hw); | ||
329 | return -EINVAL; | ||
330 | } | ||
331 | |||
332 | if (!irq_data) { | ||
333 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", hw); | ||
334 | return -EINVAL; | ||
335 | } | ||
336 | |||
337 | /* attach controller pointer to irq_data */ | 429 | /* attach controller pointer to irq_data */ |
338 | irq_data->intc = intc; | 430 | irq_data->intc = intc; |
431 | irq_data->offset = hw; | ||
432 | |||
433 | parent_intc = intc->parent; | ||
339 | 434 | ||
340 | /* set handler and flags */ | 435 | /* set handler and flags */ |
341 | switch (irq_data->type) { | 436 | switch (irq_data->type) { |
@@ -345,7 +440,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
345 | /* On the S3C2412, the EINT0to3 have a parent irq | 440 | /* On the S3C2412, the EINT0to3 have a parent irq |
346 | * but need the s3c_irq_eint0t4 chip | 441 | * but need the s3c_irq_eint0t4 chip |
347 | */ | 442 | */ |
348 | if (irq_data->parent_irq && (!soc_is_s3c2412() || hw >= 4)) | 443 | if (parent_intc && (!soc_is_s3c2412() || hw >= 4)) |
349 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, | 444 | irq_set_chip_and_handler(virq, &s3c_irqext_chip, |
350 | handle_edge_irq); | 445 | handle_edge_irq); |
351 | else | 446 | else |
@@ -353,8 +448,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
353 | handle_edge_irq); | 448 | handle_edge_irq); |
354 | break; | 449 | break; |
355 | case S3C_IRQTYPE_EDGE: | 450 | case S3C_IRQTYPE_EDGE: |
356 | if (irq_data->parent_irq || | 451 | if (parent_intc || intc->reg_pending == S3C2416_SRCPND2) |
357 | intc->reg_pending == S3C2416_SRCPND2) | ||
358 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 452 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
359 | handle_edge_irq); | 453 | handle_edge_irq); |
360 | else | 454 | else |
@@ -362,7 +456,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
362 | handle_edge_irq); | 456 | handle_edge_irq); |
363 | break; | 457 | break; |
364 | case S3C_IRQTYPE_LEVEL: | 458 | case S3C_IRQTYPE_LEVEL: |
365 | if (irq_data->parent_irq) | 459 | if (parent_intc) |
366 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, | 460 | irq_set_chip_and_handler(virq, &s3c_irq_level_chip, |
367 | handle_level_irq); | 461 | handle_level_irq); |
368 | else | 462 | else |
@@ -373,23 +467,19 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq, | |||
373 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); | 467 | pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); |
374 | return -EINVAL; | 468 | return -EINVAL; |
375 | } | 469 | } |
470 | |||
471 | irq_set_chip_data(virq, irq_data); | ||
472 | |||
376 | set_irq_flags(virq, IRQF_VALID); | 473 | set_irq_flags(virq, IRQF_VALID); |
377 | 474 | ||
378 | if (irq_data->parent_irq) { | 475 | if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) { |
379 | parent_intc = intc->parent; | 476 | if (irq_data->parent_irq > 31) { |
380 | if (!parent_intc) { | 477 | pr_err("irq-s3c24xx: parent irq %lu is out of range\n", |
381 | pr_err("irq-s3c24xx: no parent controller found for hwirq %lu\n", | 478 | irq_data->parent_irq); |
382 | hw); | ||
383 | goto err; | 479 | goto err; |
384 | } | 480 | } |
385 | 481 | ||
386 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; | 482 | parent_irq_data = &parent_intc->irqs[irq_data->parent_irq]; |
387 | if (!irq_data) { | ||
388 | pr_err("irq-s3c24xx: no irq data found for hwirq %lu\n", | ||
389 | hw); | ||
390 | goto err; | ||
391 | } | ||
392 | |||
393 | parent_irq_data->sub_intc = intc; | 483 | parent_irq_data->sub_intc = intc; |
394 | parent_irq_data->sub_bits |= (1UL << hw); | 484 | parent_irq_data->sub_bits |= (1UL << hw); |
395 | 485 | ||
@@ -444,7 +534,7 @@ static void s3c24xx_clear_intc(struct s3c_irq_intc *intc) | |||
444 | } | 534 | } |
445 | } | 535 | } |
446 | 536 | ||
447 | struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | 537 | static struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, |
448 | struct s3c_irq_data *irq_data, | 538 | struct s3c_irq_data *irq_data, |
449 | struct s3c_irq_intc *parent, | 539 | struct s3c_irq_intc *parent, |
450 | unsigned long address) | 540 | unsigned long address) |
@@ -518,6 +608,8 @@ struct s3c_irq_intc *s3c24xx_init_intc(struct device_node *np, | |||
518 | goto err; | 608 | goto err; |
519 | } | 609 | } |
520 | 610 | ||
611 | set_handle_irq(s3c24xx_handle_irq); | ||
612 | |||
521 | return intc; | 613 | return intc; |
522 | 614 | ||
523 | err: | 615 | err: |
@@ -525,12 +617,35 @@ err: | |||
525 | return ERR_PTR(ret); | 617 | return ERR_PTR(ret); |
526 | } | 618 | } |
527 | 619 | ||
528 | /* s3c24xx_init_irq | 620 | static struct s3c_irq_data init_eint[32] = { |
529 | * | 621 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
530 | * Initialise S3C2410 IRQ system | 622 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ |
531 | */ | 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 | }; | ||
532 | 646 | ||
533 | static struct s3c_irq_data init_base[32] = { | 647 | #ifdef CONFIG_CPU_S3C2410 |
648 | static struct s3c_irq_data init_s3c2410base[32] = { | ||
534 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | 649 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |
535 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ | 650 | { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */ |
536 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ | 651 | { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */ |
@@ -565,34 +680,7 @@ static struct s3c_irq_data init_base[32] = { | |||
565 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ | 680 | { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */ |
566 | }; | 681 | }; |
567 | 682 | ||
568 | static struct s3c_irq_data init_eint[32] = { | 683 | static struct s3c_irq_data init_s3c2410subint[32] = { |
569 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
570 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
571 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
572 | { .type = S3C_IRQTYPE_NONE, }, /* reserved */ | ||
573 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT4 */ | ||
574 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT5 */ | ||
575 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT6 */ | ||
576 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 4 }, /* EINT7 */ | ||
577 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT8 */ | ||
578 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT9 */ | ||
579 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT10 */ | ||
580 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT11 */ | ||
581 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT12 */ | ||
582 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT13 */ | ||
583 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT14 */ | ||
584 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT15 */ | ||
585 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT16 */ | ||
586 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT17 */ | ||
587 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT18 */ | ||
588 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT19 */ | ||
589 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT20 */ | ||
590 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT21 */ | ||
591 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT22 */ | ||
592 | { .type = S3C_IRQTYPE_EINT, .parent_irq = 5 }, /* EINT23 */ | ||
593 | }; | ||
594 | |||
595 | static struct s3c_irq_data init_subint[32] = { | ||
596 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ | 684 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */ |
597 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ | 685 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */ |
598 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ | 686 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */ |
@@ -606,23 +694,24 @@ static struct s3c_irq_data init_subint[32] = { | |||
606 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | 694 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
607 | }; | 695 | }; |
608 | 696 | ||
609 | void __init s3c24xx_init_irq(void) | 697 | void __init s3c2410_init_irq(void) |
610 | { | 698 | { |
611 | struct s3c_irq_intc *main_intc; | ||
612 | |||
613 | #ifdef CONFIG_FIQ | 699 | #ifdef CONFIG_FIQ |
614 | init_FIQ(FIQ_START); | 700 | init_FIQ(FIQ_START); |
615 | #endif | 701 | #endif |
616 | 702 | ||
617 | main_intc = s3c24xx_init_intc(NULL, &init_base[0], NULL, 0x4a000000); | 703 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2410base[0], NULL, |
618 | if (IS_ERR(main_intc)) { | 704 | 0x4a000000); |
705 | if (IS_ERR(s3c_intc[0])) { | ||
619 | pr_err("irq: could not create main interrupt controller\n"); | 706 | pr_err("irq: could not create main interrupt controller\n"); |
620 | return; | 707 | return; |
621 | } | 708 | } |
622 | 709 | ||
623 | s3c24xx_init_intc(NULL, &init_subint[0], main_intc, 0x4a000018); | 710 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2410subint[0], |
624 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 711 | s3c_intc[0], 0x4a000018); |
712 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); | ||
625 | } | 713 | } |
714 | #endif | ||
626 | 715 | ||
627 | #ifdef CONFIG_CPU_S3C2412 | 716 | #ifdef CONFIG_CPU_S3C2412 |
628 | static struct s3c_irq_data init_s3c2412base[32] = { | 717 | static struct s3c_irq_data init_s3c2412base[32] = { |
@@ -707,22 +796,22 @@ static struct s3c_irq_data init_s3c2412subint[32] = { | |||
707 | 796 | ||
708 | void s3c2412_init_irq(void) | 797 | void s3c2412_init_irq(void) |
709 | { | 798 | { |
710 | struct s3c_irq_intc *main_intc; | ||
711 | |||
712 | pr_info("S3C2412: IRQ Support\n"); | 799 | pr_info("S3C2412: IRQ Support\n"); |
713 | 800 | ||
714 | #ifdef CONFIG_FIQ | 801 | #ifdef CONFIG_FIQ |
715 | init_FIQ(FIQ_START); | 802 | init_FIQ(FIQ_START); |
716 | #endif | 803 | #endif |
717 | 804 | ||
718 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, 0x4a000000); | 805 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, |
719 | if (IS_ERR(main_intc)) { | 806 | 0x4a000000); |
807 | if (IS_ERR(s3c_intc[0])) { | ||
720 | pr_err("irq: could not create main interrupt controller\n"); | 808 | pr_err("irq: could not create main interrupt controller\n"); |
721 | return; | 809 | return; |
722 | } | 810 | } |
723 | 811 | ||
724 | s3c24xx_init_intc(NULL, &init_s3c2412eint[0], main_intc, 0x560000a4); | 812 | s3c24xx_init_intc(NULL, &init_s3c2412eint[0], s3c_intc[0], 0x560000a4); |
725 | s3c24xx_init_intc(NULL, &init_s3c2412subint[0], main_intc, 0x4a000018); | 813 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2412subint[0], |
814 | s3c_intc[0], 0x4a000018); | ||
726 | } | 815 | } |
727 | #endif | 816 | #endif |
728 | 817 | ||
@@ -796,35 +885,35 @@ static struct s3c_irq_data init_s3c2416subint[32] = { | |||
796 | 885 | ||
797 | static struct s3c_irq_data init_s3c2416_second[32] = { | 886 | static struct s3c_irq_data init_s3c2416_second[32] = { |
798 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ | 887 | { .type = S3C_IRQTYPE_EDGE }, /* 2D */ |
799 | { .type = S3C_IRQTYPE_EDGE }, /* IIC1 */ | 888 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
800 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 889 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
801 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ | 890 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
802 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ | 891 | { .type = S3C_IRQTYPE_EDGE }, /* PCM0 */ |
803 | { .type = S3C_IRQTYPE_EDGE }, /* PCM1 */ | 892 | { .type = S3C_IRQTYPE_NONE }, /* reserved */ |
804 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ | 893 | { .type = S3C_IRQTYPE_EDGE }, /* I2S0 */ |
805 | { .type = S3C_IRQTYPE_EDGE }, /* I2S1 */ | ||
806 | }; | 894 | }; |
807 | 895 | ||
808 | void __init s3c2416_init_irq(void) | 896 | void __init s3c2416_init_irq(void) |
809 | { | 897 | { |
810 | struct s3c_irq_intc *main_intc; | ||
811 | |||
812 | pr_info("S3C2416: IRQ Support\n"); | 898 | pr_info("S3C2416: IRQ Support\n"); |
813 | 899 | ||
814 | #ifdef CONFIG_FIQ | 900 | #ifdef CONFIG_FIQ |
815 | init_FIQ(FIQ_START); | 901 | init_FIQ(FIQ_START); |
816 | #endif | 902 | #endif |
817 | 903 | ||
818 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, 0x4a000000); | 904 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2416base[0], NULL, |
819 | if (IS_ERR(main_intc)) { | 905 | 0x4a000000); |
906 | if (IS_ERR(s3c_intc[0])) { | ||
820 | pr_err("irq: could not create main interrupt controller\n"); | 907 | pr_err("irq: could not create main interrupt controller\n"); |
821 | return; | 908 | return; |
822 | } | 909 | } |
823 | 910 | ||
824 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 911 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
825 | 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); | ||
826 | 914 | ||
827 | s3c24xx_init_intc(NULL, &init_s3c2416_second[0], NULL, 0x4a000040); | 915 | s3c_intc[2] = s3c24xx_init_intc(NULL, &init_s3c2416_second[0], |
916 | NULL, 0x4a000040); | ||
828 | } | 917 | } |
829 | 918 | ||
830 | #endif | 919 | #endif |
@@ -877,30 +966,30 @@ static struct s3c_irq_data init_s3c2440subint[32] = { | |||
877 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | 966 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
878 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | 967 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
879 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | 968 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
880 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */ | 969 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ |
881 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */ | 970 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ |
882 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ | 971 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */ |
883 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ | 972 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */ |
884 | }; | 973 | }; |
885 | 974 | ||
886 | void __init s3c2440_init_irq(void) | 975 | void __init s3c2440_init_irq(void) |
887 | { | 976 | { |
888 | struct s3c_irq_intc *main_intc; | ||
889 | |||
890 | pr_info("S3C2440: IRQ Support\n"); | 977 | pr_info("S3C2440: IRQ Support\n"); |
891 | 978 | ||
892 | #ifdef CONFIG_FIQ | 979 | #ifdef CONFIG_FIQ |
893 | init_FIQ(FIQ_START); | 980 | init_FIQ(FIQ_START); |
894 | #endif | 981 | #endif |
895 | 982 | ||
896 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, 0x4a000000); | 983 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, |
897 | if (IS_ERR(main_intc)) { | 984 | 0x4a000000); |
985 | if (IS_ERR(s3c_intc[0])) { | ||
898 | pr_err("irq: could not create main interrupt controller\n"); | 986 | pr_err("irq: could not create main interrupt controller\n"); |
899 | return; | 987 | return; |
900 | } | 988 | } |
901 | 989 | ||
902 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 990 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
903 | s3c24xx_init_intc(NULL, &init_s3c2440subint[0], main_intc, 0x4a000018); | 991 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2440subint[0], |
992 | s3c_intc[0], 0x4a000018); | ||
904 | } | 993 | } |
905 | #endif | 994 | #endif |
906 | 995 | ||
@@ -952,28 +1041,28 @@ static struct s3c_irq_data init_s3c2442subint[32] = { | |||
952 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ | 1041 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */ |
953 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ | 1042 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */ |
954 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ | 1043 | { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */ |
955 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */ | 1044 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_C */ |
956 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */ | 1045 | { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* CAM_P */ |
957 | }; | 1046 | }; |
958 | 1047 | ||
959 | void __init s3c2442_init_irq(void) | 1048 | void __init s3c2442_init_irq(void) |
960 | { | 1049 | { |
961 | struct s3c_irq_intc *main_intc; | ||
962 | |||
963 | pr_info("S3C2442: IRQ Support\n"); | 1050 | pr_info("S3C2442: IRQ Support\n"); |
964 | 1051 | ||
965 | #ifdef CONFIG_FIQ | 1052 | #ifdef CONFIG_FIQ |
966 | init_FIQ(FIQ_START); | 1053 | init_FIQ(FIQ_START); |
967 | #endif | 1054 | #endif |
968 | 1055 | ||
969 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, 0x4a000000); | 1056 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, |
970 | if (IS_ERR(main_intc)) { | 1057 | 0x4a000000); |
1058 | if (IS_ERR(s3c_intc[0])) { | ||
971 | pr_err("irq: could not create main interrupt controller\n"); | 1059 | pr_err("irq: could not create main interrupt controller\n"); |
972 | return; | 1060 | return; |
973 | } | 1061 | } |
974 | 1062 | ||
975 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 1063 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
976 | s3c24xx_init_intc(NULL, &init_s3c2442subint[0], main_intc, 0x4a000018); | 1064 | s3c_intc[1] = s3c24xx_init_intc(NULL, &init_s3c2442subint[0], |
1065 | s3c_intc[0], 0x4a000018); | ||
977 | } | 1066 | } |
978 | #endif | 1067 | #endif |
979 | 1068 | ||
@@ -1048,21 +1137,219 @@ static struct s3c_irq_data init_s3c2443subint[32] = { | |||
1048 | 1137 | ||
1049 | void __init s3c2443_init_irq(void) | 1138 | void __init s3c2443_init_irq(void) |
1050 | { | 1139 | { |
1051 | struct s3c_irq_intc *main_intc; | ||
1052 | |||
1053 | pr_info("S3C2443: IRQ Support\n"); | 1140 | pr_info("S3C2443: IRQ Support\n"); |
1054 | 1141 | ||
1055 | #ifdef CONFIG_FIQ | 1142 | #ifdef CONFIG_FIQ |
1056 | init_FIQ(FIQ_START); | 1143 | init_FIQ(FIQ_START); |
1057 | #endif | 1144 | #endif |
1058 | 1145 | ||
1059 | main_intc = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, 0x4a000000); | 1146 | s3c_intc[0] = s3c24xx_init_intc(NULL, &init_s3c2443base[0], NULL, |
1060 | if (IS_ERR(main_intc)) { | 1147 | 0x4a000000); |
1148 | if (IS_ERR(s3c_intc[0])) { | ||
1061 | pr_err("irq: could not create main interrupt controller\n"); | 1149 | pr_err("irq: could not create main interrupt controller\n"); |
1062 | return; | 1150 | return; |
1063 | } | 1151 | } |
1064 | 1152 | ||
1065 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 1153 | s3c24xx_init_intc(NULL, &init_eint[0], s3c_intc[0], 0x560000a4); |
1066 | 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)); | ||
1067 | } | 1353 | } |
1354 | IRQCHIP_DECLARE(s3c2416_irq, "samsung,s3c2416-irq", s3c2416_init_intc_of); | ||
1068 | #endif | 1355 | #endif |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 66120bd46d15..10744091e6ca 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include "dm.h" | 7 | #include "dm.h" |
8 | #include "dm-bio-prison.h" | 8 | #include "dm-bio-prison.h" |
9 | #include "dm-bio-record.h" | ||
9 | #include "dm-cache-metadata.h" | 10 | #include "dm-cache-metadata.h" |
10 | 11 | ||
11 | #include <linux/dm-io.h> | 12 | #include <linux/dm-io.h> |
@@ -201,10 +202,15 @@ struct per_bio_data { | |||
201 | unsigned req_nr:2; | 202 | unsigned req_nr:2; |
202 | struct dm_deferred_entry *all_io_entry; | 203 | struct dm_deferred_entry *all_io_entry; |
203 | 204 | ||
204 | /* writethrough fields */ | 205 | /* |
206 | * writethrough fields. These MUST remain at the end of this | ||
207 | * structure and the 'cache' member must be the first as it | ||
208 | * is used to determine the offsetof the writethrough fields. | ||
209 | */ | ||
205 | struct cache *cache; | 210 | struct cache *cache; |
206 | dm_cblock_t cblock; | 211 | dm_cblock_t cblock; |
207 | bio_end_io_t *saved_bi_end_io; | 212 | bio_end_io_t *saved_bi_end_io; |
213 | struct dm_bio_details bio_details; | ||
208 | }; | 214 | }; |
209 | 215 | ||
210 | struct dm_cache_migration { | 216 | struct dm_cache_migration { |
@@ -513,16 +519,28 @@ static void save_stats(struct cache *cache) | |||
513 | /*---------------------------------------------------------------- | 519 | /*---------------------------------------------------------------- |
514 | * Per bio data | 520 | * Per bio data |
515 | *--------------------------------------------------------------*/ | 521 | *--------------------------------------------------------------*/ |
516 | static struct per_bio_data *get_per_bio_data(struct bio *bio) | 522 | |
523 | /* | ||
524 | * If using writeback, leave out struct per_bio_data's writethrough fields. | ||
525 | */ | ||
526 | #define PB_DATA_SIZE_WB (offsetof(struct per_bio_data, cache)) | ||
527 | #define PB_DATA_SIZE_WT (sizeof(struct per_bio_data)) | ||
528 | |||
529 | static size_t get_per_bio_data_size(struct cache *cache) | ||
530 | { | ||
531 | return cache->features.write_through ? PB_DATA_SIZE_WT : PB_DATA_SIZE_WB; | ||
532 | } | ||
533 | |||
534 | static struct per_bio_data *get_per_bio_data(struct bio *bio, size_t data_size) | ||
517 | { | 535 | { |
518 | struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data)); | 536 | struct per_bio_data *pb = dm_per_bio_data(bio, data_size); |
519 | BUG_ON(!pb); | 537 | BUG_ON(!pb); |
520 | return pb; | 538 | return pb; |
521 | } | 539 | } |
522 | 540 | ||
523 | static struct per_bio_data *init_per_bio_data(struct bio *bio) | 541 | static struct per_bio_data *init_per_bio_data(struct bio *bio, size_t data_size) |
524 | { | 542 | { |
525 | struct per_bio_data *pb = get_per_bio_data(bio); | 543 | struct per_bio_data *pb = get_per_bio_data(bio, data_size); |
526 | 544 | ||
527 | pb->tick = false; | 545 | pb->tick = false; |
528 | pb->req_nr = dm_bio_get_target_bio_nr(bio); | 546 | pb->req_nr = dm_bio_get_target_bio_nr(bio); |
@@ -556,7 +574,8 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, | |||
556 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) | 574 | static void check_if_tick_bio_needed(struct cache *cache, struct bio *bio) |
557 | { | 575 | { |
558 | unsigned long flags; | 576 | unsigned long flags; |
559 | struct per_bio_data *pb = get_per_bio_data(bio); | 577 | size_t pb_data_size = get_per_bio_data_size(cache); |
578 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
560 | 579 | ||
561 | spin_lock_irqsave(&cache->lock, flags); | 580 | spin_lock_irqsave(&cache->lock, flags); |
562 | if (cache->need_tick_bio && | 581 | if (cache->need_tick_bio && |
@@ -635,7 +654,7 @@ static void defer_writethrough_bio(struct cache *cache, struct bio *bio) | |||
635 | 654 | ||
636 | static void writethrough_endio(struct bio *bio, int err) | 655 | static void writethrough_endio(struct bio *bio, int err) |
637 | { | 656 | { |
638 | struct per_bio_data *pb = get_per_bio_data(bio); | 657 | struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); |
639 | bio->bi_end_io = pb->saved_bi_end_io; | 658 | bio->bi_end_io = pb->saved_bi_end_io; |
640 | 659 | ||
641 | if (err) { | 660 | if (err) { |
@@ -643,6 +662,7 @@ static void writethrough_endio(struct bio *bio, int err) | |||
643 | return; | 662 | return; |
644 | } | 663 | } |
645 | 664 | ||
665 | dm_bio_restore(&pb->bio_details, bio); | ||
646 | remap_to_cache(pb->cache, bio, pb->cblock); | 666 | remap_to_cache(pb->cache, bio, pb->cblock); |
647 | 667 | ||
648 | /* | 668 | /* |
@@ -662,11 +682,12 @@ static void writethrough_endio(struct bio *bio, int err) | |||
662 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, | 682 | static void remap_to_origin_then_cache(struct cache *cache, struct bio *bio, |
663 | dm_oblock_t oblock, dm_cblock_t cblock) | 683 | dm_oblock_t oblock, dm_cblock_t cblock) |
664 | { | 684 | { |
665 | struct per_bio_data *pb = get_per_bio_data(bio); | 685 | struct per_bio_data *pb = get_per_bio_data(bio, PB_DATA_SIZE_WT); |
666 | 686 | ||
667 | pb->cache = cache; | 687 | pb->cache = cache; |
668 | pb->cblock = cblock; | 688 | pb->cblock = cblock; |
669 | pb->saved_bi_end_io = bio->bi_end_io; | 689 | pb->saved_bi_end_io = bio->bi_end_io; |
690 | dm_bio_record(&pb->bio_details, bio); | ||
670 | bio->bi_end_io = writethrough_endio; | 691 | bio->bi_end_io = writethrough_endio; |
671 | 692 | ||
672 | remap_to_origin_clear_discard(pb->cache, bio, oblock); | 693 | remap_to_origin_clear_discard(pb->cache, bio, oblock); |
@@ -1035,7 +1056,8 @@ static void defer_bio(struct cache *cache, struct bio *bio) | |||
1035 | 1056 | ||
1036 | static void process_flush_bio(struct cache *cache, struct bio *bio) | 1057 | static void process_flush_bio(struct cache *cache, struct bio *bio) |
1037 | { | 1058 | { |
1038 | struct per_bio_data *pb = get_per_bio_data(bio); | 1059 | size_t pb_data_size = get_per_bio_data_size(cache); |
1060 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
1039 | 1061 | ||
1040 | BUG_ON(bio->bi_size); | 1062 | BUG_ON(bio->bi_size); |
1041 | if (!pb->req_nr) | 1063 | if (!pb->req_nr) |
@@ -1107,7 +1129,8 @@ static void process_bio(struct cache *cache, struct prealloc *structs, | |||
1107 | dm_oblock_t block = get_bio_block(cache, bio); | 1129 | dm_oblock_t block = get_bio_block(cache, bio); |
1108 | struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; | 1130 | struct dm_bio_prison_cell *cell_prealloc, *old_ocell, *new_ocell; |
1109 | struct policy_result lookup_result; | 1131 | struct policy_result lookup_result; |
1110 | struct per_bio_data *pb = get_per_bio_data(bio); | 1132 | size_t pb_data_size = get_per_bio_data_size(cache); |
1133 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
1111 | bool discarded_block = is_discarded_oblock(cache, block); | 1134 | bool discarded_block = is_discarded_oblock(cache, block); |
1112 | bool can_migrate = discarded_block || spare_migration_bandwidth(cache); | 1135 | bool can_migrate = discarded_block || spare_migration_bandwidth(cache); |
1113 | 1136 | ||
@@ -1881,7 +1904,6 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1881 | 1904 | ||
1882 | cache->ti = ca->ti; | 1905 | cache->ti = ca->ti; |
1883 | ti->private = cache; | 1906 | ti->private = cache; |
1884 | ti->per_bio_data_size = sizeof(struct per_bio_data); | ||
1885 | ti->num_flush_bios = 2; | 1907 | ti->num_flush_bios = 2; |
1886 | ti->flush_supported = true; | 1908 | ti->flush_supported = true; |
1887 | 1909 | ||
@@ -1890,6 +1912,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
1890 | ti->discard_zeroes_data_unsupported = true; | 1912 | ti->discard_zeroes_data_unsupported = true; |
1891 | 1913 | ||
1892 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); | 1914 | memcpy(&cache->features, &ca->features, sizeof(cache->features)); |
1915 | ti->per_bio_data_size = get_per_bio_data_size(cache); | ||
1893 | 1916 | ||
1894 | cache->callbacks.congested_fn = cache_is_congested; | 1917 | cache->callbacks.congested_fn = cache_is_congested; |
1895 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); | 1918 | dm_table_add_target_callbacks(ti->table, &cache->callbacks); |
@@ -2092,6 +2115,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2092 | 2115 | ||
2093 | int r; | 2116 | int r; |
2094 | dm_oblock_t block = get_bio_block(cache, bio); | 2117 | dm_oblock_t block = get_bio_block(cache, bio); |
2118 | size_t pb_data_size = get_per_bio_data_size(cache); | ||
2095 | bool can_migrate = false; | 2119 | bool can_migrate = false; |
2096 | bool discarded_block; | 2120 | bool discarded_block; |
2097 | struct dm_bio_prison_cell *cell; | 2121 | struct dm_bio_prison_cell *cell; |
@@ -2108,7 +2132,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2108 | return DM_MAPIO_REMAPPED; | 2132 | return DM_MAPIO_REMAPPED; |
2109 | } | 2133 | } |
2110 | 2134 | ||
2111 | pb = init_per_bio_data(bio); | 2135 | pb = init_per_bio_data(bio, pb_data_size); |
2112 | 2136 | ||
2113 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { | 2137 | if (bio->bi_rw & (REQ_FLUSH | REQ_FUA | REQ_DISCARD)) { |
2114 | defer_bio(cache, bio); | 2138 | defer_bio(cache, bio); |
@@ -2193,7 +2217,8 @@ static int cache_end_io(struct dm_target *ti, struct bio *bio, int error) | |||
2193 | { | 2217 | { |
2194 | struct cache *cache = ti->private; | 2218 | struct cache *cache = ti->private; |
2195 | unsigned long flags; | 2219 | unsigned long flags; |
2196 | struct per_bio_data *pb = get_per_bio_data(bio); | 2220 | size_t pb_data_size = get_per_bio_data_size(cache); |
2221 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | ||
2197 | 2222 | ||
2198 | if (pb->tick) { | 2223 | if (pb->tick) { |
2199 | policy_tick(cache->policy); | 2224 | policy_tick(cache->policy); |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index 05d7b6333461..a0639e779973 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -204,7 +204,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC | |||
204 | 204 | ||
205 | config VIDEO_SH_VEU | 205 | config VIDEO_SH_VEU |
206 | tristate "SuperH VEU mem2mem video processing driver" | 206 | tristate "SuperH VEU mem2mem video processing driver" |
207 | depends on VIDEO_DEV && VIDEO_V4L2 | 207 | depends on VIDEO_DEV && VIDEO_V4L2 && GENERIC_HARDIRQS |
208 | select VIDEOBUF2_DMA_CONTIG | 208 | select VIDEOBUF2_DMA_CONTIG |
209 | select V4L2_MEM2MEM_DEV | 209 | select V4L2_MEM2MEM_DEV |
210 | help | 210 | help |
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index c61f590029ad..348dafc0318a 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c | |||
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev) | |||
347 | static int usb_ma901radio_probe(struct usb_interface *intf, | 347 | static int usb_ma901radio_probe(struct usb_interface *intf, |
348 | const struct usb_device_id *id) | 348 | const struct usb_device_id *id) |
349 | { | 349 | { |
350 | struct usb_device *dev = interface_to_usbdev(intf); | ||
350 | struct ma901radio_device *radio; | 351 | struct ma901radio_device *radio; |
351 | int retval = 0; | 352 | int retval = 0; |
352 | 353 | ||
354 | /* Masterkit MA901 usb radio has the same USB ID as many others | ||
355 | * Atmel V-USB devices. Let's make additional checks to be sure | ||
356 | * that this is our device. | ||
357 | */ | ||
358 | |||
359 | if (dev->product && dev->manufacturer && | ||
360 | (strncmp(dev->product, "MA901", 5) != 0 | ||
361 | || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0)) | ||
362 | return -ENODEV; | ||
363 | |||
353 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); | 364 | radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); |
354 | if (!radio) { | 365 | if (!radio) { |
355 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); | 366 | dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6bbd90e1123c..171b10f167a5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1976,12 +1976,11 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1976 | return -EINVAL; | 1976 | return -EINVAL; |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | write_unlock_bh(&bond->lock); | ||
1979 | /* unregister rx_handler early so bond_handle_frame wouldn't be called | 1980 | /* unregister rx_handler early so bond_handle_frame wouldn't be called |
1980 | * for this slave anymore. | 1981 | * for this slave anymore. |
1981 | */ | 1982 | */ |
1982 | netdev_rx_handler_unregister(slave_dev); | 1983 | netdev_rx_handler_unregister(slave_dev); |
1983 | write_unlock_bh(&bond->lock); | ||
1984 | synchronize_net(); | ||
1985 | write_lock_bh(&bond->lock); | 1984 | write_lock_bh(&bond->lock); |
1986 | 1985 | ||
1987 | if (!all && !bond->params.fail_over_mac) { | 1986 | if (!all && !bond->params.fail_over_mac) { |
@@ -4903,8 +4902,8 @@ static void __exit bonding_exit(void) | |||
4903 | 4902 | ||
4904 | bond_destroy_debugfs(); | 4903 | bond_destroy_debugfs(); |
4905 | 4904 | ||
4906 | rtnl_link_unregister(&bond_link_ops); | ||
4907 | unregister_pernet_subsys(&bond_net_ops); | 4905 | unregister_pernet_subsys(&bond_net_ops); |
4906 | rtnl_link_unregister(&bond_link_ops); | ||
4908 | 4907 | ||
4909 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4908 | #ifdef CONFIG_NET_POLL_CONTROLLER |
4910 | /* | 4909 | /* |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index db103e03ba05..ea7a388f4843 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -527,7 +527,7 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
527 | goto out; | 527 | goto out; |
528 | } | 528 | } |
529 | if (new_value < 0) { | 529 | if (new_value < 0) { |
530 | pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | 530 | pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", |
531 | bond->dev->name, new_value, INT_MAX); | 531 | bond->dev->name, new_value, INT_MAX); |
532 | ret = -EINVAL; | 532 | ret = -EINVAL; |
533 | goto out; | 533 | goto out; |
@@ -542,14 +542,15 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
542 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | 542 | pr_info("%s: Setting ARP monitoring interval to %d.\n", |
543 | bond->dev->name, new_value); | 543 | bond->dev->name, new_value); |
544 | bond->params.arp_interval = new_value; | 544 | bond->params.arp_interval = new_value; |
545 | if (bond->params.miimon) { | 545 | if (new_value) { |
546 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | 546 | if (bond->params.miimon) { |
547 | bond->dev->name, bond->dev->name); | 547 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", |
548 | bond->params.miimon = 0; | 548 | bond->dev->name, bond->dev->name); |
549 | } | 549 | bond->params.miimon = 0; |
550 | if (!bond->params.arp_targets[0]) { | 550 | } |
551 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | 551 | if (!bond->params.arp_targets[0]) |
552 | bond->dev->name); | 552 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", |
553 | bond->dev->name); | ||
553 | } | 554 | } |
554 | if (bond->dev->flags & IFF_UP) { | 555 | if (bond->dev->flags & IFF_UP) { |
555 | /* If the interface is up, we may need to fire off | 556 | /* If the interface is up, we may need to fire off |
@@ -557,10 +558,13 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
557 | * timer will get fired off when the open function | 558 | * timer will get fired off when the open function |
558 | * is called. | 559 | * is called. |
559 | */ | 560 | */ |
560 | cancel_delayed_work_sync(&bond->mii_work); | 561 | if (!new_value) { |
561 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | 562 | cancel_delayed_work_sync(&bond->arp_work); |
563 | } else { | ||
564 | cancel_delayed_work_sync(&bond->mii_work); | ||
565 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
566 | } | ||
562 | } | 567 | } |
563 | |||
564 | out: | 568 | out: |
565 | rtnl_unlock(); | 569 | rtnl_unlock(); |
566 | return ret; | 570 | return ret; |
@@ -702,7 +706,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
702 | } | 706 | } |
703 | if (new_value < 0) { | 707 | if (new_value < 0) { |
704 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 708 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", |
705 | bond->dev->name, new_value, 1, INT_MAX); | 709 | bond->dev->name, new_value, 0, INT_MAX); |
706 | ret = -EINVAL; | 710 | ret = -EINVAL; |
707 | goto out; | 711 | goto out; |
708 | } else { | 712 | } else { |
@@ -757,8 +761,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
757 | goto out; | 761 | goto out; |
758 | } | 762 | } |
759 | if (new_value < 0) { | 763 | if (new_value < 0) { |
760 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | 764 | pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", |
761 | bond->dev->name, new_value, 1, INT_MAX); | 765 | bond->dev->name, new_value, 0, INT_MAX); |
762 | ret = -EINVAL; | 766 | ret = -EINVAL; |
763 | goto out; | 767 | goto out; |
764 | } else { | 768 | } else { |
@@ -968,37 +972,37 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
968 | } | 972 | } |
969 | if (new_value < 0) { | 973 | if (new_value < 0) { |
970 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", | 974 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", |
971 | bond->dev->name, new_value, 1, INT_MAX); | 975 | bond->dev->name, new_value, 0, INT_MAX); |
972 | ret = -EINVAL; | 976 | ret = -EINVAL; |
973 | goto out; | 977 | goto out; |
974 | } else { | 978 | } |
975 | pr_info("%s: Setting MII monitoring interval to %d.\n", | 979 | pr_info("%s: Setting MII monitoring interval to %d.\n", |
976 | bond->dev->name, new_value); | 980 | bond->dev->name, new_value); |
977 | bond->params.miimon = new_value; | 981 | bond->params.miimon = new_value; |
978 | if (bond->params.updelay) | 982 | if (bond->params.updelay) |
979 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | 983 | pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", |
980 | bond->dev->name, | 984 | bond->dev->name, |
981 | bond->params.updelay * bond->params.miimon); | 985 | bond->params.updelay * bond->params.miimon); |
982 | if (bond->params.downdelay) | 986 | if (bond->params.downdelay) |
983 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | 987 | pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", |
984 | bond->dev->name, | 988 | bond->dev->name, |
985 | bond->params.downdelay * bond->params.miimon); | 989 | bond->params.downdelay * bond->params.miimon); |
986 | if (bond->params.arp_interval) { | 990 | if (new_value && bond->params.arp_interval) { |
987 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | 991 | pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", |
988 | bond->dev->name); | 992 | bond->dev->name); |
989 | bond->params.arp_interval = 0; | 993 | bond->params.arp_interval = 0; |
990 | if (bond->params.arp_validate) { | 994 | if (bond->params.arp_validate) |
991 | bond->params.arp_validate = | 995 | bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; |
992 | BOND_ARP_VALIDATE_NONE; | 996 | } |
993 | } | 997 | if (bond->dev->flags & IFF_UP) { |
994 | } | 998 | /* If the interface is up, we may need to fire off |
995 | 999 | * the MII timer. If the interface is down, the | |
996 | if (bond->dev->flags & IFF_UP) { | 1000 | * timer will get fired off when the open function |
997 | /* If the interface is up, we may need to fire off | 1001 | * is called. |
998 | * the MII timer. If the interface is down, the | 1002 | */ |
999 | * timer will get fired off when the open function | 1003 | if (!new_value) { |
1000 | * is called. | 1004 | cancel_delayed_work_sync(&bond->mii_work); |
1001 | */ | 1005 | } else { |
1002 | cancel_delayed_work_sync(&bond->arp_work); | 1006 | cancel_delayed_work_sync(&bond->arp_work); |
1003 | queue_delayed_work(bond->wq, &bond->mii_work, 0); | 1007 | queue_delayed_work(bond->wq, &bond->mii_work, 0); |
1004 | } | 1008 | } |
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig index b39ca5b3ea7f..ff2ba86cd4a4 100644 --- a/drivers/net/can/sja1000/Kconfig +++ b/drivers/net/can/sja1000/Kconfig | |||
@@ -46,6 +46,7 @@ config CAN_EMS_PCI | |||
46 | config CAN_PEAK_PCMCIA | 46 | config CAN_PEAK_PCMCIA |
47 | tristate "PEAK PCAN-PC Card" | 47 | tristate "PEAK PCAN-PC Card" |
48 | depends on PCMCIA | 48 | depends on PCMCIA |
49 | depends on HAS_IOPORT | ||
49 | ---help--- | 50 | ---help--- |
50 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) | 51 | This driver is for the PCAN-PC Card PCMCIA adapter (1 or 2 channels) |
51 | from PEAK-System (http://www.peak-system.com). To compile this | 52 | from PEAK-System (http://www.peak-system.com). To compile this |
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c index a042cdc260dc..3c18d7d000ed 100644 --- a/drivers/net/can/sja1000/plx_pci.c +++ b/drivers/net/can/sja1000/plx_pci.c | |||
@@ -348,7 +348,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
348 | */ | 348 | */ |
349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == | 349 | if ((priv->read_reg(priv, REG_CR) & REG_CR_BASICCAN_INITIAL_MASK) == |
350 | REG_CR_BASICCAN_INITIAL && | 350 | REG_CR_BASICCAN_INITIAL && |
351 | (priv->read_reg(priv, REG_SR) == REG_SR_BASICCAN_INITIAL) && | 351 | (priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_BASICCAN_INITIAL) && |
352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) | 352 | (priv->read_reg(priv, REG_IR) == REG_IR_BASICCAN_INITIAL)) |
353 | flag = 1; | 353 | flag = 1; |
354 | 354 | ||
@@ -360,7 +360,7 @@ static inline int plx_pci_check_sja1000(const struct sja1000_priv *priv) | |||
360 | * See states on p. 23 of the Datasheet. | 360 | * See states on p. 23 of the Datasheet. |
361 | */ | 361 | */ |
362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && | 362 | if (priv->read_reg(priv, REG_MOD) == REG_MOD_PELICAN_INITIAL && |
363 | priv->read_reg(priv, REG_SR) == REG_SR_PELICAN_INITIAL && | 363 | priv->read_reg(priv, SJA1000_REG_SR) == REG_SR_PELICAN_INITIAL && |
364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) | 364 | priv->read_reg(priv, REG_IR) == REG_IR_PELICAN_INITIAL) |
365 | return flag; | 365 | return flag; |
366 | 366 | ||
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index daf4013a8fc7..e4df307eaa90 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c | |||
@@ -92,7 +92,7 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val) | |||
92 | */ | 92 | */ |
93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); | 93 | spin_lock_irqsave(&priv->cmdreg_lock, flags); |
94 | priv->write_reg(priv, REG_CMR, val); | 94 | priv->write_reg(priv, REG_CMR, val); |
95 | priv->read_reg(priv, REG_SR); | 95 | priv->read_reg(priv, SJA1000_REG_SR); |
96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); | 96 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); |
97 | } | 97 | } |
98 | 98 | ||
@@ -502,7 +502,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
502 | 502 | ||
503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { | 503 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { |
504 | n++; | 504 | n++; |
505 | status = priv->read_reg(priv, REG_SR); | 505 | status = priv->read_reg(priv, SJA1000_REG_SR); |
506 | /* check for absent controller due to hw unplug */ | 506 | /* check for absent controller due to hw unplug */ |
507 | if (status == 0xFF && sja1000_is_absent(priv)) | 507 | if (status == 0xFF && sja1000_is_absent(priv)) |
508 | return IRQ_NONE; | 508 | return IRQ_NONE; |
@@ -530,7 +530,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) | |||
530 | /* receive interrupt */ | 530 | /* receive interrupt */ |
531 | while (status & SR_RBS) { | 531 | while (status & SR_RBS) { |
532 | sja1000_rx(dev); | 532 | sja1000_rx(dev); |
533 | status = priv->read_reg(priv, REG_SR); | 533 | status = priv->read_reg(priv, SJA1000_REG_SR); |
534 | /* check for absent controller */ | 534 | /* check for absent controller */ |
535 | if (status == 0xFF && sja1000_is_absent(priv)) | 535 | if (status == 0xFF && sja1000_is_absent(priv)) |
536 | return IRQ_NONE; | 536 | return IRQ_NONE; |
diff --git a/drivers/net/can/sja1000/sja1000.h b/drivers/net/can/sja1000/sja1000.h index afa99847a510..aa48e053da27 100644 --- a/drivers/net/can/sja1000/sja1000.h +++ b/drivers/net/can/sja1000/sja1000.h | |||
@@ -56,7 +56,7 @@ | |||
56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ | 56 | /* SJA1000 registers - manual section 6.4 (Pelican Mode) */ |
57 | #define REG_MOD 0x00 | 57 | #define REG_MOD 0x00 |
58 | #define REG_CMR 0x01 | 58 | #define REG_CMR 0x01 |
59 | #define REG_SR 0x02 | 59 | #define SJA1000_REG_SR 0x02 |
60 | #define REG_IR 0x03 | 60 | #define REG_IR 0x03 |
61 | #define REG_IER 0x04 | 61 | #define REG_IER 0x04 |
62 | #define REG_ALC 0x0B | 62 | #define REG_ALC 0x0B |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h index 829b5ad71d0d..b5fd934585e9 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e.h +++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h | |||
@@ -186,7 +186,7 @@ struct atl1e_tpd_desc { | |||
186 | /* how about 0x2000 */ | 186 | /* how about 0x2000 */ |
187 | #define MAX_TX_BUF_LEN 0x2000 | 187 | #define MAX_TX_BUF_LEN 0x2000 |
188 | #define MAX_TX_BUF_SHIFT 13 | 188 | #define MAX_TX_BUF_SHIFT 13 |
189 | /*#define MAX_TX_BUF_LEN 0x3000 */ | 189 | #define MAX_TSO_SEG_SIZE 0x3c00 |
190 | 190 | ||
191 | /* rrs word 1 bit 0:31 */ | 191 | /* rrs word 1 bit 0:31 */ |
192 | #define RRS_RX_CSUM_MASK 0xFFFF | 192 | #define RRS_RX_CSUM_MASK 0xFFFF |
@@ -438,7 +438,6 @@ struct atl1e_adapter { | |||
438 | struct atl1e_hw hw; | 438 | struct atl1e_hw hw; |
439 | struct atl1e_hw_stats hw_stats; | 439 | struct atl1e_hw_stats hw_stats; |
440 | 440 | ||
441 | bool have_msi; | ||
442 | u32 wol; | 441 | u32 wol; |
443 | u16 link_speed; | 442 | u16 link_speed; |
444 | u16 link_duplex; | 443 | u16 link_duplex; |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index 92f4734f860d..ac25f05ff68f 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -1849,34 +1849,19 @@ static void atl1e_free_irq(struct atl1e_adapter *adapter) | |||
1849 | struct net_device *netdev = adapter->netdev; | 1849 | struct net_device *netdev = adapter->netdev; |
1850 | 1850 | ||
1851 | free_irq(adapter->pdev->irq, netdev); | 1851 | free_irq(adapter->pdev->irq, netdev); |
1852 | |||
1853 | if (adapter->have_msi) | ||
1854 | pci_disable_msi(adapter->pdev); | ||
1855 | } | 1852 | } |
1856 | 1853 | ||
1857 | static int atl1e_request_irq(struct atl1e_adapter *adapter) | 1854 | static int atl1e_request_irq(struct atl1e_adapter *adapter) |
1858 | { | 1855 | { |
1859 | struct pci_dev *pdev = adapter->pdev; | 1856 | struct pci_dev *pdev = adapter->pdev; |
1860 | struct net_device *netdev = adapter->netdev; | 1857 | struct net_device *netdev = adapter->netdev; |
1861 | int flags = 0; | ||
1862 | int err = 0; | 1858 | int err = 0; |
1863 | 1859 | ||
1864 | adapter->have_msi = true; | 1860 | err = request_irq(pdev->irq, atl1e_intr, IRQF_SHARED, netdev->name, |
1865 | err = pci_enable_msi(pdev); | 1861 | netdev); |
1866 | if (err) { | ||
1867 | netdev_dbg(netdev, | ||
1868 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
1869 | adapter->have_msi = false; | ||
1870 | } | ||
1871 | |||
1872 | if (!adapter->have_msi) | ||
1873 | flags |= IRQF_SHARED; | ||
1874 | err = request_irq(pdev->irq, atl1e_intr, flags, netdev->name, netdev); | ||
1875 | if (err) { | 1862 | if (err) { |
1876 | netdev_dbg(adapter->netdev, | 1863 | netdev_dbg(adapter->netdev, |
1877 | "Unable to allocate interrupt Error: %d\n", err); | 1864 | "Unable to allocate interrupt Error: %d\n", err); |
1878 | if (adapter->have_msi) | ||
1879 | pci_disable_msi(pdev); | ||
1880 | return err; | 1865 | return err; |
1881 | } | 1866 | } |
1882 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); | 1867 | netdev_dbg(netdev, "atl1e_request_irq OK\n"); |
@@ -2344,6 +2329,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2344 | 2329 | ||
2345 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); | 2330 | INIT_WORK(&adapter->reset_task, atl1e_reset_task); |
2346 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); | 2331 | INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); |
2332 | netif_set_gso_max_size(netdev, MAX_TSO_SEG_SIZE); | ||
2347 | err = register_netdev(netdev); | 2333 | err = register_netdev(netdev); |
2348 | if (err) { | 2334 | if (err) { |
2349 | netdev_err(netdev, "register netdevice failed\n"); | 2335 | netdev_err(netdev, "register netdevice failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 67d2663b3974..17a972734ba7 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -14604,8 +14604,11 @@ static void tg3_read_vpd(struct tg3 *tp) | |||
14604 | if (j + len > block_end) | 14604 | if (j + len > block_end) |
14605 | goto partno; | 14605 | goto partno; |
14606 | 14606 | ||
14607 | memcpy(tp->fw_ver, &vpd_data[j], len); | 14607 | if (len >= sizeof(tp->fw_ver)) |
14608 | strncat(tp->fw_ver, " bc ", vpdlen - len - 1); | 14608 | len = sizeof(tp->fw_ver) - 1; |
14609 | memset(tp->fw_ver, 0, sizeof(tp->fw_ver)); | ||
14610 | snprintf(tp->fw_ver, sizeof(tp->fw_ver), "%.*s bc ", len, | ||
14611 | &vpd_data[j]); | ||
14609 | } | 14612 | } |
14610 | 14613 | ||
14611 | partno: | 14614 | partno: |
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index a170065b5973..b0ebc9f6d55e 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -163,6 +163,7 @@ | |||
163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ | 163 | #define XGMAC_FLOW_CTRL_FCB_BPA 0x00000001 /* Flow Control Busy ... */ |
164 | 164 | ||
165 | /* XGMAC_INT_STAT reg */ | 165 | /* XGMAC_INT_STAT reg */ |
166 | #define XGMAC_INT_STAT_PMTIM 0x00800000 /* PMT Interrupt Mask */ | ||
166 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ | 167 | #define XGMAC_INT_STAT_PMT 0x0080 /* PMT Interrupt Status */ |
167 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ | 168 | #define XGMAC_INT_STAT_LPI 0x0040 /* LPI Interrupt Status */ |
168 | 169 | ||
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev) | |||
960 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); | 961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS); |
961 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); | 962 | writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA); |
962 | 963 | ||
964 | /* Mask power mgt interrupt */ | ||
965 | writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT); | ||
966 | |||
963 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ | 967 | /* XGMAC requires AXI bus init. This is a 'magic number' for now */ |
964 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); | 968 | writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS); |
965 | 969 | ||
@@ -1141,6 +1145,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit) | |||
1141 | struct sk_buff *skb; | 1145 | struct sk_buff *skb; |
1142 | int frame_len; | 1146 | int frame_len; |
1143 | 1147 | ||
1148 | if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ)) | ||
1149 | break; | ||
1150 | |||
1144 | entry = priv->rx_tail; | 1151 | entry = priv->rx_tail; |
1145 | p = priv->dma_rx + entry; | 1152 | p = priv->dma_rx + entry; |
1146 | if (desc_get_owner(p)) | 1153 | if (desc_get_owner(p)) |
@@ -1825,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode) | |||
1825 | unsigned int pmt = 0; | 1832 | unsigned int pmt = 0; |
1826 | 1833 | ||
1827 | if (mode & WAKE_MAGIC) | 1834 | if (mode & WAKE_MAGIC) |
1828 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT; | 1835 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN; |
1829 | if (mode & WAKE_UCAST) | 1836 | if (mode & WAKE_UCAST) |
1830 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; | 1837 | pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST; |
1831 | 1838 | ||
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 8cdf02503d13..9eada8e86078 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -257,6 +257,107 @@ static void dm9000_dumpblk_32bit(void __iomem *reg, int count) | |||
257 | tmp = readl(reg); | 257 | tmp = readl(reg); |
258 | } | 258 | } |
259 | 259 | ||
260 | /* | ||
261 | * Sleep, either by using msleep() or if we are suspending, then | ||
262 | * use mdelay() to sleep. | ||
263 | */ | ||
264 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
265 | { | ||
266 | if (db->in_suspend) | ||
267 | mdelay(ms); | ||
268 | else | ||
269 | msleep(ms); | ||
270 | } | ||
271 | |||
272 | /* Read a word from phyxcer */ | ||
273 | static int | ||
274 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
275 | { | ||
276 | board_info_t *db = netdev_priv(dev); | ||
277 | unsigned long flags; | ||
278 | unsigned int reg_save; | ||
279 | int ret; | ||
280 | |||
281 | mutex_lock(&db->addr_lock); | ||
282 | |||
283 | spin_lock_irqsave(&db->lock, flags); | ||
284 | |||
285 | /* Save previous register address */ | ||
286 | reg_save = readb(db->io_addr); | ||
287 | |||
288 | /* Fill the phyxcer register into REG_0C */ | ||
289 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
290 | |||
291 | /* Issue phyxcer read command */ | ||
292 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); | ||
293 | |||
294 | writeb(reg_save, db->io_addr); | ||
295 | spin_unlock_irqrestore(&db->lock, flags); | ||
296 | |||
297 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
298 | |||
299 | spin_lock_irqsave(&db->lock, flags); | ||
300 | reg_save = readb(db->io_addr); | ||
301 | |||
302 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
303 | |||
304 | /* The read data keeps on REG_0D & REG_0E */ | ||
305 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
306 | |||
307 | /* restore the previous address */ | ||
308 | writeb(reg_save, db->io_addr); | ||
309 | spin_unlock_irqrestore(&db->lock, flags); | ||
310 | |||
311 | mutex_unlock(&db->addr_lock); | ||
312 | |||
313 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
314 | return ret; | ||
315 | } | ||
316 | |||
317 | /* Write a word to phyxcer */ | ||
318 | static void | ||
319 | dm9000_phy_write(struct net_device *dev, | ||
320 | int phyaddr_unused, int reg, int value) | ||
321 | { | ||
322 | board_info_t *db = netdev_priv(dev); | ||
323 | unsigned long flags; | ||
324 | unsigned long reg_save; | ||
325 | |||
326 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
327 | mutex_lock(&db->addr_lock); | ||
328 | |||
329 | spin_lock_irqsave(&db->lock, flags); | ||
330 | |||
331 | /* Save previous register address */ | ||
332 | reg_save = readb(db->io_addr); | ||
333 | |||
334 | /* Fill the phyxcer register into REG_0C */ | ||
335 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
336 | |||
337 | /* Fill the written data into REG_0D & REG_0E */ | ||
338 | iow(db, DM9000_EPDRL, value); | ||
339 | iow(db, DM9000_EPDRH, value >> 8); | ||
340 | |||
341 | /* Issue phyxcer write command */ | ||
342 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); | ||
343 | |||
344 | writeb(reg_save, db->io_addr); | ||
345 | spin_unlock_irqrestore(&db->lock, flags); | ||
346 | |||
347 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
348 | |||
349 | spin_lock_irqsave(&db->lock, flags); | ||
350 | reg_save = readb(db->io_addr); | ||
351 | |||
352 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
353 | |||
354 | /* restore the previous address */ | ||
355 | writeb(reg_save, db->io_addr); | ||
356 | |||
357 | spin_unlock_irqrestore(&db->lock, flags); | ||
358 | mutex_unlock(&db->addr_lock); | ||
359 | } | ||
360 | |||
260 | /* dm9000_set_io | 361 | /* dm9000_set_io |
261 | * | 362 | * |
262 | * select the specified set of io routines to use with the | 363 | * select the specified set of io routines to use with the |
@@ -795,6 +896,9 @@ dm9000_init_dm9000(struct net_device *dev) | |||
795 | 896 | ||
796 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ | 897 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ |
797 | 898 | ||
899 | dm9000_phy_write(dev, 0, MII_BMCR, BMCR_RESET); /* PHY RESET */ | ||
900 | dm9000_phy_write(dev, 0, MII_DM_DSPCR, DSPCR_INIT_PARAM); /* Init */ | ||
901 | |||
798 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; | 902 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; |
799 | 903 | ||
800 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end | 904 | /* if wol is needed, then always set NCR_WAKEEN otherwise we end |
@@ -1201,109 +1305,6 @@ dm9000_open(struct net_device *dev) | |||
1201 | return 0; | 1305 | return 0; |
1202 | } | 1306 | } |
1203 | 1307 | ||
1204 | /* | ||
1205 | * Sleep, either by using msleep() or if we are suspending, then | ||
1206 | * use mdelay() to sleep. | ||
1207 | */ | ||
1208 | static void dm9000_msleep(board_info_t *db, unsigned int ms) | ||
1209 | { | ||
1210 | if (db->in_suspend) | ||
1211 | mdelay(ms); | ||
1212 | else | ||
1213 | msleep(ms); | ||
1214 | } | ||
1215 | |||
1216 | /* | ||
1217 | * Read a word from phyxcer | ||
1218 | */ | ||
1219 | static int | ||
1220 | dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg) | ||
1221 | { | ||
1222 | board_info_t *db = netdev_priv(dev); | ||
1223 | unsigned long flags; | ||
1224 | unsigned int reg_save; | ||
1225 | int ret; | ||
1226 | |||
1227 | mutex_lock(&db->addr_lock); | ||
1228 | |||
1229 | spin_lock_irqsave(&db->lock,flags); | ||
1230 | |||
1231 | /* Save previous register address */ | ||
1232 | reg_save = readb(db->io_addr); | ||
1233 | |||
1234 | /* Fill the phyxcer register into REG_0C */ | ||
1235 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1236 | |||
1237 | iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); /* Issue phyxcer read command */ | ||
1238 | |||
1239 | writeb(reg_save, db->io_addr); | ||
1240 | spin_unlock_irqrestore(&db->lock,flags); | ||
1241 | |||
1242 | dm9000_msleep(db, 1); /* Wait read complete */ | ||
1243 | |||
1244 | spin_lock_irqsave(&db->lock,flags); | ||
1245 | reg_save = readb(db->io_addr); | ||
1246 | |||
1247 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ | ||
1248 | |||
1249 | /* The read data keeps on REG_0D & REG_0E */ | ||
1250 | ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); | ||
1251 | |||
1252 | /* restore the previous address */ | ||
1253 | writeb(reg_save, db->io_addr); | ||
1254 | spin_unlock_irqrestore(&db->lock,flags); | ||
1255 | |||
1256 | mutex_unlock(&db->addr_lock); | ||
1257 | |||
1258 | dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); | ||
1259 | return ret; | ||
1260 | } | ||
1261 | |||
1262 | /* | ||
1263 | * Write a word to phyxcer | ||
1264 | */ | ||
1265 | static void | ||
1266 | dm9000_phy_write(struct net_device *dev, | ||
1267 | int phyaddr_unused, int reg, int value) | ||
1268 | { | ||
1269 | board_info_t *db = netdev_priv(dev); | ||
1270 | unsigned long flags; | ||
1271 | unsigned long reg_save; | ||
1272 | |||
1273 | dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); | ||
1274 | mutex_lock(&db->addr_lock); | ||
1275 | |||
1276 | spin_lock_irqsave(&db->lock,flags); | ||
1277 | |||
1278 | /* Save previous register address */ | ||
1279 | reg_save = readb(db->io_addr); | ||
1280 | |||
1281 | /* Fill the phyxcer register into REG_0C */ | ||
1282 | iow(db, DM9000_EPAR, DM9000_PHY | reg); | ||
1283 | |||
1284 | /* Fill the written data into REG_0D & REG_0E */ | ||
1285 | iow(db, DM9000_EPDRL, value); | ||
1286 | iow(db, DM9000_EPDRH, value >> 8); | ||
1287 | |||
1288 | iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); /* Issue phyxcer write command */ | ||
1289 | |||
1290 | writeb(reg_save, db->io_addr); | ||
1291 | spin_unlock_irqrestore(&db->lock, flags); | ||
1292 | |||
1293 | dm9000_msleep(db, 1); /* Wait write complete */ | ||
1294 | |||
1295 | spin_lock_irqsave(&db->lock,flags); | ||
1296 | reg_save = readb(db->io_addr); | ||
1297 | |||
1298 | iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ | ||
1299 | |||
1300 | /* restore the previous address */ | ||
1301 | writeb(reg_save, db->io_addr); | ||
1302 | |||
1303 | spin_unlock_irqrestore(&db->lock, flags); | ||
1304 | mutex_unlock(&db->addr_lock); | ||
1305 | } | ||
1306 | |||
1307 | static void | 1308 | static void |
1308 | dm9000_shutdown(struct net_device *dev) | 1309 | dm9000_shutdown(struct net_device *dev) |
1309 | { | 1310 | { |
@@ -1502,7 +1503,12 @@ dm9000_probe(struct platform_device *pdev) | |||
1502 | db->flags |= DM9000_PLATF_SIMPLE_PHY; | 1503 | db->flags |= DM9000_PLATF_SIMPLE_PHY; |
1503 | #endif | 1504 | #endif |
1504 | 1505 | ||
1505 | dm9000_reset(db); | 1506 | /* Fixing bug on dm9000_probe, takeover dm9000_reset(db), |
1507 | * Need 'NCR_MAC_LBK' bit to indeed stable our DM9000 fifo | ||
1508 | * while probe stage. | ||
1509 | */ | ||
1510 | |||
1511 | iow(db, DM9000_NCR, NCR_MAC_LBK | NCR_RST); | ||
1506 | 1512 | ||
1507 | /* try multiple times, DM9000 sometimes gets the read wrong */ | 1513 | /* try multiple times, DM9000 sometimes gets the read wrong */ |
1508 | for (i = 0; i < 8; i++) { | 1514 | for (i = 0; i < 8; i++) { |
diff --git a/drivers/net/ethernet/davicom/dm9000.h b/drivers/net/ethernet/davicom/dm9000.h index 55688bd1a3ef..9ce058adabab 100644 --- a/drivers/net/ethernet/davicom/dm9000.h +++ b/drivers/net/ethernet/davicom/dm9000.h | |||
@@ -69,7 +69,9 @@ | |||
69 | #define NCR_WAKEEN (1<<6) | 69 | #define NCR_WAKEEN (1<<6) |
70 | #define NCR_FCOL (1<<4) | 70 | #define NCR_FCOL (1<<4) |
71 | #define NCR_FDX (1<<3) | 71 | #define NCR_FDX (1<<3) |
72 | #define NCR_LBK (3<<1) | 72 | |
73 | #define NCR_RESERVED (3<<1) | ||
74 | #define NCR_MAC_LBK (1<<1) | ||
73 | #define NCR_RST (1<<0) | 75 | #define NCR_RST (1<<0) |
74 | 76 | ||
75 | #define NSR_SPEED (1<<7) | 77 | #define NSR_SPEED (1<<7) |
@@ -167,5 +169,12 @@ | |||
167 | #define ISR_LNKCHNG (1<<5) | 169 | #define ISR_LNKCHNG (1<<5) |
168 | #define ISR_UNDERRUN (1<<4) | 170 | #define ISR_UNDERRUN (1<<4) |
169 | 171 | ||
172 | /* Davicom MII registers. | ||
173 | */ | ||
174 | |||
175 | #define MII_DM_DSPCR 0x1b /* DSP Control Register */ | ||
176 | |||
177 | #define DSPCR_INIT_PARAM 0xE100 /* DSP init parameter */ | ||
178 | |||
170 | #endif /* _DM9000X_H_ */ | 179 | #endif /* _DM9000X_H_ */ |
171 | 180 | ||
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 911d0253dbb2..f292c3aa423f 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -345,6 +345,53 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
345 | return NETDEV_TX_OK; | 345 | return NETDEV_TX_OK; |
346 | } | 346 | } |
347 | 347 | ||
348 | /* Init RX & TX buffer descriptors | ||
349 | */ | ||
350 | static void fec_enet_bd_init(struct net_device *dev) | ||
351 | { | ||
352 | struct fec_enet_private *fep = netdev_priv(dev); | ||
353 | struct bufdesc *bdp; | ||
354 | unsigned int i; | ||
355 | |||
356 | /* Initialize the receive buffer descriptors. */ | ||
357 | bdp = fep->rx_bd_base; | ||
358 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
359 | |||
360 | /* Initialize the BD for every fragment in the page. */ | ||
361 | if (bdp->cbd_bufaddr) | ||
362 | bdp->cbd_sc = BD_ENET_RX_EMPTY; | ||
363 | else | ||
364 | bdp->cbd_sc = 0; | ||
365 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
366 | } | ||
367 | |||
368 | /* Set the last buffer to wrap */ | ||
369 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
370 | bdp->cbd_sc |= BD_SC_WRAP; | ||
371 | |||
372 | fep->cur_rx = fep->rx_bd_base; | ||
373 | |||
374 | /* ...and the same for transmit */ | ||
375 | bdp = fep->tx_bd_base; | ||
376 | fep->cur_tx = bdp; | ||
377 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
378 | |||
379 | /* Initialize the BD for every fragment in the page. */ | ||
380 | bdp->cbd_sc = 0; | ||
381 | if (bdp->cbd_bufaddr && fep->tx_skbuff[i]) { | ||
382 | dev_kfree_skb_any(fep->tx_skbuff[i]); | ||
383 | fep->tx_skbuff[i] = NULL; | ||
384 | } | ||
385 | bdp->cbd_bufaddr = 0; | ||
386 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
387 | } | ||
388 | |||
389 | /* Set the last buffer to wrap */ | ||
390 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
391 | bdp->cbd_sc |= BD_SC_WRAP; | ||
392 | fep->dirty_tx = bdp; | ||
393 | } | ||
394 | |||
348 | /* This function is called to start or restart the FEC during a link | 395 | /* This function is called to start or restart the FEC during a link |
349 | * change. This only happens when switching between half and full | 396 | * change. This only happens when switching between half and full |
350 | * duplex. | 397 | * duplex. |
@@ -388,6 +435,8 @@ fec_restart(struct net_device *ndev, int duplex) | |||
388 | /* Set maximum receive buffer size. */ | 435 | /* Set maximum receive buffer size. */ |
389 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); | 436 | writel(PKT_MAXBLR_SIZE, fep->hwp + FEC_R_BUFF_SIZE); |
390 | 437 | ||
438 | fec_enet_bd_init(ndev); | ||
439 | |||
391 | /* Set receive and transmit descriptor base. */ | 440 | /* Set receive and transmit descriptor base. */ |
392 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); | 441 | writel(fep->bd_dma, fep->hwp + FEC_R_DES_START); |
393 | if (fep->bufdesc_ex) | 442 | if (fep->bufdesc_ex) |
@@ -397,7 +446,6 @@ fec_restart(struct net_device *ndev, int duplex) | |||
397 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) | 446 | writel((unsigned long)fep->bd_dma + sizeof(struct bufdesc) |
398 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); | 447 | * RX_RING_SIZE, fep->hwp + FEC_X_DES_START); |
399 | 448 | ||
400 | fep->cur_rx = fep->rx_bd_base; | ||
401 | 449 | ||
402 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { | 450 | for (i = 0; i <= TX_RING_MOD_MASK; i++) { |
403 | if (fep->tx_skbuff[i]) { | 451 | if (fep->tx_skbuff[i]) { |
@@ -1597,8 +1645,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1597 | { | 1645 | { |
1598 | struct fec_enet_private *fep = netdev_priv(ndev); | 1646 | struct fec_enet_private *fep = netdev_priv(ndev); |
1599 | struct bufdesc *cbd_base; | 1647 | struct bufdesc *cbd_base; |
1600 | struct bufdesc *bdp; | ||
1601 | unsigned int i; | ||
1602 | 1648 | ||
1603 | /* Allocate memory for buffer descriptors. */ | 1649 | /* Allocate memory for buffer descriptors. */ |
1604 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, | 1650 | cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, |
@@ -1608,6 +1654,7 @@ static int fec_enet_init(struct net_device *ndev) | |||
1608 | return -ENOMEM; | 1654 | return -ENOMEM; |
1609 | } | 1655 | } |
1610 | 1656 | ||
1657 | memset(cbd_base, 0, PAGE_SIZE); | ||
1611 | spin_lock_init(&fep->hw_lock); | 1658 | spin_lock_init(&fep->hw_lock); |
1612 | 1659 | ||
1613 | fep->netdev = ndev; | 1660 | fep->netdev = ndev; |
@@ -1631,35 +1678,6 @@ static int fec_enet_init(struct net_device *ndev) | |||
1631 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); | 1678 | writel(FEC_RX_DISABLED_IMASK, fep->hwp + FEC_IMASK); |
1632 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); | 1679 | netif_napi_add(ndev, &fep->napi, fec_enet_rx_napi, FEC_NAPI_WEIGHT); |
1633 | 1680 | ||
1634 | /* Initialize the receive buffer descriptors. */ | ||
1635 | bdp = fep->rx_bd_base; | ||
1636 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
1637 | |||
1638 | /* Initialize the BD for every fragment in the page. */ | ||
1639 | bdp->cbd_sc = 0; | ||
1640 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1641 | } | ||
1642 | |||
1643 | /* Set the last buffer to wrap */ | ||
1644 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1645 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1646 | |||
1647 | /* ...and the same for transmit */ | ||
1648 | bdp = fep->tx_bd_base; | ||
1649 | fep->cur_tx = bdp; | ||
1650 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1651 | |||
1652 | /* Initialize the BD for every fragment in the page. */ | ||
1653 | bdp->cbd_sc = 0; | ||
1654 | bdp->cbd_bufaddr = 0; | ||
1655 | bdp = fec_enet_get_nextdesc(bdp, fep->bufdesc_ex); | ||
1656 | } | ||
1657 | |||
1658 | /* Set the last buffer to wrap */ | ||
1659 | bdp = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
1660 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1661 | fep->dirty_tx = bdp; | ||
1662 | |||
1663 | fec_restart(ndev, 0); | 1681 | fec_restart(ndev, 0); |
1664 | 1682 | ||
1665 | return 0; | 1683 | return 0; |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index 43462d596a4e..ffd287196bf8 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -1053,6 +1053,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1053 | txdr->buffer_info[i].dma = | 1053 | txdr->buffer_info[i].dma = |
1054 | dma_map_single(&pdev->dev, skb->data, skb->len, | 1054 | dma_map_single(&pdev->dev, skb->data, skb->len, |
1055 | DMA_TO_DEVICE); | 1055 | DMA_TO_DEVICE); |
1056 | if (dma_mapping_error(&pdev->dev, txdr->buffer_info[i].dma)) { | ||
1057 | ret_val = 4; | ||
1058 | goto err_nomem; | ||
1059 | } | ||
1056 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); | 1060 | tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); |
1057 | tx_desc->lower.data = cpu_to_le32(skb->len); | 1061 | tx_desc->lower.data = cpu_to_le32(skb->len); |
1058 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | | 1062 | tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | |
@@ -1069,7 +1073,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1069 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), | 1073 | rxdr->buffer_info = kcalloc(rxdr->count, sizeof(struct e1000_buffer), |
1070 | GFP_KERNEL); | 1074 | GFP_KERNEL); |
1071 | if (!rxdr->buffer_info) { | 1075 | if (!rxdr->buffer_info) { |
1072 | ret_val = 4; | 1076 | ret_val = 5; |
1073 | goto err_nomem; | 1077 | goto err_nomem; |
1074 | } | 1078 | } |
1075 | 1079 | ||
@@ -1077,7 +1081,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1077 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, | 1081 | rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma, |
1078 | GFP_KERNEL); | 1082 | GFP_KERNEL); |
1079 | if (!rxdr->desc) { | 1083 | if (!rxdr->desc) { |
1080 | ret_val = 5; | 1084 | ret_val = 6; |
1081 | goto err_nomem; | 1085 | goto err_nomem; |
1082 | } | 1086 | } |
1083 | memset(rxdr->desc, 0, rxdr->size); | 1087 | memset(rxdr->desc, 0, rxdr->size); |
@@ -1101,7 +1105,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1101 | 1105 | ||
1102 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); | 1106 | skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, GFP_KERNEL); |
1103 | if (!skb) { | 1107 | if (!skb) { |
1104 | ret_val = 6; | 1108 | ret_val = 7; |
1105 | goto err_nomem; | 1109 | goto err_nomem; |
1106 | } | 1110 | } |
1107 | skb_reserve(skb, NET_IP_ALIGN); | 1111 | skb_reserve(skb, NET_IP_ALIGN); |
@@ -1110,6 +1114,10 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter) | |||
1110 | rxdr->buffer_info[i].dma = | 1114 | rxdr->buffer_info[i].dma = |
1111 | dma_map_single(&pdev->dev, skb->data, | 1115 | dma_map_single(&pdev->dev, skb->data, |
1112 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); | 1116 | E1000_RXBUFFER_2048, DMA_FROM_DEVICE); |
1117 | if (dma_mapping_error(&pdev->dev, rxdr->buffer_info[i].dma)) { | ||
1118 | ret_val = 8; | ||
1119 | goto err_nomem; | ||
1120 | } | ||
1113 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); | 1121 | rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); |
1114 | memset(skb->data, 0x00, skb->len); | 1122 | memset(skb->data, 0x00, skb->len); |
1115 | } | 1123 | } |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 948b86ffa4f0..7e615e2bf7e6 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -848,11 +848,16 @@ check_page: | |||
848 | } | 848 | } |
849 | } | 849 | } |
850 | 850 | ||
851 | if (!buffer_info->dma) | 851 | if (!buffer_info->dma) { |
852 | buffer_info->dma = dma_map_page(&pdev->dev, | 852 | buffer_info->dma = dma_map_page(&pdev->dev, |
853 | buffer_info->page, 0, | 853 | buffer_info->page, 0, |
854 | PAGE_SIZE, | 854 | PAGE_SIZE, |
855 | DMA_FROM_DEVICE); | 855 | DMA_FROM_DEVICE); |
856 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
857 | adapter->alloc_rx_buff_failed++; | ||
858 | break; | ||
859 | } | ||
860 | } | ||
856 | 861 | ||
857 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); | 862 | rx_desc = E1000_RX_DESC_EXT(*rx_ring, i); |
858 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); | 863 | rx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma); |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index ea4808373435..b5f94abe3cff 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -2159,6 +2159,10 @@ map_skb: | |||
2159 | skb->data, | 2159 | skb->data, |
2160 | adapter->rx_buffer_len, | 2160 | adapter->rx_buffer_len, |
2161 | DMA_FROM_DEVICE); | 2161 | DMA_FROM_DEVICE); |
2162 | if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { | ||
2163 | adapter->alloc_rx_buff_failed++; | ||
2164 | break; | ||
2165 | } | ||
2162 | 2166 | ||
2163 | rx_desc = IXGB_RX_DESC(*rx_ring, i); | 2167 | rx_desc = IXGB_RX_DESC(*rx_ring, i); |
2164 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); | 2168 | rx_desc->buff_addr = cpu_to_le64(buffer_info->dma); |
@@ -2168,7 +2172,8 @@ map_skb: | |||
2168 | rx_desc->status = 0; | 2172 | rx_desc->status = 0; |
2169 | 2173 | ||
2170 | 2174 | ||
2171 | if (++i == rx_ring->count) i = 0; | 2175 | if (++i == rx_ring->count) |
2176 | i = 0; | ||
2172 | buffer_info = &rx_ring->buffer_info[i]; | 2177 | buffer_info = &rx_ring->buffer_info[i]; |
2173 | } | 2178 | } |
2174 | 2179 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index db5611ae407e..79f4a26ea6cc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7922,12 +7922,19 @@ static int __init ixgbe_init_module(void) | |||
7922 | ixgbe_dbg_init(); | 7922 | ixgbe_dbg_init(); |
7923 | #endif /* CONFIG_DEBUG_FS */ | 7923 | #endif /* CONFIG_DEBUG_FS */ |
7924 | 7924 | ||
7925 | ret = pci_register_driver(&ixgbe_driver); | ||
7926 | if (ret) { | ||
7927 | #ifdef CONFIG_DEBUG_FS | ||
7928 | ixgbe_dbg_exit(); | ||
7929 | #endif /* CONFIG_DEBUG_FS */ | ||
7930 | return ret; | ||
7931 | } | ||
7932 | |||
7925 | #ifdef CONFIG_IXGBE_DCA | 7933 | #ifdef CONFIG_IXGBE_DCA |
7926 | dca_register_notify(&dca_notifier); | 7934 | dca_register_notify(&dca_notifier); |
7927 | #endif | 7935 | #endif |
7928 | 7936 | ||
7929 | ret = pci_register_driver(&ixgbe_driver); | 7937 | return 0; |
7930 | return ret; | ||
7931 | } | 7938 | } |
7932 | 7939 | ||
7933 | module_init(ixgbe_init_module); | 7940 | module_init(ixgbe_init_module); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index fc07ca35721b..6a0e671fcecd 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -1067,7 +1067,7 @@ static void sky2_ramset(struct sky2_hw *hw, u16 q, u32 start, u32 space) | |||
1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); | 1067 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTHP), tp); |
1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); | 1068 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTHP), space/2); |
1069 | 1069 | ||
1070 | tp = space - 2048/8; | 1070 | tp = space - 8192/8; |
1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); | 1071 | sky2_write32(hw, RB_ADDR(q, RB_RX_UTPP), tp); |
1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); | 1072 | sky2_write32(hw, RB_ADDR(q, RB_RX_LTPP), space/4); |
1073 | } else { | 1073 | } else { |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index 615ac63ea860..ec6dcd80152b 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
@@ -2074,7 +2074,7 @@ enum { | |||
2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ | 2074 | GM_IS_RX_FF_OR = 1<<1, /* Receive FIFO Overrun */ |
2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ | 2075 | GM_IS_RX_COMPL = 1<<0, /* Frame Reception Complete */ |
2076 | 2076 | ||
2077 | #define GMAC_DEF_MSK GM_IS_TX_FF_UR | 2077 | #define GMAC_DEF_MSK (GM_IS_TX_FF_UR | GM_IS_RX_FF_OR) |
2078 | }; | 2078 | }; |
2079 | 2079 | ||
2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ | 2080 | /* GMAC_LINK_CTRL 16 bit GMAC Link Control Reg (YUKON only) */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f278b10ef714..30d78f806dc3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -411,8 +411,8 @@ static int mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) | |||
411 | 411 | ||
412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) | 412 | static void mlx4_en_u64_to_mac(unsigned char dst_mac[ETH_ALEN + 2], u64 src_mac) |
413 | { | 413 | { |
414 | unsigned int i; | 414 | int i; |
415 | for (i = ETH_ALEN - 1; i; --i) { | 415 | for (i = ETH_ALEN - 1; i >= 0; --i) { |
416 | dst_mac[i] = src_mac & 0xff; | 416 | dst_mac[i] = src_mac & 0xff; |
417 | src_mac >>= 8; | 417 | src_mac >>= 8; |
418 | } | 418 | } |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index 33bcb63d56a2..8fb481252e2c 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -528,7 +528,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) | |||
528 | for (; rxfc != 0; rxfc--) { | 528 | for (; rxfc != 0; rxfc--) { |
529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); | 529 | rxh = ks8851_rdreg32(ks, KS_RXFHSR); |
530 | rxstat = rxh & 0xffff; | 530 | rxstat = rxh & 0xffff; |
531 | rxlen = rxh >> 16; | 531 | rxlen = (rxh >> 16) & 0xfff; |
532 | 532 | ||
533 | netif_dbg(ks, rx_status, ks->netdev, | 533 | netif_dbg(ks, rx_status, ks->netdev, |
534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); | 534 | "rx: stat 0x%04x, len 0x%04x\n", rxstat, rxlen); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 28fb50a1e9c3..4ecbe64a758d 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3818,6 +3818,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp) | |||
3818 | } | 3818 | } |
3819 | } | 3819 | } |
3820 | 3820 | ||
3821 | static void rtl_speed_down(struct rtl8169_private *tp) | ||
3822 | { | ||
3823 | u32 adv; | ||
3824 | int lpa; | ||
3825 | |||
3826 | rtl_writephy(tp, 0x1f, 0x0000); | ||
3827 | lpa = rtl_readphy(tp, MII_LPA); | ||
3828 | |||
3829 | if (lpa & (LPA_10HALF | LPA_10FULL)) | ||
3830 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full; | ||
3831 | else if (lpa & (LPA_100HALF | LPA_100FULL)) | ||
3832 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3833 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; | ||
3834 | else | ||
3835 | adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | | ||
3836 | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full | | ||
3837 | (tp->mii.supports_gmii ? | ||
3838 | ADVERTISED_1000baseT_Half | | ||
3839 | ADVERTISED_1000baseT_Full : 0); | ||
3840 | |||
3841 | rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL, | ||
3842 | adv); | ||
3843 | } | ||
3844 | |||
3821 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) | 3845 | static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) |
3822 | { | 3846 | { |
3823 | void __iomem *ioaddr = tp->mmio_addr; | 3847 | void __iomem *ioaddr = tp->mmio_addr; |
@@ -3848,9 +3872,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp) | |||
3848 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) | 3872 | if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) |
3849 | return false; | 3873 | return false; |
3850 | 3874 | ||
3851 | rtl_writephy(tp, 0x1f, 0x0000); | 3875 | rtl_speed_down(tp); |
3852 | rtl_writephy(tp, MII_BMCR, 0x0000); | ||
3853 | |||
3854 | rtl_wol_suspend_quirk(tp); | 3876 | rtl_wol_suspend_quirk(tp); |
3855 | 3877 | ||
3856 | return true; | 3878 | return true; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index bf5e3cf97c4d..6ed333fe5c04 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1216 | if (felic_stat & ECSR_LCHNG) { | 1216 | if (felic_stat & ECSR_LCHNG) { |
1217 | /* Link Changed */ | 1217 | /* Link Changed */ |
1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { | 1218 | if (mdp->cd->no_psr || mdp->no_ether_link) { |
1219 | if (mdp->link == PHY_DOWN) | 1219 | goto ignore_link; |
1220 | link_stat = 0; | ||
1221 | else | ||
1222 | link_stat = PHY_ST_LINK; | ||
1223 | } else { | 1220 | } else { |
1224 | link_stat = (sh_eth_read(ndev, PSR)); | 1221 | link_stat = (sh_eth_read(ndev, PSR)); |
1225 | if (mdp->ether_link_active_low) | 1222 | if (mdp->ether_link_active_low) |
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status) | |||
1242 | } | 1239 | } |
1243 | } | 1240 | } |
1244 | 1241 | ||
1242 | ignore_link: | ||
1245 | if (intr_status & EESR_TWB) { | 1243 | if (intr_status & EESR_TWB) { |
1246 | /* Write buck end. unused write back interrupt */ | 1244 | /* Write buck end. unused write back interrupt */ |
1247 | if (intr_status & EESR_TABT) /* Transmit Abort int */ | 1245 | if (intr_status & EESR_TABT) /* Transmit Abort int */ |
@@ -1326,12 +1324,18 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
1326 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1324 | struct sh_eth_private *mdp = netdev_priv(ndev); |
1327 | struct sh_eth_cpu_data *cd = mdp->cd; | 1325 | struct sh_eth_cpu_data *cd = mdp->cd; |
1328 | irqreturn_t ret = IRQ_NONE; | 1326 | irqreturn_t ret = IRQ_NONE; |
1329 | u32 intr_status = 0; | 1327 | unsigned long intr_status; |
1330 | 1328 | ||
1331 | spin_lock(&mdp->lock); | 1329 | spin_lock(&mdp->lock); |
1332 | 1330 | ||
1333 | /* Get interrpt stat */ | 1331 | /* Get interrupt status */ |
1334 | intr_status = sh_eth_read(ndev, EESR); | 1332 | intr_status = sh_eth_read(ndev, EESR); |
1333 | /* Mask it with the interrupt mask, forcing ECI interrupt to be always | ||
1334 | * enabled since it's the one that comes thru regardless of the mask, | ||
1335 | * and we need to fully handle it in sh_eth_error() in order to quench | ||
1336 | * it as it doesn't get cleared by just writing 1 to the ECI bit... | ||
1337 | */ | ||
1338 | intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI; | ||
1335 | /* Clear interrupt */ | 1339 | /* Clear interrupt */ |
1336 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | | 1340 | if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | |
1337 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | | 1341 | EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | |
@@ -1373,7 +1377,7 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1373 | struct phy_device *phydev = mdp->phydev; | 1377 | struct phy_device *phydev = mdp->phydev; |
1374 | int new_state = 0; | 1378 | int new_state = 0; |
1375 | 1379 | ||
1376 | if (phydev->link != PHY_DOWN) { | 1380 | if (phydev->link) { |
1377 | if (phydev->duplex != mdp->duplex) { | 1381 | if (phydev->duplex != mdp->duplex) { |
1378 | new_state = 1; | 1382 | new_state = 1; |
1379 | mdp->duplex = phydev->duplex; | 1383 | mdp->duplex = phydev->duplex; |
@@ -1387,17 +1391,21 @@ static void sh_eth_adjust_link(struct net_device *ndev) | |||
1387 | if (mdp->cd->set_rate) | 1391 | if (mdp->cd->set_rate) |
1388 | mdp->cd->set_rate(ndev); | 1392 | mdp->cd->set_rate(ndev); |
1389 | } | 1393 | } |
1390 | if (mdp->link == PHY_DOWN) { | 1394 | if (!mdp->link) { |
1391 | sh_eth_write(ndev, | 1395 | sh_eth_write(ndev, |
1392 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); | 1396 | (sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR); |
1393 | new_state = 1; | 1397 | new_state = 1; |
1394 | mdp->link = phydev->link; | 1398 | mdp->link = phydev->link; |
1399 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1400 | sh_eth_rcv_snd_enable(ndev); | ||
1395 | } | 1401 | } |
1396 | } else if (mdp->link) { | 1402 | } else if (mdp->link) { |
1397 | new_state = 1; | 1403 | new_state = 1; |
1398 | mdp->link = PHY_DOWN; | 1404 | mdp->link = 0; |
1399 | mdp->speed = 0; | 1405 | mdp->speed = 0; |
1400 | mdp->duplex = -1; | 1406 | mdp->duplex = -1; |
1407 | if (mdp->cd->no_psr || mdp->no_ether_link) | ||
1408 | sh_eth_rcv_snd_disable(ndev); | ||
1401 | } | 1409 | } |
1402 | 1410 | ||
1403 | if (new_state && netif_msg_link(mdp)) | 1411 | if (new_state && netif_msg_link(mdp)) |
@@ -1414,7 +1422,7 @@ static int sh_eth_phy_init(struct net_device *ndev) | |||
1414 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, | 1422 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, |
1415 | mdp->mii_bus->id , mdp->phy_id); | 1423 | mdp->mii_bus->id , mdp->phy_id); |
1416 | 1424 | ||
1417 | mdp->link = PHY_DOWN; | 1425 | mdp->link = 0; |
1418 | mdp->speed = 0; | 1426 | mdp->speed = 0; |
1419 | mdp->duplex = -1; | 1427 | mdp->duplex = -1; |
1420 | 1428 | ||
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index e6655678458e..828be4515008 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -723,7 +723,7 @@ struct sh_eth_private { | |||
723 | u32 phy_id; /* PHY ID */ | 723 | u32 phy_id; /* PHY ID */ |
724 | struct mii_bus *mii_bus; /* MDIO bus control */ | 724 | struct mii_bus *mii_bus; /* MDIO bus control */ |
725 | struct phy_device *phydev; /* PHY device control */ | 725 | struct phy_device *phydev; /* PHY device control */ |
726 | enum phy_state link; | 726 | int link; |
727 | phy_interface_t phy_interface; | 727 | phy_interface_t phy_interface; |
728 | int msg_enable; | 728 | int msg_enable; |
729 | int speed; | 729 | int speed; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index df32a090d08e..80cad06e5eb2 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -436,7 +436,7 @@ void cpsw_tx_handler(void *token, int len, int status) | |||
436 | * queue is stopped then start the queue as we have free desc for tx | 436 | * queue is stopped then start the queue as we have free desc for tx |
437 | */ | 437 | */ |
438 | if (unlikely(netif_queue_stopped(ndev))) | 438 | if (unlikely(netif_queue_stopped(ndev))) |
439 | netif_start_queue(ndev); | 439 | netif_wake_queue(ndev); |
440 | cpts_tx_timestamp(priv->cpts, skb); | 440 | cpts_tx_timestamp(priv->cpts, skb); |
441 | priv->stats.tx_packets++; | 441 | priv->stats.tx_packets++; |
442 | priv->stats.tx_bytes += len; | 442 | priv->stats.tx_bytes += len; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index ae1b77aa199f..72300bc9e378 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1053,7 +1053,7 @@ static void emac_tx_handler(void *token, int len, int status) | |||
1053 | * queue is stopped then start the queue as we have free desc for tx | 1053 | * queue is stopped then start the queue as we have free desc for tx |
1054 | */ | 1054 | */ |
1055 | if (unlikely(netif_queue_stopped(ndev))) | 1055 | if (unlikely(netif_queue_stopped(ndev))) |
1056 | netif_start_queue(ndev); | 1056 | netif_wake_queue(ndev); |
1057 | ndev->stats.tx_packets++; | 1057 | ndev->stats.tx_packets++; |
1058 | ndev->stats.tx_bytes += len; | 1058 | ndev->stats.tx_bytes += len; |
1059 | dev_kfree_skb_any(skb); | 1059 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 9abe51710f22..1a15ec14c386 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -914,8 +914,12 @@ static int smsc75xx_set_rx_max_frame_length(struct usbnet *dev, int size) | |||
914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) | 914 | static int smsc75xx_change_mtu(struct net_device *netdev, int new_mtu) |
915 | { | 915 | { |
916 | struct usbnet *dev = netdev_priv(netdev); | 916 | struct usbnet *dev = netdev_priv(netdev); |
917 | int ret; | ||
918 | |||
919 | if (new_mtu > MAX_SINGLE_PACKET_SIZE) | ||
920 | return -EINVAL; | ||
917 | 921 | ||
918 | int ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu); | 922 | ret = smsc75xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN); |
919 | if (ret < 0) { | 923 | if (ret < 0) { |
920 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); | 924 | netdev_warn(dev->net, "Failed to set mac rx frame length\n"); |
921 | return ret; | 925 | return ret; |
@@ -1324,7 +1328,7 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
1324 | 1328 | ||
1325 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); | 1329 | netif_dbg(dev, ifup, dev->net, "FCT_TX_CTL set to 0x%08x\n", buf); |
1326 | 1330 | ||
1327 | ret = smsc75xx_set_rx_max_frame_length(dev, 1514); | 1331 | ret = smsc75xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN); |
1328 | if (ret < 0) { | 1332 | if (ret < 0) { |
1329 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); | 1333 | netdev_warn(dev->net, "Failed to set max rx frame length\n"); |
1330 | return ret; | 1334 | return ret; |
@@ -2134,8 +2138,8 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
2134 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) | 2138 | else if (rx_cmd_a & (RX_CMD_A_LONG | RX_CMD_A_RUNT)) |
2135 | dev->net->stats.rx_frame_errors++; | 2139 | dev->net->stats.rx_frame_errors++; |
2136 | } else { | 2140 | } else { |
2137 | /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ | 2141 | /* MAX_SINGLE_PACKET_SIZE + 4(CRC) + 2(COE) + 4(Vlan) */ |
2138 | if (unlikely(size > (ETH_FRAME_LEN + 12))) { | 2142 | if (unlikely(size > (MAX_SINGLE_PACKET_SIZE + ETH_HLEN + 12))) { |
2139 | netif_dbg(dev, rx_err, dev->net, | 2143 | netif_dbg(dev, rx_err, dev->net, |
2140 | "size err rx_cmd_a=0x%08x\n", | 2144 | "size err rx_cmd_a=0x%08x\n", |
2141 | rx_cmd_a); | 2145 | rx_cmd_a); |
diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c index 39c84ecf6a42..7fdac6c7b3ea 100644 --- a/drivers/net/wireless/ath/ath9k/link.c +++ b/drivers/net/wireless/ath/ath9k/link.c | |||
@@ -170,7 +170,8 @@ void ath_rx_poll(unsigned long data) | |||
170 | { | 170 | { |
171 | struct ath_softc *sc = (struct ath_softc *)data; | 171 | struct ath_softc *sc = (struct ath_softc *)data; |
172 | 172 | ||
173 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | 173 | if (!test_bit(SC_OP_INVALID, &sc->sc_flags)) |
174 | ieee80211_queue_work(sc->hw, &sc->hw_check_work); | ||
174 | } | 175 | } |
175 | 176 | ||
176 | /* | 177 | /* |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 38bc5a7997ff..122146943bf2 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -1487,8 +1487,12 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1487 | const struct b43_dma_ops *ops; | 1487 | const struct b43_dma_ops *ops; |
1488 | struct b43_dmaring *ring; | 1488 | struct b43_dmaring *ring; |
1489 | struct b43_dmadesc_meta *meta; | 1489 | struct b43_dmadesc_meta *meta; |
1490 | static const struct b43_txstatus fake; /* filled with 0 */ | ||
1491 | const struct b43_txstatus *txstat; | ||
1490 | int slot, firstused; | 1492 | int slot, firstused; |
1491 | bool frame_succeed; | 1493 | bool frame_succeed; |
1494 | int skip; | ||
1495 | static u8 err_out1, err_out2; | ||
1492 | 1496 | ||
1493 | ring = parse_cookie(dev, status->cookie, &slot); | 1497 | ring = parse_cookie(dev, status->cookie, &slot); |
1494 | if (unlikely(!ring)) | 1498 | if (unlikely(!ring)) |
@@ -1501,13 +1505,36 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1501 | firstused = ring->current_slot - ring->used_slots + 1; | 1505 | firstused = ring->current_slot - ring->used_slots + 1; |
1502 | if (firstused < 0) | 1506 | if (firstused < 0) |
1503 | firstused = ring->nr_slots + firstused; | 1507 | firstused = ring->nr_slots + firstused; |
1508 | |||
1509 | skip = 0; | ||
1504 | if (unlikely(slot != firstused)) { | 1510 | if (unlikely(slot != firstused)) { |
1505 | /* This possibly is a firmware bug and will result in | 1511 | /* This possibly is a firmware bug and will result in |
1506 | * malfunction, memory leaks and/or stall of DMA functionality. */ | 1512 | * malfunction, memory leaks and/or stall of DMA functionality. |
1507 | b43dbg(dev->wl, "Out of order TX status report on DMA ring %d. " | 1513 | */ |
1508 | "Expected %d, but got %d\n", | 1514 | if (slot == next_slot(ring, next_slot(ring, firstused))) { |
1509 | ring->index, firstused, slot); | 1515 | /* If a single header/data pair was missed, skip over |
1510 | return; | 1516 | * the first two slots in an attempt to recover. |
1517 | */ | ||
1518 | slot = firstused; | ||
1519 | skip = 2; | ||
1520 | if (!err_out1) { | ||
1521 | /* Report the error once. */ | ||
1522 | b43dbg(dev->wl, | ||
1523 | "Skip on DMA ring %d slot %d.\n", | ||
1524 | ring->index, slot); | ||
1525 | err_out1 = 1; | ||
1526 | } | ||
1527 | } else { | ||
1528 | /* More than a single header/data pair were missed. | ||
1529 | * Report this error once. | ||
1530 | */ | ||
1531 | if (!err_out2) | ||
1532 | b43dbg(dev->wl, | ||
1533 | "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", | ||
1534 | ring->index, firstused, slot); | ||
1535 | err_out2 = 1; | ||
1536 | return; | ||
1537 | } | ||
1511 | } | 1538 | } |
1512 | 1539 | ||
1513 | ops = ring->ops; | 1540 | ops = ring->ops; |
@@ -1522,11 +1549,13 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1522 | slot, firstused, ring->index); | 1549 | slot, firstused, ring->index); |
1523 | break; | 1550 | break; |
1524 | } | 1551 | } |
1552 | |||
1525 | if (meta->skb) { | 1553 | if (meta->skb) { |
1526 | struct b43_private_tx_info *priv_info = | 1554 | struct b43_private_tx_info *priv_info = |
1527 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); | 1555 | b43_get_priv_tx_info(IEEE80211_SKB_CB(meta->skb)); |
1528 | 1556 | ||
1529 | unmap_descbuffer(ring, meta->dmaaddr, meta->skb->len, 1); | 1557 | unmap_descbuffer(ring, meta->dmaaddr, |
1558 | meta->skb->len, 1); | ||
1530 | kfree(priv_info->bouncebuffer); | 1559 | kfree(priv_info->bouncebuffer); |
1531 | priv_info->bouncebuffer = NULL; | 1560 | priv_info->bouncebuffer = NULL; |
1532 | } else { | 1561 | } else { |
@@ -1538,8 +1567,9 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1538 | struct ieee80211_tx_info *info; | 1567 | struct ieee80211_tx_info *info; |
1539 | 1568 | ||
1540 | if (unlikely(!meta->skb)) { | 1569 | if (unlikely(!meta->skb)) { |
1541 | /* This is a scatter-gather fragment of a frame, so | 1570 | /* This is a scatter-gather fragment of a frame, |
1542 | * the skb pointer must not be NULL. */ | 1571 | * so the skb pointer must not be NULL. |
1572 | */ | ||
1543 | b43dbg(dev->wl, "TX status unexpected NULL skb " | 1573 | b43dbg(dev->wl, "TX status unexpected NULL skb " |
1544 | "at slot %d (first=%d) on ring %d\n", | 1574 | "at slot %d (first=%d) on ring %d\n", |
1545 | slot, firstused, ring->index); | 1575 | slot, firstused, ring->index); |
@@ -1550,9 +1580,18 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1550 | 1580 | ||
1551 | /* | 1581 | /* |
1552 | * Call back to inform the ieee80211 subsystem about | 1582 | * Call back to inform the ieee80211 subsystem about |
1553 | * the status of the transmission. | 1583 | * the status of the transmission. When skipping over |
1584 | * a missed TX status report, use a status structure | ||
1585 | * filled with zeros to indicate that the frame was not | ||
1586 | * sent (frame_count 0) and not acknowledged | ||
1554 | */ | 1587 | */ |
1555 | frame_succeed = b43_fill_txstatus_report(dev, info, status); | 1588 | if (unlikely(skip)) |
1589 | txstat = &fake; | ||
1590 | else | ||
1591 | txstat = status; | ||
1592 | |||
1593 | frame_succeed = b43_fill_txstatus_report(dev, info, | ||
1594 | txstat); | ||
1556 | #ifdef CONFIG_B43_DEBUG | 1595 | #ifdef CONFIG_B43_DEBUG |
1557 | if (frame_succeed) | 1596 | if (frame_succeed) |
1558 | ring->nr_succeed_tx_packets++; | 1597 | ring->nr_succeed_tx_packets++; |
@@ -1580,12 +1619,14 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, | |||
1580 | /* Everything unmapped and free'd. So it's not used anymore. */ | 1619 | /* Everything unmapped and free'd. So it's not used anymore. */ |
1581 | ring->used_slots--; | 1620 | ring->used_slots--; |
1582 | 1621 | ||
1583 | if (meta->is_last_fragment) { | 1622 | if (meta->is_last_fragment && !skip) { |
1584 | /* This is the last scatter-gather | 1623 | /* This is the last scatter-gather |
1585 | * fragment of the frame. We are done. */ | 1624 | * fragment of the frame. We are done. */ |
1586 | break; | 1625 | break; |
1587 | } | 1626 | } |
1588 | slot = next_slot(ring, slot); | 1627 | slot = next_slot(ring, slot); |
1628 | if (skip > 0) | ||
1629 | --skip; | ||
1589 | } | 1630 | } |
1590 | if (ring->stopped) { | 1631 | if (ring->stopped) { |
1591 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); | 1632 | B43_WARN_ON(free_slots(ring) < TX_SLOTS_PER_FRAME); |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 3c35382ee6c2..e8486c1e091a 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -1564,7 +1564,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; | 1564 | u16 clip_off[2] = { 0xFFFF, 0xFFFF }; |
1565 | 1565 | ||
1566 | u8 vcm_final = 0; | 1566 | u8 vcm_final = 0; |
1567 | s8 offset[4]; | 1567 | s32 offset[4]; |
1568 | s32 results[8][4] = { }; | 1568 | s32 results[8][4] = { }; |
1569 | s32 results_min[4] = { }; | 1569 | s32 results_min[4] = { }; |
1570 | s32 poll_results[4] = { }; | 1570 | s32 poll_results[4] = { }; |
@@ -1615,7 +1615,7 @@ static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev) | |||
1615 | } | 1615 | } |
1616 | for (i = 0; i < 4; i += 2) { | 1616 | for (i = 0; i < 4; i += 2) { |
1617 | s32 curr; | 1617 | s32 curr; |
1618 | s32 mind = 40; | 1618 | s32 mind = 0x100000; |
1619 | s32 minpoll = 249; | 1619 | s32 minpoll = 249; |
1620 | u8 minvcm = 0; | 1620 | u8 minvcm = 0; |
1621 | if (2 * core != i) | 1621 | if (2 * core != i) |
@@ -1732,7 +1732,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1732 | u8 regs_save_radio[2]; | 1732 | u8 regs_save_radio[2]; |
1733 | u16 regs_save_phy[2]; | 1733 | u16 regs_save_phy[2]; |
1734 | 1734 | ||
1735 | s8 offset[4]; | 1735 | s32 offset[4]; |
1736 | u8 core; | 1736 | u8 core; |
1737 | u8 rail; | 1737 | u8 rail; |
1738 | 1738 | ||
@@ -1799,7 +1799,7 @@ static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, u8 type) | |||
1799 | } | 1799 | } |
1800 | 1800 | ||
1801 | for (i = 0; i < 4; i++) { | 1801 | for (i = 0; i < 4; i++) { |
1802 | s32 mind = 40; | 1802 | s32 mind = 0x100000; |
1803 | u8 minvcm = 0; | 1803 | u8 minvcm = 0; |
1804 | s32 minpoll = 249; | 1804 | s32 minpoll = 249; |
1805 | s32 curr; | 1805 | s32 curr; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 21a824232478..18d37645e2cd 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | |||
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1137 | gain0_15 = ((biq1 & 0xf) << 12) | | 1137 | gain0_15 = ((biq1 & 0xf) << 12) | |
1138 | ((tia & 0xf) << 8) | | 1138 | ((tia & 0xf) << 8) | |
1139 | ((lna2 & 0x3) << 6) | | 1139 | ((lna2 & 0x3) << 6) | |
1140 | ((lna2 & 0x3) << 4) | | 1140 | ((lna2 & |
1141 | ((lna1 & 0x3) << 2) | | 1141 | 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); |
1142 | ((lna1 & 0x3) << 0); | ||
1143 | 1142 | ||
1144 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); | 1143 | mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); |
1145 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); | 1144 | mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); |
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi, | |||
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); | 1158 | mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); |
1160 | mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); | ||
1161 | mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); | ||
1162 | 1159 | ||
1163 | } | 1160 | } |
1164 | 1161 | ||
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples) | |||
1331 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; | 1328 | return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; |
1332 | } | 1329 | } |
1333 | 1330 | ||
1334 | static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, | ||
1335 | u16 tia_gain, u16 lna2_gain) | ||
1336 | { | ||
1337 | u32 i_thresh_l, q_thresh_l; | ||
1338 | u32 i_thresh_h, q_thresh_h; | ||
1339 | struct lcnphy_iq_est iq_est_h, iq_est_l; | ||
1340 | |||
1341 | wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, | ||
1342 | lna2_gain, 0); | ||
1343 | |||
1344 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1345 | wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); | ||
1346 | udelay(500); | ||
1347 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1348 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) | ||
1349 | return false; | ||
1350 | |||
1351 | wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); | ||
1352 | udelay(500); | ||
1353 | write_radio_reg(pi, RADIO_2064_REG112, 0); | ||
1354 | if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) | ||
1355 | return false; | ||
1356 | |||
1357 | i_thresh_l = (iq_est_l.i_pwr << 1); | ||
1358 | i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; | ||
1359 | |||
1360 | q_thresh_l = (iq_est_l.q_pwr << 1); | ||
1361 | q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; | ||
1362 | if ((iq_est_h.i_pwr > i_thresh_l) && | ||
1363 | (iq_est_h.i_pwr < i_thresh_h) && | ||
1364 | (iq_est_h.q_pwr > q_thresh_l) && | ||
1365 | (iq_est_h.q_pwr < q_thresh_h)) | ||
1366 | return true; | ||
1367 | |||
1368 | return false; | ||
1369 | } | ||
1370 | |||
1371 | static bool | 1331 | static bool |
1372 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | 1332 | wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, |
1373 | const struct lcnphy_rx_iqcomp *iqcomp, | 1333 | const struct lcnphy_rx_iqcomp *iqcomp, |
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1382 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, | 1342 | RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, |
1383 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, | 1343 | rfoverride3_old, rfoverride3val_old, rfoverride4_old, |
1384 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; | 1344 | rfoverride4val_old, afectrlovr_old, afectrlovrval_old; |
1385 | int tia_gain, lna2_gain, biq1_gain; | 1345 | int tia_gain; |
1386 | bool set_gain; | 1346 | u32 received_power, rx_pwr_threshold; |
1387 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; | 1347 | u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; |
1388 | u16 values_to_save[11]; | 1348 | u16 values_to_save[11]; |
1389 | s16 *ptr; | 1349 | s16 *ptr; |
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, | |||
1408 | goto cal_done; | 1368 | goto cal_done; |
1409 | } | 1369 | } |
1410 | 1370 | ||
1411 | WARN_ON(module != 1); | 1371 | if (module == 1) { |
1412 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); | ||
1413 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); | ||
1414 | |||
1415 | for (i = 0; i < 11; i++) | ||
1416 | values_to_save[i] = | ||
1417 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1418 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1419 | |||
1420 | or_phy_reg(pi, 0x631, 0x0015); | ||
1421 | |||
1422 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1423 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1424 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1425 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1426 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1427 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1428 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1429 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1430 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1431 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1432 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1433 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1434 | |||
1435 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1436 | if (tx_gain_override_old) { | ||
1437 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1438 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1439 | } | ||
1440 | |||
1441 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); | ||
1442 | 1372 | ||
1443 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); | 1373 | tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); |
1444 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); | 1374 | wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); |
1445 | 1375 | ||
1446 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); | 1376 | for (i = 0; i < 11; i++) |
1447 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); | 1377 | values_to_save[i] = |
1378 | read_radio_reg(pi, rxiq_cal_rf_reg[i]); | ||
1379 | Core1TxControl_old = read_phy_reg(pi, 0x631); | ||
1380 | |||
1381 | or_phy_reg(pi, 0x631, 0x0015); | ||
1382 | |||
1383 | RFOverride0_old = read_phy_reg(pi, 0x44c); | ||
1384 | RFOverrideVal0_old = read_phy_reg(pi, 0x44d); | ||
1385 | rfoverride2_old = read_phy_reg(pi, 0x4b0); | ||
1386 | rfoverride2val_old = read_phy_reg(pi, 0x4b1); | ||
1387 | rfoverride3_old = read_phy_reg(pi, 0x4f9); | ||
1388 | rfoverride3val_old = read_phy_reg(pi, 0x4fa); | ||
1389 | rfoverride4_old = read_phy_reg(pi, 0x938); | ||
1390 | rfoverride4val_old = read_phy_reg(pi, 0x939); | ||
1391 | afectrlovr_old = read_phy_reg(pi, 0x43b); | ||
1392 | afectrlovrval_old = read_phy_reg(pi, 0x43c); | ||
1393 | old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); | ||
1394 | old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); | ||
1395 | |||
1396 | tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); | ||
1397 | if (tx_gain_override_old) { | ||
1398 | wlc_lcnphy_get_tx_gain(pi, &old_gains); | ||
1399 | tx_gain_index_old = pi_lcn->lcnphy_current_index; | ||
1400 | } | ||
1448 | 1401 | ||
1449 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); | 1402 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); |
1450 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); | ||
1451 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | ||
1452 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); | ||
1453 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); | ||
1454 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); | ||
1455 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | ||
1456 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); | ||
1457 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); | ||
1458 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | ||
1459 | |||
1460 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); | ||
1461 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); | ||
1462 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); | ||
1463 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); | ||
1464 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); | ||
1465 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); | ||
1466 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); | ||
1467 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); | ||
1468 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); | ||
1469 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1470 | 1403 | ||
1471 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | 1404 | mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); |
1472 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | 1405 | mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); |
1473 | 1406 | ||
1474 | write_phy_reg(pi, 0x6da, 0xffff); | 1407 | mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); |
1475 | or_phy_reg(pi, 0x6db, 0x3); | 1408 | mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); |
1476 | 1409 | ||
1477 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | 1410 | write_radio_reg(pi, RADIO_2064_REG116, 0x06); |
1478 | set_gain = false; | 1411 | write_radio_reg(pi, RADIO_2064_REG12C, 0x07); |
1479 | 1412 | write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); | |
1480 | lna2_gain = 3; | 1413 | write_radio_reg(pi, RADIO_2064_REG098, 0x03); |
1481 | while ((lna2_gain >= 0) && !set_gain) { | 1414 | write_radio_reg(pi, RADIO_2064_REG00B, 0x7); |
1482 | tia_gain = 4; | 1415 | mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); |
1483 | 1416 | write_radio_reg(pi, RADIO_2064_REG01D, 0x01); | |
1484 | while ((tia_gain >= 0) && !set_gain) { | 1417 | write_radio_reg(pi, RADIO_2064_REG114, 0x01); |
1485 | biq1_gain = 6; | 1418 | write_radio_reg(pi, RADIO_2064_REG02E, 0x10); |
1486 | 1419 | write_radio_reg(pi, RADIO_2064_REG12A, 0x08); | |
1487 | while ((biq1_gain >= 0) && !set_gain) { | 1420 | |
1488 | set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, | 1421 | mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); |
1489 | (u16) | 1422 | mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); |
1490 | biq1_gain, | 1423 | mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); |
1491 | (u16) | 1424 | mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); |
1492 | tia_gain, | 1425 | mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); |
1493 | (u16) | 1426 | mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); |
1494 | lna2_gain); | 1427 | mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); |
1495 | biq1_gain -= 1; | 1428 | mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); |
1496 | } | 1429 | mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); |
1430 | mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); | ||
1431 | |||
1432 | mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); | ||
1433 | mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); | ||
1434 | |||
1435 | wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); | ||
1436 | write_phy_reg(pi, 0x6da, 0xffff); | ||
1437 | or_phy_reg(pi, 0x6db, 0x3); | ||
1438 | wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); | ||
1439 | wlc_lcnphy_rx_gain_override_enable(pi, true); | ||
1440 | |||
1441 | tia_gain = 8; | ||
1442 | rx_pwr_threshold = 950; | ||
1443 | while (tia_gain > 0) { | ||
1497 | tia_gain -= 1; | 1444 | tia_gain -= 1; |
1445 | wlc_lcnphy_set_rx_gain_by_distribution(pi, | ||
1446 | 0, 0, 2, 2, | ||
1447 | (u16) | ||
1448 | tia_gain, 1, 0); | ||
1449 | udelay(500); | ||
1450 | |||
1451 | received_power = | ||
1452 | wlc_lcnphy_measure_digital_power(pi, 2000); | ||
1453 | if (received_power < rx_pwr_threshold) | ||
1454 | break; | ||
1498 | } | 1455 | } |
1499 | lna2_gain -= 1; | 1456 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); |
1500 | } | ||
1501 | 1457 | ||
1502 | if (set_gain) | 1458 | wlc_lcnphy_stop_tx_tone(pi); |
1503 | result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); | ||
1504 | else | ||
1505 | result = false; | ||
1506 | 1459 | ||
1507 | wlc_lcnphy_stop_tx_tone(pi); | 1460 | write_phy_reg(pi, 0x631, Core1TxControl_old); |
1508 | 1461 | ||
1509 | write_phy_reg(pi, 0x631, Core1TxControl_old); | 1462 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); |
1510 | 1463 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | |
1511 | write_phy_reg(pi, 0x44c, RFOverrideVal0_old); | 1464 | write_phy_reg(pi, 0x4b0, rfoverride2_old); |
1512 | write_phy_reg(pi, 0x44d, RFOverrideVal0_old); | 1465 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); |
1513 | write_phy_reg(pi, 0x4b0, rfoverride2_old); | 1466 | write_phy_reg(pi, 0x4f9, rfoverride3_old); |
1514 | write_phy_reg(pi, 0x4b1, rfoverride2val_old); | 1467 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); |
1515 | write_phy_reg(pi, 0x4f9, rfoverride3_old); | 1468 | write_phy_reg(pi, 0x938, rfoverride4_old); |
1516 | write_phy_reg(pi, 0x4fa, rfoverride3val_old); | 1469 | write_phy_reg(pi, 0x939, rfoverride4val_old); |
1517 | write_phy_reg(pi, 0x938, rfoverride4_old); | 1470 | write_phy_reg(pi, 0x43b, afectrlovr_old); |
1518 | write_phy_reg(pi, 0x939, rfoverride4val_old); | 1471 | write_phy_reg(pi, 0x43c, afectrlovrval_old); |
1519 | write_phy_reg(pi, 0x43b, afectrlovr_old); | 1472 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); |
1520 | write_phy_reg(pi, 0x43c, afectrlovrval_old); | 1473 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); |
1521 | write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); | ||
1522 | write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); | ||
1523 | 1474 | ||
1524 | wlc_lcnphy_clear_trsw_override(pi); | 1475 | wlc_lcnphy_clear_trsw_override(pi); |
1525 | 1476 | ||
1526 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); | 1477 | mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); |
1527 | 1478 | ||
1528 | for (i = 0; i < 11; i++) | 1479 | for (i = 0; i < 11; i++) |
1529 | write_radio_reg(pi, rxiq_cal_rf_reg[i], | 1480 | write_radio_reg(pi, rxiq_cal_rf_reg[i], |
1530 | values_to_save[i]); | 1481 | values_to_save[i]); |
1531 | 1482 | ||
1532 | if (tx_gain_override_old) | 1483 | if (tx_gain_override_old) |
1533 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); | 1484 | wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); |
1534 | else | 1485 | else |
1535 | wlc_lcnphy_disable_tx_gain_override(pi); | 1486 | wlc_lcnphy_disable_tx_gain_override(pi); |
1536 | 1487 | ||
1537 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); | 1488 | wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); |
1538 | wlc_lcnphy_rx_gain_override_enable(pi, false); | 1489 | wlc_lcnphy_rx_gain_override_enable(pi, false); |
1490 | } | ||
1539 | 1491 | ||
1540 | cal_done: | 1492 | cal_done: |
1541 | kfree(ptr); | 1493 | kfree(ptr); |
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel) | |||
1829 | write_radio_reg(pi, RADIO_2064_REG038, 3); | 1781 | write_radio_reg(pi, RADIO_2064_REG038, 3); |
1830 | write_radio_reg(pi, RADIO_2064_REG091, 7); | 1782 | write_radio_reg(pi, RADIO_2064_REG091, 7); |
1831 | } | 1783 | } |
1832 | |||
1833 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
1834 | u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc, | ||
1835 | 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0}; | ||
1836 | |||
1837 | write_radio_reg(pi, RADIO_2064_REG02A, 0xf); | ||
1838 | write_radio_reg(pi, RADIO_2064_REG091, 0x3); | ||
1839 | write_radio_reg(pi, RADIO_2064_REG038, 0x3); | ||
1840 | |||
1841 | write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); | ||
1842 | } | ||
1843 | } | 1784 | } |
1844 | 1785 | ||
1845 | static int | 1786 | static int |
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos) | |||
2034 | } else { | 1975 | } else { |
2035 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); | 1976 | mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); |
2036 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | 1977 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); |
2037 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); | ||
2038 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); | ||
2039 | mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); | ||
2040 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); | ||
2041 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2042 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); | ||
2043 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); | ||
2044 | mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); | ||
2045 | mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); | ||
2046 | mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); | ||
2047 | } | 1978 | } |
2048 | } else { | 1979 | } else { |
2049 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); | 1980 | mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); |
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi) | |||
2130 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); | 2061 | (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); |
2131 | 2062 | ||
2132 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); | 2063 | mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); |
2133 | mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); | ||
2134 | } | 2064 | } |
2135 | 2065 | ||
2136 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | 2066 | static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) |
2137 | { | 2067 | { |
2138 | struct phytbl_info tab; | 2068 | struct phytbl_info tab; |
2139 | u32 rfseq, ind; | 2069 | u32 rfseq, ind; |
2140 | u8 tssi_sel; | ||
2141 | 2070 | ||
2142 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 2071 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
2143 | tab.tbl_width = 32; | 2072 | tab.tbl_width = 32; |
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2159 | 2088 | ||
2160 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); | 2089 | mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); |
2161 | 2090 | ||
2162 | if (pi->sh->boardflags & BFL_FEM) { | 2091 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); |
2163 | tssi_sel = 0x1; | ||
2164 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); | ||
2165 | } else { | ||
2166 | tssi_sel = 0xe; | ||
2167 | wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA); | ||
2168 | } | ||
2169 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); | 2092 | mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); |
2170 | 2093 | ||
2171 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); | 2094 | mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); |
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2201 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); | 2124 | mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); |
2202 | 2125 | ||
2203 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { | 2126 | if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { |
2204 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); | 2127 | mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); |
2205 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); | 2128 | mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); |
2206 | } else { | 2129 | } else { |
2207 | mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); | ||
2208 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); | 2130 | mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); |
2209 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); | 2131 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); |
2210 | } | 2132 | } |
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) | |||
2251 | 2173 | ||
2252 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); | 2174 | mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); |
2253 | 2175 | ||
2254 | mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); | ||
2255 | mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); | ||
2256 | mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); | ||
2257 | |||
2258 | wlc_lcnphy_pwrctrl_rssiparams(pi); | 2176 | wlc_lcnphy_pwrctrl_rssiparams(pi); |
2259 | } | 2177 | } |
2260 | 2178 | ||
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2873 | read_radio_reg(pi, RADIO_2064_REG007) & 1; | 2791 | read_radio_reg(pi, RADIO_2064_REG007) & 1; |
2874 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; | 2792 | u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; |
2875 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; | 2793 | u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; |
2876 | u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); | ||
2877 | |||
2878 | idleTssi = read_phy_reg(pi, 0x4ab); | 2794 | idleTssi = read_phy_reg(pi, 0x4ab); |
2879 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & | 2795 | suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & |
2880 | MCTL_EN_MAC)); | 2796 | MCTL_EN_MAC)); |
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2892 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); | 2808 | mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); |
2893 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); | 2809 | mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); |
2894 | wlc_lcnphy_tssi_setup(pi); | 2810 | wlc_lcnphy_tssi_setup(pi); |
2895 | |||
2896 | mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); | ||
2897 | mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); | ||
2898 | |||
2899 | wlc_lcnphy_set_bbmult(pi, 0x0); | ||
2900 | |||
2901 | wlc_phy_do_dummy_tx(pi, true, OFF); | 2811 | wlc_phy_do_dummy_tx(pi, true, OFF); |
2902 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) | 2812 | idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) |
2903 | >> 0); | 2813 | >> 0); |
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi) | |||
2919 | 2829 | ||
2920 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); | 2830 | mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); |
2921 | 2831 | ||
2922 | wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); | ||
2923 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); | 2832 | wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); |
2924 | wlc_lcnphy_set_tx_gain(pi, &old_gains); | 2833 | wlc_lcnphy_set_tx_gain(pi, &old_gains); |
2925 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); | 2834 | wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); |
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi) | |||
3133 | wlc_lcnphy_write_table(pi, &tab); | 3042 | wlc_lcnphy_write_table(pi, &tab); |
3134 | tab.tbl_offset++; | 3043 | tab.tbl_offset++; |
3135 | } | 3044 | } |
3136 | mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); | ||
3137 | mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); | ||
3138 | mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); | ||
3139 | mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); | ||
3140 | mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); | ||
3141 | 3045 | ||
3142 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); | 3046 | mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); |
3143 | 3047 | ||
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3939 | target_gains.pad_gain = 21; | 3843 | target_gains.pad_gain = 21; |
3940 | target_gains.dac_gain = 0; | 3844 | target_gains.dac_gain = 0; |
3941 | wlc_lcnphy_set_tx_gain(pi, &target_gains); | 3845 | wlc_lcnphy_set_tx_gain(pi, &target_gains); |
3846 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3942 | 3847 | ||
3943 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { | 3848 | if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { |
3944 | 3849 | ||
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi) | |||
3949 | lcnphy_recal ? LCNPHY_CAL_RECAL : | 3854 | lcnphy_recal ? LCNPHY_CAL_RECAL : |
3950 | LCNPHY_CAL_FULL), false); | 3855 | LCNPHY_CAL_FULL), false); |
3951 | } else { | 3856 | } else { |
3952 | wlc_lcnphy_set_tx_pwr_by_index(pi, 16); | ||
3953 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); | 3857 | wlc_lcnphy_tx_iqlo_soft_cal_full(pi); |
3954 | } | 3858 | } |
3955 | 3859 | ||
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi, | |||
4374 | if (CHSPEC_IS5G(pi->radio_chanspec)) | 4278 | if (CHSPEC_IS5G(pi->radio_chanspec)) |
4375 | pa_gain = 0x70; | 4279 | pa_gain = 0x70; |
4376 | else | 4280 | else |
4377 | pa_gain = 0x60; | 4281 | pa_gain = 0x70; |
4378 | 4282 | ||
4379 | if (pi->sh->boardflags & BFL_FEM) | 4283 | if (pi->sh->boardflags & BFL_FEM) |
4380 | pa_gain = 0x10; | 4284 | pa_gain = 0x10; |
4381 | |||
4382 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; | 4285 | tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; |
4383 | tab.tbl_width = 32; | 4286 | tab.tbl_width = 32; |
4384 | tab.tbl_len = 1; | 4287 | tab.tbl_len = 1; |
4385 | tab.tbl_ptr = &val; | 4288 | tab.tbl_ptr = &val; |
4386 | 4289 | ||
4387 | for (j = 0; j < 128; j++) { | 4290 | for (j = 0; j < 128; j++) { |
4388 | if (pi->sh->boardflags & BFL_FEM) | 4291 | gm_gain = gain_table[j].gm; |
4389 | gm_gain = gain_table[j].gm; | ||
4390 | else | ||
4391 | gm_gain = 15; | ||
4392 | |||
4393 | val = (((u32) pa_gain << 24) | | 4292 | val = (((u32) pa_gain << 24) | |
4394 | (gain_table[j].pad << 16) | | 4293 | (gain_table[j].pad << 16) | |
4395 | (gain_table[j].pga << 8) | gm_gain); | 4294 | (gain_table[j].pga << 8) | gm_gain); |
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4600 | 4499 | ||
4601 | write_phy_reg(pi, 0x4ea, 0x4688); | 4500 | write_phy_reg(pi, 0x4ea, 0x4688); |
4602 | 4501 | ||
4603 | if (pi->sh->boardflags & BFL_FEM) | 4502 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); |
4604 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); | ||
4605 | else | ||
4606 | mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); | ||
4607 | 4503 | ||
4608 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); | 4504 | mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); |
4609 | 4505 | ||
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi) | |||
4614 | wlc_lcnphy_rcal(pi); | 4510 | wlc_lcnphy_rcal(pi); |
4615 | 4511 | ||
4616 | wlc_lcnphy_rc_cal(pi); | 4512 | wlc_lcnphy_rc_cal(pi); |
4617 | |||
4618 | if (!(pi->sh->boardflags & BFL_FEM)) { | ||
4619 | write_radio_reg(pi, RADIO_2064_REG032, 0x6f); | ||
4620 | write_radio_reg(pi, RADIO_2064_REG033, 0x19); | ||
4621 | write_radio_reg(pi, RADIO_2064_REG039, 0xe); | ||
4622 | } | ||
4623 | |||
4624 | } | 4513 | } |
4625 | 4514 | ||
4626 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) | 4515 | static void wlc_lcnphy_radio_init(struct brcms_phy *pi) |
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi) | |||
4650 | wlc_lcnphy_write_table(pi, &tab); | 4539 | wlc_lcnphy_write_table(pi, &tab); |
4651 | } | 4540 | } |
4652 | 4541 | ||
4653 | if (!(pi->sh->boardflags & BFL_FEM)) { | 4542 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; |
4654 | tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; | 4543 | tab.tbl_width = 16; |
4655 | tab.tbl_width = 16; | 4544 | tab.tbl_ptr = &val; |
4656 | tab.tbl_ptr = &val; | 4545 | tab.tbl_len = 1; |
4657 | tab.tbl_len = 1; | ||
4658 | 4546 | ||
4659 | val = 150; | 4547 | val = 114; |
4660 | tab.tbl_offset = 0; | 4548 | tab.tbl_offset = 0; |
4661 | wlc_lcnphy_write_table(pi, &tab); | 4549 | wlc_lcnphy_write_table(pi, &tab); |
4662 | 4550 | ||
4663 | val = 220; | 4551 | val = 130; |
4664 | tab.tbl_offset = 1; | 4552 | tab.tbl_offset = 1; |
4665 | wlc_lcnphy_write_table(pi, &tab); | 4553 | wlc_lcnphy_write_table(pi, &tab); |
4666 | } | 4554 | |
4555 | val = 6; | ||
4556 | tab.tbl_offset = 8; | ||
4557 | wlc_lcnphy_write_table(pi, &tab); | ||
4667 | 4558 | ||
4668 | if (CHSPEC_IS2G(pi->radio_chanspec)) { | 4559 | if (CHSPEC_IS2G(pi->radio_chanspec)) { |
4669 | if (pi->sh->boardflags & BFL_FEM) | 4560 | if (pi->sh->boardflags & BFL_FEM) |
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec) | |||
5055 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); | 4946 | wlc_lcnphy_load_tx_iir_filter(pi, true, 3); |
5056 | 4947 | ||
5057 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); | 4948 | mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); |
5058 | wlc_lcnphy_tssi_setup(pi); | ||
5059 | } | 4949 | } |
5060 | 4950 | ||
5061 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) | 4951 | void wlc_phy_detach_lcnphy(struct brcms_phy *pi) |
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) | |||
5094 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) | 4984 | if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) |
5095 | return false; | 4985 | return false; |
5096 | 4986 | ||
5097 | if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { | 4987 | if ((pi->sh->boardflags & BFL_FEM) && |
4988 | (LCNREV_IS(pi->pubpi.phy_rev, 1))) { | ||
5098 | if (pi_lcn->lcnphy_tempsense_option == 3) { | 4989 | if (pi_lcn->lcnphy_tempsense_option == 3) { |
5099 | pi->hwpwrctrl = true; | 4990 | pi->hwpwrctrl = true; |
5100 | pi->hwpwrctrl_capable = true; | 4991 | pi->hwpwrctrl_capable = true; |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c index b7e95acc2084..622c01ca72c5 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | |||
@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = { | |||
1992 | }; | 1992 | }; |
1993 | 1993 | ||
1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { | 1994 | static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { |
1995 | 0x0009, | ||
1996 | 0x000a, | 1995 | 0x000a, |
1997 | 0x0005, | ||
1998 | 0x0006, | ||
1999 | 0x0009, | 1996 | 0x0009, |
2000 | 0x000a, | ||
2001 | 0x0005, | ||
2002 | 0x0006, | 1997 | 0x0006, |
2003 | 0x0009, | ||
2004 | 0x000a, | ||
2005 | 0x0005, | 1998 | 0x0005, |
2006 | 0x0006, | ||
2007 | 0x0009, | ||
2008 | 0x000a, | 1999 | 0x000a, |
2009 | 0x0005, | ||
2010 | 0x0006, | ||
2011 | 0x0009, | 2000 | 0x0009, |
2012 | 0x000a, | ||
2013 | 0x0005, | ||
2014 | 0x0006, | 2001 | 0x0006, |
2015 | 0x0009, | ||
2016 | 0x000a, | ||
2017 | 0x0005, | 2002 | 0x0005, |
2018 | 0x0006, | ||
2019 | 0x0009, | ||
2020 | 0x000a, | 2003 | 0x000a, |
2021 | 0x0005, | ||
2022 | 0x0006, | ||
2023 | 0x0009, | 2004 | 0x0009, |
2024 | 0x000a, | ||
2025 | 0x0005, | ||
2026 | 0x0006, | 2005 | 0x0006, |
2027 | 0x0009, | ||
2028 | 0x000a, | ||
2029 | 0x0005, | 2006 | 0x0005, |
2030 | 0x0006, | ||
2031 | 0x0009, | ||
2032 | 0x000a, | 2007 | 0x000a, |
2033 | 0x0005, | ||
2034 | 0x0006, | ||
2035 | 0x0009, | 2008 | 0x0009, |
2036 | 0x000a, | ||
2037 | 0x0005, | ||
2038 | 0x0006, | 2009 | 0x0006, |
2039 | 0x0009, | ||
2040 | 0x000a, | ||
2041 | 0x0005, | 2010 | 0x0005, |
2042 | 0x0006, | 2011 | 0x000a, |
2043 | 0x0009, | 2012 | 0x0009, |
2013 | 0x0006, | ||
2014 | 0x0005, | ||
2044 | 0x000a, | 2015 | 0x000a, |
2016 | 0x0009, | ||
2017 | 0x0006, | ||
2045 | 0x0005, | 2018 | 0x0005, |
2019 | 0x000a, | ||
2020 | 0x0009, | ||
2046 | 0x0006, | 2021 | 0x0006, |
2022 | 0x0005, | ||
2023 | 0x000a, | ||
2047 | 0x0009, | 2024 | 0x0009, |
2025 | 0x0006, | ||
2026 | 0x0005, | ||
2048 | 0x000a, | 2027 | 0x000a, |
2028 | 0x0009, | ||
2029 | 0x0006, | ||
2049 | 0x0005, | 2030 | 0x0005, |
2031 | 0x000a, | ||
2032 | 0x0009, | ||
2050 | 0x0006, | 2033 | 0x0006, |
2034 | 0x0005, | ||
2035 | 0x000a, | ||
2051 | 0x0009, | 2036 | 0x0009, |
2037 | 0x0006, | ||
2038 | 0x0005, | ||
2052 | 0x000a, | 2039 | 0x000a, |
2040 | 0x0009, | ||
2041 | 0x0006, | ||
2053 | 0x0005, | 2042 | 0x0005, |
2043 | 0x000a, | ||
2044 | 0x0009, | ||
2054 | 0x0006, | 2045 | 0x0006, |
2046 | 0x0005, | ||
2047 | 0x000a, | ||
2055 | 0x0009, | 2048 | 0x0009, |
2049 | 0x0006, | ||
2050 | 0x0005, | ||
2056 | 0x000a, | 2051 | 0x000a, |
2052 | 0x0009, | ||
2053 | 0x0006, | ||
2057 | 0x0005, | 2054 | 0x0005, |
2055 | 0x000a, | ||
2056 | 0x0009, | ||
2058 | 0x0006, | 2057 | 0x0006, |
2058 | 0x0005, | ||
2059 | }; | 2059 | }; |
2060 | 2060 | ||
2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { | 2061 | static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { |
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c index e8324b5e5bfe..6c7493c2d698 100644 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/iwlegacy/4965-rs.c | |||
@@ -2152,7 +2152,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2152 | int rate_idx; | 2152 | int rate_idx; |
2153 | int i; | 2153 | int i; |
2154 | u32 rate; | 2154 | u32 rate; |
2155 | u8 use_green = il4965_rs_use_green(il, sta); | 2155 | u8 use_green; |
2156 | u8 active_tbl = 0; | 2156 | u8 active_tbl = 0; |
2157 | u8 valid_tx_ant; | 2157 | u8 valid_tx_ant; |
2158 | struct il_station_priv *sta_priv; | 2158 | struct il_station_priv *sta_priv; |
@@ -2160,6 +2160,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf, | |||
2160 | if (!sta || !lq_sta) | 2160 | if (!sta || !lq_sta) |
2161 | return; | 2161 | return; |
2162 | 2162 | ||
2163 | use_green = il4965_rs_use_green(il, sta); | ||
2163 | sta_priv = (void *)sta->drv_priv; | 2164 | sta_priv = (void *)sta->drv_priv; |
2164 | 2165 | ||
2165 | i = lq_sta->last_txrate_idx; | 2166 | i = lq_sta->last_txrate_idx; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c index 86ea5f4c3939..44ca0e57f9f7 100644 --- a/drivers/net/wireless/iwlwifi/dvm/lib.c +++ b/drivers/net/wireless/iwlwifi/dvm/lib.c | |||
@@ -1262,6 +1262,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | /* | 1264 | /* |
1265 | * This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag | ||
1266 | * in iwl_down but cancel the workers only later. | ||
1267 | */ | ||
1268 | if (!priv->ucode_loaded) { | ||
1269 | IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id); | ||
1270 | return -EIO; | ||
1271 | } | ||
1272 | |||
1273 | /* | ||
1265 | * Synchronous commands from this op-mode must hold | 1274 | * Synchronous commands from this op-mode must hold |
1266 | * the mutex, this ensures we don't try to send two | 1275 | * the mutex, this ensures we don't try to send two |
1267 | * (or more) synchronous commands at a time. | 1276 | * (or more) synchronous commands at a time. |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 23be948cf162..a82b6b39d4ff 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -1419,6 +1419,14 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1419 | 1419 | ||
1420 | mutex_lock(&priv->mutex); | 1420 | mutex_lock(&priv->mutex); |
1421 | 1421 | ||
1422 | if (changes & BSS_CHANGED_IDLE && bss_conf->idle) { | ||
1423 | /* | ||
1424 | * If we go idle, then clearly no "passive-no-rx" | ||
1425 | * workaround is needed any more, this is a reset. | ||
1426 | */ | ||
1427 | iwlagn_lift_passive_no_rx(priv); | ||
1428 | } | ||
1429 | |||
1422 | if (unlikely(!iwl_is_ready(priv))) { | 1430 | if (unlikely(!iwl_is_ready(priv))) { |
1423 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 1431 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
1424 | mutex_unlock(&priv->mutex); | 1432 | mutex_unlock(&priv->mutex); |
@@ -1450,16 +1458,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1450 | priv->timestamp = bss_conf->sync_tsf; | 1458 | priv->timestamp = bss_conf->sync_tsf; |
1451 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; | 1459 | ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; |
1452 | } else { | 1460 | } else { |
1453 | /* | ||
1454 | * If we disassociate while there are pending | ||
1455 | * frames, just wake up the queues and let the | ||
1456 | * frames "escape" ... This shouldn't really | ||
1457 | * be happening to start with, but we should | ||
1458 | * not get stuck in this case either since it | ||
1459 | * can happen if userspace gets confused. | ||
1460 | */ | ||
1461 | iwlagn_lift_passive_no_rx(priv); | ||
1462 | |||
1463 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1461 | ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1464 | 1462 | ||
1465 | if (ctx->ctxid == IWL_RXON_CTX_BSS) | 1463 | if (ctx->ctxid == IWL_RXON_CTX_BSS) |
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c index 6aec2df3bb27..d1a670d7b10c 100644 --- a/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/drivers/net/wireless/iwlwifi/dvm/tx.c | |||
@@ -1192,7 +1192,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, | |||
1192 | memset(&info->status, 0, sizeof(info->status)); | 1192 | memset(&info->status, 0, sizeof(info->status)); |
1193 | 1193 | ||
1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && | 1194 | if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && |
1195 | iwl_is_associated_ctx(ctx) && ctx->vif && | 1195 | ctx->vif && |
1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { | 1196 | ctx->vif->type == NL80211_IFTYPE_STATION) { |
1197 | /* block and stop all queues */ | 1197 | /* block and stop all queues */ |
1198 | priv->passive_no_rx = true; | 1198 | priv->passive_no_rx = true; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c index 736fe9bb140e..1a4ac9236a44 100644 --- a/drivers/net/wireless/iwlwifi/dvm/ucode.c +++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c | |||
@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
367 | return -EIO; | 367 | return -EIO; |
368 | } | 368 | } |
369 | 369 | ||
370 | priv->ucode_loaded = true; | ||
371 | |||
370 | if (ucode_type != IWL_UCODE_WOWLAN) { | 372 | if (ucode_type != IWL_UCODE_WOWLAN) { |
371 | /* delay a bit to give rfkill time to run */ | 373 | /* delay a bit to give rfkill time to run */ |
372 | msleep(5); | 374 | msleep(5); |
@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, | |||
380 | return ret; | 382 | return ret; |
381 | } | 383 | } |
382 | 384 | ||
383 | priv->ucode_loaded = true; | ||
384 | |||
385 | return 0; | 385 | return 0; |
386 | } | 386 | } |
387 | 387 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 17bedc50e753..12c4f31ca8fb 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -475,6 +475,10 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, | |||
475 | 475 | ||
476 | /* If platform's RF_KILL switch is NOT set to KILL */ | 476 | /* If platform's RF_KILL switch is NOT set to KILL */ |
477 | hw_rfkill = iwl_is_rfkill_set(trans); | 477 | hw_rfkill = iwl_is_rfkill_set(trans); |
478 | if (hw_rfkill) | ||
479 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
480 | else | ||
481 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
478 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 482 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
479 | if (hw_rfkill && !run_in_rfkill) | 483 | if (hw_rfkill && !run_in_rfkill) |
480 | return -ERFKILL; | 484 | return -ERFKILL; |
@@ -641,6 +645,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
641 | 645 | ||
642 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | 646 | static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) |
643 | { | 647 | { |
648 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | ||
644 | bool hw_rfkill; | 649 | bool hw_rfkill; |
645 | int err; | 650 | int err; |
646 | 651 | ||
@@ -656,6 +661,10 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
656 | iwl_enable_rfkill_int(trans); | 661 | iwl_enable_rfkill_int(trans); |
657 | 662 | ||
658 | hw_rfkill = iwl_is_rfkill_set(trans); | 663 | hw_rfkill = iwl_is_rfkill_set(trans); |
664 | if (hw_rfkill) | ||
665 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
666 | else | ||
667 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
659 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 668 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
660 | 669 | ||
661 | return 0; | 670 | return 0; |
@@ -694,6 +703,10 @@ static void iwl_trans_pcie_stop_hw(struct iwl_trans *trans, | |||
694 | * op_mode. | 703 | * op_mode. |
695 | */ | 704 | */ |
696 | hw_rfkill = iwl_is_rfkill_set(trans); | 705 | hw_rfkill = iwl_is_rfkill_set(trans); |
706 | if (hw_rfkill) | ||
707 | set_bit(STATUS_RFKILL, &trans_pcie->status); | ||
708 | else | ||
709 | clear_bit(STATUS_RFKILL, &trans_pcie->status); | ||
697 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 710 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
698 | } | 711 | } |
699 | } | 712 | } |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 8595c16f74de..cb5c6792e3a8 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -1264,7 +1264,7 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans, | |||
1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { | 1264 | for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) { |
1265 | int copy = 0; | 1265 | int copy = 0; |
1266 | 1266 | ||
1267 | if (!cmd->len) | 1267 | if (!cmd->len[i]) |
1268 | continue; | 1268 | continue; |
1269 | 1269 | ||
1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ | 1270 | /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */ |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index a44023a7bd57..8aaf56ade4d9 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1892,7 +1892,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy, | |||
1892 | } | 1892 | } |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | for (i = 0; i < request->n_channels; i++) { | 1895 | for (i = 0; i < min_t(u32, request->n_channels, |
1896 | MWIFIEX_USER_SCAN_CHAN_MAX); i++) { | ||
1896 | chan = request->channels[i]; | 1897 | chan = request->channels[i]; |
1897 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; | 1898 | priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; |
1898 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; | 1899 | priv->user_scan_cfg->chan_list[i].radio_type = chan->band; |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 5c395e2e6a2b..feb204613397 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -1508,6 +1508,7 @@ static int mwifiex_pcie_process_cmd_complete(struct mwifiex_adapter *adapter) | |||
1508 | } | 1508 | } |
1509 | memcpy(adapter->upld_buf, skb->data, | 1509 | memcpy(adapter->upld_buf, skb->data, |
1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); | 1510 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); |
1511 | skb_push(skb, INTF_HEADER_LEN); | ||
1511 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, | 1512 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
1512 | PCI_DMA_FROMDEVICE)) | 1513 | PCI_DMA_FROMDEVICE)) |
1513 | return -1; | 1514 | return -1; |
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index eef38cfd812e..ca33ae193935 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/mei_bus.h> | 25 | #include <linux/mei_cl_bus.h> |
26 | 26 | ||
27 | #include <linux/nfc.h> | 27 | #include <linux/nfc.h> |
28 | #include <net/nfc/hci.h> | 28 | #include <net/nfc/hci.h> |
@@ -32,9 +32,6 @@ | |||
32 | 32 | ||
33 | #define MICROREAD_DRIVER_NAME "microread" | 33 | #define MICROREAD_DRIVER_NAME "microread" |
34 | 34 | ||
35 | #define MICROREAD_UUID UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, 0x94, \ | ||
36 | 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c) | ||
37 | |||
38 | struct mei_nfc_hdr { | 35 | struct mei_nfc_hdr { |
39 | u8 cmd; | 36 | u8 cmd; |
40 | u8 status; | 37 | u8 status; |
@@ -48,7 +45,7 @@ struct mei_nfc_hdr { | |||
48 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) | 45 | #define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) |
49 | 46 | ||
50 | struct microread_mei_phy { | 47 | struct microread_mei_phy { |
51 | struct mei_device *mei_device; | 48 | struct mei_cl_device *device; |
52 | struct nfc_hci_dev *hdev; | 49 | struct nfc_hci_dev *hdev; |
53 | 50 | ||
54 | int powered; | 51 | int powered; |
@@ -105,14 +102,14 @@ static int microread_mei_write(void *phy_id, struct sk_buff *skb) | |||
105 | 102 | ||
106 | MEI_DUMP_SKB_OUT("mei frame sent", skb); | 103 | MEI_DUMP_SKB_OUT("mei frame sent", skb); |
107 | 104 | ||
108 | r = mei_send(phy->device, skb->data, skb->len); | 105 | r = mei_cl_send(phy->device, skb->data, skb->len); |
109 | if (r > 0) | 106 | if (r > 0) |
110 | r = 0; | 107 | r = 0; |
111 | 108 | ||
112 | return r; | 109 | return r; |
113 | } | 110 | } |
114 | 111 | ||
115 | static void microread_event_cb(struct mei_device *device, u32 events, | 112 | static void microread_event_cb(struct mei_cl_device *device, u32 events, |
116 | void *context) | 113 | void *context) |
117 | { | 114 | { |
118 | struct microread_mei_phy *phy = context; | 115 | struct microread_mei_phy *phy = context; |
@@ -120,7 +117,7 @@ static void microread_event_cb(struct mei_device *device, u32 events, | |||
120 | if (phy->hard_fault != 0) | 117 | if (phy->hard_fault != 0) |
121 | return; | 118 | return; |
122 | 119 | ||
123 | if (events & BIT(MEI_EVENT_RX)) { | 120 | if (events & BIT(MEI_CL_EVENT_RX)) { |
124 | struct sk_buff *skb; | 121 | struct sk_buff *skb; |
125 | int reply_size; | 122 | int reply_size; |
126 | 123 | ||
@@ -128,7 +125,7 @@ static void microread_event_cb(struct mei_device *device, u32 events, | |||
128 | if (!skb) | 125 | if (!skb) |
129 | return; | 126 | return; |
130 | 127 | ||
131 | reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ); | 128 | reply_size = mei_cl_recv(device, skb->data, MEI_NFC_MAX_READ); |
132 | if (reply_size < MEI_NFC_HEADER_SIZE) { | 129 | if (reply_size < MEI_NFC_HEADER_SIZE) { |
133 | kfree(skb); | 130 | kfree(skb); |
134 | return; | 131 | return; |
@@ -149,8 +146,8 @@ static struct nfc_phy_ops mei_phy_ops = { | |||
149 | .disable = microread_mei_disable, | 146 | .disable = microread_mei_disable, |
150 | }; | 147 | }; |
151 | 148 | ||
152 | static int microread_mei_probe(struct mei_device *device, | 149 | static int microread_mei_probe(struct mei_cl_device *device, |
153 | const struct mei_id *id) | 150 | const struct mei_cl_device_id *id) |
154 | { | 151 | { |
155 | struct microread_mei_phy *phy; | 152 | struct microread_mei_phy *phy; |
156 | int r; | 153 | int r; |
@@ -164,9 +161,9 @@ static int microread_mei_probe(struct mei_device *device, | |||
164 | } | 161 | } |
165 | 162 | ||
166 | phy->device = device; | 163 | phy->device = device; |
167 | mei_set_clientdata(device, phy); | 164 | mei_cl_set_drvdata(device, phy); |
168 | 165 | ||
169 | r = mei_register_event_cb(device, microread_event_cb, phy); | 166 | r = mei_cl_register_event_cb(device, microread_event_cb, phy); |
170 | if (r) { | 167 | if (r) { |
171 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); | 168 | pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); |
172 | goto err_out; | 169 | goto err_out; |
@@ -186,9 +183,9 @@ err_out: | |||
186 | return r; | 183 | return r; |
187 | } | 184 | } |
188 | 185 | ||
189 | static int microread_mei_remove(struct mei_device *device) | 186 | static int microread_mei_remove(struct mei_cl_device *device) |
190 | { | 187 | { |
191 | struct microread_mei_phy *phy = mei_get_clientdata(device); | 188 | struct microread_mei_phy *phy = mei_cl_get_drvdata(device); |
192 | 189 | ||
193 | pr_info("Removing microread\n"); | 190 | pr_info("Removing microread\n"); |
194 | 191 | ||
@@ -202,16 +199,15 @@ static int microread_mei_remove(struct mei_device *device) | |||
202 | return 0; | 199 | return 0; |
203 | } | 200 | } |
204 | 201 | ||
205 | static struct mei_id microread_mei_tbl[] = { | 202 | static struct mei_cl_device_id microread_mei_tbl[] = { |
206 | { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, | 203 | { MICROREAD_DRIVER_NAME }, |
207 | 204 | ||
208 | /* required last entry */ | 205 | /* required last entry */ |
209 | { } | 206 | { } |
210 | }; | 207 | }; |
211 | |||
212 | MODULE_DEVICE_TABLE(mei, microread_mei_tbl); | 208 | MODULE_DEVICE_TABLE(mei, microread_mei_tbl); |
213 | 209 | ||
214 | static struct mei_driver microread_driver = { | 210 | static struct mei_cl_driver microread_driver = { |
215 | .id_table = microread_mei_tbl, | 211 | .id_table = microread_mei_tbl, |
216 | .name = MICROREAD_DRIVER_NAME, | 212 | .name = MICROREAD_DRIVER_NAME, |
217 | 213 | ||
@@ -225,7 +221,7 @@ static int microread_mei_init(void) | |||
225 | 221 | ||
226 | pr_debug(DRIVER_DESC ": %s\n", __func__); | 222 | pr_debug(DRIVER_DESC ": %s\n", __func__); |
227 | 223 | ||
228 | r = mei_driver_register(µread_driver); | 224 | r = mei_cl_driver_register(µread_driver); |
229 | if (r) { | 225 | if (r) { |
230 | pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); | 226 | pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); |
231 | return r; | 227 | return r; |
@@ -236,7 +232,7 @@ static int microread_mei_init(void) | |||
236 | 232 | ||
237 | static void microread_mei_exit(void) | 233 | static void microread_mei_exit(void) |
238 | { | 234 | { |
239 | mei_driver_unregister(µread_driver); | 235 | mei_cl_driver_unregister(µread_driver); |
240 | } | 236 | } |
241 | 237 | ||
242 | module_init(microread_mei_init); | 238 | module_init(microread_mei_init); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dee5dddaa292..5147c210df52 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -53,14 +53,15 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
53 | return; | 53 | return; |
54 | } | 54 | } |
55 | 55 | ||
56 | if (!pci_dev->pm_cap || !pci_dev->pme_support | 56 | /* Clear PME Status if set. */ |
57 | || pci_check_pme_status(pci_dev)) { | 57 | if (pci_dev->pme_support) |
58 | if (pci_dev->pme_poll) | 58 | pci_check_pme_status(pci_dev); |
59 | pci_dev->pme_poll = false; | ||
60 | 59 | ||
61 | pci_wakeup_event(pci_dev); | 60 | if (pci_dev->pme_poll) |
62 | pm_runtime_resume(&pci_dev->dev); | 61 | pci_dev->pme_poll = false; |
63 | } | 62 | |
63 | pci_wakeup_event(pci_dev); | ||
64 | pm_runtime_resume(&pci_dev->dev); | ||
64 | 65 | ||
65 | if (pci_dev->subordinate) | 66 | if (pci_dev->subordinate) |
66 | pci_pme_wakeup_bus(pci_dev->subordinate); | 67 | pci_pme_wakeup_bus(pci_dev->subordinate); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1fa1e482a999..79277fb36c6b 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -390,9 +390,10 @@ static void pci_device_shutdown(struct device *dev) | |||
390 | 390 | ||
391 | /* | 391 | /* |
392 | * Turn off Bus Master bit on the device to tell it to not | 392 | * Turn off Bus Master bit on the device to tell it to not |
393 | * continue to do DMA | 393 | * continue to do DMA. Don't touch devices in D3cold or unknown states. |
394 | */ | 394 | */ |
395 | pci_clear_master(pci_dev); | 395 | if (pci_dev->current_state <= PCI_D3hot) |
396 | pci_clear_master(pci_dev); | ||
396 | } | 397 | } |
397 | 398 | ||
398 | #ifdef CONFIG_PM | 399 | #ifdef CONFIG_PM |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 08c243ab034e..ed4d09498337 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -185,14 +185,6 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { | |||
185 | #endif /* !PM */ | 185 | #endif /* !PM */ |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * PCIe port runtime suspend is broken for some chipsets, so use a | ||
189 | * black list to disable runtime PM for these chipsets. | ||
190 | */ | ||
191 | static const struct pci_device_id port_runtime_pm_black_list[] = { | ||
192 | { /* end: all zeroes */ } | ||
193 | }; | ||
194 | |||
195 | /* | ||
196 | * pcie_portdrv_probe - Probe PCI-Express port devices | 188 | * pcie_portdrv_probe - Probe PCI-Express port devices |
197 | * @dev: PCI-Express port device being probed | 189 | * @dev: PCI-Express port device being probed |
198 | * | 190 | * |
@@ -225,16 +217,11 @@ static int pcie_portdrv_probe(struct pci_dev *dev, | |||
225 | * it by default. | 217 | * it by default. |
226 | */ | 218 | */ |
227 | dev->d3cold_allowed = false; | 219 | dev->d3cold_allowed = false; |
228 | if (!pci_match_id(port_runtime_pm_black_list, dev)) | ||
229 | pm_runtime_put_noidle(&dev->dev); | ||
230 | |||
231 | return 0; | 220 | return 0; |
232 | } | 221 | } |
233 | 222 | ||
234 | static void pcie_portdrv_remove(struct pci_dev *dev) | 223 | static void pcie_portdrv_remove(struct pci_dev *dev) |
235 | { | 224 | { |
236 | if (!pci_match_id(port_runtime_pm_black_list, dev)) | ||
237 | pm_runtime_get_noresume(&dev->dev); | ||
238 | pcie_port_device_remove(dev); | 225 | pcie_port_device_remove(dev); |
239 | pci_disable_device(dev); | 226 | pci_disable_device(dev); |
240 | } | 227 | } |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index b41ac7756a4b..c5d0a08a8747 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -100,27 +100,6 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) | |||
100 | return min((size_t)(image - rom), size); | 100 | return min((size_t)(image - rom), size); |
101 | } | 101 | } |
102 | 102 | ||
103 | static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size) | ||
104 | { | ||
105 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | ||
106 | loff_t start; | ||
107 | |||
108 | /* assign the ROM an address if it doesn't have one */ | ||
109 | if (res->parent == NULL && pci_assign_resource(pdev, PCI_ROM_RESOURCE)) | ||
110 | return 0; | ||
111 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | ||
112 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
113 | |||
114 | if (*size == 0) | ||
115 | return 0; | ||
116 | |||
117 | /* Enable ROM space decodes */ | ||
118 | if (pci_enable_rom(pdev)) | ||
119 | return 0; | ||
120 | |||
121 | return start; | ||
122 | } | ||
123 | |||
124 | /** | 103 | /** |
125 | * pci_map_rom - map a PCI ROM to kernel space | 104 | * pci_map_rom - map a PCI ROM to kernel space |
126 | * @pdev: pointer to pci device struct | 105 | * @pdev: pointer to pci device struct |
@@ -135,7 +114,7 @@ static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size) | |||
135 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | 114 | void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) |
136 | { | 115 | { |
137 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | 116 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
138 | loff_t start = 0; | 117 | loff_t start; |
139 | void __iomem *rom; | 118 | void __iomem *rom; |
140 | 119 | ||
141 | /* | 120 | /* |
@@ -154,21 +133,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
154 | return (void __iomem *)(unsigned long) | 133 | return (void __iomem *)(unsigned long) |
155 | pci_resource_start(pdev, PCI_ROM_RESOURCE); | 134 | pci_resource_start(pdev, PCI_ROM_RESOURCE); |
156 | } else { | 135 | } else { |
157 | start = pci_find_rom(pdev, size); | 136 | /* assign the ROM an address if it doesn't have one */ |
158 | } | 137 | if (res->parent == NULL && |
159 | } | 138 | pci_assign_resource(pdev,PCI_ROM_RESOURCE)) |
139 | return NULL; | ||
140 | start = pci_resource_start(pdev, PCI_ROM_RESOURCE); | ||
141 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
142 | if (*size == 0) | ||
143 | return NULL; | ||
160 | 144 | ||
161 | /* | 145 | /* Enable ROM space decodes */ |
162 | * Some devices may provide ROMs via a source other than the BAR | 146 | if (pci_enable_rom(pdev)) |
163 | */ | 147 | return NULL; |
164 | if (!start && pdev->rom && pdev->romlen) { | 148 | } |
165 | *size = pdev->romlen; | ||
166 | return phys_to_virt(pdev->rom); | ||
167 | } | 149 | } |
168 | 150 | ||
169 | if (!start) | ||
170 | return NULL; | ||
171 | |||
172 | rom = ioremap(start, *size); | 151 | rom = ioremap(start, *size); |
173 | if (!rom) { | 152 | if (!rom) { |
174 | /* restore enable if ioremap fails */ | 153 | /* restore enable if ioremap fails */ |
@@ -202,8 +181,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) | |||
202 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) | 181 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) |
203 | return; | 182 | return; |
204 | 183 | ||
205 | if (!pdev->rom || !pdev->romlen) | 184 | iounmap(rom); |
206 | iounmap(rom); | ||
207 | 185 | ||
208 | /* Disable again before continuing, leave enabled if pci=rom */ | 186 | /* Disable again before continuing, leave enabled if pci=rom */ |
209 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) | 187 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | IORESOURCE_ROM_SHADOW))) |
@@ -227,7 +205,24 @@ void pci_cleanup_rom(struct pci_dev *pdev) | |||
227 | } | 205 | } |
228 | } | 206 | } |
229 | 207 | ||
208 | /** | ||
209 | * pci_platform_rom - provides a pointer to any ROM image provided by the | ||
210 | * platform | ||
211 | * @pdev: pointer to pci device struct | ||
212 | * @size: pointer to receive size of pci window over ROM | ||
213 | */ | ||
214 | void __iomem *pci_platform_rom(struct pci_dev *pdev, size_t *size) | ||
215 | { | ||
216 | if (pdev->rom && pdev->romlen) { | ||
217 | *size = pdev->romlen; | ||
218 | return phys_to_virt((phys_addr_t)pdev->rom); | ||
219 | } | ||
220 | |||
221 | return NULL; | ||
222 | } | ||
223 | |||
230 | EXPORT_SYMBOL(pci_map_rom); | 224 | EXPORT_SYMBOL(pci_map_rom); |
231 | EXPORT_SYMBOL(pci_unmap_rom); | 225 | EXPORT_SYMBOL(pci_unmap_rom); |
232 | EXPORT_SYMBOL_GPL(pci_enable_rom); | 226 | EXPORT_SYMBOL_GPL(pci_enable_rom); |
233 | EXPORT_SYMBOL_GPL(pci_disable_rom); | 227 | EXPORT_SYMBOL_GPL(pci_disable_rom); |
228 | EXPORT_SYMBOL(pci_platform_rom); | ||
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 0a9f27e094ea..434ebc3a99dc 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -44,7 +44,6 @@ static DECLARE_COMPLETION(at91_rtc_updated); | |||
44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 44 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
45 | static void __iomem *at91_rtc_regs; | 45 | static void __iomem *at91_rtc_regs; |
46 | static int irq; | 46 | static int irq; |
47 | static u32 at91_rtc_imr; | ||
48 | 47 | ||
49 | /* | 48 | /* |
50 | * Decode time/date into rtc_time structure | 49 | * Decode time/date into rtc_time structure |
@@ -109,11 +108,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
109 | cr = at91_rtc_read(AT91_RTC_CR); | 108 | cr = at91_rtc_read(AT91_RTC_CR); |
110 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 109 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
111 | 110 | ||
112 | at91_rtc_imr |= AT91_RTC_ACKUPD; | ||
113 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 111 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); |
114 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 112 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
115 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 113 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
116 | at91_rtc_imr &= ~AT91_RTC_ACKUPD; | ||
117 | 114 | ||
118 | at91_rtc_write(AT91_RTC_TIMR, | 115 | at91_rtc_write(AT91_RTC_TIMR, |
119 | bin2bcd(tm->tm_sec) << 0 | 116 | bin2bcd(tm->tm_sec) << 0 |
@@ -145,7 +142,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
145 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 142 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
146 | tm->tm_year = at91_alarm_year - 1900; | 143 | tm->tm_year = at91_alarm_year - 1900; |
147 | 144 | ||
148 | alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) | 145 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) |
149 | ? 1 : 0; | 146 | ? 1 : 0; |
150 | 147 | ||
151 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 148 | dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -171,7 +168,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
171 | tm.tm_sec = alrm->time.tm_sec; | 168 | tm.tm_sec = alrm->time.tm_sec; |
172 | 169 | ||
173 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 170 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
174 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
175 | at91_rtc_write(AT91_RTC_TIMALR, | 171 | at91_rtc_write(AT91_RTC_TIMALR, |
176 | bin2bcd(tm.tm_sec) << 0 | 172 | bin2bcd(tm.tm_sec) << 0 |
177 | | bin2bcd(tm.tm_min) << 8 | 173 | | bin2bcd(tm.tm_min) << 8 |
@@ -184,7 +180,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
184 | 180 | ||
185 | if (alrm->enabled) { | 181 | if (alrm->enabled) { |
186 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 182 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
187 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
188 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 183 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
189 | } | 184 | } |
190 | 185 | ||
@@ -201,12 +196,9 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
201 | 196 | ||
202 | if (enabled) { | 197 | if (enabled) { |
203 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 198 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
204 | at91_rtc_imr |= AT91_RTC_ALARM; | ||
205 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); | 199 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
206 | } else { | 200 | } else |
207 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 201 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
208 | at91_rtc_imr &= ~AT91_RTC_ALARM; | ||
209 | } | ||
210 | 202 | ||
211 | return 0; | 203 | return 0; |
212 | } | 204 | } |
@@ -215,10 +207,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
215 | */ | 207 | */ |
216 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 208 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
217 | { | 209 | { |
210 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); | ||
211 | |||
218 | seq_printf(seq, "update_IRQ\t: %s\n", | 212 | seq_printf(seq, "update_IRQ\t: %s\n", |
219 | (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 213 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
220 | seq_printf(seq, "periodic_IRQ\t: %s\n", | 214 | seq_printf(seq, "periodic_IRQ\t: %s\n", |
221 | (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); | 215 | (imr & AT91_RTC_SECEV) ? "yes" : "no"); |
222 | 216 | ||
223 | return 0; | 217 | return 0; |
224 | } | 218 | } |
@@ -233,7 +227,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
233 | unsigned int rtsr; | 227 | unsigned int rtsr; |
234 | unsigned long events = 0; | 228 | unsigned long events = 0; |
235 | 229 | ||
236 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; | 230 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); |
237 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 231 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
238 | if (rtsr & AT91_RTC_ALARM) | 232 | if (rtsr & AT91_RTC_ALARM) |
239 | events |= (RTC_AF | RTC_IRQF); | 233 | events |= (RTC_AF | RTC_IRQF); |
@@ -297,7 +291,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
297 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 291 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
298 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 292 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
299 | AT91_RTC_CALEV); | 293 | AT91_RTC_CALEV); |
300 | at91_rtc_imr = 0; | ||
301 | 294 | ||
302 | ret = request_irq(irq, at91_rtc_interrupt, | 295 | ret = request_irq(irq, at91_rtc_interrupt, |
303 | IRQF_SHARED, | 296 | IRQF_SHARED, |
@@ -336,7 +329,6 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
336 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 329 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
337 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 330 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
338 | AT91_RTC_CALEV); | 331 | AT91_RTC_CALEV); |
339 | at91_rtc_imr = 0; | ||
340 | free_irq(irq, pdev); | 332 | free_irq(irq, pdev); |
341 | 333 | ||
342 | rtc_device_unregister(rtc); | 334 | rtc_device_unregister(rtc); |
@@ -349,35 +341,31 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
349 | 341 | ||
350 | /* AT91RM9200 RTC Power management control */ | 342 | /* AT91RM9200 RTC Power management control */ |
351 | 343 | ||
352 | static u32 at91_rtc_bkpimr; | 344 | static u32 at91_rtc_imr; |
353 | |||
354 | 345 | ||
355 | static int at91_rtc_suspend(struct device *dev) | 346 | static int at91_rtc_suspend(struct device *dev) |
356 | { | 347 | { |
357 | /* this IRQ is shared with DBGU and other hardware which isn't | 348 | /* this IRQ is shared with DBGU and other hardware which isn't |
358 | * necessarily doing PM like we are... | 349 | * necessarily doing PM like we are... |
359 | */ | 350 | */ |
360 | at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 351 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) |
361 | if (at91_rtc_bkpimr) { | 352 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
362 | if (device_may_wakeup(dev)) { | 353 | if (at91_rtc_imr) { |
354 | if (device_may_wakeup(dev)) | ||
363 | enable_irq_wake(irq); | 355 | enable_irq_wake(irq); |
364 | } else { | 356 | else |
365 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); | 357 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); |
366 | at91_rtc_imr &= ~at91_rtc_bkpimr; | 358 | } |
367 | } | ||
368 | } | ||
369 | return 0; | 359 | return 0; |
370 | } | 360 | } |
371 | 361 | ||
372 | static int at91_rtc_resume(struct device *dev) | 362 | static int at91_rtc_resume(struct device *dev) |
373 | { | 363 | { |
374 | if (at91_rtc_bkpimr) { | 364 | if (at91_rtc_imr) { |
375 | if (device_may_wakeup(dev)) { | 365 | if (device_may_wakeup(dev)) |
376 | disable_irq_wake(irq); | 366 | disable_irq_wake(irq); |
377 | } else { | 367 | else |
378 | at91_rtc_imr |= at91_rtc_bkpimr; | 368 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); |
379 | at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr); | ||
380 | } | ||
381 | } | 369 | } |
382 | return 0; | 370 | return 0; |
383 | } | 371 | } |
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h index 5f940b6844cb..da1945e5f714 100644 --- a/drivers/rtc/rtc-at91rm9200.h +++ b/drivers/rtc/rtc-at91rm9200.h | |||
@@ -64,6 +64,7 @@ | |||
64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ | 64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ |
65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ | 65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ |
66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ | 66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ |
67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ | ||
67 | 68 | ||
68 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ | 69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ |
69 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | 70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ |
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c index 5ac9c935c151..e9b9c8392832 100644 --- a/drivers/s390/block/scm_blk.c +++ b/drivers/s390/block/scm_blk.c | |||
@@ -307,7 +307,7 @@ static void scm_blk_handle_error(struct scm_request *scmrq) | |||
307 | case EQC_WR_PROHIBIT: | 307 | case EQC_WR_PROHIBIT: |
308 | spin_lock_irqsave(&bdev->lock, flags); | 308 | spin_lock_irqsave(&bdev->lock, flags); |
309 | if (bdev->state != SCM_WR_PROHIBIT) | 309 | if (bdev->state != SCM_WR_PROHIBIT) |
310 | pr_info("%lu: Write access to the SCM increment is suspended\n", | 310 | pr_info("%lx: Write access to the SCM increment is suspended\n", |
311 | (unsigned long) bdev->scmdev->address); | 311 | (unsigned long) bdev->scmdev->address); |
312 | bdev->state = SCM_WR_PROHIBIT; | 312 | bdev->state = SCM_WR_PROHIBIT; |
313 | spin_unlock_irqrestore(&bdev->lock, flags); | 313 | spin_unlock_irqrestore(&bdev->lock, flags); |
@@ -445,7 +445,7 @@ void scm_blk_set_available(struct scm_blk_dev *bdev) | |||
445 | 445 | ||
446 | spin_lock_irqsave(&bdev->lock, flags); | 446 | spin_lock_irqsave(&bdev->lock, flags); |
447 | if (bdev->state == SCM_WR_PROHIBIT) | 447 | if (bdev->state == SCM_WR_PROHIBIT) |
448 | pr_info("%lu: Write access to the SCM increment is restored\n", | 448 | pr_info("%lx: Write access to the SCM increment is restored\n", |
449 | (unsigned long) bdev->scmdev->address); | 449 | (unsigned long) bdev->scmdev->address); |
450 | bdev->state = SCM_OPER; | 450 | bdev->state = SCM_OPER; |
451 | spin_unlock_irqrestore(&bdev->lock, flags); | 451 | spin_unlock_irqrestore(&bdev->lock, flags); |
@@ -463,12 +463,15 @@ static int __init scm_blk_init(void) | |||
463 | goto out; | 463 | goto out; |
464 | 464 | ||
465 | scm_major = ret; | 465 | scm_major = ret; |
466 | if (scm_alloc_rqs(nr_requests)) | 466 | ret = scm_alloc_rqs(nr_requests); |
467 | if (ret) | ||
467 | goto out_unreg; | 468 | goto out_unreg; |
468 | 469 | ||
469 | scm_debug = debug_register("scm_log", 16, 1, 16); | 470 | scm_debug = debug_register("scm_log", 16, 1, 16); |
470 | if (!scm_debug) | 471 | if (!scm_debug) { |
472 | ret = -ENOMEM; | ||
471 | goto out_free; | 473 | goto out_free; |
474 | } | ||
472 | 475 | ||
473 | debug_register_view(scm_debug, &debug_hex_ascii_view); | 476 | debug_register_view(scm_debug, &debug_hex_ascii_view); |
474 | debug_set_level(scm_debug, 2); | 477 | debug_set_level(scm_debug, 2); |
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c index 5f6180d6ff08..c98cf52d78d1 100644 --- a/drivers/s390/block/scm_drv.c +++ b/drivers/s390/block/scm_drv.c | |||
@@ -19,7 +19,7 @@ static void scm_notify(struct scm_device *scmdev, enum scm_event event) | |||
19 | 19 | ||
20 | switch (event) { | 20 | switch (event) { |
21 | case SCM_CHANGE: | 21 | case SCM_CHANGE: |
22 | pr_info("%lu: The capabilities of the SCM increment changed\n", | 22 | pr_info("%lx: The capabilities of the SCM increment changed\n", |
23 | (unsigned long) scmdev->address); | 23 | (unsigned long) scmdev->address); |
24 | SCM_LOG(2, "State changed"); | 24 | SCM_LOG(2, "State changed"); |
25 | SCM_LOG_STATE(2, scmdev); | 25 | SCM_LOG_STATE(2, scmdev); |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index b907dba24025..cee69dac3e18 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
915 | int i, rc; | 915 | int i, rc; |
916 | 916 | ||
917 | /* Check if the tty3270 is already there. */ | 917 | /* Check if the tty3270 is already there. */ |
918 | view = raw3270_find_view(&tty3270_fn, tty->index); | 918 | view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR); |
919 | if (!IS_ERR(view)) { | 919 | if (!IS_ERR(view)) { |
920 | tp = container_of(view, struct tty3270, view); | 920 | tp = container_of(view, struct tty3270, view); |
921 | tty->driver_data = tp; | 921 | tty->driver_data = tp; |
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) | |||
927 | tp->inattr = TF_INPUT; | 927 | tp->inattr = TF_INPUT; |
928 | return tty_port_install(&tp->port, driver, tty); | 928 | return tty_port_install(&tp->port, driver, tty); |
929 | } | 929 | } |
930 | if (tty3270_max_index < tty->index) | 930 | if (tty3270_max_index < tty->index + 1) |
931 | tty3270_max_index = tty->index; | 931 | tty3270_max_index = tty->index + 1; |
932 | 932 | ||
933 | /* Allocate tty3270 structure on first open. */ | 933 | /* Allocate tty3270 structure on first open. */ |
934 | tp = tty3270_alloc_view(); | 934 | tp = tty3270_alloc_view(); |
935 | if (IS_ERR(tp)) | 935 | if (IS_ERR(tp)) |
936 | return PTR_ERR(tp); | 936 | return PTR_ERR(tp); |
937 | 937 | ||
938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); | 938 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
939 | tty->index + RAW3270_FIRSTMINOR); | ||
939 | if (rc) { | 940 | if (rc) { |
940 | tty3270_free_view(tp); | 941 | tty3270_free_view(tp); |
941 | return rc; | 942 | return rc; |
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = { | |||
1846 | 1847 | ||
1847 | void tty3270_create_cb(int minor) | 1848 | void tty3270_create_cb(int minor) |
1848 | { | 1849 | { |
1849 | tty_register_device(tty3270_driver, minor, NULL); | 1850 | tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL); |
1850 | } | 1851 | } |
1851 | 1852 | ||
1852 | void tty3270_destroy_cb(int minor) | 1853 | void tty3270_destroy_cb(int minor) |
1853 | { | 1854 | { |
1854 | tty_unregister_device(tty3270_driver, minor); | 1855 | tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR); |
1855 | } | 1856 | } |
1856 | 1857 | ||
1857 | struct raw3270_notifier tty3270_notifier = | 1858 | struct raw3270_notifier tty3270_notifier = |
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void) | |||
1884 | driver->driver_name = "tty3270"; | 1885 | driver->driver_name = "tty3270"; |
1885 | driver->name = "3270/tty"; | 1886 | driver->name = "3270/tty"; |
1886 | driver->major = IBM_TTY3270_MAJOR; | 1887 | driver->major = IBM_TTY3270_MAJOR; |
1887 | driver->minor_start = 0; | 1888 | driver->minor_start = RAW3270_FIRSTMINOR; |
1889 | driver->name_base = RAW3270_FIRSTMINOR; | ||
1888 | driver->type = TTY_DRIVER_TYPE_SYSTEM; | 1890 | driver->type = TTY_DRIVER_TYPE_SYSTEM; |
1889 | driver->subtype = SYSTEM_TYPE_TTY; | 1891 | driver->subtype = SYSTEM_TYPE_TTY; |
1890 | driver->init_termios = tty_std_termios; | 1892 | driver->init_termios = tty_std_termios; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 2daf4b0da434..90bc7bd00966 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -940,6 +940,7 @@ static int bnx2fc_libfc_config(struct fc_lport *lport) | |||
940 | fc_exch_init(lport); | 940 | fc_exch_init(lport); |
941 | fc_rport_init(lport); | 941 | fc_rport_init(lport); |
942 | fc_disc_init(lport); | 942 | fc_disc_init(lport); |
943 | fc_disc_config(lport, lport); | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
945 | 946 | ||
@@ -2133,6 +2134,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2133 | } | 2134 | } |
2134 | 2135 | ||
2135 | ctlr = bnx2fc_to_ctlr(interface); | 2136 | ctlr = bnx2fc_to_ctlr(interface); |
2137 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2136 | interface->vlan_id = vlan_id; | 2138 | interface->vlan_id = vlan_id; |
2137 | 2139 | ||
2138 | interface->timer_work_queue = | 2140 | interface->timer_work_queue = |
@@ -2143,7 +2145,7 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2143 | goto ifput_err; | 2145 | goto ifput_err; |
2144 | } | 2146 | } |
2145 | 2147 | ||
2146 | lport = bnx2fc_if_create(interface, &interface->hba->pcidev->dev, 0); | 2148 | lport = bnx2fc_if_create(interface, &cdev->dev, 0); |
2147 | if (!lport) { | 2149 | if (!lport) { |
2148 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", | 2150 | printk(KERN_ERR PFX "Failed to create interface (%s)\n", |
2149 | netdev->name); | 2151 | netdev->name); |
@@ -2159,8 +2161,6 @@ static int _bnx2fc_create(struct net_device *netdev, | |||
2159 | /* Make this master N_port */ | 2161 | /* Make this master N_port */ |
2160 | ctlr->lp = lport; | 2162 | ctlr->lp = lport; |
2161 | 2163 | ||
2162 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2163 | |||
2164 | if (link_state == BNX2FC_CREATE_LINK_UP) | 2164 | if (link_state == BNX2FC_CREATE_LINK_UP) |
2165 | cdev->enabled = FCOE_CTLR_ENABLED; | 2165 | cdev->enabled = FCOE_CTLR_ENABLED; |
2166 | else | 2166 | else |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index b5d92fc93c70..9bfdc9a3f897 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -490,7 +490,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
490 | { | 490 | { |
491 | struct net_device *netdev = fcoe->netdev; | 491 | struct net_device *netdev = fcoe->netdev; |
492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); | 492 | struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe); |
493 | struct fcoe_ctlr_device *ctlr_dev = fcoe_ctlr_to_ctlr_dev(fip); | ||
494 | 493 | ||
495 | rtnl_lock(); | 494 | rtnl_lock(); |
496 | if (!fcoe->removed) | 495 | if (!fcoe->removed) |
@@ -501,7 +500,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
501 | /* tear-down the FCoE controller */ | 500 | /* tear-down the FCoE controller */ |
502 | fcoe_ctlr_destroy(fip); | 501 | fcoe_ctlr_destroy(fip); |
503 | scsi_host_put(fip->lp->host); | 502 | scsi_host_put(fip->lp->host); |
504 | fcoe_ctlr_device_delete(ctlr_dev); | ||
505 | dev_put(netdev); | 503 | dev_put(netdev); |
506 | module_put(THIS_MODULE); | 504 | module_put(THIS_MODULE); |
507 | } | 505 | } |
@@ -2194,6 +2192,8 @@ out_nodev: | |||
2194 | */ | 2192 | */ |
2195 | static void fcoe_destroy_work(struct work_struct *work) | 2193 | static void fcoe_destroy_work(struct work_struct *work) |
2196 | { | 2194 | { |
2195 | struct fcoe_ctlr_device *cdev; | ||
2196 | struct fcoe_ctlr *ctlr; | ||
2197 | struct fcoe_port *port; | 2197 | struct fcoe_port *port; |
2198 | struct fcoe_interface *fcoe; | 2198 | struct fcoe_interface *fcoe; |
2199 | struct Scsi_Host *shost; | 2199 | struct Scsi_Host *shost; |
@@ -2224,10 +2224,15 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
2224 | mutex_lock(&fcoe_config_mutex); | 2224 | mutex_lock(&fcoe_config_mutex); |
2225 | 2225 | ||
2226 | fcoe = port->priv; | 2226 | fcoe = port->priv; |
2227 | ctlr = fcoe_to_ctlr(fcoe); | ||
2228 | cdev = fcoe_ctlr_to_ctlr_dev(ctlr); | ||
2229 | |||
2227 | fcoe_if_destroy(port->lport); | 2230 | fcoe_if_destroy(port->lport); |
2228 | fcoe_interface_cleanup(fcoe); | 2231 | fcoe_interface_cleanup(fcoe); |
2229 | 2232 | ||
2230 | mutex_unlock(&fcoe_config_mutex); | 2233 | mutex_unlock(&fcoe_config_mutex); |
2234 | |||
2235 | fcoe_ctlr_device_delete(cdev); | ||
2231 | } | 2236 | } |
2232 | 2237 | ||
2233 | /** | 2238 | /** |
@@ -2335,7 +2340,9 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2335 | rc = -EIO; | 2340 | rc = -EIO; |
2336 | rtnl_unlock(); | 2341 | rtnl_unlock(); |
2337 | fcoe_interface_cleanup(fcoe); | 2342 | fcoe_interface_cleanup(fcoe); |
2338 | goto out_nortnl; | 2343 | mutex_unlock(&fcoe_config_mutex); |
2344 | fcoe_ctlr_device_delete(ctlr_dev); | ||
2345 | goto out; | ||
2339 | } | 2346 | } |
2340 | 2347 | ||
2341 | /* Make this the "master" N_Port */ | 2348 | /* Make this the "master" N_Port */ |
@@ -2375,8 +2382,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_state fip_mode, | |||
2375 | 2382 | ||
2376 | out_nodev: | 2383 | out_nodev: |
2377 | rtnl_unlock(); | 2384 | rtnl_unlock(); |
2378 | out_nortnl: | ||
2379 | mutex_unlock(&fcoe_config_mutex); | 2385 | mutex_unlock(&fcoe_config_mutex); |
2386 | out: | ||
2380 | return rc; | 2387 | return rc; |
2381 | } | 2388 | } |
2382 | 2389 | ||
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 08c3bc398da2..a76247201be5 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c | |||
@@ -2815,6 +2815,47 @@ unlock: | |||
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | /** | 2817 | /** |
2818 | * fcoe_ctlr_mode_set() - Set or reset the ctlr's mode | ||
2819 | * @lport: The local port to be (re)configured | ||
2820 | * @fip: The FCoE controller whose mode is changing | ||
2821 | * @fip_mode: The new fip mode | ||
2822 | * | ||
2823 | * Note that the we shouldn't be changing the libfc discovery settings | ||
2824 | * (fc_disc_config) while an lport is going through the libfc state | ||
2825 | * machine. The mode can only be changed when a fcoe_ctlr device is | ||
2826 | * disabled, so that should ensure that this routine is only called | ||
2827 | * when nothing is happening. | ||
2828 | */ | ||
2829 | void fcoe_ctlr_mode_set(struct fc_lport *lport, struct fcoe_ctlr *fip, | ||
2830 | enum fip_state fip_mode) | ||
2831 | { | ||
2832 | void *priv; | ||
2833 | |||
2834 | WARN_ON(lport->state != LPORT_ST_RESET && | ||
2835 | lport->state != LPORT_ST_DISABLED); | ||
2836 | |||
2837 | if (fip_mode == FIP_MODE_VN2VN) { | ||
2838 | lport->rport_priv_size = sizeof(struct fcoe_rport); | ||
2839 | lport->point_to_multipoint = 1; | ||
2840 | lport->tt.disc_recv_req = fcoe_ctlr_disc_recv; | ||
2841 | lport->tt.disc_start = fcoe_ctlr_disc_start; | ||
2842 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; | ||
2843 | lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final; | ||
2844 | priv = fip; | ||
2845 | } else { | ||
2846 | lport->rport_priv_size = 0; | ||
2847 | lport->point_to_multipoint = 0; | ||
2848 | lport->tt.disc_recv_req = NULL; | ||
2849 | lport->tt.disc_start = NULL; | ||
2850 | lport->tt.disc_stop = NULL; | ||
2851 | lport->tt.disc_stop_final = NULL; | ||
2852 | priv = lport; | ||
2853 | } | ||
2854 | |||
2855 | fc_disc_config(lport, priv); | ||
2856 | } | ||
2857 | |||
2858 | /** | ||
2818 | * fcoe_libfc_config() - Sets up libfc related properties for local port | 2859 | * fcoe_libfc_config() - Sets up libfc related properties for local port |
2819 | * @lport: The local port to configure libfc for | 2860 | * @lport: The local port to configure libfc for |
2820 | * @fip: The FCoE controller in use by the local port | 2861 | * @fip: The FCoE controller in use by the local port |
@@ -2833,21 +2874,9 @@ int fcoe_libfc_config(struct fc_lport *lport, struct fcoe_ctlr *fip, | |||
2833 | fc_exch_init(lport); | 2874 | fc_exch_init(lport); |
2834 | fc_elsct_init(lport); | 2875 | fc_elsct_init(lport); |
2835 | fc_lport_init(lport); | 2876 | fc_lport_init(lport); |
2836 | if (fip->mode == FIP_MODE_VN2VN) | ||
2837 | lport->rport_priv_size = sizeof(struct fcoe_rport); | ||
2838 | fc_rport_init(lport); | 2877 | fc_rport_init(lport); |
2839 | if (fip->mode == FIP_MODE_VN2VN) { | 2878 | fc_disc_init(lport); |
2840 | lport->point_to_multipoint = 1; | 2879 | fcoe_ctlr_mode_set(lport, fip, fip->mode); |
2841 | lport->tt.disc_recv_req = fcoe_ctlr_disc_recv; | ||
2842 | lport->tt.disc_start = fcoe_ctlr_disc_start; | ||
2843 | lport->tt.disc_stop = fcoe_ctlr_disc_stop; | ||
2844 | lport->tt.disc_stop_final = fcoe_ctlr_disc_stop_final; | ||
2845 | mutex_init(&lport->disc.disc_mutex); | ||
2846 | INIT_LIST_HEAD(&lport->disc.rports); | ||
2847 | lport->disc.priv = fip; | ||
2848 | } else { | ||
2849 | fc_disc_init(lport); | ||
2850 | } | ||
2851 | return 0; | 2880 | return 0; |
2852 | } | 2881 | } |
2853 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); | 2882 | EXPORT_SYMBOL_GPL(fcoe_libfc_config); |
@@ -2875,6 +2904,7 @@ EXPORT_SYMBOL(fcoe_fcf_get_selected); | |||
2875 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | 2904 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) |
2876 | { | 2905 | { |
2877 | struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); | 2906 | struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); |
2907 | struct fc_lport *lport = ctlr->lp; | ||
2878 | 2908 | ||
2879 | mutex_lock(&ctlr->ctlr_mutex); | 2909 | mutex_lock(&ctlr->ctlr_mutex); |
2880 | switch (ctlr_dev->mode) { | 2910 | switch (ctlr_dev->mode) { |
@@ -2888,5 +2918,7 @@ void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *ctlr_dev) | |||
2888 | } | 2918 | } |
2889 | 2919 | ||
2890 | mutex_unlock(&ctlr->ctlr_mutex); | 2920 | mutex_unlock(&ctlr->ctlr_mutex); |
2921 | |||
2922 | fcoe_ctlr_mode_set(lport, ctlr, ctlr->mode); | ||
2891 | } | 2923 | } |
2892 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); | 2924 | EXPORT_SYMBOL(fcoe_ctlr_set_fip_mode); |
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8e561e6a557c..880a9068ca12 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -712,12 +712,13 @@ static void fc_disc_stop_final(struct fc_lport *lport) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | /** | 714 | /** |
715 | * fc_disc_init() - Initialize the discovery layer for a local port | 715 | * fc_disc_config() - Configure the discovery layer for a local port |
716 | * @lport: The local port that needs the discovery layer to be initialized | 716 | * @lport: The local port that needs the discovery layer to be configured |
717 | * @priv: Private data structre for users of the discovery layer | ||
717 | */ | 718 | */ |
718 | int fc_disc_init(struct fc_lport *lport) | 719 | void fc_disc_config(struct fc_lport *lport, void *priv) |
719 | { | 720 | { |
720 | struct fc_disc *disc; | 721 | struct fc_disc *disc = &lport->disc; |
721 | 722 | ||
722 | if (!lport->tt.disc_start) | 723 | if (!lport->tt.disc_start) |
723 | lport->tt.disc_start = fc_disc_start; | 724 | lport->tt.disc_start = fc_disc_start; |
@@ -732,12 +733,21 @@ int fc_disc_init(struct fc_lport *lport) | |||
732 | lport->tt.disc_recv_req = fc_disc_recv_req; | 733 | lport->tt.disc_recv_req = fc_disc_recv_req; |
733 | 734 | ||
734 | disc = &lport->disc; | 735 | disc = &lport->disc; |
736 | |||
737 | disc->priv = priv; | ||
738 | } | ||
739 | EXPORT_SYMBOL(fc_disc_config); | ||
740 | |||
741 | /** | ||
742 | * fc_disc_init() - Initialize the discovery layer for a local port | ||
743 | * @lport: The local port that needs the discovery layer to be initialized | ||
744 | */ | ||
745 | void fc_disc_init(struct fc_lport *lport) | ||
746 | { | ||
747 | struct fc_disc *disc = &lport->disc; | ||
748 | |||
735 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); | 749 | INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); |
736 | mutex_init(&disc->disc_mutex); | 750 | mutex_init(&disc->disc_mutex); |
737 | INIT_LIST_HEAD(&disc->rports); | 751 | INIT_LIST_HEAD(&disc->rports); |
738 | |||
739 | disc->priv = lport; | ||
740 | |||
741 | return 0; | ||
742 | } | 752 | } |
743 | EXPORT_SYMBOL(fc_disc_init); | 753 | EXPORT_SYMBOL(fc_disc_init); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index f80eee74a311..2be0de920d67 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -55,6 +55,7 @@ comment "SPI Master Controller Drivers" | |||
55 | 55 | ||
56 | config SPI_ALTERA | 56 | config SPI_ALTERA |
57 | tristate "Altera SPI Controller" | 57 | tristate "Altera SPI Controller" |
58 | depends on GENERIC_HARDIRQS | ||
58 | select SPI_BITBANG | 59 | select SPI_BITBANG |
59 | help | 60 | help |
60 | This is the driver for the Altera SPI Controller. | 61 | This is the driver for the Altera SPI Controller. |
@@ -310,7 +311,7 @@ config SPI_PXA2XX_DMA | |||
310 | 311 | ||
311 | config SPI_PXA2XX | 312 | config SPI_PXA2XX |
312 | tristate "PXA2xx SSP SPI master" | 313 | tristate "PXA2xx SSP SPI master" |
313 | depends on ARCH_PXA || PCI || ACPI | 314 | depends on (ARCH_PXA || PCI || ACPI) && GENERIC_HARDIRQS |
314 | select PXA_SSP if ARCH_PXA | 315 | select PXA_SSP if ARCH_PXA |
315 | help | 316 | help |
316 | This enables using a PXA2xx or Sodaville SSP port as a SPI master | 317 | This enables using a PXA2xx or Sodaville SSP port as a SPI master |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index 9578af782a77..d7df435d962e 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -152,7 +152,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
152 | static int bcm63xx_spi_setup(struct spi_device *spi) | 152 | static int bcm63xx_spi_setup(struct spi_device *spi) |
153 | { | 153 | { |
154 | struct bcm63xx_spi *bs; | 154 | struct bcm63xx_spi *bs; |
155 | int ret; | ||
156 | 155 | ||
157 | bs = spi_master_get_devdata(spi->master); | 156 | bs = spi_master_get_devdata(spi->master); |
158 | 157 | ||
@@ -490,7 +489,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) | |||
490 | default: | 489 | default: |
491 | dev_err(dev, "unsupported MSG_CTL width: %d\n", | 490 | dev_err(dev, "unsupported MSG_CTL width: %d\n", |
492 | bs->msg_ctl_width); | 491 | bs->msg_ctl_width); |
493 | goto out_clk_disable; | 492 | goto out_err; |
494 | } | 493 | } |
495 | 494 | ||
496 | /* Initialize hardware */ | 495 | /* Initialize hardware */ |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 89480b281d74..3e490ee7f275 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi, | |||
164 | 164 | ||
165 | for (i = count; i > 0; i--) { | 165 | for (i = count; i > 0; i--) { |
166 | data = tx_buf ? *tx_buf++ : 0; | 166 | data = tx_buf ? *tx_buf++ : 0; |
167 | if (len == EOFBYTE) | 167 | if (len == EOFBYTE && t->cs_change) |
168 | setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); | 168 | setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); |
169 | out_8(&fifo->txdata_8, data); | 169 | out_8(&fifo->txdata_8, data); |
170 | len--; | 170 | len--; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index b0fe393c882c..371cc66f1a0e 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -1139,6 +1139,35 @@ err_no_rxchan: | |||
1139 | return -ENODEV; | 1139 | return -ENODEV; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static int pl022_dma_autoprobe(struct pl022 *pl022) | ||
1143 | { | ||
1144 | struct device *dev = &pl022->adev->dev; | ||
1145 | |||
1146 | /* automatically configure DMA channels from platform, normally using DT */ | ||
1147 | pl022->dma_rx_channel = dma_request_slave_channel(dev, "rx"); | ||
1148 | if (!pl022->dma_rx_channel) | ||
1149 | goto err_no_rxchan; | ||
1150 | |||
1151 | pl022->dma_tx_channel = dma_request_slave_channel(dev, "tx"); | ||
1152 | if (!pl022->dma_tx_channel) | ||
1153 | goto err_no_txchan; | ||
1154 | |||
1155 | pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
1156 | if (!pl022->dummypage) | ||
1157 | goto err_no_dummypage; | ||
1158 | |||
1159 | return 0; | ||
1160 | |||
1161 | err_no_dummypage: | ||
1162 | dma_release_channel(pl022->dma_tx_channel); | ||
1163 | pl022->dma_tx_channel = NULL; | ||
1164 | err_no_txchan: | ||
1165 | dma_release_channel(pl022->dma_rx_channel); | ||
1166 | pl022->dma_rx_channel = NULL; | ||
1167 | err_no_rxchan: | ||
1168 | return -ENODEV; | ||
1169 | } | ||
1170 | |||
1142 | static void terminate_dma(struct pl022 *pl022) | 1171 | static void terminate_dma(struct pl022 *pl022) |
1143 | { | 1172 | { |
1144 | struct dma_chan *rxchan = pl022->dma_rx_channel; | 1173 | struct dma_chan *rxchan = pl022->dma_rx_channel; |
@@ -1167,6 +1196,11 @@ static inline int configure_dma(struct pl022 *pl022) | |||
1167 | return -ENODEV; | 1196 | return -ENODEV; |
1168 | } | 1197 | } |
1169 | 1198 | ||
1199 | static inline int pl022_dma_autoprobe(struct pl022 *pl022) | ||
1200 | { | ||
1201 | return 0; | ||
1202 | } | ||
1203 | |||
1170 | static inline int pl022_dma_probe(struct pl022 *pl022) | 1204 | static inline int pl022_dma_probe(struct pl022 *pl022) |
1171 | { | 1205 | { |
1172 | return 0; | 1206 | return 0; |
@@ -2226,8 +2260,13 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2226 | goto err_no_irq; | 2260 | goto err_no_irq; |
2227 | } | 2261 | } |
2228 | 2262 | ||
2229 | /* Get DMA channels */ | 2263 | /* Get DMA channels, try autoconfiguration first */ |
2230 | if (platform_info->enable_dma) { | 2264 | status = pl022_dma_autoprobe(pl022); |
2265 | |||
2266 | /* If that failed, use channels from platform_info */ | ||
2267 | if (status == 0) | ||
2268 | platform_info->enable_dma = 1; | ||
2269 | else if (platform_info->enable_dma) { | ||
2231 | status = pl022_dma_probe(pl022); | 2270 | status = pl022_dma_probe(pl022); |
2232 | if (status != 0) | 2271 | if (status != 0) |
2233 | platform_info->enable_dma = 0; | 2272 | platform_info->enable_dma = 0; |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 90b27a3508a6..810413883c79 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1168,7 +1168,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) | |||
1168 | 1168 | ||
1169 | master->dev.parent = &pdev->dev; | 1169 | master->dev.parent = &pdev->dev; |
1170 | master->dev.of_node = pdev->dev.of_node; | 1170 | master->dev.of_node = pdev->dev.of_node; |
1171 | ACPI_HANDLE_SET(&master->dev, ACPI_HANDLE(&pdev->dev)); | ||
1172 | /* the spi->mode bits understood by this driver: */ | 1171 | /* the spi->mode bits understood by this driver: */ |
1173 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 1172 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
1174 | 1173 | ||
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index e862ab8853aa..4188b2faac5c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -994,25 +994,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data) | |||
994 | { | 994 | { |
995 | struct s3c64xx_spi_driver_data *sdd = data; | 995 | struct s3c64xx_spi_driver_data *sdd = data; |
996 | struct spi_master *spi = sdd->master; | 996 | struct spi_master *spi = sdd->master; |
997 | unsigned int val; | 997 | unsigned int val, clr = 0; |
998 | 998 | ||
999 | val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR); | 999 | val = readl(sdd->regs + S3C64XX_SPI_STATUS); |
1000 | 1000 | ||
1001 | val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR | | 1001 | if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) { |
1002 | S3C64XX_SPI_PND_RX_UNDERRUN_CLR | | 1002 | clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR; |
1003 | S3C64XX_SPI_PND_TX_OVERRUN_CLR | | ||
1004 | S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1005 | |||
1006 | writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1007 | |||
1008 | if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR) | ||
1009 | dev_err(&spi->dev, "RX overrun\n"); | 1003 | dev_err(&spi->dev, "RX overrun\n"); |
1010 | if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR) | 1004 | } |
1005 | if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) { | ||
1006 | clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR; | ||
1011 | dev_err(&spi->dev, "RX underrun\n"); | 1007 | dev_err(&spi->dev, "RX underrun\n"); |
1012 | if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR) | 1008 | } |
1009 | if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) { | ||
1010 | clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR; | ||
1013 | dev_err(&spi->dev, "TX overrun\n"); | 1011 | dev_err(&spi->dev, "TX overrun\n"); |
1014 | if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR) | 1012 | } |
1013 | if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) { | ||
1014 | clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1015 | dev_err(&spi->dev, "TX underrun\n"); | 1015 | dev_err(&spi->dev, "TX underrun\n"); |
1016 | } | ||
1017 | |||
1018 | /* Clear the pending irq by setting and then clearing it */ | ||
1019 | writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1020 | writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR); | ||
1016 | 1021 | ||
1017 | return IRQ_HANDLED; | 1022 | return IRQ_HANDLED; |
1018 | } | 1023 | } |
@@ -1036,9 +1041,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel) | |||
1036 | writel(0, regs + S3C64XX_SPI_MODE_CFG); | 1041 | writel(0, regs + S3C64XX_SPI_MODE_CFG); |
1037 | writel(0, regs + S3C64XX_SPI_PACKET_CNT); | 1042 | writel(0, regs + S3C64XX_SPI_PACKET_CNT); |
1038 | 1043 | ||
1039 | /* Clear any irq pending bits */ | 1044 | /* Clear any irq pending bits, should set and clear the bits */ |
1040 | writel(readl(regs + S3C64XX_SPI_PENDING_CLR), | 1045 | val = S3C64XX_SPI_PND_RX_OVERRUN_CLR | |
1041 | regs + S3C64XX_SPI_PENDING_CLR); | 1046 | S3C64XX_SPI_PND_RX_UNDERRUN_CLR | |
1047 | S3C64XX_SPI_PND_TX_OVERRUN_CLR | | ||
1048 | S3C64XX_SPI_PND_TX_UNDERRUN_CLR; | ||
1049 | writel(val, regs + S3C64XX_SPI_PENDING_CLR); | ||
1050 | writel(0, regs + S3C64XX_SPI_PENDING_CLR); | ||
1042 | 1051 | ||
1043 | writel(0, regs + S3C64XX_SPI_SWAP_CFG); | 1052 | writel(0, regs + S3C64XX_SPI_SWAP_CFG); |
1044 | 1053 | ||
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index b8698b389ef3..a829563f4713 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
@@ -858,21 +858,6 @@ static int tegra_slink_setup(struct spi_device *spi) | |||
858 | return 0; | 858 | return 0; |
859 | } | 859 | } |
860 | 860 | ||
861 | static int tegra_slink_prepare_transfer(struct spi_master *master) | ||
862 | { | ||
863 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); | ||
864 | |||
865 | return pm_runtime_get_sync(tspi->dev); | ||
866 | } | ||
867 | |||
868 | static int tegra_slink_unprepare_transfer(struct spi_master *master) | ||
869 | { | ||
870 | struct tegra_slink_data *tspi = spi_master_get_devdata(master); | ||
871 | |||
872 | pm_runtime_put(tspi->dev); | ||
873 | return 0; | ||
874 | } | ||
875 | |||
876 | static int tegra_slink_transfer_one_message(struct spi_master *master, | 861 | static int tegra_slink_transfer_one_message(struct spi_master *master, |
877 | struct spi_message *msg) | 862 | struct spi_message *msg) |
878 | { | 863 | { |
@@ -885,6 +870,12 @@ static int tegra_slink_transfer_one_message(struct spi_master *master, | |||
885 | 870 | ||
886 | msg->status = 0; | 871 | msg->status = 0; |
887 | msg->actual_length = 0; | 872 | msg->actual_length = 0; |
873 | ret = pm_runtime_get_sync(tspi->dev); | ||
874 | if (ret < 0) { | ||
875 | dev_err(tspi->dev, "runtime get failed: %d\n", ret); | ||
876 | goto done; | ||
877 | } | ||
878 | |||
888 | single_xfer = list_is_singular(&msg->transfers); | 879 | single_xfer = list_is_singular(&msg->transfers); |
889 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 880 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
890 | INIT_COMPLETION(tspi->xfer_completion); | 881 | INIT_COMPLETION(tspi->xfer_completion); |
@@ -921,6 +912,8 @@ static int tegra_slink_transfer_one_message(struct spi_master *master, | |||
921 | exit: | 912 | exit: |
922 | tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); | 913 | tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); |
923 | tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); | 914 | tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); |
915 | pm_runtime_put(tspi->dev); | ||
916 | done: | ||
924 | msg->status = ret; | 917 | msg->status = ret; |
925 | spi_finalize_current_message(master); | 918 | spi_finalize_current_message(master); |
926 | return ret; | 919 | return ret; |
@@ -1148,9 +1141,7 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
1148 | /* the spi->mode bits understood by this driver: */ | 1141 | /* the spi->mode bits understood by this driver: */ |
1149 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; | 1142 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; |
1150 | master->setup = tegra_slink_setup; | 1143 | master->setup = tegra_slink_setup; |
1151 | master->prepare_transfer_hardware = tegra_slink_prepare_transfer; | ||
1152 | master->transfer_one_message = tegra_slink_transfer_one_message; | 1144 | master->transfer_one_message = tegra_slink_transfer_one_message; |
1153 | master->unprepare_transfer_hardware = tegra_slink_unprepare_transfer; | ||
1154 | master->num_chipselect = MAX_CHIP_SELECT; | 1145 | master->num_chipselect = MAX_CHIP_SELECT; |
1155 | master->bus_num = -1; | 1146 | master->bus_num = -1; |
1156 | 1147 | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index f996c600eb8c..004b10f184d4 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -543,17 +543,16 @@ static void spi_pump_messages(struct kthread_work *work) | |||
543 | /* Lock queue and check for queue work */ | 543 | /* Lock queue and check for queue work */ |
544 | spin_lock_irqsave(&master->queue_lock, flags); | 544 | spin_lock_irqsave(&master->queue_lock, flags); |
545 | if (list_empty(&master->queue) || !master->running) { | 545 | if (list_empty(&master->queue) || !master->running) { |
546 | if (master->busy && master->unprepare_transfer_hardware) { | 546 | if (!master->busy) { |
547 | ret = master->unprepare_transfer_hardware(master); | 547 | spin_unlock_irqrestore(&master->queue_lock, flags); |
548 | if (ret) { | 548 | return; |
549 | spin_unlock_irqrestore(&master->queue_lock, flags); | ||
550 | dev_err(&master->dev, | ||
551 | "failed to unprepare transfer hardware\n"); | ||
552 | return; | ||
553 | } | ||
554 | } | 549 | } |
555 | master->busy = false; | 550 | master->busy = false; |
556 | spin_unlock_irqrestore(&master->queue_lock, flags); | 551 | spin_unlock_irqrestore(&master->queue_lock, flags); |
552 | if (master->unprepare_transfer_hardware && | ||
553 | master->unprepare_transfer_hardware(master)) | ||
554 | dev_err(&master->dev, | ||
555 | "failed to unprepare transfer hardware\n"); | ||
557 | return; | 556 | return; |
558 | } | 557 | } |
559 | 558 | ||
@@ -984,7 +983,7 @@ static void acpi_register_spi_devices(struct spi_master *master) | |||
984 | acpi_status status; | 983 | acpi_status status; |
985 | acpi_handle handle; | 984 | acpi_handle handle; |
986 | 985 | ||
987 | handle = ACPI_HANDLE(&master->dev); | 986 | handle = ACPI_HANDLE(master->dev.parent); |
988 | if (!handle) | 987 | if (!handle) |
989 | return; | 988 | return; |
990 | 989 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 3ea5408fcbeb..1c1942b5cee9 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -245,7 +245,7 @@ static void pl011_sgbuf_free(struct dma_chan *chan, struct pl011_sgbuf *sg, | |||
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | 248 | static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *uap) |
249 | { | 249 | { |
250 | /* DMA is the sole user of the platform data right now */ | 250 | /* DMA is the sole user of the platform data right now */ |
251 | struct amba_pl011_data *plat = uap->port.dev->platform_data; | 251 | struct amba_pl011_data *plat = uap->port.dev->platform_data; |
@@ -259,20 +259,25 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
259 | struct dma_chan *chan; | 259 | struct dma_chan *chan; |
260 | dma_cap_mask_t mask; | 260 | dma_cap_mask_t mask; |
261 | 261 | ||
262 | /* We need platform data */ | 262 | chan = dma_request_slave_channel(dev, "tx"); |
263 | if (!plat || !plat->dma_filter) { | ||
264 | dev_info(uap->port.dev, "no DMA platform data\n"); | ||
265 | return; | ||
266 | } | ||
267 | 263 | ||
268 | /* Try to acquire a generic DMA engine slave TX channel */ | ||
269 | dma_cap_zero(mask); | ||
270 | dma_cap_set(DMA_SLAVE, mask); | ||
271 | |||
272 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_tx_param); | ||
273 | if (!chan) { | 264 | if (!chan) { |
274 | dev_err(uap->port.dev, "no TX DMA channel!\n"); | 265 | /* We need platform data */ |
275 | return; | 266 | if (!plat || !plat->dma_filter) { |
267 | dev_info(uap->port.dev, "no DMA platform data\n"); | ||
268 | return; | ||
269 | } | ||
270 | |||
271 | /* Try to acquire a generic DMA engine slave TX channel */ | ||
272 | dma_cap_zero(mask); | ||
273 | dma_cap_set(DMA_SLAVE, mask); | ||
274 | |||
275 | chan = dma_request_channel(mask, plat->dma_filter, | ||
276 | plat->dma_tx_param); | ||
277 | if (!chan) { | ||
278 | dev_err(uap->port.dev, "no TX DMA channel!\n"); | ||
279 | return; | ||
280 | } | ||
276 | } | 281 | } |
277 | 282 | ||
278 | dmaengine_slave_config(chan, &tx_conf); | 283 | dmaengine_slave_config(chan, &tx_conf); |
@@ -282,7 +287,18 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
282 | dma_chan_name(uap->dmatx.chan)); | 287 | dma_chan_name(uap->dmatx.chan)); |
283 | 288 | ||
284 | /* Optionally make use of an RX channel as well */ | 289 | /* Optionally make use of an RX channel as well */ |
285 | if (plat->dma_rx_param) { | 290 | chan = dma_request_slave_channel(dev, "rx"); |
291 | |||
292 | if (!chan && plat->dma_rx_param) { | ||
293 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param); | ||
294 | |||
295 | if (!chan) { | ||
296 | dev_err(uap->port.dev, "no RX DMA channel!\n"); | ||
297 | return; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | if (chan) { | ||
286 | struct dma_slave_config rx_conf = { | 302 | struct dma_slave_config rx_conf = { |
287 | .src_addr = uap->port.mapbase + UART01x_DR, | 303 | .src_addr = uap->port.mapbase + UART01x_DR, |
288 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | 304 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, |
@@ -291,12 +307,6 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
291 | .device_fc = false, | 307 | .device_fc = false, |
292 | }; | 308 | }; |
293 | 309 | ||
294 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param); | ||
295 | if (!chan) { | ||
296 | dev_err(uap->port.dev, "no RX DMA channel!\n"); | ||
297 | return; | ||
298 | } | ||
299 | |||
300 | dmaengine_slave_config(chan, &rx_conf); | 310 | dmaengine_slave_config(chan, &rx_conf); |
301 | uap->dmarx.chan = chan; | 311 | uap->dmarx.chan = chan; |
302 | 312 | ||
@@ -315,6 +325,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
315 | struct dma_uap { | 325 | struct dma_uap { |
316 | struct list_head node; | 326 | struct list_head node; |
317 | struct uart_amba_port *uap; | 327 | struct uart_amba_port *uap; |
328 | struct device *dev; | ||
318 | }; | 329 | }; |
319 | 330 | ||
320 | static LIST_HEAD(pl011_dma_uarts); | 331 | static LIST_HEAD(pl011_dma_uarts); |
@@ -325,7 +336,7 @@ static int __init pl011_dma_initcall(void) | |||
325 | 336 | ||
326 | list_for_each_safe(node, tmp, &pl011_dma_uarts) { | 337 | list_for_each_safe(node, tmp, &pl011_dma_uarts) { |
327 | struct dma_uap *dmau = list_entry(node, struct dma_uap, node); | 338 | struct dma_uap *dmau = list_entry(node, struct dma_uap, node); |
328 | pl011_dma_probe_initcall(dmau->uap); | 339 | pl011_dma_probe_initcall(dmau->dev, dmau->uap); |
329 | list_del(node); | 340 | list_del(node); |
330 | kfree(dmau); | 341 | kfree(dmau); |
331 | } | 342 | } |
@@ -334,18 +345,19 @@ static int __init pl011_dma_initcall(void) | |||
334 | 345 | ||
335 | device_initcall(pl011_dma_initcall); | 346 | device_initcall(pl011_dma_initcall); |
336 | 347 | ||
337 | static void pl011_dma_probe(struct uart_amba_port *uap) | 348 | static void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
338 | { | 349 | { |
339 | struct dma_uap *dmau = kzalloc(sizeof(struct dma_uap), GFP_KERNEL); | 350 | struct dma_uap *dmau = kzalloc(sizeof(struct dma_uap), GFP_KERNEL); |
340 | if (dmau) { | 351 | if (dmau) { |
341 | dmau->uap = uap; | 352 | dmau->uap = uap; |
353 | dmau->dev = dev; | ||
342 | list_add_tail(&dmau->node, &pl011_dma_uarts); | 354 | list_add_tail(&dmau->node, &pl011_dma_uarts); |
343 | } | 355 | } |
344 | } | 356 | } |
345 | #else | 357 | #else |
346 | static void pl011_dma_probe(struct uart_amba_port *uap) | 358 | static void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
347 | { | 359 | { |
348 | pl011_dma_probe_initcall(uap); | 360 | pl011_dma_probe_initcall(dev, uap); |
349 | } | 361 | } |
350 | #endif | 362 | #endif |
351 | 363 | ||
@@ -979,7 +991,7 @@ static inline bool pl011_dma_rx_running(struct uart_amba_port *uap) | |||
979 | 991 | ||
980 | #else | 992 | #else |
981 | /* Blank functions if the DMA engine is not available */ | 993 | /* Blank functions if the DMA engine is not available */ |
982 | static inline void pl011_dma_probe(struct uart_amba_port *uap) | 994 | static inline void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
983 | { | 995 | { |
984 | } | 996 | } |
985 | 997 | ||
@@ -2020,7 +2032,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2020 | uap->port.ops = &amba_pl011_pops; | 2032 | uap->port.ops = &amba_pl011_pops; |
2021 | uap->port.flags = UPF_BOOT_AUTOCONF; | 2033 | uap->port.flags = UPF_BOOT_AUTOCONF; |
2022 | uap->port.line = i; | 2034 | uap->port.line = i; |
2023 | pl011_dma_probe(uap); | 2035 | pl011_dma_probe(&dev->dev, uap); |
2024 | 2036 | ||
2025 | /* Ensure interrupts from this UART are masked and cleared */ | 2037 | /* Ensure interrupts from this UART are masked and cleared */ |
2026 | writew(0, uap->port.membase + UART011_IMSC); | 2038 | writew(0, uap->port.membase + UART011_IMSC); |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 797f9d514732..65d4e55552c6 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -67,7 +67,6 @@ static void usb_port_device_release(struct device *dev) | |||
67 | { | 67 | { |
68 | struct usb_port *port_dev = to_usb_port(dev); | 68 | struct usb_port *port_dev = to_usb_port(dev); |
69 | 69 | ||
70 | dev_pm_qos_hide_flags(dev); | ||
71 | kfree(port_dev); | 70 | kfree(port_dev); |
72 | } | 71 | } |
73 | 72 | ||
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index 94ad0f71383c..7f6709991a5c 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm, | |||
1400 | fbmode->vmode = 0; | 1400 | fbmode->vmode = 0; |
1401 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 1401 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) |
1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; | 1402 | fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; |
1403 | if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) | 1403 | if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH) |
1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; | 1404 | fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; |
1405 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) | 1405 | if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) |
1406 | fbmode->vmode |= FB_VMODE_INTERLACED; | 1406 | fbmode->vmode |= FB_VMODE_INTERLACED; |
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c index c904f42d81c1..a0c9396ca43f 100644 --- a/drivers/video/omap2/displays/panel-generic-dpi.c +++ b/drivers/video/omap2/displays/panel-generic-dpi.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <video/omapdss.h> | 36 | #include <video/omapdss.h> |
37 | 37 | ||
38 | #include <video/omap-panel-generic-dpi.h> | 38 | #include <video/omap-panel-data.h> |
39 | 39 | ||
40 | struct panel_config { | 40 | struct panel_config { |
41 | struct omap_video_timings timings; | 41 | struct omap_video_timings timings; |
diff --git a/drivers/video/omap2/displays/panel-n8x0.c b/drivers/video/omap2/displays/panel-n8x0.c index dd1294750802..9c6b5fafeb2e 100644 --- a/drivers/video/omap2/displays/panel-n8x0.c +++ b/drivers/video/omap2/displays/panel-n8x0.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/fb.h> | 9 | #include <linux/fb.h> |
10 | 10 | ||
11 | #include <video/omapdss.h> | 11 | #include <video/omapdss.h> |
12 | #include <video/omap-panel-n8x0.h> | 12 | #include <video/omap-panel-data.h> |
13 | 13 | ||
14 | #define BLIZZARD_REV_CODE 0x00 | 14 | #define BLIZZARD_REV_CODE 0x00 |
15 | #define BLIZZARD_CONFIG 0x02 | 15 | #define BLIZZARD_CONFIG 0x02 |
diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c index 1b94018aac3e..974ac29236aa 100644 --- a/drivers/video/omap2/displays/panel-picodlp.c +++ b/drivers/video/omap2/displays/panel-picodlp.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | 32 | ||
33 | #include <video/omapdss.h> | 33 | #include <video/omapdss.h> |
34 | #include <video/omap-panel-picodlp.h> | 34 | #include <video/omap-panel-data.h> |
35 | 35 | ||
36 | #include "panel-picodlp.h" | 36 | #include "panel-picodlp.h" |
37 | 37 | ||
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index a32407a5735a..031d4069f332 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | 34 | ||
35 | #include <video/omapdss.h> | 35 | #include <video/omapdss.h> |
36 | #include <video/omap-panel-nokia-dsi.h> | 36 | #include <video/omap-panel-data.h> |
37 | #include <video/mipi_display.h> | 37 | #include <video/mipi_display.h> |
38 | 38 | ||
39 | /* DSI Virtual channel. Hardcoded for now. */ | 39 | /* DSI Virtual channel. Hardcoded for now. */ |
diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c index 8281baafe1ef..a1dba868cef1 100644 --- a/drivers/video/omap2/displays/panel-tfp410.c +++ b/drivers/video/omap2/displays/panel-tfp410.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <drm/drm_edid.h> | 25 | #include <drm/drm_edid.h> |
26 | 26 | ||
27 | #include <video/omap-panel-tfp410.h> | 27 | #include <video/omap-panel-data.h> |
28 | 28 | ||
29 | static const struct omap_video_timings tfp410_default_timings = { | 29 | static const struct omap_video_timings tfp410_default_timings = { |
30 | .x_res = 640, | 30 | .x_res = 640, |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 63203acef812..0264704a52be 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -858,6 +858,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch) | |||
858 | tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16) | 858 | tmp = ((mode->xres & 7) << 24) | ((display_h_total & 7) << 16) |
859 | | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7); | 859 | | ((mode->hsync_len & 7) << 8) | (hsync_pos & 7); |
860 | lcdc_write_chan(ch, LDHAJR, tmp); | 860 | lcdc_write_chan(ch, LDHAJR, tmp); |
861 | lcdc_write_chan_mirror(ch, LDHAJR, tmp); | ||
861 | } | 862 | } |
862 | 863 | ||
863 | static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) | 864 | static void sh_mobile_lcdc_overlay_setup(struct sh_mobile_lcdc_overlay *ovl) |
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index b75db0186488..d4284458377e 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -1973,7 +1973,8 @@ static int uvesafb_init(void) | |||
1973 | err = -ENOMEM; | 1973 | err = -ENOMEM; |
1974 | 1974 | ||
1975 | if (err) { | 1975 | if (err) { |
1976 | platform_device_put(uvesafb_device); | 1976 | if (uvesafb_device) |
1977 | platform_device_put(uvesafb_device); | ||
1977 | platform_driver_unregister(&uvesafb_driver); | 1978 | platform_driver_unregister(&uvesafb_driver); |
1978 | cn_del_callback(&uvesafb_cn_id); | 1979 | cn_del_callback(&uvesafb_cn_id); |
1979 | return err; | 1980 | return err; |
diff --git a/firmware/Makefile b/firmware/Makefile index 5d8ee1319b5c..cbb09ce9730a 100644 --- a/firmware/Makefile +++ b/firmware/Makefile | |||
@@ -82,7 +82,7 @@ fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \ | |||
82 | fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ | 82 | fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ |
83 | qlogic/12160.bin | 83 | qlogic/12160.bin |
84 | fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin | 84 | fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin |
85 | fw-shipped-$(CONFIG_INFINIBAND_QIB) += intel/sd7220.fw | 85 | fw-shipped-$(CONFIG_INFINIBAND_QIB) += qlogic/sd7220.fw |
86 | fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp | 86 | fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp |
87 | fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ | 87 | fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ |
88 | ess/maestro3_assp_minisrc.fw | 88 | ess/maestro3_assp_minisrc.fw |
diff --git a/firmware/intel/sd7220.fw.ihex b/firmware/qlogic/sd7220.fw.ihex index a33636319112..a33636319112 100644 --- a/firmware/intel/sd7220.fw.ihex +++ b/firmware/qlogic/sd7220.fw.ihex | |||
diff --git a/fs/block_dev.c b/fs/block_dev.c index aea605c98ba6..aae187a7f94a 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -551,6 +551,7 @@ struct block_device *bdgrab(struct block_device *bdev) | |||
551 | ihold(bdev->bd_inode); | 551 | ihold(bdev->bd_inode); |
552 | return bdev; | 552 | return bdev; |
553 | } | 553 | } |
554 | EXPORT_SYMBOL(bdgrab); | ||
554 | 555 | ||
555 | long nr_blockdev_pages(void) | 556 | long nr_blockdev_pages(void) |
556 | { | 557 | { |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 56efcaadf848..9c6d06dcef8b 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2999,20 +2999,23 @@ static int ext4_split_extent_at(handle_t *handle, | |||
2999 | if (split_flag & EXT4_EXT_DATA_VALID1) { | 2999 | if (split_flag & EXT4_EXT_DATA_VALID1) { |
3000 | err = ext4_ext_zeroout(inode, ex2); | 3000 | err = ext4_ext_zeroout(inode, ex2); |
3001 | zero_ex.ee_block = ex2->ee_block; | 3001 | zero_ex.ee_block = ex2->ee_block; |
3002 | zero_ex.ee_len = ext4_ext_get_actual_len(ex2); | 3002 | zero_ex.ee_len = cpu_to_le16( |
3003 | ext4_ext_get_actual_len(ex2)); | ||
3003 | ext4_ext_store_pblock(&zero_ex, | 3004 | ext4_ext_store_pblock(&zero_ex, |
3004 | ext4_ext_pblock(ex2)); | 3005 | ext4_ext_pblock(ex2)); |
3005 | } else { | 3006 | } else { |
3006 | err = ext4_ext_zeroout(inode, ex); | 3007 | err = ext4_ext_zeroout(inode, ex); |
3007 | zero_ex.ee_block = ex->ee_block; | 3008 | zero_ex.ee_block = ex->ee_block; |
3008 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | 3009 | zero_ex.ee_len = cpu_to_le16( |
3010 | ext4_ext_get_actual_len(ex)); | ||
3009 | ext4_ext_store_pblock(&zero_ex, | 3011 | ext4_ext_store_pblock(&zero_ex, |
3010 | ext4_ext_pblock(ex)); | 3012 | ext4_ext_pblock(ex)); |
3011 | } | 3013 | } |
3012 | } else { | 3014 | } else { |
3013 | err = ext4_ext_zeroout(inode, &orig_ex); | 3015 | err = ext4_ext_zeroout(inode, &orig_ex); |
3014 | zero_ex.ee_block = orig_ex.ee_block; | 3016 | zero_ex.ee_block = orig_ex.ee_block; |
3015 | zero_ex.ee_len = ext4_ext_get_actual_len(&orig_ex); | 3017 | zero_ex.ee_len = cpu_to_le16( |
3018 | ext4_ext_get_actual_len(&orig_ex)); | ||
3016 | ext4_ext_store_pblock(&zero_ex, | 3019 | ext4_ext_store_pblock(&zero_ex, |
3017 | ext4_ext_pblock(&orig_ex)); | 3020 | ext4_ext_pblock(&orig_ex)); |
3018 | } | 3021 | } |
@@ -3272,7 +3275,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3272 | if (err) | 3275 | if (err) |
3273 | goto out; | 3276 | goto out; |
3274 | zero_ex.ee_block = ex->ee_block; | 3277 | zero_ex.ee_block = ex->ee_block; |
3275 | zero_ex.ee_len = ext4_ext_get_actual_len(ex); | 3278 | zero_ex.ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)); |
3276 | ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); | 3279 | ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); |
3277 | 3280 | ||
3278 | err = ext4_ext_get_access(handle, inode, path + depth); | 3281 | err = ext4_ext_get_access(handle, inode, path + depth); |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index b505a145a593..a04183127ef0 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -1539,9 +1539,9 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode, | |||
1539 | blk = *i_data; | 1539 | blk = *i_data; |
1540 | if (level > 0) { | 1540 | if (level > 0) { |
1541 | ext4_lblk_t first2; | 1541 | ext4_lblk_t first2; |
1542 | bh = sb_bread(inode->i_sb, blk); | 1542 | bh = sb_bread(inode->i_sb, le32_to_cpu(blk)); |
1543 | if (!bh) { | 1543 | if (!bh) { |
1544 | EXT4_ERROR_INODE_BLOCK(inode, blk, | 1544 | EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk), |
1545 | "Read failure"); | 1545 | "Read failure"); |
1546 | return -EIO; | 1546 | return -EIO; |
1547 | } | 1547 | } |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 019f45e45097..d79c2dadc536 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -923,8 +923,11 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) | |||
923 | cmd = F_SETLK; | 923 | cmd = F_SETLK; |
924 | fl->fl_type = F_UNLCK; | 924 | fl->fl_type = F_UNLCK; |
925 | } | 925 | } |
926 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 926 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { |
927 | if (fl->fl_type == F_UNLCK) | ||
928 | posix_lock_file_wait(file, fl); | ||
927 | return -EIO; | 929 | return -EIO; |
930 | } | ||
928 | if (IS_GETLK(cmd)) | 931 | if (IS_GETLK(cmd)) |
929 | return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); | 932 | return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); |
930 | else if (fl->fl_type == F_UNLCK) | 933 | else if (fl->fl_type == F_UNLCK) |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 156e42ec84ea..5c29216e9cc1 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -588,6 +588,7 @@ struct lm_lockstruct { | |||
588 | struct dlm_lksb ls_control_lksb; /* control_lock */ | 588 | struct dlm_lksb ls_control_lksb; /* control_lock */ |
589 | char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */ | 589 | char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */ |
590 | struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */ | 590 | struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */ |
591 | char *ls_lvb_bits; | ||
591 | 592 | ||
592 | spinlock_t ls_recover_spin; /* protects following fields */ | 593 | spinlock_t ls_recover_spin; /* protects following fields */ |
593 | unsigned long ls_recover_flags; /* DFL_ */ | 594 | unsigned long ls_recover_flags; /* DFL_ */ |
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 9802de0f85e6..c8423d6de6c3 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -483,12 +483,8 @@ static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen, | |||
483 | 483 | ||
484 | static int all_jid_bits_clear(char *lvb) | 484 | static int all_jid_bits_clear(char *lvb) |
485 | { | 485 | { |
486 | int i; | 486 | return !memchr_inv(lvb + JID_BITMAP_OFFSET, 0, |
487 | for (i = JID_BITMAP_OFFSET; i < GDLM_LVB_SIZE; i++) { | 487 | GDLM_LVB_SIZE - JID_BITMAP_OFFSET); |
488 | if (lvb[i]) | ||
489 | return 0; | ||
490 | } | ||
491 | return 1; | ||
492 | } | 488 | } |
493 | 489 | ||
494 | static void sync_wait_cb(void *arg) | 490 | static void sync_wait_cb(void *arg) |
@@ -580,7 +576,6 @@ static void gfs2_control_func(struct work_struct *work) | |||
580 | { | 576 | { |
581 | struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work); | 577 | struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work); |
582 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 578 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
583 | char lvb_bits[GDLM_LVB_SIZE]; | ||
584 | uint32_t block_gen, start_gen, lvb_gen, flags; | 579 | uint32_t block_gen, start_gen, lvb_gen, flags; |
585 | int recover_set = 0; | 580 | int recover_set = 0; |
586 | int write_lvb = 0; | 581 | int write_lvb = 0; |
@@ -634,7 +629,7 @@ static void gfs2_control_func(struct work_struct *work) | |||
634 | return; | 629 | return; |
635 | } | 630 | } |
636 | 631 | ||
637 | control_lvb_read(ls, &lvb_gen, lvb_bits); | 632 | control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); |
638 | 633 | ||
639 | spin_lock(&ls->ls_recover_spin); | 634 | spin_lock(&ls->ls_recover_spin); |
640 | if (block_gen != ls->ls_recover_block || | 635 | if (block_gen != ls->ls_recover_block || |
@@ -664,10 +659,10 @@ static void gfs2_control_func(struct work_struct *work) | |||
664 | 659 | ||
665 | ls->ls_recover_result[i] = 0; | 660 | ls->ls_recover_result[i] = 0; |
666 | 661 | ||
667 | if (!test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) | 662 | if (!test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) |
668 | continue; | 663 | continue; |
669 | 664 | ||
670 | __clear_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); | 665 | __clear_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); |
671 | write_lvb = 1; | 666 | write_lvb = 1; |
672 | } | 667 | } |
673 | } | 668 | } |
@@ -691,7 +686,7 @@ static void gfs2_control_func(struct work_struct *work) | |||
691 | continue; | 686 | continue; |
692 | if (ls->ls_recover_submit[i] < start_gen) { | 687 | if (ls->ls_recover_submit[i] < start_gen) { |
693 | ls->ls_recover_submit[i] = 0; | 688 | ls->ls_recover_submit[i] = 0; |
694 | __set_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); | 689 | __set_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); |
695 | } | 690 | } |
696 | } | 691 | } |
697 | /* even if there are no bits to set, we need to write the | 692 | /* even if there are no bits to set, we need to write the |
@@ -705,7 +700,7 @@ static void gfs2_control_func(struct work_struct *work) | |||
705 | spin_unlock(&ls->ls_recover_spin); | 700 | spin_unlock(&ls->ls_recover_spin); |
706 | 701 | ||
707 | if (write_lvb) { | 702 | if (write_lvb) { |
708 | control_lvb_write(ls, start_gen, lvb_bits); | 703 | control_lvb_write(ls, start_gen, ls->ls_lvb_bits); |
709 | flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK; | 704 | flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK; |
710 | } else { | 705 | } else { |
711 | flags = DLM_LKF_CONVERT; | 706 | flags = DLM_LKF_CONVERT; |
@@ -725,7 +720,7 @@ static void gfs2_control_func(struct work_struct *work) | |||
725 | */ | 720 | */ |
726 | 721 | ||
727 | for (i = 0; i < recover_size; i++) { | 722 | for (i = 0; i < recover_size; i++) { |
728 | if (test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) { | 723 | if (test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) { |
729 | fs_info(sdp, "recover generation %u jid %d\n", | 724 | fs_info(sdp, "recover generation %u jid %d\n", |
730 | start_gen, i); | 725 | start_gen, i); |
731 | gfs2_recover_set(sdp, i); | 726 | gfs2_recover_set(sdp, i); |
@@ -758,7 +753,6 @@ static void gfs2_control_func(struct work_struct *work) | |||
758 | static int control_mount(struct gfs2_sbd *sdp) | 753 | static int control_mount(struct gfs2_sbd *sdp) |
759 | { | 754 | { |
760 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 755 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
761 | char lvb_bits[GDLM_LVB_SIZE]; | ||
762 | uint32_t start_gen, block_gen, mount_gen, lvb_gen; | 756 | uint32_t start_gen, block_gen, mount_gen, lvb_gen; |
763 | int mounted_mode; | 757 | int mounted_mode; |
764 | int retries = 0; | 758 | int retries = 0; |
@@ -857,7 +851,7 @@ locks_done: | |||
857 | * lvb_gen will be non-zero. | 851 | * lvb_gen will be non-zero. |
858 | */ | 852 | */ |
859 | 853 | ||
860 | control_lvb_read(ls, &lvb_gen, lvb_bits); | 854 | control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); |
861 | 855 | ||
862 | if (lvb_gen == 0xFFFFFFFF) { | 856 | if (lvb_gen == 0xFFFFFFFF) { |
863 | /* special value to force mount attempts to fail */ | 857 | /* special value to force mount attempts to fail */ |
@@ -887,7 +881,7 @@ locks_done: | |||
887 | * and all lvb bits to be clear (no pending journal recoveries.) | 881 | * and all lvb bits to be clear (no pending journal recoveries.) |
888 | */ | 882 | */ |
889 | 883 | ||
890 | if (!all_jid_bits_clear(lvb_bits)) { | 884 | if (!all_jid_bits_clear(ls->ls_lvb_bits)) { |
891 | /* journals need recovery, wait until all are clear */ | 885 | /* journals need recovery, wait until all are clear */ |
892 | fs_info(sdp, "control_mount wait for journal recovery\n"); | 886 | fs_info(sdp, "control_mount wait for journal recovery\n"); |
893 | goto restart; | 887 | goto restart; |
@@ -949,7 +943,6 @@ static int dlm_recovery_wait(void *word) | |||
949 | static int control_first_done(struct gfs2_sbd *sdp) | 943 | static int control_first_done(struct gfs2_sbd *sdp) |
950 | { | 944 | { |
951 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; | 945 | struct lm_lockstruct *ls = &sdp->sd_lockstruct; |
952 | char lvb_bits[GDLM_LVB_SIZE]; | ||
953 | uint32_t start_gen, block_gen; | 946 | uint32_t start_gen, block_gen; |
954 | int error; | 947 | int error; |
955 | 948 | ||
@@ -991,8 +984,8 @@ restart: | |||
991 | memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); | 984 | memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); |
992 | spin_unlock(&ls->ls_recover_spin); | 985 | spin_unlock(&ls->ls_recover_spin); |
993 | 986 | ||
994 | memset(lvb_bits, 0, sizeof(lvb_bits)); | 987 | memset(ls->ls_lvb_bits, 0, GDLM_LVB_SIZE); |
995 | control_lvb_write(ls, start_gen, lvb_bits); | 988 | control_lvb_write(ls, start_gen, ls->ls_lvb_bits); |
996 | 989 | ||
997 | error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT); | 990 | error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT); |
998 | if (error) | 991 | if (error) |
@@ -1022,6 +1015,12 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots, | |||
1022 | uint32_t old_size, new_size; | 1015 | uint32_t old_size, new_size; |
1023 | int i, max_jid; | 1016 | int i, max_jid; |
1024 | 1017 | ||
1018 | if (!ls->ls_lvb_bits) { | ||
1019 | ls->ls_lvb_bits = kzalloc(GDLM_LVB_SIZE, GFP_NOFS); | ||
1020 | if (!ls->ls_lvb_bits) | ||
1021 | return -ENOMEM; | ||
1022 | } | ||
1023 | |||
1025 | max_jid = 0; | 1024 | max_jid = 0; |
1026 | for (i = 0; i < num_slots; i++) { | 1025 | for (i = 0; i < num_slots; i++) { |
1027 | if (max_jid < slots[i].slot - 1) | 1026 | if (max_jid < slots[i].slot - 1) |
@@ -1057,6 +1056,7 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots, | |||
1057 | 1056 | ||
1058 | static void free_recover_size(struct lm_lockstruct *ls) | 1057 | static void free_recover_size(struct lm_lockstruct *ls) |
1059 | { | 1058 | { |
1059 | kfree(ls->ls_lvb_bits); | ||
1060 | kfree(ls->ls_recover_submit); | 1060 | kfree(ls->ls_recover_submit); |
1061 | kfree(ls->ls_recover_result); | 1061 | kfree(ls->ls_recover_result); |
1062 | ls->ls_recover_submit = NULL; | 1062 | ls->ls_recover_submit = NULL; |
@@ -1205,6 +1205,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table) | |||
1205 | ls->ls_recover_size = 0; | 1205 | ls->ls_recover_size = 0; |
1206 | ls->ls_recover_submit = NULL; | 1206 | ls->ls_recover_submit = NULL; |
1207 | ls->ls_recover_result = NULL; | 1207 | ls->ls_recover_result = NULL; |
1208 | ls->ls_lvb_bits = NULL; | ||
1208 | 1209 | ||
1209 | error = set_recover_size(sdp, NULL, 0); | 1210 | error = set_recover_size(sdp, NULL, 0); |
1210 | if (error) | 1211 | if (error) |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index d1f51fd73f86..5a51265a4341 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip) | |||
576 | RB_CLEAR_NODE(&ip->i_res->rs_node); | 576 | RB_CLEAR_NODE(&ip->i_res->rs_node); |
577 | out: | 577 | out: |
578 | up_write(&ip->i_rw_mutex); | 578 | up_write(&ip->i_rw_mutex); |
579 | return 0; | 579 | return error; |
580 | } | 580 | } |
581 | 581 | ||
582 | static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) | 582 | static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) |
@@ -1181,12 +1181,9 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, | |||
1181 | const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed) | 1181 | const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed) |
1182 | { | 1182 | { |
1183 | struct super_block *sb = sdp->sd_vfs; | 1183 | struct super_block *sb = sdp->sd_vfs; |
1184 | struct block_device *bdev = sb->s_bdev; | ||
1185 | const unsigned int sects_per_blk = sdp->sd_sb.sb_bsize / | ||
1186 | bdev_logical_block_size(sb->s_bdev); | ||
1187 | u64 blk; | 1184 | u64 blk; |
1188 | sector_t start = 0; | 1185 | sector_t start = 0; |
1189 | sector_t nr_sects = 0; | 1186 | sector_t nr_blks = 0; |
1190 | int rv; | 1187 | int rv; |
1191 | unsigned int x; | 1188 | unsigned int x; |
1192 | u32 trimmed = 0; | 1189 | u32 trimmed = 0; |
@@ -1206,35 +1203,34 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset, | |||
1206 | if (diff == 0) | 1203 | if (diff == 0) |
1207 | continue; | 1204 | continue; |
1208 | blk = offset + ((bi->bi_start + x) * GFS2_NBBY); | 1205 | blk = offset + ((bi->bi_start + x) * GFS2_NBBY); |
1209 | blk *= sects_per_blk; /* convert to sectors */ | ||
1210 | while(diff) { | 1206 | while(diff) { |
1211 | if (diff & 1) { | 1207 | if (diff & 1) { |
1212 | if (nr_sects == 0) | 1208 | if (nr_blks == 0) |
1213 | goto start_new_extent; | 1209 | goto start_new_extent; |
1214 | if ((start + nr_sects) != blk) { | 1210 | if ((start + nr_blks) != blk) { |
1215 | if (nr_sects >= minlen) { | 1211 | if (nr_blks >= minlen) { |
1216 | rv = blkdev_issue_discard(bdev, | 1212 | rv = sb_issue_discard(sb, |
1217 | start, nr_sects, | 1213 | start, nr_blks, |
1218 | GFP_NOFS, 0); | 1214 | GFP_NOFS, 0); |
1219 | if (rv) | 1215 | if (rv) |
1220 | goto fail; | 1216 | goto fail; |
1221 | trimmed += nr_sects; | 1217 | trimmed += nr_blks; |
1222 | } | 1218 | } |
1223 | nr_sects = 0; | 1219 | nr_blks = 0; |
1224 | start_new_extent: | 1220 | start_new_extent: |
1225 | start = blk; | 1221 | start = blk; |
1226 | } | 1222 | } |
1227 | nr_sects += sects_per_blk; | 1223 | nr_blks++; |
1228 | } | 1224 | } |
1229 | diff >>= 2; | 1225 | diff >>= 2; |
1230 | blk += sects_per_blk; | 1226 | blk++; |
1231 | } | 1227 | } |
1232 | } | 1228 | } |
1233 | if (nr_sects >= minlen) { | 1229 | if (nr_blks >= minlen) { |
1234 | rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, 0); | 1230 | rv = sb_issue_discard(sb, start, nr_blks, GFP_NOFS, 0); |
1235 | if (rv) | 1231 | if (rv) |
1236 | goto fail; | 1232 | goto fail; |
1237 | trimmed += nr_sects; | 1233 | trimmed += nr_blks; |
1238 | } | 1234 | } |
1239 | if (ptrimmed) | 1235 | if (ptrimmed) |
1240 | *ptrimmed = trimmed; | 1236 | *ptrimmed = trimmed; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 01168865dd37..a2720071f282 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -264,7 +264,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, | |||
264 | iattr->ia_valid |= ATTR_SIZE; | 264 | iattr->ia_valid |= ATTR_SIZE; |
265 | } | 265 | } |
266 | if (bmval[0] & FATTR4_WORD0_ACL) { | 266 | if (bmval[0] & FATTR4_WORD0_ACL) { |
267 | int nace; | 267 | u32 nace; |
268 | struct nfs4_ace *ace; | 268 | struct nfs4_ace *ace; |
269 | 269 | ||
270 | READ_BUF(4); len += 4; | 270 | READ_BUF(4); len += 4; |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index c196369fe408..4cce1d9552fb 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset, | |||
187 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) | 187 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) |
188 | return -ENOSPC; | 188 | return -ENOSPC; |
189 | 189 | ||
190 | if (name[0] == '.' && (name[1] == '\0' || | 190 | if (name[0] == '.' && (namelen < 2 || |
191 | (name[1] == '.' && name[2] == '\0'))) | 191 | (namelen == 2 && name[1] == '.'))) |
192 | return 0; | 192 | return 0; |
193 | 193 | ||
194 | dentry = lookup_one_len(name, dbuf->xadir, namelen); | 194 | dentry = lookup_one_len(name, dbuf->xadir, namelen); |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index ac838b844936..f21acf0ef01f 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1568 | c->remounting_rw = 1; | 1568 | c->remounting_rw = 1; |
1569 | c->ro_mount = 0; | 1569 | c->ro_mount = 0; |
1570 | 1570 | ||
1571 | if (c->space_fixup) { | ||
1572 | err = ubifs_fixup_free_space(c); | ||
1573 | if (err) | ||
1574 | return err; | ||
1575 | } | ||
1576 | |||
1571 | err = check_free_space(c); | 1577 | err = check_free_space(c); |
1572 | if (err) | 1578 | if (err) |
1573 | goto out; | 1579 | goto out; |
@@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1684 | err = dbg_check_space_info(c); | 1690 | err = dbg_check_space_info(c); |
1685 | } | 1691 | } |
1686 | 1692 | ||
1687 | if (c->space_fixup) { | ||
1688 | err = ubifs_fixup_free_space(c); | ||
1689 | if (err) | ||
1690 | goto out; | ||
1691 | } | ||
1692 | |||
1693 | mutex_unlock(&c->umount_mutex); | 1693 | mutex_unlock(&c->umount_mutex); |
1694 | return err; | 1694 | return err; |
1695 | 1695 | ||
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/compat.h b/include/linux/compat.h index 76a87fb57ac2..377cd8c3395e 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -141,11 +141,11 @@ typedef struct { | |||
141 | } compat_sigset_t; | 141 | } compat_sigset_t; |
142 | 142 | ||
143 | struct compat_sigaction { | 143 | struct compat_sigaction { |
144 | #ifndef __ARCH_HAS_ODD_SIGACTION | 144 | #ifndef __ARCH_HAS_IRIX_SIGACTION |
145 | compat_uptr_t sa_handler; | 145 | compat_uptr_t sa_handler; |
146 | compat_ulong_t sa_flags; | 146 | compat_ulong_t sa_flags; |
147 | #else | 147 | #else |
148 | compat_ulong_t sa_flags; | 148 | compat_uint_t sa_flags; |
149 | compat_uptr_t sa_handler; | 149 | compat_uptr_t sa_handler; |
150 | #endif | 150 | #endif |
151 | #ifdef __ARCH_HAS_SA_RESTORER | 151 | #ifdef __ARCH_HAS_SA_RESTORER |
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index e83ef39b3bea..fe8c4476f7e4 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h | |||
@@ -213,7 +213,7 @@ struct devfreq_simple_ondemand_data { | |||
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | #else /* !CONFIG_PM_DEVFREQ */ | 215 | #else /* !CONFIG_PM_DEVFREQ */ |
216 | static struct devfreq *devfreq_add_device(struct device *dev, | 216 | static inline struct devfreq *devfreq_add_device(struct device *dev, |
217 | struct devfreq_dev_profile *profile, | 217 | struct devfreq_dev_profile *profile, |
218 | const char *governor_name, | 218 | const char *governor_name, |
219 | void *data) | 219 | void *data) |
@@ -221,34 +221,34 @@ static struct devfreq *devfreq_add_device(struct device *dev, | |||
221 | return NULL; | 221 | return NULL; |
222 | } | 222 | } |
223 | 223 | ||
224 | static int devfreq_remove_device(struct devfreq *devfreq) | 224 | static inline int devfreq_remove_device(struct devfreq *devfreq) |
225 | { | 225 | { |
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | static int devfreq_suspend_device(struct devfreq *devfreq) | 229 | static inline int devfreq_suspend_device(struct devfreq *devfreq) |
230 | { | 230 | { |
231 | return 0; | 231 | return 0; |
232 | } | 232 | } |
233 | 233 | ||
234 | static int devfreq_resume_device(struct devfreq *devfreq) | 234 | static inline int devfreq_resume_device(struct devfreq *devfreq) |
235 | { | 235 | { |
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | static struct opp *devfreq_recommended_opp(struct device *dev, | 239 | static inline struct opp *devfreq_recommended_opp(struct device *dev, |
240 | unsigned long *freq, u32 flags) | 240 | unsigned long *freq, u32 flags) |
241 | { | 241 | { |
242 | return -EINVAL; | 242 | return ERR_PTR(-EINVAL); |
243 | } | 243 | } |
244 | 244 | ||
245 | static int devfreq_register_opp_notifier(struct device *dev, | 245 | static inline int devfreq_register_opp_notifier(struct device *dev, |
246 | struct devfreq *devfreq) | 246 | struct devfreq *devfreq) |
247 | { | 247 | { |
248 | return -EINVAL; | 248 | return -EINVAL; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int devfreq_unregister_opp_notifier(struct device *dev, | 251 | static inline int devfreq_unregister_opp_notifier(struct device *dev, |
252 | struct devfreq *devfreq) | 252 | struct devfreq *devfreq) |
253 | { | 253 | { |
254 | return -EINVAL; | 254 | return -EINVAL; |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index cad77fe09d77..c13958251927 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -518,7 +518,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, | |||
518 | int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 518 | int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
519 | void *data, unsigned long len); | 519 | void *data, unsigned long len); |
520 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 520 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
521 | gpa_t gpa); | 521 | gpa_t gpa, unsigned long len); |
522 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | 522 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
523 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); | 523 | int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len); |
524 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | 524 | struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); |
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index fa7cc7244cbd..b0bcce0ddc95 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h | |||
@@ -71,6 +71,7 @@ struct gfn_to_hva_cache { | |||
71 | u64 generation; | 71 | u64 generation; |
72 | gpa_t gpa; | 72 | gpa_t gpa; |
73 | unsigned long hva; | 73 | unsigned long hva; |
74 | unsigned long len; | ||
74 | struct kvm_memory_slot *memslot; | 75 | struct kvm_memory_slot *memslot; |
75 | }; | 76 | }; |
76 | 77 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b3d00fa4b314..6151e903eef0 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -210,9 +210,9 @@ struct netdev_hw_addr { | |||
210 | #define NETDEV_HW_ADDR_T_SLAVE 3 | 210 | #define NETDEV_HW_ADDR_T_SLAVE 3 |
211 | #define NETDEV_HW_ADDR_T_UNICAST 4 | 211 | #define NETDEV_HW_ADDR_T_UNICAST 4 |
212 | #define NETDEV_HW_ADDR_T_MULTICAST 5 | 212 | #define NETDEV_HW_ADDR_T_MULTICAST 5 |
213 | bool synced; | ||
214 | bool global_use; | 213 | bool global_use; |
215 | int refcount; | 214 | int refcount; |
215 | int synced; | ||
216 | struct rcu_head rcu_head; | 216 | struct rcu_head rcu_head; |
217 | }; | 217 | }; |
218 | 218 | ||
@@ -895,7 +895,7 @@ struct netdev_fcoe_hbainfo { | |||
895 | * | 895 | * |
896 | * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) | 896 | * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) |
897 | * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, | 897 | * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, |
898 | * struct net_device *dev) | 898 | * struct net_device *dev, u32 filter_mask) |
899 | * | 899 | * |
900 | * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); | 900 | * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); |
901 | * Called to change device carrier. Soft-devices (like dummy, team, etc) | 901 | * Called to change device carrier. Soft-devices (like dummy, team, etc) |
diff --git a/include/linux/of.h b/include/linux/of.h index c0747a44eaff..b0f3bbd0216b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -382,6 +382,11 @@ static inline int of_device_is_compatible(const struct device_node *device, | |||
382 | return 0; | 382 | return 0; |
383 | } | 383 | } |
384 | 384 | ||
385 | static inline int of_device_is_available(const struct device_node *device) | ||
386 | { | ||
387 | return 0; | ||
388 | } | ||
389 | |||
385 | 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, |
386 | const char *name, | 391 | const char *name, |
387 | int *lenp) | 392 | int *lenp) |
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h index a7b4fc386e63..3cc21c9cc1e8 100644 --- a/include/linux/pata_arasan_cf_data.h +++ b/include/linux/pata_arasan_cf_data.h | |||
@@ -37,8 +37,6 @@ struct arasan_cf_pdata { | |||
37 | #define CF_BROKEN_PIO (1) | 37 | #define CF_BROKEN_PIO (1) |
38 | #define CF_BROKEN_MWDMA (1 << 1) | 38 | #define CF_BROKEN_MWDMA (1 << 1) |
39 | #define CF_BROKEN_UDMA (1 << 2) | 39 | #define CF_BROKEN_UDMA (1 << 2) |
40 | /* This is platform specific data for the DMA controller */ | ||
41 | void *dma_priv; | ||
42 | }; | 40 | }; |
43 | 41 | ||
44 | static inline void | 42 | static inline void |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 2461033a7987..710067f3618c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -916,6 +916,7 @@ void pci_disable_rom(struct pci_dev *pdev); | |||
916 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); | 916 | void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); |
917 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); | 917 | void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); |
918 | size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); | 918 | size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); |
919 | void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size); | ||
919 | 920 | ||
920 | /* Power management related routines */ | 921 | /* Power management related routines */ |
921 | int pci_save_state(struct pci_dev *dev); | 922 | int pci_save_state(struct pci_dev *dev); |
diff --git a/include/linux/signal.h b/include/linux/signal.h index a2dcb94ea49d..9475c5cb28bc 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -250,11 +250,11 @@ extern int show_unhandled_signals; | |||
250 | extern int sigsuspend(sigset_t *); | 250 | extern int sigsuspend(sigset_t *); |
251 | 251 | ||
252 | struct sigaction { | 252 | struct sigaction { |
253 | #ifndef __ARCH_HAS_ODD_SIGACTION | 253 | #ifndef __ARCH_HAS_IRIX_SIGACTION |
254 | __sighandler_t sa_handler; | 254 | __sighandler_t sa_handler; |
255 | unsigned long sa_flags; | 255 | unsigned long sa_flags; |
256 | #else | 256 | #else |
257 | unsigned long sa_flags; | 257 | unsigned int sa_flags; |
258 | __sighandler_t sa_handler; | 258 | __sighandler_t sa_handler; |
259 | #endif | 259 | #endif |
260 | #ifdef __ARCH_HAS_SA_RESTORER | 260 | #ifdef __ARCH_HAS_SA_RESTORER |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 441f5bfdab8e..b8292d8cc9fa 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2643,6 +2643,13 @@ static inline void nf_reset(struct sk_buff *skb) | |||
2643 | #endif | 2643 | #endif |
2644 | } | 2644 | } |
2645 | 2645 | ||
2646 | static inline void nf_reset_trace(struct sk_buff *skb) | ||
2647 | { | ||
2648 | #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) | ||
2649 | skb->nf_trace = 0; | ||
2650 | #endif | ||
2651 | } | ||
2652 | |||
2646 | /* Note: This doesn't put any conntrack and bridge info in dst. */ | 2653 | /* Note: This doesn't put any conntrack and bridge info in dst. */ |
2647 | static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) | 2654 | static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) |
2648 | { | 2655 | { |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 399162b50a8d..e1379b4e8faf 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -1074,7 +1074,8 @@ void fc_rport_terminate_io(struct fc_rport *); | |||
1074 | /* | 1074 | /* |
1075 | * DISCOVERY LAYER | 1075 | * DISCOVERY LAYER |
1076 | *****************************/ | 1076 | *****************************/ |
1077 | int fc_disc_init(struct fc_lport *); | 1077 | void fc_disc_init(struct fc_lport *); |
1078 | void fc_disc_config(struct fc_lport *, void *); | ||
1078 | 1079 | ||
1079 | static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc) | 1080 | static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc) |
1080 | { | 1081 | { |
diff --git a/include/sound/max98090.h b/include/sound/max98090.h index 95efb13f8478..95efb13f8478 100755..100644 --- a/include/sound/max98090.h +++ b/include/sound/max98090.h | |||
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index e1ef63d4a5c4..44a30b108683 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -488,6 +488,7 @@ struct snd_soc_dapm_path { | |||
488 | /* status */ | 488 | /* status */ |
489 | u32 connect:1; /* source and sink widgets are connected */ | 489 | u32 connect:1; /* source and sink widgets are connected */ |
490 | u32 walked:1; /* path has been walked */ | 490 | u32 walked:1; /* path has been walked */ |
491 | u32 walking:1; /* path is in the process of being walked */ | ||
491 | u32 weak:1; /* path ignored for power management */ | 492 | u32 weak:1; /* path ignored for power management */ |
492 | 493 | ||
493 | int (*connected)(struct snd_soc_dapm_widget *source, | 494 | int (*connected)(struct snd_soc_dapm_widget *source, |
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h new file mode 100644 index 000000000000..6b55839b73fc --- /dev/null +++ b/include/video/omap-panel-data.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | * Header containing platform_data structs for omap panels | ||
3 | * | ||
4 | * Copyright (C) 2013 Texas Instruments | ||
5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> | ||
6 | * Archit Taneja <archit@ti.com> | ||
7 | * | ||
8 | * Copyright (C) 2011 Texas Instruments | ||
9 | * Author: Mayuresh Janorkar <mayur@ti.com> | ||
10 | * | ||
11 | * Copyright (C) 2010 Canonical Ltd. | ||
12 | * Author: Bryan Wu <bryan.wu@canonical.com> | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify it | ||
15 | * under the terms of the GNU General Public License version 2 as published by | ||
16 | * the Free Software Foundation. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
19 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
20 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
21 | * more details. | ||
22 | * | ||
23 | * You should have received a copy of the GNU General Public License along with | ||
24 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | */ | ||
26 | |||
27 | #ifndef __OMAP_PANEL_DATA_H | ||
28 | #define __OMAP_PANEL_DATA_H | ||
29 | |||
30 | struct omap_dss_device; | ||
31 | |||
32 | /** | ||
33 | * struct panel_generic_dpi_data - panel driver configuration data | ||
34 | * @name: panel name | ||
35 | * @platform_enable: platform specific panel enable function | ||
36 | * @platform_disable: platform specific panel disable function | ||
37 | * @num_gpios: number of gpios connected to panel | ||
38 | * @gpios: gpio numbers on the platform | ||
39 | * @gpio_invert: configure gpio as active high or low | ||
40 | */ | ||
41 | struct panel_generic_dpi_data { | ||
42 | const char *name; | ||
43 | int (*platform_enable)(struct omap_dss_device *dssdev); | ||
44 | void (*platform_disable)(struct omap_dss_device *dssdev); | ||
45 | |||
46 | int num_gpios; | ||
47 | int gpios[10]; | ||
48 | bool gpio_invert[10]; | ||
49 | }; | ||
50 | |||
51 | /** | ||
52 | * struct panel_n8x0_data - N800 panel driver configuration data | ||
53 | */ | ||
54 | struct panel_n8x0_data { | ||
55 | int (*platform_enable)(struct omap_dss_device *dssdev); | ||
56 | void (*platform_disable)(struct omap_dss_device *dssdev); | ||
57 | int panel_reset; | ||
58 | int ctrl_pwrdown; | ||
59 | |||
60 | int (*set_backlight)(struct omap_dss_device *dssdev, int level); | ||
61 | }; | ||
62 | |||
63 | /** | ||
64 | * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration data | ||
65 | * @name: panel name | ||
66 | * @use_ext_te: use external TE | ||
67 | * @ext_te_gpio: external TE GPIO | ||
68 | * @esd_interval: interval of ESD checks, 0 = disabled (ms) | ||
69 | * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) | ||
70 | * @use_dsi_backlight: true if panel uses DSI command to control backlight | ||
71 | * @pin_config: DSI pin configuration | ||
72 | */ | ||
73 | |||
74 | struct nokia_dsi_panel_data { | ||
75 | const char *name; | ||
76 | |||
77 | int reset_gpio; | ||
78 | |||
79 | bool use_ext_te; | ||
80 | int ext_te_gpio; | ||
81 | |||
82 | unsigned esd_interval; | ||
83 | unsigned ulps_timeout; | ||
84 | |||
85 | bool use_dsi_backlight; | ||
86 | |||
87 | struct omap_dsi_pin_config pin_config; | ||
88 | }; | ||
89 | |||
90 | /** | ||
91 | * struct picodlp_panel_data - picodlp panel driver configuration data | ||
92 | * @picodlp_adapter_id: i2c_adapter number for picodlp | ||
93 | */ | ||
94 | struct picodlp_panel_data { | ||
95 | int picodlp_adapter_id; | ||
96 | int emu_done_gpio; | ||
97 | int pwrgood_gpio; | ||
98 | }; | ||
99 | |||
100 | /** | ||
101 | * struct tfp410_platform_data - tfp410 panel driver configuration data | ||
102 | * @i2c_bus_num: i2c bus id for the panel | ||
103 | * @power_down_gpio: gpio number for PD pin (or -1 if not available) | ||
104 | */ | ||
105 | struct tfp410_platform_data { | ||
106 | int i2c_bus_num; | ||
107 | int power_down_gpio; | ||
108 | }; | ||
109 | |||
110 | /** | ||
111 | * sharp ls panel driver configuration data | ||
112 | * @resb_gpio: reset signal | ||
113 | * @ini_gpio: power on control | ||
114 | * @mo_gpio: selection for resolution(VGA/QVGA) | ||
115 | * @lr_gpio: selection for horizontal scanning direction | ||
116 | * @ud_gpio: selection for vertical scanning direction | ||
117 | */ | ||
118 | struct panel_sharp_ls037v7dw01_data { | ||
119 | int resb_gpio; | ||
120 | int ini_gpio; | ||
121 | int mo_gpio; | ||
122 | int lr_gpio; | ||
123 | int ud_gpio; | ||
124 | }; | ||
125 | |||
126 | /** | ||
127 | * acx565akm panel driver configuration data | ||
128 | * @reset_gpio: reset signal | ||
129 | */ | ||
130 | struct panel_acx565akm_data { | ||
131 | int reset_gpio; | ||
132 | }; | ||
133 | |||
134 | /** | ||
135 | * nec nl8048 panel driver configuration data | ||
136 | * @res_gpio: reset signal | ||
137 | * @qvga_gpio: selection for resolution(QVGA/WVGA) | ||
138 | */ | ||
139 | struct panel_nec_nl8048_data { | ||
140 | int res_gpio; | ||
141 | int qvga_gpio; | ||
142 | }; | ||
143 | |||
144 | /** | ||
145 | * tpo td043 panel driver configuration data | ||
146 | * @nreset_gpio: reset signal | ||
147 | */ | ||
148 | struct panel_tpo_td043_data { | ||
149 | int nreset_gpio; | ||
150 | }; | ||
151 | |||
152 | #endif /* __OMAP_PANEL_DATA_H */ | ||
diff --git a/include/video/omap-panel-generic-dpi.h b/include/video/omap-panel-generic-dpi.h deleted file mode 100644 index 127e3f20328e..000000000000 --- a/include/video/omap-panel-generic-dpi.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * Header for generic DPI panel driver | ||
3 | * | ||
4 | * Copyright (C) 2010 Canonical Ltd. | ||
5 | * Author: Bryan Wu <bryan.wu@canonical.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #ifndef __OMAP_PANEL_GENERIC_DPI_H | ||
21 | #define __OMAP_PANEL_GENERIC_DPI_H | ||
22 | |||
23 | struct omap_dss_device; | ||
24 | |||
25 | /** | ||
26 | * struct panel_generic_dpi_data - panel driver configuration data | ||
27 | * @name: panel name | ||
28 | * @platform_enable: platform specific panel enable function | ||
29 | * @platform_disable: platform specific panel disable function | ||
30 | */ | ||
31 | struct panel_generic_dpi_data { | ||
32 | const char *name; | ||
33 | int (*platform_enable)(struct omap_dss_device *dssdev); | ||
34 | void (*platform_disable)(struct omap_dss_device *dssdev); | ||
35 | }; | ||
36 | |||
37 | #endif /* __OMAP_PANEL_GENERIC_DPI_H */ | ||
diff --git a/include/video/omap-panel-n8x0.h b/include/video/omap-panel-n8x0.h deleted file mode 100644 index 50a1302e2cfd..000000000000 --- a/include/video/omap-panel-n8x0.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #ifndef __OMAP_PANEL_N8X0_H | ||
2 | #define __OMAP_PANEL_N8X0_H | ||
3 | |||
4 | struct omap_dss_device; | ||
5 | |||
6 | struct panel_n8x0_data { | ||
7 | int (*platform_enable)(struct omap_dss_device *dssdev); | ||
8 | void (*platform_disable)(struct omap_dss_device *dssdev); | ||
9 | int panel_reset; | ||
10 | int ctrl_pwrdown; | ||
11 | |||
12 | int (*set_backlight)(struct omap_dss_device *dssdev, int level); | ||
13 | }; | ||
14 | |||
15 | #endif | ||
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h deleted file mode 100644 index 04219a295539..000000000000 --- a/include/video/omap-panel-nokia-dsi.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #ifndef __OMAP_NOKIA_DSI_PANEL_H | ||
2 | #define __OMAP_NOKIA_DSI_PANEL_H | ||
3 | |||
4 | struct omap_dss_device; | ||
5 | |||
6 | /** | ||
7 | * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration | ||
8 | * @name: panel name | ||
9 | * @use_ext_te: use external TE | ||
10 | * @ext_te_gpio: external TE GPIO | ||
11 | * @esd_interval: interval of ESD checks, 0 = disabled (ms) | ||
12 | * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) | ||
13 | * @use_dsi_backlight: true if panel uses DSI command to control backlight | ||
14 | * @pin_config: DSI pin configuration | ||
15 | */ | ||
16 | struct nokia_dsi_panel_data { | ||
17 | const char *name; | ||
18 | |||
19 | int reset_gpio; | ||
20 | |||
21 | bool use_ext_te; | ||
22 | int ext_te_gpio; | ||
23 | |||
24 | unsigned esd_interval; | ||
25 | unsigned ulps_timeout; | ||
26 | |||
27 | bool use_dsi_backlight; | ||
28 | |||
29 | struct omap_dsi_pin_config pin_config; | ||
30 | }; | ||
31 | |||
32 | #endif /* __OMAP_NOKIA_DSI_PANEL_H */ | ||
diff --git a/include/video/omap-panel-picodlp.h b/include/video/omap-panel-picodlp.h deleted file mode 100644 index 1c342ef6f3a1..000000000000 --- a/include/video/omap-panel-picodlp.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * panel data for picodlp panel | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments | ||
5 | * | ||
6 | * Author: Mayuresh Janorkar <mayur@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __PANEL_PICODLP_H | ||
13 | #define __PANEL_PICODLP_H | ||
14 | /** | ||
15 | * struct : picodlp panel data | ||
16 | * picodlp_adapter_id: i2c_adapter number for picodlp | ||
17 | */ | ||
18 | struct picodlp_panel_data { | ||
19 | int picodlp_adapter_id; | ||
20 | int emu_done_gpio; | ||
21 | int pwrgood_gpio; | ||
22 | }; | ||
23 | #endif /* __PANEL_PICODLP_H */ | ||
diff --git a/include/video/omap-panel-tfp410.h b/include/video/omap-panel-tfp410.h deleted file mode 100644 index aef35e48bc7e..000000000000 --- a/include/video/omap-panel-tfp410.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * Header for TFP410 chip driver | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments Inc | ||
5 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #ifndef __OMAP_PANEL_TFP410_H | ||
21 | #define __OMAP_PANEL_TFP410_H | ||
22 | |||
23 | struct omap_dss_device; | ||
24 | |||
25 | /** | ||
26 | * struct tfp410_platform_data - panel driver configuration data | ||
27 | * @i2c_bus_num: i2c bus id for the panel | ||
28 | * @power_down_gpio: gpio number for PD pin (or -1 if not available) | ||
29 | */ | ||
30 | struct tfp410_platform_data { | ||
31 | int i2c_bus_num; | ||
32 | int power_down_gpio; | ||
33 | }; | ||
34 | |||
35 | #endif /* __OMAP_PANEL_TFP410_H */ | ||
@@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, | |||
872 | goto out_unlock; | 872 | goto out_unlock; |
873 | break; | 873 | break; |
874 | } | 874 | } |
875 | msg = ERR_PTR(-EAGAIN); | ||
875 | } else | 876 | } else |
876 | break; | 877 | break; |
877 | msg_counter++; | 878 | msg_counter++; |
@@ -1940,7 +1940,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) | |||
1940 | 1940 | ||
1941 | /* Check the cache first. */ | 1941 | /* Check the cache first. */ |
1942 | /* (Cache hit rate is typically around 35%.) */ | 1942 | /* (Cache hit rate is typically around 35%.) */ |
1943 | vma = mm->mmap_cache; | 1943 | vma = ACCESS_ONCE(mm->mmap_cache); |
1944 | if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) { | 1944 | if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) { |
1945 | struct rb_node *rb_node; | 1945 | struct rb_node *rb_node; |
1946 | 1946 | ||
diff --git a/mm/nommu.c b/mm/nommu.c index e19328087534..2f3ea749c318 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -821,7 +821,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr) | |||
821 | struct vm_area_struct *vma; | 821 | struct vm_area_struct *vma; |
822 | 822 | ||
823 | /* check the cache first */ | 823 | /* check the cache first */ |
824 | vma = mm->mmap_cache; | 824 | vma = ACCESS_ONCE(mm->mmap_cache); |
825 | if (vma && vma->vm_start <= addr && vma->vm_end > addr) | 825 | if (vma && vma->vm_start <= addr && vma->vm_end > addr) |
826 | return vma; | 826 | return vma; |
827 | 827 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index b13e5c766c11..e7d68ed8aafe 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1624,7 +1624,6 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
1624 | } | 1624 | } |
1625 | 1625 | ||
1626 | skb_orphan(skb); | 1626 | skb_orphan(skb); |
1627 | nf_reset(skb); | ||
1628 | 1627 | ||
1629 | if (unlikely(!is_skb_forwardable(dev, skb))) { | 1628 | if (unlikely(!is_skb_forwardable(dev, skb))) { |
1630 | atomic_long_inc(&dev->rx_dropped); | 1629 | atomic_long_inc(&dev->rx_dropped); |
@@ -1640,6 +1639,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) | |||
1640 | skb->mark = 0; | 1639 | skb->mark = 0; |
1641 | secpath_reset(skb); | 1640 | secpath_reset(skb); |
1642 | nf_reset(skb); | 1641 | nf_reset(skb); |
1642 | nf_reset_trace(skb); | ||
1643 | return netif_rx(skb); | 1643 | return netif_rx(skb); |
1644 | } | 1644 | } |
1645 | EXPORT_SYMBOL_GPL(dev_forward_skb); | 1645 | EXPORT_SYMBOL_GPL(dev_forward_skb); |
@@ -3314,6 +3314,7 @@ int netdev_rx_handler_register(struct net_device *dev, | |||
3314 | if (dev->rx_handler) | 3314 | if (dev->rx_handler) |
3315 | return -EBUSY; | 3315 | return -EBUSY; |
3316 | 3316 | ||
3317 | /* Note: rx_handler_data must be set before rx_handler */ | ||
3317 | rcu_assign_pointer(dev->rx_handler_data, rx_handler_data); | 3318 | rcu_assign_pointer(dev->rx_handler_data, rx_handler_data); |
3318 | rcu_assign_pointer(dev->rx_handler, rx_handler); | 3319 | rcu_assign_pointer(dev->rx_handler, rx_handler); |
3319 | 3320 | ||
@@ -3334,6 +3335,11 @@ void netdev_rx_handler_unregister(struct net_device *dev) | |||
3334 | 3335 | ||
3335 | ASSERT_RTNL(); | 3336 | ASSERT_RTNL(); |
3336 | RCU_INIT_POINTER(dev->rx_handler, NULL); | 3337 | RCU_INIT_POINTER(dev->rx_handler, NULL); |
3338 | /* a reader seeing a non NULL rx_handler in a rcu_read_lock() | ||
3339 | * section has a guarantee to see a non NULL rx_handler_data | ||
3340 | * as well. | ||
3341 | */ | ||
3342 | synchronize_net(); | ||
3337 | RCU_INIT_POINTER(dev->rx_handler_data, NULL); | 3343 | RCU_INIT_POINTER(dev->rx_handler_data, NULL); |
3338 | } | 3344 | } |
3339 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); | 3345 | EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister); |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index bd2eb9d3e369..abdc9e6ef33e 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -37,7 +37,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list, | |||
37 | ha->type = addr_type; | 37 | ha->type = addr_type; |
38 | ha->refcount = 1; | 38 | ha->refcount = 1; |
39 | ha->global_use = global; | 39 | ha->global_use = global; |
40 | ha->synced = false; | 40 | ha->synced = 0; |
41 | list_add_tail_rcu(&ha->list, &list->list); | 41 | list_add_tail_rcu(&ha->list, &list->list); |
42 | list->count++; | 42 | list->count++; |
43 | 43 | ||
@@ -165,7 +165,7 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list, | |||
165 | addr_len, ha->type); | 165 | addr_len, ha->type); |
166 | if (err) | 166 | if (err) |
167 | break; | 167 | break; |
168 | ha->synced = true; | 168 | ha->synced++; |
169 | ha->refcount++; | 169 | ha->refcount++; |
170 | } else if (ha->refcount == 1) { | 170 | } else if (ha->refcount == 1) { |
171 | __hw_addr_del(to_list, ha->addr, addr_len, ha->type); | 171 | __hw_addr_del(to_list, ha->addr, addr_len, ha->type); |
@@ -186,7 +186,7 @@ void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, | |||
186 | if (ha->synced) { | 186 | if (ha->synced) { |
187 | __hw_addr_del(to_list, ha->addr, | 187 | __hw_addr_del(to_list, ha->addr, |
188 | addr_len, ha->type); | 188 | addr_len, ha->type); |
189 | ha->synced = false; | 189 | ha->synced--; |
190 | __hw_addr_del(from_list, ha->addr, | 190 | __hw_addr_del(from_list, ha->addr, |
191 | addr_len, ha->type); | 191 | addr_len, ha->type); |
192 | } | 192 | } |
diff --git a/net/core/flow.c b/net/core/flow.c index c56ea6f7f6c7..2bfd081c59f7 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -328,7 +328,7 @@ static void flow_cache_flush_per_cpu(void *data) | |||
328 | struct flow_flush_info *info = data; | 328 | struct flow_flush_info *info = data; |
329 | struct tasklet_struct *tasklet; | 329 | struct tasklet_struct *tasklet; |
330 | 330 | ||
331 | tasklet = this_cpu_ptr(&info->cache->percpu->flush_tasklet); | 331 | tasklet = &this_cpu_ptr(info->cache->percpu)->flush_tasklet; |
332 | tasklet->data = (unsigned long)info; | 332 | tasklet->data = (unsigned long)info; |
333 | tasklet_schedule(tasklet); | 333 | tasklet_schedule(tasklet); |
334 | } | 334 | } |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5fb8d7e47294..b65441da74ab 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -496,8 +496,10 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev) | |||
496 | } | 496 | } |
497 | if (ops->fill_info) { | 497 | if (ops->fill_info) { |
498 | data = nla_nest_start(skb, IFLA_INFO_DATA); | 498 | data = nla_nest_start(skb, IFLA_INFO_DATA); |
499 | if (data == NULL) | 499 | if (data == NULL) { |
500 | err = -EMSGSIZE; | ||
500 | goto err_cancel_link; | 501 | goto err_cancel_link; |
502 | } | ||
501 | err = ops->fill_info(skb, dev); | 503 | err = ops->fill_info(skb, dev); |
502 | if (err < 0) | 504 | if (err < 0) |
503 | goto err_cancel_data; | 505 | goto err_cancel_data; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index f678507bc829..96083b7a436b 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -802,8 +802,10 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg | |||
802 | if (nlh->nlmsg_flags & NLM_F_EXCL || | 802 | if (nlh->nlmsg_flags & NLM_F_EXCL || |
803 | !(nlh->nlmsg_flags & NLM_F_REPLACE)) | 803 | !(nlh->nlmsg_flags & NLM_F_REPLACE)) |
804 | return -EEXIST; | 804 | return -EEXIST; |
805 | 805 | ifa = ifa_existing; | |
806 | set_ifa_lifetime(ifa_existing, valid_lft, prefered_lft); | 806 | set_ifa_lifetime(ifa, valid_lft, prefered_lft); |
807 | rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid); | ||
808 | blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa); | ||
807 | } | 809 | } |
808 | return 0; | 810 | return 0; |
809 | } | 811 | } |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 26512250e095..a459c4f5b769 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2529,6 +2529,9 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2529 | static void init_loopback(struct net_device *dev) | 2529 | static void init_loopback(struct net_device *dev) |
2530 | { | 2530 | { |
2531 | struct inet6_dev *idev; | 2531 | struct inet6_dev *idev; |
2532 | struct net_device *sp_dev; | ||
2533 | struct inet6_ifaddr *sp_ifa; | ||
2534 | struct rt6_info *sp_rt; | ||
2532 | 2535 | ||
2533 | /* ::1 */ | 2536 | /* ::1 */ |
2534 | 2537 | ||
@@ -2540,6 +2543,30 @@ static void init_loopback(struct net_device *dev) | |||
2540 | } | 2543 | } |
2541 | 2544 | ||
2542 | add_addr(idev, &in6addr_loopback, 128, IFA_HOST); | 2545 | add_addr(idev, &in6addr_loopback, 128, IFA_HOST); |
2546 | |||
2547 | /* Add routes to other interface's IPv6 addresses */ | ||
2548 | for_each_netdev(dev_net(dev), sp_dev) { | ||
2549 | if (!strcmp(sp_dev->name, dev->name)) | ||
2550 | continue; | ||
2551 | |||
2552 | idev = __in6_dev_get(sp_dev); | ||
2553 | if (!idev) | ||
2554 | continue; | ||
2555 | |||
2556 | read_lock_bh(&idev->lock); | ||
2557 | list_for_each_entry(sp_ifa, &idev->addr_list, if_list) { | ||
2558 | |||
2559 | if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE)) | ||
2560 | continue; | ||
2561 | |||
2562 | sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0); | ||
2563 | |||
2564 | /* Failure cases are ignored */ | ||
2565 | if (!IS_ERR(sp_rt)) | ||
2566 | ip6_ins_rt(sp_rt); | ||
2567 | } | ||
2568 | read_unlock_bh(&idev->lock); | ||
2569 | } | ||
2543 | } | 2570 | } |
2544 | 2571 | ||
2545 | static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr) | 2572 | static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr) |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index e33fe0ab2568..2bab2aa59745 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -118,6 +118,18 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
118 | ipv6_addr_loopback(&hdr->daddr)) | 118 | ipv6_addr_loopback(&hdr->daddr)) |
119 | goto err; | 119 | goto err; |
120 | 120 | ||
121 | /* RFC4291 Errata ID: 3480 | ||
122 | * Interface-Local scope spans only a single interface on a | ||
123 | * node and is useful only for loopback transmission of | ||
124 | * multicast. Packets with interface-local scope received | ||
125 | * from another node must be discarded. | ||
126 | */ | ||
127 | if (!(skb->pkt_type == PACKET_LOOPBACK || | ||
128 | dev->flags & IFF_LOOPBACK) && | ||
129 | ipv6_addr_is_multicast(&hdr->daddr) && | ||
130 | IPV6_ADDR_MC_SCOPE(&hdr->daddr) == 1) | ||
131 | goto err; | ||
132 | |||
121 | /* RFC4291 2.7 | 133 | /* RFC4291 2.7 |
122 | * Nodes must not originate a packet to a multicast address whose scope | 134 | * Nodes must not originate a packet to a multicast address whose scope |
123 | * field contains the reserved value 0; if such a packet is received, it | 135 | * field contains the reserved value 0; if such a packet is received, it |
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c index 33608c610276..cb631143721c 100644 --- a/net/ipv6/netfilter/ip6t_NPT.c +++ b/net/ipv6/netfilter/ip6t_NPT.c | |||
@@ -57,7 +57,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt, | |||
57 | if (pfx_len - i >= 32) | 57 | if (pfx_len - i >= 32) |
58 | mask = 0; | 58 | mask = 0; |
59 | else | 59 | else |
60 | mask = htonl(~((1 << (pfx_len - i)) - 1)); | 60 | mask = htonl((1 << (i - pfx_len + 32)) - 1); |
61 | 61 | ||
62 | idx = i / 32; | 62 | idx = i / 32; |
63 | addr->s6_addr32[idx] &= mask; | 63 | addr->s6_addr32[idx] &= mask; |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 8555f331ea60..5b1e5af25713 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2693,6 +2693,7 @@ static int key_notify_policy_flush(const struct km_event *c) | |||
2693 | hdr->sadb_msg_pid = c->portid; | 2693 | hdr->sadb_msg_pid = c->portid; |
2694 | hdr->sadb_msg_version = PF_KEY_V2; | 2694 | hdr->sadb_msg_version = PF_KEY_V2; |
2695 | hdr->sadb_msg_errno = (uint8_t) 0; | 2695 | hdr->sadb_msg_errno = (uint8_t) 0; |
2696 | hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC; | ||
2696 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); | 2697 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); |
2697 | pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net); | 2698 | pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net); |
2698 | return 0; | 2699 | return 0; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index fb306814576a..a6893602f87a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -2582,7 +2582,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2582 | list_del(&dep->list); | 2582 | list_del(&dep->list); |
2583 | mutex_unlock(&local->mtx); | 2583 | mutex_unlock(&local->mtx); |
2584 | 2584 | ||
2585 | ieee80211_roc_notify_destroy(dep); | 2585 | ieee80211_roc_notify_destroy(dep, true); |
2586 | return 0; | 2586 | return 0; |
2587 | } | 2587 | } |
2588 | 2588 | ||
@@ -2622,7 +2622,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2622 | ieee80211_start_next_roc(local); | 2622 | ieee80211_start_next_roc(local); |
2623 | mutex_unlock(&local->mtx); | 2623 | mutex_unlock(&local->mtx); |
2624 | 2624 | ||
2625 | ieee80211_roc_notify_destroy(found); | 2625 | ieee80211_roc_notify_destroy(found, true); |
2626 | } else { | 2626 | } else { |
2627 | /* work may be pending so use it all the time */ | 2627 | /* work may be pending so use it all the time */ |
2628 | found->abort = true; | 2628 | found->abort = true; |
@@ -2632,6 +2632,8 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, | |||
2632 | 2632 | ||
2633 | /* work will clean up etc */ | 2633 | /* work will clean up etc */ |
2634 | flush_delayed_work(&found->work); | 2634 | flush_delayed_work(&found->work); |
2635 | WARN_ON(!found->to_be_freed); | ||
2636 | kfree(found); | ||
2635 | } | 2637 | } |
2636 | 2638 | ||
2637 | return 0; | 2639 | return 0; |
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 78c0d90dd641..931be419ab5a 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -63,6 +63,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local, | |||
63 | enum ieee80211_chanctx_mode mode) | 63 | enum ieee80211_chanctx_mode mode) |
64 | { | 64 | { |
65 | struct ieee80211_chanctx *ctx; | 65 | struct ieee80211_chanctx *ctx; |
66 | u32 changed; | ||
66 | int err; | 67 | int err; |
67 | 68 | ||
68 | lockdep_assert_held(&local->chanctx_mtx); | 69 | lockdep_assert_held(&local->chanctx_mtx); |
@@ -76,6 +77,13 @@ ieee80211_new_chanctx(struct ieee80211_local *local, | |||
76 | ctx->conf.rx_chains_dynamic = 1; | 77 | ctx->conf.rx_chains_dynamic = 1; |
77 | ctx->mode = mode; | 78 | ctx->mode = mode; |
78 | 79 | ||
80 | /* acquire mutex to prevent idle from changing */ | ||
81 | mutex_lock(&local->mtx); | ||
82 | /* turn idle off *before* setting channel -- some drivers need that */ | ||
83 | changed = ieee80211_idle_off(local); | ||
84 | if (changed) | ||
85 | ieee80211_hw_config(local, changed); | ||
86 | |||
79 | if (!local->use_chanctx) { | 87 | if (!local->use_chanctx) { |
80 | local->_oper_channel_type = | 88 | local->_oper_channel_type = |
81 | cfg80211_get_chandef_type(chandef); | 89 | cfg80211_get_chandef_type(chandef); |
@@ -85,14 +93,17 @@ ieee80211_new_chanctx(struct ieee80211_local *local, | |||
85 | err = drv_add_chanctx(local, ctx); | 93 | err = drv_add_chanctx(local, ctx); |
86 | if (err) { | 94 | if (err) { |
87 | kfree(ctx); | 95 | kfree(ctx); |
88 | return ERR_PTR(err); | 96 | ctx = ERR_PTR(err); |
97 | |||
98 | ieee80211_recalc_idle(local); | ||
99 | goto out; | ||
89 | } | 100 | } |
90 | } | 101 | } |
91 | 102 | ||
103 | /* and keep the mutex held until the new chanctx is on the list */ | ||
92 | list_add_rcu(&ctx->list, &local->chanctx_list); | 104 | list_add_rcu(&ctx->list, &local->chanctx_list); |
93 | 105 | ||
94 | mutex_lock(&local->mtx); | 106 | out: |
95 | ieee80211_recalc_idle(local); | ||
96 | mutex_unlock(&local->mtx); | 107 | mutex_unlock(&local->mtx); |
97 | 108 | ||
98 | return ctx; | 109 | return ctx; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 388580a1bada..5672533a0832 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -309,6 +309,7 @@ struct ieee80211_roc_work { | |||
309 | struct ieee80211_channel *chan; | 309 | struct ieee80211_channel *chan; |
310 | 310 | ||
311 | bool started, abort, hw_begun, notified; | 311 | bool started, abort, hw_begun, notified; |
312 | bool to_be_freed; | ||
312 | 313 | ||
313 | unsigned long hw_start_time; | 314 | unsigned long hw_start_time; |
314 | 315 | ||
@@ -1347,7 +1348,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local); | |||
1347 | void ieee80211_roc_setup(struct ieee80211_local *local); | 1348 | void ieee80211_roc_setup(struct ieee80211_local *local); |
1348 | void ieee80211_start_next_roc(struct ieee80211_local *local); | 1349 | void ieee80211_start_next_roc(struct ieee80211_local *local); |
1349 | void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); | 1350 | void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); |
1350 | void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc); | 1351 | void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free); |
1351 | void ieee80211_sw_roc_work(struct work_struct *work); | 1352 | void ieee80211_sw_roc_work(struct work_struct *work); |
1352 | void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); | 1353 | void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); |
1353 | 1354 | ||
@@ -1361,6 +1362,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, | |||
1361 | enum nl80211_iftype type); | 1362 | enum nl80211_iftype type); |
1362 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); | 1363 | void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); |
1363 | void ieee80211_remove_interfaces(struct ieee80211_local *local); | 1364 | void ieee80211_remove_interfaces(struct ieee80211_local *local); |
1365 | u32 ieee80211_idle_off(struct ieee80211_local *local); | ||
1364 | void ieee80211_recalc_idle(struct ieee80211_local *local); | 1366 | void ieee80211_recalc_idle(struct ieee80211_local *local); |
1365 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, | 1367 | void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, |
1366 | const int offset); | 1368 | const int offset); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index baaa8608e52d..58150f877ec3 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -78,7 +78,7 @@ void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) | |||
78 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER); | 78 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER); |
79 | } | 79 | } |
80 | 80 | ||
81 | static u32 ieee80211_idle_off(struct ieee80211_local *local) | 81 | u32 ieee80211_idle_off(struct ieee80211_local *local) |
82 | { | 82 | { |
83 | if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) | 83 | if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) |
84 | return 0; | 84 | return 0; |
@@ -349,21 +349,19 @@ static void ieee80211_set_default_queues(struct ieee80211_sub_if_data *sdata) | |||
349 | static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) | 349 | static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) |
350 | { | 350 | { |
351 | struct ieee80211_sub_if_data *sdata; | 351 | struct ieee80211_sub_if_data *sdata; |
352 | int ret = 0; | 352 | int ret; |
353 | 353 | ||
354 | if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) | 354 | if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) |
355 | return 0; | 355 | return 0; |
356 | 356 | ||
357 | mutex_lock(&local->iflist_mtx); | 357 | ASSERT_RTNL(); |
358 | 358 | ||
359 | if (local->monitor_sdata) | 359 | if (local->monitor_sdata) |
360 | goto out_unlock; | 360 | return 0; |
361 | 361 | ||
362 | sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, GFP_KERNEL); | 362 | sdata = kzalloc(sizeof(*sdata) + local->hw.vif_data_size, GFP_KERNEL); |
363 | if (!sdata) { | 363 | if (!sdata) |
364 | ret = -ENOMEM; | 364 | return -ENOMEM; |
365 | goto out_unlock; | ||
366 | } | ||
367 | 365 | ||
368 | /* set up data */ | 366 | /* set up data */ |
369 | sdata->local = local; | 367 | sdata->local = local; |
@@ -377,13 +375,13 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) | |||
377 | if (WARN_ON(ret)) { | 375 | if (WARN_ON(ret)) { |
378 | /* ok .. stupid driver, it asked for this! */ | 376 | /* ok .. stupid driver, it asked for this! */ |
379 | kfree(sdata); | 377 | kfree(sdata); |
380 | goto out_unlock; | 378 | return ret; |
381 | } | 379 | } |
382 | 380 | ||
383 | ret = ieee80211_check_queues(sdata); | 381 | ret = ieee80211_check_queues(sdata); |
384 | if (ret) { | 382 | if (ret) { |
385 | kfree(sdata); | 383 | kfree(sdata); |
386 | goto out_unlock; | 384 | return ret; |
387 | } | 385 | } |
388 | 386 | ||
389 | ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef, | 387 | ret = ieee80211_vif_use_channel(sdata, &local->monitor_chandef, |
@@ -391,13 +389,14 @@ static int ieee80211_add_virtual_monitor(struct ieee80211_local *local) | |||
391 | if (ret) { | 389 | if (ret) { |
392 | drv_remove_interface(local, sdata); | 390 | drv_remove_interface(local, sdata); |
393 | kfree(sdata); | 391 | kfree(sdata); |
394 | goto out_unlock; | 392 | return ret; |
395 | } | 393 | } |
396 | 394 | ||
395 | mutex_lock(&local->iflist_mtx); | ||
397 | rcu_assign_pointer(local->monitor_sdata, sdata); | 396 | rcu_assign_pointer(local->monitor_sdata, sdata); |
398 | out_unlock: | ||
399 | mutex_unlock(&local->iflist_mtx); | 397 | mutex_unlock(&local->iflist_mtx); |
400 | return ret; | 398 | |
399 | return 0; | ||
401 | } | 400 | } |
402 | 401 | ||
403 | static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | 402 | static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) |
@@ -407,14 +406,20 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | |||
407 | if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) | 406 | if (!(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)) |
408 | return; | 407 | return; |
409 | 408 | ||
409 | ASSERT_RTNL(); | ||
410 | |||
410 | mutex_lock(&local->iflist_mtx); | 411 | mutex_lock(&local->iflist_mtx); |
411 | 412 | ||
412 | sdata = rcu_dereference_protected(local->monitor_sdata, | 413 | sdata = rcu_dereference_protected(local->monitor_sdata, |
413 | lockdep_is_held(&local->iflist_mtx)); | 414 | lockdep_is_held(&local->iflist_mtx)); |
414 | if (!sdata) | 415 | if (!sdata) { |
415 | goto out_unlock; | 416 | mutex_unlock(&local->iflist_mtx); |
417 | return; | ||
418 | } | ||
416 | 419 | ||
417 | rcu_assign_pointer(local->monitor_sdata, NULL); | 420 | rcu_assign_pointer(local->monitor_sdata, NULL); |
421 | mutex_unlock(&local->iflist_mtx); | ||
422 | |||
418 | synchronize_net(); | 423 | synchronize_net(); |
419 | 424 | ||
420 | ieee80211_vif_release_channel(sdata); | 425 | ieee80211_vif_release_channel(sdata); |
@@ -422,8 +427,6 @@ static void ieee80211_del_virtual_monitor(struct ieee80211_local *local) | |||
422 | drv_remove_interface(local, sdata); | 427 | drv_remove_interface(local, sdata); |
423 | 428 | ||
424 | kfree(sdata); | 429 | kfree(sdata); |
425 | out_unlock: | ||
426 | mutex_unlock(&local->iflist_mtx); | ||
427 | } | 430 | } |
428 | 431 | ||
429 | /* | 432 | /* |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 29ce2aa87e7b..4749b3858695 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -1060,7 +1060,8 @@ void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) | |||
1060 | 1060 | ||
1061 | rcu_read_lock(); | 1061 | rcu_read_lock(); |
1062 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 1062 | list_for_each_entry_rcu(sdata, &local->interfaces, list) |
1063 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 1063 | if (ieee80211_vif_is_mesh(&sdata->vif) && |
1064 | ieee80211_sdata_running(sdata)) | ||
1064 | ieee80211_queue_work(&local->hw, &sdata->work); | 1065 | ieee80211_queue_work(&local->hw, &sdata->work); |
1065 | rcu_read_unlock(); | 1066 | rcu_read_unlock(); |
1066 | } | 1067 | } |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 141577412d84..82cc30318a86 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -3608,8 +3608,10 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local) | |||
3608 | 3608 | ||
3609 | /* Restart STA timers */ | 3609 | /* Restart STA timers */ |
3610 | rcu_read_lock(); | 3610 | rcu_read_lock(); |
3611 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 3611 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
3612 | ieee80211_restart_sta_timer(sdata); | 3612 | if (ieee80211_sdata_running(sdata)) |
3613 | ieee80211_restart_sta_timer(sdata); | ||
3614 | } | ||
3613 | rcu_read_unlock(); | 3615 | rcu_read_unlock(); |
3614 | } | 3616 | } |
3615 | 3617 | ||
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c index cc79b4a2e821..430bd254e496 100644 --- a/net/mac80211/offchannel.c +++ b/net/mac80211/offchannel.c | |||
@@ -297,10 +297,13 @@ void ieee80211_start_next_roc(struct ieee80211_local *local) | |||
297 | } | 297 | } |
298 | } | 298 | } |
299 | 299 | ||
300 | void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc) | 300 | void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free) |
301 | { | 301 | { |
302 | struct ieee80211_roc_work *dep, *tmp; | 302 | struct ieee80211_roc_work *dep, *tmp; |
303 | 303 | ||
304 | if (WARN_ON(roc->to_be_freed)) | ||
305 | return; | ||
306 | |||
304 | /* was never transmitted */ | 307 | /* was never transmitted */ |
305 | if (roc->frame) { | 308 | if (roc->frame) { |
306 | cfg80211_mgmt_tx_status(&roc->sdata->wdev, | 309 | cfg80211_mgmt_tx_status(&roc->sdata->wdev, |
@@ -316,9 +319,12 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc) | |||
316 | GFP_KERNEL); | 319 | GFP_KERNEL); |
317 | 320 | ||
318 | list_for_each_entry_safe(dep, tmp, &roc->dependents, list) | 321 | list_for_each_entry_safe(dep, tmp, &roc->dependents, list) |
319 | ieee80211_roc_notify_destroy(dep); | 322 | ieee80211_roc_notify_destroy(dep, true); |
320 | 323 | ||
321 | kfree(roc); | 324 | if (free) |
325 | kfree(roc); | ||
326 | else | ||
327 | roc->to_be_freed = true; | ||
322 | } | 328 | } |
323 | 329 | ||
324 | void ieee80211_sw_roc_work(struct work_struct *work) | 330 | void ieee80211_sw_roc_work(struct work_struct *work) |
@@ -331,6 +337,9 @@ void ieee80211_sw_roc_work(struct work_struct *work) | |||
331 | 337 | ||
332 | mutex_lock(&local->mtx); | 338 | mutex_lock(&local->mtx); |
333 | 339 | ||
340 | if (roc->to_be_freed) | ||
341 | goto out_unlock; | ||
342 | |||
334 | if (roc->abort) | 343 | if (roc->abort) |
335 | goto finish; | 344 | goto finish; |
336 | 345 | ||
@@ -370,7 +379,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) | |||
370 | finish: | 379 | finish: |
371 | list_del(&roc->list); | 380 | list_del(&roc->list); |
372 | started = roc->started; | 381 | started = roc->started; |
373 | ieee80211_roc_notify_destroy(roc); | 382 | ieee80211_roc_notify_destroy(roc, !roc->abort); |
374 | 383 | ||
375 | if (started) { | 384 | if (started) { |
376 | drv_flush(local, false); | 385 | drv_flush(local, false); |
@@ -410,7 +419,7 @@ static void ieee80211_hw_roc_done(struct work_struct *work) | |||
410 | 419 | ||
411 | list_del(&roc->list); | 420 | list_del(&roc->list); |
412 | 421 | ||
413 | ieee80211_roc_notify_destroy(roc); | 422 | ieee80211_roc_notify_destroy(roc, true); |
414 | 423 | ||
415 | /* if there's another roc, start it now */ | 424 | /* if there's another roc, start it now */ |
416 | ieee80211_start_next_roc(local); | 425 | ieee80211_start_next_roc(local); |
@@ -460,12 +469,14 @@ void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata) | |||
460 | list_for_each_entry_safe(roc, tmp, &tmp_list, list) { | 469 | list_for_each_entry_safe(roc, tmp, &tmp_list, list) { |
461 | if (local->ops->remain_on_channel) { | 470 | if (local->ops->remain_on_channel) { |
462 | list_del(&roc->list); | 471 | list_del(&roc->list); |
463 | ieee80211_roc_notify_destroy(roc); | 472 | ieee80211_roc_notify_destroy(roc, true); |
464 | } else { | 473 | } else { |
465 | ieee80211_queue_delayed_work(&local->hw, &roc->work, 0); | 474 | ieee80211_queue_delayed_work(&local->hw, &roc->work, 0); |
466 | 475 | ||
467 | /* work will clean up etc */ | 476 | /* work will clean up etc */ |
468 | flush_delayed_work(&roc->work); | 477 | flush_delayed_work(&roc->work); |
478 | WARN_ON(!roc->to_be_freed); | ||
479 | kfree(roc); | ||
469 | } | 480 | } |
470 | } | 481 | } |
471 | 482 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bb73ed2d20b9..c6844ad080be 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2675,7 +2675,19 @@ ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx) | |||
2675 | 2675 | ||
2676 | memset(nskb->cb, 0, sizeof(nskb->cb)); | 2676 | memset(nskb->cb, 0, sizeof(nskb->cb)); |
2677 | 2677 | ||
2678 | ieee80211_tx_skb(rx->sdata, nskb); | 2678 | if (rx->sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) { |
2679 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(nskb); | ||
2680 | |||
2681 | info->flags = IEEE80211_TX_CTL_TX_OFFCHAN | | ||
2682 | IEEE80211_TX_INTFL_OFFCHAN_TX_OK | | ||
2683 | IEEE80211_TX_CTL_NO_CCK_RATE; | ||
2684 | if (local->hw.flags & IEEE80211_HW_QUEUE_CONTROL) | ||
2685 | info->hw_queue = | ||
2686 | local->hw.offchannel_tx_hw_queue; | ||
2687 | } | ||
2688 | |||
2689 | __ieee80211_tx_skb_tid_band(rx->sdata, nskb, 7, | ||
2690 | status->band); | ||
2679 | } | 2691 | } |
2680 | dev_kfree_skb(rx->skb); | 2692 | dev_kfree_skb(rx->skb); |
2681 | return RX_QUEUED; | 2693 | return RX_QUEUED; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index a79ce820cb50..238a0cca320e 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -766,6 +766,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta) | |||
766 | struct ieee80211_local *local; | 766 | struct ieee80211_local *local; |
767 | struct ieee80211_sub_if_data *sdata; | 767 | struct ieee80211_sub_if_data *sdata; |
768 | int ret, i; | 768 | int ret, i; |
769 | bool have_key = false; | ||
769 | 770 | ||
770 | might_sleep(); | 771 | might_sleep(); |
771 | 772 | ||
@@ -793,12 +794,19 @@ int __must_check __sta_info_destroy(struct sta_info *sta) | |||
793 | list_del_rcu(&sta->list); | 794 | list_del_rcu(&sta->list); |
794 | 795 | ||
795 | mutex_lock(&local->key_mtx); | 796 | mutex_lock(&local->key_mtx); |
796 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) | 797 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
797 | __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i])); | 798 | __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i])); |
798 | if (sta->ptk) | 799 | have_key = true; |
800 | } | ||
801 | if (sta->ptk) { | ||
799 | __ieee80211_key_free(key_mtx_dereference(local, sta->ptk)); | 802 | __ieee80211_key_free(key_mtx_dereference(local, sta->ptk)); |
803 | have_key = true; | ||
804 | } | ||
800 | mutex_unlock(&local->key_mtx); | 805 | mutex_unlock(&local->key_mtx); |
801 | 806 | ||
807 | if (!have_key) | ||
808 | synchronize_net(); | ||
809 | |||
802 | sta->dead = true; | 810 | sta->dead = true; |
803 | 811 | ||
804 | local->num_sta--; | 812 | local->num_sta--; |
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c index 6bcce401fd1c..fedee3943661 100644 --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c | |||
@@ -568,6 +568,7 @@ static int __init nf_conntrack_standalone_init(void) | |||
568 | register_net_sysctl(&init_net, "net", nf_ct_netfilter_table); | 568 | register_net_sysctl(&init_net, "net", nf_ct_netfilter_table); |
569 | if (!nf_ct_netfilter_header) { | 569 | if (!nf_ct_netfilter_header) { |
570 | pr_err("nf_conntrack: can't register to sysctl.\n"); | 570 | pr_err("nf_conntrack: can't register to sysctl.\n"); |
571 | ret = -ENOMEM; | ||
571 | goto out_sysctl; | 572 | goto out_sysctl; |
572 | } | 573 | } |
573 | #endif | 574 | #endif |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 589d686f0b4c..dc3fd5d44464 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -49,6 +49,8 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb, | |||
49 | return -EINVAL; | 49 | return -EINVAL; |
50 | 50 | ||
51 | acct_name = nla_data(tb[NFACCT_NAME]); | 51 | acct_name = nla_data(tb[NFACCT_NAME]); |
52 | if (strlen(acct_name) == 0) | ||
53 | return -EINVAL; | ||
52 | 54 | ||
53 | list_for_each_entry(nfacct, &nfnl_acct_list, head) { | 55 | list_for_each_entry(nfacct, &nfnl_acct_list, head) { |
54 | if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0) | 56 | if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0) |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 1cb48540f86a..42680b2baa11 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -1062,8 +1062,10 @@ static int __init nfnetlink_queue_init(void) | |||
1062 | 1062 | ||
1063 | #ifdef CONFIG_PROC_FS | 1063 | #ifdef CONFIG_PROC_FS |
1064 | if (!proc_create("nfnetlink_queue", 0440, | 1064 | if (!proc_create("nfnetlink_queue", 0440, |
1065 | proc_net_netfilter, &nfqnl_file_ops)) | 1065 | proc_net_netfilter, &nfqnl_file_ops)) { |
1066 | status = -ENOMEM; | ||
1066 | goto cleanup_subsys; | 1067 | goto cleanup_subsys; |
1068 | } | ||
1067 | #endif | 1069 | #endif |
1068 | 1070 | ||
1069 | register_netdevice_notifier(&nfqnl_dev_notifier); | 1071 | register_netdevice_notifier(&nfqnl_dev_notifier); |
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c index b530afadd76c..ee25f25f0cd6 100644 --- a/net/nfc/llcp/llcp.c +++ b/net/nfc/llcp/llcp.c | |||
@@ -107,8 +107,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen, | |||
107 | accept_sk->sk_state_change(sk); | 107 | accept_sk->sk_state_change(sk); |
108 | 108 | ||
109 | bh_unlock_sock(accept_sk); | 109 | bh_unlock_sock(accept_sk); |
110 | |||
111 | sock_orphan(accept_sk); | ||
112 | } | 110 | } |
113 | 111 | ||
114 | if (listen == true) { | 112 | if (listen == true) { |
@@ -134,8 +132,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen, | |||
134 | 132 | ||
135 | bh_unlock_sock(sk); | 133 | bh_unlock_sock(sk); |
136 | 134 | ||
137 | sock_orphan(sk); | ||
138 | |||
139 | sk_del_node_init(sk); | 135 | sk_del_node_init(sk); |
140 | } | 136 | } |
141 | 137 | ||
@@ -164,8 +160,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen, | |||
164 | 160 | ||
165 | bh_unlock_sock(sk); | 161 | bh_unlock_sock(sk); |
166 | 162 | ||
167 | sock_orphan(sk); | ||
168 | |||
169 | sk_del_node_init(sk); | 163 | sk_del_node_init(sk); |
170 | } | 164 | } |
171 | 165 | ||
@@ -827,7 +821,6 @@ static void nfc_llcp_recv_ui(struct nfc_llcp_local *local, | |||
827 | skb_get(skb); | 821 | skb_get(skb); |
828 | } else { | 822 | } else { |
829 | pr_err("Receive queue is full\n"); | 823 | pr_err("Receive queue is full\n"); |
830 | kfree_skb(skb); | ||
831 | } | 824 | } |
832 | 825 | ||
833 | nfc_llcp_sock_put(llcp_sock); | 826 | nfc_llcp_sock_put(llcp_sock); |
@@ -1028,7 +1021,6 @@ static void nfc_llcp_recv_hdlc(struct nfc_llcp_local *local, | |||
1028 | skb_get(skb); | 1021 | skb_get(skb); |
1029 | } else { | 1022 | } else { |
1030 | pr_err("Receive queue is full\n"); | 1023 | pr_err("Receive queue is full\n"); |
1031 | kfree_skb(skb); | ||
1032 | } | 1024 | } |
1033 | } | 1025 | } |
1034 | 1026 | ||
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 5c7cdf3f2a83..8f025746f337 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -270,7 +270,9 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent, | |||
270 | } | 270 | } |
271 | 271 | ||
272 | if (sk->sk_state == LLCP_CONNECTED || !newsock) { | 272 | if (sk->sk_state == LLCP_CONNECTED || !newsock) { |
273 | nfc_llcp_accept_unlink(sk); | 273 | list_del_init(&lsk->accept_queue); |
274 | sock_put(sk); | ||
275 | |||
274 | if (newsock) | 276 | if (newsock) |
275 | sock_graft(sk, newsock); | 277 | sock_graft(sk, newsock); |
276 | 278 | ||
@@ -464,8 +466,6 @@ static int llcp_sock_release(struct socket *sock) | |||
464 | nfc_llcp_accept_unlink(accept_sk); | 466 | nfc_llcp_accept_unlink(accept_sk); |
465 | 467 | ||
466 | release_sock(accept_sk); | 468 | release_sock(accept_sk); |
467 | |||
468 | sock_orphan(accept_sk); | ||
469 | } | 469 | } |
470 | } | 470 | } |
471 | 471 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 13aa47aa2ffb..1bc210ffcba2 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -962,8 +962,11 @@ cbq_dequeue(struct Qdisc *sch) | |||
962 | cbq_update(q); | 962 | cbq_update(q); |
963 | if ((incr -= incr2) < 0) | 963 | if ((incr -= incr2) < 0) |
964 | incr = 0; | 964 | incr = 0; |
965 | q->now += incr; | ||
966 | } else { | ||
967 | if (now > q->now) | ||
968 | q->now = now; | ||
965 | } | 969 | } |
966 | q->now += incr; | ||
967 | q->now_rt = now; | 970 | q->now_rt = now; |
968 | 971 | ||
969 | for (;;) { | 972 | for (;;) { |
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 4e606fcb2534..55786283a3df 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
@@ -195,7 +195,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
195 | flow->deficit = q->quantum; | 195 | flow->deficit = q->quantum; |
196 | flow->dropped = 0; | 196 | flow->dropped = 0; |
197 | } | 197 | } |
198 | if (++sch->q.qlen < sch->limit) | 198 | if (++sch->q.qlen <= sch->limit) |
199 | return NET_XMIT_SUCCESS; | 199 | return NET_XMIT_SUCCESS; |
200 | 200 | ||
201 | q->drop_overlimit++; | 201 | q->drop_overlimit++; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index ffad48109a22..eac7e0ee23c1 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -904,7 +904,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate) | |||
904 | u64 mult; | 904 | u64 mult; |
905 | int shift; | 905 | int shift; |
906 | 906 | ||
907 | r->rate_bps = rate << 3; | 907 | r->rate_bps = (u64)rate << 3; |
908 | r->shift = 0; | 908 | r->shift = 0; |
909 | r->mult = 1; | 909 | r->mult = 1; |
910 | /* | 910 | /* |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 971282b6f6a3..2db702d82e7d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1412,8 +1412,8 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock, | |||
1412 | if (UNIXCB(skb).cred) | 1412 | if (UNIXCB(skb).cred) |
1413 | return; | 1413 | return; |
1414 | if (test_bit(SOCK_PASSCRED, &sock->flags) || | 1414 | if (test_bit(SOCK_PASSCRED, &sock->flags) || |
1415 | (other->sk_socket && | 1415 | !other->sk_socket || |
1416 | test_bit(SOCK_PASSCRED, &other->sk_socket->flags))) { | 1416 | test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) { |
1417 | UNIXCB(skb).pid = get_pid(task_tgid(current)); | 1417 | UNIXCB(skb).pid = get_pid(task_tgid(current)); |
1418 | UNIXCB(skb).cred = get_current_cred(); | 1418 | UNIXCB(skb).cred = get_current_cred(); |
1419 | } | 1419 | } |
@@ -1993,7 +1993,7 @@ again: | |||
1993 | if ((UNIXCB(skb).pid != siocb->scm->pid) || | 1993 | if ((UNIXCB(skb).pid != siocb->scm->pid) || |
1994 | (UNIXCB(skb).cred != siocb->scm->cred)) | 1994 | (UNIXCB(skb).cred != siocb->scm->cred)) |
1995 | break; | 1995 | break; |
1996 | } else { | 1996 | } else if (test_bit(SOCK_PASSCRED, &sock->flags)) { |
1997 | /* Copy credentials */ | 1997 | /* Copy credentials */ |
1998 | scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); | 1998 | scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); |
1999 | check_creds = 1; | 1999 | check_creds = 1; |
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index ca511c4f388a..d8079daf1bde 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c | |||
@@ -207,7 +207,7 @@ static struct sock *__vsock_find_bound_socket(struct sockaddr_vm *addr) | |||
207 | struct vsock_sock *vsk; | 207 | struct vsock_sock *vsk; |
208 | 208 | ||
209 | list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) | 209 | list_for_each_entry(vsk, vsock_bound_sockets(addr), bound_table) |
210 | if (vsock_addr_equals_addr_any(addr, &vsk->local_addr)) | 210 | if (addr->svm_port == vsk->local_addr.svm_port) |
211 | return sk_vsock(vsk); | 211 | return sk_vsock(vsk); |
212 | 212 | ||
213 | return NULL; | 213 | return NULL; |
@@ -220,8 +220,8 @@ static struct sock *__vsock_find_connected_socket(struct sockaddr_vm *src, | |||
220 | 220 | ||
221 | list_for_each_entry(vsk, vsock_connected_sockets(src, dst), | 221 | list_for_each_entry(vsk, vsock_connected_sockets(src, dst), |
222 | connected_table) { | 222 | connected_table) { |
223 | if (vsock_addr_equals_addr(src, &vsk->remote_addr) | 223 | if (vsock_addr_equals_addr(src, &vsk->remote_addr) && |
224 | && vsock_addr_equals_addr(dst, &vsk->local_addr)) { | 224 | dst->svm_port == vsk->local_addr.svm_port) { |
225 | return sk_vsock(vsk); | 225 | return sk_vsock(vsk); |
226 | } | 226 | } |
227 | } | 227 | } |
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index a70ace83a153..1f6508e249ae 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c | |||
@@ -464,19 +464,16 @@ static struct sock *vmci_transport_get_pending( | |||
464 | struct vsock_sock *vlistener; | 464 | struct vsock_sock *vlistener; |
465 | struct vsock_sock *vpending; | 465 | struct vsock_sock *vpending; |
466 | struct sock *pending; | 466 | struct sock *pending; |
467 | struct sockaddr_vm src; | ||
468 | |||
469 | vsock_addr_init(&src, pkt->dg.src.context, pkt->src_port); | ||
467 | 470 | ||
468 | vlistener = vsock_sk(listener); | 471 | vlistener = vsock_sk(listener); |
469 | 472 | ||
470 | list_for_each_entry(vpending, &vlistener->pending_links, | 473 | list_for_each_entry(vpending, &vlistener->pending_links, |
471 | pending_links) { | 474 | pending_links) { |
472 | struct sockaddr_vm src; | ||
473 | struct sockaddr_vm dst; | ||
474 | |||
475 | vsock_addr_init(&src, pkt->dg.src.context, pkt->src_port); | ||
476 | vsock_addr_init(&dst, pkt->dg.dst.context, pkt->dst_port); | ||
477 | |||
478 | if (vsock_addr_equals_addr(&src, &vpending->remote_addr) && | 475 | if (vsock_addr_equals_addr(&src, &vpending->remote_addr) && |
479 | vsock_addr_equals_addr(&dst, &vpending->local_addr)) { | 476 | pkt->dst_port == vpending->local_addr.svm_port) { |
480 | pending = sk_vsock(vpending); | 477 | pending = sk_vsock(vpending); |
481 | sock_hold(pending); | 478 | sock_hold(pending); |
482 | goto found; | 479 | goto found; |
@@ -739,10 +736,15 @@ static int vmci_transport_recv_stream_cb(void *data, struct vmci_datagram *dg) | |||
739 | */ | 736 | */ |
740 | bh_lock_sock(sk); | 737 | bh_lock_sock(sk); |
741 | 738 | ||
742 | if (!sock_owned_by_user(sk) && sk->sk_state == SS_CONNECTED) | 739 | if (!sock_owned_by_user(sk)) { |
743 | vmci_trans(vsk)->notify_ops->handle_notify_pkt( | 740 | /* The local context ID may be out of date, update it. */ |
744 | sk, pkt, true, &dst, &src, | 741 | vsk->local_addr.svm_cid = dst.svm_cid; |
745 | &bh_process_pkt); | 742 | |
743 | if (sk->sk_state == SS_CONNECTED) | ||
744 | vmci_trans(vsk)->notify_ops->handle_notify_pkt( | ||
745 | sk, pkt, true, &dst, &src, | ||
746 | &bh_process_pkt); | ||
747 | } | ||
746 | 748 | ||
747 | bh_unlock_sock(sk); | 749 | bh_unlock_sock(sk); |
748 | 750 | ||
@@ -902,6 +904,9 @@ static void vmci_transport_recv_pkt_work(struct work_struct *work) | |||
902 | 904 | ||
903 | lock_sock(sk); | 905 | lock_sock(sk); |
904 | 906 | ||
907 | /* The local context ID may be out of date. */ | ||
908 | vsock_sk(sk)->local_addr.svm_cid = pkt->dg.dst.context; | ||
909 | |||
905 | switch (sk->sk_state) { | 910 | switch (sk->sk_state) { |
906 | case SS_LISTEN: | 911 | case SS_LISTEN: |
907 | vmci_transport_recv_listen(sk, pkt); | 912 | vmci_transport_recv_listen(sk, pkt); |
@@ -958,6 +963,10 @@ static int vmci_transport_recv_listen(struct sock *sk, | |||
958 | pending = vmci_transport_get_pending(sk, pkt); | 963 | pending = vmci_transport_get_pending(sk, pkt); |
959 | if (pending) { | 964 | if (pending) { |
960 | lock_sock(pending); | 965 | lock_sock(pending); |
966 | |||
967 | /* The local context ID may be out of date. */ | ||
968 | vsock_sk(pending)->local_addr.svm_cid = pkt->dg.dst.context; | ||
969 | |||
961 | switch (pending->sk_state) { | 970 | switch (pending->sk_state) { |
962 | case SS_CONNECTING: | 971 | case SS_CONNECTING: |
963 | err = vmci_transport_recv_connecting_server(sk, | 972 | err = vmci_transport_recv_connecting_server(sk, |
diff --git a/net/vmw_vsock/vsock_addr.c b/net/vmw_vsock/vsock_addr.c index b7df1aea7c59..ec2611b4ea0e 100644 --- a/net/vmw_vsock/vsock_addr.c +++ b/net/vmw_vsock/vsock_addr.c | |||
@@ -64,16 +64,6 @@ bool vsock_addr_equals_addr(const struct sockaddr_vm *addr, | |||
64 | } | 64 | } |
65 | EXPORT_SYMBOL_GPL(vsock_addr_equals_addr); | 65 | EXPORT_SYMBOL_GPL(vsock_addr_equals_addr); |
66 | 66 | ||
67 | bool vsock_addr_equals_addr_any(const struct sockaddr_vm *addr, | ||
68 | const struct sockaddr_vm *other) | ||
69 | { | ||
70 | return (addr->svm_cid == VMADDR_CID_ANY || | ||
71 | other->svm_cid == VMADDR_CID_ANY || | ||
72 | addr->svm_cid == other->svm_cid) && | ||
73 | addr->svm_port == other->svm_port; | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(vsock_addr_equals_addr_any); | ||
76 | |||
77 | int vsock_addr_cast(const struct sockaddr *addr, | 67 | int vsock_addr_cast(const struct sockaddr *addr, |
78 | size_t len, struct sockaddr_vm **out_addr) | 68 | size_t len, struct sockaddr_vm **out_addr) |
79 | { | 69 | { |
diff --git a/net/vmw_vsock/vsock_addr.h b/net/vmw_vsock/vsock_addr.h index cdfbcefdf843..9ccd5316eac0 100644 --- a/net/vmw_vsock/vsock_addr.h +++ b/net/vmw_vsock/vsock_addr.h | |||
@@ -24,8 +24,6 @@ bool vsock_addr_bound(const struct sockaddr_vm *addr); | |||
24 | void vsock_addr_unbind(struct sockaddr_vm *addr); | 24 | void vsock_addr_unbind(struct sockaddr_vm *addr); |
25 | bool vsock_addr_equals_addr(const struct sockaddr_vm *addr, | 25 | bool vsock_addr_equals_addr(const struct sockaddr_vm *addr, |
26 | const struct sockaddr_vm *other); | 26 | const struct sockaddr_vm *other); |
27 | bool vsock_addr_equals_addr_any(const struct sockaddr_vm *addr, | ||
28 | const struct sockaddr_vm *other); | ||
29 | int vsock_addr_cast(const struct sockaddr *addr, size_t len, | 27 | int vsock_addr_cast(const struct sockaddr *addr, size_t len, |
30 | struct sockaddr_vm **out_addr); | 28 | struct sockaddr_vm **out_addr); |
31 | 29 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index ea4155fe9733..6ddf74f0ae1e 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -212,6 +212,39 @@ static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data) | |||
212 | rdev_rfkill_poll(rdev); | 212 | rdev_rfkill_poll(rdev); |
213 | } | 213 | } |
214 | 214 | ||
215 | void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev, | ||
216 | struct wireless_dev *wdev) | ||
217 | { | ||
218 | lockdep_assert_held(&rdev->devlist_mtx); | ||
219 | lockdep_assert_held(&rdev->sched_scan_mtx); | ||
220 | |||
221 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE)) | ||
222 | return; | ||
223 | |||
224 | if (!wdev->p2p_started) | ||
225 | return; | ||
226 | |||
227 | rdev_stop_p2p_device(rdev, wdev); | ||
228 | wdev->p2p_started = false; | ||
229 | |||
230 | rdev->opencount--; | ||
231 | |||
232 | if (rdev->scan_req && rdev->scan_req->wdev == wdev) { | ||
233 | bool busy = work_busy(&rdev->scan_done_wk); | ||
234 | |||
235 | /* | ||
236 | * If the work isn't pending or running (in which case it would | ||
237 | * be waiting for the lock we hold) the driver didn't properly | ||
238 | * cancel the scan when the interface was removed. In this case | ||
239 | * warn and leak the scan request object to not crash later. | ||
240 | */ | ||
241 | WARN_ON(!busy); | ||
242 | |||
243 | rdev->scan_req->aborted = true; | ||
244 | ___cfg80211_scan_done(rdev, !busy); | ||
245 | } | ||
246 | } | ||
247 | |||
215 | static int cfg80211_rfkill_set_block(void *data, bool blocked) | 248 | static int cfg80211_rfkill_set_block(void *data, bool blocked) |
216 | { | 249 | { |
217 | struct cfg80211_registered_device *rdev = data; | 250 | struct cfg80211_registered_device *rdev = data; |
@@ -221,7 +254,8 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked) | |||
221 | return 0; | 254 | return 0; |
222 | 255 | ||
223 | rtnl_lock(); | 256 | rtnl_lock(); |
224 | mutex_lock(&rdev->devlist_mtx); | 257 | |
258 | /* read-only iteration need not hold the devlist_mtx */ | ||
225 | 259 | ||
226 | list_for_each_entry(wdev, &rdev->wdev_list, list) { | 260 | list_for_each_entry(wdev, &rdev->wdev_list, list) { |
227 | if (wdev->netdev) { | 261 | if (wdev->netdev) { |
@@ -231,18 +265,18 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked) | |||
231 | /* otherwise, check iftype */ | 265 | /* otherwise, check iftype */ |
232 | switch (wdev->iftype) { | 266 | switch (wdev->iftype) { |
233 | case NL80211_IFTYPE_P2P_DEVICE: | 267 | case NL80211_IFTYPE_P2P_DEVICE: |
234 | if (!wdev->p2p_started) | 268 | /* but this requires it */ |
235 | break; | 269 | mutex_lock(&rdev->devlist_mtx); |
236 | rdev_stop_p2p_device(rdev, wdev); | 270 | mutex_lock(&rdev->sched_scan_mtx); |
237 | wdev->p2p_started = false; | 271 | cfg80211_stop_p2p_device(rdev, wdev); |
238 | rdev->opencount--; | 272 | mutex_unlock(&rdev->sched_scan_mtx); |
273 | mutex_unlock(&rdev->devlist_mtx); | ||
239 | break; | 274 | break; |
240 | default: | 275 | default: |
241 | break; | 276 | break; |
242 | } | 277 | } |
243 | } | 278 | } |
244 | 279 | ||
245 | mutex_unlock(&rdev->devlist_mtx); | ||
246 | rtnl_unlock(); | 280 | rtnl_unlock(); |
247 | 281 | ||
248 | return 0; | 282 | return 0; |
@@ -745,17 +779,13 @@ static void wdev_cleanup_work(struct work_struct *work) | |||
745 | wdev = container_of(work, struct wireless_dev, cleanup_work); | 779 | wdev = container_of(work, struct wireless_dev, cleanup_work); |
746 | rdev = wiphy_to_dev(wdev->wiphy); | 780 | rdev = wiphy_to_dev(wdev->wiphy); |
747 | 781 | ||
748 | cfg80211_lock_rdev(rdev); | 782 | mutex_lock(&rdev->sched_scan_mtx); |
749 | 783 | ||
750 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { | 784 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { |
751 | rdev->scan_req->aborted = true; | 785 | rdev->scan_req->aborted = true; |
752 | ___cfg80211_scan_done(rdev, true); | 786 | ___cfg80211_scan_done(rdev, true); |
753 | } | 787 | } |
754 | 788 | ||
755 | cfg80211_unlock_rdev(rdev); | ||
756 | |||
757 | mutex_lock(&rdev->sched_scan_mtx); | ||
758 | |||
759 | if (WARN_ON(rdev->sched_scan_req && | 789 | if (WARN_ON(rdev->sched_scan_req && |
760 | rdev->sched_scan_req->dev == wdev->netdev)) { | 790 | rdev->sched_scan_req->dev == wdev->netdev)) { |
761 | __cfg80211_stop_sched_scan(rdev, false); | 791 | __cfg80211_stop_sched_scan(rdev, false); |
@@ -781,21 +811,19 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev) | |||
781 | return; | 811 | return; |
782 | 812 | ||
783 | mutex_lock(&rdev->devlist_mtx); | 813 | mutex_lock(&rdev->devlist_mtx); |
814 | mutex_lock(&rdev->sched_scan_mtx); | ||
784 | list_del_rcu(&wdev->list); | 815 | list_del_rcu(&wdev->list); |
785 | rdev->devlist_generation++; | 816 | rdev->devlist_generation++; |
786 | 817 | ||
787 | switch (wdev->iftype) { | 818 | switch (wdev->iftype) { |
788 | case NL80211_IFTYPE_P2P_DEVICE: | 819 | case NL80211_IFTYPE_P2P_DEVICE: |
789 | if (!wdev->p2p_started) | 820 | cfg80211_stop_p2p_device(rdev, wdev); |
790 | break; | ||
791 | rdev_stop_p2p_device(rdev, wdev); | ||
792 | wdev->p2p_started = false; | ||
793 | rdev->opencount--; | ||
794 | break; | 821 | break; |
795 | default: | 822 | default: |
796 | WARN_ON_ONCE(1); | 823 | WARN_ON_ONCE(1); |
797 | break; | 824 | break; |
798 | } | 825 | } |
826 | mutex_unlock(&rdev->sched_scan_mtx); | ||
799 | mutex_unlock(&rdev->devlist_mtx); | 827 | mutex_unlock(&rdev->devlist_mtx); |
800 | } | 828 | } |
801 | EXPORT_SYMBOL(cfg80211_unregister_wdev); | 829 | EXPORT_SYMBOL(cfg80211_unregister_wdev); |
@@ -936,6 +964,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
936 | cfg80211_update_iface_num(rdev, wdev->iftype, 1); | 964 | cfg80211_update_iface_num(rdev, wdev->iftype, 1); |
937 | cfg80211_lock_rdev(rdev); | 965 | cfg80211_lock_rdev(rdev); |
938 | mutex_lock(&rdev->devlist_mtx); | 966 | mutex_lock(&rdev->devlist_mtx); |
967 | mutex_lock(&rdev->sched_scan_mtx); | ||
939 | wdev_lock(wdev); | 968 | wdev_lock(wdev); |
940 | switch (wdev->iftype) { | 969 | switch (wdev->iftype) { |
941 | #ifdef CONFIG_CFG80211_WEXT | 970 | #ifdef CONFIG_CFG80211_WEXT |
@@ -967,6 +996,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
967 | break; | 996 | break; |
968 | } | 997 | } |
969 | wdev_unlock(wdev); | 998 | wdev_unlock(wdev); |
999 | mutex_unlock(&rdev->sched_scan_mtx); | ||
970 | rdev->opencount++; | 1000 | rdev->opencount++; |
971 | mutex_unlock(&rdev->devlist_mtx); | 1001 | mutex_unlock(&rdev->devlist_mtx); |
972 | cfg80211_unlock_rdev(rdev); | 1002 | cfg80211_unlock_rdev(rdev); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 3aec0e429d8a..5845c2b37aa8 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -503,6 +503,9 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, | |||
503 | void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, | 503 | void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev, |
504 | enum nl80211_iftype iftype, int num); | 504 | enum nl80211_iftype iftype, int num); |
505 | 505 | ||
506 | void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev, | ||
507 | struct wireless_dev *wdev); | ||
508 | |||
506 | #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 | 509 | #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 |
507 | 510 | ||
508 | #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS | 511 | #ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index d44ab216c0ec..58e13a8c95f9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4702,14 +4702,19 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
4702 | if (!rdev->ops->scan) | 4702 | if (!rdev->ops->scan) |
4703 | return -EOPNOTSUPP; | 4703 | return -EOPNOTSUPP; |
4704 | 4704 | ||
4705 | if (rdev->scan_req) | 4705 | mutex_lock(&rdev->sched_scan_mtx); |
4706 | return -EBUSY; | 4706 | if (rdev->scan_req) { |
4707 | err = -EBUSY; | ||
4708 | goto unlock; | ||
4709 | } | ||
4707 | 4710 | ||
4708 | if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { | 4711 | if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { |
4709 | n_channels = validate_scan_freqs( | 4712 | n_channels = validate_scan_freqs( |
4710 | info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); | 4713 | info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); |
4711 | if (!n_channels) | 4714 | if (!n_channels) { |
4712 | return -EINVAL; | 4715 | err = -EINVAL; |
4716 | goto unlock; | ||
4717 | } | ||
4713 | } else { | 4718 | } else { |
4714 | enum ieee80211_band band; | 4719 | enum ieee80211_band band; |
4715 | n_channels = 0; | 4720 | n_channels = 0; |
@@ -4723,23 +4728,29 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
4723 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) | 4728 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) |
4724 | n_ssids++; | 4729 | n_ssids++; |
4725 | 4730 | ||
4726 | if (n_ssids > wiphy->max_scan_ssids) | 4731 | if (n_ssids > wiphy->max_scan_ssids) { |
4727 | return -EINVAL; | 4732 | err = -EINVAL; |
4733 | goto unlock; | ||
4734 | } | ||
4728 | 4735 | ||
4729 | if (info->attrs[NL80211_ATTR_IE]) | 4736 | if (info->attrs[NL80211_ATTR_IE]) |
4730 | ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); | 4737 | ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); |
4731 | else | 4738 | else |
4732 | ie_len = 0; | 4739 | ie_len = 0; |
4733 | 4740 | ||
4734 | if (ie_len > wiphy->max_scan_ie_len) | 4741 | if (ie_len > wiphy->max_scan_ie_len) { |
4735 | return -EINVAL; | 4742 | err = -EINVAL; |
4743 | goto unlock; | ||
4744 | } | ||
4736 | 4745 | ||
4737 | request = kzalloc(sizeof(*request) | 4746 | request = kzalloc(sizeof(*request) |
4738 | + sizeof(*request->ssids) * n_ssids | 4747 | + sizeof(*request->ssids) * n_ssids |
4739 | + sizeof(*request->channels) * n_channels | 4748 | + sizeof(*request->channels) * n_channels |
4740 | + ie_len, GFP_KERNEL); | 4749 | + ie_len, GFP_KERNEL); |
4741 | if (!request) | 4750 | if (!request) { |
4742 | return -ENOMEM; | 4751 | err = -ENOMEM; |
4752 | goto unlock; | ||
4753 | } | ||
4743 | 4754 | ||
4744 | if (n_ssids) | 4755 | if (n_ssids) |
4745 | request->ssids = (void *)&request->channels[n_channels]; | 4756 | request->ssids = (void *)&request->channels[n_channels]; |
@@ -4876,6 +4887,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
4876 | kfree(request); | 4887 | kfree(request); |
4877 | } | 4888 | } |
4878 | 4889 | ||
4890 | unlock: | ||
4891 | mutex_unlock(&rdev->sched_scan_mtx); | ||
4879 | return err; | 4892 | return err; |
4880 | } | 4893 | } |
4881 | 4894 | ||
@@ -7749,20 +7762,9 @@ static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info) | |||
7749 | if (!rdev->ops->stop_p2p_device) | 7762 | if (!rdev->ops->stop_p2p_device) |
7750 | return -EOPNOTSUPP; | 7763 | return -EOPNOTSUPP; |
7751 | 7764 | ||
7752 | if (!wdev->p2p_started) | 7765 | mutex_lock(&rdev->sched_scan_mtx); |
7753 | return 0; | 7766 | cfg80211_stop_p2p_device(rdev, wdev); |
7754 | 7767 | mutex_unlock(&rdev->sched_scan_mtx); | |
7755 | rdev_stop_p2p_device(rdev, wdev); | ||
7756 | wdev->p2p_started = false; | ||
7757 | |||
7758 | mutex_lock(&rdev->devlist_mtx); | ||
7759 | rdev->opencount--; | ||
7760 | mutex_unlock(&rdev->devlist_mtx); | ||
7761 | |||
7762 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { | ||
7763 | rdev->scan_req->aborted = true; | ||
7764 | ___cfg80211_scan_done(rdev, true); | ||
7765 | } | ||
7766 | 7768 | ||
7767 | return 0; | 7769 | return 0; |
7768 | } | 7770 | } |
@@ -8486,7 +8488,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg, | |||
8486 | struct nlattr *nest; | 8488 | struct nlattr *nest; |
8487 | int i; | 8489 | int i; |
8488 | 8490 | ||
8489 | ASSERT_RDEV_LOCK(rdev); | 8491 | lockdep_assert_held(&rdev->sched_scan_mtx); |
8490 | 8492 | ||
8491 | if (WARN_ON(!req)) | 8493 | if (WARN_ON(!req)) |
8492 | return 0; | 8494 | return 0; |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 674aadca0079..fd99ea495b7e 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -169,7 +169,7 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) | |||
169 | union iwreq_data wrqu; | 169 | union iwreq_data wrqu; |
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | ASSERT_RDEV_LOCK(rdev); | 172 | lockdep_assert_held(&rdev->sched_scan_mtx); |
173 | 173 | ||
174 | request = rdev->scan_req; | 174 | request = rdev->scan_req; |
175 | 175 | ||
@@ -230,9 +230,9 @@ void __cfg80211_scan_done(struct work_struct *wk) | |||
230 | rdev = container_of(wk, struct cfg80211_registered_device, | 230 | rdev = container_of(wk, struct cfg80211_registered_device, |
231 | scan_done_wk); | 231 | scan_done_wk); |
232 | 232 | ||
233 | cfg80211_lock_rdev(rdev); | 233 | mutex_lock(&rdev->sched_scan_mtx); |
234 | ___cfg80211_scan_done(rdev, false); | 234 | ___cfg80211_scan_done(rdev, false); |
235 | cfg80211_unlock_rdev(rdev); | 235 | mutex_unlock(&rdev->sched_scan_mtx); |
236 | } | 236 | } |
237 | 237 | ||
238 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) | 238 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) |
@@ -698,11 +698,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
698 | found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); | 698 | found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); |
699 | 699 | ||
700 | if (found) { | 700 | if (found) { |
701 | found->pub.beacon_interval = tmp->pub.beacon_interval; | ||
702 | found->pub.signal = tmp->pub.signal; | ||
703 | found->pub.capability = tmp->pub.capability; | ||
704 | found->ts = tmp->ts; | ||
705 | |||
706 | /* Update IEs */ | 701 | /* Update IEs */ |
707 | if (rcu_access_pointer(tmp->pub.proberesp_ies)) { | 702 | if (rcu_access_pointer(tmp->pub.proberesp_ies)) { |
708 | const struct cfg80211_bss_ies *old; | 703 | const struct cfg80211_bss_ies *old; |
@@ -723,6 +718,8 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
723 | 718 | ||
724 | if (found->pub.hidden_beacon_bss && | 719 | if (found->pub.hidden_beacon_bss && |
725 | !list_empty(&found->hidden_list)) { | 720 | !list_empty(&found->hidden_list)) { |
721 | const struct cfg80211_bss_ies *f; | ||
722 | |||
726 | /* | 723 | /* |
727 | * The found BSS struct is one of the probe | 724 | * The found BSS struct is one of the probe |
728 | * response members of a group, but we're | 725 | * response members of a group, but we're |
@@ -732,6 +729,10 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
732 | * SSID to showing it, which is confusing so | 729 | * SSID to showing it, which is confusing so |
733 | * drop this information. | 730 | * drop this information. |
734 | */ | 731 | */ |
732 | |||
733 | f = rcu_access_pointer(tmp->pub.beacon_ies); | ||
734 | kfree_rcu((struct cfg80211_bss_ies *)f, | ||
735 | rcu_head); | ||
735 | goto drop; | 736 | goto drop; |
736 | } | 737 | } |
737 | 738 | ||
@@ -761,6 +762,11 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
761 | kfree_rcu((struct cfg80211_bss_ies *)old, | 762 | kfree_rcu((struct cfg80211_bss_ies *)old, |
762 | rcu_head); | 763 | rcu_head); |
763 | } | 764 | } |
765 | |||
766 | found->pub.beacon_interval = tmp->pub.beacon_interval; | ||
767 | found->pub.signal = tmp->pub.signal; | ||
768 | found->pub.capability = tmp->pub.capability; | ||
769 | found->ts = tmp->ts; | ||
764 | } else { | 770 | } else { |
765 | struct cfg80211_internal_bss *new; | 771 | struct cfg80211_internal_bss *new; |
766 | struct cfg80211_internal_bss *hidden; | 772 | struct cfg80211_internal_bss *hidden; |
@@ -1056,6 +1062,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
1056 | if (IS_ERR(rdev)) | 1062 | if (IS_ERR(rdev)) |
1057 | return PTR_ERR(rdev); | 1063 | return PTR_ERR(rdev); |
1058 | 1064 | ||
1065 | mutex_lock(&rdev->sched_scan_mtx); | ||
1059 | if (rdev->scan_req) { | 1066 | if (rdev->scan_req) { |
1060 | err = -EBUSY; | 1067 | err = -EBUSY; |
1061 | goto out; | 1068 | goto out; |
@@ -1162,6 +1169,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
1162 | dev_hold(dev); | 1169 | dev_hold(dev); |
1163 | } | 1170 | } |
1164 | out: | 1171 | out: |
1172 | mutex_unlock(&rdev->sched_scan_mtx); | ||
1165 | kfree(creq); | 1173 | kfree(creq); |
1166 | cfg80211_unlock_rdev(rdev); | 1174 | cfg80211_unlock_rdev(rdev); |
1167 | return err; | 1175 | return err; |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index f432bd3755b1..09d994d192ff 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -85,6 +85,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) | |||
85 | ASSERT_RTNL(); | 85 | ASSERT_RTNL(); |
86 | ASSERT_RDEV_LOCK(rdev); | 86 | ASSERT_RDEV_LOCK(rdev); |
87 | ASSERT_WDEV_LOCK(wdev); | 87 | ASSERT_WDEV_LOCK(wdev); |
88 | lockdep_assert_held(&rdev->sched_scan_mtx); | ||
88 | 89 | ||
89 | if (rdev->scan_req) | 90 | if (rdev->scan_req) |
90 | return -EBUSY; | 91 | return -EBUSY; |
@@ -320,11 +321,9 @@ void cfg80211_sme_scan_done(struct net_device *dev) | |||
320 | { | 321 | { |
321 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 322 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
322 | 323 | ||
323 | mutex_lock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx); | ||
324 | wdev_lock(wdev); | 324 | wdev_lock(wdev); |
325 | __cfg80211_sme_scan_done(dev); | 325 | __cfg80211_sme_scan_done(dev); |
326 | wdev_unlock(wdev); | 326 | wdev_unlock(wdev); |
327 | mutex_unlock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx); | ||
328 | } | 327 | } |
329 | 328 | ||
330 | void cfg80211_sme_rx_auth(struct net_device *dev, | 329 | void cfg80211_sme_rx_auth(struct net_device *dev, |
@@ -924,9 +923,12 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
924 | int err; | 923 | int err; |
925 | 924 | ||
926 | mutex_lock(&rdev->devlist_mtx); | 925 | mutex_lock(&rdev->devlist_mtx); |
926 | /* might request scan - scan_mtx -> wdev_mtx dependency */ | ||
927 | mutex_lock(&rdev->sched_scan_mtx); | ||
927 | wdev_lock(dev->ieee80211_ptr); | 928 | wdev_lock(dev->ieee80211_ptr); |
928 | err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL); | 929 | err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL); |
929 | wdev_unlock(dev->ieee80211_ptr); | 930 | wdev_unlock(dev->ieee80211_ptr); |
931 | mutex_unlock(&rdev->sched_scan_mtx); | ||
930 | mutex_unlock(&rdev->devlist_mtx); | 932 | mutex_unlock(&rdev->devlist_mtx); |
931 | 933 | ||
932 | return err; | 934 | return err; |
diff --git a/net/wireless/trace.h b/net/wireless/trace.h index b7a531380e19..7586de77a2f8 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h | |||
@@ -27,7 +27,8 @@ | |||
27 | #define WIPHY_PR_ARG __entry->wiphy_name | 27 | #define WIPHY_PR_ARG __entry->wiphy_name |
28 | 28 | ||
29 | #define WDEV_ENTRY __field(u32, id) | 29 | #define WDEV_ENTRY __field(u32, id) |
30 | #define WDEV_ASSIGN (__entry->id) = (wdev ? wdev->identifier : 0) | 30 | #define WDEV_ASSIGN (__entry->id) = (!IS_ERR_OR_NULL(wdev) \ |
31 | ? wdev->identifier : 0) | ||
31 | #define WDEV_PR_FMT "wdev(%u)" | 32 | #define WDEV_PR_FMT "wdev(%u)" |
32 | #define WDEV_PR_ARG (__entry->id) | 33 | #define WDEV_PR_ARG (__entry->id) |
33 | 34 | ||
@@ -1778,7 +1779,7 @@ TRACE_EVENT(rdev_set_mac_acl, | |||
1778 | ), | 1779 | ), |
1779 | TP_fast_assign( | 1780 | TP_fast_assign( |
1780 | WIPHY_ASSIGN; | 1781 | WIPHY_ASSIGN; |
1781 | WIPHY_ASSIGN; | 1782 | NETDEV_ASSIGN; |
1782 | __entry->acl_policy = params->acl_policy; | 1783 | __entry->acl_policy = params->acl_policy; |
1783 | ), | 1784 | ), |
1784 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", acl policy: %d", | 1785 | TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", acl policy: %d", |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index fb9622f6d99c..e79cb5c0655a 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -89,6 +89,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
89 | 89 | ||
90 | cfg80211_lock_rdev(rdev); | 90 | cfg80211_lock_rdev(rdev); |
91 | mutex_lock(&rdev->devlist_mtx); | 91 | mutex_lock(&rdev->devlist_mtx); |
92 | mutex_lock(&rdev->sched_scan_mtx); | ||
92 | wdev_lock(wdev); | 93 | wdev_lock(wdev); |
93 | 94 | ||
94 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 95 | if (wdev->sme_state != CFG80211_SME_IDLE) { |
@@ -135,6 +136,7 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
135 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 136 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
136 | out: | 137 | out: |
137 | wdev_unlock(wdev); | 138 | wdev_unlock(wdev); |
139 | mutex_unlock(&rdev->sched_scan_mtx); | ||
138 | mutex_unlock(&rdev->devlist_mtx); | 140 | mutex_unlock(&rdev->devlist_mtx); |
139 | cfg80211_unlock_rdev(rdev); | 141 | cfg80211_unlock_rdev(rdev); |
140 | return err; | 142 | return err; |
@@ -190,6 +192,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
190 | 192 | ||
191 | cfg80211_lock_rdev(rdev); | 193 | cfg80211_lock_rdev(rdev); |
192 | mutex_lock(&rdev->devlist_mtx); | 194 | mutex_lock(&rdev->devlist_mtx); |
195 | mutex_lock(&rdev->sched_scan_mtx); | ||
193 | wdev_lock(wdev); | 196 | wdev_lock(wdev); |
194 | 197 | ||
195 | err = 0; | 198 | err = 0; |
@@ -223,6 +226,7 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
223 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 226 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
224 | out: | 227 | out: |
225 | wdev_unlock(wdev); | 228 | wdev_unlock(wdev); |
229 | mutex_unlock(&rdev->sched_scan_mtx); | ||
226 | mutex_unlock(&rdev->devlist_mtx); | 230 | mutex_unlock(&rdev->devlist_mtx); |
227 | cfg80211_unlock_rdev(rdev); | 231 | cfg80211_unlock_rdev(rdev); |
228 | return err; | 232 | return err; |
@@ -285,6 +289,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
285 | 289 | ||
286 | cfg80211_lock_rdev(rdev); | 290 | cfg80211_lock_rdev(rdev); |
287 | mutex_lock(&rdev->devlist_mtx); | 291 | mutex_lock(&rdev->devlist_mtx); |
292 | mutex_lock(&rdev->sched_scan_mtx); | ||
288 | wdev_lock(wdev); | 293 | wdev_lock(wdev); |
289 | 294 | ||
290 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 295 | if (wdev->sme_state != CFG80211_SME_IDLE) { |
@@ -313,6 +318,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
313 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 318 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
314 | out: | 319 | out: |
315 | wdev_unlock(wdev); | 320 | wdev_unlock(wdev); |
321 | mutex_unlock(&rdev->sched_scan_mtx); | ||
316 | mutex_unlock(&rdev->devlist_mtx); | 322 | mutex_unlock(&rdev->devlist_mtx); |
317 | cfg80211_unlock_rdev(rdev); | 323 | cfg80211_unlock_rdev(rdev); |
318 | return err; | 324 | return err; |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 35754cc8a9e5..8dafe6d3c6e4 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
@@ -334,6 +334,70 @@ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event) | |||
334 | x->xflags &= ~XFRM_TIME_DEFER; | 334 | x->xflags &= ~XFRM_TIME_DEFER; |
335 | } | 335 | } |
336 | 336 | ||
337 | static void xfrm_replay_notify_esn(struct xfrm_state *x, int event) | ||
338 | { | ||
339 | u32 seq_diff, oseq_diff; | ||
340 | struct km_event c; | ||
341 | struct xfrm_replay_state_esn *replay_esn = x->replay_esn; | ||
342 | struct xfrm_replay_state_esn *preplay_esn = x->preplay_esn; | ||
343 | |||
344 | /* we send notify messages in case | ||
345 | * 1. we updated on of the sequence numbers, and the seqno difference | ||
346 | * is at least x->replay_maxdiff, in this case we also update the | ||
347 | * timeout of our timer function | ||
348 | * 2. if x->replay_maxage has elapsed since last update, | ||
349 | * and there were changes | ||
350 | * | ||
351 | * The state structure must be locked! | ||
352 | */ | ||
353 | |||
354 | switch (event) { | ||
355 | case XFRM_REPLAY_UPDATE: | ||
356 | if (!x->replay_maxdiff) | ||
357 | break; | ||
358 | |||
359 | if (replay_esn->seq_hi == preplay_esn->seq_hi) | ||
360 | seq_diff = replay_esn->seq - preplay_esn->seq; | ||
361 | else | ||
362 | seq_diff = ~preplay_esn->seq + replay_esn->seq + 1; | ||
363 | |||
364 | if (replay_esn->oseq_hi == preplay_esn->oseq_hi) | ||
365 | oseq_diff = replay_esn->oseq - preplay_esn->oseq; | ||
366 | else | ||
367 | oseq_diff = ~preplay_esn->oseq + replay_esn->oseq + 1; | ||
368 | |||
369 | if (seq_diff < x->replay_maxdiff && | ||
370 | oseq_diff < x->replay_maxdiff) { | ||
371 | |||
372 | if (x->xflags & XFRM_TIME_DEFER) | ||
373 | event = XFRM_REPLAY_TIMEOUT; | ||
374 | else | ||
375 | return; | ||
376 | } | ||
377 | |||
378 | break; | ||
379 | |||
380 | case XFRM_REPLAY_TIMEOUT: | ||
381 | if (memcmp(x->replay_esn, x->preplay_esn, | ||
382 | xfrm_replay_state_esn_len(replay_esn)) == 0) { | ||
383 | x->xflags |= XFRM_TIME_DEFER; | ||
384 | return; | ||
385 | } | ||
386 | |||
387 | break; | ||
388 | } | ||
389 | |||
390 | memcpy(x->preplay_esn, x->replay_esn, | ||
391 | xfrm_replay_state_esn_len(replay_esn)); | ||
392 | c.event = XFRM_MSG_NEWAE; | ||
393 | c.data.aevent = event; | ||
394 | km_state_notify(x, &c); | ||
395 | |||
396 | if (x->replay_maxage && | ||
397 | !mod_timer(&x->rtimer, jiffies + x->replay_maxage)) | ||
398 | x->xflags &= ~XFRM_TIME_DEFER; | ||
399 | } | ||
400 | |||
337 | static int xfrm_replay_overflow_esn(struct xfrm_state *x, struct sk_buff *skb) | 401 | static int xfrm_replay_overflow_esn(struct xfrm_state *x, struct sk_buff *skb) |
338 | { | 402 | { |
339 | int err = 0; | 403 | int err = 0; |
@@ -510,7 +574,7 @@ static struct xfrm_replay xfrm_replay_esn = { | |||
510 | .advance = xfrm_replay_advance_esn, | 574 | .advance = xfrm_replay_advance_esn, |
511 | .check = xfrm_replay_check_esn, | 575 | .check = xfrm_replay_check_esn, |
512 | .recheck = xfrm_replay_recheck_esn, | 576 | .recheck = xfrm_replay_recheck_esn, |
513 | .notify = xfrm_replay_notify_bmp, | 577 | .notify = xfrm_replay_notify_esn, |
514 | .overflow = xfrm_replay_overflow_esn, | 578 | .overflow = xfrm_replay_overflow_esn, |
515 | }; | 579 | }; |
516 | 580 | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index ecdf30eb5879..4aba7646dd9c 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cfg) | |||
173 | "Line Out", "Speaker", "HP Out", "CD", | 173 | "Line Out", "Speaker", "HP Out", "CD", |
174 | "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", | 174 | "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", |
175 | "Line In", "Aux", "Mic", "Telephony", | 175 | "Line In", "Aux", "Mic", "Telephony", |
176 | "SPDIF In", "Digitial In", "Reserved", "Other" | 176 | "SPDIF In", "Digital In", "Reserved", "Other" |
177 | }; | 177 | }; |
178 | 178 | ||
179 | return jack_types[(cfg & AC_DEFCFG_DEVICE) | 179 | return jack_types[(cfg & AC_DEFCFG_DEVICE) |
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 7dd846380a50..d0d7ac1e99d2 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -320,7 +320,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid, | |||
320 | unsigned char *buf, int *eld_size) | 320 | unsigned char *buf, int *eld_size) |
321 | { | 321 | { |
322 | int i; | 322 | int i; |
323 | int ret; | 323 | int ret = 0; |
324 | int size; | 324 | int size; |
325 | 325 | ||
326 | /* | 326 | /* |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 43c2ea539561..2dbe767be16b 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -740,7 +740,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path); | |||
740 | static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) | 740 | static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) |
741 | { | 741 | { |
742 | struct hda_gen_spec *spec = codec->spec; | 742 | struct hda_gen_spec *spec = codec->spec; |
743 | bool changed; | 743 | bool changed = false; |
744 | int i; | 744 | int i; |
745 | 745 | ||
746 | if (!spec->power_down_unused || path->active) | 746 | if (!spec->power_down_unused || path->active) |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 418bfc0eb0a3..bcd40ee488e3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -134,8 +134,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " | |||
134 | * this may give more power-saving, but will take longer time to | 134 | * this may give more power-saving, but will take longer time to |
135 | * wake up. | 135 | * wake up. |
136 | */ | 136 | */ |
137 | static int power_save_controller = -1; | 137 | static bool power_save_controller = 1; |
138 | module_param(power_save_controller, bint, 0644); | 138 | module_param(power_save_controller, bool, 0644); |
139 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); | 139 | MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); |
140 | #endif /* CONFIG_PM */ | 140 | #endif /* CONFIG_PM */ |
141 | 141 | ||
@@ -2931,8 +2931,6 @@ static int azx_runtime_idle(struct device *dev) | |||
2931 | struct snd_card *card = dev_get_drvdata(dev); | 2931 | struct snd_card *card = dev_get_drvdata(dev); |
2932 | struct azx *chip = card->private_data; | 2932 | struct azx *chip = card->private_data; |
2933 | 2933 | ||
2934 | if (power_save_controller > 0) | ||
2935 | return 0; | ||
2936 | if (!power_save_controller || | 2934 | if (!power_save_controller || |
2937 | !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 2935 | !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
2938 | return -EBUSY; | 2936 | return -EBUSY; |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 78e1827d0a95..de8ac5c07fd0 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -1196,7 +1196,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
1196 | 1196 | ||
1197 | _snd_printd(SND_PR_VERBOSE, | 1197 | _snd_printd(SND_PR_VERBOSE, |
1198 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", | 1198 | "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", |
1199 | codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); | 1199 | codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid); |
1200 | 1200 | ||
1201 | if (eld->eld_valid) { | 1201 | if (eld->eld_valid) { |
1202 | if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer, | 1202 | if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 563c24df4d6f..f15c36bde540 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3440,7 +3440,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
3440 | const hda_nid_t *ssids; | 3440 | const hda_nid_t *ssids; |
3441 | 3441 | ||
3442 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | 3442 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
3443 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | 3443 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 || |
3444 | codec->vendor_id == 0x10ec0671) | ||
3444 | ssids = alc663_ssids; | 3445 | ssids = alc663_ssids; |
3445 | else | 3446 | else |
3446 | ssids = alc662_ssids; | 3447 | ssids = alc662_ssids; |
@@ -3894,6 +3895,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
3894 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, | 3895 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
3895 | { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, | 3896 | { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, |
3896 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, | 3897 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
3898 | { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 }, | ||
3897 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, | 3899 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
3898 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 3900 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
3899 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 3901 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index fc176044994d..fc176044994d 100755..100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h index 7e103f249053..7e103f249053 100755..100644 --- a/sound/soc/codecs/max98090.h +++ b/sound/soc/codecs/max98090.h | |||
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c index f2d61a187830..566ea3256e2d 100644 --- a/sound/soc/codecs/si476x.c +++ b/sound/soc/codecs/si476x.c | |||
@@ -159,6 +159,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream, | |||
159 | switch (params_format(params)) { | 159 | switch (params_format(params)) { |
160 | case SNDRV_PCM_FORMAT_S8: | 160 | case SNDRV_PCM_FORMAT_S8: |
161 | width = SI476X_PCM_FORMAT_S8; | 161 | width = SI476X_PCM_FORMAT_S8; |
162 | break; | ||
162 | case SNDRV_PCM_FORMAT_S16_LE: | 163 | case SNDRV_PCM_FORMAT_S16_LE: |
163 | width = SI476X_PCM_FORMAT_S16_LE; | 164 | width = SI476X_PCM_FORMAT_S16_LE; |
164 | break; | 165 | break; |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f3f7e75f8628..9af1bddc4c62 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -828,7 +828,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
828 | &buf_list); | 828 | &buf_list); |
829 | if (!buf) { | 829 | if (!buf) { |
830 | adsp_err(dsp, "Out of memory\n"); | 830 | adsp_err(dsp, "Out of memory\n"); |
831 | return -ENOMEM; | 831 | ret = -ENOMEM; |
832 | goto out_fw; | ||
832 | } | 833 | } |
833 | 834 | ||
834 | adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", | 835 | adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", |
@@ -865,7 +866,7 @@ out_fw: | |||
865 | wm_adsp_buf_free(&buf_list); | 866 | wm_adsp_buf_free(&buf_list); |
866 | out: | 867 | out: |
867 | kfree(file); | 868 | kfree(file); |
868 | return 0; | 869 | return ret; |
869 | } | 870 | } |
870 | 871 | ||
871 | int wm_adsp1_init(struct wm_adsp *adsp) | 872 | int wm_adsp1_init(struct wm_adsp *adsp) |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index 55464a5b0706..810c7eeb7b03 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97) | |||
496 | 496 | ||
497 | if (imx_ssi->ac97_reset) | 497 | if (imx_ssi->ac97_reset) |
498 | imx_ssi->ac97_reset(ac97); | 498 | imx_ssi->ac97_reset(ac97); |
499 | /* First read sometimes fails, do a dummy read */ | ||
500 | imx_ssi_ac97_read(ac97, 0); | ||
499 | } | 501 | } |
500 | 502 | ||
501 | static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) | 503 | static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) |
@@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) | |||
504 | 506 | ||
505 | if (imx_ssi->ac97_warm_reset) | 507 | if (imx_ssi->ac97_warm_reset) |
506 | imx_ssi->ac97_warm_reset(ac97); | 508 | imx_ssi->ac97_warm_reset(ac97); |
509 | |||
510 | /* First read sometimes fails, do a dummy read */ | ||
511 | imx_ssi_ac97_read(ac97, 0); | ||
507 | } | 512 | } |
508 | 513 | ||
509 | struct snd_ac97_bus_ops soc_ac97_ops = { | 514 | struct snd_ac97_bus_ops soc_ac97_ops = { |
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index 8e52c1485df3..eb4373840bb6 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -51,7 +51,7 @@ static struct snd_soc_card pcm030_card = { | |||
51 | .num_links = ARRAY_SIZE(pcm030_fabric_dai), | 51 | .num_links = ARRAY_SIZE(pcm030_fabric_dai), |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int __init pcm030_fabric_probe(struct platform_device *op) | 54 | static int pcm030_fabric_probe(struct platform_device *op) |
55 | { | 55 | { |
56 | struct device_node *np = op->dev.of_node; | 56 | struct device_node *np = op->dev.of_node; |
57 | struct device_node *platform_np; | 57 | struct device_node *platform_np; |
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index 19eff8fc4fdd..1a8b03e4b41b 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c | |||
@@ -342,8 +342,8 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
342 | return 0; | 342 | return 0; |
343 | } | 343 | } |
344 | 344 | ||
345 | static struct snd_soc_platform sh7760_soc_platform = { | 345 | static struct snd_soc_platform_driver sh7760_soc_platform = { |
346 | .pcm_ops = &camelot_pcm_ops, | 346 | .ops = &camelot_pcm_ops, |
347 | .pcm_new = camelot_pcm_new, | 347 | .pcm_new = camelot_pcm_new, |
348 | .pcm_free = camelot_pcm_free, | 348 | .pcm_free = camelot_pcm_free, |
349 | }; | 349 | }; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b7e84a7cd9ee..507d251916af 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -3140,7 +3140,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, | |||
3140 | if (params->mask) { | 3140 | if (params->mask) { |
3141 | ret = regmap_read(codec->control_data, params->base, &val); | 3141 | ret = regmap_read(codec->control_data, params->base, &val); |
3142 | if (ret != 0) | 3142 | if (ret != 0) |
3143 | return ret; | 3143 | goto out; |
3144 | 3144 | ||
3145 | val &= params->mask; | 3145 | val &= params->mask; |
3146 | 3146 | ||
@@ -3158,13 +3158,15 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, | |||
3158 | ((u32 *)data)[0] |= cpu_to_be32(val); | 3158 | ((u32 *)data)[0] |= cpu_to_be32(val); |
3159 | break; | 3159 | break; |
3160 | default: | 3160 | default: |
3161 | return -EINVAL; | 3161 | ret = -EINVAL; |
3162 | goto out; | ||
3162 | } | 3163 | } |
3163 | } | 3164 | } |
3164 | 3165 | ||
3165 | ret = regmap_raw_write(codec->control_data, params->base, | 3166 | ret = regmap_raw_write(codec->control_data, params->base, |
3166 | data, len); | 3167 | data, len); |
3167 | 3168 | ||
3169 | out: | ||
3168 | kfree(data); | 3170 | kfree(data); |
3169 | 3171 | ||
3170 | return ret; | 3172 | return ret; |
@@ -4197,7 +4199,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
4197 | dev_err(card->dev, | 4199 | dev_err(card->dev, |
4198 | "ASoC: Property '%s' index %d could not be read: %d\n", | 4200 | "ASoC: Property '%s' index %d could not be read: %d\n", |
4199 | propname, 2 * i, ret); | 4201 | propname, 2 * i, ret); |
4200 | kfree(routes); | ||
4201 | return -EINVAL; | 4202 | return -EINVAL; |
4202 | } | 4203 | } |
4203 | ret = of_property_read_string_index(np, propname, | 4204 | ret = of_property_read_string_index(np, propname, |
@@ -4206,7 +4207,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
4206 | dev_err(card->dev, | 4207 | dev_err(card->dev, |
4207 | "ASoC: Property '%s' index %d could not be read: %d\n", | 4208 | "ASoC: Property '%s' index %d could not be read: %d\n", |
4208 | propname, (2 * i) + 1, ret); | 4209 | propname, (2 * i) + 1, ret); |
4209 | kfree(routes); | ||
4210 | return -EINVAL; | 4210 | return -EINVAL; |
4211 | } | 4211 | } |
4212 | } | 4212 | } |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1d6a9b3ceb27..d6d9ba2e6916 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -831,6 +831,9 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
831 | if (path->weak) | 831 | if (path->weak) |
832 | continue; | 832 | continue; |
833 | 833 | ||
834 | if (path->walking) | ||
835 | return 1; | ||
836 | |||
834 | if (path->walked) | 837 | if (path->walked) |
835 | continue; | 838 | continue; |
836 | 839 | ||
@@ -838,6 +841,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
838 | 841 | ||
839 | if (path->sink && path->connect) { | 842 | if (path->sink && path->connect) { |
840 | path->walked = 1; | 843 | path->walked = 1; |
844 | path->walking = 1; | ||
841 | 845 | ||
842 | /* do we need to add this widget to the list ? */ | 846 | /* do we need to add this widget to the list ? */ |
843 | if (list) { | 847 | if (list) { |
@@ -847,11 +851,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
847 | dev_err(widget->dapm->dev, | 851 | dev_err(widget->dapm->dev, |
848 | "ASoC: could not add widget %s\n", | 852 | "ASoC: could not add widget %s\n", |
849 | widget->name); | 853 | widget->name); |
854 | path->walking = 0; | ||
850 | return con; | 855 | return con; |
851 | } | 856 | } |
852 | } | 857 | } |
853 | 858 | ||
854 | con += is_connected_output_ep(path->sink, list); | 859 | con += is_connected_output_ep(path->sink, list); |
860 | |||
861 | path->walking = 0; | ||
855 | } | 862 | } |
856 | } | 863 | } |
857 | 864 | ||
@@ -931,6 +938,9 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
931 | if (path->weak) | 938 | if (path->weak) |
932 | continue; | 939 | continue; |
933 | 940 | ||
941 | if (path->walking) | ||
942 | return 1; | ||
943 | |||
934 | if (path->walked) | 944 | if (path->walked) |
935 | continue; | 945 | continue; |
936 | 946 | ||
@@ -938,6 +948,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
938 | 948 | ||
939 | if (path->source && path->connect) { | 949 | if (path->source && path->connect) { |
940 | path->walked = 1; | 950 | path->walked = 1; |
951 | path->walking = 1; | ||
941 | 952 | ||
942 | /* do we need to add this widget to the list ? */ | 953 | /* do we need to add this widget to the list ? */ |
943 | if (list) { | 954 | if (list) { |
@@ -947,11 +958,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
947 | dev_err(widget->dapm->dev, | 958 | dev_err(widget->dapm->dev, |
948 | "ASoC: could not add widget %s\n", | 959 | "ASoC: could not add widget %s\n", |
949 | widget->name); | 960 | widget->name); |
961 | path->walking = 0; | ||
950 | return con; | 962 | return con; |
951 | } | 963 | } |
952 | } | 964 | } |
953 | 965 | ||
954 | con += is_connected_input_ep(path->source, list); | 966 | con += is_connected_input_ep(path->source, list); |
967 | |||
968 | path->walking = 0; | ||
955 | } | 969 | } |
956 | } | 970 | } |
957 | 971 | ||
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 9b76cc5a1148..5e7aebe1e664 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm) | |||
149 | 149 | ||
150 | static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); | 150 | static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); |
151 | 151 | ||
152 | static int spear_pcm_new(struct snd_card *card, | 152 | static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd) |
153 | struct snd_soc_dai *dai, struct snd_pcm *pcm) | ||
154 | { | 153 | { |
154 | struct snd_card *card = rtd->card->snd_card; | ||
155 | int ret; | 155 | int ret; |
156 | 156 | ||
157 | if (!card->dev->dma_mask) | 157 | if (!card->dev->dma_mask) |
@@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card, | |||
159 | if (!card->dev->coherent_dma_mask) | 159 | if (!card->dev->coherent_dma_mask) |
160 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); | 160 | card->dev->coherent_dma_mask = DMA_BIT_MASK(32); |
161 | 161 | ||
162 | if (dai->driver->playback.channels_min) { | 162 | if (rtd->cpu_dai->driver->playback.channels_min) { |
163 | ret = spear_pcm_preallocate_dma_buffer(pcm, | 163 | ret = spear_pcm_preallocate_dma_buffer(rtd->pcm, |
164 | SNDRV_PCM_STREAM_PLAYBACK, | 164 | SNDRV_PCM_STREAM_PLAYBACK, |
165 | spear_pcm_hardware.buffer_bytes_max); | 165 | spear_pcm_hardware.buffer_bytes_max); |
166 | if (ret) | 166 | if (ret) |
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | 169 | ||
170 | if (dai->driver->capture.channels_min) { | 170 | if (rtd->cpu_dai->driver->capture.channels_min) { |
171 | ret = spear_pcm_preallocate_dma_buffer(pcm, | 171 | ret = spear_pcm_preallocate_dma_buffer(rtd->pcm, |
172 | SNDRV_PCM_STREAM_CAPTURE, | 172 | SNDRV_PCM_STREAM_CAPTURE, |
173 | spear_pcm_hardware.buffer_bytes_max); | 173 | spear_pcm_hardware.buffer_bytes_max); |
174 | if (ret) | 174 | if (ret) |
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 5e634a2eb282..9e2703a25156 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c | |||
@@ -253,7 +253,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, | |||
253 | { | 253 | { |
254 | struct usb_device *dev = chip->dev; | 254 | struct usb_device *dev = chip->dev; |
255 | unsigned char data[4]; | 255 | unsigned char data[4]; |
256 | int err, crate; | 256 | int err, cur_rate, prev_rate; |
257 | int clock = snd_usb_clock_find_source(chip, fmt->clock); | 257 | int clock = snd_usb_clock_find_source(chip, fmt->clock); |
258 | 258 | ||
259 | if (clock < 0) | 259 | if (clock < 0) |
@@ -266,6 +266,19 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, | |||
266 | return -ENXIO; | 266 | return -ENXIO; |
267 | } | 267 | } |
268 | 268 | ||
269 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, | ||
270 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | ||
271 | UAC2_CS_CONTROL_SAM_FREQ << 8, | ||
272 | snd_usb_ctrl_intf(chip) | (clock << 8), | ||
273 | data, sizeof(data)); | ||
274 | if (err < 0) { | ||
275 | snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", | ||
276 | dev->devnum, iface, fmt->altsetting); | ||
277 | prev_rate = 0; | ||
278 | } else { | ||
279 | prev_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); | ||
280 | } | ||
281 | |||
269 | data[0] = rate; | 282 | data[0] = rate; |
270 | data[1] = rate >> 8; | 283 | data[1] = rate >> 8; |
271 | data[2] = rate >> 16; | 284 | data[2] = rate >> 16; |
@@ -280,19 +293,31 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface, | |||
280 | return err; | 293 | return err; |
281 | } | 294 | } |
282 | 295 | ||
283 | if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, | 296 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, |
284 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 297 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, |
285 | UAC2_CS_CONTROL_SAM_FREQ << 8, | 298 | UAC2_CS_CONTROL_SAM_FREQ << 8, |
286 | snd_usb_ctrl_intf(chip) | (clock << 8), | 299 | snd_usb_ctrl_intf(chip) | (clock << 8), |
287 | data, sizeof(data))) < 0) { | 300 | data, sizeof(data)); |
301 | if (err < 0) { | ||
288 | snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", | 302 | snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", |
289 | dev->devnum, iface, fmt->altsetting); | 303 | dev->devnum, iface, fmt->altsetting); |
290 | return err; | 304 | cur_rate = 0; |
305 | } else { | ||
306 | cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); | ||
291 | } | 307 | } |
292 | 308 | ||
293 | crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); | 309 | if (cur_rate != rate) { |
294 | if (crate != rate) | 310 | snd_printd(KERN_WARNING |
295 | snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); | 311 | "current rate %d is different from the runtime rate %d\n", |
312 | cur_rate, rate); | ||
313 | } | ||
314 | |||
315 | /* Some devices doesn't respond to sample rate changes while the | ||
316 | * interface is active. */ | ||
317 | if (rate != prev_rate) { | ||
318 | usb_set_interface(dev, iface, 0); | ||
319 | usb_set_interface(dev, iface, fmt->altsetting); | ||
320 | } | ||
296 | 321 | ||
297 | return 0; | 322 | return 0; |
298 | } | 323 | } |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index adc68feb5c5a..f18013f09e68 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1541,21 +1541,38 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, | |||
1541 | } | 1541 | } |
1542 | 1542 | ||
1543 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 1543 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
1544 | gpa_t gpa) | 1544 | gpa_t gpa, unsigned long len) |
1545 | { | 1545 | { |
1546 | struct kvm_memslots *slots = kvm_memslots(kvm); | 1546 | struct kvm_memslots *slots = kvm_memslots(kvm); |
1547 | int offset = offset_in_page(gpa); | 1547 | int offset = offset_in_page(gpa); |
1548 | gfn_t gfn = gpa >> PAGE_SHIFT; | 1548 | gfn_t start_gfn = gpa >> PAGE_SHIFT; |
1549 | gfn_t end_gfn = (gpa + len - 1) >> PAGE_SHIFT; | ||
1550 | gfn_t nr_pages_needed = end_gfn - start_gfn + 1; | ||
1551 | gfn_t nr_pages_avail; | ||
1549 | 1552 | ||
1550 | ghc->gpa = gpa; | 1553 | ghc->gpa = gpa; |
1551 | ghc->generation = slots->generation; | 1554 | ghc->generation = slots->generation; |
1552 | ghc->memslot = gfn_to_memslot(kvm, gfn); | 1555 | ghc->len = len; |
1553 | ghc->hva = gfn_to_hva_many(ghc->memslot, gfn, NULL); | 1556 | ghc->memslot = gfn_to_memslot(kvm, start_gfn); |
1554 | if (!kvm_is_error_hva(ghc->hva)) | 1557 | ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail); |
1558 | if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) { | ||
1555 | ghc->hva += offset; | 1559 | ghc->hva += offset; |
1556 | else | 1560 | } else { |
1557 | return -EFAULT; | 1561 | /* |
1558 | 1562 | * If the requested region crosses two memslots, we still | |
1563 | * verify that the entire region is valid here. | ||
1564 | */ | ||
1565 | while (start_gfn <= end_gfn) { | ||
1566 | ghc->memslot = gfn_to_memslot(kvm, start_gfn); | ||
1567 | ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, | ||
1568 | &nr_pages_avail); | ||
1569 | if (kvm_is_error_hva(ghc->hva)) | ||
1570 | return -EFAULT; | ||
1571 | start_gfn += nr_pages_avail; | ||
1572 | } | ||
1573 | /* Use the slow path for cross page reads and writes. */ | ||
1574 | ghc->memslot = NULL; | ||
1575 | } | ||
1559 | return 0; | 1576 | return 0; |
1560 | } | 1577 | } |
1561 | EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init); | 1578 | EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init); |
@@ -1566,8 +1583,13 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | |||
1566 | struct kvm_memslots *slots = kvm_memslots(kvm); | 1583 | struct kvm_memslots *slots = kvm_memslots(kvm); |
1567 | int r; | 1584 | int r; |
1568 | 1585 | ||
1586 | BUG_ON(len > ghc->len); | ||
1587 | |||
1569 | if (slots->generation != ghc->generation) | 1588 | if (slots->generation != ghc->generation) |
1570 | kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); | 1589 | kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); |
1590 | |||
1591 | if (unlikely(!ghc->memslot)) | ||
1592 | return kvm_write_guest(kvm, ghc->gpa, data, len); | ||
1571 | 1593 | ||
1572 | if (kvm_is_error_hva(ghc->hva)) | 1594 | if (kvm_is_error_hva(ghc->hva)) |
1573 | return -EFAULT; | 1595 | return -EFAULT; |
@@ -1587,8 +1609,13 @@ int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | |||
1587 | struct kvm_memslots *slots = kvm_memslots(kvm); | 1609 | struct kvm_memslots *slots = kvm_memslots(kvm); |
1588 | int r; | 1610 | int r; |
1589 | 1611 | ||
1612 | BUG_ON(len > ghc->len); | ||
1613 | |||
1590 | if (slots->generation != ghc->generation) | 1614 | if (slots->generation != ghc->generation) |
1591 | kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa); | 1615 | kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len); |
1616 | |||
1617 | if (unlikely(!ghc->memslot)) | ||
1618 | return kvm_read_guest(kvm, ghc->gpa, data, len); | ||
1592 | 1619 | ||
1593 | if (kvm_is_error_hva(ghc->hva)) | 1620 | if (kvm_is_error_hva(ghc->hva)) |
1594 | return -EFAULT; | 1621 | return -EFAULT; |