[PATCH 1/6] OMAP4: check for usb availability at device registration

Vicente Bergas vicencb at gmail.com
Sat Mar 16 18:59:37 EDT 2013


this way serial-over-usb driver is registered always, but the device is
only registered when booting from usb.

Signed-off-by: Vicente Bergas <vicencb at gmail.com>
---
 arch/arm/boards/archosg9/board.c      | 6 +++++-
 drivers/serial/serial_omap4_usbboot.c | 2 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c
index bf247de..3ae7051 100644
--- a/arch/arm/boards/archosg9/board.c
+++ b/arch/arm/boards/archosg9/board.c
@@ -17,15 +17,19 @@
 #include <generated/mach-types.h>
 #include <mach/omap4-silicon.h>
 #include <mach/omap4-devices.h>
+#include <mach/omap4_rom_usb.h>
 #include <sizes.h>
 #include <i2c/i2c.h>
 #include <gpio.h>
 #include "archos_features.h"
 
 static int archosg9_console_init(void){
-	if (IS_ENABLED(CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT))
+	if (IS_ENABLED(CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT) &&
+		omap4_usbboot_ready()
+	){
 		add_generic_device("serial_omap4_usbboot", DEVICE_ID_DYNAMIC
 			, NULL, 0, 0, 0, NULL);
+	}
 	if (IS_ENABLED(CONFIG_DRIVER_SERIAL_NS16550)) {
 		gpio_direction_output(41, 0); /* gps_disable */
 		gpio_direction_output(34, 1); /* 1v8_pwron */
diff --git a/drivers/serial/serial_omap4_usbboot.c b/drivers/serial/serial_omap4_usbboot.c
index e377fc4..f0a2fd1 100644
--- a/drivers/serial/serial_omap4_usbboot.c
+++ b/drivers/serial/serial_omap4_usbboot.c
@@ -78,8 +78,6 @@ static struct driver_d serial_omap4_usbboot_driver = {
 
 static int serial_omap4_usbboot_init(void)
 {
-	if (!omap4_usbboot_ready())
-		return 0;
 	return platform_driver_register(&serial_omap4_usbboot_driver);
 }
 console_initcall(serial_omap4_usbboot_init);
-- 
1.8.2




More information about the barebox mailing list