Skip to contentSkip to conversation

Add Combo PHY driver for HiSilicon STB SoCs

PATCH Superseded Shawn Guo 2 participants 6 messages Oct 30, 2017 – Nov 2, 2017

Subsystems (2)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

v5 cover Add Combo PHY driver for HiSilicon STB SoCs

From: Shawn Guo <[email protected]>

It adds device tree bindings and driver support for Combo PHY device which can be found on HiSilicon STB SoCs.

Changes for v5:
- Add bindings doc for Hi3798CV200 peripheral controller, and refer to the bindings of this parent node in combphy bindings doc.

Changes for v4:
- Instead of relying on device id, add a new property hisilicon,fixed-mode for combphy device that doesn't support mode select but a fixed phy mode.
- Move combphy mode select register bits definition to device tree, as it may vary from one device to another.

Changes for v3:
- Make combphy device be child of peripheral controller and use 'reg' property for mapping combphy configuration registers.
- Kill "hisilicon,peripheral-syscon" property, since parent node is just the syscon controller now.
- Check combphy id to handle the quirk that combphy0 can not configure mode but always works in USB3 mode.
- Unify phy .init and .exit hooks for different combphy instances and work modes, as the only quirk we need to handle is that combphy0 can only work in USB3 mode.
- Better naming for clock and reset, 'ref' to 'ref_clk', 'por' to 'por_rst'.

Changes for v2:
- Move DT bindings into a separate patch.
- Drop the spurious newline from drivers/phy/Makefile.
- Use the phy type defines in dt-bindings/phy/phy.h.
- Use PTR_ERR_OR_ZERO() for checking return from devm_of_phy_provider_register().
- Add USB3 phy support.

Jianguo Sun (2):
dt-bindings: add bindings doc for hi3798cv200 combphy
phy: add combo phy driver for HiSilicon STB SoCs

Shawn Guo (1):
dt-bindings: hisilicon: add doc for Hi3798CV200 peripheral controller

 .../bindings/arm/hisilicon/hisilicon.txt           |  23 ++
 .../bindings/phy/phy-hi3798cv200-combphy.txt       |  59 +++++
 drivers/phy/hisilicon/Kconfig                      |   9 +
 drivers/phy/hisilicon/Makefile                     |   1 +
 drivers/phy/hisilicon/phy-histb-combphy.c          | 289 +++++++++++++++++++++
 5 files changed, 381 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-hi3798cv200-combphy.txt
 create mode 100644 drivers/phy/hisilicon/phy-histb-combphy.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v5 1/3 dt-bindings: hisilicon: add doc for Hi3798CV200 peripheral controller

From: Shawn Guo <[email protected]>

It adds bindings doc for Hi3798CV200 peripheral controller.

---
 .../bindings/arm/hisilicon/hisilicon.txt           | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +23 -0
index 7111fbc82a4e..199cd36fe1ba 100644
@@ -75,6 +75,29 @@ Example:
 	};
 
 -----------------------------------------------------------------------
+Hisilicon Hi3798CV200 Peripheral Controller
+
+The Hi3798CV200 Peripheral Controller controls peripherals, queries
+their status, and configures some functions of peripherals.
+
+Required properties:
+- compatible: Should contain "hisilicon,hi3798cv200-perictrl", "syscon"
+  and "simple-mfd".
+- reg: Register address and size of Peripheral Controller.
+- #address-cells: Should be 1.
+- #size-cells: Should be 1.
+
+Examples:
+
+	perictrl: peripheral-controller at 8a20000 {
+		compatible = "hisilicon,hi3798cv200-perictrl", "syscon",
+			     "simple-mfd";
+		reg = <0x8a20000 0x1000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+	};
+
+-----------------------------------------------------------------------
 Hisilicon Hi6220 system controller
 
 Required properties:
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v5 2/3 dt-bindings: add bindings doc for hi3798cv200 combphy

In reply to Shawn Guo

From: Jianguo Sun <[email protected]>

It adds the device tree bindings for PCIE/SATA/USB3 combo PHY found on HiSilicon STB SoCs.

---
 .../bindings/phy/phy-hi3798cv200-combphy.txt       | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-hi3798cv200-combphy.txt
