arm64: exynos: Enable USB for E850-96 board
Subsystems (6)
Sam Protsenko
maintainercover arm64: exynos: Enable USB for E850-96 board
This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.
Sam Protsenko (8):
dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
usb: dwc3: exynos: Add support for Exynos850 variant
phy: exynos5-usbdrd: Make it possible to pass custom phy ops
phy: exynos5-usbdrd: Add 26MHz ref clk support
phy: exynos5-usbdrd: Add Exynos850 support
arm64: dts: exynos: Enable USB in Exynos850
arm64: dts: exynos: Enable USB support on E850-96 board
.../bindings/phy/samsung,usb3-drd-phy.yaml | 1 + .../bindings/usb/samsung,exynos-dwc3.yaml | 16 ++ .../boot/dts/exynos/exynos850-e850-96.dts | 58 ++++++ arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++ drivers/phy/samsung/phy-exynos5-usbdrd.c | 182 +++++++++++++++++- drivers/usb/dwc3/dwc3-exynos.c | 9 + 6 files changed, 294 insertions(+), 2 deletions(-)
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 1/8 dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
Exynos850 has dwc3 compatible USB controller, so it can reuse existing dwc3 glue layer. Document a new compatible for Exynos850 and its clocks.
--- .../bindings/usb/samsung,exynos-dwc3.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Documentation/devicetree/bindings/usb/samsung,exynos-dwc3.yaml +16 -0
@@ -15,6 +15,7 @@ properties: - samsung,exynos5250-dwusb3 - samsung,exynos5433-dwusb3 - samsung,exynos7-dwusb3 + - samsung,exynos850-dwusb3 '#address-cells': const: 1
@@ -101,6 +102,21 @@ allOf: - const: usbdrd30_susp_clk - const: usbdrd30_axius_clk + - if: + properties: + compatible: + contains: + const: samsung,exynos850-dwusb3 + then: + properties: + clocks: + minItems: 2 + maxItems: 2 + clock-names: + items: + - const: bus_early + - const: ref + additionalProperties: false examples:
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 1/8] dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
Quoted 7 lines · Sam Protsenko
Exynos850 has dwc3 compatible USB controller, so it can reuse existing dwc3 glue layer. Document a new compatible for Exynos850 and its clocks.
Signed-off-by Sam Protsenko <[email protected]>--- .../bindings/usb/samsung,exynos-dwc3.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 2/8 dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
In reply to Sam ProtsenkoDocument Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two clocks (ref and phy), which is already described in bindings.
--- Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml +1 -0
@@ -29,6 +29,7 @@ properties: - samsung,exynos5420-usbdrd-phy - samsung,exynos5433-usbdrd-phy - samsung,exynos7-usbdrd-phy + - samsung,exynos850-usbdrd-phy clocks: minItems: 2
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
Quoted 7 lines · Sam Protsenko
Document Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two clocks (ref and phy), which is already described in bindings.
Signed-off-by Sam Protsenko <[email protected]>--- Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 + 1 file changed, 1 insertion(+)
You should probably split the patchset between separate subsystems, so Greg and Vinod can easily pick up their parts.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Vinod Koul
maintainerRe: [PATCH 2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Sam Protsenko
Document Exynos850 compatible. USB 2.0 DRD PHY on Exynos850 has two clocks (ref and phy), which is already described in bindings.
Signed-off-by Sam Protsenko <[email protected]>--- Documentation/devicetree/bindings/phy/samsung,usb3-drd-phy.yaml | 1 + 1 file changed, 1 insertion(+)You should probably split the patchset between separate subsystems, so Greg and Vinod can easily pick up their parts.
Yes I agree :-) if there is NO dependency pls split them!
Quoted 6 lines
Reviewed-by Krzysztof Kozlowski <[email protected]>Best regards,
Krzysztof
Signature · 6 lines
~Vinod -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 3/8 usb: dwc3: exynos: Add support for Exynos850 variant
In reply to Sam ProtsenkoAdd Exynos850 compatible string and associated driver data. Only two clocks are needed for this SoC:
- bus_early: bus clock needed for registers access
- ref: USB 2.0 DRD reference clock (50 MHz)
--- drivers/usb/dwc3/dwc3-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/dwc3/dwc3-exynos.c +9 -0
@@ -163,6 +163,12 @@ static const struct dwc3_exynos_driverdata exynos7_drvdata = { .suspend_clk_idx = 1, }; +static const struct dwc3_exynos_driverdata exynos850_drvdata = { + .clk_names = {"bus_early" ,"ref" }, + .num_clks =2 , + .suspend_clk_idx =-1 , +}; +static const struct of_device_id exynos_dwc3_match[] = { { .compatible ="samsung,exynos5250-dwusb3" ,
@@ -173,6 +179,9 @@ static const struct of_device_id exynos_dwc3_match[] = { }, { .compatible = "samsung,exynos7-dwusb3", .data = &exynos7_drvdata, + }, { + .compatible = "samsung,exynos850-dwusb3", + .data = &exynos850_drvdata, }, { } };
Signature · 1 line
2.39.2
Re: [PATCH 3/8] usb: dwc3: exynos: Add support for Exynos850 variant
Quoted 9 lines · Sam Protsenko
Add Exynos850 compatible string and associated driver data. Only two clocks are needed for this SoC:
-bus_early: bus clock needed for registers access
- ref: USB 2.0 DRD reference clock (50 MHz)Signed-off-by Sam Protsenko <[email protected]>--- drivers/usb/dwc3/dwc3-exynos.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 4/8 phy: exynos5-usbdrd: Make it possible to pass custom phy ops
In reply to Sam ProtsenkoProvide a way to use different PHY ops for different chips. Right now all chips are using exynos5_usbdrd_phy_ops, but it won't always be the case. For example, Exynos850 has very different USB PHY block, so there will be another PHY ops implementation for that chip.
No functional change.
--- drivers/phy/samsung/phy-exynos5-usbdrd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/phy/samsung/phy-exynos5-usbdrd.c +7 -2
@@ -165,6 +165,7 @@ struct exynos5_usbdrd_phy_config {struct exynos5_usbdrd_phy_drvdata {const struct exynos5_usbdrd_phy_config *phy_cfg; +const struct phy_ops *phy_ops;u32 pmu_offset_usbdrd0_phy;u32 pmu_offset_usbdrd1_phy;bool has_common_clk_gate;
@@ -779,6 +780,7 @@ static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = {static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, + .phy_ops = &exynos5_usbdrd_phy_ops, .pmu_offset_usbdrd0_phy =EXYNOS5_USBDRD_PHY_CONTROL , .pmu_offset_usbdrd1_phy =EXYNOS5420_USBDRD1_PHY_CONTROL , .has_common_clk_gate = true,
@@ -786,12 +788,14 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = {static const struct exynos5_usbdrd_phy_drvdata exynos5250_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, + .phy_ops = &exynos5_usbdrd_phy_ops, .pmu_offset_usbdrd0_phy =EXYNOS5_USBDRD_PHY_CONTROL , .has_common_clk_gate = true, };static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, + .phy_ops = &exynos5_usbdrd_phy_ops, .pmu_offset_usbdrd0_phy =EXYNOS5_USBDRD_PHY_CONTROL , .pmu_offset_usbdrd1_phy =EXYNOS5433_USBHOST30_PHY_CONTROL , .has_common_clk_gate = false,
@@ -799,6 +803,7 @@ static const struct exynos5_usbdrd_phy_drvdata exynos5433_usbdrd_phy = {static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, + .phy_ops = &exynos5_usbdrd_phy_ops, .pmu_offset_usbdrd0_phy =EXYNOS5_USBDRD_PHY_CONTROL , .has_common_clk_gate = false, };
@@ -906,8 +911,8 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)dev_vdbg (dev,"Creating usbdrd_phy phy\n" );for (i =0 ; i <EXYNOS5_DRDPHYS_NUM ; i++) { -struct phy *phy =devm_phy_create (dev,NULL , - &exynos5_usbdrd_phy_ops); +struct phy *phy =devm_phy_create (dev,NULL , drv_data->phy_ops); +if (IS_ERR (phy)) {dev_err (dev,"Failed to create usbdrd_phy phy\n" );return PTR_ERR (phy);
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops
Quoted 7 lines · Sam Protsenko
Provide a way to use different PHY ops for different chips. Right now all chips are using
exynos5_usbdrd_phy_ops, but it won't always be the case. For example, Exynos850 has very different USB PHY block, so there will be another PHY ops implementation for that chip.No functional change.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 5/8 phy: exynos5-usbdrd: Add 26MHz ref clk support
In reply to Sam ProtsenkoModern Exynos chips (like Exynos850) might have 26 MHz OSCCLK external clock, which is also used as a PHY reference clock. For some USB PHY controllers (e.g USB DRD PHY block on Exynos850) there is no need to set the refclk frequency at all (and corresponding bits in CLKRSTCTRL[7:5] are marked RESERVED), so that value won't be set in the driver. But even in that case, 26 MHz support still has to be added, otherwise exynos5_rate_to_clk() fails, which leads in turn to probe error.
Add the correct value for 26MHz refclk to make it possible to add support for new Exynos USB DRD PHY controllers.
--- drivers/phy/samsung/phy-exynos5-usbdrd.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/phy/samsung/phy-exynos5-usbdrd.c +4 -0
@@ -30,6 +30,7 @@#define EXYNOS5_FSEL_19MHZ2 0x3#define EXYNOS5_FSEL_20MHZ 0x4#define EXYNOS5_FSEL_24MHZ 0x5 +#define EXYNOS5_FSEL_26MHZ 0x82#define EXYNOS5_FSEL_50MHZ 0x7/* Exynos5: USB 3.0 DRD PHY registers */
@@ -244,6 +245,9 @@ static unsigned int exynos5_rate_to_clk(unsigned long rate, u32 *reg)case 24 *MHZ : *reg =EXYNOS5_FSEL_24MHZ ;break ; +case 26 *MHZ : + *reg =EXYNOS5_FSEL_26MHZ ; +break ;case 50 *MHZ : *reg =EXYNOS5_FSEL_50MHZ ;break ;
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support
Quoted 8 lines · Sam Protsenko
Modern Exynos chips (like Exynos850) might have 26 MHz OSCCLK external clock, which is also used as a PHY reference clock. For some USB PHY controllers (e.g USB DRD PHY block on Exynos850) there is no need to set the refclk frequency at all (and corresponding bits in CLKRSTCTRL[7:5] are marked RESERVED), so that value won't be set in the driver. But even in that case, 26 MHz support still has to be added, otherwise
exynos5_rate_to_clk()fails, which leads in turn to probe error.
Quoted 5 lines
Add the correct value for 26MHz refclk to make it possible to add support for new Exynos USB DRD PHY controllers.
Signed-off-by Sam Protsenko <[email protected]>---
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 6/8 phy: exynos5-usbdrd: Add Exynos850 support
In reply to Sam ProtsenkoImplement Exynos850 USB 2.0 DRD PHY controller support. Exynos850 has quite a different PHY controller than Exynos5 compatible controllers, but it's still possible to implement it on top of existing exynos5-usbdrd driver infrastructure.
Only UTMI+ (USB 2.0) PHY interface is implemented, as Exynos850 doesn't support USB 3.0.
Only two clocks are used for this controller:
- phy: bus clock, used for PHY registers access
- ref: PHY reference clock (OSCCLK)
--- drivers/phy/samsung/phy-exynos5-usbdrd.c | 169 +++++++++++++++++++++++ 1 file changed, 169 insertions(+)
drivers/phy/samsung/phy-exynos5-usbdrd.c +169 -0
@@ -145,6 +145,34 @@#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5 (0x20 << 4)#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M (0x40 << 4) +/* Exynos850: USB DRD PHY registers */ +#define EXYNOS850_DRD_LINKCTRL 0x04 +#define LINKCTRL_BUS_FILTER_BYPASS (_x) ((_x) << 4) +#define LINKCTRL_FORCE_QACT BIT(8) + +#define EXYNOS850_DRD_CLKRST 0x20 +#define CLKRST_LINK_SW_RST BIT(0) +#define CLKRST_PORT_RST BIT(1) +#define CLKRST_PHY_SW_RST BIT(3) + +#define EXYNOS850_DRD_UTMI 0x50 +#define UTMI_FORCE_SLEEP BIT(0) +#define UTMI_FORCE_SUSPEND BIT(1) +#define UTMI_DM_PULLDOWN BIT(2) +#define UTMI_DP_PULLDOWN BIT(3) +#define UTMI_FORCE_BVALID BIT(4) +#define UTMI_FORCE_VBUSVALID BIT(5) + +#define EXYNOS850_DRD_HSP 0x54 +#define HSP_COMMONONN BIT(8) +#define HSP_EN_UTMISUSPEND BIT(9) +#define HSP_VBUSVLDEXT BIT(12) +#define HSP_VBUSVLDEXTSEL BIT(13) +#define HSP_FSV_OUT_EN BIT(24) + +#define EXYNOS850_DRD_HSP_TEST 0x5c +#define HSP_TEST_SIDDQ BIT(24) +#define KHZ 1000#define MHZ (KHZ * KHZ)
@@ -716,6 +744,129 @@ static const struct phy_ops exynos5_usbdrd_phy_ops = { .owner = THIS_MODULE, }; +static void exynos850_usbdrd_utmi_init (struct exynos5_usbdrd_phy *phy_drd) +{ +void __iomem *regs_base = phy_drd->reg_phy; +u32 reg; + +/* +* Disable HWACG (hardware auto clock gating control). This will force +* QACTIVE signal in Q-Channel interface to HIGH level, to make sure +* the PHY clock is not gated by the hardware. +*/ + reg =readl (regs_base +EXYNOS850_DRD_LINKCTRL ); + reg |=LINKCTRL_FORCE_QACT ; +writel (reg, regs_base +EXYNOS850_DRD_LINKCTRL ); + +/* Start PHY Reset (POR=high) */ + reg =readl (regs_base +EXYNOS850_DRD_CLKRST ); + reg |=CLKRST_PHY_SW_RST ; +writel (reg, regs_base +EXYNOS850_DRD_CLKRST ); + +/* Enable UTMI+ */ + reg =readl (regs_base +EXYNOS850_DRD_UTMI ); + reg &= ~(UTMI_FORCE_SUSPEND |UTMI_FORCE_SLEEP |UTMI_DP_PULLDOWN | +UTMI_DM_PULLDOWN ); +writel (reg, regs_base +EXYNOS850_DRD_UTMI ); + +/* Set PHY clock and control HS PHY */ + reg =readl (regs_base +EXYNOS850_DRD_HSP ); + reg |=HSP_EN_UTMISUSPEND |HSP_COMMONONN ; +writel (reg, regs_base +EXYNOS850_DRD_HSP ); + +/* Set VBUS Valid and D+ pull-up control by VBUS pad usage */ + reg =readl (regs_base +EXYNOS850_DRD_LINKCTRL ); + reg |=LINKCTRL_BUS_FILTER_BYPASS (0xf ); +writel (reg, regs_base +EXYNOS850_DRD_LINKCTRL ); + + reg =readl (regs_base +EXYNOS850_DRD_UTMI ); + reg |=UTMI_FORCE_BVALID |UTMI_FORCE_VBUSVALID ; +writel (reg, regs_base +EXYNOS850_DRD_UTMI ); + + reg =readl (regs_base +EXYNOS850_DRD_HSP ); + reg |=HSP_VBUSVLDEXT |HSP_VBUSVLDEXTSEL ; +writel (reg, regs_base +EXYNOS850_DRD_HSP ); + +/* Power up PHY analog blocks */ + reg =readl (regs_base +EXYNOS850_DRD_HSP_TEST ); + reg &= ~HSP_TEST_SIDDQ ; +writel (reg, regs_base +EXYNOS850_DRD_HSP_TEST ); + +/* Finish PHY reset (POR=low) */ +udelay (10 );/* required before doing POR=low */ + reg =readl (regs_base +EXYNOS850_DRD_CLKRST ); + reg &= ~(CLKRST_PHY_SW_RST |CLKRST_PORT_RST ); +writel (reg, regs_base +EXYNOS850_DRD_CLKRST ); +udelay (75 );/* required after POR=low for guaranteed PHY clock */ + +/* Disable single ended signal out */ + reg =readl (regs_base +EXYNOS850_DRD_HSP ); + reg &= ~HSP_FSV_OUT_EN ; +writel (reg, regs_base +EXYNOS850_DRD_HSP ); +} + +static int exynos850_usbdrd_phy_init (struct phy *phy) +{ +struct phy_usb_instance *inst =phy_get_drvdata (phy); +struct exynos5_usbdrd_phy *phy_drd =to_usbdrd_phy (inst); +int ret; + + ret =clk_prepare_enable (phy_drd->clk); +if (ret) +return ret; + +/* UTMI or PIPE3 specific init */ + inst->phy_cfg->phy_init (phy_drd); + +clk_disable_unprepare (phy_drd->clk); + +return 0 ; +} + +static int exynos850_usbdrd_phy_exit (struct phy *phy) +{ +struct phy_usb_instance *inst =phy_get_drvdata (phy); +struct exynos5_usbdrd_phy *phy_drd =to_usbdrd_phy (inst); +void __iomem *regs_base = phy_drd->reg_phy; +u32 reg; +int ret; + + ret =clk_prepare_enable (phy_drd->clk); +if (ret) +return ret; + +/* Set PHY clock and control HS PHY */ + reg =readl (regs_base +EXYNOS850_DRD_UTMI ); + reg &= ~(UTMI_DP_PULLDOWN |UTMI_DM_PULLDOWN ); + reg |=UTMI_FORCE_SUSPEND |UTMI_FORCE_SLEEP ; +writel (reg, regs_base +EXYNOS850_DRD_UTMI ); + +/* Power down PHY analog blocks */ + reg =readl (regs_base +EXYNOS850_DRD_HSP_TEST ); + reg |=HSP_TEST_SIDDQ ; +writel (reg, regs_base +EXYNOS850_DRD_HSP_TEST ); + +/* Link reset */ + reg =readl (regs_base +EXYNOS850_DRD_CLKRST ); + reg |=CLKRST_LINK_SW_RST ; +writel (reg, regs_base +EXYNOS850_DRD_CLKRST ); +udelay (10 );/* required before doing POR=low */ + reg &= ~CLKRST_LINK_SW_RST ; +writel (reg, regs_base +EXYNOS850_DRD_CLKRST ); + +clk_disable_unprepare (phy_drd->clk); + +return 0 ; +} + +static const struct phy_ops exynos850_usbdrd_phy_ops = { + .init = exynos850_usbdrd_phy_init, + .exit = exynos850_usbdrd_phy_exit, + .power_on = exynos5_usbdrd_phy_power_on, + .power_off = exynos5_usbdrd_phy_power_off, + .owner =THIS_MODULE , +}; +static int exynos5_usbdrd_phy_clk_handle (struct exynos5_usbdrd_phy *phy_drd) {unsigned long ref_rate;
@@ -782,6 +933,14 @@ static const struct exynos5_usbdrd_phy_config phy_cfg_exynos5[] = { }, }; +static const struct exynos5_usbdrd_phy_config phy_cfg_exynos850[] = { + { + .id =EXYNOS5_DRDPHY_UTMI , + .phy_isol = exynos5_usbdrd_phy_isol, + .phy_init = exynos850_usbdrd_utmi_init, + }, +}; +static const struct exynos5_usbdrd_phy_drvdata exynos5420_usbdrd_phy = { .phy_cfg = phy_cfg_exynos5, .phy_ops = &exynos5_usbdrd_phy_ops,
@@ -812,6 +971,13 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = { .has_common_clk_gate = false, }; +static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = { + .phy_cfg = phy_cfg_exynos850, + .phy_ops = &exynos850_usbdrd_phy_ops, + .pmu_offset_usbdrd0_phy =EXYNOS5_USBDRD_PHY_CONTROL , + .has_common_clk_gate = true, +}; +static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { { .compatible ="samsung,exynos5250-usbdrd-phy" ,
@@ -825,6 +991,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { }, { .compatible = "samsung,exynos7-usbdrd-phy", .data = &exynos7_usbdrd_phy + }, { + .compatible = "samsung,exynos850-usbdrd-phy", + .data = &exynos850_usbdrd_phy }, { }, };
Signature · 1 line
2.39.2
Re: [PATCH 6/8] phy: exynos5-usbdrd: Add Exynos850 support
Quoted 8 lines · Sam Protsenko
Implement Exynos850 USB 2.0 DRD PHY controller support. Exynos850 has quite a different PHY controller than Exynos5 compatible controllers, but it's still possible to implement it on top of existing exynos5-usbdrd driver infrastructure.
Only UTMI+ (USB 2.0) PHY interface is implemented, as Exynos850 doesn't support USB 3.0.
Quoted 6 lines
Only two clocks are used for this controller:
- phy: bus clock, used for PHY registers access
- ref: PHY reference clock (OSCCLK)Signed-off-by Sam Protsenko <[email protected]>---
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Sam Protsenko
maintainerPATCH 7/8 arm64: dts: exynos: Enable USB in Exynos850
In reply to Sam ProtsenkoAdd USB controller and USB PHY controller nodes for Exynos850 SoC.
The USB controller has next features:
- Dual Role Device (DRD) controller
- DWC3 compatible
- Supports USB 2.0 host and USB 2.0 device interfaces
- Supports full-speed (12 Mbps) and high-speed (480 Mbps) modes with USB device 2.0 interface
- Supports on-chip USB PHY transceiver
- Supports up to 16 bi-directional endpoints (that includes control endpoint 0)
- Complies with xHCI 1.00 specification
Only USB 2.0 is supported in Exynos850, so only UTMI+ PHY interface is specified in "phys" property (index 0) and PIPE3 is omitted (index 1).
--- arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/exynos/exynos850.dtsi +30 -0
@@ -570,6 +570,36 @@ sysreg_cmgp: syscon@11c20000 { clocks = <&cmu_cmgp CLK_GOUT_SYSREG_CMGP_PCLK>; }; + usbdrd: usb@13600000 { + compatible = "samsung,exynos850-dwusb3"; + clocks = <&cmu_hsi CLK_GOUT_USB_BUS_EARLY_CLK>, + <&cmu_hsi CLK_GOUT_USB_REF_CLK>; + clock-names = "bus_early", "ref"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x13600000 0x10000>; + status = "disabled"; + + usbdrd_dwc3: usb@0 { + compatible = "snps,dwc3"; + reg = <0x0 0x10000>; + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usbdrd_phy 0>; + phy-names = "usb2-phy"; + }; + }; + + usbdrd_phy: phy@135d0000 { + compatible = "samsung,exynos850-usbdrd-phy"; + reg = <0x135d0000 0x100>; + clocks = <&cmu_hsi CLK_GOUT_USB_PHY_ACLK>, + <&cmu_hsi CLK_GOUT_USB_PHY_REF_CLK>; + clock-names = "phy", "ref"; + samsung,pmu-syscon = <&pmu_system_controller>; + #phy-cells = <1>; + status = "disabled"; + }; + usi_uart: usi@138200c0 { compatible = "samsung,exynos850-usi"; reg = <0x138200c0 0x20>;
Signature · 7 lines
2.39.2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: [PATCH 7/8] arm64: dts: exynos: Enable USB in Exynos850
Quoted 27 lines · Sam Protsenko
Add USB controller and USB PHY controller nodes for Exynos850 SoC.
The USB controller has next features:
- Dual Role Device (DRD) controller
- DWC3 compatible
- Supports USB 2.0 host and USB 2.0 device interfaces
- Supports full-speed (12 Mbps) and high-speed (480 Mbps) modes with USB device 2.0 interface
- Supports on-chip USB PHY transceiver
- Supports up to 16 bi-directional endpoints (that includes control endpoint 0)
- Complies with xHCI 1.00 specificationOnly USB 2.0 is supported in Exynos850, so only UTMI+ PHY interface is specified in "phys" property (index 0) and PIPE3 is omitted (index 1).
Signed-off-by Sam Protsenko <[email protected]>--- arch/arm64/boot/dts/exynos/exynos850.dtsi | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm64/boot/dts/exynos/exynos850.dtsi +0
-0@@ -570,6 +570,36 @@ sysreg_cmgp: syscon@11c20000 { clocks = <&cmu_cmgp CLK_GOUT_SYSREG_CMGP_PCLK>;
arch/arm64/boot/dts/exynos/exynos850.dtsi sysreg_cmgp: syscon@11c20000 { · line 580
Quoted 10 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +8
-0}; + usbdrd: usb@13600000 { + compatible = "samsung,exynos850-dwusb3"; + clocks = <&cmu_hsi CLK_GOUT_USB_BUS_EARLY_CLK>, + <&cmu_hsi CLK_GOUT_USB_REF_CLK>; + clock-names = "bus_early", "ref"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x13600000 0x10000>;
Please put ranges after compatible. I know that existing code does not follow this convention, though.
arch/arm64/boot/dts/exynos/exynos850.dtsi sysreg_cmgp: syscon@11c20000 { · line 582
Quoted 2 lines
arch/arm64/boot/dts/exynos/exynos850.dtsi +2
-0+ status = "disabled"; +
Best regards,
Krzysztof
Sam Protsenko
maintainerPATCH 8/8 arm64: dts: exynos: Enable USB support on E850-96 board
In reply to Sam ProtsenkoThe E850-96 board has a micro-USB socket and two USB 2.0 host sockets. The USB role (host or peripheral) is selected automatically depending on micro-USB cable attachment state:
- micro-USB cable is attached: USB device role
- micro-USB cable is detached: USB host role
USB can't act simultaneously as a device and a host, because Exynos850 SoC has only one USB controller and there are no external USB controllers on the E850-96 board. So the USB switch chip (specifically TS3USB221A) connects SoC USB lines either to micro-USB connector or to USB hub chip (LAN9514), w.r.t. micro-USB cable attachment state.
When USB works in the host role, Ethernet capability becomes available too, as LAN9514 chip (providing USB hub) also enables Ethernet PHY and Ethernet MAC.
Dynamic role switching is done in gpio-usb-b-connector, using current micro-USB VBUS line level as a trigger:
- VBUS=high: SoC USB lines are wired to micro-USB socket
- VBUS=low: SoC USB lines are wired to USB hub chip
In order to make USB host functional when the board is booted with micro-USB cable disconnected, role-switch-default-mode = "host" is used.
One can look at E850-96 board schematics [1] to figure out how exactly all related USB hardware connections and lines reflect into corresponding device tree definitions.
As PMIC regulators are not implemented yet, we rely on USB LDOs being already enabled in the bootloader, and a dummy regulator is provided to "usbdrd" vdd nodes for now.
[1] https://www.96boards.org/documentation/consumer/e850-96b/hardware-docs/
--- .../boot/dts/exynos/exynos850-e850-96.dts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/exynos/exynos850-e850-96.dts +58 -0
@@ -29,6 +29,22 @@ chosen { stdout-path = &serial_0; }; + connector { + compatible = "gpio-usb-b-connector", "usb-b-connector"; + label = "micro-USB"; + type = "micro"; + vbus-supply = <®_usb_host_vbus>; + id-gpios = <&gpa0 0 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <µ_usb_det_pins>; + + port { + usb_dr_connector: endpoint { + remote-endpoint = <&usb1_drd_sw>; + }; + }; + }; + /* * RAM: 4 GiB (eMCP): * - 2 GiB at 0x80000000
@@ -111,6 +127,20 @@ bt_active_led: led-5 { }; }; + /* TODO: Remove this once PMIC is implemented */ + reg_dummy: regulator-0 { + compatible = "regulator-fixed"; + regulator-name = "dummy_reg"; + }; + + reg_usb_host_vbus: regulator-1 { + compatible = "regulator-fixed"; + regulator-name = "usb_host_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpa3 5 GPIO_ACTIVE_LOW>; + }; + /* * RTC clock (XrtcXTI); external, must be 32.768 kHz. *
@@ -172,6 +202,12 @@ key_volup_pins: key-volup-pins { samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>; }; + + micro_usb_det_pins: micro-usb-det-pins { + samsung,pins = "gpa0-0"; + samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>; + samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>; + }; }; &rtc {
@@ -186,6 +222,28 @@ &serial_0 { pinctrl-0 = <&uart1_pins>; }; +&usbdrd { + status = "okay"; + vdd10-supply = <®_dummy>; + vdd33-supply = <®_dummy>; +}; + +&usbdrd_dwc3 { + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + + port { + usb1_drd_sw: endpoint { + remote-endpoint = <&usb_dr_connector>; + }; + }; +}; + +&usbdrd_phy { + status = "okay"; +}; + &usi_uart { samsung,clkreq-on; /* needed for UART mode */ status = "okay";
Signature · 1 line
2.39.2
Re: [PATCH 8/8] arm64: dts: exynos: Enable USB support on E850-96 board
Quoted 32 lines · Sam Protsenko
The E850-96 board has a micro-USB socket and two USB 2.0 host sockets. The USB role (host or peripheral) is selected automatically depending on micro-USB cable attachment state:
- micro-USB cable is attached: USB device role
- micro-USB cable is detached: USB host roleUSB can't act simultaneously as a device and a host, because Exynos850 SoC has only one USB controller and there are no external USB controllers on the E850-96 board. So the USB switch chip (specifically TS3USB221A) connects SoC USB lines either to micro-USB connector or to USB hub chip (LAN9514), w.r.t. micro-USB cable attachment state.
When USB works in the host role, Ethernet capability becomes available too, as LAN9514 chip (providing USB hub) also enables Ethernet PHY and Ethernet MAC.
Dynamic role switching is done in gpio-usb-b-connector, using current micro-USB VBUS line level as a trigger:
- VBUS=high: SoC USB lines are wired to micro-USB socket
- VBUS=low: SoC USB lines are wired to USB hub chipIn order to make USB host functional when the board is booted with micro-USB cable disconnected, role-switch-default-mode = "host" is used.
One can look at E850-96 board schematics [1] to figure out how exactly all related USB hardware connections and lines reflect into corresponding device tree definitions.
As PMIC regulators are not implemented yet, we rely on USB LDOs being already enabled in the bootloader, and a dummy regulator is provided to "usbdrd" vdd nodes for now.
Quoted 7 lines
[1] https://www.96boards.org/documentation/consumer/e850-96b/hardware-docs/
Signed-off-by Sam Protsenko <[email protected]>--- .../boot/dts/exynos/exynos850-e850-96.dts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+)
This looks good. Please split the DTS patches from the patchset, so they won't be applied by Greg. Anyway, I finished pulling for this cycle, so this will have to wait till v6.6-rc1.
Best regards,
Krzysztof
Signature · 3 lines
linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Re: (subset) [PATCH 0/8] arm64: exynos: Enable USB for E850-96 board
In reply to Sam ProtsenkoQuoted 15 lines · Sam Protsenko
This patch series enables USB gadget, USB host and Ethernet support for E850-96 board. The most major change was done in USB PHY driver, as the register layout of PHY block in Exynos850 is very different from Exynos5 one.
Sam Protsenko (8):
dt-bindings: usb: samsung,exynos-dwc3: Add Exynos850 support
dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
usb: dwc3: exynos: Add support for Exynos850 variant
phy: exynos5-usbdrd: Make it possible to pass custom phy ops
phy: exynos5-usbdrd: Add 26MHz ref clk support
phy: exynos5-usbdrd: Add Exynos850 support
arm64: dts: exynos: Enable USB in Exynos850
arm64: dts: exynos: Enable USB support on E850-96 board
Quoted 1 line
[...]
Applied, thanks!
[2/8] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos850 support
commit: 0b76bdce32300a626dc796f656c085a786c5dab1
[4/8] phy: exynos5-usbdrd: Make it possible to pass custom phy ops
commit: 6b34ec66e7e7351b9a0a1eba8f57eb46ddeabf1e
[5/8] phy: exynos5-usbdrd: Add 26MHz ref clk support
commit: 255ec3879dd4d585799fd8d8a94a335eaf84d2ec
[6/8] phy: exynos5-usbdrd: Add Exynos850 support
commit: 691525074db97d9b684dd1457fd8dc9842a36615Best regards,
Signature · 1 line
~Vinod