pinctrl: qcom: Add msm8998 pinctrl driver
Subsystems (6)
PATCH 1/1 pinctrl: qcom: Add msm8998 pinctrl driver
Add initial pinctrl driver to support pin configuration with pinctrl framework for msm8998.
--- .../bindings/pinctrl/qcom,msm8998-pinctrl.txt | 200 ++ drivers/pinctrl/qcom/Kconfig | 8 + drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-msm8998.c | 1933 ++++++++++++++++++++ 4 files changed, 2142 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,msm8998-pinctrl.txt create mode 100644 drivers/pinctrl/qcom/pinctrl-msm8998.c
Documentation/devicetree/bindings/pinctrl/qcom,msm8998-pinctrl.txt new file +200 -0
@@ -0,0 +1,200 @@ +Qualcomm MSM8998 TLMM block + +This binding describes the Top Level Mode Multiplexer block found in the +MSM8998 platform. + +- compatible: + Usage: required + Value type: <string> + Definition: must be "qcom,msm8998-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 arbitrary 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-gpio149 + Supports mux, bias and drive-strength + + sdc2_clk, sdc2_cmd, sdc2_data + Supports bias and drive-strength + + ufs_reset + Supports bias and drive-strength + +- 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: + + blsp_spi1, gpio, blsp_uim1_a, blsp_uart1_a, blsp_i2c1, + blsp_spi8, blsp_uart8_a, blsp_uim8_a, qdss_cti0_b, + blsp_i2c8, ddr_bist, atest_tsens2, atest_usb1, blsp_spi4, + blsp_uart1_b, blsp_uim1_b, wlan1_adc1, atest_usb13,bimc_dte1, + tsif1_sync, wlan1_adc0, atest_usb12, bimc_dte0, mdp_vsync_a, + blsp_i2c4, atest_gpsadc1, wlan2_adc1, atest_usb11, edp_lcd, + dbg_out, atest_gpsadc0, wlan2_adc0, atest_usb10, mdp_vsync, + m_voc, cam_mclk, pll_bypassnl, qdss_gpio0, pll_reset, + qdss_gpio1, qdss_gpio2, qdss_gpio3, cci_i2c, qdss_gpio4, + phase_flag14, qdss_gpio5, phase_flag15, qdss_gpio6, qdss_gpio7, + cci_timer4, blsp2_spi, qdss_gpio11, qdss_gpio12, qdss_gpio13, + qdss_gpio14, qdss_gpio15, cci_timer0, qdss_gpio8, vsense_data0, + cci_timer1, qdss_gpio, vsense_data1, cci_timer2, blsp1_spi_b, + qdss_gpio9, vsense_mode, cci_timer3, cci_async, blsp1_spi_a, + qdss_gpio10, vsense_clkout, hdmi_rcv, hdmi_cec, blsp_spi2, + blsp_uart2_a, blsp_uim2_a, pwr_modem, hdmi_ddc, blsp_i2c2, + pwr_nav, pwr_crypto, hdmi_hot, edp_hot, pci_e0, jitter_bist, + agera_pll, atest_tsens, usb_phy, lpass_slimbus, sd_write, + tsif1_error, blsp_spi6, blsp_uart3_b, blsp_uim3_b, blsp_i2c6, + bt_reset, blsp_spi3, blsp_uart3_a, blsp_uim3_a, blsp_i2c3, + blsp_spi9, blsp_uart9_a, blsp_uim9_a, blsp10_spi_b, qdss_cti0_a, + blsp_i2c9, blsp10_spi_a, blsp_spi7, blsp_uart7_a, blsp_uim7_a, + blsp_i2c7, qua_mi2s, blsp10_spi, gcc_gp1_a, ssc_irq, blsp_spi11, + blsp_uart8_b, blsp_uim8_b, gcc_gp2_a, qdss_cti1_a, gcc_gp3_a, + blsp_i2c11, cri_trng0, cri_trng1, cri_trng, pri_mi2s, sp_cmu, + blsp_spi10, blsp_uart7_b, blsp_uim7_b, pri_mi2s_ws, blsp_i2c10, + spkr_i2s, audio_ref, blsp9_spi, tsense_pwm1, tsense_pwm2, + btfm_slimbus, phase_flag0, ter_mi2s, phase_flag7, phase_flag8, + phase_flag9, phase_flag4, gcc_gp1_b, sec_mi2s, blsp_spi12, + blsp_uart9_b, blsp_uim9_b, gcc_gp2_b, gcc_gp3_b, blsp_i2c12, + blsp_spi5, blsp_uart2_b, blsp_uim2_b, blsp_i2c5, tsif1_clk, + phase_flag10, tsif1_en, mdp_vsync0, mdp_vsync1, mdp_vsync2, + mdp_vsync3, blsp1_spi, tgu_ch0, qdss_cti1_b, tsif1_data, sdc4_cmd, + tgu_ch1, phase_flag1, tsif2_error, sdc43, vfr_1, phase_flag2, + tsif2_clk, sdc4_clk, tsif2_en, sdc42, sd_card, tsif2_data, sdc41, + tsif2_sync, sdc40, phase_flag3, mdp_vsync_b, ldo_en, ldo_update, + blsp_uart8, blsp11_i2c, prng_rosc, phase_flag5, uim2_data, uim2_clk, + uim2_reset, uim2_present, uim1_data, uim1_clk, uim1_reset, + uim1_present, uim_batt, phase_flag16, nav_dr, phase_flag11, phase_flag12, + phase_flag13, atest_char, adsp_ext, phase_flag17, atest_char3, phase_flag18, + atest_char2, phase_flag19, atest_char1, phase_flag20, atest_char0, + phase_flag21, phase_flag22, phase_flag23, phase_flag24, phase_flag25, + modem_tsync, nav_pps, phase_flag26, phase_flag27, qlink_request, phase_flag28, + qlink_enable, phase_flag6, phase_flag29, phase_flag30, phase_flag31, + pa_indicator, ssbi1, isense_dbg, mss_lte + + +- 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: + + tlmm: pinctrl@03400000 { + compatible = "qcom,msm8998-pinctrl"; + reg = <0x03400000 0xc00000>; + interrupts = <0 208 0>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + + uart_console_active: uart_console_active { + mux { + pins = "gpio4", "gpio5"; + function = "blsp_uart8_a"; + }; + + config { + pins = "gpio4", "gpio5"; + drive-strength = <2>; + bias-disable; + }; + }; + };
drivers/pinctrl/qcom/Kconfig +8 -0
@@ -96,6 +96,14 @@ config PINCTRL_MSM8996 This is the pinctrl, pinmux, pinconf and gpiolib driver for the Qualcomm TLMM block found in the Qualcomm MSM8996 platform. +config PINCTRL_MSM8998 + tristate "Qualcomm MSM8998 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 MSM8998 platform. + config PINCTRL_QDF2XXX tristate "Qualcomm Technologies QDF2xxx pin controller driver" depends on GPIOLIB && ACPI
drivers/pinctrl/qcom/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o obj-$(CONFIG_PINCTRL_MSM8916) += pinctrl-msm8916.o obj-$(CONFIG_PINCTRL_MSM8994) += pinctrl-msm8994.o obj-$(CONFIG_PINCTRL_MSM8996) += pinctrl-msm8996.o +obj-$(CONFIG_PINCTRL_MSM8998) += pinctrl-msm8998.o obj-$(CONFIG_PINCTRL_QDF2XXX) += pinctrl-qdf2xxx.o obj-$(CONFIG_PINCTRL_MDM9615) += pinctrl-mdm9615.o obj-$(CONFIG_PINCTRL_QCOM_SPMI_PMIC) += pinctrl-spmi-gpio.o
drivers/pinctrl/qcom/pinctrl-msm8998.c new file +1933 -0
1,933 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 6 lines · Imran Khan
Add initial pinctrl driver to support pin configuration with pinctrl framework for msm8998.
Signed-off-by Imran Khan <[email protected]>--- .../bindings/pinctrl/qcom,msm8998-pinctrl.txt | 200 ++
Quoted 6 lines
drivers/pinctrl/qcom/Kconfig | 8 + drivers/pinctrl/qcom/Makefile | 1 + drivers/pinctrl/qcom/pinctrl-msm8998.c | 1933 ++++++++++++++++++++ 4 files changed, 2142 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,msm8998-pinctrl.txt create mode 100644 drivers/pinctrl/qcom/pinctrl-msm8998.c
Quoted 4 lines · Imran Khan
Add initial pinctrl driver to support pin configuration with pinctrl framework for msm8998.
Signed-off-by Imran Khan <[email protected]>
You need review from the Qcom pinctrl maintainer Bjorn Andersson for this patch.
+#define NORTH 0x500000 +#define WEST 0x100000 +#define EAST 0x900000
(...)
Quoted 2 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c new file +2
-0+static const struct msm_pingroup msm8998_groups[] = { + PINGROUP(0, EAST, blsp_spi1, blsp_uart1_a, blsp_uim1_a, NA, NA, NA, NA,
(...)
Quoted 1 line
+ PINGROUP(6, WEST,
blsp_spi8,blsp_uart8_a,blsp_i2c8, NA, NA, NA, NA,
(...)
Quoted 1 line
+
PINGROUP(35, NORTH, pci_e0, jitter_bist, NA, NA, NA, NA, NA, NA, NA),
(...)
No south? :)
Are these the left/right/top edges of the chip or a reference to x86 bridges terminology? It warrants that you add a comment to the driver file explaining what it means.
Yours,
Linus Walleij
Quoted 1 line · Imran Khan
drivers/pinctrl/qcom/pinctrl-msm8998.c +0
-0
[..]
drivers/pinctrl/qcom/pinctrl-msm8998.c line 30
Quoted 4 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +4
-0+ +#define NORTH 0x500000 +#define WEST 0x100000 +#define EAST 0x900000
So the control registers are now laid out in 3 non-contiguous ranges? Please move them to the top of the file.
Quoted 1 line
+#define
REG_SIZE0x1000
Just inline 0x1000 in the macro below.
Quoted 78 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +78
-0+#define PINGROUP(id, base, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ + { \ + .name = "gpio" #id, \ + .pins = gpio##id##_pins, \ + .npins = (unsigned int)ARRAY_SIZE(gpio##id##_pins), \ + .funcs = (int[]){ \ + msm_mux_gpio, /* gpio mode */ \ + msm_mux_##f1, \ + msm_mux_##f2, \ + msm_mux_##f3, \ + msm_mux_##f4, \ + msm_mux_##f5, \ + msm_mux_##f6, \ + msm_mux_##f7, \ + msm_mux_##f8, \ + msm_mux_##f9 \ + }, \ + .nfuncs = 10, \ + .ctl_reg = base + REG_SIZE * id, \ + .io_reg = base + 0x4 + REG_SIZE * id, \ + .intr_cfg_reg = base + 0x8 + REG_SIZE * id, \ + .intr_status_reg = base + 0xc + REG_SIZE * id, \ + .intr_target_reg = base + 0x8 + REG_SIZE * id, \ + .mux_bit = 2, \ + .pull_bit = 0, \ + .drv_bit = 6, \ + .oe_bit = 9, \ + .in_bit = 0, \ + .out_bit = 1, \ + .intr_enable_bit = 0, \ + .intr_status_bit = 0, \ + .intr_target_bit = 5, \ + .intr_target_kpss_val = 3, \ + .intr_raw_status_bit = 4, \ + .intr_polarity_bit = 1, \ + .intr_detection_bit = 2, \ + .intr_detection_width = 2, \ + } + +#define SDC_QDSD_PINGROUP (pg_name, ctl, pull, drv) \ + { \ + .name = #pg_name, \ + .pins = pg_name##_pins, \ + .npins = (unsigned int)ARRAY_SIZE(pg_name##_pins), \ + .ctl_reg = ctl, \ + .io_reg = 0, \ + .intr_cfg_reg = 0, \ + .intr_status_reg = 0, \ + .intr_target_reg = 0, \ + .mux_bit = -1, \ + .pull_bit = pull, \ + .drv_bit = drv, \ + .oe_bit = -1, \ + .in_bit = -1, \ + .out_bit = -1, \ + .intr_enable_bit = -1, \ + .intr_status_bit = -1, \ + .intr_target_bit = -1, \ + .intr_raw_status_bit = -1, \ + .intr_polarity_bit = -1, \ + .intr_detection_bit = -1, \ + .intr_detection_width = -1, \ + } + +#define UFS_RESET (pg_name, offset) \ + { \ + .name = #pg_name, \ + .pins = pg_name##_pins, \ + .npins = (unsigned int)ARRAY_SIZE(pg_name##_pins), \ + .ctl_reg = offset, \ + .io_reg = offset + 0x4, \ + .intr_cfg_reg = 0, \ + .intr_status_reg = 0, \ + .intr_target_reg = 0, \ + .mux_bit = -1, \ + .pull_bit = 3, \ + .drv_bit = 0, \ + .oe_bit = -1, \
drivers/pinctrl/qcom/pinctrl-msm8998.c line 119
Quoted 10 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +10
-0+ .in_bit = -1, \ + .out_bit = 0, \ + .intr_enable_bit = -1, \ + .intr_status_bit = -1, \ + .intr_target_bit = -1, \ + .intr_raw_status_bit = -1, \ + .intr_polarity_bit = -1, \ + .intr_detection_bit = -1, \ + .intr_detection_width = -1, \ + }
Please add an empty line here.
Quoted 1 line
+static const struct
pinctrl_pin_descmsm8998_pins[] = {
[..]
Quoted 1 line
+enum
msm8998_functions{
[..]
drivers/pinctrl/qcom/pinctrl-msm8998.c line 665
Quoted 4 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +4
-0+ msm_mux_phase_flag6, + msm_mux_phase_flag29, + msm_mux_phase_flag30, + msm_mux_phase_flag31,
With the Qualcomm pinctrl driver it's possible to specify configuration in DT for a subset of pins of a group. So I think you should squash the "phase_flag"s and "atest_char" into one group each.
Quoted 7 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +7
-0+ msm_mux_pa_indicator, + msm_mux_ssbi1, + msm_mux_isense_dbg, + msm_mux_mss_lte, + msm_mux_gpio, + msm_mux_NA, +};
[..]
drivers/pinctrl/qcom/pinctrl-msm8998.c line 1644
Quoted 3 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +3
-0+static const struct msm_pingroup msm8998_groups[] = { +PINGROUP (0 ,EAST , blsp_spi1, blsp_uart1_a, blsp_uim1_a,NA ,NA ,NA ,NA , +NA ,NA ),
Please do ignore the 80-char "rule" and skip the line break on these - it makes the table easier to read.
[..]
drivers/pinctrl/qcom/pinctrl-msm8998.c line 1896
Quoted 10 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +10
-0+}; + +static const struct msm_pinctrl_soc_data msm8998_pinctrl = { + .pins = msm8998_pins, + .npins =ARRAY_SIZE (msm8998_pins), + .functions = msm8998_functions, + .nfunctions =ARRAY_SIZE (msm8998_functions), + .groups = msm8998_groups, + .ngroups =ARRAY_SIZE (msm8998_groups), + .ngpios =153 ,
ngpios is 150
drivers/pinctrl/qcom/pinctrl-msm8998.c
Quoted 2 lines
drivers/pinctrl/qcom/pinctrl-msm8998.c +2
-0+}; +
Regards,
Bjorn