All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support
@ 2016-03-29 16:26 Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 01/17] power: axp818: Remove undefined axp818_init() Chen-Yu Tsai
                   ` (17 more replies)
  0 siblings, 18 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

Hi everyone,

This series adds more support for axp818 regulators, and USB support
for A83T. Normal EHCI/OHCI USB works, and so does OTG host mode.
I couldn't get my Cubietruck Plus to work in gadget mode though.
No USB device appears on the host end when it enters fastboot.

Patch 1 removes axp818_init() from the header file, as it is undefined
and unused.

Patch 2 fixes axp818's DCDC5 default voltage. DCDC5 normally supplies
DRAM. This changes the default to match DDR3 DRAM.

Patch 3 adds support for axp818's FLDOs, one of which powers the HSIC
PHY.

Patch 4 raises the DCDC1 voltage on h8_homlet_v2 to 3.3V, the default
value.

Patch 5 enables and sets DLDO4 to 3.3V on h8_homlet_v2. This powers
the AC200 chip, which among other things, is the ethernet PHY.

Patch 6 adds support for the USB PHYs on A83T.

Patch 7 fixes some clock macros related to USB PHYs for A83T.

Patch 8 & 9 add A83T compatible strings to sunxi EHCI & OHCI.

Patch 10 adds support for A83T to musb sunxi glue.

Patch 11 generalizes the VBUS function related macros for AXP PMICs.

Patch 12 adds support for VBUS drive on AXP818.

Patch 13 enables USB Kconfig options in h8_homlet_v2_defconfig.

Patch 14 enables USB Kconfig options in Cubietruck_plus_defconfig.

Patch 15 ~ 17 is the minimal changes needed to enable USB on the
A83T boards I have. They are not the same as the kernel changes
I will submit, and should not be merged without discussion.

Regards
ChenYu


Chen-Yu Tsai (17):
  power: axp818: Remove undefined axp818_init()
  power: axp818: Fix DCDC5 default voltage
  power: axp818: Add support for FLDOs
  sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V)
  sunxi: h8_homlet_v2: Set DLDO4 to 3.3V
  sunxi: usb_phy: Add support for A83T USB PHYs
  sunxi: clk: Fix USB PHY clock macros for A83T
  sunxi: ehci: Add A83T compatible
  sunxi: ohci: Add A83T compatible
  musb: sunxi: Add support for A83T
  sunxi: axp: Generalize register macros for VBUS drive GPIO
  sunxi: axp: Support VBUS drive GPIO on AXP818
  sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig
  sunxi: Cubietruck Plus: Enable USB Kconfig options in defconfig
  [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi
  [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus
  [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2

 arch/arm/cpu/armv7/sunxi/usb_phy.c                 | 48 ++++++++++++++++++++++
 arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts  | 12 ++++++
 arch/arm/dts/sun8i-a83t-cubietruck-plus.dts        | 12 ++++++
 arch/arm/dts/sun8i-a83t.dtsi                       | 34 +++++++++++++++
 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h |  6 +--
 board/sunxi/board.c                                |  6 +++
 configs/Cubietruck_plus_defconfig                  | 10 ++++-
 configs/h8_homlet_v2_defconfig                     |  8 +++-
 drivers/gpio/axp_gpio.c                            | 25 ++++++-----
 drivers/power/Kconfig                              | 30 +++++++++++++-
 drivers/power/axp818.c                             | 34 +++++++++++++++
 drivers/usb/host/ehci-sunxi.c                      |  1 +
 drivers/usb/host/ohci-sunxi.c                      |  1 +
 drivers/usb/musb-new/musb_regs.h                   |  2 +-
 include/axp221.h                                   |  8 ++--
 include/axp818.h                                   |  9 ++--
 include/axp_pmic.h                                 |  1 +
 include/configs/sun8i.h                            |  2 +
 18 files changed, 222 insertions(+), 27 deletions(-)

-- 
2.7.0

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 01/17] power: axp818: Remove undefined axp818_init()
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 02/17] power: axp818: Fix DCDC5 default voltage Chen-Yu Tsai
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

axp818_init() is declared, but never defined.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 include/axp818.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/axp818.h b/include/axp818.h
index 46d05ad..c2f9847 100644
--- a/include/axp818.h
+++ b/include/axp818.h
@@ -53,8 +53,6 @@
 #define AXP818_ALDO2_CTRL	0x29
 #define AXP818_ALDO3_CTRL	0x2a
 
-int axp818_init(void);
-
 /* For axp_gpio.c */
 #define AXP_POWER_STATUS		0x00
 #define AXP_POWER_STATUS_VBUS_PRESENT	(1 << 5)
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 02/17] power: axp818: Fix DCDC5 default voltage
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 01/17] power: axp818: Remove undefined axp818_init() Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 03/17] power: axp818: Add support for FLDOs Chen-Yu Tsai
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

DCDC5 is designed to supply VCC-DRAM, which is normally 1.5V for DDR3,
1.35V for DDR3L, and 1.2V for LPDDR3.

Also remove CONFIG_AXP_DCDC5_VOLT from h8_homlet_v2_defconfig.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 configs/h8_homlet_v2_defconfig | 1 -
 drivers/power/Kconfig          | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/configs/h8_homlet_v2_defconfig b/configs/h8_homlet_v2_defconfig
index 4742aaf6..1f492ab 100644
--- a/configs/h8_homlet_v2_defconfig
+++ b/configs/h8_homlet_v2_defconfig
@@ -12,4 +12,3 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DCDC1_VOLT=3000
-CONFIG_AXP_DCDC5_VOLT=1500
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index adc6455..548fe26 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -118,13 +118,12 @@ config AXP_DCDC4_VOLT
 config AXP_DCDC5_VOLT
 	int "axp pmic dcdc5 voltage"
 	depends on AXP221_POWER || AXP818_POWER
-	default 1800 if AXP818_POWER
 	default 1500 if MACH_SUN6I || MACH_SUN8I
 	---help---
 	Set the voltage (mV) to program the axp pmic dcdc5 at, set to 0 to
 	disable dcdc5.
 	On A23 / A31 / A33 / A83T boards dcdc5 is VCC-DRAM and should be 1.5V,
-	1.8V for A83T.
+	1.35V if DDR3L is used.
 
 config AXP_ALDO1_VOLT
 	int "axp pmic (a)ldo1 voltage"
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 03/17] power: axp818: Add support for FLDOs
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 01/17] power: axp818: Remove undefined axp818_init() Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 02/17] power: axp818: Fix DCDC5 default voltage Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 04/17] sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V) Chen-Yu Tsai
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The FLDOs on AXP818 PMIC normally provide power to CPUS and USB HSIC PHY
on the A83T/H8.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 board/sunxi/board.c    |  6 ++++++
 drivers/power/Kconfig  | 27 +++++++++++++++++++++++++++
 drivers/power/axp818.c | 34 ++++++++++++++++++++++++++++++++++
 include/axp818.h       |  1 +
 include/axp_pmic.h     |  1 +
 5 files changed, 69 insertions(+)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 2d5335f..2271c89 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -486,6 +486,12 @@ void sunxi_board_init(void)
 	power_failed |= axp_set_eldo(2, CONFIG_AXP_ELDO2_VOLT);
 	power_failed |= axp_set_eldo(3, CONFIG_AXP_ELDO3_VOLT);
 #endif
+
+#ifdef CONFIG_AXP818_POWER
+	power_failed |= axp_set_fldo(1, CONFIG_AXP_FLDO1_VOLT);
+	power_failed |= axp_set_fldo(2, CONFIG_AXP_FLDO2_VOLT);
+	power_failed |= axp_set_fldo(3, CONFIG_AXP_FLDO3_VOLT);
+#endif
 #endif
 	printf("DRAM:");
 	ramsize = sunxi_dram_init();
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 548fe26..937b9aa 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -238,6 +238,33 @@ config AXP_ELDO3_VOLT
 	1.2V for the SSD2828 chip (converter of parallel LCD interface
 	into MIPI DSI).
 
+config AXP_FLDO1_VOLT
+	int "axp pmic fldo1 voltage"
+	depends on AXP818_POWER
+	default 0 if MACH_SUN8I_A83T
+	---help---
+	Set the voltage (mV) to program the axp pmic fldo1 at, set to 0 to
+	disable fldo1.
+	On A83T / H8 boards fldo1 is VCC-HSIC and should be 1.2V if HSIC is
+	used.
+
+config AXP_FLDO2_VOLT
+	int "axp pmic eldo2 voltage"
+	depends on AXP818_POWER
+	default 900 if MACH_SUN8I_A83T
+	---help---
+	Set the voltage (mV) to program the axp pmic fldo2 at, set to 0 to
+	disable fldo2.
+	On A83T / H8 boards fldo2 is VCC-CPUS and should be 0.9V.
+
+config AXP_FLDO3_VOLT
+	int "axp pmic fldo3 voltage"
+	depends on AXP818_POWER
+	default 0
+	---help---
+	Set the voltage (mV) to program the axp pmic fldo3 at, set to 0 to
+	disable fldo3.
+
 config SY8106A_VOUT1_VOLT
 	int "SY8106A pmic VOUT1 voltage"
 	depends on SY8106A_POWER
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c
index e885d02..3ac05ff 100644
--- a/drivers/power/axp818.c
+++ b/drivers/power/axp818.c
@@ -191,6 +191,40 @@ int axp_set_eldo(int eldo_num, unsigned int mvolt)
 				AXP818_OUTPUT_CTRL2_ELDO1_EN << (eldo_num - 1));
 }
 
+int axp_set_fldo(int fldo_num, unsigned int mvolt)
+{
+	int ret;
+	u8 cfg;
+
+	if (fldo_num < 1 || fldo_num > 3)
+		return -EINVAL;
+
+	if (mvolt == 0)
+		return pmic_bus_clrbits(AXP818_OUTPUT_CTRL3,
+				AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
+
+	if (fldo_num < 3) {
+		cfg = axp818_mvolt_to_cfg(mvolt, 700, 1450, 50);
+		ret = pmic_bus_write(AXP818_FLDO1_CTRL + (fldo_num - 1), cfg);
+	} else {
+		/*
+		 * Special case for FLDO3, which is DCDC5 / 2 or FLDOIN / 2
+		 * Since FLDOIN is unknown, test against DCDC5.
+		 */
+		if (mvolt * 2 == CONFIG_AXP_DCDC5_VOLT)
+			ret = pmic_bus_clrbits(AXP818_FLDO2_3_CTRL,
+					       AXP818_FLDO2_3_CTRL_FLDO3_VOL);
+		else
+			ret = pmic_bus_setbits(AXP818_FLDO2_3_CTRL,
+					       AXP818_FLDO2_3_CTRL_FLDO3_VOL);
+	}
+	if (ret)
+		return ret;
+
+	return pmic_bus_setbits(AXP818_OUTPUT_CTRL3,
+				AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
+}
+
 int axp_init(void)
 {
 	u8 axp_chip_id;
diff --git a/include/axp818.h b/include/axp818.h
index c2f9847..003477f 100644
--- a/include/axp818.h
+++ b/include/axp818.h
@@ -41,6 +41,7 @@
 #define AXP818_ELDO3_CTRL	0x1b
 #define AXP818_FLDO1_CTRL	0x1c
 #define AXP818_FLDO2_3_CTRL	0x1d
+#define AXP818_FLDO2_3_CTRL_FLDO3_VOL	(1 << 4)
 #define AXP818_DCDC1_CTRL	0x20
 #define AXP818_DCDC2_CTRL	0x21
 #define AXP818_DCDC3_CTRL	0x22
diff --git a/include/axp_pmic.h b/include/axp_pmic.h
index 0f14683..b203cc8 100644
--- a/include/axp_pmic.h
+++ b/include/axp_pmic.h
@@ -31,6 +31,7 @@ int axp_set_aldo3(unsigned int mvolt);
 int axp_set_aldo4(unsigned int mvolt);
 int axp_set_dldo(int dldo_num, unsigned int mvolt);
 int axp_set_eldo(int eldo_num, unsigned int mvolt);
+int axp_set_fldo(int fldo_num, unsigned int mvolt);
 int axp_init(void);
 int axp_get_sid(unsigned int *sid);
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 04/17] sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V)
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 03/17] power: axp818: Add support for FLDOs Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 05/17] sunxi: h8_homlet_v2: Set DLDO4 to 3.3V Chen-Yu Tsai
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The schematics of the h8_homlet_v2 show DCDC1 set to 3.3V. Some
Allwinner-based boards set it to 3.0V to conserve power. Since the
h8_homlet_v2 is a set-top box board with external power, there is
no such requirement.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 configs/h8_homlet_v2_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/h8_homlet_v2_defconfig b/configs/h8_homlet_v2_defconfig
index 1f492ab..538a2c2 100644
--- a/configs/h8_homlet_v2_defconfig
+++ b/configs/h8_homlet_v2_defconfig
@@ -11,4 +11,3 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_AXP_DCDC1_VOLT=3000
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 05/17] sunxi: h8_homlet_v2: Set DLDO4 to 3.3V
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (3 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 04/17] sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V) Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs Chen-Yu Tsai
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

DLDO4 supplies power to the PD pins, and the AC200 Ethernet PHY /
composite video encoder.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 configs/h8_homlet_v2_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/h8_homlet_v2_defconfig b/configs/h8_homlet_v2_defconfig
index 538a2c2..4ede071 100644
--- a/configs/h8_homlet_v2_defconfig
+++ b/configs/h8_homlet_v2_defconfig
@@ -11,3 +11,4 @@ CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_AXP_DLDO4_VOLT=3300
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (4 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 05/17] sunxi: h8_homlet_v2: Set DLDO4 to 3.3V Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-31 15:05   ` [U-Boot] [linux-sunxi] " Hans de Goede
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 07/17] sunxi: clk: Fix USB PHY clock macros for A83T Chen-Yu Tsai
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The A83T has 3 USB PHYs: 1 for USB OTG, 1 for standard USB 1.1/2.0 host,
1 for USB HSIC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/cpu/armv7/sunxi/usb_phy.c | 48 ++++++++++++++++++++++++++++++++++++++
 include/configs/sun8i.h            |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c b/arch/arm/cpu/armv7/sunxi/usb_phy.c
