Advertisement
Guest User

Untitled

a guest
Dec 13th, 2010
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.70 KB | None | 0 0
  1. diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
  2. index b9505aa..946f302 100644
  3. --- a/arch/arm/kernel/head-common.S
  4. +++ b/arch/arm/kernel/head-common.S
  5. @@ -215,12 +215,14 @@ __lookup_machine_type:
  6. add r5, r5, r3 @ convert virt addresses to
  7. add r6, r6, r3 @ physical address space
  8. 1: ldr r3, [r5, #MACHINFO_TYPE] @ get machine type
  9. +/*
  10. teq r3, r1 @ matches loader number?
  11. beq 2f @ found
  12. add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc
  13. cmp r5, r6
  14. blo 1b
  15. mov r5, #0 @ unknown machine
  16. +*/
  17. 2: mov pc, lr
  18. ENDPROC(__lookup_machine_type)
  19.  
  20. diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
  21. index d49e6e6..a5b9197 100755
  22. --- a/arch/arm/mach-omap2/board-zoom-peripherals.c
  23. +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
  24. @@ -526,7 +526,7 @@ static int __init omap_i2c_init(void)
  25. prog_io |= OMAP3630_PRG_SR_PULLUPRESX;
  26. omap_ctrl_writel(prog_io, OMAP36XX_CONTROL_PROG_IO_WKUP1);
  27. }
  28. - omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo,
  29. + omap_register_i2c_bus(1, 100, zoom_i2c_boardinfo,
  30. ARRAY_SIZE(zoom_i2c_boardinfo));
  31. omap_register_i2c_bus(2, 100, zoom_i2c_boardinfo2,
  32. ARRAY_SIZE(zoom_i2c_boardinfo2));
  33. @@ -585,13 +585,13 @@ void __init zoom_peripherals_init(void * peripheral_data)
  34.  
  35. use_generic_twl4030_script(&zoom_t2scripts_data , omap3_setuptime);
  36. omap_i2c_init();
  37. - synaptics_dev_init();
  38. - wlan_1273_reset();
  39. - omap_serial_init();
  40. + //synaptics_dev_init();
  41. + //wlan_1273_reset();
  42. + //omap_serial_init();
  43. usb_musb_init();
  44. - enable_board_wakeup_source();
  45. - platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
  46. - omap_voltage_init_vc((struct prm_setup_vc *) peripheral_data);
  47. - zoom_cam_init();
  48. - omap_voltage_init_vc(omap3_setuptime);
  49. + //enable_board_wakeup_source();
  50. + //platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
  51. + //omap_voltage_init_vc((struct prm_setup_vc *) peripheral_data);
  52. + //zoom_cam_init();
  53. + //omap_voltage_init_vc(omap3_setuptime);
  54. }
  55. diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
  56. index 063dd1a..26c0aa6 100644
  57. --- a/arch/arm/mach-omap2/board-zoom2.c
  58. +++ b/arch/arm/mach-omap2/board-zoom2.c
  59. @@ -154,9 +154,9 @@ static void __init omap_zoom2_init(void)
  60. {
  61. omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
  62. zoom_peripherals_init(&omap3_setuptime_table);
  63. - zoom_flash_init(zoom_flash_partitions, ZOOM_NAND_CS);
  64. - zoom_debugboard_init();
  65. - zoom_display_init(OMAP_DSS_VENC_TYPE_COMPOSITE);
  66. + //zoom_flash_init(zoom_flash_partitions, ZOOM_NAND_CS);
  67. + //zoom_debugboard_init();
  68. + //zoom_display_init(OMAP_DSS_VENC_TYPE_COMPOSITE);
  69. }
  70.  
  71. static void __init omap_zoom2_map_io(void)
  72. diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
  73. index d5cee44..9c967d9 100644
  74. --- a/arch/arm/mach-omap2/board-zoom3.c
  75. +++ b/arch/arm/mach-omap2/board-zoom3.c
  76. @@ -131,9 +131,9 @@ static void __init omap_zoom_init(void)
  77. {
  78. omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
  79. zoom_peripherals_init(&omap3_setuptime_table);
  80. - zoom_flash_init(zoom_flash_partitions, ZOOM_NAND_CS);
  81. - zoom_debugboard_init();
  82. - zoom_display_init(OMAP_DSS_VENC_TYPE_COMPOSITE);
  83. + //zoom_flash_init(zoom_flash_partitions, ZOOM_NAND_CS);
  84. + //zoom_debugboard_init();
  85. + //zoom_display_init(OMAP_DSS_VENC_TYPE_COMPOSITE);
  86. }
  87.  
  88. MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
  89. diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
  90. index 76ccc9c..7f26b16 100644
  91. --- a/arch/arm/mach-omap2/devices.c
  92. +++ b/arch/arm/mach-omap2/devices.c
  93. @@ -1037,9 +1037,11 @@ static inline void omap_hdq_init(void)
  94. static inline void omap_hdq_init(void) {}
  95. #endif
  96.  
  97. +#ifdef CONFIG_PM
  98. struct sgx_platform_data omap_sgx_data = {
  99. .set_min_bus_tput = omap_pm_set_min_bus_tput,
  100. };
  101. +#endif
  102.  
  103. static struct platform_device powervr_device = {
  104. .name = "pvrsrvkm",
  105. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
  106. index ee41120..1f23411 100644
  107. --- a/drivers/usb/gadget/Kconfig
  108. +++ b/drivers/usb/gadget/Kconfig
  109. @@ -861,4 +861,16 @@ config USB_G_MULTI_CDC
  110.  
  111. endchoice
  112.  
  113. +config USB_G_SERIAL_CONSOLE
  114. + tristate "Serial Gadget Console Support"
  115. + depends on USB_G_SERIAL || USB_CDC_COMPOSITE
  116. + help
  117. + Support for console on ttyGS devices. Note this is not an
  118. + "early console" and since the USB system takes a while to
  119. + come up, this is generally not going to help debug early
  120. + boot oopses. However, early messages will be dumped to
  121. + the console if the kernel manages to stay up long enough
  122. + for the console to instantiate.
  123. +
  124. +
  125. endif # USB_GADGET
  126. diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
  127. index adf8260..d08c7e4 100644
  128. --- a/drivers/usb/gadget/u_serial.c
  129. +++ b/drivers/usb/gadget/u_serial.c
  130. @@ -5,6 +5,8 @@
  131. * Copyright (C) 2008 David Brownell
  132. * Copyright (C) 2008 by Nokia Corporation
  133. *
  134. + * Console support Copyright (C) 2010 Brian S. Julin (bri at abrij.org)
  135. + *
  136. * This code also borrows from usbserial.c, which is
  137. * Copyright (C) 1999 - 2002 Greg Kroah-Hartman (greg@kroah.com)
  138. * Copyright (C) 2000 Peter Berger (pberger@brimson.com)
  139. @@ -24,6 +26,8 @@
  140. #include <linux/tty.h>
  141. #include <linux/tty_flip.h>
  142.  
  143. +#include <linux/console.h>
  144. +
  145. #include "u_serial.h"
  146.  
  147.  
  148. @@ -92,7 +96,11 @@ struct gs_buf {
  149. */
  150. struct gs_port {
  151. spinlock_t port_lock; /* guard port_* access */
  152. +#ifdef CONFIG_USB_G_SERIAL_CONSOLE
  153. + int stole_lock; /* for console oopses */
  154.  
  155. + struct console port_console;
  156. +#endif
  157. struct gserial *port_usb;
  158. struct tty_struct *port_tty;
  159.  
  160. @@ -389,7 +397,7 @@ __acquires(&port->port_lock)
  161. spin_lock(&port->port_lock);
  162.  
  163. if (status) {
  164. - pr_debug("%s: %s %s err %d\n",
  165. + pr_vdebug("%s: %s %s err %d\n",
  166. __func__, "queue", in->name, status);
  167. list_add(&req->list, pool);
  168. break;
  169. @@ -440,7 +448,7 @@ __acquires(&port->port_lock)
  170. spin_lock(&port->port_lock);
  171.  
  172. if (status) {
  173. - pr_debug("%s: %s %s err %d\n",
  174. + pr_vdebug("%s: %s %s err %d\n",
  175. __func__, "queue", out->name, status);
  176. list_add(&req->list, pool);
  177. break;
  178. @@ -681,12 +689,14 @@ static int gs_start_io(struct gs_port *port)
  179. started = gs_start_rx(port);
  180.  
  181. /* unblock any pending writes into our circular buffer */
  182. - if (started) {
  183. - tty_wakeup(port->port_tty);
  184. - } else {
  185. - gs_free_requests(ep, head);
  186. - gs_free_requests(port->port_usb->in, &port->write_pool);
  187. - status = -EIO;
  188. + if (port->port_tty) {
  189. + if (started) {
  190. + tty_wakeup(port->port_tty);
  191. + } else {
  192. + gs_free_requests(ep, head);
  193. + gs_free_requests(port->port_usb->in, &port->write_pool);
  194. + status = -EIO;
  195. + }
  196. }
  197.  
  198. return status;
  199. @@ -764,7 +774,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
  200. spin_lock_irq(&port->port_lock);
  201.  
  202. if (status) {
  203. - pr_debug("gs_open: ttyGS%d (%p,%p) no buffer\n",
  204. + pr_vdebug("gs_open: ttyGS%d (%p,%p) no buffer\n",
  205. port->port_num, tty, file);
  206. port->openclose = false;
  207. goto exit_unlock_port;
  208. @@ -792,14 +802,14 @@ static int gs_open(struct tty_struct *tty, struct file *file)
  209. if (port->port_usb) {
  210. struct gserial *gser = port->port_usb;
  211.  
  212. - pr_debug("gs_open: start ttyGS%d\n", port->port_num);
  213. + pr_vdebug("gs_open: start ttyGS%d\n", port->port_num);
  214. gs_start_io(port);
  215.  
  216. if (gser->connect)
  217. gser->connect(gser);
  218. }
  219.  
  220. - pr_debug("gs_open: ttyGS%d (%p,%p)\n", port->port_num, tty, file);
  221. + pr_vdebug("gs_open: ttyGS%d (%p,%p)\n", port->port_num, tty, file);
  222.  
  223. status = 0;
  224.  
  225. @@ -835,7 +845,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
  226. goto exit;
  227. }
  228.  
  229. - pr_debug("gs_close: ttyGS%d (%p,%p) ...\n", port->port_num, tty, file);
  230. + pr_vdebug("gs_close: ttyGS%d (%p,%p) ...\n", port->port_num, tty, file);
  231.  
  232. /* mark port as closing but in use; we can drop port lock
  233. * and sleep if necessary
  234. @@ -873,7 +883,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
  235.  
  236. port->openclose = false;
  237.  
  238. - pr_debug("gs_close: ttyGS%d (%p,%p) done!\n",
  239. + pr_vdebug("gs_close: ttyGS%d (%p,%p) done!\n",
  240. port->port_num, tty, file);
  241.  
  242. wake_up_interruptible(&port->close_wait);
  243. @@ -901,6 +911,88 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
  244. return count;
  245. }
  246.  
  247. +#ifdef CONFIG_USB_G_SERIAL_CONSOLE
  248. +/* This stolen/adapted from serial/sn_console.c */
  249. +static void gs_console_write(struct console *cons, const char *buf, unsigned count)
  250. +{
  251. + unsigned long flags = 0;
  252. + unsigned status;
  253. + struct gs_port *port;
  254. +
  255. + port = cons->data;
  256. +
  257. + /* Just chuck everything if USB side is not up. */
  258. + if (!port->port_usb) return;
  259. +
  260. + /* somebody really wants this output, might be an
  261. + * oops, kdb, panic, etc. make sure they get it. */
  262. + if (spin_is_locked(&port->port_lock)) {
  263. + char *get = port->port_write_buf.buf_get;
  264. + char *put = port->port_write_buf.buf_put;
  265. + int got_lock = 0;
  266. + int counter;
  267. +
  268. + /*
  269. + * We attempt to determine if someone has died with the
  270. + * lock. We wait ~20 secs after the head and tail ptrs
  271. + * stop moving and assume the lock holder is not functional
  272. + * and plow ahead. If the lock is freed within the time out
  273. + * period we re-get the lock and go ahead normally. We also
  274. + * remember if we have plowed ahead so that we don't have
  275. + * to wait out the time out period again - the asumption
  276. + * is that we will time out again.
  277. + */
  278. + for (counter = 0; counter < 150; mdelay(125), counter++) {
  279. + if (!spin_is_locked(&port->port_lock) || port->stole_lock) {
  280. + if (!port->stole_lock)
  281. + break;
  282. + spin_lock_irqsave(&port->port_lock, flags);
  283. + got_lock = 1;
  284. + break;
  285. + }
  286. + /* still locked */
  287. + if ((get != port->port_write_buf.buf_get)
  288. + || (put != port->port_write_buf.buf_put)) {
  289. + put = port->port_write_buf.buf_put;
  290. + get = port->port_write_buf.buf_get;
  291. + counter = 0;
  292. + }
  293. + }
  294. + /* Make space by flushing any waiting output */
  295. + if (port->port_usb)
  296. + gs_start_tx(port);
  297. + while (count) {
  298. + count -= gs_buf_put(&port->port_write_buf, buf, count);
  299. + if (port->port_usb) break;
  300. + /* Flush our stuff immediately */
  301. + if (!gs_start_tx(port))
  302. + mdelay(125);
  303. + }
  304. + if (got_lock) {
  305. + spin_unlock_irqrestore(&port->port_lock, flags);
  306. + port->stole_lock = 0;
  307. + } else {
  308. + /* fell thru */
  309. + port->stole_lock = 1;
  310. + }
  311. + return;
  312. + }
  313. + port->stole_lock = 0;
  314. + spin_lock_irqsave(&port->port_lock, flags);
  315. + /* Flush out any waiting output so we have as much space as possible */
  316. + if (port->port_usb)
  317. + status = gs_start_tx(port);
  318. + while (count) {
  319. + count -= gs_buf_put(&port->port_write_buf, buf, count);
  320. + if (port->port_usb) break;
  321. + /* Flush our stuff immediately */
  322. + if (!gs_start_tx(port))
  323. + mdelay(125);
  324. + }
  325. + spin_unlock_irqrestore(&port->port_lock, flags);
  326. +}
  327. +#endif
  328. +
  329. static int gs_put_char(struct tty_struct *tty, unsigned char ch)
  330. {
  331. struct gs_port *port = tty->driver_data;
  332. @@ -1015,6 +1107,47 @@ static const struct tty_operations gs_tty_ops = {
  333.  
  334. static struct tty_driver *gs_tty_driver;
  335.  
  336. +#ifdef CONFIG_USB_G_SERIAL_CONSOLE
  337. +struct tty_driver *gs_console_device(struct console *cons, int *gidx)
  338. +{
  339. + struct gs_port *port;
  340. + port = container_of(cons, struct gs_port, port_console);
  341. + if (gidx)
  342. + *gidx = port->port_num;
  343. + return gs_tty_driver;
  344. +}
  345. +
  346. +static int gs_console_setup (struct console *cons, char *options)
  347. +{
  348. + struct gs_port *port;
  349. + int status = 0;
  350. +
  351. + /*
  352. + * If this is called we are about to become the active console. (?)
  353. + *
  354. + * That is not what this hook is for, but it serves our purposes.
  355. + *
  356. + * Since there is no actual tty yet, we have to do some of what is
  357. + * normally done in gs_open.
  358. + */
  359. + port = container_of(cons, struct gs_port, port_console);
  360. + if (port->port_write_buf.buf_buf == NULL) {
  361. + status = gs_buf_alloc(&port->port_write_buf, WRITE_BUF_SIZE);
  362. + }
  363. +
  364. + /* Start the I/O stream */
  365. + if (port->port_usb) {
  366. + struct gserial *gser = port->port_usb;
  367. +
  368. + gs_start_io(port);
  369. +
  370. + if (gser->connect)
  371. + gser->connect(gser);
  372. + }
  373. + return status;
  374. +}
  375. +#endif
  376. +
  377. static int __init
  378. gs_port_alloc(unsigned port_num, struct usb_cdc_line_coding *coding)
  379. {
  380. @@ -1129,10 +1262,25 @@ int __init gserial_setup(struct usb_gadget *g, unsigned count)
  381. __func__, i, PTR_ERR(tty_dev));
  382. }
  383.  
  384. - pr_debug("%s: registered %d ttyGS* device%s\n", __func__,
  385. + pr_vdebug("%s: registered %d ttyGS* device%s\n", __func__,
  386. count, (count == 1) ? "" : "s");
  387.  
  388. return status;
  389. +#ifdef CONFIG_USB_G_SERIAL_CONSOLE
  390. + for (i = 0; i < count; i++) {
  391. + struct gs_port *p;
  392. +
  393. + p = ports[i].port;
  394. + strcpy(p->port_console.name, PREFIX);
  395. + p->port_console.write = gs_console_write;
  396. + p->port_console.device = gs_console_device;
  397. + p->port_console.setup = gs_console_setup;
  398. + p->port_console.flags = CON_PRINTBUFFER | CON_ENABLED;
  399. + p->port_console.index = p->port_num;
  400. + p->port_console.data = p;
  401. + register_console(&p->port_console);
  402. + }
  403. +#endif
  404. fail:
  405. while (count--)
  406. kfree(ports[count].port);
  407. @@ -1179,6 +1327,10 @@ void gserial_cleanup(void)
  408. /* prevent new opens */
  409. mutex_lock(&ports[i].lock);
  410. port = ports[i].port;
  411. +
  412. +#ifdef CONFIG_USB_G_SERIAL_CONSOLE
  413. + unregister_console(&port->port_console);
  414. +#endif
  415. ports[i].port = NULL;
  416. mutex_unlock(&ports[i].lock);
  417.  
  418. @@ -1196,7 +1348,7 @@ void gserial_cleanup(void)
  419. tty_unregister_driver(gs_tty_driver);
  420. gs_tty_driver = NULL;
  421.  
  422. - pr_debug("%s: cleaned up ttyGS* support\n", __func__);
  423. + pr_vdebug("%s: cleaned up ttyGS* support\n", __func__);
  424. }
  425.  
  426. /**
  427. @@ -1259,7 +1411,7 @@ int gserial_connect(struct gserial *gser, u8 port_num)
  428. * protocol about open/close status (connect/disconnect).
  429. */
  430. if (port->open_count) {
  431. - pr_debug("gserial_connect: start ttyGS%d\n", port->port_num);
  432. + pr_vdebug("gserial_connect: start ttyGS%d\n", port->port_num);
  433. gs_start_io(port);
  434. if (gser->connect)
  435. gser->connect(gser);
  436. @@ -1269,7 +1421,6 @@ int gserial_connect(struct gserial *gser, u8 port_num)
  437. }
  438.  
  439. spin_unlock_irqrestore(&port->port_lock, flags);
  440. -
  441. return status;
  442.  
  443. fail_out:
  444. @@ -1312,6 +1463,7 @@ void gserial_disconnect(struct gserial *gser)
  445. }
  446. spin_unlock_irqrestore(&port->port_lock, flags);
  447.  
  448. +
  449. /* disable endpoints, aborting down any active I/O */
  450. usb_ep_disable(gser->out);
  451. gser->out->driver_data = NULL;
  452. diff --git a/kernel/panic.c b/kernel/panic.c
  453. index 96b45d0..cf4f616 100644
  454. --- a/kernel/panic.c
  455. +++ b/kernel/panic.c
  456. @@ -29,7 +29,7 @@ static int pause_on_oops;
  457. static int pause_on_oops_flag;
  458. static DEFINE_SPINLOCK(pause_on_oops_lock);
  459.  
  460. -int panic_timeout;
  461. +int panic_timeout=10;
  462.  
  463. ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
  464.  
  465. @@ -100,9 +100,11 @@ NORET_TYPE void panic(const char * fmt, ...)
  466. * Delay timeout seconds before rebooting the machine.
  467. * We can't use the "normal" timers since we just panicked.
  468. */
  469. - printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);
  470.  
  471. for (i = 0; i < panic_timeout*1000; ) {
  472. + printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
  473. + printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);
  474. +
  475. touch_nmi_watchdog();
  476. i += panic_blink(i);
  477. mdelay(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement