[U-Boot] [linux-sunxi] [PATCH RFC 00/17] sunxi: more AXP818 and A83T USB support

Hans de Goede
2016-03-31T14:59:50Z

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(-)
>