Documentation/devicetree/bindings/phy/phy-hi3798cv200-combphy.txt new file +59 -0
new file mode 100644
index 000000000000..17b0c761370a
@@ -0,0 +1,59 @@
+HiSilicon STB PCIE/SATA/USB3 PHY
+
+Required properties:
+- compatible: Should be "hisilicon,hi3798cv200-combphy"
+- reg: Should be the address space for COMBPHY configuration and state
+  registers in peripheral controller, e.g. PERI_COMBPHY0_CFG and
+  PERI_COMBPHY0_STATE for COMBPHY0 Hi3798CV200 SoC.
+- #phy-cells: Should be 1.  The cell number is used to select the phy mode
+  as defined in <dt-bindings/phy/phy.h>.
+- clocks: The phandle to clock provider and clock specifier pair.
+- resets: The phandle to reset controller and reset specifier pair.
+
+Refer to phy/phy-bindings.txt for the generic PHY binding properties.
+
+Optional properties:
+- hisilicon,fixed-mode: If the phy device doesn't support mode select
+  but a fixed mode setting, the property should be present to specify
+  the particular mode.
+- hisilicon,mode-select-bits: If the phy device support mode select,
+  this property should be present to specify the register bits in
+  peripheral controller, as a 3 integers tuple:
+  <register_offset bit_shift bit_mask>.
+
+Notes:
+- Between hisilicon,fixed-mode and hisilicon,mode-select-bits, one and only
+  one of them should be present.
+- The device node should be a child of peripheral controller that contains
+  COMBPHY configuration/state and PERI_CTRL register used to select PHY mode.
+  Refer to arm/hisilicon/hisilicon.txt for the parent peripheral controller
+  bindings.
+
+Examples:
+
+perictrl: peripheral-controller at 8a20000 {
+	compatible = "hisilicon,hi3798cv200-perictrl", "syscon",
+		     "simple-mfd";
+	reg = <0x8a20000 0x1000>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+	ranges = <0x0 0x8a20000 0x1000>;
+
+	combphy0: phy at 850 {
+		compatible = "hisilicon,hi3798cv200-combphy";
+		reg = <0x850 0x8>;
+		#phy-cells = <1>;
+		clocks = <&crg HISTB_COMBPHY0_CLK>;
+		resets = <&crg 0x188 4>;
+		hisilicon,fixed-mode = <PHY_TYPE_USB3>;
+	};
+
+	combphy1: phy at 858 {
+		compatible = "hisilicon,hi3798cv200-combphy";
+		reg = <0x858 0x8>;
+		#phy-cells = <1>;
+		clocks = <&crg HISTB_COMBPHY1_CLK>;
+		resets = <&crg 0x188 12>;
+		hisilicon,mode-select-bits = <0x0008 11 (0x3 << 11)>;
+	};
+};
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v5 3/3 phy: add combo phy driver for HiSilicon STB SoCs

In reply to Shawn Guo

From: Jianguo Sun <[email protected]>

Add combo phy driver for HiSilicon STB SoCs. This phy can be used as pcie-phy, sata-phy or usb-phy.

---
 drivers/phy/hisilicon/Kconfig             |   9 +
 drivers/phy/hisilicon/Makefile            |   1 +
 drivers/phy/hisilicon/phy-histb-combphy.c | 289 ++++++++++++++++++++++++++++++
 3 files changed, 299 insertions(+)
 create mode 100644 drivers/phy/hisilicon/phy-histb-combphy.c
drivers/phy/hisilicon/Kconfig +9 -0
index 6164c4cd0f65..d9afe2b12827 100644
@@ -11,6 +11,15 @@ config PHY_HI6220_USB
 
 	  To compile this driver as a module, choose M here.
 
+config PHY_HISTB_COMBPHY
+	tristate "HiSilicon STB SoCs COMBPHY support"
+	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Enable this to support the HISILICON STB SoCs COMBPHY.
+	  If unsure, say N.
+
 config PHY_HIX5HD2_SATA
 	tristate "HIX5HD2 SATA PHY Driver"
 	depends on ARCH_HIX5HD2 && OF && HAS_IOMEM
drivers/phy/hisilicon/Makefile +1 -0
index 541b348187a8..5e8e2dfa8c37 100644
@@ -1,2 +1,3 @@
 obj-$(CONFIG_PHY_HI6220_USB)		+= phy-hi6220-usb.o
+obj-$(CONFIG_PHY_HISTB_COMBPHY)		+= phy-histb-combphy.o
 obj-$(CONFIG_PHY_HIX5HD2_SATA)		+= phy-hix5hd2-sata.o
drivers/phy/hisilicon/phy-histb-combphy.c new file +289 -0

289 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#5 lore raw

v5 cover Add Combo PHY driver for HiSilicon STB SoCs

In reply to Shawn Guo

Hi Kishon,

Quoted 6 lines · Shawn Guo

Jianguo Sun (2):
dt-bindings: add bindings doc for hi3798cv200 combphy
phy: add combo phy driver for HiSilicon STB SoCs

Shawn Guo (1):
dt-bindings: hisilicon: add doc for Hi3798CV200 peripheral controller

Is it still possible to get this series into 4.15 merge window?

Shawn