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