index 0749fbd..4ac532a 100644
--- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
+++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
@@ -34,6 +34,16 @@
 #define REG_PHY_UNK_H3			0x420
 #define REG_PMU_UNK_H3			0x810
 
+/* A83T specific control bits for PHY0 */
+#define SUNXI_PHY_CTL_VBUSVLDEXT	BIT(5)
+#define SUNXI_PHY_CTL_SIDDQ		BIT(3)
+
+/* A83T HSIC specific bits */
+#define SUNXI_EHCI_HS_FORCE		BIT(20)
+#define SUNXI_EHCI_CONNECT_DET		BIT(17)
+#define SUNXI_EHCI_CONNECT_INT		BIT(16)
+#define SUNXI_EHCI_HSIC			BIT(1)
+
 static struct sunxi_usb_phy {
 	int usb_rst_mask;
 	int gpio_vbus;
@@ -55,6 +65,14 @@ static struct sunxi_usb_phy {
 		.base = SUNXI_USB1_BASE,
 	},
 #if CONFIG_SUNXI_USB_PHYS >= 3
+#ifdef CONFIG_MACH_SUN8I_A83T
+	{
+		.usb_rst_mask = CCM_USB_CTRL_HSIC_RST | CCM_USB_CTRL_HSIC_CLK |
+				CCM_USB_CTRL_12M_CLK,
+		.id = 2,
+		.base = SUNXI_USB2_BASE,
+	}
+#else
 	{
 		.usb_rst_mask = CCM_USB_CTRL_PHY2_RST | CCM_USB_CTRL_PHY2_CLK,
 		.id = 2,
@@ -68,6 +86,7 @@ static struct sunxi_usb_phy {
 		.base = SUNXI_USB3_BASE,
 	}
 #endif
+#endif
 };
 
 static int get_vbus_gpio(int index)
@@ -97,6 +116,7 @@ static int get_id_detect_gpio(int index)
 	return -EINVAL;
 }
 
