summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch316
1 files changed, 316 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch
new file mode 100644
index 0000000000..6f6af2c758
--- /dev/null
+++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/neo1973-chargefast.patch
@@ -0,0 +1,316 @@
1Index: u-boot/drivers/usbtty.c
2===================================================================
3--- u-boot.orig/drivers/usbtty.c
4+++ u-boot/drivers/usbtty.c
5@@ -66,7 +66,7 @@
6 /*
7 * Defines
8 */
9-#define NUM_CONFIGS 1
10+#define NUM_CONFIGS 2
11 #define MAX_INTERFACES 2
12 #define NUM_ENDPOINTS 3
13 #define ACM_TX_ENDPOINT 3
14@@ -192,8 +192,7 @@
15 #endif
16 .bConfigurationValue = 1,
17 .iConfiguration = STR_CONFIG,
18- .bmAttributes =
19- BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED,
20+ .bmAttributes = BMATTRIBUTE_RESERVED,
21 .bMaxPower = USBTTY_MAXPOWER
22 },
23 /* Interface 1 */
24@@ -294,6 +293,120 @@
25 .func_dfu = DFU_FUNC_DESC,
26 #endif
27 },
28+ {
29+ .configuration_desc ={
30+ .bLength =
31+ sizeof(struct usb_configuration_descriptor),
32+ .bDescriptorType = USB_DT_CONFIG,
33+ .wTotalLength =
34+ cpu_to_le16(sizeof(struct acm_config_desc)
35+#ifdef CONFIG_USBD_DFU
36+ - sizeof(struct usb_interface_descriptor)
37+ - sizeof(struct usb_dfu_func_descriptor)
38+#endif
39+ ),
40+ .bNumInterfaces = NUM_ACM_INTERFACES,
41+ .bConfigurationValue = 2,
42+ .iConfiguration = STR_CONFIG,
43+ .bmAttributes = BMATTRIBUTE_RESERVED,
44+ .bMaxPower = 50, /* 100mA */
45+ },
46+ /* Interface 1 */
47+ .interface_desc = {
48+ .bLength = sizeof(struct usb_interface_descriptor),
49+ .bDescriptorType = USB_DT_INTERFACE,
50+ .bInterfaceNumber = 0,
51+ .bAlternateSetting = 0,
52+ .bNumEndpoints = 0x01,
53+ .bInterfaceClass =
54+ COMMUNICATIONS_INTERFACE_CLASS_CONTROL,
55+ .bInterfaceSubClass = COMMUNICATIONS_ACM_SUBCLASS,
56+ .bInterfaceProtocol = COMMUNICATIONS_V25TER_PROTOCOL,
57+ .iInterface = STR_CTRL_INTERFACE,
58+ },
59+ .usb_class_header = {
60+ .bFunctionLength =
61+ sizeof(struct usb_class_header_function_descriptor),
62+ .bDescriptorType = CS_INTERFACE,
63+ .bDescriptorSubtype = USB_ST_HEADER,
64+ .bcdCDC = cpu_to_le16(110),
65+ },
66+ .usb_class_call_mgt = {
67+ .bFunctionLength =
68+ sizeof(struct usb_class_call_management_descriptor),
69+ .bDescriptorType = CS_INTERFACE,
70+ .bDescriptorSubtype = USB_ST_CMF,
71+ .bmCapabilities = 0x00,
72+ .bDataInterface = 0x01,
73+ },
74+ .usb_class_acm = {
75+ .bFunctionLength =
76+ sizeof(struct usb_class_abstract_control_descriptor),
77+ .bDescriptorType = CS_INTERFACE,
78+ .bDescriptorSubtype = USB_ST_ACMF,
79+ .bmCapabilities = 0x00,
80+ },
81+ .usb_class_union = {
82+ .bFunctionLength =
83+ sizeof(struct usb_class_union_function_descriptor),
84+ .bDescriptorType = CS_INTERFACE,
85+ .bDescriptorSubtype = USB_ST_UF,
86+ .bMasterInterface = 0x00,
87+ .bSlaveInterface0 = 0x01,
88+ },
89+ .notification_endpoint = {
90+ .bLength =
91+ sizeof(struct usb_endpoint_descriptor),
92+ .bDescriptorType = USB_DT_ENDPOINT,
93+ .bEndpointAddress = 0x01 | USB_DIR_IN,
94+ .bmAttributes = USB_ENDPOINT_XFER_INT,
95+ .wMaxPacketSize
96+ = cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE),
97+ .bInterval = 0xFF,
98+ },
99+
100+ /* Interface 2 */
101+ .data_class_interface = {
102+ .bLength =
103+ sizeof(struct usb_interface_descriptor),
104+ .bDescriptorType = USB_DT_INTERFACE,
105+ .bInterfaceNumber = 0x01,
106+ .bAlternateSetting = 0x00,
107+ .bNumEndpoints = 0x02,
108+ .bInterfaceClass =
109+ COMMUNICATIONS_INTERFACE_CLASS_DATA,
110+ .bInterfaceSubClass = DATA_INTERFACE_SUBCLASS_NONE,
111+ .bInterfaceProtocol = DATA_INTERFACE_PROTOCOL_NONE,
112+ .iInterface = STR_DATA_INTERFACE,
113+ },
114+ .data_endpoints = {
115+ {
116+ .bLength =
117+ sizeof(struct usb_endpoint_descriptor),
118+ .bDescriptorType = USB_DT_ENDPOINT,
119+ .bEndpointAddress = 0x02 | USB_DIR_OUT,
120+ .bmAttributes =
121+ USB_ENDPOINT_XFER_BULK,
122+ .wMaxPacketSize =
123+ cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE),
124+ .bInterval = 0xFF,
125+ },
126+ {
127+ .bLength =
128+ sizeof(struct usb_endpoint_descriptor),
129+ .bDescriptorType = USB_DT_ENDPOINT,
130+ .bEndpointAddress = 0x03 | USB_DIR_IN,
131+ .bmAttributes =
132+ USB_ENDPOINT_XFER_BULK,
133+ .wMaxPacketSize =
134+ cpu_to_le16(CONFIG_USBD_SERIAL_BULK_PKTSIZE),
135+ .bInterval = 0xFF,
136+ },
137+ },
138+ /* We don't add the DFU functional descriptor here since we only
139+ * want to do DFU in the high-current charging mode for safety reasons */
140+ },
141+
142 };
143
144 static struct rs232_emu rs232_desc={
145@@ -330,8 +443,7 @@
146 .bNumInterfaces = NUM_GSERIAL_INTERFACES,
147 .bConfigurationValue = 1,
148 .iConfiguration = STR_CONFIG,
149- .bmAttributes =
150- BMATTRIBUTE_SELF_POWERED|BMATTRIBUTE_RESERVED,
151+ .bmAttributes = BMATTRIBUTE_RESERVED,
152 .bMaxPower = USBTTY_MAXPOWER
153 },
154 .interface_desc = {
155@@ -384,6 +496,68 @@
156 },
157 },
158 },
159+ {
160+ .configuration_desc ={
161+ .bLength = sizeof(struct usb_configuration_descriptor),
162+ .bDescriptorType = USB_DT_CONFIG,
163+ .wTotalLength =
164+ cpu_to_le16(sizeof(struct gserial_config_desc)),
165+ .bNumInterfaces = NUM_GSERIAL_INTERFACES,
166+ .bConfigurationValue = 1,
167+ .iConfiguration = STR_CONFIG,
168+ .bmAttributes = BMATTRIBUTE_RESERVED,
169+ .bMaxPower = 50
170+ },
171+ .interface_desc = {
172+ {
173+ .bLength =
174+ sizeof(struct usb_interface_descriptor),
175+ .bDescriptorType = USB_DT_INTERFACE,
176+ .bInterfaceNumber = 0,
177+ .bAlternateSetting = 0,
178+ .bNumEndpoints = NUM_ENDPOINTS,
179+ .bInterfaceClass =
180+ COMMUNICATIONS_INTERFACE_CLASS_VENDOR,
181+ .bInterfaceSubClass =
182+ COMMUNICATIONS_NO_SUBCLASS,
183+ .bInterfaceProtocol =
184+ COMMUNICATIONS_NO_PROTOCOL,
185+ .iInterface = STR_DATA_INTERFACE
186+ },
187+ },
188+ .data_endpoints = {
189+ {
190+ .bLength =
191+ sizeof(struct usb_endpoint_descriptor),
192+ .bDescriptorType = USB_DT_ENDPOINT,
193+ .bEndpointAddress = 0x01 | USB_DIR_OUT,
194+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
195+ .wMaxPacketSize =
196+ cpu_to_le16(CONFIG_USBD_SERIAL_OUT_PKTSIZE),
197+ .bInterval= 0xFF,
198+ },
199+ {
200+ .bLength =
201+ sizeof(struct usb_endpoint_descriptor),
202+ .bDescriptorType = USB_DT_ENDPOINT,
203+ .bEndpointAddress = 0x02 | USB_DIR_IN,
204+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
205+ .wMaxPacketSize =
206+ cpu_to_le16(CONFIG_USBD_SERIAL_IN_PKTSIZE),
207+ .bInterval = 0xFF,
208+ },
209+ {
210+ .bLength =
211+ sizeof(struct usb_endpoint_descriptor),
212+ .bDescriptorType = USB_DT_ENDPOINT,
213+ .bEndpointAddress = 0x03 | USB_DIR_IN,
214+ .bmAttributes = USB_ENDPOINT_XFER_INT,
215+ .wMaxPacketSize =
216+ cpu_to_le16(CONFIG_USBD_SERIAL_INT_PKTSIZE),
217+ .bInterval = 0xFF,
218+ },
219+ },
220+ },
221 };
222
223 /*
224@@ -679,12 +853,14 @@
225 bus_instance->maxpacketsize = 64;
226 bus_instance->serial_number_str = serial_number;
227
228- /* configuration instance */
229- memset (config_instance, 0,
230- sizeof (struct usb_configuration_instance));
231- config_instance->interfaces = interface_count;
232- config_instance->configuration_descriptor = configuration_descriptor;
233- config_instance->interface_instance_array = interface_instance;
234+ /* configuration instances */
235+ for (i = 0; i < NUM_CONFIGS; i++) {
236+ memset(&config_instance[i], 0, sizeof(config_instance));
237+ config_instance[i].interfaces = interface_count;
238+ /* FIXME: this breaks for the non-ACM case */
239+ config_instance[i].configuration_descriptor = &acm_configuration_descriptors[i];
240+ config_instance[i].interface_instance_array = interface_instance;
241+ }
242
243 /* interface instance */
244 memset (interface_instance, 0,
245@@ -1043,9 +1219,17 @@
246 usbtty_configured_flag = 0;
247 break;
248 case DEVICE_CONFIGURED:
249+ printf("DEVICE_CONFIGURED: %u\n", device->configuration);
250+ if (device->configuration == 1)
251+ udc_ctrl(UDC_CTRL_500mA_ENABLE, 1);
252+ else
253+ udc_ctrl(UDC_CTRL_500mA_ENABLE, 0);
254 usbtty_configured_flag = 1;
255 break;
256-
257+ case DEVICE_DE_CONFIGURED:
258+ printf("DEVICE_DE_CONFIGURED\n");
259+ udc_ctrl(UDC_CTRL_500mA_ENABLE, 0);
260+ break;
261 case DEVICE_ADDRESS_ASSIGNED:
262 usbtty_init_endpoints ();
263
264Index: u-boot/drivers/usbtty.h
265===================================================================
266--- u-boot.orig/drivers/usbtty.h
267+++ u-boot/drivers/usbtty.h
268@@ -60,7 +60,7 @@
269 #define USBTTY_DEVICE_CLASS COMMUNICATIONS_DEVICE_CLASS
270
271 #define USBTTY_BCD_DEVICE 0x00
272-#define USBTTY_MAXPOWER 0x00
273+#define USBTTY_MAXPOWER 250 /* 500mA */
274
275 #define STR_LANG 0x00
276 #define STR_MANUFACTURER 0x01
277Index: u-boot/board/neo1973/common/udc.c
278===================================================================
279--- u-boot.orig/board/neo1973/common/udc.c
280+++ u-boot/board/neo1973/common/udc.c
281@@ -2,6 +2,7 @@
282 #include <common.h>
283 #include <usbdcore.h>
284 #include <s3c2410.h>
285+#include <pcf50606.h>
286
287 void udc_ctrl(enum usbd_event event, int param)
288 {
289@@ -17,6 +18,13 @@
290 gpio->GPBDAT &= ~(1 << 9);
291 #endif
292 break;
293+ case UDC_CTRL_500mA_ENABLE:
294+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4) || \
295+ defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3) || \
296+ defined(CONFIG_ARCH_GTA01B_v4)
297+ pcf50606_charge_autofast(param);
298+#endif
299+ break;
300 default:
301 break;
302 }
303Index: u-boot/include/usbdcore.h
304===================================================================
305--- u-boot.orig/include/usbdcore.h
306+++ u-boot/include/usbdcore.h
307@@ -686,8 +686,8 @@
308
309 enum usbd_event {
310 UDC_CTRL_PULLUP_ENABLE,
311+ UDC_CTRL_500mA_ENABLE,
312 };
313
314 void udc_ctrl(enum usbd_event event, int param);
315 #endif
316-#endif