ARM: omap4_romusb: allow adding usb-serial when not booting from usb
Signed-off-by: Vicente Bergas <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
4fe4febc3e
commit
c60a184c53
|
@ -17,15 +17,18 @@
|
|||
#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 */
|
||||
|
|
|
@ -122,8 +122,11 @@ struct omap4_usbboot {
|
|||
struct per_handle dread;
|
||||
struct per_handle dwrite;
|
||||
struct per_driver *io;
|
||||
int ready;
|
||||
};
|
||||
|
||||
int omap4_usbboot_open(void);
|
||||
int omap4_usbboot_ready(void);
|
||||
void omap4_usbboot_close(void);
|
||||
|
||||
void omap4_usbboot_queue_read(void *data, unsigned len);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
static struct omap4_usbboot omap4_usbboot_data;
|
||||
|
||||
static int omap4_usbboot_open(void)
|
||||
int omap4_usbboot_open(void)
|
||||
{
|
||||
int (*rom_get_per_driver)(struct per_driver **io, u32 device_type);
|
||||
int (*rom_get_per_device)(struct per_handle **rh);
|
||||
|
@ -60,7 +60,7 @@ static int omap4_usbboot_open(void)
|
|||
|
||||
if ((boot->device_type != DEVICE_USB) &&
|
||||
(boot->device_type != DEVICE_USBEXT))
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
memset(&omap4_usbboot_data, 0, sizeof(omap4_usbboot_data));
|
||||
n = rom_get_per_driver(&omap4_usbboot_data.io, boot->device_type);
|
||||
|
@ -77,9 +77,16 @@ static int omap4_usbboot_open(void)
|
|||
omap4_usbboot_data.dwrite.options = boot->options;
|
||||
omap4_usbboot_data.dwrite.device_type = boot->device_type;
|
||||
__asm__ __volatile__ ("cpsie i\n");
|
||||
omap4_usbboot_data.ready = 1;
|
||||
|
||||
omap4_usbboot_puts("USB communications initialized\n");
|
||||
return 0;
|
||||
}
|
||||
core_initcall(omap4_usbboot_open);
|
||||
|
||||
int omap4_usbboot_ready(void){
|
||||
return omap4_usbboot_data.ready;
|
||||
}
|
||||
|
||||
static void rom_read_callback(struct per_handle *rh)
|
||||
{
|
||||
|
@ -110,11 +117,13 @@ int omap4_usbboot_wait_read(void)
|
|||
omap4_usbboot_data.dread.status = -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int omap4_usbboot_is_read_waiting(void)
|
||||
{
|
||||
barrier();
|
||||
return omap4_usbboot_data.dread.status == STATUS_WAITING;
|
||||
}
|
||||
|
||||
int omap4_usbboot_is_read_ok(void)
|
||||
{
|
||||
barrier();
|
||||
|
@ -186,13 +195,3 @@ void omap4_usbboot_puts(const char *s)
|
|||
while ((c = *s++))
|
||||
omap4_usbboot_write(&c, 4);
|
||||
}
|
||||
|
||||
static int omap4_usbboot_init(void)
|
||||
{
|
||||
if (omap4_bootsrc() == OMAP_BOOTSRC_USB1) {
|
||||
omap4_usbboot_open();
|
||||
omap4_usbboot_puts("USB communications initialized\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
core_initcall(omap4_usbboot_init);
|
||||
|
|
Loading…
Reference in New Issue