usb: musb-new: Extend and move Allwinner quirk into Kconfig
Subsystems (2)
PATCH v2 1/1 usb: musb-new: Extend and move Allwinner quirk into Kconfig
All newer Allwinner SoCs (since about 2013) miss the CONFIGDATA register in their MUSB implementation, so they need a quirk to hardcode this.
Currently this quirk depends on listing the SoCs affected in musb_reg.h, which means that this list needs to grow with every new chip.
Move the quirk feature into Kconfig, next to PIO_ONLY, and change the default to y (for Allwinner builds), while listing the early implementations as exceptions.
This fixes USB peripheral operation on some newer SoCs, which were not explicitly listed before.
Tested on H6, H616, R40 (which were broken before), and also on the H5 and A20, for regressions.
---
Hi,
a bit more elaborate than the first version, but hopefully cleaner and more robust this time: we should never need to add anything to get new SoCs covered.
Cheers,
Andre
Changelog v1 .. v2:
- Add Kconfig variable
- Switch to listing the exceptions instead of all affected SoCs
drivers/usb/musb-new/Kconfig | 10 ++++++++++ drivers/usb/musb-new/musb_regs.h | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/usb/musb-new/Kconfig +10 -0
@@ -89,3 +89,13 @@ config USB_MUSB_PIO_ONLY help All data is copied between memory and FIFO by the CPU. DMA controllers are ignored. + +config USB_MUSB_FIXED_CONFIGDATA + bool "Hardcode MUSB CONFIGDATA register" + depends on USB_MUSB_SUNXI + default n if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN7I || MACH_SUN8I_A23 + default y + help + Newer Allwinner SoCs do not implement the MUSB_CONFIGDATA register, + so it always reads 0. Select this option to override this and + return a hardcoded value instead.
drivers/usb/musb-new/musb_regs.h +1 -2
@@ -431,8 +431,7 @@ 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 || \ - definedCONFIG_MACH_SUNXI_H3_H5 || definedCONFIG_MACH_SUN50I +#ifdef CONFIG_USB_MUSB_FIXED_CONFIGDATA /* <Sigh> allwinner saves a reg, and we need to hardcode this */ return 0xde ;#else
Signature · 1 line
2.17.5
Marek Vasut
AppliedPATCH v2 1/1 usb: musb-new: Extend and move Allwinner quirk into Kconfig
Quoted 10 lines · Andre Przywara
All newer Allwinner SoCs (since about 2013) miss the CONFIGDATA register in their MUSB implementation, so they need a quirk to hardcode this.
Currently this quirk depends on listing the SoCs affected in
musb_reg.h, which means that this list needs to grow with every new chip.Move the quirk feature into
Kconfig, next toPIO_ONLY, and change the default to y (for Allwinner builds), while listing the early implementations as exceptions.
Quoted 5 lines
This fixes USB peripheral operation on some newer SoCs, which were not explicitly listed before.
Tested on H6, H616, R40 (which were broken before), and also on the H5 and A20, for regressions.
Applied, thanks