+#ifndef CONFIG_MACH_SUN8I_A83T
 static void usb_phy_write(struct sunxi_usb_phy *phy, int addr,
 			  int data, int len)
 {
@@ -161,6 +181,7 @@ static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy)
 	return;
 }
 #endif
+#endif
 
 static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
 {
@@ -174,6 +195,13 @@ static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
 		SUNXI_EHCI_AHB_INCRX_ALIGN_EN |
 		SUNXI_EHCI_ULPI_BYPASS_EN;
 
+#ifdef CONFIG_MACH_SUN8I_A83T
+	if (phy->id == 2)
+		bits |= SUNXI_EHCI_HS_FORCE |
+			SUNXI_EHCI_CONNECT_INT |
+			SUNXI_EHCI_HSIC;
+#endif
+
 	if (enable)
 		setbits_le32(addr, bits);
 	else
@@ -184,9 +212,11 @@ static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
 
 void sunxi_usb_phy_enable_squelch_detect(int index, int enable)
 {
+#ifndef CONFIG_MACH_SUN8I_A83T
 	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
 
 	usb_phy_write(phy, 0x3c, enable ? 0 : 2, 2);
+#endif
 }
 
 void sunxi_usb_phy_init(int index)
@@ -200,10 +230,21 @@ void sunxi_usb_phy_init(int index)
 
 	setbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask);
 
+#ifndef CONFIG_MACH_SUN8I_A83T
 	sunxi_usb_phy_config(phy);
+#endif
 
 	if (phy->id != 0)
 		sunxi_usb_phy_passby(phy, SUNXI_USB_PASSBY_EN);
+
+#ifdef CONFIG_MACH_SUN8I_A83T
+	if (phy->id == 0) {
+		setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
+			     SUNXI_PHY_CTL_VBUSVLDEXT);
+		clrbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
+			     SUNXI_PHY_CTL_SIDDQ);
+	}
+#endif
 }
 
 void sunxi_usb_phy_exit(int index)
@@ -218,6 +259,13 @@ void sunxi_usb_phy_exit(int index)
 	if (phy->id != 0)
 		sunxi_usb_phy_passby(phy, !SUNXI_USB_PASSBY_EN);
 
+#ifdef CONFIG_MACH_SUN8I_A83T
+	if (phy->id == 0) {
+		setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
+			     SUNXI_PHY_CTL_SIDDQ);
+	}
+#endif
+
 	clrbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask);
 }
 
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 7c0ab1e..eb5db4e 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -20,6 +20,8 @@
 
 #ifdef CONFIG_MACH_SUN8I_H3
 	#define CONFIG_SUNXI_USB_PHYS	4
+#elif defined CONFIG_MACH_SUN8I_A83T
+	#define CONFIG_SUNXI_USB_PHYS	3
 #else
 	#define CONFIG_SUNXI_USB_PHYS	2
 #endif
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 07/17] sunxi: clk: Fix USB PHY clock macros for A83T
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (5 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 08/17] sunxi: ehci: Add A83T compatible Chen-Yu Tsai
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The A83T has 3 PHYs, the last one being HSIC, which has 2 clocks.
Also there is only 1 OHCI.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h b/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
index 5f93d7f..5e1346e 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h
@@ -224,14 +224,14 @@ struct sunxi_ccm_reg {
 
 #define CCM_USB_CTRL_PHY0_RST (0x1 << 0)
 #define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
-#define CCM_USB_CTRL_PHY2_RST (0x1 << 2)
+#define CCM_USB_CTRL_HSIC_RST (0x1 << 2)
 /* There is no global phy clk gate on sun6i, define as 0 */
 #define CCM_USB_CTRL_PHYGATE 0
 #define CCM_USB_CTRL_PHY0_CLK (0x1 << 8)
 #define CCM_USB_CTRL_PHY1_CLK (0x1 << 9)
-#define CCM_USB_CTRL_PHY2_CLK (0x1 << 10)
+#define CCM_USB_CTRL_HSIC_CLK (0x1 << 10)
+#define CCM_USB_CTRL_12M_CLK (0x1 << 11)
 #define CCM_USB_CTRL_OHCI0_CLK (0x1 << 16)
-#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 17)
 
 #define CCM_GMAC_CTRL_TX_CLK_SRC_MII	0x0
 #define CCM_GMAC_CTRL_TX_CLK_SRC_EXT_RGMII 0x1
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 08/17] sunxi: ehci: Add A83T compatible
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (6 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 07/17] sunxi: clk: Fix USB PHY clock macros for A83T Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 09/17] sunxi: ohci: " Chen-Yu Tsai
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

We have a separate compatible for almost each SoC. Add one for the A83T.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/usb/host/ehci-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
index 677a5d3..d5eb492 100644
--- a/drivers/usb/host/ehci-sunxi.c
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -91,6 +91,7 @@ static const struct udevice_id ehci_usb_ids[] = {
 	{ .compatible = "allwinner,sun6i-a31-ehci", },
 	{ .compatible = "allwinner,sun7i-a20-ehci", },
 	{ .compatible = "allwinner,sun8i-a23-ehci", },
+	{ .compatible = "allwinner,sun8i-a83t-ehci", },
 	{ .compatible = "allwinner,sun8i-h3-ehci",  },
 	{ .compatible = "allwinner,sun9i-a80-ehci", },
 	{ }
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 09/17] sunxi: ohci: Add A83T compatible
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (7 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 08/17] sunxi: ehci: Add A83T compatible Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 10/17] musb: sunxi: Add support for A83T Chen-Yu Tsai
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

