r1284 - trunk/src/target/u-boot/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Thu Mar 8 23:27:58 CET 2007
Author: werner
Date: 2007-03-08 23:27:48 +0100 (Thu, 08 Mar 2007)
New Revision: 1284
Modified:
trunk/src/target/u-boot/patches/boot-menu.patch
trunk/src/target/u-boot/patches/uboot-dfu.patch
Log:
drivers/usbdfu.c, include/usb_dfu.h (dfu_init_instance): added new global
volatile variable system_dfu_state pointing to dfu_state of the first
DFU-capable device set up in the system
board/neo1973/bootmenu.c (do_option, bootmenu_hook): changed calls to
neo1973_poweroff to poweroff_if_idle which makes sure the system is not in
DFU before powering down (power down despite DFU is still allowed if
explicitly requested by user)
Modified: trunk/src/target/u-boot/patches/boot-menu.patch
===================================================================
--- trunk/src/target/u-boot/patches/boot-menu.patch 2007-03-08 22:04:04 UTC (rev 1283)
+++ trunk/src/target/u-boot/patches/boot-menu.patch 2007-03-08 22:27:48 UTC (rev 1284)
@@ -22,7 +22,7 @@
===================================================================
--- /dev/null
+++ u-boot/board/neo1973/bootmenu.c
-@@ -0,0 +1,335 @@
+@@ -0,0 +1,365 @@
+/*
+ * bootmenu.c - Boot menu
+ *
@@ -50,7 +50,14 @@
+#include <devices.h>
+#include <console.h>
+#include <environment.h>
++#include <environment.h>
++#include <asm/atomic.h>
+
++#ifdef CONFIG_USBD_DFU
++#include "usbdcore.h"
++#include "usb_dfu.h"
++#endif
++
+#include "neo1973.h"
+
+
@@ -257,6 +264,27 @@
+}
+
+
++static int system_idle(void)
++{
++#ifdef CONFIG_USBD_DFU
++ if (system_dfu_state)
++ return *system_dfu_state == DFU_STATE_appIDLE;
++#endif
++ return 1;
++}
++
++
++static void poweroff_if_idle(void)
++{
++ unsigned long flags;
++
++ local_irq_save(flags);
++ if (system_idle())
++ neo1973_poweroff();
++ local_irq_restore(flags);
++}
++
++
+static void do_option(int option)
+{
+ int seconds, aux;
@@ -290,7 +318,7 @@
+ seconds--;
+ }
+ if (!option)
-+ neo1973_poweroff();
++ poweroff_if_idle();
+ init_bootmenu();
+}
+
@@ -322,8 +350,10 @@
+ }
+ on = tmp;
+ if (neo1973_new_second())
-+ if (++seconds > boot_menu_timeout)
-+ neo1973_poweroff();
++ if (++seconds > boot_menu_timeout) {
++ poweroff_if_idle();
++ seconds = 0;
++ }
+}
+
+
Modified: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch 2007-03-08 22:04:04 UTC (rev 1283)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch 2007-03-08 22:27:48 UTC (rev 1284)
@@ -1,7 +1,7 @@
Index: u-boot/drivers/usbdcore_ep0.c
===================================================================
---- u-boot.orig/drivers/usbdcore_ep0.c 2007-02-28 03:51:25.000000000 +0100
-+++ u-boot/drivers/usbdcore_ep0.c 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/drivers/usbdcore_ep0.c
++++ u-boot/drivers/usbdcore_ep0.c
@@ -42,10 +42,15 @@
*/
@@ -18,7 +18,7 @@
#if 0
#define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
#else
-@@ -213,7 +218,7 @@
+@@ -213,7 +218,7 @@ static int ep0_get_descriptor (struct us
urb->buffer = device_descriptor;
urb->actual_length = MIN(sizeof(*device_descriptor), max);
}
@@ -27,7 +27,7 @@
break;
case USB_DESCRIPTOR_TYPE_CONFIGURATION:
-@@ -267,7 +272,24 @@
+@@ -267,7 +272,24 @@ static int ep0_get_descriptor (struct us
return -1;
case USB_DESCRIPTOR_TYPE_ENDPOINT:
return -1;
@@ -52,7 +52,7 @@
{
return -1; /* unsupported at this time */
#if 0
-@@ -294,6 +316,7 @@
+@@ -294,6 +316,7 @@ static int ep0_get_descriptor (struct us
max);
#endif
}
@@ -60,7 +60,7 @@
break;
case USB_DESCRIPTOR_TYPE_REPORT:
{
-@@ -388,6 +411,24 @@
+@@ -388,6 +411,24 @@ int ep0_recv_setup (struct urb *urb)
le16_to_cpu (request->wLength),
USBD_DEVICE_REQUESTS (request->bRequest));
@@ -85,7 +85,7 @@
/* handle USB Standard Request (c.f. USB Spec table 9-2) */
if ((request->bmRequestType & USB_REQ_TYPE_MASK) != 0) {
if (device->device_state <= STATE_CONFIGURED)
-@@ -570,7 +611,8 @@
+@@ -570,7 +611,8 @@ int ep0_recv_setup (struct urb *urb)
device->interface = le16_to_cpu (request->wIndex);
device->alternate = le16_to_cpu (request->wValue);
/*dbg_ep0(2, "set interface: %d alternate: %d", device->interface, device->alternate); */
@@ -97,9 +97,9 @@
case USB_REQ_GET_STATUS:
Index: u-boot/drivers/usbdfu.c
===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/drivers/usbdfu.c 2007-02-28 03:51:58.000000000 +0100
-@@ -0,0 +1,1000 @@
+--- /dev/null
++++ u-boot/drivers/usbdfu.c
+@@ -0,0 +1,1007 @@
+/*
+ * (C) 2007 by OpenMoko, Inc.
+ * Author: Harald Welte <laforge at openmoko.org>
@@ -168,6 +168,9 @@
+#define RET_ZLP 1
+#define RET_STALL 2
+
++volatile enum dfu_state *system_dfu_state; /* for 3rd parties */
++
++
+struct dnload_state {
+ nand_info_t *nand;
+ struct part_info *part;
@@ -1024,6 +1027,10 @@
+ dev->dfu_state = DFU_STATE_appIDLE;
+ dev->dfu_status = DFU_STATUS_OK;
+
++ if (system_dfu_state)
++ printf("SURPRISE: system_dfu_state is already set\n");
++ system_dfu_state = &dev->dfu_state;
++
+ dfu_init_strings(dev);
+
+ return 0;
@@ -1102,9 +1109,9 @@
+#endif /* CONFIG_USBD_DFU */
Index: u-boot/drivers/Makefile
===================================================================
---- u-boot.orig/drivers/Makefile 2007-02-28 03:51:25.000000000 +0100
-+++ u-boot/drivers/Makefile 2007-02-28 03:51:25.000000000 +0100
-@@ -46,7 +46,7 @@
+--- u-boot.orig/drivers/Makefile
++++ u-boot/drivers/Makefile
+@@ -46,7 +46,7 @@ COBJS = 3c589.o 5701rls.o ali512x.o atme
sl811_usb.o sm501.o smc91111.o smiLynxEM.o \
status_led.o sym53c8xx.o systemace.o ahci.o \
ti_pci1410a.o tigon3.o tsec.o \
@@ -1115,8 +1122,8 @@
pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
Index: u-boot/drivers/usbdcore.c
===================================================================
---- u-boot.orig/drivers/usbdcore.c 2007-02-28 03:47:38.000000000 +0100
-+++ u-boot/drivers/usbdcore.c 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/drivers/usbdcore.c
++++ u-boot/drivers/usbdcore.c
@@ -31,6 +31,7 @@
#include <malloc.h>
@@ -1125,7 +1132,7 @@
#define MAX_INTERFACES 2
-@@ -212,6 +213,10 @@
+@@ -212,6 +213,10 @@ struct usb_alternate_instance *usbd_devi
*/
struct usb_device_descriptor *usbd_device_device_descriptor (struct usb_device_instance *device, int port)
{
@@ -1136,7 +1143,7 @@
return (device->device_descriptor);
}
-@@ -232,6 +237,10 @@
+@@ -232,6 +237,10 @@ struct usb_configuration_descriptor *usb
if (!(configuration_instance = usbd_device_configuration_instance (device, port, configuration))) {
return NULL;
}
@@ -1147,7 +1154,7 @@
return (configuration_instance->configuration_descriptor);
}
-@@ -253,6 +262,13 @@
+@@ -253,6 +262,13 @@ struct usb_interface_descriptor *usbd_de
if (!(interface_instance = usbd_device_interface_instance (device, port, configuration, interface))) {
return NULL;
}
@@ -1161,7 +1168,7 @@
if ((alternate < 0) || (alternate >= interface_instance->alternates)) {
return NULL;
}
-@@ -681,4 +697,7 @@
+@@ -681,4 +697,7 @@ void usbd_device_event_irq (struct usb_d
/* usbdbg("calling device->event"); */
device->event(device, event, data);
}
@@ -1171,8 +1178,8 @@
}
Index: u-boot/drivers/usbtty.c
===================================================================
---- u-boot.orig/drivers/usbtty.c 2007-02-28 03:51:24.000000000 +0100
-+++ u-boot/drivers/usbtty.c 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/drivers/usbtty.c
++++ u-boot/drivers/usbtty.c
@@ -31,6 +31,8 @@
#include "usbtty.h"
#include "usb_cdc_acm.h"
@@ -1182,7 +1189,7 @@
#include <config.h> /* If defined, override Linux identifiers with
* vendor specific ones */
-@@ -118,7 +120,7 @@
+@@ -118,7 +120,7 @@ extern struct usb_string_descriptor **us
static unsigned short rx_endpoint = 0;
static unsigned short tx_endpoint = 0;
static unsigned short interface_count = 0;
@@ -1191,7 +1198,7 @@
/* USB Descriptor Strings */
static u8 wstrLang[4] = {4,USB_DT_STRING,0x9,0x4};
-@@ -169,6 +171,10 @@
+@@ -169,6 +171,10 @@ struct acm_config_desc {
struct usb_interface_descriptor data_class_interface;
struct usb_endpoint_descriptor
data_endpoints[NUM_ENDPOINTS-1] __attribute__((packed));
@@ -1202,7 +1209,7 @@
} __attribute__((packed));
static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = {
-@@ -179,7 +185,11 @@
+@@ -179,7 +185,11 @@ static struct acm_config_desc acm_config
.bDescriptorType = USB_DT_CONFIG,
.wTotalLength =
cpu_to_le16(sizeof(struct acm_config_desc)),
@@ -1214,7 +1221,7 @@
.bConfigurationValue = 1,
.iConfiguration = STR_CONFIG,
.bmAttributes =
-@@ -278,6 +288,11 @@
+@@ -278,6 +288,11 @@ static struct acm_config_desc acm_config
.bInterval = 0xFF,
},
},
@@ -1226,7 +1233,7 @@
},
};
-@@ -390,7 +405,7 @@
+@@ -390,7 +405,7 @@ static int fill_buffer (circbuf_t * buf)
void usbtty_poll (void);
/* utility function for converting char* to wide string used by USB */
@@ -1235,7 +1242,7 @@
{
int i;
for (i = 0; i < strlen (str) && str[i]; i++){
-@@ -652,6 +667,9 @@
+@@ -652,6 +667,9 @@ static void usbtty_init_instances (void)
device_instance->bus = bus_instance;
device_instance->configurations = NUM_CONFIGS;
device_instance->configuration_instance_array = config_instance;
@@ -1247,8 +1254,8 @@
memset (bus_instance, 0, sizeof (struct usb_bus_instance));
Index: u-boot/include/configs/neo1973.h
===================================================================
---- u-boot.orig/include/configs/neo1973.h 2007-02-28 03:51:25.000000000 +0100
-+++ u-boot/include/configs/neo1973.h 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/include/configs/neo1973.h
++++ u-boot/include/configs/neo1973.h
@@ -165,7 +165,7 @@
*/
#define CONFIG_STACKSIZE (128*1024) /* regular stack */
@@ -1271,9 +1278,9 @@
* Physical Memory Map
Index: u-boot/include/usb_dfu.h
===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/include/usb_dfu.h 2007-02-28 03:51:25.000000000 +0100
-@@ -0,0 +1,97 @@
+--- /dev/null
++++ u-boot/include/usb_dfu.h
+@@ -0,0 +1,99 @@
+#ifndef _DFU_H
+#define _DFU_H
+
@@ -1365,6 +1372,8 @@
+#define DFU_EP0_ZLP 3
+#define DFU_EP0_DATA 4
+
++extern volatile enum dfu_state *system_dfu_state; /* for 3rd parties */
++
+int dfu_ep0_handler(struct urb *urb);
+
+void dfu_event(struct usb_device_instance *device,
@@ -1373,8 +1382,8 @@
+#endif /* _DFU_H */
Index: u-boot/include/usb_dfu_descriptors.h
===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/include/usb_dfu_descriptors.h 2007-02-28 03:51:25.000000000 +0100
+--- /dev/null
++++ u-boot/include/usb_dfu_descriptors.h
@@ -0,0 +1,94 @@
+#ifndef _USB_DFU_H
+#define _USB_DFU_H
@@ -1472,8 +1481,8 @@
+#endif /* _USB_DFU_H */
Index: u-boot/include/usbdcore.h
===================================================================
---- u-boot.orig/include/usbdcore.h 2007-02-28 03:51:24.000000000 +0100
-+++ u-boot/include/usbdcore.h 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/include/usbdcore.h
++++ u-boot/include/usbdcore.h
@@ -33,6 +33,7 @@
#include <common.h>
@@ -1482,7 +1491,7 @@
#define MAX_URBS_QUEUED 5
-@@ -475,7 +476,11 @@
+@@ -475,7 +476,11 @@ typedef struct urb_link {
* function driver to inform it that data has arrived.
*/
@@ -1494,7 +1503,7 @@
struct urb {
struct usb_endpoint_instance *endpoint;
-@@ -603,6 +608,12 @@
+@@ -603,6 +608,12 @@ struct usb_device_instance {
unsigned long usbd_rxtx_timestamp;
unsigned long usbd_last_rxtx_timestamp;
@@ -1507,7 +1516,7 @@
};
/* Bus Interface configuration structure
-@@ -632,6 +643,8 @@
+@@ -632,6 +643,8 @@ extern char *usbd_device_status[];
extern char *usbd_device_requests[];
extern char *usbd_device_descriptors[];
@@ -1518,8 +1527,8 @@
urb_link *first_urb_link (urb_link * hd);
Index: u-boot/drivers/usbtty.h
===================================================================
---- u-boot.orig/drivers/usbtty.h 2007-02-28 03:51:25.000000000 +0100
-+++ u-boot/drivers/usbtty.h 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/drivers/usbtty.h
++++ u-boot/drivers/usbtty.h
@@ -71,4 +71,10 @@
#define STR_CTRL_INTERFACE 0x06
#define STR_COUNT 0x07
@@ -1533,8 +1542,8 @@
#endif
Index: u-boot/include/configs/qt2410.h
===================================================================
---- u-boot.orig/include/configs/qt2410.h 2007-02-28 03:51:24.000000000 +0100
-+++ u-boot/include/configs/qt2410.h 2007-02-28 03:51:25.000000000 +0100
+--- u-boot.orig/include/configs/qt2410.h
++++ u-boot/include/configs/qt2410.h
@@ -199,7 +199,8 @@
#define CONFIG_USBD_PRODUCT_NAME "QT2410 Bootloader " U_BOOT_VERSION
#define CONFIG_EXTRA_ENV_SETTINGS "usbtty=cdc_acm\0"
More information about the commitlog
mailing list