Skip to contentSkip to conversation

arm: sunxi: do not force USB for arch-sunxi

PATCH New Yann E. MORIN 2 participants 5 messages Oct 31, 2016 – Nov 13, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: sunxi: do not force USB for arch-sunxi

Currently, USB is forced-enabled for the sunxi familly, and there is no way to disable it.

However, USB takes a long time to initiliase, delaying the boot by up to 5 seconds (without any USB device attached!). This is a very long delay, especially in cases where USB booting is not wanted at all, and where the device is expected to boot relatively often (even in production).

Change the way the dependencies are handled, by only forcibly selecting USB when CONFIG_DISTRO_DEFAULTS ("defaults suitable for booting general purpose Linux distributions") is set. This option defaults to y for the sunxi familly, so the current default behaviour is kept unchanged. Users interested in boot time and/or size will be able to disable this to further disable USB.

With USB disabled, the time spent in U-Boot before handing control to the Linux kernel is about 1s now, down from ~5s (Nanopi Neo, sunxi H3).

Cc Ian Campbell <[email protected]>
Cc Hans De Goede <[email protected]>

---
This is a tentative patch, acting as an RFC (unless it is good to go as is, of course!).

This has been discussed on IRC with <ssvb> and <apritzel>, and this solution is what emerged from the discussions as a first step.

The second step would be to defer intialisation of drivers until they are actually needed, i.e. if main boot is not from USB, then don't initiliase USB; if main boot fails, then initialise addtional drivers, like USB... Or something along those lines... That's a much tougher work for me, though...

There are other features that are currently forced like USB, but USB is by far the worst "offender" and a low-hanging fruit. Those other "offenders" can be handled in follow up changes.

---
 arch/arm/Kconfig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/Kconfig +5 -5
index d7a9b11..c13f60f 100644
@@ -561,22 +561,22 @@ config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
 	select CMD_GPIO
 	select CMD_MMC if MMC
-	select CMD_USB
+	select CMD_USB if DISTRO_DEFAULTS
 	select DM
 	select DM_ETH
 	select DM_GPIO
 	select DM_KEYBOARD
 	select DM_SERIAL
-	select DM_USB
+	select DM_USB if DISTRO_DEFAULTS
 	select OF_BOARD_SETUP
 	select OF_CONTROL
 	select OF_SEPARATE
 	select SPL_STACK_R if SUPPORT_SPL
 	select SPL_SYS_MALLOC_SIMPLE if SUPPORT_SPL
 	select SYS_NS16550
-	select USB
-	select USB_STORAGE
-	select USB_KEYBOARD
+	select USB if DISTRO_DEFAULTS
+	select USB_STORAGE if DISTRO_DEFAULTS
+	select USB_KEYBOARD if DISTRO_DEFAULTS
 	select USE_TINY_PRINTF
 
 config TARGET_TS4800
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 arm: sunxi: do not force USB for arch-sunxi

Ian, Hans, All,

On 2016-10-31 22:33 +0100, Yann E. MORIN spake thusly:

Quoted 15 lines

Currently, USB is forced-enabled for the sunxi familly, and there is no way to disable it.

However, USB takes a long time to initiliase, delaying the boot by up to 5 seconds (without any USB device attached!). This is a very long delay, especially in cases where USB booting is not wanted at all, and where the device is expected to boot relatively often (even in production).

Change the way the dependencies are handled, by only forcibly selecting USB when CONFIG_DISTRO_DEFAULTS ("defaults suitable for booting general purpose Linux distributions") is set. This option defaults to y for the sunxi familly, so the current default behaviour is kept unchanged. Users interested in boot time and/or size will be able to disable this to further disable USB.

Quoted 2 lines

With USB disabled, the time spent in U-Boot before handing control to the Linux kernel is about 1s now, down from ~5s (Nanopi Neo, sunxi H3).

Just a gentle ping... ;-)

Regards,
Yann E. MORIN.

Quoted 59 lines
Cc Ian Campbell <[email protected]>
Cc Hans De Goede <[email protected]>

---
This is a tentative patch, acting as an RFC (unless it is good to go as is, of course!).

This has been discussed on IRC with <ssvb> and <apritzel>, and this solution is what emerged from the discussions as a first step.

The second step would be to defer intialisation of drivers until they are actually needed, i.e. if main boot is not from USB, then don't initiliase USB; if main boot fails, then initialise addtional drivers, like USB... Or something along those lines... That's a much tougher work for me, though...

