Changeset 1284


Ignore:
Timestamp:
03/08/07 23:27:48 (6 years ago)
Author:
werner
Message:

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)

Location:
trunk/src/target/u-boot/patches
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/u-boot/patches/boot-menu.patch

    r1283 r1284  
    2323--- /dev/null 
    2424+++ u-boot/board/neo1973/bootmenu.c 
    25 @@ -0,0 +1,335 @@ 
     25@@ -0,0 +1,365 @@ 
    2626+/* 
    2727+ * bootmenu.c - Boot menu 
     
    5151+#include <console.h> 
    5252+#include <environment.h> 
     53+#include <environment.h> 
     54+#include <asm/atomic.h> 
     55+ 
     56+#ifdef CONFIG_USBD_DFU 
     57+#include "usbdcore.h" 
     58+#include "usb_dfu.h" 
     59+#endif 
    5360+ 
    5461+#include "neo1973.h" 
     
    258265+ 
    259266+ 
     267+static int system_idle(void) 
     268+{ 
     269+#ifdef  CONFIG_USBD_DFU 
     270+       if (system_dfu_state) 
     271+               return *system_dfu_state == DFU_STATE_appIDLE; 
     272+#endif 
     273+       return 1; 
     274+} 
     275+ 
     276+ 
     277+static void poweroff_if_idle(void) 
     278+{ 
     279+       unsigned long flags; 
     280+ 
     281+       local_irq_save(flags); 
     282+       if (system_idle()) 
     283+               neo1973_poweroff(); 
     284+       local_irq_restore(flags); 
     285+} 
     286+ 
     287+ 
    260288+static void do_option(int option) 
    261289+{ 
     
    291319+       } 
    292320+       if (!option) 
    293 +               neo1973_poweroff(); 
     321+               poweroff_if_idle(); 
    294322+       init_bootmenu(); 
    295323+} 
     
    323351+       on = tmp; 
    324352+       if (neo1973_new_second()) 
    325 +               if (++seconds > boot_menu_timeout) 
    326 +                       neo1973_poweroff(); 
     353+               if (++seconds > boot_menu_timeout) { 
     354+                       poweroff_if_idle(); 
     355+                       seconds = 0; 
     356+               } 
    327357+} 
    328358+ 
  • trunk/src/target/u-boot/patches/uboot-dfu.patch

    r1155 r1284  
    11Index: u-boot/drivers/usbdcore_ep0.c 
    22=================================================================== 
    3 --- u-boot.orig/drivers/usbdcore_ep0.c  2007-02-28 03:51:25.000000000 +0100 
    4 +++ u-boot/drivers/usbdcore_ep0.c       2007-02-28 03:51:25.000000000 +0100 
     3--- u-boot.orig/drivers/usbdcore_ep0.c 
     4+++ u-boot/drivers/usbdcore_ep0.c 
    55@@ -42,10 +42,15 @@ 
    66  */ 
     
    1919 #define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args) 
    2020 #else 
    21 @@ -213,7 +218,7 @@ 
     21@@ -213,7 +218,7 @@ static int ep0_get_descriptor (struct us 
    2222                        urb->buffer = device_descriptor; 
    2323                        urb->actual_length = MIN(sizeof(*device_descriptor), max); 
     
    2828  
    2929        case USB_DESCRIPTOR_TYPE_CONFIGURATION: 
    30 @@ -267,7 +272,24 @@ 
     30@@ -267,7 +272,24 @@ static int ep0_get_descriptor (struct us 
    3131                return -1; 
    3232        case USB_DESCRIPTOR_TYPE_ENDPOINT: 
     
    5353                        return -1;      /* unsupported at this time */ 
    5454 #if 0 
    55 @@ -294,6 +316,7 @@ 
     55@@ -294,6 +316,7 @@ static int ep0_get_descriptor (struct us 
    5656                                     max); 
    5757 #endif 
     
    6161        case USB_DESCRIPTOR_TYPE_REPORT: 
    6262                { 
    63 @@ -388,6 +411,24 @@ 
     63@@ -388,6 +411,24 @@ int ep0_recv_setup (struct urb *urb) 
    6464                 le16_to_cpu (request->wLength), 
    6565                 USBD_DEVICE_REQUESTS (request->bRequest)); 
     
    8686        if ((request->bmRequestType & USB_REQ_TYPE_MASK) != 0) { 
    8787                if (device->device_state <= STATE_CONFIGURED) 
    88 @@ -570,7 +611,8 @@ 
     88@@ -570,7 +611,8 @@ int ep0_recv_setup (struct urb *urb) 
    8989                        device->interface = le16_to_cpu (request->wIndex); 
    9090                        device->alternate = le16_to_cpu (request->wValue); 
     
    9898Index: u-boot/drivers/usbdfu.c 
    9999=================================================================== 
    100 --- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    101 +++ u-boot/drivers/usbdfu.c     2007-02-28 03:51:58.000000000 +0100 
    102 @@ -0,0 +1,1000 @@ 
     100--- /dev/null 
     101+++ u-boot/drivers/usbdfu.c 
     102@@ -0,0 +1,1007 @@ 
    103103+/* 
    104104+ * (C) 2007 by OpenMoko, Inc. 
     
    168168+#define RET_ZLP                1 
    169169+#define RET_STALL      2 
     170+ 
     171+volatile enum dfu_state *system_dfu_state; /* for 3rd parties */ 
     172+ 
    170173+ 
    171174+struct dnload_state { 
     
    10251028+       dev->dfu_status = DFU_STATUS_OK; 
    10261029+ 
     1030+       if (system_dfu_state) 
     1031+               printf("SURPRISE: system_dfu_state is already set\n"); 
     1032+       system_dfu_state = &dev->dfu_state; 
     1033+ 
    10271034+       dfu_init_strings(dev); 
    10281035+ 
     
    11031110Index: u-boot/drivers/Makefile 
    11041111=================================================================== 
    1105 --- u-boot.orig/drivers/Makefile        2007-02-28 03:51:25.000000000 +0100 
    1106 +++ u-boot/drivers/Makefile     2007-02-28 03:51:25.000000000 +0100 
    1107 @@ -46,7 +46,7 @@ 
     1112--- u-boot.orig/drivers/Makefile 
     1113+++ u-boot/drivers/Makefile 
     1114@@ -46,7 +46,7 @@ COBJS = 3c589.o 5701rls.o ali512x.o atme 
    11081115          sl811_usb.o sm501.o smc91111.o smiLynxEM.o \ 
    11091116          status_led.o sym53c8xx.o systemace.o ahci.o \ 
     
    11161123Index: u-boot/drivers/usbdcore.c 
    11171124=================================================================== 
    1118 --- u-boot.orig/drivers/usbdcore.c      2007-02-28 03:47:38.000000000 +0100 
    1119 +++ u-boot/drivers/usbdcore.c   2007-02-28 03:51:25.000000000 +0100 
     1125--- u-boot.orig/drivers/usbdcore.c 
     1126+++ u-boot/drivers/usbdcore.c 
    11201127@@ -31,6 +31,7 @@ 
    11211128  
     
    11261133 #define MAX_INTERFACES 2 
    11271134  
    1128 @@ -212,6 +213,10 @@ 
     1135@@ -212,6 +213,10 @@ struct usb_alternate_instance *usbd_devi 
    11291136  */ 
    11301137 struct usb_device_descriptor *usbd_device_device_descriptor (struct usb_device_instance *device, int port) 
     
    11371144 } 
    11381145  
    1139 @@ -232,6 +237,10 @@ 
     1146@@ -232,6 +237,10 @@ struct usb_configuration_descriptor *usb 
    11401147        if (!(configuration_instance = usbd_device_configuration_instance (device, port, configuration))) { 
    11411148                return NULL; 
     
    11481155 } 
    11491156  
    1150 @@ -253,6 +262,13 @@ 
     1157@@ -253,6 +262,13 @@ struct usb_interface_descriptor *usbd_de 
    11511158        if (!(interface_instance = usbd_device_interface_instance (device, port, configuration, interface))) { 
    11521159                return NULL; 
     
    11621169                return NULL; 
    11631170        } 
    1164 @@ -681,4 +697,7 @@ 
     1171@@ -681,4 +697,7 @@ void usbd_device_event_irq (struct usb_d 
    11651172                /* usbdbg("calling device->event"); */ 
    11661173                device->event(device, event, data); 
     
    11721179Index: u-boot/drivers/usbtty.c 
    11731180=================================================================== 
    1174 --- u-boot.orig/drivers/usbtty.c        2007-02-28 03:51:24.000000000 +0100 
    1175 +++ u-boot/drivers/usbtty.c     2007-02-28 03:51:25.000000000 +0100 
     1181--- u-boot.orig/drivers/usbtty.c 
     1182+++ u-boot/drivers/usbtty.c 
    11761183@@ -31,6 +31,8 @@ 
    11771184 #include "usbtty.h" 
     
    11831190                                 * vendor specific ones */ 
    11841191  
    1185 @@ -118,7 +120,7 @@ 
     1192@@ -118,7 +120,7 @@ extern struct usb_string_descriptor **us 
    11861193 static unsigned short rx_endpoint = 0; 
    11871194 static unsigned short tx_endpoint = 0; 
     
    11921199 /* USB Descriptor Strings */ 
    11931200 static u8 wstrLang[4] = {4,USB_DT_STRING,0x9,0x4}; 
    1194 @@ -169,6 +171,10 @@ 
     1201@@ -169,6 +171,10 @@ struct acm_config_desc { 
    11951202        struct usb_interface_descriptor data_class_interface; 
    11961203        struct usb_endpoint_descriptor  
     
    12031210  
    12041211 static struct acm_config_desc acm_configuration_descriptors[NUM_CONFIGS] = { 
    1205 @@ -179,7 +185,11 @@ 
     1212@@ -179,7 +185,11 @@ static struct acm_config_desc acm_config 
    12061213                        .bDescriptorType = USB_DT_CONFIG, 
    12071214                        .wTotalLength =   
     
    12151222                        .iConfiguration = STR_CONFIG, 
    12161223                        .bmAttributes =  
    1217 @@ -278,6 +288,11 @@ 
     1224@@ -278,6 +288,11 @@ static struct acm_config_desc acm_config 
    12181225                                .bInterval              = 0xFF, 
    12191226                        }, 
     
    12271234 };      
    12281235  
    1229 @@ -390,7 +405,7 @@ 
     1236@@ -390,7 +405,7 @@ static int fill_buffer (circbuf_t * buf) 
    12301237 void usbtty_poll (void); 
    12311238  
     
    12361243        int i; 
    12371244        for (i = 0; i < strlen (str) && str[i]; i++){ 
    1238 @@ -652,6 +667,9 @@ 
     1245@@ -652,6 +667,9 @@ static void usbtty_init_instances (void) 
    12391246        device_instance->bus = bus_instance; 
    12401247        device_instance->configurations = NUM_CONFIGS; 
     
    12481255Index: u-boot/include/configs/neo1973.h 
    12491256=================================================================== 
    1250 --- u-boot.orig/include/configs/neo1973.h       2007-02-28 03:51:25.000000000 +0100 
    1251 +++ u-boot/include/configs/neo1973.h    2007-02-28 03:51:25.000000000 +0100 
     1257--- u-boot.orig/include/configs/neo1973.h 
     1258+++ u-boot/include/configs/neo1973.h 
    12521259@@ -165,7 +165,7 @@ 
    12531260  */ 
     
    12721279Index: u-boot/include/usb_dfu.h 
    12731280=================================================================== 
    1274 --- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1275 +++ u-boot/include/usb_dfu.h    2007-02-28 03:51:25.000000000 +0100 
    1276 @@ -0,0 +1,97 @@ 
     1281--- /dev/null 
     1282+++ u-boot/include/usb_dfu.h 
     1283@@ -0,0 +1,99 @@ 
    12771284+#ifndef _DFU_H 
    12781285+#define _DFU_H 
     
    13661373+#define DFU_EP0_DATA           4 
    13671374+ 
     1375+extern volatile enum dfu_state *system_dfu_state; /* for 3rd parties */ 
     1376+ 
    13681377+int dfu_ep0_handler(struct urb *urb); 
    13691378+ 
     
    13741383Index: u-boot/include/usb_dfu_descriptors.h 
    13751384=================================================================== 
    1376 --- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1377 +++ u-boot/include/usb_dfu_descriptors.h        2007-02-28 03:51:25.000000000 +0100 
     1385--- /dev/null 
     1386+++ u-boot/include/usb_dfu_descriptors.h 
    13781387@@ -0,0 +1,94 @@ 
    13791388+#ifndef _USB_DFU_H 
     
    14731482Index: u-boot/include/usbdcore.h 
    14741483=================================================================== 
    1475 --- u-boot.orig/include/usbdcore.h      2007-02-28 03:51:24.000000000 +0100 
    1476 +++ u-boot/include/usbdcore.h   2007-02-28 03:51:25.000000000 +0100 
     1484--- u-boot.orig/include/usbdcore.h 
     1485+++ u-boot/include/usbdcore.h 
    14771486@@ -33,6 +33,7 @@ 
    14781487  
     
    14831492  
    14841493 #define MAX_URBS_QUEUED 5 
    1485 @@ -475,7 +476,11 @@ 
     1494@@ -475,7 +476,11 @@ typedef struct urb_link { 
    14861495  * function driver to inform it that data has arrived. 
    14871496  */ 
     
    14951504  
    14961505        struct usb_endpoint_instance *endpoint; 
    1497 @@ -603,6 +608,12 @@ 
     1506@@ -603,6 +608,12 @@ struct usb_device_instance { 
    14981507        unsigned long usbd_rxtx_timestamp; 
    14991508        unsigned long usbd_last_rxtx_timestamp; 
     
    15081517  
    15091518 /* Bus Interface configuration structure 
    1510 @@ -632,6 +643,8 @@ 
     1519@@ -632,6 +643,8 @@ extern char *usbd_device_status[]; 
    15111520 extern char *usbd_device_requests[]; 
    15121521 extern char *usbd_device_descriptors[]; 
     
    15191528Index: u-boot/drivers/usbtty.h 
    15201529=================================================================== 
    1521 --- u-boot.orig/drivers/usbtty.h        2007-02-28 03:51:25.000000000 +0100 
    1522 +++ u-boot/drivers/usbtty.h     2007-02-28 03:51:25.000000000 +0100 
     1530--- u-boot.orig/drivers/usbtty.h 
     1531+++ u-boot/drivers/usbtty.h 
    15231532@@ -71,4 +71,10 @@ 
    15241533 #define STR_CTRL_INTERFACE     0x06 
     
    15341543Index: u-boot/include/configs/qt2410.h 
    15351544=================================================================== 
    1536 --- u-boot.orig/include/configs/qt2410.h        2007-02-28 03:51:24.000000000 +0100 
    1537 +++ u-boot/include/configs/qt2410.h     2007-02-28 03:51:25.000000000 +0100 
     1545--- u-boot.orig/include/configs/qt2410.h 
     1546+++ u-boot/include/configs/qt2410.h 
    15381547@@ -199,7 +199,8 @@ 
    15391548 #define CONFIG_USBD_PRODUCT_NAME       "QT2410 Bootloader " U_BOOT_VERSION 
Note: See TracChangeset for help on using the changeset viewer.