musb: sunxi: Add OTG-Peripheral support for Allwineer H3/H5/A64
Subsystems (6)
v3 cover musb: sunxi: Add OTG-Peripheral support for Allwineer H3/H5/A64
This is rework of previous A64 musb[1] and H3 musb series with OTG Peripheral support for Allwineer H3/H5/A64. Will submit another series on host support since A64 need AXP PMIC.
Series start with Jun Nie H3 musb changes followed by H5 and A64 musb changes.
All changes available at u-boot-sunxi/otg-peripheral branch.
[1] https://patchwork.ozlabs.org/cover/847375/
thanks!
Jagan.
Chen-Yu Tsai (2):
sunxi: Fix USB PHY index for H3/H5/A64
sunxi: usb_phy: setup USB PHY passby for USB0 on H3/H5/A64
Jagan Teki (23):
sunxi: usb_phy: Clear PHYCTL register before writing
ARM: dts: sun8i-h3: bananapi-m2-plus: Sync usb otg nodes from Linux
configs: bananapi-m2-plus: Enable USB OTG peripheral mode
configs: sun50i: Drop CONFIG_USB_MAX_CONTROLLER_COUNT
msub: sunxi: Update proper fifo config for H5
configs: sun50i: Set proper USB PHY count for H5
sunxi: usb_phy: Fix phy_config to handle all SOC's
musb: sunxi: Add phy0 dual route support
arm64: allwinner: h5: orangepi-pc2: Order nodes in alphabetic
sunxi: arm64: Increase u-boot size on MMC environment
sunxi: Add uENV partition on gpt partition table
arm64: allwinner: h5: orangepi-pc2: Sync usb otg nodes from Linux
configs: orangepi-pc2: Enable USB OTG peripheral mode
arm64: allwinner: h5: orangepi-prime: Sync usb otg nodes from Linux
configs: orangepi-prime: Enable USB OTG peripheral mode
sunxi: clock: Fix clock gating for A64
configs: sun50i: Set proper USB PHY count for A64
musb: sunxi: Add support for A64
sunxi: usb_phy: Clear SIDDP for A64
arm64: allwinner: a64: bananapi-m64: Sync usb_otg node from Linux
configs: bananapi-m64: Enable USB OTG peripheral mode
arm64: allwinner: a64: olinuxino: Sync usb_otg from Linux
configs: a64-olinuxino: Enable USB OTG peripheral mode
Jun Nie (5):
sunxi: h3: Sync OTG and HCI nodes from Linux DT
sunxi: musb: Add fifo config for H3
sunxi: musb: Hack dynamic fifo support for H3 OTG
sunxi: musb: Enable OTG device clock for H3
sunxi: H3: set different otg base address per mode
arch/arm/dts/sun50i-a64-bananapi-m64.dts | 10 ++++ arch/arm/dts/sun50i-a64-olinuxino.dts | 5 ++ arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 54 +++++++++++++-------- arch/arm/dts/sun50i-h5-orangepi-prime.dts | 13 +++++ arch/arm/dts/sun8i-h3-bananapi-m2-plus.dts | 13 +++++ arch/arm/dts/sun8i-h3.dtsi | 32 +++++++++++++ arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 37 ++++++++------- arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 ++ arch/arm/include/asm/arch-sunxi/usb_phy.h | 1 + arch/arm/mach-sunxi/usb_phy.c | 68 ++++++++++++++++++--------- configs/Sinovoip_BPI_M2_Plus_defconfig | 1 + configs/a64-olinuxino_defconfig | 1 + configs/bananapi_m64_defconfig | 1 + configs/orangepi_pc2_defconfig | 1 + configs/orangepi_prime_defconfig | 1 + drivers/usb/host/ehci-sunxi.c | 9 +++- drivers/usb/host/ohci-sunxi.c | 9 +++- drivers/usb/musb-new/musb_regs.h | 3 +- drivers/usb/musb-new/sunxi.c | 47 ++++++++++++++++++ env/Kconfig | 3 +- include/configs/sun50i.h | 7 ++- include/configs/sunxi-common.h | 3 +- 22 files changed, 258 insertions(+), 65 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/30 sunxi: h3: Sync OTG and HCI nodes from Linux DT
From: Jun Nie <[email protected]>
Allwinner H3 have a dual-routed USB PHY0 -- routed to either OHCI/EHCI or MUSB controller.
--- arch/arm/dts/sun8i-h3.dtsi | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm/dts/sun8i-h3.dtsi +32 -0
@@ -218,6 +218,19 @@ #size-cells = <0>; }; + usb_otg: usb at 1c19000 { + compatible = "allwinner,sun8i-h3-musb"; + reg = <0x01c19000 0x400>; + clocks = <&ccu CLK_BUS_OTG>; + resets = <&ccu RST_BUS_OTG>; + interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "mc"; + phys = <&usbphy 0>; + phy-names = "usb"; + extcon = <&usbphy 0>; + status = "disabled"; + }; + usbphy: phy at 01c19400 { compatible = "allwinner,sun8i-h3-usb-phy"; reg = <0x01c19400 0x2c>,
@@ -250,6 +263,25 @@ #phy-cells = <1>; }; + ehci0: usb at 1c1a000 { + compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; + reg = <0x01c1a000 0x100>; + interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>; + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; + status = "disabled"; + }; + + ohci0: usb at 1c1a400 { + compatible = "allwinner,sun8i-h3-ohci", "generic-ohci"; + reg = <0x01c1a400 0x100>; + interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>, + <&ccu CLK_USB_OHCI0>; + resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>; + status = "disabled"; + }; + ehci1: usb at 01c1b000 { compatible = "allwinner,sun8i-h3-ehci", "generic-ehci"; reg = <0x01c1b000 0x100>;
Signature · 1 line
2.7.4
PATCH v3 2/30 sunxi: musb: Add fifo config for H3
In reply to Jagan TekiFrom: Jun Nie <[email protected]>
Add fifo config for H3 as H3 differ with other SoC on ep number.
--- drivers/usb/musb-new/sunxi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/usb/musb-new/sunxi.c +32 -0
@@ -290,10 +290,42 @@ static const struct musb_platform_ops sunxi_musb_ops = { .disable = sunxi_musb_disable, }; +#if defined(CONFIG_MACH_SUN8I_H3 ) +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num =1 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =1 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_RX , .maxpacket =512 , }, +}; +#else +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num =1 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =1 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =5 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =5 , .style =FIFO_RX , .maxpacket =512 , }, +}; +#endif +static struct musb_hdrc_config musb_config = { + .fifo_cfg = sunxi_musb_fifo_config, + .fifo_cfg_size =ARRAY_SIZE (sunxi_musb_fifo_config), .multipoint =1 , .dyn_fifo =1 , +#if defined(CONFIG_MACH_SUN8I_H3) + .num_eps =5 , +#else .num_eps =6 , +#endif .ram_bits =11 , };
Signature · 1 line
2.7.4
PATCH v3 2/30 sunxi: musb: Add fifo config for H3
Quoted 36 lines · Jagan Teki
From: Jun Nie <[email protected]>
Add fifo config for H3 as H3 differ with other SoC on ep number.
Signed-off-by Jun Nie <[email protected]>Reviewed-by Jagan Teki <[email protected]>[jagan: fixed num_eps for H3]Signed-off-by Jagan Teki <[email protected]>Cc Marek Vasut <[email protected]>--- drivers/usb/musb-new/sunxi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)drivers/usb/musb-new/sunxi.c +14
-0@@ -290,10 +290,42 @@ static const struct musb_platform_ops sunxi_musb_ops = { .disable = sunxi_musb_disable, }; +#if defined(CONFIG_MACH_SUN8I_H3 ) +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num =1 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =1 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =2 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =3 , .style =FIFO_RX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_TX , .maxpacket =512 , }, + { .hw_ep_num =4 , .style =FIFO_RX , .maxpacket =512 , }, +}; +#else +static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { + { .hw_ep_num = 1, .style = FIFO_TX, .maxpacket = 512, },
drivers/usb/musb-new/sunxi.c static const struct musb_platform_ops sunxi_musb_ops = { · line 316
Quoted 10 lines
drivers/usb/musb-new/sunxi.c +10
-0+ { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 2, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 3, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 4, .style = FIFO_RX, .maxpacket = 512, }, + { .hw_ep_num = 5, .style = FIFO_TX, .maxpacket = 512, }, + { .hw_ep_num = 5, .style = FIFO_RX, .maxpacket = 512, }, +};
Ugh, each and every two entries are the same except for style being either RX/TX . And each tuple differs only in hw_ep_num . Generate that with some sane macro ...
Moreover, the driver is DT capable, use that to discern different SoCs and DO NOT ADD MORE IFDEFs .
Quoted 16 lines
drivers/usb/musb-new/sunxi.c +8
-0+#endif +static struct musb_hdrc_config musb_config = { + .fifo_cfg = sunxi_musb_fifo_config, + .fifo_cfg_size =ARRAY_SIZE (sunxi_musb_fifo_config), .multipoint =1 , .dyn_fifo =1 , +#if defined(CONFIG_MACH_SUN8I_H3) + .num_eps =5 , +#else .num_eps =6 , +#endif .ram_bits =11 , };
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
In reply to Jagan TekiFrom: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 30 +++++++++++++-------------- drivers/usb/host/ehci-sunxi.c | 9 +++++++- drivers/usb/host/ohci-sunxi.c | 9 +++++++- 3 files changed, 30 insertions(+), 18 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +14 -16
@@ -270,17 +270,18 @@ struct sunxi_ccm_reg {#define AXI_GATE_OFFSET_DRAM 0/* ahb_gate0 offsets */ +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +#define AHB_GATE_OFFSET_USB_OHCI3 31 +#define AHB_GATE_OFFSET_USB_OHCI2 30 +#define AHB_GATE_OFFSET_USB_OHCI1 29 +#define AHB_GATE_OFFSET_USB_OHCI0 28 +#define AHB_GATE_OFFSET_USB_EHCI3 27 +#define AHB_GATE_OFFSET_USB_EHCI2 26 +#define AHB_GATE_OFFSET_USB_EHCI1 25 +#define AHB_GATE_OFFSET_USB_EHCI0 24 +#else #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29 -#ifdef CONFIG_MACH_SUNXI_H3_H5 -/* -* These are EHCI1 - EHCI3 in the datasheet (EHCI0 is for the OTG) we call -* them 0 - 2 like they were called on older SoCs. -*/ -#define AHB_GATE_OFFSET_USB_EHCI2 27 -#define AHB_GATE_OFFSET_USB_EHCI1 26 -#define AHB_GATE_OFFSET_USB_EHCI0 25 -#else #define AHB_GATE_OFFSET_USB_EHCI1 27#define AHB_GATE_OFFSET_USB_EHCI0 26#endif
@@ -339,13 +340,10 @@ struct sunxi_ccm_reg {#define CCM_USB_CTRL_PHY2_CLK (0x1 << 10)#define CCM_USB_CTRL_PHY3_CLK (0x1 << 11)#ifdef CONFIG_MACH_SUNXI_H3_H5 -/* -* These are OHCI1 - OHCI3 in the datasheet (OHCI0 is for the OTG) we call -* them 0 - 2 like they were called on older SoCs. -*/ -#define CCM_USB_CTRL_OHCI0_CLK (0x1 << 17) -#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 18) -#define CCM_USB_CTRL_OHCI2_CLK (0x1 << 19) +#define CCM_USB_CTRL_OHCI0_CLK (0x1 << 16) +#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 17) +#define CCM_USB_CTRL_OHCI2_CLK (0x1 << 18) +#define CCM_USB_CTRL_OHCI3_CLK (0x1 << 19)#else #define CCM_USB_CTRL_OHCI0_CLK (0x1 << 16)#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 17)
drivers/usb/host/ehci-sunxi.c +8 -1
@@ -48,10 +48,17 @@ static int ehci_usb_probe(struct udevice *dev)#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) extra_ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_OHCI0 ;#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )hccr -SUNXI_USB0_BASE ) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ; +#endif priv->ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; extra_ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; - priv->phy_index++;/* Non otg phys start at 1 */ +#if !defined(CONFIG_MACH_SUNXI_H3_H5 ) && !defined(CONFIG_MACH_SUN50I ) + priv->phy_index++;/* older chips do not have EHCI with OTG */ +#endif setbits_le32 (&ccm->ahb_gate0, priv->ahb_gate_mask | extra_ahb_gate_mask);
drivers/usb/host/ohci-sunxi.c +8 -1
@@ -51,11 +51,18 @@ static int ohci_usb_probe(struct udevice *dev) extra_ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_EHCI0 ;#endif priv->usb_gate_mask =CCM_USB_CTRL_OHCI0_CLK ; +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )regs - (SUNXI_USB0_BASE +0x400 )) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )regs - (SUNXI_USB1_BASE +0x400 )) /BASE_DIST ; +#endif priv->ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; extra_ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; priv->usb_gate_mask <<= priv->phy_index; - priv->phy_index++;/* Non otg phys start at 1 */ +#if !defined(CONFIG_MACH_SUNXI_H3_H5 ) && !defined(CONFIG_MACH_SUN50I ) + priv->phy_index++;/* older chips do not have OHCI with OTG */ +#endif setbits_le32 (&ccm->ahb_gate0, priv->ahb_gate_mask | extra_ahb_gate_mask);
Signature · 1 line
2.7.4
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Quoted 109 lines
Signed-off-by Chen-Yu Tsai <[email protected]>Reviewed-by Jagan Teki <[email protected]>[jagan: remove 3/8] from commit header]Signed-off-by Jagan Teki <[email protected]>Cc Marek Vasut <[email protected]>--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 30 +++++++++++++-------------- drivers/usb/host/ehci-sunxi.c | 9 +++++++- drivers/usb/host/ohci-sunxi.c | 9 +++++++- 3 files changed, 30 insertions(+), 18 deletions(-)arch/arm/include/asm/arch-sunxi/clock_sun6i.h +14
-16@@ -270,17 +270,18 @@ struct sunxi_ccm_reg {#define AXI_GATE_OFFSET_DRAM 0/* ahb_gate0 offsets */ +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +#define AHB_GATE_OFFSET_USB_OHCI3 31 +#define AHB_GATE_OFFSET_USB_OHCI2 30 +#define AHB_GATE_OFFSET_USB_OHCI1 29 +#define AHB_GATE_OFFSET_USB_OHCI0 28 +#define AHB_GATE_OFFSET_USB_EHCI3 27 +#define AHB_GATE_OFFSET_USB_EHCI2 26 +#define AHB_GATE_OFFSET_USB_EHCI1 25 +#define AHB_GATE_OFFSET_USB_EHCI0 24 +#else #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29 -#ifdef CONFIG_MACH_SUNXI_H3_H5 -/* -* These are EHCI1 - EHCI3 in the datasheet (EHCI0 is for the OTG) we call -* them 0 - 2 like they were called on older SoCs. -*/ -#define AHB_GATE_OFFSET_USB_EHCI2 27 -#define AHB_GATE_OFFSET_USB_EHCI1 26 -#define AHB_GATE_OFFSET_USB_EHCI0 25 -#else #define AHB_GATE_OFFSET_USB_EHCI1 27#define AHB_GATE_OFFSET_USB_EHCI0 26#endif @@ -339,13 +340,10 @@ struct sunxi_ccm_reg {#define CCM_USB_CTRL_PHY2_CLK (0x1 << 10)#define CCM_USB_CTRL_PHY3_CLK (0x1 << 11)#ifdef CONFIG_MACH_SUNXI_H3_H5 -/* -* These are OHCI1 - OHCI3 in the datasheet (OHCI0 is for the OTG) we call -* them 0 - 2 like they were called on older SoCs. -*/ -#define CCM_USB_CTRL_OHCI0_CLK (0x1 << 17) -#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 18) -#define CCM_USB_CTRL_OHCI2_CLK (0x1 << 19) +#define CCM_USB_CTRL_OHCI0_CLK (0x1 << 16) +#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 17) +#define CCM_USB_CTRL_OHCI2_CLK (0x1 << 18) +#define CCM_USB_CTRL_OHCI3_CLK (0x1 << 19)#else #define CCM_USB_CTRL_OHCI0_CLK (0x1 << 16)#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 17)drivers/usb/host/ehci-sunxi.c +8
-1@@ -48,10 +48,17 @@ static int ehci_usb_probe(struct udevice *dev)#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) extra_ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_OHCI0 ;#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )hccr -SUNXI_USB0_BASE ) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ; +#endif priv->ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; extra_ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; - priv->phy_index++;/* Non otg phys start at 1 */ +#if !defined(CONFIG_MACH_SUNXI_H3_H5 ) && !defined(CONFIG_MACH_SUN50I ) + priv->phy_index++;/* older chips do not have EHCI with OTG */ +#endif setbits_le32 (&ccm->ahb_gate0, priv->ahb_gate_mask | extra_ahb_gate_mask);drivers/usb/host/ohci-sunxi.c +8
-1@@ -51,11 +51,18 @@ static int ohci_usb_probe(struct udevice *dev) extra_ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_EHCI0 ;#endif priv->usb_gate_mask =CCM_USB_CTRL_OHCI0_CLK ; +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )regs - (SUNXI_USB0_BASE +0x400 )) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )regs - (SUNXI_USB1_BASE +0x400 )) /BASE_DIST ; +#endif priv->ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; extra_ahb_gate_mask <<= priv->phy_index *AHB_CLK_DIST ; priv->usb_gate_mask <<= priv->phy_index; - priv->phy_index++;/* Non otg phys start at 1 */ +#if !defined(CONFIG_MACH_SUNXI_H3_H5 ) && !defined(CONFIG_MACH_SUN50I ) + priv->phy_index++;/* older chips do not have OHCI with OTG */ +#endif setbits_le32 (&ccm->ahb_gate0, priv->ahb_gate_mask | extra_ahb_gate_mask);
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 7 lines · Marek Vasut
Quoted 6 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
Quoted 6 lines
Quoted 2 lines
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
+#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I)
+ /* Newer chips have a EHCI/OHCI host pair for OTG host mode */
+ priv->phy_index = ((uintptr_t)hccr - SUNXI_USB0_BASE) / BASE_DIST;
+#else
priv->phy_index = ((uintptr_t)hccr - SUNXI_USB1_BASE) / BASE_DIST;
+#endif
You can associate data with each DT compatible in the struct udevice_id, so this should be rather trivial change _without_ adding any ifdefs.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 24 lines · Marek Vasut
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
drivers/usb/host/ehci-sunxi.c static int ehci_usb_probe(struct udevice *dev) · line 56
Quoted 6 lines
drivers/usb/host/ehci-sunxi.c +5
-0+#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )hccr -SUNXI_USB0_BASE ) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ; +#endif
if you read it previous comment clearly for "phy, reset, clock" writes it may not possible and true for above ifdef.
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 25 lines · Jagan Teki
Quoted 24 lines · Marek Vasut
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
Quoted 9 lines
drivers/usb/host/ehci-sunxi.c static int ehci_usb_probe(struct udevice *dev) · line 56
Quoted 6 lines
drivers/usb/host/ehci-sunxi.c +5
-0+#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )hccr -SUNXI_USB0_BASE ) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ; +#endif if you read it previous comment clearly for "phy, reset, clock" writes it may not possible and true for above ifdef.
I only see if (platform is foo or bar) set phy_index to something else set it to something else, therefore I think the comment about 'phy, reset, clock' is irrelevant.
You can very well add ie.
{ .compatible = "allwinner,sun5i-a13-ohci", .data = TYPE_FOO },
And then do
if (dev_get_driver_data(...) == TYPE_FOO)
priv->phy_index = bar;
else
priv->.......;
If you think this is not possible, please do explain why in detail.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 43 lines · Marek Vasut
Quoted 25 lines · Jagan Teki
Quoted 24 lines · Marek Vasut
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
Quoted 9 lines
drivers/usb/host/ehci-sunxi.c static int ehci_usb_probe(struct udevice *dev) · line 56
Quoted 6 lines
drivers/usb/host/ehci-sunxi.c +5
-0+#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +/* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t )hccr -SUNXI_USB0_BASE ) /BASE_DIST ; +#else priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ; +#endif if you read it previous comment clearly for "phy, reset, clock" writes it may not possible and true for above ifdef.
I only see if (platform is foo or bar) set
phy_indexto something else set it to something else, therefore I think the comment about 'phy, reset, clock' is irrelevant.You can very well add ie.
{ .compatible = "allwinner,sun5i-a13-ohci", .data =TYPE_FOO},
Quoted 8 lines
And then do
if (
dev_get_driver_data(...)==TYPE_FOO)
priv->phy_index= bar;
else
priv->.......;If you think this is not possible, please do explain why in detail.
Can I expect a new patchset using DT properly ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 46 lines · Marek Vasut
Quoted 45 lines · Marek Vasut
Quoted 25 lines · Jagan Teki
Quoted 24 lines · Marek Vasut
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) + /* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t)hccr - SUNXI_USB0_BASE) / BASE_DIST; +#else priv->phy_index = ((uintptr_t)hccr - SUNXI_USB1_BASE) / BASE_DIST; +#endifif you read it previous comment clearly for "phy, reset, clock" writes it may not possible and true for above ifdef.
I only see if (platform is foo or bar) set
phy_indexto something else set it to something else, therefore I think the comment about 'phy, reset, clock' is irrelevant.You can very well add ie.
{ .compatible = "allwinner,sun5i-a13-ohci", .data =TYPE_FOO},And then do
Quoted 8 lines
Quoted 6 lines
if (
dev_get_driver_data(...)==TYPE_FOO)
priv->phy_index= bar;
else
priv->.......;If you think this is not possible, please do explain why in detail.
Can I expect a new patchset using DT properly ?
Yes Marek, I'm working on infact I'm trying to get these SOC's specs out from musb and writing phy driver for that matter.
PATCH v3 3/30 sunxi: Fix USB PHY index for H3/H5/A64
Quoted 52 lines · Jagan Teki
Quoted 51 lines · Marek Vasut
Quoted 50 lines · Marek Vasut
Quoted 25 lines · Jagan Teki
Quoted 24 lines · Marek Vasut
Quoted 11 lines · Jagan Teki
Quoted 10 lines · Marek Vasut
Quoted 8 lines · Jagan Teki
From: Chen-Yu Tsai <[email protected]>
On the new chips such as H3, H5, and A64, the USB OTG controller is paired with a set of proper EHCI/OHCI USB hosts. To enable these hosts, the USB PHY index count has to be reworked to start from this pair.
This patch reworks the USB clock gate and reset indices, and how the USB host is mapped to a USB phy, for the newer chips.
Quoted 7 lines
Quoted 3 lines
The ifdeffery is awful. The driver is DT capable, do why don't you detect the block type / soc type from DT and handle this dynamically instead of adding ifdefs ?
Though this driver is DT capable phy, reset, clock and other still need to have have it. till now we are relying on ifdef's to move feature to work first.
This statement makes no sense, just use the DT compatible to discern the block type and get rid of statements like this:
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) + /* Newer chips have a EHCI/OHCI host pair for OTG host mode */ + priv->phy_index = ((uintptr_t)hccr - SUNXI_USB0_BASE) / BASE_DIST; +#else priv->phy_index = ((uintptr_t)hccr - SUNXI_USB1_BASE) / BASE_DIST; +#endifif you read it previous comment clearly for "phy, reset, clock" writes it may not possible and true for above ifdef.
I only see if (platform is foo or bar) set
phy_indexto something else set it to something else, therefore I think the comment about 'phy, reset, clock' is irrelevant.You can very well add ie.
{ .compatible = "allwinner,sun5i-a13-ohci", .data =TYPE_FOO},And then do
if (
dev_get_driver_data(...)==TYPE_FOO)
priv->phy_index= bar;
else
priv->.......;
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
If you think this is not possible, please do explain why in detail.
Can I expect a new patchset using DT properly ?
Yes Marek, I'm working on infact I'm trying to get these SOC's specs out from musb and writing phy driver for that matter.
Good!
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 4/30 sunxi: musb: Hack dynamic fifo support for H3 OTG
In reply to Jagan TekiFrom: Jun Nie <[email protected]>
Like other Allwinner SoC, the H3 is missing the config register from the musb hardware block. Use a known working value for it like other SoC.
--- drivers/usb/musb-new/musb_regs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/musb-new/musb_regs.h +2 -1
@@ -432,7 +432,8 @@ static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase)static inline u8 musb_read_configdata (void __iomem *mbase) { -#if definedCONFIG_MACH_SUN8I_A33 || definedCONFIG_MACH_SUN8I_A83T +#if defined(CONFIG_MACH_SUN8I_A33 ) || defined(CONFIG_MACH_SUN8I_A83T ) || \ + defined(CONFIG_MACH_SUNXI_H3_H5 )/* <Sigh> allwinner saves a reg, and we need to hardcode this */ return 0xde ;#else
Signature · 1 line
2.7.4
PATCH v3 5/30 sunxi: musb: Enable OTG device clock for H3
In reply to Jagan TekiFrom: Jun Nie <[email protected]>
Enable OTG clock and deassert reset
--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + drivers/usb/musb-new/sunxi.c | 8 ++++++++ 2 files changed, 9 insertions(+)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +1 -0
@@ -279,6 +279,7 @@ struct sunxi_ccm_reg {#define AHB_GATE_OFFSET_USB_EHCI2 26#define AHB_GATE_OFFSET_USB_EHCI1 25#define AHB_GATE_OFFSET_USB_EHCI0 24 +#define AHB_GATE_OFFSET_OTG_DEVICE 23#else #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29
drivers/usb/musb-new/sunxi.c +8 -0
@@ -266,6 +266,11 @@ static int sunxi_musb_init(struct musb *musb)#ifdef CONFIG_SUNXI_GEN_SUN6I setbits_le32 (&ccm->ahb_reset0_cfg,1 <<AHB_GATE_OFFSET_USB0 );#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +setbits_le32 (&ccm->ahb_gate0,BIT (AHB_GATE_OFFSET_OTG_DEVICE )); +setbits_le32 (&ccm->ahb_reset0_cfg,BIT (AHB_GATE_OFFSET_OTG_DEVICE )); +#endif +sunxi_usb_phy_init (0 );USBC_ConfigFIFO_Base ();
@@ -380,6 +385,9 @@ static int musb_usb_remove(struct udevice *dev)#ifdef CONFIG_SUNXI_GEN_SUN6I clrbits_le32 (&ccm->ahb_reset0_cfg,1 <<AHB_GATE_OFFSET_USB0 );#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +clrbits_le32 (&ccm->ahb_gate0,1 <<AHB_GATE_OFFSET_OTG_DEVICE ); +#endif clrbits_le32 (&ccm->ahb_gate0,1 <<AHB_GATE_OFFSET_USB0 );free (host->host);
Signature · 1 line
2.7.4
PATCH v3 5/30 sunxi: musb: Enable OTG device clock for H3
Quoted 9 lines · Jagan Teki
From: Jun Nie <[email protected]>
Enable OTG clock and deassert reset
Signed-off-by Jun Nie <[email protected]>[jagan: fixed AHB_GATE_OFFSET_OTG_DEVICE to use H3/H5/A64]Signed-off-by Jagan Teki <[email protected]>Reviewed-by Jagan Teki <[email protected]>Cc Marek Vasut <[email protected]>
Same concern about DT and ifdefs here ...
Quoted 44 lines
--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + drivers/usb/musb-new/sunxi.c | 8 ++++++++ 2 files changed, 9 insertions(+)arch/arm/include/asm/arch-sunxi/clock_sun6i.h +1
-0@@ -279,6 +279,7 @@ struct sunxi_ccm_reg {#define AHB_GATE_OFFSET_USB_EHCI2 26#define AHB_GATE_OFFSET_USB_EHCI1 25#define AHB_GATE_OFFSET_USB_EHCI0 24 +#define AHB_GATE_OFFSET_OTG_DEVICE 23#else #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29drivers/usb/musb-new/sunxi.c +8
-0@@ -266,6 +266,11 @@ static int sunxi_musb_init(struct musb *musb)#ifdef CONFIG_SUNXI_GEN_SUN6I setbits_le32 (&ccm->ahb_reset0_cfg,1 <<AHB_GATE_OFFSET_USB0 );#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +setbits_le32 (&ccm->ahb_gate0,BIT (AHB_GATE_OFFSET_OTG_DEVICE )); +setbits_le32 (&ccm->ahb_reset0_cfg,BIT (AHB_GATE_OFFSET_OTG_DEVICE )); +#endif +sunxi_usb_phy_init (0 );USBC_ConfigFIFO_Base ();@@ -380,6 +385,9 @@ static int musb_usb_remove(struct udevice *dev)#ifdef CONFIG_SUNXI_GEN_SUN6I clrbits_le32 (&ccm->ahb_reset0_cfg,1 <<AHB_GATE_OFFSET_USB0 );#endif +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +clrbits_le32 (&ccm->ahb_gate0,1 <<AHB_GATE_OFFSET_OTG_DEVICE ); +#endif clrbits_le32 (&ccm->ahb_gate0,1 <<AHB_GATE_OFFSET_USB0 );free (host->host);
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 6/30 sunxi: usb_phy: setup USB PHY passby for USB0 on H3/H5/A64
In reply to Jagan TekiFrom: Chen-Yu Tsai <[email protected]>
On newer chips, there is a pair of EHCI/OHCI USB hosts for OTG host mode. USB PHY passby must be configured for its corresponding PHY.
--- arch/arm/mach-sunxi/usb_phy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/usb_phy.c +6 -1
@@ -239,7 +239,12 @@ void sunxi_usb_phy_init(int index)sunxi_usb_phy_config (phy); -if (phy->id !=0 ) +/* +* Later SoCs such as the H3, H5, A64 have proper hosts for OTG. +* As such the passby settings need to be set for them as well. +*/ +if (phy->id !=0 ||IS_ENABLED (CONFIG_MACH_SUNXI_H3_H5 ) || +IS_ENABLED (CONFIG_MACH_SUN50I ))sunxi_usb_phy_passby (phy,SUNXI_USB_PASSBY_EN );#ifdef CONFIG_MACH_SUN8I_A83T
Signature · 1 line
2.7.4
PATCH v3 7/30 sunxi: H3: set different otg base address per mode
In reply to Jagan TekiFrom: Jun Nie <[email protected]>
Set different base address per host mode or peripheral mode. Phy configuration also depends on this address.
--- arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +4 -0
@@ -64,7 +64,11 @@#ifdef CONFIG_SUNXI_GEN_SUN6I #if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I )#define SUNXI_USBPHY_BASE 0x01c19000 +#ifdef CONFIG_USB_MUSB_GADGET +#define SUNXI_USB0_BASE 0x01c19000 +#else #define SUNXI_USB0_BASE 0x01c1a000 +#endif #define SUNXI_USB1_BASE 0x01c1b000#define SUNXI_USB2_BASE 0x01c1c000#define SUNXI_USB3_BASE 0x01c1d000
Signature · 1 line
2.7.4
PATCH v3 8/30 sunxi: usb_phy: Clear PHYCTL register before writing
In reply to Jagan TekiPHYCTL register offset at 0x10 need to be cleared before it's written. Ported from below Linux patch.
d699c1d phy: sun4i-usb: change PHYCTL register clearing code
--- arch/arm/mach-sunxi/usb_phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/usb_phy.c +2 -1
@@ -126,7 +126,8 @@ __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr,int j =0 , usbc_bit =0 ;void *dest = (void *)SUNXI_USB0_BASE +SUNXI_USB_CSR ; -#ifdef CONFIG_MACH_SUN8I_A33 +#if defined(CONFIG_MACH_SUN8I_A33 ) || defined(CONFIG_MACH_SUNXI_H3_H5 ) || \ + defined(CONFIG_MACH_SUN50I )/* CSR needs to be explicitly initialized to 0 on A33 */ writel (0 , dest);#endif
Signature · 1 line
2.7.4
PATCH v3 8/30 sunxi: usb_phy: Clear PHYCTL register before writing
Hi,
Quoted 6 lines · Jagan Teki
PHYCTL register offset at
0x10need to be cleared before it's written. Ported from below Linux patch.
d699c1d phy: sun4i-usb: change PHYCTL register clearing codeSigned-off-by Jagan Teki <[email protected]>Signed-off-by Jun Nie <[email protected]>
Those signed-off-by don't make much sense. Either Jun made that patch and should be the author, or you made that patch, and Jun Signed-off shouldn't be there.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180129/15eb4c11/attachment.sig>
PATCH v3 8/30 sunxi: usb_phy: Clear PHYCTL register before writing
Quoted 7 lines · Maxime Ripard
Hi,
Quoted 4 lines · Jagan Teki
PHYCTL register offset at
0x10need to be cleared before it's written. Ported from below Linux patch.
d699c1d phy: sun4i-usb: change PHYCTL register clearing code
Quoted 6 lines
Quoted 2 lines
Signed-off-by Jagan Teki <[email protected]>Signed-off-by Jun Nie <[email protected]>Those signed-off-by don't make much sense. Either Jun made that patch and should be the author, or you made that patch, and Jun Signed-off shouldn't be there.
Don't understand what doesn't make sense, more Signed-off-by implies group of people worked on the particular change and author who usually made this. This is what I usually follow all my patches if the change/patch work together.
PATCH v3 8/30 sunxi: usb_phy: Clear PHYCTL register before writing
Quoted 12 lines · Jagan Teki
Quoted 10 lines · Maxime Ripard
Hi,
Quoted 6 lines · Jagan Teki
PHYCTL register offset at
0x10need to be cleared before it's written. Ported from below Linux patch.
d699c1d phy: sun4i-usb: change PHYCTL register clearing codeSigned-off-by Jagan Teki <[email protected]>Signed-off-by Jun Nie <[email protected]>
Quoted 8 lines
Quoted 3 lines
Those signed-off-by don't make much sense. Either Jun made that patch and should be the author, or you made that patch, and Jun Signed-off shouldn't be there.
Don't understand what doesn't make sense, more Signed-off-by implies group of people worked on the particular change and author who usually made this. This is what I usually follow all my patches if the change/patch work together.
Jun's Signed-off implies that he merged and carried this patch, ie Jun was acting as a maintainer, or was sending a patch on behalf of you. This isn't the case.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180129/41450e42/attachment.sig>
PATCH v3 9/30 ARM: dts: sun8i-h3: bananapi-m2-plus: Sync usb otg nodes from Linux
In reply to Jagan TekiBananapi-m2-plus has usb otg routed host with either EHCI0/OHCI0 sync the same from Linux.
--- arch/arm/dts/sun8i-h3-bananapi-m2-plus.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/dts/sun8i-h3-bananapi-m2-plus.dts +13 -0
@@ -93,6 +93,10 @@ }; }; +&ehci0 { + status = "okay"; +}; + &ehci1 { status = "okay"; };
@@ -146,6 +150,10 @@ status = "okay"; }; +&ohci0 { + status = "okay"; +}; + &ohci1 { status = "okay"; };
@@ -189,6 +197,11 @@ status = "okay"; }; +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + &usbphy { /* USB VBUS is on as long as VCC-IO is on */ status = "okay";
Signature · 1 line
2.7.4
PATCH v3 10/30 configs: bananapi-m2-plus: Enable USB OTG peripheral mode
In reply to Jagan TekiEnable USB_MUSB_GADGET which operate OTG in peripheral mode
--- configs/Sinovoip_BPI_M2_Plus_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/Sinovoip_BPI_M2_Plus_defconfig +1 -0
@@ -16,4 +16,5 @@ CONFIG_SPL=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.7.4
PATCH v3 11/30 configs: sun50i: Drop CONFIG_USB_MAX_CONTROLLER_COUNT
In reply to Jagan TekiNow, DM_USB enabled and controller info exctracted from DT so drop explicit count.
--- include/configs/sun50i.h | 1 - 1 file changed, 1 deletion(-)
include/configs/sun50i.h +0 -1
@@ -13,7 +13,6 @@#ifdef CONFIG_USB_EHCI_HCD #define CONFIG_USB_EHCI_SUNXI -#define CONFIG_USB_MAX_CONTROLLER_COUNT 1#endif #define CONFIG_SUNXI_USB_PHYS 1
Signature · 1 line
2.7.4
PATCH v3 12/30 msub: sunxi: Update proper fifo config for H5
In reply to Jagan TekiLike H3, H5 has similar fifo config with fifo count 5, so update same H3 config to H5 as well.
--- drivers/usb/musb-new/sunxi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb-new/sunxi.c +2 -2
@@ -295,7 +295,7 @@ static const struct musb_platform_ops sunxi_musb_ops = { .disable = sunxi_musb_disable, }; -#if defined(CONFIG_MACH_SUN8I_H3 ) +#if defined(CONFIG_MACH_SUNXI_H3_H5 )static struct musb_fifo_cfg sunxi_musb_fifo_config[] = { { .hw_ep_num =1 , .style =FIFO_TX , .maxpacket =512 , }, { .hw_ep_num = 1, .style = FIFO_RX, .maxpacket = 512, },
@@ -326,7 +326,7 @@ static struct musb_hdrc_config musb_config = { .fifo_cfg_size = ARRAY_SIZE(sunxi_musb_fifo_config), .multipoint = 1, .dyn_fifo = 1, -#if defined(CONFIG_MACH_SUN8I_H3 ) +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) .num_eps = 5, #else .num_eps = 6,
Signature · 1 line
2.7.4
PATCH v3 13/30 configs: sun50i: Set proper USB PHY count for H5
In reply to Jagan TekiLike Allwinner H3 even H5 as integrates with 4 USB PHYs which are connected as:
PHY#0: shared between USB-OTG_DEVICE and USB_OTG_EHCI0/OHCI0 PHY#1: USB-HCI1(EHCI1/OHCI1)
PHY#2: USB-HCI2(EHCI2/OHCI2)
PHY#3: USB-HCI3(EHCI3/OHCI3)
--- include/configs/sun50i.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/configs/sun50i.h +5 -1
@@ -15,7 +15,11 @@#define CONFIG_USB_EHCI_SUNXI #endif -#define CONFIG_SUNXI_USB_PHYS 1 +#ifdef CONFIG_MACH_SUNXI_H3_H5 +# define CONFIG_SUNXI_USB_PHYS 4 +#else +# define CONFIG_SUNXI_USB_PHYS 1 +#endif #define GICD_BASE 0x1c81000#define GICC_BASE 0x1c82000
Signature · 1 line
2.7.4
PATCH v3 14/30 sunxi: usb_phy: Fix phy_config to handle all SOC's
In reply to Jagan Teki- enable_pmu_unk1 for V3S/H3/H5/A64
- enable usb 45 Ohm calibration for all non A83T SOC's
- adjust PHY's magnitude for all non A83T SOC's
--- arch/arm/mach-sunxi/usb_phy.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-)
arch/arm/mach-sunxi/usb_phy.c +11 -20
@@ -153,41 +153,32 @@ __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr, } } -#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +#ifndef CONFIG_MACH_SUN8I_A83T static void sunxi_usb_phy_config (struct sunxi_usb_phy *phy) {#if definedCONFIG_MACH_SUNXI_H3_H5 if (phy->id ==0 )clrbits_le32 (SUNXI_USBPHY_BASE +REG_PHY_UNK_H3 ,0x01 );#endif + +# if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) || \ + defined(CONFIG_MACH_SUN8I_V3S )clrbits_le32 (phy->base +REG_PMU_UNK_H3 ,0x02 ); -} -#elif definedCONFIG_MACH_SUN8I_A83T -static void sunxi_usb_phy_config (struct sunxi_usb_phy *phy) -{ -} -#else -static void sunxi_usb_phy_config (struct sunxi_usb_phy *phy) -{ -/* The following comments are machine -* translated from Chinese, you have been warned! -*/ +# endif -/* Regulation 45 ohms */ +/* Enable USB 45 Ohm resistor calibration */ if (phy->id ==0 )usb_phy_write (phy,0x0c ,0x01 ,1 ); -/* adjust PHY's magnitude and rate */ +/* Adjust PHY's magnitude and rate */ usb_phy_write (phy,0x20 ,0x14 ,5 ); -/* threshold adjustment disconnect */ -#if definedCONFIG_MACH_SUN5I || definedCONFIG_MACH_SUN7I +/* Disconnect threshold adjustment */ +# if definedCONFIG_MACH_SUN5I || definedCONFIG_MACH_SUN7I usb_phy_write (phy,0x2a ,2 ,2 ); -#else +# else usb_phy_write (phy,0x2a ,3 ,2 ); -#endif - -return ; +# endif }#endif
Signature · 1 line
2.7.4
PATCH v3 15/30 musb: sunxi: Add phy0 dual route support
In reply to Jagan TekiAllwinner V3/H3/H5/A64 have PHY0 dual_route, where routing happens through EHCI/OHCI or through MUSB based id_det. id_det can be 0 and 1 for Host and Peripheral dr_modes and it can be gpio value for OTG.
--- arch/arm/include/asm/arch-sunxi/usb_phy.h | 1 + arch/arm/mach-sunxi/usb_phy.c | 20 ++++++++++++++++++++ drivers/usb/musb-new/sunxi.c | 7 +++++++ 3 files changed, 28 insertions(+)
arch/arm/include/asm/arch-sunxi/usb_phy.h +1 -0
@@ -19,3 +19,4 @@ void sunxi_usb_phy_power_off(int index);int sunxi_usb_phy_vbus_detect (int index);int sunxi_usb_phy_id_detect (int index);void sunxi_usb_phy_enable_squelch_detect (int index,int enable); +void sunxi_usb_phy0_reroute (int id_det);
arch/arm/mach-sunxi/usb_phy.c +20 -0
@@ -28,6 +28,8 @@#else #define SUNXI_USB_CSR 0x410#endif +#define REG_PHY_OTGCTL 0x420 +#define OTGCTL_ROUTE_MUSB BIT(0)#define SUNXI_USB_PMU_IRQ_ENABLE 0x800#define SUNXI_USB_PASSBY_EN 1
@@ -332,6 +334,24 @@ int sunxi_usb_phy_id_detect(int index)return gpio_get_value (phy->gpio_id_det); } +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) || \ + defined(CONFIG_MACH_SUN8I_V3S ) +void sunxi_usb_phy0_reroute (int id_det) +{ +u32 regval; + + regval =readl (SUNXI_USB0_BASE +REG_PHY_OTGCTL ); +if (id_det ==0 ) { +/* Host mode. Route phy0 to EHCI/OHCI */ + regval &= ~OTGCTL_ROUTE_MUSB ; + }else { +/* Peripheral mode. Route phy0 to MUSB */ + regval |=OTGCTL_ROUTE_MUSB ; + } +writel (regval,SUNXI_USB0_BASE +REG_PHY_OTGCTL ); +} +#endif +int sunxi_usb_phy_probe (void ) {struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;
drivers/usb/musb-new/sunxi.c +7 -0
@@ -272,6 +272,13 @@ static int sunxi_musb_init(struct musb *musb)#endif sunxi_usb_phy_init (0 ); +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) || \ + defined(CONFIG_MACH_SUN8I_V3S ) +if (is_host_enabled (musb)) +sunxi_usb_phy0_reroute (0 ); +else +sunxi_usb_phy0_reroute (1 ); +#endif USBC_ConfigFIFO_Base ();USBC_EnableDpDmPullUp (musb->mregs);
Signature · 1 line
2.7.4
PATCH v3 15/30 musb: sunxi: Add phy0 dual route support
Quoted 35 lines · Jagan Teki
Allwinner V3/H3/H5/A64 have PHY0
dual_route, where routing happens through EHCI/OHCI or through MUSB basedid_det.id_detcan be 0 and 1 for Host and Peripheraldr_modesand it can be gpio value for OTG.Signed-off-by Jagan Teki <[email protected]>Cc Marek Vasut <[email protected]>--- arch/arm/include/asm/arch-sunxi/usb_phy.h | 1 + arch/arm/mach-sunxi/usb_phy.c | 20 ++++++++++++++++++++ drivers/usb/musb-new/sunxi.c | 7 +++++++ 3 files changed, 28 insertions(+)arch/arm/include/asm/arch-sunxi/usb_phy.h +1
-0@@ -19,3 +19,4 @@ void sunxi_usb_phy_power_off(int index);int sunxi_usb_phy_vbus_detect (int index);int sunxi_usb_phy_id_detect (int index);void sunxi_usb_phy_enable_squelch_detect (int index,int enable); +void sunxi_usb_phy0_reroute (int id_det);arch/arm/mach-sunxi/usb_phy.c +2
-0@@ -28,6 +28,8 @@#else #define SUNXI_USB_CSR 0x410#endif +#define REG_PHY_OTGCTL 0x420 +#define OTGCTL_ROUTE_MUSB BIT(0)#define SUNXI_USB_PMU_IRQ_ENABLE 0x800#define SUNXI_USB_PASSBY_EN 1
arch/arm/mach-sunxi/usb_phy.c int sunxi_usb_phy_id_detect(int index) · line 339
Quoted 6 lines
arch/arm/mach-sunxi/usb_phy.c +3
-0@@ -332,6 +334,24 @@ int sunxi_usb_phy_id_detect(int index)return gpio_get_value (phy->gpio_id_det); } +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) || \ + defined(CONFIG_MACH_SUN8I_V3S ) +void sunxi_usb_phy0_reroute (int id_det)
Is this supposed to be bool mode ?
Also, ifdefs ... use DT.
Quoted 37 lines
arch/arm/mach-sunxi/usb_phy.c +15
-0+{ +u32 regval; + + regval =readl (SUNXI_USB0_BASE +REG_PHY_OTGCTL ); +if (id_det ==0 ) { +/* Host mode. Route phy0 to EHCI/OHCI */ + regval &= ~OTGCTL_ROUTE_MUSB ; + }else { +/* Peripheral mode. Route phy0 to MUSB */ + regval |=OTGCTL_ROUTE_MUSB ; + } +writel (regval,SUNXI_USB0_BASE +REG_PHY_OTGCTL ); +} +#endif +int sunxi_usb_phy_probe (void ) {struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;drivers/usb/musb-new/sunxi.c +7
-0@@ -272,6 +272,13 @@ static int sunxi_musb_init(struct musb *musb)#endif sunxi_usb_phy_init (0 ); +#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) || \ + defined(CONFIG_MACH_SUN8I_V3S ) +if (is_host_enabled (musb)) +sunxi_usb_phy0_reroute (0 ); +else +sunxi_usb_phy0_reroute (1 ); +#endif USBC_ConfigFIFO_Base ();USBC_EnableDpDmPullUp (musb->mregs);
Signature · 2 lines
Best regards, Marek Vasut
PATCH v3 16/30 arm64: allwinner: h5: orangepi-pc2: Order nodes in alphabetic
In reply to Jagan TekiOrder sun50i-h5-orangepi-pc2.dts nodes in alphabetic
--- arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 49 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-)
arch/arm/dts/sun50i-h5-orangepi-pc2.dts +25 -24
@@ -50,6 +50,11 @@ model = "OrangePi PC 2"; compatible = "xunlong,orangepi-pc-2", "allwinner,sun50i-h5"; + aliases { + serial0 = &uart0; + ethernet0 = &emac; + }; + chosen { stdout-path = "serial0:115200n8"; };
@@ -58,11 +63,6 @@ reg = <0x40000000 0x40000000>; }; - aliases { - serial0 = &uart0; - ethernet0 = &emac; - }; - soc { reg_vcc3v3: vcc3v3 { compatible = "regulator-fixed";
@@ -73,6 +73,22 @@ }; }; +&emac { + pinctrl-names = "default"; + pinctrl-0 = <&emac_rgmii_pins>; + phy-mode = "rgmii"; + phy = <&phy1>; + status = "okay"; + + phy1: ethernet-phy at 1 { + reg = <1>; + }; +}; + +&ehci1 { + status = "okay"; +}; + &mmc0 { compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc",
@@ -86,6 +102,10 @@ status = "okay"; }; +&ohci1 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>;
@@ -96,22 +116,3 @@ status = "okay"; }; -&ohci1 { - status = "okay"; -}; - -&ehci1 { - status = "okay"; -}; - -&emac { - pinctrl-names = "default"; - pinctrl-0 = <&emac_rgmii_pins>; - phy-mode = "rgmii"; - phy = <&phy1>; - status = "okay"; - - phy1: ethernet-phy at 1 { - reg = <1>; - }; -};
Signature · 1 line
2.7.4
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
In reply to Jagan TekiU-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the ENV_OFFSET to 0x100000 so the u-boot size limit increased to 0xf6000
MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiB
--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
env/Kconfig +2 -1
@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64 help Offset from the start of the device (or partition)
include/configs/sunxi-common.h +1 -1
@@ -154,7 +154,7 @@* (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)), but the value will be used * directly in a makefile, without the preprocessor expansion. */ -#define CONFIG_BOARD_SIZE_LIMIT 0x7e000 +#define CONFIG_BOARD_SIZE_LIMIT 0xf6000#endif #if CONFIG_MMC_SUNXI_SLOT_EXTRA !=-1
Signature · 1 line
2.7.4
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 23 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)env/Kconfig +0
-0
env/Kconfig config ENV_OFFSET · line 445
Quoted 6 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64
This breaks all existing platforms. NAK.
Why do you think we went into so great troubles recently?
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180129/7d360af1/attachment.sig>
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Can you elaborate, what it breaks. 32 bit sunxi start with 0x88000 and 64-sun start with 0x100000 this is what I expecting here.
Quoted 2 lines
Why do you think we went into so great troubles recently?
Certainly yes, MUSB_GADGET increasing u-boot.itb 548K
u-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 35 lines · Jagan Teki
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Quoted 2 lines
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.
If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
Quoted 10 lines
Quoted 1 line
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..
That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180130/8998d8dd/attachment.sig>
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 36 lines · Maxime Ripard
Quoted 35 lines · Jagan Teki
Quoted 32 lines · Maxime Ripard
Quoted 23 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)env/Kconfig +0
-0env/Kconfig config ENV_OFFSET · line 445
Quoted 6 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Quoted 5 lines
Quoted 2 lines
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
True, but we can't control this adding new stuff ultimately increasing size. either we can stop working new features or increasing partition size, do you have any other suggestions?
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..
Quoted 2 lines
That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Sorry, can't understand please explain it little bit.
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 41 lines · Jagan Teki
Quoted 39 lines · Maxime Ripard
Quoted 37 lines · Jagan Teki
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.
Quoted 6 lines
Quoted 2 lines
If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
True, but we can't control this adding new stuff ultimately increasing size. either we can stop working new features or increasing partition size, do you have any other suggestions?
https://lists.denx.de/pipermail/u-boot/2017-December/314940.html
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 1 line
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..
Quoted 4 lines
Quoted 2 lines
That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Sorry, can't understand please explain it little bit.
We've had:
https://patchwork.ozlabs.org/cover/828100/
https://patchwork.ozlabs.org/cover/851904/
https://patchwork.ozlabs.org/cover/864994/
That were doing everything we could to *not* move the location of the environment in order to address the issue. Why do you think we did that?
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180131/21d85c97/attachment.sig>
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 81 lines · Maxime Ripard
Quoted 41 lines · Jagan Teki
Quoted 39 lines · Maxime Ripard
Quoted 37 lines · Jagan Teki
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.Quoted 6 lines
Quoted 2 lines
If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
True, but we can't control this adding new stuff ultimately increasing size. either we can stop working new features or increasing partition size, do you have any other suggestions?
https://lists.denx.de/pipermail/u-boot/2017-December/314940.html
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 1 line
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..Quoted 4 lines
Quoted 2 lines
That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Sorry, can't understand please explain it little bit.
We've had:
https://patchwork.ozlabs.org/cover/828100/
https://patchwork.ozlabs.org/cover/851904/
https://patchwork.ozlabs.org/cover/864994/That were doing everything we could to *not* move the location of the environment in order to address the issue. Why do you think we did that?
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
In reply to Maxime RipardQuoted 65 lines · Maxime Ripard
Quoted 41 lines · Jagan Teki
Quoted 39 lines · Maxime Ripard
Quoted 37 lines · Jagan Teki
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.Quoted 6 lines
Quoted 2 lines
If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
True, but we can't control this adding new stuff ultimately increasing size. either we can stop working new features or increasing partition size, do you have any other suggestions?
https://lists.denx.de/pipermail/u-boot/2017-December/314940.html
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
Quoted 1 line
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Quoted 6 lines
Quoted 1 line
Sorry, can't understand please explain it little bit.
We've had:
https://patchwork.ozlabs.org/cover/828100/
https://patchwork.ozlabs.org/cover/851904/
https://patchwork.ozlabs.org/cover/864994/
Now we have transition IN, and we can able to change the SIZE check right?
PATCH v3 17/30 sunxi: arm64: Increase u-boot size on MMC environment
Quoted 67 lines · Jagan Teki
Quoted 65 lines · Maxime Ripard
Quoted 41 lines · Jagan Teki
Quoted 39 lines · Maxime Ripard
Quoted 37 lines · Jagan Teki
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Jagan Teki
U-Boot size is crossing MMC environment offset due to adding new features on arm64 boards. So update the
ENV_OFFSETto0x100000so the u-boot size limit increased to0xf6000MMC layout(updated):
===================
part: sector: size
unused: 0: 8KiB
SPL: 16: 32KiB
U-Boot: 80: 984KiB
uENV: 2048: 128KiBSigned-off-by Jagan Teki <[email protected]>--- env/Kconfig | 3 ++- include/configs/sunxi-common.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 13 lines
env/Kconfig config ENV_OFFSET · line 445
Quoted 11 lines
env/Kconfig +2
-1@@ -441,7 +441,8 @@ config ENV_OFFSET hex "Environment Offset" depends on !ENV_IS_IN_UBI depends on !ENV_IS_NOWHERE - default 0x88000 if ARCH_SUNXI + default 0x88000 if ARCH_SUNXI && !ARM64 + default 0x100000 if ARCH_SUNXI && ARM64This breaks all existing platforms. NAK.
Can you elaborate, what it breaks. 32 bit sunxi start with
0x88000and 64-sun start with0x100000this is what I expecting here.Quoted 6 lines
Quoted 2 lines
If you have an environment already flashed, flashing the new u-boot will overwrite it, and might break any partition layout you have set.
True, but we can't control this adding new stuff ultimately increasing size. either we can stop working new features or increasing partition size, do you have any other suggestions?
https://lists.denx.de/pipermail/u-boot/2017-December/314940.html
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
Quoted 1 line
Why do you think we went into so great troubles recently?
Certainly yes,
MUSB_GADGETincreasing u-boot.itb 548Ku-boot.itb exceeds file size limit:
limit: 516096 bytes
actual: 560088 bytes
excess: 43992 bytes
make: *** [u-boot.itb] Error 1
make: *** Waiting for unfinished jobs..That's not my question. Why do you think we had some many discussions, debates and patches if we could have done so from the beginning?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Sorry, can't understand please explain it little bit.
We've had:
https://patchwork.ozlabs.org/cover/828100/
https://patchwork.ozlabs.org/cover/851904/
https://patchwork.ozlabs.org/cover/864994/Now we have transition IN, and we can able to change the SIZE check right?
Not until the transition is over.
Maxime
Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering http://bootlin.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180206/9fc53d01/attachment.sig>
PATCH v3 18/30 sunxi: Add uENV partition on gpt partition table
In reply to Jagan TekiInsert 128KiB uENV partition after loader2 on gpt partition table.
--- include/configs/sunxi-common.h | 1 + 1 file changed, 1 insertion(+)
include/configs/sunxi-common.h +1 -0
@@ -505,6 +505,7 @@ extern int soft_i2c_gpio_scl;#define PARTS_DEFAULT \ "name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};" \ "name=loader2,size=984k,uuid=${uuid_gpt_loader2};" \ + "name=uEnv,size=128K,uuid=${uuid_gpt_uenv};" \ "name=esp,size=128M,bootable,uuid=${uuid_gpt_esp};" \ "name=system,size=-,uuid=${uuid_gpt_system};"
Signature · 1 line
2.7.4
PATCH v3 18/30 sunxi: Add uENV partition on gpt partition table
Quoted 3 lines · Jagan Teki
Insert 128KiB uENV partition after loader2 on gpt partition table.
Signed-off-by Jagan Teki <[email protected]>
What is the point of this partition?
If it is to store the environment, it was discussed to add it into the esp partition.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180129/98d5d95c/attachment.sig>
PATCH v3 18/30 sunxi: Add uENV partition on gpt partition table
Quoted 6 lines · Maxime Ripard
Quoted 3 lines · Jagan Teki
Insert 128KiB uENV partition after loader2 on gpt partition table.
Signed-off-by Jagan Teki <[email protected]>What is the point of this partition?
Yes for u-boot environment.
Quoted 3 lines
If it is to store the environment, it was discussed to add it into the esp partition.
If it is part of esp are we sure env part from esp is always unchanged expect u-boot saveenv?, I would prefer env has separate partition because, there could be chance of formatting esp from host and copy Linux images instead of fastboot write or any other media write.
PATCH v3 18/30 sunxi: Add uENV partition on gpt partition table
Quoted 12 lines · Jagan Teki
Quoted 6 lines · Maxime Ripard
Quoted 3 lines · Jagan Teki
Insert 128KiB uENV partition after loader2 on gpt partition table.
Signed-off-by Jagan Teki <[email protected]>What is the point of this partition?
Yes for u-boot environment.
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
If it is to store the environment, it was discussed to add it into the esp partition.
If it is part of esp are we sure env part from esp is always unchanged expect u-boot saveenv?, I would prefer env has separate partition because, there could be chance of formatting esp from host and copy Linux images instead of fastboot write or any other media write.
Please look at the discussion we had at the time. The esp partition is under the firmware control, so it's safe to put our environment there.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180130/a64e7a84/attachment.sig>
PATCH v3 19/30 arm64: allwinner: h5: orangepi-pc2: Sync usb otg nodes from Linux
In reply to Jagan Tekiorangepi-pc2 has usb otg routed host with either EHCI0/OHCI0 sync the same from Linux.
--- arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/dts/sun50i-h5-orangepi-pc2.dts +13 -0
@@ -85,6 +85,10 @@ }; }; +&ehci0 { + status = "okay"; +}; + &ehci1 { status = "okay"; };
@@ -102,6 +106,10 @@ status = "okay"; }; +&ohci0 { + status = "okay"; +}; + &ohci1 { status = "okay"; };
@@ -112,6 +120,11 @@ status = "okay"; }; +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + &usbphy { status = "okay"; };
Signature · 1 line
2.7.4
PATCH v3 20/30 configs: orangepi-pc2: Enable USB OTG peripheral mode
In reply to Jagan TekiEnable USB_MUSB_GADGET which operate OTG in peripheral mode
--- configs/orangepi_pc2_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/orangepi_pc2_defconfig +1 -0
@@ -15,4 +15,5 @@ CONFIG_SPL=y CONFIG_SPL_SPI_SUNXI=y CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.7.4
PATCH v3 21/30 arm64: allwinner: h5: orangepi-prime: Sync usb otg nodes from Linux
In reply to Jagan Tekiorangepi-prime has usb otg routed host with either EHCI0/OHCI0 sync the same from Linux.
--- arch/arm/dts/sun50i-h5-orangepi-prime.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/dts/sun50i-h5-orangepi-prime.dts +13 -0
@@ -72,6 +72,10 @@ }; }; +&ehci0 { + status = "okay"; +}; + &ehci1 { status = "okay"; };
@@ -89,6 +93,10 @@ status = "okay"; }; +&ohci0 { + status = "okay"; +}; + &ohci1 { status = "okay"; };
@@ -99,6 +107,11 @@ status = "okay"; }; +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + &usbphy { status = "okay"; };
Signature · 1 line
2.7.4
PATCH v3 22/30 configs: orangepi-prime: Enable USB OTG peripheral mode
In reply to Jagan TekiEnable USB_MUSB_GADGET which operate OTG in peripheral mode
--- configs/orangepi_prime_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/orangepi_prime_defconfig +1 -0
@@ -13,4 +13,5 @@ CONFIG_SPL=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.7.4
PATCH v3 23/30 sunxi: clock: Fix clock gating for A64
In reply to Jagan Tekiclock gating bits on a64 are different than H3_H5, so fix them on clock_sun6i.h
--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +8 -2
@@ -270,7 +270,7 @@ struct sunxi_ccm_reg {#define AXI_GATE_OFFSET_DRAM 0/* ahb_gate0 offsets */ -#if defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) +#ifdef CONFIG_MACH_SUNXI_H3_H5 #define AHB_GATE_OFFSET_USB_OHCI3 31#define AHB_GATE_OFFSET_USB_OHCI2 30#define AHB_GATE_OFFSET_USB_OHCI1 29
@@ -280,13 +280,19 @@ struct sunxi_ccm_reg {#define AHB_GATE_OFFSET_USB_EHCI1 25#define AHB_GATE_OFFSET_USB_EHCI0 24#define AHB_GATE_OFFSET_OTG_DEVICE 23 +#elif defined(CONFIG_MACH_SUN50I ) +#define AHB_GATE_OFFSET_USB_OHCI0 29 +#define AHB_GATE_OFFSET_USB_EHCI0 25 +#define AHB_GATE_OFFSET_OTG_DEVICE 23#else #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29#define AHB_GATE_OFFSET_USB_EHCI1 27#define AHB_GATE_OFFSET_USB_EHCI0 26#endif -#ifndef CONFIG_MACH_SUN8I_R40 +#ifdef CONFIG_MACH_SUN50I +#define AHB_GATE_OFFSET_USB0 23 +#elif !defined(CONFIG_MACH_SUN8I_R40 )#define AHB_GATE_OFFSET_USB0 24#else #define AHB_GATE_OFFSET_USB0 25
Signature · 1 line
2.7.4
PATCH v3 24/30 configs: sun50i: Set proper USB PHY count for A64
In reply to Jagan TekiThere are two USB PHY's on A64 which are connected as:
PHY#0: shared between USB-OTG_DEVICE and USB-OTG-HCI PHY#1: USB-HCI0(EHCI0/OHCI0)
--- include/configs/sun50i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/sun50i.h +1 -1
@@ -18,7 +18,7 @@#ifdef CONFIG_MACH_SUNXI_H3_H5 # define CONFIG_SUNXI_USB_PHYS 4#else -# define CONFIG_SUNXI_USB_PHYS 1 +# define CONFIG_SUNXI_USB_PHYS 2#endif #define GICD_BASE 0x1c81000
Signature · 1 line
2.7.4
PATCH v3 25/30 musb: sunxi: Add support for A64
In reply to Jagan TekiLike other Allwinner SoC, the A64 is missing the config register from the musb hardware block. Use a known working value for it like other SoC.
--- drivers/usb/musb-new/musb_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb-new/musb_regs.h +1 -1
@@ -433,7 +433,7 @@ static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase)static inline u8 musb_read_configdata (void __iomem *mbase) {#if defined(CONFIG_MACH_SUN8I_A33 ) || defined(CONFIG_MACH_SUN8I_A83T ) || \ - defined(CONFIG_MACH_SUNXI_H3_H5 ) + defined(CONFIG_MACH_SUNXI_H3_H5 ) || defined(CONFIG_MACH_SUN50I )/* <Sigh> allwinner saves a reg, and we need to hardcode this */ return 0xde ;#else
Signature · 1 line
2.7.4
PATCH v3 26/30 sunxi: usb_phy: Clear SIDDP for A64
In reply to Jagan TekiAllwinner a64 needs to clear the SIDDP bit from PHYCTL register once the phy_init done.
--- arch/arm/mach-sunxi/usb_phy.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-sunxi/usb_phy.c +7 -0
@@ -45,6 +45,7 @@/* A83T specific control bits for PHY0 */ #define SUNXI_PHY_CTL_VBUSVLDEXT BIT(5)#define SUNXI_PHY_CTL_SIDDQ BIT(3) +#define SUNXI_PHY_CTL_SIDDP BIT(1)/* A83T HSIC specific bits */ #define SUNXI_EHCI_HS_FORCE BIT(20)
@@ -249,6 +250,12 @@ void sunxi_usb_phy_init(int index) SUNXI_PHY_CTL_SIDDQ); }#endif + +#ifdef CONFIG_MACH_SUN50I +if (phy->id ==0 ) +clrbits_le32 (SUNXI_USB0_BASE +SUNXI_USB_CSR , +SUNXI_PHY_CTL_SIDDP ); +#endif }void sunxi_usb_phy_exit (int index)
Signature · 1 line
2.7.4
PATCH v3 27/30 arm64: allwinner: a64: bananapi-m64: Sync usb_otg node from Linux
In reply to Jagan TekiSync bananapi-m64 usb_otg node from Linux.
--- arch/arm/dts/sun50i-a64-bananapi-m64.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/dts/sun50i-a64-bananapi-m64.dts +10 -0
@@ -119,3 +119,13 @@ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; status = "okay"; }; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */ + status = "okay"; +};
Signature · 1 line
2.7.4
PATCH v3 28/30 configs: bananapi-m64: Enable USB OTG peripheral mode
In reply to Jagan TekiEnable USB_MUSB_GADGET which operate OTG in peripheral mode
--- configs/bananapi_m64_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/bananapi_m64_defconfig +1 -0
@@ -14,4 +14,5 @@ CONFIG_SPL=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.7.4
PATCH v3 29/30 arm64: allwinner: a64: olinuxino: Sync usb_otg from Linux
In reply to Jagan TekiSync a64-olinuxino usb_otg node from Linux.
--- arch/arm/dts/sun50i-a64-olinuxino.dts | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/dts/sun50i-a64-olinuxino.dts +5 -0
@@ -82,3 +82,8 @@ pinctrl-0 = <&uart0_pins_a>; status = "okay"; }; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +};
Signature · 1 line
2.7.4
PATCH v3 30/30 configs: a64-olinuxino: Enable USB OTG peripheral mode
In reply to Jagan TekiEnable USB_MUSB_GADGET which operate OTG in peripheral mode
--- configs/a64-olinuxino_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/a64-olinuxino_defconfig +1 -0
@@ -13,4 +13,5 @@ CONFIG_SPL=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SUN8I_EMAC=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.7.4