We have a separate compatible for almost each SoC. Add one for the A83T.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/usb/host/ohci-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index d4fb95a..6f3f4ce 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -94,6 +94,7 @@ static const struct udevice_id ohci_usb_ids[] = {
 	{ .compatible = "allwinner,sun6i-a31-ohci", },
 	{ .compatible = "allwinner,sun7i-a20-ohci", },
 	{ .compatible = "allwinner,sun8i-a23-ohci", },
+	{ .compatible = "allwinner,sun8i-a83t-ohci", },
 	{ .compatible = "allwinner,sun8i-h3-ohci",  },
 	{ .compatible = "allwinner,sun9i-a80-ohci", },
 	{ }
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 10/17] musb: sunxi: Add support for A83T
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (8 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 09/17] sunxi: ohci: " Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 11/17] sunxi: axp: Generalize register macros for VBUS drive GPIO Chen-Yu Tsai
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

Like the Allwinner A33 SoC, the A83T is missing the config register
from the musb USB DRD hardware block. Use a known working value for
it.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/usb/musb-new/musb_regs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb-new/musb_regs.h b/drivers/usb/musb-new/musb_regs.h
index 4dc9abb..0f18dd7 100644
--- a/drivers/usb/musb-new/musb_regs.h
+++ b/drivers/usb/musb-new/musb_regs.h
@@ -434,7 +434,7 @@ static inline u8 musb_read_ulpi_buscontrol(void __iomem *mbase)
 
 static inline u8 musb_read_configdata(void __iomem *mbase)
 {
-#ifdef CONFIG_MACH_SUN8I_A33
+#if defined CONFIG_MACH_SUN8I_A33 || defined CONFIG_MACH_SUN8I_A83T
 	/* <Sigh> allwinner saves a reg, and we need to hardcode this */
 	return 0xde;
 #else
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 11/17] sunxi: axp: Generalize register macros for VBUS drive GPIO
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (9 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 10/17] musb: sunxi: Add support for A83T Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 12/17] sunxi: axp: Support VBUS drive GPIO on AXP818 Chen-Yu Tsai
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

VBUS drive is supported on AXP221 and later PMICs. Rework the macros
so we can support this on later PMICs without too much work.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/gpio/axp_gpio.c | 25 ++++++++++++++-----------
 include/axp221.h        |  8 ++++----
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/gpio/axp_gpio.c b/drivers/gpio/axp_gpio.c
index bd2ac89..ec00827 100644
--- a/drivers/gpio/axp_gpio.c
+++ b/drivers/gpio/axp_gpio.c
@@ -59,10 +59,11 @@ static int axp_gpio_direction_output(struct udevice *dev, unsigned pin,
 	u8 reg;
 
 	switch (pin) {
-#ifdef CONFIG_AXP221_POWER /* Only available on axp221/axp223 */
+#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC
+	/* Only available on later PMICs */
 	case SUNXI_GPIO_AXP0_VBUS_ENABLE:
-		ret = pmic_bus_clrbits(AXP221_MISC_CTRL,
-				       AXP221_MISC_CTRL_N_VBUSEN_FUNC);
+		ret = pmic_bus_clrbits(AXP_MISC_CTRL,
+				       AXP_MISC_CTRL_N_VBUSEN_FUNC);
 		if (ret)
 			return ret;
 
@@ -90,10 +91,11 @@ static int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 		mask = AXP_POWER_STATUS_VBUS_PRESENT;
 		break;
 #endif
-#ifdef CONFIG_AXP221_POWER /* Only available on axp221/axp223 */
+#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC
+	/* Only available on later PMICs */
 	case SUNXI_GPIO_AXP0_VBUS_ENABLE:
-		ret = pmic_bus_read(AXP221_VBUS_IPSOUT, &val);
-		mask = AXP221_VBUS_IPSOUT_DRIVEBUS;
+		ret = pmic_bus_read(AXP_VBUS_IPSOUT, &val);
+		mask = AXP_VBUS_IPSOUT_DRIVEBUS;
 		break;
 #endif
 	default:
@@ -115,14 +117,15 @@ static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 	u8 reg;
 
 	switch (pin) {
-#ifdef CONFIG_AXP221_POWER /* Only available on axp221/axp223 */
+#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC
+	/* Only available on later PMICs */
 	case SUNXI_GPIO_AXP0_VBUS_ENABLE:
 		if (val)
-			return pmic_bus_setbits(AXP221_VBUS_IPSOUT,
-						AXP221_VBUS_IPSOUT_DRIVEBUS);
+			return pmic_bus_setbits(AXP_VBUS_IPSOUT,
+						AXP_VBUS_IPSOUT_DRIVEBUS);
 		else
-			return pmic_bus_clrbits(AXP221_VBUS_IPSOUT,
-						AXP221_VBUS_IPSOUT_DRIVEBUS);
+			return pmic_bus_clrbits(AXP_VBUS_IPSOUT,
+						AXP_VBUS_IPSOUT_DRIVEBUS);
 #endif
 	default:
 		reg = axp_get_gpio_ctrl_reg(pin);
diff --git a/include/axp221.h b/include/axp221.h
index 04cd8c2..b4b64b0 100644
--- a/include/axp221.h
+++ b/include/axp221.h
@@ -43,12 +43,8 @@
 #define AXP221_ALDO1_CTRL	0x28
 #define AXP221_ALDO2_CTRL	0x29
 #define AXP221_ALDO3_CTRL	0x2a
-#define AXP221_VBUS_IPSOUT	0x30
-#define AXP221_VBUS_IPSOUT_DRIVEBUS	(1 << 2)
 #define AXP221_SHUTDOWN		0x32
 #define AXP221_SHUTDOWN_POWEROFF	(1 << 7)
-#define AXP221_MISC_CTRL	0x8f
-#define AXP221_MISC_CTRL_N_VBUSEN_FUNC	(1 << 4)
 #define AXP221_PAGE		0xff
 
 /* Page 1 addresses */
@@ -57,6 +53,10 @@
 /* For axp_gpio.c */
 #define AXP_POWER_STATUS		0x00
 #define AXP_POWER_STATUS_VBUS_PRESENT		(1 << 5)
+#define AXP_VBUS_IPSOUT			0x30
+#define AXP_VBUS_IPSOUT_DRIVEBUS		(1 << 2)
+#define AXP_MISC_CTRL			0x8f
+#define AXP_MISC_CTRL_N_VBUSEN_FUNC		(1 << 4)
 #define AXP_GPIO0_CTRL			0x90
 #define AXP_GPIO1_CTRL			0x92
 #define AXP_GPIO_CTRL_OUTPUT_LOW		0x00 /* Drive pin low */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 12/17] sunxi: axp: Support VBUS drive GPIO on AXP818
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (10 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 11/17] sunxi: axp: Generalize register macros for VBUS drive GPIO Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 13/17] sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig Chen-Yu Tsai
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

AXP818 supports VBUS drive function, even though the manual does not
mention it.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 include/axp818.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/axp818.h b/include/axp818.h
index 003477f..5630eed 100644
--- a/include/axp818.h
+++ b/include/axp818.h
@@ -56,7 +56,11 @@
 
 /* For axp_gpio.c */
 #define AXP_POWER_STATUS		0x00
-#define AXP_POWER_STATUS_VBUS_PRESENT	(1 << 5)
+#define AXP_POWER_STATUS_VBUS_PRESENT		(1 << 5)
+#define AXP_VBUS_IPSOUT			0x30
+#define AXP_VBUS_IPSOUT_DRIVEBUS		(1 << 2)
+#define AXP_MISC_CTRL			0x8f
+#define AXP_MISC_CTRL_N_VBUSEN_FUNC		(1 << 4)
 #define AXP_GPIO0_CTRL			0x90
 #define AXP_GPIO1_CTRL			0x92
 #define AXP_GPIO_CTRL_OUTPUT_LOW	0x00 /* Drive pin low */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 13/17] sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (11 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 12/17] sunxi: axp: Support VBUS drive GPIO on AXP818 Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 14/17] sunxi: Cubietruck Plus: " Chen-Yu Tsai
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The h8_homlet_v2 has 2 USB host ports, one connected to the OTG
controller, one connected to the EHCI/OHCI pair.

Also provide the card detect pin for MMC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 configs/h8_homlet_v2_defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configs/h8_homlet_v2_defconfig b/configs/h8_homlet_v2_defconfig
index 4ede071..e04d96b 100644
--- a/configs/h8_homlet_v2_defconfig
+++ b/configs/h8_homlet_v2_defconfig
@@ -4,6 +4,9 @@ CONFIG_MACH_SUN8I_A83T=y
 CONFIG_DRAM_CLK=480
 CONFIG_DRAM_ZQ=15355
 CONFIG_DRAM_ODT_EN=y
+CONFIG_MMC0_CD_PIN="PF6"
+CONFIG_USB0_VBUS_PIN="PL5"
+CONFIG_USB1_VBUS_PIN="PL6"
 CONFIG_AXP_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-allwinner-h8homlet-v2"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
@@ -12,3 +15,5 @@ CONFIG_SPL=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_AXP_DLDO4_VOLT=3300
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_HOST=y
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 14/17] sunxi: Cubietruck Plus: Enable USB Kconfig options in defconfig
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (12 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 13/17] sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig Chen-Yu Tsai
@ 2016-03-29 16:26 ` Chen-Yu Tsai
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 15/17] [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi Chen-Yu Tsai
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:26 UTC (permalink / raw)
  To: u-boot

The Cubietruck Plus uses all 3 USB controllers:

  - USB OTG functions are provided by the musb USB OTG controller
  - Onboard SATA is provied by a USB-SATA bridge connected to USB1
  - The USB host ports on the board are provided by an HSIC USB hub

FLDO1 is set to 1.2V for HSIC.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 configs/Cubietruck_plus_defconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configs/Cubietruck_plus_defconfig b/configs/Cubietruck_plus_defconfig
index bb0b336..d625c21 100644
--- a/configs/Cubietruck_plus_defconfig
+++ b/configs/Cubietruck_plus_defconfig
@@ -6,13 +6,21 @@ CONFIG_DRAM_ZQ=15355
 CONFIG_DRAM_ODT_EN=y
 CONFIG_MMC0_CD_PIN="PF6"
 CONFIG_I2C0_ENABLE=y
+CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
+CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
+CONFIG_USB0_ID_DET="PH11"
+CONFIG_USB1_VBUS_PIN="PD29"
+CONFIG_USB2_VBUS_PIN="PL6"
 CONFIG_AXP_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-a83t-cubietruck-plus"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="RGMII,MACPWR=SUNXI_GPD(20)"
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
 CONFIG_AXP_DLDO3_VOLT=2500
 CONFIG_AXP_DLDO4_VOLT=3300
+CONFIG_AXP_FLDO1_VOLT=1200
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_MUSB_HOST=y
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 15/17] [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (13 preceding siblings ...)
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 14/17] sunxi: Cubietruck Plus: " Chen-Yu Tsai
@ 2016-03-29 16:27 ` Chen-Yu Tsai
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 16/17] [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus Chen-Yu Tsai
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:27 UTC (permalink / raw)
  To: u-boot

This provides the minimal changes to the A83T dtsi to enable USB in
U-boot. It is not what will be submitted to the kernel.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/dts/sun8i-a83t.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/arm/dts/sun8i-a83t.dtsi b/arch/arm/dts/sun8i-a83t.dtsi
index d3473f8..0fe73e1 100644
--- a/arch/arm/dts/sun8i-a83t.dtsi
+++ b/arch/arm/dts/sun8i-a83t.dtsi
@@ -224,5 +224,39 @@
 			#interrupt-cells = <3>;
 			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_HIGH)>;
 		};
