提交 e0b8b786 编写于 作者: L Linus Torvalds

Merge tag 'pinctrl-v3.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pinctrl updates from Linus Walleij:
 "This is the bulk pin control changes for the v3.17 merge development
  cycle:

   - get rid of the .disable() callback from the driver callback vtable.

     This callback was abused and counterintuitive since a pin or group
     of pins can be said to always be in some setting, and never really
     disabled.  We now only enable a certain muxing, and move between
     some certain muxings, we never "disable" a mux setting

   - some janitorial moving the MSM, Samsung and Nomadik and drivers to
     their own subdirectories for a clearer view in the subsystem.  This
     will continue

   - kill off the use of the return value from gpiochip_remove(), this
     will be done in parallel in the GPIO subsystem and hopefully not
     trigger too many unchecked return value warnings before we get rid
     of this altogether

   - a huge set of changes and improvements to the Allwinner sunxi
     drivers especially for their latest A23 and A31 SoCs, and some
     ground work for the new sun8i platform family

   - a large set of Rockchip driver improvements adding support for the
     RK3288 SoC

   - advances in migration of older Freescale platforms to pin control,
     especially i.MX1

   - Samsung and Exynos improvements

   - support for the Qualcomm MSM8960 SoC

   - use the gpiolib irqchip helpers for the ST SPEAr and Intel Baytrail
     drivers

   - a bunch of nice janitorial work done with cppcheck"

* tag 'pinctrl-v3.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (61 commits)
  pinctrl: baytrail: Convert to use gpiolib irqchip
  pinctrl: sunxi: number gpio ranges starting from 0
  pinctrl: sunxi: use gpiolib API to mark a GPIO used as an IRQ
  pinctrl: rockchip: add drive-strength control for rk3288
  pinctrl: rockchip: add separate type for rk3288
  pinctrl: rockchip: set is_generic in pinconf_ops
  pinctrl: msm: drop negativity check on unsigned value
  pinctrl: remove all usage of gpio_remove ret val in driver/pinctl
  pinctrl: qcom: Make muxing of gpio function explicit
  pinctrl: nomadik: move all Nomadik drivers to subdir
  pinctrl: samsung: Group all drivers in a sub-dir
  sh-pfc: sh73a0: Introduce the use of devm_regulator_register
  sh-pfc: Add renesas,pfc-r8a7791 to binding documentation
  pinctrl: msm: move all qualcomm drivers to subdir
  pinctrl: msm: Add msm8960 definitions
  pinctrl: samsung: Allow pin value to be initialized using pinfunc
  pinctrl: samsung: Allow grouping multiple pinmux/pinconf nodes
  pinctrl: exynos: Consolidate irq_chips of GPIO and WKUP EINTs
  pinctrl: samsung: Handle GPIO request and free using pinctrl helpers
  pinctrl: samsung: Decouple direction setting from pinctrl
  ...