There are other features that are currently forced like USB, but USB is by far the worst "offender" and a low-hanging fruit. Those other "offenders" can be handled in follow up changes.

---
 arch/arm/Kconfig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/Kconfig +5 -5
index d7a9b11..c13f60f 100644
@@ -561,22 +561,22 @@ config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
 	select CMD_GPIO
 	select CMD_MMC if MMC
-	select CMD_USB
+	select CMD_USB if DISTRO_DEFAULTS
 	select DM
 	select DM_ETH
 	select DM_GPIO
 	select DM_KEYBOARD
 	select DM_SERIAL
-	select DM_USB
+	select DM_USB if DISTRO_DEFAULTS
 	select OF_BOARD_SETUP
 	select OF_CONTROL
 	select OF_SEPARATE
 	select SPL_STACK_R if SUPPORT_SPL
 	select SPL_SYS_MALLOC_SIMPLE if SUPPORT_SPL
 	select SYS_NS16550
-	select USB
-	select USB_STORAGE
-	select USB_KEYBOARD
+	select USB if DISTRO_DEFAULTS
+	select USB_STORAGE if DISTRO_DEFAULTS
+	select USB_KEYBOARD if DISTRO_DEFAULTS
 	select USE_TINY_PRINTF
 
 config TARGET_TS4800
Signature · 1 line
2.7.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 arm: sunxi: do not force USB for arch-sunxi

Hi,

Quoted 18 lines · Yann E. MORIN

Ian, Hans, All,

On 2016-10-31 22:33 +0100, Yann E. MORIN spake thusly:

Quoted 15 lines

Currently, USB is forced-enabled for the sunxi familly, and there is no way to disable it.

However, USB takes a long time to initiliase, delaying the boot by up to 5 seconds (without any USB device attached!). This is a very long delay, especially in cases where USB booting is not wanted at all, and where the device is expected to boot relatively often (even in production).

Change the way the dependencies are handled, by only forcibly selecting USB when CONFIG_DISTRO_DEFAULTS ("defaults suitable for booting general purpose Linux distributions") is set. This option defaults to y for the sunxi familly, so the current default behaviour is kept unchanged. Users interested in boot time and/or size will be able to disable this to further disable USB.

Quoted 4 lines
Quoted 2 lines

With USB disabled, the time spent in U-Boot before handing control to the Linux kernel is about 1s now, down from ~5s (Nanopi Neo, sunxi H3).

Just a gentle ping... ;-)

10 days is a bit short in between ping times for a volunteer maintained subsys :) Anyways I've this on my todo and hopefully will get around to it soonish.

Regards,

Hans

Quoted 64 lines

Regards,
Yann E. MORIN.

Quoted 59 lines
Cc Ian Campbell <[email protected]>
Cc Hans De Goede <[email protected]>

---
This is a tentative patch, acting as an RFC (unless it is good to go as is, of course!).

This has been discussed on IRC with <ssvb> and <apritzel>, and this solution is what emerged from the discussions as a first step.

The second step would be to defer intialisation of drivers until they are actually needed, i.e. if main boot is not from USB, then don't initiliase USB; if main boot fails, then initialise addtional drivers, like USB... Or something along those lines... That's a much tougher work for me, though...

There are other features that are currently forced like USB, but USB is by far the worst "offender" and a low-hanging fruit. Those other "offenders" can be handled in follow up changes.

---
 arch/arm/Kconfig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/Kconfig +5 -6
index d7a9b11..c13f60f 100644
@@ -561,22 +561,22 @@ config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
 	select CMD_GPIO
 	select CMD_MMC if MMC
-	select CMD_USB
+	select CMD_USB if DISTRO_DEFAULTS
 	select DM
 	select DM_ETH
 	select DM_GPIO
 	select DM_KEYBOARD
 	select DM_SERIAL
-	select DM_USB
+	select DM_USB if DISTRO_DEFAULTS
 	select OF_BOARD_SETUP
 	select OF_CONTROL
 	select OF_SEPARATE
 	select SPL_STACK_R if SUPPORT_SPL
 	select SPL_SYS_MALLOC_SIMPLE if SUPPORT_SPL
 	select SYS_NS16550
-	select USB
-	select USB_STORAGE
-	select USB_KEYBOARD
+	select USB if DISTRO_DEFAULTS
+	select USB_STORAGE if DISTRO_DEFAULTS
+	select USB_KEYBOARD if DISTRO_DEFAULTS
 	select USE_TINY_PRINTF
 
 config TARGET_TS4800
--

2.7.4

#3 lore raw