+
+		usb_otg: usb at 01c19000 {
+			compatible = "allwinner,sun8i-a33-musb";
+			interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "mc";
+			status = "disabled";
+		};
+
+		ehci0: usb at 01c1a000 {
+			compatible = "allwinner,sun8i-a83t-ehci", "generic-ehci";
+			reg = <0x01c1a000 0x100>;
+			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		ohci0: usb at 01c1a400 {
+			compatible = "allwinner,sun8i-a83t-ohci", "generic-ohci";
+			reg = <0x01c1a400 0x100>;
+			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		ehci1: usb at 01c1b000 {
+			compatible = "allwinner,sun8i-a83t-ehci", "generic-ehci";
+			reg = <0x01c1b000 0x100>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		r_pio: pinctrl at 01f02c00 {
+			compatible = "allwinner,sun8i-a83t-r-pinctrl";
+			reg = <0x01f02c00 0x400>;
+			interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+		};
 	};
 };
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 16/17] [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (14 preceding siblings ...)
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 15/17] [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi Chen-Yu Tsai
@ 2016-03-29 16:27 ` Chen-Yu Tsai
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 17/17] [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2 Chen-Yu Tsai
  2016-03-31 14:59 ` [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Hans de Goede
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:27 UTC (permalink / raw)
  To: u-boot

This provides the minimal changes to the Cubietruck Plus dts to enable USB
in U-boot. It is not what will be submitted to the kernel.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/dts/sun8i-a83t-cubietruck-plus.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts
index 88b1e09..8437c8f 100644
--- a/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts
+++ b/arch/arm/dts/sun8i-a83t-cubietruck-plus.dts
@@ -58,8 +58,20 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ehci1 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_b>;
 	status = "okay";
 };
+
+&usb_otg {
+	status = "okay";
+};
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [PATCH RFC 17/17] [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (15 preceding siblings ...)
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 16/17] [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus Chen-Yu Tsai
@ 2016-03-29 16:27 ` Chen-Yu Tsai
  2016-03-31 14:59 ` [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Hans de Goede
  17 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-29 16:27 UTC (permalink / raw)
  To: u-boot

This provides the minimal changes to the H8Homlet v2 dts to enable USB
in U-boot. It is not what will be submitted to the kernel.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts b/arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts
index 342e1d3..c8495d7 100644
--- a/arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts
+++ b/arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts
@@ -57,8 +57,20 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ohci0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_b>;
 	status = "okay";
 };
+
+&usb_otg {
+	status = "okay";
+};
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support
  2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
                   ` (16 preceding siblings ...)
  2016-03-29 16:27 ` [U-Boot] [PATCH RFC 17/17] [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2 Chen-Yu Tsai
@ 2016-03-31 14:59 ` Hans de Goede
  2016-03-31 16:15   ` Chen-Yu Tsai
  17 siblings, 1 reply; 21+ messages in thread
From: Hans de Goede @ 2016-03-31 14:59 UTC (permalink / raw)
  To: u-boot

Hi,

On 29-03-16 18:26, Chen-Yu Tsai wrote:
> Hi everyone,
>
> This series adds more support for axp818 regulators, and USB support
> for A83T. Normal EHCI/OHCI USB works, and so does OTG host mode.

Cool, thanks for working on this!

> I couldn't get my Cubietruck Plus to work in gadget mode though.
> No USB device appears on the host end when it enters fastboot.

Did you change CONFIG_USB_MUSB_HOST=y to CONFIG_USB_MUSB_GADGET=y ?
currently we support building either one or the other.

I would certainly welcome patches to make things more dynamic,
you could replace the

#ifdef CONFIG_USB_MUSB_HOST
#else
#endif

construct in drivers/usb/musb-new/sunxi.c: sunxi_musb_board_init()
with an id=pin check (but only when both CONFIG_USB_MUSB_HOST and
CONFIG_USB_MUSB_GADGET are defined, on some boards the port is
hardwired for a certain use).

If you take a shot at this, do not forget to also update musb_plat
dynamically, currently that is statically initialized depending
on CONFIG_USB_MUSB_HOST being defined.

You probably also want to check other places for
#ifdef CONFIG_USB_MUSB_HOST / #ifdef CONFIG_USB_MUSB_GADGET,
but I'm reasonably sure that defining both at the same time
should _mostly_ work, just as long as you only register either
the host or gadget part from sunxi_musb_board_init() (which
means that the right cable needs to be plugged in before
u-boot starts).

###

I've applied patches 1-12 to my tree, and I plan to include
these in my next pull-req I've not added 13-14 to give
you some time to figure out what todo with the otg, I guess
that on the h8_homlet_v2 you can just leave it as
CONFIG_USB_MUSB_HOST=y since it is wired to an USB A female
connector.

On the cubietruck you may want to make it CONFIG_USB_MUSB_GADGET=y
since the most likely use there is using it in gadget mode (for host
mode it has normal ports).

About patches 15-17 you've tagged these as "[DO NOT MERGE]" I understand
that the devicetree bits which will eventually go upstream will look
differently, but as long as the compatible and the base-address will
not change, we can pretty merge them in u-boot already, u-boot's dts
copy is only used internally and not passed to the kernel.

I will not merge them if you do not want me too, but we could have
these minimal nodes for now to get things to work. These can then
eventually be replaced with the real kernel dts when that is upstream.

Regards,

Hans



> Patch 1 removes axp818_init() from the header file, as it is undefined
> and unused.
>
> Patch 2 fixes axp818's DCDC5 default voltage. DCDC5 normally supplies
> DRAM. This changes the default to match DDR3 DRAM.
>
> Patch 3 adds support for axp818's FLDOs, one of which powers the HSIC
> PHY.
>
> Patch 4 raises the DCDC1 voltage on h8_homlet_v2 to 3.3V, the default
> value.
>
> Patch 5 enables and sets DLDO4 to 3.3V on h8_homlet_v2. This powers
> the AC200 chip, which among other things, is the ethernet PHY.
>
> Patch 6 adds support for the USB PHYs on A83T.
>
> Patch 7 fixes some clock macros related to USB PHYs for A83T.
>
> Patch 8 & 9 add A83T compatible strings to sunxi EHCI & OHCI.
>
> Patch 10 adds support for A83T to musb sunxi glue.
>
> Patch 11 generalizes the VBUS function related macros for AXP PMICs.
>
> Patch 12 adds support for VBUS drive on AXP818.
>
> Patch 13 enables USB Kconfig options in h8_homlet_v2_defconfig.
>
> Patch 14 enables USB Kconfig options in Cubietruck_plus_defconfig.
>
> Patch 15 ~ 17 is the minimal changes needed to enable USB on the
> A83T boards I have. They are not the same as the kernel changes
> I will submit, and should not be merged without discussion.
>
> Regards
> ChenYu
>
>
> Chen-Yu Tsai (17):
>    power: axp818: Remove undefined axp818_init()
>    power: axp818: Fix DCDC5 default voltage
>    power: axp818: Add support for FLDOs
>    sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V)
>    sunxi: h8_homlet_v2: Set DLDO4 to 3.3V
>    sunxi: usb_phy: Add support for A83T USB PHYs
>    sunxi: clk: Fix USB PHY clock macros for A83T
>    sunxi: ehci: Add A83T compatible
>    sunxi: ohci: Add A83T compatible
>    musb: sunxi: Add support for A83T
>    sunxi: axp: Generalize register macros for VBUS drive GPIO
>    sunxi: axp: Support VBUS drive GPIO on AXP818
>    sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig
>    sunxi: Cubietruck Plus: Enable USB Kconfig options in defconfig
>    [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi
>    [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus
>    [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2
>
>   arch/arm/cpu/armv7/sunxi/usb_phy.c                 | 48 ++++++++++++++++++++++
>   arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts  | 12 ++++++
>   arch/arm/dts/sun8i-a83t-cubietruck-plus.dts        | 12 ++++++
>   arch/arm/dts/sun8i-a83t.dtsi                       | 34 +++++++++++++++
>   arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h |  6 +--
>   board/sunxi/board.c                                |  6 +++
>   configs/Cubietruck_plus_defconfig                  | 10 ++++-
>   configs/h8_homlet_v2_defconfig                     |  8 +++-
>   drivers/gpio/axp_gpio.c                            | 25 ++++++-----
>   drivers/power/Kconfig                              | 30 +++++++++++++-
>   drivers/power/axp818.c                             | 34 +++++++++++++++
>   drivers/usb/host/ehci-sunxi.c                      |  1 +
>   drivers/usb/host/ohci-sunxi.c                      |  1 +
>   drivers/usb/musb-new/musb_regs.h                   |  2 +-
>   include/axp221.h                                   |  8 ++--
>   include/axp818.h                                   |  9 ++--
>   include/axp_pmic.h                                 |  1 +
>   include/configs/sun8i.h                            |  2 +
>   18 files changed, 222 insertions(+), 27 deletions(-)
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [linux-sunxi] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs
  2016-03-29 16:26 ` [U-Boot] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs Chen-Yu Tsai
@ 2016-03-31 15:05   ` Hans de Goede
  0 siblings, 0 replies; 21+ messages in thread
From: Hans de Goede @ 2016-03-31 15:05 UTC (permalink / raw)
  To: u-boot

Hi,

On 29-03-16 18:26, Chen-Yu Tsai wrote:
> The A83T has 3 USB PHYs: 1 for USB OTG, 1 for standard USB 1.1/2.0 host,
> 1 for USB HSIC.
>
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Note, I've made some minor changes to this one to reduce the amount of
#ifdef-s it introduces.

Regards,

Hans



> ---
>   arch/arm/cpu/armv7/sunxi/usb_phy.c | 48 ++++++++++++++++++++++++++++++++++++++
>   include/configs/sun8i.h            |  2 ++
>   2 files changed, 50 insertions(+)
>
> diff --git a/arch/arm/cpu/armv7/sunxi/usb_phy.c b/arch/arm/cpu/armv7/sunxi/usb_phy.c
> index 0749fbd..4ac532a 100644
> --- a/arch/arm/cpu/armv7/sunxi/usb_phy.c
> +++ b/arch/arm/cpu/armv7/sunxi/usb_phy.c
> @@ -34,6 +34,16 @@
>   #define REG_PHY_UNK_H3			0x420
>   #define REG_PMU_UNK_H3			0x810
>
> +/* A83T specific control bits for PHY0 */
> +#define SUNXI_PHY_CTL_VBUSVLDEXT	BIT(5)
> +#define SUNXI_PHY_CTL_SIDDQ		BIT(3)
> +
> +/* A83T HSIC specific bits */
> +#define SUNXI_EHCI_HS_FORCE		BIT(20)
> +#define SUNXI_EHCI_CONNECT_DET		BIT(17)
> +#define SUNXI_EHCI_CONNECT_INT		BIT(16)
> +#define SUNXI_EHCI_HSIC			BIT(1)
> +
>   static struct sunxi_usb_phy {
>   	int usb_rst_mask;
>   	int gpio_vbus;
> @@ -55,6 +65,14 @@ static struct sunxi_usb_phy {
>   		.base = SUNXI_USB1_BASE,
>   	},
>   #if CONFIG_SUNXI_USB_PHYS >= 3
> +#ifdef CONFIG_MACH_SUN8I_A83T
> +	{
> +		.usb_rst_mask = CCM_USB_CTRL_HSIC_RST | CCM_USB_CTRL_HSIC_CLK |
> +				CCM_USB_CTRL_12M_CLK,
> +		.id = 2,
> +		.base = SUNXI_USB2_BASE,
> +	}
> +#else
>   	{
>   		.usb_rst_mask = CCM_USB_CTRL_PHY2_RST | CCM_USB_CTRL_PHY2_CLK,
>   		.id = 2,
> @@ -68,6 +86,7 @@ static struct sunxi_usb_phy {
>   		.base = SUNXI_USB3_BASE,
>   	}
>   #endif
> +#endif
>   };
>
>   static int get_vbus_gpio(int index)
> @@ -97,6 +116,7 @@ static int get_id_detect_gpio(int index)
>   	return -EINVAL;
>   }
>
> +#ifndef CONFIG_MACH_SUN8I_A83T
>   static void usb_phy_write(struct sunxi_usb_phy *phy, int addr,
>   			  int data, int len)
>   {
> @@ -161,6 +181,7 @@ static void sunxi_usb_phy_config(struct sunxi_usb_phy *phy)
>   	return;
>   }
>   #endif
> +#endif
>
>   static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
>   {
> @@ -174,6 +195,13 @@ static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
>   		SUNXI_EHCI_AHB_INCRX_ALIGN_EN |
>   		SUNXI_EHCI_ULPI_BYPASS_EN;
>
> +#ifdef CONFIG_MACH_SUN8I_A83T
> +	if (phy->id == 2)
> +		bits |= SUNXI_EHCI_HS_FORCE |
> +			SUNXI_EHCI_CONNECT_INT |
> +			SUNXI_EHCI_HSIC;
> +#endif
> +
>   	if (enable)
>   		setbits_le32(addr, bits);
>   	else
> @@ -184,9 +212,11 @@ static void sunxi_usb_phy_passby(struct sunxi_usb_phy *phy, int enable)
>
>   void sunxi_usb_phy_enable_squelch_detect(int index, int enable)
>   {
> +#ifndef CONFIG_MACH_SUN8I_A83T
>   	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
>
>   	usb_phy_write(phy, 0x3c, enable ? 0 : 2, 2);
> +#endif
>   }
>
>   void sunxi_usb_phy_init(int index)
> @@ -200,10 +230,21 @@ void sunxi_usb_phy_init(int index)
>
>   	setbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask);
>
> +#ifndef CONFIG_MACH_SUN8I_A83T
>   	sunxi_usb_phy_config(phy);
> +#endif
>
>   	if (phy->id != 0)
>   		sunxi_usb_phy_passby(phy, SUNXI_USB_PASSBY_EN);
> +
> +#ifdef CONFIG_MACH_SUN8I_A83T
> +	if (phy->id == 0) {
> +		setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
> +			     SUNXI_PHY_CTL_VBUSVLDEXT);
> +		clrbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
> +			     SUNXI_PHY_CTL_SIDDQ);
> +	}
> +#endif
>   }
>
>   void sunxi_usb_phy_exit(int index)
> @@ -218,6 +259,13 @@ void sunxi_usb_phy_exit(int index)
>   	if (phy->id != 0)
>   		sunxi_usb_phy_passby(phy, !SUNXI_USB_PASSBY_EN);
>
> +#ifdef CONFIG_MACH_SUN8I_A83T
> +	if (phy->id == 0) {
> +		setbits_le32(SUNXI_USB0_BASE + SUNXI_USB_CSR,
> +			     SUNXI_PHY_CTL_SIDDQ);
> +	}
> +#endif
> +
>   	clrbits_le32(&ccm->usb_clk_cfg, phy->usb_rst_mask);
>   }
>
> diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
> index 7c0ab1e..eb5db4e 100644
> --- a/include/configs/sun8i.h
> +++ b/include/configs/sun8i.h
> @@ -20,6 +20,8 @@
>
>   #ifdef CONFIG_MACH_SUN8I_H3
>   	#define CONFIG_SUNXI_USB_PHYS	4
> +#elif defined CONFIG_MACH_SUN8I_A83T
> +	#define CONFIG_SUNXI_USB_PHYS	3
>   #else
>   	#define CONFIG_SUNXI_USB_PHYS	2
>   #endif
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support
  2016-03-31 14:59 ` [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Hans de Goede
@ 2016-03-31 16:15   ` Chen-Yu Tsai
  0 siblings, 0 replies; 21+ messages in thread
From: Chen-Yu Tsai @ 2016-03-31 16:15 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 31, 2016 at 10:59 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 29-03-16 18:26, Chen-Yu Tsai wrote:
>>
>> Hi everyone,
>>
>> This series adds more support for axp818 regulators, and USB support
>> for A83T. Normal EHCI/OHCI USB works, and so does OTG host mode.
>
>
> Cool, thanks for working on this!
>
>> I couldn't get my Cubietruck Plus to work in gadget mode though.
>> No USB device appears on the host end when it enters fastboot.
>
>
> Did you change CONFIG_USB_MUSB_HOST=y to CONFIG_USB_MUSB_GADGET=y ?
> currently we support building either one or the other.

I did, but I didn't want to send a non-working defconfig. I'm
certain musb was compiled in gadget mode, just that nothing was
happening.

> I would certainly welcome patches to make things more dynamic,
> you could replace the
>
> #ifdef CONFIG_USB_MUSB_HOST
> #else
> #endif
>
> construct in drivers/usb/musb-new/sunxi.c: sunxi_musb_board_init()
> with an id=pin check (but only when both CONFIG_USB_MUSB_HOST and
> CONFIG_USB_MUSB_GADGET are defined, on some boards the port is
> hardwired for a certain use).
>
> If you take a shot at this, do not forget to also update musb_plat
> dynamically, currently that is statically initialized depending
> on CONFIG_USB_MUSB_HOST being defined.
>
> You probably also want to check other places for
> #ifdef CONFIG_USB_MUSB_HOST / #ifdef CONFIG_USB_MUSB_GADGET,
> but I'm reasonably sure that defining both at the same time
> should _mostly_ work, just as long as you only register either
> the host or gadget part from sunxi_musb_board_init() (which
> means that the right cable needs to be plugged in before
> u-boot starts).

I'm probably not going to spend much more time on this, at least
not soon. The host ports working should be enough for normal use.

> ###
>
> I've applied patches 1-12 to my tree, and I plan to include
> these in my next pull-req I've not added 13-14 to give
> you some time to figure out what todo with the otg, I guess
> that on the h8_homlet_v2 you can just leave it as
> CONFIG_USB_MUSB_HOST=y since it is wired to an USB A female
> connector.

That is what I intended.

> On the cubietruck you may want to make it CONFIG_USB_MUSB_GADGET=y
> since the most likely use there is using it in gadget mode (for host
> mode it has normal ports).

Right. Except I couldn't get it to work.

> About patches 15-17 you've tagged these as "[DO NOT MERGE]" I understand
> that the devicetree bits which will eventually go upstream will look
> differently, but as long as the compatible and the base-address will
> not change, we can pretty merge them in u-boot already, u-boot's dts
> copy is only used internally and not passed to the kernel.
>
> I will not merge them if you do not want me too, but we could have
> these minimal nodes for now to get things to work. These can then
> eventually be replaced with the real kernel dts when that is upstream.

If you aren't concerned with them looking different than the kernel
ones, I have no problem with merging them. Just wanted to be sure
before you do so. :)


