sunxi: Avoid any assumption between musb gadget and host but fallback to host
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep USB_KEYBOARD always enabled and in Kconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).
In case gadget mode is not explicitly enabled, this will fallback to host mode.
--- board/sunxi/Kconfig | 7 ------- configs/MSI_Primo73_defconfig | 1 - configs/MSI_Primo81_defconfig | 1 - include/configs/sunxi-common.h | 5 ++++- 4 files changed, 4 insertions(+), 10 deletions(-)
board/sunxi/Kconfig +0 -7
@@ -452,13 +452,6 @@ config USB_MUSB_SUNXI one usb host controller enabled at a time, so enabling this on boards which also use the ehci host controller will result in build errors. -config USB_KEYBOARD - boolean "Enable USB keyboard support" - default y - ---help--- - Say Y here to add support for using a USB keyboard (typically used - in combination with a graphical console). - config GMAC_TX_DELAY int "GMAC Transmit Clock Delay Chain" default 0
configs/MSI_Primo73_defconfig +0 -1
@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0 CONFIG_VIDEO_LCD_POWER="PH8" CONFIG_VIDEO_LCD_BL_EN="PH7" CONFIG_VIDEO_LCD_BL_PWM="PB2" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN7I=y
configs/MSI_Primo81_defconfig +0 -1
@@ -20,7 +20,6 @@ CONFIG_VIDEO_LCD_SPI_MOSI="PH11" CONFIG_VIDEO_LCD_SPI_MISO="PH12" CONFIG_VIDEO_LCD_BL_EN="PA25" CONFIG_VIDEO_LCD_BL_PWM="PH13" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN6I=y
include/configs/sunxi-common.h +4 -1
@@ -298,13 +298,16 @@ extern int soft_i2c_gpio_scl;#endif #ifdef CONFIG_USB_MUSB_SUNXI +#ifndef CONFIG_MUSB_GADGET #define CONFIG_MUSB_HOST +#endif #define CONFIG_MUSB_PIO_ONLY #endif -#if definedCONFIG_USB_EHCI || definedCONFIG_USB_MUSB_SUNXI +#if definedCONFIG_USB_EHCI || definedCONFIG_MUSB_HOST #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE +#define CONFIG_USB_KEYBOARD #endif #ifdef CONFIG_USB_KEYBOARD
Signature · 1 line
1.9.1
Hans de Goede
NAKPATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
Hi,
Quoted 9 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>
Nack, I'm not going to take any patch which removes config USB_KEYBOARD, having USB_KEYBOARD always enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.
Regards,
Hans
Quoted 72 lines
--- board/sunxi/Kconfig | 7 ------- configs/MSI_Primo73_defconfig | 1 - configs/MSI_Primo81_defconfig | 1 - include/configs/sunxi-common.h | 5 ++++- 4 files changed, 4 insertions(+), 10 deletions(-)board/sunxi/Kconfig +0
-7@@ -452,13 +452,6 @@ config USB_MUSB_SUNXI one usb host controller enabled at a time, so enabling this on boards which also use the ehci host controller will result in build errors. -config USB_KEYBOARD - boolean "Enable USB keyboard support" - default y - ---help--- - Say Y here to add support for using a USB keyboard (typically used - in combination with a graphical console). - config GMAC_TX_DELAY int "GMAC Transmit Clock Delay Chain" default 0configs/MSI_Primo73_defconfig +0
-1@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0 CONFIG_VIDEO_LCD_POWER="PH8" CONFIG_VIDEO_LCD_BL_EN="PH7" CONFIG_VIDEO_LCD_BL_PWM="PB2" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN7I=yconfigs/MSI_Primo81_defconfig +0
-1@@ -20,7 +20,6 @@ CONFIG_VIDEO_LCD_SPI_MOSI="PH11" CONFIG_VIDEO_LCD_SPI_MISO="PH12" CONFIG_VIDEO_LCD_BL_EN="PA25" CONFIG_VIDEO_LCD_BL_PWM="PH13" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN6I=yinclude/configs/sunxi-common.h +4
-1@@ -298,13 +298,16 @@ extern int soft_i2c_gpio_scl;#endif #ifdef CONFIG_USB_MUSB_SUNXI +#ifndef CONFIG_MUSB_GADGET #define CONFIG_MUSB_HOST +#endif #define CONFIG_MUSB_PIO_ONLY #endif -#if definedCONFIG_USB_EHCI || definedCONFIG_USB_MUSB_SUNXI +#if definedCONFIG_USB_EHCI || definedCONFIG_MUSB_HOST #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE +#define CONFIG_USB_KEYBOARD #endif #ifdef CONFIG_USB_KEYBOARD
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
Le dimanche 29 mars 2015 ? 13:18 +0200, Hans de Goede a ?crit :
Quoted 9 lines
Hi,
Quoted 6 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).
Quoted 8 lines
Quoted 3 lines
In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>Nack, I'm not going to take any patch which removes config
USB_KEYBOARD, havingUSB_KEYBOARDalways enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.
Fair enough, I'll give up on this then. For my use case, I can always disable USB keyboard when enabling MUSB gadget.
Quoted 76 lines
Regards,
Hans
Quoted 70 lines
--- board/sunxi/Kconfig | 7 ------- configs/MSI_Primo73_defconfig | 1 - configs/MSI_Primo81_defconfig | 1 - include/configs/sunxi-common.h | 5 ++++- 4 files changed, 4 insertions(+), 10 deletions(-)board/sunxi/Kconfig +0
-7@@ -452,13 +452,6 @@ config USB_MUSB_SUNXI one usb host controller enabled at a time, so enabling this on boards which also use the ehci host controller will result in build errors. -config USB_KEYBOARD - boolean "Enable USB keyboard support" - default y - ---help--- - Say Y here to add support for using a USB keyboard (typically used - in combination with a graphical console). - config GMAC_TX_DELAY int "GMAC Transmit Clock Delay Chain" default 0configs/MSI_Primo73_defconfig +0
-1@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0 CONFIG_VIDEO_LCD_POWER="PH8" CONFIG_VIDEO_LCD_BL_EN="PH7" CONFIG_VIDEO_LCD_BL_PWM="PB2" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN7I=yconfigs/MSI_Primo81_defconfig +0
-1@@ -20,7 +20,6 @@ CONFIG_VIDEO_LCD_SPI_MOSI="PH11" CONFIG_VIDEO_LCD_SPI_MISO="PH12" CONFIG_VIDEO_LCD_BL_EN="PA25" CONFIG_VIDEO_LCD_BL_PWM="PH13" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN6I=yinclude/configs/sunxi-common.h +4
-1@@ -298,13 +298,16 @@ extern int soft_i2c_gpio_scl;#endif #ifdef CONFIG_USB_MUSB_SUNXI +#ifndef CONFIG_MUSB_GADGET #define CONFIG_MUSB_HOST +#endif #define CONFIG_MUSB_PIO_ONLY #endif -#if definedCONFIG_USB_EHCI || definedCONFIG_USB_MUSB_SUNXI +#if definedCONFIG_USB_EHCI || definedCONFIG_MUSB_HOST #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE +#define CONFIG_USB_KEYBOARD #endif
Quoted 2 lines
include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 313
Quoted 2 lines
include/configs/sunxi-common.h +0
-0#ifdef CONFIG_USB_KEYBOARD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150329/4709f32a/attachment.sig>
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
In reply to Hans de GoedeLe dimanche 29 mars 2015 ? 13:18 +0200, Hans de Goede a ?crit :
Quoted 9 lines
Hi,
Quoted 6 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).
Quoted 8 lines
Quoted 3 lines
In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>Nack, I'm not going to take any patch which removes config
USB_KEYBOARD, havingUSB_KEYBOARDalways enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.
Actually, I said I would give up on this, but there are still parts of that patch that I need for USB gadget (not related to USB keyboard).
Regarding USB keyboard, the best solution IMO would be to set it disabled by default in board/sunxi/Kconfig (both because of the boot time penality and because it's not relevant when using gadget mode) and have it enabled individually in each configs/*_defconfig that uses USB in host mode.
Quoted 76 lines
Regards,
Hans
Quoted 70 lines
--- board/sunxi/Kconfig | 7 ------- configs/MSI_Primo73_defconfig | 1 - configs/MSI_Primo81_defconfig | 1 - include/configs/sunxi-common.h | 5 ++++- 4 files changed, 4 insertions(+), 10 deletions(-)board/sunxi/Kconfig +0
-7@@ -452,13 +452,6 @@ config USB_MUSB_SUNXI one usb host controller enabled at a time, so enabling this on boards which also use the ehci host controller will result in build errors. -config USB_KEYBOARD - boolean "Enable USB keyboard support" - default y - ---help--- - Say Y here to add support for using a USB keyboard (typically used - in combination with a graphical console). - config GMAC_TX_DELAY int "GMAC Transmit Clock Delay Chain" default 0configs/MSI_Primo73_defconfig +0
-1@@ -14,7 +14,6 @@ CONFIG_VIDEO_LCD_DCLK_PHASE=0 CONFIG_VIDEO_LCD_POWER="PH8" CONFIG_VIDEO_LCD_BL_EN="PH7" CONFIG_VIDEO_LCD_BL_PWM="PB2" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN7I=yconfigs/MSI_Primo81_defconfig +0
-1@@ -20,7 +20,6 @@ CONFIG_VIDEO_LCD_SPI_MOSI="PH11" CONFIG_VIDEO_LCD_SPI_MISO="PH12" CONFIG_VIDEO_LCD_BL_EN="PA25" CONFIG_VIDEO_LCD_BL_PWM="PH13" -CONFIG_USB_KEYBOARD=n CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN6I=yinclude/configs/sunxi-common.h +4
-1@@ -298,13 +298,16 @@ extern int soft_i2c_gpio_scl;#endif #ifdef CONFIG_USB_MUSB_SUNXI +#ifndef CONFIG_MUSB_GADGET #define CONFIG_MUSB_HOST +#endif #define CONFIG_MUSB_PIO_ONLY #endif -#if definedCONFIG_USB_EHCI || definedCONFIG_USB_MUSB_SUNXI +#if definedCONFIG_USB_EHCI || definedCONFIG_MUSB_HOST #define CONFIG_CMD_USB #define CONFIG_USB_STORAGE +#define CONFIG_USB_KEYBOARD #endif
Quoted 2 lines
include/configs/sunxi-common.h extern int soft_i2c_gpio_scl; · line 313
Quoted 2 lines
include/configs/sunxi-common.h +0
-0#ifdef CONFIG_USB_KEYBOARD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150404/29f6c2ae/attachment.sig>
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
Hi,
Quoted 19 lines · Paul Kocialkowski
Le dimanche 29 mars 2015 ? 13:18 +0200, Hans de Goede a ?crit :
Quoted 9 lines
Hi,
Quoted 6 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).Quoted 8 lines
Quoted 3 lines
In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>Nack, I'm not going to take any patch which removes config
USB_KEYBOARD, havingUSB_KEYBOARDalways enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.
Quoted 8 lines
Actually, I said I would give up on this, but there are still parts of that patch that I need for USB gadget (not related to USB keyboard).
Regarding USB keyboard, the best solution IMO would be to set it disabled by default in board/sunxi/Kconfig (both because of the boot time penality and because it's not relevant when using gadget mode) and have it enabled individually in each configs/*_defconfig that uses USB in host mode.
We try to offer the best ootb experience with the defconfigs and many users will not have serial consoles attached, so we really want usb-keyboard by default. Actually we can currently already use host mode on ehci and gadget mode on musb and then we still want usb-keyboard and that is how I expect the majority of the boards to eventually be configured ootb.
The only time when we do not want USB_KEYBOARD is when we've no usb hosts at all because that will cause linking errors, this should go away once we move over usb to the device model which will happen soon.
I'm happy to take patches you need to enable gadget mode, but I do not think it is a good idea to flip the the default and then add CONFIG_USB_KEYBOARD=y to pretty much every one of our 55 defconfig files.
Regards,
Hans
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
Le samedi 04 avril 2015 ? 15:48 +0200, Hans de Goede a ?crit :
Quoted 31 lines
Hi,
Quoted 19 lines · Paul Kocialkowski
Le dimanche 29 mars 2015 ? 13:18 +0200, Hans de Goede a ?crit :
Quoted 9 lines
Hi,
Quoted 6 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).Quoted 8 lines
Quoted 3 lines
In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>Nack, I'm not going to take any patch which removes config
USB_KEYBOARD, havingUSB_KEYBOARDalways enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.Quoted 8 lines
Actually, I said I would give up on this, but there are still parts of that patch that I need for USB gadget (not related to USB keyboard).
Regarding USB keyboard, the best solution IMO would be to set it disabled by default in board/sunxi/Kconfig (both because of the boot time penality and because it's not relevant when using gadget mode) and have it enabled individually in each configs/*_defconfig that uses USB in host mode.
Quoted 6 lines
We try to offer the best ootb experience with the defconfigs and many users will not have serial consoles attached, so we really want usb-keyboard by default. Actually we can currently already use host mode on ehci and gadget mode on musb and then we still want usb-keyboard and that is how I expect the majority of the boards to eventually be configured ootb.
I hadn't thought of that, it makes sense.
Quoted 4 lines
The only time when we do not want
USB_KEYBOARDis when we've no usb hosts at all because that will cause linking errors, this should go away once we move over usb to the device model which will happen soon.
Of course, the best solution would be to have USB keyboard enabled but not used at run-time when there is no host available at all.
Quoted 4 lines
I'm happy to take patches you need to enable gadget mode, but I do not think it is a good idea to flip the the default and then add
CONFIG_USB_KEYBOARD=yto pretty much every one of our 55 defconfig files.
Well, the long way to do it without modifying each board would be to:
* switch USB_EHCI to Kconfig
* switch MUSB_HOST and MUSB_GADGET to Kconfig
* default MUSB_GADGET to n
* default MUSB_HOST to y if !MUSB_GADGET
* default USB_KEYBORAD to y if USB_EHCI || MUSB_HOST
That way, we don't have to change the defconfigs and my problem is solved. What do you think?
This would also be one more step to eliminating CONFIG_SYS_EXTRA_OPTIONS, which is not a bad thing.
Signature · 17 lines
Paul Kocialkowski, Replicant developer Replicant is a fully free Android distribution running on several devices, a free software mobile operating system putting the emphasis on freedom and privacy/security. Website: http://www.replicant.us/ Blog: http://blog.replicant.us/ Wiki/tracker/forums: http://redmine.replicant.us/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150404/7bf71ad9/attachment.sig>
PATCH v2 1/1 sunxi: Avoid any assumption between musb gadget and host but fallback to host
Hi,
Quoted 61 lines · Paul Kocialkowski
Le samedi 04 avril 2015 ? 15:48 +0200, Hans de Goede a ?crit :
Quoted 31 lines
Hi,
Quoted 19 lines · Paul Kocialkowski
Le dimanche 29 mars 2015 ? 13:18 +0200, Hans de Goede a ?crit :
Quoted 9 lines
Hi,
Quoted 6 lines · Paul Kocialkowski
musb might be used in gadget mode on sunxi, so we don't want to assume anything related to host mode, especially USB keyboard support. Thus, there is no reason to keep
USB_KEYBOARDalways enabled and inKconfig: it is much better fit to enable it in the common sunxi config header, when needed (some devices also have no USB support at all).Quoted 8 lines
Quoted 3 lines
In case gadget mode is not explicitly enabled, this will fallback to host mode.
Signed-off-by Paul Kocialkowski <[email protected]>Nack, I'm not going to take any patch which removes config
USB_KEYBOARD, havingUSB_KEYBOARDalways enabled on devices with usb host capability causes a significant penalty in boot time, and some people may want to turn it off because of that.Quoted 8 lines
Actually, I said I would give up on this, but there are still parts of that patch that I need for USB gadget (not related to USB keyboard).
Regarding USB keyboard, the best solution IMO would be to set it disabled by default in board/sunxi/Kconfig (both because of the boot time penality and because it's not relevant when using gadget mode) and have it enabled individually in each configs/*_defconfig that uses USB in host mode.
Quoted 6 lines
We try to offer the best ootb experience with the defconfigs and many users will not have serial consoles attached, so we really want usb-keyboard by default. Actually we can currently already use host mode on ehci and gadget mode on musb and then we still want usb-keyboard and that is how I expect the majority of the boards to eventually be configured ootb.
I hadn't thought of that, it makes sense.
Quoted 4 lines
The only time when we do not want
USB_KEYBOARDis when we've no usb hosts at all because that will cause linking errors, this should go away once we move over usb to the device model which will happen soon.Of course, the best solution would be to have USB keyboard enabled but not used at run-time when there is no host available at all.
Quoted 4 lines
I'm happy to take patches you need to enable gadget mode, but I do not think it is a good idea to flip the the default and then add
CONFIG_USB_KEYBOARD=yto pretty much every one of our 55 defconfig files.Well, the long way to do it without modifying each board would be to:
* switchUSB_EHCItoKconfig
* switchMUSB_HOSTandMUSB_GADGETtoKconfig
* defaultMUSB_GADGETto n
* defaultMUSB_HOSTto y if !MUSB_GADGET
* defaultUSB_KEYBORADto y ifUSB_EHCI||MUSB_HOST
Quoted 5 lines
That way, we don't have to change the defconfigs and my problem is solved. What do you think?
This would also be one more step to eliminating
CONFIG_SYS_EXTRA_OPTIONS, which is not a bad thing.
This sounds good to me, note there already is a USB_EHCI_HCD Kconfig which does what you want in drivers/usb/host/Kconfig (it automatically defines CONFIG_USB_EHCI to keep non converted boards working).
So step 1 would be a patch moving sunxi over to stop setting USB_EHCI in CONFIG_SYS_EXTRA_OPTIONS and instead have it use define USB_ARCH_HAS_HCD and use USB_EHCI_HCD please set USB_EHCI_HCD by default in board/sunxi/Kconfig like how we also set a default for e.g. SYS_CLK_FREQ, I think in the initial patch it should have a default of:
default y
And then later be changed to:
default y if !MUSB_HOST
As for moving MUSB_HOST / GADGET to Kconfig please coordinate that with Marek.
Regards,
Hans