Introduce GENI SE Controller Driver
Subsystems (5)
v7 cover Introduce GENI SE Controller Driver
Generic Interface (GENI) firmware based Qualcomm Universal Peripheral (QUP) Wrapper is a next generation programmable module for supporting a wide range of serial interfaces like UART, SPI, I2C, I3C, etc. A single QUP module can provide upto 8 Serial Interfaces using its internal Serial Engines (SE). The protocol supported by each interface is determined by the firmware loaded to the Serial Engine.
This patch series introduces GENI SE Driver to manage the GENI based QUP Wrapper and the common aspects of all SEs inside the QUP Wrapper. This patch series also introduces the UART and I2C Controller drivers to drive the SEs that are programmed with the respective protocols.
[v7]
* Return appropriate error codes as idenitified in i2c fault-codes
* Add Maintainer details for I2C controller driver
* Fix an incorrect conditional check in DMA mode
* Drop the patches in the series that got accepted
[v6]
* Move the I2C clock-frequency configuration to the SDM845 board file
* Remove a redundant comment in the I2C driver
[v5]
* Remove Linux specific property from the device tree binding
* Clarify I2C SCL time period documentation
* Remove redundant checks in I2C controller driver during timeout
* Use 100kHz as the default clock frequency in the I2C controller driver
* Disable Wrapper controller by default in the SDM845 device tree and enable it explicitly for SDM845 MTP
* Specify I2C clock frequency in the SDM845 device tree
* Remove bias configuration for I2C pins under sleep state in device tree
* Drop the serial driver from the patch series since it is merged
* Specify the UART port options in the SDM845 device tree
[v4]
* Add SPI controller information in device tree binding
* Add support for debug UART & I2C controllers in SDM845 device tree
* Remove any unnecessary parenthesis & casting
* Identify break character in UART line and pass it to the framework
* Transmit data from fault handler reliably in debug UART
* Map the register block when the UART port is requested
* Move concise exported functions as macros or inlines in public header
* Move the clock performance table from the wrapper to serial engines
* Add a lock to synchronize between IRQ & error handling in I2C controller
* Remove any compiler optimization hints like likely/unlikely
* Update documentation to clarify tables and hardware blocks
[v3]
* Update the driver dependencies
* Use the SPDX License Expression
* Squash all the controller device tree bindings together
* Use kernel doc format for documentation
* Add additional documentation for packing configuration
* Use clk_bulk_* API for related clocks
* Remove driver references to pinctrl and their states
* Replace magic numbers with appropriate macros
* Update memory barrier usage and associated comments
* Reduce interlacing of register reads/writes
* Fix poll_get_char() operation in console UART driver under polling mode
* Address other comments from Bjorn Andersson to improve code readability
[v2]
* Updated device tree bindings to describe the hardware
* Updated SE DT node as child node of QUP Wrapper DT node
* Moved common AHB clocks to QUP Wrapper DT node
* Use the standard "clock-frequency" I2C property
* Update compatible field in UART Controller to reflect hardware manual
* Addressed other device tree binding specific comments from Rob Herring
Karthikeyan Ramasubramanian (3):
i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C
controller
MAINTAINERS: Add Qualcomm Generic Interface I2C driver maintainer
arm64: dts: sdm845: Add support for an instance of I2C controller
Rajendra Nayak (1):
arm64: dts: sdm845: Add serial console support
MAINTAINERS | 8 + arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 60 +++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 67 ++++ drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-qcom-geni.c | 649 ++++++++++++++++++++++++++++++++ 6 files changed, 798 insertions(+) create mode 100644 drivers/i2c/busses/i2c-qcom-geni.c
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 1/4 i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
This bus driver supports the GENI based i2c hardware controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including I2C. The driver supports FIFO mode and DMA mode of transfer and switches modes dynamically depending on the size of the transfer.
--- drivers/i2c/busses/Kconfig | 13 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-qcom-geni.c | 649 +++++++++++++++++++++++++++++++++++++ 3 files changed, 663 insertions(+) create mode 100644 drivers/i2c/busses/i2c-qcom-geni.c
drivers/i2c/busses/Kconfig +13 -0
@@ -828,6 +828,19 @@ config I2C_PXA_SLAVE is necessary for systems where the PXA may be a target on the I2C bus. +config I2C_QCOM_GENI + tristate "Qualcomm Technologies Inc.'s GENI based I2C controller" + depends on ARCH_QCOM || COMPILE_TEST + depends on QCOM_GENI_SE + help + This driver supports GENI serial engine based I2C controller in + master mode on the Qualcomm Technologies Inc.'s SoCs. If you say + yes to this option, support will be included for the built-in I2C + interface on the Qualcomm Technologies Inc.'s SoCs. + + This driver can also be built as a module. If so, the module + will be called i2c-qcom-geni. + config I2C_QUP tristate "Qualcomm QUP based I2C controller" depends on ARCH_QCOM
drivers/i2c/busses/Makefile +1 -0
@@ -83,6 +83,7 @@ obj-$(CONFIG_I2C_PNX) += i2c-pnx.o obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o obj-$(CONFIG_I2C_PXA) += i2c-pxa.o obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o +obj-$(CONFIG_I2C_QCOM_GENI) += i2c-qcom-geni.o obj-$(CONFIG_I2C_QUP) += i2c-qup.o obj-$(CONFIG_I2C_RIIC) += i2c-riic.o obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o
drivers/i2c/busses/i2c-qcom-geni.c new file +649 -0
649 lines not on this page · raw message
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 2/4 MAINTAINERS: Add Qualcomm Generic Interface I2C driver maintainer
In reply to Karthikeyan RamasubramanianAdd Alok Chauhan and myself as maintainers for Qualcomm GENI I2C master controller driver.
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -11814,6 +11814,14 @@ L: [email protected] S: Supported F: drivers/net/ethernet/qualcomm/emac/ +QUALCOMM GENERIC INTERFACE I2C DRIVER +M: Alok Chauhan <[email protected]> +M: Karthikeyan Ramasubramanian <[email protected]> +L: [email protected] +L: [email protected] +S: Supported +F: drivers/i2c/busses/i2c-qcom-geni.c + QUALCOMM HEXAGON ARCHITECTURE M: Richard Kuo <[email protected]> L: [email protected]
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 3/4 arm64: dts: sdm845: Add serial console support
In reply to Karthikeyan RamasubramanianFrom: Rajendra Nayak <[email protected]>
Add the qup uart node and geni se instance needed to support the serial console on the MTP.
--- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 41 +++++++++++++++++++++++++++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 39 +++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-mtp.dts +41 -0
@@ -12,4 +12,45 @@ / { model = "Qualcomm Technologies, Inc. SDM845 MTP"; compatible = "qcom,sdm845-mtp"; + + aliases { + serial0 = &uart2; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +}; + +&soc { + geniqup@ac0000 { + status = "okay"; + + serial@a84000 { + status = "okay"; + }; + }; + + pinctrl@3400000 { + qup-uart2-default { + pinconf_tx { + pins = "gpio4"; + drive-strength = <2>; + bias-disable; + }; + + pinconf_rx { + pins = "gpio5"; + drive-strength = <2>; + bias-pull-up; + }; + }; + + qup-uart2-sleep { + pinconf { + pins = "gpio4", "gpio5"; + bias-pull-down; + }; + }; + }; };
arch/arm64/boot/dts/qcom/sdm845.dtsi +39 -0
@@ -6,6 +6,7 @@ */ #include <dt-bindings/interrupt-controller/arm-gic.h> +#include <dt-bindings/clock/qcom,gcc-sdm845.h> / { interrupt-parent = <&intc>;
@@ -194,6 +195,20 @@ #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; + + qup_uart2_default: qup-uart2-default { + pinmux { + function = "qup9"; + pins = "gpio4", "gpio5"; + }; + }; + + qup_uart2_sleep: qup-uart2-sleep { + pinmux { + function = "gpio"; + pins = "gpio4", "gpio5"; + }; + }; }; timer@17c90000 {
@@ -272,5 +287,29 @@ #interrupt-cells = <4>; cell-index = <0>; }; + + geniqup@ac0000 { + compatible = "qcom,geni-se-qup"; + reg = <0xac0000 0x6000>; + clock-names = "m-ahb", "s-ahb"; + clocks = <&gcc GCC_QUPV3_WRAP_1_M_AHB_CLK>, + <&gcc GCC_QUPV3_WRAP_1_S_AHB_CLK>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + uart2: serial@a84000 { + compatible = "qcom,geni-debug-uart"; + reg = <0xa84000 0x4000>; + clock-names = "se"; + clocks = <&gcc GCC_QUPV3_WRAP1_S1_CLK>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&qup_uart2_default>; + pinctrl-1 = <&qup_uart2_sleep>; + interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + }; }; };
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 4/4 arm64: dts: sdm845: Add support for an instance of I2C controller
In reply to Karthikeyan RamasubramanianAdd one instance of GENI based I2C master controller to enable testing I2C driver using EEPROM slave.
--- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 19 +++++++++++++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-mtp.dts +19 -0
@@ -29,9 +29,28 @@ serial@a84000 { status = "okay"; }; + + i2c@a88000 { + clock-frequency = <400000>; + status = "okay"; + }; }; pinctrl@3400000 { + qup-i2c10-default { + pinconf { + pins = "gpio55", "gpio56"; + drive-strength = <2>; + bias-disable; + }; + }; + + qup-i2c10-sleep { + pinconf { + pins = "gpio55", "gpio56"; + }; + }; + qup-uart2-default { pinconf_tx { pins = "gpio4";
arch/arm64/boot/dts/qcom/sdm845.dtsi +28 -0
@@ -196,6 +196,20 @@ interrupt-controller; #interrupt-cells = <2>; + qup_i2c10_default: qup-i2c10-default { + pinmux { + function = "qup10"; + pins = "gpio55", "gpio56"; + }; + }; + + qup_i2c10_sleep: qup-i2c10-sleep { + pinmux { + function = "gpio"; + pins = "gpio55", "gpio56"; + }; + }; + qup_uart2_default: qup-uart2-default { pinmux { function = "qup9";
@@ -310,6 +324,20 @@ interrupts = <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>; status = "disabled"; }; + + i2c10: i2c@a88000 { + compatible = "qcom,geni-i2c"; + reg = <0xa88000 0x4000>; + clock-names = "se"; + clocks = <&gcc GCC_QUPV3_WRAP1_S2_CLK>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&qup_i2c10_default>; + pinctrl-1 = <&qup_i2c10_sleep>; + interrupts = <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; }; };
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v7 1/4] i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
In reply to Karthikeyan RamasubramanianQuoting Karthikeyan Ramasubramanian (2018-06-12 10:09:05)
Quoted 11 lines
This bus driver supports the GENI based i2c hardware controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including I2C. The driver supports FIFO mode and DMA mode of transfer and switches modes dynamically depending on the size of the transfer.
Signed-off-by Karthikeyan Ramasubramanian <[email protected]>Signed-off-by Sagar Dharia <[email protected]>Signed-off-by Girish Mahadevan <[email protected]>Reviewed-by Douglas Anderson <[email protected]>---
Re: [PATCH v7 3/4] arm64: dts: sdm845: Add serial console support
In reply to Karthikeyan RamasubramanianHi,
Quoted 11 lines · Karthikeyan Ramasubramanian
From: Rajendra Nayak <[email protected]>
Add the qup uart node and geni se instance needed to support the serial console on the MTP.
Signed-off-by Rajendra Nayak <[email protected]>Signed-off-by Karthikeyan Ramasubramanian <[email protected]>--- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 41 +++++++++++++++++++++++++++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 39 +++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+)
I've posted <https://patchwork.kernel.org/patch/10462687/> which already includes these nodes plus ones for other QUP peripherals. Please feel free to comment on that patch. A few notes about that patch compared to this one:
1. Label is uart9, not uart2. No idea where the 2 came from.
2. No sleep pinconf states. For SPI they were definitely causing problems. When I looked deeper into it it became unclear to me what the point of all this remuxing is. Right now you are selecting the "sleep" state in the geni code for runtime PM but nothing (yet) is actually power gating the QUPs, so the pinmux isn't doing a whole lot. Even if you power gate the QUPs there shouldn't be any reason (that I'm aware of) to remux.
-Doug
Re: [PATCH v7 4/4] arm64: dts: sdm845: Add support for an instance of I2C controller
In reply to Karthikeyan RamasubramanianHi,
Quoted 9 lines · Karthikeyan Ramasubramanian
Add one instance of GENI based I2C master controller to enable testing I2C driver using EEPROM slave.
Signed-off-by Karthikeyan Ramasubramanian <[email protected]>Reviewed-by Douglas Anderson <[email protected]>--- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 19 +++++++++++++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)
Similar for to patch #3 in this series, let's move the discussion to
<https://patchwork.kernel.org/patch/10462687/> and
<https://patchwork.kernel.org/patch/10462683/>.
-Doug
Re: [PATCH v7 1/4] i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
In reply to Karthikeyan RamasubramanianQuoted 10 lines · Karthikeyan Ramasubramanian
This bus driver supports the GENI based i2c hardware controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including I2C. The driver supports FIFO mode and DMA mode of transfer and switches modes dynamically depending on the size of the transfer.
Signed-off-by Karthikeyan Ramasubramanian <[email protected]>Signed-off-by Sagar Dharia <[email protected]>Signed-off-by Girish Mahadevan <[email protected]>Reviewed-by Douglas Anderson <[email protected]>
Looks good except one minor thing:
drivers/i2c/busses/i2c-qcom-geni.c line 579
Quoted 7 lines
drivers/i2c/busses/i2c-qcom-geni.c new file +7
-0+pm_runtime_set_suspended (gi2c->se.dev); +pm_runtime_set_autosuspend_delay (gi2c->se.dev,I2C_AUTO_SUSPEND_DELAY ); +pm_runtime_use_autosuspend (gi2c->se.dev); +pm_runtime_enable (gi2c->se.dev); +i2c_add_adapter (&gi2c->adap); + +return 0 ;
i2c_add_adapter can fail. So, I'd guess you want to check the return value and move it above the pm_runtime calls?
Re: [PATCH v7 1/4] i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
Quoted 14 lines · Wolfram Sang
Quoted 10 lines · Karthikeyan Ramasubramanian
This bus driver supports the GENI based i2c hardware controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including I2C. The driver supports FIFO mode and DMA mode of transfer and switches modes dynamically depending on the size of the transfer.
Signed-off-by Karthikeyan Ramasubramanian <[email protected]>Signed-off-by Sagar Dharia <[email protected]>Signed-off-by Girish Mahadevan <[email protected]>Reviewed-by Douglas Anderson <[email protected]>Looks good except one minor thing:
Quoted 11 lines
drivers/i2c/busses/i2c-qcom-geni.c line 579
Quoted 7 lines
drivers/i2c/busses/i2c-qcom-geni.c new file +7
-0+pm_runtime_set_suspended (gi2c->se.dev); +pm_runtime_set_autosuspend_delay (gi2c->se.dev,I2C_AUTO_SUSPEND_DELAY ); +pm_runtime_use_autosuspend (gi2c->se.dev); +pm_runtime_enable (gi2c->se.dev); +i2c_add_adapter (&gi2c->adap); + +return 0 ;
i2c_add_adaptercan fail. So, I'd guess you want to check the return value and move it above thepm_runtimecalls?
Sure, I will update and upload a new patchset.
Regards,
Karthik.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project