diff options
author | Olof Johansson <olof@lixom.net> | 2014-01-04 00:09:51 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2014-01-04 00:09:51 -0500 |
commit | 11b35a352521b740944455b45dbee190e9c893a4 (patch) | |
tree | aa5bc9a24cb6290aaed5476990f0e5a05442ff38 | |
parent | 5631e7f4e29b1ebf3d856614c0b5876463857da6 (diff) | |
parent | b652896b02df3dfde3a68957cce01f2aa4585842 (diff) |
Merge tag 'renesas-dt3-for-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/dt
From Simon Horman:
Third Round of Renesas ARM Based SoC DT Updates for v3.14
* r8a7791 (R-Car M2) and r8a7790 (R-Car H2) SoCSs
- Add SSI, QSPI and MSIOF clocks in device tree
r8a7791 (R-Car M2) based Koelsch and r8a7790 (R-Car H2) based Lager boards
- Remove reference DTS
- Specify external clock frequency in DT
- Sync non-reference DTS with referene DTS
- Add clocks to DTS
* r8a7740 (R-Mobile A1) based Armadillo board
- Add gpio-keys device
- Add PWM backlight enable GPIO
- Add PWM backlight power supply
* r8a73a0 (SH-Mobile AG5), r8a7740 (R-Mobile A1) and
r8a73a4 (SH-Mobile APE6) SoCs
- Specify PFC interrupts in DT
* tag 'renesas-dt3-for-v3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: (72 commits)
ARM: shmobile: r8a7791: Add SSI clocks in device tree
ARM: shmobile: r8a7790: Add SSI clocks in device tree
ARM: shmobile: r8a7791: Add QSPI module clock in device tree
ARM: shmobile: r8a7790: Add QSPI module clock in device tree
ARM: shmobile: r8a7791: Add MSIOF clocks in device tree
ARM: shmobile: r8a7790: Add MSIOF clocks in device tree
ARM: shmobile: Remove Koelsch reference DTS
ARM: shmobile: Remove Lager reference DTS
ARM: shmobile: koelsch: Specify external clock frequency in DT
ARM: shmobile: lager: Specify external clock frequency in DT
ARM: shmobile: Sync Koelsch DTS with Koelsch reference DTS
ARM: shmobile: Sync Lager DTS with Lager reference DTS
ARM: shmobile: r8a7791: Add clocks
ARM: shmobile: r8a7790: Reference clocks
ARM: shmobile: r8a7790: Add clocks
ARM: shmobile: armadillo: dts: Add gpio-keys device
ARM: shmobile: sh73a0: Specify PFC interrupts in DT
ARM: shmobile: r8a7740: Specify PFC interrupts in DT
ARM: shmobile: r8a73a4: Specify PFC interrupts in DT
ARM: shmobile: armadillo: dts: Add PWM backlight enable GPIO
...
Signed-off-by: Olof Johansson <olof@lixom.net>
59 files changed, 5356 insertions, 331 deletions
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt new file mode 100644 index 000000000000..952e373178d2 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | * Renesas CPG DIV6 Clock | ||
2 | |||
3 | The CPG DIV6 clocks are variable factor clocks provided by the Clock Pulse | ||
4 | Generator (CPG). They clock input is divided by a configurable factor from 1 | ||
5 | to 64. | ||
6 | |||
7 | Required Properties: | ||
8 | |||
9 | - compatible: Must be one of the following | ||
10 | - "renesas,r8a7790-div6-clock" for R8A7790 (R-Car H2) DIV6 clocks | ||
11 | - "renesas,r8a7791-div6-clock" for R8A7791 (R-Car M2) DIV6 clocks | ||
12 | - "renesas,cpg-div6-clock" for generic DIV6 clocks | ||
13 | - reg: Base address and length of the memory resource used by the DIV6 clock | ||
14 | - clocks: Reference to the parent clock | ||
15 | - #clock-cells: Must be 0 | ||
16 | - clock-output-names: The name of the clock as a free-form string | ||
17 | |||
18 | |||
19 | Example | ||
20 | ------- | ||
21 | |||
22 | sd2_clk: sd2_clk@e6150078 { | ||
23 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
24 | reg = <0 0xe6150078 0 4>; | ||
25 | clocks = <&pll1_div2_clk>; | ||
26 | #clock-cells = <0>; | ||
27 | clock-output-names = "sd2"; | ||
28 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt new file mode 100644 index 000000000000..a6a352c2771e --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt | |||
@@ -0,0 +1,51 @@ | |||
1 | * Renesas CPG Module Stop (MSTP) Clocks | ||
2 | |||
3 | The CPG can gate SoC device clocks. The gates are organized in groups of up to | ||
4 | 32 gates. | ||
5 | |||
6 | This device tree binding describes a single 32 gate clocks group per node. | ||
7 | Clocks are referenced by user nodes by the MSTP node phandle and the clock | ||
8 | index in the group, from 0 to 31. | ||
9 | |||
10 | Required Properties: | ||
11 | |||
12 | - compatible: Must be one of the following | ||
13 | - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks | ||
14 | - "renesas,r8a7791-mstp-clocks" for R8A7791 (R-Car M2) MSTP gate clocks | ||
15 | - "renesas,cpg-mstp-clock" for generic MSTP gate clocks | ||
16 | - reg: Base address and length of the I/O mapped registers used by the MSTP | ||
17 | clocks. The first register is the clock control register and is mandatory. | ||
18 | The second register is the clock status register and is optional when not | ||
19 | implemented in hardware. | ||
20 | - clocks: Reference to the parent clocks, one per output clock. The parents | ||
21 | must appear in the same order as the output clocks. | ||
22 | - #clock-cells: Must be 1 | ||
23 | - clock-output-names: The name of the clocks as free-form strings | ||
24 | - renesas,indices: Indices of the gate clocks into the group (0 to 31) | ||
25 | |||
26 | The clocks, clock-output-names and renesas,indices properties contain one | ||
27 | entry per gate clock. The MSTP groups are sparsely populated. Unimplemented | ||
28 | gate clocks must not be declared. | ||
29 | |||
30 | |||
31 | Example | ||
32 | ------- | ||
33 | |||
34 | #include <dt-bindings/clock/r8a7790-clock.h> | ||
35 | |||
36 | mstp3_clks: mstp3_clks@e615013c { | ||
37 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
38 | reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; | ||
39 | clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>, | ||
40 | <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, | ||
41 | <&mmc0_clk>; | ||
42 | #clock-cells = <1>; | ||
43 | clock-output-names = | ||
44 | "tpu0", "mmcif1", "sdhi3", "sdhi2", | ||
45 | "sdhi1", "sdhi0", "mmcif0"; | ||
46 | renesas,clock-indices = < | ||
47 | R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3 | ||
48 | R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 | ||
49 | R8A7790_CLK_MMCIF0 | ||
50 | >; | ||
51 | }; | ||
diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt new file mode 100644 index 000000000000..7b41c2fe54db --- /dev/null +++ b/Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | * Renesas R-Car Gen2 Clock Pulse Generator (CPG) | ||
2 | |||
3 | The CPG generates core clocks for the R-Car Gen2 SoCs. It includes three PLLs | ||
4 | and several fixed ratio dividers. | ||
5 | |||
6 | Required Properties: | ||
7 | |||
8 | - compatible: Must be one of | ||
9 | - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG | ||
10 | - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG | ||
11 | - "renesas,rcar-gen2-cpg-clocks" for the generic R-Car Gen2 CPG | ||
12 | |||
13 | - reg: Base address and length of the memory resource used by the CPG | ||
14 | |||
15 | - clocks: Reference to the parent clock | ||
16 | - #clock-cells: Must be 1 | ||
17 | - clock-output-names: The names of the clocks. Supported clocks are "main", | ||
18 | "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0", "sd1" and "z" | ||
19 | |||
20 | |||
21 | Example | ||
22 | ------- | ||
23 | |||
24 | cpg_clocks: cpg_clocks@e6150000 { | ||
25 | compatible = "renesas,r8a7790-cpg-clocks", | ||
26 | "renesas,rcar-gen2-cpg-clocks"; | ||
27 | reg = <0 0xe6150000 0 0x1000>; | ||
28 | clocks = <&extal_clk>; | ||
29 | #clock-cells = <1>; | ||
30 | clock-output-names = "main", "pll0, "pll1", "pll3", | ||
31 | "lb", "qspi", "sdh", "sd0", "sd1", "z"; | ||
32 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx25-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx25-pinctrl.txt new file mode 100644 index 000000000000..fd653bde18d5 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx25-pinctrl.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | * Freescale IMX25 IOMUX Controller | ||
2 | |||
3 | Please refer to fsl,imx-pinctrl.txt in this directory for common binding part | ||
4 | and usage. | ||
5 | |||
6 | CONFIG bits definition: | ||
7 | PAD_CTL_HYS (1 << 8) | ||
8 | PAD_CTL_PKE (1 << 7) | ||
9 | PAD_CTL_PUE (1 << 6) | ||
10 | PAD_CTL_PUS_100K_DOWN (0 << 4) | ||
11 | PAD_CTL_PUS_47K_UP (1 << 4) | ||
12 | PAD_CTL_PUS_100K_UP (2 << 4) | ||
13 | PAD_CTL_PUS_22K_UP (3 << 4) | ||
14 | PAD_CTL_ODE_CMOS (0 << 3) | ||
15 | PAD_CTL_ODE_OPENDRAIN (1 << 3) | ||
16 | PAD_CTL_DSE_NOMINAL (0 << 1) | ||
17 | PAD_CTL_DSE_HIGH (1 << 1) | ||
18 | PAD_CTL_DSE_MAX (2 << 1) | ||
19 | PAD_CTL_SRE_FAST (1 << 0) | ||
20 | PAD_CTL_SRE_SLOW (0 << 0) | ||
21 | |||
22 | Refer to imx25-pinfunc.h in device tree source folder for all available | ||
23 | imx25 PIN_FUNC_ID. | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt index 353eca0efbf8..d1706ea82572 100644 --- a/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx27-pinctrl.txt | |||
@@ -52,12 +52,25 @@ Required properties for pin configuration node: | |||
52 | CONFIG can be 0 or 1, meaning Pullup disable/enable. | 52 | CONFIG can be 0 or 1, meaning Pullup disable/enable. |
53 | 53 | ||
54 | 54 | ||
55 | The iomux controller has gpio child nodes which are embedded in the iomux | ||
56 | control registers. They have to be defined as child nodes of the iomux device | ||
57 | node. If gpio subnodes are defined "#address-cells", "#size-cells" and "ranges" | ||
58 | properties for the iomux device node are required. | ||
55 | 59 | ||
56 | Example: | 60 | Example: |
57 | 61 | ||
58 | iomuxc: iomuxc@10015000 { | 62 | iomuxc: iomuxc@10015000 { |
59 | compatible = "fsl,imx27-iomuxc"; | 63 | compatible = "fsl,imx27-iomuxc"; |
60 | reg = <0x10015000 0x600>; | 64 | reg = <0x10015000 0x600>; |
65 | #address-cells = <1>; | ||
66 | #size-cells = <1>; | ||
67 | ranges; | ||
68 | |||
69 | gpio1: gpio@10015000 { | ||
70 | ... | ||
71 | }; | ||
72 | |||
73 | ... | ||
61 | 74 | ||
62 | uart { | 75 | uart { |
63 | pinctrl_uart1: uart-1 { | 76 | pinctrl_uart1: uart-1 { |
@@ -83,6 +96,15 @@ The above example using macros: | |||
83 | iomuxc: iomuxc@10015000 { | 96 | iomuxc: iomuxc@10015000 { |
84 | compatible = "fsl,imx27-iomuxc"; | 97 | compatible = "fsl,imx27-iomuxc"; |
85 | reg = <0x10015000 0x600>; | 98 | reg = <0x10015000 0x600>; |
99 | #address-cells = <1>; | ||
100 | #size-cells = <1>; | ||
101 | ranges; | ||
102 | |||
103 | gpio1: gpio@10015000 { | ||
104 | ... | ||
105 | }; | ||
106 | |||
107 | ... | ||
86 | 108 | ||
87 | uart { | 109 | uart { |
88 | pinctrl_uart1: uart-1 { | 110 | pinctrl_uart1: uart-1 { |
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8x74-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8x74-pinctrl.txt new file mode 100644 index 000000000000..70ab78fe93c8 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8x74-pinctrl.txt | |||
@@ -0,0 +1,92 @@ | |||
1 | Qualcomm MSM8x74 TLMM block | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: "qcom,msm8x74-pinctrl" | ||
5 | - reg: Should be the base address and length of the TLMM block. | ||
6 | - interrupts: Should be the parent IRQ of the TLMM block. | ||
7 | - interrupt-controller: Marks the device node as an interrupt controller. | ||
8 | - #interrupt-cells: Should be two. | ||
9 | - gpio-controller: Marks the device node as a GPIO controller. | ||
10 | - #gpio-cells : Should be two. | ||
11 | The first cell is the gpio pin number and the | ||
12 | second cell is used for optional parameters. | ||
13 | |||
14 | Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for | ||
15 | a general description of GPIO and interrupt bindings. | ||
16 | |||
17 | Please refer to pinctrl-bindings.txt in this directory for details of the | ||
18 | common pinctrl bindings used by client devices, including the meaning of the | ||
19 | phrase "pin configuration node". | ||
20 | |||
21 | Qualcomm's pin configuration nodes act as a container for an abitrary number of | ||
22 | subnodes. Each of these subnodes represents some desired configuration for a | ||
23 | pin, a group, or a list of pins or groups. This configuration can include the | ||
24 | mux function to select on those pin(s)/group(s), and various pin configuration | ||
25 | parameters, such as pull-up, drive strength, etc. | ||
26 | |||
27 | The name of each subnode is not important; all subnodes should be enumerated | ||
28 | and processed purely based on their content. | ||
29 | |||
30 | Each subnode only affects those parameters that are explicitly listed. In | ||
31 | other words, a subnode that lists a mux function but no pin configuration | ||
32 | parameters implies no information about any pin configuration parameters. | ||
33 | Similarly, a pin subnode that describes a pullup parameter implies no | ||
34 | information about e.g. the mux function. | ||
35 | |||
36 | |||
37 | The following generic properties as defined in pinctrl-bindings.txt are valid | ||
38 | to specify in a pin configuration subnode: | ||
39 | pins, function, bias-disable, bias-pull-down, bias-pull,up, drive-strength. | ||
40 | |||
41 | Non-empty subnodes must specify the 'pins' property. | ||
42 | Note that not all properties are valid for all pins. | ||
43 | |||
44 | |||
45 | Valid values for qcom,pins are: | ||
46 | gpio0-gpio145 | ||
47 | Supports mux, bias and drive-strength | ||
48 | |||
49 | sdc1_clk, sdc1_cmd, sdc1_data, sdc2_clk, sdc2_cmd, sdc2_data | ||
50 | Supports bias and drive-strength | ||
51 | |||
52 | Valid values for qcom,function are: | ||
53 | blsp_i2c2, blsp_i2c6, blsp_i2c11, blsp_spi1, blsp_uart2, blsp_uart8, slimbus | ||
54 | |||
55 | (Note that this is not yet the complete list of functions) | ||
56 | |||
57 | |||
58 | |||
59 | Example: | ||
60 | |||
61 | msmgpio: pinctrl@fd510000 { | ||
62 | compatible = "qcom,msm8x74-pinctrl"; | ||
63 | reg = <0xfd510000 0x4000>; | ||
64 | |||
65 | gpio-controller; | ||
66 | #gpio-cells = <2>; | ||
67 | interrupt-controller; | ||
68 | #interrupt-cells = <2>; | ||
69 | interrupts = <0 208 0>; | ||
70 | |||
71 | pinctrl-names = "default"; | ||
72 | pinctrl-0 = <&uart2_default>; | ||
73 | |||
74 | uart2_default: uart2_default { | ||
75 | mux { | ||
76 | qcom,pins = "gpio4", "gpio5"; | ||
77 | qcom,function = "blsp_uart2"; | ||
78 | }; | ||
79 | |||
80 | tx { | ||
81 | qcom,pins = "gpio4"; | ||
82 | drive-strength = <4>; | ||
83 | bias-disable; | ||
84 | }; | ||
85 | |||
86 | rx { | ||
87 | qcom,pins = "gpio5"; | ||
88 | drive-strength = <2>; | ||
89 | bias-pull-up; | ||
90 | }; | ||
91 | }; | ||
92 | }; | ||
diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt index d5dac7b843a9..35d2e1f186f0 100644 --- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt | |||
@@ -26,6 +26,11 @@ Optional properties: | |||
26 | - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO, forbidden | 26 | - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO, forbidden |
27 | otherwise. Should be 3. | 27 | otherwise. Should be 3. |
28 | 28 | ||
29 | - interrupts-extended: Specify the interrupts associated with external | ||
30 | IRQ pins. This property is mandatory when the PFC handles GPIOs and | ||
31 | forbidden otherwise. When specified, it must contain one interrupt per | ||
32 | external IRQ, sorted by external IRQ number. | ||
33 | |||
29 | The PFC node also acts as a container for pin configuration nodes. Please refer | 34 | The PFC node also acts as a container for pin configuration nodes. Please refer |
30 | to pinctrl-bindings.txt in this directory for the definition of the term "pin | 35 | to pinctrl-bindings.txt in this directory for the definition of the term "pin |
31 | configuration node" and for the common pinctrl bindings used by client devices. | 36 | configuration node" and for the common pinctrl bindings used by client devices. |
@@ -103,6 +108,15 @@ Example 1: SH73A0 (SH-Mobile AG5) pin controller node | |||
103 | <0xe605801c 0x1c>; | 108 | <0xe605801c 0x1c>; |
104 | gpio-controller; | 109 | gpio-controller; |
105 | #gpio-cells = <2>; | 110 | #gpio-cells = <2>; |
111 | interrupts-extended = | ||
112 | <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, | ||
113 | <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>, | ||
114 | <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>, | ||
115 | <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>, | ||
116 | <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>, | ||
117 | <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>, | ||
118 | <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>, | ||
119 | <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>; | ||
106 | }; | 120 | }; |
107 | 121 | ||
108 | Example 2: A GPIO LED node that references a GPIO | 122 | Example 2: A GPIO LED node that references a GPIO |
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index e7d3444caed8..4f93eefb4c29 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
@@ -232,7 +232,6 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += emev2-kzm9d.dtb \ | |||
232 | r8a7779-marzen.dtb \ | 232 | r8a7779-marzen.dtb \ |
233 | r8a7779-marzen-reference.dtb \ | 233 | r8a7779-marzen-reference.dtb \ |
234 | r8a7791-koelsch.dtb \ | 234 | r8a7791-koelsch.dtb \ |
235 | r8a7791-koelsch-reference.dtb \ | ||
236 | r8a7790-lager.dtb \ | 235 | r8a7790-lager.dtb \ |
237 | r8a7790-lager-reference.dtb \ | 236 | r8a7790-lager-reference.dtb \ |
238 | sh73a0-kzm9g.dtb \ | 237 | sh73a0-kzm9g.dtb \ |
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi index 6b7ce89a68f7..62d0211bd192 100644 --- a/arch/arm/boot/dts/r8a73a4.dtsi +++ b/arch/arm/boot/dts/r8a73a4.dtsi | |||
@@ -288,6 +288,22 @@ | |||
288 | reg = <0 0xe6050000 0 0x9000>; | 288 | reg = <0 0xe6050000 0 0x9000>; |
289 | gpio-controller; | 289 | gpio-controller; |
290 | #gpio-cells = <2>; | 290 | #gpio-cells = <2>; |
291 | interrupts-extended = | ||
292 | <&irqc0 0 0>, <&irqc0 1 0>, <&irqc0 2 0>, <&irqc0 3 0>, | ||
293 | <&irqc0 4 0>, <&irqc0 5 0>, <&irqc0 6 0>, <&irqc0 7 0>, | ||
294 | <&irqc0 8 0>, <&irqc0 9 0>, <&irqc0 10 0>, <&irqc0 11 0>, | ||
295 | <&irqc0 12 0>, <&irqc0 13 0>, <&irqc0 14 0>, <&irqc0 15 0>, | ||
296 | <&irqc0 16 0>, <&irqc0 17 0>, <&irqc0 18 0>, <&irqc0 19 0>, | ||
297 | <&irqc0 20 0>, <&irqc0 21 0>, <&irqc0 22 0>, <&irqc0 23 0>, | ||
298 | <&irqc0 24 0>, <&irqc0 25 0>, <&irqc0 26 0>, <&irqc0 27 0>, | ||
299 | <&irqc0 28 0>, <&irqc0 29 0>, <&irqc0 30 0>, <&irqc0 31 0>, | ||
300 | <&irqc1 0 0>, <&irqc1 1 0>, <&irqc1 2 0>, <&irqc1 3 0>, | ||
301 | <&irqc1 4 0>, <&irqc1 5 0>, <&irqc1 6 0>, <&irqc1 7 0>, | ||
302 | <&irqc1 8 0>, <&irqc1 9 0>, <&irqc1 10 0>, <&irqc1 11 0>, | ||
303 | <&irqc1 12 0>, <&irqc1 13 0>, <&irqc1 14 0>, <&irqc1 15 0>, | ||
304 | <&irqc1 16 0>, <&irqc1 17 0>, <&irqc1 18 0>, <&irqc1 19 0>, | ||
305 | <&irqc1 20 0>, <&irqc1 21 0>, <&irqc1 22 0>, <&irqc1 23 0>, | ||
306 | <&irqc1 24 0>, <&irqc1 25 0>; | ||
291 | }; | 307 | }; |
292 | 308 | ||
293 | sdhi0: sd@ee100000 { | 309 | sdhi0: sd@ee100000 { |
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts index 6d6fd3dff2d3..95a849bf921f 100644 --- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | |||
@@ -63,6 +63,44 @@ | |||
63 | enable-active-high; | 63 | enable-active-high; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | reg_5p0v: regulator@3 { | ||
67 | compatible = "regulator-fixed"; | ||
68 | regulator-name = "fixed-5.0V"; | ||
69 | regulator-min-microvolt = <5000000>; | ||
70 | regulator-max-microvolt = <5000000>; | ||
71 | regulator-always-on; | ||
72 | regulator-boot-on; | ||
73 | }; | ||
74 | |||
75 | gpio-keys { | ||
76 | compatible = "gpio-keys"; | ||
77 | |||
78 | power-key { | ||
79 | gpios = <&pfc 99 GPIO_ACTIVE_LOW>; | ||
80 | linux,code = <116>; | ||
81 | label = "SW3"; | ||
82 | gpio-key,wakeup; | ||
83 | }; | ||
84 | |||
85 | back-key { | ||
86 | gpios = <&pfc 100 GPIO_ACTIVE_LOW>; | ||
87 | linux,code = <158>; | ||
88 | label = "SW4"; | ||
89 | }; | ||
90 | |||
91 | menu-key { | ||
92 | gpios = <&pfc 97 GPIO_ACTIVE_LOW>; | ||
93 | linux,code = <139>; | ||
94 | label = "SW5"; | ||
95 | }; | ||
96 | |||
97 | home-key { | ||
98 | gpios = <&pfc 98 GPIO_ACTIVE_LOW>; | ||
99 | linux,code = <102>; | ||
100 | label = "SW6"; | ||
101 | }; | ||
102 | }; | ||
103 | |||
66 | leds { | 104 | leds { |
67 | compatible = "gpio-leds"; | 105 | compatible = "gpio-leds"; |
68 | led1 { | 106 | led1 { |
@@ -86,6 +124,8 @@ | |||
86 | default-brightness-level = <9>; | 124 | default-brightness-level = <9>; |
87 | pinctrl-0 = <&backlight_pins>; | 125 | pinctrl-0 = <&backlight_pins>; |
88 | pinctrl-names = "default"; | 126 | pinctrl-names = "default"; |
127 | power-supply = <®_5p0v>; | ||
128 | enable-gpios = <&pfc 61 GPIO_ACTIVE_HIGH>; | ||
89 | }; | 129 | }; |
90 | 130 | ||
91 | sound { | 131 | sound { |
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi index 2782f642acfc..8280884bfa59 100644 --- a/arch/arm/boot/dts/r8a7740.dtsi +++ b/arch/arm/boot/dts/r8a7740.dtsi | |||
@@ -155,6 +155,15 @@ | |||
155 | <0xe605800c 0x20>; | 155 | <0xe605800c 0x20>; |
156 | gpio-controller; | 156 | gpio-controller; |
157 | #gpio-cells = <2>; | 157 | #gpio-cells = <2>; |
158 | interrupts-extended = | ||
159 | <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, | ||
160 | <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>, | ||
161 | <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>, | ||
162 | <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>, | ||
163 | <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>, | ||
164 | <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>, | ||
165 | <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>, | ||
166 | <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>; | ||
158 | }; | 167 | }; |
159 | 168 | ||
160 | tpu: pwm@e6600000 { | 169 | tpu: pwm@e6600000 { |
diff --git a/arch/arm/boot/dts/r8a7790-lager-reference.dts b/arch/arm/boot/dts/r8a7790-lager-reference.dts deleted file mode 100644 index dfedc0ea82e1..000000000000 --- a/arch/arm/boot/dts/r8a7790-lager-reference.dts +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* | ||
2 | * Device Tree Source for the Lager board | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | |||
11 | /dts-v1/; | ||
12 | #include "r8a7790.dtsi" | ||
13 | #include <dt-bindings/gpio/gpio.h> | ||
14 | |||
15 | / { | ||
16 | model = "Lager"; | ||
17 | compatible = "renesas,lager-reference", "renesas,r8a7790"; | ||
18 | |||
19 | chosen { | ||
20 | bootargs = "console=ttySC6,115200 ignore_loglevel rw"; | ||
21 | }; | ||
22 | |||
23 | memory@40000000 { | ||
24 | device_type = "memory"; | ||
25 | reg = <0 0x40000000 0 0x80000000>; | ||
26 | }; | ||
27 | |||
28 | memory@180000000 { | ||
29 | device_type = "memory"; | ||
30 | reg = <1 0x80000000 0 0x80000000>; | ||
31 | }; | ||
32 | |||
33 | lbsc { | ||
34 | #address-cells = <1>; | ||
35 | #size-cells = <1>; | ||
36 | }; | ||
37 | |||
38 | leds { | ||
39 | compatible = "gpio-leds"; | ||
40 | led6 { | ||
41 | gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; | ||
42 | }; | ||
43 | led7 { | ||
44 | gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>; | ||
45 | }; | ||
46 | led8 { | ||
47 | gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>; | ||
48 | }; | ||
49 | }; | ||
50 | |||
51 | fixedregulator3v3: fixedregulator@0 { | ||
52 | compatible = "regulator-fixed"; | ||
53 | regulator-name = "fixed-3.3V"; | ||
54 | regulator-min-microvolt = <3300000>; | ||
55 | regulator-max-microvolt = <3300000>; | ||
56 | regulator-boot-on; | ||
57 | regulator-always-on; | ||
58 | }; | ||
59 | }; | ||
60 | |||
61 | &pfc { | ||
62 | pinctrl-0 = <&scif0_pins &scif1_pins>; | ||
63 | pinctrl-names = "default"; | ||
64 | |||
65 | scif0_pins: serial0 { | ||
66 | renesas,groups = "scif0_data"; | ||
67 | renesas,function = "scif0"; | ||
68 | }; | ||
69 | |||
70 | scif1_pins: serial1 { | ||
71 | renesas,groups = "scif1_data"; | ||
72 | renesas,function = "scif1"; | ||
73 | }; | ||
74 | |||
75 | mmc1_pins: mmc1 { | ||
76 | renesas,groups = "mmc1_data8", "mmc1_ctrl"; | ||
77 | renesas,function = "mmc1"; | ||
78 | }; | ||
79 | }; | ||
80 | |||
81 | &mmcif1 { | ||
82 | pinctrl-0 = <&mmc1_pins>; | ||
83 | pinctrl-names = "default"; | ||
84 | |||
85 | vmmc-supply = <&fixedregulator3v3>; | ||
86 | bus-width = <8>; | ||
87 | non-removable; | ||
88 | status = "okay"; | ||
89 | }; | ||
diff --git a/arch/arm/boot/dts/r8a7790-lager.dts b/arch/arm/boot/dts/r8a7790-lager.dts index 10e6a08164e5..57569cba1528 100644 --- a/arch/arm/boot/dts/r8a7790-lager.dts +++ b/arch/arm/boot/dts/r8a7790-lager.dts | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | /dts-v1/; | 11 | /dts-v1/; |
12 | #include "r8a7790.dtsi" | 12 | #include "r8a7790.dtsi" |
13 | #include <dt-bindings/gpio/gpio.h> | ||
13 | 14 | ||
14 | / { | 15 | / { |
15 | model = "Lager"; | 16 | model = "Lager"; |
@@ -33,4 +34,60 @@ | |||
33 | #address-cells = <1>; | 34 | #address-cells = <1>; |
34 | #size-cells = <1>; | 35 | #size-cells = <1>; |
35 | }; | 36 | }; |
37 | |||
38 | leds { | ||
39 | compatible = "gpio-leds"; | ||
40 | led6 { | ||
41 | gpios = <&gpio4 22 GPIO_ACTIVE_HIGH>; | ||
42 | }; | ||
43 | led7 { | ||
44 | gpios = <&gpio4 23 GPIO_ACTIVE_HIGH>; | ||
45 | }; | ||
46 | led8 { | ||
47 | gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>; | ||
48 | }; | ||
49 | }; | ||
50 | |||
51 | fixedregulator3v3: fixedregulator@0 { | ||
52 | compatible = "regulator-fixed"; | ||
53 | regulator-name = "fixed-3.3V"; | ||
54 | regulator-min-microvolt = <3300000>; | ||
55 | regulator-max-microvolt = <3300000>; | ||
56 | regulator-boot-on; | ||
57 | regulator-always-on; | ||
58 | }; | ||
59 | }; | ||
60 | |||
61 | &extal_clk { | ||
62 | clock-frequency = <20000000>; | ||
63 | }; | ||
64 | |||
65 | &pfc { | ||
66 | pinctrl-0 = <&scif0_pins &scif1_pins>; | ||
67 | pinctrl-names = "default"; | ||
68 | |||
69 | scif0_pins: serial0 { | ||
70 | renesas,groups = "scif0_data"; | ||
71 | renesas,function = "scif0"; | ||
72 | }; | ||
73 | |||
74 | scif1_pins: serial1 { | ||
75 | renesas,groups = "scif1_data"; | ||
76 | renesas,function = "scif1"; | ||
77 | }; | ||
78 | |||
79 | mmc1_pins: mmc1 { | ||
80 | renesas,groups = "mmc1_data8", "mmc1_ctrl"; | ||
81 | renesas,function = "mmc1"; | ||
82 | }; | ||
83 | }; | ||
84 | |||
85 | &mmcif1 { | ||
86 | pinctrl-0 = <&mmc1_pins>; | ||
87 | pinctrl-names = "default"; | ||
88 | |||
89 | vmmc-supply = <&fixedregulator3v3>; | ||
90 | bus-width = <8>; | ||
91 | non-removable; | ||
92 | status = "okay"; | ||
36 | }; | 93 | }; |
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi index 0e4d5b57c48b..c5417dafca0d 100644 --- a/arch/arm/boot/dts/r8a7790.dtsi +++ b/arch/arm/boot/dts/r8a7790.dtsi | |||
@@ -8,6 +8,7 @@ | |||
8 | * kind, whether express or implied. | 8 | * kind, whether express or implied. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <dt-bindings/clock/r8a7790-clock.h> | ||
11 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 12 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
12 | #include <dt-bindings/interrupt-controller/irq.h> | 13 | #include <dt-bindings/interrupt-controller/irq.h> |
13 | 14 | ||
@@ -196,6 +197,7 @@ | |||
196 | reg = <0 0xe6508000 0 0x40>; | 197 | reg = <0 0xe6508000 0 0x40>; |
197 | interrupt-parent = <&gic>; | 198 | interrupt-parent = <&gic>; |
198 | interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>; | 199 | interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>; |
200 | clocks = <&mstp3_clks R8A7790_CLK_I2C0>; | ||
199 | status = "disabled"; | 201 | status = "disabled"; |
200 | }; | 202 | }; |
201 | 203 | ||
@@ -206,6 +208,7 @@ | |||
206 | reg = <0 0xe6518000 0 0x40>; | 208 | reg = <0 0xe6518000 0 0x40>; |
207 | interrupt-parent = <&gic>; | 209 | interrupt-parent = <&gic>; |
208 | interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>; | 210 | interrupts = <0 288 IRQ_TYPE_LEVEL_HIGH>; |
211 | clocks = <&mstp3_clks R8A7790_CLK_I2C1>; | ||
209 | status = "disabled"; | 212 | status = "disabled"; |
210 | }; | 213 | }; |
211 | 214 | ||
@@ -216,6 +219,7 @@ | |||
216 | reg = <0 0xe6530000 0 0x40>; | 219 | reg = <0 0xe6530000 0 0x40>; |
217 | interrupt-parent = <&gic>; | 220 | interrupt-parent = <&gic>; |
218 | interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>; | 221 | interrupts = <0 286 IRQ_TYPE_LEVEL_HIGH>; |
222 | clocks = <&mstp3_clks R8A7790_CLK_I2C2>; | ||
219 | status = "disabled"; | 223 | status = "disabled"; |
220 | }; | 224 | }; |
221 | 225 | ||
@@ -226,6 +230,7 @@ | |||
226 | reg = <0 0xe6540000 0 0x40>; | 230 | reg = <0 0xe6540000 0 0x40>; |
227 | interrupt-parent = <&gic>; | 231 | interrupt-parent = <&gic>; |
228 | interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>; | 232 | interrupts = <0 290 IRQ_TYPE_LEVEL_HIGH>; |
233 | clocks = <&mstp3_clks R8A7790_CLK_I2C3>; | ||
229 | status = "disabled"; | 234 | status = "disabled"; |
230 | }; | 235 | }; |
231 | 236 | ||
@@ -234,6 +239,7 @@ | |||
234 | reg = <0 0xee200000 0 0x80>; | 239 | reg = <0 0xee200000 0 0x80>; |
235 | interrupt-parent = <&gic>; | 240 | interrupt-parent = <&gic>; |
236 | interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>; | 241 | interrupts = <0 169 IRQ_TYPE_LEVEL_HIGH>; |
242 | clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>; | ||
237 | reg-io-width = <4>; | 243 | reg-io-width = <4>; |
238 | status = "disabled"; | 244 | status = "disabled"; |
239 | }; | 245 | }; |
@@ -243,6 +249,7 @@ | |||
243 | reg = <0 0xee220000 0 0x80>; | 249 | reg = <0 0xee220000 0 0x80>; |
244 | interrupt-parent = <&gic>; | 250 | interrupt-parent = <&gic>; |
245 | interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>; | 251 | interrupts = <0 170 IRQ_TYPE_LEVEL_HIGH>; |
252 | clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>; | ||
246 | reg-io-width = <4>; | 253 | reg-io-width = <4>; |
247 | status = "disabled"; | 254 | status = "disabled"; |
248 | }; | 255 | }; |
@@ -257,6 +264,7 @@ | |||
257 | reg = <0 0xee100000 0 0x100>; | 264 | reg = <0 0xee100000 0 0x100>; |
258 | interrupt-parent = <&gic>; | 265 | interrupt-parent = <&gic>; |
259 | interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>; | 266 | interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>; |
267 | clocks = <&mstp3_clks R8A7790_CLK_SDHI0>; | ||
260 | cap-sd-highspeed; | 268 | cap-sd-highspeed; |
261 | status = "disabled"; | 269 | status = "disabled"; |
262 | }; | 270 | }; |
@@ -266,6 +274,7 @@ | |||
266 | reg = <0 0xee120000 0 0x100>; | 274 | reg = <0 0xee120000 0 0x100>; |
267 | interrupt-parent = <&gic>; | 275 | interrupt-parent = <&gic>; |
268 | interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>; | 276 | interrupts = <0 166 IRQ_TYPE_LEVEL_HIGH>; |
277 | clocks = <&mstp3_clks R8A7790_CLK_SDHI1>; | ||
269 | cap-sd-highspeed; | 278 | cap-sd-highspeed; |
270 | status = "disabled"; | 279 | status = "disabled"; |
271 | }; | 280 | }; |
@@ -275,6 +284,7 @@ | |||
275 | reg = <0 0xee140000 0 0x100>; | 284 | reg = <0 0xee140000 0 0x100>; |
276 | interrupt-parent = <&gic>; | 285 | interrupt-parent = <&gic>; |
277 | interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>; | 286 | interrupts = <0 167 IRQ_TYPE_LEVEL_HIGH>; |
287 | clocks = <&mstp3_clks R8A7790_CLK_SDHI2>; | ||
278 | cap-sd-highspeed; | 288 | cap-sd-highspeed; |
279 | status = "disabled"; | 289 | status = "disabled"; |
280 | }; | 290 | }; |
@@ -284,7 +294,357 @@ | |||
284 | reg = <0 0xee160000 0 0x100>; | 294 | reg = <0 0xee160000 0 0x100>; |
285 | interrupt-parent = <&gic>; | 295 | interrupt-parent = <&gic>; |
286 | interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>; | 296 | interrupts = <0 168 IRQ_TYPE_LEVEL_HIGH>; |
297 | clocks = <&mstp3_clks R8A7790_CLK_SDHI3>; | ||
287 | cap-sd-highspeed; | 298 | cap-sd-highspeed; |
288 | status = "disabled"; | 299 | status = "disabled"; |
289 | }; | 300 | }; |
301 | |||
302 | clocks { | ||
303 | #address-cells = <2>; | ||
304 | #size-cells = <2>; | ||
305 | ranges; | ||
306 | |||
307 | /* External root clock */ | ||
308 | extal_clk: extal_clk { | ||
309 | compatible = "fixed-clock"; | ||
310 | #clock-cells = <0>; | ||
311 | /* This value must be overriden by the board. */ | ||
312 | clock-frequency = <0>; | ||
313 | clock-output-names = "extal"; | ||
314 | }; | ||
315 | |||
316 | /* Special CPG clocks */ | ||
317 | cpg_clocks: cpg_clocks@e6150000 { | ||
318 | compatible = "renesas,r8a7790-cpg-clocks", | ||
319 | "renesas,rcar-gen2-cpg-clocks"; | ||
320 | reg = <0 0xe6150000 0 0x1000>; | ||
321 | clocks = <&extal_clk>; | ||
322 | #clock-cells = <1>; | ||
323 | clock-output-names = "main", "pll0", "pll1", "pll3", | ||
324 | "lb", "qspi", "sdh", "sd0", "sd1", | ||
325 | "z"; | ||
326 | }; | ||
327 | |||
328 | /* Variable factor clocks */ | ||
329 | sd2_clk: sd2_clk@e6150078 { | ||
330 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
331 | reg = <0 0xe6150078 0 4>; | ||
332 | clocks = <&pll1_div2_clk>; | ||
333 | #clock-cells = <0>; | ||
334 | clock-output-names = "sd2"; | ||
335 | }; | ||
336 | sd3_clk: sd3_clk@e615007c { | ||
337 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
338 | reg = <0 0xe615007c 0 4>; | ||
339 | clocks = <&pll1_div2_clk>; | ||
340 | #clock-cells = <0>; | ||
341 | clock-output-names = "sd3"; | ||
342 | }; | ||
343 | mmc0_clk: mmc0_clk@e6150240 { | ||
344 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
345 | reg = <0 0xe6150240 0 4>; | ||
346 | clocks = <&pll1_div2_clk>; | ||
347 | #clock-cells = <0>; | ||
348 | clock-output-names = "mmc0"; | ||
349 | }; | ||
350 | mmc1_clk: mmc1_clk@e6150244 { | ||
351 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
352 | reg = <0 0xe6150244 0 4>; | ||
353 | clocks = <&pll1_div2_clk>; | ||
354 | #clock-cells = <0>; | ||
355 | clock-output-names = "mmc1"; | ||
356 | }; | ||
357 | ssp_clk: ssp_clk@e6150248 { | ||
358 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
359 | reg = <0 0xe6150248 0 4>; | ||
360 | clocks = <&pll1_div2_clk>; | ||
361 | #clock-cells = <0>; | ||
362 | clock-output-names = "ssp"; | ||
363 | }; | ||
364 | ssprs_clk: ssprs_clk@e615024c { | ||
365 | compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; | ||
366 | reg = <0 0xe615024c 0 4>; | ||
367 | clocks = <&pll1_div2_clk>; | ||
368 | #clock-cells = <0>; | ||
369 | clock-output-names = "ssprs"; | ||
370 | }; | ||
371 | |||
372 | /* Fixed factor clocks */ | ||
373 | pll1_div2_clk: pll1_div2_clk { | ||
374 | compatible = "fixed-factor-clock"; | ||
375 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
376 | #clock-cells = <0>; | ||
377 | clock-div = <2>; | ||
378 | clock-mult = <1>; | ||
379 | clock-output-names = "pll1_div2"; | ||
380 | }; | ||
381 | z2_clk: z2_clk { | ||
382 | compatible = "fixed-factor-clock"; | ||
383 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
384 | #clock-cells = <0>; | ||
385 | clock-div = <2>; | ||
386 | clock-mult = <1>; | ||
387 | clock-output-names = "z2"; | ||
388 | }; | ||
389 | zg_clk: zg_clk { | ||
390 | compatible = "fixed-factor-clock"; | ||
391 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
392 | #clock-cells = <0>; | ||
393 | clock-div = <3>; | ||
394 | clock-mult = <1>; | ||
395 | clock-output-names = "zg"; | ||
396 | }; | ||
397 | zx_clk: zx_clk { | ||
398 | compatible = "fixed-factor-clock"; | ||
399 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
400 | #clock-cells = <0>; | ||
401 | clock-div = <3>; | ||
402 | clock-mult = <1>; | ||
403 | clock-output-names = "zx"; | ||
404 | }; | ||
405 | zs_clk: zs_clk { | ||
406 | compatible = "fixed-factor-clock"; | ||
407 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
408 | #clock-cells = <0>; | ||
409 | clock-div = <6>; | ||
410 | clock-mult = <1>; | ||
411 | clock-output-names = "zs"; | ||
412 | }; | ||
413 | hp_clk: hp_clk { | ||
414 | compatible = "fixed-factor-clock"; | ||
415 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
416 | #clock-cells = <0>; | ||
417 | clock-div = <12>; | ||
418 | clock-mult = <1>; | ||
419 | clock-output-names = "hp"; | ||
420 | }; | ||
421 | i_clk: i_clk { | ||
422 | compatible = "fixed-factor-clock"; | ||
423 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
424 | #clock-cells = <0>; | ||
425 | clock-div = <2>; | ||
426 | clock-mult = <1>; | ||
427 | clock-output-names = "i"; | ||
428 | }; | ||
429 | b_clk: b_clk { | ||
430 | compatible = "fixed-factor-clock"; | ||
431 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
432 | #clock-cells = <0>; | ||
433 | clock-div = <12>; | ||
434 | clock-mult = <1>; | ||
435 | clock-output-names = "b"; | ||
436 | }; | ||
437 | p_clk: p_clk { | ||
438 | compatible = "fixed-factor-clock"; | ||
439 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
440 | #clock-cells = <0>; | ||
441 | clock-div = <24>; | ||
442 | clock-mult = <1>; | ||
443 | clock-output-names = "p"; | ||
444 | }; | ||
445 | cl_clk: cl_clk { | ||
446 | compatible = "fixed-factor-clock"; | ||
447 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
448 | #clock-cells = <0>; | ||
449 | clock-div = <48>; | ||
450 | clock-mult = <1>; | ||
451 | clock-output-names = "cl"; | ||
452 | }; | ||
453 | m2_clk: m2_clk { | ||
454 | compatible = "fixed-factor-clock"; | ||
455 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
456 | #clock-cells = <0>; | ||
457 | clock-div = <8>; | ||
458 | clock-mult = <1>; | ||
459 | clock-output-names = "m2"; | ||
460 | }; | ||
461 | imp_clk: imp_clk { | ||
462 | compatible = "fixed-factor-clock"; | ||
463 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
464 | #clock-cells = <0>; | ||
465 | clock-div = <4>; | ||
466 | clock-mult = <1>; | ||
467 | clock-output-names = "imp"; | ||
468 | }; | ||
469 | rclk_clk: rclk_clk { | ||
470 | compatible = "fixed-factor-clock"; | ||
471 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
472 | #clock-cells = <0>; | ||
473 | clock-div = <(48 * 1024)>; | ||
474 | clock-mult = <1>; | ||
475 | clock-output-names = "rclk"; | ||
476 | }; | ||
477 | oscclk_clk: oscclk_clk { | ||
478 | compatible = "fixed-factor-clock"; | ||
479 | clocks = <&cpg_clocks R8A7790_CLK_PLL1>; | ||
480 | #clock-cells = <0>; | ||
481 | clock-div = <(12 * 1024)>; | ||
482 | clock-mult = <1>; | ||
483 | clock-output-names = "oscclk"; | ||
484 | }; | ||
485 | zb3_clk: zb3_clk { | ||
486 | compatible = "fixed-factor-clock"; | ||
487 | clocks = <&cpg_clocks R8A7790_CLK_PLL3>; | ||
488 | #clock-cells = <0>; | ||
489 | clock-div = <4>; | ||
490 | clock-mult = <1>; | ||
491 | clock-output-names = "zb3"; | ||
492 | }; | ||
493 | zb3d2_clk: zb3d2_clk { | ||
494 | compatible = "fixed-factor-clock"; | ||
495 | clocks = <&cpg_clocks R8A7790_CLK_PLL3>; | ||
496 | #clock-cells = <0>; | ||
497 | clock-div = <8>; | ||
498 | clock-mult = <1>; | ||
499 | clock-output-names = "zb3d2"; | ||
500 | }; | ||
501 | ddr_clk: ddr_clk { | ||
502 | compatible = "fixed-factor-clock"; | ||
503 | clocks = <&cpg_clocks R8A7790_CLK_PLL3>; | ||
504 | #clock-cells = <0>; | ||
505 | clock-div = <8>; | ||
506 | clock-mult = <1>; | ||
507 | clock-output-names = "ddr"; | ||
508 | }; | ||
509 | mp_clk: mp_clk { | ||
510 | compatible = "fixed-factor-clock"; | ||
511 | clocks = <&pll1_div2_clk>; | ||
512 | #clock-cells = <0>; | ||
513 | clock-div = <15>; | ||
514 | clock-mult = <1>; | ||
515 | clock-output-names = "mp"; | ||
516 | }; | ||
517 | cp_clk: cp_clk { | ||
518 | compatible = "fixed-factor-clock"; | ||
519 | clocks = <&extal_clk>; | ||
520 | #clock-cells = <0>; | ||
521 | clock-div = <2>; | ||
522 | clock-mult = <1>; | ||
523 | clock-output-names = "cp"; | ||
524 | }; | ||
525 | |||
526 | /* Gate clocks */ | ||
527 | mstp0_clks: mstp0_clks@e6150130 { | ||
528 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
529 | reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>; | ||
530 | clocks = <&mp_clk>; | ||
531 | #clock-cells = <1>; | ||
532 | renesas,clock-indices = <R8A7790_CLK_MSIOF0>; | ||
533 | clock-output-names = "msiof0"; | ||
534 | }; | ||
535 | mstp1_clks: mstp1_clks@e6150134 { | ||
536 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
537 | reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; | ||
538 | clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, | ||
539 | <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>, | ||
540 | <&zs_clk>; | ||
541 | #clock-cells = <1>; | ||
542 | renesas,clock-indices = < | ||
543 | R8A7790_CLK_TMU1 R8A7790_CLK_TMU3 R8A7790_CLK_TMU2 | ||
544 | R8A7790_CLK_CMT0 R8A7790_CLK_TMU0 R8A7790_CLK_VSP1_DU1 | ||
545 | R8A7790_CLK_VSP1_DU0 R8A7790_CLK_VSP1_RT R8A7790_CLK_VSP1_SY | ||
546 | >; | ||
547 | clock-output-names = | ||
548 | "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", | ||
549 | "vsp1-du0", "vsp1-rt", "vsp1-sy"; | ||
550 | }; | ||
551 | mstp2_clks: mstp2_clks@e6150138 { | ||
552 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
553 | reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>; | ||
554 | clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, | ||
555 | <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>; | ||
556 | #clock-cells = <1>; | ||
557 | renesas,clock-indices = < | ||
558 | R8A7790_CLK_SCIFA2 R8A7790_CLK_SCIFA1 R8A7790_CLK_SCIFA0 | ||
559 | R8A7790_CLK_MSIOF2 R8A7790_CLK_SCIFB0 R8A7790_CLK_SCIFB1 | ||
560 | R8A7790_CLK_MSIOF1 R8A7790_CLK_MSIOF3 R8A7790_CLK_SCIFB2 | ||
561 | >; | ||
562 | clock-output-names = | ||
563 | "scifa2", "scifa1", "scifa0", "msiof2", "scifb0", | ||
564 | "scifb1", "msiof1", "msiof3", "scifb2"; | ||
565 | }; | ||
566 | mstp3_clks: mstp3_clks@e615013c { | ||
567 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
568 | reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; | ||
569 | clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>, | ||
570 | <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>, | ||
571 | <&mmc0_clk>, <&rclk_clk>; | ||
572 | #clock-cells = <1>; | ||
573 | renesas,clock-indices = < | ||
574 | R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3 | ||
575 | R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0 | ||
576 | R8A7790_CLK_MMCIF0 R8A7790_CLK_CMT1 | ||
577 | >; | ||
578 | clock-output-names = | ||
579 | "tpu0", "mmcif1", "sdhi3", "sdhi2", | ||
580 | "sdhi1", "sdhi0", "mmcif0", "cmt1"; | ||
581 | }; | ||
582 | mstp5_clks: mstp5_clks@e6150144 { | ||
583 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
584 | reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>; | ||
585 | clocks = <&extal_clk>, <&p_clk>; | ||
586 | #clock-cells = <1>; | ||
587 | renesas,clock-indices = <R8A7790_CLK_THERMAL R8A7790_CLK_PWM>; | ||
588 | clock-output-names = "thermal", "pwm"; | ||
589 | }; | ||
590 | mstp7_clks: mstp7_clks@e615014c { | ||
591 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
592 | reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>; | ||
593 | clocks = <&mp_clk>, <&mp_clk>, <&zs_clk>, <&zs_clk>, <&p_clk>, | ||
594 | <&p_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>, <&zx_clk>, | ||
595 | <&zx_clk>; | ||
596 | #clock-cells = <1>; | ||
597 | renesas,clock-indices = < | ||
598 | R8A7790_CLK_EHCI R8A7790_CLK_HSUSB R8A7790_CLK_HSCIF1 | ||
599 | R8A7790_CLK_HSCIF0 R8A7790_CLK_SCIF1 R8A7790_CLK_SCIF0 | ||
600 | R8A7790_CLK_DU2 R8A7790_CLK_DU1 R8A7790_CLK_DU0 | ||
601 | R8A7790_CLK_LVDS1 R8A7790_CLK_LVDS0 | ||
602 | >; | ||
603 | clock-output-names = | ||
604 | "ehci", "hsusb", "hscif1", "hscif0", "scif1", | ||
605 | "scif0", "du2", "du1", "du0", "lvds1", "lvds0"; | ||
606 | }; | ||
607 | mstp8_clks: mstp8_clks@e6150990 { | ||
608 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
609 | reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>; | ||
610 | clocks = <&p_clk>; | ||
611 | #clock-cells = <1>; | ||
612 | renesas,clock-indices = <R8A7790_CLK_ETHER>; | ||
613 | clock-output-names = "ether"; | ||
614 | }; | ||
615 | mstp9_clks: mstp9_clks@e6150994 { | ||
616 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
617 | reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>; | ||
618 | clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7790_CLK_QSPI>, | ||
619 | <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>; | ||
620 | #clock-cells = <1>; | ||
621 | renesas,clock-indices = < | ||
622 | R8A7790_CLK_RCAN1 R8A7790_CLK_RCAN0 R8A7790_CLK_QSPI_MOD | ||
623 | R8A7790_CLK_I2C3 R8A7790_CLK_I2C2 R8A7790_CLK_I2C1 | ||
624 | R8A7790_CLK_I2C0 | ||
625 | >; | ||
626 | clock-output-names = | ||
627 | "rcan1", "rcan0", "qspi_mod", "i2c3", "i2c2", "i2c1", "i2c0"; | ||
628 | }; | ||
629 | mstp10_clks: mstp10_clks@e6150998 { | ||
630 | compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
631 | reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>; | ||
632 | clocks = <&p_clk>, <&mstp10_clks R8A7790_CLK_SSI>, | ||
633 | <&mstp10_clks R8A7790_CLK_SSI>, <&mstp10_clks R8A7790_CLK_SSI>, | ||
634 | <&mstp10_clks R8A7790_CLK_SSI>, <&mstp10_clks R8A7790_CLK_SSI>, | ||
635 | <&mstp10_clks R8A7790_CLK_SSI>, <&mstp10_clks R8A7790_CLK_SSI>, | ||
636 | <&mstp10_clks R8A7790_CLK_SSI>, <&mstp10_clks R8A7790_CLK_SSI>, | ||
637 | <&mstp10_clks R8A7790_CLK_SSI>; | ||
638 | #clock-cells = <1>; | ||
639 | renesas,clock-indices = < | ||
640 | R8A7790_CLK_SSI R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 | ||
641 | R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5 | ||
642 | R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 | ||
643 | R8A7790_CLK_SSI1 R8A7790_CLK_SSI0 | ||
644 | >; | ||
645 | clock-output-names = | ||
646 | "ssi", "ssi9", "ssi8", "ssi7", "ssi6", "ssi5", | ||
647 | "ssi4", "ssi3", "ssi2", "ssi1", "ssi0"; | ||
648 | }; | ||
649 | }; | ||
290 | }; | 650 | }; |
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts index c4e8b3a0cd13..fd556c3483e3 100644 --- a/arch/arm/boot/dts/r8a7791-koelsch.dts +++ b/arch/arm/boot/dts/r8a7791-koelsch.dts | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | /dts-v1/; | 12 | /dts-v1/; |
13 | #include "r8a7791.dtsi" | 13 | #include "r8a7791.dtsi" |
14 | #include <dt-bindings/gpio/gpio.h> | ||
14 | 15 | ||
15 | / { | 16 | / { |
16 | model = "Koelsch"; | 17 | model = "Koelsch"; |
@@ -29,4 +30,36 @@ | |||
29 | #address-cells = <1>; | 30 | #address-cells = <1>; |
30 | #size-cells = <1>; | 31 | #size-cells = <1>; |
31 | }; | 32 | }; |
33 | |||
34 | leds { | ||
35 | compatible = "gpio-leds"; | ||
36 | led6 { | ||
37 | gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>; | ||
38 | }; | ||
39 | led7 { | ||
40 | gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>; | ||
41 | }; | ||
42 | led8 { | ||
43 | gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>; | ||
44 | }; | ||
45 | }; | ||
46 | }; | ||
47 | |||
48 | &extal_clk { | ||
49 | clock-frequency = <20000000>; | ||
50 | }; | ||
51 | |||
52 | &pfc { | ||
53 | pinctrl-0 = <&scif0_pins &scif1_pins>; | ||
54 | pinctrl-names = "default"; | ||
55 | |||
56 | scif0_pins: serial0 { | ||
57 | renesas,groups = "scif0_data_d"; | ||
58 | renesas,function = "scif0"; | ||
59 | }; | ||
60 | |||
61 | scif1_pins: serial1 { | ||
62 | renesas,groups = "scif1_data_d"; | ||
63 | renesas,function = "scif1"; | ||
64 | }; | ||
32 | }; | 65 | }; |
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index a349aff54c76..e92c1f7aedd0 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi | |||
@@ -9,6 +9,7 @@ | |||
9 | * kind, whether express or implied. | 9 | * kind, whether express or implied. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <dt-bindings/clock/r8a7791-clock.h> | ||
12 | #include <dt-bindings/interrupt-controller/arm-gic.h> | 13 | #include <dt-bindings/interrupt-controller/arm-gic.h> |
13 | #include <dt-bindings/interrupt-controller/irq.h> | 14 | #include <dt-bindings/interrupt-controller/irq.h> |
14 | 15 | ||
@@ -183,4 +184,346 @@ | |||
183 | reg = <0 0xe6060000 0 0x250>; | 184 | reg = <0 0xe6060000 0 0x250>; |
184 | #gpio-range-cells = <3>; | 185 | #gpio-range-cells = <3>; |
185 | }; | 186 | }; |
187 | |||
188 | clocks { | ||
189 | #address-cells = <2>; | ||
190 | #size-cells = <2>; | ||
191 | ranges; | ||
192 | |||
193 | /* External root clock */ | ||
194 | extal_clk: extal_clk { | ||
195 | compatible = "fixed-clock"; | ||
196 | #clock-cells = <0>; | ||
197 | /* This value must be overriden by the board. */ | ||
198 | clock-frequency = <0>; | ||
199 | clock-output-names = "extal"; | ||
200 | }; | ||
201 | |||
202 | /* Special CPG clocks */ | ||
203 | cpg_clocks: cpg_clocks@e6150000 { | ||
204 | compatible = "renesas,r8a7791-cpg-clocks", | ||
205 | "renesas,rcar-gen2-cpg-clocks"; | ||
206 | reg = <0 0xe6150000 0 0x1000>; | ||
207 | clocks = <&extal_clk>; | ||
208 | #clock-cells = <1>; | ||
209 | clock-output-names = "main", "pll0", "pll1", "pll3", | ||
210 | "lb", "qspi", "sdh", "sd0", "z"; | ||
211 | }; | ||
212 | |||
213 | /* Variable factor clocks */ | ||
214 | sd1_clk: sd2_clk@e6150078 { | ||
215 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
216 | reg = <0 0xe6150078 0 4>; | ||
217 | clocks = <&pll1_div2_clk>; | ||
218 | #clock-cells = <0>; | ||
219 | clock-output-names = "sd1"; | ||
220 | }; | ||
221 | sd2_clk: sd3_clk@e615007c { | ||
222 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
223 | reg = <0 0xe615007c 0 4>; | ||
224 | clocks = <&pll1_div2_clk>; | ||
225 | #clock-cells = <0>; | ||
226 | clock-output-names = "sd2"; | ||
227 | }; | ||
228 | mmc0_clk: mmc0_clk@e6150240 { | ||
229 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
230 | reg = <0 0xe6150240 0 4>; | ||
231 | clocks = <&pll1_div2_clk>; | ||
232 | #clock-cells = <0>; | ||
233 | clock-output-names = "mmc0"; | ||
234 | }; | ||
235 | ssp_clk: ssp_clk@e6150248 { | ||
236 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
237 | reg = <0 0xe6150248 0 4>; | ||
238 | clocks = <&pll1_div2_clk>; | ||
239 | #clock-cells = <0>; | ||
240 | clock-output-names = "ssp"; | ||
241 | }; | ||
242 | ssprs_clk: ssprs_clk@e615024c { | ||
243 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
244 | reg = <0 0xe615024c 0 4>; | ||
245 | clocks = <&pll1_div2_clk>; | ||
246 | #clock-cells = <0>; | ||
247 | clock-output-names = "ssprs"; | ||
248 | }; | ||
249 | |||
250 | /* Fixed factor clocks */ | ||
251 | pll1_div2_clk: pll1_div2_clk { | ||
252 | compatible = "fixed-factor-clock"; | ||
253 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
254 | #clock-cells = <0>; | ||
255 | clock-div = <2>; | ||
256 | clock-mult = <1>; | ||
257 | clock-output-names = "pll1_div2"; | ||
258 | }; | ||
259 | zg_clk: zg_clk { | ||
260 | compatible = "fixed-factor-clock"; | ||
261 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
262 | #clock-cells = <0>; | ||
263 | clock-div = <3>; | ||
264 | clock-mult = <1>; | ||
265 | clock-output-names = "zg"; | ||
266 | }; | ||
267 | zx_clk: zx_clk { | ||
268 | compatible = "fixed-factor-clock"; | ||
269 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
270 | #clock-cells = <0>; | ||
271 | clock-div = <3>; | ||
272 | clock-mult = <1>; | ||
273 | clock-output-names = "zx"; | ||
274 | }; | ||
275 | zs_clk: zs_clk { | ||
276 | compatible = "fixed-factor-clock"; | ||
277 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
278 | #clock-cells = <0>; | ||
279 | clock-div = <6>; | ||
280 | clock-mult = <1>; | ||
281 | clock-output-names = "zs"; | ||
282 | }; | ||
283 | hp_clk: hp_clk { | ||
284 | compatible = "fixed-factor-clock"; | ||
285 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
286 | #clock-cells = <0>; | ||
287 | clock-div = <12>; | ||
288 | clock-mult = <1>; | ||
289 | clock-output-names = "hp"; | ||
290 | }; | ||
291 | i_clk: i_clk { | ||
292 | compatible = "fixed-factor-clock"; | ||
293 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
294 | #clock-cells = <0>; | ||
295 | clock-div = <2>; | ||
296 | clock-mult = <1>; | ||
297 | clock-output-names = "i"; | ||
298 | }; | ||
299 | b_clk: b_clk { | ||
300 | compatible = "fixed-factor-clock"; | ||
301 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
302 | #clock-cells = <0>; | ||
303 | clock-div = <12>; | ||
304 | clock-mult = <1>; | ||
305 | clock-output-names = "b"; | ||
306 | }; | ||
307 | p_clk: p_clk { | ||
308 | compatible = "fixed-factor-clock"; | ||
309 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
310 | #clock-cells = <0>; | ||
311 | clock-div = <24>; | ||
312 | clock-mult = <1>; | ||
313 | clock-output-names = "p"; | ||
314 | }; | ||
315 | cl_clk: cl_clk { | ||
316 | compatible = "fixed-factor-clock"; | ||
317 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
318 | #clock-cells = <0>; | ||
319 | clock-div = <48>; | ||
320 | clock-mult = <1>; | ||
321 | clock-output-names = "cl"; | ||
322 | }; | ||
323 | m2_clk: m2_clk { | ||
324 | compatible = "fixed-factor-clock"; | ||
325 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
326 | #clock-cells = <0>; | ||
327 | clock-div = <8>; | ||
328 | clock-mult = <1>; | ||
329 | clock-output-names = "m2"; | ||
330 | }; | ||
331 | imp_clk: imp_clk { | ||
332 | compatible = "fixed-factor-clock"; | ||
333 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
334 | #clock-cells = <0>; | ||
335 | clock-div = <4>; | ||
336 | clock-mult = <1>; | ||
337 | clock-output-names = "imp"; | ||
338 | }; | ||
339 | rclk_clk: rclk_clk { | ||
340 | compatible = "fixed-factor-clock"; | ||
341 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
342 | #clock-cells = <0>; | ||
343 | clock-div = <(48 * 1024)>; | ||
344 | clock-mult = <1>; | ||
345 | clock-output-names = "rclk"; | ||
346 | }; | ||
347 | oscclk_clk: oscclk_clk { | ||
348 | compatible = "fixed-factor-clock"; | ||
349 | clocks = <&cpg_clocks R8A7791_CLK_PLL1>; | ||
350 | #clock-cells = <0>; | ||
351 | clock-div = <(12 * 1024)>; | ||
352 | clock-mult = <1>; | ||
353 | clock-output-names = "oscclk"; | ||
354 | }; | ||
355 | zb3_clk: zb3_clk { | ||
356 | compatible = "fixed-factor-clock"; | ||
357 | clocks = <&cpg_clocks R8A7791_CLK_PLL3>; | ||
358 | #clock-cells = <0>; | ||
359 | clock-div = <4>; | ||
360 | clock-mult = <1>; | ||
361 | clock-output-names = "zb3"; | ||
362 | }; | ||
363 | zb3d2_clk: zb3d2_clk { | ||
364 | compatible = "fixed-factor-clock"; | ||
365 | clocks = <&cpg_clocks R8A7791_CLK_PLL3>; | ||
366 | #clock-cells = <0>; | ||
367 | clock-div = <8>; | ||
368 | clock-mult = <1>; | ||
369 | clock-output-names = "zb3d2"; | ||
370 | }; | ||
371 | ddr_clk: ddr_clk { | ||
372 | compatible = "fixed-factor-clock"; | ||
373 | clocks = <&cpg_clocks R8A7791_CLK_PLL3>; | ||
374 | #clock-cells = <0>; | ||
375 | clock-div = <8>; | ||
376 | clock-mult = <1>; | ||
377 | clock-output-names = "ddr"; | ||
378 | }; | ||
379 | mp_clk: mp_clk { | ||
380 | compatible = "fixed-factor-clock"; | ||
381 | clocks = <&pll1_div2_clk>; | ||
382 | #clock-cells = <0>; | ||
383 | clock-div = <15>; | ||
384 | clock-mult = <1>; | ||
385 | clock-output-names = "mp"; | ||
386 | }; | ||
387 | cp_clk: cp_clk { | ||
388 | compatible = "fixed-factor-clock"; | ||
389 | clocks = <&extal_clk>; | ||
390 | #clock-cells = <0>; | ||
391 | clock-div = <2>; | ||
392 | clock-mult = <1>; | ||
393 | clock-output-names = "cp"; | ||
394 | }; | ||
395 | |||
396 | /* Gate clocks */ | ||
397 | mstp0_clks: mstp0_clks@e6150130 { | ||
398 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
399 | reg = <0 0xe6150130 0 4>, <0 0xe6150030 0 4>; | ||
400 | clocks = <&mp_clk>; | ||
401 | #clock-cells = <1>; | ||
402 | renesas,clock-indices = <R8A7791_CLK_MSIOF0>; | ||
403 | clock-output-names = "msiof0"; | ||
404 | }; | ||
405 | mstp1_clks: mstp1_clks@e6150134 { | ||
406 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
407 | reg = <0 0xe6150134 0 4>, <0 0xe6150038 0 4>; | ||
408 | clocks = <&p_clk>, <&p_clk>, <&p_clk>, <&rclk_clk>, | ||
409 | <&cp_clk>, <&zs_clk>, <&zs_clk>, <&zs_clk>; | ||
410 | #clock-cells = <1>; | ||
411 | renesas,clock-indices = < | ||
412 | R8A7791_CLK_TMU1 R8A7791_CLK_TMU3 R8A7791_CLK_TMU2 | ||
413 | R8A7791_CLK_CMT0 R8A7791_CLK_TMU0 R8A7791_CLK_VSP1_DU1 | ||
414 | R8A7791_CLK_VSP1_DU0 R8A7791_CLK_VSP1_SY | ||
415 | >; | ||
416 | clock-output-names = | ||
417 | "tmu1", "tmu3", "tmu2", "cmt0", "tmu0", "vsp1-du1", | ||
418 | "vsp1-du0", "vsp1-sy"; | ||
419 | }; | ||
420 | mstp2_clks: mstp2_clks@e6150138 { | ||
421 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
422 | reg = <0 0xe6150138 0 4>, <0 0xe6150040 0 4>; | ||
423 | clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, <&mp_clk>, | ||
424 | <&mp_clk>, <&mp_clk>, <&mp_clk>; | ||
425 | #clock-cells = <1>; | ||
426 | renesas,clock-indices = < | ||
427 | R8A7791_CLK_SCIFA2 R8A7791_CLK_SCIFA1 R8A7791_CLK_SCIFA0 | ||
428 | R8A7791_CLK_MSIOF2 R8A7791_CLK_SCIFB0 R8A7791_CLK_SCIFB1 | ||
429 | R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2 | ||
430 | >; | ||
431 | clock-output-names = | ||
432 | "scifa2", "scifa1", "scifa0", "misof2", "scifb0", | ||
433 | "scifb1", "msiof1", "scifb2"; | ||
434 | }; | ||
435 | mstp3_clks: mstp3_clks@e615013c { | ||
436 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
437 | reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; | ||
438 | clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, | ||
439 | <&cpg_clocks R8A7791_CLK_SD0>, <&mmc0_clk>, <&rclk_clk>; | ||
440 | #clock-cells = <1>; | ||
441 | renesas,clock-indices = < | ||
442 | R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 | ||
443 | R8A7791_CLK_SDHI0 R8A7791_CLK_MMCIF0 R8A7791_CLK_CMT1 | ||
444 | >; | ||
445 | clock-output-names = | ||
446 | "tpu0", "sdhi2", "sdhi1", "sdhi0", "mmcif0", "cmt1"; | ||
447 | }; | ||
448 | mstp5_clks: mstp5_clks@e6150144 { | ||
449 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
450 | reg = <0 0xe6150144 0 4>, <0 0xe615003c 0 4>; | ||
451 | clocks = <&extal_clk>, <&p_clk>; | ||
452 | #clock-cells = <1>; | ||
453 | renesas,clock-indices = <R8A7791_CLK_THERMAL R8A7791_CLK_PWM>; | ||
454 | clock-output-names = "thermal", "pwm"; | ||
455 | }; | ||
456 | mstp7_clks: mstp7_clks@e615014c { | ||
457 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
458 | reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>; | ||
459 | clocks = <&mp_clk>, <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>, | ||
460 | <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, | ||
461 | <&zx_clk>, <&zx_clk>, <&zx_clk>; | ||
462 | #clock-cells = <1>; | ||
463 | renesas,clock-indices = < | ||
464 | R8A7791_CLK_HSUSB R8A7791_CLK_HSCIF2 R8A7791_CLK_SCIF5 | ||
465 | R8A7791_CLK_SCIF4 R8A7791_CLK_HSCIF1 R8A7791_CLK_HSCIF0 | ||
466 | R8A7791_CLK_SCIF3 R8A7791_CLK_SCIF2 R8A7791_CLK_SCIF1 | ||
467 | R8A7791_CLK_SCIF0 R8A7791_CLK_DU1 R8A7791_CLK_DU0 | ||
468 | R8A7791_CLK_LVDS0 | ||
469 | >; | ||
470 | clock-output-names = | ||
471 | "hsusb", "hscif2", "scif5", "scif4", "hscif1", "hscif0", | ||
472 | "scif3", "scif2", "scif1", "scif0", "du1", "du0", "lvds0"; | ||
473 | }; | ||
474 | mstp8_clks: mstp8_clks@e6150990 { | ||
475 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
476 | reg = <0 0xe6150990 0 4>, <0 0xe61509a0 0 4>; | ||
477 | clocks = <&p_clk>; | ||
478 | #clock-cells = <1>; | ||
479 | renesas,clock-indices = <R8A7791_CLK_ETHER>; | ||
480 | clock-output-names = "ether"; | ||
481 | }; | ||
482 | mstp9_clks: mstp9_clks@e6150994 { | ||
483 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
484 | reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>; | ||
485 | clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7791_CLK_QSPI>, | ||
486 | <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, | ||
487 | <&p_clk>; | ||
488 | #clock-cells = <1>; | ||
489 | renesas,clock-indices = < | ||
490 | R8A7791_CLK_RCAN1 R8A7791_CLK_RCAN0 R8A7791_CLK_QSPI_MOD | ||
491 | R8A7791_CLK_I2C4 R8A7791_CLK_I2C4 R8A7791_CLK_I2C3 | ||
492 | R8A7791_CLK_I2C2 R8A7791_CLK_I2C1 R8A7791_CLK_I2C0 | ||
493 | >; | ||
494 | clock-output-names = | ||
495 | "rcan1", "rcan0", "qspi_mod", "i2c5", "i2c4", "i2c3", | ||
496 | "i2c2", "i2c1", "i2c0"; | ||
497 | }; | ||
498 | mstp10_clks: mstp10_clks@e6150998 { | ||
499 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
500 | reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>; | ||
501 | clocks = <&p_clk>, <&mstp10_clks R8A7791_CLK_SSI>, | ||
502 | <&mstp10_clks R8A7791_CLK_SSI>, <&mstp10_clks R8A7791_CLK_SSI>, | ||
503 | <&mstp10_clks R8A7791_CLK_SSI>, <&mstp10_clks R8A7791_CLK_SSI>, | ||
504 | <&mstp10_clks R8A7791_CLK_SSI>, <&mstp10_clks R8A7791_CLK_SSI>, | ||
505 | <&mstp10_clks R8A7791_CLK_SSI>, <&mstp10_clks R8A7791_CLK_SSI>, | ||
506 | <&mstp10_clks R8A7791_CLK_SSI>; | ||
507 | #clock-cells = <1>; | ||
508 | renesas,clock-indices = < | ||
509 | R8A7791_CLK_SSI R8A7791_CLK_SSI9 R8A7791_CLK_SSI8 | ||
510 | R8A7791_CLK_SSI7 R8A7791_CLK_SSI6 R8A7791_CLK_SSI5 | ||
511 | R8A7791_CLK_SSI4 R8A7791_CLK_SSI3 R8A7791_CLK_SSI2 | ||
512 | R8A7791_CLK_SSI1 R8A7791_CLK_SSI0 | ||
513 | >; | ||
514 | clock-output-names = | ||
515 | "ssi", "ssi9", "ssi8", "ssi7", "ssi6", "ssi5", | ||
516 | "ssi4", "ssi3", "ssi2", "ssi1", "ssi0"; | ||
517 | }; | ||
518 | mstp11_clks: mstp11_clks@e615099c { | ||
519 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
520 | reg = <0 0xe615099c 0 4>, <0 0xe61509ac 0 4>; | ||
521 | clocks = <&mp_clk>, <&mp_clk>, <&mp_clk>; | ||
522 | #clock-cells = <1>; | ||
523 | renesas,clock-indices = < | ||
524 | R8A7791_CLK_SCIFA3 R8A7791_CLK_SCIFA4 R8A7791_CLK_SCIFA5 | ||
525 | >; | ||
526 | clock-output-names = "scifa3", "scifa4", "scifa5"; | ||
527 | }; | ||
528 | }; | ||
186 | }; | 529 | }; |
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi index c460dd229b13..b7bd3b9a6753 100644 --- a/arch/arm/boot/dts/sh73a0.dtsi +++ b/arch/arm/boot/dts/sh73a0.dtsi | |||
@@ -242,6 +242,15 @@ | |||
242 | <0xe605801c 0x1c>; | 242 | <0xe605801c 0x1c>; |
243 | gpio-controller; | 243 | gpio-controller; |
244 | #gpio-cells = <2>; | 244 | #gpio-cells = <2>; |
245 | interrupts-extended = | ||
246 | <&irqpin0 0 0>, <&irqpin0 1 0>, <&irqpin0 2 0>, <&irqpin0 3 0>, | ||
247 | <&irqpin0 4 0>, <&irqpin0 5 0>, <&irqpin0 6 0>, <&irqpin0 7 0>, | ||
248 | <&irqpin1 0 0>, <&irqpin1 1 0>, <&irqpin1 2 0>, <&irqpin1 3 0>, | ||
249 | <&irqpin1 4 0>, <&irqpin1 5 0>, <&irqpin1 6 0>, <&irqpin1 7 0>, | ||
250 | <&irqpin2 0 0>, <&irqpin2 1 0>, <&irqpin2 2 0>, <&irqpin2 3 0>, | ||
251 | <&irqpin2 4 0>, <&irqpin2 5 0>, <&irqpin2 6 0>, <&irqpin2 7 0>, | ||
252 | <&irqpin3 0 0>, <&irqpin3 1 0>, <&irqpin3 2 0>, <&irqpin3 3 0>, | ||
253 | <&irqpin3 4 0>, <&irqpin3 5 0>, <&irqpin3 6 0>, <&irqpin3 7 0>; | ||
245 | }; | 254 | }; |
246 | 255 | ||
247 | sh_fsi2: sound@ec230000 { | 256 | sh_fsi2: sound@ec230000 { |
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index aa9017bb750c..8c8889211f6d 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig | |||
@@ -12,6 +12,7 @@ config ARCH_SHMOBILE_MULTI | |||
12 | select HAVE_SMP | 12 | select HAVE_SMP |
13 | select ARM_GIC | 13 | select ARM_GIC |
14 | select MIGHT_HAVE_CACHE_L2X0 | 14 | select MIGHT_HAVE_CACHE_L2X0 |
15 | select MIGHT_HAVE_PCI | ||
15 | select NO_IOPORT | 16 | select NO_IOPORT |
16 | select PINCTRL | 17 | select PINCTRL |
17 | select ARCH_REQUIRE_GPIOLIB | 18 | select ARCH_REQUIRE_GPIOLIB |
@@ -96,6 +97,7 @@ config ARCH_R8A7790 | |||
96 | select ARCH_WANT_OPTIONAL_GPIOLIB | 97 | select ARCH_WANT_OPTIONAL_GPIOLIB |
97 | select ARM_GIC | 98 | select ARM_GIC |
98 | select CPU_V7 | 99 | select CPU_V7 |
100 | select MIGHT_HAVE_PCI | ||
99 | select SH_CLK_CPG | 101 | select SH_CLK_CPG |
100 | select RENESAS_IRQC | 102 | select RENESAS_IRQC |
101 | 103 | ||
@@ -104,6 +106,7 @@ config ARCH_R8A7791 | |||
104 | select ARCH_WANT_OPTIONAL_GPIOLIB | 106 | select ARCH_WANT_OPTIONAL_GPIOLIB |
105 | select ARM_GIC | 107 | select ARM_GIC |
106 | select CPU_V7 | 108 | select CPU_V7 |
109 | select MIGHT_HAVE_PCI | ||
107 | select SH_CLK_CPG | 110 | select SH_CLK_CPG |
108 | select RENESAS_IRQC | 111 | select RENESAS_IRQC |
109 | 112 | ||
@@ -112,6 +115,7 @@ config ARCH_EMEV2 | |||
112 | select ARCH_WANT_OPTIONAL_GPIOLIB | 115 | select ARCH_WANT_OPTIONAL_GPIOLIB |
113 | select ARM_GIC | 116 | select ARM_GIC |
114 | select CPU_V7 | 117 | select CPU_V7 |
118 | select MIGHT_HAVE_PCI | ||
115 | select USE_OF | 119 | select USE_OF |
116 | select AUTO_ZRELADDR | 120 | select AUTO_ZRELADDR |
117 | 121 | ||
@@ -239,6 +243,7 @@ config MACH_KOELSCH | |||
239 | bool "Koelsch board" | 243 | bool "Koelsch board" |
240 | depends on ARCH_R8A7791 | 244 | depends on ARCH_R8A7791 |
241 | select USE_OF | 245 | select USE_OF |
246 | select MICREL_PHY if SH_ETH | ||
242 | 247 | ||
243 | config MACH_KZM9G | 248 | config MACH_KZM9G |
244 | bool "KZM-A9-GT board" | 249 | bool "KZM-A9-GT board" |
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c index 38611526fe9a..44b55ef8857e 100644 --- a/arch/arm/mach-shmobile/board-bockw.c +++ b/arch/arm/mach-shmobile/board-bockw.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/mmc/sh_mmcif.h> | 25 | #include <linux/mmc/sh_mmcif.h> |
26 | #include <linux/mtd/partitions.h> | 26 | #include <linux/mtd/partitions.h> |
27 | #include <linux/pinctrl/machine.h> | 27 | #include <linux/pinctrl/machine.h> |
28 | #include <linux/platform_data/camera-rcar.h> | ||
28 | #include <linux/platform_data/usb-rcar-phy.h> | 29 | #include <linux/platform_data/usb-rcar-phy.h> |
29 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/regulator/fixed.h> | 31 | #include <linux/regulator/fixed.h> |
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c index 7b457aed8253..0814a508fd61 100644 --- a/arch/arm/mach-shmobile/clock-r7s72100.c +++ b/arch/arm/mach-shmobile/clock-r7s72100.c | |||
@@ -181,7 +181,6 @@ static struct clk_lookup lookups[] = { | |||
181 | CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]), | 181 | CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]), |
182 | CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]), | 182 | CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]), |
183 | CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]), | 183 | CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]), |
184 | CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), | ||
185 | }; | 184 | }; |
186 | 185 | ||
187 | void __init r7s72100_clock_init(void) | 186 | void __init r7s72100_clock_init(void) |
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c index 312376d2cfd1..c5c60ecdec8f 100644 --- a/arch/arm/mach-shmobile/clock-r8a7790.c +++ b/arch/arm/mach-shmobile/clock-r8a7790.c | |||
@@ -292,9 +292,13 @@ static struct clk_lookup lookups[] = { | |||
292 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), | 292 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), |
293 | CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), | 293 | CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), |
294 | CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]), | 294 | CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]), |
295 | CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP931]), | ||
295 | CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]), | 296 | CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]), |
297 | CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP930]), | ||
296 | CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]), | 298 | CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]), |
299 | CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP929]), | ||
297 | CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]), | 300 | CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]), |
301 | CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP928]), | ||
298 | CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), | 302 | CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), |
299 | CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), | 303 | CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), |
300 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), | 304 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), |
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c index ff2d60d55bd5..f5461262ee25 100644 --- a/arch/arm/mach-shmobile/clock-r8a7791.c +++ b/arch/arm/mach-shmobile/clock-r8a7791.c | |||
@@ -122,6 +122,7 @@ static struct clk *main_clks[] = { | |||
122 | 122 | ||
123 | /* MSTP */ | 123 | /* MSTP */ |
124 | enum { | 124 | enum { |
125 | MSTP813, | ||
125 | MSTP726, MSTP724, MSTP723, MSTP721, MSTP720, | 126 | MSTP726, MSTP724, MSTP723, MSTP721, MSTP720, |
126 | MSTP719, MSTP718, MSTP715, MSTP714, | 127 | MSTP719, MSTP718, MSTP715, MSTP714, |
127 | MSTP522, | 128 | MSTP522, |
@@ -132,6 +133,7 @@ enum { | |||
132 | }; | 133 | }; |
133 | 134 | ||
134 | static struct clk mstp_clks[MSTP_NR] = { | 135 | static struct clk mstp_clks[MSTP_NR] = { |
136 | [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ | ||
135 | [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */ | 137 | [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */ |
136 | [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */ | 138 | [MSTP724] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 24, 0), /* DU0 */ |
137 | [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */ | 139 | [MSTP723] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 23, 0), /* DU1 */ |
@@ -192,6 +194,7 @@ static struct clk_lookup lookups[] = { | |||
192 | CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), | 194 | CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), |
193 | CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), | 195 | CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), |
194 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), | 196 | CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), |
197 | CLKDEV_DEV_ID("r8a7791-ether", &mstp_clks[MSTP813]), /* Ether */ | ||
195 | }; | 198 | }; |
196 | 199 | ||
197 | #define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ | 200 | #define R8A7791_CLOCK_ROOT(e, m, p0, p1, p30, p31) \ |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 30d88689a960..23edf8360c27 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -652,6 +652,7 @@ static struct clk_lookup lookups[] = { | |||
652 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ | 652 | CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ |
653 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ | 653 | CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */ |
654 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ | 654 | CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */ |
655 | CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */ | ||
655 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ | 656 | CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */ |
656 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ | 657 | CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */ |
657 | CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ | 658 | CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */ |
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h index b497f932d04f..f4076a50e970 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h | |||
@@ -20,13 +20,30 @@ | |||
20 | #define __ASM_R8A7778_H__ | 20 | #define __ASM_R8A7778_H__ |
21 | 21 | ||
22 | #include <linux/sh_eth.h> | 22 | #include <linux/sh_eth.h> |
23 | #include <linux/platform_data/camera-rcar.h> | ||
24 | 23 | ||
25 | /* HPB-DMA slave IDs */ | 24 | /* HPB-DMA slave IDs */ |
26 | enum { | 25 | enum { |
27 | HPBDMA_SLAVE_DUMMY, | 26 | HPBDMA_SLAVE_DUMMY, |
28 | HPBDMA_SLAVE_SDHI0_TX, | 27 | HPBDMA_SLAVE_SDHI0_TX, |
29 | HPBDMA_SLAVE_SDHI0_RX, | 28 | HPBDMA_SLAVE_SDHI0_RX, |
29 | HPBDMA_SLAVE_SSI0_TX, | ||
30 | HPBDMA_SLAVE_SSI0_RX, | ||
31 | HPBDMA_SLAVE_SSI1_TX, | ||
32 | HPBDMA_SLAVE_SSI1_RX, | ||
33 | HPBDMA_SLAVE_SSI2_TX, | ||
34 | HPBDMA_SLAVE_SSI2_RX, | ||
35 | HPBDMA_SLAVE_SSI3_TX, | ||
36 | HPBDMA_SLAVE_SSI3_RX, | ||
37 | HPBDMA_SLAVE_SSI4_TX, | ||
38 | HPBDMA_SLAVE_SSI4_RX, | ||
39 | HPBDMA_SLAVE_SSI5_TX, | ||
40 | HPBDMA_SLAVE_SSI5_RX, | ||
41 | HPBDMA_SLAVE_SSI6_TX, | ||
42 | HPBDMA_SLAVE_SSI6_RX, | ||
43 | HPBDMA_SLAVE_SSI7_TX, | ||
44 | HPBDMA_SLAVE_SSI7_RX, | ||
45 | HPBDMA_SLAVE_SSI8_TX, | ||
46 | HPBDMA_SLAVE_SSI8_RX, | ||
30 | HPBDMA_SLAVE_HPBIF0_TX, | 47 | HPBDMA_SLAVE_HPBIF0_TX, |
31 | HPBDMA_SLAVE_HPBIF0_RX, | 48 | HPBDMA_SLAVE_HPBIF0_RX, |
32 | HPBDMA_SLAVE_HPBIF1_TX, | 49 | HPBDMA_SLAVE_HPBIF1_TX, |
@@ -45,6 +62,8 @@ enum { | |||
45 | HPBDMA_SLAVE_HPBIF7_RX, | 62 | HPBDMA_SLAVE_HPBIF7_RX, |
46 | HPBDMA_SLAVE_HPBIF8_TX, | 63 | HPBDMA_SLAVE_HPBIF8_TX, |
47 | HPBDMA_SLAVE_HPBIF8_RX, | 64 | HPBDMA_SLAVE_HPBIF8_RX, |
65 | HPBDMA_SLAVE_USBFUNC_TX, | ||
66 | HPBDMA_SLAVE_USBFUNC_RX, | ||
48 | }; | 67 | }; |
49 | 68 | ||
50 | extern void r8a7778_add_standard_devices(void); | 69 | extern void r8a7778_add_standard_devices(void); |
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c index 81701cfb6cc6..7ea6308e5da8 100644 --- a/arch/arm/mach-shmobile/setup-r8a7778.c +++ b/arch/arm/mach-shmobile/setup-r8a7778.c | |||
@@ -319,6 +319,29 @@ void __init r8a7778_add_dt_devices(void) | |||
319 | #define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */ | 319 | #define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */ |
320 | #define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */ | 320 | #define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */ |
321 | 321 | ||
322 | #define HPBDMA_SSI(_id) \ | ||
323 | { \ | ||
324 | .id = HPBDMA_SLAVE_SSI## _id ##_TX, \ | ||
325 | .addr = 0xffd91008 + (_id * 0x40), \ | ||
326 | .dcr = HPB_DMAE_DCR_CT | \ | ||
327 | HPB_DMAE_DCR_DIP | \ | ||
328 | HPB_DMAE_DCR_SPDS_32BIT | \ | ||
329 | HPB_DMAE_DCR_DMDL | \ | ||
330 | HPB_DMAE_DCR_DPDS_32BIT, \ | ||
331 | .port = _id + (_id << 8), \ | ||
332 | .dma_ch = (28 + _id), \ | ||
333 | }, { \ | ||
334 | .id = HPBDMA_SLAVE_SSI## _id ##_RX, \ | ||
335 | .addr = 0xffd9100c + (_id * 0x40), \ | ||
336 | .dcr = HPB_DMAE_DCR_CT | \ | ||
337 | HPB_DMAE_DCR_DIP | \ | ||
338 | HPB_DMAE_DCR_SMDL | \ | ||
339 | HPB_DMAE_DCR_SPDS_32BIT | \ | ||
340 | HPB_DMAE_DCR_DPDS_32BIT, \ | ||
341 | .port = _id + (_id << 8), \ | ||
342 | .dma_ch = (28 + _id), \ | ||
343 | } | ||
344 | |||
322 | #define HPBDMA_HPBIF(_id) \ | 345 | #define HPBDMA_HPBIF(_id) \ |
323 | { \ | 346 | { \ |
324 | .id = HPBDMA_SLAVE_HPBIF## _id ##_TX, \ | 347 | .id = HPBDMA_SLAVE_HPBIF## _id ##_TX, \ |
@@ -371,8 +394,34 @@ static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = { | |||
371 | .port = 0x0D0C, | 394 | .port = 0x0D0C, |
372 | .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, | 395 | .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, |
373 | .dma_ch = 22, | 396 | .dma_ch = 22, |
397 | }, { | ||
398 | .id = HPBDMA_SLAVE_USBFUNC_TX, /* for D0 */ | ||
399 | .addr = 0xffe60018, | ||
400 | .dcr = HPB_DMAE_DCR_SPDS_32BIT | | ||
401 | HPB_DMAE_DCR_DMDL | | ||
402 | HPB_DMAE_DCR_DPDS_32BIT, | ||
403 | .port = 0x0000, | ||
404 | .dma_ch = 14, | ||
405 | }, { | ||
406 | .id = HPBDMA_SLAVE_USBFUNC_RX, /* for D1 */ | ||
407 | .addr = 0xffe6001c, | ||
408 | .dcr = HPB_DMAE_DCR_SMDL | | ||
409 | HPB_DMAE_DCR_SPDS_32BIT | | ||
410 | HPB_DMAE_DCR_DPDS_32BIT, | ||
411 | .port = 0x0101, | ||
412 | .dma_ch = 15, | ||
374 | }, | 413 | }, |
375 | 414 | ||
415 | HPBDMA_SSI(0), | ||
416 | HPBDMA_SSI(1), | ||
417 | HPBDMA_SSI(2), | ||
418 | HPBDMA_SSI(3), | ||
419 | HPBDMA_SSI(4), | ||
420 | HPBDMA_SSI(5), | ||
421 | HPBDMA_SSI(6), | ||
422 | HPBDMA_SSI(7), | ||
423 | HPBDMA_SSI(8), | ||
424 | |||
376 | HPBDMA_HPBIF(0), | 425 | HPBDMA_HPBIF(0), |
377 | HPBDMA_HPBIF(1), | 426 | HPBDMA_HPBIF(1), |
378 | HPBDMA_HPBIF(2), | 427 | HPBDMA_HPBIF(2), |
@@ -385,24 +434,44 @@ static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = { | |||
385 | }; | 434 | }; |
386 | 435 | ||
387 | static const struct hpb_dmae_channel hpb_dmae_channels[] = { | 436 | static const struct hpb_dmae_channel hpb_dmae_channels[] = { |
437 | HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_TX), /* ch. 14 */ | ||
438 | HPB_DMAE_CHANNEL(0x7c, HPBDMA_SLAVE_USBFUNC_RX), /* ch. 15 */ | ||
388 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */ | 439 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */ |
389 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */ | 440 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */ |
441 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_TX), /* ch. 28 */ | ||
442 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI0_RX), /* ch. 28 */ | ||
390 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_TX), /* ch. 28 */ | 443 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_TX), /* ch. 28 */ |
391 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_RX), /* ch. 28 */ | 444 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF0_RX), /* ch. 28 */ |
445 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_TX), /* ch. 29 */ | ||
446 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI1_RX), /* ch. 29 */ | ||
392 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_TX), /* ch. 29 */ | 447 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_TX), /* ch. 29 */ |
393 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_RX), /* ch. 29 */ | 448 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF1_RX), /* ch. 29 */ |
449 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_TX), /* ch. 30 */ | ||
450 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI2_RX), /* ch. 30 */ | ||
394 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_TX), /* ch. 30 */ | 451 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_TX), /* ch. 30 */ |
395 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_RX), /* ch. 30 */ | 452 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF2_RX), /* ch. 30 */ |
453 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_TX), /* ch. 31 */ | ||
454 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI3_RX), /* ch. 31 */ | ||
396 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_TX), /* ch. 31 */ | 455 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_TX), /* ch. 31 */ |
397 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_RX), /* ch. 31 */ | 456 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF3_RX), /* ch. 31 */ |
457 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_TX), /* ch. 32 */ | ||
458 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI4_RX), /* ch. 32 */ | ||
398 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_TX), /* ch. 32 */ | 459 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_TX), /* ch. 32 */ |
399 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_RX), /* ch. 32 */ | 460 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF4_RX), /* ch. 32 */ |
461 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_TX), /* ch. 33 */ | ||
462 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI5_RX), /* ch. 33 */ | ||
400 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_TX), /* ch. 33 */ | 463 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_TX), /* ch. 33 */ |
401 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_RX), /* ch. 33 */ | 464 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF5_RX), /* ch. 33 */ |
465 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_TX), /* ch. 34 */ | ||
466 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI6_RX), /* ch. 34 */ | ||
402 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_TX), /* ch. 34 */ | 467 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_TX), /* ch. 34 */ |
403 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_RX), /* ch. 34 */ | 468 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF6_RX), /* ch. 34 */ |
469 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_TX), /* ch. 35 */ | ||
470 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI7_RX), /* ch. 35 */ | ||
404 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_TX), /* ch. 35 */ | 471 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_TX), /* ch. 35 */ |
405 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_RX), /* ch. 35 */ | 472 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF7_RX), /* ch. 35 */ |
473 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_TX), /* ch. 36 */ | ||
474 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_SSI8_RX), /* ch. 36 */ | ||
406 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_TX), /* ch. 36 */ | 475 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_TX), /* ch. 36 */ |
407 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_RX), /* ch. 36 */ | 476 | HPB_DMAE_CHANNEL(0x7f, HPBDMA_SLAVE_HPBIF8_RX), /* ch. 36 */ |
408 | }; | 477 | }; |
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index 3543c3bacb75..8474818a7ae0 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c | |||
@@ -67,6 +67,27 @@ R8A7790_GPIO(5); | |||
67 | &r8a7790_gpio##idx##_platform_data, \ | 67 | &r8a7790_gpio##idx##_platform_data, \ |
68 | sizeof(r8a7790_gpio##idx##_platform_data)) | 68 | sizeof(r8a7790_gpio##idx##_platform_data)) |
69 | 69 | ||
70 | static struct resource i2c_resources[] __initdata = { | ||
71 | /* I2C0 */ | ||
72 | DEFINE_RES_MEM(0xE6508000, 0x40), | ||
73 | DEFINE_RES_IRQ(gic_spi(287)), | ||
74 | /* I2C1 */ | ||
75 | DEFINE_RES_MEM(0xE6518000, 0x40), | ||
76 | DEFINE_RES_IRQ(gic_spi(288)), | ||
77 | /* I2C2 */ | ||
78 | DEFINE_RES_MEM(0xE6530000, 0x40), | ||
79 | DEFINE_RES_IRQ(gic_spi(286)), | ||
80 | /* I2C3 */ | ||
81 | DEFINE_RES_MEM(0xE6540000, 0x40), | ||
82 | DEFINE_RES_IRQ(gic_spi(290)), | ||
83 | |||
84 | }; | ||
85 | |||
86 | #define r8a7790_register_i2c(idx) \ | ||
87 | platform_device_register_simple( \ | ||
88 | "i2c-rcar", idx, \ | ||
89 | i2c_resources + (2 * idx), 2); \ | ||
90 | |||
70 | void __init r8a7790_pinmux_init(void) | 91 | void __init r8a7790_pinmux_init(void) |
71 | { | 92 | { |
72 | r8a7790_register_pfc(); | 93 | r8a7790_register_pfc(); |
@@ -76,6 +97,10 @@ void __init r8a7790_pinmux_init(void) | |||
76 | r8a7790_register_gpio(3); | 97 | r8a7790_register_gpio(3); |
77 | r8a7790_register_gpio(4); | 98 | r8a7790_register_gpio(4); |
78 | r8a7790_register_gpio(5); | 99 | r8a7790_register_gpio(5); |
100 | r8a7790_register_i2c(0); | ||
101 | r8a7790_register_i2c(1); | ||
102 | r8a7790_register_i2c(2); | ||
103 | r8a7790_register_i2c(3); | ||
79 | } | 104 | } |
80 | 105 | ||
81 | #define SCIF_COMMON(scif_type, baseaddr, irq) \ | 106 | #define SCIF_COMMON(scif_type, baseaddr, irq) \ |
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c index 5734c24bf6c7..69ccc6c6fd33 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/clk/shmobile.h> | ||
21 | #include <linux/clocksource.h> | 22 | #include <linux/clocksource.h> |
22 | #include <linux/io.h> | 23 | #include <linux/io.h> |
23 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
@@ -44,8 +45,10 @@ u32 __init rcar_gen2_read_mode_pins(void) | |||
44 | 45 | ||
45 | void __init rcar_gen2_timer_init(void) | 46 | void __init rcar_gen2_timer_init(void) |
46 | { | 47 | { |
47 | #ifdef CONFIG_ARM_ARCH_TIMER | 48 | #if defined(CONFIG_ARM_ARCH_TIMER) || defined(CONFIG_COMMON_CLK) |
48 | u32 mode = rcar_gen2_read_mode_pins(); | 49 | u32 mode = rcar_gen2_read_mode_pins(); |
50 | #endif | ||
51 | #ifdef CONFIG_ARM_ARCH_TIMER | ||
49 | void __iomem *base; | 52 | void __iomem *base; |
50 | int extal_mhz = 0; | 53 | int extal_mhz = 0; |
51 | u32 freq; | 54 | u32 freq; |
@@ -78,14 +81,28 @@ void __init rcar_gen2_timer_init(void) | |||
78 | /* Remap "armgcnt address map" space */ | 81 | /* Remap "armgcnt address map" space */ |
79 | base = ioremap(0xe6080000, PAGE_SIZE); | 82 | base = ioremap(0xe6080000, PAGE_SIZE); |
80 | 83 | ||
81 | /* Update registers with correct frequency */ | 84 | /* |
82 | iowrite32(freq, base + CNTFID0); | 85 | * Update the timer if it is either not running, or is not at the |
83 | asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq)); | 86 | * right frequency. The timer is only configurable in secure mode |
87 | * so this avoids an abort if the loader started the timer and | ||
88 | * entered the kernel in non-secure mode. | ||
89 | */ | ||
90 | |||
91 | if ((ioread32(base + CNTCR) & 1) == 0 || | ||
92 | ioread32(base + CNTFID0) != freq) { | ||
93 | /* Update registers with correct frequency */ | ||
94 | iowrite32(freq, base + CNTFID0); | ||
95 | asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq)); | ||
96 | |||
97 | /* make sure arch timer is started by setting bit 0 of CNTCR */ | ||
98 | iowrite32(1, base + CNTCR); | ||
99 | } | ||
84 | 100 | ||
85 | /* make sure arch timer is started by setting bit 0 of CNTCR */ | ||
86 | iowrite32(1, base + CNTCR); | ||
87 | iounmap(base); | 101 | iounmap(base); |
88 | #endif /* CONFIG_ARM_ARCH_TIMER */ | 102 | #endif /* CONFIG_ARM_ARCH_TIMER */ |
89 | 103 | ||
104 | #ifdef CONFIG_COMMON_CLK | ||
105 | rcar_gen2_clocks_init(mode); | ||
106 | #endif | ||
90 | clocksource_of_init(); | 107 | clocksource_of_init(); |
91 | } | 108 | } |
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index ace7309c4369..a3b7c5dd3c16 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ | |||
36 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o | 36 | obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o |
37 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ | 37 | obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ |
38 | obj-$(CONFIG_COMMON_CLK_AT91) += at91/ | 38 | obj-$(CONFIG_COMMON_CLK_AT91) += at91/ |
39 | obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile/ | ||
39 | 40 | ||
40 | obj-$(CONFIG_X86) += x86/ | 41 | obj-$(CONFIG_X86) += x86/ |
41 | 42 | ||
diff --git a/drivers/clk/shmobile/Makefile b/drivers/clk/shmobile/Makefile new file mode 100644 index 000000000000..706adc6ae70c --- /dev/null +++ b/drivers/clk/shmobile/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | obj-$(CONFIG_ARCH_R8A7790) += clk-rcar-gen2.o | ||
2 | obj-$(CONFIG_ARCH_R8A7791) += clk-rcar-gen2.o | ||
3 | obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.o | ||
4 | obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-mstp.o | ||
5 | |||
6 | # for emply built-in.o | ||
7 | obj-n := dummy | ||
diff --git a/drivers/clk/shmobile/clk-div6.c b/drivers/clk/shmobile/clk-div6.c new file mode 100644 index 000000000000..aac4756ec52e --- /dev/null +++ b/drivers/clk/shmobile/clk-div6.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * r8a7790 Common Clock Framework support | ||
3 | * | ||
4 | * Copyright (C) 2013 Renesas Solutions Corp. | ||
5 | * | ||
6 | * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/clkdev.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/of.h> | ||
19 | #include <linux/of_address.h> | ||
20 | |||
21 | #define CPG_DIV6_CKSTP BIT(8) | ||
22 | #define CPG_DIV6_DIV(d) ((d) & 0x3f) | ||
23 | #define CPG_DIV6_DIV_MASK 0x3f | ||
24 | |||
25 | /** | ||
26 | * struct div6_clock - MSTP gating clock | ||
27 | * @hw: handle between common and hardware-specific interfaces | ||
28 | * @reg: IO-remapped register | ||
29 | * @div: divisor value (1-64) | ||
30 | */ | ||
31 | struct div6_clock { | ||
32 | struct clk_hw hw; | ||
33 | void __iomem *reg; | ||
34 | unsigned int div; | ||
35 | }; | ||
36 | |||
37 | #define to_div6_clock(_hw) container_of(_hw, struct div6_clock, hw) | ||
38 | |||
39 | static int cpg_div6_clock_enable(struct clk_hw *hw) | ||
40 | { | ||
41 | struct div6_clock *clock = to_div6_clock(hw); | ||
42 | |||
43 | clk_writel(CPG_DIV6_DIV(clock->div - 1), clock->reg); | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static void cpg_div6_clock_disable(struct clk_hw *hw) | ||
49 | { | ||
50 | struct div6_clock *clock = to_div6_clock(hw); | ||
51 | |||
52 | /* DIV6 clocks require the divisor field to be non-zero when stopping | ||
53 | * the clock. | ||
54 | */ | ||
55 | clk_writel(CPG_DIV6_CKSTP | CPG_DIV6_DIV(CPG_DIV6_DIV_MASK), | ||
56 | clock->reg); | ||
57 | } | ||
58 | |||
59 | static int cpg_div6_clock_is_enabled(struct clk_hw *hw) | ||
60 | { | ||
61 | struct div6_clock *clock = to_div6_clock(hw); | ||
62 | |||
63 | return !(clk_readl(clock->reg) & CPG_DIV6_CKSTP); | ||
64 | } | ||
65 | |||
66 | static unsigned long cpg_div6_clock_recalc_rate(struct clk_hw *hw, | ||
67 | unsigned long parent_rate) | ||
68 | { | ||
69 | struct div6_clock *clock = to_div6_clock(hw); | ||
70 | unsigned int div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1; | ||
71 | |||
72 | return parent_rate / div; | ||
73 | } | ||
74 | |||
75 | static unsigned int cpg_div6_clock_calc_div(unsigned long rate, | ||
76 | unsigned long parent_rate) | ||
77 | { | ||
78 | unsigned int div; | ||
79 | |||
80 | div = DIV_ROUND_CLOSEST(parent_rate, rate); | ||
81 | return clamp_t(unsigned int, div, 1, 64); | ||
82 | } | ||
83 | |||
84 | static long cpg_div6_clock_round_rate(struct clk_hw *hw, unsigned long rate, | ||
85 | unsigned long *parent_rate) | ||
86 | { | ||
87 | unsigned int div = cpg_div6_clock_calc_div(rate, *parent_rate); | ||
88 | |||
89 | return *parent_rate / div; | ||
90 | } | ||
91 | |||
92 | static int cpg_div6_clock_set_rate(struct clk_hw *hw, unsigned long rate, | ||
93 | unsigned long parent_rate) | ||
94 | { | ||
95 | struct div6_clock *clock = to_div6_clock(hw); | ||
96 | unsigned int div = cpg_div6_clock_calc_div(rate, parent_rate); | ||
97 | |||
98 | clock->div = div; | ||
99 | |||
100 | /* Only program the new divisor if the clock isn't stopped. */ | ||
101 | if (!(clk_readl(clock->reg) & CPG_DIV6_CKSTP)) | ||
102 | clk_writel(CPG_DIV6_DIV(clock->div - 1), clock->reg); | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static const struct clk_ops cpg_div6_clock_ops = { | ||
108 | .enable = cpg_div6_clock_enable, | ||
109 | .disable = cpg_div6_clock_disable, | ||
110 | .is_enabled = cpg_div6_clock_is_enabled, | ||
111 | .recalc_rate = cpg_div6_clock_recalc_rate, | ||
112 | .round_rate = cpg_div6_clock_round_rate, | ||
113 | .set_rate = cpg_div6_clock_set_rate, | ||
114 | }; | ||
115 | |||
116 | static void __init cpg_div6_clock_init(struct device_node *np) | ||
117 | { | ||
118 | struct clk_init_data init; | ||
119 | struct div6_clock *clock; | ||
120 | const char *parent_name; | ||
121 | const char *name; | ||
122 | struct clk *clk; | ||
123 | int ret; | ||
124 | |||
125 | clock = kzalloc(sizeof(*clock), GFP_KERNEL); | ||
126 | if (!clock) { | ||
127 | pr_err("%s: failed to allocate %s DIV6 clock\n", | ||
128 | __func__, np->name); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | /* Remap the clock register and read the divisor. Disabling the | ||
133 | * clock overwrites the divisor, so we need to cache its value for the | ||
134 | * enable operation. | ||
135 | */ | ||
136 | clock->reg = of_iomap(np, 0); | ||
137 | if (clock->reg == NULL) { | ||
138 | pr_err("%s: failed to map %s DIV6 clock register\n", | ||
139 | __func__, np->name); | ||
140 | goto error; | ||
141 | } | ||
142 | |||
143 | clock->div = (clk_readl(clock->reg) & CPG_DIV6_DIV_MASK) + 1; | ||
144 | |||
145 | /* Parse the DT properties. */ | ||
146 | ret = of_property_read_string(np, "clock-output-names", &name); | ||
147 | if (ret < 0) { | ||
148 | pr_err("%s: failed to get %s DIV6 clock output name\n", | ||
149 | __func__, np->name); | ||
150 | goto error; | ||
151 | } | ||
152 | |||
153 | parent_name = of_clk_get_parent_name(np, 0); | ||
154 | if (parent_name == NULL) { | ||
155 | pr_err("%s: failed to get %s DIV6 clock parent name\n", | ||
156 | __func__, np->name); | ||
157 | goto error; | ||
158 | } | ||
159 | |||
160 | /* Register the clock. */ | ||
161 | init.name = name; | ||
162 | init.ops = &cpg_div6_clock_ops; | ||
163 | init.flags = CLK_IS_BASIC; | ||
164 | init.parent_names = &parent_name; | ||
165 | init.num_parents = 1; | ||
166 | |||
167 | clock->hw.init = &init; | ||
168 | |||
169 | clk = clk_register(NULL, &clock->hw); | ||
170 | if (IS_ERR(clk)) { | ||
171 | pr_err("%s: failed to register %s DIV6 clock (%ld)\n", | ||
172 | __func__, np->name, PTR_ERR(clk)); | ||
173 | goto error; | ||
174 | } | ||
175 | |||
176 | of_clk_add_provider(np, of_clk_src_simple_get, clk); | ||
177 | |||
178 | return; | ||
179 | |||
180 | error: | ||
181 | if (clock->reg) | ||
182 | iounmap(clock->reg); | ||
183 | kfree(clock); | ||
184 | } | ||
185 | CLK_OF_DECLARE(cpg_div6_clk, "renesas,cpg-div6-clock", cpg_div6_clock_init); | ||
diff --git a/drivers/clk/shmobile/clk-mstp.c b/drivers/clk/shmobile/clk-mstp.c new file mode 100644 index 000000000000..e576b60de20e --- /dev/null +++ b/drivers/clk/shmobile/clk-mstp.c | |||
@@ -0,0 +1,229 @@ | |||
1 | /* | ||
2 | * R-Car MSTP clocks | ||
3 | * | ||
4 | * Copyright (C) 2013 Ideas On Board SPRL | ||
5 | * | ||
6 | * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/clkdev.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/of.h> | ||
17 | #include <linux/of_address.h> | ||
18 | #include <linux/spinlock.h> | ||
19 | |||
20 | /* | ||
21 | * MSTP clocks. We can't use standard gate clocks as we need to poll on the | ||
22 | * status register when enabling the clock. | ||
23 | */ | ||
24 | |||
25 | #define MSTP_MAX_CLOCKS 32 | ||
26 | |||
27 | /** | ||
28 | * struct mstp_clock_group - MSTP gating clocks group | ||
29 | * | ||
30 | * @data: clocks in this group | ||
31 | * @smstpcr: module stop control register | ||
32 | * @mstpsr: module stop status register (optional) | ||
33 | * @lock: protects writes to SMSTPCR | ||
34 | */ | ||
35 | struct mstp_clock_group { | ||
36 | struct clk_onecell_data data; | ||
37 | void __iomem *smstpcr; | ||
38 | void __iomem *mstpsr; | ||
39 | spinlock_t lock; | ||
40 | }; | ||
41 | |||
42 | /** | ||
43 | * struct mstp_clock - MSTP gating clock | ||
44 | * @hw: handle between common and hardware-specific interfaces | ||
45 | * @bit_index: control bit index | ||
46 | * @group: MSTP clocks group | ||
47 | */ | ||
48 | struct mstp_clock { | ||
49 | struct clk_hw hw; | ||
50 | u32 bit_index; | ||
51 | struct mstp_clock_group *group; | ||
52 | }; | ||
53 | |||
54 | #define to_mstp_clock(_hw) container_of(_hw, struct mstp_clock, hw) | ||
55 | |||
56 | static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable) | ||
57 | { | ||
58 | struct mstp_clock *clock = to_mstp_clock(hw); | ||
59 | struct mstp_clock_group *group = clock->group; | ||
60 | u32 bitmask = BIT(clock->bit_index); | ||
61 | unsigned long flags; | ||
62 | unsigned int i; | ||
63 | u32 value; | ||
64 | |||
65 | spin_lock_irqsave(&group->lock, flags); | ||
66 | |||
67 | value = clk_readl(group->smstpcr); | ||
68 | if (enable) | ||
69 | value &= ~bitmask; | ||
70 | else | ||
71 | value |= bitmask; | ||
72 | clk_writel(value, group->smstpcr); | ||
73 | |||
74 | spin_unlock_irqrestore(&group->lock, flags); | ||
75 | |||
76 | if (!enable || !group->mstpsr) | ||
77 | return 0; | ||
78 | |||
79 | for (i = 1000; i > 0; --i) { | ||
80 | if (!(clk_readl(group->mstpsr) & bitmask)) | ||
81 | break; | ||
82 | cpu_relax(); | ||
83 | } | ||
84 | |||
85 | if (!i) { | ||
86 | pr_err("%s: failed to enable %p[%d]\n", __func__, | ||
87 | group->smstpcr, clock->bit_index); | ||
88 | return -ETIMEDOUT; | ||
89 | } | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static int cpg_mstp_clock_enable(struct clk_hw *hw) | ||
95 | { | ||
96 | return cpg_mstp_clock_endisable(hw, true); | ||
97 | } | ||
98 | |||
99 | static void cpg_mstp_clock_disable(struct clk_hw *hw) | ||
100 | { | ||
101 | cpg_mstp_clock_endisable(hw, false); | ||
102 | } | ||
103 | |||
104 | static int cpg_mstp_clock_is_enabled(struct clk_hw *hw) | ||
105 | { | ||
106 | struct mstp_clock *clock = to_mstp_clock(hw); | ||
107 | struct mstp_clock_group *group = clock->group; | ||
108 | u32 value; | ||
109 | |||
110 | if (group->mstpsr) | ||
111 | value = clk_readl(group->mstpsr); | ||
112 | else | ||
113 | value = clk_readl(group->smstpcr); | ||
114 | |||
115 | return !!(value & BIT(clock->bit_index)); | ||
116 | } | ||
117 | |||
118 | static const struct clk_ops cpg_mstp_clock_ops = { | ||
119 | .enable = cpg_mstp_clock_enable, | ||
120 | .disable = cpg_mstp_clock_disable, | ||
121 | .is_enabled = cpg_mstp_clock_is_enabled, | ||
122 | }; | ||
123 | |||
124 | static struct clk * __init | ||
125 | cpg_mstp_clock_register(const char *name, const char *parent_name, | ||
126 | unsigned int index, struct mstp_clock_group *group) | ||
127 | { | ||
128 | struct clk_init_data init; | ||
129 | struct mstp_clock *clock; | ||
130 | struct clk *clk; | ||
131 | |||
132 | clock = kzalloc(sizeof(*clock), GFP_KERNEL); | ||
133 | if (!clock) { | ||
134 | pr_err("%s: failed to allocate MSTP clock.\n", __func__); | ||
135 | return ERR_PTR(-ENOMEM); | ||
136 | } | ||
137 | |||
138 | init.name = name; | ||
139 | init.ops = &cpg_mstp_clock_ops; | ||
140 | init.flags = CLK_IS_BASIC; | ||
141 | init.parent_names = &parent_name; | ||
142 | init.num_parents = 1; | ||
143 | |||
144 | clock->bit_index = index; | ||
145 | clock->group = group; | ||
146 | clock->hw.init = &init; | ||
147 | |||
148 | clk = clk_register(NULL, &clock->hw); | ||
149 | |||
150 | if (IS_ERR(clk)) | ||
151 | kfree(clock); | ||
152 | |||
153 | return clk; | ||
154 | } | ||
155 | |||
156 | static void __init cpg_mstp_clocks_init(struct device_node *np) | ||
157 | { | ||
158 | struct mstp_clock_group *group; | ||
159 | struct clk **clks; | ||
160 | unsigned int i; | ||
161 | |||
162 | group = kzalloc(sizeof(*group), GFP_KERNEL); | ||
163 | clks = kzalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL); | ||
164 | if (group == NULL || clks == NULL) { | ||
165 | kfree(group); | ||
166 | kfree(clks); | ||
167 | pr_err("%s: failed to allocate group\n", __func__); | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | spin_lock_init(&group->lock); | ||
172 | group->data.clks = clks; | ||
173 | |||
174 | group->smstpcr = of_iomap(np, 0); | ||
175 | group->mstpsr = of_iomap(np, 1); | ||
176 | |||
177 | if (group->smstpcr == NULL) { | ||
178 | pr_err("%s: failed to remap SMSTPCR\n", __func__); | ||
179 | kfree(group); | ||
180 | kfree(clks); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | for (i = 0; i < MSTP_MAX_CLOCKS; ++i) { | ||
185 | const char *parent_name; | ||
186 | const char *name; | ||
187 | u32 clkidx; | ||
188 | int ret; | ||
189 | |||
190 | /* Skip clocks with no name. */ | ||
191 | ret = of_property_read_string_index(np, "clock-output-names", | ||
192 | i, &name); | ||
193 | if (ret < 0 || strlen(name) == 0) | ||
194 | continue; | ||
195 | |||
196 | parent_name = of_clk_get_parent_name(np, i); | ||
197 | ret = of_property_read_u32_index(np, "renesas,clock-indices", i, | ||
198 | &clkidx); | ||
199 | if (parent_name == NULL || ret < 0) | ||
200 | break; | ||
201 | |||
202 | if (clkidx >= MSTP_MAX_CLOCKS) { | ||
203 | pr_err("%s: invalid clock %s %s index %u)\n", | ||
204 | __func__, np->name, name, clkidx); | ||
205 | continue; | ||
206 | } | ||
207 | |||
208 | clks[clkidx] = cpg_mstp_clock_register(name, parent_name, i, | ||
209 | group); | ||
210 | if (!IS_ERR(clks[clkidx])) { | ||
211 | group->data.clk_num = max(group->data.clk_num, clkidx); | ||
212 | /* | ||
213 | * Register a clkdev to let board code retrieve the | ||
214 | * clock by name and register aliases for non-DT | ||
215 | * devices. | ||
216 | * | ||
217 | * FIXME: Remove this when all devices that require a | ||
218 | * clock will be instantiated from DT. | ||
219 | */ | ||
220 | clk_register_clkdev(clks[clkidx], name, NULL); | ||
221 | } else { | ||
222 | pr_err("%s: failed to register %s %s clock (%ld)\n", | ||
223 | __func__, np->name, name, PTR_ERR(clks[clkidx])); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | of_clk_add_provider(np, of_clk_src_onecell_get, &group->data); | ||
228 | } | ||
229 | CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init); | ||
diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c new file mode 100644 index 000000000000..a59ec217a124 --- /dev/null +++ b/drivers/clk/shmobile/clk-rcar-gen2.c | |||
@@ -0,0 +1,298 @@ | |||
1 | /* | ||
2 | * rcar_gen2 Core CPG Clocks | ||
3 | * | ||
4 | * Copyright (C) 2013 Ideas On Board SPRL | ||
5 | * | ||
6 | * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | */ | ||
12 | |||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/clkdev.h> | ||
15 | #include <linux/clk/shmobile.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/math64.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/spinlock.h> | ||
22 | |||
23 | struct rcar_gen2_cpg { | ||
24 | struct clk_onecell_data data; | ||
25 | spinlock_t lock; | ||
26 | void __iomem *reg; | ||
27 | }; | ||
28 | |||
29 | #define CPG_SDCKCR 0x00000074 | ||
30 | #define CPG_PLL0CR 0x000000d8 | ||
31 | #define CPG_FRQCRC 0x000000e0 | ||
32 | #define CPG_FRQCRC_ZFC_MASK (0x1f << 8) | ||
33 | #define CPG_FRQCRC_ZFC_SHIFT 8 | ||
34 | |||
35 | /* ----------------------------------------------------------------------------- | ||
36 | * Z Clock | ||
37 | * | ||
38 | * Traits of this clock: | ||
39 | * prepare - clk_prepare only ensures that parents are prepared | ||
40 | * enable - clk_enable only ensures that parents are enabled | ||
41 | * rate - rate is adjustable. clk->rate = parent->rate * mult / 32 | ||
42 | * parent - fixed parent. No clk_set_parent support | ||
43 | */ | ||
44 | |||
45 | struct cpg_z_clk { | ||
46 | struct clk_hw hw; | ||
47 | void __iomem *reg; | ||
48 | }; | ||
49 | |||
50 | #define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw) | ||
51 | |||
52 | static unsigned long cpg_z_clk_recalc_rate(struct clk_hw *hw, | ||
53 | unsigned long parent_rate) | ||
54 | { | ||
55 | struct cpg_z_clk *zclk = to_z_clk(hw); | ||
56 | unsigned int mult; | ||
57 | unsigned int val; | ||
58 | |||
59 | val = (clk_readl(zclk->reg) & CPG_FRQCRC_ZFC_MASK) | ||
60 | >> CPG_FRQCRC_ZFC_SHIFT; | ||
61 | mult = 32 - val; | ||
62 | |||
63 | return div_u64((u64)parent_rate * mult, 32); | ||
64 | } | ||
65 | |||
66 | static long cpg_z_clk_round_rate(struct clk_hw *hw, unsigned long rate, | ||
67 | unsigned long *parent_rate) | ||
68 | { | ||
69 | unsigned long prate = *parent_rate; | ||
70 | unsigned int mult; | ||
71 | |||
72 | if (!prate) | ||
73 | prate = 1; | ||
74 | |||
75 | mult = div_u64((u64)rate * 32, prate); | ||
76 | mult = clamp(mult, 1U, 32U); | ||
77 | |||
78 | return *parent_rate / 32 * mult; | ||
79 | } | ||
80 | |||
81 | static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate, | ||
82 | unsigned long parent_rate) | ||
83 | { | ||
84 | struct cpg_z_clk *zclk = to_z_clk(hw); | ||
85 | unsigned int mult; | ||
86 | u32 val; | ||
87 | |||
88 | mult = div_u64((u64)rate * 32, parent_rate); | ||
89 | mult = clamp(mult, 1U, 32U); | ||
90 | |||
91 | val = clk_readl(zclk->reg); | ||
92 | val &= ~CPG_FRQCRC_ZFC_MASK; | ||
93 | val |= (32 - mult) << CPG_FRQCRC_ZFC_SHIFT; | ||
94 | clk_writel(val, zclk->reg); | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static const struct clk_ops cpg_z_clk_ops = { | ||
100 | .recalc_rate = cpg_z_clk_recalc_rate, | ||
101 | .round_rate = cpg_z_clk_round_rate, | ||
102 | .set_rate = cpg_z_clk_set_rate, | ||
103 | }; | ||
104 | |||
105 | static struct clk * __init cpg_z_clk_register(struct rcar_gen2_cpg *cpg) | ||
106 | { | ||
107 | static const char *parent_name = "pll0"; | ||
108 | struct clk_init_data init; | ||
109 | struct cpg_z_clk *zclk; | ||
110 | struct clk *clk; | ||
111 | |||
112 | zclk = kzalloc(sizeof(*zclk), GFP_KERNEL); | ||
113 | if (!zclk) | ||
114 | return ERR_PTR(-ENOMEM); | ||
115 | |||
116 | init.name = "z"; | ||
117 | init.ops = &cpg_z_clk_ops; | ||
118 | init.flags = 0; | ||
119 | init.parent_names = &parent_name; | ||
120 | init.num_parents = 1; | ||
121 | |||
122 | zclk->reg = cpg->reg + CPG_FRQCRC; | ||
123 | zclk->hw.init = &init; | ||
124 | |||
125 | clk = clk_register(NULL, &zclk->hw); | ||
126 | if (IS_ERR(clk)) | ||
127 | kfree(zclk); | ||
128 | |||
129 | return clk; | ||
130 | } | ||
131 | |||
132 | /* ----------------------------------------------------------------------------- | ||
133 | * CPG Clock Data | ||
134 | */ | ||
135 | |||
136 | /* | ||
137 | * MD EXTAL PLL0 PLL1 PLL3 | ||
138 | * 14 13 19 (MHz) *1 *1 | ||
139 | *--------------------------------------------------- | ||
140 | * 0 0 0 15 x 1 x172/2 x208/2 x106 | ||
141 | * 0 0 1 15 x 1 x172/2 x208/2 x88 | ||
142 | * 0 1 0 20 x 1 x130/2 x156/2 x80 | ||
143 | * 0 1 1 20 x 1 x130/2 x156/2 x66 | ||
144 | * 1 0 0 26 / 2 x200/2 x240/2 x122 | ||
145 | * 1 0 1 26 / 2 x200/2 x240/2 x102 | ||
146 | * 1 1 0 30 / 2 x172/2 x208/2 x106 | ||
147 | * 1 1 1 30 / 2 x172/2 x208/2 x88 | ||
148 | * | ||
149 | * *1 : Table 7.6 indicates VCO ouput (PLLx = VCO/2) | ||
150 | */ | ||
151 | #define CPG_PLL_CONFIG_INDEX(md) ((((md) & BIT(14)) >> 12) | \ | ||
152 | (((md) & BIT(13)) >> 12) | \ | ||
153 | (((md) & BIT(19)) >> 19)) | ||
154 | struct cpg_pll_config { | ||
155 | unsigned int extal_div; | ||
156 | unsigned int pll1_mult; | ||
157 | unsigned int pll3_mult; | ||
158 | }; | ||
159 | |||
160 | static const struct cpg_pll_config cpg_pll_configs[8] __initconst = { | ||
161 | { 1, 208, 106 }, { 1, 208, 88 }, { 1, 156, 80 }, { 1, 156, 66 }, | ||
162 | { 2, 240, 122 }, { 2, 240, 102 }, { 2, 208, 106 }, { 2, 208, 88 }, | ||
163 | }; | ||
164 | |||
165 | /* SDHI divisors */ | ||
166 | static const struct clk_div_table cpg_sdh_div_table[] = { | ||
167 | { 0, 2 }, { 1, 3 }, { 2, 4 }, { 3, 6 }, | ||
168 | { 4, 8 }, { 5, 12 }, { 6, 16 }, { 7, 18 }, | ||
169 | { 8, 24 }, { 10, 36 }, { 11, 48 }, { 0, 0 }, | ||
170 | }; | ||
171 | |||
172 | static const struct clk_div_table cpg_sd01_div_table[] = { | ||
173 | { 5, 12 }, { 6, 16 }, { 7, 18 }, { 8, 24 }, | ||
174 | { 10, 36 }, { 11, 48 }, { 12, 10 }, { 0, 0 }, | ||
175 | }; | ||
176 | |||
177 | /* ----------------------------------------------------------------------------- | ||
178 | * Initialization | ||
179 | */ | ||
180 | |||
181 | static u32 cpg_mode __initdata; | ||
182 | |||
183 | static struct clk * __init | ||
184 | rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, | ||
185 | const struct cpg_pll_config *config, | ||
186 | const char *name) | ||
187 | { | ||
188 | const struct clk_div_table *table = NULL; | ||
189 | const char *parent_name = "main"; | ||
190 | unsigned int shift; | ||
191 | unsigned int mult = 1; | ||
192 | unsigned int div = 1; | ||
193 | |||
194 | if (!strcmp(name, "main")) { | ||
195 | parent_name = of_clk_get_parent_name(np, 0); | ||
196 | div = config->extal_div; | ||
197 | } else if (!strcmp(name, "pll0")) { | ||
198 | /* PLL0 is a configurable multiplier clock. Register it as a | ||
199 | * fixed factor clock for now as there's no generic multiplier | ||
200 | * clock implementation and we currently have no need to change | ||
201 | * the multiplier value. | ||
202 | */ | ||
203 | u32 value = clk_readl(cpg->reg + CPG_PLL0CR); | ||
204 | mult = ((value >> 24) & ((1 << 7) - 1)) + 1; | ||
205 | } else if (!strcmp(name, "pll1")) { | ||
206 | mult = config->pll1_mult / 2; | ||
207 | } else if (!strcmp(name, "pll3")) { | ||
208 | mult = config->pll3_mult; | ||
209 | } else if (!strcmp(name, "lb")) { | ||
210 | div = cpg_mode & BIT(18) ? 36 : 24; | ||
211 | } else if (!strcmp(name, "qspi")) { | ||
212 | div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2) | ||
213 | ? 16 : 20; | ||
214 | } else if (!strcmp(name, "sdh")) { | ||
215 | table = cpg_sdh_div_table; | ||
216 | shift = 8; | ||
217 | } else if (!strcmp(name, "sd0")) { | ||
218 | table = cpg_sd01_div_table; | ||
219 | shift = 4; | ||
220 | } else if (!strcmp(name, "sd1")) { | ||
221 | table = cpg_sd01_div_table; | ||
222 | shift = 0; | ||
223 | } else if (!strcmp(name, "z")) { | ||
224 | return cpg_z_clk_register(cpg); | ||
225 | } else { | ||
226 | return ERR_PTR(-EINVAL); | ||
227 | } | ||
228 | |||
229 | if (!table) | ||
230 | return clk_register_fixed_factor(NULL, name, parent_name, 0, | ||
231 | mult, div); | ||
232 | else | ||
233 | return clk_register_divider_table(NULL, name, parent_name, 0, | ||
234 | cpg->reg + CPG_SDCKCR, shift, | ||
235 | 4, 0, table, &cpg->lock); | ||
236 | } | ||
237 | |||
238 | static void __init rcar_gen2_cpg_clocks_init(struct device_node *np) | ||
239 | { | ||
240 | const struct cpg_pll_config *config; | ||
241 | struct rcar_gen2_cpg *cpg; | ||
242 | struct clk **clks; | ||
243 | unsigned int i; | ||
244 | int num_clks; | ||
245 | |||
246 | num_clks = of_property_count_strings(np, "clock-output-names"); | ||
247 | if (num_clks < 0) { | ||
248 | pr_err("%s: failed to count clocks\n", __func__); | ||
249 | return; | ||
250 | } | ||
251 | |||
252 | cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); | ||
253 | clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL); | ||
254 | if (cpg == NULL || clks == NULL) { | ||
255 | /* We're leaking memory on purpose, there's no point in cleaning | ||
256 | * up as the system won't boot anyway. | ||
257 | */ | ||
258 | pr_err("%s: failed to allocate cpg\n", __func__); | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | spin_lock_init(&cpg->lock); | ||
263 | |||
264 | cpg->data.clks = clks; | ||
265 | cpg->data.clk_num = num_clks; | ||
266 | |||
267 | cpg->reg = of_iomap(np, 0); | ||
268 | if (WARN_ON(cpg->reg == NULL)) | ||
269 | return; | ||
270 | |||
271 | config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX(cpg_mode)]; | ||
272 | |||
273 | for (i = 0; i < num_clks; ++i) { | ||
274 | const char *name; | ||
275 | struct clk *clk; | ||
276 | |||
277 | of_property_read_string_index(np, "clock-output-names", i, | ||
278 | &name); | ||
279 | |||
280 | clk = rcar_gen2_cpg_register_clock(np, cpg, config, name); | ||
281 | if (IS_ERR(clk)) | ||
282 | pr_err("%s: failed to register %s %s clock (%ld)\n", | ||
283 | __func__, np->name, name, PTR_ERR(clk)); | ||
284 | else | ||
285 | cpg->data.clks[i] = clk; | ||
286 | } | ||
287 | |||
288 | of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); | ||
289 | } | ||
290 | CLK_OF_DECLARE(rcar_gen2_cpg_clks, "renesas,rcar-gen2-cpg-clocks", | ||
291 | rcar_gen2_cpg_clocks_init); | ||
292 | |||
293 | void __init rcar_gen2_clocks_init(u32 mode) | ||
294 | { | ||
295 | cpg_mode = mode; | ||
296 | |||
297 | of_clk_init(NULL); | ||
298 | } | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 0965e9848b3d..940341a185d7 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long delta, | |||
634 | 634 | ||
635 | static void sh_cmt_clock_event_suspend(struct clock_event_device *ced) | 635 | static void sh_cmt_clock_event_suspend(struct clock_event_device *ced) |
636 | { | 636 | { |
637 | pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev); | 637 | struct sh_cmt_priv *p = ced_to_sh_cmt(ced); |
638 | |||
639 | pm_genpd_syscore_poweroff(&p->pdev->dev); | ||
640 | clk_unprepare(p->clk); | ||
638 | } | 641 | } |
639 | 642 | ||
640 | static void sh_cmt_clock_event_resume(struct clock_event_device *ced) | 643 | static void sh_cmt_clock_event_resume(struct clock_event_device *ced) |
641 | { | 644 | { |
642 | pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev); | 645 | struct sh_cmt_priv *p = ced_to_sh_cmt(ced); |
646 | |||
647 | clk_prepare(p->clk); | ||
648 | pm_genpd_syscore_poweron(&p->pdev->dev); | ||
643 | } | 649 | } |
644 | 650 | ||
645 | static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, | 651 | static void sh_cmt_register_clockevent(struct sh_cmt_priv *p, |
@@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
737 | goto err2; | 743 | goto err2; |
738 | } | 744 | } |
739 | 745 | ||
746 | ret = clk_prepare(p->clk); | ||
747 | if (ret < 0) | ||
748 | goto err3; | ||
749 | |||
740 | if (res2 && (resource_size(res2) == 4)) { | 750 | if (res2 && (resource_size(res2) == 4)) { |
741 | /* assume both CMSTR and CMCSR to be 32-bit */ | 751 | /* assume both CMSTR and CMCSR to be 32-bit */ |
742 | p->read_control = sh_cmt_read32; | 752 | p->read_control = sh_cmt_read32; |
@@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
773 | cfg->clocksource_rating); | 783 | cfg->clocksource_rating); |
774 | if (ret) { | 784 | if (ret) { |
775 | dev_err(&p->pdev->dev, "registration failed\n"); | 785 | dev_err(&p->pdev->dev, "registration failed\n"); |
776 | goto err3; | 786 | goto err4; |
777 | } | 787 | } |
778 | p->cs_enabled = false; | 788 | p->cs_enabled = false; |
779 | 789 | ||
780 | ret = setup_irq(irq, &p->irqaction); | 790 | ret = setup_irq(irq, &p->irqaction); |
781 | if (ret) { | 791 | if (ret) { |
782 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); | 792 | dev_err(&p->pdev->dev, "failed to request irq %d\n", irq); |
783 | goto err3; | 793 | goto err4; |
784 | } | 794 | } |
785 | 795 | ||
786 | platform_set_drvdata(pdev, p); | 796 | platform_set_drvdata(pdev, p); |
787 | 797 | ||
788 | return 0; | 798 | return 0; |
799 | err4: | ||
800 | clk_unprepare(p->clk); | ||
789 | err3: | 801 | err3: |
790 | clk_put(p->clk); | 802 | clk_put(p->clk); |
791 | err2: | 803 | err2: |
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 33f9dc1f14fd..30fcb897eb99 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
@@ -116,15 +116,22 @@ config PINCTRL_IMX1_CORE | |||
116 | 116 | ||
117 | config PINCTRL_IMX27 | 117 | config PINCTRL_IMX27 |
118 | bool "IMX27 pinctrl driver" | 118 | bool "IMX27 pinctrl driver" |
119 | depends on OF | ||
120 | depends on SOC_IMX27 | 119 | depends on SOC_IMX27 |
121 | select PINCTRL_IMX1_CORE | 120 | select PINCTRL_IMX1_CORE |
122 | help | 121 | help |
123 | Say Y here to enable the imx27 pinctrl driver | 122 | Say Y here to enable the imx27 pinctrl driver |
124 | 123 | ||
124 | |||
125 | config PINCTRL_IMX25 | ||
126 | bool "IMX25 pinctrl driver" | ||
127 | depends on OF | ||
128 | depends on SOC_IMX25 | ||
129 | select PINCTRL_IMX | ||
130 | help | ||
131 | Say Y here to enable the imx25 pinctrl driver | ||
132 | |||
125 | config PINCTRL_IMX35 | 133 | config PINCTRL_IMX35 |
126 | bool "IMX35 pinctrl driver" | 134 | bool "IMX35 pinctrl driver" |
127 | depends on OF | ||
128 | depends on SOC_IMX35 | 135 | depends on SOC_IMX35 |
129 | select PINCTRL_IMX | 136 | select PINCTRL_IMX |
130 | help | 137 | help |
@@ -132,7 +139,6 @@ config PINCTRL_IMX35 | |||
132 | 139 | ||
133 | config PINCTRL_IMX50 | 140 | config PINCTRL_IMX50 |
134 | bool "IMX50 pinctrl driver" | 141 | bool "IMX50 pinctrl driver" |
135 | depends on OF | ||
136 | depends on SOC_IMX50 | 142 | depends on SOC_IMX50 |
137 | select PINCTRL_IMX | 143 | select PINCTRL_IMX |
138 | help | 144 | help |
@@ -140,7 +146,6 @@ config PINCTRL_IMX50 | |||
140 | 146 | ||
141 | config PINCTRL_IMX51 | 147 | config PINCTRL_IMX51 |
142 | bool "IMX51 pinctrl driver" | 148 | bool "IMX51 pinctrl driver" |
143 | depends on OF | ||
144 | depends on SOC_IMX51 | 149 | depends on SOC_IMX51 |
145 | select PINCTRL_IMX | 150 | select PINCTRL_IMX |
146 | help | 151 | help |
@@ -148,7 +153,6 @@ config PINCTRL_IMX51 | |||
148 | 153 | ||
149 | config PINCTRL_IMX53 | 154 | config PINCTRL_IMX53 |
150 | bool "IMX53 pinctrl driver" | 155 | bool "IMX53 pinctrl driver" |
151 | depends on OF | ||
152 | depends on SOC_IMX53 | 156 | depends on SOC_IMX53 |
153 | select PINCTRL_IMX | 157 | select PINCTRL_IMX |
154 | help | 158 | help |
@@ -156,7 +160,6 @@ config PINCTRL_IMX53 | |||
156 | 160 | ||
157 | config PINCTRL_IMX6Q | 161 | config PINCTRL_IMX6Q |
158 | bool "IMX6Q/DL pinctrl driver" | 162 | bool "IMX6Q/DL pinctrl driver" |
159 | depends on OF | ||
160 | depends on SOC_IMX6Q | 163 | depends on SOC_IMX6Q |
161 | select PINCTRL_IMX | 164 | select PINCTRL_IMX |
162 | help | 165 | help |
@@ -164,7 +167,6 @@ config PINCTRL_IMX6Q | |||
164 | 167 | ||
165 | config PINCTRL_IMX6SL | 168 | config PINCTRL_IMX6SL |
166 | bool "IMX6SL pinctrl driver" | 169 | bool "IMX6SL pinctrl driver" |
167 | depends on OF | ||
168 | depends on SOC_IMX6SL | 170 | depends on SOC_IMX6SL |
169 | select PINCTRL_IMX | 171 | select PINCTRL_IMX |
170 | help | 172 | help |
@@ -172,7 +174,6 @@ config PINCTRL_IMX6SL | |||
172 | 174 | ||
173 | config PINCTRL_VF610 | 175 | config PINCTRL_VF610 |
174 | bool "Freescale Vybrid VF610 pinctrl driver" | 176 | bool "Freescale Vybrid VF610 pinctrl driver" |
175 | depends on OF | ||
176 | depends on SOC_VF610 | 177 | depends on SOC_VF610 |
177 | select PINCTRL_IMX | 178 | select PINCTRL_IMX |
178 | help | 179 | help |
@@ -202,6 +203,17 @@ config PINCTRL_IMX28 | |||
202 | bool | 203 | bool |
203 | select PINCTRL_MXS | 204 | select PINCTRL_MXS |
204 | 205 | ||
206 | config PINCTRL_MSM | ||
207 | bool | ||
208 | select PINMUX | ||
209 | select PINCONF | ||
210 | select GENERIC_PINCONF | ||
211 | |||
212 | config PINCTRL_MSM8X74 | ||
213 | bool "Qualcomm 8x74 pin controller driver" | ||
214 | depends on OF && OF_IRQ | ||
215 | select PINCTRL_MSM | ||
216 | |||
205 | config PINCTRL_NOMADIK | 217 | config PINCTRL_NOMADIK |
206 | bool "Nomadik pin controller driver" | 218 | bool "Nomadik pin controller driver" |
207 | depends on ARCH_U8500 || ARCH_NOMADIK | 219 | depends on ARCH_U8500 || ARCH_NOMADIK |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index 4f7be2921aa5..5d91e4b448d4 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
@@ -34,7 +34,10 @@ obj-$(CONFIG_PINCTRL_IMX6SL) += pinctrl-imx6sl.o | |||
34 | obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o | 34 | obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o |
35 | obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o | 35 | obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o |
36 | obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o | 36 | obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o |
37 | obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o | ||
37 | obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o | 38 | obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o |
39 | obj-$(CONFIG_PINCTRL_MSM) += pinctrl-msm.o | ||
40 | obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o | ||
38 | obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o | 41 | obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o |
39 | obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o | 42 | obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o |
40 | obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o | 43 | obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o |
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index b8fcc38c0d11..4187fe58794d 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -28,12 +28,6 @@ int pinconf_check_ops(struct pinctrl_dev *pctldev) | |||
28 | { | 28 | { |
29 | const struct pinconf_ops *ops = pctldev->desc->confops; | 29 | const struct pinconf_ops *ops = pctldev->desc->confops; |
30 | 30 | ||
31 | /* We must be able to read out pin status */ | ||
32 | if (!ops->pin_config_get && !ops->pin_config_group_get) { | ||
33 | dev_err(pctldev->dev, | ||
34 | "pinconf must be able to read out pin status\n"); | ||
35 | return -EINVAL; | ||
36 | } | ||
37 | /* We have to be able to config the pins in SOME way */ | 31 | /* We have to be able to config the pins in SOME way */ |
38 | if (!ops->pin_config_set && !ops->pin_config_group_set) { | 32 | if (!ops->pin_config_set && !ops->pin_config_group_set) { |
39 | dev_err(pctldev->dev, | 33 | dev_err(pctldev->dev, |
@@ -67,9 +61,9 @@ int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, | |||
67 | const struct pinconf_ops *ops = pctldev->desc->confops; | 61 | const struct pinconf_ops *ops = pctldev->desc->confops; |
68 | 62 | ||
69 | if (!ops || !ops->pin_config_get) { | 63 | if (!ops || !ops->pin_config_get) { |
70 | dev_err(pctldev->dev, "cannot get pin configuration, missing " | 64 | dev_dbg(pctldev->dev, "cannot get pin configuration, missing " |
71 | "pin_config_get() function in driver\n"); | 65 | "pin_config_get() function in driver\n"); |
72 | return -EINVAL; | 66 | return -ENOTSUPP; |
73 | } | 67 | } |
74 | 68 | ||
75 | return ops->pin_config_get(pctldev, pin, config); | 69 | return ops->pin_config_get(pctldev, pin, config); |
@@ -93,10 +87,10 @@ int pin_config_group_get(const char *dev_name, const char *pin_group, | |||
93 | ops = pctldev->desc->confops; | 87 | ops = pctldev->desc->confops; |
94 | 88 | ||
95 | if (!ops || !ops->pin_config_group_get) { | 89 | if (!ops || !ops->pin_config_group_get) { |
96 | dev_err(pctldev->dev, "cannot get configuration for pin " | 90 | dev_dbg(pctldev->dev, "cannot get configuration for pin " |
97 | "group, missing group config get function in " | 91 | "group, missing group config get function in " |
98 | "driver\n"); | 92 | "driver\n"); |
99 | ret = -EINVAL; | 93 | ret = -ENOTSUPP; |
100 | goto unlock; | 94 | goto unlock; |
101 | } | 95 | } |
102 | 96 | ||
@@ -305,9 +299,6 @@ static int pinconf_pins_show(struct seq_file *s, void *what) | |||
305 | const struct pinconf_ops *ops = pctldev->desc->confops; | 299 | const struct pinconf_ops *ops = pctldev->desc->confops; |
306 | unsigned i, pin; | 300 | unsigned i, pin; |
307 | 301 | ||
308 | if (!ops || !ops->pin_config_get) | ||
309 | return 0; | ||
310 | |||
311 | seq_puts(s, "Pin config settings per pin\n"); | 302 | seq_puts(s, "Pin config settings per pin\n"); |
312 | seq_puts(s, "Format: pin (name): configs\n"); | 303 | seq_puts(s, "Format: pin (name): configs\n"); |
313 | 304 | ||
@@ -356,9 +347,6 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
356 | unsigned ngroups = pctlops->get_groups_count(pctldev); | 347 | unsigned ngroups = pctlops->get_groups_count(pctldev); |
357 | unsigned selector = 0; | 348 | unsigned selector = 0; |
358 | 349 | ||
359 | if (!ops || !ops->pin_config_group_get) | ||
360 | return 0; | ||
361 | |||
362 | seq_puts(s, "Pin config settings per pin group\n"); | 350 | seq_puts(s, "Pin config settings per pin group\n"); |
363 | seq_puts(s, "Format: group (name): configs\n"); | 351 | seq_puts(s, "Format: group (name): configs\n"); |
364 | 352 | ||
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index a7549c4c83b4..b0b78f3468ae 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -118,7 +118,7 @@ struct at91_pin_group { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * struct at91_pinctrl_mux_ops - describes an At91 mux ops group | 121 | * struct at91_pinctrl_mux_ops - describes an AT91 mux ops group |
122 | * on new IP with support for periph C and D the way to mux in | 122 | * on new IP with support for periph C and D the way to mux in |
123 | * periph A and B has changed | 123 | * periph A and B has changed |
124 | * So provide the right call back | 124 | * So provide the right call back |
@@ -722,7 +722,8 @@ static int at91_pinconf_get(struct pinctrl_dev *pctldev, | |||
722 | unsigned pin; | 722 | unsigned pin; |
723 | int div; | 723 | int div; |
724 | 724 | ||
725 | dev_dbg(info->dev, "%s:%d, pin_id=%d, config=0x%lx", __func__, __LINE__, pin_id, *config); | 725 | *config = 0; |
726 | dev_dbg(info->dev, "%s:%d, pin_id=%d", __func__, __LINE__, pin_id); | ||
726 | pio = pin_to_controller(info, pin_to_bank(pin_id)); | 727 | pio = pin_to_controller(info, pin_to_bank(pin_id)); |
727 | pin = pin_id % MAX_NB_GPIO_PER_BANK; | 728 | pin = pin_id % MAX_NB_GPIO_PER_BANK; |
728 | 729 | ||
@@ -1396,7 +1397,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
1396 | chained_irq_enter(chip, desc); | 1397 | chained_irq_enter(chip, desc); |
1397 | for (;;) { | 1398 | for (;;) { |
1398 | /* Reading ISR acks pending (edge triggered) GPIO interrupts. | 1399 | /* Reading ISR acks pending (edge triggered) GPIO interrupts. |
1399 | * When there none are pending, we're finished unless we need | 1400 | * When there are none pending, we're finished unless we need |
1400 | * to process multiple banks (like ID_PIOCDE on sam9263). | 1401 | * to process multiple banks (like ID_PIOCDE on sam9263). |
1401 | */ | 1402 | */ |
1402 | isr = readl_relaxed(pio + PIO_ISR) & readl_relaxed(pio + PIO_IMR); | 1403 | isr = readl_relaxed(pio + PIO_ISR) & readl_relaxed(pio + PIO_IMR); |
@@ -1505,7 +1506,7 @@ static int at91_gpio_of_irq_setup(struct device_node *node, | |||
1505 | prev = gpio_chips[at91_gpio->pioc_idx - 1]; | 1506 | prev = gpio_chips[at91_gpio->pioc_idx - 1]; |
1506 | 1507 | ||
1507 | /* The top level handler handles one bank of GPIOs, except | 1508 | /* The top level handler handles one bank of GPIOs, except |
1508 | * on some SoC it can handles up to three... | 1509 | * on some SoC it can handle up to three... |
1509 | * We only set up the handler for the first of the list. | 1510 | * We only set up the handler for the first of the list. |
1510 | */ | 1511 | */ |
1511 | if (prev && prev->next == at91_gpio) | 1512 | if (prev && prev->next == at91_gpio) |
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 2832576d8b12..5888066d80c2 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -286,13 +286,19 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
286 | spin_lock_irqsave(&vg->lock, flags); | 286 | spin_lock_irqsave(&vg->lock, flags); |
287 | 287 | ||
288 | for (i = 0; i < vg->chip.ngpio; i++) { | 288 | for (i = 0; i < vg->chip.ngpio; i++) { |
289 | const char *label; | ||
289 | offs = vg->range->pins[i] * 16; | 290 | offs = vg->range->pins[i] * 16; |
290 | conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG); | 291 | conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG); |
291 | val = readl(vg->reg_base + offs + BYT_VAL_REG); | 292 | val = readl(vg->reg_base + offs + BYT_VAL_REG); |
292 | 293 | ||
294 | label = gpiochip_is_requested(chip, i); | ||
295 | if (!label) | ||
296 | label = "Unrequested"; | ||
297 | |||
293 | seq_printf(s, | 298 | seq_printf(s, |
294 | " gpio-%-3d %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n", | 299 | " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n", |
295 | i, | 300 | i, |
301 | label, | ||
296 | val & BYT_INPUT_EN ? " " : "in", | 302 | val & BYT_INPUT_EN ? " " : "in", |
297 | val & BYT_OUTPUT_EN ? " " : "out", | 303 | val & BYT_OUTPUT_EN ? " " : "out", |
298 | val & BYT_LEVEL ? "hi" : "lo", | 304 | val & BYT_LEVEL ? "hi" : "lo", |
@@ -366,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d) | |||
366 | { | 372 | { |
367 | } | 373 | } |
368 | 374 | ||
375 | static unsigned int byt_irq_startup(struct irq_data *d) | ||
376 | { | ||
377 | struct byt_gpio *vg = irq_data_get_irq_chip_data(d); | ||
378 | |||
379 | if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d))) | ||
380 | dev_err(vg->chip.dev, | ||
381 | "unable to lock HW IRQ %lu for IRQ\n", | ||
382 | irqd_to_hwirq(d)); | ||
383 | byt_irq_unmask(d); | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static void byt_irq_shutdown(struct irq_data *d) | ||
388 | { | ||
389 | struct byt_gpio *vg = irq_data_get_irq_chip_data(d); | ||
390 | |||
391 | byt_irq_mask(d); | ||
392 | gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d)); | ||
393 | } | ||
394 | |||
369 | static struct irq_chip byt_irqchip = { | 395 | static struct irq_chip byt_irqchip = { |
370 | .name = "BYT-GPIO", | 396 | .name = "BYT-GPIO", |
371 | .irq_mask = byt_irq_mask, | 397 | .irq_mask = byt_irq_mask, |
372 | .irq_unmask = byt_irq_unmask, | 398 | .irq_unmask = byt_irq_unmask, |
373 | .irq_set_type = byt_irq_type, | 399 | .irq_set_type = byt_irq_type, |
400 | .irq_startup = byt_irq_startup, | ||
401 | .irq_shutdown = byt_irq_shutdown, | ||
374 | }; | 402 | }; |
375 | 403 | ||
376 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) | 404 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) |
diff --git a/drivers/pinctrl/pinctrl-imx1-core.c b/drivers/pinctrl/pinctrl-imx1-core.c index f77914ac081a..17aecde1b51d 100644 --- a/drivers/pinctrl/pinctrl-imx1-core.c +++ b/drivers/pinctrl/pinctrl-imx1-core.c | |||
@@ -638,6 +638,13 @@ int imx1_pinctrl_core_probe(struct platform_device *pdev, | |||
638 | return -EINVAL; | 638 | return -EINVAL; |
639 | } | 639 | } |
640 | 640 | ||
641 | ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); | ||
642 | if (ret) { | ||
643 | pinctrl_unregister(ipctl->pctl); | ||
644 | dev_err(&pdev->dev, "Failed to populate subdevices\n"); | ||
645 | return ret; | ||
646 | } | ||
647 | |||
641 | dev_info(&pdev->dev, "initialized IMX pinctrl driver\n"); | 648 | dev_info(&pdev->dev, "initialized IMX pinctrl driver\n"); |
642 | 649 | ||
643 | return 0; | 650 | return 0; |
diff --git a/drivers/pinctrl/pinctrl-imx25.c b/drivers/pinctrl/pinctrl-imx25.c new file mode 100644 index 000000000000..1aae1b61c4dc --- /dev/null +++ b/drivers/pinctrl/pinctrl-imx25.c | |||
@@ -0,0 +1,351 @@ | |||
1 | /* | ||
2 | * imx25 pinctrl driver. | ||
3 | * | ||
4 | * Copyright 2013 Eukréa Electromatique <denis@eukrea.com> | ||
5 | * | ||
6 | * This driver was mostly copied from the imx51 pinctrl driver which has: | ||
7 | * | ||
8 | * Copyright (C) 2012 Freescale Semiconductor, Inc. | ||
9 | * Copyright (C) 2012 Linaro, Inc. | ||
10 | * | ||
11 | * Author: Denis Carikli <denis@eukrea.com> | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as published | ||
15 | * by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/err.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_device.h> | ||
24 | #include <linux/pinctrl/pinctrl.h> | ||
25 | |||
26 | #include "pinctrl-imx.h" | ||
27 | |||
28 | enum imx25_pads { | ||
29 | MX25_PAD_RESERVE0 = 1, | ||
30 | MX25_PAD_RESERVE1 = 2, | ||
31 | MX25_PAD_A10 = 3, | ||
32 | MX25_PAD_A13 = 4, | ||
33 | MX25_PAD_A14 = 5, | ||
34 | MX25_PAD_A15 = 6, | ||
35 | MX25_PAD_A16 = 7, | ||
36 | MX25_PAD_A17 = 8, | ||
37 | MX25_PAD_A18 = 9, | ||
38 | MX25_PAD_A19 = 10, | ||
39 | MX25_PAD_A20 = 11, | ||
40 | MX25_PAD_A21 = 12, | ||
41 | MX25_PAD_A22 = 13, | ||
42 | MX25_PAD_A23 = 14, | ||
43 | MX25_PAD_A24 = 15, | ||
44 | MX25_PAD_A25 = 16, | ||
45 | MX25_PAD_EB0 = 17, | ||
46 | MX25_PAD_EB1 = 18, | ||
47 | MX25_PAD_OE = 19, | ||
48 | MX25_PAD_CS0 = 20, | ||
49 | MX25_PAD_CS1 = 21, | ||
50 | MX25_PAD_CS4 = 22, | ||
51 | MX25_PAD_CS5 = 23, | ||
52 | MX25_PAD_NF_CE0 = 24, | ||
53 | MX25_PAD_ECB = 25, | ||
54 | MX25_PAD_LBA = 26, | ||
55 | MX25_PAD_BCLK = 27, | ||
56 | MX25_PAD_RW = 28, | ||
57 | MX25_PAD_NFWE_B = 29, | ||
58 | MX25_PAD_NFRE_B = 30, | ||
59 | MX25_PAD_NFALE = 31, | ||
60 | MX25_PAD_NFCLE = 32, | ||
61 | MX25_PAD_NFWP_B = 33, | ||
62 | MX25_PAD_NFRB = 34, | ||
63 | MX25_PAD_D15 = 35, | ||
64 | MX25_PAD_D14 = 36, | ||
65 | MX25_PAD_D13 = 37, | ||
66 | MX25_PAD_D12 = 38, | ||
67 | MX25_PAD_D11 = 39, | ||
68 | MX25_PAD_D10 = 40, | ||
69 | MX25_PAD_D9 = 41, | ||
70 | MX25_PAD_D8 = 42, | ||
71 | MX25_PAD_D7 = 43, | ||
72 | MX25_PAD_D6 = 44, | ||
73 | MX25_PAD_D5 = 45, | ||
74 | MX25_PAD_D4 = 46, | ||
75 | MX25_PAD_D3 = 47, | ||
76 | MX25_PAD_D2 = 48, | ||
77 | MX25_PAD_D1 = 49, | ||
78 | MX25_PAD_D0 = 50, | ||
79 | MX25_PAD_LD0 = 51, | ||
80 | MX25_PAD_LD1 = 52, | ||
81 | MX25_PAD_LD2 = 53, | ||
82 | MX25_PAD_LD3 = 54, | ||
83 | MX25_PAD_LD4 = 55, | ||
84 | MX25_PAD_LD5 = 56, | ||
85 | MX25_PAD_LD6 = 57, | ||
86 | MX25_PAD_LD7 = 58, | ||
87 | MX25_PAD_LD8 = 59, | ||
88 | MX25_PAD_LD9 = 60, | ||
89 | MX25_PAD_LD10 = 61, | ||
90 | MX25_PAD_LD11 = 62, | ||
91 | MX25_PAD_LD12 = 63, | ||
92 | MX25_PAD_LD13 = 64, | ||
93 | MX25_PAD_LD14 = 65, | ||
94 | MX25_PAD_LD15 = 66, | ||
95 | MX25_PAD_HSYNC = 67, | ||
96 | MX25_PAD_VSYNC = 68, | ||
97 | MX25_PAD_LSCLK = 69, | ||
98 | MX25_PAD_OE_ACD = 70, | ||
99 | MX25_PAD_CONTRAST = 71, | ||
100 | MX25_PAD_PWM = 72, | ||
101 | MX25_PAD_CSI_D2 = 73, | ||
102 | MX25_PAD_CSI_D3 = 74, | ||
103 | MX25_PAD_CSI_D4 = 75, | ||
104 | MX25_PAD_CSI_D5 = 76, | ||
105 | MX25_PAD_CSI_D6 = 77, | ||
106 | MX25_PAD_CSI_D7 = 78, | ||
107 | MX25_PAD_CSI_D8 = 79, | ||
108 | MX25_PAD_CSI_D9 = 80, | ||
109 | MX25_PAD_CSI_MCLK = 81, | ||
110 | MX25_PAD_CSI_VSYNC = 82, | ||
111 | MX25_PAD_CSI_HSYNC = 83, | ||
112 | MX25_PAD_CSI_PIXCLK = 84, | ||
113 | MX25_PAD_I2C1_CLK = 85, | ||
114 | MX25_PAD_I2C1_DAT = 86, | ||
115 | MX25_PAD_CSPI1_MOSI = 87, | ||
116 | MX25_PAD_CSPI1_MISO = 88, | ||
117 | MX25_PAD_CSPI1_SS0 = 89, | ||
118 | MX25_PAD_CSPI1_SS1 = 90, | ||
119 | MX25_PAD_CSPI1_SCLK = 91, | ||
120 | MX25_PAD_CSPI1_RDY = 92, | ||
121 | MX25_PAD_UART1_RXD = 93, | ||
122 | MX25_PAD_UART1_TXD = 94, | ||
123 | MX25_PAD_UART1_RTS = 95, | ||
124 | MX25_PAD_UART1_CTS = 96, | ||
125 | MX25_PAD_UART2_RXD = 97, | ||
126 | MX25_PAD_UART2_TXD = 98, | ||
127 | MX25_PAD_UART2_RTS = 99, | ||
128 | MX25_PAD_UART2_CTS = 100, | ||
129 | MX25_PAD_SD1_CMD = 101, | ||
130 | MX25_PAD_SD1_CLK = 102, | ||
131 | MX25_PAD_SD1_DATA0 = 103, | ||
132 | MX25_PAD_SD1_DATA1 = 104, | ||
133 | MX25_PAD_SD1_DATA2 = 105, | ||
134 | MX25_PAD_SD1_DATA3 = 106, | ||
135 | MX25_PAD_KPP_ROW0 = 107, | ||
136 | MX25_PAD_KPP_ROW1 = 108, | ||
137 | MX25_PAD_KPP_ROW2 = 109, | ||
138 | MX25_PAD_KPP_ROW3 = 110, | ||
139 | MX25_PAD_KPP_COL0 = 111, | ||
140 | MX25_PAD_KPP_COL1 = 112, | ||
141 | MX25_PAD_KPP_COL2 = 113, | ||
142 | MX25_PAD_KPP_COL3 = 114, | ||
143 | MX25_PAD_FEC_MDC = 115, | ||
144 | MX25_PAD_FEC_MDIO = 116, | ||
145 | MX25_PAD_FEC_TDATA0 = 117, | ||
146 | MX25_PAD_FEC_TDATA1 = 118, | ||
147 | MX25_PAD_FEC_TX_EN = 119, | ||
148 | MX25_PAD_FEC_RDATA0 = 120, | ||
149 | MX25_PAD_FEC_RDATA1 = 121, | ||
150 | MX25_PAD_FEC_RX_DV = 122, | ||
151 | MX25_PAD_FEC_TX_CLK = 123, | ||
152 | MX25_PAD_RTCK = 124, | ||
153 | MX25_PAD_DE_B = 125, | ||
154 | MX25_PAD_GPIO_A = 126, | ||
155 | MX25_PAD_GPIO_B = 127, | ||
156 | MX25_PAD_GPIO_C = 128, | ||
157 | MX25_PAD_GPIO_D = 129, | ||
158 | MX25_PAD_GPIO_E = 130, | ||
159 | MX25_PAD_GPIO_F = 131, | ||
160 | MX25_PAD_EXT_ARMCLK = 132, | ||
161 | MX25_PAD_UPLL_BYPCLK = 133, | ||
162 | MX25_PAD_VSTBY_REQ = 134, | ||
163 | MX25_PAD_VSTBY_ACK = 135, | ||
164 | MX25_PAD_POWER_FAIL = 136, | ||
165 | MX25_PAD_CLKO = 137, | ||
166 | MX25_PAD_BOOT_MODE0 = 138, | ||
167 | MX25_PAD_BOOT_MODE1 = 139, | ||
168 | }; | ||
169 | |||
170 | /* Pad names for the pinmux subsystem */ | ||
171 | static const struct pinctrl_pin_desc imx25_pinctrl_pads[] = { | ||
172 | IMX_PINCTRL_PIN(MX25_PAD_RESERVE0), | ||
173 | IMX_PINCTRL_PIN(MX25_PAD_RESERVE1), | ||
174 | IMX_PINCTRL_PIN(MX25_PAD_A10), | ||
175 | IMX_PINCTRL_PIN(MX25_PAD_A13), | ||
176 | IMX_PINCTRL_PIN(MX25_PAD_A14), | ||
177 | IMX_PINCTRL_PIN(MX25_PAD_A15), | ||
178 | IMX_PINCTRL_PIN(MX25_PAD_A16), | ||
179 | IMX_PINCTRL_PIN(MX25_PAD_A17), | ||
180 | IMX_PINCTRL_PIN(MX25_PAD_A18), | ||
181 | IMX_PINCTRL_PIN(MX25_PAD_A19), | ||
182 | IMX_PINCTRL_PIN(MX25_PAD_A20), | ||
183 | IMX_PINCTRL_PIN(MX25_PAD_A21), | ||
184 | IMX_PINCTRL_PIN(MX25_PAD_A22), | ||
185 | IMX_PINCTRL_PIN(MX25_PAD_A23), | ||
186 | IMX_PINCTRL_PIN(MX25_PAD_A24), | ||
187 | IMX_PINCTRL_PIN(MX25_PAD_A25), | ||
188 | IMX_PINCTRL_PIN(MX25_PAD_EB0), | ||
189 | IMX_PINCTRL_PIN(MX25_PAD_EB1), | ||
190 | IMX_PINCTRL_PIN(MX25_PAD_OE), | ||
191 | IMX_PINCTRL_PIN(MX25_PAD_CS0), | ||
192 | IMX_PINCTRL_PIN(MX25_PAD_CS1), | ||
193 | IMX_PINCTRL_PIN(MX25_PAD_CS4), | ||
194 | IMX_PINCTRL_PIN(MX25_PAD_CS5), | ||
195 | IMX_PINCTRL_PIN(MX25_PAD_NF_CE0), | ||
196 | IMX_PINCTRL_PIN(MX25_PAD_ECB), | ||
197 | IMX_PINCTRL_PIN(MX25_PAD_LBA), | ||
198 | IMX_PINCTRL_PIN(MX25_PAD_BCLK), | ||
199 | IMX_PINCTRL_PIN(MX25_PAD_RW), | ||
200 | IMX_PINCTRL_PIN(MX25_PAD_NFWE_B), | ||
201 | IMX_PINCTRL_PIN(MX25_PAD_NFRE_B), | ||
202 | IMX_PINCTRL_PIN(MX25_PAD_NFALE), | ||
203 | IMX_PINCTRL_PIN(MX25_PAD_NFCLE), | ||
204 | IMX_PINCTRL_PIN(MX25_PAD_NFWP_B), | ||
205 | IMX_PINCTRL_PIN(MX25_PAD_NFRB), | ||
206 | IMX_PINCTRL_PIN(MX25_PAD_D15), | ||
207 | IMX_PINCTRL_PIN(MX25_PAD_D14), | ||
208 | IMX_PINCTRL_PIN(MX25_PAD_D13), | ||
209 | IMX_PINCTRL_PIN(MX25_PAD_D12), | ||
210 | IMX_PINCTRL_PIN(MX25_PAD_D11), | ||
211 | IMX_PINCTRL_PIN(MX25_PAD_D10), | ||
212 | IMX_PINCTRL_PIN(MX25_PAD_D9), | ||
213 | IMX_PINCTRL_PIN(MX25_PAD_D8), | ||
214 | IMX_PINCTRL_PIN(MX25_PAD_D7), | ||
215 | IMX_PINCTRL_PIN(MX25_PAD_D6), | ||
216 | IMX_PINCTRL_PIN(MX25_PAD_D5), | ||
217 | IMX_PINCTRL_PIN(MX25_PAD_D4), | ||
218 | IMX_PINCTRL_PIN(MX25_PAD_D3), | ||
219 | IMX_PINCTRL_PIN(MX25_PAD_D2), | ||
220 | IMX_PINCTRL_PIN(MX25_PAD_D1), | ||
221 | IMX_PINCTRL_PIN(MX25_PAD_D0), | ||
222 | IMX_PINCTRL_PIN(MX25_PAD_LD0), | ||
223 | IMX_PINCTRL_PIN(MX25_PAD_LD1), | ||
224 | IMX_PINCTRL_PIN(MX25_PAD_LD2), | ||
225 | IMX_PINCTRL_PIN(MX25_PAD_LD3), | ||
226 | IMX_PINCTRL_PIN(MX25_PAD_LD4), | ||
227 | IMX_PINCTRL_PIN(MX25_PAD_LD5), | ||
228 | IMX_PINCTRL_PIN(MX25_PAD_LD6), | ||
229 | IMX_PINCTRL_PIN(MX25_PAD_LD7), | ||
230 | IMX_PINCTRL_PIN(MX25_PAD_LD8), | ||
231 | IMX_PINCTRL_PIN(MX25_PAD_LD9), | ||
232 | IMX_PINCTRL_PIN(MX25_PAD_LD10), | ||
233 | IMX_PINCTRL_PIN(MX25_PAD_LD11), | ||
234 | IMX_PINCTRL_PIN(MX25_PAD_LD12), | ||
235 | IMX_PINCTRL_PIN(MX25_PAD_LD13), | ||
236 | IMX_PINCTRL_PIN(MX25_PAD_LD14), | ||
237 | IMX_PINCTRL_PIN(MX25_PAD_LD15), | ||
238 | IMX_PINCTRL_PIN(MX25_PAD_HSYNC), | ||
239 | IMX_PINCTRL_PIN(MX25_PAD_VSYNC), | ||
240 | IMX_PINCTRL_PIN(MX25_PAD_LSCLK), | ||
241 | IMX_PINCTRL_PIN(MX25_PAD_OE_ACD), | ||
242 | IMX_PINCTRL_PIN(MX25_PAD_CONTRAST), | ||
243 | IMX_PINCTRL_PIN(MX25_PAD_PWM), | ||
244 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D2), | ||
245 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D3), | ||
246 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D4), | ||
247 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D5), | ||
248 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D6), | ||
249 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D7), | ||
250 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D8), | ||
251 | IMX_PINCTRL_PIN(MX25_PAD_CSI_D9), | ||
252 | IMX_PINCTRL_PIN(MX25_PAD_CSI_MCLK), | ||
253 | IMX_PINCTRL_PIN(MX25_PAD_CSI_VSYNC), | ||
254 | IMX_PINCTRL_PIN(MX25_PAD_CSI_HSYNC), | ||
255 | IMX_PINCTRL_PIN(MX25_PAD_CSI_PIXCLK), | ||
256 | IMX_PINCTRL_PIN(MX25_PAD_I2C1_CLK), | ||
257 | IMX_PINCTRL_PIN(MX25_PAD_I2C1_DAT), | ||
258 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MOSI), | ||
259 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_MISO), | ||
260 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS0), | ||
261 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SS1), | ||
262 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_SCLK), | ||
263 | IMX_PINCTRL_PIN(MX25_PAD_CSPI1_RDY), | ||
264 | IMX_PINCTRL_PIN(MX25_PAD_UART1_RXD), | ||
265 | IMX_PINCTRL_PIN(MX25_PAD_UART1_TXD), | ||
266 | IMX_PINCTRL_PIN(MX25_PAD_UART1_RTS), | ||
267 | IMX_PINCTRL_PIN(MX25_PAD_UART1_CTS), | ||
268 | IMX_PINCTRL_PIN(MX25_PAD_UART2_RXD), | ||
269 | IMX_PINCTRL_PIN(MX25_PAD_UART2_TXD), | ||
270 | IMX_PINCTRL_PIN(MX25_PAD_UART2_RTS), | ||
271 | IMX_PINCTRL_PIN(MX25_PAD_UART2_CTS), | ||
272 | IMX_PINCTRL_PIN(MX25_PAD_SD1_CMD), | ||
273 | IMX_PINCTRL_PIN(MX25_PAD_SD1_CLK), | ||
274 | IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA0), | ||
275 | IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA1), | ||
276 | IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA2), | ||
277 | IMX_PINCTRL_PIN(MX25_PAD_SD1_DATA3), | ||
278 | IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW0), | ||
279 | IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW1), | ||
280 | IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW2), | ||
281 | IMX_PINCTRL_PIN(MX25_PAD_KPP_ROW3), | ||
282 | IMX_PINCTRL_PIN(MX25_PAD_KPP_COL0), | ||
283 | IMX_PINCTRL_PIN(MX25_PAD_KPP_COL1), | ||
284 | IMX_PINCTRL_PIN(MX25_PAD_KPP_COL2), | ||
285 | IMX_PINCTRL_PIN(MX25_PAD_KPP_COL3), | ||
286 | IMX_PINCTRL_PIN(MX25_PAD_FEC_MDC), | ||
287 | IMX_PINCTRL_PIN(MX25_PAD_FEC_MDIO), | ||
288 | IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA0), | ||
289 | IMX_PINCTRL_PIN(MX25_PAD_FEC_TDATA1), | ||
290 | IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_EN), | ||
291 | IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA0), | ||
292 | IMX_PINCTRL_PIN(MX25_PAD_FEC_RDATA1), | ||
293 | IMX_PINCTRL_PIN(MX25_PAD_FEC_RX_DV), | ||
294 | IMX_PINCTRL_PIN(MX25_PAD_FEC_TX_CLK), | ||
295 | IMX_PINCTRL_PIN(MX25_PAD_RTCK), | ||
296 | IMX_PINCTRL_PIN(MX25_PAD_DE_B), | ||
297 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_A), | ||
298 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_B), | ||
299 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_C), | ||
300 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_D), | ||
301 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_E), | ||
302 | IMX_PINCTRL_PIN(MX25_PAD_GPIO_F), | ||
303 | IMX_PINCTRL_PIN(MX25_PAD_EXT_ARMCLK), | ||
304 | IMX_PINCTRL_PIN(MX25_PAD_UPLL_BYPCLK), | ||
305 | IMX_PINCTRL_PIN(MX25_PAD_VSTBY_REQ), | ||
306 | IMX_PINCTRL_PIN(MX25_PAD_VSTBY_ACK), | ||
307 | IMX_PINCTRL_PIN(MX25_PAD_POWER_FAIL), | ||
308 | IMX_PINCTRL_PIN(MX25_PAD_CLKO), | ||
309 | IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE0), | ||
310 | IMX_PINCTRL_PIN(MX25_PAD_BOOT_MODE1), | ||
311 | }; | ||
312 | |||
313 | static struct imx_pinctrl_soc_info imx25_pinctrl_info = { | ||
314 | .pins = imx25_pinctrl_pads, | ||
315 | .npins = ARRAY_SIZE(imx25_pinctrl_pads), | ||
316 | }; | ||
317 | |||
318 | static struct of_device_id imx25_pinctrl_of_match[] = { | ||
319 | { .compatible = "fsl,imx25-iomuxc", }, | ||
320 | { /* sentinel */ } | ||
321 | }; | ||
322 | |||
323 | static int imx25_pinctrl_probe(struct platform_device *pdev) | ||
324 | { | ||
325 | return imx_pinctrl_probe(pdev, &imx25_pinctrl_info); | ||
326 | } | ||
327 | |||
328 | static struct platform_driver imx25_pinctrl_driver = { | ||
329 | .driver = { | ||
330 | .name = "imx25-pinctrl", | ||
331 | .owner = THIS_MODULE, | ||
332 | .of_match_table = of_match_ptr(imx25_pinctrl_of_match), | ||
333 | }, | ||
334 | .probe = imx25_pinctrl_probe, | ||
335 | .remove = imx_pinctrl_remove, | ||
336 | }; | ||
337 | |||
338 | static int __init imx25_pinctrl_init(void) | ||
339 | { | ||
340 | return platform_driver_register(&imx25_pinctrl_driver); | ||
341 | } | ||
342 | arch_initcall(imx25_pinctrl_init); | ||
343 | |||
344 | static void __exit imx25_pinctrl_exit(void) | ||
345 | { | ||
346 | platform_driver_unregister(&imx25_pinctrl_driver); | ||
347 | } | ||
348 | module_exit(imx25_pinctrl_exit); | ||
349 | MODULE_AUTHOR("Denis Carikli <denis@eukrea.com>"); | ||
350 | MODULE_DESCRIPTION("Freescale IMX25 pinctrl driver"); | ||
351 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/pinctrl/pinctrl-msm.c b/drivers/pinctrl/pinctrl-msm.c new file mode 100644 index 000000000000..28b90aba708d --- /dev/null +++ b/drivers/pinctrl/pinctrl-msm.c | |||
@@ -0,0 +1,1028 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, Sony Mobile Communications AB. | ||
3 | * Copyright (c) 2013, The Linux Foundation. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 and | ||
7 | * only version 2 as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/err.h> | ||
16 | #include <linux/irqdomain.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/pinctrl/machine.h> | ||
22 | #include <linux/pinctrl/pinctrl.h> | ||
23 | #include <linux/pinctrl/pinmux.h> | ||
24 | #include <linux/pinctrl/pinconf.h> | ||
25 | #include <linux/pinctrl/pinconf-generic.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/gpio.h> | ||
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/irq.h> | ||
30 | #include <linux/irqchip/chained_irq.h> | ||
31 | #include <linux/of_irq.h> | ||
32 | #include <linux/spinlock.h> | ||
33 | |||
34 | #include "core.h" | ||
35 | #include "pinconf.h" | ||
36 | #include "pinctrl-msm.h" | ||
37 | #include "pinctrl-utils.h" | ||
38 | |||
39 | /** | ||
40 | * struct msm_pinctrl - state for a pinctrl-msm device | ||
41 | * @dev: device handle. | ||
42 | * @pctrl: pinctrl handle. | ||
43 | * @domain: irqdomain handle. | ||
44 | * @chip: gpiochip handle. | ||
45 | * @irq: parent irq for the TLMM irq_chip. | ||
46 | * @lock: Spinlock to protect register resources as well | ||
47 | * as msm_pinctrl data structures. | ||
48 | * @enabled_irqs: Bitmap of currently enabled irqs. | ||
49 | * @dual_edge_irqs: Bitmap of irqs that need sw emulated dual edge | ||
50 | * detection. | ||
51 | * @wake_irqs: Bitmap of irqs with requested as wakeup source. | ||
52 | * @soc; Reference to soc_data of platform specific data. | ||
53 | * @regs: Base address for the TLMM register map. | ||
54 | */ | ||
55 | struct msm_pinctrl { | ||
56 | struct device *dev; | ||
57 | struct pinctrl_dev *pctrl; | ||
58 | struct irq_domain *domain; | ||
59 | struct gpio_chip chip; | ||
60 | unsigned irq; | ||
61 | |||
62 | spinlock_t lock; | ||
63 | |||
64 | unsigned long *enabled_irqs; | ||
65 | unsigned long *dual_edge_irqs; | ||
66 | unsigned long *wake_irqs; | ||
67 | |||
68 | const struct msm_pinctrl_soc_data *soc; | ||
69 | void __iomem *regs; | ||
70 | }; | ||
71 | |||
72 | static int msm_get_groups_count(struct pinctrl_dev *pctldev) | ||
73 | { | ||
74 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
75 | |||
76 | return pctrl->soc->ngroups; | ||
77 | } | ||
78 | |||
79 | static const char *msm_get_group_name(struct pinctrl_dev *pctldev, | ||
80 | unsigned group) | ||
81 | { | ||
82 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
83 | |||
84 | return pctrl->soc->groups[group].name; | ||
85 | } | ||
86 | |||
87 | static int msm_get_group_pins(struct pinctrl_dev *pctldev, | ||
88 | unsigned group, | ||
89 | const unsigned **pins, | ||
90 | unsigned *num_pins) | ||
91 | { | ||
92 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
93 | |||
94 | *pins = pctrl->soc->groups[group].pins; | ||
95 | *num_pins = pctrl->soc->groups[group].npins; | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static struct pinctrl_ops msm_pinctrl_ops = { | ||
100 | .get_groups_count = msm_get_groups_count, | ||
101 | .get_group_name = msm_get_group_name, | ||
102 | .get_group_pins = msm_get_group_pins, | ||
103 | .dt_node_to_map = pinconf_generic_dt_node_to_map_group, | ||
104 | .dt_free_map = pinctrl_utils_dt_free_map, | ||
105 | }; | ||
106 | |||
107 | static int msm_get_functions_count(struct pinctrl_dev *pctldev) | ||
108 | { | ||
109 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
110 | |||
111 | return pctrl->soc->nfunctions; | ||
112 | } | ||
113 | |||
114 | static const char *msm_get_function_name(struct pinctrl_dev *pctldev, | ||
115 | unsigned function) | ||
116 | { | ||
117 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
118 | |||
119 | return pctrl->soc->functions[function].name; | ||
120 | } | ||
121 | |||
122 | static int msm_get_function_groups(struct pinctrl_dev *pctldev, | ||
123 | unsigned function, | ||
124 | const char * const **groups, | ||
125 | unsigned * const num_groups) | ||
126 | { | ||
127 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
128 | |||
129 | *groups = pctrl->soc->functions[function].groups; | ||
130 | *num_groups = pctrl->soc->functions[function].ngroups; | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | static int msm_pinmux_enable(struct pinctrl_dev *pctldev, | ||
135 | unsigned function, | ||
136 | unsigned group) | ||
137 | { | ||
138 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
139 | const struct msm_pingroup *g; | ||
140 | unsigned long flags; | ||
141 | u32 val; | ||
142 | int i; | ||
143 | |||
144 | g = &pctrl->soc->groups[group]; | ||
145 | |||
146 | if (WARN_ON(g->mux_bit < 0)) | ||
147 | return -EINVAL; | ||
148 | |||
149 | for (i = 0; i < ARRAY_SIZE(g->funcs); i++) { | ||
150 | if (g->funcs[i] == function) | ||
151 | break; | ||
152 | } | ||
153 | |||
154 | if (WARN_ON(i == ARRAY_SIZE(g->funcs))) | ||
155 | return -EINVAL; | ||
156 | |||
157 | spin_lock_irqsave(&pctrl->lock, flags); | ||
158 | |||
159 | val = readl(pctrl->regs + g->ctl_reg); | ||
160 | val &= ~(0x7 << g->mux_bit); | ||
161 | val |= i << g->mux_bit; | ||
162 | writel(val, pctrl->regs + g->ctl_reg); | ||
163 | |||
164 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static void msm_pinmux_disable(struct pinctrl_dev *pctldev, | ||
170 | unsigned function, | ||
171 | unsigned group) | ||
172 | { | ||
173 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
174 | const struct msm_pingroup *g; | ||
175 | unsigned long flags; | ||
176 | u32 val; | ||
177 | |||
178 | g = &pctrl->soc->groups[group]; | ||
179 | |||
180 | if (WARN_ON(g->mux_bit < 0)) | ||
181 | return; | ||
182 | |||
183 | spin_lock_irqsave(&pctrl->lock, flags); | ||
184 | |||
185 | /* Clear the mux bits to select gpio mode */ | ||
186 | val = readl(pctrl->regs + g->ctl_reg); | ||
187 | val &= ~(0x7 << g->mux_bit); | ||
188 | writel(val, pctrl->regs + g->ctl_reg); | ||
189 | |||
190 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
191 | } | ||
192 | |||
193 | static struct pinmux_ops msm_pinmux_ops = { | ||
194 | .get_functions_count = msm_get_functions_count, | ||
195 | .get_function_name = msm_get_function_name, | ||
196 | .get_function_groups = msm_get_function_groups, | ||
197 | .enable = msm_pinmux_enable, | ||
198 | .disable = msm_pinmux_disable, | ||
199 | }; | ||
200 | |||
201 | static int msm_config_reg(struct msm_pinctrl *pctrl, | ||
202 | const struct msm_pingroup *g, | ||
203 | unsigned param, | ||
204 | unsigned *reg, | ||
205 | unsigned *mask, | ||
206 | unsigned *bit) | ||
207 | { | ||
208 | switch (param) { | ||
209 | case PIN_CONFIG_BIAS_DISABLE: | ||
210 | *reg = g->ctl_reg; | ||
211 | *bit = g->pull_bit; | ||
212 | *mask = 3; | ||
213 | break; | ||
214 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
215 | *reg = g->ctl_reg; | ||
216 | *bit = g->pull_bit; | ||
217 | *mask = 3; | ||
218 | break; | ||
219 | case PIN_CONFIG_BIAS_PULL_UP: | ||
220 | *reg = g->ctl_reg; | ||
221 | *bit = g->pull_bit; | ||
222 | *mask = 3; | ||
223 | break; | ||
224 | case PIN_CONFIG_DRIVE_STRENGTH: | ||
225 | *reg = g->ctl_reg; | ||
226 | *bit = g->drv_bit; | ||
227 | *mask = 7; | ||
228 | break; | ||
229 | default: | ||
230 | dev_err(pctrl->dev, "Invalid config param %04x\n", param); | ||
231 | return -ENOTSUPP; | ||
232 | } | ||
233 | |||
234 | if (*reg < 0) { | ||
235 | dev_err(pctrl->dev, "Config param %04x not supported on group %s\n", | ||
236 | param, g->name); | ||
237 | return -ENOTSUPP; | ||
238 | } | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static int msm_config_get(struct pinctrl_dev *pctldev, | ||
244 | unsigned int pin, | ||
245 | unsigned long *config) | ||
246 | { | ||
247 | dev_err(pctldev->dev, "pin_config_set op not supported\n"); | ||
248 | return -ENOTSUPP; | ||
249 | } | ||
250 | |||
251 | static int msm_config_set(struct pinctrl_dev *pctldev, unsigned int pin, | ||
252 | unsigned long *configs, unsigned num_configs) | ||
253 | { | ||
254 | dev_err(pctldev->dev, "pin_config_set op not supported\n"); | ||
255 | return -ENOTSUPP; | ||
256 | } | ||
257 | |||
258 | #define MSM_NO_PULL 0 | ||
259 | #define MSM_PULL_DOWN 1 | ||
260 | #define MSM_PULL_UP 3 | ||
261 | |||
262 | static const unsigned msm_regval_to_drive[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; | ||
263 | static const unsigned msm_drive_to_regval[] = { -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, 7 }; | ||
264 | |||
265 | static int msm_config_group_get(struct pinctrl_dev *pctldev, | ||
266 | unsigned int group, | ||
267 | unsigned long *config) | ||
268 | { | ||
269 | const struct msm_pingroup *g; | ||
270 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
271 | unsigned param = pinconf_to_config_param(*config); | ||
272 | unsigned mask; | ||
273 | unsigned arg; | ||
274 | unsigned bit; | ||
275 | unsigned reg; | ||
276 | int ret; | ||
277 | u32 val; | ||
278 | |||
279 | g = &pctrl->soc->groups[group]; | ||
280 | |||
281 | ret = msm_config_reg(pctrl, g, param, ®, &mask, &bit); | ||
282 | if (ret < 0) | ||
283 | return ret; | ||
284 | |||
285 | val = readl(pctrl->regs + reg); | ||
286 | arg = (val >> bit) & mask; | ||
287 | |||
288 | /* Convert register value to pinconf value */ | ||
289 | switch (param) { | ||
290 | case PIN_CONFIG_BIAS_DISABLE: | ||
291 | arg = arg == MSM_NO_PULL; | ||
292 | break; | ||
293 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
294 | arg = arg == MSM_PULL_DOWN; | ||
295 | break; | ||
296 | case PIN_CONFIG_BIAS_PULL_UP: | ||
297 | arg = arg == MSM_PULL_UP; | ||
298 | break; | ||
299 | case PIN_CONFIG_DRIVE_STRENGTH: | ||
300 | arg = msm_regval_to_drive[arg]; | ||
301 | break; | ||
302 | default: | ||
303 | dev_err(pctrl->dev, "Unsupported config parameter: %x\n", | ||
304 | param); | ||
305 | return -EINVAL; | ||
306 | } | ||
307 | |||
308 | *config = pinconf_to_config_packed(param, arg); | ||
309 | |||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | static int msm_config_group_set(struct pinctrl_dev *pctldev, | ||
314 | unsigned group, | ||
315 | unsigned long *configs, | ||
316 | unsigned num_configs) | ||
317 | { | ||
318 | const struct msm_pingroup *g; | ||
319 | struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); | ||
320 | unsigned long flags; | ||
321 | unsigned param; | ||
322 | unsigned mask; | ||
323 | unsigned arg; | ||
324 | unsigned bit; | ||
325 | unsigned reg; | ||
326 | int ret; | ||
327 | u32 val; | ||
328 | int i; | ||
329 | |||
330 | g = &pctrl->soc->groups[group]; | ||
331 | |||
332 | for (i = 0; i < num_configs; i++) { | ||
333 | param = pinconf_to_config_param(configs[i]); | ||
334 | arg = pinconf_to_config_argument(configs[i]); | ||
335 | |||
336 | ret = msm_config_reg(pctrl, g, param, ®, &mask, &bit); | ||
337 | if (ret < 0) | ||
338 | return ret; | ||
339 | |||
340 | /* Convert pinconf values to register values */ | ||
341 | switch (param) { | ||
342 | case PIN_CONFIG_BIAS_DISABLE: | ||
343 | arg = MSM_NO_PULL; | ||
344 | break; | ||
345 | case PIN_CONFIG_BIAS_PULL_DOWN: | ||
346 | arg = MSM_PULL_DOWN; | ||
347 | break; | ||
348 | case PIN_CONFIG_BIAS_PULL_UP: | ||
349 | arg = MSM_PULL_UP; | ||
350 | break; | ||
351 | case PIN_CONFIG_DRIVE_STRENGTH: | ||
352 | /* Check for invalid values */ | ||
353 | if (arg > ARRAY_SIZE(msm_drive_to_regval)) | ||
354 | arg = -1; | ||
355 | else | ||
356 | arg = msm_drive_to_regval[arg]; | ||
357 | break; | ||
358 | default: | ||
359 | dev_err(pctrl->dev, "Unsupported config parameter: %x\n", | ||
360 | param); | ||
361 | return -EINVAL; | ||
362 | } | ||
363 | |||
364 | /* Range-check user-supplied value */ | ||
365 | if (arg & ~mask) { | ||
366 | dev_err(pctrl->dev, "config %x: %x is invalid\n", param, arg); | ||
367 | return -EINVAL; | ||
368 | } | ||
369 | |||
370 | spin_lock_irqsave(&pctrl->lock, flags); | ||
371 | val = readl(pctrl->regs + reg); | ||
372 | val &= ~(mask << bit); | ||
373 | val |= arg << bit; | ||
374 | writel(val, pctrl->regs + reg); | ||
375 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
376 | } | ||
377 | |||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static struct pinconf_ops msm_pinconf_ops = { | ||
382 | .pin_config_get = msm_config_get, | ||
383 | .pin_config_set = msm_config_set, | ||
384 | .pin_config_group_get = msm_config_group_get, | ||
385 | .pin_config_group_set = msm_config_group_set, | ||
386 | }; | ||
387 | |||
388 | static struct pinctrl_desc msm_pinctrl_desc = { | ||
389 | .pctlops = &msm_pinctrl_ops, | ||
390 | .pmxops = &msm_pinmux_ops, | ||
391 | .confops = &msm_pinconf_ops, | ||
392 | .owner = THIS_MODULE, | ||
393 | }; | ||
394 | |||
395 | static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
396 | { | ||
397 | const struct msm_pingroup *g; | ||
398 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
399 | unsigned long flags; | ||
400 | u32 val; | ||
401 | |||
402 | if (WARN_ON(offset >= pctrl->soc->ngroups)) | ||
403 | return -EINVAL; | ||
404 | |||
405 | g = &pctrl->soc->groups[offset]; | ||
406 | |||
407 | if (WARN_ON(g->oe_bit < 0)) | ||
408 | return -EINVAL; | ||
409 | |||
410 | spin_lock_irqsave(&pctrl->lock, flags); | ||
411 | |||
412 | val = readl(pctrl->regs + g->ctl_reg); | ||
413 | val &= ~BIT(g->oe_bit); | ||
414 | writel(val, pctrl->regs + g->ctl_reg); | ||
415 | |||
416 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
417 | |||
418 | return 0; | ||
419 | } | ||
420 | |||
421 | static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) | ||
422 | { | ||
423 | const struct msm_pingroup *g; | ||
424 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
425 | unsigned long flags; | ||
426 | u32 val; | ||
427 | |||
428 | if (WARN_ON(offset >= pctrl->soc->ngroups)) | ||
429 | return -EINVAL; | ||
430 | |||
431 | g = &pctrl->soc->groups[offset]; | ||
432 | |||
433 | if (WARN_ON(g->oe_bit < 0)) | ||
434 | return -EINVAL; | ||
435 | |||
436 | spin_lock_irqsave(&pctrl->lock, flags); | ||
437 | |||
438 | writel(value ? BIT(g->out_bit) : 0, pctrl->regs + g->io_reg); | ||
439 | |||
440 | val = readl(pctrl->regs + g->ctl_reg); | ||
441 | val |= BIT(g->oe_bit); | ||
442 | writel(val, pctrl->regs + g->ctl_reg); | ||
443 | |||
444 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
445 | |||
446 | return 0; | ||
447 | } | ||
448 | |||
449 | static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
450 | { | ||
451 | const struct msm_pingroup *g; | ||
452 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
453 | u32 val; | ||
454 | |||
455 | if (WARN_ON(offset >= pctrl->soc->ngroups)) | ||
456 | return -EINVAL; | ||
457 | |||
458 | g = &pctrl->soc->groups[offset]; | ||
459 | |||
460 | val = readl(pctrl->regs + g->io_reg); | ||
461 | return !!(val & BIT(g->in_bit)); | ||
462 | } | ||
463 | |||
464 | static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | ||
465 | { | ||
466 | const struct msm_pingroup *g; | ||
467 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
468 | unsigned long flags; | ||
469 | u32 val; | ||
470 | |||
471 | if (WARN_ON(offset >= pctrl->soc->ngroups)) | ||
472 | return; | ||
473 | |||
474 | g = &pctrl->soc->groups[offset]; | ||
475 | |||
476 | spin_lock_irqsave(&pctrl->lock, flags); | ||
477 | |||
478 | val = readl(pctrl->regs + g->io_reg); | ||
479 | val |= BIT(g->out_bit); | ||
480 | writel(val, pctrl->regs + g->io_reg); | ||
481 | |||
482 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
483 | } | ||
484 | |||
485 | static int msm_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
486 | { | ||
487 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
488 | |||
489 | return irq_find_mapping(pctrl->domain, offset); | ||
490 | } | ||
491 | |||
492 | static int msm_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
493 | { | ||
494 | int gpio = chip->base + offset; | ||
495 | return pinctrl_request_gpio(gpio); | ||
496 | } | ||
497 | |||
498 | static void msm_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
499 | { | ||
500 | int gpio = chip->base + offset; | ||
501 | return pinctrl_free_gpio(gpio); | ||
502 | } | ||
503 | |||
504 | #ifdef CONFIG_DEBUG_FS | ||
505 | #include <linux/seq_file.h> | ||
506 | |||
507 | static void msm_gpio_dbg_show_one(struct seq_file *s, | ||
508 | struct pinctrl_dev *pctldev, | ||
509 | struct gpio_chip *chip, | ||
510 | unsigned offset, | ||
511 | unsigned gpio) | ||
512 | { | ||
513 | const struct msm_pingroup *g; | ||
514 | struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); | ||
515 | unsigned func; | ||
516 | int is_out; | ||
517 | int drive; | ||
518 | int pull; | ||
519 | u32 ctl_reg; | ||
520 | |||
521 | const char *pulls[] = { | ||
522 | "no pull", | ||
523 | "pull down", | ||
524 | "keeper", | ||
525 | "pull up" | ||
526 | }; | ||
527 | |||
528 | g = &pctrl->soc->groups[offset]; | ||
529 | ctl_reg = readl(pctrl->regs + g->ctl_reg); | ||
530 | |||
531 | is_out = !!(ctl_reg & BIT(g->oe_bit)); | ||
532 | func = (ctl_reg >> g->mux_bit) & 7; | ||
533 | drive = (ctl_reg >> g->drv_bit) & 7; | ||
534 | pull = (ctl_reg >> g->pull_bit) & 3; | ||
535 | |||
536 | seq_printf(s, " %-8s: %-3s %d", g->name, is_out ? "out" : "in", func); | ||
537 | seq_printf(s, " %dmA", msm_regval_to_drive[drive]); | ||
538 | seq_printf(s, " %s", pulls[pull]); | ||
539 | } | ||
540 | |||
541 | static void msm_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | ||
542 | { | ||
543 | unsigned gpio = chip->base; | ||
544 | unsigned i; | ||
545 | |||
546 | for (i = 0; i < chip->ngpio; i++, gpio++) { | ||
547 | msm_gpio_dbg_show_one(s, NULL, chip, i, gpio); | ||
548 | seq_printf(s, "\n"); | ||
549 | } | ||
550 | } | ||
551 | |||
552 | #else | ||
553 | #define msm_gpio_dbg_show NULL | ||
554 | #endif | ||
555 | |||
556 | static struct gpio_chip msm_gpio_template = { | ||
557 | .direction_input = msm_gpio_direction_input, | ||
558 | .direction_output = msm_gpio_direction_output, | ||
559 | .get = msm_gpio_get, | ||
560 | .set = msm_gpio_set, | ||
561 | .to_irq = msm_gpio_to_irq, | ||
562 | .request = msm_gpio_request, | ||
563 | .free = msm_gpio_free, | ||
564 | .dbg_show = msm_gpio_dbg_show, | ||
565 | }; | ||
566 | |||
567 | /* For dual-edge interrupts in software, since some hardware has no | ||
568 | * such support: | ||
569 | * | ||
570 | * At appropriate moments, this function may be called to flip the polarity | ||
571 | * settings of both-edge irq lines to try and catch the next edge. | ||
572 | * | ||
573 | * The attempt is considered successful if: | ||
574 | * - the status bit goes high, indicating that an edge was caught, or | ||
575 | * - the input value of the gpio doesn't change during the attempt. | ||
576 | * If the value changes twice during the process, that would cause the first | ||
577 | * test to fail but would force the second, as two opposite | ||
578 | * transitions would cause a detection no matter the polarity setting. | ||
579 | * | ||
580 | * The do-loop tries to sledge-hammer closed the timing hole between | ||
581 | * the initial value-read and the polarity-write - if the line value changes | ||
582 | * during that window, an interrupt is lost, the new polarity setting is | ||
583 | * incorrect, and the first success test will fail, causing a retry. | ||
584 | * | ||
585 | * Algorithm comes from Google's msmgpio driver. | ||
586 | */ | ||
587 | static void msm_gpio_update_dual_edge_pos(struct msm_pinctrl *pctrl, | ||
588 | const struct msm_pingroup *g, | ||
589 | struct irq_data *d) | ||
590 | { | ||
591 | int loop_limit = 100; | ||
592 | unsigned val, val2, intstat; | ||
593 | unsigned pol; | ||
594 | |||
595 | do { | ||
596 | val = readl(pctrl->regs + g->io_reg) & BIT(g->in_bit); | ||
597 | |||
598 | pol = readl(pctrl->regs + g->intr_cfg_reg); | ||
599 | pol ^= BIT(g->intr_polarity_bit); | ||
600 | writel(pol, pctrl->regs + g->intr_cfg_reg); | ||
601 | |||
602 | val2 = readl(pctrl->regs + g->io_reg) & BIT(g->in_bit); | ||
603 | intstat = readl(pctrl->regs + g->intr_status_reg); | ||
604 | if (intstat || (val == val2)) | ||
605 | return; | ||
606 | } while (loop_limit-- > 0); | ||
607 | dev_err(pctrl->dev, "dual-edge irq failed to stabilize, %#08x != %#08x\n", | ||
608 | val, val2); | ||
609 | } | ||
610 | |||
611 | static void msm_gpio_irq_mask(struct irq_data *d) | ||
612 | { | ||
613 | const struct msm_pingroup *g; | ||
614 | struct msm_pinctrl *pctrl; | ||
615 | unsigned long flags; | ||
616 | u32 val; | ||
617 | |||
618 | pctrl = irq_data_get_irq_chip_data(d); | ||
619 | if (!pctrl) | ||
620 | return; | ||
621 | |||
622 | if (WARN_ON(d->hwirq >= pctrl->soc->ngroups)) | ||
623 | return; | ||
624 | |||
625 | g = &pctrl->soc->groups[d->hwirq]; | ||
626 | |||
627 | spin_lock_irqsave(&pctrl->lock, flags); | ||
628 | |||
629 | val = readl(pctrl->regs + g->intr_cfg_reg); | ||
630 | val &= ~BIT(g->intr_enable_bit); | ||
631 | writel(val, pctrl->regs + g->intr_cfg_reg); | ||
632 | |||
633 | clear_bit(d->hwirq, pctrl->enabled_irqs); | ||
634 | |||
635 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
636 | } | ||
637 | |||
638 | static void msm_gpio_irq_unmask(struct irq_data *d) | ||
639 | { | ||
640 | const struct msm_pingroup *g; | ||
641 | struct msm_pinctrl *pctrl; | ||
642 | unsigned long flags; | ||
643 | u32 val; | ||
644 | |||
645 | pctrl = irq_data_get_irq_chip_data(d); | ||
646 | if (!pctrl) | ||
647 | return; | ||
648 | |||
649 | if (WARN_ON(d->hwirq >= pctrl->soc->ngroups)) | ||
650 | return; | ||
651 | |||
652 | g = &pctrl->soc->groups[d->hwirq]; | ||
653 | |||
654 | spin_lock_irqsave(&pctrl->lock, flags); | ||
655 | |||
656 | val = readl(pctrl->regs + g->intr_status_reg); | ||
657 | val &= ~BIT(g->intr_status_bit); | ||
658 | writel(val, pctrl->regs + g->intr_status_reg); | ||
659 | |||
660 | val = readl(pctrl->regs + g->intr_cfg_reg); | ||
661 | val |= BIT(g->intr_enable_bit); | ||
662 | writel(val, pctrl->regs + g->intr_cfg_reg); | ||
663 | |||
664 | set_bit(d->hwirq, pctrl->enabled_irqs); | ||
665 | |||
666 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
667 | } | ||
668 | |||
669 | static void msm_gpio_irq_ack(struct irq_data *d) | ||
670 | { | ||
671 | const struct msm_pingroup *g; | ||
672 | struct msm_pinctrl *pctrl; | ||
673 | unsigned long flags; | ||
674 | u32 val; | ||
675 | |||
676 | pctrl = irq_data_get_irq_chip_data(d); | ||
677 | if (!pctrl) | ||
678 | return; | ||
679 | |||
680 | if (WARN_ON(d->hwirq >= pctrl->soc->ngroups)) | ||
681 | return; | ||
682 | |||
683 | g = &pctrl->soc->groups[d->hwirq]; | ||
684 | |||
685 | spin_lock_irqsave(&pctrl->lock, flags); | ||
686 | |||
687 | val = readl(pctrl->regs + g->intr_status_reg); | ||
688 | val &= ~BIT(g->intr_status_bit); | ||
689 | writel(val, pctrl->regs + g->intr_status_reg); | ||
690 | |||
691 | if (test_bit(d->hwirq, pctrl->dual_edge_irqs)) | ||
692 | msm_gpio_update_dual_edge_pos(pctrl, g, d); | ||
693 | |||
694 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
695 | } | ||
696 | |||
697 | #define INTR_TARGET_PROC_APPS 4 | ||
698 | |||
699 | static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) | ||
700 | { | ||
701 | const struct msm_pingroup *g; | ||
702 | struct msm_pinctrl *pctrl; | ||
703 | unsigned long flags; | ||
704 | u32 val; | ||
705 | |||
706 | pctrl = irq_data_get_irq_chip_data(d); | ||
707 | if (!pctrl) | ||
708 | return -EINVAL; | ||
709 | |||
710 | if (WARN_ON(d->hwirq >= pctrl->soc->ngroups)) | ||
711 | return -EINVAL; | ||
712 | |||
713 | g = &pctrl->soc->groups[d->hwirq]; | ||
714 | |||
715 | spin_lock_irqsave(&pctrl->lock, flags); | ||
716 | |||
717 | /* | ||
718 | * For hw without possibility of detecting both edges | ||
719 | */ | ||
720 | if (g->intr_detection_width == 1 && type == IRQ_TYPE_EDGE_BOTH) | ||
721 | set_bit(d->hwirq, pctrl->dual_edge_irqs); | ||
722 | else | ||
723 | clear_bit(d->hwirq, pctrl->dual_edge_irqs); | ||
724 | |||
725 | /* Route interrupts to application cpu */ | ||
726 | val = readl(pctrl->regs + g->intr_target_reg); | ||
727 | val &= ~(7 << g->intr_target_bit); | ||
728 | val |= INTR_TARGET_PROC_APPS << g->intr_target_bit; | ||
729 | writel(val, pctrl->regs + g->intr_target_reg); | ||
730 | |||
731 | /* Update configuration for gpio. | ||
732 | * RAW_STATUS_EN is left on for all gpio irqs. Due to the | ||
733 | * internal circuitry of TLMM, toggling the RAW_STATUS | ||
734 | * could cause the INTR_STATUS to be set for EDGE interrupts. | ||
735 | */ | ||
736 | val = readl(pctrl->regs + g->intr_cfg_reg); | ||
737 | val |= BIT(g->intr_raw_status_bit); | ||
738 | if (g->intr_detection_width == 2) { | ||
739 | val &= ~(3 << g->intr_detection_bit); | ||
740 | val &= ~(1 << g->intr_polarity_bit); | ||
741 | switch (type) { | ||
742 | case IRQ_TYPE_EDGE_RISING: | ||
743 | val |= 1 << g->intr_detection_bit; | ||
744 | val |= BIT(g->intr_polarity_bit); | ||
745 | break; | ||
746 | case IRQ_TYPE_EDGE_FALLING: | ||
747 | val |= 2 << g->intr_detection_bit; | ||
748 | val |= BIT(g->intr_polarity_bit); | ||
749 | break; | ||
750 | case IRQ_TYPE_EDGE_BOTH: | ||
751 | val |= 3 << g->intr_detection_bit; | ||
752 | val |= BIT(g->intr_polarity_bit); | ||
753 | break; | ||
754 | case IRQ_TYPE_LEVEL_LOW: | ||
755 | break; | ||
756 | case IRQ_TYPE_LEVEL_HIGH: | ||
757 | val |= BIT(g->intr_polarity_bit); | ||
758 | break; | ||
759 | } | ||
760 | } else if (g->intr_detection_width == 1) { | ||
761 | val &= ~(1 << g->intr_detection_bit); | ||
762 | val &= ~(1 << g->intr_polarity_bit); | ||
763 | switch (type) { | ||
764 | case IRQ_TYPE_EDGE_RISING: | ||
765 | val |= BIT(g->intr_detection_bit); | ||
766 | val |= BIT(g->intr_polarity_bit); | ||
767 | break; | ||
768 | case IRQ_TYPE_EDGE_FALLING: | ||
769 | val |= BIT(g->intr_detection_bit); | ||
770 | break; | ||
771 | case IRQ_TYPE_EDGE_BOTH: | ||
772 | val |= BIT(g->intr_detection_bit); | ||
773 | break; | ||
774 | case IRQ_TYPE_LEVEL_LOW: | ||
775 | break; | ||
776 | case IRQ_TYPE_LEVEL_HIGH: | ||
777 | val |= BIT(g->intr_polarity_bit); | ||
778 | break; | ||
779 | } | ||
780 | } else { | ||
781 | BUG(); | ||
782 | } | ||
783 | writel(val, pctrl->regs + g->intr_cfg_reg); | ||
784 | |||
785 | if (test_bit(d->hwirq, pctrl->dual_edge_irqs)) | ||
786 | msm_gpio_update_dual_edge_pos(pctrl, g, d); | ||
787 | |||
788 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
789 | |||
790 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | ||
791 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
792 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | ||
793 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
794 | |||
795 | return 0; | ||
796 | } | ||
797 | |||
798 | static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) | ||
799 | { | ||
800 | struct msm_pinctrl *pctrl; | ||
801 | unsigned long flags; | ||
802 | unsigned ngpio; | ||
803 | |||
804 | pctrl = irq_data_get_irq_chip_data(d); | ||
805 | if (!pctrl) | ||
806 | return -EINVAL; | ||
807 | |||
808 | ngpio = pctrl->chip.ngpio; | ||
809 | |||
810 | spin_lock_irqsave(&pctrl->lock, flags); | ||
811 | |||
812 | if (on) { | ||
813 | if (bitmap_empty(pctrl->wake_irqs, ngpio)) | ||
814 | enable_irq_wake(pctrl->irq); | ||
815 | set_bit(d->hwirq, pctrl->wake_irqs); | ||
816 | } else { | ||
817 | clear_bit(d->hwirq, pctrl->wake_irqs); | ||
818 | if (bitmap_empty(pctrl->wake_irqs, ngpio)) | ||
819 | disable_irq_wake(pctrl->irq); | ||
820 | } | ||
821 | |||
822 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | |||
827 | static unsigned int msm_gpio_irq_startup(struct irq_data *d) | ||
828 | { | ||
829 | struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d); | ||
830 | |||
831 | if (gpio_lock_as_irq(&pctrl->chip, d->hwirq)) { | ||
832 | dev_err(pctrl->dev, "unable to lock HW IRQ %lu for IRQ\n", | ||
833 | d->hwirq); | ||
834 | } | ||
835 | msm_gpio_irq_unmask(d); | ||
836 | return 0; | ||
837 | } | ||
838 | |||
839 | static void msm_gpio_irq_shutdown(struct irq_data *d) | ||
840 | { | ||
841 | struct msm_pinctrl *pctrl = irq_data_get_irq_chip_data(d); | ||
842 | |||
843 | msm_gpio_irq_mask(d); | ||
844 | gpio_unlock_as_irq(&pctrl->chip, d->hwirq); | ||
845 | } | ||
846 | |||
847 | static struct irq_chip msm_gpio_irq_chip = { | ||
848 | .name = "msmgpio", | ||
849 | .irq_mask = msm_gpio_irq_mask, | ||
850 | .irq_unmask = msm_gpio_irq_unmask, | ||
851 | .irq_ack = msm_gpio_irq_ack, | ||
852 | .irq_set_type = msm_gpio_irq_set_type, | ||
853 | .irq_set_wake = msm_gpio_irq_set_wake, | ||
854 | .irq_startup = msm_gpio_irq_startup, | ||
855 | .irq_shutdown = msm_gpio_irq_shutdown, | ||
856 | }; | ||
857 | |||
858 | static void msm_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) | ||
859 | { | ||
860 | const struct msm_pingroup *g; | ||
861 | struct msm_pinctrl *pctrl = irq_desc_get_handler_data(desc); | ||
862 | struct irq_chip *chip = irq_get_chip(irq); | ||
863 | int irq_pin; | ||
864 | int handled = 0; | ||
865 | u32 val; | ||
866 | int i; | ||
867 | |||
868 | chained_irq_enter(chip, desc); | ||
869 | |||
870 | /* | ||
871 | * Each pin have it's own IRQ status register, so use | ||
872 | * enabled_irq bitmap to limit the number of reads. | ||
873 | */ | ||
874 | for_each_set_bit(i, pctrl->enabled_irqs, pctrl->chip.ngpio) { | ||
875 | g = &pctrl->soc->groups[i]; | ||
876 | val = readl(pctrl->regs + g->intr_status_reg); | ||
877 | if (val & BIT(g->intr_status_bit)) { | ||
878 | irq_pin = irq_find_mapping(pctrl->domain, i); | ||
879 | generic_handle_irq(irq_pin); | ||
880 | handled++; | ||
881 | } | ||
882 | } | ||
883 | |||
884 | /* No interrutps where flagged */ | ||
885 | if (handled == 0) | ||
886 | handle_bad_irq(irq, desc); | ||
887 | |||
888 | chained_irq_exit(chip, desc); | ||
889 | } | ||
890 | |||
891 | static int msm_gpio_init(struct msm_pinctrl *pctrl) | ||
892 | { | ||
893 | struct gpio_chip *chip; | ||
894 | int irq; | ||
895 | int ret; | ||
896 | int i; | ||
897 | int r; | ||
898 | |||
899 | chip = &pctrl->chip; | ||
900 | chip->base = 0; | ||
901 | chip->ngpio = pctrl->soc->ngpios; | ||
902 | chip->label = dev_name(pctrl->dev); | ||
903 | chip->dev = pctrl->dev; | ||
904 | chip->owner = THIS_MODULE; | ||
905 | chip->of_node = pctrl->dev->of_node; | ||
906 | |||
907 | pctrl->enabled_irqs = devm_kzalloc(pctrl->dev, | ||
908 | sizeof(unsigned long) * BITS_TO_LONGS(chip->ngpio), | ||
909 | GFP_KERNEL); | ||
910 | if (!pctrl->enabled_irqs) { | ||
911 | dev_err(pctrl->dev, "Failed to allocate enabled_irqs bitmap\n"); | ||
912 | return -ENOMEM; | ||
913 | } | ||
914 | |||
915 | pctrl->dual_edge_irqs = devm_kzalloc(pctrl->dev, | ||
916 | sizeof(unsigned long) * BITS_TO_LONGS(chip->ngpio), | ||
917 | GFP_KERNEL); | ||
918 | if (!pctrl->dual_edge_irqs) { | ||
919 | dev_err(pctrl->dev, "Failed to allocate dual_edge_irqs bitmap\n"); | ||
920 | return -ENOMEM; | ||
921 | } | ||
922 | |||
923 | pctrl->wake_irqs = devm_kzalloc(pctrl->dev, | ||
924 | sizeof(unsigned long) * BITS_TO_LONGS(chip->ngpio), | ||
925 | GFP_KERNEL); | ||
926 | if (!pctrl->wake_irqs) { | ||
927 | dev_err(pctrl->dev, "Failed to allocate wake_irqs bitmap\n"); | ||
928 | return -ENOMEM; | ||
929 | } | ||
930 | |||
931 | ret = gpiochip_add(&pctrl->chip); | ||
932 | if (ret) { | ||
933 | dev_err(pctrl->dev, "Failed register gpiochip\n"); | ||
934 | return ret; | ||
935 | } | ||
936 | |||
937 | ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), 0, 0, chip->ngpio); | ||
938 | if (ret) { | ||
939 | dev_err(pctrl->dev, "Failed to add pin range\n"); | ||
940 | return ret; | ||
941 | } | ||
942 | |||
943 | pctrl->domain = irq_domain_add_linear(pctrl->dev->of_node, chip->ngpio, | ||
944 | &irq_domain_simple_ops, NULL); | ||
945 | if (!pctrl->domain) { | ||
946 | dev_err(pctrl->dev, "Failed to register irq domain\n"); | ||
947 | r = gpiochip_remove(&pctrl->chip); | ||
948 | return -ENOSYS; | ||
949 | } | ||
950 | |||
951 | for (i = 0; i < chip->ngpio; i++) { | ||
952 | irq = irq_create_mapping(pctrl->domain, i); | ||
953 | irq_set_chip_and_handler(irq, &msm_gpio_irq_chip, handle_edge_irq); | ||
954 | irq_set_chip_data(irq, pctrl); | ||
955 | } | ||
956 | |||
957 | irq_set_handler_data(pctrl->irq, pctrl); | ||
958 | irq_set_chained_handler(pctrl->irq, msm_gpio_irq_handler); | ||
959 | |||
960 | return 0; | ||
961 | } | ||
962 | |||
963 | int msm_pinctrl_probe(struct platform_device *pdev, | ||
964 | const struct msm_pinctrl_soc_data *soc_data) | ||
965 | { | ||
966 | struct msm_pinctrl *pctrl; | ||
967 | struct resource *res; | ||
968 | int ret; | ||
969 | |||
970 | pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); | ||
971 | if (!pctrl) { | ||
972 | dev_err(&pdev->dev, "Can't allocate msm_pinctrl\n"); | ||
973 | return -ENOMEM; | ||
974 | } | ||
975 | pctrl->dev = &pdev->dev; | ||
976 | pctrl->soc = soc_data; | ||
977 | pctrl->chip = msm_gpio_template; | ||
978 | |||
979 | spin_lock_init(&pctrl->lock); | ||
980 | |||
981 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
982 | pctrl->regs = devm_ioremap_resource(&pdev->dev, res); | ||
983 | if (IS_ERR(pctrl->regs)) | ||
984 | return PTR_ERR(pctrl->regs); | ||
985 | |||
986 | pctrl->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); | ||
987 | if (pctrl->irq < 0) { | ||
988 | dev_err(&pdev->dev, "No interrupt defined for msmgpio\n"); | ||
989 | return pctrl->irq; | ||
990 | } | ||
991 | |||
992 | msm_pinctrl_desc.name = dev_name(&pdev->dev); | ||
993 | msm_pinctrl_desc.pins = pctrl->soc->pins; | ||
994 | msm_pinctrl_desc.npins = pctrl->soc->npins; | ||
995 | pctrl->pctrl = pinctrl_register(&msm_pinctrl_desc, &pdev->dev, pctrl); | ||
996 | if (!pctrl->pctrl) { | ||
997 | dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); | ||
998 | return -ENODEV; | ||
999 | } | ||
1000 | |||
1001 | ret = msm_gpio_init(pctrl); | ||
1002 | if (ret) { | ||
1003 | pinctrl_unregister(pctrl->pctrl); | ||
1004 | return ret; | ||
1005 | } | ||
1006 | |||
1007 | platform_set_drvdata(pdev, pctrl); | ||
1008 | |||
1009 | dev_dbg(&pdev->dev, "Probed Qualcomm pinctrl driver\n"); | ||
1010 | |||
1011 | return 0; | ||
1012 | } | ||
1013 | EXPORT_SYMBOL(msm_pinctrl_probe); | ||
1014 | |||
1015 | int msm_pinctrl_remove(struct platform_device *pdev) | ||
1016 | { | ||
1017 | struct msm_pinctrl *pctrl = platform_get_drvdata(pdev); | ||
1018 | int ret; | ||
1019 | |||
1020 | irq_set_chained_handler(pctrl->irq, NULL); | ||
1021 | irq_domain_remove(pctrl->domain); | ||
1022 | ret = gpiochip_remove(&pctrl->chip); | ||
1023 | pinctrl_unregister(pctrl->pctrl); | ||
1024 | |||
1025 | return 0; | ||
1026 | } | ||
1027 | EXPORT_SYMBOL(msm_pinctrl_remove); | ||
1028 | |||
diff --git a/drivers/pinctrl/pinctrl-msm.h b/drivers/pinctrl/pinctrl-msm.h new file mode 100644 index 000000000000..206e782e2daa --- /dev/null +++ b/drivers/pinctrl/pinctrl-msm.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, Sony Mobile Communications AB. | ||
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 and | ||
6 | * only version 2 as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | #ifndef __PINCTRL_MSM_H__ | ||
14 | #define __PINCTRL_MSM_H__ | ||
15 | |||
16 | #include <linux/pinctrl/pinctrl.h> | ||
17 | #include <linux/pinctrl/pinmux.h> | ||
18 | #include <linux/pinctrl/pinconf.h> | ||
19 | #include <linux/pinctrl/machine.h> | ||
20 | |||
21 | /** | ||
22 | * struct msm_function - a pinmux function | ||
23 | * @name: Name of the pinmux function. | ||
24 | * @groups: List of pingroups for this function. | ||
25 | * @ngroups: Number of entries in @groups. | ||
26 | */ | ||
27 | struct msm_function { | ||
28 | const char *name; | ||
29 | const char * const *groups; | ||
30 | unsigned ngroups; | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * struct msm_pingroup - Qualcomm pingroup definition | ||
35 | * @name: Name of the pingroup. | ||
36 | * @pins: A list of pins assigned to this pingroup. | ||
37 | * @npins: Number of entries in @pins. | ||
38 | * @funcs: A list of pinmux functions that can be selected for | ||
39 | * this group. The index of the selected function is used | ||
40 | * for programming the function selector. | ||
41 | * Entries should be indices into the groups list of the | ||
42 | * struct msm_pinctrl_soc_data. | ||
43 | * @ctl_reg: Offset of the register holding control bits for this group. | ||
44 | * @io_reg: Offset of the register holding input/output bits for this group. | ||
45 | * @intr_cfg_reg: Offset of the register holding interrupt configuration bits. | ||
46 | * @intr_status_reg: Offset of the register holding the status bits for this group. | ||
47 | * @intr_target_reg: Offset of the register specifying routing of the interrupts | ||
48 | * from this group. | ||
49 | * @mux_bit: Offset in @ctl_reg for the pinmux function selection. | ||
50 | * @pull_bit: Offset in @ctl_reg for the bias configuration. | ||
51 | * @drv_bit: Offset in @ctl_reg for the drive strength configuration. | ||
52 | * @oe_bit: Offset in @ctl_reg for controlling output enable. | ||
53 | * @in_bit: Offset in @io_reg for the input bit value. | ||
54 | * @out_bit: Offset in @io_reg for the output bit value. | ||
55 | * @intr_enable_bit: Offset in @intr_cfg_reg for enabling the interrupt for this group. | ||
56 | * @intr_status_bit: Offset in @intr_status_reg for reading and acking the interrupt | ||
57 | * status. | ||
58 | * @intr_target_bit: Offset in @intr_target_reg for configuring the interrupt routing. | ||
59 | * @intr_raw_status_bit: Offset in @intr_cfg_reg for the raw status bit. | ||
60 | * @intr_polarity_bit: Offset in @intr_cfg_reg for specifying polarity of the interrupt. | ||
61 | * @intr_detection_bit: Offset in @intr_cfg_reg for specifying interrupt type. | ||
62 | * @intr_detection_width: Number of bits used for specifying interrupt type, | ||
63 | * Should be 2 for SoCs that can detect both edges in hardware, | ||
64 | * otherwise 1. | ||
65 | */ | ||
66 | struct msm_pingroup { | ||
67 | const char *name; | ||
68 | const unsigned *pins; | ||
69 | unsigned npins; | ||
70 | |||
71 | unsigned funcs[8]; | ||
72 | |||
73 | s16 ctl_reg; | ||
74 | s16 io_reg; | ||
75 | s16 intr_cfg_reg; | ||
76 | s16 intr_status_reg; | ||
77 | s16 intr_target_reg; | ||
78 | |||
79 | unsigned mux_bit:5; | ||
80 | |||
81 | unsigned pull_bit:5; | ||
82 | unsigned drv_bit:5; | ||
83 | |||
84 | unsigned oe_bit:5; | ||
85 | unsigned in_bit:5; | ||
86 | unsigned out_bit:5; | ||
87 | |||
88 | unsigned intr_enable_bit:5; | ||
89 | unsigned intr_status_bit:5; | ||
90 | |||
91 | unsigned intr_target_bit:5; | ||
92 | unsigned intr_raw_status_bit:5; | ||
93 | unsigned intr_polarity_bit:5; | ||
94 | unsigned intr_detection_bit:5; | ||
95 | unsigned intr_detection_width:5; | ||
96 | }; | ||
97 | |||
98 | /** | ||
99 | * struct msm_pinctrl_soc_data - Qualcomm pin controller driver configuration | ||
100 | * @pins: An array describing all pins the pin controller affects. | ||
101 | * @npins: The number of entries in @pins. | ||
102 | * @functions: An array describing all mux functions the SoC supports. | ||
103 | * @nfunctions: The number of entries in @functions. | ||
104 | * @groups: An array describing all pin groups the pin SoC supports. | ||
105 | * @ngroups: The numbmer of entries in @groups. | ||
106 | * @ngpio: The number of pingroups the driver should expose as GPIOs. | ||
107 | */ | ||
108 | struct msm_pinctrl_soc_data { | ||
109 | const struct pinctrl_pin_desc *pins; | ||
110 | unsigned npins; | ||
111 | const struct msm_function *functions; | ||
112 | unsigned nfunctions; | ||
113 | const struct msm_pingroup *groups; | ||
114 | unsigned ngroups; | ||
115 | unsigned ngpios; | ||
116 | }; | ||
117 | |||
118 | int msm_pinctrl_probe(struct platform_device *pdev, | ||
119 | const struct msm_pinctrl_soc_data *soc_data); | ||
120 | int msm_pinctrl_remove(struct platform_device *pdev); | ||
121 | |||
122 | #endif | ||
diff --git a/drivers/pinctrl/pinctrl-msm8x74.c b/drivers/pinctrl/pinctrl-msm8x74.c new file mode 100644 index 000000000000..762552bc53b9 --- /dev/null +++ b/drivers/pinctrl/pinctrl-msm8x74.c | |||
@@ -0,0 +1,636 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, Sony Mobile Communications AB. | ||
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 and | ||
6 | * only version 2 as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/pinctrl/pinctrl.h> | ||
18 | #include <linux/pinctrl/pinmux.h> | ||
19 | |||
20 | #include "pinctrl-msm.h" | ||
21 | |||
22 | static const struct pinctrl_pin_desc msm8x74_pins[] = { | ||
23 | PINCTRL_PIN(0, "GPIO_0"), | ||
24 | PINCTRL_PIN(1, "GPIO_1"), | ||
25 | PINCTRL_PIN(2, "GPIO_2"), | ||
26 | PINCTRL_PIN(3, "GPIO_3"), | ||
27 | PINCTRL_PIN(4, "GPIO_4"), | ||
28 | PINCTRL_PIN(5, "GPIO_5"), | ||
29 | PINCTRL_PIN(6, "GPIO_6"), | ||
30 | PINCTRL_PIN(7, "GPIO_7"), | ||
31 | PINCTRL_PIN(8, "GPIO_8"), | ||
32 | PINCTRL_PIN(9, "GPIO_9"), | ||
33 | PINCTRL_PIN(10, "GPIO_10"), | ||
34 | PINCTRL_PIN(11, "GPIO_11"), | ||
35 | PINCTRL_PIN(12, "GPIO_12"), | ||
36 | PINCTRL_PIN(13, "GPIO_13"), | ||
37 | PINCTRL_PIN(14, "GPIO_14"), | ||
38 | PINCTRL_PIN(15, "GPIO_15"), | ||
39 | PINCTRL_PIN(16, "GPIO_16"), | ||
40 | PINCTRL_PIN(17, "GPIO_17"), | ||
41 | PINCTRL_PIN(18, "GPIO_18"), | ||
42 | PINCTRL_PIN(19, "GPIO_19"), | ||
43 | PINCTRL_PIN(20, "GPIO_20"), | ||
44 | PINCTRL_PIN(21, "GPIO_21"), | ||
45 | PINCTRL_PIN(22, "GPIO_22"), | ||
46 | PINCTRL_PIN(23, "GPIO_23"), | ||
47 | PINCTRL_PIN(24, "GPIO_24"), | ||
48 | PINCTRL_PIN(25, "GPIO_25"), | ||
49 | PINCTRL_PIN(26, "GPIO_26"), | ||
50 | PINCTRL_PIN(27, "GPIO_27"), | ||
51 | PINCTRL_PIN(28, "GPIO_28"), | ||
52 | PINCTRL_PIN(29, "GPIO_29"), | ||
53 | PINCTRL_PIN(30, "GPIO_30"), | ||
54 | PINCTRL_PIN(31, "GPIO_31"), | ||
55 | PINCTRL_PIN(32, "GPIO_32"), | ||
56 | PINCTRL_PIN(33, "GPIO_33"), | ||
57 | PINCTRL_PIN(34, "GPIO_34"), | ||
58 | PINCTRL_PIN(35, "GPIO_35"), | ||
59 | PINCTRL_PIN(36, "GPIO_36"), | ||
60 | PINCTRL_PIN(37, "GPIO_37"), | ||
61 | PINCTRL_PIN(38, "GPIO_38"), | ||
62 | PINCTRL_PIN(39, "GPIO_39"), | ||
63 | PINCTRL_PIN(40, "GPIO_40"), | ||
64 | PINCTRL_PIN(41, "GPIO_41"), | ||
65 | PINCTRL_PIN(42, "GPIO_42"), | ||
66 | PINCTRL_PIN(43, "GPIO_43"), | ||
67 | PINCTRL_PIN(44, "GPIO_44"), | ||
68 | PINCTRL_PIN(45, "GPIO_45"), | ||
69 | PINCTRL_PIN(46, "GPIO_46"), | ||
70 | PINCTRL_PIN(47, "GPIO_47"), | ||
71 | PINCTRL_PIN(48, "GPIO_48"), | ||
72 | PINCTRL_PIN(49, "GPIO_49"), | ||
73 | PINCTRL_PIN(50, "GPIO_50"), | ||
74 | PINCTRL_PIN(51, "GPIO_51"), | ||
75 | PINCTRL_PIN(52, "GPIO_52"), | ||
76 | PINCTRL_PIN(53, "GPIO_53"), | ||
77 | PINCTRL_PIN(54, "GPIO_54"), | ||
78 | PINCTRL_PIN(55, "GPIO_55"), | ||
79 | PINCTRL_PIN(56, "GPIO_56"), | ||
80 | PINCTRL_PIN(57, "GPIO_57"), | ||
81 | PINCTRL_PIN(58, "GPIO_58"), | ||
82 | PINCTRL_PIN(59, "GPIO_59"), | ||
83 | PINCTRL_PIN(60, "GPIO_60"), | ||
84 | PINCTRL_PIN(61, "GPIO_61"), | ||
85 | PINCTRL_PIN(62, "GPIO_62"), | ||
86 | PINCTRL_PIN(63, "GPIO_63"), | ||
87 | PINCTRL_PIN(64, "GPIO_64"), | ||
88 | PINCTRL_PIN(65, "GPIO_65"), | ||
89 | PINCTRL_PIN(66, "GPIO_66"), | ||
90 | PINCTRL_PIN(67, "GPIO_67"), | ||
91 | PINCTRL_PIN(68, "GPIO_68"), | ||
92 | PINCTRL_PIN(69, "GPIO_69"), | ||
93 | PINCTRL_PIN(70, "GPIO_70"), | ||
94 | PINCTRL_PIN(71, "GPIO_71"), | ||
95 | PINCTRL_PIN(72, "GPIO_72"), | ||
96 | PINCTRL_PIN(73, "GPIO_73"), | ||
97 | PINCTRL_PIN(74, "GPIO_74"), | ||
98 | PINCTRL_PIN(75, "GPIO_75"), | ||
99 | PINCTRL_PIN(76, "GPIO_76"), | ||
100 | PINCTRL_PIN(77, "GPIO_77"), | ||
101 | PINCTRL_PIN(78, "GPIO_78"), | ||
102 | PINCTRL_PIN(79, "GPIO_79"), | ||
103 | PINCTRL_PIN(80, "GPIO_80"), | ||
104 | PINCTRL_PIN(81, "GPIO_81"), | ||
105 | PINCTRL_PIN(82, "GPIO_82"), | ||
106 | PINCTRL_PIN(83, "GPIO_83"), | ||
107 | PINCTRL_PIN(84, "GPIO_84"), | ||
108 | PINCTRL_PIN(85, "GPIO_85"), | ||
109 | PINCTRL_PIN(86, "GPIO_86"), | ||
110 | PINCTRL_PIN(87, "GPIO_87"), | ||
111 | PINCTRL_PIN(88, "GPIO_88"), | ||
112 | PINCTRL_PIN(89, "GPIO_89"), | ||
113 | PINCTRL_PIN(90, "GPIO_90"), | ||
114 | PINCTRL_PIN(91, "GPIO_91"), | ||
115 | PINCTRL_PIN(92, "GPIO_92"), | ||
116 | PINCTRL_PIN(93, "GPIO_93"), | ||
117 | PINCTRL_PIN(94, "GPIO_94"), | ||
118 | PINCTRL_PIN(95, "GPIO_95"), | ||
119 | PINCTRL_PIN(96, "GPIO_96"), | ||
120 | PINCTRL_PIN(97, "GPIO_97"), | ||
121 | PINCTRL_PIN(98, "GPIO_98"), | ||
122 | PINCTRL_PIN(99, "GPIO_99"), | ||
123 | PINCTRL_PIN(100, "GPIO_100"), | ||
124 | PINCTRL_PIN(101, "GPIO_101"), | ||
125 | PINCTRL_PIN(102, "GPIO_102"), | ||
126 | PINCTRL_PIN(103, "GPIO_103"), | ||
127 | PINCTRL_PIN(104, "GPIO_104"), | ||
128 | PINCTRL_PIN(105, "GPIO_105"), | ||
129 | PINCTRL_PIN(106, "GPIO_106"), | ||
130 | PINCTRL_PIN(107, "GPIO_107"), | ||
131 | PINCTRL_PIN(108, "GPIO_108"), | ||
132 | PINCTRL_PIN(109, "GPIO_109"), | ||
133 | PINCTRL_PIN(110, "GPIO_110"), | ||
134 | PINCTRL_PIN(111, "GPIO_111"), | ||
135 | PINCTRL_PIN(112, "GPIO_112"), | ||
136 | PINCTRL_PIN(113, "GPIO_113"), | ||
137 | PINCTRL_PIN(114, "GPIO_114"), | ||
138 | PINCTRL_PIN(115, "GPIO_115"), | ||
139 | PINCTRL_PIN(116, "GPIO_116"), | ||
140 | PINCTRL_PIN(117, "GPIO_117"), | ||
141 | PINCTRL_PIN(118, "GPIO_118"), | ||
142 | PINCTRL_PIN(119, "GPIO_119"), | ||
143 | PINCTRL_PIN(120, "GPIO_120"), | ||
144 | PINCTRL_PIN(121, "GPIO_121"), | ||
145 | PINCTRL_PIN(122, "GPIO_122"), | ||
146 | PINCTRL_PIN(123, "GPIO_123"), | ||
147 | PINCTRL_PIN(124, "GPIO_124"), | ||
148 | PINCTRL_PIN(125, "GPIO_125"), | ||
149 | PINCTRL_PIN(126, "GPIO_126"), | ||
150 | PINCTRL_PIN(127, "GPIO_127"), | ||
151 | PINCTRL_PIN(128, "GPIO_128"), | ||
152 | PINCTRL_PIN(129, "GPIO_129"), | ||
153 | PINCTRL_PIN(130, "GPIO_130"), | ||
154 | PINCTRL_PIN(131, "GPIO_131"), | ||
155 | PINCTRL_PIN(132, "GPIO_132"), | ||
156 | PINCTRL_PIN(133, "GPIO_133"), | ||
157 | PINCTRL_PIN(134, "GPIO_134"), | ||
158 | PINCTRL_PIN(135, "GPIO_135"), | ||
159 | PINCTRL_PIN(136, "GPIO_136"), | ||
160 | PINCTRL_PIN(137, "GPIO_137"), | ||
161 | PINCTRL_PIN(138, "GPIO_138"), | ||
162 | PINCTRL_PIN(139, "GPIO_139"), | ||
163 | PINCTRL_PIN(140, "GPIO_140"), | ||
164 | PINCTRL_PIN(141, "GPIO_141"), | ||
165 | PINCTRL_PIN(142, "GPIO_142"), | ||
166 | PINCTRL_PIN(143, "GPIO_143"), | ||
167 | PINCTRL_PIN(144, "GPIO_144"), | ||
168 | PINCTRL_PIN(145, "GPIO_145"), | ||
169 | |||
170 | PINCTRL_PIN(146, "SDC1_CLK"), | ||
171 | PINCTRL_PIN(147, "SDC1_CMD"), | ||
172 | PINCTRL_PIN(148, "SDC1_DATA"), | ||
173 | PINCTRL_PIN(149, "SDC2_CLK"), | ||
174 | PINCTRL_PIN(150, "SDC2_CMD"), | ||
175 | PINCTRL_PIN(151, "SDC2_DATA"), | ||
176 | }; | ||
177 | |||
178 | #define DECLARE_MSM_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin } | ||
179 | DECLARE_MSM_GPIO_PINS(0); | ||
180 | DECLARE_MSM_GPIO_PINS(1); | ||
181 | DECLARE_MSM_GPIO_PINS(2); | ||
182 | DECLARE_MSM_GPIO_PINS(3); | ||
183 | DECLARE_MSM_GPIO_PINS(4); | ||
184 | DECLARE_MSM_GPIO_PINS(5); | ||
185 | DECLARE_MSM_GPIO_PINS(6); | ||
186 | DECLARE_MSM_GPIO_PINS(7); | ||
187 | DECLARE_MSM_GPIO_PINS(8); | ||
188 | DECLARE_MSM_GPIO_PINS(9); | ||
189 | DECLARE_MSM_GPIO_PINS(10); | ||
190 | DECLARE_MSM_GPIO_PINS(11); | ||
191 | DECLARE_MSM_GPIO_PINS(12); | ||
192 | DECLARE_MSM_GPIO_PINS(13); | ||
193 | DECLARE_MSM_GPIO_PINS(14); | ||
194 | DECLARE_MSM_GPIO_PINS(15); | ||
195 | DECLARE_MSM_GPIO_PINS(16); | ||
196 | DECLARE_MSM_GPIO_PINS(17); | ||
197 | DECLARE_MSM_GPIO_PINS(18); | ||
198 | DECLARE_MSM_GPIO_PINS(19); | ||
199 | DECLARE_MSM_GPIO_PINS(20); | ||
200 | DECLARE_MSM_GPIO_PINS(21); | ||
201 | DECLARE_MSM_GPIO_PINS(22); | ||
202 | DECLARE_MSM_GPIO_PINS(23); | ||
203 | DECLARE_MSM_GPIO_PINS(24); | ||
204 | DECLARE_MSM_GPIO_PINS(25); | ||
205 | DECLARE_MSM_GPIO_PINS(26); | ||
206 | DECLARE_MSM_GPIO_PINS(27); | ||
207 | DECLARE_MSM_GPIO_PINS(28); | ||
208 | DECLARE_MSM_GPIO_PINS(29); | ||
209 | DECLARE_MSM_GPIO_PINS(30); | ||
210 | DECLARE_MSM_GPIO_PINS(31); | ||
211 | DECLARE_MSM_GPIO_PINS(32); | ||
212 | DECLARE_MSM_GPIO_PINS(33); | ||
213 | DECLARE_MSM_GPIO_PINS(34); | ||
214 | DECLARE_MSM_GPIO_PINS(35); | ||
215 | DECLARE_MSM_GPIO_PINS(36); | ||
216 | DECLARE_MSM_GPIO_PINS(37); | ||
217 | DECLARE_MSM_GPIO_PINS(38); | ||
218 | DECLARE_MSM_GPIO_PINS(39); | ||
219 | DECLARE_MSM_GPIO_PINS(40); | ||
220 | DECLARE_MSM_GPIO_PINS(41); | ||
221 | DECLARE_MSM_GPIO_PINS(42); | ||
222 | DECLARE_MSM_GPIO_PINS(43); | ||
223 | DECLARE_MSM_GPIO_PINS(44); | ||
224 | DECLARE_MSM_GPIO_PINS(45); | ||
225 | DECLARE_MSM_GPIO_PINS(46); | ||
226 | DECLARE_MSM_GPIO_PINS(47); | ||
227 | DECLARE_MSM_GPIO_PINS(48); | ||
228 | DECLARE_MSM_GPIO_PINS(49); | ||
229 | DECLARE_MSM_GPIO_PINS(50); | ||
230 | DECLARE_MSM_GPIO_PINS(51); | ||
231 | DECLARE_MSM_GPIO_PINS(52); | ||
232 | DECLARE_MSM_GPIO_PINS(53); | ||
233 | DECLARE_MSM_GPIO_PINS(54); | ||
234 | DECLARE_MSM_GPIO_PINS(55); | ||
235 | DECLARE_MSM_GPIO_PINS(56); | ||
236 | DECLARE_MSM_GPIO_PINS(57); | ||
237 | DECLARE_MSM_GPIO_PINS(58); | ||
238 | DECLARE_MSM_GPIO_PINS(59); | ||
239 | DECLARE_MSM_GPIO_PINS(60); | ||
240 | DECLARE_MSM_GPIO_PINS(61); | ||
241 | DECLARE_MSM_GPIO_PINS(62); | ||
242 | DECLARE_MSM_GPIO_PINS(63); | ||
243 | DECLARE_MSM_GPIO_PINS(64); | ||
244 | DECLARE_MSM_GPIO_PINS(65); | ||
245 | DECLARE_MSM_GPIO_PINS(66); | ||
246 | DECLARE_MSM_GPIO_PINS(67); | ||
247 | DECLARE_MSM_GPIO_PINS(68); | ||
248 | DECLARE_MSM_GPIO_PINS(69); | ||
249 | DECLARE_MSM_GPIO_PINS(70); | ||
250 | DECLARE_MSM_GPIO_PINS(71); | ||
251 | DECLARE_MSM_GPIO_PINS(72); | ||
252 | DECLARE_MSM_GPIO_PINS(73); | ||
253 | DECLARE_MSM_GPIO_PINS(74); | ||
254 | DECLARE_MSM_GPIO_PINS(75); | ||
255 | DECLARE_MSM_GPIO_PINS(76); | ||
256 | DECLARE_MSM_GPIO_PINS(77); | ||
257 | DECLARE_MSM_GPIO_PINS(78); | ||
258 | DECLARE_MSM_GPIO_PINS(79); | ||
259 | DECLARE_MSM_GPIO_PINS(80); | ||
260 | DECLARE_MSM_GPIO_PINS(81); | ||
261 | DECLARE_MSM_GPIO_PINS(82); | ||
262 | DECLARE_MSM_GPIO_PINS(83); | ||
263 | DECLARE_MSM_GPIO_PINS(84); | ||
264 | DECLARE_MSM_GPIO_PINS(85); | ||
265 | DECLARE_MSM_GPIO_PINS(86); | ||
266 | DECLARE_MSM_GPIO_PINS(87); | ||
267 | DECLARE_MSM_GPIO_PINS(88); | ||
268 | DECLARE_MSM_GPIO_PINS(89); | ||
269 | DECLARE_MSM_GPIO_PINS(90); | ||
270 | DECLARE_MSM_GPIO_PINS(91); | ||
271 | DECLARE_MSM_GPIO_PINS(92); | ||
272 | DECLARE_MSM_GPIO_PINS(93); | ||
273 | DECLARE_MSM_GPIO_PINS(94); | ||
274 | DECLARE_MSM_GPIO_PINS(95); | ||
275 | DECLARE_MSM_GPIO_PINS(96); | ||
276 | DECLARE_MSM_GPIO_PINS(97); | ||
277 | DECLARE_MSM_GPIO_PINS(98); | ||
278 | DECLARE_MSM_GPIO_PINS(99); | ||
279 | DECLARE_MSM_GPIO_PINS(100); | ||
280 | DECLARE_MSM_GPIO_PINS(101); | ||
281 | DECLARE_MSM_GPIO_PINS(102); | ||
282 | DECLARE_MSM_GPIO_PINS(103); | ||
283 | DECLARE_MSM_GPIO_PINS(104); | ||
284 | DECLARE_MSM_GPIO_PINS(105); | ||
285 | DECLARE_MSM_GPIO_PINS(106); | ||
286 | DECLARE_MSM_GPIO_PINS(107); | ||
287 | DECLARE_MSM_GPIO_PINS(108); | ||
288 | DECLARE_MSM_GPIO_PINS(109); | ||
289 | DECLARE_MSM_GPIO_PINS(110); | ||
290 | DECLARE_MSM_GPIO_PINS(111); | ||
291 | DECLARE_MSM_GPIO_PINS(112); | ||
292 | DECLARE_MSM_GPIO_PINS(113); | ||
293 | DECLARE_MSM_GPIO_PINS(114); | ||
294 | DECLARE_MSM_GPIO_PINS(115); | ||
295 | DECLARE_MSM_GPIO_PINS(116); | ||
296 | DECLARE_MSM_GPIO_PINS(117); | ||
297 | DECLARE_MSM_GPIO_PINS(118); | ||
298 | DECLARE_MSM_GPIO_PINS(119); | ||
299 | DECLARE_MSM_GPIO_PINS(120); | ||
300 | DECLARE_MSM_GPIO_PINS(121); | ||
301 | DECLARE_MSM_GPIO_PINS(122); | ||
302 | DECLARE_MSM_GPIO_PINS(123); | ||
303 | DECLARE_MSM_GPIO_PINS(124); | ||
304 | DECLARE_MSM_GPIO_PINS(125); | ||
305 | DECLARE_MSM_GPIO_PINS(126); | ||
306 | DECLARE_MSM_GPIO_PINS(127); | ||
307 | DECLARE_MSM_GPIO_PINS(128); | ||
308 | DECLARE_MSM_GPIO_PINS(129); | ||
309 | DECLARE_MSM_GPIO_PINS(130); | ||
310 | DECLARE_MSM_GPIO_PINS(131); | ||
311 | DECLARE_MSM_GPIO_PINS(132); | ||
312 | DECLARE_MSM_GPIO_PINS(133); | ||
313 | DECLARE_MSM_GPIO_PINS(134); | ||
314 | DECLARE_MSM_GPIO_PINS(135); | ||
315 | DECLARE_MSM_GPIO_PINS(136); | ||
316 | DECLARE_MSM_GPIO_PINS(137); | ||
317 | DECLARE_MSM_GPIO_PINS(138); | ||
318 | DECLARE_MSM_GPIO_PINS(139); | ||
319 | DECLARE_MSM_GPIO_PINS(140); | ||
320 | DECLARE_MSM_GPIO_PINS(141); | ||
321 | DECLARE_MSM_GPIO_PINS(142); | ||
322 | DECLARE_MSM_GPIO_PINS(143); | ||
323 | DECLARE_MSM_GPIO_PINS(144); | ||
324 | DECLARE_MSM_GPIO_PINS(145); | ||
325 | |||
326 | static const unsigned int sdc1_clk_pins[] = { 146 }; | ||
327 | static const unsigned int sdc1_cmd_pins[] = { 147 }; | ||
328 | static const unsigned int sdc1_data_pins[] = { 148 }; | ||
329 | static const unsigned int sdc2_clk_pins[] = { 149 }; | ||
330 | static const unsigned int sdc2_cmd_pins[] = { 150 }; | ||
331 | static const unsigned int sdc2_data_pins[] = { 151 }; | ||
332 | |||
333 | #define FUNCTION(fname) \ | ||
334 | [MSM_MUX_##fname] = { \ | ||
335 | .name = #fname, \ | ||
336 | .groups = fname##_groups, \ | ||
337 | .ngroups = ARRAY_SIZE(fname##_groups), \ | ||
338 | } | ||
339 | |||
340 | #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7) \ | ||
341 | { \ | ||
342 | .name = "gpio" #id, \ | ||
343 | .pins = gpio##id##_pins, \ | ||
344 | .npins = ARRAY_SIZE(gpio##id##_pins), \ | ||
345 | .funcs = { \ | ||
346 | MSM_MUX_NA, /* gpio mode */ \ | ||
347 | MSM_MUX_##f1, \ | ||
348 | MSM_MUX_##f2, \ | ||
349 | MSM_MUX_##f3, \ | ||
350 | MSM_MUX_##f4, \ | ||
351 | MSM_MUX_##f5, \ | ||
352 | MSM_MUX_##f6, \ | ||
353 | MSM_MUX_##f7 \ | ||
354 | }, \ | ||
355 | .ctl_reg = 0x1000 + 0x10 * id , \ | ||
356 | .io_reg = 0x1004 + 0x10 * id, \ | ||
357 | .intr_cfg_reg = 0x1008 + 0x10 * id, \ | ||
358 | .intr_status_reg = 0x100c + 0x10 * id, \ | ||
359 | .intr_target_reg = 0x1008 + 0x10 * id, \ | ||
360 | .mux_bit = 2, \ | ||
361 | .pull_bit = 0, \ | ||
362 | .drv_bit = 6, \ | ||
363 | .oe_bit = 9, \ | ||
364 | .in_bit = 0, \ | ||
365 | .out_bit = 1, \ | ||
366 | .intr_enable_bit = 0, \ | ||
367 | .intr_status_bit = 0, \ | ||
368 | .intr_target_bit = 5, \ | ||
369 | .intr_raw_status_bit = 4, \ | ||
370 | .intr_polarity_bit = 1, \ | ||
371 | .intr_detection_bit = 2, \ | ||
372 | .intr_detection_width = 2, \ | ||
373 | } | ||
374 | |||
375 | #define SDC_PINGROUP(pg_name, ctl, pull, drv) \ | ||
376 | { \ | ||
377 | .name = #pg_name, \ | ||
378 | .pins = pg_name##_pins, \ | ||
379 | .npins = ARRAY_SIZE(pg_name##_pins), \ | ||
380 | .ctl_reg = ctl, \ | ||
381 | .io_reg = 0, \ | ||
382 | .intr_cfg_reg = 0, \ | ||
383 | .intr_status_reg = 0, \ | ||
384 | .intr_target_reg = 0, \ | ||
385 | .mux_bit = -1, \ | ||
386 | .pull_bit = pull, \ | ||
387 | .drv_bit = drv, \ | ||
388 | .oe_bit = -1, \ | ||
389 | .in_bit = -1, \ | ||
390 | .out_bit = -1, \ | ||
391 | .intr_enable_bit = -1, \ | ||
392 | .intr_status_bit = -1, \ | ||
393 | .intr_target_bit = -1, \ | ||
394 | .intr_raw_status_bit = -1, \ | ||
395 | .intr_polarity_bit = -1, \ | ||
396 | .intr_detection_bit = -1, \ | ||
397 | .intr_detection_width = -1, \ | ||
398 | } | ||
399 | |||
400 | /* | ||
401 | * TODO: Add the rest of the possible functions and fill out | ||
402 | * the pingroup table below. | ||
403 | */ | ||
404 | enum msm8x74_functions { | ||
405 | MSM_MUX_blsp_i2c2, | ||
406 | MSM_MUX_blsp_i2c6, | ||
407 | MSM_MUX_blsp_i2c11, | ||
408 | MSM_MUX_blsp_spi1, | ||
409 | MSM_MUX_blsp_uart2, | ||
410 | MSM_MUX_blsp_uart8, | ||
411 | MSM_MUX_slimbus, | ||
412 | MSM_MUX_NA, | ||
413 | }; | ||
414 | |||
415 | static const char * const blsp_i2c2_groups[] = { "gpio6", "gpio7" }; | ||
416 | static const char * const blsp_i2c6_groups[] = { "gpio29", "gpio30" }; | ||
417 | static const char * const blsp_i2c11_groups[] = { "gpio83", "gpio84" }; | ||
418 | static const char * const blsp_spi1_groups[] = { "gpio0", "gpio1", "gpio2", "gpio3" }; | ||
419 | static const char * const blsp_uart2_groups[] = { "gpio4", "gpio5" }; | ||
420 | static const char * const blsp_uart8_groups[] = { "gpio45", "gpio46" }; | ||
421 | static const char * const slimbus_groups[] = { "gpio70", "gpio71" }; | ||
422 | |||
423 | static const struct msm_function msm8x74_functions[] = { | ||
424 | FUNCTION(blsp_i2c2), | ||
425 | FUNCTION(blsp_i2c6), | ||
426 | FUNCTION(blsp_i2c11), | ||
427 | FUNCTION(blsp_spi1), | ||
428 | FUNCTION(blsp_uart2), | ||
429 | FUNCTION(blsp_uart8), | ||
430 | FUNCTION(slimbus), | ||
431 | }; | ||
432 | |||
433 | static const struct msm_pingroup msm8x74_groups[] = { | ||
434 | PINGROUP(0, blsp_spi1, NA, NA, NA, NA, NA, NA), | ||
435 | PINGROUP(1, blsp_spi1, NA, NA, NA, NA, NA, NA), | ||
436 | PINGROUP(2, blsp_spi1, NA, NA, NA, NA, NA, NA), | ||
437 | PINGROUP(3, blsp_spi1, NA, NA, NA, NA, NA, NA), | ||
438 | PINGROUP(4, NA, blsp_uart2, NA, NA, NA, NA, NA), | ||
439 | PINGROUP(5, NA, blsp_uart2, NA, NA, NA, NA, NA), | ||
440 | PINGROUP(6, NA, NA, blsp_i2c2, NA, NA, NA, NA), | ||
441 | PINGROUP(7, NA, NA, blsp_i2c2, NA, NA, NA, NA), | ||
442 | PINGROUP(8, NA, NA, NA, NA, NA, NA, NA), | ||
443 | PINGROUP(9, NA, NA, NA, NA, NA, NA, NA), | ||
444 | PINGROUP(10, NA, NA, NA, NA, NA, NA, NA), | ||
445 | PINGROUP(11, NA, NA, NA, NA, NA, NA, NA), | ||
446 | PINGROUP(12, NA, NA, NA, NA, NA, NA, NA), | ||
447 | PINGROUP(13, NA, NA, NA, NA, NA, NA, NA), | ||
448 | PINGROUP(14, NA, NA, NA, NA, NA, NA, NA), | ||
449 | PINGROUP(15, NA, NA, NA, NA, NA, NA, NA), | ||
450 | PINGROUP(16, NA, NA, NA, NA, NA, NA, NA), | ||
451 | PINGROUP(17, NA, NA, NA, NA, NA, NA, NA), | ||
452 | PINGROUP(18, NA, NA, NA, NA, NA, NA, NA), | ||
453 | PINGROUP(19, NA, NA, NA, NA, NA, NA, NA), | ||
454 | PINGROUP(20, NA, NA, NA, NA, NA, NA, NA), | ||
455 | PINGROUP(21, NA, NA, NA, NA, NA, NA, NA), | ||
456 | PINGROUP(22, NA, NA, NA, NA, NA, NA, NA), | ||
457 | PINGROUP(23, NA, NA, NA, NA, NA, NA, NA), | ||
458 | PINGROUP(24, NA, NA, NA, NA, NA, NA, NA), | ||
459 | PINGROUP(25, NA, NA, NA, NA, NA, NA, NA), | ||
460 | PINGROUP(26, NA, NA, NA, NA, NA, NA, NA), | ||
461 | PINGROUP(27, NA, NA, NA, NA, NA, NA, NA), | ||
462 | PINGROUP(28, NA, NA, NA, NA, NA, NA, NA), | ||
463 | PINGROUP(29, NA, NA, blsp_i2c6, NA, NA, NA, NA), | ||
464 | PINGROUP(30, NA, NA, blsp_i2c6, NA, NA, NA, NA), | ||
465 | PINGROUP(31, NA, NA, NA, NA, NA, NA, NA), | ||
466 | PINGROUP(32, NA, NA, NA, NA, NA, NA, NA), | ||
467 | PINGROUP(33, NA, NA, NA, NA, NA, NA, NA), | ||
468 | PINGROUP(34, NA, NA, NA, NA, NA, NA, NA), | ||
469 | PINGROUP(35, NA, NA, NA, NA, NA, NA, NA), | ||
470 | PINGROUP(36, NA, NA, NA, NA, NA, NA, NA), | ||
471 | PINGROUP(37, NA, NA, NA, NA, NA, NA, NA), | ||
472 | PINGROUP(38, NA, NA, NA, NA, NA, NA, NA), | ||
473 | PINGROUP(39, NA, NA, NA, NA, NA, NA, NA), | ||
474 | PINGROUP(40, NA, NA, NA, NA, NA, NA, NA), | ||
475 | PINGROUP(41, NA, NA, NA, NA, NA, NA, NA), | ||
476 | PINGROUP(42, NA, NA, NA, NA, NA, NA, NA), | ||
477 | PINGROUP(43, NA, NA, NA, NA, NA, NA, NA), | ||
478 | PINGROUP(44, NA, NA, NA, NA, NA, NA, NA), | ||
479 | PINGROUP(45, NA, blsp_uart8, NA, NA, NA, NA, NA), | ||
480 | PINGROUP(46, NA, blsp_uart8, NA, NA, NA, NA, NA), | ||
481 | PINGROUP(47, NA, NA, NA, NA, NA, NA, NA), | ||
482 | PINGROUP(48, NA, NA, NA, NA, NA, NA, NA), | ||
483 | PINGROUP(49, NA, NA, NA, NA, NA, NA, NA), | ||
484 | PINGROUP(50, NA, NA, NA, NA, NA, NA, NA), | ||
485 | PINGROUP(51, NA, NA, NA, NA, NA, NA, NA), | ||
486 | PINGROUP(52, NA, NA, NA, NA, NA, NA, NA), | ||
487 | PINGROUP(53, NA, NA, NA, NA, NA, NA, NA), | ||
488 | PINGROUP(54, NA, NA, NA, NA, NA, NA, NA), | ||
489 | PINGROUP(55, NA, NA, NA, NA, NA, NA, NA), | ||
490 | PINGROUP(56, NA, NA, NA, NA, NA, NA, NA), | ||
491 | PINGROUP(57, NA, NA, NA, NA, NA, NA, NA), | ||
492 | PINGROUP(58, NA, NA, NA, NA, NA, NA, NA), | ||
493 | PINGROUP(59, NA, NA, NA, NA, NA, NA, NA), | ||
494 | PINGROUP(60, NA, NA, NA, NA, NA, NA, NA), | ||
495 | PINGROUP(61, NA, NA, NA, NA, NA, NA, NA), | ||
496 | PINGROUP(62, NA, NA, NA, NA, NA, NA, NA), | ||
497 | PINGROUP(63, NA, NA, NA, NA, NA, NA, NA), | ||
498 | PINGROUP(64, NA, NA, NA, NA, NA, NA, NA), | ||
499 | PINGROUP(65, NA, NA, NA, NA, NA, NA, NA), | ||
500 | PINGROUP(66, NA, NA, NA, NA, NA, NA, NA), | ||
501 | PINGROUP(67, NA, NA, NA, NA, NA, NA, NA), | ||
502 | PINGROUP(68, NA, NA, NA, NA, NA, NA, NA), | ||
503 | PINGROUP(69, NA, NA, NA, NA, NA, NA, NA), | ||
504 | PINGROUP(70, slimbus, NA, NA, NA, NA, NA, NA), | ||
505 | PINGROUP(71, slimbus, NA, NA, NA, NA, NA, NA), | ||
506 | PINGROUP(72, NA, NA, NA, NA, NA, NA, NA), | ||
507 | PINGROUP(73, NA, NA, NA, NA, NA, NA, NA), | ||
508 | PINGROUP(74, NA, NA, NA, NA, NA, NA, NA), | ||
509 | PINGROUP(75, NA, NA, NA, NA, NA, NA, NA), | ||
510 | PINGROUP(76, NA, NA, NA, NA, NA, NA, NA), | ||
511 | PINGROUP(77, NA, NA, NA, NA, NA, NA, NA), | ||
512 | PINGROUP(78, NA, NA, NA, NA, NA, NA, NA), | ||
513 | PINGROUP(79, NA, NA, NA, NA, NA, NA, NA), | ||
514 | PINGROUP(80, NA, NA, NA, NA, NA, NA, NA), | ||
515 | PINGROUP(81, NA, NA, NA, NA, NA, NA, NA), | ||
516 | PINGROUP(82, NA, NA, NA, NA, NA, NA, NA), | ||
517 | PINGROUP(83, NA, NA, blsp_i2c11, NA, NA, NA, NA), | ||
518 | PINGROUP(84, NA, NA, blsp_i2c11, NA, NA, NA, NA), | ||
519 | PINGROUP(85, NA, NA, NA, NA, NA, NA, NA), | ||
520 | PINGROUP(86, NA, NA, NA, NA, NA, NA, NA), | ||
521 | PINGROUP(87, NA, NA, NA, NA, NA, NA, NA), | ||
522 | PINGROUP(88, NA, NA, NA, NA, NA, NA, NA), | ||
523 | PINGROUP(89, NA, NA, NA, NA, NA, NA, NA), | ||
524 | PINGROUP(90, NA, NA, NA, NA, NA, NA, NA), | ||
525 | PINGROUP(91, NA, NA, NA, NA, NA, NA, NA), | ||
526 | PINGROUP(92, NA, NA, NA, NA, NA, NA, NA), | ||
527 | PINGROUP(93, NA, NA, NA, NA, NA, NA, NA), | ||
528 | PINGROUP(94, NA, NA, NA, NA, NA, NA, NA), | ||
529 | PINGROUP(95, NA, NA, NA, NA, NA, NA, NA), | ||
530 | PINGROUP(96, NA, NA, NA, NA, NA, NA, NA), | ||
531 | PINGROUP(97, NA, NA, NA, NA, NA, NA, NA), | ||
532 | PINGROUP(98, NA, NA, NA, NA, NA, NA, NA), | ||
533 | PINGROUP(99, NA, NA, NA, NA, NA, NA, NA), | ||
534 | PINGROUP(100, NA, NA, NA, NA, NA, NA, NA), | ||
535 | PINGROUP(101, NA, NA, NA, NA, NA, NA, NA), | ||
536 | PINGROUP(102, NA, NA, NA, NA, NA, NA, NA), | ||
537 | PINGROUP(103, NA, NA, NA, NA, NA, NA, NA), | ||
538 | PINGROUP(104, NA, NA, NA, NA, NA, NA, NA), | ||
539 | PINGROUP(105, NA, NA, NA, NA, NA, NA, NA), | ||
540 | PINGROUP(106, NA, NA, NA, NA, NA, NA, NA), | ||
541 | PINGROUP(107, NA, NA, NA, NA, NA, NA, NA), | ||
542 | PINGROUP(108, NA, NA, NA, NA, NA, NA, NA), | ||
543 | PINGROUP(109, NA, NA, NA, NA, NA, NA, NA), | ||
544 | PINGROUP(110, NA, NA, NA, NA, NA, NA, NA), | ||
545 | PINGROUP(111, NA, NA, NA, NA, NA, NA, NA), | ||
546 | PINGROUP(112, NA, NA, NA, NA, NA, NA, NA), | ||
547 | PINGROUP(113, NA, NA, NA, NA, NA, NA, NA), | ||
548 | PINGROUP(114, NA, NA, NA, NA, NA, NA, NA), | ||
549 | PINGROUP(115, NA, NA, NA, NA, NA, NA, NA), | ||
550 | PINGROUP(116, NA, NA, NA, NA, NA, NA, NA), | ||
551 | PINGROUP(117, NA, NA, NA, NA, NA, NA, NA), | ||
552 | PINGROUP(118, NA, NA, NA, NA, NA, NA, NA), | ||
553 | PINGROUP(119, NA, NA, NA, NA, NA, NA, NA), | ||
554 | PINGROUP(120, NA, NA, NA, NA, NA, NA, NA), | ||
555 | PINGROUP(121, NA, NA, NA, NA, NA, NA, NA), | ||
556 | PINGROUP(122, NA, NA, NA, NA, NA, NA, NA), | ||
557 | PINGROUP(123, NA, NA, NA, NA, NA, NA, NA), | ||
558 | PINGROUP(124, NA, NA, NA, NA, NA, NA, NA), | ||
559 | PINGROUP(125, NA, NA, NA, NA, NA, NA, NA), | ||
560 | PINGROUP(126, NA, NA, NA, NA, NA, NA, NA), | ||
561 | PINGROUP(127, NA, NA, NA, NA, NA, NA, NA), | ||
562 | PINGROUP(128, NA, NA, NA, NA, NA, NA, NA), | ||
563 | PINGROUP(129, NA, NA, NA, NA, NA, NA, NA), | ||
564 | PINGROUP(130, NA, NA, NA, NA, NA, NA, NA), | ||
565 | PINGROUP(131, NA, NA, NA, NA, NA, NA, NA), | ||
566 | PINGROUP(132, NA, NA, NA, NA, NA, NA, NA), | ||
567 | PINGROUP(133, NA, NA, NA, NA, NA, NA, NA), | ||
568 | PINGROUP(134, NA, NA, NA, NA, NA, NA, NA), | ||
569 | PINGROUP(135, NA, NA, NA, NA, NA, NA, NA), | ||
570 | PINGROUP(136, NA, NA, NA, NA, NA, NA, NA), | ||
571 | PINGROUP(137, NA, NA, NA, NA, NA, NA, NA), | ||
572 | PINGROUP(138, NA, NA, NA, NA, NA, NA, NA), | ||
573 | PINGROUP(139, NA, NA, NA, NA, NA, NA, NA), | ||
574 | PINGROUP(140, NA, NA, NA, NA, NA, NA, NA), | ||
575 | PINGROUP(141, NA, NA, NA, NA, NA, NA, NA), | ||
576 | PINGROUP(143, NA, NA, NA, NA, NA, NA, NA), | ||
577 | PINGROUP(143, NA, NA, NA, NA, NA, NA, NA), | ||
578 | PINGROUP(144, NA, NA, NA, NA, NA, NA, NA), | ||
579 | PINGROUP(145, NA, NA, NA, NA, NA, NA, NA), | ||
580 | SDC_PINGROUP(sdc1_clk, 0x2044, 13, 6), | ||
581 | SDC_PINGROUP(sdc1_cmd, 0x2044, 11, 3), | ||
582 | SDC_PINGROUP(sdc1_data, 0x2044, 9, 0), | ||
583 | SDC_PINGROUP(sdc2_clk, 0x2048, 14, 6), | ||
584 | SDC_PINGROUP(sdc2_cmd, 0x2048, 11, 3), | ||
585 | SDC_PINGROUP(sdc2_data, 0x2048, 9, 0), | ||
586 | }; | ||
587 | |||
588 | #define NUM_GPIO_PINGROUPS 146 | ||
589 | |||
590 | static const struct msm_pinctrl_soc_data msm8x74_pinctrl = { | ||
591 | .pins = msm8x74_pins, | ||
592 | .npins = ARRAY_SIZE(msm8x74_pins), | ||
593 | .functions = msm8x74_functions, | ||
594 | .nfunctions = ARRAY_SIZE(msm8x74_functions), | ||
595 | .groups = msm8x74_groups, | ||
596 | .ngroups = ARRAY_SIZE(msm8x74_groups), | ||
597 | .ngpios = NUM_GPIO_PINGROUPS, | ||
598 | }; | ||
599 | |||
600 | static int msm8x74_pinctrl_probe(struct platform_device *pdev) | ||
601 | { | ||
602 | return msm_pinctrl_probe(pdev, &msm8x74_pinctrl); | ||
603 | } | ||
604 | |||
605 | static struct of_device_id msm8x74_pinctrl_of_match[] = { | ||
606 | { .compatible = "qcom,msm8x74-pinctrl", }, | ||
607 | { }, | ||
608 | }; | ||
609 | |||
610 | static struct platform_driver msm8x74_pinctrl_driver = { | ||
611 | .driver = { | ||
612 | .name = "msm8x74-pinctrl", | ||
613 | .owner = THIS_MODULE, | ||
614 | .of_match_table = msm8x74_pinctrl_of_match, | ||
615 | }, | ||
616 | .probe = msm8x74_pinctrl_probe, | ||
617 | .remove = msm_pinctrl_remove, | ||
618 | }; | ||
619 | |||
620 | static int __init msm8x74_pinctrl_init(void) | ||
621 | { | ||
622 | return platform_driver_register(&msm8x74_pinctrl_driver); | ||
623 | } | ||
624 | arch_initcall(msm8x74_pinctrl_init); | ||
625 | |||
626 | static void __exit msm8x74_pinctrl_exit(void) | ||
627 | { | ||
628 | platform_driver_unregister(&msm8x74_pinctrl_driver); | ||
629 | } | ||
630 | module_exit(msm8x74_pinctrl_exit); | ||
631 | |||
632 | MODULE_AUTHOR("Bjorn Andersson <bjorn.andersson@sonymobile.com>"); | ||
633 | MODULE_DESCRIPTION("Qualcomm MSM8x74 pinctrl driver"); | ||
634 | MODULE_LICENSE("GPL v2"); | ||
635 | MODULE_DEVICE_TABLE(of, msm8x74_pinctrl_of_match); | ||
636 | |||
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 983662e846a4..6559e1436768 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1060,14 +1060,14 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, | |||
1060 | (mode < 0) ? "unknown" : modes[mode], | 1060 | (mode < 0) ? "unknown" : modes[mode], |
1061 | pull ? "pull" : "none"); | 1061 | pull ? "pull" : "none"); |
1062 | 1062 | ||
1063 | if (label && !is_out) { | 1063 | if (!is_out) { |
1064 | int irq = gpio_to_irq(gpio); | 1064 | int irq = gpio_to_irq(gpio); |
1065 | struct irq_desc *desc = irq_to_desc(irq); | 1065 | struct irq_desc *desc = irq_to_desc(irq); |
1066 | 1066 | ||
1067 | /* This races with request_irq(), set_irq_type(), | 1067 | /* This races with request_irq(), set_irq_type(), |
1068 | * and set_irq_wake() ... but those are "rare". | 1068 | * and set_irq_wake() ... but those are "rare". |
1069 | */ | 1069 | */ |
1070 | if (irq >= 0 && desc->action) { | 1070 | if (irq > 0 && desc && desc->action) { |
1071 | char *trigger; | 1071 | char *trigger; |
1072 | u32 bitmask = nmk_gpio_get_bitmask(gpio); | 1072 | u32 bitmask = nmk_gpio_get_bitmask(gpio); |
1073 | 1073 | ||
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index d77ece5217f0..b9b464d0578c 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c | |||
@@ -26,29 +26,67 @@ | |||
26 | 26 | ||
27 | #include "core.h" | 27 | #include "core.h" |
28 | 28 | ||
29 | static int sh_pfc_ioremap(struct sh_pfc *pfc, struct platform_device *pdev) | 29 | static int sh_pfc_map_resources(struct sh_pfc *pfc, |
30 | struct platform_device *pdev) | ||
30 | { | 31 | { |
32 | unsigned int num_windows = 0; | ||
33 | unsigned int num_irqs = 0; | ||
34 | struct sh_pfc_window *windows; | ||
35 | unsigned int *irqs = NULL; | ||
31 | struct resource *res; | 36 | struct resource *res; |
32 | int k; | 37 | unsigned int i; |
38 | |||
39 | /* Count the MEM and IRQ resources. */ | ||
40 | for (i = 0; i < pdev->num_resources; ++i) { | ||
41 | switch (resource_type(&pdev->resource[i])) { | ||
42 | case IORESOURCE_MEM: | ||
43 | num_windows++; | ||
44 | break; | ||
45 | |||
46 | case IORESOURCE_IRQ: | ||
47 | num_irqs++; | ||
48 | break; | ||
49 | } | ||
50 | } | ||
33 | 51 | ||
34 | if (pdev->num_resources == 0) | 52 | if (num_windows == 0) |
35 | return -EINVAL; | 53 | return -EINVAL; |
36 | 54 | ||
37 | pfc->window = devm_kzalloc(pfc->dev, pdev->num_resources * | 55 | /* Allocate memory windows and IRQs arrays. */ |
38 | sizeof(*pfc->window), GFP_NOWAIT); | 56 | windows = devm_kzalloc(pfc->dev, num_windows * sizeof(*windows), |
39 | if (!pfc->window) | 57 | GFP_KERNEL); |
58 | if (windows == NULL) | ||
40 | return -ENOMEM; | 59 | return -ENOMEM; |
41 | 60 | ||
42 | pfc->num_windows = pdev->num_resources; | 61 | pfc->num_windows = num_windows; |
62 | pfc->windows = windows; | ||
43 | 63 | ||
44 | for (k = 0, res = pdev->resource; k < pdev->num_resources; k++, res++) { | 64 | if (num_irqs) { |
45 | WARN_ON(resource_type(res) != IORESOURCE_MEM); | 65 | irqs = devm_kzalloc(pfc->dev, num_irqs * sizeof(*irqs), |
46 | pfc->window[k].phys = res->start; | 66 | GFP_KERNEL); |
47 | pfc->window[k].size = resource_size(res); | 67 | if (irqs == NULL) |
48 | pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start, | ||
49 | resource_size(res)); | ||
50 | if (!pfc->window[k].virt) | ||
51 | return -ENOMEM; | 68 | return -ENOMEM; |
69 | |||
70 | pfc->num_irqs = num_irqs; | ||
71 | pfc->irqs = irqs; | ||
72 | } | ||
73 | |||
74 | /* Fill them. */ | ||
75 | for (i = 0, res = pdev->resource; i < pdev->num_resources; i++, res++) { | ||
76 | switch (resource_type(res)) { | ||
77 | case IORESOURCE_MEM: | ||
78 | windows->phys = res->start; | ||
79 | windows->size = resource_size(res); | ||
80 | windows->virt = devm_ioremap_resource(pfc->dev, res); | ||
81 | if (IS_ERR(windows->virt)) | ||
82 | return -ENOMEM; | ||
83 | windows++; | ||
84 | break; | ||
85 | |||
86 | case IORESOURCE_IRQ: | ||
87 | *irqs++ = res->start; | ||
88 | break; | ||
89 | } | ||
52 | } | 90 | } |
53 | 91 | ||
54 | return 0; | 92 | return 0; |
@@ -62,7 +100,7 @@ static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc, | |||
62 | 100 | ||
63 | /* scan through physical windows and convert address */ | 101 | /* scan through physical windows and convert address */ |
64 | for (i = 0; i < pfc->num_windows; i++) { | 102 | for (i = 0; i < pfc->num_windows; i++) { |
65 | window = pfc->window + i; | 103 | window = pfc->windows + i; |
66 | 104 | ||
67 | if (address < window->phys) | 105 | if (address < window->phys) |
68 | continue; | 106 | continue; |
@@ -147,7 +185,7 @@ static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, | |||
147 | unsigned long *maskp, | 185 | unsigned long *maskp, |
148 | unsigned long *posp) | 186 | unsigned long *posp) |
149 | { | 187 | { |
150 | int k; | 188 | unsigned int k; |
151 | 189 | ||
152 | *mapped_regp = sh_pfc_phys_to_virt(pfc, crp->reg); | 190 | *mapped_regp = sh_pfc_phys_to_virt(pfc, crp->reg); |
153 | 191 | ||
@@ -196,7 +234,7 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, u16 enum_id, | |||
196 | { | 234 | { |
197 | const struct pinmux_cfg_reg *config_reg; | 235 | const struct pinmux_cfg_reg *config_reg; |
198 | unsigned long r_width, f_width, curr_width, ncomb; | 236 | unsigned long r_width, f_width, curr_width, ncomb; |
199 | int k, m, n, pos, bit_pos; | 237 | unsigned int k, m, n, pos, bit_pos; |
200 | 238 | ||
201 | k = 0; | 239 | k = 0; |
202 | while (1) { | 240 | while (1) { |
@@ -238,7 +276,7 @@ static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, u16 mark, int pos, | |||
238 | u16 *enum_idp) | 276 | u16 *enum_idp) |
239 | { | 277 | { |
240 | const u16 *data = pfc->info->gpio_data; | 278 | const u16 *data = pfc->info->gpio_data; |
241 | int k; | 279 | unsigned int k; |
242 | 280 | ||
243 | if (pos) { | 281 | if (pos) { |
244 | *enum_idp = data[pos + 1]; | 282 | *enum_idp = data[pos + 1]; |
@@ -481,7 +519,7 @@ static int sh_pfc_probe(struct platform_device *pdev) | |||
481 | pfc->info = info; | 519 | pfc->info = info; |
482 | pfc->dev = &pdev->dev; | 520 | pfc->dev = &pdev->dev; |
483 | 521 | ||
484 | ret = sh_pfc_ioremap(pfc, pdev); | 522 | ret = sh_pfc_map_resources(pfc, pdev); |
485 | if (unlikely(ret < 0)) | 523 | if (unlikely(ret < 0)) |
486 | return ret; | 524 | return ret; |
487 | 525 | ||
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h index 11ea87268658..b7b0e6ccf305 100644 --- a/drivers/pinctrl/sh-pfc/core.h +++ b/drivers/pinctrl/sh-pfc/core.h | |||
@@ -37,7 +37,9 @@ struct sh_pfc { | |||
37 | spinlock_t lock; | 37 | spinlock_t lock; |
38 | 38 | ||
39 | unsigned int num_windows; | 39 | unsigned int num_windows; |
40 | struct sh_pfc_window *window; | 40 | struct sh_pfc_window *windows; |
41 | unsigned int num_irqs; | ||
42 | unsigned int *irqs; | ||
41 | 43 | ||
42 | struct sh_pfc_pin_range *ranges; | 44 | struct sh_pfc_pin_range *ranges; |
43 | unsigned int nr_ranges; | 45 | unsigned int nr_ranges; |
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index 04bf52b64fb3..63480815e1af 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c | |||
@@ -204,18 +204,24 @@ static void gpio_pin_set(struct gpio_chip *gc, unsigned offset, int value) | |||
204 | static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset) | 204 | static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset) |
205 | { | 205 | { |
206 | struct sh_pfc *pfc = gpio_to_pfc(gc); | 206 | struct sh_pfc *pfc = gpio_to_pfc(gc); |
207 | int i, k; | 207 | unsigned int i, k; |
208 | 208 | ||
209 | for (i = 0; i < pfc->info->gpio_irq_size; i++) { | 209 | for (i = 0; i < pfc->info->gpio_irq_size; i++) { |
210 | unsigned short *gpios = pfc->info->gpio_irq[i].gpios; | 210 | short *gpios = pfc->info->gpio_irq[i].gpios; |
211 | 211 | ||
212 | for (k = 0; gpios[k]; k++) { | 212 | for (k = 0; gpios[k] >= 0; k++) { |
213 | if (gpios[k] == offset) | 213 | if (gpios[k] == offset) |
214 | return pfc->info->gpio_irq[i].irq; | 214 | goto found; |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | return -ENOSYS; | 218 | return -ENOSYS; |
219 | |||
220 | found: | ||
221 | if (pfc->num_irqs) | ||
222 | return pfc->irqs[i]; | ||
223 | else | ||
224 | return pfc->info->gpio_irq[i].irq; | ||
219 | } | 225 | } |
220 | 226 | ||
221 | static int gpio_pin_setup(struct sh_pfc_chip *chip) | 227 | static int gpio_pin_setup(struct sh_pfc_chip *chip) |
@@ -347,7 +353,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | |||
347 | * GPIOs. | 353 | * GPIOs. |
348 | */ | 354 | */ |
349 | for (i = 0; i < pfc->num_windows; ++i) { | 355 | for (i = 0; i < pfc->num_windows; ++i) { |
350 | struct sh_pfc_window *window = &pfc->window[i]; | 356 | struct sh_pfc_window *window = &pfc->windows[i]; |
351 | 357 | ||
352 | if (pfc->info->data_regs[0].reg >= window->phys && | 358 | if (pfc->info->data_regs[0].reg >= window->phys && |
353 | pfc->info->data_regs[0].reg < window->phys + window->size) | 359 | pfc->info->data_regs[0].reg < window->phys + window->size) |
@@ -357,8 +363,14 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | |||
357 | if (i == pfc->num_windows) | 363 | if (i == pfc->num_windows) |
358 | return 0; | 364 | return 0; |
359 | 365 | ||
366 | /* If we have IRQ resources make sure their number is correct. */ | ||
367 | if (pfc->num_irqs && pfc->num_irqs != pfc->info->gpio_irq_size) { | ||
368 | dev_err(pfc->dev, "invalid number of IRQ resources\n"); | ||
369 | return -EINVAL; | ||
370 | } | ||
371 | |||
360 | /* Register the real GPIOs chip. */ | 372 | /* Register the real GPIOs chip. */ |
361 | chip = sh_pfc_add_gpiochip(pfc, gpio_pin_setup, &pfc->window[i]); | 373 | chip = sh_pfc_add_gpiochip(pfc, gpio_pin_setup, &pfc->windows[i]); |
362 | if (IS_ERR(chip)) | 374 | if (IS_ERR(chip)) |
363 | return PTR_ERR(chip); | 375 | return PTR_ERR(chip); |
364 | 376 | ||
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c index d25fd4ea0a1d..32dd478f28e3 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a73a4.c | |||
@@ -2061,17 +2061,6 @@ static const struct sh_pfc_function pinmux_functions[] = { | |||
2061 | SH_PFC_FUNCTION(sdhi2), | 2061 | SH_PFC_FUNCTION(sdhi2), |
2062 | }; | 2062 | }; |
2063 | 2063 | ||
2064 | #undef PORTCR | ||
2065 | #define PORTCR(nr, reg) \ | ||
2066 | { \ | ||
2067 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
2068 | _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \ | ||
2069 | PORT##nr##_FN0, PORT##nr##_FN1, \ | ||
2070 | PORT##nr##_FN2, PORT##nr##_FN3, \ | ||
2071 | PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
2072 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
2073 | } | ||
2074 | |||
2075 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { | 2064 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
2076 | PORTCR(0, 0xe6050000), | 2065 | PORTCR(0, 0xe6050000), |
2077 | PORTCR(1, 0xe6050001), | 2066 | PORTCR(1, 0xe6050001), |
@@ -2691,7 +2680,7 @@ static unsigned int r8a73a4_pinmux_get_bias(struct sh_pfc *pfc, | |||
2691 | { | 2680 | { |
2692 | void __iomem *addr; | 2681 | void __iomem *addr; |
2693 | 2682 | ||
2694 | addr = pfc->window->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; | 2683 | addr = pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; |
2695 | 2684 | ||
2696 | switch (ioread8(addr) & PORTCR_PULMD_MASK) { | 2685 | switch (ioread8(addr) & PORTCR_PULMD_MASK) { |
2697 | case PORTCR_PULMD_UP: | 2686 | case PORTCR_PULMD_UP: |
@@ -2710,7 +2699,7 @@ static void r8a73a4_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, | |||
2710 | void __iomem *addr; | 2699 | void __iomem *addr; |
2711 | u32 value; | 2700 | u32 value; |
2712 | 2701 | ||
2713 | addr = pfc->window->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; | 2702 | addr = pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin; |
2714 | value = ioread8(addr) & ~PORTCR_PULMD_MASK; | 2703 | value = ioread8(addr) & ~PORTCR_PULMD_MASK; |
2715 | 2704 | ||
2716 | switch (bias) { | 2705 | switch (bias) { |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index bc5eb453a45c..61e258577881 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c | |||
@@ -3234,17 +3234,6 @@ static const struct sh_pfc_function pinmux_functions[] = { | |||
3234 | SH_PFC_FUNCTION(tpu0), | 3234 | SH_PFC_FUNCTION(tpu0), |
3235 | }; | 3235 | }; |
3236 | 3236 | ||
3237 | #undef PORTCR | ||
3238 | #define PORTCR(nr, reg) \ | ||
3239 | { \ | ||
3240 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
3241 | _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \ | ||
3242 | PORT##nr##_FN0, PORT##nr##_FN1, \ | ||
3243 | PORT##nr##_FN2, PORT##nr##_FN3, \ | ||
3244 | PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
3245 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
3246 | } | ||
3247 | |||
3248 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { | 3237 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
3249 | PORTCR(0, 0xe6050000), /* PORT0CR */ | 3238 | PORTCR(0, 0xe6050000), /* PORT0CR */ |
3250 | PORTCR(1, 0xe6050001), /* PORT1CR */ | 3239 | PORTCR(1, 0xe6050001), /* PORT1CR */ |
@@ -3721,7 +3710,7 @@ static void __iomem *r8a7740_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
3721 | &r8a7740_portcr_offsets[i]; | 3710 | &r8a7740_portcr_offsets[i]; |
3722 | 3711 | ||
3723 | if (pin <= group->end_pin) | 3712 | if (pin <= group->end_pin) |
3724 | return pfc->window->virt + group->offset + pin; | 3713 | return pfc->windows->virt + group->offset + pin; |
3725 | } | 3714 | } |
3726 | 3715 | ||
3727 | return NULL; | 3716 | return NULL; |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index 72786fc93958..293a51a7434e 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c | |||
@@ -1739,6 +1739,56 @@ static struct sh_pfc_pin pinmux_pins[] = { | |||
1739 | SH_PFC_PIN_NAMED(ROW_GROUP_A('H'), 15, AH15), | 1739 | SH_PFC_PIN_NAMED(ROW_GROUP_A('H'), 15, AH15), |
1740 | }; | 1740 | }; |
1741 | 1741 | ||
1742 | /* - AUDIO CLOCK ------------------------------------------------------------ */ | ||
1743 | static const unsigned int audio_clk_a_pins[] = { | ||
1744 | /* CLK A */ | ||
1745 | RCAR_GP_PIN(4, 25), | ||
1746 | }; | ||
1747 | static const unsigned int audio_clk_a_mux[] = { | ||
1748 | AUDIO_CLKA_MARK, | ||
1749 | }; | ||
1750 | static const unsigned int audio_clk_b_pins[] = { | ||
1751 | /* CLK B */ | ||
1752 | RCAR_GP_PIN(4, 26), | ||
1753 | }; | ||
1754 | static const unsigned int audio_clk_b_mux[] = { | ||
1755 | AUDIO_CLKB_MARK, | ||
1756 | }; | ||
1757 | static const unsigned int audio_clk_c_pins[] = { | ||
1758 | /* CLK C */ | ||
1759 | RCAR_GP_PIN(5, 27), | ||
1760 | }; | ||
1761 | static const unsigned int audio_clk_c_mux[] = { | ||
1762 | AUDIO_CLKC_MARK, | ||
1763 | }; | ||
1764 | static const unsigned int audio_clkout_pins[] = { | ||
1765 | /* CLK OUT */ | ||
1766 | RCAR_GP_PIN(5, 16), | ||
1767 | }; | ||
1768 | static const unsigned int audio_clkout_mux[] = { | ||
1769 | AUDIO_CLKOUT_MARK, | ||
1770 | }; | ||
1771 | static const unsigned int audio_clkout_b_pins[] = { | ||
1772 | /* CLK OUT B */ | ||
1773 | RCAR_GP_PIN(0, 23), | ||
1774 | }; | ||
1775 | static const unsigned int audio_clkout_b_mux[] = { | ||
1776 | AUDIO_CLKOUT_B_MARK, | ||
1777 | }; | ||
1778 | static const unsigned int audio_clkout_c_pins[] = { | ||
1779 | /* CLK OUT C */ | ||
1780 | RCAR_GP_PIN(5, 27), | ||
1781 | }; | ||
1782 | static const unsigned int audio_clkout_c_mux[] = { | ||
1783 | AUDIO_CLKOUT_C_MARK, | ||
1784 | }; | ||
1785 | static const unsigned int audio_clkout_d_pins[] = { | ||
1786 | /* CLK OUT D */ | ||
1787 | RCAR_GP_PIN(5, 20), | ||
1788 | }; | ||
1789 | static const unsigned int audio_clkout_d_mux[] = { | ||
1790 | AUDIO_CLKOUT_D_MARK, | ||
1791 | }; | ||
1742 | /* - DU RGB ----------------------------------------------------------------- */ | 1792 | /* - DU RGB ----------------------------------------------------------------- */ |
1743 | static const unsigned int du_rgb666_pins[] = { | 1793 | static const unsigned int du_rgb666_pins[] = { |
1744 | /* R[7:2], G[7:2], B[7:2] */ | 1794 | /* R[7:2], G[7:2], B[7:2] */ |
@@ -2961,6 +3011,189 @@ static const unsigned int sdhi3_wp_pins[] = { | |||
2961 | static const unsigned int sdhi3_wp_mux[] = { | 3011 | static const unsigned int sdhi3_wp_mux[] = { |
2962 | SD3_WP_MARK, | 3012 | SD3_WP_MARK, |
2963 | }; | 3013 | }; |
3014 | /* - SSI -------------------------------------------------------------------- */ | ||
3015 | static const unsigned int ssi0_data_pins[] = { | ||
3016 | /* SDATA0 */ | ||
3017 | RCAR_GP_PIN(4, 5), | ||
3018 | }; | ||
3019 | static const unsigned int ssi0_data_mux[] = { | ||
3020 | SSI_SDATA0_MARK, | ||
3021 | }; | ||
3022 | static const unsigned int ssi0129_ctrl_pins[] = { | ||
3023 | /* SCK, WS */ | ||
3024 | RCAR_GP_PIN(4, 3), RCAR_GP_PIN(4, 4), | ||
3025 | }; | ||
3026 | static const unsigned int ssi0129_ctrl_mux[] = { | ||
3027 | SSI_SCK0129_MARK, SSI_WS0129_MARK, | ||
3028 | }; | ||
3029 | static const unsigned int ssi1_data_pins[] = { | ||
3030 | /* SDATA1 */ | ||
3031 | RCAR_GP_PIN(4, 6), | ||
3032 | }; | ||
3033 | static const unsigned int ssi1_data_mux[] = { | ||
3034 | SSI_SDATA1_MARK, | ||
3035 | }; | ||
3036 | static const unsigned int ssi1_ctrl_pins[] = { | ||
3037 | /* SCK, WS */ | ||
3038 | RCAR_GP_PIN(4, 7), RCAR_GP_PIN(4, 24), | ||
3039 | }; | ||
3040 | static const unsigned int ssi1_ctrl_mux[] = { | ||
3041 | SSI_SCK1_MARK, SSI_WS1_MARK, | ||
3042 | }; | ||
3043 | static const unsigned int ssi2_data_pins[] = { | ||
3044 | /* SDATA2 */ | ||
3045 | RCAR_GP_PIN(4, 7), | ||
3046 | }; | ||
3047 | static const unsigned int ssi2_data_mux[] = { | ||
3048 | SSI_SDATA2_MARK, | ||
3049 | }; | ||
3050 | static const unsigned int ssi2_ctrl_pins[] = { | ||
3051 | /* SCK, WS */ | ||
3052 | RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 17), | ||
3053 | }; | ||
3054 | static const unsigned int ssi2_ctrl_mux[] = { | ||
3055 | SSI_SCK2_MARK, SSI_WS2_MARK, | ||
3056 | }; | ||
3057 | static const unsigned int ssi3_data_pins[] = { | ||
3058 | /* SDATA3 */ | ||
3059 | RCAR_GP_PIN(4, 10), | ||
3060 | }; | ||
3061 | static const unsigned int ssi3_data_mux[] = { | ||
3062 | SSI_SDATA3_MARK | ||
3063 | }; | ||
3064 | static const unsigned int ssi34_ctrl_pins[] = { | ||
3065 | /* SCK, WS */ | ||
3066 | RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9), | ||
3067 | }; | ||
3068 | static const unsigned int ssi34_ctrl_mux[] = { | ||
3069 | SSI_SCK34_MARK, SSI_WS34_MARK, | ||
3070 | }; | ||
3071 | static const unsigned int ssi4_data_pins[] = { | ||
3072 | /* SDATA4 */ | ||
3073 | RCAR_GP_PIN(4, 13), | ||
3074 | }; | ||
3075 | static const unsigned int ssi4_data_mux[] = { | ||
3076 | SSI_SDATA4_MARK, | ||
3077 | }; | ||
3078 | static const unsigned int ssi4_ctrl_pins[] = { | ||
3079 | /* SCK, WS */ | ||
3080 | RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12), | ||
3081 | }; | ||
3082 | static const unsigned int ssi4_ctrl_mux[] = { | ||
3083 | SSI_SCK4_MARK, SSI_WS4_MARK, | ||
3084 | }; | ||
3085 | static const unsigned int ssi5_pins[] = { | ||
3086 | /* SDATA5, SCK, WS */ | ||
3087 | RCAR_GP_PIN(4, 16), RCAR_GP_PIN(4, 14), RCAR_GP_PIN(4, 15), | ||
3088 | }; | ||
3089 | static const unsigned int ssi5_mux[] = { | ||
3090 | SSI_SDATA5_MARK, SSI_SCK5_MARK, SSI_WS5_MARK, | ||
3091 | }; | ||
3092 | static const unsigned int ssi5_b_pins[] = { | ||
3093 | /* SDATA5, SCK, WS */ | ||
3094 | RCAR_GP_PIN(0, 26), RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25), | ||
3095 | }; | ||
3096 | static const unsigned int ssi5_b_mux[] = { | ||
3097 | SSI_SDATA5_B_MARK, SSI_SCK5_B_MARK, SSI_WS5_B_MARK | ||
3098 | }; | ||
3099 | static const unsigned int ssi5_c_pins[] = { | ||
3100 | /* SDATA5, SCK, WS */ | ||
3101 | RCAR_GP_PIN(4, 24), RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12), | ||
3102 | }; | ||
3103 | static const unsigned int ssi5_c_mux[] = { | ||
3104 | SSI_SDATA5_C_MARK, SSI_SCK5_C_MARK, SSI_WS5_C_MARK, | ||
3105 | }; | ||
3106 | static const unsigned int ssi6_pins[] = { | ||
3107 | /* SDATA6, SCK, WS */ | ||
3108 | RCAR_GP_PIN(4, 19), RCAR_GP_PIN(4, 17), RCAR_GP_PIN(4, 18), | ||
3109 | }; | ||
3110 | static const unsigned int ssi6_mux[] = { | ||
3111 | SSI_SDATA6_MARK, SSI_SCK6_MARK, SSI_WS6_MARK, | ||
3112 | }; | ||
3113 | static const unsigned int ssi6_b_pins[] = { | ||
3114 | /* SDATA6, SCK, WS */ | ||
3115 | RCAR_GP_PIN(1, 29), RCAR_GP_PIN(1, 25), RCAR_GP_PIN(1, 27), | ||
3116 | }; | ||
3117 | static const unsigned int ssi6_b_mux[] = { | ||
3118 | SSI_SDATA6_B_MARK, SSI_SCK6_B_MARK, SSI_WS6_B_MARK, | ||
3119 | }; | ||
3120 | static const unsigned int ssi7_data_pins[] = { | ||
3121 | /* SDATA7 */ | ||
3122 | RCAR_GP_PIN(4, 22), | ||
3123 | }; | ||
3124 | static const unsigned int ssi7_data_mux[] = { | ||
3125 | SSI_SDATA7_MARK, | ||
3126 | }; | ||
3127 | static const unsigned int ssi7_b_data_pins[] = { | ||
3128 | /* SDATA7 */ | ||
3129 | RCAR_GP_PIN(4, 22), | ||
3130 | }; | ||
3131 | static const unsigned int ssi7_b_data_mux[] = { | ||
3132 | SSI_SDATA7_B_MARK, | ||
3133 | }; | ||
3134 | static const unsigned int ssi7_c_data_pins[] = { | ||
3135 | /* SDATA7 */ | ||
3136 | RCAR_GP_PIN(1, 26), | ||
3137 | }; | ||
3138 | static const unsigned int ssi7_c_data_mux[] = { | ||
3139 | SSI_SDATA7_C_MARK, | ||
3140 | }; | ||
3141 | static const unsigned int ssi78_ctrl_pins[] = { | ||
3142 | /* SCK, WS */ | ||
3143 | RCAR_GP_PIN(4, 20), RCAR_GP_PIN(4, 21), | ||
3144 | }; | ||
3145 | static const unsigned int ssi78_ctrl_mux[] = { | ||
3146 | SSI_SCK78_MARK, SSI_WS78_MARK, | ||
3147 | }; | ||
3148 | static const unsigned int ssi78_b_ctrl_pins[] = { | ||
3149 | /* SCK, WS */ | ||
3150 | RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 24), | ||
3151 | }; | ||
3152 | static const unsigned int ssi78_b_ctrl_mux[] = { | ||
3153 | SSI_SCK78_B_MARK, SSI_WS78_B_MARK, | ||
3154 | }; | ||
3155 | static const unsigned int ssi78_c_ctrl_pins[] = { | ||
3156 | /* SCK, WS */ | ||
3157 | RCAR_GP_PIN(1, 24), RCAR_GP_PIN(1, 25), | ||
3158 | }; | ||
3159 | static const unsigned int ssi78_c_ctrl_mux[] = { | ||
3160 | SSI_SCK78_C_MARK, SSI_WS78_C_MARK, | ||
3161 | }; | ||
3162 | static const unsigned int ssi8_data_pins[] = { | ||
3163 | /* SDATA8 */ | ||
3164 | RCAR_GP_PIN(4, 23), | ||
3165 | }; | ||
3166 | static const unsigned int ssi8_data_mux[] = { | ||
3167 | SSI_SDATA8_MARK, | ||
3168 | }; | ||
3169 | static const unsigned int ssi8_b_data_pins[] = { | ||
3170 | /* SDATA8 */ | ||
3171 | RCAR_GP_PIN(4, 23), | ||
3172 | }; | ||
3173 | static const unsigned int ssi8_b_data_mux[] = { | ||
3174 | SSI_SDATA8_B_MARK, | ||
3175 | }; | ||
3176 | static const unsigned int ssi8_c_data_pins[] = { | ||
3177 | /* SDATA8 */ | ||
3178 | RCAR_GP_PIN(1, 27), | ||
3179 | }; | ||
3180 | static const unsigned int ssi8_c_data_mux[] = { | ||
3181 | SSI_SDATA8_C_MARK, | ||
3182 | }; | ||
3183 | static const unsigned int ssi9_data_pins[] = { | ||
3184 | /* SDATA9 */ | ||
3185 | RCAR_GP_PIN(4, 24), | ||
3186 | }; | ||
3187 | static const unsigned int ssi9_data_mux[] = { | ||
3188 | SSI_SDATA9_MARK, | ||
3189 | }; | ||
3190 | static const unsigned int ssi9_ctrl_pins[] = { | ||
3191 | /* SCK, WS */ | ||
3192 | RCAR_GP_PIN(5, 10), RCAR_GP_PIN(5, 11), | ||
3193 | }; | ||
3194 | static const unsigned int ssi9_ctrl_mux[] = { | ||
3195 | SSI_SCK9_MARK, SSI_WS9_MARK, | ||
3196 | }; | ||
2964 | /* - TPU0 ------------------------------------------------------------------- */ | 3197 | /* - TPU0 ------------------------------------------------------------------- */ |
2965 | static const unsigned int tpu0_to0_pins[] = { | 3198 | static const unsigned int tpu0_to0_pins[] = { |
2966 | /* TO */ | 3199 | /* TO */ |
@@ -3014,59 +3247,110 @@ static const unsigned int usb2_pins[] = { | |||
3014 | static const unsigned int usb2_mux[] = { | 3247 | static const unsigned int usb2_mux[] = { |
3015 | USB2_PWEN_MARK, USB2_OVC_MARK, | 3248 | USB2_PWEN_MARK, USB2_OVC_MARK, |
3016 | }; | 3249 | }; |
3017 | /* - VIN0 ------------------------------------------------------------------- */ | 3250 | |
3018 | static const unsigned int vin0_data_g_pins[] = { | 3251 | union vin_data { |
3019 | RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9), RCAR_GP_PIN(0, 10), | 3252 | unsigned int data24[24]; |
3020 | RCAR_GP_PIN(0, 11), RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1), | 3253 | unsigned int data20[20]; |
3021 | RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3), | 3254 | unsigned int data16[16]; |
3022 | }; | 3255 | unsigned int data12[12]; |
3023 | static const unsigned int vin0_data_g_mux[] = { | 3256 | unsigned int data10[10]; |
3024 | VI0_G0_MARK, VI0_G1_MARK, VI0_G2_MARK, | 3257 | unsigned int data8[8]; |
3025 | VI0_G3_MARK, VI0_G4_MARK, VI0_G5_MARK, | 3258 | unsigned int data4[4]; |
3026 | VI0_G6_MARK, VI0_G7_MARK, | ||
3027 | }; | 3259 | }; |
3028 | static const unsigned int vin0_data_r_pins[] = { | 3260 | |
3029 | RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 6), | 3261 | #define VIN_DATA_PIN_GROUP(n, s) \ |
3030 | RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25), | 3262 | { \ |
3031 | RCAR_GP_PIN(0, 26), RCAR_GP_PIN(1, 11), | 3263 | .name = #n#s, \ |
3264 | .pins = n##_pins.data##s, \ | ||
3265 | .mux = n##_mux.data##s, \ | ||
3266 | .nr_pins = ARRAY_SIZE(n##_pins.data##s), \ | ||
3267 | } | ||
3268 | |||
3269 | /* - VIN0 ------------------------------------------------------------------- */ | ||
3270 | static const union vin_data vin0_data_pins = { | ||
3271 | .data24 = { | ||
3272 | /* B */ | ||
3273 | RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2), | ||
3274 | RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4), | ||
3275 | RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6), | ||
3276 | RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8), | ||
3277 | /* G */ | ||
3278 | RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9), | ||
3279 | RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11), | ||
3280 | RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1), | ||
3281 | RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3), | ||
3282 | /* R */ | ||
3283 | RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5), | ||
3284 | RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7), | ||
3285 | RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25), | ||
3286 | RCAR_GP_PIN(0, 26), RCAR_GP_PIN(1, 11), | ||
3287 | }, | ||
3032 | }; | 3288 | }; |
3033 | static const unsigned int vin0_data_r_mux[] = { | 3289 | static const union vin_data vin0_data_mux = { |
3034 | VI0_R0_MARK, VI0_R1_MARK, VI0_R2_MARK, | 3290 | .data24 = { |
3035 | VI0_R3_MARK, VI0_R4_MARK, VI0_R5_MARK, | 3291 | /* B */ |
3036 | VI0_R6_MARK, VI0_R7_MARK, | 3292 | VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK, |
3293 | VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK, | ||
3294 | VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK, | ||
3295 | VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK, | ||
3296 | /* G */ | ||
3297 | VI0_G0_MARK, VI0_G1_MARK, | ||
3298 | VI0_G2_MARK, VI0_G3_MARK, | ||
3299 | VI0_G4_MARK, VI0_G5_MARK, | ||
3300 | VI0_G6_MARK, VI0_G7_MARK, | ||
3301 | /* R */ | ||
3302 | VI0_R0_MARK, VI0_R1_MARK, | ||
3303 | VI0_R2_MARK, VI0_R3_MARK, | ||
3304 | VI0_R4_MARK, VI0_R5_MARK, | ||
3305 | VI0_R6_MARK, VI0_R7_MARK, | ||
3306 | }, | ||
3037 | }; | 3307 | }; |
3038 | static const unsigned int vin0_data_b_pins[] = { | 3308 | static const unsigned int vin0_data18_pins[] = { |
3039 | RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3), | 3309 | /* B */ |
3040 | RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6), | 3310 | RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4), |
3311 | RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6), | ||
3041 | RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8), | 3312 | RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8), |
3313 | /* G */ | ||
3314 | RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11), | ||
3315 | RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1), | ||
3316 | RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3), | ||
3317 | /* R */ | ||
3318 | RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7), | ||
3319 | RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25), | ||
3320 | RCAR_GP_PIN(0, 26), RCAR_GP_PIN(1, 11), | ||
3042 | }; | 3321 | }; |
3043 | static const unsigned int vin0_data_b_mux[] = { | 3322 | static const unsigned int vin0_data18_mux[] = { |
3044 | VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK, VI0_DATA2_VI0_B2_MARK, | 3323 | /* B */ |
3045 | VI0_DATA3_VI0_B3_MARK, VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK, | 3324 | VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK, |
3325 | VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK, | ||
3046 | VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK, | 3326 | VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK, |
3327 | /* G */ | ||
3328 | VI0_G2_MARK, VI0_G3_MARK, | ||
3329 | VI0_G4_MARK, VI0_G5_MARK, | ||
3330 | VI0_G6_MARK, VI0_G7_MARK, | ||
3331 | /* R */ | ||
3332 | VI0_R2_MARK, VI0_R3_MARK, | ||
3333 | VI0_R4_MARK, VI0_R5_MARK, | ||
3334 | VI0_R6_MARK, VI0_R7_MARK, | ||
3047 | }; | 3335 | }; |
3048 | static const unsigned int vin0_hsync_signal_pins[] = { | 3336 | static const unsigned int vin0_sync_pins[] = { |
3049 | RCAR_GP_PIN(0, 12), | 3337 | RCAR_GP_PIN(0, 12), /* HSYNC */ |
3338 | RCAR_GP_PIN(0, 13), /* VSYNC */ | ||
3050 | }; | 3339 | }; |
3051 | static const unsigned int vin0_hsync_signal_mux[] = { | 3340 | static const unsigned int vin0_sync_mux[] = { |
3052 | VI0_HSYNC_N_MARK, | 3341 | VI0_HSYNC_N_MARK, |
3053 | }; | ||
3054 | static const unsigned int vin0_vsync_signal_pins[] = { | ||
3055 | RCAR_GP_PIN(0, 13), | ||
3056 | }; | ||
3057 | static const unsigned int vin0_vsync_signal_mux[] = { | ||
3058 | VI0_VSYNC_N_MARK, | 3342 | VI0_VSYNC_N_MARK, |
3059 | }; | 3343 | }; |
3060 | static const unsigned int vin0_field_signal_pins[] = { | 3344 | static const unsigned int vin0_field_pins[] = { |
3061 | RCAR_GP_PIN(0, 15), | 3345 | RCAR_GP_PIN(0, 15), |
3062 | }; | 3346 | }; |
3063 | static const unsigned int vin0_field_signal_mux[] = { | 3347 | static const unsigned int vin0_field_mux[] = { |
3064 | VI0_FIELD_MARK, | 3348 | VI0_FIELD_MARK, |
3065 | }; | 3349 | }; |
3066 | static const unsigned int vin0_data_enable_pins[] = { | 3350 | static const unsigned int vin0_clkenb_pins[] = { |
3067 | RCAR_GP_PIN(0, 14), | 3351 | RCAR_GP_PIN(0, 14), |
3068 | }; | 3352 | }; |
3069 | static const unsigned int vin0_data_enable_mux[] = { | 3353 | static const unsigned int vin0_clkenb_mux[] = { |
3070 | VI0_CLKENB_MARK, | 3354 | VI0_CLKENB_MARK, |
3071 | }; | 3355 | }; |
3072 | static const unsigned int vin0_clk_pins[] = { | 3356 | static const unsigned int vin0_clk_pins[] = { |
@@ -3076,15 +3360,91 @@ static const unsigned int vin0_clk_mux[] = { | |||
3076 | VI0_CLK_MARK, | 3360 | VI0_CLK_MARK, |
3077 | }; | 3361 | }; |
3078 | /* - VIN1 ------------------------------------------------------------------- */ | 3362 | /* - VIN1 ------------------------------------------------------------------- */ |
3079 | static const unsigned int vin1_data_pins[] = { | 3363 | static const union vin_data vin1_data_pins = { |
3080 | RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11), RCAR_GP_PIN(2, 12), | 3364 | .data24 = { |
3081 | RCAR_GP_PIN(2, 13), RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15), | 3365 | /* B */ |
3082 | RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17), | 3366 | RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11), |
3367 | RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13), | ||
3368 | RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15), | ||
3369 | RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17), | ||
3370 | /* G */ | ||
3371 | RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15), | ||
3372 | RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20), | ||
3373 | RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12), | ||
3374 | RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7), | ||
3375 | /* R */ | ||
3376 | RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28), | ||
3377 | RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4), | ||
3378 | RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), | ||
3379 | RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8), | ||
3380 | }, | ||
3083 | }; | 3381 | }; |
3084 | static const unsigned int vin1_data_mux[] = { | 3382 | static const union vin_data vin1_data_mux = { |
3085 | VI1_DATA0_VI1_B0_MARK, VI1_DATA1_VI1_B1_MARK, VI1_DATA2_VI1_B2_MARK, | 3383 | .data24 = { |
3086 | VI1_DATA3_VI1_B3_MARK, VI1_DATA4_VI1_B4_MARK, VI1_DATA5_VI1_B5_MARK, | 3384 | /* B */ |
3385 | VI1_DATA0_VI1_B0_MARK, VI1_DATA1_VI1_B1_MARK, | ||
3386 | VI1_DATA2_VI1_B2_MARK, VI1_DATA3_VI1_B3_MARK, | ||
3387 | VI1_DATA4_VI1_B4_MARK, VI1_DATA5_VI1_B5_MARK, | ||
3388 | VI1_DATA6_VI1_B6_MARK, VI1_DATA7_VI1_B7_MARK, | ||
3389 | /* G */ | ||
3390 | VI1_G0_MARK, VI1_G1_MARK, | ||
3391 | VI1_G2_MARK, VI1_G3_MARK, | ||
3392 | VI1_G4_MARK, VI1_G5_MARK, | ||
3393 | VI1_G6_MARK, VI1_G7_MARK, | ||
3394 | /* R */ | ||
3395 | VI1_R0_MARK, VI1_R1_MARK, | ||
3396 | VI1_R2_MARK, VI1_R3_MARK, | ||
3397 | VI1_R4_MARK, VI1_R5_MARK, | ||
3398 | VI1_R6_MARK, VI1_R7_MARK, | ||
3399 | }, | ||
3400 | }; | ||
3401 | static const unsigned int vin1_data18_pins[] = { | ||
3402 | /* B */ | ||
3403 | RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13), | ||
3404 | RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15), | ||
3405 | RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17), | ||
3406 | /* G */ | ||
3407 | RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20), | ||
3408 | RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12), | ||
3409 | RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7), | ||
3410 | /* R */ | ||
3411 | RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4), | ||
3412 | RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), | ||
3413 | RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8), | ||
3414 | }; | ||
3415 | static const unsigned int vin1_data18_mux[] = { | ||
3416 | /* B */ | ||
3417 | VI1_DATA2_VI1_B2_MARK, VI1_DATA3_VI1_B3_MARK, | ||
3418 | VI1_DATA4_VI1_B4_MARK, VI1_DATA5_VI1_B5_MARK, | ||
3087 | VI1_DATA6_VI1_B6_MARK, VI1_DATA7_VI1_B7_MARK, | 3419 | VI1_DATA6_VI1_B6_MARK, VI1_DATA7_VI1_B7_MARK, |
3420 | /* G */ | ||
3421 | VI1_G2_MARK, VI1_G3_MARK, | ||
3422 | VI1_G4_MARK, VI1_G5_MARK, | ||
3423 | VI1_G6_MARK, VI1_G7_MARK, | ||
3424 | /* R */ | ||
3425 | VI1_R2_MARK, VI1_R3_MARK, | ||
3426 | VI1_R4_MARK, VI1_R5_MARK, | ||
3427 | VI1_R6_MARK, VI1_R7_MARK, | ||
3428 | }; | ||
3429 | static const unsigned int vin1_sync_pins[] = { | ||
3430 | RCAR_GP_PIN(1, 24), /* HSYNC */ | ||
3431 | RCAR_GP_PIN(1, 25), /* VSYNC */ | ||
3432 | }; | ||
3433 | static const unsigned int vin1_sync_mux[] = { | ||
3434 | VI1_HSYNC_N_MARK, | ||
3435 | VI1_VSYNC_N_MARK, | ||
3436 | }; | ||
3437 | static const unsigned int vin1_field_pins[] = { | ||
3438 | RCAR_GP_PIN(1, 13), | ||
3439 | }; | ||
3440 | static const unsigned int vin1_field_mux[] = { | ||
3441 | VI1_FIELD_MARK, | ||
3442 | }; | ||
3443 | static const unsigned int vin1_clkenb_pins[] = { | ||
3444 | RCAR_GP_PIN(1, 26), | ||
3445 | }; | ||
3446 | static const unsigned int vin1_clkenb_mux[] = { | ||
3447 | VI1_CLKENB_MARK, | ||
3088 | }; | 3448 | }; |
3089 | static const unsigned int vin1_clk_pins[] = { | 3449 | static const unsigned int vin1_clk_pins[] = { |
3090 | RCAR_GP_PIN(2, 9), | 3450 | RCAR_GP_PIN(2, 9), |
@@ -3092,8 +3452,147 @@ static const unsigned int vin1_clk_pins[] = { | |||
3092 | static const unsigned int vin1_clk_mux[] = { | 3452 | static const unsigned int vin1_clk_mux[] = { |
3093 | VI1_CLK_MARK, | 3453 | VI1_CLK_MARK, |
3094 | }; | 3454 | }; |
3455 | /* - VIN2 ----------------------------------------------------------------- */ | ||
3456 | static const union vin_data vin2_data_pins = { | ||
3457 | .data24 = { | ||
3458 | /* B */ | ||
3459 | RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9), | ||
3460 | RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11), | ||
3461 | RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13), | ||
3462 | RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15), | ||
3463 | /* G */ | ||
3464 | RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28), | ||
3465 | RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 10), | ||
3466 | RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5), | ||
3467 | RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7), | ||
3468 | /* R */ | ||
3469 | RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13), | ||
3470 | RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15), | ||
3471 | RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20), | ||
3472 | RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 24), | ||
3473 | }, | ||
3474 | }; | ||
3475 | static const union vin_data vin2_data_mux = { | ||
3476 | .data24 = { | ||
3477 | /* B */ | ||
3478 | VI2_DATA0_VI2_B0_MARK, VI2_DATA1_VI2_B1_MARK, | ||
3479 | VI2_DATA2_VI2_B2_MARK, VI2_DATA3_VI2_B3_MARK, | ||
3480 | VI2_DATA4_VI2_B4_MARK, VI2_DATA5_VI2_B5_MARK, | ||
3481 | VI2_DATA6_VI2_B6_MARK, VI2_DATA7_VI2_B7_MARK, | ||
3482 | /* G */ | ||
3483 | VI2_G0_MARK, VI2_G1_MARK, | ||
3484 | VI2_G2_MARK, VI2_G3_MARK, | ||
3485 | VI2_G4_MARK, VI2_G5_MARK, | ||
3486 | VI2_G6_MARK, VI2_G7_MARK, | ||
3487 | /* R */ | ||
3488 | VI2_R0_MARK, VI2_R1_MARK, | ||
3489 | VI2_R2_MARK, VI2_R3_MARK, | ||
3490 | VI2_R4_MARK, VI2_R5_MARK, | ||
3491 | VI2_R6_MARK, VI2_R7_MARK, | ||
3492 | }, | ||
3493 | }; | ||
3494 | static const unsigned int vin2_data18_pins[] = { | ||
3495 | /* B */ | ||
3496 | RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11), | ||
3497 | RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13), | ||
3498 | RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15), | ||
3499 | /* G */ | ||
3500 | RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 10), | ||
3501 | RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5), | ||
3502 | RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7), | ||
3503 | /* R */ | ||
3504 | RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15), | ||
3505 | RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20), | ||
3506 | RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 24), | ||
3507 | }; | ||
3508 | static const unsigned int vin2_data18_mux[] = { | ||
3509 | /* B */ | ||
3510 | VI2_DATA2_VI2_B2_MARK, VI2_DATA3_VI2_B3_MARK, | ||
3511 | VI2_DATA4_VI2_B4_MARK, VI2_DATA5_VI2_B5_MARK, | ||
3512 | VI2_DATA6_VI2_B6_MARK, VI2_DATA7_VI2_B7_MARK, | ||
3513 | /* G */ | ||
3514 | VI2_G2_MARK, VI2_G3_MARK, | ||
3515 | VI2_G4_MARK, VI2_G5_MARK, | ||
3516 | VI2_G6_MARK, VI2_G7_MARK, | ||
3517 | /* R */ | ||
3518 | VI2_R2_MARK, VI2_R3_MARK, | ||
3519 | VI2_R4_MARK, VI2_R5_MARK, | ||
3520 | VI2_R6_MARK, VI2_R7_MARK, | ||
3521 | }; | ||
3522 | static const unsigned int vin2_sync_pins[] = { | ||
3523 | RCAR_GP_PIN(1, 16), /* HSYNC */ | ||
3524 | RCAR_GP_PIN(1, 21), /* VSYNC */ | ||
3525 | }; | ||
3526 | static const unsigned int vin2_sync_mux[] = { | ||
3527 | VI2_HSYNC_N_MARK, | ||
3528 | VI2_VSYNC_N_MARK, | ||
3529 | }; | ||
3530 | static const unsigned int vin2_field_pins[] = { | ||
3531 | RCAR_GP_PIN(1, 9), | ||
3532 | }; | ||
3533 | static const unsigned int vin2_field_mux[] = { | ||
3534 | VI2_FIELD_MARK, | ||
3535 | }; | ||
3536 | static const unsigned int vin2_clkenb_pins[] = { | ||
3537 | RCAR_GP_PIN(1, 8), | ||
3538 | }; | ||
3539 | static const unsigned int vin2_clkenb_mux[] = { | ||
3540 | VI2_CLKENB_MARK, | ||
3541 | }; | ||
3542 | static const unsigned int vin2_clk_pins[] = { | ||
3543 | RCAR_GP_PIN(1, 11), | ||
3544 | }; | ||
3545 | static const unsigned int vin2_clk_mux[] = { | ||
3546 | VI2_CLK_MARK, | ||
3547 | }; | ||
3548 | /* - VIN3 ----------------------------------------------------------------- */ | ||
3549 | static const unsigned int vin3_data8_pins[] = { | ||
3550 | RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1), | ||
3551 | RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3), | ||
3552 | RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5), | ||
3553 | RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7), | ||
3554 | }; | ||
3555 | static const unsigned int vin3_data8_mux[] = { | ||
3556 | VI3_DATA0_MARK, VI3_DATA1_MARK, | ||
3557 | VI3_DATA2_MARK, VI3_DATA3_MARK, | ||
3558 | VI3_DATA4_MARK, VI3_DATA5_MARK, | ||
3559 | VI3_DATA6_MARK, VI3_DATA7_MARK, | ||
3560 | }; | ||
3561 | static const unsigned int vin3_sync_pins[] = { | ||
3562 | RCAR_GP_PIN(1, 16), /* HSYNC */ | ||
3563 | RCAR_GP_PIN(1, 17), /* VSYNC */ | ||
3564 | }; | ||
3565 | static const unsigned int vin3_sync_mux[] = { | ||
3566 | VI3_HSYNC_N_MARK, | ||
3567 | VI2_VSYNC_N_MARK, | ||
3568 | }; | ||
3569 | static const unsigned int vin3_field_pins[] = { | ||
3570 | RCAR_GP_PIN(1, 15), | ||
3571 | }; | ||
3572 | static const unsigned int vin3_field_mux[] = { | ||
3573 | VI3_FIELD_MARK, | ||
3574 | }; | ||
3575 | static const unsigned int vin3_clkenb_pins[] = { | ||
3576 | RCAR_GP_PIN(1, 14), | ||
3577 | }; | ||
3578 | static const unsigned int vin3_clkenb_mux[] = { | ||
3579 | VI3_CLKENB_MARK, | ||
3580 | }; | ||
3581 | static const unsigned int vin3_clk_pins[] = { | ||
3582 | RCAR_GP_PIN(1, 23), | ||
3583 | }; | ||
3584 | static const unsigned int vin3_clk_mux[] = { | ||
3585 | VI3_CLK_MARK, | ||
3586 | }; | ||
3095 | 3587 | ||
3096 | static const struct sh_pfc_pin_group pinmux_groups[] = { | 3588 | static const struct sh_pfc_pin_group pinmux_groups[] = { |
3589 | SH_PFC_PIN_GROUP(audio_clk_a), | ||
3590 | SH_PFC_PIN_GROUP(audio_clk_b), | ||
3591 | SH_PFC_PIN_GROUP(audio_clk_c), | ||
3592 | SH_PFC_PIN_GROUP(audio_clkout), | ||
3593 | SH_PFC_PIN_GROUP(audio_clkout_b), | ||
3594 | SH_PFC_PIN_GROUP(audio_clkout_c), | ||
3595 | SH_PFC_PIN_GROUP(audio_clkout_d), | ||
3097 | SH_PFC_PIN_GROUP(du_rgb666), | 3596 | SH_PFC_PIN_GROUP(du_rgb666), |
3098 | SH_PFC_PIN_GROUP(du_rgb888), | 3597 | SH_PFC_PIN_GROUP(du_rgb888), |
3099 | SH_PFC_PIN_GROUP(du_clk_out_0), | 3598 | SH_PFC_PIN_GROUP(du_clk_out_0), |
@@ -3259,6 +3758,32 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { | |||
3259 | SH_PFC_PIN_GROUP(sdhi3_ctrl), | 3758 | SH_PFC_PIN_GROUP(sdhi3_ctrl), |
3260 | SH_PFC_PIN_GROUP(sdhi3_cd), | 3759 | SH_PFC_PIN_GROUP(sdhi3_cd), |
3261 | SH_PFC_PIN_GROUP(sdhi3_wp), | 3760 | SH_PFC_PIN_GROUP(sdhi3_wp), |
3761 | SH_PFC_PIN_GROUP(ssi0_data), | ||
3762 | SH_PFC_PIN_GROUP(ssi0129_ctrl), | ||
3763 | SH_PFC_PIN_GROUP(ssi1_data), | ||
3764 | SH_PFC_PIN_GROUP(ssi1_ctrl), | ||
3765 | SH_PFC_PIN_GROUP(ssi2_data), | ||
3766 | SH_PFC_PIN_GROUP(ssi2_ctrl), | ||
3767 | SH_PFC_PIN_GROUP(ssi3_data), | ||
3768 | SH_PFC_PIN_GROUP(ssi34_ctrl), | ||
3769 | SH_PFC_PIN_GROUP(ssi4_data), | ||
3770 | SH_PFC_PIN_GROUP(ssi4_ctrl), | ||
3771 | SH_PFC_PIN_GROUP(ssi5), | ||
3772 | SH_PFC_PIN_GROUP(ssi5_b), | ||
3773 | SH_PFC_PIN_GROUP(ssi5_c), | ||
3774 | SH_PFC_PIN_GROUP(ssi6), | ||
3775 | SH_PFC_PIN_GROUP(ssi6_b), | ||
3776 | SH_PFC_PIN_GROUP(ssi7_data), | ||
3777 | SH_PFC_PIN_GROUP(ssi7_b_data), | ||
3778 | SH_PFC_PIN_GROUP(ssi7_c_data), | ||
3779 | SH_PFC_PIN_GROUP(ssi78_ctrl), | ||
3780 | SH_PFC_PIN_GROUP(ssi78_b_ctrl), | ||
3781 | SH_PFC_PIN_GROUP(ssi78_c_ctrl), | ||
3782 | SH_PFC_PIN_GROUP(ssi8_data), | ||
3783 | SH_PFC_PIN_GROUP(ssi8_b_data), | ||
3784 | SH_PFC_PIN_GROUP(ssi8_c_data), | ||
3785 | SH_PFC_PIN_GROUP(ssi9_data), | ||
3786 | SH_PFC_PIN_GROUP(ssi9_ctrl), | ||
3262 | SH_PFC_PIN_GROUP(tpu0_to0), | 3787 | SH_PFC_PIN_GROUP(tpu0_to0), |
3263 | SH_PFC_PIN_GROUP(tpu0_to1), | 3788 | SH_PFC_PIN_GROUP(tpu0_to1), |
3264 | SH_PFC_PIN_GROUP(tpu0_to2), | 3789 | SH_PFC_PIN_GROUP(tpu0_to2), |
@@ -3266,16 +3791,54 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { | |||
3266 | SH_PFC_PIN_GROUP(usb0), | 3791 | SH_PFC_PIN_GROUP(usb0), |
3267 | SH_PFC_PIN_GROUP(usb1), | 3792 | SH_PFC_PIN_GROUP(usb1), |
3268 | SH_PFC_PIN_GROUP(usb2), | 3793 | SH_PFC_PIN_GROUP(usb2), |
3269 | SH_PFC_PIN_GROUP(vin0_data_g), | 3794 | VIN_DATA_PIN_GROUP(vin0_data, 24), |
3270 | SH_PFC_PIN_GROUP(vin0_data_r), | 3795 | VIN_DATA_PIN_GROUP(vin0_data, 20), |
3271 | SH_PFC_PIN_GROUP(vin0_data_b), | 3796 | SH_PFC_PIN_GROUP(vin0_data18), |
3272 | SH_PFC_PIN_GROUP(vin0_hsync_signal), | 3797 | VIN_DATA_PIN_GROUP(vin0_data, 16), |
3273 | SH_PFC_PIN_GROUP(vin0_vsync_signal), | 3798 | VIN_DATA_PIN_GROUP(vin0_data, 12), |
3274 | SH_PFC_PIN_GROUP(vin0_field_signal), | 3799 | VIN_DATA_PIN_GROUP(vin0_data, 10), |
3275 | SH_PFC_PIN_GROUP(vin0_data_enable), | 3800 | VIN_DATA_PIN_GROUP(vin0_data, 8), |
3801 | VIN_DATA_PIN_GROUP(vin0_data, 4), | ||
3802 | SH_PFC_PIN_GROUP(vin0_sync), | ||
3803 | SH_PFC_PIN_GROUP(vin0_field), | ||
3804 | SH_PFC_PIN_GROUP(vin0_clkenb), | ||
3276 | SH_PFC_PIN_GROUP(vin0_clk), | 3805 | SH_PFC_PIN_GROUP(vin0_clk), |
3277 | SH_PFC_PIN_GROUP(vin1_data), | 3806 | VIN_DATA_PIN_GROUP(vin1_data, 24), |
3807 | VIN_DATA_PIN_GROUP(vin1_data, 20), | ||
3808 | SH_PFC_PIN_GROUP(vin1_data18), | ||
3809 | VIN_DATA_PIN_GROUP(vin1_data, 16), | ||
3810 | VIN_DATA_PIN_GROUP(vin1_data, 12), | ||
3811 | VIN_DATA_PIN_GROUP(vin1_data, 10), | ||
3812 | VIN_DATA_PIN_GROUP(vin1_data, 8), | ||
3813 | VIN_DATA_PIN_GROUP(vin1_data, 4), | ||
3814 | SH_PFC_PIN_GROUP(vin1_sync), | ||
3815 | SH_PFC_PIN_GROUP(vin1_field), | ||
3816 | SH_PFC_PIN_GROUP(vin1_clkenb), | ||
3278 | SH_PFC_PIN_GROUP(vin1_clk), | 3817 | SH_PFC_PIN_GROUP(vin1_clk), |
3818 | VIN_DATA_PIN_GROUP(vin2_data, 24), | ||
3819 | SH_PFC_PIN_GROUP(vin2_data18), | ||
3820 | VIN_DATA_PIN_GROUP(vin2_data, 16), | ||
3821 | VIN_DATA_PIN_GROUP(vin2_data, 8), | ||
3822 | VIN_DATA_PIN_GROUP(vin2_data, 4), | ||
3823 | SH_PFC_PIN_GROUP(vin2_sync), | ||
3824 | SH_PFC_PIN_GROUP(vin2_field), | ||
3825 | SH_PFC_PIN_GROUP(vin2_clkenb), | ||
3826 | SH_PFC_PIN_GROUP(vin2_clk), | ||
3827 | SH_PFC_PIN_GROUP(vin3_data8), | ||
3828 | SH_PFC_PIN_GROUP(vin3_sync), | ||
3829 | SH_PFC_PIN_GROUP(vin3_field), | ||
3830 | SH_PFC_PIN_GROUP(vin3_clkenb), | ||
3831 | SH_PFC_PIN_GROUP(vin3_clk), | ||
3832 | }; | ||
3833 | |||
3834 | static const char * const audio_clk_groups[] = { | ||
3835 | "audio_clk_a", | ||
3836 | "audio_clk_b", | ||
3837 | "audio_clk_c", | ||
3838 | "audio_clkout", | ||
3839 | "audio_clkout_b", | ||
3840 | "audio_clkout_c", | ||
3841 | "audio_clkout_d", | ||
3279 | }; | 3842 | }; |
3280 | 3843 | ||
3281 | static const char * const du_groups[] = { | 3844 | static const char * const du_groups[] = { |
@@ -3533,6 +4096,35 @@ static const char * const sdhi3_groups[] = { | |||
3533 | "sdhi3_wp", | 4096 | "sdhi3_wp", |
3534 | }; | 4097 | }; |
3535 | 4098 | ||
4099 | static const char * const ssi_groups[] = { | ||
4100 | "ssi0_data", | ||
4101 | "ssi0129_ctrl", | ||
4102 | "ssi1_data", | ||
4103 | "ssi1_ctrl", | ||
4104 | "ssi2_data", | ||
4105 | "ssi2_ctrl", | ||
4106 | "ssi3_data", | ||
4107 | "ssi34_ctrl", | ||
4108 | "ssi4_data", | ||
4109 | "ssi4_ctrl", | ||
4110 | "ssi5", | ||
4111 | "ssi5_b", | ||
4112 | "ssi5_c", | ||
4113 | "ssi6", | ||
4114 | "ssi6_b", | ||
4115 | "ssi7_data", | ||
4116 | "ssi7_b_data", | ||
4117 | "ssi7_c_data", | ||
4118 | "ssi78_ctrl", | ||
4119 | "ssi78_b_ctrl", | ||
4120 | "ssi78_c_ctrl", | ||
4121 | "ssi8_data", | ||
4122 | "ssi8_b_data", | ||
4123 | "ssi8_c_data", | ||
4124 | "ssi9_data", | ||
4125 | "ssi9_ctrl", | ||
4126 | }; | ||
4127 | |||
3536 | static const char * const tpu0_groups[] = { | 4128 | static const char * const tpu0_groups[] = { |
3537 | "tpu0_to0", | 4129 | "tpu0_to0", |
3538 | "tpu0_to1", | 4130 | "tpu0_to1", |
@@ -3553,22 +4145,57 @@ static const char * const usb2_groups[] = { | |||
3553 | }; | 4145 | }; |
3554 | 4146 | ||
3555 | static const char * const vin0_groups[] = { | 4147 | static const char * const vin0_groups[] = { |
3556 | "vin0_data_g", | 4148 | "vin0_data24", |
3557 | "vin0_data_r", | 4149 | "vin0_data20", |
3558 | "vin0_data_b", | 4150 | "vin0_data18", |
3559 | "vin0_hsync_signal", | 4151 | "vin0_data16", |
3560 | "vin0_vsync_signal", | 4152 | "vin0_data12", |
3561 | "vin0_field_signal", | 4153 | "vin0_data10", |
3562 | "vin0_data_enable", | 4154 | "vin0_data8", |
4155 | "vin0_data4", | ||
4156 | "vin0_sync", | ||
4157 | "vin0_field", | ||
4158 | "vin0_clkenb", | ||
3563 | "vin0_clk", | 4159 | "vin0_clk", |
3564 | }; | 4160 | }; |
3565 | 4161 | ||
3566 | static const char * const vin1_groups[] = { | 4162 | static const char * const vin1_groups[] = { |
3567 | "vin1_data", | 4163 | "vin1_data24", |
4164 | "vin1_data20", | ||
4165 | "vin1_data18", | ||
4166 | "vin1_data16", | ||
4167 | "vin1_data12", | ||
4168 | "vin1_data10", | ||
4169 | "vin1_data8", | ||
4170 | "vin1_data4", | ||
4171 | "vin1_sync", | ||
4172 | "vin1_field", | ||
4173 | "vin1_clkenb", | ||
3568 | "vin1_clk", | 4174 | "vin1_clk", |
3569 | }; | 4175 | }; |
3570 | 4176 | ||
4177 | static const char * const vin2_groups[] = { | ||
4178 | "vin2_data24", | ||
4179 | "vin2_data18", | ||
4180 | "vin2_data16", | ||
4181 | "vin2_data8", | ||
4182 | "vin2_data4", | ||
4183 | "vin2_sync", | ||
4184 | "vin2_field", | ||
4185 | "vin2_clkenb", | ||
4186 | "vin2_clk", | ||
4187 | }; | ||
4188 | |||
4189 | static const char * const vin3_groups[] = { | ||
4190 | "vin3_data8", | ||
4191 | "vin3_sync", | ||
4192 | "vin3_field", | ||
4193 | "vin3_clkenb", | ||
4194 | "vin3_clk", | ||
4195 | }; | ||
4196 | |||
3571 | static const struct sh_pfc_function pinmux_functions[] = { | 4197 | static const struct sh_pfc_function pinmux_functions[] = { |
4198 | SH_PFC_FUNCTION(audio_clk), | ||
3572 | SH_PFC_FUNCTION(du), | 4199 | SH_PFC_FUNCTION(du), |
3573 | SH_PFC_FUNCTION(du0), | 4200 | SH_PFC_FUNCTION(du0), |
3574 | SH_PFC_FUNCTION(du1), | 4201 | SH_PFC_FUNCTION(du1), |
@@ -3599,12 +4226,15 @@ static const struct sh_pfc_function pinmux_functions[] = { | |||
3599 | SH_PFC_FUNCTION(sdhi1), | 4226 | SH_PFC_FUNCTION(sdhi1), |
3600 | SH_PFC_FUNCTION(sdhi2), | 4227 | SH_PFC_FUNCTION(sdhi2), |
3601 | SH_PFC_FUNCTION(sdhi3), | 4228 | SH_PFC_FUNCTION(sdhi3), |
4229 | SH_PFC_FUNCTION(ssi), | ||
3602 | SH_PFC_FUNCTION(tpu0), | 4230 | SH_PFC_FUNCTION(tpu0), |
3603 | SH_PFC_FUNCTION(usb0), | 4231 | SH_PFC_FUNCTION(usb0), |
3604 | SH_PFC_FUNCTION(usb1), | 4232 | SH_PFC_FUNCTION(usb1), |
3605 | SH_PFC_FUNCTION(usb2), | 4233 | SH_PFC_FUNCTION(usb2), |
3606 | SH_PFC_FUNCTION(vin0), | 4234 | SH_PFC_FUNCTION(vin0), |
3607 | SH_PFC_FUNCTION(vin1), | 4235 | SH_PFC_FUNCTION(vin1), |
4236 | SH_PFC_FUNCTION(vin2), | ||
4237 | SH_PFC_FUNCTION(vin3), | ||
3608 | }; | 4238 | }; |
3609 | 4239 | ||
3610 | static struct pinmux_cfg_reg pinmux_config_regs[] = { | 4240 | static struct pinmux_cfg_reg pinmux_config_regs[] = { |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index bf76a654c02f..ea02d37bab7c 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c | |||
@@ -1730,11 +1730,11 @@ static const unsigned int du_clk_out_1_pins[] = { | |||
1730 | static const unsigned int du_clk_out_1_mux[] = { | 1730 | static const unsigned int du_clk_out_1_mux[] = { |
1731 | DU1_DOTCLKOUT1_MARK | 1731 | DU1_DOTCLKOUT1_MARK |
1732 | }; | 1732 | }; |
1733 | static const unsigned int du_sync_1_pins[] = { | 1733 | static const unsigned int du_sync_pins[] = { |
1734 | /* EXVSYNC/VSYNC, EXHSYNC/HSYNC, EXDISP/EXODDF/EXCDE */ | 1734 | /* EXVSYNC/VSYNC, EXHSYNC/HSYNC, EXDISP/EXODDF/EXCDE */ |
1735 | RCAR_GP_PIN(3, 29), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 27), | 1735 | RCAR_GP_PIN(3, 29), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 27), |
1736 | }; | 1736 | }; |
1737 | static const unsigned int du_sync_1_mux[] = { | 1737 | static const unsigned int du_sync_mux[] = { |
1738 | DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK, | 1738 | DU1_EXODDF_DU1_ODDF_DISP_CDE_MARK, |
1739 | DU1_EXVSYNC_DU1_VSYNC_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK | 1739 | DU1_EXVSYNC_DU1_VSYNC_MARK, DU1_EXHSYNC_DU1_HSYNC_MARK |
1740 | }; | 1740 | }; |
@@ -1742,6 +1742,9 @@ static const unsigned int du_cde_disp_pins[] = { | |||
1742 | /* CDE DISP */ | 1742 | /* CDE DISP */ |
1743 | RCAR_GP_PIN(3, 31), RCAR_GP_PIN(3, 30), | 1743 | RCAR_GP_PIN(3, 31), RCAR_GP_PIN(3, 30), |
1744 | }; | 1744 | }; |
1745 | static const unsigned int du_cde_disp_mux[] = { | ||
1746 | DU1_CDE_MARK, DU1_DISP_MARK | ||
1747 | }; | ||
1745 | static const unsigned int du0_clk_in_pins[] = { | 1748 | static const unsigned int du0_clk_in_pins[] = { |
1746 | /* CLKIN */ | 1749 | /* CLKIN */ |
1747 | RCAR_GP_PIN(6, 31), | 1750 | RCAR_GP_PIN(6, 31), |
@@ -1749,15 +1752,26 @@ static const unsigned int du0_clk_in_pins[] = { | |||
1749 | static const unsigned int du0_clk_in_mux[] = { | 1752 | static const unsigned int du0_clk_in_mux[] = { |
1750 | DU0_DOTCLKIN_MARK | 1753 | DU0_DOTCLKIN_MARK |
1751 | }; | 1754 | }; |
1752 | static const unsigned int du_cde_disp_mux[] = { | ||
1753 | DU1_CDE_MARK, DU1_DISP_MARK | ||
1754 | }; | ||
1755 | static const unsigned int du1_clk_in_pins[] = { | 1755 | static const unsigned int du1_clk_in_pins[] = { |
1756 | /* CLKIN */ | 1756 | /* CLKIN */ |
1757 | RCAR_GP_PIN(7, 20), RCAR_GP_PIN(7, 19), RCAR_GP_PIN(3, 24), | 1757 | RCAR_GP_PIN(3, 24), |
1758 | }; | 1758 | }; |
1759 | static const unsigned int du1_clk_in_mux[] = { | 1759 | static const unsigned int du1_clk_in_mux[] = { |
1760 | DU1_DOTCLKIN_C_MARK, DU1_DOTCLKIN_B_MARK, DU1_DOTCLKIN_MARK | 1760 | DU1_DOTCLKIN_MARK |
1761 | }; | ||
1762 | static const unsigned int du1_clk_in_b_pins[] = { | ||
1763 | /* CLKIN */ | ||
1764 | RCAR_GP_PIN(7, 19), | ||
1765 | }; | ||
1766 | static const unsigned int du1_clk_in_b_mux[] = { | ||
1767 | DU1_DOTCLKIN_B_MARK, | ||
1768 | }; | ||
1769 | static const unsigned int du1_clk_in_c_pins[] = { | ||
1770 | /* CLKIN */ | ||
1771 | RCAR_GP_PIN(7, 20), | ||
1772 | }; | ||
1773 | static const unsigned int du1_clk_in_c_mux[] = { | ||
1774 | DU1_DOTCLKIN_C_MARK, | ||
1761 | }; | 1775 | }; |
1762 | /* - ETH -------------------------------------------------------------------- */ | 1776 | /* - ETH -------------------------------------------------------------------- */ |
1763 | static const unsigned int eth_link_pins[] = { | 1777 | static const unsigned int eth_link_pins[] = { |
@@ -2670,10 +2684,12 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { | |||
2670 | SH_PFC_PIN_GROUP(du_rgb888), | 2684 | SH_PFC_PIN_GROUP(du_rgb888), |
2671 | SH_PFC_PIN_GROUP(du_clk_out_0), | 2685 | SH_PFC_PIN_GROUP(du_clk_out_0), |
2672 | SH_PFC_PIN_GROUP(du_clk_out_1), | 2686 | SH_PFC_PIN_GROUP(du_clk_out_1), |
2673 | SH_PFC_PIN_GROUP(du_sync_1), | 2687 | SH_PFC_PIN_GROUP(du_sync), |
2674 | SH_PFC_PIN_GROUP(du_cde_disp), | 2688 | SH_PFC_PIN_GROUP(du_cde_disp), |
2675 | SH_PFC_PIN_GROUP(du0_clk_in), | 2689 | SH_PFC_PIN_GROUP(du0_clk_in), |
2676 | SH_PFC_PIN_GROUP(du1_clk_in), | 2690 | SH_PFC_PIN_GROUP(du1_clk_in), |
2691 | SH_PFC_PIN_GROUP(du1_clk_in_b), | ||
2692 | SH_PFC_PIN_GROUP(du1_clk_in_c), | ||
2677 | SH_PFC_PIN_GROUP(eth_link), | 2693 | SH_PFC_PIN_GROUP(eth_link), |
2678 | SH_PFC_PIN_GROUP(eth_magic), | 2694 | SH_PFC_PIN_GROUP(eth_magic), |
2679 | SH_PFC_PIN_GROUP(eth_mdio), | 2695 | SH_PFC_PIN_GROUP(eth_mdio), |
@@ -2805,7 +2821,7 @@ static const char * const du_groups[] = { | |||
2805 | "du_rgb888", | 2821 | "du_rgb888", |
2806 | "du_clk_out_0", | 2822 | "du_clk_out_0", |
2807 | "du_clk_out_1", | 2823 | "du_clk_out_1", |
2808 | "du_sync_1", | 2824 | "du_sync", |
2809 | "du_cde_disp", | 2825 | "du_cde_disp", |
2810 | }; | 2826 | }; |
2811 | 2827 | ||
@@ -2815,6 +2831,8 @@ static const char * const du0_groups[] = { | |||
2815 | 2831 | ||
2816 | static const char * const du1_groups[] = { | 2832 | static const char * const du1_groups[] = { |
2817 | "du1_clk_in", | 2833 | "du1_clk_in", |
2834 | "du1_clk_in_b", | ||
2835 | "du1_clk_in_c", | ||
2818 | }; | 2836 | }; |
2819 | 2837 | ||
2820 | static const char * const eth_groups[] = { | 2838 | static const char * const eth_groups[] = { |
@@ -2840,20 +2858,29 @@ static const char * const mmc_groups[] = { | |||
2840 | 2858 | ||
2841 | static const char * const msiof0_groups[] = { | 2859 | static const char * const msiof0_groups[] = { |
2842 | "msiof0_clk", | 2860 | "msiof0_clk", |
2843 | "msiof0_ctrl", | 2861 | "msiof0_sync", |
2844 | "msiof0_data", | 2862 | "msiof0_ss1", |
2863 | "msiof0_ss2", | ||
2864 | "msiof0_rx", | ||
2865 | "msiof0_tx", | ||
2845 | }; | 2866 | }; |
2846 | 2867 | ||
2847 | static const char * const msiof1_groups[] = { | 2868 | static const char * const msiof1_groups[] = { |
2848 | "msiof1_clk", | 2869 | "msiof1_clk", |
2849 | "msiof1_ctrl", | 2870 | "msiof1_sync", |
2850 | "msiof1_data", | 2871 | "msiof1_ss1", |
2872 | "msiof1_ss2", | ||
2873 | "msiof1_rx", | ||
2874 | "msiof1_tx", | ||
2851 | }; | 2875 | }; |
2852 | 2876 | ||
2853 | static const char * const msiof2_groups[] = { | 2877 | static const char * const msiof2_groups[] = { |
2854 | "msiof2_clk", | 2878 | "msiof2_clk", |
2855 | "msiof2_ctrl", | 2879 | "msiof2_sync", |
2856 | "msiof2_data", | 2880 | "msiof2_ss1", |
2881 | "msiof2_ss2", | ||
2882 | "msiof2_rx", | ||
2883 | "msiof2_tx", | ||
2857 | }; | 2884 | }; |
2858 | 2885 | ||
2859 | static const char * const scif0_groups[] = { | 2886 | static const char * const scif0_groups[] = { |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh7372.c b/drivers/pinctrl/sh-pfc/pfc-sh7372.c index cc097b693820..9f66a5025db0 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh7372.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh7372.c | |||
@@ -2118,17 +2118,6 @@ static const struct sh_pfc_function pinmux_functions[] = { | |||
2118 | SH_PFC_FUNCTION(usb1), | 2118 | SH_PFC_FUNCTION(usb1), |
2119 | }; | 2119 | }; |
2120 | 2120 | ||
2121 | #undef PORTCR | ||
2122 | #define PORTCR(nr, reg) \ | ||
2123 | { \ | ||
2124 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
2125 | _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \ | ||
2126 | PORT##nr##_FN0, PORT##nr##_FN1, \ | ||
2127 | PORT##nr##_FN2, PORT##nr##_FN3, \ | ||
2128 | PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
2129 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
2130 | } | ||
2131 | |||
2132 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { | 2121 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
2133 | PORTCR(0, 0xE6051000), /* PORT0CR */ | 2122 | PORTCR(0, 0xE6051000), /* PORT0CR */ |
2134 | PORTCR(1, 0xE6051001), /* PORT1CR */ | 2123 | PORTCR(1, 0xE6051001), /* PORT1CR */ |
@@ -2585,7 +2574,7 @@ static void __iomem *sh7372_pinmux_portcr(struct sh_pfc *pfc, unsigned int pin) | |||
2585 | &sh7372_portcr_offsets[i]; | 2574 | &sh7372_portcr_offsets[i]; |
2586 | 2575 | ||
2587 | if (pin <= group->end_pin) | 2576 | if (pin <= group->end_pin) |
2588 | return pfc->window->virt + group->offset + pin; | 2577 | return pfc->windows->virt + group->offset + pin; |
2589 | } | 2578 | } |
2590 | 2579 | ||
2591 | return NULL; | 2580 | return NULL; |
diff --git a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c index 7e278a97e411..dc7c7fb33805 100644 --- a/drivers/pinctrl/sh-pfc/pfc-sh73a0.c +++ b/drivers/pinctrl/sh-pfc/pfc-sh73a0.c | |||
@@ -3138,16 +3138,6 @@ static const struct sh_pfc_function pinmux_functions[] = { | |||
3138 | SH_PFC_FUNCTION(usb), | 3138 | SH_PFC_FUNCTION(usb), |
3139 | }; | 3139 | }; |
3140 | 3140 | ||
3141 | #undef PORTCR | ||
3142 | #define PORTCR(nr, reg) \ | ||
3143 | { \ | ||
3144 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | ||
3145 | _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \ | ||
3146 | PORT##nr##_FN0, PORT##nr##_FN1, \ | ||
3147 | PORT##nr##_FN2, PORT##nr##_FN3, \ | ||
3148 | PORT##nr##_FN4, PORT##nr##_FN5, \ | ||
3149 | PORT##nr##_FN6, PORT##nr##_FN7 } \ | ||
3150 | } | ||
3151 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { | 3141 | static const struct pinmux_cfg_reg pinmux_config_regs[] = { |
3152 | PORTCR(0, 0xe6050000), /* PORT0CR */ | 3142 | PORTCR(0, 0xe6050000), /* PORT0CR */ |
3153 | PORTCR(1, 0xe6050001), /* PORT1CR */ | 3143 | PORTCR(1, 0xe6050001), /* PORT1CR */ |
@@ -3661,38 +3651,38 @@ static const struct pinmux_data_reg pinmux_data_regs[] = { | |||
3661 | }; | 3651 | }; |
3662 | 3652 | ||
3663 | static const struct pinmux_irq pinmux_irqs[] = { | 3653 | static const struct pinmux_irq pinmux_irqs[] = { |
3664 | PINMUX_IRQ(irq_pin(19), 9), | ||
3665 | PINMUX_IRQ(irq_pin(1), 10), | ||
3666 | PINMUX_IRQ(irq_pin(0), 11), | 3654 | PINMUX_IRQ(irq_pin(0), 11), |
3655 | PINMUX_IRQ(irq_pin(1), 10), | ||
3656 | PINMUX_IRQ(irq_pin(2), 149), | ||
3657 | PINMUX_IRQ(irq_pin(3), 224), | ||
3658 | PINMUX_IRQ(irq_pin(4), 159), | ||
3659 | PINMUX_IRQ(irq_pin(5), 227), | ||
3660 | PINMUX_IRQ(irq_pin(6), 147), | ||
3661 | PINMUX_IRQ(irq_pin(7), 150), | ||
3662 | PINMUX_IRQ(irq_pin(8), 223), | ||
3663 | PINMUX_IRQ(irq_pin(9), 56, 308), | ||
3664 | PINMUX_IRQ(irq_pin(10), 54), | ||
3665 | PINMUX_IRQ(irq_pin(11), 238), | ||
3666 | PINMUX_IRQ(irq_pin(12), 156), | ||
3667 | PINMUX_IRQ(irq_pin(13), 239), | ||
3668 | PINMUX_IRQ(irq_pin(14), 251), | ||
3669 | PINMUX_IRQ(irq_pin(15), 0), | ||
3670 | PINMUX_IRQ(irq_pin(16), 249), | ||
3671 | PINMUX_IRQ(irq_pin(17), 234), | ||
3667 | PINMUX_IRQ(irq_pin(18), 13), | 3672 | PINMUX_IRQ(irq_pin(18), 13), |
3673 | PINMUX_IRQ(irq_pin(19), 9), | ||
3668 | PINMUX_IRQ(irq_pin(20), 14), | 3674 | PINMUX_IRQ(irq_pin(20), 14), |
3669 | PINMUX_IRQ(irq_pin(21), 15), | 3675 | PINMUX_IRQ(irq_pin(21), 15), |
3670 | PINMUX_IRQ(irq_pin(31), 26), | ||
3671 | PINMUX_IRQ(irq_pin(30), 27), | ||
3672 | PINMUX_IRQ(irq_pin(29), 28), | ||
3673 | PINMUX_IRQ(irq_pin(22), 40), | 3676 | PINMUX_IRQ(irq_pin(22), 40), |
3674 | PINMUX_IRQ(irq_pin(23), 53), | 3677 | PINMUX_IRQ(irq_pin(23), 53), |
3675 | PINMUX_IRQ(irq_pin(10), 54), | 3678 | PINMUX_IRQ(irq_pin(24), 118), |
3676 | PINMUX_IRQ(irq_pin(9), 56), | 3679 | PINMUX_IRQ(irq_pin(25), 164), |
3677 | PINMUX_IRQ(irq_pin(26), 115), | 3680 | PINMUX_IRQ(irq_pin(26), 115), |
3678 | PINMUX_IRQ(irq_pin(27), 116), | 3681 | PINMUX_IRQ(irq_pin(27), 116), |
3679 | PINMUX_IRQ(irq_pin(28), 117), | 3682 | PINMUX_IRQ(irq_pin(28), 117), |
3680 | PINMUX_IRQ(irq_pin(24), 118), | 3683 | PINMUX_IRQ(irq_pin(29), 28), |
3681 | PINMUX_IRQ(irq_pin(6), 147), | 3684 | PINMUX_IRQ(irq_pin(30), 27), |
3682 | PINMUX_IRQ(irq_pin(2), 149), | 3685 | PINMUX_IRQ(irq_pin(31), 26), |
3683 | PINMUX_IRQ(irq_pin(7), 150), | ||
3684 | PINMUX_IRQ(irq_pin(12), 156), | ||
3685 | PINMUX_IRQ(irq_pin(4), 159), | ||
3686 | PINMUX_IRQ(irq_pin(25), 164), | ||
3687 | PINMUX_IRQ(irq_pin(8), 223), | ||
3688 | PINMUX_IRQ(irq_pin(3), 224), | ||
3689 | PINMUX_IRQ(irq_pin(5), 227), | ||
3690 | PINMUX_IRQ(irq_pin(17), 234), | ||
3691 | PINMUX_IRQ(irq_pin(11), 238), | ||
3692 | PINMUX_IRQ(irq_pin(13), 239), | ||
3693 | PINMUX_IRQ(irq_pin(16), 249), | ||
3694 | PINMUX_IRQ(irq_pin(14), 251), | ||
3695 | PINMUX_IRQ(irq_pin(9), 308), | ||
3696 | }; | 3686 | }; |
3697 | 3687 | ||
3698 | /* ----------------------------------------------------------------------------- | 3688 | /* ----------------------------------------------------------------------------- |
@@ -3702,7 +3692,7 @@ static const struct pinmux_irq pinmux_irqs[] = { | |||
3702 | static void sh73a0_vccq_mc0_endisable(struct regulator_dev *reg, bool enable) | 3692 | static void sh73a0_vccq_mc0_endisable(struct regulator_dev *reg, bool enable) |
3703 | { | 3693 | { |
3704 | struct sh_pfc *pfc = reg->reg_data; | 3694 | struct sh_pfc *pfc = reg->reg_data; |
3705 | void __iomem *addr = pfc->window[1].virt + 4; | 3695 | void __iomem *addr = pfc->windows[1].virt + 4; |
3706 | unsigned long flags; | 3696 | unsigned long flags; |
3707 | u32 value; | 3697 | u32 value; |
3708 | 3698 | ||
@@ -3735,7 +3725,7 @@ static int sh73a0_vccq_mc0_disable(struct regulator_dev *reg) | |||
3735 | static int sh73a0_vccq_mc0_is_enabled(struct regulator_dev *reg) | 3725 | static int sh73a0_vccq_mc0_is_enabled(struct regulator_dev *reg) |
3736 | { | 3726 | { |
3737 | struct sh_pfc *pfc = reg->reg_data; | 3727 | struct sh_pfc *pfc = reg->reg_data; |
3738 | void __iomem *addr = pfc->window[1].virt + 4; | 3728 | void __iomem *addr = pfc->windows[1].virt + 4; |
3739 | unsigned long flags; | 3729 | unsigned long flags; |
3740 | u32 value; | 3730 | u32 value; |
3741 | 3731 | ||
@@ -3794,7 +3784,7 @@ static const unsigned int sh73a0_portcr_offsets[] = { | |||
3794 | 3784 | ||
3795 | static unsigned int sh73a0_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) | 3785 | static unsigned int sh73a0_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) |
3796 | { | 3786 | { |
3797 | void __iomem *addr = pfc->window->virt | 3787 | void __iomem *addr = pfc->windows->virt |
3798 | + sh73a0_portcr_offsets[pin >> 5] + pin; | 3788 | + sh73a0_portcr_offsets[pin >> 5] + pin; |
3799 | u32 value = ioread8(addr) & PORTnCR_PULMD_MASK; | 3789 | u32 value = ioread8(addr) & PORTnCR_PULMD_MASK; |
3800 | 3790 | ||
@@ -3812,7 +3802,7 @@ static unsigned int sh73a0_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin) | |||
3812 | static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, | 3802 | static void sh73a0_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, |
3813 | unsigned int bias) | 3803 | unsigned int bias) |
3814 | { | 3804 | { |
3815 | void __iomem *addr = pfc->window->virt | 3805 | void __iomem *addr = pfc->windows->virt |
3816 | + sh73a0_portcr_offsets[pin >> 5] + pin; | 3806 | + sh73a0_portcr_offsets[pin >> 5] + pin; |
3817 | u32 value = ioread8(addr) & ~PORTnCR_PULMD_MASK; | 3807 | u32 value = ioread8(addr) & ~PORTnCR_PULMD_MASK; |
3818 | 3808 | ||
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h index 11bd0d970a52..e17ccab54f2d 100644 --- a/drivers/pinctrl/sh-pfc/sh_pfc.h +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h | |||
@@ -94,11 +94,11 @@ struct pinmux_data_reg { | |||
94 | 94 | ||
95 | struct pinmux_irq { | 95 | struct pinmux_irq { |
96 | int irq; | 96 | int irq; |
97 | unsigned short *gpios; | 97 | short *gpios; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | #define PINMUX_IRQ(irq_nr, ids...) \ | 100 | #define PINMUX_IRQ(irq_nr, ids...) \ |
101 | { .irq = irq_nr, .gpios = (unsigned short []) { ids, 0 } } \ | 101 | { .irq = irq_nr, .gpios = (short []) { ids, -1 } } |
102 | 102 | ||
103 | struct pinmux_range { | 103 | struct pinmux_range { |
104 | u16 begin; | 104 | u16 begin; |
@@ -304,8 +304,7 @@ struct sh_pfc_soc_info { | |||
304 | #define PORTCR(nr, reg) \ | 304 | #define PORTCR(nr, reg) \ |
305 | { \ | 305 | { \ |
306 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ | 306 | PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \ |
307 | _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \ | 307 | _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT), \ |
308 | PORT##nr##_IN_PU, PORT##nr##_OUT), \ | ||
309 | PORT##nr##_FN0, PORT##nr##_FN1, \ | 308 | PORT##nr##_FN0, PORT##nr##_FN1, \ |
310 | PORT##nr##_FN2, PORT##nr##_FN3, \ | 309 | PORT##nr##_FN2, PORT##nr##_FN3, \ |
311 | PORT##nr##_FN4, PORT##nr##_FN5, \ | 310 | PORT##nr##_FN4, PORT##nr##_FN5, \ |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7d8103cd3e2e..1a3fc7a2e4db 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -421,9 +421,9 @@ static void sci_port_enable(struct sci_port *sci_port) | |||
421 | 421 | ||
422 | pm_runtime_get_sync(sci_port->port.dev); | 422 | pm_runtime_get_sync(sci_port->port.dev); |
423 | 423 | ||
424 | clk_enable(sci_port->iclk); | 424 | clk_prepare_enable(sci_port->iclk); |
425 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | 425 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); |
426 | clk_enable(sci_port->fclk); | 426 | clk_prepare_enable(sci_port->fclk); |
427 | } | 427 | } |
428 | 428 | ||
429 | static void sci_port_disable(struct sci_port *sci_port) | 429 | static void sci_port_disable(struct sci_port *sci_port) |
@@ -431,8 +431,16 @@ static void sci_port_disable(struct sci_port *sci_port) | |||
431 | if (!sci_port->port.dev) | 431 | if (!sci_port->port.dev) |
432 | return; | 432 | return; |
433 | 433 | ||
434 | clk_disable(sci_port->fclk); | 434 | /* Cancel the break timer to ensure that the timer handler will not try |
435 | clk_disable(sci_port->iclk); | 435 | * to access the hardware with clocks and power disabled. Reset the |
436 | * break flag to make the break debouncing state machine ready for the | ||
437 | * next break. | ||
438 | */ | ||
439 | del_timer_sync(&sci_port->break_timer); | ||
440 | sci_port->break_flag = 0; | ||
441 | |||
442 | clk_disable_unprepare(sci_port->fclk); | ||
443 | clk_disable_unprepare(sci_port->iclk); | ||
436 | 444 | ||
437 | pm_runtime_put_sync(sci_port->port.dev); | 445 | pm_runtime_put_sync(sci_port->port.dev); |
438 | } | 446 | } |
@@ -557,7 +565,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
557 | return 1; | 565 | return 1; |
558 | 566 | ||
559 | /* Cast for ARM damage */ | 567 | /* Cast for ARM damage */ |
560 | return !!__raw_readb((void __iomem *)s->cfg->port_reg); | 568 | return !!__raw_readb((void __iomem *)(uintptr_t)s->cfg->port_reg); |
561 | } | 569 | } |
562 | 570 | ||
563 | /* ********************************************************************** * | 571 | /* ********************************************************************** * |
@@ -733,8 +741,6 @@ static void sci_break_timer(unsigned long data) | |||
733 | { | 741 | { |
734 | struct sci_port *port = (struct sci_port *)data; | 742 | struct sci_port *port = (struct sci_port *)data; |
735 | 743 | ||
736 | sci_port_enable(port); | ||
737 | |||
738 | if (sci_rxd_in(&port->port) == 0) { | 744 | if (sci_rxd_in(&port->port) == 0) { |
739 | port->break_flag = 1; | 745 | port->break_flag = 1; |
740 | sci_schedule_break_timer(port); | 746 | sci_schedule_break_timer(port); |
@@ -744,8 +750,6 @@ static void sci_break_timer(unsigned long data) | |||
744 | sci_schedule_break_timer(port); | 750 | sci_schedule_break_timer(port); |
745 | } else | 751 | } else |
746 | port->break_flag = 0; | 752 | port->break_flag = 0; |
747 | |||
748 | sci_port_disable(port); | ||
749 | } | 753 | } |
750 | 754 | ||
751 | static int sci_handle_errors(struct uart_port *port) | 755 | static int sci_handle_errors(struct uart_port *port) |
@@ -1309,7 +1313,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count) | |||
1309 | } | 1313 | } |
1310 | 1314 | ||
1311 | if (room < count) | 1315 | if (room < count) |
1312 | dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", | 1316 | dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n", |
1313 | count - room); | 1317 | count - room); |
1314 | if (!room) | 1318 | if (!room) |
1315 | return room; | 1319 | return room; |
@@ -1442,7 +1446,7 @@ static void work_fn_rx(struct work_struct *work) | |||
1442 | int count; | 1446 | int count; |
1443 | 1447 | ||
1444 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); | 1448 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); |
1445 | dev_dbg(port->dev, "Read %u bytes with cookie %d\n", | 1449 | dev_dbg(port->dev, "Read %zu bytes with cookie %d\n", |
1446 | sh_desc->partial, sh_desc->cookie); | 1450 | sh_desc->partial, sh_desc->cookie); |
1447 | 1451 | ||
1448 | spin_lock_irqsave(&port->lock, flags); | 1452 | spin_lock_irqsave(&port->lock, flags); |
@@ -1691,16 +1695,17 @@ static void sci_request_dma(struct uart_port *port) | |||
1691 | s->chan_tx = chan; | 1695 | s->chan_tx = chan; |
1692 | sg_init_table(&s->sg_tx, 1); | 1696 | sg_init_table(&s->sg_tx, 1); |
1693 | /* UART circular tx buffer is an aligned page. */ | 1697 | /* UART circular tx buffer is an aligned page. */ |
1694 | BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK); | 1698 | BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK); |
1695 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), | 1699 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), |
1696 | UART_XMIT_SIZE, (int)port->state->xmit.buf & ~PAGE_MASK); | 1700 | UART_XMIT_SIZE, |
1701 | (uintptr_t)port->state->xmit.buf & ~PAGE_MASK); | ||
1697 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); | 1702 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); |
1698 | if (!nent) | 1703 | if (!nent) |
1699 | sci_tx_dma_release(s, false); | 1704 | sci_tx_dma_release(s, false); |
1700 | else | 1705 | else |
1701 | dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__, | 1706 | dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__, |
1702 | sg_dma_len(&s->sg_tx), | 1707 | sg_dma_len(&s->sg_tx), port->state->xmit.buf, |
1703 | port->state->xmit.buf, sg_dma_address(&s->sg_tx)); | 1708 | &sg_dma_address(&s->sg_tx)); |
1704 | 1709 | ||
1705 | s->sg_len_tx = nent; | 1710 | s->sg_len_tx = nent; |
1706 | 1711 | ||
@@ -1740,7 +1745,7 @@ static void sci_request_dma(struct uart_port *port) | |||
1740 | 1745 | ||
1741 | sg_init_table(sg, 1); | 1746 | sg_init_table(sg, 1); |
1742 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, | 1747 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, |
1743 | (int)buf[i] & ~PAGE_MASK); | 1748 | (uintptr_t)buf[i] & ~PAGE_MASK); |
1744 | sg_dma_address(sg) = dma[i]; | 1749 | sg_dma_address(sg) = dma[i]; |
1745 | } | 1750 | } |
1746 | 1751 | ||
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h new file mode 100644 index 000000000000..dbb262a3e7a6 --- /dev/null +++ b/include/dt-bindings/clock/r8a7790-clock.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Ideas On Board SPRL | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __DT_BINDINGS_CLOCK_R8A7790_H__ | ||
11 | #define __DT_BINDINGS_CLOCK_R8A7790_H__ | ||
12 | |||
13 | /* CPG */ | ||
14 | #define R8A7790_CLK_MAIN 0 | ||
15 | #define R8A7790_CLK_PLL0 1 | ||
16 | #define R8A7790_CLK_PLL1 2 | ||
17 | #define R8A7790_CLK_PLL3 3 | ||
18 | #define R8A7790_CLK_LB 4 | ||
19 | #define R8A7790_CLK_QSPI 5 | ||
20 | #define R8A7790_CLK_SDH 6 | ||
21 | #define R8A7790_CLK_SD0 7 | ||
22 | #define R8A7790_CLK_SD1 8 | ||
23 | #define R8A7790_CLK_Z 9 | ||
24 | |||
25 | /* MSTP0 */ | ||
26 | #define R8A7790_CLK_MSIOF0 0 | ||
27 | |||
28 | /* MSTP1 */ | ||
29 | #define R8A7790_CLK_TMU1 11 | ||
30 | #define R8A7790_CLK_TMU3 21 | ||
31 | #define R8A7790_CLK_TMU2 22 | ||
32 | #define R8A7790_CLK_CMT0 24 | ||
33 | #define R8A7790_CLK_TMU0 25 | ||
34 | #define R8A7790_CLK_VSP1_DU1 27 | ||
35 | #define R8A7790_CLK_VSP1_DU0 28 | ||
36 | #define R8A7790_CLK_VSP1_RT 30 | ||
37 | #define R8A7790_CLK_VSP1_SY 31 | ||
38 | |||
39 | /* MSTP2 */ | ||
40 | #define R8A7790_CLK_SCIFA2 2 | ||
41 | #define R8A7790_CLK_SCIFA1 3 | ||
42 | #define R8A7790_CLK_SCIFA0 4 | ||
43 | #define R8A7790_CLK_MSIOF2 5 | ||
44 | #define R8A7790_CLK_SCIFB0 6 | ||
45 | #define R8A7790_CLK_SCIFB1 7 | ||
46 | #define R8A7790_CLK_MSIOF1 8 | ||
47 | #define R8A7790_CLK_MSIOF3 15 | ||
48 | #define R8A7790_CLK_SCIFB2 16 | ||
49 | #define R8A7790_CLK_SYS_DMAC0 18 | ||
50 | #define R8A7790_CLK_SYS_DMAC1 19 | ||
51 | |||
52 | /* MSTP3 */ | ||
53 | #define R8A7790_CLK_TPU0 4 | ||
54 | #define R8A7790_CLK_MMCIF1 5 | ||
55 | #define R8A7790_CLK_SDHI3 11 | ||
56 | #define R8A7790_CLK_SDHI2 12 | ||
57 | #define R8A7790_CLK_SDHI1 13 | ||
58 | #define R8A7790_CLK_SDHI0 14 | ||
59 | #define R8A7790_CLK_MMCIF0 15 | ||
60 | #define R8A7790_CLK_SSUSB 28 | ||
61 | #define R8A7790_CLK_CMT1 29 | ||
62 | #define R8A7790_CLK_USBDMAC0 30 | ||
63 | #define R8A7790_CLK_USBDMAC1 31 | ||
64 | |||
65 | /* MSTP5 */ | ||
66 | #define R8A7790_CLK_THERMAL 22 | ||
67 | #define R8A7790_CLK_PWM 23 | ||
68 | |||
69 | /* MSTP7 */ | ||
70 | #define R8A7790_CLK_EHCI 3 | ||
71 | #define R8A7790_CLK_HSUSB 4 | ||
72 | #define R8A7790_CLK_HSCIF1 16 | ||
73 | #define R8A7790_CLK_HSCIF0 17 | ||
74 | #define R8A7790_CLK_SCIF1 20 | ||
75 | #define R8A7790_CLK_SCIF0 21 | ||
76 | #define R8A7790_CLK_DU2 22 | ||
77 | #define R8A7790_CLK_DU1 23 | ||
78 | #define R8A7790_CLK_DU0 24 | ||
79 | #define R8A7790_CLK_LVDS1 25 | ||
80 | #define R8A7790_CLK_LVDS0 26 | ||
81 | |||
82 | /* MSTP8 */ | ||
83 | #define R8A7790_CLK_VIN3 8 | ||
84 | #define R8A7790_CLK_VIN2 9 | ||
85 | #define R8A7790_CLK_VIN1 10 | ||
86 | #define R8A7790_CLK_VIN0 11 | ||
87 | #define R8A7790_CLK_ETHER 13 | ||
88 | #define R8A7790_CLK_SATA1 14 | ||
89 | #define R8A7790_CLK_SATA0 15 | ||
90 | |||
91 | /* MSTP9 */ | ||
92 | #define R8A7790_CLK_GPIO5 7 | ||
93 | #define R8A7790_CLK_GPIO4 8 | ||
94 | #define R8A7790_CLK_GPIO3 9 | ||
95 | #define R8A7790_CLK_GPIO2 10 | ||
96 | #define R8A7790_CLK_GPIO1 11 | ||
97 | #define R8A7790_CLK_GPIO0 12 | ||
98 | #define R8A7790_CLK_RCAN1 15 | ||
99 | #define R8A7790_CLK_RCAN0 16 | ||
100 | #define R8A7790_CLK_QSPI_MOD 17 | ||
101 | #define R8A7790_CLK_IICDVFS 26 | ||
102 | #define R8A7790_CLK_I2C3 28 | ||
103 | #define R8A7790_CLK_I2C2 29 | ||
104 | #define R8A7790_CLK_I2C1 30 | ||
105 | #define R8A7790_CLK_I2C0 31 | ||
106 | |||
107 | /* MSTP10 */ | ||
108 | #define R8A7790_CLK_SSI 5 | ||
109 | #define R8A7790_CLK_SSI9 6 | ||
110 | #define R8A7790_CLK_SSI8 7 | ||
111 | #define R8A7790_CLK_SSI7 8 | ||
112 | #define R8A7790_CLK_SSI6 9 | ||
113 | #define R8A7790_CLK_SSI5 10 | ||
114 | #define R8A7790_CLK_SSI4 11 | ||
115 | #define R8A7790_CLK_SSI3 12 | ||
116 | #define R8A7790_CLK_SSI2 13 | ||
117 | #define R8A7790_CLK_SSI1 14 | ||
118 | #define R8A7790_CLK_SSI0 15 | ||
119 | |||
120 | #endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */ | ||
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h new file mode 100644 index 000000000000..1c8f00d0d88b --- /dev/null +++ b/include/dt-bindings/clock/r8a7791-clock.h | |||
@@ -0,0 +1,124 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Ideas On Board SPRL | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef __DT_BINDINGS_CLOCK_R8A7791_H__ | ||
11 | #define __DT_BINDINGS_CLOCK_R8A7791_H__ | ||
12 | |||
13 | /* CPG */ | ||
14 | #define R8A7791_CLK_MAIN 0 | ||
15 | #define R8A7791_CLK_PLL0 1 | ||
16 | #define R8A7791_CLK_PLL1 2 | ||
17 | #define R8A7791_CLK_PLL3 3 | ||
18 | #define R8A7791_CLK_LB 4 | ||
19 | #define R8A7791_CLK_QSPI 5 | ||
20 | #define R8A7791_CLK_SDH 6 | ||
21 | #define R8A7791_CLK_SD0 7 | ||
22 | #define R8A7791_CLK_Z 8 | ||
23 | |||
24 | /* MSTP0 */ | ||
25 | #define R8A7791_CLK_MSIOF0 0 | ||
26 | |||
27 | /* MSTP1 */ | ||
28 | #define R8A7791_CLK_TMU1 11 | ||
29 | #define R8A7791_CLK_TMU3 21 | ||
30 | #define R8A7791_CLK_TMU2 22 | ||
31 | #define R8A7791_CLK_CMT0 24 | ||
32 | #define R8A7791_CLK_TMU0 25 | ||
33 | #define R8A7791_CLK_VSP1_DU1 27 | ||
34 | #define R8A7791_CLK_VSP1_DU0 28 | ||
35 | #define R8A7791_CLK_VSP1_SY 31 | ||
36 | |||
37 | /* MSTP2 */ | ||
38 | #define R8A7791_CLK_SCIFA2 2 | ||
39 | #define R8A7791_CLK_SCIFA1 3 | ||
40 | #define R8A7791_CLK_SCIFA0 4 | ||
41 | #define R8A7791_CLK_MSIOF2 5 | ||
42 | #define R8A7791_CLK_SCIFB0 6 | ||
43 | #define R8A7791_CLK_SCIFB1 7 | ||
44 | #define R8A7791_CLK_MSIOF1 8 | ||
45 | #define R8A7791_CLK_SCIFB2 16 | ||
46 | #define R8A7791_CLK_DMAC 18 | ||
47 | |||
48 | /* MSTP3 */ | ||
49 | #define R8A7791_CLK_TPU0 4 | ||
50 | #define R8A7791_CLK_SDHI2 11 | ||
51 | #define R8A7791_CLK_SDHI1 12 | ||
52 | #define R8A7791_CLK_SDHI0 14 | ||
53 | #define R8A7791_CLK_MMCIF0 15 | ||
54 | #define R8A7791_CLK_SSUSB 28 | ||
55 | #define R8A7791_CLK_CMT1 29 | ||
56 | #define R8A7791_CLK_USBDMAC0 30 | ||
57 | #define R8A7791_CLK_USBDMAC1 31 | ||
58 | |||
59 | /* MSTP5 */ | ||
60 | #define R8A7791_CLK_THERMAL 22 | ||
61 | #define R8A7791_CLK_PWM 23 | ||
62 | |||
63 | /* MSTP7 */ | ||
64 | #define R8A7791_CLK_HSUSB 4 | ||
65 | #define R8A7791_CLK_HSCIF2 13 | ||
66 | #define R8A7791_CLK_SCIF5 14 | ||
67 | #define R8A7791_CLK_SCIF4 15 | ||
68 | #define R8A7791_CLK_HSCIF1 16 | ||
69 | #define R8A7791_CLK_HSCIF0 17 | ||
70 | #define R8A7791_CLK_SCIF3 18 | ||
71 | #define R8A7791_CLK_SCIF2 19 | ||
72 | #define R8A7791_CLK_SCIF1 20 | ||
73 | #define R8A7791_CLK_SCIF0 21 | ||
74 | #define R8A7791_CLK_DU1 23 | ||
75 | #define R8A7791_CLK_DU0 24 | ||
76 | #define R8A7791_CLK_LVDS0 26 | ||
77 | |||
78 | /* MSTP8 */ | ||
79 | #define R8A7791_CLK_VIN2 9 | ||
80 | #define R8A7791_CLK_VIN1 10 | ||
81 | #define R8A7791_CLK_VIN0 11 | ||
82 | #define R8A7791_CLK_ETHER 13 | ||
83 | #define R8A7791_CLK_SATA1 14 | ||
84 | #define R8A7791_CLK_SATA0 15 | ||
85 | |||
86 | /* MSTP9 */ | ||
87 | #define R8A7791_CLK_GPIO7 4 | ||
88 | #define R8A7791_CLK_GPIO6 5 | ||
89 | #define R8A7791_CLK_GPIO5 7 | ||
90 | #define R8A7791_CLK_GPIO4 8 | ||
91 | #define R8A7791_CLK_GPIO3 9 | ||
92 | #define R8A7791_CLK_GPIO2 10 | ||
93 | #define R8A7791_CLK_GPIO1 11 | ||
94 | #define R8A7791_CLK_GPIO0 12 | ||
95 | #define R8A7791_CLK_RCAN1 15 | ||
96 | #define R8A7791_CLK_RCAN0 16 | ||
97 | #define R8A7791_CLK_QSPI_MOD 17 | ||
98 | #define R8A7791_CLK_I2C5 25 | ||
99 | #define R8A7791_CLK_IICDVFS 26 | ||
100 | #define R8A7791_CLK_I2C4 27 | ||
101 | #define R8A7791_CLK_I2C3 28 | ||
102 | #define R8A7791_CLK_I2C2 29 | ||
103 | #define R8A7791_CLK_I2C1 30 | ||
104 | #define R8A7791_CLK_I2C0 31 | ||
105 | |||
106 | /* MSTP10 */ | ||
107 | #define R8A7791_CLK_SSI 5 | ||
108 | #define R8A7791_CLK_SSI9 6 | ||
109 | #define R8A7791_CLK_SSI8 7 | ||
110 | #define R8A7791_CLK_SSI7 8 | ||
111 | #define R8A7791_CLK_SSI6 9 | ||
112 | #define R8A7791_CLK_SSI5 10 | ||
113 | #define R8A7791_CLK_SSI4 11 | ||
114 | #define R8A7791_CLK_SSI3 12 | ||
115 | #define R8A7791_CLK_SSI2 13 | ||
116 | #define R8A7791_CLK_SSI1 14 | ||
117 | #define R8A7791_CLK_SSI0 15 | ||
118 | |||
119 | /* MSTP11 */ | ||
120 | #define R8A7791_CLK_SCIFA3 6 | ||
121 | #define R8A7791_CLK_SCIFA4 7 | ||
122 | #define R8A7791_CLK_SCIFA5 8 | ||
123 | |||
124 | #endif /* __DT_BINDINGS_CLOCK_R8A7791_H__ */ | ||
diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h new file mode 100644 index 000000000000..f9bf080a1123 --- /dev/null +++ b/include/linux/clk/shmobile.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Ideas On Board SPRL | ||
3 | * | ||
4 | * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.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 | |||
12 | #ifndef __LINUX_CLK_SHMOBILE_H_ | ||
13 | #define __LINUX_CLK_SHMOBILE_H_ | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | void rcar_gen2_clocks_init(u32 mode); | ||
18 | |||
19 | #endif | ||
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h index fb90ef5eb038..282309d7c4dc 100644 --- a/include/linux/pinctrl/pinconf-generic.h +++ b/include/linux/pinctrl/pinconf-generic.h | |||
@@ -82,8 +82,10 @@ | |||
82 | * operation, if several modes of operation are supported these can be | 82 | * operation, if several modes of operation are supported these can be |
83 | * passed in the argument on a custom form, else just use argument 1 | 83 | * passed in the argument on a custom form, else just use argument 1 |
84 | * to indicate low power mode, argument 0 turns low power mode off. | 84 | * to indicate low power mode, argument 0 turns low power mode off. |
85 | * @PIN_CONFIG_OUTPUT: this will configure the pin in output, use argument | 85 | * @PIN_CONFIG_OUTPUT: this will configure the pin as an output. Use argument |
86 | * 1 to indicate high level, argument 0 to indicate low level. | 86 | * 1 to indicate high level, argument 0 to indicate low level. (Please |
87 | * see Documentation/pinctrl.txt, section "GPIO mode pitfalls" for a | ||
88 | * discussion around this parameter.) | ||
87 | * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if | 89 | * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if |
88 | * you need to pass in custom configurations to the pin controller, use | 90 | * you need to pass in custom configurations to the pin controller, use |
89 | * PIN_CONFIG_END+1 as the base offset. | 91 | * PIN_CONFIG_END+1 as the base offset. |