USB3 support for Broadcom NS2 SoC
Subsystems (3)
v2 cover USB3 support for Broadcom NS2 SoC
Changes in v2:
* Addressed Rob Herring's comments on the binding documentation, which resulted in a restructing of the device tree and how the driver references those nodes. This, in turn, resulted in a few new documentation files being created.
This patch set contains the USB3 support for Broadcom NS2 SoC. The USB3 PHY is connected through the MDIO interface.
Jon Mason (3):
dt-bindings: usb: Add documentation for NS2 CDRU USB3
dt-bindings: usb: Add documentation for NS2 ICFG USB3
dt-bindings: usb: Add documentation for NS2 IDM USB3
Yendapally Reddy Dhananjaya Reddy (3):
dt-bindings: phy: Add documentation for NS2 USB3 PHY
phy: Add USB3 PHY support for Broadcom NS2 SoC
arm64: dts: ns2: Add USB3 Support
.../devicetree/bindings/phy/brcm,ns2-usb3-phy.txt | 48 ++ .../bindings/usb/brcm,cdru-usb3-ctrl.txt | 14 + .../devicetree/bindings/usb/brcm,icfg-usb.txt | 13 + .../devicetree/bindings/usb/brcm,usb3-idm.txt | 14 + arch/arm64/boot/dts/broadcom/ns2-svk.dts | 16 + arch/arm64/boot/dts/broadcom/ns2-xmc.dts | 8 + arch/arm64/boot/dts/broadcom/ns2.dtsi | 59 +++ drivers/phy/broadcom/Kconfig | 9 + drivers/phy/broadcom/Makefile | 1 + drivers/phy/broadcom/phy-bcm-ns2-usb3.c | 580 +++++++++++++++++++++ 10 files changed, 762 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt create mode 100644 Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt create mode 100644 Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt create mode 100644 Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt create mode 100644 drivers/phy/broadcom/phy-bcm-ns2-usb3.c
Signature · 1 line
2.7.4
PATCH v2 1/6 dt-bindings: phy: Add documentation for NS2 USB3 PHY
From: Yendapally Reddy Dhananjaya Reddy <[email protected]>
Add documentation for USB3 PHY available in NS2 SoC
--- .../devicetree/bindings/phy/brcm,ns2-usb3-phy.txt | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt new file +48 -0
@@ -0,0 +1,48 @@ +Broadcom USB3 dual port phy for Northstar2 SoC +This is a child bus node of "brcm,mdio-mux-iproc" node. + +Required mdio bus properties: +- reg: MDIO Bus number for the MDIO interface +- #address-cells: must be 1 +- #size-cells: must be 0 + +Required PHY properties: +- compatible: should be "brcm,ns2-usb3-phy" +- reg: MDIO Phy ID for the MDIO interface +- #phy-cells: must be 0 +- #address-cells: must be 1 +- #size-cells: must be 0 + +Sub-nodes: + Each port's PHY should be represented as a sub-node. + +Sub-nodes required properties: + - reg: the PHY number + - phy-cells: from the generic PHY bindings, must be 0 + +Example: + +mdio at 1 { + reg = <0x1>; + #address-cells = <1>; + #size-cells = <0>; + + usb3_phy: usb3_phy at 0 { + compatible = "brcm,ns2-usb3-phy"; + reg = <0x0>; + #address-cells = <1>; + #size-cells = <0>; + + usb3_phy0: usb3_phy at 0 { + reg = <0>; + #phy-cells = <0>; + status = "disabled"; + }; + + usb3_phy1: usb_phy at 1 { + reg = <1>; + #phy-cells = <0>; + status = "disabled"; + }; + }; +};
Signature · 1 line
2.7.4
Re: [PATCH v2 1/6] dt-bindings: phy: Add documentation for NS2 USB3 PHY
Quoted 37 lines · Jon Mason
From: Yendapally Reddy Dhananjaya Reddy <[email protected]>
Add documentation for USB3 PHY available in NS2 SoC
Signed-off-by Yendapally Reddy Dhananjaya Reddy <[email protected]>Signed-off-by Jon Mason <[email protected]>--- .../devicetree/bindings/phy/brcm,ns2-usb3-phy.txt | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txtDocumentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt new file +20
-0@@ -0,0 +1,48 @@ +Broadcom USB3 dual port phy for Northstar2 SoC +This is a child bus node of "brcm,mdio-mux-iproc" node. + +Required mdio bus properties: +- reg: MDIO Bus number for the MDIO interface +- #address-cells: must be 1 +- #size-cells: must be 0 + +Required PHY properties: +- compatible: should be "brcm,ns2-usb3-phy" +- reg: MDIO Phy ID for the MDIO interface +- #phy-cells: must be 0 +- #address-cells: must be 1 +- #size-cells: must be 0 + +Sub-nodes: + Each port's PHY should be represented as a sub-node. + +Sub-nodes required properties: + - reg: the PHY number
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt line 30
Quoted 10 lines
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt new file +10
-0+ - phy-cells: from the generic PHY bindings, must be 0 + +Example: + +mdio at 1 { + reg = <0x1>; + #address-cells = <1>; + #size-cells = <0>; + + usb3_phy: usb3_phy at 0 {
usb3-phy at 0
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt line 39
Quoted 9 lines
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt new file +9
-0+ compatible = "brcm,ns2-usb3-phy"; + reg = <0x0>; + #address-cells = <1>; + #size-cells = <0>; + + usb3_phy0: usb3_phy at 0 { + reg = <0>; + #phy-cells = <0>; + status = "disabled";
Don't show status in examples.
With those nits fixed,
Quoted 12 lines
Documentation/devicetree/bindings/phy/brcm,ns2-usb3-phy.txt new file +9
-0+ }; + + usb3_phy1: usb_phy at 1 { + reg = <1>; + #phy-cells = <0>; + status = "disabled"; + }; + }; +};Signature · 1 line
2.7.4
PATCH v2 2/6 dt-bindings: usb: Add documentation for NS2 CDRU USB3
In reply to Jon MasonAdd documentation for CDRU USB3 registers available in NS2 SoC
--- .../devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt
Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt new file +14 -0
@@ -0,0 +1,14 @@ +Broadcom Chip Device Resource Unit USB3 register + +Required properties: +- compatible: "brcm,cdru-usb3-ctrl" +- reg: Base address and length of the USB registers + + +Example: + +cdru_usb3_ctrl: cdru_usb3_ctrl at 6501d144 { + compatible = "brcm,cdru-usb3-ctrl"; + reg = <0x6501d144 0x4>; +}; +
Signature · 1 line
2.7.4
Re: [PATCH v2 2/6] dt-bindings: usb: Add documentation for NS2 CDRU USB3
Quoted 14 lines · Jon Mason
Add documentation for CDRU USB3 registers available in NS2 SoC
Signed-off-by Jon Mason <[email protected]>--- .../devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txtDocumentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt new file +0
-0
Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt new file +10
-0@@ -0,0 +1,14 @@ +Broadcom Chip Device Resource Unit USB3 register + +Required properties: +- compatible: "brcm,cdru-usb3-ctrl" +- reg: Base address and length of the USB registers + + +Example: + +cdru_usb3_ctrl: cdru_usb3_ctrl at 6501d144 {
s/_/-/
With that,
Quoted 7 lines
Documentation/devicetree/bindings/usb/brcm,cdru-usb3-ctrl.txt new file +4
-0+ compatible = "brcm,cdru-usb3-ctrl"; + reg = <0x6501d144 0x4>; +}; +Signature · 1 line
2.7.4
PATCH v2 3/6 dt-bindings: usb: Add documentation for NS2 ICFG USB3
In reply to Jon MasonAdd documentation for ICFG USB3 registers available in NS2 SoC
--- Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt
Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt new file +13 -0
@@ -0,0 +1,13 @@ +Broadcom ICFG USB3 registers + +Required properties: +- compatible: "brcm,icfg-usb" +- reg: Base address and length of the USB registers + + +Example: + +icfg_usb3: icfg_usb3 at 66000900 { + compatible = "brcm,icfg-usb"; + reg = <0x66000900 0x60>; +};
Signature · 1 line
2.7.4
Re: [PATCH v2 3/6] dt-bindings: usb: Add documentation for NS2 ICFG USB3
Quoted 15 lines · Jon Mason
Add documentation for ICFG USB3 registers available in NS2 SoC
Signed-off-by Jon Mason <[email protected]>--- Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,icfg-usb.txtDocumentation/devicetree/bindings/usb/brcm,icfg-usb.txt new file +1
-0@@ -0,0 +1,13 @@ +Broadcom ICFG USB3 registers
Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt line 11
Quoted 10 lines
Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt new file +10
-0+ +Required properties: +- compatible: "brcm,icfg-usb" +- reg: Base address and length of the USB registers + + +Example: + +icfg_usb3: icfg_usb3 at 66000900 { + compatible = "brcm,icfg-usb";
s/_/-/
With that,
Quoted 5 lines
Documentation/devicetree/bindings/usb/brcm,icfg-usb.txt new file +2
-0+ reg = <0x66000900 0x60>; +};Signature · 1 line
2.7.4
PATCH v2 4/6 dt-bindings: usb: Add documentation for NS2 IDM USB3
In reply to Jon MasonAdd documentation for IDM USB3 registers available in NS2 SoC
--- Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt
Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt new file +14 -0
@@ -0,0 +1,14 @@ +Broadcom IDM USB3 registers + +Required properties: +- compatible: "brcm,usb3-idm" +- reg: Base address and length of the USB registers + + +Example: + +usb3_idm: idm at 67000000 { + compatible = "brcm,usb3-idm"; + reg = <0x67000000 0x2000>; +}; +
Signature · 1 line
2.7.4
Re: [PATCH v2 4/6] dt-bindings: usb: Add documentation for NS2 IDM USB3
Quoted 14 lines · Jon Mason
Add documentation for IDM USB3 registers available in NS2 SoC
Signed-off-by Jon Mason <[email protected]>--- Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/brcm,usb3-idm.txtDocumentation/devicetree/bindings/usb/brcm,usb3-idm.txt new file +0
-0
Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt line 10
Quoted 10 lines
Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt new file +10
-0@@ -0,0 +1,14 @@ +Broadcom IDM USB3 registers + +Required properties: +- compatible: "brcm,usb3-idm" +- reg: Base address and length of the USB registers + + +Example: + +usb3_idm: idm at 67000000 {
I'm assuming these are all some misc registers in addition to the USB controller? If this is the USB controller itself, then use generic node names for the DT spec.
Quoted 7 lines
Documentation/devicetree/bindings/usb/brcm,usb3-idm.txt new file +4
-0+ compatible = "brcm,usb3-idm"; + reg = <0x67000000 0x2000>; +}; +Signature · 1 line
2.7.4
PATCH v2 5/6 phy: Add USB3 PHY support for Broadcom NS2 SoC
In reply to Jon MasonFrom: Yendapally Reddy Dhananjaya Reddy <[email protected]>
This patch adds support for Broadcom NS2 USB3 PHY
--- drivers/phy/broadcom/Kconfig | 9 + drivers/phy/broadcom/Makefile | 1 + drivers/phy/broadcom/phy-bcm-ns2-usb3.c | 580 ++++++++++++++++++++++++++++++++ 3 files changed, 590 insertions(+) create mode 100644 drivers/phy/broadcom/phy-bcm-ns2-usb3.c
drivers/phy/broadcom/Kconfig +9 -0
@@ -45,6 +45,15 @@ config PHY_NS2_PCIE Enable this to support the Broadcom Northstar2 PCIe PHY. If unsure, say N. +config PHY_NS2_USB3 + tristate "Broadcom NorthStar2 USB3 PHY driver" + depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST) + select GENERIC_PHY + default ARCH_BCM_IPROC + help + Enable this to support the Broadcom Northstar2 USB3 PHY. + If unsure, say N. + config PHY_NS2_USB_DRD tristate "Broadcom Northstar2 USB DRD PHY support" depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/phy/broadcom/Makefile +1 -0
@@ -3,5 +3,6 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB3) += phy-bcm-ns-usb3.o obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o +obj-$(CONFIG_PHY_NS2_USB3) += phy-bcm-ns2-usb3.o obj-$(CONFIG_PHY_NS2_USB_DRD) += phy-bcm-ns2-usbdrd.o obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.o
drivers/phy/broadcom/phy-bcm-ns2-usb3.c new file +580 -0
580 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 5/6] phy: Add USB3 PHY support for Broadcom NS2 SoC
Hi,
Quoted 18 lines · Jon Mason
From: Yendapally Reddy Dhananjaya Reddy <[email protected]>
This patch adds support for Broadcom NS2 USB3 PHY
Signed-off-by Yendapally Reddy Dhananjaya Reddy <[email protected]>Signed-off-by Jon Mason <[email protected]>--- drivers/phy/broadcom/Kconfig | 9 + drivers/phy/broadcom/Makefile | 1 + drivers/phy/broadcom/phy-bcm-ns2-usb3.c | 580 ++++++++++++++++++++++++++++++++ 3 files changed, 590 insertions(+) create mode 100644 drivers/phy/broadcom/phy-bcm-ns2-usb3.cdrivers/phy/broadcom/Kconfig +0
-0
drivers/phy/broadcom/Kconfig config PHY_NS2_PCIE · line 51
Quoted 7 lines
drivers/phy/broadcom/Kconfig +4
-0@@ -45,6 +45,15 @@ config PHY_NS2_PCIE Enable this to support the Broadcom Northstar2 PCIe PHY. If unsure, say N. +config PHY_NS2_USB3 + tristate "Broadcom NorthStar2 USB3 PHY driver" + depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST) + select GENERIC_PHY
depends on MDIO_BUS?
Quoted 81 lines
drivers/phy/broadcom/Kconfig +5
-0+ default ARCH_BCM_IPROC + help + Enable this to support the Broadcom Northstar2 USB3 PHY. + If unsure, say N. + config PHY_NS2_USB_DRD tristate "Broadcom Northstar2 USB DRD PHY support" depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST)drivers/phy/broadcom/Makefile +1
-0@@ -3,5 +3,6 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB3) += phy-bcm-ns-usb3.o obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o +obj-$(CONFIG_PHY_NS2_USB3) += phy-bcm-ns2-usb3.o obj-$(CONFIG_PHY_NS2_USB_DRD) += phy-bcm-ns2-usbdrd.o obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.odrivers/phy/broadcom/phy-bcm-ns2-usb3.c new file +56
-0@@ -0,0 +1,580 @@ +/* +* Copyright (C) 2016 Broadcom +* +* 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 version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/delay.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/mfd/syscon.h> +#include <linux/mdio.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/phy/phy.h> + +#define NS2_USB3_PHY_MAX 0x02 + +#define NS2_USB3_PHY_CONFIG_CTRL_REG 0x10 +#define NS2_USB3_PHY_CONFIG_CTRL_MASK (BIT(3) | BIT(4) | BIT(5)) +#define NS2_USB3_PHY_CONFIG_CTRL_PLL_SEQ_START BIT(6) + +#define NS2_USB3_PHY_P0CTL_REG 0x14 +#define NS2_USB3_PHY_P1CTL_REG 0x18 +#define NS2_USB3_PHY_PXCTL_I_BIT BIT(1) + +#define NS2_USB3_PHY_MISC_STATUS_REG 0x20 + +#define NS2_IDM_RST_CTRL_P0_OFFSET 0x800 +#define NS2_IDM_RST_CTRL_P1_OFFSET 0x1800 +#define NS2_IDM_RESET_CONTROL_BIT BIT(0) + +#define NS2_IDM_IO_CTRL_P0_OFFSET 0x408 +#define NS2_IDM_IO_CTRL_P1_OFFSET 0x1408 +/* Bit 23 for PPC Polarity, Bit 24 for PPC NANDNOR select */ +#define NS2_IDM_IO_CTRL_PPC_CFG (BIT(23) | BIT(24)) + +#define NS2_PHY_RESET_BIT BIT(5) +#define NS2_PHY_PLL_RESET_BIT BIT(6) + +/* NS2 USB3 MDIO */ +#define NS2_USB3_MDIO_PLL30_ADDR 0x8000 +#define NS2_USB3_MDIO_BLK_ACCESS 0x1F +#define NS2_USB3_MDIO_PLL30_ANAPLL_CTRL 0x14 +#define NS2_USB3_MDIO_PLL30_ANAPLL_CTRL_VAL 0x23 +#define NS2_USB3_MDIO_PLL30_GEN_PLL 0xF +#define NS2_USB3_MDIO_PLL30_GEN_PLL_PCLK_SEL BIT(11) +#define NS2_USB3_MDIO_P0_AFE30_ADDR 0x8080 +#define NS2_USB3_MDIO_P1_AFE30_ADDR 0x9080
drivers/phy/broadcom/phy-bcm-ns2-usb3.c line 66
Quoted 10 lines
drivers/phy/broadcom/phy-bcm-ns2-usb3.c new file +10
-0+#define NS2_USB3_MDIO_AFE30_RX_SIG_DETECT 0x5 +#define NS2_USB3_MDIO_AFE30_RX_SIG_DETECT_VAL 0xAC0D + +#define NS2_USB3_MDIO_P0_PIPE_BLK_ADDR 0x8060 +#define NS2_USB3_MDIO_P1_PIPE_BLK_ADDR 0x9060 +#define NS2_USB3_MDIO_PIPE_BLK_REG_1_OFFSET 0x1 +#define NS2_USB3_MDIO_PIPE_BLK_REG_1_VAL 0x207 + +#define NS2_USB3_MDIO_P0_AEQ_BLK_ADDR 0x80E0 +#define NS2_USB3_MDIO_P1_AEQ_BLK_ADDR 0x90E0
Looking at the register offsets, P0 and P1 can be abstracted IMO. i.e you can simply have 'NS2_USB3_MDIO_PIPE_BLK_ADDR_OFFSET 0x60' and the base address can come from dt. For P0 it should be 0x8000 and P1 it should be 0x9000.
Then when the consumer requests for initialization of P0, it can be just P0 base address + S2_USB3_MDIO_PIPE_BLK_ADDR_OFFSET and likewise for P1.
Same thing is applicable for NS2_USB3_MDIO_P0_AEQ_BLK_ADDR, NS2_USB3_MDIO_P0_AFE30_ADDR etc.
Thanks
Kishon
Re: [PATCH v2 5/6] phy: Add USB3 PHY support for Broadcom NS2 SoC
Quoted 126 lines · Kishon Vijay Abraham I
Hi,
Quoted 18 lines · Jon Mason
From: Yendapally Reddy Dhananjaya Reddy <[email protected]>
This patch adds support for Broadcom NS2 USB3 PHY
Signed-off-by Yendapally Reddy Dhananjaya Reddy <[email protected]>Signed-off-by Jon Mason <[email protected]>--- drivers/phy/broadcom/Kconfig | 9 + drivers/phy/broadcom/Makefile | 1 + drivers/phy/broadcom/phy-bcm-ns2-usb3.c | 580 ++++++++++++++++++++++++++++++++ 3 files changed, 590 insertions(+) create mode 100644 drivers/phy/broadcom/phy-bcm-ns2-usb3.cdrivers/phy/broadcom/Kconfig +0
-0drivers/phy/broadcom/Kconfig config PHY_NS2_PCIE · line 51
Quoted 7 lines
drivers/phy/broadcom/Kconfig +4
-0@@ -45,6 +45,15 @@ config PHY_NS2_PCIE Enable this to support the Broadcom Northstar2 PCIe PHY. If unsure, say N. +config PHY_NS2_USB3 + tristate "Broadcom NorthStar2 USB3 PHY driver" + depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST) + select GENERIC_PHYdepends on
MDIO_BUS?Quoted 81 lines
drivers/phy/broadcom/Kconfig +5
-0+ default ARCH_BCM_IPROC + help + Enable this to support the Broadcom Northstar2 USB3 PHY. + If unsure, say N. + config PHY_NS2_USB_DRD tristate "Broadcom Northstar2 USB DRD PHY support" depends on OF && (ARCH_BCM_IPROC || COMPILE_TEST)drivers/phy/broadcom/Makefile +1
-0@@ -3,5 +3,6 @@ obj-$(CONFIG_BCM_KONA_USB2_PHY) += phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB2) += phy-bcm-ns-usb2.o obj-$(CONFIG_PHY_BCM_NS_USB3) += phy-bcm-ns-usb3.o obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o +obj-$(CONFIG_PHY_NS2_USB3) += phy-bcm-ns2-usb3.o obj-$(CONFIG_PHY_NS2_USB_DRD) += phy-bcm-ns2-usbdrd.o obj-$(CONFIG_PHY_BRCM_SATA) += phy-brcm-sata.odrivers/phy/broadcom/phy-bcm-ns2-usb3.c new file +56
-0@@ -0,0 +1,580 @@ +/* +* Copyright (C) 2016 Broadcom +* +* 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 version 2. +* +* This program is distributed "as is" WITHOUT ANY WARRANTY of any +* kind, whether express or implied; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#include <linux/delay.h> +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/mfd/syscon.h> +#include <linux/mdio.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/phy/phy.h> + +#define NS2_USB3_PHY_MAX 0x02 + +#define NS2_USB3_PHY_CONFIG_CTRL_REG 0x10 +#define NS2_USB3_PHY_CONFIG_CTRL_MASK (BIT(3) | BIT(4) | BIT(5)) +#define NS2_USB3_PHY_CONFIG_CTRL_PLL_SEQ_START BIT(6) + +#define NS2_USB3_PHY_P0CTL_REG 0x14 +#define NS2_USB3_PHY_P1CTL_REG 0x18 +#define NS2_USB3_PHY_PXCTL_I_BIT BIT(1) + +#define NS2_USB3_PHY_MISC_STATUS_REG 0x20 + +#define NS2_IDM_RST_CTRL_P0_OFFSET 0x800 +#define NS2_IDM_RST_CTRL_P1_OFFSET 0x1800 +#define NS2_IDM_RESET_CONTROL_BIT BIT(0) + +#define NS2_IDM_IO_CTRL_P0_OFFSET 0x408 +#define NS2_IDM_IO_CTRL_P1_OFFSET 0x1408 +/* Bit 23 for PPC Polarity, Bit 24 for PPC NANDNOR select */ +#define NS2_IDM_IO_CTRL_PPC_CFG (BIT(23) | BIT(24)) + +#define NS2_PHY_RESET_BIT BIT(5) +#define NS2_PHY_PLL_RESET_BIT BIT(6) + +/* NS2 USB3 MDIO */ +#define NS2_USB3_MDIO_PLL30_ADDR 0x8000 +#define NS2_USB3_MDIO_BLK_ACCESS 0x1F +#define NS2_USB3_MDIO_PLL30_ANAPLL_CTRL 0x14 +#define NS2_USB3_MDIO_PLL30_ANAPLL_CTRL_VAL 0x23 +#define NS2_USB3_MDIO_PLL30_GEN_PLL 0xF +#define NS2_USB3_MDIO_PLL30_GEN_PLL_PCLK_SEL BIT(11) +#define NS2_USB3_MDIO_P0_AFE30_ADDR 0x8080 +#define NS2_USB3_MDIO_P1_AFE30_ADDR 0x9080drivers/phy/broadcom/phy-bcm-ns2-usb3.c line 66
Quoted 10 lines
drivers/phy/broadcom/phy-bcm-ns2-usb3.c new file +10
-0+#define NS2_USB3_MDIO_AFE30_RX_SIG_DETECT 0x5 +#define NS2_USB3_MDIO_AFE30_RX_SIG_DETECT_VAL 0xAC0D + +#define NS2_USB3_MDIO_P0_PIPE_BLK_ADDR 0x8060 +#define NS2_USB3_MDIO_P1_PIPE_BLK_ADDR 0x9060 +#define NS2_USB3_MDIO_PIPE_BLK_REG_1_OFFSET 0x1 +#define NS2_USB3_MDIO_PIPE_BLK_REG_1_VAL 0x207 + +#define NS2_USB3_MDIO_P0_AEQ_BLK_ADDR 0x80E0 +#define NS2_USB3_MDIO_P1_AEQ_BLK_ADDR 0x90E0Looking at the register offsets, P0 and P1 can be abstracted IMO. i.e you can simply have '
NS2_USB3_MDIO_PIPE_BLK_ADDR_OFFSET0x60' and the base address can come from dt. For P0 it should be0x8000and P1 it should be0x9000.
Quoted 5 lines
Then when the consumer requests for initialization of P0, it can be just P0 base address +
S2_USB3_MDIO_PIPE_BLK_ADDR_OFFSETand likewise for P1.Same thing is applicable for
NS2_USB3_MDIO_P0_AEQ_BLK_ADDR,NS2_USB3_MDIO_P0_AFE30_ADDRetc.
Thanks for the input. These are good suggestions. I'll make the changes and push a new version shortly.
Thanks,
Jon
Quoted 3 lines
Thanks
Kishon
PATCH v2 6/6 arm64: dts: ns2: Add USB3 Support
In reply to Jon MasonFrom: Yendapally Reddy Dhananjaya Reddy <[email protected]>
Add USB3 support to the Northstar2 Device tree files
--- arch/arm64/boot/dts/broadcom/ns2-svk.dts | 16 +++++++++ arch/arm64/boot/dts/broadcom/ns2-xmc.dts | 8 +++++ arch/arm64/boot/dts/broadcom/ns2.dtsi | 59 ++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+)
arch/arm64/boot/dts/broadcom/ns2-svk.dts +16 -0
@@ -234,3 +234,19 @@ }; }; }; + +&usb3_phy0 { + status = "okay"; +}; + +&usb3_phy1 { + status = "okay"; +}; + +&xhci0 { + status = "okay"; +}; + +&xhci1 { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/ns2-xmc.dts +8 -0
@@ -189,3 +189,11 @@ &uart3 { status = "okay"; }; + +&usb3_phy0 { + status = "okay"; +}; + +&xhci0 { + status = "okay"; +};
arch/arm64/boot/dts/broadcom/ns2.dtsi +59 -0
88 lines not on this page · raw message
Signature · 1 line
2.7.4