PATCH 1/1 arm: sunxi: do not force USB for arch-sunxi

Hans, All,

On 2016-11-10 20:10 +0100, Hans de Goede spake thusly:

Quoted 19 lines · Yann E. MORIN
Quoted 18 lines

Ian, Hans, All,

On 2016-10-31 22:33 +0100, Yann E. MORIN spake thusly:

Quoted 15 lines

Currently, USB is forced-enabled for the sunxi familly, and there is no way to disable it.

However, USB takes a long time to initiliase, delaying the boot by up to 5 seconds (without any USB device attached!). This is a very long delay, especially in cases where USB booting is not wanted at all, and where the device is expected to boot relatively often (even in production).

Change the way the dependencies are handled, by only forcibly selecting USB when CONFIG_DISTRO_DEFAULTS ("defaults suitable for booting general purpose Linux distributions") is set. This option defaults to y for the sunxi familly, so the current default behaviour is kept unchanged. Users interested in boot time and/or size will be able to disable this to further disable USB.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

With USB disabled, the time spent in U-Boot before handing control to the Linux kernel is about 1s now, down from ~5s (Nanopi Neo, sunxi H3).

Just a gentle ping... ;-)

10 days is a bit short in between ping times for a volunteer maintained subsys :)

Sorry, I'm just new on the U-Boot list, so I'm not sure what the usual round-trip is. ;-)

Quoted 2 lines

Anyways I've this on my todo and hopefully will get around to it soonish.

Thanks! You'll get a beer next time we meet for ELC-E.

(What? Bribery does not help? Ohh.. ;-) )

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 arm: sunxi: do not force USB for arch-sunxi

In reply to Yann E. MORIN

Hi,

Quoted 18 lines · Yann E. MORIN

Currently, USB is forced-enabled for the sunxi familly, and there is no way to disable it.

However, USB takes a long time to initiliase, delaying the boot by up to 5 seconds (without any USB device attached!). This is a very long delay, especially in cases where USB booting is not wanted at all, and where the device is expected to boot relatively often (even in production).

Change the way the dependencies are handled, by only forcibly selecting USB when CONFIG_DISTRO_DEFAULTS ("defaults suitable for booting general purpose Linux distributions") is set. This option defaults to y for the sunxi familly, so the current default behaviour is kept unchanged. Users interested in boot time and/or size will be able to disable this to further disable USB.

With USB disabled, the time spent in U-Boot before handing control to the Linux kernel is about 1s now, down from ~5s (Nanopi Neo, sunxi H3).

Quoted 7 lines
Cc Ian Campbell <[email protected]>
Cc Hans De Goede <[email protected]>

---
This is a tentative patch, acting as an RFC (unless it is good to go as is, of course!).

I cannot come up with a better approach either, so this LGTM:

Regards,

Hans

Quoted 50 lines

This has been discussed on IRC with <ssvb> and <apritzel>, and this solution is what emerged from the discussions as a first step.

The second step would be to defer intialisation of drivers until they are actually needed, i.e. if main boot is not from USB, then don't initiliase USB; if main boot fails, then initialise addtional drivers, like USB... Or something along those lines... That's a much tougher work for me, though...

There are other features that are currently forced like USB, but USB is by far the worst "offender" and a low-hanging fruit. Those other "offenders" can be handled in follow up changes.

---
 arch/arm/Kconfig | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/Kconfig +5 -5
index d7a9b11..c13f60f 100644
@@ -561,22 +561,22 @@ config ARCH_SUNXI
 	bool "Support sunxi (Allwinner) SoCs"
 	select CMD_GPIO
 	select CMD_MMC if MMC
-	select CMD_USB
+	select CMD_USB if DISTRO_DEFAULTS
 	select DM
 	select DM_ETH
 	select DM_GPIO
 	select DM_KEYBOARD
 	select DM_SERIAL
-	select DM_USB
+	select DM_USB if DISTRO_DEFAULTS
 	select OF_BOARD_SETUP
 	select OF_CONTROL
 	select OF_SEPARATE
 	select SPL_STACK_R if SUPPORT_SPL
 	select SPL_SYS_MALLOC_SIMPLE if SUPPORT_SPL
 	select SYS_NS16550
-	select USB
-	select USB_STORAGE
-	select USB_KEYBOARD
+	select USB if DISTRO_DEFAULTS
+	select USB_STORAGE if DISTRO_DEFAULTS
+	select USB_KEYBOARD if DISTRO_DEFAULTS
 	select USE_TINY_PRINTF
 
 config TARGET_TS4800