ar71xx: add 2.6.39 support
[openwrt/svn-archive/archive.git] / target / linux / ubicom32 / patches-2.6.30 / 100-ubicom32_support.patch
1 --- a/drivers/char/hw_random/Kconfig
2 +++ b/drivers/char/hw_random/Kconfig
3 @@ -148,3 +148,16 @@ config HW_RANDOM_VIRTIO
4
5 To compile this driver as a module, choose M here: the
6 module will be called virtio-rng. If unsure, say N.
7 +
8 +config HW_RANDOM_UBICOM32
9 + tristate "Ubicom32 HW Random Number Generator support"
10 + depends on HW_RANDOM && UBICOM32
11 + default HW_RANDOM
12 + ---help---
13 + This driver provides kernel-side support for the Random Number
14 + Generator hardware found on Ubicom32 processors.
15 +
16 + To compile this driver as a module, choose M here: the
17 + module will be called pasemi-rng.
18 +
19 + If unsure, say Y.
20 --- a/drivers/char/hw_random/Makefile
21 +++ b/drivers/char/hw_random/Makefile
22 @@ -15,3 +15,4 @@ obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx
23 obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o
24 obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o
25 obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
26 +obj-$(CONFIG_HW_RANDOM_UBICOM32) += ubicom32-rng.o
27 --- a/drivers/crypto/Kconfig
28 +++ b/drivers/crypto/Kconfig
29 @@ -61,6 +61,40 @@ config CRYPTO_DEV_GEODE
30 To compile this driver as a module, choose M here: the module
31 will be called geode-aes.
32
33 +config CRYPTO_UBICOM32
34 + bool "Ubicom32 Security Module"
35 + depends on UBICOM32
36 + help
37 + This is the ubicom32 hardware acceleration common code.
38 +
39 +config CRYPTO_AES_UBICOM32
40 + tristate "Ubicom32 AES implementation"
41 + depends on CRYPTO_UBICOM32
42 + select CRYPTO_ALGAPI
43 + help
44 + This is the ubicom32 hardware AES implementation.
45 +
46 +config CRYPTO_DES_UBICOM32
47 + tristate "Ubicom32 DES implementation"
48 + depends on CRYPTO_UBICOM32
49 + select CRYPTO_ALGAPI
50 + help
51 + This is the ubicom32 hardware DES and 3DES implementation.
52 +
53 +config CRYPTO_SHA1_UBICOM32
54 + tristate "Ubicom32 SHA1 implementation"
55 + depends on CRYPTO_UBICOM32
56 + select CRYPTO_ALGAPI
57 + help
58 + This is the ubicom32 hardware SHA1 implementation.
59 +
60 +config CRYPTO_MD5_UBICOM32
61 + tristate "Ubicom32 MD5 implementation"
62 + depends on CRYPTO_UBICOM32
63 + select CRYPTO_ALGAPI
64 + help
65 + This is the ubicom32 hardware MD5 implementation.
66 +
67 config ZCRYPT
68 tristate "Support for PCI-attached cryptographic adapters"
69 depends on S390
70 --- a/drivers/mmc/host/Kconfig
71 +++ b/drivers/mmc/host/Kconfig
72 @@ -266,3 +266,10 @@ config GPIOMMC_CONFIGFS
73 help
74 This option automatically enables configfs support for gpiommc
75 if configfs is available.
76 +
77 +config MMC_UBICOM32
78 + tristate "Ubicom32 MMC/SD host controller"
79 + depends on UBICOM32
80 + help
81 + This provides support for the SD/MMC hardware found on Ubicom32
82 + IP7K processors
83 --- a/drivers/mmc/host/Makefile
84 +++ b/drivers/mmc/host/Makefile
85 @@ -30,4 +30,5 @@ obj-$(CONFIG_MMC_S3C) += s3cmci.o
86 obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o
87 obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o
88 obj-$(CONFIG_GPIOMMC) += gpiommc.o
89 +obj-$(CONFIG_MMC_UBICOM32) += ubicom32sd.o
90
91 --- a/drivers/mtd/devices/Kconfig
92 +++ b/drivers/mtd/devices/Kconfig
93 @@ -104,6 +104,31 @@ config M25PXX_USE_FAST_READ
94 help
95 This option enables FAST_READ access supported by ST M25Pxx.
96
97 +config MTD_UBI32_NAND_SPI_ER
98 + tristate "UBI32_NAND SPI-ER support"
99 + help
100 + This driver supports the Micron MT29F1G01 SPI-ER NAND flash chip
101 + using the built in flash controller on the Ubicom32 architecture.
102 + Partial page writes are not supported by this driver.
103 +
104 +config MTD_NAND_SPI_ER
105 + tristate "NAND SPI-ER support"
106 + help
107 + This driver supports the Micron MT29F1G01 SPI-ER NAND flash chip
108 + using a generic SPI bus. Partial page writes are supported
109 + by this driver.
110 +
111 +config MTD_UBI32_M25P80
112 + tristate "Ubicom processor support for most SPI Flash chips (AT26DF, M25P, W25X, ...)"
113 + depends on UBICOM32
114 + default y
115 + help
116 + This enables access to most modern SPI flash chips, used for
117 + program and data storage. Series supported include Atmel AT26DF,
118 + Spansion S25SL, SST 25VF, ST M25P, and Winbond W25X. Other chips
119 + are supported as well. See the driver source for the current list,
120 + or to add other chips.
121 +
122 config MTD_SLRAM
123 tristate "Uncached system RAM"
124 help
125 --- a/drivers/mtd/devices/Makefile
126 +++ b/drivers/mtd/devices/Makefile
127 @@ -16,3 +16,6 @@ obj-$(CONFIG_MTD_LART) += lart.o
128 obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
129 obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
130 obj-$(CONFIG_MTD_M25P80) += m25p80.o
131 +obj-$(CONFIG_MTD_UBI32_M25P80) += ubi32-m25p80.o
132 +obj-$(CONFIG_MTD_NAND_SPI_ER) += nand-spi-er.o
133 +obj-$(CONFIG_MTD_UBI32_NAND_SPI_ER) += ubi32-nand-spi-er.o
134 --- a/drivers/net/Kconfig
135 +++ b/drivers/net/Kconfig
136 @@ -2540,6 +2540,19 @@ config JME
137 To compile this driver as a module, choose M here. The module
138 will be called jme.
139
140 +config UBICOM32_GMAC
141 + tristate "Ubicom Gigabit Ethernet support"
142 + depends on UBICOM32
143 + help
144 + Gigabit Ethernet support for ubicom32 processors
145 +
146 +config UBICOM32_OCM_FOR_SKB
147 + bool "USE OCM for SKB (EXPERIMENTAL)"
148 + depends on UBICOM32_GMAC
149 + default n
150 + help
151 + Allocate skb from OCM for Ethernet Receive when possible
152 +
153 endif # NETDEV_1000
154
155 #
156 --- a/drivers/net/Makefile
157 +++ b/drivers/net/Makefile
158 @@ -272,3 +272,5 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
159 obj-$(CONFIG_SFC) += sfc/
160
161 obj-$(CONFIG_WIMAX) += wimax/
162 +
163 +obj-$(CONFIG_UBICOM32_GMAC) += ubi32-eth.o
164 --- a/drivers/net/usb/asix.c
165 +++ b/drivers/net/usb/asix.c
166 @@ -319,14 +319,33 @@ static int asix_rx_fixup(struct usbnet *
167 /* get the packet length */
168 size = (u16) (header & 0x0000ffff);
169
170 - if ((skb->len) - ((size + 1) & 0xfffe) == 0)
171 + if ((skb->len) - ((size + 1) & 0xfffe) == 0) {
172 +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
173 + if (((u32)packet & 0x02) == 0) {
174 + memmove(packet - 2, packet, size);
175 + skb->data -= 2;
176 + skb->tail -= 2;
177 + }
178 +#endif
179 return 2;
180 + }
181 +
182 if (size > ETH_FRAME_LEN) {
183 deverr(dev,"asix_rx_fixup() Bad RX Length %d", size);
184 return 0;
185 }
186 ax_skb = skb_clone(skb, GFP_ATOMIC);
187 if (ax_skb) {
188 +#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
189 + if (((u32)packet & 0x02) == 0) {
190 + memmove(packet - 2, packet, size);
191 + ax_skb->data = packet - 2;
192 + } else {
193 + ax_skb->data = packet;
194 + }
195 +#else
196 + ax_skb->data = packet;
197 +#endif
198 ax_skb->len = size;
199 ax_skb->data = packet;
200 skb_set_tail_pointer(ax_skb, size);
201 @@ -1125,13 +1144,19 @@ static int ax88178_link_reset(struct usb
202 mode = AX88178_MEDIUM_DEFAULT;
203
204 if (ecmd.speed == SPEED_1000)
205 +#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS
206 mode |= AX_MEDIUM_GM;
207 +#else
208 + mode |= AX_MEDIUM_GM | AX_MEDIUM_ENCK;
209 +#endif
210 else if (ecmd.speed == SPEED_100)
211 mode |= AX_MEDIUM_PS;
212 else
213 mode &= ~(AX_MEDIUM_PS | AX_MEDIUM_GM);
214
215 +#ifdef HAVE_EFFICIENT_UNALIGNED_ACCESS
216 mode |= AX_MEDIUM_ENCK;
217 +#endif
218
219 if (ecmd.duplex == DUPLEX_FULL)
220 mode |= AX_MEDIUM_FD;
221 --- a/drivers/oprofile/cpu_buffer.c
222 +++ b/drivers/oprofile/cpu_buffer.c
223 @@ -328,10 +328,10 @@ static inline void oprofile_end_trace(st
224 }
225
226 static inline void
227 -__oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
228 - unsigned long event, int is_kernel)
229 +__oprofile_add_ext_sample_cpu(unsigned long pc, struct pt_regs * const regs,
230 + unsigned long event, int is_kernel, int cpu)
231 {
232 - struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(cpu_buffer);
233 + struct oprofile_cpu_buffer *cpu_buf = &per_cpu(cpu_buffer, cpu);
234 unsigned long backtrace = oprofile_backtrace_depth;
235
236 /*
237 @@ -353,7 +353,8 @@ __oprofile_add_ext_sample(unsigned long
238 void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
239 unsigned long event, int is_kernel)
240 {
241 - __oprofile_add_ext_sample(pc, regs, event, is_kernel);
242 + __oprofile_add_ext_sample_cpu(pc, regs, event,
243 + is_kernel, smp_processor_id());
244 }
245
246 void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
247 @@ -361,7 +362,8 @@ void oprofile_add_sample(struct pt_regs
248 int is_kernel = !user_mode(regs);
249 unsigned long pc = profile_pc(regs);
250
251 - __oprofile_add_ext_sample(pc, regs, event, is_kernel);
252 + __oprofile_add_ext_sample_cpu(pc, regs, event,
253 + is_kernel, smp_processor_id());
254 }
255
256 /*
257 --- a/drivers/pci/Makefile
258 +++ b/drivers/pci/Makefile
259 @@ -44,8 +44,8 @@ obj-$(CONFIG_PPC) += setup-bus.o
260 obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o
261 obj-$(CONFIG_X86_VISWS) += setup-irq.o
262 obj-$(CONFIG_MN10300) += setup-bus.o
263 +obj-$(CONFIG_UBICOM32) += setup-bus.o setup-irq.o
264
265 -#
266 # ACPI Related PCI FW Functions
267 #
268 obj-$(CONFIG_ACPI) += pci-acpi.o
269 --- a/drivers/serial/Kconfig
270 +++ b/drivers/serial/Kconfig
271 @@ -871,6 +871,57 @@ config SERIAL_UARTLITE_CONSOLE
272 console (the system console is the device which receives all kernel
273 messages and warnings and which allows logins in single user mode).
274
275 +config SERIAL_UBI32_UARTTIO
276 + tristate "Ubicom UARTTIO support"
277 + depends on UBICOM32=y
278 + select SERIAL_CORE
279 + default y
280 + help
281 + Add support for the Ubicom virtual peripherial serial interface.
282 +
283 +config SERIAL_UBI32_UARTTIO_NR_UARTS
284 + int "Maximum number of UARTTIO virtual serial ports"
285 + depends on SERIAL_UBI32_UARTTIO
286 + default "4"
287 + help
288 + Set this to the maximum number of serial ports you want the driver to support.
289 +
290 +config SERIAL_UBI32_UARTTIO_CONSOLE
291 + tristate "Ubicom UARTTIO console support"
292 + depends on SERIAL_UBI32_UARTTIO=y
293 + select SERIAL_CORE_CONSOLE
294 + default y
295 + help
296 + Add support for console on the Ubicom virtual peripherial serial interface.
297 +
298 +config SERIAL_UBI32_SERDES
299 + bool "Ubicom serial port support"
300 + depends on UBICOM32=y
301 + select SERIAL_CORE
302 + default y
303 + help
304 + Add support for the Ubicom serial interface.
305 +
306 +config SERIAL_UBI32_SERDES_CONSOLE
307 + bool "Ubicom serial console support"
308 + depends on SERIAL_UBI32_SERDES=y
309 + select SERIAL_CORE_CONSOLE
310 + default y
311 +
312 +config SERIAL_UBI32_MAILBOX
313 + bool "Ubicom mailbox support"
314 + depends on UBICOM32=y
315 + select SERIAL_CORE
316 + default n
317 + help
318 + Add support for the Ubicom mailbox interface.
319 +
320 +config SERIAL_UBI32_MAILBOX_CONSOLE
321 + bool "Ubicom mailbox console support"
322 + depends on SERIAL_UBI32_MAILBOX=y
323 + select SERIAL_CORE_CONSOLE
324 + default y
325 +
326 config SERIAL_SUNCORE
327 bool
328 depends on SPARC
329 --- a/drivers/serial/Makefile
330 +++ b/drivers/serial/Makefile
331 @@ -77,3 +77,6 @@ obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIA
332 obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o
333 obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o
334 obj-$(CONFIG_SERIAL_QE) += ucc_uart.o
335 +obj-$(CONFIG_SERIAL_UBI32_SERDES) += ubi32_serdes.o
336 +obj-$(CONFIG_SERIAL_UBI32_UARTTIO) += ubi32_uarttio.o
337 +obj-$(CONFIG_SERIAL_UBI32_MAILBOX) += ubi32_mailbox.o
338 --- a/drivers/spi/Kconfig
339 +++ b/drivers/spi/Kconfig
340 @@ -196,6 +196,15 @@ config SPI_S3C24XX
341 help
342 SPI driver for Samsung S3C24XX series ARM SoCs
343
344 +config SPI_UBICOM32_GPIO
345 + tristate "Ubicom32 SPI over GPIO"
346 + depends on SPI_MASTER && UBICOM32 && EXPERIMENTAL
347 + select SPI_BITBANG
348 + select HAS_DMA
349 + help
350 + SPI driver for the Ubicom32 architecture using
351 + GPIO lines to provide the SPI bus.
352 +
353 config SPI_S3C24XX_GPIO
354 tristate "Samsung S3C24XX series SPI by GPIO"
355 depends on ARCH_S3C2410 && EXPERIMENTAL
356 --- a/drivers/spi/Makefile
357 +++ b/drivers/spi/Makefile
358 @@ -27,6 +27,7 @@ obj-$(CONFIG_SPI_ORION) += orion_spi.o
359 obj-$(CONFIG_SPI_MPC52xx_PSC) += mpc52xx_psc_spi.o
360 obj-$(CONFIG_SPI_MPC83xx) += spi_mpc83xx.o
361 obj-$(CONFIG_SPI_S3C24XX_GPIO) += spi_s3c24xx_gpio.o
362 +obj-$(CONFIG_SPI_UBICOM32_GPIO) += spi_ubicom32_gpio.o
363 obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o
364 obj-$(CONFIG_SPI_TXX9) += spi_txx9.o
365 obj-$(CONFIG_SPI_XILINX) += xilinx_spi.o
366 --- a/drivers/uio/Kconfig
367 +++ b/drivers/uio/Kconfig
368 @@ -89,4 +89,12 @@ config UIO_SERCOS3
369
370 If you compile this as a module, it will be called uio_sercos3.
371
372 +config UIO_UBICOM32RING
373 + tristate "Ubicom32 Ring Buffer driver"
374 + default n
375 + help
376 + Userspace I/O interface for a Ubicom32 Ring Buffer.
377 +
378 + If you compile this as a module, it will be called uio_ubicom32ring
379 +
380 endif
381 --- a/drivers/uio/Makefile
382 +++ b/drivers/uio/Makefile
383 @@ -5,3 +5,4 @@ obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdr
384 obj-$(CONFIG_UIO_SMX) += uio_smx.o
385 obj-$(CONFIG_UIO_AEC) += uio_aec.o
386 obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o
387 +obj-$(CONFIG_UIO_UBICOM32RING) += uio_ubicom32ring.o
388 --- a/drivers/usb/gadget/epautoconf.c
389 +++ b/drivers/usb/gadget/epautoconf.c
390 @@ -154,6 +154,10 @@ ep_matches (
391 /* configure your hardware with enough buffering!! */
392 }
393 break;
394 +
395 + case USB_ENDPOINT_XFER_BULK:
396 + if ((gadget->is_dualspeed) && (ep->maxpacket < 512))
397 + return 0;
398 }
399
400 /* MATCH!! */
401 --- a/drivers/usb/Kconfig
402 +++ b/drivers/usb/Kconfig
403 @@ -22,6 +22,7 @@ config USB_ARCH_HAS_HCD
404 default y if PCMCIA && !M32R # sl811_cs
405 default y if ARM # SL-811
406 default y if SUPERH # r8a66597-hcd
407 + default y if UBICOM32 # Ubicom's onchip USB Duial role controller
408 default PCI
409
410 # many non-PCI SOC chips embed OHCI
411 --- a/drivers/usb/musb/Kconfig
412 +++ b/drivers/usb/musb/Kconfig
413 @@ -12,7 +12,7 @@ config USB_MUSB_HDRC
414 depends on !SUPERH
415 select TWL4030_USB if MACH_OMAP_3430SDP
416 select USB_OTG_UTILS
417 - tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
418 + tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, Ubicom, ...)'
419 help
420 Say Y here if your system has a dual role high speed USB
421 controller based on the Mentor Graphics silicon IP. Then
422 --- a/drivers/usb/musb/Makefile
423 +++ b/drivers/usb/musb/Makefile
424 @@ -30,6 +30,10 @@ ifeq ($(CONFIG_BF52x),y)
425 musb_hdrc-objs += blackfin.o
426 endif
427
428 +ifeq ($(CONFIG_UBICOM32), y)
429 + musb_hdrc-objs += ubi32_usb.o
430 +endif
431 +
432 ifeq ($(CONFIG_USB_GADGET_MUSB_HDRC),y)
433 musb_hdrc-objs += musb_gadget_ep0.o musb_gadget.o
434 endif
435 --- a/drivers/usb/musb/musb_core.c
436 +++ b/drivers/usb/musb/musb_core.c
437 @@ -105,6 +105,13 @@
438 #include <asm/mach-types.h>
439 #endif
440
441 +#ifdef CONFIG_UBICOM32
442 +#include <asm/ip5000.h>
443 +#include <asm/ubicom32-tio.h>
444 +extern void ubi32_usb_init(void);
445 +extern void ubi32_usb_int_clr(void);
446 +#endif
447 +
448 #include "musb_core.h"
449
450
451 @@ -147,8 +154,37 @@ static inline struct musb *dev_to_musb(s
452 }
453
454 /*-------------------------------------------------------------------------*/
455 +#if defined(CONFIG_UBICOM32)
456 +
457 +/*
458 + * Load an endpoint's FIFO
459 + */
460 +void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 wCount, const u8 *pSource)
461 +{
462 + void __iomem *fifo = hw_ep->fifo;
463 +
464 + prefetch((u8 *)pSource);
465 +
466 + DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
467 + 'T', hw_ep->epnum, fifo, wCount, pSource);
468 +
469 + usb_tio_write_fifo((u32)fifo, (u32)pSource, wCount);
470 +
471 +}
472 +
473 +/*
474 + * Unload an endpoint's FIFO
475 + */
476 +void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 wCount, u8 *pDest)
477 +{
478 +
479 + void __iomem *fifo = hw_ep->fifo;
480 + DBG(4, "%cX ep%d fifo %p count %d buf %p\n",
481 + 'R', hw_ep->epnum, fifo, wCount, pDest);
482 + usb_tio_read_fifo((u32)fifo, (u32)pDest, wCount);
483 +}
484
485 -#if !defined(CONFIG_USB_TUSB6010) && !defined(CONFIG_BLACKFIN)
486 +#elif !defined(CONFIG_USB_TUSB6010) && !defined(CONFIG_BLACKFIN)
487
488 /*
489 * Load an endpoint's FIFO
490 @@ -227,8 +263,7 @@ void musb_read_fifo(struct musb_hw_ep *h
491 readsb(fifo, dst, len);
492 }
493 }
494 -
495 -#endif /* normal PIO */
496 +#endif /* !T6010 && !BLACKFIN */
497
498
499 /*-------------------------------------------------------------------------*/
500 @@ -874,12 +909,19 @@ void musb_start(struct musb *musb)
501 musb_writeb(regs, MUSB_TESTMODE, 0);
502
503 /* put into basic highspeed mode and start session */
504 +#ifndef CONFIG_UBICOM32
505 musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE
506 | MUSB_POWER_SOFTCONN
507 | MUSB_POWER_HSENAB
508 /* ENSUSPEND wedges tusb */
509 /* | MUSB_POWER_ENSUSPEND */
510 );
511 +#else
512 + musb_writeb(regs, MUSB_POWER, MUSB_POWER_HSENAB
513 + /* ENSUSPEND wedges tusb */
514 + /* | MUSB_POWER_ENSUSPEND */
515 + );
516 +#endif
517
518 musb->is_active = 0;
519 devctl = musb_readb(regs, MUSB_DEVCTL);
520 @@ -1081,6 +1123,7 @@ static struct fifo_cfg __initdata mode_4
521 };
522
523
524 +#ifndef CONFIG_UBICOM32
525 /*
526 * configure a fifo; for non-shared endpoints, this may be called
527 * once for a tx fifo and once for an rx fifo.
528 @@ -1240,7 +1283,7 @@ static int __init ep_config_from_table(s
529
530 return 0;
531 }
532 -
533 +#endif /* CONFIG_UBICOM32 */
534
535 /*
536 * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false
537 @@ -1256,6 +1299,11 @@ static int __init ep_config_from_hw(stru
538 DBG(2, "<== static silicon ep config\n");
539
540 /* FIXME pick up ep0 maxpacket size */
541 +#ifdef CONFIG_UBICOM32
542 + /* set ep0 to shared_fifo, otherwise urb will be put to out_qh but ep0_irq try to get the urb from in_qh*/
543 + hw_ep = musb->endpoints;
544 + hw_ep->is_shared_fifo = true;
545 +#endif
546
547 for (epnum = 1; epnum < musb->config->num_eps; epnum++) {
548 musb_ep_select(mbase, epnum);
549 @@ -1276,14 +1324,27 @@ static int __init ep_config_from_hw(stru
550 /* REVISIT: this algorithm is lazy, we should at least
551 * try to pick a double buffered endpoint.
552 */
553 +#ifndef CONFIG_UBICOM32
554 if (musb->bulk_ep)
555 continue;
556 musb->bulk_ep = hw_ep;
557 +#else
558 + if ((musb->bulk_ep_in) && (musb->bulk_ep_out))
559 + continue;
560 + /* Save theEP with 1024 Bytes FIFO for ISO */
561 + if(hw_ep->max_packet_sz_tx == 512) {
562 + if (!musb->bulk_ep_in) {
563 + musb->bulk_ep_in = hw_ep;
564 + } else if (!musb->bulk_ep_out) {
565 + musb->bulk_ep_out = hw_ep;
566 + }
567 + }
568 +#endif /* CONFIG_UBICOM32 */
569 #endif
570 }
571
572 #ifdef CONFIG_USB_MUSB_HDRC_HCD
573 - if (!musb->bulk_ep) {
574 + if ((!musb->bulk_ep_in) || (!musb->bulk_ep_out)) {
575 pr_debug("%s: missing bulk\n", musb_driver_name);
576 return -EINVAL;
577 }
578 @@ -1393,12 +1454,16 @@ static int __init musb_core_init(u16 mus
579 musb->epmask = 1;
580
581 if (reg & MUSB_CONFIGDATA_DYNFIFO) {
582 +#ifndef CONFIG_UBICOM32
583 if (musb->config->dyn_fifo)
584 status = ep_config_from_table(musb);
585 - else {
586 + else
587 +#endif
588 + {
589 ERR("reconfigure software for Dynamic FIFOs\n");
590 status = -ENODEV;
591 }
592 +
593 } else {
594 if (!musb->config->dyn_fifo)
595 status = ep_config_from_hw(musb);
596 @@ -1462,8 +1527,8 @@ static int __init musb_core_init(u16 mus
597
598 /*-------------------------------------------------------------------------*/
599
600 -#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
601 -
602 +#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_UBICOM32)
603 +static u32_t musb_int_count = 0;
604 static irqreturn_t generic_interrupt(int irq, void *__hci)
605 {
606 unsigned long flags;
607 @@ -1472,10 +1537,17 @@ static irqreturn_t generic_interrupt(int
608
609 spin_lock_irqsave(&musb->lock, flags);
610
611 +#ifndef CONFIG_UBICOM32
612 musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
613 musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
614 musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
615 +#else
616 + musb_read_int_status(&musb->int_usb, &musb->int_tx, &musb->int_rx);
617 + //ubi32_usb_int_clr();
618 + musb_int_count++;
619 +#endif
620
621 + DBG(4, "usb %x, tx %x, rx %x", musb->int_usb, musb->int_tx, musb->int_rx);
622 if (musb->int_usb || musb->int_tx || musb->int_rx)
623 retval = musb_interrupt(musb);
624
625 @@ -2210,6 +2282,10 @@ static struct platform_driver musb_drive
626
627 static int __init musb_init(void)
628 {
629 +#ifdef CONFIG_UBICOM32
630 + ubi32_usb_init();
631 +#endif
632 +
633 #ifdef CONFIG_USB_MUSB_HDRC_HCD
634 if (usb_disabled())
635 return 0;
636 --- a/drivers/usb/musb/musb_core.h
637 +++ b/drivers/usb/musb/musb_core.h
638 @@ -326,7 +326,12 @@ struct musb {
639 * queue until it completes or NAKs too much; then we try the next
640 * endpoint.
641 */
642 +#ifdef CONFIG_UBICOM32
643 + struct musb_hw_ep *bulk_ep_in;
644 + struct musb_hw_ep *bulk_ep_out;
645 +#else
646 struct musb_hw_ep *bulk_ep;
647 +#endif
648
649 struct list_head control; /* of musb_qh */
650 struct list_head in_bulk; /* of musb_qh */
651 --- a/drivers/usb/musb/musb_gadget.c
652 +++ b/drivers/usb/musb/musb_gadget.c
653 @@ -432,7 +432,7 @@ void musb_g_tx(struct musb *musb, u8 epn
654 * probably rates reporting as a host error
655 */
656 if (csr & MUSB_TXCSR_P_SENTSTALL) {
657 - csr |= MUSB_TXCSR_P_WZC_BITS;
658 + csr &= ~(MUSB_TXCSR_P_WZC_BITS);
659 csr &= ~MUSB_TXCSR_P_SENTSTALL;
660 musb_writew(epio, MUSB_TXCSR, csr);
661 if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) {
662 @@ -448,7 +448,7 @@ void musb_g_tx(struct musb *musb, u8 epn
663
664 if (csr & MUSB_TXCSR_P_UNDERRUN) {
665 /* we NAKed, no big deal ... little reason to care */
666 - csr |= MUSB_TXCSR_P_WZC_BITS;
667 + csr &= ~(MUSB_TXCSR_P_WZC_BITS);
668 csr &= ~(MUSB_TXCSR_P_UNDERRUN
669 | MUSB_TXCSR_TXPKTRDY);
670 musb_writew(epio, MUSB_TXCSR, csr);
671 @@ -584,10 +584,16 @@ static void rxstate(struct musb *musb, s
672 u16 csr = 0;
673 const u8 epnum = req->epnum;
674 struct usb_request *request = &req->request;
675 - struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
676 + struct musb_ep *musb_ep = NULL;
677 void __iomem *epio = musb->endpoints[epnum].regs;
678 - unsigned fifo_count = 0;
679 - u16 len = musb_ep->packet_sz;
680 + u16 fifo_count = 0;
681 + u16 len = 0;
682 +
683 + if (musb->endpoints[epnum].is_shared_fifo)
684 + musb_ep = &musb->endpoints[epnum].ep_in;
685 + else
686 + musb_ep = &musb->endpoints[epnum].ep_out;
687 + len = musb_ep->packet_sz;
688
689 csr = musb_readw(epio, MUSB_RXCSR);
690
691 @@ -726,7 +732,7 @@ static void rxstate(struct musb *musb, s
692 */
693
694 /* ack the read! */
695 - csr |= MUSB_RXCSR_P_WZC_BITS;
696 + csr &= ~MUSB_RXCSR_P_WZC_BITS;
697 csr &= ~MUSB_RXCSR_RXPKTRDY;
698 musb_writew(epio, MUSB_RXCSR, csr);
699 }
700 @@ -745,10 +751,15 @@ void musb_g_rx(struct musb *musb, u8 epn
701 u16 csr;
702 struct usb_request *request;
703 void __iomem *mbase = musb->mregs;
704 - struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out;
705 + struct musb_ep *musb_ep = NULL;
706 void __iomem *epio = musb->endpoints[epnum].regs;
707 struct dma_channel *dma;
708
709 + if (musb->endpoints[epnum].is_shared_fifo)
710 + musb_ep = &musb->endpoints[epnum].ep_in;
711 + else
712 + musb_ep = &musb->endpoints[epnum].ep_out;
713 +
714 musb_ep_select(mbase, epnum);
715
716 request = next_request(musb_ep);
717 @@ -1769,7 +1780,9 @@ int usb_gadget_register_driver(struct us
718 }
719 }
720 }
721 -
722 +#ifndef CONFIG_USB_MUSB_OTG
723 + musb_pullup(musb, 1);
724 +#endif
725 return retval;
726 }
727 EXPORT_SYMBOL(usb_gadget_register_driver);
728 --- a/drivers/usb/musb/musb_gadget_ep0.c
729 +++ b/drivers/usb/musb/musb_gadget_ep0.c
730 @@ -240,14 +240,14 @@ __acquires(musb->lock)
731 case USB_REQ_SET_ADDRESS:
732 /* change it after the status stage */
733 musb->set_address = true;
734 - musb->address = (u8) (ctrlrequest->wValue & 0x7f);
735 + musb->address = (u8) (le16_to_cpu(ctrlrequest->wValue) & 0x7f);
736 handled = 1;
737 break;
738
739 case USB_REQ_CLEAR_FEATURE:
740 switch (recip) {
741 case USB_RECIP_DEVICE:
742 - if (ctrlrequest->wValue
743 + if (le16_to_cpu(ctrlrequest->wValue)
744 != USB_DEVICE_REMOTE_WAKEUP)
745 break;
746 musb->may_wakeup = 0;
747 @@ -261,8 +261,8 @@ __acquires(musb->lock)
748
749 if (num == 0
750 || num >= MUSB_C_NUM_EPS
751 - || ctrlrequest->wValue
752 - != USB_ENDPOINT_HALT)
753 + || le16_to_cpu(ctrlrequest->wValue
754 + != USB_ENDPOINT_HALT))
755 break;
756
757 if (ctrlrequest->wIndex & USB_DIR_IN)
758 @@ -292,7 +292,7 @@ __acquires(musb->lock)
759 switch (recip) {
760 case USB_RECIP_DEVICE:
761 handled = 1;
762 - switch (ctrlrequest->wValue) {
763 + switch (le16_to_cpu(ctrlrequest->wValue)) {
764 case USB_DEVICE_REMOTE_WAKEUP:
765 musb->may_wakeup = 1;
766 break;
767 @@ -374,8 +374,8 @@ stall:
768
769 if (epnum == 0
770 || epnum >= MUSB_C_NUM_EPS
771 - || ctrlrequest->wValue
772 - != USB_ENDPOINT_HALT)
773 + || le16_to_cpu(ctrlrequest->wValue
774 + != USB_ENDPOINT_HALT))
775 break;
776
777 ep = musb->endpoints + epnum;
778 --- a/drivers/usb/musb/musb_host.c
779 +++ b/drivers/usb/musb/musb_host.c
780 @@ -160,7 +160,11 @@ static inline void musb_h_tx_start(struc
781 /* NOTE: no locks here; caller should lock and select EP */
782 if (ep->epnum) {
783 txcsr = musb_readw(ep->regs, MUSB_TXCSR);
784 +#ifndef CONFIG_UBICOM32
785 txcsr |= MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_H_WZC_BITS;
786 +#else
787 + txcsr |= (MUSB_TXCSR_TXPKTRDY & (~MUSB_TXCSR_H_WZC_BITS));
788 +#endif
789 musb_writew(ep->regs, MUSB_TXCSR, txcsr);
790 } else {
791 txcsr = MUSB_CSR0_H_SETUPPKT | MUSB_CSR0_TXPKTRDY;
792 @@ -223,6 +227,8 @@ musb_start_urb(struct musb *musb, int is
793 break;
794 default: /* bulk, interrupt */
795 /* actual_length may be nonzero on retry paths */
796 + if (urb->actual_length)
797 + DBG(3 ,"musb_start_urb: URB %p retried, len: %d\n", urb, urb->actual_length);
798 buf = urb->transfer_buffer + urb->actual_length;
799 len = urb->transfer_buffer_length - urb->actual_length;
800 }
801 @@ -342,13 +348,13 @@ musb_save_toggle(struct musb_hw_ep *ep,
802 if (!is_in) {
803 csr = musb_readw(epio, MUSB_TXCSR);
804 usb_settoggle(udev, qh->epnum, 1,
805 - (csr & MUSB_TXCSR_H_DATATOGGLE)
806 - ? 1 : 0);
807 + ((csr & MUSB_TXCSR_H_DATATOGGLE)
808 + ? 1 : 0));
809 } else {
810 csr = musb_readw(epio, MUSB_RXCSR);
811 usb_settoggle(udev, qh->epnum, 0,
812 - (csr & MUSB_RXCSR_H_DATATOGGLE)
813 - ? 1 : 0);
814 + ((csr & MUSB_RXCSR_H_DATATOGGLE)
815 + ? 1 : 0));
816 }
817 }
818
819 @@ -556,7 +562,11 @@ musb_host_packet_rx(struct musb *musb, s
820 musb_read_fifo(hw_ep, length, buf);
821
822 csr = musb_readw(epio, MUSB_RXCSR);
823 +#ifndef CONFIG_UBICOM32
824 csr |= MUSB_RXCSR_H_WZC_BITS;
825 +#else
826 + csr &= ~MUSB_RXCSR_H_WZC_BITS;
827 +#endif
828 if (unlikely(do_flush))
829 musb_h_flush_rxfifo(hw_ep, csr);
830 else {
831 @@ -590,6 +600,7 @@ musb_rx_reinit(struct musb *musb, struct
832
833 /* if programmed for Tx, put it in RX mode */
834 if (ep->is_shared_fifo) {
835 +#ifndef CONFIG_UBICOM32
836 csr = musb_readw(ep->regs, MUSB_TXCSR);
837 if (csr & MUSB_TXCSR_MODE) {
838 musb_h_tx_flush_fifo(ep);
839 @@ -604,7 +615,18 @@ musb_rx_reinit(struct musb *musb, struct
840 */
841 if (csr & MUSB_TXCSR_DMAMODE)
842 musb_writew(ep->regs, MUSB_TXCSR, MUSB_TXCSR_DMAMODE);
843 +
844 +#else
845 + /* clear mode (and everything else) to enable Rx */
846 musb_writew(ep->regs, MUSB_TXCSR, 0);
847 + /* scrub all previous state, clearing toggle */
848 + csr = musb_readw(ep->regs, MUSB_RXCSR);
849 + if (csr & MUSB_RXCSR_RXPKTRDY)
850 + WARNING("rx%d, packet/%d ready?\n", ep->epnum,
851 + musb_readw(ep->regs, MUSB_RXCOUNT));
852 +
853 + musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
854 +#endif
855
856 /* scrub all previous state, clearing toggle */
857 } else {
858 @@ -1138,8 +1160,18 @@ void musb_host_tx(struct musb *musb, u8
859 void __iomem *mbase = musb->mregs;
860 struct dma_channel *dma;
861
862 +#ifdef CONFIG_UBICOM32
863 + if (hw_ep->is_shared_fifo) {
864 + qh = hw_ep->in_qh;
865 + }
866 +#ifdef CONFIG_USB_SERIAL_SIERRAWIRELESS
867 + printk(KERN_DEBUG "OUT/TX%d end, csr %04x%s\n", epnum, tx_csr,
868 + dma ? ", dma" : "");
869 +#endif
870 +#endif
871 urb = next_urb(qh);
872
873 +
874 musb_ep_select(mbase, epnum);
875 tx_csr = musb_readw(epio, MUSB_TXCSR);
876
877 @@ -1180,9 +1212,14 @@ void musb_host_tx(struct musb *musb, u8
878 * we have a candidate... NAKing is *NOT* an error
879 */
880 musb_ep_select(mbase, epnum);
881 +#ifndef CONFIG_UBICOM32
882 musb_writew(epio, MUSB_TXCSR,
883 MUSB_TXCSR_H_WZC_BITS
884 | MUSB_TXCSR_TXPKTRDY);
885 +#else
886 + musb_writew(epio, MUSB_TXCSR,
887 + MUSB_TXCSR_TXPKTRDY);
888 +#endif
889 return;
890 }
891
892 @@ -1353,8 +1390,14 @@ void musb_host_tx(struct musb *musb, u8
893 qh->segsize = length;
894
895 musb_ep_select(mbase, epnum);
896 +#ifndef CONFIG_UBICOM32
897 + musb_writew(epio, MUSB_TXCSR,
898 + MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
899 +#else
900 musb_writew(epio, MUSB_TXCSR,
901 - MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
902 + MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY);
903 +#endif
904 +
905 }
906
907
908 @@ -1414,7 +1457,11 @@ static void musb_bulk_rx_nak_timeout(str
909
910 /* clear nak timeout bit */
911 rx_csr = musb_readw(epio, MUSB_RXCSR);
912 +#ifndef CONFIG_UBICOM32
913 rx_csr |= MUSB_RXCSR_H_WZC_BITS;
914 +#else
915 + rx_csr &= ~MUSB_RXCSR_H_WZC_BITS;
916 +#endif
917 rx_csr &= ~MUSB_RXCSR_DATAERROR;
918 musb_writew(epio, MUSB_RXCSR, rx_csr);
919
920 @@ -1483,6 +1530,13 @@ void musb_host_rx(struct musb *musb, u8
921
922 pipe = urb->pipe;
923
924 +#ifdef CONFIG_UBICOM32
925 +#ifdef CONFIG_USB_SERIAL_SIERRAWIRELESS
926 + printk(KERN_DEBUG "RXCSR%d %04x, reqpkt, len %zu%s\n", epnum, rx_csr,
927 + xfer_len, dma ? ", dma" : "");
928 +#endif
929 +#endif
930 +
931 DBG(5, "<== hw %d rxcsr %04x, urb actual %d (+dma %zu)\n",
932 epnum, rx_csr, urb->actual_length,
933 dma ? dma->actual_len : 0);
934 @@ -1521,8 +1575,15 @@ void musb_host_rx(struct musb *musb, u8
935 return;
936 }
937 musb_ep_select(mbase, epnum);
938 +#ifndef CONFIG_UBICOM32
939 rx_csr |= MUSB_RXCSR_H_WZC_BITS;
940 rx_csr &= ~MUSB_RXCSR_DATAERROR;
941 +#else
942 + /* NEED TO EVALUATE CHANGE */
943 + rx_csr &= ~MUSB_RXCSR_H_WZC_BITS;
944 + rx_csr &= ~MUSB_RXCSR_DATAERROR;
945 +// musb_writew(epio, MUSB_RXCSR, (~(MUSB_RXCSR_H_WZC_BITS))| MUSB_RXCSR_H_REQPKT);
946 +#endif
947 musb_writew(epio, MUSB_RXCSR, rx_csr);
948
949 goto finish;
950 @@ -1579,8 +1640,13 @@ void musb_host_rx(struct musb *musb, u8
951 rx_csr &= ~MUSB_RXCSR_H_REQPKT;
952
953 musb_ep_select(mbase, epnum);
954 +#ifndef CONFIG_UBICOM32
955 musb_writew(epio, MUSB_RXCSR,
956 MUSB_RXCSR_H_WZC_BITS | rx_csr);
957 +#else
958 + musb_writew(epio, MUSB_RXCSR,
959 + (~MUSB_RXCSR_H_WZC_BITS) & rx_csr);
960 +#endif
961 }
962 #endif
963 if (dma && (rx_csr & MUSB_RXCSR_DMAENAB)) {
964 @@ -1610,7 +1676,7 @@ void musb_host_rx(struct musb *musb, u8
965 else
966 done = false;
967
968 - } else {
969 + } else {
970 /* done if urb buffer is full or short packet is recd */
971 done = (urb->actual_length + xfer_len >=
972 urb->transfer_buffer_length
973 @@ -1823,7 +1889,11 @@ static int musb_schedule(
974 } else if (hw_ep->out_qh != NULL)
975 continue;
976
977 +#ifndef CONFIG_UBICOM32
978 if (hw_ep == musb->bulk_ep)
979 +#else
980 + if ((hw_ep == musb->bulk_ep_in) || (hw_ep == musb->bulk_ep_out)) /* Ubicom */
981 +#endif
982 continue;
983
984 if (is_in)
985 @@ -1836,7 +1906,14 @@ static int musb_schedule(
986 best_end = epnum;
987 }
988 }
989 +
990 +#ifdef CONFIG_UBICOM32
991 + if (((best_diff >= qh->maxpacket)) && ((qh->type == USB_ENDPOINT_XFER_BULK) && (!is_in)))
992 + best_end = -1;
993 +#endif
994 +
995 /* use bulk reserved ep1 if no other ep is free */
996 +#ifndef CONFIG_UBICOM32
997 if (best_end < 0 && qh->type == USB_ENDPOINT_XFER_BULK) {
998 hw_ep = musb->bulk_ep;
999 if (is_in)
1000 @@ -1858,6 +1935,22 @@ static int musb_schedule(
1001 } else if (best_end < 0) {
1002 return -ENOSPC;
1003 }
1004 +#else
1005 + if (best_end < 0 && qh->type == USB_ENDPOINT_XFER_BULK) {
1006 + /* hw_ep = musb->bulk_ep; */
1007 + if (is_in) {
1008 + head = &musb->in_bulk;
1009 + hw_ep = musb->bulk_ep_in; /* UBICOM */
1010 + }
1011 + else {
1012 + head = &musb->out_bulk;
1013 + hw_ep = musb->bulk_ep_out; /* UBICOM */
1014 + }
1015 + goto success;
1016 + } else if (best_end < 0) {
1017 + return -ENOSPC;
1018 + }
1019 +#endif
1020
1021 idle = 1;
1022 qh->mux = 0;
1023 @@ -1869,6 +1962,13 @@ success:
1024 list_add_tail(&qh->ring, head);
1025 qh->mux = 1;
1026 }
1027 + /*
1028 + * It's not make sense to set NAK timeout when qh->mux = 0,
1029 + * There is nothing else to schedule
1030 + */
1031 + if ((qh->type == USB_ENDPOINT_XFER_BULK) && (qh->mux == 0))
1032 + qh->intv_reg = 0;
1033 +
1034 qh->hw_ep = hw_ep;
1035 qh->hep->hcpriv = qh;
1036 if (idle)
1037 @@ -1975,6 +2075,15 @@ static int musb_urb_enqueue(
1038 /* ISO always uses logarithmic encoding */
1039 interval = min_t(u8, epd->bInterval, 16);
1040 break;
1041 +#ifdef COMFIG_UBICOM32
1042 + case USB_ENDPOINT_XFER_BULK:
1043 + if (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
1044 + interval = (USB_SPEED_HIGH == urb->dev->speed) ? 16: 2;
1045 + else
1046 + interval = 0;
1047 + break;
1048 +#endif
1049 +
1050 default:
1051 /* REVISIT we actually want to use NAK limits, hinting to the
1052 * transfer scheduling logic to try some other qh, e.g. try
1053 --- a/drivers/usb/musb/musb_io.h
1054 +++ b/drivers/usb/musb/musb_io.h
1055 @@ -58,6 +58,7 @@ static inline void writesb(const void __
1056
1057 #ifndef CONFIG_BLACKFIN
1058
1059 +#ifndef CONFIG_UBICOM32
1060 /* NOTE: these offsets are all in bytes */
1061
1062 static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
1063 @@ -72,7 +73,37 @@ static inline void musb_writew(void __io
1064
1065 static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
1066 { __raw_writel(data, addr + offset); }
1067 +#else
1068 +#include <asm/ubicom32-tio.h>
1069 +static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
1070 +{
1071 + u16 data;
1072 + usb_tio_read_u16((u32)(addr + offset), &data);
1073 + return data;
1074 +}
1075
1076 +static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
1077 +{
1078 + u8 data;
1079 + usb_tio_read_u8((u32)(addr + offset), &data);
1080 + return data;
1081 +}
1082 +
1083 +static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
1084 +{
1085 + usb_tio_write_u16((u32)(addr + offset), data);
1086 +}
1087 +
1088 +static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
1089 +{
1090 + usb_tio_write_u8((u32)(addr + offset), data);
1091 +}
1092 +
1093 +static inline void musb_read_int_status(u8_t *int_usb, u16_t *int_tx, u16_t *int_rx)
1094 +{
1095 + return usb_tio_read_int_status(int_usb, int_tx, int_rx);
1096 +}
1097 +#endif /* CONFIG_UBICOM32 */
1098
1099 #ifdef CONFIG_USB_TUSB6010
1100
1101 @@ -106,7 +137,7 @@ static inline void musb_writeb(void __io
1102 __raw_writew(tmp, addr + (offset & ~1));
1103 }
1104
1105 -#else
1106 +#elif !defined(CONFIG_UBICOM32)
1107
1108 static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
1109 { return __raw_readb(addr + offset); }
1110 --- a/drivers/usb/musb/musb_regs.h
1111 +++ b/drivers/usb/musb/musb_regs.h
1112 @@ -167,6 +167,7 @@
1113 (MUSB_TXCSR_H_NAKTIMEOUT | MUSB_TXCSR_H_RXSTALL \
1114 | MUSB_TXCSR_H_ERROR | MUSB_TXCSR_FIFONOTEMPTY)
1115
1116 +
1117 /* RXCSR in Peripheral and Host mode */
1118 #define MUSB_RXCSR_AUTOCLEAR 0x8000
1119 #define MUSB_RXCSR_DMAENAB 0x2000
1120 --- a/drivers/video/backlight/Kconfig
1121 +++ b/drivers/video/backlight/Kconfig
1122 @@ -93,6 +93,63 @@ config LCD_HP700
1123 If you have an HP Jornada 700 series handheld (710/720/728)
1124 say Y to enable LCD control driver.
1125
1126 +config LCD_UBICOM32POWER
1127 + tristate "Ubicom LCD power Driver"
1128 + depends on LCD_CLASS_DEVICE && UBICOM32
1129 + default n
1130 + help
1131 + If you have a Ubicom32 based system with an LCD panel that requires
1132 + power control, say Y to enable the power control driver for it.
1133 +
1134 +config LCD_UBICOM32
1135 + tristate "Ubicom Backlight Driver"
1136 + depends on LCD_CLASS_DEVICE && UBICOM32
1137 + default n
1138 + help
1139 + This driver takes care of initialization of LCD panels with
1140 + built in controllers.
1141 +
1142 +menu "Ubicom32 LCD Panel Support"
1143 + depends on UBICOM32 && LCD_UBICOM32
1144 +
1145 +config LCD_UBICOM32_TFT2N0369E_P
1146 + bool "TFT2N0369E (Portrait)"
1147 + default n
1148 + help
1149 + Support for TFT2N0369 in portrait mode
1150 +
1151 +config LCD_UBICOM32_TFT2N0369E_L
1152 + bool "TFT2N0369E (Landscape)"
1153 + default n
1154 + help
1155 + Support for TFT2N0369 in landscape mode
1156 +
1157 +config LCD_UBICOM32_CFAF240320KTTS
1158 + bool "CFAF240320KTTS"
1159 + default n
1160 + help
1161 + Support for CFAF240320KTTS
1162 +
1163 +config LCD_UBICOM32_CFAF240320KTTS_180
1164 + bool "CFAF240320KTTS (180 rotation)"
1165 + default n
1166 + help
1167 + Support for CFAF240320KTTS rotated 180 degrees
1168 +
1169 +config LCD_UBICOM32_CFAF240320D
1170 + bool "CFAF240320D"
1171 + default n
1172 + help
1173 + Support for CFAF240320D
1174 +
1175 +config LCD_UBICOM32_CFAF320240F
1176 + bool "CFAF320240F"
1177 + default n
1178 + help
1179 + Support for CFAF320240F
1180 +
1181 +endmenu
1182 +
1183 #
1184 # Backlight
1185 #
1186 @@ -229,3 +286,11 @@ config BACKLIGHT_SAHARA
1187 help
1188 If you have a Tabletkiosk Sahara Touch-iT, say y to enable the
1189 backlight driver.
1190 +
1191 +config BACKLIGHT_UBICOM32
1192 + tristate "Ubicom Backlight Driver"
1193 + depends on BACKLIGHT_CLASS_DEVICE && UBICOM32
1194 + default n
1195 + help
1196 + If you have a Ubicom32 based system with a backlight say Y to enable the
1197 + backlight driver.
1198 --- a/drivers/video/backlight/Makefile
1199 +++ b/drivers/video/backlight/Makefile
1200 @@ -9,6 +9,9 @@ obj-$(CONFIG_LCD_PLATFORM) += platfor
1201 obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o
1202 obj-$(CONFIG_LCD_TDO24M) += tdo24m.o
1203 obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o
1204 +obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o
1205 +obj-$(CONFIG_LCD_UBICOM32POWER) += ubicom32lcdpower.o
1206 +obj-$(CONFIG_LCD_UBICOM32) += ubicom32lcd.o
1207
1208 obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
1209 obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o
1210 @@ -24,4 +27,4 @@ obj-$(CONFIG_BACKLIGHT_DA903X) += da903x
1211 obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o
1212 obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
1213 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
1214 -
1215 +obj-$(CONFIG_BACKLIGHT_UBICOM32) += ubicom32bl.o
1216 --- a/drivers/video/Kconfig
1217 +++ b/drivers/video/Kconfig
1218 @@ -609,6 +609,50 @@ config FB_BFIN_T350MCQB
1219 This display is a QVGA 320x240 24-bit RGB display interfaced by an 8-bit wide PPI
1220 It uses PPI[0..7] PPI_FS1, PPI_FS2 and PPI_CLK.
1221
1222 +config FB_UBICOM32
1223 + tristate "Ubicom32 Frame Buffer driver"
1224 + depends on FB && UBICOM32
1225 + select FB_CFB_FILLRECT
1226 + select FB_CFB_COPYAREA
1227 + select FB_CFB_IMAGEBLIT
1228 + select FONT_6x11 if FRAMEBUFFER_CONSOLE
1229 + help
1230 + This is the framebuffer device driver for the Ubicom32 architecture.
1231 + You can configure video memory by using kernel command line parameters, for example:
1232 + video=ubicomfb:vram_size=512,init_value=0xffff
1233 +
1234 +config FB_UBICOM32_PLIO80
1235 + tristate "Ubicom32 80 Bus PLIO Frame Buffer driver"
1236 + depends on FB && UBICOM32
1237 + select FB_CFB_FILLRECT
1238 + select FB_CFB_COPYAREA
1239 + select FB_CFB_IMAGEBLIT
1240 + select FONT_6x11 if FRAMEBUFFER_CONSOLE
1241 + select UBICOM32_PLIO
1242 + help
1243 + This is a framebuffer device driver for the Ubicom32 architecture.
1244 + You can configure the xres, yres and vram size (in kilobytes) by using
1245 + kernel command line parameters, for example:
1246 + video=ubicom32vfb:xres=320,yres=240,vram_size=512
1247 +
1248 +config FB_UBICOM32_VIRTUAL
1249 + tristate "Ubicom32 Virtual Frame Buffer driver"
1250 + depends on FB && UBICOM32
1251 + select FB_CFB_FILLRECT
1252 + select FB_CFB_COPYAREA
1253 + select FB_CFB_IMAGEBLIT
1254 + select FONT_6x11 if FRAMEBUFFER_CONSOLE
1255 + help
1256 + This is a virtual framebuffer device driver for the Ubicom32 architecture.
1257 + You can configure the xres, yres and vram size (in kilobytes) by using
1258 + kernel command line parameters, for example:
1259 + video=ubicom32vfb:xres=320,yres=240,vram_size=512
1260 +
1261 +config FB_UBICOM32_VIRTUAL_NOAUTO
1262 + bool "Do not automatically load"
1263 + depends on FB_UBICOM32_VIRTUAL
1264 + help
1265 + Select this option to prevent the VFB from automatically loading at boot.
1266
1267 config FB_STI
1268 tristate "HP STI frame buffer device support"
1269 --- a/drivers/video/Makefile
1270 +++ b/drivers/video/Makefile
1271 @@ -136,6 +136,10 @@ obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-
1272 obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o
1273 obj-$(CONFIG_FB_MX3) += mx3fb.o
1274
1275 +obj-$(CONFIG_FB_UBICOM32) += ubicom32fb.o
1276 +obj-$(CONFIG_FB_UBICOM32_PLIO80) += ubicom32plio80.o
1277 +obj-$(CONFIG_FB_UBICOM32_VIRTUAL) += ubicom32vfb.o
1278 +
1279 # the test framebuffer is last
1280 obj-$(CONFIG_FB_VIRTUAL) += vfb.o
1281
1282 --- a/drivers/watchdog/Kconfig
1283 +++ b/drivers/watchdog/Kconfig
1284 @@ -887,6 +887,19 @@ config WATCHDOG_RIO
1285 machines. The watchdog timeout period is normally one minute but
1286 can be changed with a boot-time parameter.
1287
1288 +# Ubicom32
1289 +
1290 +config UBI32_WDT
1291 + tristate "Ubicom32 Hardware Watchdog support"
1292 + depends on UBICOM32
1293 + ---help---
1294 + If you say yes here you will get support for the Ubicom32 On-Chip
1295 + Watchdog Timer. If you have one of these processors and wish to
1296 + have watchdog support enabled, say Y, otherwise say N.
1297 +
1298 + To compile this driver as a module, choose M here: the
1299 + module will be called ubi32_wdt.
1300 +
1301 # XTENSA Architecture
1302
1303 #
1304 --- a/drivers/watchdog/Makefile
1305 +++ b/drivers/watchdog/Makefile
1306 @@ -131,6 +131,9 @@ obj-$(CONFIG_SH_WDT) += shwdt.o
1307 obj-$(CONFIG_WATCHDOG_RIO) += riowd.o
1308 obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o
1309
1310 +# Ubicom32 Architecture
1311 +obj-$(CONFIG_UBI32_WDT) += ubi32_wdt.o
1312 +
1313 # XTENSA Architecture
1314
1315 # Architecture Independant
1316 --- a/fs/binfmt_flat.c
1317 +++ b/fs/binfmt_flat.c
1318 @@ -67,6 +67,11 @@
1319 #define FLAT_DATA_ALIGN (sizeof(void *))
1320 #endif
1321
1322 +#ifndef ARCH_FLAT_ALIGN
1323 +#undef FLAT_DATA_ALIGN
1324 +#define FLAT_DATA_ALIGN ARCH_FLAT_ALIGN
1325 +#endif
1326 +
1327 #define RELOC_FAILED 0xff00ff01 /* Relocation incorrect somewhere */
1328 #define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */
1329
1330 @@ -436,6 +441,7 @@ static int load_flat_file(struct linux_b
1331 loff_t fpos;
1332 unsigned long start_code, end_code;
1333 int ret;
1334 + int flush_happened = 0;
1335
1336 hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */
1337 inode = bprm->file->f_path.dentry->d_inode;
1338 @@ -521,6 +527,7 @@ static int load_flat_file(struct linux_b
1339
1340 /* OK, This is the point of no return */
1341 set_personality(PER_LINUX_32BIT);
1342 + flush_happened = 1;
1343 }
1344
1345 /*
1346 @@ -535,6 +542,12 @@ static int load_flat_file(struct linux_b
1347 * it all together.
1348 */
1349 if ((flags & (FLAT_FLAG_RAM|FLAT_FLAG_GZIP)) == 0) {
1350 +
1351 +#ifdef ARCH_FLAT_ALIGN_TEXT
1352 + printk("Unable to mmap rom with ARCH alignment requirements\n");
1353 + ret = -ENOEXEC;
1354 + goto err;
1355 +#endif
1356 /*
1357 * this should give us a ROM ptr, but if it doesn't we don't
1358 * really care
1359 @@ -553,7 +566,7 @@ static int load_flat_file(struct linux_b
1360 goto err;
1361 }
1362
1363 - len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
1364 + len = data_len + extra + ALIGN(MAX_SHARED_LIBS * sizeof(unsigned long), FLAT_DATA_ALIGN);
1365 len = PAGE_ALIGN(len);
1366 down_write(&current->mm->mmap_sem);
1367 realdatastart = do_mmap(0, 0, len,
1368 @@ -572,6 +585,7 @@ static int load_flat_file(struct linux_b
1369 datapos = ALIGN(realdatastart +
1370 MAX_SHARED_LIBS * sizeof(unsigned long),
1371 FLAT_DATA_ALIGN);
1372 + //datapos = realdatastart + ALIGN(MAX_SHARED_LIBS * sizeof(unsigned long), ARCH_FLAT_ALIGN);
1373
1374 DBG_FLT("BINFMT_FLAT: Allocated data+bss+stack (%d bytes): %x\n",
1375 (int)(data_len + bss_len + stack_len), (int)datapos);
1376 @@ -600,7 +614,11 @@ static int load_flat_file(struct linux_b
1377 memp_size = len;
1378 } else {
1379
1380 - len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
1381 + len = text_len + data_len + extra + ALIGN(MAX_SHARED_LIBS * sizeof(unsigned long), FLAT_DATA_ALIGN);
1382 +#ifdef ARCH_FLAT_ALIGN_TEXT
1383 + /* Reserve space for the text alignment. */
1384 + len += FLAT_DATA_ALIGN;
1385 +#endif
1386 len = PAGE_ALIGN(len);
1387 down_write(&current->mm->mmap_sem);
1388 textpos = do_mmap(0, 0, len,
1389 @@ -616,10 +634,17 @@ static int load_flat_file(struct linux_b
1390 goto err;
1391 }
1392
1393 + memp = textpos;
1394 +#ifdef ARCH_FLAT_ALIGN_TEXT
1395 + textpos = ALIGN(textpos + sizeof(struct flat_hdr), FLAT_DATA_ALIGN) - sizeof(struct flat_hdr);
1396 +#endif
1397 realdatastart = textpos + ntohl(hdr->data_start);
1398 datapos = ALIGN(realdatastart +
1399 MAX_SHARED_LIBS * sizeof(unsigned long),
1400 FLAT_DATA_ALIGN);
1401 +// datapos = realdatastart + ALIGN(MAX_SHARED_LIBS * sizeof(unsigned long), ARCH_FLAT_ALIGN);
1402 +// reloc = (unsigned long *) (textpos + ntohl(hdr->reloc_start) +
1403 +// ALIGN(MAX_SHARED_LIBS * sizeof(unsigned long), ARCH_FLAT_ALIGN));
1404
1405 reloc = (unsigned long *)
1406 (datapos + (ntohl(hdr->reloc_start) - text_len));
1407 @@ -659,7 +684,7 @@ static int load_flat_file(struct linux_b
1408 }
1409 if (result >= (unsigned long)-4096) {
1410 printk("Unable to read code+data+bss, errno %d\n",(int)-result);
1411 - do_munmap(current->mm, textpos, text_len + data_len + extra +
1412 + do_munmap(current->mm, memp, text_len + data_len + extra +
1413 MAX_SHARED_LIBS * sizeof(unsigned long));
1414 ret = result;
1415 goto err;
1416 @@ -672,6 +697,9 @@ static int load_flat_file(struct linux_b
1417
1418 /* The main program needs a little extra setup in the task structure */
1419 start_code = textpos + sizeof (struct flat_hdr);
1420 +#ifdef ARCH_FLAT_ALIGN_TEXT
1421 + BUG_ON(ALIGN(start_code, FLAT_DATA_ALIGN) != start_code);
1422 +#endif
1423 end_code = textpos + text_len;
1424 if (id == 0) {
1425 current->mm->start_code = start_code;
1426 @@ -800,6 +828,13 @@ static int load_flat_file(struct linux_b
1427
1428 return 0;
1429 err:
1430 + if (flush_happened) {
1431 + /*
1432 + * The parent process has already started running. We cannot allow the child to return back to user space
1433 + * as this child is still uning the parent stack and 2 will clobber each other. We are going to kill this child.
1434 + */
1435 + do_exit(SIGTERM);
1436 + }
1437 return ret;
1438 }
1439
1440 --- a/fs/Kconfig.binfmt
1441 +++ b/fs/Kconfig.binfmt
1442 @@ -30,7 +30,7 @@ config COMPAT_BINFMT_ELF
1443 config BINFMT_ELF_FDPIC
1444 bool "Kernel support for FDPIC ELF binaries"
1445 default y
1446 - depends on (FRV || BLACKFIN || (SUPERH32 && !MMU))
1447 + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || UBICOM32)
1448 help
1449 ELF FDPIC binaries are based on ELF, but allow the individual load
1450 segments of a binary to be located in memory independently of each
1451 --- a/include/asm-generic/resource.h
1452 +++ b/include/asm-generic/resource.h
1453 @@ -69,13 +69,16 @@
1454 /*
1455 * boot-time rlimit defaults for the init task:
1456 */
1457 +#ifndef CONFIG_ELF_CORE
1458 +#define CONFIG_USER_ELF_CORE_SIZE 0
1459 +#endif
1460 #define INIT_RLIMITS \
1461 { \
1462 [RLIMIT_CPU] = { RLIM_INFINITY, RLIM_INFINITY }, \
1463 [RLIMIT_FSIZE] = { RLIM_INFINITY, RLIM_INFINITY }, \
1464 [RLIMIT_DATA] = { RLIM_INFINITY, RLIM_INFINITY }, \
1465 [RLIMIT_STACK] = { _STK_LIM, _STK_LIM_MAX }, \
1466 - [RLIMIT_CORE] = { 0, RLIM_INFINITY }, \
1467 + [RLIMIT_CORE] = { CONFIG_USER_ELF_CORE_SIZE, RLIM_INFINITY }, \
1468 [RLIMIT_RSS] = { RLIM_INFINITY, RLIM_INFINITY }, \
1469 [RLIMIT_NPROC] = { 0, 0 }, \
1470 [RLIMIT_NOFILE] = { INR_OPEN, INR_OPEN }, \
1471 --- a/include/linux/elf-em.h
1472 +++ b/include/linux/elf-em.h
1473 @@ -41,6 +41,7 @@
1474 * up with a final number.
1475 */
1476 #define EM_ALPHA 0x9026
1477 +#define EM_UBICOM32 0xde3d /* Ubicom32; no ABI */
1478
1479 /* Bogus old v850 magic number, used by old tools. */
1480 #define EM_CYGNUS_V850 0x9080
1481 --- a/include/linux/fb.h
1482 +++ b/include/linux/fb.h
1483 @@ -151,6 +151,10 @@ struct dentry;
1484 #define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
1485 #define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
1486
1487 +#define FB_ACCEL_UBICOM32 0x0100 /* Ubicom32 */
1488 +#define FB_ACCEL_UBICOM32_VFB 0x0101 /* Ubicom32 VFB */
1489 +#define FB_ACCEL_UBICOM32_PLIO80 0x0102 /* Ubicom32 PLIO80 */
1490 +
1491 struct fb_fix_screeninfo {
1492 char id[16]; /* identification string eg "TT Builtin" */
1493 unsigned long smem_start; /* Start of frame buffer mem */
1494 --- a/include/linux/if_ppp.h
1495 +++ b/include/linux/if_ppp.h
1496 @@ -114,14 +114,14 @@ struct pppol2tp_ioc_stats {
1497 __u16 tunnel_id; /* redundant */
1498 __u16 session_id; /* if zero, get tunnel stats */
1499 __u32 using_ipsec:1; /* valid only for session_id == 0 */
1500 - aligned_u64 tx_packets;
1501 - aligned_u64 tx_bytes;
1502 - aligned_u64 tx_errors;
1503 - aligned_u64 rx_packets;
1504 - aligned_u64 rx_bytes;
1505 - aligned_u64 rx_seq_discards;
1506 - aligned_u64 rx_oos_packets;
1507 - aligned_u64 rx_errors;
1508 + __u64 tx_packets;
1509 + __u64 tx_bytes;
1510 + __u64 tx_errors;
1511 + __u64 rx_packets;
1512 + __u64 rx_bytes;
1513 + __u64 rx_seq_discards;
1514 + __u64 rx_oos_packets;
1515 + __u64 rx_errors;
1516 };
1517
1518 #define ifr__name b.ifr_ifrn.ifrn_name
1519 --- a/include/linux/oprofile.h
1520 +++ b/include/linux/oprofile.h
1521 @@ -99,6 +99,8 @@ void oprofile_add_sample(struct pt_regs
1522 */
1523 void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
1524 unsigned long event, int is_kernel);
1525 +void oprofile_add_ext_sample_cpu(unsigned long pc, struct pt_regs * const regs,
1526 + unsigned long event, int is_kernel, int cpu);
1527
1528 /* Use this instead when the PC value is not from the regs. Doesn't
1529 * backtrace. */
1530 --- a/include/linux/serial_core.h
1531 +++ b/include/linux/serial_core.h
1532 @@ -167,6 +167,9 @@
1533 /* MAX3100 */
1534 #define PORT_MAX3100 86
1535
1536 +/* Ubicom32 */
1537 +#define PORT_UBI32_UARTTIO 87
1538 +
1539 #ifdef __KERNEL__
1540
1541 #include <linux/compiler.h>
1542 --- a/include/linux/slab.h
1543 +++ b/include/linux/slab.h
1544 @@ -317,4 +317,14 @@ static inline void *kzalloc_node(size_t
1545 return kmalloc_node(size, flags | __GFP_ZERO, node);
1546 }
1547
1548 +struct kmem_cache_size_info {
1549 + unsigned short page;
1550 + unsigned short order;
1551 +};
1552 +
1553 +/*
1554 + * get info on all the memory allocated by slab for this named cache
1555 + */
1556 +extern int kmem_cache_block_info(char *name, struct kmem_cache_size_info *data, int max_data);
1557 +
1558 #endif /* _LINUX_SLAB_H */
1559 --- a/init/Kconfig
1560 +++ b/init/Kconfig
1561 @@ -865,6 +865,12 @@ config ELF_CORE
1562 help
1563 Enable support for generating core dumps. Disabling saves about 4k.
1564
1565 +config USER_ELF_CORE_SIZE
1566 + int "user core dump size (10MB to 32MB)"
1567 + range 10485760 33554432
1568 + default 16777216
1569 + depends on ELF_CORE
1570 +
1571 config PCSPKR_PLATFORM
1572 bool "Enable PC-Speaker support" if EMBEDDED
1573 depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES
1574 --- a/kernel/module.c
1575 +++ b/kernel/module.c
1576 @@ -2688,6 +2688,9 @@ static int m_show(struct seq_file *m, vo
1577 /* Used by oprofile and other similar tools. */
1578 seq_printf(m, " 0x%p", mod->module_core);
1579
1580 +#ifdef ARCH_PROC_MODULES_EXTRA
1581 + ARCH_PROC_MODULES_EXTRA(m, mod);
1582 +#endif
1583 /* Taints info */
1584 if (mod->taints)
1585 seq_printf(m, " %s", module_flags(mod, buf));
1586 @@ -2840,8 +2843,12 @@ void print_modules(void)
1587 printk("Modules linked in:");
1588 /* Most callers should already have preempt disabled, but make sure */
1589 preempt_disable();
1590 - list_for_each_entry_rcu(mod, &modules, list)
1591 + list_for_each_entry_rcu(mod, &modules, list) {
1592 printk(" %s%s", mod->name, module_flags(mod, buf));
1593 +#ifdef ARCH_OOPS_MODULE_EXTRA
1594 + ARCH_OOPS_MODULE_EXTRA(mod);
1595 +#endif
1596 + }
1597 preempt_enable();
1598 if (last_unloaded_module[0])
1599 printk(" [last unloaded: %s]", last_unloaded_module);
1600 --- a/kernel/sched_clock.c
1601 +++ b/kernel/sched_clock.c
1602 @@ -38,8 +38,7 @@
1603 */
1604 unsigned long long __attribute__((weak)) sched_clock(void)
1605 {
1606 - return (unsigned long long)(jiffies - INITIAL_JIFFIES)
1607 - * (NSEC_PER_SEC / HZ);
1608 + return (get_jiffies_64() - INITIAL_JIFFIES) * (NSEC_PER_SEC / HZ);
1609 }
1610
1611 static __read_mostly int sched_clock_running;
1612 --- a/lib/Kconfig.debug
1613 +++ b/lib/Kconfig.debug
1614 @@ -621,7 +621,7 @@ config FRAME_POINTER
1615 bool "Compile the kernel with frame pointers"
1616 depends on DEBUG_KERNEL && \
1617 (CRIS || M68K || M68KNOMMU || FRV || UML || \
1618 - AVR32 || SUPERH || BLACKFIN || MN10300) || \
1619 + AVR32 || SUPERH || BLACKFIN || MN10300 || UBICOM32) || \
1620 ARCH_WANT_FRAME_POINTERS
1621 default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS
1622 help
1623 --- a/mm/Makefile
1624 +++ b/mm/Makefile
1625 @@ -38,3 +38,5 @@ obj-$(CONFIG_SMP) += allocpercpu.o
1626 endif
1627 obj-$(CONFIG_QUICKLIST) += quicklist.o
1628 obj-$(CONFIG_CGROUP_MEM_RES_CTLR) += memcontrol.o page_cgroup.o
1629 +
1630 +CFLAGS_slab.o := $(PROFILING) -O2
1631 --- a/mm/slab.c
1632 +++ b/mm/slab.c
1633 @@ -4100,6 +4100,68 @@ out:
1634
1635 #ifdef CONFIG_SLABINFO
1636
1637 +
1638 +/*
1639 + * get info on all the memory allocated by slab for this named cache
1640 + */
1641 +int kmem_cache_block_info(char *name, struct kmem_cache_size_info *data, int max_data)
1642 +{
1643 + int res = 0;
1644 + int found = 0;
1645 + int node;
1646 + struct kmem_cache *cachep;
1647 + struct kmem_list3 *l3;
1648 + struct slab *slabp;
1649 +
1650 + /* Find the cache in the chain of caches. */
1651 + mutex_lock(&cache_chain_mutex);
1652 + list_for_each_entry(cachep, &cache_chain, next) {
1653 + if (strcmp(cachep->name, name) == 0) {
1654 + found = 1;
1655 + break;
1656 + }
1657 + }
1658 + mutex_unlock(&cache_chain_mutex);
1659 + if (!found) {
1660 + return 0;
1661 + }
1662 + for_each_online_node(node) {
1663 + l3 = cachep->nodelists[node];
1664 + if (!l3)
1665 + continue;
1666 + if (res >= max_data)
1667 + break;
1668 + check_irq_on();
1669 + spin_lock_irq(&l3->list_lock);
1670 +
1671 + list_for_each_entry(slabp, &l3->slabs_full, list) {
1672 + if (res >= max_data)
1673 + break;
1674 + data[res].page = ((unsigned int)slabp->s_mem >> PAGE_SHIFT) & 0xffff;
1675 + data[res].order = cachep->gfporder;
1676 + res++;
1677 + }
1678 + list_for_each_entry(slabp, &l3->slabs_partial, list) {
1679 + if (res >= max_data)
1680 + break;
1681 + data[res].page = ((unsigned int)slabp->s_mem >> PAGE_SHIFT) & 0xffff;
1682 + data[res].order = cachep->gfporder;
1683 + res++;
1684 + }
1685 + list_for_each_entry(slabp, &l3->slabs_free, list) {
1686 + if (res >= max_data)
1687 + break;
1688 + data[res].page = ((unsigned int)slabp->s_mem >> PAGE_SHIFT) & 0xffff;
1689 + data[res].order = cachep->gfporder;
1690 + res++;
1691 + }
1692 +
1693 + spin_unlock_irq(&l3->list_lock);
1694 + }
1695 +
1696 + return res;
1697 +}
1698 +
1699 static void print_slabinfo_header(struct seq_file *m)
1700 {
1701 /*
1702 --- a/scripts/mod/file2alias.c
1703 +++ b/scripts/mod/file2alias.c
1704 @@ -774,6 +774,15 @@ void handle_moddevtable(struct module *m
1705 + sym->st_value;
1706 }
1707
1708 + /*
1709 + * somehow our gcc is not generating st_size correctly and set 0 for some symbols.
1710 + * and 0 size will break do_table since it adjust size to (size - id_size)
1711 + * this is to make sure st_size fall in range.
1712 + */
1713 + if (sym->st_size == 0 || sym->st_size > info->sechdrs[sym->st_shndx].sh_size) {
1714 + sym->st_size = info->sechdrs[sym->st_shndx].sh_size;
1715 + }
1716 +
1717 if (sym_is(symname, "__mod_pci_device_table"))
1718 do_table(symval, sym->st_size,
1719 sizeof(struct pci_device_id), "pci",
1720 --- a/sound/Kconfig
1721 +++ b/sound/Kconfig
1722 @@ -82,6 +82,8 @@ source "sound/parisc/Kconfig"
1723
1724 source "sound/soc/Kconfig"
1725
1726 +source "sound/ubicom32/Kconfig"
1727 +
1728 endif # SND
1729
1730 menuconfig SOUND_PRIME
1731 --- a/sound/Makefile
1732 +++ b/sound/Makefile
1733 @@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND_PRIME) += sound_firmw
1734 obj-$(CONFIG_SOUND_PRIME) += oss/
1735 obj-$(CONFIG_DMASOUND) += oss/
1736 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
1737 - sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/
1738 + sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ ubicom32/
1739 obj-$(CONFIG_SND_AOA) += aoa/
1740
1741 # This one must be compilable even if sound is configured out