...@@ -13,6 +13,8 @@ Required properties: ...@@ -13,6 +13,8 @@ Required properties:
"allwinner,sun6i-a31-pinctrl" "allwinner,sun6i-a31-pinctrl"
"allwinner,sun6i-a31-r-pinctrl" "allwinner,sun6i-a31-r-pinctrl"
"allwinner,sun7i-a20-pinctrl" "allwinner,sun7i-a20-pinctrl"
"allwinner,sun8i-a23-pinctrl"
"allwinner,sun8i-a23-r-pinctrl"
- reg: Should contain the register physical address and length for the - reg: Should contain the register physical address and length for the
pin controller. pin controller.
......
...@@ -46,7 +46,7 @@ Valid values for pins are: ...@@ -46,7 +46,7 @@ Valid values for pins are:
gpio0-gpio89 gpio0-gpio89
Valid values for function are: Valid values for function are:
cam_mclk, codec_mic_i2s, codec_spkr_i2s, gsbi1, gsbi2, gsbi3, gsbi4, cam_mclk, codec_mic_i2s, codec_spkr_i2s, gpio, gsbi1, gsbi2, gsbi3, gsbi4,
gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6, gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1, gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm, gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
......
...@@ -51,7 +51,7 @@ Valid values for qcom,pins are: ...@@ -51,7 +51,7 @@ Valid values for qcom,pins are:
Valid values for function are: Valid values for function are:
mdio, mi2s, pdm, ssbi, spmi, audio_pcm, gsbi1, gsbi2, gsbi4, gsbi5, mdio, mi2s, pdm, ssbi, spmi, audio_pcm, gpio, gsbi1, gsbi2, gsbi4, gsbi5,
gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6, gsbi7, nss_spi, sdc1, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6, gsbi7, nss_spi, sdc1,
spdif, nand, tsif1, tsif2, usb_fs_n, usb_fs, usb2_hsic, rgmii2, sata, spdif, nand, tsif1, tsif2, usb_fs_n, usb_fs, usb2_hsic, rgmii2, sata,
pcie1_rst, pcie1_prsnt, pcie1_pwren_n, pcie1_pwren, pcie1_pwrflt, pcie1_rst, pcie1_prsnt, pcie1_pwren_n, pcie1_pwren, pcie1_pwrflt,
......
Qualcomm MSM8960 TLMM block
This binding describes the Top Level Mode Multiplexer block found in the
MSM8960 platform.
- compatible:
Usage: required
Value type: <string>
Definition: must be "qcom,msm8960-pinctrl"
- reg:
Usage: required
Value type: <prop-encoded-array>
Definition: the base address and size of the TLMM register space.
- interrupts:
Usage: required
Value type: <prop-encoded-array>
Definition: should specify the TLMM summary IRQ.
- interrupt-controller:
Usage: required
Value type: <none>
Definition: identifies this node as an interrupt controller
- #interrupt-cells:
Usage: required
Value type: <u32>
Definition: must be 2. Specifying the pin number and flags, as defined
in <dt-bindings/interrupt-controller/irq.h>
- gpio-controller:
Usage: required
Value type: <none>
Definition: identifies this node as a gpio controller
- #gpio-cells:
Usage: required
Value type: <u32>
Definition: must be 2. Specifying the pin number and flags, as defined
in <dt-bindings/gpio/gpio.h>
Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
a general description of GPIO and interrupt bindings.
Please refer to pinctrl-bindings.txt in this directory for details of the
common pinctrl bindings used by client devices, including the meaning of the
phrase "pin configuration node".
The pin configuration nodes act as a container for an abitrary number of
subnodes. Each of these subnodes represents some desired configuration for a
pin, a group, or a list of pins or groups. This configuration can include the
mux function to select on those pin(s)/group(s), and various pin configuration
parameters, such as pull-up, drive strength, etc.
PIN CONFIGURATION NODES:
The name of each subnode is not important; all subnodes should be enumerated
and processed purely based on their content.
Each subnode only affects those parameters that are explicitly listed. In
other words, a subnode that lists a mux function but no pin configuration
parameters implies no information about any pin configuration parameters.
Similarly, a pin subnode that describes a pullup parameter implies no
information about e.g. the mux function.
The following generic properties as defined in pinctrl-bindings.txt are valid
to specify in a pin configuration subnode:
- pins:
Usage: required
Value type: <string-array>
Definition: List of gpio pins affected by the properties specified in
this subnode. Valid pins are:
gpio0-gpio151,
sdc1_clk,
sdc1_cmd,
sdc1_data
sdc3_clk,
sdc3_cmd,
sdc3_data
- function:
Usage: required
Value type: <string>
Definition: Specify the alternative function to be configured for the
specified pins. Functions are only valid for gpio pins.
Valid values are:
audio_pcm, bt, cam_mclk0, cam_mclk1, cam_mclk2,
codec_mic_i2s, codec_spkr_i2s, ext_gps, fm, gps_blanking,
gps_pps_in, gps_pps_out, gp_clk_0a, gp_clk_0b, gp_clk_1a,
gp_clk_1b, gp_clk_2a, gp_clk_2b, gp_mn, gp_pdm_0a,
gp_pdm_0b, gp_pdm_1a, gp_pdm_1b, gp_pdm_2a, gp_pdm_2b, gpio,
gsbi1, gsbi1_spi_cs1_n, gsbi1_spi_cs2a_n, gsbi1_spi_cs2b_n,
gsbi1_spi_cs3_n, gsbi2, gsbi2_spi_cs1_n, gsbi2_spi_cs2_n,
gsbi2_spi_cs3_n, gsbi3, gsbi4, gsbi4_3d_cam_i2c_l,
gsbi4_3d_cam_i2c_r, gsbi5, gsbi5_3d_cam_i2c_l,
gsbi5_3d_cam_i2c_r, gsbi6, gsbi7, gsbi8, gsbi9, gsbi10,
gsbi11, gsbi11_spi_cs1a_n, gsbi11_spi_cs1b_n,
gsbi11_spi_cs2a_n, gsbi11_spi_cs2b_n, gsbi11_spi_cs3_n,
gsbi12, hdmi_cec, hdmi_ddc_clock, hdmi_ddc_data,
hdmi_hot_plug_detect, hsic, mdp_vsync, mi2s, mic_i2s,
pmb_clk, pmb_ext_ctrl, ps_hold, rpm_wdog, sdc2, sdc4, sdc5,
slimbus1, slimbus2, spkr_i2s, ssbi1, ssbi2, ssbi_ext_gps,
ssbi_pmic2, ssbi_qpa1, ssbi_ts, tsif1, tsif2, ts_eoc,
usb_fs1, usb_fs1_oe, usb_fs1_oe_n, usb_fs2, usb_fs2_oe,
usb_fs2_oe_n, vfe_camif_timer1_a, vfe_camif_timer1_b,
vfe_camif_timer2, vfe_camif_timer3_a, vfe_camif_timer3_b,
vfe_camif_timer4_a, vfe_camif_timer4_b, vfe_camif_timer4_c,
vfe_camif_timer5_a, vfe_camif_timer5_b, vfe_camif_timer6_a,
vfe_camif_timer6_b, vfe_camif_timer6_c, vfe_camif_timer7_a,
vfe_camif_timer7_b, vfe_camif_timer7_c, wlan
- bias-disable:
Usage: optional
Value type: <none>
Definition: The specified pins should be configued as no pull.
- bias-pull-down:
Usage: optional
Value type: <none>
Definition: The specified pins should be configued as pull down.
- bias-pull-up:
Usage: optional
Value type: <none>
Definition: The specified pins should be configued as pull up.
- output-high:
Usage: optional
Value type: <none>
Definition: The specified pins are configured in output mode, driven
high.
Not valid for sdc pins.
- output-low:
Usage: optional
Value type: <none>
Definition: The specified pins are configured in output mode, driven
low.
Not valid for sdc pins.
- drive-strength:
Usage: optional
Value type: <u32>
Definition: Selects the drive strength for the specified pins, in mA.
Valid values are: 2, 4, 6, 8, 10, 12, 14 and 16
Example:
msmgpio: pinctrl@800000 {
compatible = "qcom,msm8960-pinctrl";
reg = <0x800000 0x4000>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
interrupts = <0 16 0x4>;
gsbi8_uart: gsbi8-uart {
mux {
pins = "gpio34", "gpio35";
function = "gsbi8";
};
tx {
pins = "gpio34";
drive-strength = <4>;
bias-disable;
};
rx {
pins = "gpio35";
drive-strength = <2>;
bias-pull-up;
};
};
};
...@@ -70,7 +70,7 @@ Valid values for function are: ...@@ -70,7 +70,7 @@ Valid values for function are:
cam_mckl0, cam_mclk1, cam_mclk2, cam_mclk3, mdp_vsync, hdmi_cec, hdmi_ddc, cam_mckl0, cam_mclk1, cam_mclk2, cam_mclk3, mdp_vsync, hdmi_cec, hdmi_ddc,
hdmi_hpd, edp_hpd, gp_pdm0, gp_pdm1, gp_pdm2, gp_pdm3, gp0_clk, gp1_clk, hdmi_hpd, edp_hpd, gp_pdm0, gp_pdm1, gp_pdm2, gp_pdm3, gp0_clk, gp1_clk,
gp_mn, tsif1, tsif2, hsic, grfc, audio_ref_clk, qua_mi2s, pri_mi2s, spkr_mi2s, gp_mn, tsif1, tsif2, hsic, grfc, audio_ref_clk, qua_mi2s, pri_mi2s, spkr_mi2s,
ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus, gpio
(Note that this is not yet the complete list of functions) (Note that this is not yet the complete list of functions)
......
...@@ -15,6 +15,7 @@ Required Properties: ...@@ -15,6 +15,7 @@ Required Properties:
- "renesas,pfc-r8a7778": for R8A7778 (R-Mobile M1) compatible pin-controller. - "renesas,pfc-r8a7778": for R8A7778 (R-Mobile M1) compatible pin-controller.
- "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller. - "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller.
- "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller. - "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller.
- "renesas,pfc-r8a7791": for R8A7791 (R-Car M2) compatible pin-controller.
- "renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller. - "renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller.
- "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller. - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
......
...@@ -21,6 +21,7 @@ defined as gpio sub-nodes of the pinmux controller. ...@@ -21,6 +21,7 @@ defined as gpio sub-nodes of the pinmux controller.
Required properties for iomux controller: Required properties for iomux controller:
- compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl" - compatible: one of "rockchip,rk2928-pinctrl", "rockchip,rk3066a-pinctrl"
"rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl" "rockchip,rk3066b-pinctrl", "rockchip,rk3188-pinctrl"
"rockchip,rk3288-pinctrl"
- rockchip,grf: phandle referencing a syscon providing the - rockchip,grf: phandle referencing a syscon providing the
"general register files" "general register files"
...@@ -36,7 +37,7 @@ Deprecated properties for iomux controller: ...@@ -36,7 +37,7 @@ Deprecated properties for iomux controller:
Use rockchip,grf and rockchip,pmu described above instead. Use rockchip,grf and rockchip,pmu described above instead.
Required properties for gpio sub nodes: Required properties for gpio sub nodes:
- compatible: "rockchip,gpio-bank", "rockchip,rk3188-gpio-bank0" - compatible: "rockchip,gpio-bank"
- reg: register of the gpio bank (different than the iomux registerset) - reg: register of the gpio bank (different than the iomux registerset)
- interrupts: base interrupt of the gpio bank in the interrupt controller - interrupts: base interrupt of the gpio bank in the interrupt controller
- clocks: clock that drives this bank - clocks: clock that drives this bank
...@@ -50,6 +51,7 @@ Required properties for gpio sub nodes: ...@@ -50,6 +51,7 @@ Required properties for gpio sub nodes:
bindings/interrupt-controller/interrupts.txt bindings/interrupt-controller/interrupts.txt
Deprecated properties for gpio sub nodes: Deprecated properties for gpio sub nodes:
- compatible: "rockchip,rk3188-gpio-bank0"
- reg: second element: separate pull register for rk3188 bank0, use - reg: second element: separate pull register for rk3188 bank0, use
rockchip,pmu described above instead rockchip,pmu described above instead
......
...@@ -44,7 +44,11 @@ Required Properties: ...@@ -44,7 +44,11 @@ Required Properties:
- Pin mux/config groups as child nodes: The pin mux (selecting pin function - Pin mux/config groups as child nodes: The pin mux (selecting pin function
mode) and pin config (pull up/down, driver strength) settings are represented mode) and pin config (pull up/down, driver strength) settings are represented
as child nodes of the pin-controller node. There should be atleast one as child nodes of the pin-controller node. There should be atleast one
child node and there is no limit on the count of these child nodes. child node and there is no limit on the count of these child nodes. It is
also possible for a child node to consist of several further child nodes
to allow grouping multiple pinctrl groups into one. The format of second
level child nodes is exactly the same as for first level ones and is
described below.
The child node should contain a list of pin(s) on which a particular pin The child node should contain a list of pin(s) on which a particular pin
function selection or pin configuration (or both) have to applied. This function selection or pin configuration (or both) have to applied. This
...@@ -71,6 +75,7 @@ Required Properties: ...@@ -71,6 +75,7 @@ Required Properties:
"samsung,pins" property of the child node. The following pin configuration "samsung,pins" property of the child node. The following pin configuration
properties are supported. properties are supported.
- samsung,pin-val: Initial value of pin output buffer.
- samsung,pin-pud: Pull up/down configuration. - samsung,pin-pud: Pull up/down configuration.
- samsung,pin-drv: Drive strength configuration. - samsung,pin-drv: Drive strength configuration.
- samsung,pin-pud-pdn: Pull up/down configuration in power down mode. - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
...@@ -249,6 +254,23 @@ Example 1: A pin-controller node with pin groups. ...@@ -249,6 +254,23 @@ Example 1: A pin-controller node with pin groups.
samsung,pin-pud = <3>; samsung,pin-pud = <3>;
samsung,pin-drv = <0>; samsung,pin-drv = <0>;
}; };
sd4_bus8: sd4-bus-width8 {
part-1 {
samsung,pins = "gpk0-3", "gpk0-4",
"gpk0-5", "gpk0-6";
samsung,pin-function = <3>;
samsung,pin-pud = <3>;
samsung,pin-drv = <3>;
};
part-2 {
samsung,pins = "gpk1-3", "gpk1-4",
"gpk1-5", "gpk1-6";
samsung,pin-function = <4>;
samsung,pin-pud = <4>;
samsung,pin-drv = <3>;
};
};
}; };
Example 2: A pin-controller node with external wakeup interrupt controller node. Example 2: A pin-controller node with external wakeup interrupt controller node.
......
...@@ -101,14 +101,6 @@ ...@@ -101,14 +101,6 @@
#define MX27_PAD_CONTRAST__GPIO1_30 0x1e 0x032 #define MX27_PAD_CONTRAST__GPIO1_30 0x1e 0x032
#define MX27_PAD_OE_ACD__OE_ACD 0x1f 0x004 #define MX27_PAD_OE_ACD__OE_ACD 0x1f 0x004
#define MX27_PAD_OE_ACD__GPIO1_31 0x1f 0x032 #define MX27_PAD_OE_ACD__GPIO1_31 0x1f 0x032
#define MX27_PAD_UNUSED0__UNUSED0 0x20 0x004
#define MX27_PAD_UNUSED0__GPIO2_0 0x20 0x032
#define MX27_PAD_UNUSED1__UNUSED1 0x21 0x004
#define MX27_PAD_UNUSED1__GPIO2_1 0x21 0x032
#define MX27_PAD_UNUSED2__UNUSED2 0x22 0x004
#define MX27_PAD_UNUSED2__GPIO2_2 0x22 0x032
#define MX27_PAD_UNUSED3__UNUSED3 0x23 0x004
#define MX27_PAD_UNUSED3__GPIO2_3 0x23 0x032
#define MX27_PAD_SD2_D0__SD2_D0 0x24 0x004 #define MX27_PAD_SD2_D0__SD2_D0 0x24 0x004
#define MX27_PAD_SD2_D0__MSHC_DATA0 0x24 0x005 #define MX27_PAD_SD2_D0__MSHC_DATA0 0x24 0x005
#define MX27_PAD_SD2_D0__GPIO2_4 0x24 0x032 #define MX27_PAD_SD2_D0__GPIO2_4 0x24 0x032
...@@ -183,16 +175,6 @@ ...@@ -183,16 +175,6 @@
#define MX27_PAD_USBH1_RXDP__USBH1_RXDP 0x3f 0x004 #define MX27_PAD_USBH1_RXDP__USBH1_RXDP 0x3f 0x004
#define MX27_PAD_USBH1_RXDP__UART4_RXD 0x3f 0x001 #define MX27_PAD_USBH1_RXDP__UART4_RXD 0x3f 0x001
#define MX27_PAD_USBH1_RXDP__GPIO2_31 0x3f 0x032 #define MX27_PAD_USBH1_RXDP__GPIO2_31 0x3f 0x032
#define MX27_PAD_UNUSED4__UNUSED4 0x40 0x004
#define MX27_PAD_UNUSED4__GPIO3_0 0x40 0x032
#define MX27_PAD_UNUSED5__UNUSED5 0x41 0x004
#define MX27_PAD_UNUSED5__GPIO3_1 0x41 0x032
#define MX27_PAD_UNUSED6__UNUSED6 0x42 0x004
#define MX27_PAD_UNUSED6__GPIO3_2 0x42 0x032
#define MX27_PAD_UNUSED7__UNUSED7 0x43 0x004
#define MX27_PAD_UNUSED7__GPIO3_3 0x43 0x032
#define MX27_PAD_UNUSED8__UNUSED8 0x44 0x004
#define MX27_PAD_UNUSED8__GPIO3_4 0x44 0x032
#define MX27_PAD_I2C2_SDA__I2C2_SDA 0x45 0x004 #define MX27_PAD_I2C2_SDA__I2C2_SDA 0x45 0x004
#define MX27_PAD_I2C2_SDA__GPIO3_5 0x45 0x032 #define MX27_PAD_I2C2_SDA__GPIO3_5 0x45 0x032
#define MX27_PAD_I2C2_SCL__I2C2_SCL 0x46 0x004 #define MX27_PAD_I2C2_SCL__I2C2_SCL 0x46 0x004
...@@ -422,18 +404,6 @@ ...@@ -422,18 +404,6 @@
#define MX27_PAD_USBOTG_CLK__GPIO5_24 0x98 0x032 #define MX27_PAD_USBOTG_CLK__GPIO5_24 0x98 0x032
#define MX27_PAD_USBOTG_DATA7__USBOTG_DATA7 0x99 0x004 #define MX27_PAD_USBOTG_DATA7__USBOTG_DATA7 0x99 0x004
#define MX27_PAD_USBOTG_DATA7__GPIO5_25 0x99 0x032 #define MX27_PAD_USBOTG_DATA7__GPIO5_25 0x99 0x032
#define MX27_PAD_UNUSED9__UNUSED9 0x9a 0x004
#define MX27_PAD_UNUSED9__GPIO5_26 0x9a 0x032
#define MX27_PAD_UNUSED10__UNUSED10 0x9b 0x004
#define MX27_PAD_UNUSED10__GPIO5_27 0x9b 0x032
#define MX27_PAD_UNUSED11__UNUSED11 0x9c 0x004
#define MX27_PAD_UNUSED11__GPIO5_28 0x9c 0x032
#define MX27_PAD_UNUSED12__UNUSED12 0x9d 0x004
#define MX27_PAD_UNUSED12__GPIO5_29 0x9d 0x032
#define MX27_PAD_UNUSED13__UNUSED13 0x9e 0x004
#define MX27_PAD_UNUSED13__GPIO5_30 0x9e 0x032
#define MX27_PAD_UNUSED14__UNUSED14 0x9f 0x004
#define MX27_PAD_UNUSED14__GPIO5_31 0x9f 0x032
#define MX27_PAD_NFRB__NFRB 0xa0 0x000 #define MX27_PAD_NFRB__NFRB 0xa0 0x000
#define MX27_PAD_NFRB__ETMTRACEPKT3 0xa0 0x005 #define MX27_PAD_NFRB__ETMTRACEPKT3 0xa0 0x005
#define MX27_PAD_NFRB__GPIO6_0 0xa0 0x032 #define MX27_PAD_NFRB__GPIO6_0 0xa0 0x032
...@@ -506,21 +476,5 @@ ...@@ -506,21 +476,5 @@
#define MX27_PAD_ATA_DATA15__ETMTRACEPKT4 0xb7 0x005 #define MX27_PAD_ATA_DATA15__ETMTRACEPKT4 0xb7 0x005
#define MX27_PAD_ATA_DATA15__FEC_TX_EN 0xb7 0x006 #define MX27_PAD_ATA_DATA15__FEC_TX_EN 0xb7 0x006
#define MX27_PAD_ATA_DATA15__GPIO6_23 0xb7 0x032 #define MX27_PAD_ATA_DATA15__GPIO6_23 0xb7 0x032
#define MX27_PAD_UNUSED15__UNUSED15 0xb8 0x004
#define MX27_PAD_UNUSED15__GPIO6_24 0xb8 0x032
#define MX27_PAD_UNUSED16__UNUSED16 0xb9 0x004
#define MX27_PAD_UNUSED16__GPIO6_25 0xb9 0x032
#define MX27_PAD_UNUSED17__UNUSED17 0xba 0x004
#define MX27_PAD_UNUSED17__GPIO6_26 0xba 0x032
#define MX27_PAD_UNUSED18__UNUSED18 0xbb 0x004
#define MX27_PAD_UNUSED18__GPIO6_27 0xbb 0x032
#define MX27_PAD_UNUSED19__UNUSED19 0xbc 0x004
#define MX27_PAD_UNUSED19__GPIO6_28 0xbc 0x032
#define MX27_PAD_UNUSED20__UNUSED20 0xbd 0x004
#define MX27_PAD_UNUSED20__GPIO6_29 0xbd 0x032
#define MX27_PAD_UNUSED21__UNUSED21 0xbe 0x004
#define MX27_PAD_UNUSED21__GPIO6_30 0xbe 0x032
#define MX27_PAD_UNUSED22__UNUSED22 0xbf 0x004
#define MX27_PAD_UNUSED22__GPIO6_31 0xbf 0x032
#endif /* __DTS_IMX27_PINFUNC_H */ #endif /* __DTS_IMX27_PINFUNC_H */
...@@ -4,7 +4,6 @@ menuconfig ARCH_SUNXI ...@@ -4,7 +4,6 @@ menuconfig ARCH_SUNXI
select CLKSRC_MMIO select CLKSRC_MMIO
select GENERIC_IRQ_CHIP select GENERIC_IRQ_CHIP
select PINCTRL select PINCTRL
select PINCTRL_SUNXI
select SUN4I_TIMER select SUN4I_TIMER
if ARCH_SUNXI if ARCH_SUNXI
......
...@@ -11,10 +11,10 @@ menu "Pin controllers" ...@@ -11,10 +11,10 @@ menu "Pin controllers"
depends on PINCTRL depends on PINCTRL
config PINMUX config PINMUX
bool "Support pin multiplexing controllers" bool "Support pin multiplexing controllers" if COMPILE_TEST
config PINCONF config PINCONF
bool "Support pin configuration controllers" bool "Support pin configuration controllers" if COMPILE_TEST
config GENERIC_PINCONF config GENERIC_PINCONF
bool bool
...@@ -26,29 +26,6 @@ config DEBUG_PINCTRL ...@@ -26,29 +26,6 @@ config DEBUG_PINCTRL
help help
Say Y here to add some extra checks and diagnostics to PINCTRL calls. Say Y here to add some extra checks and diagnostics to PINCTRL calls.
config PINCTRL_ABX500
bool "ST-Ericsson ABx500 family Mixed Signal Circuit gpio functions"
depends on AB8500_CORE
select GENERIC_PINCONF
help
Select this to enable the ABx500 family IC GPIO driver
config PINCTRL_AB8500
bool "AB8500 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB8540
bool "AB8540 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB9540
bool "AB9540 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB8505
bool "AB8505 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_ADI2 config PINCTRL_ADI2
bool "ADI pin controller driver" bool "ADI pin controller driver"
depends on BLACKFIN depends on BLACKFIN
...@@ -93,7 +70,7 @@ config PINCTRL_AT91 ...@@ -93,7 +70,7 @@ config PINCTRL_AT91
config PINCTRL_BAYTRAIL config PINCTRL_BAYTRAIL
bool "Intel Baytrail GPIO pin control" bool "Intel Baytrail GPIO pin control"
depends on GPIOLIB && ACPI && X86 depends on GPIOLIB && ACPI && X86
select IRQ_DOMAIN select GPIOLIB_IRQCHIP
help help
driver for memory mapped GPIO functionality on Intel Baytrail driver for memory mapped GPIO functionality on Intel Baytrail
platforms. Supports 3 banks with 102, 28 and 44 gpios. platforms. Supports 3 banks with 102, 28 and 44 gpios.
...@@ -130,6 +107,13 @@ config PINCTRL_IMX1_CORE ...@@ -130,6 +107,13 @@ config PINCTRL_IMX1_CORE
select PINMUX select PINMUX
select PINCONF select PINCONF
config PINCTRL_IMX1
bool "IMX1 pinctrl driver"
depends on SOC_IMX1
select PINCTRL_IMX1_CORE
help
Say Y here to enable the imx1 pinctrl driver
config PINCTRL_IMX27 config PINCTRL_IMX27
bool "IMX27 pinctrl driver" bool "IMX27 pinctrl driver"
depends on SOC_IMX27 depends on SOC_IMX27
...@@ -226,58 +210,6 @@ config PINCTRL_IMX28 ...@@ -226,58 +210,6 @@ config PINCTRL_IMX28
bool bool
select PINCTRL_MXS select PINCTRL_MXS
config PINCTRL_MSM
bool
select PINMUX
select PINCONF
select GENERIC_PINCONF
select GPIOLIB_IRQCHIP
config PINCTRL_APQ8064
tristate "Qualcomm APQ8064 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm APQ8064 platform.
config PINCTRL_IPQ8064
tristate "Qualcomm IPQ8064 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm IPQ8064 platform.
config PINCTRL_MSM8X74
tristate "Qualcomm 8x74 pin controller driver"
depends on GPIOLIB && OF && (ARCH_QCOM || COMPILE_TEST)
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm 8974 platform.
config PINCTRL_NOMADIK
bool "Nomadik pin controller driver"
depends on ARCH_U8500 || ARCH_NOMADIK
select PINMUX
select PINCONF
select GPIOLIB
select OF_GPIO
select GPIOLIB_IRQCHIP
config PINCTRL_STN8815
bool "STN8815 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_NOMADIK
config PINCTRL_DB8500
bool "DB8500 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_U8500
config PINCTRL_DB8540
bool "DB8540 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_U8500
config PINCTRL_ROCKCHIP config PINCTRL_ROCKCHIP
bool bool
select PINMUX select PINMUX
...@@ -356,22 +288,6 @@ config PINCTRL_COH901 ...@@ -356,22 +288,6 @@ config PINCTRL_COH901
COH 901 335 and COH 901 571/3. They contain 3, 5 or 7 COH 901 335 and COH 901 571/3. They contain 3, 5 or 7
ports of 8 GPIO pins each. ports of 8 GPIO pins each.
config PINCTRL_SAMSUNG
bool
select PINMUX
select PINCONF
config PINCTRL_EXYNOS
bool "Pinctrl driver data for Samsung EXYNOS SoCs other than 5440"
depends on OF && GPIOLIB && (ARCH_EXYNOS || ARCH_S5PV210)
select PINCTRL_SAMSUNG
config PINCTRL_EXYNOS5440
bool "Samsung EXYNOS5440 SoC pinctrl driver"
depends on SOC_EXYNOS5440
select PINMUX
select PINCONF
config PINCTRL_PALMAS config PINCTRL_PALMAS
bool "Pinctrl driver for the PALMAS Series MFD devices" bool "Pinctrl driver for the PALMAS Series MFD devices"
depends on OF && MFD_PALMAS depends on OF && MFD_PALMAS
...@@ -383,18 +299,11 @@ config PINCTRL_PALMAS ...@@ -383,18 +299,11 @@ config PINCTRL_PALMAS
open drain configuration for the Palmas series devices like open drain configuration for the Palmas series devices like
TPS65913, TPS80036 etc. TPS65913, TPS80036 etc.
config PINCTRL_S3C24XX
bool "Samsung S3C24XX SoC pinctrl driver"
depends on ARCH_S3C24XX
select PINCTRL_SAMSUNG
config PINCTRL_S3C64XX
bool "Samsung S3C64XX SoC pinctrl driver"
depends on ARCH_S3C64XX
select PINCTRL_SAMSUNG
source "drivers/pinctrl/berlin/Kconfig" source "drivers/pinctrl/berlin/Kconfig"
source "drivers/pinctrl/mvebu/Kconfig" source "drivers/pinctrl/mvebu/Kconfig"
source "drivers/pinctrl/nomadik/Kconfig"
source "drivers/pinctrl/qcom/Kconfig"
source "drivers/pinctrl/samsung/Kconfig"
source "drivers/pinctrl/sh-pfc/Kconfig" source "drivers/pinctrl/sh-pfc/Kconfig"
source "drivers/pinctrl/spear/Kconfig" source "drivers/pinctrl/spear/Kconfig"
source "drivers/pinctrl/sunxi/Kconfig" source "drivers/pinctrl/sunxi/Kconfig"
......
...@@ -9,11 +9,6 @@ ifeq ($(CONFIG_OF),y) ...@@ -9,11 +9,6 @@ ifeq ($(CONFIG_OF),y)
obj-$(CONFIG_PINCTRL) += devicetree.o obj-$(CONFIG_PINCTRL) += devicetree.o
endif endif
obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
obj-$(CONFIG_PINCTRL_ABX500) += pinctrl-abx500.o
obj-$(CONFIG_PINCTRL_AB8500) += pinctrl-ab8500.o
obj-$(CONFIG_PINCTRL_AB8540) += pinctrl-ab8540.o
obj-$(CONFIG_PINCTRL_AB9540) += pinctrl-ab9540.o
obj-$(CONFIG_PINCTRL_AB8505) += pinctrl-ab8505.o
obj-$(CONFIG_PINCTRL_ADI2) += pinctrl-adi2.o obj-$(CONFIG_PINCTRL_ADI2) += pinctrl-adi2.o
obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o
obj-$(CONFIG_PINCTRL_BF54x) += pinctrl-adi2-bf54x.o obj-$(CONFIG_PINCTRL_BF54x) += pinctrl-adi2-bf54x.o
...@@ -24,6 +19,7 @@ obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o ...@@ -24,6 +19,7 @@ obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o
obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o
obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o
obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o obj-$(CONFIG_PINCTRL_IMX1_CORE) += pinctrl-imx1-core.o
obj-$(CONFIG_PINCTRL_IMX1) += pinctrl-imx1.o
obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o obj-$(CONFIG_PINCTRL_IMX27) += pinctrl-imx27.o
obj-$(CONFIG_PINCTRL_IMX35) += pinctrl-imx35.o obj-$(CONFIG_PINCTRL_IMX35) += pinctrl-imx35.o
obj-$(CONFIG_PINCTRL_IMX50) += pinctrl-imx50.o obj-$(CONFIG_PINCTRL_IMX50) += pinctrl-imx50.o
...@@ -38,14 +34,6 @@ obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o ...@@ -38,14 +34,6 @@ obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o
obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o
obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o
obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o
obj-$(CONFIG_PINCTRL_MSM) += pinctrl-msm.o
obj-$(CONFIG_PINCTRL_APQ8064) += pinctrl-apq8064.o
obj-$(CONFIG_PINCTRL_IPQ8064) += pinctrl-ipq8064.o
obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o
obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o
obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o
obj-$(CONFIG_PINCTRL_DB8540) += pinctrl-nomadik-db8540.o
obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o
obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
...@@ -59,11 +47,6 @@ obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o ...@@ -59,11 +47,6 @@ obj-$(CONFIG_PINCTRL_TZ1090) += pinctrl-tz1090.o
obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o obj-$(CONFIG_PINCTRL_TZ1090_PDC) += pinctrl-tz1090-pdc.o
obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o
obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o
obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o
obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o
obj-$(CONFIG_PINCTRL_S3C24XX) += pinctrl-s3c24xx.o
obj-$(CONFIG_PINCTRL_S3C64XX) += pinctrl-s3c64xx.o
obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o
obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o
obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
...@@ -72,8 +55,11 @@ obj-$(CONFIG_PINCTRL_VF610) += pinctrl-vf610.o ...@@ -72,8 +55,11 @@ obj-$(CONFIG_PINCTRL_VF610) += pinctrl-vf610.o
obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-$(CONFIG_ARCH_BERLIN) += berlin/
obj-$(CONFIG_PLAT_ORION) += mvebu/ obj-$(CONFIG_PLAT_ORION) += mvebu/
obj-y += nomadik/
obj-$(CONFIG_ARCH_QCOM) += qcom/
obj-$(CONFIG_PLAT_SAMSUNG) += samsung/
obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/ obj-$(CONFIG_ARCH_SHMOBILE) += sh-pfc/
obj-$(CONFIG_SUPERH) += sh-pfc/ obj-$(CONFIG_SUPERH) += sh-pfc/
obj-$(CONFIG_PLAT_SPEAR) += spear/ obj-$(CONFIG_PLAT_SPEAR) += spear/
obj-$(CONFIG_ARCH_VT8500) += vt8500/
obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/
obj-$(CONFIG_ARCH_VT8500) += vt8500/
...@@ -992,28 +992,14 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) ...@@ -992,28 +992,14 @@ int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
if (p->state) { if (p->state) {
/* /*
* The set of groups with a mux configuration in the old state * For each pinmux setting in the old state, forget SW's record
* may not be identical to the set of groups with a mux setting * of mux owner for that pingroup. Any pingroups which are
* in the new state. While this might be unusual, it's entirely * still owned by the new state will be re-acquired by the call
* possible for the "user"-supplied mapping table to be written * to pinmux_enable_setting() in the loop below.
* that way. For each group that was configured in the old state
* but not in the new state, this code puts that group into a
* safe/disabled state.
*/ */
list_for_each_entry(setting, &p->state->settings, node) { list_for_each_entry(setting, &p->state->settings, node) {
bool found = false;
if (setting->type != PIN_MAP_TYPE_MUX_GROUP) if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
continue; continue;
list_for_each_entry(setting2, &state->settings, node) {
if (setting2->type != PIN_MAP_TYPE_MUX_GROUP)
continue;
if (setting2->data.mux.group ==
setting->data.mux.group) {
found = true;
break;
}
}
if (!found)
pinmux_disable_setting(setting); pinmux_disable_setting(setting);
} }
} }
......
if ARCH_U8500
config PINCTRL_ABX500
bool "ST-Ericsson ABx500 family Mixed Signal Circuit gpio functions"
depends on AB8500_CORE
select GENERIC_PINCONF
help
Select this to enable the ABx500 family IC GPIO driver
config PINCTRL_AB8500
bool "AB8500 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB8540
bool "AB8540 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB9540
bool "AB9540 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
config PINCTRL_AB8505
bool "AB8505 pin controller driver"
depends on PINCTRL_ABX500 && ARCH_U8500
endif
if (ARCH_U8500 || ARCH_NOMADIK)
config PINCTRL_NOMADIK
bool "Nomadik pin controller driver"
depends on ARCH_U8500 || ARCH_NOMADIK
select PINMUX
select PINCONF
select GPIOLIB
select OF_GPIO
select GPIOLIB_IRQCHIP
config PINCTRL_STN8815
bool "STN8815 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_NOMADIK
config PINCTRL_DB8500
bool "DB8500 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_U8500
config PINCTRL_DB8540
bool "DB8540 pin controller driver"
depends on PINCTRL_NOMADIK && ARCH_U8500
endif
# Nomadik family pin control drivers
obj-$(CONFIG_PINCTRL_ABX500) += pinctrl-abx500.o
obj-$(CONFIG_PINCTRL_AB8500) += pinctrl-ab8500.o
obj-$(CONFIG_PINCTRL_AB8540) += pinctrl-ab8540.o
obj-$(CONFIG_PINCTRL_AB9540) += pinctrl-ab9540.o
obj-$(CONFIG_PINCTRL_AB8505) += pinctrl-ab8505.o
obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o
obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o
obj-$(CONFIG_PINCTRL_DB8540) += pinctrl-nomadik-db8540.o
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
#include "pinctrl-abx500.h" #include "pinctrl-abx500.h"
#include "core.h" #include "../core.h"
#include "pinconf.h" #include "../pinconf.h"
/* /*
* The AB9540 and AB8540 GPIO support are extended versions * The AB9540 and AB8540 GPIO support are extended versions
...@@ -737,20 +737,6 @@ static int abx500_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, ...@@ -737,20 +737,6 @@ static int abx500_pmx_enable(struct pinctrl_dev *pctldev, unsigned function,
return ret; return ret;
} }
static void abx500_pmx_disable(struct pinctrl_dev *pctldev,
unsigned function, unsigned group)
{
struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
const struct abx500_pingroup *g;
g = &pct->soc->groups[group];
if (g->altsetting < 0)
return;
/* FIXME: poke out the mux, set the pin to some default state? */
dev_dbg(pct->dev, "disable group %s, %u pins\n", g->name, g->npins);
}
static int abx500_gpio_request_enable(struct pinctrl_dev *pctldev, static int abx500_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned offset)
...@@ -799,7 +785,6 @@ static const struct pinmux_ops abx500_pinmux_ops = { ...@@ -799,7 +785,6 @@ static const struct pinmux_ops abx500_pinmux_ops = {
.get_function_name = abx500_pmx_get_func_name, .get_function_name = abx500_pmx_get_func_name,
.get_function_groups = abx500_pmx_get_func_groups, .get_function_groups = abx500_pmx_get_func_groups,
.enable = abx500_pmx_enable, .enable = abx500_pmx_enable,
.disable = abx500_pmx_disable,
.gpio_request_enable = abx500_gpio_request_enable, .gpio_request_enable = abx500_gpio_request_enable,
.gpio_disable_free = abx500_gpio_disable_free, .gpio_disable_free = abx500_gpio_disable_free,
}; };
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
/* Since we request GPIOs from ourself */ /* Since we request GPIOs from ourself */
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include "pinctrl-nomadik.h" #include "pinctrl-nomadik.h"
#include "core.h" #include "../core.h"
/* /*
* The GPIO module in the Nomadik family of Systems-on-Chip is an * The GPIO module in the Nomadik family of Systems-on-Chip is an
...@@ -1765,21 +1765,6 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, ...@@ -1765,21 +1765,6 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function,
return ret; return ret;
} }
static void nmk_pmx_disable(struct pinctrl_dev *pctldev,
unsigned function, unsigned group)
{
struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev);
const struct nmk_pingroup *g;
g = &npct->soc->groups[group];
if (g->altsetting < 0)
return;
/* Poke out the mux, set the pin to some default state? */
dev_dbg(npct->dev, "disable group %s, %u pins\n", g->name, g->npins);
}
static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned offset)
...@@ -1826,7 +1811,6 @@ static const struct pinmux_ops nmk_pinmux_ops = { ...@@ -1826,7 +1811,6 @@ static const struct pinmux_ops nmk_pinmux_ops = {
.get_function_name = nmk_pmx_get_func_name, .get_function_name = nmk_pmx_get_func_name,
.get_function_groups = nmk_pmx_get_func_groups, .get_function_groups = nmk_pmx_get_func_groups,
.enable = nmk_pmx_enable, .enable = nmk_pmx_enable,
.disable = nmk_pmx_disable,
.gpio_request_enable = nmk_gpio_request_enable, .gpio_request_enable = nmk_gpio_request_enable,
.gpio_disable_free = nmk_gpio_disable_free, .gpio_disable_free = nmk_gpio_disable_free,
}; };
......
...@@ -401,7 +401,7 @@ static int adi_gpio_irq_type(struct irq_data *d, unsigned int type) ...@@ -401,7 +401,7 @@ static int adi_gpio_irq_type(struct irq_data *d, unsigned int type)
if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
snprintf(buf, 16, "gpio-irq%d", irq); snprintf(buf, 16, "gpio-irq%u", irq);
port_setup(port, d->hwirq, true); port_setup(port, d->hwirq, true);
} else } else
goto out; goto out;
...@@ -652,35 +652,6 @@ static int adi_pinmux_enable(struct pinctrl_dev *pctldev, unsigned func_id, ...@@ -652,35 +652,6 @@ static int adi_pinmux_enable(struct pinctrl_dev *pctldev, unsigned func_id,
return 0; return 0;
} }
static void adi_pinmux_disable(struct pinctrl_dev *pctldev, unsigned func_id,
unsigned group_id)
{
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
struct gpio_port *port;
struct pinctrl_gpio_range *range;
unsigned long flags;
unsigned short *mux, pin;
mux = (unsigned short *)pinctrl->soc->groups[group_id].mux;
while (*mux) {
pin = P_IDENT(*mux);
range = pinctrl_find_gpio_range_from_pin(pctldev, pin);
if (range == NULL) /* should not happen */
return;
port = container_of(range->gc, struct gpio_port, chip);
spin_lock_irqsave(&port->lock, flags);
port_setup(port, pin_to_offset(range, pin), true);
mux++;
spin_unlock_irqrestore(&port->lock, flags);
}
}
static int adi_pinmux_get_funcs_count(struct pinctrl_dev *pctldev) static int adi_pinmux_get_funcs_count(struct pinctrl_dev *pctldev)
{ {
struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev); struct adi_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctldev);
...@@ -728,7 +699,6 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev, ...@@ -728,7 +699,6 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev,
static struct pinmux_ops adi_pinmux_ops = { static struct pinmux_ops adi_pinmux_ops = {
.enable = adi_pinmux_enable, .enable = adi_pinmux_enable,
.disable = adi_pinmux_disable,
.get_functions_count = adi_pinmux_get_funcs_count, .get_functions_count = adi_pinmux_get_funcs_count,
.get_function_name = adi_pinmux_get_func_name, .get_function_name = adi_pinmux_get_func_name,
.get_function_groups = adi_pinmux_get_groups, .get_function_groups = adi_pinmux_get_groups,
...@@ -979,7 +949,7 @@ static int adi_gpio_probe(struct platform_device *pdev) ...@@ -979,7 +949,7 @@ static int adi_gpio_probe(struct platform_device *pdev)
struct gpio_port *port; struct gpio_port *port;
char pinctrl_devname[DEVNAME_SIZE]; char pinctrl_devname[DEVNAME_SIZE];
static int gpio; static int gpio;
int ret = 0, ret1; int ret = 0;
pdata = dev->platform_data; pdata = dev->platform_data;
if (!pdata) if (!pdata)
...@@ -1057,7 +1027,7 @@ static int adi_gpio_probe(struct platform_device *pdev) ...@@ -1057,7 +1027,7 @@ static int adi_gpio_probe(struct platform_device *pdev)
return 0; return 0;
out_remove_gpiochip: out_remove_gpiochip:
ret1 = gpiochip_remove(&port->chip); gpiochip_remove(&port->chip);
out_remove_domain: out_remove_domain:
if (port->pint) if (port->pint)
irq_domain_remove(port->domain); irq_domain_remove(port->domain);
...@@ -1068,12 +1038,11 @@ static int adi_gpio_probe(struct platform_device *pdev) ...@@ -1068,12 +1038,11 @@ static int adi_gpio_probe(struct platform_device *pdev)
static int adi_gpio_remove(struct platform_device *pdev) static int adi_gpio_remove(struct platform_device *pdev)
{ {
struct gpio_port *port = platform_get_drvdata(pdev); struct gpio_port *port = platform_get_drvdata(pdev);
int ret;
u8 offset; u8 offset;
list_del(&port->node); list_del(&port->node);
gpiochip_remove_pin_ranges(&port->chip); gpiochip_remove_pin_ranges(&port->chip);
ret = gpiochip_remove(&port->chip); gpiochip_remove(&port->chip);
if (port->pint) { if (port->pint) {
for (offset = 0; offset < port->width; offset++) for (offset = 0; offset < port->width; offset++)
irq_dispose_mapping(irq_find_mapping(port->domain, irq_dispose_mapping(irq_find_mapping(port->domain,
...@@ -1081,7 +1050,7 @@ static int adi_gpio_remove(struct platform_device *pdev) ...@@ -1081,7 +1050,7 @@ static int adi_gpio_remove(struct platform_device *pdev)
irq_domain_remove(port->domain); irq_domain_remove(port->domain);
} }
return ret; return 0;
} }
static int adi_pinctrl_probe(struct platform_device *pdev) static int adi_pinctrl_probe(struct platform_device *pdev)
......
...@@ -565,7 +565,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) ...@@ -565,7 +565,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
{ {
struct as3722_pctrl_info *as_pci; struct as3722_pctrl_info *as_pci;
int ret; int ret;
int tret;
as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL); as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL);
if (!as_pci) if (!as_pci)
...@@ -611,10 +610,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) ...@@ -611,10 +610,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
return 0; return 0;
fail_range_add: fail_range_add:
tret = gpiochip_remove(&as_pci->gpio_chip); gpiochip_remove(&as_pci->gpio_chip);
if (tret < 0)
dev_warn(&pdev->dev, "Couldn't remove gpio chip, %d\n", tret);
fail_chip_add: fail_chip_add:
pinctrl_unregister(as_pci->pctl); pinctrl_unregister(as_pci->pctl);
return ret; return ret;
...@@ -623,11 +619,8 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) ...@@ -623,11 +619,8 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
static int as3722_pinctrl_remove(struct platform_device *pdev) static int as3722_pinctrl_remove(struct platform_device *pdev)
{ {
struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev); struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev);
int ret;
ret = gpiochip_remove(&as_pci->gpio_chip); gpiochip_remove(&as_pci->gpio_chip);
if (ret < 0)
return ret;
pinctrl_unregister(as_pci->pctl); pinctrl_unregister(as_pci->pctl);
return 0; return 0;
} }
......
...@@ -611,26 +611,6 @@ static int at91_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -611,26 +611,6 @@ static int at91_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static void at91_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
unsigned group)
{
struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
const struct at91_pmx_pin *pins_conf = info->groups[group].pins_conf;
const struct at91_pmx_pin *pin;
uint32_t npins = info->groups[group].npins;
int i;
unsigned mask;
void __iomem *pio;
for (i = 0; i < npins; i++) {
pin = &pins_conf[i];
at91_pin_dbg(info->dev, pin);
pio = pin_to_controller(info, pin->bank);
mask = pin_to_mask(pin->pin);
at91_mux_gpio_enable(pio, mask, 1);
}
}
static int at91_pmx_get_funcs_count(struct pinctrl_dev *pctldev) static int at91_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
{ {
struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); struct at91_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
...@@ -705,7 +685,6 @@ static const struct pinmux_ops at91_pmx_ops = { ...@@ -705,7 +685,6 @@ static const struct pinmux_ops at91_pmx_ops = {
.get_function_name = at91_pmx_get_func_name, .get_function_name = at91_pmx_get_func_name,
.get_function_groups = at91_pmx_get_groups, .get_function_groups = at91_pmx_get_groups,
.enable = at91_pmx_enable, .enable = at91_pmx_enable,
.disable = at91_pmx_disable,
.gpio_request_enable = at91_gpio_request_enable, .gpio_request_enable = at91_gpio_request_enable,
.gpio_disable_free = at91_gpio_disable_free, .gpio_disable_free = at91_gpio_disable_free,
}; };
...@@ -793,9 +772,9 @@ static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev, ...@@ -793,9 +772,9 @@ static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned pin_id) struct seq_file *s, unsigned pin_id)
{ {
unsigned long config; unsigned long config;
int ret, val, num_conf = 0; int val, num_conf = 0;
ret = at91_pinconf_get(pctldev, pin_id, &config); at91_pinconf_get(pctldev, pin_id, &config);
DBG_SHOW_FLAG(MULTI_DRIVE); DBG_SHOW_FLAG(MULTI_DRIVE);
DBG_SHOW_FLAG(PULL_UP); DBG_SHOW_FLAG(PULL_UP);
...@@ -945,7 +924,7 @@ static int at91_pinctrl_parse_functions(struct device_node *np, ...@@ -945,7 +924,7 @@ static int at91_pinctrl_parse_functions(struct device_node *np,
/* Initialise function */ /* Initialise function */
func->name = np->name; func->name = np->name;
func->ngroups = of_get_child_count(np); func->ngroups = of_get_child_count(np);
if (func->ngroups <= 0) { if (func->ngroups == 0) {
dev_err(info->dev, "no groups defined\n"); dev_err(info->dev, "no groups defined\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/irqdomain.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
...@@ -44,6 +42,7 @@ ...@@ -44,6 +42,7 @@
/* BYT_CONF0_REG register bits */ /* BYT_CONF0_REG register bits */
#define BYT_IODEN BIT(31) #define BYT_IODEN BIT(31)
#define BYT_DIRECT_IRQ_EN BIT(27)
#define BYT_TRIG_NEG BIT(26) #define BYT_TRIG_NEG BIT(26)
#define BYT_TRIG_POS BIT(25) #define BYT_TRIG_POS BIT(25)
#define BYT_TRIG_LVL BIT(24) #define BYT_TRIG_LVL BIT(24)
...@@ -137,7 +136,6 @@ static struct pinctrl_gpio_range byt_ranges[] = { ...@@ -137,7 +136,6 @@ static struct pinctrl_gpio_range byt_ranges[] = {
struct byt_gpio { struct byt_gpio {
struct gpio_chip chip; struct gpio_chip chip;
struct irq_domain *domain;
struct platform_device *pdev; struct platform_device *pdev;
spinlock_t lock; spinlock_t lock;
void __iomem *reg_base; void __iomem *reg_base;
...@@ -217,7 +215,7 @@ static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) ...@@ -217,7 +215,7 @@ static void byt_gpio_free(struct gpio_chip *chip, unsigned offset)
static int byt_irq_type(struct irq_data *d, unsigned type) static int byt_irq_type(struct irq_data *d, unsigned type)
{ {
struct byt_gpio *vg = irq_data_get_irq_chip_data(d); struct byt_gpio *vg = to_byt_gpio(irq_data_get_irq_chip_data(d));
u32 offset = irqd_to_hwirq(d); u32 offset = irqd_to_hwirq(d);
u32 value; u32 value;
unsigned long flags; unsigned long flags;
...@@ -303,12 +301,22 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, ...@@ -303,12 +301,22 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
unsigned gpio, int value) unsigned gpio, int value)
{ {
struct byt_gpio *vg = to_byt_gpio(chip); struct byt_gpio *vg = to_byt_gpio(chip);
void __iomem *conf_reg = byt_gpio_reg(chip, gpio, BYT_CONF0_REG);
void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG); void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG);
unsigned long flags; unsigned long flags;
u32 reg_val; u32 reg_val;
spin_lock_irqsave(&vg->lock, flags); spin_lock_irqsave(&vg->lock, flags);
/*
* Before making any direction modifications, do a check if gpio
* is set for direct IRQ. On baytrail, setting GPIO to output does
* not make sense, so let's at least warn the caller before they shoot
* themselves in the foot.
*/
WARN(readl(conf_reg) & BYT_DIRECT_IRQ_EN,
"Potential Error: Setting GPIO with direct_irq_en to output");
reg_val = readl(reg) | BYT_DIR_MASK; reg_val = readl(reg) | BYT_DIR_MASK;
reg_val &= ~BYT_OUTPUT_EN; reg_val &= ~BYT_OUTPUT_EN;
...@@ -393,16 +401,10 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) ...@@ -393,16 +401,10 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
spin_unlock_irqrestore(&vg->lock, flags); spin_unlock_irqrestore(&vg->lock, flags);
} }
static int byt_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
struct byt_gpio *vg = to_byt_gpio(chip);
return irq_create_mapping(vg->domain, offset);
}
static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc) static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct irq_data *data = irq_desc_get_irq_data(desc); struct irq_data *data = irq_desc_get_irq_data(desc);
struct byt_gpio *vg = irq_data_get_irq_handler_data(data); struct byt_gpio *vg = to_byt_gpio(irq_desc_get_handler_data(desc));
struct irq_chip *chip = irq_data_get_irq_chip(data); struct irq_chip *chip = irq_data_get_irq_chip(data);
u32 base, pin, mask; u32 base, pin, mask;
void __iomem *reg; void __iomem *reg;
...@@ -421,7 +423,7 @@ static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -421,7 +423,7 @@ static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
/* Clear before handling so we can't lose an edge */ /* Clear before handling so we can't lose an edge */
writel(mask, reg); writel(mask, reg);
virq = irq_find_mapping(vg->domain, base + pin); virq = irq_find_mapping(vg->chip.irqdomain, base + pin);
generic_handle_irq(virq); generic_handle_irq(virq);
/* In case bios or user sets triggering incorretly a pin /* In case bios or user sets triggering incorretly a pin
...@@ -454,33 +456,11 @@ static void byt_irq_mask(struct irq_data *d) ...@@ -454,33 +456,11 @@ static void byt_irq_mask(struct irq_data *d)
{ {
} }
static int byt_irq_reqres(struct irq_data *d)
{
struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d))) {
dev_err(vg->chip.dev,
"unable to lock HW IRQ %lu for IRQ\n",
irqd_to_hwirq(d));
return -EINVAL;
}
return 0;
}
static void byt_irq_relres(struct irq_data *d)
{
struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d));
}
static struct irq_chip byt_irqchip = { static struct irq_chip byt_irqchip = {
.name = "BYT-GPIO", .name = "BYT-GPIO",
.irq_mask = byt_irq_mask, .irq_mask = byt_irq_mask,
.irq_unmask = byt_irq_unmask, .irq_unmask = byt_irq_unmask,
.irq_set_type = byt_irq_type, .irq_set_type = byt_irq_type,
.irq_request_resources = byt_irq_reqres,
.irq_release_resources = byt_irq_relres,
}; };
static void byt_gpio_irq_init_hw(struct byt_gpio *vg) static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
...@@ -501,23 +481,6 @@ static void byt_gpio_irq_init_hw(struct byt_gpio *vg) ...@@ -501,23 +481,6 @@ static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
} }
} }
static int byt_gpio_irq_map(struct irq_domain *d, unsigned int virq,
irq_hw_number_t hw)
{
struct byt_gpio *vg = d->host_data;
irq_set_chip_and_handler_name(virq, &byt_irqchip, handle_simple_irq,
"demux");
irq_set_chip_data(virq, vg);
irq_set_irq_type(virq, IRQ_TYPE_NONE);
return 0;
}
static const struct irq_domain_ops byt_gpio_irq_ops = {
.map = byt_gpio_irq_map,
};
static int byt_gpio_probe(struct platform_device *pdev) static int byt_gpio_probe(struct platform_device *pdev)
{ {
struct byt_gpio *vg; struct byt_gpio *vg;
...@@ -527,7 +490,6 @@ static int byt_gpio_probe(struct platform_device *pdev) ...@@ -527,7 +490,6 @@ static int byt_gpio_probe(struct platform_device *pdev)
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
struct pinctrl_gpio_range *range; struct pinctrl_gpio_range *range;
acpi_handle handle = ACPI_HANDLE(dev); acpi_handle handle = ACPI_HANDLE(dev);
unsigned hwirq;
int ret; int ret;
if (acpi_bus_get_device(handle, &acpi_dev)) if (acpi_bus_get_device(handle, &acpi_dev))
...@@ -574,29 +536,29 @@ static int byt_gpio_probe(struct platform_device *pdev) ...@@ -574,29 +536,29 @@ static int byt_gpio_probe(struct platform_device *pdev)
gc->can_sleep = false; gc->can_sleep = false;
gc->dev = dev; gc->dev = dev;
ret = gpiochip_add(gc);
if (ret) {
dev_err(&pdev->dev, "failed adding byt-gpio chip\n");
return ret;
}
/* set up interrupts */ /* set up interrupts */
irq_rc = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq_rc = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (irq_rc && irq_rc->start) { if (irq_rc && irq_rc->start) {
hwirq = irq_rc->start;
gc->to_irq = byt_gpio_to_irq;
vg->domain = irq_domain_add_linear(NULL, gc->ngpio,
&byt_gpio_irq_ops, vg);
if (!vg->domain)
return -ENXIO;
byt_gpio_irq_init_hw(vg); byt_gpio_irq_init_hw(vg);
ret = gpiochip_irqchip_add(gc, &byt_irqchip, 0,
irq_set_handler_data(hwirq, vg); handle_simple_irq, IRQ_TYPE_NONE);
irq_set_chained_handler(hwirq, byt_gpio_irq_handler);
}
ret = gpiochip_add(gc);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed adding byt-gpio chip\n"); dev_err(dev, "failed to add irqchip\n");
gpiochip_remove(gc);
return ret; return ret;
} }
gpiochip_set_chained_irqchip(gc, &byt_irqchip,
(unsigned)irq_rc->start,
byt_gpio_irq_handler);
}
pm_runtime_enable(dev); pm_runtime_enable(dev);
return 0; return 0;
...@@ -627,12 +589,9 @@ MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match); ...@@ -627,12 +589,9 @@ MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
static int byt_gpio_remove(struct platform_device *pdev) static int byt_gpio_remove(struct platform_device *pdev)
{ {
struct byt_gpio *vg = platform_get_drvdata(pdev); struct byt_gpio *vg = platform_get_drvdata(pdev);
int err;
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
err = gpiochip_remove(&vg->chip); gpiochip_remove(&vg->chip);
if (err)
dev_warn(&pdev->dev, "failed to remove gpio_chip.\n");
return 0; return 0;
} }
......
...@@ -1396,7 +1396,7 @@ static struct pinctrl_desc bcm281xx_pinctrl_desc = { ...@@ -1396,7 +1396,7 @@ static struct pinctrl_desc bcm281xx_pinctrl_desc = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
int __init bcm281xx_pinctrl_probe(struct platform_device *pdev) static int __init bcm281xx_pinctrl_probe(struct platform_device *pdev)
{ {
struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl; struct bcm281xx_pinctrl_data *pdata = &bcm281xx_pinctrl;
struct resource *res; struct resource *res;
......
...@@ -841,16 +841,6 @@ static int bcm2835_pmx_enable(struct pinctrl_dev *pctldev, ...@@ -841,16 +841,6 @@ static int bcm2835_pmx_enable(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static void bcm2835_pmx_disable(struct pinctrl_dev *pctldev,
unsigned func_selector,
unsigned group_selector)
{
struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
/* disable by setting to GPIO_IN */
bcm2835_pinctrl_fsel_set(pc, group_selector, BCM2835_FSEL_GPIO_IN);
}
static void bcm2835_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, static void bcm2835_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned offset)
...@@ -880,7 +870,6 @@ static const struct pinmux_ops bcm2835_pmx_ops = { ...@@ -880,7 +870,6 @@ static const struct pinmux_ops bcm2835_pmx_ops = {
.get_function_name = bcm2835_pmx_get_function_name, .get_function_name = bcm2835_pmx_get_function_name,
.get_function_groups = bcm2835_pmx_get_function_groups, .get_function_groups = bcm2835_pmx_get_function_groups,
.enable = bcm2835_pmx_enable, .enable = bcm2835_pmx_enable,
.disable = bcm2835_pmx_disable,
.gpio_disable_free = bcm2835_pmx_gpio_disable_free, .gpio_disable_free = bcm2835_pmx_gpio_disable_free,
.gpio_set_direction = bcm2835_pmx_gpio_set_direction, .gpio_set_direction = bcm2835_pmx_gpio_set_direction,
}; };
......
...@@ -756,8 +756,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -756,8 +756,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
err_no_range: err_no_range:
err_no_irqchip: err_no_irqchip:
if (gpiochip_remove(&gpio->chip)) gpiochip_remove(&gpio->chip);
dev_err(&pdev->dev, "failed to remove gpio chip\n");
err_no_chip: err_no_chip:
clk_disable_unprepare(gpio->clk); clk_disable_unprepare(gpio->clk);
dev_err(&pdev->dev, "module ERROR:%d\n", err); dev_err(&pdev->dev, "module ERROR:%d\n", err);
...@@ -767,16 +766,11 @@ static int __init u300_gpio_probe(struct platform_device *pdev) ...@@ -767,16 +766,11 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
static int __exit u300_gpio_remove(struct platform_device *pdev) static int __exit u300_gpio_remove(struct platform_device *pdev)
{ {
struct u300_gpio *gpio = platform_get_drvdata(pdev); struct u300_gpio *gpio = platform_get_drvdata(pdev);
int err;
/* Turn off the GPIO block */ /* Turn off the GPIO block */
writel(0x00000000U, gpio->base + U300_GPIO_CR); writel(0x00000000U, gpio->base + U300_GPIO_CR);
err = gpiochip_remove(&gpio->chip); gpiochip_remove(&gpio->chip);
if (err < 0) {
dev_err(gpio->dev, "unable to remove gpiochip: %d\n", err);
return err;
}
clk_disable_unprepare(gpio->clk); clk_disable_unprepare(gpio->clk);
return 0; return 0;
} }
......
...@@ -515,7 +515,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np, ...@@ -515,7 +515,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
/* Initialise function */ /* Initialise function */
func->name = np->name; func->name = np->name;
func->num_groups = of_get_child_count(np); func->num_groups = of_get_child_count(np);
if (func->num_groups <= 0) { if (func->num_groups == 0) {
dev_err(info->dev, "no groups defined in %s\n", np->full_name); dev_err(info->dev, "no groups defined in %s\n", np->full_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -526,7 +526,7 @@ static int imx1_pinctrl_parse_functions(struct device_node *np, ...@@ -526,7 +526,7 @@ static int imx1_pinctrl_parse_functions(struct device_node *np,
/* Initialise function */ /* Initialise function */
func->name = np->name; func->name = np->name;
func->num_groups = of_get_child_count(np); func->num_groups = of_get_child_count(np);
if (func->num_groups <= 0) if (func->num_groups == 0)
return -EINVAL; return -EINVAL;
func->groups = devm_kzalloc(info->dev, func->groups = devm_kzalloc(info->dev,
......
/*
* i.MX1 pinctrl driver based on imx pinmux core
*
* Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/pinctrl.h>
#include "pinctrl-imx1.h"
#define PAD_ID(port, pin) ((port) * 32 + (pin))
#define PA 0
#define PB 1
#define PC 2
#define PD 3
enum imx1_pads {
MX1_PAD_A24 = PAD_ID(PA, 0),
MX1_PAD_TIN = PAD_ID(PA, 1),
MX1_PAD_PWMO = PAD_ID(PA, 2),
MX1_PAD_CSI_MCLK = PAD_ID(PA, 3),
MX1_PAD_CSI_D0 = PAD_ID(PA, 4),
MX1_PAD_CSI_D1 = PAD_ID(PA, 5),
MX1_PAD_CSI_D2 = PAD_ID(PA, 6),
MX1_PAD_CSI_D3 = PAD_ID(PA, 7),
MX1_PAD_CSI_D4 = PAD_ID(PA, 8),
MX1_PAD_CSI_D5 = PAD_ID(PA, 9),
MX1_PAD_CSI_D6 = PAD_ID(PA, 10),
MX1_PAD_CSI_D7 = PAD_ID(PA, 11),
MX1_PAD_CSI_VSYNC = PAD_ID(PA, 12),
MX1_PAD_CSI_HSYNC = PAD_ID(PA, 13),
MX1_PAD_CSI_PIXCLK = PAD_ID(PA, 14),
MX1_PAD_I2C_SDA = PAD_ID(PA, 15),
MX1_PAD_I2C_SCL = PAD_ID(PA, 16),
MX1_PAD_DTACK = PAD_ID(PA, 17),
MX1_PAD_BCLK = PAD_ID(PA, 18),
MX1_PAD_LBA = PAD_ID(PA, 19),
MX1_PAD_ECB = PAD_ID(PA, 20),
MX1_PAD_A0 = PAD_ID(PA, 21),
MX1_PAD_CS4 = PAD_ID(PA, 22),
MX1_PAD_CS5 = PAD_ID(PA, 23),
MX1_PAD_A16 = PAD_ID(PA, 24),
MX1_PAD_A17 = PAD_ID(PA, 25),
MX1_PAD_A18 = PAD_ID(PA, 26),
MX1_PAD_A19 = PAD_ID(PA, 27),
MX1_PAD_A20 = PAD_ID(PA, 28),
MX1_PAD_A21 = PAD_ID(PA, 29),
MX1_PAD_A22 = PAD_ID(PA, 30),
MX1_PAD_A23 = PAD_ID(PA, 31),
MX1_PAD_SD_DAT0 = PAD_ID(PB, 8),
MX1_PAD_SD_DAT1 = PAD_ID(PB, 9),
MX1_PAD_SD_DAT2 = PAD_ID(PB, 10),
MX1_PAD_SD_DAT3 = PAD_ID(PB, 11),
MX1_PAD_SD_SCLK = PAD_ID(PB, 12),
MX1_PAD_SD_CMD = PAD_ID(PB, 13),
MX1_PAD_SIM_SVEN = PAD_ID(PB, 14),
MX1_PAD_SIM_PD = PAD_ID(PB, 15),
MX1_PAD_SIM_TX = PAD_ID(PB, 16),
MX1_PAD_SIM_RX = PAD_ID(PB, 17),
MX1_PAD_SIM_RST = PAD_ID(PB, 18),
MX1_PAD_SIM_CLK = PAD_ID(PB, 19),
MX1_PAD_USBD_AFE = PAD_ID(PB, 20),
MX1_PAD_USBD_OE = PAD_ID(PB, 21),
MX1_PAD_USBD_RCV = PAD_ID(PB, 22),
MX1_PAD_USBD_SUSPND = PAD_ID(PB, 23),
MX1_PAD_USBD_VP = PAD_ID(PB, 24),
MX1_PAD_USBD_VM = PAD_ID(PB, 25),
MX1_PAD_USBD_VPO = PAD_ID(PB, 26),
MX1_PAD_USBD_VMO = PAD_ID(PB, 27),
MX1_PAD_UART2_CTS = PAD_ID(PB, 28),
MX1_PAD_UART2_RTS = PAD_ID(PB, 29),
MX1_PAD_UART2_TXD = PAD_ID(PB, 30),
MX1_PAD_UART2_RXD = PAD_ID(PB, 31),
MX1_PAD_SSI_RXFS = PAD_ID(PC, 3),
MX1_PAD_SSI_RXCLK = PAD_ID(PC, 4),
MX1_PAD_SSI_RXDAT = PAD_ID(PC, 5),
MX1_PAD_SSI_TXDAT = PAD_ID(PC, 6),
MX1_PAD_SSI_TXFS = PAD_ID(PC, 7),
MX1_PAD_SSI_TXCLK = PAD_ID(PC, 8),
MX1_PAD_UART1_CTS = PAD_ID(PC, 9),
MX1_PAD_UART1_RTS = PAD_ID(PC, 10),
MX1_PAD_UART1_TXD = PAD_ID(PC, 11),
MX1_PAD_UART1_RXD = PAD_ID(PC, 12),
MX1_PAD_SPI1_RDY = PAD_ID(PC, 13),
MX1_PAD_SPI1_SCLK = PAD_ID(PC, 14),
MX1_PAD_SPI1_SS = PAD_ID(PC, 15),
MX1_PAD_SPI1_MISO = PAD_ID(PC, 16),
MX1_PAD_SPI1_MOSI = PAD_ID(PC, 17),
MX1_PAD_BT13 = PAD_ID(PC, 19),
MX1_PAD_BT12 = PAD_ID(PC, 20),
MX1_PAD_BT11 = PAD_ID(PC, 21),
MX1_PAD_BT10 = PAD_ID(PC, 22),
MX1_PAD_BT9 = PAD_ID(PC, 23),
MX1_PAD_BT8 = PAD_ID(PC, 24),
MX1_PAD_BT7 = PAD_ID(PC, 25),
MX1_PAD_BT6 = PAD_ID(PC, 26),
MX1_PAD_BT5 = PAD_ID(PC, 27),
MX1_PAD_BT4 = PAD_ID(PC, 28),
MX1_PAD_BT3 = PAD_ID(PC, 29),
MX1_PAD_BT2 = PAD_ID(PC, 30),
MX1_PAD_BT1 = PAD_ID(PC, 31),
MX1_PAD_LSCLK = PAD_ID(PD, 6),
MX1_PAD_REV = PAD_ID(PD, 7),
MX1_PAD_CLS = PAD_ID(PD, 8),
MX1_PAD_PS = PAD_ID(PD, 9),
MX1_PAD_SPL_SPR = PAD_ID(PD, 10),
MX1_PAD_CONTRAST = PAD_ID(PD, 11),
MX1_PAD_ACD_OE = PAD_ID(PD, 12),
MX1_PAD_LP_HSYNC = PAD_ID(PD, 13),
MX1_PAD_FLM_VSYNC = PAD_ID(PD, 14),
MX1_PAD_LD0 = PAD_ID(PD, 15),
MX1_PAD_LD1 = PAD_ID(PD, 16),
MX1_PAD_LD2 = PAD_ID(PD, 17),
MX1_PAD_LD3 = PAD_ID(PD, 18),
MX1_PAD_LD4 = PAD_ID(PD, 19),
MX1_PAD_LD5 = PAD_ID(PD, 20),
MX1_PAD_LD6 = PAD_ID(PD, 21),
MX1_PAD_LD7 = PAD_ID(PD, 22),
MX1_PAD_LD8 = PAD_ID(PD, 23),
MX1_PAD_LD9 = PAD_ID(PD, 24),
MX1_PAD_LD10 = PAD_ID(PD, 25),
MX1_PAD_LD11 = PAD_ID(PD, 26),
MX1_PAD_LD12 = PAD_ID(PD, 27),
MX1_PAD_LD13 = PAD_ID(PD, 28),
MX1_PAD_LD14 = PAD_ID(PD, 29),
MX1_PAD_LD15 = PAD_ID(PD, 30),
MX1_PAD_TMR2OUT = PAD_ID(PD, 31),
};
/* Pad names for the pinmux subsystem */
static const struct pinctrl_pin_desc imx1_pinctrl_pads[] = {
IMX_PINCTRL_PIN(MX1_PAD_A24),
IMX_PINCTRL_PIN(MX1_PAD_TIN),
IMX_PINCTRL_PIN(MX1_PAD_PWMO),
IMX_PINCTRL_PIN(MX1_PAD_CSI_MCLK),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D0),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D1),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D2),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D3),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D4),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D5),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D6),
IMX_PINCTRL_PIN(MX1_PAD_CSI_D7),
IMX_PINCTRL_PIN(MX1_PAD_CSI_VSYNC),
IMX_PINCTRL_PIN(MX1_PAD_CSI_HSYNC),
IMX_PINCTRL_PIN(MX1_PAD_CSI_PIXCLK),
IMX_PINCTRL_PIN(MX1_PAD_I2C_SDA),
IMX_PINCTRL_PIN(MX1_PAD_I2C_SCL),
IMX_PINCTRL_PIN(MX1_PAD_DTACK),
IMX_PINCTRL_PIN(MX1_PAD_BCLK),
IMX_PINCTRL_PIN(MX1_PAD_LBA),
IMX_PINCTRL_PIN(MX1_PAD_ECB),
IMX_PINCTRL_PIN(MX1_PAD_A0),
IMX_PINCTRL_PIN(MX1_PAD_CS4),
IMX_PINCTRL_PIN(MX1_PAD_CS5),
IMX_PINCTRL_PIN(MX1_PAD_A16),
IMX_PINCTRL_PIN(MX1_PAD_A17),
IMX_PINCTRL_PIN(MX1_PAD_A18),
IMX_PINCTRL_PIN(MX1_PAD_A19),
IMX_PINCTRL_PIN(MX1_PAD_A20),
IMX_PINCTRL_PIN(MX1_PAD_A21),
IMX_PINCTRL_PIN(MX1_PAD_A22),
IMX_PINCTRL_PIN(MX1_PAD_A23),
IMX_PINCTRL_PIN(MX1_PAD_SD_DAT0),
IMX_PINCTRL_PIN(MX1_PAD_SD_DAT1),
IMX_PINCTRL_PIN(MX1_PAD_SD_DAT2),
IMX_PINCTRL_PIN(MX1_PAD_SD_DAT3),
IMX_PINCTRL_PIN(MX1_PAD_SD_SCLK),
IMX_PINCTRL_PIN(MX1_PAD_SD_CMD),
IMX_PINCTRL_PIN(MX1_PAD_SIM_SVEN),
IMX_PINCTRL_PIN(MX1_PAD_SIM_PD),
IMX_PINCTRL_PIN(MX1_PAD_SIM_TX),
IMX_PINCTRL_PIN(MX1_PAD_SIM_RX),
IMX_PINCTRL_PIN(MX1_PAD_SIM_CLK),
IMX_PINCTRL_PIN(MX1_PAD_USBD_AFE),
IMX_PINCTRL_PIN(MX1_PAD_USBD_OE),
IMX_PINCTRL_PIN(MX1_PAD_USBD_RCV),
IMX_PINCTRL_PIN(MX1_PAD_USBD_SUSPND),
IMX_PINCTRL_PIN(MX1_PAD_USBD_VP),
IMX_PINCTRL_PIN(MX1_PAD_USBD_VM),
IMX_PINCTRL_PIN(MX1_PAD_USBD_VPO),
IMX_PINCTRL_PIN(MX1_PAD_USBD_VMO),
IMX_PINCTRL_PIN(MX1_PAD_UART2_CTS),
IMX_PINCTRL_PIN(MX1_PAD_UART2_RTS),
IMX_PINCTRL_PIN(MX1_PAD_UART2_TXD),
IMX_PINCTRL_PIN(MX1_PAD_UART2_RXD),
IMX_PINCTRL_PIN(MX1_PAD_SSI_RXFS),
IMX_PINCTRL_PIN(MX1_PAD_SSI_RXCLK),
IMX_PINCTRL_PIN(MX1_PAD_SSI_RXDAT),
IMX_PINCTRL_PIN(MX1_PAD_SSI_TXDAT),
IMX_PINCTRL_PIN(MX1_PAD_SSI_TXFS),
IMX_PINCTRL_PIN(MX1_PAD_SSI_TXCLK),
IMX_PINCTRL_PIN(MX1_PAD_UART1_CTS),
IMX_PINCTRL_PIN(MX1_PAD_UART1_RTS),
IMX_PINCTRL_PIN(MX1_PAD_UART1_TXD),
IMX_PINCTRL_PIN(MX1_PAD_UART1_RXD),
IMX_PINCTRL_PIN(MX1_PAD_SPI1_RDY),
IMX_PINCTRL_PIN(MX1_PAD_SPI1_SCLK),
IMX_PINCTRL_PIN(MX1_PAD_SPI1_SS),
IMX_PINCTRL_PIN(MX1_PAD_SPI1_MISO),
IMX_PINCTRL_PIN(MX1_PAD_SPI1_MOSI),
IMX_PINCTRL_PIN(MX1_PAD_BT13),
IMX_PINCTRL_PIN(MX1_PAD_BT12),
IMX_PINCTRL_PIN(MX1_PAD_BT11),
IMX_PINCTRL_PIN(MX1_PAD_BT10),
IMX_PINCTRL_PIN(MX1_PAD_BT9),
IMX_PINCTRL_PIN(MX1_PAD_BT8),
IMX_PINCTRL_PIN(MX1_PAD_BT7),
IMX_PINCTRL_PIN(MX1_PAD_BT6),
IMX_PINCTRL_PIN(MX1_PAD_BT5),
IMX_PINCTRL_PIN(MX1_PAD_BT4),
IMX_PINCTRL_PIN(MX1_PAD_BT3),
IMX_PINCTRL_PIN(MX1_PAD_BT2),
IMX_PINCTRL_PIN(MX1_PAD_BT1),
IMX_PINCTRL_PIN(MX1_PAD_LSCLK),
IMX_PINCTRL_PIN(MX1_PAD_REV),
IMX_PINCTRL_PIN(MX1_PAD_CLS),
IMX_PINCTRL_PIN(MX1_PAD_PS),
IMX_PINCTRL_PIN(MX1_PAD_SPL_SPR),
IMX_PINCTRL_PIN(MX1_PAD_CONTRAST),
IMX_PINCTRL_PIN(MX1_PAD_ACD_OE),
IMX_PINCTRL_PIN(MX1_PAD_LP_HSYNC),
IMX_PINCTRL_PIN(MX1_PAD_FLM_VSYNC),
IMX_PINCTRL_PIN(MX1_PAD_LD0),
IMX_PINCTRL_PIN(MX1_PAD_LD1),
IMX_PINCTRL_PIN(MX1_PAD_LD2),
IMX_PINCTRL_PIN(MX1_PAD_LD3),
IMX_PINCTRL_PIN(MX1_PAD_LD4),
IMX_PINCTRL_PIN(MX1_PAD_LD5),
IMX_PINCTRL_PIN(MX1_PAD_LD6),
IMX_PINCTRL_PIN(MX1_PAD_LD7),
IMX_PINCTRL_PIN(MX1_PAD_LD8),
IMX_PINCTRL_PIN(MX1_PAD_LD9),
IMX_PINCTRL_PIN(MX1_PAD_LD10),
IMX_PINCTRL_PIN(MX1_PAD_LD11),
IMX_PINCTRL_PIN(MX1_PAD_LD12),
IMX_PINCTRL_PIN(MX1_PAD_LD13),
IMX_PINCTRL_PIN(MX1_PAD_LD14),
IMX_PINCTRL_PIN(MX1_PAD_LD15),
IMX_PINCTRL_PIN(MX1_PAD_TMR2OUT),
};
static struct imx1_pinctrl_soc_info imx1_pinctrl_info = {
.pins = imx1_pinctrl_pads,
.npins = ARRAY_SIZE(imx1_pinctrl_pads),
};
static int __init imx1_pinctrl_probe(struct platform_device *pdev)
{
return imx1_pinctrl_core_probe(pdev, &imx1_pinctrl_info);
}
static const struct of_device_id imx1_pinctrl_of_match[] = {
{ .compatible = "fsl,imx1-iomuxc", },
{ }
};
MODULE_DEVICE_TABLE(of, imx1_pinctrl_of_match);
static struct platform_driver imx1_pinctrl_driver = {
.driver = {
.name = "imx1-pinctrl",
.owner = THIS_MODULE,
.of_match_table = imx1_pinctrl_of_match,
},
.remove = imx1_pinctrl_core_remove,
};
module_platform_driver_probe(imx1_pinctrl_driver, imx1_pinctrl_probe);
MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
MODULE_DESCRIPTION("Freescale i.MX1 pinctrl driver");
MODULE_LICENSE("GPL");
...@@ -63,10 +63,6 @@ enum imx27_pads { ...@@ -63,10 +63,6 @@ enum imx27_pads {
MX27_PAD_CONTRAST = PAD_ID(PA, 30), MX27_PAD_CONTRAST = PAD_ID(PA, 30),
MX27_PAD_OE_ACD = PAD_ID(PA, 31), MX27_PAD_OE_ACD = PAD_ID(PA, 31),
MX27_PAD_UNUSED0 = PAD_ID(PB, 0),
MX27_PAD_UNUSED1 = PAD_ID(PB, 1),
MX27_PAD_UNUSED2 = PAD_ID(PB, 2),
MX27_PAD_UNUSED3 = PAD_ID(PB, 3),
MX27_PAD_SD2_D0 = PAD_ID(PB, 4), MX27_PAD_SD2_D0 = PAD_ID(PB, 4),
MX27_PAD_SD2_D1 = PAD_ID(PB, 5), MX27_PAD_SD2_D1 = PAD_ID(PB, 5),
MX27_PAD_SD2_D2 = PAD_ID(PB, 6), MX27_PAD_SD2_D2 = PAD_ID(PB, 6),
...@@ -96,11 +92,6 @@ enum imx27_pads { ...@@ -96,11 +92,6 @@ enum imx27_pads {
MX27_PAD_USBH1_RXDM = PAD_ID(PB, 30), MX27_PAD_USBH1_RXDM = PAD_ID(PB, 30),
MX27_PAD_USBH1_RXDP = PAD_ID(PB, 31), MX27_PAD_USBH1_RXDP = PAD_ID(PB, 31),
MX27_PAD_UNUSED4 = PAD_ID(PC, 0),
MX27_PAD_UNUSED5 = PAD_ID(PC, 1),
MX27_PAD_UNUSED6 = PAD_ID(PC, 2),
MX27_PAD_UNUSED7 = PAD_ID(PC, 3),
MX27_PAD_UNUSED8 = PAD_ID(PC, 4),
MX27_PAD_I2C2_SDA = PAD_ID(PC, 5), MX27_PAD_I2C2_SDA = PAD_ID(PC, 5),
MX27_PAD_I2C2_SCL = PAD_ID(PC, 6), MX27_PAD_I2C2_SCL = PAD_ID(PC, 6),
MX27_PAD_USBOTG_DATA5 = PAD_ID(PC, 7), MX27_PAD_USBOTG_DATA5 = PAD_ID(PC, 7),
...@@ -188,12 +179,6 @@ enum imx27_pads { ...@@ -188,12 +179,6 @@ enum imx27_pads {
MX27_PAD_SD1_CLK = PAD_ID(PE, 23), MX27_PAD_SD1_CLK = PAD_ID(PE, 23),
MX27_PAD_USBOTG_CLK = PAD_ID(PE, 24), MX27_PAD_USBOTG_CLK = PAD_ID(PE, 24),
MX27_PAD_USBOTG_DATA7 = PAD_ID(PE, 25), MX27_PAD_USBOTG_DATA7 = PAD_ID(PE, 25),
MX27_PAD_UNUSED9 = PAD_ID(PE, 26),
MX27_PAD_UNUSED10 = PAD_ID(PE, 27),
MX27_PAD_UNUSED11 = PAD_ID(PE, 28),
MX27_PAD_UNUSED12 = PAD_ID(PE, 29),
MX27_PAD_UNUSED13 = PAD_ID(PE, 30),
MX27_PAD_UNUSED14 = PAD_ID(PE, 31),
MX27_PAD_NFRB = PAD_ID(PF, 0), MX27_PAD_NFRB = PAD_ID(PF, 0),
MX27_PAD_NFCLE = PAD_ID(PF, 1), MX27_PAD_NFCLE = PAD_ID(PF, 1),
...@@ -219,14 +204,6 @@ enum imx27_pads { ...@@ -219,14 +204,6 @@ enum imx27_pads {
MX27_PAD_CS4_B = PAD_ID(PF, 21), MX27_PAD_CS4_B = PAD_ID(PF, 21),
MX27_PAD_CS5_B = PAD_ID(PF, 22), MX27_PAD_CS5_B = PAD_ID(PF, 22),
MX27_PAD_ATA_DATA15 = PAD_ID(PF, 23), MX27_PAD_ATA_DATA15 = PAD_ID(PF, 23),
MX27_PAD_UNUSED15 = PAD_ID(PF, 24),
MX27_PAD_UNUSED16 = PAD_ID(PF, 25),
MX27_PAD_UNUSED17 = PAD_ID(PF, 26),
MX27_PAD_UNUSED18 = PAD_ID(PF, 27),
MX27_PAD_UNUSED19 = PAD_ID(PF, 28),
MX27_PAD_UNUSED20 = PAD_ID(PF, 29),
MX27_PAD_UNUSED21 = PAD_ID(PF, 30),
MX27_PAD_UNUSED22 = PAD_ID(PF, 31),
}; };
/* Pad names for the pinmux subsystem */ /* Pad names for the pinmux subsystem */
...@@ -264,10 +241,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = { ...@@ -264,10 +241,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = {
IMX_PINCTRL_PIN(MX27_PAD_CONTRAST), IMX_PINCTRL_PIN(MX27_PAD_CONTRAST),
IMX_PINCTRL_PIN(MX27_PAD_OE_ACD), IMX_PINCTRL_PIN(MX27_PAD_OE_ACD),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED0),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED1),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED2),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED3),
IMX_PINCTRL_PIN(MX27_PAD_SD2_D0), IMX_PINCTRL_PIN(MX27_PAD_SD2_D0),
IMX_PINCTRL_PIN(MX27_PAD_SD2_D1), IMX_PINCTRL_PIN(MX27_PAD_SD2_D1),
IMX_PINCTRL_PIN(MX27_PAD_SD2_D2), IMX_PINCTRL_PIN(MX27_PAD_SD2_D2),
...@@ -297,11 +270,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = { ...@@ -297,11 +270,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = {
IMX_PINCTRL_PIN(MX27_PAD_USBH1_RXDM), IMX_PINCTRL_PIN(MX27_PAD_USBH1_RXDM),
IMX_PINCTRL_PIN(MX27_PAD_USBH1_RXDP), IMX_PINCTRL_PIN(MX27_PAD_USBH1_RXDP),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED4),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED5),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED6),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED7),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED8),
IMX_PINCTRL_PIN(MX27_PAD_I2C2_SDA), IMX_PINCTRL_PIN(MX27_PAD_I2C2_SDA),
IMX_PINCTRL_PIN(MX27_PAD_I2C2_SCL), IMX_PINCTRL_PIN(MX27_PAD_I2C2_SCL),
IMX_PINCTRL_PIN(MX27_PAD_USBOTG_DATA5), IMX_PINCTRL_PIN(MX27_PAD_USBOTG_DATA5),
...@@ -389,12 +357,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = { ...@@ -389,12 +357,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = {
IMX_PINCTRL_PIN(MX27_PAD_SD1_CLK), IMX_PINCTRL_PIN(MX27_PAD_SD1_CLK),
IMX_PINCTRL_PIN(MX27_PAD_USBOTG_CLK), IMX_PINCTRL_PIN(MX27_PAD_USBOTG_CLK),
IMX_PINCTRL_PIN(MX27_PAD_USBOTG_DATA7), IMX_PINCTRL_PIN(MX27_PAD_USBOTG_DATA7),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED9),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED10),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED11),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED12),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED13),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED14),
IMX_PINCTRL_PIN(MX27_PAD_NFRB), IMX_PINCTRL_PIN(MX27_PAD_NFRB),
IMX_PINCTRL_PIN(MX27_PAD_NFCLE), IMX_PINCTRL_PIN(MX27_PAD_NFCLE),
...@@ -420,14 +382,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = { ...@@ -420,14 +382,6 @@ static const struct pinctrl_pin_desc imx27_pinctrl_pads[] = {
IMX_PINCTRL_PIN(MX27_PAD_CS4_B), IMX_PINCTRL_PIN(MX27_PAD_CS4_B),
IMX_PINCTRL_PIN(MX27_PAD_CS5_B), IMX_PINCTRL_PIN(MX27_PAD_CS5_B),
IMX_PINCTRL_PIN(MX27_PAD_ATA_DATA15), IMX_PINCTRL_PIN(MX27_PAD_ATA_DATA15),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED15),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED16),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED17),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED18),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED19),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED20),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED21),
IMX_PINCTRL_PIN(MX27_PAD_UNUSED22),
}; };
static struct imx1_pinctrl_soc_info imx27_pinctrl_info = { static struct imx1_pinctrl_soc_info imx27_pinctrl_info = {
...@@ -440,12 +394,6 @@ static struct of_device_id imx27_pinctrl_of_match[] = { ...@@ -440,12 +394,6 @@ static struct of_device_id imx27_pinctrl_of_match[] = {
{ /* sentinel */ } { /* sentinel */ }
}; };
struct imx27_pinctrl_private {
int num_gpio_childs;
struct platform_device **gpio_dev;
struct mxc_gpio_platform_data *gpio_pdata;
};
static int imx27_pinctrl_probe(struct platform_device *pdev) static int imx27_pinctrl_probe(struct platform_device *pdev)
{ {
return imx1_pinctrl_core_probe(pdev, &imx27_pinctrl_info); return imx1_pinctrl_core_probe(pdev, &imx27_pinctrl_info);
......
...@@ -62,11 +62,26 @@ enum rockchip_pinctrl_type { ...@@ -62,11 +62,26 @@ enum rockchip_pinctrl_type {
RK2928, RK2928,
RK3066B, RK3066B,
RK3188, RK3188,
RK3288,
}; };
enum rockchip_pin_bank_type { /**
COMMON_BANK, * Encode variants of iomux registers into a type variable
RK3188_BANK0, */
#define IOMUX_GPIO_ONLY BIT(0)
#define IOMUX_WIDTH_4BIT BIT(1)
#define IOMUX_SOURCE_PMU BIT(2)
#define IOMUX_UNROUTED BIT(3)
/**
* @type: iomux variant using IOMUX_* constants
* @offset: if initialized to -1 it will be autocalculated, by specifying
* an initial offset value the relevant source offset can be reset
* to a new value for autocalculating the following iomux registers.
*/
struct rockchip_iomux {
int type;
int offset;
}; };
/** /**
...@@ -78,6 +93,7 @@ enum rockchip_pin_bank_type { ...@@ -78,6 +93,7 @@ enum rockchip_pin_bank_type {
* @nr_pins: number of pins in this bank * @nr_pins: number of pins in this bank
* @name: name of the bank * @name: name of the bank
* @bank_num: number of the bank, to account for holes * @bank_num: number of the bank, to account for holes
* @iomux: array describing the 4 iomux sources of the bank
* @valid: are all necessary informations present * @valid: are all necessary informations present
* @of_node: dt node of this bank * @of_node: dt node of this bank
* @drvdata: common pinctrl basedata * @drvdata: common pinctrl basedata
...@@ -95,7 +111,7 @@ struct rockchip_pin_bank { ...@@ -95,7 +111,7 @@ struct rockchip_pin_bank {
u8 nr_pins; u8 nr_pins;
char *name; char *name;
u8 bank_num; u8 bank_num;
enum rockchip_pin_bank_type bank_type; struct rockchip_iomux iomux[4];
bool valid; bool valid;
struct device_node *of_node; struct device_node *of_node;
struct rockchip_pinctrl *drvdata; struct rockchip_pinctrl *drvdata;
...@@ -111,6 +127,25 @@ struct rockchip_pin_bank { ...@@ -111,6 +127,25 @@ struct rockchip_pin_bank {
.bank_num = id, \ .bank_num = id, \
.nr_pins = pins, \ .nr_pins = pins, \
.name = label, \ .name = label, \
.iomux = { \
{ .offset = -1 }, \
{ .offset = -1 }, \
{ .offset = -1 }, \
{ .offset = -1 }, \
}, \
}
#define PIN_BANK_IOMUX_FLAGS(id, pins, label, iom0, iom1, iom2, iom3) \
{ \
.bank_num = id, \
.nr_pins = pins, \
.name = label, \
.iomux = { \
{ .type = iom0, .offset = -1 }, \
{ .type = iom1, .offset = -1 }, \
{ .type = iom2, .offset = -1 }, \
{ .type = iom3, .offset = -1 }, \
}, \
} }
/** /**
...@@ -121,7 +156,8 @@ struct rockchip_pin_ctrl { ...@@ -121,7 +156,8 @@ struct rockchip_pin_ctrl {
u32 nr_pins; u32 nr_pins;
char *label; char *label;
enum rockchip_pinctrl_type type; enum rockchip_pinctrl_type type;
int mux_offset; int grf_mux_offset;
int pmu_mux_offset;
void (*pull_calc_reg)(struct rockchip_pin_bank *bank, void (*pull_calc_reg)(struct rockchip_pin_bank *bank,
int pin_num, struct regmap **regmap, int pin_num, struct regmap **regmap,
int *reg, u8 *bit); int *reg, u8 *bit);
...@@ -343,24 +379,42 @@ static const struct pinctrl_ops rockchip_pctrl_ops = { ...@@ -343,24 +379,42 @@ static const struct pinctrl_ops rockchip_pctrl_ops = {
static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin) static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
int iomux_num = (pin / 8);
struct regmap *regmap;
unsigned int val; unsigned int val;
int reg, ret; int reg, ret, mask;
u8 bit; u8 bit;
if (bank->bank_type == RK3188_BANK0 && pin < 16) if (iomux_num > 3)
return -EINVAL;
if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) {
dev_err(info->dev, "pin %d is unrouted\n", pin);
return -EINVAL;
}
if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY)
return RK_FUNC_GPIO; return RK_FUNC_GPIO;
regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
? info->regmap_pmu : info->regmap_base;
/* get basic quadrupel of mux registers and the correct reg inside */ /* get basic quadrupel of mux registers and the correct reg inside */
reg = info->ctrl->mux_offset; mask = (bank->iomux[iomux_num].type & IOMUX_WIDTH_4BIT) ? 0xf : 0x3;
reg += bank->bank_num * 0x10; reg = bank->iomux[iomux_num].offset;
reg += (pin / 8) * 4; if (bank->iomux[iomux_num].type & IOMUX_WIDTH_4BIT) {
if ((pin % 8) >= 4)
reg += 0x4;
bit = (pin % 4) * 4;
} else {
bit = (pin % 8) * 2; bit = (pin % 8) * 2;
}
ret = regmap_read(info->regmap_base, reg, &val); ret = regmap_read(regmap, reg, &val);
if (ret) if (ret)
return ret; return ret;
return ((val >> bit) & 3); return ((val >> bit) & mask);
} }
/* /*
...@@ -379,16 +433,22 @@ static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin) ...@@ -379,16 +433,22 @@ static int rockchip_get_mux(struct rockchip_pin_bank *bank, int pin)
static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
int reg, ret; int iomux_num = (pin / 8);
struct regmap *regmap;
int reg, ret, mask;
unsigned long flags; unsigned long flags;
u8 bit; u8 bit;
u32 data; u32 data;
/* if (iomux_num > 3)
* The first 16 pins of rk3188_bank0 are always gpios and do not have return -EINVAL;
* a mux register at all.
*/ if (bank->iomux[iomux_num].type & IOMUX_UNROUTED) {
if (bank->bank_type == RK3188_BANK0 && pin < 16) { dev_err(info->dev, "pin %d is unrouted\n", pin);
return -EINVAL;
}
if (bank->iomux[iomux_num].type & IOMUX_GPIO_ONLY) {
if (mux != RK_FUNC_GPIO) { if (mux != RK_FUNC_GPIO) {
dev_err(info->dev, dev_err(info->dev,
"pin %d only supports a gpio mux\n", pin); "pin %d only supports a gpio mux\n", pin);
...@@ -401,17 +461,25 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) ...@@ -401,17 +461,25 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n", dev_dbg(info->dev, "setting mux of GPIO%d-%d to %d\n",
bank->bank_num, pin, mux); bank->bank_num, pin, mux);
regmap = (bank->iomux[iomux_num].type & IOMUX_SOURCE_PMU)
? info->regmap_pmu : info->regmap_base;
/* get basic quadrupel of mux registers and the correct reg inside */ /* get basic quadrupel of mux registers and the correct reg inside */
reg = info->ctrl->mux_offset; mask = (bank->iomux[iomux_num].type & IOMUX_WIDTH_4BIT) ? 0xf : 0x3;
reg += bank->bank_num * 0x10; reg = bank->iomux[iomux_num].offset;
reg += (pin / 8) * 4; if (bank->iomux[iomux_num].type & IOMUX_WIDTH_4BIT) {
if ((pin % 8) >= 4)
reg += 0x4;
bit = (pin % 4) * 4;
} else {
bit = (pin % 8) * 2; bit = (pin % 8) * 2;
}
spin_lock_irqsave(&bank->slock, flags); spin_lock_irqsave(&bank->slock, flags);
data = (3 << (bit + 16)); data = (mask << (bit + 16));
data |= (mux & 3) << bit; data |= (mux & mask) << bit;
ret = regmap_write(info->regmap_base, reg, data); ret = regmap_write(regmap, reg, data);
spin_unlock_irqrestore(&bank->slock, flags); spin_unlock_irqrestore(&bank->slock, flags);
...@@ -449,7 +517,7 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, ...@@ -449,7 +517,7 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
/* The first 12 pins of the first bank are located elsewhere */ /* The first 12 pins of the first bank are located elsewhere */
if (bank->bank_type == RK3188_BANK0 && pin_num < 12) { if (bank->bank_num == 0 && pin_num < 12) {
*regmap = info->regmap_pmu ? info->regmap_pmu *regmap = info->regmap_pmu ? info->regmap_pmu
: bank->regmap_pull; : bank->regmap_pull;
*reg = info->regmap_pmu ? RK3188_PULL_PMU_OFFSET : 0; *reg = info->regmap_pmu ? RK3188_PULL_PMU_OFFSET : 0;
...@@ -476,6 +544,127 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank, ...@@ -476,6 +544,127 @@ static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
} }
} }
#define RK3288_PULL_OFFSET 0x140
static void rk3288_calc_pull_reg_and_bit(struct rockchip_pin_bank *bank,
int pin_num, struct regmap **regmap,
int *reg, u8 *bit)
{
struct rockchip_pinctrl *info = bank->drvdata;
/* The first 24 pins of the first bank are located in PMU */
if (bank->bank_num == 0) {
*regmap = info->regmap_pmu;
*reg = RK3188_PULL_PMU_OFFSET;
*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
*bit = pin_num % RK3188_PULL_PINS_PER_REG;
*bit *= RK3188_PULL_BITS_PER_PIN;
} else {
*regmap = info->regmap_base;
*reg = RK3288_PULL_OFFSET;
/* correct the offset, as we're starting with the 2nd bank */
*reg -= 0x10;
*reg += bank->bank_num * RK3188_PULL_BANK_STRIDE;
*reg += ((pin_num / RK3188_PULL_PINS_PER_REG) * 4);
*bit = (pin_num % RK3188_PULL_PINS_PER_REG);
*bit *= RK3188_PULL_BITS_PER_PIN;
}
}
#define RK3288_DRV_PMU_OFFSET 0x70
#define RK3288_DRV_GRF_OFFSET 0x1c0
#define RK3288_DRV_BITS_PER_PIN 2
#define RK3288_DRV_PINS_PER_REG 8
#define RK3288_DRV_BANK_STRIDE 16
static int rk3288_drv_list[] = { 2, 4, 8, 12 };
static void rk3288_calc_drv_reg_and_bit(struct rockchip_pin_bank *bank,
int pin_num, struct regmap **regmap,
int *reg, u8 *bit)
{
struct rockchip_pinctrl *info = bank->drvdata;
/* The first 24 pins of the first bank are located in PMU */
if (bank->bank_num == 0) {
*regmap = info->regmap_pmu;
*reg = RK3288_DRV_PMU_OFFSET;
*reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4);
*bit = pin_num % RK3288_DRV_PINS_PER_REG;
*bit *= RK3288_DRV_BITS_PER_PIN;
} else {
*regmap = info->regmap_base;
*reg = RK3288_DRV_GRF_OFFSET;
/* correct the offset, as we're starting with the 2nd bank */
*reg -= 0x10;
*reg += bank->bank_num * RK3288_DRV_BANK_STRIDE;
*reg += ((pin_num / RK3288_DRV_PINS_PER_REG) * 4);
*bit = (pin_num % RK3288_DRV_PINS_PER_REG);
*bit *= RK3288_DRV_BITS_PER_PIN;
}
}
static int rk3288_get_drive(struct rockchip_pin_bank *bank, int pin_num)
{
struct regmap *regmap;
int reg, ret;
u32 data;
u8 bit;
rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
ret = regmap_read(regmap, reg, &data);
if (ret)
return ret;
data >>= bit;
data &= (1 << RK3288_DRV_BITS_PER_PIN) - 1;
return rk3288_drv_list[data];
}
static int rk3288_set_drive(struct rockchip_pin_bank *bank, int pin_num,
int strength)
{
struct rockchip_pinctrl *info = bank->drvdata;
struct regmap *regmap;
unsigned long flags;
int reg, ret, i;
u32 data;
u8 bit;
rk3288_calc_drv_reg_and_bit(bank, pin_num, &regmap, &reg, &bit);
ret = -EINVAL;
for (i = 0; i < ARRAY_SIZE(rk3288_drv_list); i++) {
if (rk3288_drv_list[i] == strength) {
ret = i;
break;
}
}
if (ret < 0) {
dev_err(info->dev, "unsupported driver strength %d\n",
strength);
return ret;
}
spin_lock_irqsave(&bank->slock, flags);
/* enable the write to the equivalent lower bits */
data = ((1 << RK3288_DRV_BITS_PER_PIN) - 1) << (bit + 16);
data |= (ret << bit);
ret = regmap_write(regmap, reg, data);
spin_unlock_irqrestore(&bank->slock, flags);
return ret;
}
static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
{ {
struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pinctrl *info = bank->drvdata;
...@@ -501,6 +690,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) ...@@ -501,6 +690,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num)
? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
: PIN_CONFIG_BIAS_DISABLE; : PIN_CONFIG_BIAS_DISABLE;
case RK3188: case RK3188:
case RK3288:
data >>= bit; data >>= bit;
data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1; data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1;
...@@ -555,6 +745,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, ...@@ -555,6 +745,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
spin_unlock_irqrestore(&bank->slock, flags); spin_unlock_irqrestore(&bank->slock, flags);
break; break;
case RK3188: case RK3188:
case RK3288:
spin_lock_irqsave(&bank->slock, flags); spin_lock_irqsave(&bank->slock, flags);
/* enable the write to the equivalent lower bits */ /* enable the write to the equivalent lower bits */
...@@ -657,23 +848,6 @@ static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -657,23 +848,6 @@ static int rockchip_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static void rockchip_pmx_disable(struct pinctrl_dev *pctldev,
unsigned selector, unsigned group)
{
struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
const unsigned int *pins = info->groups[group].pins;
struct rockchip_pin_bank *bank;
int cnt;
dev_dbg(info->dev, "disable function %s group %s\n",
info->functions[selector].name, info->groups[group].name);
for (cnt = 0; cnt < info->groups[group].npins; cnt++) {
bank = pin_to_bank(info, pins[cnt]);
rockchip_set_mux(bank, pins[cnt] - bank->pin_base, 0);
}
}
/* /*
* The calls to gpio_direction_output() and gpio_direction_input() * The calls to gpio_direction_output() and gpio_direction_input()
* leads to this function call (via the pinctrl_gpio_direction_{input|output}() * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
...@@ -716,7 +890,6 @@ static const struct pinmux_ops rockchip_pmx_ops = { ...@@ -716,7 +890,6 @@ static const struct pinmux_ops rockchip_pmx_ops = {
.get_function_name = rockchip_pmx_get_func_name, .get_function_name = rockchip_pmx_get_func_name,
.get_function_groups = rockchip_pmx_get_groups, .get_function_groups = rockchip_pmx_get_groups,
.enable = rockchip_pmx_enable, .enable = rockchip_pmx_enable,
.disable = rockchip_pmx_disable,
.gpio_set_direction = rockchip_pmx_gpio_set_direction, .gpio_set_direction = rockchip_pmx_gpio_set_direction,
}; };
...@@ -734,6 +907,7 @@ static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl, ...@@ -734,6 +907,7 @@ static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl,
case RK3066B: case RK3066B:
return pull ? false : true; return pull ? false : true;
case RK3188: case RK3188:
case RK3288:
return (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT); return (pull != PIN_CONFIG_BIAS_PULL_PIN_DEFAULT);
} }
...@@ -788,6 +962,15 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -788,6 +962,15 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin,
if (rc) if (rc)
return rc; return rc;
break; break;
case PIN_CONFIG_DRIVE_STRENGTH:
/* rk3288 is the first with per-pin drive-strength */
if (info->ctrl->type != RK3288)
return -ENOTSUPP;
rc = rk3288_set_drive(bank, pin - bank->pin_base, arg);
if (rc < 0)
return rc;
break;
default: default:
return -ENOTSUPP; return -ENOTSUPP;
break; break;
...@@ -837,6 +1020,17 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -837,6 +1020,17 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
arg = rc ? 1 : 0; arg = rc ? 1 : 0;
break; break;
case PIN_CONFIG_DRIVE_STRENGTH:
/* rk3288 is the first with per-pin drive-strength */
if (info->ctrl->type != RK3288)
return -ENOTSUPP;
rc = rk3288_get_drive(bank, pin - bank->pin_base);
if (rc < 0)
return rc;
arg = rc;
break;
default: default:
return -ENOTSUPP; return -ENOTSUPP;
break; break;
...@@ -850,6 +1044,7 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -850,6 +1044,7 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
static const struct pinconf_ops rockchip_pinconf_ops = { static const struct pinconf_ops rockchip_pinconf_ops = {
.pin_config_get = rockchip_pinconf_get, .pin_config_get = rockchip_pinconf_get,
.pin_config_set = rockchip_pinconf_set, .pin_config_set = rockchip_pinconf_set,
.is_generic = true,
}; };
static const struct of_device_id rockchip_bank_match[] = { static const struct of_device_id rockchip_bank_match[] = {
...@@ -1414,10 +1609,7 @@ static int rockchip_gpiolib_register(struct platform_device *pdev, ...@@ -1414,10 +1609,7 @@ static int rockchip_gpiolib_register(struct platform_device *pdev,
for (--i, --bank; i >= 0; --i, --bank) { for (--i, --bank; i >= 0; --i, --bank) {
if (!bank->valid) if (!bank->valid)
continue; continue;
gpiochip_remove(&bank->gpio_chip);
if (gpiochip_remove(&bank->gpio_chip))
dev_err(&pdev->dev, "gpio chip %s remove failed\n",
bank->gpio_chip.label);
} }
return ret; return ret;
} }
...@@ -1427,20 +1619,15 @@ static int rockchip_gpiolib_unregister(struct platform_device *pdev, ...@@ -1427,20 +1619,15 @@ static int rockchip_gpiolib_unregister(struct platform_device *pdev,
{ {
struct rockchip_pin_ctrl *ctrl = info->ctrl; struct rockchip_pin_ctrl *ctrl = info->ctrl;
struct rockchip_pin_bank *bank = ctrl->pin_banks; struct rockchip_pin_bank *bank = ctrl->pin_banks;
int ret = 0;
int i; int i;
for (i = 0; !ret && i < ctrl->nr_banks; ++i, ++bank) { for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
if (!bank->valid) if (!bank->valid)
continue; continue;
gpiochip_remove(&bank->gpio_chip);
ret = gpiochip_remove(&bank->gpio_chip);
} }
if (ret) return 0;
dev_err(&pdev->dev, "gpio chip remove failed\n");
return ret;
} }
static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
...@@ -1466,8 +1653,6 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, ...@@ -1466,8 +1653,6 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
"rockchip,rk3188-gpio-bank0")) { "rockchip,rk3188-gpio-bank0")) {
struct device_node *node; struct device_node *node;
bank->bank_type = RK3188_BANK0;
node = of_parse_phandle(bank->of_node->parent, node = of_parse_phandle(bank->of_node->parent,
"rockchip,pmu", 0); "rockchip,pmu", 0);
if (!node) { if (!node) {
...@@ -1487,9 +1672,6 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank, ...@@ -1487,9 +1672,6 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
base, base,
&rockchip_regmap_config); &rockchip_regmap_config);
} }
} else {
bank->bank_type = COMMON_BANK;
} }
bank->irq = irq_of_parse_and_map(bank->of_node, 0); bank->irq = irq_of_parse_and_map(bank->of_node, 0);
...@@ -1513,7 +1695,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( ...@@ -1513,7 +1695,7 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
struct device_node *np; struct device_node *np;
struct rockchip_pin_ctrl *ctrl; struct rockchip_pin_ctrl *ctrl;
struct rockchip_pin_bank *bank; struct rockchip_pin_bank *bank;
int i; int grf_offs, pmu_offs, i, j;
match = of_match_node(rockchip_pinctrl_dt_match, node); match = of_match_node(rockchip_pinctrl_dt_match, node);
ctrl = (struct rockchip_pin_ctrl *)match->data; ctrl = (struct rockchip_pin_ctrl *)match->data;
...@@ -1535,12 +1717,51 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data( ...@@ -1535,12 +1717,51 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
} }
} }
grf_offs = ctrl->grf_mux_offset;
pmu_offs = ctrl->pmu_mux_offset;
bank = ctrl->pin_banks; bank = ctrl->pin_banks;
for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
int bank_pins = 0;
spin_lock_init(&bank->slock); spin_lock_init(&bank->slock);
bank->drvdata = d; bank->drvdata = d;
bank->pin_base = ctrl->nr_pins; bank->pin_base = ctrl->nr_pins;
ctrl->nr_pins += bank->nr_pins; ctrl->nr_pins += bank->nr_pins;
/* calculate iomux offsets */
for (j = 0; j < 4; j++) {
struct rockchip_iomux *iom = &bank->iomux[j];
int inc;
if (bank_pins >= bank->nr_pins)
break;
/* preset offset value, set new start value */
if (iom->offset >= 0) {
if (iom->type & IOMUX_SOURCE_PMU)
pmu_offs = iom->offset;
else
grf_offs = iom->offset;
} else { /* set current offset */
iom->offset = (iom->type & IOMUX_SOURCE_PMU) ?
pmu_offs : grf_offs;
}
dev_dbg(d->dev, "bank %d, iomux %d has offset 0x%x\n",
i, j, iom->offset);
/*
* Increase offset according to iomux width.
* 4bit iomux'es are spread over two registers.
*/
inc = (iom->type & IOMUX_WIDTH_4BIT) ? 8 : 4;
if (iom->type & IOMUX_SOURCE_PMU)
pmu_offs += inc;
else
grf_offs += inc;
bank_pins += 8;
}
} }
return ctrl; return ctrl;
...@@ -1644,7 +1865,7 @@ static struct rockchip_pin_ctrl rk2928_pin_ctrl = { ...@@ -1644,7 +1865,7 @@ static struct rockchip_pin_ctrl rk2928_pin_ctrl = {
.nr_banks = ARRAY_SIZE(rk2928_pin_banks), .nr_banks = ARRAY_SIZE(rk2928_pin_banks),
.label = "RK2928-GPIO", .label = "RK2928-GPIO",
.type = RK2928, .type = RK2928,
.mux_offset = 0xa8, .grf_mux_offset = 0xa8,
.pull_calc_reg = rk2928_calc_pull_reg_and_bit, .pull_calc_reg = rk2928_calc_pull_reg_and_bit,
}; };
...@@ -1662,7 +1883,7 @@ static struct rockchip_pin_ctrl rk3066a_pin_ctrl = { ...@@ -1662,7 +1883,7 @@ static struct rockchip_pin_ctrl rk3066a_pin_ctrl = {
.nr_banks = ARRAY_SIZE(rk3066a_pin_banks), .nr_banks = ARRAY_SIZE(rk3066a_pin_banks),
.label = "RK3066a-GPIO", .label = "RK3066a-GPIO",
.type = RK2928, .type = RK2928,
.mux_offset = 0xa8, .grf_mux_offset = 0xa8,
.pull_calc_reg = rk2928_calc_pull_reg_and_bit, .pull_calc_reg = rk2928_calc_pull_reg_and_bit,
}; };
...@@ -1678,11 +1899,11 @@ static struct rockchip_pin_ctrl rk3066b_pin_ctrl = { ...@@ -1678,11 +1899,11 @@ static struct rockchip_pin_ctrl rk3066b_pin_ctrl = {
.nr_banks = ARRAY_SIZE(rk3066b_pin_banks), .nr_banks = ARRAY_SIZE(rk3066b_pin_banks),
.label = "RK3066b-GPIO", .label = "RK3066b-GPIO",
.type = RK3066B, .type = RK3066B,
.mux_offset = 0x60, .grf_mux_offset = 0x60,
}; };
static struct rockchip_pin_bank rk3188_pin_banks[] = { static struct rockchip_pin_bank rk3188_pin_banks[] = {
PIN_BANK(0, 32, "gpio0"), PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", IOMUX_GPIO_ONLY, 0, 0, 0),
PIN_BANK(1, 32, "gpio1"), PIN_BANK(1, 32, "gpio1"),
PIN_BANK(2, 32, "gpio2"), PIN_BANK(2, 32, "gpio2"),
PIN_BANK(3, 32, "gpio3"), PIN_BANK(3, 32, "gpio3"),
...@@ -1693,10 +1914,52 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = { ...@@ -1693,10 +1914,52 @@ static struct rockchip_pin_ctrl rk3188_pin_ctrl = {
.nr_banks = ARRAY_SIZE(rk3188_pin_banks), .nr_banks = ARRAY_SIZE(rk3188_pin_banks),
.label = "RK3188-GPIO", .label = "RK3188-GPIO",
.type = RK3188, .type = RK3188,
.mux_offset = 0x60, .grf_mux_offset = 0x60,
.pull_calc_reg = rk3188_calc_pull_reg_and_bit, .pull_calc_reg = rk3188_calc_pull_reg_and_bit,
}; };
static struct rockchip_pin_bank rk3288_pin_banks[] = {
PIN_BANK_IOMUX_FLAGS(0, 24, "gpio0", IOMUX_SOURCE_PMU,
IOMUX_SOURCE_PMU,
IOMUX_SOURCE_PMU,
IOMUX_UNROUTED
),
PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", IOMUX_UNROUTED,
IOMUX_UNROUTED,
IOMUX_UNROUTED,
0
),
PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, 0, 0, IOMUX_UNROUTED),
PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", 0, 0, 0, IOMUX_WIDTH_4BIT),
PIN_BANK_IOMUX_FLAGS(4, 32, "gpio4", IOMUX_WIDTH_4BIT,
IOMUX_WIDTH_4BIT,
0,
0
),
PIN_BANK_IOMUX_FLAGS(5, 32, "gpio5", IOMUX_UNROUTED,
0,
0,
IOMUX_UNROUTED
),
PIN_BANK_IOMUX_FLAGS(6, 32, "gpio6", 0, 0, 0, IOMUX_UNROUTED),
PIN_BANK_IOMUX_FLAGS(7, 32, "gpio7", 0,
0,
IOMUX_WIDTH_4BIT,
IOMUX_UNROUTED
),
PIN_BANK(8, 16, "gpio8"),
};
static struct rockchip_pin_ctrl rk3288_pin_ctrl = {
.pin_banks = rk3288_pin_banks,
.nr_banks = ARRAY_SIZE(rk3288_pin_banks),
.label = "RK3288-GPIO",
.type = RK3288,
.grf_mux_offset = 0x0,
.pmu_mux_offset = 0x84,
.pull_calc_reg = rk3288_calc_pull_reg_and_bit,
};
static const struct of_device_id rockchip_pinctrl_dt_match[] = { static const struct of_device_id rockchip_pinctrl_dt_match[] = {
{ .compatible = "rockchip,rk2928-pinctrl", { .compatible = "rockchip,rk2928-pinctrl",
.data = (void *)&rk2928_pin_ctrl }, .data = (void *)&rk2928_pin_ctrl },
...@@ -1706,6 +1969,8 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = { ...@@ -1706,6 +1969,8 @@ static const struct of_device_id rockchip_pinctrl_dt_match[] = {
.data = (void *)&rk3066b_pin_ctrl }, .data = (void *)&rk3066b_pin_ctrl },
{ .compatible = "rockchip,rk3188-pinctrl", { .compatible = "rockchip,rk3188-pinctrl",
.data = (void *)&rk3188_pin_ctrl }, .data = (void *)&rk3188_pin_ctrl },
{ .compatible = "rockchip,rk3288-pinctrl",
.data = (void *)&rk3288_pin_ctrl },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match); MODULE_DEVICE_TABLE(of, rockchip_pinctrl_dt_match);
......
...@@ -488,61 +488,6 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector, ...@@ -488,61 +488,6 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
return 0; return 0;
} }
static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
unsigned group)
{
struct pcs_device *pcs;
struct pcs_function *func;
int i;
pcs = pinctrl_dev_get_drvdata(pctldev);
/* If function mask is null, needn't disable it. */
if (!pcs->fmask)
return;
func = radix_tree_lookup(&pcs->ftree, fselector);
if (!func) {
dev_err(pcs->dev, "%s could not find function%i\n",
__func__, fselector);
return;
}
/*
* Ignore disable if function-off is not specified. Some hardware
* does not have clearly defined disable function. For pin specific
* off modes, you can use alternate named states as described in
* pinctrl-bindings.txt.
*/
if (pcs->foff == PCS_OFF_DISABLED) {
dev_dbg(pcs->dev, "ignoring disable for %s function%i\n",
func->name, fselector);
return;
}
dev_dbg(pcs->dev, "disabling function%i %s\n",
fselector, func->name);
for (i = 0; i < func->nvals; i++) {
struct pcs_func_vals *vals;
unsigned long flags;
unsigned val, mask;
vals = &func->vals[i];
raw_spin_lock_irqsave(&pcs->lock, flags);
val = pcs->read(vals->reg);
if (pcs->bits_per_mux)
mask = vals->mask;
else
mask = pcs->fmask;
val &= ~mask;
val |= pcs->foff << pcs->fshift;
pcs->write(val, vals->reg);
raw_spin_unlock_irqrestore(&pcs->lock, flags);
}
}
static int pcs_request_gpio(struct pinctrl_dev *pctldev, static int pcs_request_gpio(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned pin) struct pinctrl_gpio_range *range, unsigned pin)
{ {
...@@ -575,7 +520,6 @@ static const struct pinmux_ops pcs_pinmux_ops = { ...@@ -575,7 +520,6 @@ static const struct pinmux_ops pcs_pinmux_ops = {
.get_function_name = pcs_get_function_name, .get_function_name = pcs_get_function_name,
.get_function_groups = pcs_get_function_groups, .get_function_groups = pcs_get_function_groups,
.enable = pcs_enable, .enable = pcs_enable,
.disable = pcs_disable,
.gpio_request_enable = pcs_request_gpio, .gpio_request_enable = pcs_request_gpio,
}; };
...@@ -836,7 +780,7 @@ static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, ...@@ -836,7 +780,7 @@ static int pcs_add_pin(struct pcs_device *pcs, unsigned offset,
pin = &pcs->pins.pa[i]; pin = &pcs->pins.pa[i];
pn = &pcs->names[i]; pn = &pcs->names[i];
sprintf(pn->name, "%lx.%d", sprintf(pn->name, "%lx.%u",
(unsigned long)pcs->res->start + offset, pin_pos); (unsigned long)pcs->res->start + offset, pin_pos);
pin->name = pn->name; pin->name = pn->name;
pin->number = i; pin->number = i;
...@@ -1739,11 +1683,10 @@ static void pcs_irq_chain_handler(unsigned int irq, struct irq_desc *desc) ...@@ -1739,11 +1683,10 @@ static void pcs_irq_chain_handler(unsigned int irq, struct irq_desc *desc)
{ {
struct pcs_soc_data *pcs_soc = irq_desc_get_handler_data(desc); struct pcs_soc_data *pcs_soc = irq_desc_get_handler_data(desc);
struct irq_chip *chip; struct irq_chip *chip;
int res;
chip = irq_get_chip(irq); chip = irq_get_chip(irq);
chained_irq_enter(chip, desc); chained_irq_enter(chip, desc);
res = pcs_irq_handle(pcs_soc); pcs_irq_handle(pcs_soc);
/* REVISIT: export and add handle_bad_irq(irq, desc)? */ /* REVISIT: export and add handle_bad_irq(irq, desc)? */
chained_irq_exit(chip, desc); chained_irq_exit(chip, desc);
......
...@@ -930,11 +930,6 @@ static int st_pmx_enable(struct pinctrl_dev *pctldev, unsigned fselector, ...@@ -930,11 +930,6 @@ static int st_pmx_enable(struct pinctrl_dev *pctldev, unsigned fselector,
return 0; return 0;
} }
static void st_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
unsigned group)
{
}
static int st_pmx_set_gpio_direction(struct pinctrl_dev *pctldev, static int st_pmx_set_gpio_direction(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned gpio, struct pinctrl_gpio_range *range, unsigned gpio,
bool input) bool input)
...@@ -957,7 +952,6 @@ static struct pinmux_ops st_pmxops = { ...@@ -957,7 +952,6 @@ static struct pinmux_ops st_pmxops = {
.get_function_name = st_pmx_get_fname, .get_function_name = st_pmx_get_fname,
.get_function_groups = st_pmx_get_groups, .get_function_groups = st_pmx_get_groups,
.enable = st_pmx_enable, .enable = st_pmx_enable,
.disable = st_pmx_disable,
.gpio_set_direction = st_pmx_set_gpio_direction, .gpio_set_direction = st_pmx_set_gpio_direction,
}; };
...@@ -1178,9 +1172,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np, ...@@ -1178,9 +1172,7 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
const __be32 *list; const __be32 *list;
struct property *pp; struct property *pp;
struct st_pinconf *conf; struct st_pinconf *conf;
phandle phandle;
struct device_node *pins; struct device_node *pins;
u32 pin;
int i = 0, npins = 0, nr_props; int i = 0, npins = 0, nr_props;
pins = of_get_child_by_name(np, "st,pins"); pins = of_get_child_by_name(np, "st,pins");
...@@ -1218,8 +1210,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np, ...@@ -1218,8 +1210,8 @@ static int st_pctl_dt_parse_groups(struct device_node *np,
conf = &grp->pin_conf[i]; conf = &grp->pin_conf[i];
/* bank & offset */ /* bank & offset */
phandle = be32_to_cpup(list++); be32_to_cpup(list++);
pin = be32_to_cpup(list++); be32_to_cpup(list++);
conf->pin = of_get_named_gpio(pins, pp->name, 0); conf->pin = of_get_named_gpio(pins, pp->name, 0);
conf->name = pp->name; conf->name = pp->name;
grp->pins[i] = conf->pin; grp->pins[i] = conf->pin;
...@@ -1256,7 +1248,7 @@ static int st_pctl_parse_functions(struct device_node *np, ...@@ -1256,7 +1248,7 @@ static int st_pctl_parse_functions(struct device_node *np,
func = &info->functions[index]; func = &info->functions[index];
func->name = np->name; func->name = np->name;
func->ngroups = of_get_child_count(np); func->ngroups = of_get_child_count(np);
if (func->ngroups <= 0) { if (func->ngroups == 0) {
dev_err(info->dev, "No groups defined\n"); dev_err(info->dev, "No groups defined\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1454,6 +1446,7 @@ static struct irq_chip st_gpio_irqchip = { ...@@ -1454,6 +1446,7 @@ static struct irq_chip st_gpio_irqchip = {
.irq_mask = st_gpio_irq_mask, .irq_mask = st_gpio_irq_mask,
.irq_unmask = st_gpio_irq_unmask, .irq_unmask = st_gpio_irq_unmask,
.irq_set_type = st_gpio_irq_set_type, .irq_set_type = st_gpio_irq_set_type,
.flags = IRQCHIP_SKIP_SET_WAKE,
}; };
static int st_gpiolib_register_bank(struct st_pinctrl *info, static int st_gpiolib_register_bank(struct st_pinctrl *info,
......
...@@ -738,22 +738,6 @@ static int tb10x_pctl_enable(struct pinctrl_dev *pctl, ...@@ -738,22 +738,6 @@ static int tb10x_pctl_enable(struct pinctrl_dev *pctl,
return 0; return 0;
} }
static void tb10x_pctl_disable(struct pinctrl_dev *pctl,
unsigned func_selector, unsigned group_selector)
{
struct tb10x_pinctrl *state = pinctrl_dev_get_drvdata(pctl);
const struct tb10x_pinfuncgrp *grp = &state->pingroups[group_selector];
if (grp->port < 0)
return;
mutex_lock(&state->mutex);
state->ports[grp->port].count--;
mutex_unlock(&state->mutex);
}
static struct pinmux_ops tb10x_pinmux_ops = { static struct pinmux_ops tb10x_pinmux_ops = {
.get_functions_count = tb10x_get_functions_count, .get_functions_count = tb10x_get_functions_count,
.get_function_name = tb10x_get_function_name, .get_function_name = tb10x_get_function_name,
...@@ -761,7 +745,6 @@ static struct pinmux_ops tb10x_pinmux_ops = { ...@@ -761,7 +745,6 @@ static struct pinmux_ops tb10x_pinmux_ops = {
.gpio_request_enable = tb10x_gpio_request_enable, .gpio_request_enable = tb10x_gpio_request_enable,
.gpio_disable_free = tb10x_gpio_disable_free, .gpio_disable_free = tb10x_gpio_disable_free,
.enable = tb10x_pctl_enable, .enable = tb10x_pctl_enable,
.disable = tb10x_pctl_disable,
}; };
static struct pinctrl_desc tb10x_pindesc = { static struct pinctrl_desc tb10x_pindesc = {
......
...@@ -290,24 +290,11 @@ static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function, ...@@ -290,24 +290,11 @@ static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function,
return 0; return 0;
} }
static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
unsigned function, unsigned group)
{
struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
const struct tegra_pingroup *g;
g = &pmx->soc->groups[group];
if (WARN_ON(g->mux_reg < 0))
return;
}
static const struct pinmux_ops tegra_pinmux_ops = { static const struct pinmux_ops tegra_pinmux_ops = {
.get_functions_count = tegra_pinctrl_get_funcs_count, .get_functions_count = tegra_pinctrl_get_funcs_count,
.get_function_name = tegra_pinctrl_get_func_name, .get_function_name = tegra_pinctrl_get_func_name,
.get_function_groups = tegra_pinctrl_get_func_groups, .get_function_groups = tegra_pinctrl_get_func_groups,
.enable = tegra_pinctrl_enable, .enable = tegra_pinctrl_enable,
.disable = tegra_pinctrl_disable,
}; };
static int tegra_pinconf_reg(struct tegra_pmx *pmx, static int tegra_pinconf_reg(struct tegra_pmx *pmx,
......
...@@ -574,33 +574,6 @@ static int tz1090_pdc_pinctrl_enable(struct pinctrl_dev *pctldev, ...@@ -574,33 +574,6 @@ static int tz1090_pdc_pinctrl_enable(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static void tz1090_pdc_pinctrl_disable(struct pinctrl_dev *pctldev,
unsigned int function,
unsigned int group)
{
struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
const struct tz1090_pdc_pingroup *grp = &tz1090_pdc_groups[group];
dev_dbg(pctldev->dev, "%s(func=%u (%s), group=%u (%s))\n",
__func__,
function, tz1090_pdc_functions[function].name,
group, tz1090_pdc_groups[group].name);
/* is it even a mux? */
if (grp->drv)
return;
/* does this group even control the function? */
if (function != grp->func)
return;
/* record the pin being unmuxed and update mux bit */
spin_lock(&pmx->lock);
pmx->mux_en &= ~BIT(grp->pins[0]);
tz1090_pdc_pinctrl_mux(pmx, grp);
spin_unlock(&pmx->lock);
}
static const struct tz1090_pdc_pingroup *find_mux_group( static const struct tz1090_pdc_pingroup *find_mux_group(
struct tz1090_pdc_pmx *pmx, struct tz1090_pdc_pmx *pmx,
unsigned int pin) unsigned int pin)
...@@ -662,7 +635,6 @@ static struct pinmux_ops tz1090_pdc_pinmux_ops = { ...@@ -662,7 +635,6 @@ static struct pinmux_ops tz1090_pdc_pinmux_ops = {
.get_function_name = tz1090_pdc_pinctrl_get_func_name, .get_function_name = tz1090_pdc_pinctrl_get_func_name,
.get_function_groups = tz1090_pdc_pinctrl_get_func_groups, .get_function_groups = tz1090_pdc_pinctrl_get_func_groups,
.enable = tz1090_pdc_pinctrl_enable, .enable = tz1090_pdc_pinctrl_enable,
.disable = tz1090_pdc_pinctrl_disable,
.gpio_request_enable = tz1090_pdc_pinctrl_gpio_request_enable, .gpio_request_enable = tz1090_pdc_pinctrl_gpio_request_enable,
.gpio_disable_free = tz1090_pdc_pinctrl_gpio_disable_free, .gpio_disable_free = tz1090_pdc_pinctrl_gpio_disable_free,
}; };
......
...@@ -1478,63 +1478,6 @@ static int tz1090_pinctrl_enable(struct pinctrl_dev *pctldev, ...@@ -1478,63 +1478,6 @@ static int tz1090_pinctrl_enable(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
/**
* tz1090_pinctrl_disable() - Disable a function on a pin group.
* @pctldev: Pin control data
* @function: Function index to disable
* @group: Group index to disable
*
* Disable a particular function on a group of pins. The per GPIO pin pseudo pin
* groups can be used (in which case the pin will be taken out of peripheral
* mode. Some convenience pin groups can also be used in which case the effect
* is the same as enabling the function on each individual pin in the group.
*/
static void tz1090_pinctrl_disable(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group)
{
struct tz1090_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
struct tz1090_pingroup *grp;
unsigned int pin_num, mux_group, i, npins;
const unsigned int *pins;
/* group of pins? */
if (group < ARRAY_SIZE(tz1090_groups)) {
grp = &tz1090_groups[group];
npins = grp->npins;
pins = grp->pins;
/*
* All pins in the group must belong to the same mux group,
* which allows us to just use the mux group of the first pin.
* By explicitly listing permitted pingroups for each function
* the pinmux core should ensure this is always the case.
*/
} else {
pin_num = group - ARRAY_SIZE(tz1090_groups);
npins = 1;
pins = &pin_num;
}
mux_group = tz1090_mux_pins[*pins];
/* no mux group, but can still be individually muxed to peripheral */
if (mux_group >= TZ1090_MUX_GROUP_MAX) {
if (function == TZ1090_MUX_PERIP)
goto unmux_pins;
return;
}
/* mux group already set to a different function? */
grp = &tz1090_mux_groups[mux_group];
dev_dbg(pctldev->dev, "%s: unmuxing %u pin(s) in '%s' from '%s'\n",
__func__, npins, grp->name, tz1090_functions[function].name);
/* subtract pins from ref count and unmux individually */
WARN_ON(grp->func_count < npins);
grp->func_count -= npins;
unmux_pins:
for (i = 0; i < npins; ++i)
tz1090_pinctrl_perip_select(pmx, pins[i], false);
}
/** /**
* tz1090_pinctrl_gpio_request_enable() - Put pin in GPIO mode. * tz1090_pinctrl_gpio_request_enable() - Put pin in GPIO mode.
* @pctldev: Pin control data * @pctldev: Pin control data
...@@ -1575,7 +1518,6 @@ static struct pinmux_ops tz1090_pinmux_ops = { ...@@ -1575,7 +1518,6 @@ static struct pinmux_ops tz1090_pinmux_ops = {
.get_function_name = tz1090_pinctrl_get_func_name, .get_function_name = tz1090_pinctrl_get_func_name,
.get_function_groups = tz1090_pinctrl_get_func_groups, .get_function_groups = tz1090_pinctrl_get_func_groups,
.enable = tz1090_pinctrl_enable, .enable = tz1090_pinctrl_enable,
.disable = tz1090_pinctrl_disable,
.gpio_request_enable = tz1090_pinctrl_gpio_request_enable, .gpio_request_enable = tz1090_pinctrl_gpio_request_enable,
.gpio_disable_free = tz1090_pinctrl_gpio_disable_free, .gpio_disable_free = tz1090_pinctrl_gpio_disable_free,
}; };
......
...@@ -970,19 +970,6 @@ static int u300_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -970,19 +970,6 @@ static int u300_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static void u300_pmx_disable(struct pinctrl_dev *pctldev, unsigned selector,
unsigned group)
{
struct u300_pmx *upmx;
/* There is nothing to do with the power pins */
if (selector == 0)
return;
upmx = pinctrl_dev_get_drvdata(pctldev);
u300_pmx_endisable(upmx, selector, false);
}
static int u300_pmx_get_funcs_count(struct pinctrl_dev *pctldev) static int u300_pmx_get_funcs_count(struct pinctrl_dev *pctldev)
{ {
return ARRAY_SIZE(u300_pmx_functions); return ARRAY_SIZE(u300_pmx_functions);
...@@ -1008,7 +995,6 @@ static const struct pinmux_ops u300_pmx_ops = { ...@@ -1008,7 +995,6 @@ static const struct pinmux_ops u300_pmx_ops = {
.get_function_name = u300_pmx_get_func_name, .get_function_name = u300_pmx_get_func_name,
.get_function_groups = u300_pmx_get_groups, .get_function_groups = u300_pmx_get_groups,
.enable = u300_pmx_enable, .enable = u300_pmx_enable,
.disable = u300_pmx_disable,
}; };
static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin, static int u300_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin,
......
...@@ -471,7 +471,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) ...@@ -471,7 +471,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting)
{ {
struct pinctrl_dev *pctldev = setting->pctldev; struct pinctrl_dev *pctldev = setting->pctldev;
const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
const struct pinmux_ops *ops = pctldev->desc->pmxops;
int ret = 0; int ret = 0;
const unsigned *pins = NULL; const unsigned *pins = NULL;
unsigned num_pins = 0; unsigned num_pins = 0;
...@@ -518,9 +517,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting) ...@@ -518,9 +517,6 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting)
pins[i], desc->name, gname); pins[i], desc->name, gname);
} }
} }
if (ops->disable)
ops->disable(pctldev, setting->data.mux.func, setting->data.mux.group);
} }
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
......
if (ARCH_QCOM || COMPILE_TEST)
config PINCTRL_MSM
bool
select PINMUX
select PINCONF
select GENERIC_PINCONF
select GPIOLIB_IRQCHIP
config PINCTRL_APQ8064
tristate "Qualcomm APQ8064 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm APQ8064 platform.
config PINCTRL_IPQ8064
tristate "Qualcomm IPQ8064 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm IPQ8064 platform.
config PINCTRL_MSM8960
tristate "Qualcomm 8960 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm 8960 platform.
config PINCTRL_MSM8X74
tristate "Qualcomm 8x74 pin controller driver"
depends on GPIOLIB && OF
select PINCTRL_MSM
help
This is the pinctrl, pinmux, pinconf and gpiolib driver for the
Qualcomm TLMM block found in the Qualcomm 8974 platform.
endif
# Qualcomm pin control drivers
obj-$(CONFIG_PINCTRL_MSM) += pinctrl-msm.o
obj-$(CONFIG_PINCTRL_APQ8064) += pinctrl-apq8064.o
obj-$(CONFIG_PINCTRL_IPQ8064) += pinctrl-ipq8064.o
obj-$(CONFIG_PINCTRL_MSM8960) += pinctrl-msm8960.o
obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o
...@@ -230,7 +230,7 @@ static const unsigned int sdc3_data_pins[] = { 95 }; ...@@ -230,7 +230,7 @@ static const unsigned int sdc3_data_pins[] = { 95 };
.pins = gpio##id##_pins, \ .pins = gpio##id##_pins, \
.npins = ARRAY_SIZE(gpio##id##_pins), \ .npins = ARRAY_SIZE(gpio##id##_pins), \
.funcs = (int[]){ \ .funcs = (int[]){ \
APQ_MUX_NA, /* gpio mode */ \ APQ_MUX_gpio, \
APQ_MUX_##f1, \ APQ_MUX_##f1, \
APQ_MUX_##f2, \ APQ_MUX_##f2, \
APQ_MUX_##f3, \ APQ_MUX_##f3, \
...@@ -293,6 +293,7 @@ enum apq8064_functions { ...@@ -293,6 +293,7 @@ enum apq8064_functions {
APQ_MUX_cam_mclk, APQ_MUX_cam_mclk,
APQ_MUX_codec_mic_i2s, APQ_MUX_codec_mic_i2s,
APQ_MUX_codec_spkr_i2s, APQ_MUX_codec_spkr_i2s,
APQ_MUX_gpio,
APQ_MUX_gsbi1, APQ_MUX_gsbi1,
APQ_MUX_gsbi2, APQ_MUX_gsbi2,
APQ_MUX_gsbi3, APQ_MUX_gsbi3,
...@@ -335,6 +336,21 @@ static const char * const codec_mic_i2s_groups[] = { ...@@ -335,6 +336,21 @@ static const char * const codec_mic_i2s_groups[] = {
static const char * const codec_spkr_i2s_groups[] = { static const char * const codec_spkr_i2s_groups[] = {
"gpio39", "gpio40", "gpio41", "gpio42" "gpio39", "gpio40", "gpio41", "gpio42"
}; };
static const char * const gpio_groups[] = {
"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
"gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
"gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
};
static const char * const gsbi1_groups[] = { static const char * const gsbi1_groups[] = {
"gpio18", "gpio19", "gpio20", "gpio21" "gpio18", "gpio19", "gpio20", "gpio21"
}; };
...@@ -430,6 +446,7 @@ static const struct msm_function apq8064_functions[] = { ...@@ -430,6 +446,7 @@ static const struct msm_function apq8064_functions[] = {
FUNCTION(cam_mclk), FUNCTION(cam_mclk),
FUNCTION(codec_mic_i2s), FUNCTION(codec_mic_i2s),
FUNCTION(codec_spkr_i2s), FUNCTION(codec_spkr_i2s),
FUNCTION(gpio),
FUNCTION(gsbi1), FUNCTION(gsbi1),
FUNCTION(gsbi2), FUNCTION(gsbi2),
FUNCTION(gsbi3), FUNCTION(gsbi3),
......
...@@ -183,7 +183,7 @@ static const unsigned int sdc3_data_pins[] = { 71 }; ...@@ -183,7 +183,7 @@ static const unsigned int sdc3_data_pins[] = { 71 };
.pins = gpio##id##_pins, \ .pins = gpio##id##_pins, \
.npins = ARRAY_SIZE(gpio##id##_pins), \ .npins = ARRAY_SIZE(gpio##id##_pins), \
.funcs = (int[]){ \ .funcs = (int[]){ \
IPQ_MUX_NA, /* gpio mode */ \ IPQ_MUX_gpio, \
IPQ_MUX_##f1, \ IPQ_MUX_##f1, \
IPQ_MUX_##f2, \ IPQ_MUX_##f2, \
IPQ_MUX_##f3, \ IPQ_MUX_##f3, \
...@@ -243,6 +243,7 @@ static const unsigned int sdc3_data_pins[] = { 71 }; ...@@ -243,6 +243,7 @@ static const unsigned int sdc3_data_pins[] = { 71 };
} }
enum ipq8064_functions { enum ipq8064_functions {
IPQ_MUX_gpio,
IPQ_MUX_mdio, IPQ_MUX_mdio,
IPQ_MUX_mi2s, IPQ_MUX_mi2s,
IPQ_MUX_pdm, IPQ_MUX_pdm,
...@@ -291,6 +292,19 @@ enum ipq8064_functions { ...@@ -291,6 +292,19 @@ enum ipq8064_functions {
IPQ_MUX_NA, IPQ_MUX_NA,
}; };
static const char * const gpio_groups[] = {
"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
"gpio64", "gpio65", "gpio66", "gpio67", "gpio68"
};
static const char * const mdio_groups[] = { static const char * const mdio_groups[] = {
"gpio0", "gpio1", "gpio10", "gpio11", "gpio0", "gpio1", "gpio10", "gpio11",
}; };
...@@ -481,6 +495,7 @@ static const char * const ps_hold_groups[] = { ...@@ -481,6 +495,7 @@ static const char * const ps_hold_groups[] = {
}; };
static const struct msm_function ipq8064_functions[] = { static const struct msm_function ipq8064_functions[] = {
FUNCTION(gpio),
FUNCTION(mdio), FUNCTION(mdio),
FUNCTION(ssbi), FUNCTION(ssbi),
FUNCTION(spmi), FUNCTION(spmi),
......
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include "core.h" #include "../core.h"
#include "pinconf.h" #include "../pinconf.h"
#include "pinctrl-msm.h" #include "pinctrl-msm.h"
#include "pinctrl-utils.h" #include "../pinctrl-utils.h"
#define MAX_NR_GPIO 300 #define MAX_NR_GPIO 300
...@@ -142,9 +142,6 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev, ...@@ -142,9 +142,6 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev,
g = &pctrl->soc->groups[group]; g = &pctrl->soc->groups[group];
if (WARN_ON(g->mux_bit < 0))
return -EINVAL;
for (i = 0; i < g->nfuncs; i++) { for (i = 0; i < g->nfuncs; i++) {
if (g->funcs[i] == function) if (g->funcs[i] == function)
break; break;
...@@ -165,36 +162,11 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev, ...@@ -165,36 +162,11 @@ static int msm_pinmux_enable(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static void msm_pinmux_disable(struct pinctrl_dev *pctldev,
unsigned function,
unsigned group)
{
struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
const struct msm_pingroup *g;
unsigned long flags;
u32 val;
g = &pctrl->soc->groups[group];
if (WARN_ON(g->mux_bit < 0))
return;
spin_lock_irqsave(&pctrl->lock, flags);
/* Clear the mux bits to select gpio mode */
val = readl(pctrl->regs + g->ctl_reg);
val &= ~(0x7 << g->mux_bit);
writel(val, pctrl->regs + g->ctl_reg);
spin_unlock_irqrestore(&pctrl->lock, flags);
}
static const struct pinmux_ops msm_pinmux_ops = { static const struct pinmux_ops msm_pinmux_ops = {
.get_functions_count = msm_get_functions_count, .get_functions_count = msm_get_functions_count,
.get_function_name = msm_get_function_name, .get_function_name = msm_get_function_name,
.get_function_groups = msm_get_function_groups, .get_function_groups = msm_get_function_groups,
.enable = msm_pinmux_enable, .enable = msm_pinmux_enable,
.disable = msm_pinmux_disable,
}; };
static int msm_config_reg(struct msm_pinctrl *pctrl, static int msm_config_reg(struct msm_pinctrl *pctrl,
...@@ -206,6 +178,7 @@ static int msm_config_reg(struct msm_pinctrl *pctrl, ...@@ -206,6 +178,7 @@ static int msm_config_reg(struct msm_pinctrl *pctrl,
switch (param) { switch (param) {
case PIN_CONFIG_BIAS_DISABLE: case PIN_CONFIG_BIAS_DISABLE:
case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_DOWN:
case PIN_CONFIG_BIAS_BUS_HOLD:
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
*bit = g->pull_bit; *bit = g->pull_bit;
*mask = 3; *mask = 3;
...@@ -243,6 +216,7 @@ static int msm_config_set(struct pinctrl_dev *pctldev, unsigned int pin, ...@@ -243,6 +216,7 @@ static int msm_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
#define MSM_NO_PULL 0 #define MSM_NO_PULL 0
#define MSM_PULL_DOWN 1 #define MSM_PULL_DOWN 1
#define MSM_KEEPER 2
#define MSM_PULL_UP 3 #define MSM_PULL_UP 3
static unsigned msm_regval_to_drive(u32 val) static unsigned msm_regval_to_drive(u32 val)
...@@ -280,6 +254,9 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev, ...@@ -280,6 +254,9 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev,
case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_DOWN:
arg = arg == MSM_PULL_DOWN; arg = arg == MSM_PULL_DOWN;
break; break;
case PIN_CONFIG_BIAS_BUS_HOLD:
arg = arg == MSM_KEEPER;
break;
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
arg = arg == MSM_PULL_UP; arg = arg == MSM_PULL_UP;
break; break;
...@@ -339,6 +316,9 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev, ...@@ -339,6 +316,9 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev,
case PIN_CONFIG_BIAS_PULL_DOWN: case PIN_CONFIG_BIAS_PULL_DOWN:
arg = MSM_PULL_DOWN; arg = MSM_PULL_DOWN;
break; break;
case PIN_CONFIG_BIAS_BUS_HOLD:
arg = MSM_KEEPER;
break;
case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_UP:
arg = MSM_PULL_UP; arg = MSM_PULL_UP;
break; break;
......
此差异已折叠。
...@@ -342,7 +342,7 @@ static const unsigned int sdc2_data_pins[] = { 151 }; ...@@ -342,7 +342,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
.pins = gpio##id##_pins, \ .pins = gpio##id##_pins, \
.npins = ARRAY_SIZE(gpio##id##_pins), \ .npins = ARRAY_SIZE(gpio##id##_pins), \
.funcs = (int[]){ \ .funcs = (int[]){ \
MSM_MUX_NA, /* gpio mode */ \ MSM_MUX_gpio, \
MSM_MUX_##f1, \ MSM_MUX_##f1, \
MSM_MUX_##f2, \ MSM_MUX_##f2, \
MSM_MUX_##f3, \ MSM_MUX_##f3, \
...@@ -402,6 +402,7 @@ static const unsigned int sdc2_data_pins[] = { 151 }; ...@@ -402,6 +402,7 @@ static const unsigned int sdc2_data_pins[] = { 151 };
* the pingroup table below. * the pingroup table below.
*/ */
enum msm8x74_functions { enum msm8x74_functions {
MSM_MUX_gpio,
MSM_MUX_cci_i2c0, MSM_MUX_cci_i2c0,
MSM_MUX_cci_i2c1, MSM_MUX_cci_i2c1,
MSM_MUX_blsp_i2c1, MSM_MUX_blsp_i2c1,
...@@ -509,6 +510,31 @@ enum msm8x74_functions { ...@@ -509,6 +510,31 @@ enum msm8x74_functions {
MSM_MUX_NA, MSM_MUX_NA,
}; };
static const char * const gpio_groups[] = {
"gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
"gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
"gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
"gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
"gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
"gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
"gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
"gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
"gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
"gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
"gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
"gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
"gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
"gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
"gpio105", "gpio106", "gpio107", "gpio108", "gpio109", "gpio110",
"gpio111", "gpio112", "gpio113", "gpio114", "gpio115", "gpio116",
"gpio117", "gpio118", "gpio119", "gpio120", "gpio121", "gpio122",
"gpio123", "gpio124", "gpio125", "gpio126", "gpio127", "gpio128",
"gpio129", "gpio130", "gpio131", "gpio132", "gpio133", "gpio134",
"gpio135", "gpio136", "gpio137", "gpio138", "gpio139", "gpio140",
"gpio141", "gpio142", "gpio143", "gpio144", "gpio145"
};
static const char * const blsp_uart1_groups[] = { static const char * const blsp_uart1_groups[] = {
"gpio0", "gpio1", "gpio2", "gpio3" "gpio0", "gpio1", "gpio2", "gpio3"
}; };
...@@ -728,6 +754,7 @@ static const char * const wlan_groups[] = { ...@@ -728,6 +754,7 @@ static const char * const wlan_groups[] = {
static const char * const slimbus_groups[] = { "gpio70", "gpio71" }; static const char * const slimbus_groups[] = { "gpio70", "gpio71" };
static const struct msm_function msm8x74_functions[] = { static const struct msm_function msm8x74_functions[] = {
FUNCTION(gpio),
FUNCTION(cci_i2c0), FUNCTION(cci_i2c0),
FUNCTION(cci_i2c1), FUNCTION(cci_i2c1),
FUNCTION(uim1), FUNCTION(uim1),
......
#
# Samsung Pin control drivers
#
config PINCTRL_SAMSUNG
bool
select PINMUX
select PINCONF
config PINCTRL_EXYNOS
bool "Pinctrl driver data for Samsung EXYNOS SoCs other than 5440"
depends on OF && GPIOLIB && (ARCH_EXYNOS || ARCH_S5PV210)
select PINCTRL_SAMSUNG
config PINCTRL_EXYNOS5440
bool "Samsung EXYNOS5440 SoC pinctrl driver"
depends on SOC_EXYNOS5440
select PINMUX
select PINCONF
config PINCTRL_S3C24XX
bool "Samsung S3C24XX SoC pinctrl driver"
depends on ARCH_S3C24XX
select PINCTRL_SAMSUNG
config PINCTRL_S3C64XX
bool "Samsung S3C64XX SoC pinctrl driver"
depends on ARCH_S3C64XX
select PINCTRL_SAMSUNG
# Samsung pin control drivers
obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o
obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o
obj-$(CONFIG_PINCTRL_S3C24XX) += pinctrl-s3c24xx.o
obj-$(CONFIG_PINCTRL_S3C64XX) += pinctrl-s3c64xx.o
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include "core.h" #include "../core.h"
/* EXYNOS5440 GPIO and Pinctrl register offsets */ /* EXYNOS5440 GPIO and Pinctrl register offsets */
#define GPIO_MUX 0x00 #define GPIO_MUX 0x00
...@@ -371,13 +371,6 @@ static int exynos5440_pinmux_enable(struct pinctrl_dev *pctldev, unsigned select ...@@ -371,13 +371,6 @@ static int exynos5440_pinmux_enable(struct pinctrl_dev *pctldev, unsigned select
return 0; return 0;
} }
/* disable a specified pinmux by writing to registers */
static void exynos5440_pinmux_disable(struct pinctrl_dev *pctldev,
unsigned selector, unsigned group)
{
exynos5440_pinmux_setup(pctldev, selector, group, false);
}
/* /*
* The calls to gpio_direction_output() and gpio_direction_input() * The calls to gpio_direction_output() and gpio_direction_input()
* leads to this function call (via the pinctrl_gpio_direction_{input|output}() * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
...@@ -395,7 +388,6 @@ static const struct pinmux_ops exynos5440_pinmux_ops = { ...@@ -395,7 +388,6 @@ static const struct pinmux_ops exynos5440_pinmux_ops = {
.get_function_name = exynos5440_pinmux_get_fname, .get_function_name = exynos5440_pinmux_get_fname,
.get_function_groups = exynos5440_pinmux_get_groups, .get_function_groups = exynos5440_pinmux_get_groups,
.enable = exynos5440_pinmux_enable, .enable = exynos5440_pinmux_enable,
.disable = exynos5440_pinmux_disable,
.gpio_set_direction = exynos5440_pinmux_gpio_set_direction, .gpio_set_direction = exynos5440_pinmux_gpio_set_direction,
}; };
......
...@@ -156,13 +156,6 @@ struct samsung_pin_bank { ...@@ -156,13 +156,6 @@ struct samsung_pin_bank {
* @nr_banks: number of pin banks. * @nr_banks: number of pin banks.
* @base: starting system wide pin number. * @base: starting system wide pin number.
* @nr_pins: number of pins supported by the controller. * @nr_pins: number of pins supported by the controller.
* @geint_con: offset of the ext-gpio controller registers.
* @geint_mask: offset of the ext-gpio interrupt mask registers.
* @geint_pend: offset of the ext-gpio interrupt pending registers.
* @weint_con: offset of the ext-wakeup controller registers.
* @weint_mask: offset of the ext-wakeup interrupt mask registers.
* @weint_pend: offset of the ext-wakeup interrupt pending registers.
* @svc: offset of the interrupt service register.
* @eint_gpio_init: platform specific callback to setup the external gpio * @eint_gpio_init: platform specific callback to setup the external gpio
* interrupts for the controller. * interrupts for the controller.
* @eint_wkup_init: platform specific callback to setup the external wakeup * @eint_wkup_init: platform specific callback to setup the external wakeup
...@@ -176,16 +169,6 @@ struct samsung_pin_ctrl { ...@@ -176,16 +169,6 @@ struct samsung_pin_ctrl {
u32 base; u32 base;
u32 nr_pins; u32 nr_pins;
u32 geint_con;
u32 geint_mask;
u32 geint_pend;
u32 weint_con;
u32 weint_mask;
u32 weint_pend;
u32 svc;
int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *); int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *);
int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *); int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *);
void (*suspend)(struct samsung_pinctrl_drv_data *); void (*suspend)(struct samsung_pinctrl_drv_data *);
...@@ -248,6 +231,7 @@ struct samsung_pmx_func { ...@@ -248,6 +231,7 @@ struct samsung_pmx_func {
const char *name; const char *name;
const char **groups; const char **groups;
u8 num_groups; u8 num_groups;
u32 val;
}; };
/* list of all exported SoC specific data */ /* list of all exported SoC specific data */
......
...@@ -409,11 +409,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) ...@@ -409,11 +409,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc) int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
{ {
int err; gpiochip_remove(&pfc->gpio->gpio_chip);
int ret; gpiochip_remove(&pfc->func->gpio_chip);
ret = gpiochip_remove(&pfc->gpio->gpio_chip);
err = gpiochip_remove(&pfc->func->gpio_chip);
return ret < 0 ? ret : err; return 0;
} }
...@@ -3842,7 +3842,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc) ...@@ -3842,7 +3842,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
cfg.init_data = &sh73a0_vccq_mc0_init_data; cfg.init_data = &sh73a0_vccq_mc0_init_data;
cfg.driver_data = pfc; cfg.driver_data = pfc;
data->vccq_mc0 = regulator_register(&sh73a0_vccq_mc0_desc, &cfg); data->vccq_mc0 = devm_regulator_register(pfc->dev,
&sh73a0_vccq_mc0_desc, &cfg);
if (IS_ERR(data->vccq_mc0)) { if (IS_ERR(data->vccq_mc0)) {
ret = PTR_ERR(data->vccq_mc0); ret = PTR_ERR(data->vccq_mc0);
dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n", dev_err(pfc->dev, "Failed to register VCCQ MC0 regulator: %d\n",
...@@ -3855,16 +3856,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc) ...@@ -3855,16 +3856,8 @@ static int sh73a0_pinmux_soc_init(struct sh_pfc *pfc)
return 0; return 0;
} }
static void sh73a0_pinmux_soc_exit(struct sh_pfc *pfc)
{
struct sh73a0_pinmux_data *data = pfc->soc_data;
regulator_unregister(data->vccq_mc0);
}
static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = { static const struct sh_pfc_soc_operations sh73a0_pinmux_ops = {
.init = sh73a0_pinmux_soc_init, .init = sh73a0_pinmux_soc_init,
.exit = sh73a0_pinmux_soc_exit,
.get_bias = sh73a0_pinmux_get_bias, .get_bias = sh73a0_pinmux_get_bias,
.set_bias = sh73a0_pinmux_set_bias, .set_bias = sh73a0_pinmux_set_bias,
}; };
......
...@@ -345,27 +345,6 @@ static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -345,27 +345,6 @@ static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector,
return ret; return ret;
} }
static void sh_pfc_func_disable(struct pinctrl_dev *pctldev, unsigned selector,
unsigned group)
{
struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
struct sh_pfc *pfc = pmx->pfc;
const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
unsigned long flags;
unsigned int i;
spin_lock_irqsave(&pfc->lock, flags);
for (i = 0; i < grp->nr_pins; ++i) {
int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
cfg->type = PINMUX_TYPE_NONE;
}
spin_unlock_irqrestore(&pfc->lock, flags);
}
static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, struct pinctrl_gpio_range *range,
unsigned offset) unsigned offset)
...@@ -464,7 +443,6 @@ static const struct pinmux_ops sh_pfc_pinmux_ops = { ...@@ -464,7 +443,6 @@ static const struct pinmux_ops sh_pfc_pinmux_ops = {
.get_function_name = sh_pfc_get_function_name, .get_function_name = sh_pfc_get_function_name,
.get_function_groups = sh_pfc_get_function_groups, .get_function_groups = sh_pfc_get_function_groups,
.enable = sh_pfc_func_enable, .enable = sh_pfc_func_enable,
.disable = sh_pfc_func_disable,
.gpio_request_enable = sh_pfc_gpio_request_enable, .gpio_request_enable = sh_pfc_gpio_request_enable,
.gpio_disable_free = sh_pfc_gpio_disable_free, .gpio_disable_free = sh_pfc_gpio_disable_free,
.gpio_set_direction = sh_pfc_gpio_set_direction, .gpio_set_direction = sh_pfc_gpio_set_direction,
......
...@@ -186,15 +186,6 @@ static int sirfsoc_pinmux_enable(struct pinctrl_dev *pmxdev, unsigned selector, ...@@ -186,15 +186,6 @@ static int sirfsoc_pinmux_enable(struct pinctrl_dev *pmxdev, unsigned selector,
return 0; return 0;
} }
static void sirfsoc_pinmux_disable(struct pinctrl_dev *pmxdev, unsigned selector,
unsigned group)
{
struct sirfsoc_pmx *spmx;
spmx = pinctrl_dev_get_drvdata(pmxdev);
sirfsoc_pinmux_endisable(spmx, selector, false);
}
static int sirfsoc_pinmux_get_funcs_count(struct pinctrl_dev *pmxdev) static int sirfsoc_pinmux_get_funcs_count(struct pinctrl_dev *pmxdev)
{ {
return sirfsoc_pmxfunc_cnt; return sirfsoc_pmxfunc_cnt;
...@@ -240,7 +231,6 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev, ...@@ -240,7 +231,6 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
static struct pinmux_ops sirfsoc_pinmux_ops = { static struct pinmux_ops sirfsoc_pinmux_ops = {
.enable = sirfsoc_pinmux_enable, .enable = sirfsoc_pinmux_enable,
.disable = sirfsoc_pinmux_disable,
.get_functions_count = sirfsoc_pinmux_get_funcs_count, .get_functions_count = sirfsoc_pinmux_get_funcs_count,
.get_function_name = sirfsoc_pinmux_get_func_name, .get_function_name = sirfsoc_pinmux_get_func_name,
.get_function_groups = sirfsoc_pinmux_get_groups, .get_function_groups = sirfsoc_pinmux_get_groups,
......
...@@ -48,6 +48,7 @@ config PINCTRL_SPEAR1340 ...@@ -48,6 +48,7 @@ config PINCTRL_SPEAR1340
config PINCTRL_SPEAR_PLGPIO config PINCTRL_SPEAR_PLGPIO
bool "SPEAr SoC PLGPIO Controller" bool "SPEAr SoC PLGPIO Controller"
depends on GPIOLIB && PINCTRL_SPEAR depends on GPIOLIB && PINCTRL_SPEAR
select GPIOLIB_IRQCHIP
help help
Say yes here to support PLGPIO controller on ST Microelectronics SPEAr Say yes here to support PLGPIO controller on ST Microelectronics SPEAr
SoCs. SoCs.
......
...@@ -11,12 +11,11 @@ ...@@ -11,12 +11,11 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio/driver.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm.h> #include <linux/pm.h>
...@@ -54,7 +53,6 @@ struct plgpio_regs { ...@@ -54,7 +53,6 @@ struct plgpio_regs {
* *
* lock: lock for guarding gpio registers * lock: lock for guarding gpio registers
* base: base address of plgpio block * base: base address of plgpio block
* irq_base: irq number of plgpio0
* chip: gpio framework specific chip information structure * chip: gpio framework specific chip information structure
* p2o: function ptr for pin to offset conversion. This is required only for * p2o: function ptr for pin to offset conversion. This is required only for
* machines where mapping b/w pin and offset is not 1-to-1. * machines where mapping b/w pin and offset is not 1-to-1.
...@@ -68,8 +66,6 @@ struct plgpio { ...@@ -68,8 +66,6 @@ struct plgpio {
spinlock_t lock; spinlock_t lock;
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
unsigned irq_base;
struct irq_domain *irq_domain;
struct gpio_chip chip; struct gpio_chip chip;
int (*p2o)(int pin); /* pin_to_offset */ int (*p2o)(int pin); /* pin_to_offset */
int (*o2p)(int offset); /* offset_to_pin */ int (*o2p)(int offset); /* offset_to_pin */
...@@ -280,21 +276,12 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset) ...@@ -280,21 +276,12 @@ static void plgpio_free(struct gpio_chip *chip, unsigned offset)
pinctrl_free_gpio(gpio); pinctrl_free_gpio(gpio);
} }
static int plgpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
struct plgpio *plgpio = container_of(chip, struct plgpio, chip);
if (IS_ERR_VALUE(plgpio->irq_base))
return -EINVAL;
return irq_find_mapping(plgpio->irq_domain, offset);
}
/* PLGPIO IRQ */ /* PLGPIO IRQ */
static void plgpio_irq_disable(struct irq_data *d) static void plgpio_irq_disable(struct irq_data *d)
{ {
struct plgpio *plgpio = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
int offset = d->irq - plgpio->irq_base; struct plgpio *plgpio = container_of(gc, struct plgpio, chip);
int offset = d->hwirq;
unsigned long flags; unsigned long flags;
/* get correct offset for "offset" pin */ /* get correct offset for "offset" pin */
...@@ -311,8 +298,9 @@ static void plgpio_irq_disable(struct irq_data *d) ...@@ -311,8 +298,9 @@ static void plgpio_irq_disable(struct irq_data *d)
static void plgpio_irq_enable(struct irq_data *d) static void plgpio_irq_enable(struct irq_data *d)
{ {
struct plgpio *plgpio = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
int offset = d->irq - plgpio->irq_base; struct plgpio *plgpio = container_of(gc, struct plgpio, chip);
int offset = d->hwirq;
unsigned long flags; unsigned long flags;
/* get correct offset for "offset" pin */ /* get correct offset for "offset" pin */
...@@ -329,8 +317,9 @@ static void plgpio_irq_enable(struct irq_data *d) ...@@ -329,8 +317,9 @@ static void plgpio_irq_enable(struct irq_data *d)
static int plgpio_irq_set_type(struct irq_data *d, unsigned trigger) static int plgpio_irq_set_type(struct irq_data *d, unsigned trigger)
{ {
struct plgpio *plgpio = irq_data_get_irq_chip_data(d); struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
int offset = d->irq - plgpio->irq_base; struct plgpio *plgpio = container_of(gc, struct plgpio, chip);
int offset = d->hwirq;
void __iomem *reg_off; void __iomem *reg_off;
unsigned int supported_type = 0, val; unsigned int supported_type = 0, val;
...@@ -369,7 +358,8 @@ static struct irq_chip plgpio_irqchip = { ...@@ -369,7 +358,8 @@ static struct irq_chip plgpio_irqchip = {
static void plgpio_irq_handler(unsigned irq, struct irq_desc *desc) static void plgpio_irq_handler(unsigned irq, struct irq_desc *desc)
{ {
struct plgpio *plgpio = irq_get_handler_data(irq); struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct plgpio *plgpio = container_of(gc, struct plgpio, chip);
struct irq_chip *irqchip = irq_desc_get_chip(desc); struct irq_chip *irqchip = irq_desc_get_chip(desc);
int regs_count, count, pin, offset, i = 0; int regs_count, count, pin, offset, i = 0;
unsigned long pending; unsigned long pending;
...@@ -410,7 +400,8 @@ static void plgpio_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -410,7 +400,8 @@ static void plgpio_irq_handler(unsigned irq, struct irq_desc *desc)
/* get correct irq line number */ /* get correct irq line number */
pin = i * MAX_GPIO_PER_REG + pin; pin = i * MAX_GPIO_PER_REG + pin;
generic_handle_irq(plgpio_to_irq(&plgpio->chip, pin)); generic_handle_irq(
irq_find_mapping(gc->irqdomain, pin));
} }
} }
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);
...@@ -523,10 +514,9 @@ static int plgpio_probe_dt(struct platform_device *pdev, struct plgpio *plgpio) ...@@ -523,10 +514,9 @@ static int plgpio_probe_dt(struct platform_device *pdev, struct plgpio *plgpio)
} }
static int plgpio_probe(struct platform_device *pdev) static int plgpio_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node;
struct plgpio *plgpio; struct plgpio *plgpio;
struct resource *res; struct resource *res;
int ret, irq, i; int ret, irq;
plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL); plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL);
if (!plgpio) { if (!plgpio) {
...@@ -563,7 +553,6 @@ static int plgpio_probe(struct platform_device *pdev) ...@@ -563,7 +553,6 @@ static int plgpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, plgpio); platform_set_drvdata(pdev, plgpio);
spin_lock_init(&plgpio->lock); spin_lock_init(&plgpio->lock);
plgpio->irq_base = -1;
plgpio->chip.base = -1; plgpio->chip.base = -1;
plgpio->chip.request = plgpio_request; plgpio->chip.request = plgpio_request;
plgpio->chip.free = plgpio_free; plgpio->chip.free = plgpio_free;
...@@ -571,10 +560,10 @@ static int plgpio_probe(struct platform_device *pdev) ...@@ -571,10 +560,10 @@ static int plgpio_probe(struct platform_device *pdev)
plgpio->chip.direction_output = plgpio_direction_output; plgpio->chip.direction_output = plgpio_direction_output;
plgpio->chip.get = plgpio_get_value; plgpio->chip.get = plgpio_get_value;
plgpio->chip.set = plgpio_set_value; plgpio->chip.set = plgpio_set_value;
plgpio->chip.to_irq = plgpio_to_irq;
plgpio->chip.label = dev_name(&pdev->dev); plgpio->chip.label = dev_name(&pdev->dev);
plgpio->chip.dev = &pdev->dev; plgpio->chip.dev = &pdev->dev;
plgpio->chip.owner = THIS_MODULE; plgpio->chip.owner = THIS_MODULE;
plgpio->chip.of_node = pdev->dev.of_node;
if (!IS_ERR(plgpio->clk)) { if (!IS_ERR(plgpio->clk)) {
ret = clk_prepare(plgpio->clk); ret = clk_prepare(plgpio->clk);
...@@ -592,43 +581,32 @@ static int plgpio_probe(struct platform_device *pdev) ...@@ -592,43 +581,32 @@ static int plgpio_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_info(&pdev->dev, "irqs not supported\n"); dev_info(&pdev->dev, "PLGPIO registered without IRQs\n");
return 0;
}
plgpio->irq_base = irq_alloc_descs(-1, 0, plgpio->chip.ngpio, 0);
if (IS_ERR_VALUE(plgpio->irq_base)) {
/* we would not support irq for gpio */
dev_warn(&pdev->dev, "couldn't allocate irq base\n");
return 0; return 0;
} }
plgpio->irq_domain = irq_domain_add_legacy(np, plgpio->chip.ngpio, ret = gpiochip_irqchip_add(&plgpio->chip,
plgpio->irq_base, 0, &irq_domain_simple_ops, NULL); &plgpio_irqchip,
if (WARN_ON(!plgpio->irq_domain)) { 0,
dev_err(&pdev->dev, "irq domain init failed\n"); handle_simple_irq,
irq_free_descs(plgpio->irq_base, plgpio->chip.ngpio); IRQ_TYPE_NONE);
ret = -ENXIO; if (ret) {
dev_err(&pdev->dev, "failed to add irqchip to gpiochip\n");
goto remove_gpiochip; goto remove_gpiochip;
} }
irq_set_chained_handler(irq, plgpio_irq_handler); gpiochip_set_chained_irqchip(&plgpio->chip,
for (i = 0; i < plgpio->chip.ngpio; i++) { &plgpio_irqchip,
irq_set_chip_and_handler(i + plgpio->irq_base, &plgpio_irqchip, irq,
handle_simple_irq); plgpio_irq_handler);
set_irq_flags(i + plgpio->irq_base, IRQF_VALID);
irq_set_chip_data(i + plgpio->irq_base, plgpio);
}
irq_set_handler_data(irq, plgpio);
dev_info(&pdev->dev, "PLGPIO registered with IRQs\n"); dev_info(&pdev->dev, "PLGPIO registered with IRQs\n");
return 0; return 0;
remove_gpiochip: remove_gpiochip:
dev_info(&pdev->dev, "Remove gpiochip\n"); dev_info(&pdev->dev, "Remove gpiochip\n");
if (gpiochip_remove(&plgpio->chip)) gpiochip_remove(&plgpio->chip);
dev_err(&pdev->dev, "unable to remove gpiochip\n");
unprepare_clk: unprepare_clk:
if (!IS_ERR(plgpio->clk)) if (!IS_ERR(plgpio->clk))
clk_unprepare(plgpio->clk); clk_unprepare(plgpio->clk);
......
此差异已折叠。
...@@ -8,3 +8,5 @@ obj-$(CONFIG_PINCTRL_SUN5I_A13) += pinctrl-sun5i-a13.o ...@@ -8,3 +8,5 @@ obj-$(CONFIG_PINCTRL_SUN5I_A13) += pinctrl-sun5i-a13.o
obj-$(CONFIG_PINCTRL_SUN6I_A31) += pinctrl-sun6i-a31.o obj-$(CONFIG_PINCTRL_SUN6I_A31) += pinctrl-sun6i-a31.o
obj-$(CONFIG_PINCTRL_SUN6I_A31_R) += pinctrl-sun6i-a31-r.o obj-$(CONFIG_PINCTRL_SUN6I_A31_R) += pinctrl-sun6i-a31-r.o
obj-$(CONFIG_PINCTRL_SUN7I_A20) += pinctrl-sun7i-a20.o obj-$(CONFIG_PINCTRL_SUN7I_A20) += pinctrl-sun7i-a20.o
obj-$(CONFIG_PINCTRL_SUN8I_A23) += pinctrl-sun8i-a23.o
obj-$(CONFIG_PINCTRL_SUN8I_A23_R) += pinctrl-sun8i-a23-r.o
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册