Regards
ChenYu

P.S. I'll be at ELC next week.

>> Patch 1 removes axp818_init() from the header file, as it is undefined
>> and unused.
>>
>> Patch 2 fixes axp818's DCDC5 default voltage. DCDC5 normally supplies
>> DRAM. This changes the default to match DDR3 DRAM.
>>
>> Patch 3 adds support for axp818's FLDOs, one of which powers the HSIC
>> PHY.
>>
>> Patch 4 raises the DCDC1 voltage on h8_homlet_v2 to 3.3V, the default
>> value.
>>
>> Patch 5 enables and sets DLDO4 to 3.3V on h8_homlet_v2. This powers
>> the AC200 chip, which among other things, is the ethernet PHY.
>>
>> Patch 6 adds support for the USB PHYs on A83T.
>>
>> Patch 7 fixes some clock macros related to USB PHYs for A83T.
>>
>> Patch 8 & 9 add A83T compatible strings to sunxi EHCI & OHCI.
>>
>> Patch 10 adds support for A83T to musb sunxi glue.
>>
>> Patch 11 generalizes the VBUS function related macros for AXP PMICs.
>>
>> Patch 12 adds support for VBUS drive on AXP818.
>>
>> Patch 13 enables USB Kconfig options in h8_homlet_v2_defconfig.
>>
>> Patch 14 enables USB Kconfig options in Cubietruck_plus_defconfig.
>>
>> Patch 15 ~ 17 is the minimal changes needed to enable USB on the
>> A83T boards I have. They are not the same as the kernel changes
>> I will submit, and should not be merged without discussion.
>>
>> Regards
>> ChenYu
>>
>>
>> Chen-Yu Tsai (17):
>>    power: axp818: Remove undefined axp818_init()
>>    power: axp818: Fix DCDC5 default voltage
>>    power: axp818: Add support for FLDOs
>>    sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V)
>>    sunxi: h8_homlet_v2: Set DLDO4 to 3.3V
>>    sunxi: usb_phy: Add support for A83T USB PHYs
>>    sunxi: clk: Fix USB PHY clock macros for A83T
>>    sunxi: ehci: Add A83T compatible
>>    sunxi: ohci: Add A83T compatible
>>    musb: sunxi: Add support for A83T
>>    sunxi: axp: Generalize register macros for VBUS drive GPIO
>>    sunxi: axp: Support VBUS drive GPIO on AXP818
>>    sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig
>>    sunxi: Cubietruck Plus: Enable USB Kconfig options in defconfig
>>    [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi
>>    [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus
>>    [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2
>>
>>   arch/arm/cpu/armv7/sunxi/usb_phy.c                 | 48
>> ++++++++++++++++++++++
>>   arch/arm/dts/sun8i-a83t-allwinner-h8homlet-v2.dts  | 12 ++++++
>>   arch/arm/dts/sun8i-a83t-cubietruck-plus.dts        | 12 ++++++
>>   arch/arm/dts/sun8i-a83t.dtsi                       | 34 +++++++++++++++
>>   arch/arm/include/asm/arch-sunxi/clock_sun8i_a83t.h |  6 +--
>>   board/sunxi/board.c                                |  6 +++
>>   configs/Cubietruck_plus_defconfig                  | 10 ++++-
>>   configs/h8_homlet_v2_defconfig                     |  8 +++-
>>   drivers/gpio/axp_gpio.c                            | 25 ++++++-----
>>   drivers/power/Kconfig                              | 30 +++++++++++++-
>>   drivers/power/axp818.c                             | 34 +++++++++++++++
>>   drivers/usb/host/ehci-sunxi.c                      |  1 +
>>   drivers/usb/host/ohci-sunxi.c                      |  1 +
>>   drivers/usb/musb-new/musb_regs.h                   |  2 +-
>>   include/axp221.h                                   |  8 ++--
>>   include/axp818.h                                   |  9 ++--
>>   include/axp_pmic.h                                 |  1 +
>>   include/configs/sun8i.h                            |  2 +
>>   18 files changed, 222 insertions(+), 27 deletions(-)
>>
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-03-31 16:15 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 16:26 [U-Boot] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 01/17] power: axp818: Remove undefined axp818_init() Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 02/17] power: axp818: Fix DCDC5 default voltage Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 03/17] power: axp818: Add support for FLDOs Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 04/17] sunxi: h8_homlet_v2: Set DCDC1 to default voltage (3.3V) Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 05/17] sunxi: h8_homlet_v2: Set DLDO4 to 3.3V Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 06/17] sunxi: usb_phy: Add support for A83T USB PHYs Chen-Yu Tsai
2016-03-31 15:05   ` [U-Boot] [linux-sunxi] " Hans de Goede
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 07/17] sunxi: clk: Fix USB PHY clock macros for A83T Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 08/17] sunxi: ehci: Add A83T compatible Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 09/17] sunxi: ohci: " Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 10/17] musb: sunxi: Add support for A83T Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 11/17] sunxi: axp: Generalize register macros for VBUS drive GPIO Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 12/17] sunxi: axp: Support VBUS drive GPIO on AXP818 Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 13/17] sunxi: h8_homlet_v2: Enable USB Kconfig options in defconfig Chen-Yu Tsai
2016-03-29 16:26 ` [U-Boot] [PATCH RFC 14/17] sunxi: Cubietruck Plus: " Chen-Yu Tsai
2016-03-29 16:27 ` [U-Boot] [PATCH RFC 15/17] [DO NOT MERGE] sunxi: Add USB and R_PIO nodes to sun8i-a83t.dtsi Chen-Yu Tsai
2016-03-29 16:27 ` [U-Boot] [PATCH RFC 16/17] [DO NOT MERGE] sunxi: Enable USB on Cubietruck Plus Chen-Yu Tsai
2016-03-29 16:27 ` [U-Boot] [PATCH RFC 17/17] [DO NOT MERGE] sunxi: Enable USB nodes for H8Homlet v2 Chen-Yu Tsai
2016-03-31 14:59 ` [U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support Hans de Goede
2016-03-31 16:15   ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.