Develop and Download Open Source Software

Browse Subversion Repository

Contents of /patch-mipsel-oms400-2.6.32.56.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Mon Feb 20 16:24:37 2012 UTC (12 years ago) by yk700101
File MIME type: text/x-diff
File size: 88360 byte(s)
based on linux-2.6.26.8-005-obs.patch.bz2 by and src.tgz Plat'Home CO., LTD.
1 diff -urN linux-2.6.32.56.org/arch/mips/Kconfig linux-2.6.32.56/arch/mips/Kconfig
2 --- linux-2.6.32.56.org/arch/mips/Kconfig 2012-02-12 10:48:12.000000000 +0900
3 +++ linux-2.6.32.56/arch/mips/Kconfig 2012-02-14 23:59:14.000000000 +0900
4 @@ -740,6 +740,21 @@
5 config GENERIC_HARDIRQS_NO__DO_IRQ
6 def_bool y
7
8 +config OMS400_PUSHSW
9 + bool
10 + depends on MIPS && MIPS_OMS400
11 + default y
12 +
13 +config OMS400_LED
14 + bool
15 + depends on MIPS && MIPS_OMS400
16 + default y
17 +
18 +config OMS400_DIO
19 + bool
20 + depends on MIPS && MIPS_OMS400
21 + default y
22 +
23 #
24 # Select some configuration options automatically based on user selections.
25 #
26 @@ -1929,15 +1944,24 @@
27 config HZ_100
28 bool "100 HZ" if SYS_SUPPORTS_100HZ || SYS_SUPPORTS_ARBIT_HZ
29
30 + config HZ_125
31 + bool "125 HZ" if SYS_SUPPORTS_125HZ
32 +
33 config HZ_128
34 bool "128 HZ" if SYS_SUPPORTS_128HZ || SYS_SUPPORTS_ARBIT_HZ
35
36 + config HZ_200
37 + bool "200 HZ" if SYS_SUPPORTS_200HZ
38 +
39 config HZ_250
40 bool "250 HZ" if SYS_SUPPORTS_250HZ || SYS_SUPPORTS_ARBIT_HZ
41
42 config HZ_256
43 bool "256 HZ" if SYS_SUPPORTS_256HZ || SYS_SUPPORTS_ARBIT_HZ
44
45 + config HZ_500
46 + bool "500 HZ" if SYS_SUPPORTS_500HZ
47 +
48 config HZ_1000
49 bool "1000 HZ" if SYS_SUPPORTS_1000HZ || SYS_SUPPORTS_ARBIT_HZ
50
51 @@ -1952,15 +1976,24 @@
52 config SYS_SUPPORTS_100HZ
53 bool
54
55 +config SYS_SUPPORTS_125HZ
56 + bool
57 +
58 config SYS_SUPPORTS_128HZ
59 bool
60
61 +config SYS_SUPPORTS_200HZ
62 + bool
63 +
64 config SYS_SUPPORTS_250HZ
65 bool
66
67 config SYS_SUPPORTS_256HZ
68 bool
69
70 +config SYS_SUPPORTS_500HZ
71 + bool
72 +
73 config SYS_SUPPORTS_1000HZ
74 bool
75
76 @@ -1978,9 +2011,12 @@
77 int
78 default 48 if HZ_48
79 default 100 if HZ_100
80 + default 125 if HZ_125
81 default 128 if HZ_128
82 + default 200 if HZ_200
83 default 250 if HZ_250
84 default 256 if HZ_256
85 + default 500 if HZ_500
86 default 1000 if HZ_1000
87 default 1024 if HZ_1024
88
89 diff -urN linux-2.6.32.56.org/arch/mips/Makefile linux-2.6.32.56/arch/mips/Makefile
90 --- linux-2.6.32.56.org/arch/mips/Makefile 2012-02-12 10:48:12.000000000 +0900
91 +++ linux-2.6.32.56/arch/mips/Makefile 2012-02-16 00:18:28.000000000 +0900
92 @@ -259,6 +259,13 @@
93 load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000
94
95 +#
96 +# Plathome OMS-AL400/128
97 +#
98 +core-$(CONFIG_MIPS_OMS400) += arch/mips/alchemy/devboards/
99 +cflags-$(CONFIG_MIPS_OMS400) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
100 +load-$(CONFIG_MIPS_OMS400) += 0xffffffff80100000
101 +
102 #
103 # AMD Alchemy Db1200 eval board
104 #
105 core-$(CONFIG_MIPS_DB1200) += arch/mips/alchemy/devboards/
106 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/Kconfig linux-2.6.32.56/arch/mips/alchemy/Kconfig
107 --- linux-2.6.32.56.org/arch/mips/alchemy/Kconfig 2012-02-12 10:48:12.000000000 +0900
108 +++ linux-2.6.32.56/arch/mips/alchemy/Kconfig 2012-02-14 23:34:54.000000000 +0900
109 @@ -64,6 +64,25 @@
110 select MIPS_DISABLE_OBSOLETE_IDE
111 select SYS_SUPPORTS_LITTLE_ENDIAN
112
113 +config MIPS_OMS400
114 + bool "Plat'Home Open Micro Server based on AU1550/400"
115 + select SOC_AU1550
116 + select HW_HAS_PCI
117 + select DMA_NONCOHERENT
118 + select MIPS_DISABLE_OBSOLETE_IDE
119 + select RESOURCES_64BIT if PCI
120 + select SYS_HAS_CPU_MIPS32_R1
121 + select SYS_SUPPORTS_LITTLE_ENDIAN
122 + select OMS400_PUSHSW
123 + select OMS400_LED
124 + select OMS400_DIO
125 + select SYS_SUPPORTS_100HZ
126 + select SYS_SUPPORTS_125HZ
127 + select SYS_SUPPORTS_200HZ
128 + select SYS_SUPPORTS_250HZ
129 + select SYS_SUPPORTS_500HZ
130 + select SYS_SUPPORTS_1000HZ
131 +
132 config MIPS_MIRAGE
133 bool "Alchemy Mirage board"
134 select DMA_NONCOHERENT
135 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/common/platform.c linux-2.6.32.56/arch/mips/alchemy/common/platform.c
136 --- linux-2.6.32.56.org/arch/mips/alchemy/common/platform.c 2012-02-12 10:48:12.000000000 +0900
137 +++ linux-2.6.32.56/arch/mips/alchemy/common/platform.c 2012-02-14 23:50:15.000000000 +0900
138 @@ -46,9 +46,14 @@
139 PORT(UART1_ADDR, AU1100_UART1_INT),
140 PORT(UART3_ADDR, AU1100_UART3_INT),
141 #elif defined(CONFIG_SOC_AU1550)
142 +#ifdef CONFIG_MIPS_OMS400
143 + PORT(UART0_ADDR, AU1550_UART0_INT),
144 + PORT(UART3_ADDR, AU1550_UART3_INT),
145 +#else
146 PORT(UART0_ADDR, AU1550_UART0_INT),
147 PORT(UART1_ADDR, AU1550_UART1_INT),
148 PORT(UART3_ADDR, AU1550_UART3_INT),
149 +#endif
150 #elif defined(CONFIG_SOC_AU1200)
151 PORT(UART0_ADDR, AU1200_UART0_INT),
152 PORT(UART1_ADDR, AU1200_UART1_INT),
153 @@ -66,6 +71,7 @@
154 };
155
156 /* OHCI (USB full speed host controller) */
157 +#ifndef CONFIG_MIPS_OMS400
158 static struct resource au1xxx_usb_ohci_resources[] = {
159 [0] = {
160 .start = USB_OHCI_BASE,
161 @@ -92,6 +98,7 @@
162 .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources),
163 .resource = au1xxx_usb_ohci_resources,
164 };
165 +#endif
166
167 /*** AU1100 LCD controller ***/
168
169 @@ -333,7 +340,9 @@
170
171 static struct platform_device *au1xxx_platform_devices[] __initdata = {
172 &au1xx0_uart_device,
173 +#ifndef CONFIG_MIPS_OMS400
174 &au1xxx_usb_ohci_device,
175 +#endif
176 &au1x00_pcmcia_device,
177 #ifdef CONFIG_FB_AU1100
178 &au1100_lcd_device,
179 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/common/reset.c linux-2.6.32.56/arch/mips/alchemy/common/reset.c
180 --- linux-2.6.32.56.org/arch/mips/alchemy/common/reset.c 2012-02-12 10:48:12.000000000 +0900
181 +++ linux-2.6.32.56/arch/mips/alchemy/common/reset.c 2012-02-15 00:06:25.000000000 +0900
182 @@ -32,6 +32,12 @@
183 #include <asm/cacheflush.h>
184 #include <asm/mach-au1x00/au1000.h>
185
186 +#if defined(CONFIG_MIPS_OMS400) && defined(CONFIG_OMS400_LED)
187 +#include <linux/delay.h>
188 +#define BLINK_MSEC (1000)
189 +extern int obsled_out(int);
190 +#endif
191 +
192 void au1000_restart(char *command)
193 {
194 /* Set all integrated peripherals to disabled states */
195 @@ -161,6 +167,16 @@
196 while (1); /* should not get here */
197 #else
198 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
199 +#if defined(CONFIG_MIPS_OMS400) && defined(CONFIG_OMS400_LED)
200 + while(1) {
201 + obsled_out(7);
202 + au_sync();
203 + mdelay(BLINK_MSEC);
204 + obsled_out(0);
205 + au_sync();
206 + mdelay(BLINK_MSEC);
207 + }
208 +#endif
209 #ifdef CONFIG_MIPS_MIRAGE
210 gpio_direction_output(210, 1);
211 #endif
212 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/devboards/Makefile linux-2.6.32.56/arch/mips/alchemy/devboards/Makefile
213 --- linux-2.6.32.56.org/arch/mips/alchemy/devboards/Makefile 2012-02-12 10:48:12.000000000 +0900
214 +++ linux-2.6.32.56/arch/mips/alchemy/devboards/Makefile 2012-02-16 00:56:20.000000000 +0900
215 @@ -14,5 +14,6 @@
216 obj-$(CONFIG_MIPS_DB1200) += pb1200/
217 obj-$(CONFIG_MIPS_DB1500) += db1x00/
218 obj-$(CONFIG_MIPS_DB1550) += db1x00/
219 +obj-$(CONFIG_MIPS_OMS400) += db1x00/
220 obj-$(CONFIG_MIPS_BOSPORUS) += db1x00/
221 obj-$(CONFIG_MIPS_MIRAGE) += db1x00/
222 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/devboards/db1x00/board_setup.c linux-2.6.32.56/arch/mips/alchemy/devboards/db1x00/board_setup.c
223 --- linux-2.6.32.56.org/arch/mips/alchemy/devboards/db1x00/board_setup.c 2012-02-12 10:48:12.000000000 +0900
224 +++ linux-2.6.32.56/arch/mips/alchemy/devboards/db1x00/board_setup.c 2012-02-15 00:16:00.000000000 +0900
225 @@ -36,7 +36,9 @@
226 #include <prom.h>
227
228
229 +#ifndef CONFIG_MIPS_OMS400
230 static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
231 +#endif
232
233 const char *get_system_type(void)
234 {
235 @@ -50,7 +52,9 @@
236 void board_reset(void)
237 {
238 /* Hit BCSR.SW_RESET[RESET] */
239 +#ifndef CONFIG_MIPS_OMS400
240 bcsr->swreset = 0x0000;
241 +#endif
242 }
243
244 void __init board_setup(void)
245 @@ -96,7 +100,9 @@
246 au_sync();
247 }
248 #endif
249 +#ifndef CONFIG_MIPS_OMS400
250 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
251 +#endif
252
253 /* Enable GPIO[31:0] inputs */
254 alchemy_gpio1_input_enable();
255 @@ -145,4 +151,7 @@
256 #ifdef CONFIG_MIPS_DB1550
257 printk(KERN_INFO "AMD Alchemy Au1550/Db1550 Board\n");
258 #endif
259 +#ifdef CONFIG_MIPS_OMS400
260 + printk("Plat'Home OMS-AL400/128 based on AMD Alchemy Au1550/400\n");
261 +#endif
262 }
263 diff -urN linux-2.6.32.56.org/arch/mips/alchemy/devboards/db1x00/irqmap.c linux-2.6.32.56/arch/mips/alchemy/devboards/db1x00/irqmap.c
264 --- linux-2.6.32.56.org/arch/mips/alchemy/devboards/db1x00/irqmap.c 2012-02-12 10:48:12.000000000 +0900
265 +++ linux-2.6.32.56/arch/mips/alchemy/devboards/db1x00/irqmap.c 2012-02-15 01:01:18.000000000 +0900
266 @@ -62,10 +62,23 @@
267 };
268 #endif
269
270 +#ifdef CONFIG_MIPS_OMS400
271 +char irq_tab_alchemy[][5] __initdata = {
272 + [1] = { -1, INTD, INTD, INTD, INTD}, /* External PCI slot */
273 + [2] = { -1, INTC, INTC, INTC, INTX}, /* uPD720101 USB */
274 + [3] = { -1, INTB, INTX, INTX, INTX}, /* E1000 GBEther */
275 + [4] = { -1, INTA, INTX, INTX, INTX}, /* E1000 GBEther */
276 +};
277 +#endif
278
279 struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
280
281 #ifndef CONFIG_MIPS_MIRAGE
282 +#ifdef CONFIG_MIPS_OMS400
283 + { AU1000_GPIO_3, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 IRQ# */
284 + { AU1000_GPIO_15,IRQF_TRIGGER_HIGH,0 }, /* PUSH BUTTON IRQ# */
285 + { AU1500_GPIO_201_205,(IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING),0}, /* DIO in */
286 +#else
287 #ifdef CONFIG_MIPS_DB1550
288 { AU1000_GPIO_3, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 0 IRQ# */
289 { AU1000_GPIO_5, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 IRQ# */
290 @@ -78,6 +91,7 @@
291 { AU1000_GPIO_4, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 STSCHG# */
292 { AU1000_GPIO_5, IRQF_TRIGGER_LOW, 0 }, /* PCMCIA Card 1 IRQ# */
293 #endif
294 +#endif
295 #else
296 { AU1000_GPIO_7, IRQF_TRIGGER_RISING, 0 }, /* touchscreen pen down */
297 #endif
298 diff -urN linux-2.6.32.56.org/arch/mips/include/asm/dio_oms400.h linux-2.6.32.56/arch/mips/include/asm/dio_oms400.h
299 --- linux-2.6.32.56.org/arch/mips/include/asm/dio_oms400.h 1970-01-01 09:00:00.000000000 +0900
300 +++ linux-2.6.32.56/arch/mips/include/asm/dio_oms400.h 2012-02-14 12:01:36.000000000 +0900
301 @@ -0,0 +1,20 @@
302 +/*
303 + * This file is subject to the terms and conditions of the GNU General Public
304 + * License. See the file "COPYING" in the main directory of this archive
305 + * for more details.
306 + *
307 + * Copyright (C) 1995, 1996, 2001 Ralf Baechle
308 + * Copyright (C) 2001 MIPS Technologies, Inc.
309 + */
310 +#ifndef _DIO_OMS400_H
311 +#define _DIO_OMS400_H
312 +
313 +#include <asm/ioctl.h>
314 +
315 +#define DIOIOC_RD_DIN _IOR('D', 0x31, int)
316 +#define DIOIOC_WT_DOUT _IOW('D', 0x32, int)
317 +#define DIOIOC_RD_DOUT _IOR('D', 0x33, int)
318 +#define DIOIOC_WAITCHANGE _IOR('D', 0x34, int)
319 +#define DIOIOC_GETWAITPID _IOR('D', 0x35, int)
320 +
321 +#endif /* _DOI_OMS400_H */
322 diff -urN linux-2.6.32.56.org/arch/mips/include/asm/mach-au1x00/au1xxx.h linux-2.6.32.56/arch/mips/include/asm/mach-au1x00/au1xxx.h
323 --- linux-2.6.32.56.org/arch/mips/include/asm/mach-au1x00/au1xxx.h 2012-02-12 10:48:12.000000000 +0900
324 +++ linux-2.6.32.56/arch/mips/include/asm/mach-au1x00/au1xxx.h 2012-02-15 13:47:47.000000000 +0900
325 @@ -26,7 +26,8 @@
326 #include <asm/mach-au1x00/au1000.h>
327
328 #if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
329 - defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550)
330 + defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550) || \
331 + defined(CONFIG_MIPS_OMS400)
332 #include <asm/mach-db1x00/db1x00.h>
333
334 #elif defined(CONFIG_MIPS_PB1550)
335 diff -urN linux-2.6.32.56.org/arch/mips/include/asm/mach-db1x00/db1x00.h linux-2.6.32.56/arch/mips/include/asm/mach-db1x00/db1x00.h
336 --- linux-2.6.32.56.org/arch/mips/include/asm/mach-db1x00/db1x00.h 2012-02-12 10:48:12.000000000 +0900
337 +++ linux-2.6.32.56/arch/mips/include/asm/mach-db1x00/db1x00.h 2012-02-15 13:54:55.000000000 +0900
338 @@ -29,6 +29,7 @@
339
340 #include <asm/mach-au1x00/au1xxx_psc.h>
341
342 +#ifndef CONFIG_MIPS_OMS400
343 #ifdef CONFIG_MIPS_DB1550
344
345 #define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
346 @@ -176,4 +177,9 @@
347 #define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
348 #define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
349
350 +#else
351 +
352 +#define SMBUS_PSC_BASE PSC0_BASE_ADDR
353 +
354 +#endif /* CONFIG_MIPS_OMS400 */
355 #endif /* __ASM_DB1X00_H */
356 diff -urN linux-2.6.32.56.org/arch/mips/include/asm/pushsw_oms400.h linux-2.6.32.56/arch/mips/include/asm/pushsw_oms400.h
357 --- linux-2.6.32.56.org/arch/mips/include/asm/pushsw_oms400.h 1970-01-01 09:00:00.000000000 +0900
358 +++ linux-2.6.32.56/arch/mips/include/asm/pushsw_oms400.h 2012-02-14 12:01:36.000000000 +0900
359 @@ -0,0 +1,19 @@
360 +/*
361 + * Century <www.centurysys.co.jp>
362 + * - Century's push switch driver header
363 + */
364 +
365 +#include <linux/ioctl.h>
366 +#include <linux/major.h>
367 +/* #include <linux/miscdevice.h> */
368 +
369 +#define PUSHSW_MAJOR (MISC_MAJOR)
370 +
371 +#define PUSHSW_IOCTL_BASE 'P'
372 +
373 +#define PSWIOC_GETSTATUS _IOR(PUSHSW_IOCTL_BASE, 0, int)
374 +#define PSWIOC_WAITPUSH _IOR(PUSHSW_IOCTL_BASE, 1, int)
375 +#define PSWIOC_GETWAITPID _IOR(PUSHSW_IOCTL_BASE, 2, int)
376 +
377 +#define PSWIOF_PUSHED (1)
378 +#define PSWIOF_NOTPUSHED (0)
379 diff -urN linux-2.6.32.56.org/arch/mips/include/asm/unistd.h linux-2.6.32.56/arch/mips/include/asm/unistd.h
380 --- linux-2.6.32.56.org/arch/mips/include/asm/unistd.h 2012-02-12 10:48:12.000000000 +0900
381 +++ linux-2.6.32.56/arch/mips/include/asm/unistd.h 2012-02-15 13:59:12.000000000 +0900
382 @@ -994,10 +994,9 @@
383 #define __NR_N32_Linux 6000
384 #define __NR_N32_Linux_syscalls 299
385
386 -#ifdef __KERNEL__
387 -
388 #ifndef __ASSEMBLY__
389
390 +#ifdef __KERNEL__
391 #define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
392 #define __ARCH_WANT_IPC_PARSE_VERSION
393 #define __ARCH_WANT_OLD_READDIR
394 diff -urN linux-2.6.32.56.org/arch/mips/kernel/setup.c linux-2.6.32.56/arch/mips/kernel/setup.c
395 --- linux-2.6.32.56.org/arch/mips/kernel/setup.c 2012-02-12 10:48:12.000000000 +0900
396 +++ linux-2.6.32.56/arch/mips/kernel/setup.c 2012-02-15 09:23:20.000000000 +0900
397 @@ -169,6 +169,9 @@
398 if (!initrd_start || initrd_end <= initrd_start) {
399 #ifdef CONFIG_PROBE_INITRD_HEADER
400 u32 *initrd_header;
401 +#ifdef CONFIG_MIPS_OMS400
402 + extern u32 Initrd_Data;
403 +#endif
404
405 /*
406 * See if initrd has been added to the kernel image by
407 @@ -177,11 +180,19 @@
408 * word is a magic number and the second one is the size of
409 * initrd. Initrd start must be page aligned in any cases.
410 */
411 +#ifdef CONFIG_MIPS_OMS400
412 + initrd_header = &Initrd_Data;
413 + if (initrd_header[0] != 0x494E5244)
414 + goto disable;
415 + initrd_start = initrd_header[1];
416 + initrd_end = initrd_header[2];
417 +#else
418 initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + 8)) - 8;
419 if (initrd_header[0] != 0x494E5244)
420 goto disable;
421 initrd_start = (unsigned long)(initrd_header + 2);
422 initrd_end = initrd_start + initrd_header[1];
423 +#endif
424 #else
425 goto disable;
426 #endif
427 diff -urN linux-2.6.32.56.org/arch/mips/kernel/vmlinux.lds.S linux-2.6.32.56/arch/mips/kernel/vmlinux.lds.S
428 --- linux-2.6.32.56.org/arch/mips/kernel/vmlinux.lds.S 2012-02-12 10:48:12.000000000 +0900
429 +++ linux-2.6.32.56/arch/mips/kernel/vmlinux.lds.S 2012-02-15 23:10:13.000000000 +0900
430 @@ -112,6 +112,12 @@
431 __init_end = .;
432 /* freed after init ends here */
433
434 +#ifdef CONFIG_MIPS_OMS400
435 + . = ALIGN(PAGE_SIZE);
436 + .initrd_data : { *(.initrd_data) }
437 + . = ALIGN(PAGE_SIZE);
438 +#endif
439 +
440 BSS_SECTION(0, 0, 0)
441
442 _end = . ;
443 diff -urN linux-2.6.32.56.org/arch/mips/mm/init.c linux-2.6.32.56/arch/mips/mm/init.c
444 --- linux-2.6.32.56.org/arch/mips/mm/init.c 2012-02-12 10:48:12.000000000 +0900
445 +++ linux-2.6.32.56/arch/mips/mm/init.c 2012-02-15 09:29:28.000000000 +0900
446 @@ -438,7 +438,7 @@
447
448 ClearPageReserved(page);
449 init_page_count(page);
450 - memset(addr, POISON_FREE_INITMEM, PAGE_SIZE);
451 + memset(addr, 0x00, PAGE_SIZE);
452 __free_page(page);
453 totalram_pages++;
454 }
455 diff -urN linux-2.6.32.56.org/drivers/Makefile linux-2.6.32.56/drivers/Makefile
456 --- linux-2.6.32.56.org/drivers/Makefile 2012-02-12 10:48:12.000000000 +0900
457 +++ linux-2.6.32.56/drivers/Makefile 2012-02-15 09:39:38.000000000 +0900
458 @@ -40,6 +40,7 @@
459 obj-$(CONFIG_PARPORT) += parport/
460 obj-y += base/ block/ misc/ mfd/
461 obj-$(CONFIG_NUBUS) += nubus/
462 +obj-$(CONFIG_PCCARD) += pcmcia/
463 obj-y += macintosh/
464 obj-$(CONFIG_IDE) += ide/
465 obj-$(CONFIG_SCSI) += scsi/
466 @@ -54,7 +55,7 @@
467 obj-$(CONFIG_UIO) += uio/
468 obj-y += cdrom/
469 obj-y += auxdisplay/
470 -obj-$(CONFIG_PCCARD) += pcmcia/
471 +#obj-$(CONFIG_PCCARD) += pcmcia/
472 obj-$(CONFIG_DIO) += dio/
473 obj-$(CONFIG_SBUS) += sbus/
474 obj-$(CONFIG_ZORRO) += zorro/
475 diff -urN linux-2.6.32.56.org/drivers/char/Makefile linux-2.6.32.56/drivers/char/Makefile
476 --- linux-2.6.32.56.org/drivers/char/Makefile 2012-02-12 10:48:12.000000000 +0900
477 +++ linux-2.6.32.56/drivers/char/Makefile 2012-02-15 09:44:08.000000000 +0900
478 @@ -98,6 +98,9 @@
479 obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o
480 obj-$(CONFIG_GPIO_TB0219) += tb0219.o
481 obj-$(CONFIG_TELCLOCK) += tlclk.o
482 +obj-$(CONFIG_OMS400_PUSHSW) += pushsw_oms400.o
483 +obj-$(CONFIG_OMS400_LED) += led_oms400.o
484 +obj-$(CONFIG_OMS400_DIO) += dio_oms400.o
485
486 obj-$(CONFIG_MWAVE) += mwave/
487 obj-$(CONFIG_AGP) += agp/
488 diff -urN linux-2.6.32.56.org/drivers/char/dio_oms400.c linux-2.6.32.56/drivers/char/dio_oms400.c
489 --- linux-2.6.32.56.org/drivers/char/dio_oms400.c 1970-01-01 09:00:00.000000000 +0900
490 +++ linux-2.6.32.56/drivers/char/dio_oms400.c 2012-02-15 19:11:20.000000000 +0900
491 @@ -0,0 +1,198 @@
492 +/*
493 + * This program is free software; you can redistribute it and/or
494 + * modify it under the terms of the GNU General Public License
495 + * as published by the Free Software Foundation; either version
496 + * 2 of the License, or (at your option) any later version.
497 + *
498 + */
499 +
500 +#include <linux/module.h>
501 +#include <linux/sched.h>
502 +#include <linux/miscdevice.h>
503 +#include <linux/smp_lock.h>
504 +#include <linux/delay.h>
505 +#include <linux/proc_fs.h>
506 +#include <linux/capability.h>
507 +#include <linux/init.h>
508 +
509 +#include <asm/uaccess.h>
510 +#include <linux/types.h>
511 +#include <linux/interrupt.h>
512 +#include <linux/errno.h>
513 +#include <linux/kernel.h>
514 +#include <linux/fcntl.h>
515 +#include <asm/irq.h>
516 +#include <asm/ioctls.h>
517 +#include <asm/dio_oms400.h>
518 +#include <asm/io.h>
519 +#include <asm/mach-au1x00/au1000.h>
520 +#include <asm/mach-au1x00/gpio-au1000.h>
521 +
522 +#define DBGON(x) x
523 +#define DBGOFF(x)
524 +
525 +#define DIO_VER "0.01"
526 +#define DIO_IRQ AU1500_GPIO_201_205
527 +
528 +/*----------------------------------------------------------------------------
529 + * Prototypes.
530 + *----------------------------------------------------------------------------*/
531 +int dio_init(void);
532 +irqreturn_t dio_isr(int irq, void *dev_id, struct pt_regs *regs);
533 +static int dio_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
534 +static int dio_open(struct inode *inode, struct file *file);
535 +static int dio_release(struct inode *inode, struct file *file);
536 +
537 +/*----------------------------------------------------------------------------
538 + *----------------------------------------------------------------------------*/
539 +static struct file_operations dio_fops = {
540 + owner: THIS_MODULE,
541 + ioctl: dio_ioctl,
542 + open: dio_open,
543 + release: dio_release,
544 +};
545 +static struct miscdevice dio_miscdev =
546 + { OMS400DIO_MINOR, "dio", &dio_fops };
547 +static DECLARE_WAIT_QUEUE_HEAD(dio_wait);
548 +
549 +/* used to allow only one process at a time to "own" the DIO */
550 +static pid_t dio_wait_pid = 0;
551 +/*----------------------------------------------------------------------------
552 + *----------------------------------------------------------------------------*/
553 +int
554 +dio_init(void)
555 +{
556 + printk("DIO driver v%s\n", DIO_VER);
557 +
558 +#ifdef CONFIG_OMS400_DIO_ENABLE_IRQ
559 + /* Install the DIO interrupt handler */
560 + if (request_irq(DIO_IRQ, dio_isr, IRQF_IRQPOLL, "dio", NULL)) {
561 + printk("[dio_open] interrupt %u not free\n", DIO_IRQ);
562 + return (-EIO);
563 + }
564 + DBGOFF(printk("[dio_init] DIO installed on interrupt %u\n", DIO_IRQ);)
565 +#endif
566 + misc_register(&dio_miscdev);
567 + return (0);
568 +} /* dio_init() */
569 +
570 +/*----------------------------------------------------------------------------
571 + *----------------------------------------------------------------------------*/
572 +irqreturn_t
573 +dio_isr(int irq, void *dev_id, struct pt_regs *regs)
574 +{
575 + /* DBGOFF(printk(KERN_CRIT "p");) */
576 + wake_up_interruptible(&dio_wait);
577 + return IRQ_HANDLED;
578 +} /* dio_isr() */
579 +
580 +/*----------------------------------------------------------------------------
581 + *----------------------------------------------------------------------------*/
582 +static int
583 +dio_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
584 + unsigned long arg)
585 +{
586 + unsigned long flags;
587 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
588 + int val, mask, err;
589 +
590 + if (MINOR(inode->i_rdev) != OMS400DIO_MINOR) {
591 + return (-ENODEV);
592 + }
593 +
594 + switch (cmd) {
595 +#ifdef CONFIG_OMS400_DIO_ENABLE_IRQ
596 + case DIOIOC_GETWAITPID:
597 + return (put_user(dio_wait_pid, (int *) arg));
598 + case DIOIOC_WAITCHANGE:
599 + /* protect dio_wait_pid */
600 + spin_lock_irqsave(&driver_lock, flags);
601 + if (dio_wait_pid == 0) {
602 + dio_wait_pid = current->pid;
603 + spin_unlock_irqrestore(&driver_lock, flags);
604 + DBGOFF(printk("[dio_ioctl] DIOIOC_WAITCHANGE pid %u\n", dio_wait_pid);)
605 + /* block until DIN change */
606 + interruptible_sleep_on(&dio_wait);
607 + spin_lock_irqsave(&driver_lock, flags);
608 + dio_wait_pid = 0;
609 + spin_unlock_irqrestore(&driver_lock, flags);
610 +
611 + DBGOFF(printk("[dio_ioctl] unblocked\n");)
612 + if (signal_pending(current)) {
613 + DBGOFF(printk("[dio_ioctl] sig\n");)
614 + return (-ERESTARTSYS);
615 + }
616 + return (0);
617 + } else {
618 + spin_unlock_irqrestore(&driver_lock, flags);
619 + return (-EBUSY);
620 + }
621 +#endif
622 + case DIOIOC_RD_DIN:
623 + return (put_user((au_readl(GPIO2_PINSTATE) >> 1) & 0x0f, (int *) arg));
624 +
625 + case DIOIOC_WT_DOUT:
626 + err = get_user(val, (int *) arg);
627 + if (err)
628 + return err;
629 + mask = (val >> 16) & 0x0f;
630 + val &= 0x0f;
631 + au_writel ((val << 11) | (mask << 27), GPIO2_OUTPUT);
632 + return 0;
633 + case DIOIOC_RD_DOUT:
634 + return (put_user((au_readl(GPIO2_PINSTATE) >> 11) & 0x0f, (int *) arg));
635 + default:
636 + break;
637 + }
638 + return (-ENOIOCTLCMD);
639 +} /* dio_ioctl() */
640 +
641 +/*----------------------------------------------------------------------------
642 + *----------------------------------------------------------------------------*/
643 +static int
644 +dio_open(struct inode *inode, struct file *file)
645 +{
646 + switch (MINOR(inode->i_rdev)) {
647 + case OMS400DIO_MINOR:
648 +// MOD_INC_USE_COUNT;
649 + return (0);
650 + default:
651 + return (-ENODEV);
652 + }
653 +} /* dio_open() */
654 +
655 +/*----------------------------------------------------------------------------
656 + *----------------------------------------------------------------------------*/
657 +static int
658 +dio_release(struct inode *inode, struct file *file)
659 +{
660 + unsigned long flags;
661 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
662 +
663 + DBGOFF(printk("[dio_release] ");)
664 + if (MINOR(inode->i_rdev) == OMS400DIO_MINOR) {
665 + DBGOFF(printk("by pid %u\n", current->pid);)
666 + spin_lock_irqsave(&driver_lock, flags);
667 + if (dio_wait_pid && (dio_wait_pid == current->pid)) {
668 + dio_wait_pid = 0;
669 + spin_unlock_irqrestore(&driver_lock, flags);
670 + DBGOFF(printk("cleared\n");)
671 + } else {
672 + spin_unlock_irqrestore(&driver_lock, flags);
673 + DBGOFF(if (dio_wait_pid) printk("dio_wait_pid %u, current->pid %u\n", dio_wait_pid, current->pid);)
674 + }
675 +// MOD_DEC_USE_COUNT;
676 + }
677 + return (0);
678 +} /* dio_release() */
679 +
680 +static void
681 +dio_exit(void)
682 +{
683 + misc_deregister(&dio_miscdev);
684 +#ifdef CONFIG_OMS400_DIO_ENABLE_IRQ
685 + free_irq(DIO_IRQ, NULL);
686 +#endif
687 +} /* cleanup_module() */
688 +module_init(dio_init);
689 +module_exit(dio_exit);
690 diff -urN linux-2.6.32.56.org/drivers/char/generic_serial.c linux-2.6.32.56/drivers/char/generic_serial.c
691 --- linux-2.6.32.56.org/drivers/char/generic_serial.c 2012-02-12 10:48:12.000000000 +0900
692 +++ linux-2.6.32.56/drivers/char/generic_serial.c 2012-02-15 09:53:51.000000000 +0900
693 @@ -267,6 +267,8 @@
694 {
695 struct gs_port *port;
696 unsigned long flags;
697 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
698 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
699
700 func_enter ();
701
702 @@ -348,6 +350,7 @@
703 static void gs_shutdown_port (struct gs_port *port)
704 {
705 unsigned long flags;
706 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
707
708 func_enter();
709
710 @@ -509,6 +512,7 @@
711 {
712 unsigned long flags;
713 struct gs_port *port;
714 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
715
716 func_enter ();
717
718 diff -urN linux-2.6.32.56.org/drivers/char/led_oms400.c linux-2.6.32.56/drivers/char/led_oms400.c
719 --- linux-2.6.32.56.org/drivers/char/led_oms400.c 1970-01-01 09:00:00.000000000 +0900
720 +++ linux-2.6.32.56/drivers/char/led_oms400.c 2012-02-15 19:10:55.000000000 +0900
721 @@ -0,0 +1,147 @@
722 +/*
723 + * FILE NAME au1000_gpio.c
724 + *
725 + * BRIEF MODULE DESCRIPTION
726 + * Driver for Alchemy Au1000 GPIO.
727 + *
728 + * Author: MontaVista Software, Inc. <source@mvista.com>
729 + * Steve Longerbeam <stevel@mvista.com>
730 + *
731 + * Copyright 2001 MontaVista Software Inc.
732 + *
733 + * This program is free software; you can redistribute it and/or modify it
734 + * under the terms of the GNU General Public License as published by the
735 + * Free Software Foundation; either version 2 of the License, or (at your
736 + * option) any later version.
737 + *
738 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
739 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
740 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
741 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
742 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
743 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
744 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
745 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
746 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
747 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
748 + *
749 + * You should have received a copy of the GNU General Public License along
750 + * with this program; if not, write to the Free Software Foundation, Inc.,
751 + * 675 Mass Ave, Cambridge, MA 02139, USA.
752 + */
753 +
754 +#include <linux/module.h>
755 +#include <linux/types.h>
756 +#include <linux/kernel.h>
757 +#include <linux/miscdevice.h>
758 +#include <linux/init.h>
759 +#include <linux/fs.h>
760 +#include <asm/uaccess.h>
761 +#include <asm/io.h>
762 +#include <asm/mach-au1x00/au1000.h>
763 +#include <asm/mach-au1x00/gpio-au1000.h>
764 +
765 +#define VERSION "0.01"
766 +
767 +#define OMSLED_MINOR SEGLED_MINOR
768 +
769 +static int is_open = 0;
770 +
771 +/*
772 + * Return the pin state. Pins configured as outputs will return
773 + * the output state, and pins configured as inputs (tri-stated)
774 + * will return input pin state.
775 + */
776 +static int oms400led_in(u32 *val)
777 +{
778 + *val = (inl(SYS_PINSTATERD) >> 6) & 0x07;
779 + return 0;
780 +}
781 +
782 +/*
783 + * Set/clear GPIO pins. Only available GPIOs will be affected.
784 + */
785 +static int oms400led_out(u32 data)
786 +{
787 + int set, clr;
788 + set = (data & 0x07) << 6;
789 + clr = set ^ (0x07 << 6);
790 +
791 + if (set)
792 + au_writel(set, SYS_OUTPUTSET);
793 + if (clr)
794 + au_writel(clr, SYS_OUTPUTCLR);
795 + return 0;
796 +}
797 +
798 +static int oms400led_open(struct inode *inode, struct file *file)
799 +{
800 + is_open = 1;
801 + return 0;
802 +}
803 +
804 +static int oms400led_release(struct inode *inode, struct file *file)
805 +{
806 + is_open = 0;
807 + return 0;
808 +}
809 +
810 +static ssize_t oms400led_write(struct file *file, const char *buf, size_t count,
811 + loff_t *ppos)
812 +{
813 + int err, i, led;
814 +
815 + if (count <= 0)
816 + return 0;
817 +
818 + for (i = 0; i < count; i++) {
819 + err = get_user(led, buf + i);
820 + if (err)
821 + return err;
822 + if ((led < '0' ) || (led > '7'))
823 + continue;
824 + err = oms400led_out(led);
825 + if (err)
826 + return err;
827 + }
828 + return count;
829 +}
830 +
831 +static struct file_operations oms400led_fops =
832 +{
833 + .owner = THIS_MODULE,
834 + .write = oms400led_write,
835 + .open = oms400led_open,
836 + .release = oms400led_release,
837 +};
838 +
839 +
840 +static struct miscdevice oms400led_miscdev =
841 +{
842 + OMSLED_MINOR,
843 + "oms400 led",
844 + &oms400led_fops
845 +};
846 +
847 +int __init oms400led_init(void)
848 +{
849 + misc_register(&oms400led_miscdev);
850 + printk("OMS-AL400 LED driver, version %s\n", VERSION);
851 + return 0;
852 +}
853 +
854 +void __exit oms400led_exit(void)
855 +{
856 + misc_deregister(&oms400led_miscdev);
857 +}
858 +
859 +module_init(oms400led_init);
860 +module_exit(oms400led_exit);
861 +
862 +int obsled_out(int val)
863 +{
864 + int err;
865 +
866 + err = oms400led_out(val & 0x07);
867 + return err;
868 +}
869 diff -urN linux-2.6.32.56.org/drivers/char/pushsw_oms400.c linux-2.6.32.56/drivers/char/pushsw_oms400.c
870 --- linux-2.6.32.56.org/drivers/char/pushsw_oms400.c 1970-01-01 09:00:00.000000000 +0900
871 +++ linux-2.6.32.56/drivers/char/pushsw_oms400.c 2012-02-15 19:10:02.000000000 +0900
872 @@ -0,0 +1,193 @@
873 +/*
874 + * This program is free software; you can redistribute it and/or
875 + * modify it under the terms of the GNU General Public License
876 + * as published by the Free Software Foundation; either version
877 + * 2 of the License, or (at your option) any later version.
878 + *
879 + */
880 +
881 +#include <linux/module.h>
882 +#include <linux/sched.h>
883 +#include <linux/miscdevice.h>
884 +#include <linux/smp_lock.h>
885 +#include <linux/delay.h>
886 +#include <linux/proc_fs.h>
887 +#include <linux/capability.h>
888 +#include <linux/init.h>
889 +
890 +#include <asm/uaccess.h>
891 +#include <linux/types.h>
892 +#include <linux/interrupt.h>
893 +#include <linux/errno.h>
894 +#include <linux/kernel.h>
895 +#include <linux/fcntl.h>
896 +#include <asm/irq.h>
897 +#include <asm/pushsw_oms400.h>
898 +#include <asm/dio_oms400.h>
899 +#include <asm/io.h>
900 +#include <asm/mach-au1x00/au1000.h>
901 +#include <asm/mach-au1x00/gpio-au1000.h>
902 +
903 +//#define USE_DIN
904 +
905 +#define DBGON(x)
906 +#define DBGOFF(x) x
907 +
908 +#define PSW_VER "0.02"
909 +#ifdef USE_DIN
910 +#define PSW_IRQ AU1500_GPIO_201_205
911 +#define DIO_MASK 2
912 +#define DIO_CHECKV 0
913 +#else
914 +#define PSW_IRQ AU1000_GPIO_15
915 +#endif
916 +
917 +/*----------------------------------------------------------------------------
918 + * Prototypes.
919 + *----------------------------------------------------------------------------*/
920 +int psw_init(void);
921 +irqreturn_t psw_isr(int irq, void *dev_id);
922 +static int psw_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
923 +static int psw_open(struct inode *inode, struct file *file);
924 +static int psw_release(struct inode *inode, struct file *file);
925 +
926 +/*----------------------------------------------------------------------------
927 + *----------------------------------------------------------------------------*/
928 +static struct file_operations psw_fops = {
929 + owner: THIS_MODULE,
930 + ioctl: psw_ioctl,
931 + open: psw_open,
932 + release: psw_release,
933 +};
934 +static struct miscdevice psw_miscdev =
935 + { PUSHSW_MINOR, "pushsw", &psw_fops };
936 +static DECLARE_WAIT_QUEUE_HEAD(psw_wait);
937 +
938 +/* used to allow only one process at a time to "own" the push switch */
939 +static pid_t psw_wait_pid = 0;
940 +/*----------------------------------------------------------------------------
941 + *----------------------------------------------------------------------------*/
942 +int
943 +psw_init(void)
944 +{
945 + printk("Push switch driver v%s\n", PSW_VER);
946 +
947 + /* Install the push switch interrupt handler */
948 + if (request_irq(PSW_IRQ, psw_isr, IRQF_IRQPOLL, "push switch", NULL)) {
949 + printk("[psw_open] interrupt %u not free\n", PSW_IRQ);
950 + return (-EIO);
951 + }
952 + DBGOFF(printk("[psw_init] Push switch installed on interrupt %u\n", PSW_IRQ);)
953 + misc_register(&psw_miscdev);
954 + return (0);
955 +} /* psw_init() */
956 +
957 +/*----------------------------------------------------------------------------
958 + *----------------------------------------------------------------------------*/
959 +irqreturn_t
960 +psw_isr(int irq, void *dev_id)
961 +{
962 + /* DBGOFF(printk(KERN_CRIT "p");) */
963 + wake_up_interruptible(&psw_wait);
964 + return IRQ_HANDLED;
965 +} /* psw_isr() */
966 +
967 +/*----------------------------------------------------------------------------
968 + *----------------------------------------------------------------------------*/
969 +static int
970 +psw_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
971 + unsigned long arg)
972 +{
973 + unsigned long flags;
974 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
975 +
976 + if (MINOR(inode->i_rdev) != PUSHSW_MINOR) {
977 + return (-ENODEV);
978 + }
979 +
980 + switch (cmd) {
981 + case PSWIOC_GETWAITPID:
982 + return (put_user(psw_wait_pid, (int *) arg));
983 + case PSWIOC_WAITPUSH:
984 + /* protect psw_wait_pid */
985 + spin_lock_irqsave(&driver_lock, flags);
986 + if (psw_wait_pid == 0) {
987 + psw_wait_pid = current->pid;
988 + spin_unlock_irqrestore(&driver_lock, flags);
989 + DBGOFF(printk("[psw_ioctl] PSWIOC_WAITPUSH pid %u\n", psw_wait_pid);)
990 + /* block until switch pushed */
991 + while (1) {
992 + interruptible_sleep_on(&psw_wait);
993 +#ifdef USE_DIN
994 + msleep(5);
995 + if ((au_readl(GPIO2_PINSTATE) & DIO_MASK) == DIO_CHECKV)
996 +#endif
997 + break;
998 + }
999 + spin_lock_irqsave(&driver_lock, flags);
1000 + psw_wait_pid = 0;
1001 + spin_unlock_irqrestore(&driver_lock, flags);
1002 +
1003 + DBGOFF(printk("[psw_ioctl] unblocked\n");)
1004 + if (signal_pending(current)) {
1005 + DBGOFF(printk("[psw_ioctl] sig\n");)
1006 + return (-ERESTARTSYS);
1007 + }
1008 + return (0);
1009 + } else {
1010 + spin_unlock_irqrestore(&driver_lock, flags);
1011 + return (-EBUSY);
1012 + }
1013 + default:
1014 + break;
1015 + }
1016 + return (-ENOIOCTLCMD);
1017 +} /* psw_ioctl() */
1018 +
1019 +/*----------------------------------------------------------------------------
1020 + *----------------------------------------------------------------------------*/
1021 +static int
1022 +psw_open(struct inode *inode, struct file *file)
1023 +{
1024 + switch (MINOR(inode->i_rdev)) {
1025 + case PUSHSW_MINOR:
1026 +// MOD_INC_USE_COUNT;
1027 + return (0);
1028 + default:
1029 + return (-ENODEV);
1030 + }
1031 +} /* psw_open() */
1032 +
1033 +/*----------------------------------------------------------------------------
1034 + *----------------------------------------------------------------------------*/
1035 +static int
1036 +psw_release(struct inode *inode, struct file *file)
1037 +{
1038 + unsigned long flags;
1039 + spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
1040 +
1041 + DBGOFF(printk("[psw_release] ");)
1042 + if (MINOR(inode->i_rdev) == PUSHSW_MINOR) {
1043 + DBGOFF(printk("by pid %u\n", current->pid);)
1044 + spin_lock_irqsave(&driver_lock, flags);
1045 + if (psw_wait_pid && (psw_wait_pid == current->pid)) {
1046 + psw_wait_pid = 0;
1047 + spin_unlock_irqrestore(&driver_lock, flags);
1048 + DBGOFF(printk("cleared\n");)
1049 + } else {
1050 + spin_unlock_irqrestore(&driver_lock, flags);
1051 + DBGOFF(if (psw_wait_pid) printk("psw_wait_pid %u, current->pid %u\n", psw_wait_pid, current->pid);)
1052 + }
1053 +// MOD_DEC_USE_COUNT;
1054 + }
1055 + return (0);
1056 +} /* psw_release() */
1057 +
1058 +static void
1059 +psw_exit(void)
1060 +{
1061 + misc_deregister(&psw_miscdev);
1062 + free_irq(PSW_IRQ, NULL);
1063 +} /* cleanup_module() */
1064 +module_init(psw_init);
1065 +module_exit(psw_exit);
1066 diff -urN linux-2.6.32.56.org/drivers/i2c/busses/i2c-au1550.c linux-2.6.32.56/drivers/i2c/busses/i2c-au1550.c
1067 --- linux-2.6.32.56.org/drivers/i2c/busses/i2c-au1550.c 2012-02-12 10:48:12.000000000 +0900
1068 +++ linux-2.6.32.56/drivers/i2c/busses/i2c-au1550.c 2012-02-15 09:59:09.000000000 +0900
1069 @@ -401,6 +401,7 @@
1070 priv->ack_timeout = 200;
1071
1072 priv->adap.nr = pdev->id;
1073 + priv->adap.class = I2C_CLASS_HWMON;
1074 priv->adap.algo = &au1550_algo;
1075 priv->adap.algo_data = priv;
1076 priv->adap.dev.parent = &pdev->dev;
1077 diff -urN linux-2.6.32.56.org/drivers/i2c/chips/Kconfig linux-2.6.32.56/drivers/i2c/chips/Kconfig
1078 --- linux-2.6.32.56.org/drivers/i2c/chips/Kconfig 2012-02-12 10:48:12.000000000 +0900
1079 +++ linux-2.6.32.56/drivers/i2c/chips/Kconfig 2012-02-15 10:03:08.000000000 +0900
1080 @@ -16,6 +16,18 @@
1081 This driver can also be built as a module. If so, the module
1082 will be called ds1682.
1083
1084 +config OMS400_EEPROM
1085 + tristate "OMS400_EEPROM"
1086 + depends on I2C && MIPS_OMS400
1087 + help
1088 + OMS-AL400/128 EEPROM driver.
1089 +
1090 +config OMS400_RTC
1091 + tristate "OMS400_RTC"
1092 + depends on I2C && MIPS_OMS400
1093 + help
1094 + OMS-AL400/128 RTC driver.
1095 +
1096 config SENSORS_TSL2550
1097 tristate "Taos TSL2550 ambient light sensor"
1098 depends on EXPERIMENTAL
1099 diff -urN linux-2.6.32.56.org/drivers/i2c/chips/Makefile linux-2.6.32.56/drivers/i2c/chips/Makefile
1100 --- linux-2.6.32.56.org/drivers/i2c/chips/Makefile 2012-02-12 10:48:12.000000000 +0900
1101 +++ linux-2.6.32.56/drivers/i2c/chips/Makefile 2012-02-15 10:05:12.000000000 +0900
1102 @@ -12,6 +12,8 @@
1103
1104 obj-$(CONFIG_DS1682) += ds1682.o
1105 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
1106 +obj-$(CONFIG_OMS400_EEPROM) += eeprom-oms400.o
1107 +obj-$(CONFIG_OMS400_RTC) += r2025x-rtc.o
1108
1109 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
1110 EXTRA_CFLAGS += -DDEBUG
1111 diff -urN linux-2.6.32.56.org/drivers/i2c/chips/eeprom-oms400.c linux-2.6.32.56/drivers/i2c/chips/eeprom-oms400.c
1112 --- linux-2.6.32.56.org/drivers/i2c/chips/eeprom-oms400.c 1970-01-01 09:00:00.000000000 +0900
1113 +++ linux-2.6.32.56/drivers/i2c/chips/eeprom-oms400.c 2012-02-15 21:10:21.000000000 +0900
1114 @@ -0,0 +1,463 @@
1115 +/*
1116 + * linux/drivers/i2c/chips/eeprom-oms400.c.c
1117 + *
1118 + *
1119 + * Copyright
1120 + * Author: 2002 AXE Inc.
1121 + * takawata@axe-inc.co.jp
1122 + *
1123 + * This program is free software; you can redistribute it and/or modify it
1124 + * under the terms of the GNU General Public License as published by the
1125 + * Free Software Foundation; either version 2 of the License, or (at your
1126 + * option) any later version.
1127 + *
1128 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1129 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1130 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1131 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1132 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1133 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1134 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1135 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1136 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1137 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1138 + *
1139 + * You should have received a copy of the GNU General Public License along
1140 + * with this program; if not, write to the Free Software Foundation, Inc.,
1141 + * 675 Mass Ave, Cambridge, MA 02139, USA.
1142 + *
1143 + * TODO:
1144 + * - implement alarm and periodic IRQ support.
1145 + *
1146 + */
1147 +/*
1148 + * Based On
1149 + * linux/drivers/char/x1226-rtc.c
1150 + *
1151 + * I2C Real Time Clock Client Driver for Xicor X1226 RTC/Calendar
1152 + *
1153 + * Copyright 2002 MontaVista Software Inc.
1154 + * Author: MontaVista Software, Inc.
1155 + * stevel@mvista.com or source@mvista.com
1156 + *
1157 + * This program is free software; you can redistribute it and/or modify it
1158 + * under the terms of the GNU General Public License as published by the
1159 + * Free Software Foundation; either version 2 of the License, or (at your
1160 + * option) any later version.
1161 + *
1162 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1163 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1164 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1165 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1166 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1167 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1168 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1169 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1170 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1171 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1172 + *
1173 + * You should have received a copy of the GNU General Public License along
1174 + * with this program; if not, write to the Free Software Foundation, Inc.,
1175 + * 675 Mass Ave, Cambridge, MA 02139, USA.
1176 + *
1177 + * TODO:
1178 + * - implement alarm and periodic IRQ support.
1179 + *
1180 + */
1181 +#include <linux/module.h>
1182 +#include <linux/kernel.h>
1183 +#include <linux/types.h>
1184 +#include <linux/miscdevice.h>
1185 +#include <linux/fcntl.h>
1186 +#include <linux/poll.h>
1187 +#include <linux/fs.h>
1188 +#include <linux/init.h>
1189 +#include <linux/delay.h>
1190 +#include <linux/i2c.h>
1191 +#include <linux/slab.h>
1192 +#include <linux/string.h>
1193 +#include <linux/rtc.h>
1194 +#include <linux/proc_fs.h>
1195 +#include <linux/spinlock.h>
1196 +#include <asm/uaccess.h>
1197 +#include <asm/system.h>
1198 +#include <asm/time.h>
1199 +
1200 +#define EEPROM_MAJOR 240
1201 +#define EEPROM_T_WR 10
1202 +struct eepromi2c_private
1203 +{
1204 + u8 ei2_addr;
1205 + int ei2_size;
1206 + int ei2_maxpage;
1207 + int use_count;
1208 + unsigned char *tmpbuf;
1209 + struct i2c_client *ei2_i2c;
1210 +};
1211 +
1212 +static spinlock_t eeprom_state_lock = SPIN_LOCK_UNLOCKED;
1213 +
1214 +struct eepromi2c_private eepromi2c_conf[]=
1215 +{
1216 + {0x50, 0x200, 16, 0, NULL, NULL, NULL},
1217 +};
1218 +
1219 +#define MAXEEPROMDEVS (sizeof(eepromi2c_conf)/ sizeof(struct eepromi2c_private))
1220 +#ifndef I2C_M_WR
1221 +#define I2C_M_WR 0x0
1222 +#endif
1223 +
1224 +#ifdef DEBUG_I2CEEPROM
1225 +#define dbg(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
1226 +#else
1227 +#define dbg(fmt, args...)
1228 +#endif
1229 +
1230 +#define I2CEEPROM_MODULE_NAME "LARGEEEPROM"
1231 +#define PFX I2CEEPROM_MODULE_NAME
1232 +
1233 +#define err(format, arg...) printk(KERN_ERR PFX ": " format , ## arg)
1234 +#define info(format, arg...) printk(KERN_INFO PFX ": " format , ## arg)
1235 +#define warn(format, arg...) printk(KERN_WARNING PFX ": " format , ## arg)
1236 +#define emerg(format, arg...) printk(KERN_EMERG PFX ": " format , ## arg)
1237 +
1238 +//yamamoto static struct i2c_driver i2ceeprom_driver;
1239 +
1240 +static int i2ceeprom_read(struct i2c_client *client,
1241 + u16 reg_offset, u8 *buf, int len)
1242 +{
1243 + int ret;
1244 + u8 regbuf = reg_offset;
1245 + struct i2c_msg random_addr_read[2] = {
1246 + {
1247 + /* "Set Current Address" */
1248 + client->addr,
1249 + client->flags | I2C_M_WR,
1250 + 1,
1251 + &regbuf
1252 + },
1253 + {
1254 + /* "Sequential Read" if len>1,
1255 + "Current Address Read" if len=1 */
1256 + client->addr ,
1257 + client->flags| I2C_M_RD ,
1258 + len,
1259 + buf
1260 + }
1261 + };
1262 +
1263 + random_addr_read[0].addr |= (reg_offset >> 8) &0x07;;
1264 + random_addr_read[1].addr |= (reg_offset >> 8) &0x07;;
1265 +
1266 + dbg("i2c_transfer %04x %04x\n",random_addr_read[0].addr,regbuf);
1267 +
1268 + if ((ret = i2c_transfer(client->adapter, random_addr_read, 2)) != 2) {
1269 + ret = -ENXIO;
1270 + dbg("i2c_transfer failed\n");
1271 + }
1272 +
1273 + return ret;
1274 +}
1275 +
1276 +static int i2ceeprom_write(struct i2c_client *client,
1277 + u16 reg_offset, u8 *buf, int len)
1278 +{
1279 + int ret;
1280 + u8* local_buf;
1281 + struct i2c_msg page_write = {
1282 + client->addr,
1283 + client->flags ,
1284 + len + 1,
1285 + NULL
1286 + };
1287 +
1288 + if ((local_buf = (u8*)kmalloc(len + 1, GFP_KERNEL)) == NULL) {
1289 + err("buffer alloc failed\n");
1290 + return -ENOMEM;
1291 + }
1292 +
1293 + local_buf[0] = reg_offset;
1294 + memcpy(local_buf + 1, buf, len);
1295 + page_write.buf = local_buf;
1296 +
1297 + page_write.addr |= (reg_offset >> 8) &0x07;
1298 + dbg("i2c_transfer %04x %04x\n",page_write.addr,regbuf);
1299 +
1300 + if ((ret = i2c_transfer(client->adapter, &page_write, 1)) != 1) {
1301 + ret = -ENXIO;
1302 + dbg("i2c_transfer failed\n");
1303 + }
1304 +
1305 + msleep(EEPROM_T_WR);
1306 + kfree(local_buf);
1307 + return ret;
1308 +}
1309 +
1310 +static long long eepromi2c_llseek(struct file *file, loff_t offset, int origin)
1311 +{
1312 + int minor;
1313 + struct inode *minode = file->f_dentry->d_inode;
1314 + struct eepromi2c_private *pri;
1315 +
1316 + if ((minor = MINOR(minode->i_rdev)) >= MAXEEPROMDEVS)
1317 + return -ENXIO;
1318 + pri = &eepromi2c_conf[minor];
1319 + switch (origin) {
1320 + case 0:
1321 + file->f_pos = offset;
1322 + return file->f_pos;
1323 + case 1:
1324 + file->f_pos += offset;
1325 + return file->f_pos;
1326 + case 2:
1327 + file->f_pos = pri->ei2_size - offset;
1328 + return file->f_pos;
1329 + default:
1330 + return -EINVAL;
1331 + }
1332 +}
1333 +
1334 +static ssize_t eepromi2c_read(struct file *file, char *buf, size_t count,
1335 + loff_t *ppos)
1336 +{
1337 + int minor;
1338 + struct i2c_client *client;
1339 + struct eepromi2c_private *pri;
1340 + int offset, remaining, copysize;
1341 + struct inode *minode = file->f_dentry->d_inode;
1342 + if ((minor = MINOR(minode->i_rdev)) >= MAXEEPROMDEVS)
1343 + return -ENXIO;
1344 + pri = &eepromi2c_conf[minor];
1345 + if (!(client = pri->ei2_i2c))
1346 + return -ENXIO;
1347 + offset = *ppos;
1348 + offset += 16;
1349 + if ((offset + count) > pri->ei2_size)
1350 + count = pri->ei2_size - offset;
1351 + if (count <= 0) {
1352 + return 0;
1353 + }
1354 + remaining = count;
1355 + do {
1356 + copysize = (remaining > pri->ei2_maxpage)
1357 + ? pri->ei2_maxpage : remaining;
1358 + dbg("; copysize=%d\n", copysize);
1359 + i2ceeprom_read(client, offset, pri->tmpbuf, copysize);
1360 + if (copy_to_user(buf, pri->tmpbuf, copysize))
1361 + return -EFAULT;
1362 + *ppos += copysize;
1363 + offset += copysize;
1364 + buf += copysize;
1365 + remaining -= copysize;
1366 + } while (remaining > 0);
1367 + return count;
1368 +}
1369 +
1370 +static ssize_t eepromi2c_write(struct file *file, const char *buf, size_t count,
1371 + loff_t *ppos)
1372 +{
1373 + int minor;
1374 + struct i2c_client *client;
1375 + struct eepromi2c_private *pri;
1376 + int offset, remaining, copysize;
1377 + struct inode *minode = file->f_dentry->d_inode;
1378 + if ((minor = MINOR(minode->i_rdev)) >= MAXEEPROMDEVS)
1379 + return -ENXIO;
1380 + pri = &eepromi2c_conf[minor];
1381 + if (!(client = pri->ei2_i2c))
1382 + return -ENXIO;
1383 + offset = *ppos;
1384 + offset += 16;
1385 + if ((offset + count) > pri->ei2_size)
1386 + count = pri->ei2_size - offset;
1387 + if (count <= 0) {
1388 + return 0;
1389 + }
1390 + /*Write regeon should be aligned */
1391 + copysize = (count > pri->ei2_maxpage) ? pri->ei2_maxpage : count;
1392 + if ((offset / pri->ei2_maxpage) !=
1393 + ((offset + copysize) / pri->ei2_maxpage))
1394 + copysize = pri->ei2_maxpage - (offset % pri->ei2_maxpage);
1395 + dbg("; offset=%d\n", offset);
1396 + remaining = count;
1397 + do {
1398 + dbg("; copysize=%d\n", copysize);
1399 + if (copy_from_user(pri->tmpbuf, buf, copysize)) {
1400 + return -EFAULT;
1401 + }
1402 +
1403 + i2ceeprom_write(client, offset, pri->tmpbuf, copysize);
1404 + *ppos += copysize;
1405 + offset += copysize;
1406 + buf += copysize;
1407 + remaining -= copysize;
1408 + copysize = (remaining > pri->ei2_maxpage)
1409 + ? pri->ei2_maxpage : remaining;
1410 + } while (remaining > 0);
1411 + return count;
1412 +}
1413 +
1414 +static int eepromi2c_open(struct inode *minode, struct file *mfile)
1415 +{
1416 + int minor;
1417 + spin_lock(&eeprom_state_lock);
1418 + if ((minor = MINOR(minode->i_rdev)) >= MAXEEPROMDEVS)
1419 + return -ENXIO;
1420 + if (!eepromi2c_conf[minor].ei2_i2c)
1421 + return -ENXIO;
1422 +
1423 + if (eepromi2c_conf[minor].use_count)
1424 + return -EBUSY;
1425 + eepromi2c_conf[minor].use_count++;
1426 + spin_unlock(&eeprom_state_lock);
1427 + return 0;
1428 +}
1429 +
1430 +static int eepromi2c_ioctl(struct inode *inode, struct file *file,
1431 + unsigned int cmd, unsigned long arg)
1432 +{
1433 + return -ENOTTY;
1434 +}
1435 +
1436 +static int eepromi2c_release(struct inode *inode, struct file *file)
1437 +{
1438 + int minor;
1439 + spin_lock(&eeprom_state_lock);
1440 + if ((minor = MINOR(inode->i_rdev)) >= MAXEEPROMDEVS)
1441 + return -ENXIO;
1442 + eepromi2c_conf[minor].use_count--;
1443 + spin_unlock(&eeprom_state_lock);
1444 + return 0;
1445 +}
1446 +
1447 +static struct file_operations eepromi2c_fops = {
1448 + owner: THIS_MODULE,
1449 + llseek: eepromi2c_llseek,
1450 + read: eepromi2c_read,
1451 + write: eepromi2c_write,
1452 + ioctl: eepromi2c_ioctl,
1453 + open: eepromi2c_open,
1454 + release: eepromi2c_release,
1455 +};
1456 +
1457 +//yamamoto -->
1458 +//yamamoto static int i2ceeprom_probe(struct i2c_adapter *adap)
1459 +static int i2ceeprom_probe(struct i2c_client *client, const struct i2c_device_id *id)
1460 +//yamamoto <--
1461 +{
1462 + int res, i;
1463 + int ret = 1;
1464 +#if 0
1465 + char nbuffer[15];
1466 +#endif
1467 + unsigned char stat;
1468 + struct i2c_client *this_client;
1469 +
1470 + res = -ENXIO;
1471 + register_chrdev(EEPROM_MAJOR, "eeprom", &eepromi2c_fops);
1472 +
1473 + this_client = kmalloc(sizeof(*this_client), GFP_KERNEL);
1474 +
1475 + for (i = 0; i < MAXEEPROMDEVS; i++) {
1476 + if (this_client == NULL) {
1477 + break;
1478 + }
1479 +
1480 + memset(this_client, 0, sizeof(*this_client));
1481 +
1482 +//yamamoto -->
1483 + this_client = client;
1484 +//yamamoto <--
1485 +
1486 +//yamamoto strcpy(this_client->name, I2CEEPROM_MODULE_NAME);
1487 +//yamamoto this_client->flags = 0;
1488 +//yamamoto this_client->addr = eepromi2c_conf[i].ei2_addr;
1489 +//yamamoto this_client->adapter = adap;
1490 +//yamamoto this_client->driver = &i2ceeprom_driver;
1491 +
1492 + if ((res = i2ceeprom_read(this_client, 0, &stat, 1)) < 0) {
1493 + printk("Probe read %d\n", res);
1494 + continue;
1495 + }
1496 +
1497 + if ((eepromi2c_conf[i].tmpbuf =
1498 + kmalloc(eepromi2c_conf[i].ei2_size, GFP_KERNEL)) == NULL) {
1499 + continue;
1500 + }
1501 +
1502 + printk("Serial EEPROM FOUND at %x\n", this_client->addr);
1503 +//yamamoto if (i2c_attach_client(this_client)) {
1504 +//yamamoto continue;
1505 +//yamamoto }
1506 + eepromi2c_conf[i].ei2_i2c = this_client;
1507 + ret = 0; /*At least 1 dev found */
1508 + this_client = kmalloc(sizeof(*this_client), GFP_KERNEL);
1509 + }
1510 + kfree(this_client);
1511 + return ret;
1512 +}
1513 +
1514 +//yamamoto -->
1515 +//yamamoto static int i2ceeprom_detach(struct i2c_client *client)
1516 +static int i2ceeprom_remove(struct i2c_client *client)
1517 +//yamamoto <--
1518 +{
1519 +//yamamoto i2c_detach_client(client);
1520 +
1521 + kfree(client);
1522 +
1523 + return 0;
1524 +}
1525 +
1526 +static int i2ceeprom_command(struct i2c_client *client, unsigned int cmd,
1527 + void *arg)
1528 +{
1529 +
1530 + return -EINVAL;
1531 +}
1532 +
1533 +//yamamoto -->
1534 +static struct i2c_device_id i2ceeprom_idtable[] = {
1535 + { "i2ceeprom", 0 },
1536 + { }
1537 +};
1538 +
1539 +MODULE_DEVICE_TABLE(i2c, i2ceeprom_idtable);
1540 +//yamamoto <--
1541 +
1542 +static struct i2c_driver i2ceeprom_driver = {
1543 + .driver = {
1544 + .name = I2CEEPROM_MODULE_NAME,
1545 + },
1546 +//yamamoto -->
1547 + .id_table = i2ceeprom_idtable,
1548 + .probe = i2ceeprom_probe,
1549 + .remove = __devexit_p(i2ceeprom_remove),
1550 +//yamamoto .id = I2C_DRIVERID_LARGEEEPROM,
1551 +//yamamoto .attach_adapter = i2ceeprom_probe,
1552 +//yamamoto .detach_client = i2ceeprom_detach,
1553 +//yamamoto <--
1554 + .command = i2ceeprom_command
1555 +};
1556 +
1557 +
1558 +static __init int i2ceeprom_init(void)
1559 +{
1560 + int ret;
1561 +
1562 + info("I2C based EEPROM driver.\n");
1563 + ret = i2c_add_driver(&i2ceeprom_driver);
1564 + if (ret) {
1565 + err("Register I2C driver failed, errno is %d\n", ret);
1566 + return ret;
1567 + }
1568 + return 0;
1569 +}
1570 +
1571 +static void __exit i2ceeprom_exit(void)
1572 +{
1573 + i2c_del_driver(&i2ceeprom_driver);
1574 +}
1575 +
1576 +module_init(i2ceeprom_init);
1577 +module_exit(i2ceeprom_exit);
1578 diff -urN linux-2.6.32.56.org/drivers/i2c/chips/r2025x-rtc.c linux-2.6.32.56/drivers/i2c/chips/r2025x-rtc.c
1579 --- linux-2.6.32.56.org/drivers/i2c/chips/r2025x-rtc.c 1970-01-01 09:00:00.000000000 +0900
1580 +++ linux-2.6.32.56/drivers/i2c/chips/r2025x-rtc.c 2012-02-15 21:31:34.000000000 +0900
1581 @@ -0,0 +1,506 @@
1582 +/*
1583 + * linux/drivers/i2c/chips/r2025x-rtc.c
1584 + *
1585 + * I2C Real Time Clock Client Driver for Xicor R2025x RTC/Calendar
1586 + *
1587 + * Copyright 2002 MontaVista Software Inc.
1588 + * Author: MontaVista Software, Inc.
1589 + * stevel@mvista.com or source@mvista.com
1590 + *
1591 + * This program is free software; you can redistribute it and/or modify it
1592 + * under the terms of the GNU General Public License as published by the
1593 + * Free Software Foundation; either version 2 of the License, or (at your
1594 + * option) any later version.
1595 + *
1596 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1597 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1598 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
1599 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1600 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1601 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
1602 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1603 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1604 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
1605 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1606 + *
1607 + * You should have received a copy of the GNU General Public License along
1608 + * with this program; if not, write to the Free Software Foundation, Inc.,
1609 + * 675 Mass Ave, Cambridge, MA 02139, USA.
1610 + *
1611 + * TODO:
1612 + * - implement alarm and periodic IRQ support.
1613 + *
1614 + */
1615 +#include <linux/delay.h>
1616 +#include <linux/module.h>
1617 +#include <linux/kernel.h>
1618 +#include <linux/types.h>
1619 +#include <linux/miscdevice.h>
1620 +#include <linux/fcntl.h>
1621 +#include <linux/poll.h>
1622 +#include <linux/fs.h>
1623 +#include <linux/init.h>
1624 +#include <linux/i2c.h>
1625 +#include <linux/slab.h>
1626 +#include <linux/string.h>
1627 +#include <linux/rtc.h>
1628 +#include <linux/proc_fs.h>
1629 +#include <linux/spinlock.h>
1630 +#include <asm/uaccess.h>
1631 +#include <asm/system.h>
1632 +#include <asm/time.h>
1633 +
1634 +#ifdef DEBUG_R2025x
1635 +#define dbg(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __func__, ## args)
1636 +#else
1637 +#define dbg(fmt, args...)
1638 +#endif
1639 +
1640 +#define R2025x_MODULE_NAME "R2025x"
1641 +#define PFX R2025x_MODULE_NAME
1642 +
1643 +#define err(format, arg...) printk(KERN_ERR PFX ": " format , ## arg)
1644 +#define info(format, arg...) printk(KERN_INFO PFX ": " format , ## arg)
1645 +#define warn(format, arg...) printk(KERN_WARNING PFX ": " format , ## arg)
1646 +#define emerg(format, arg...) printk(KERN_EMERG PFX ": " format , ## arg)
1647 +
1648 +
1649 +#define R2025x_RTC_SR 0x3f
1650 +#define RTC_SR_RTCF (1)
1651 +#define RTC_SR_WEL (1<<1)
1652 +#define RTC_SR_RWEL (1<<2)
1653 +
1654 +#define R2025x_RTC_BASE 0x00
1655 +
1656 +/* This is an image of the RTC registers starting at offset 0x30 */
1657 +struct rtc_registers {
1658 + unsigned char secs; // 00
1659 + unsigned char mins; // 01
1660 + unsigned char hours; // 02
1661 + unsigned char dayofweek;// 03
1662 + unsigned char day; // 04
1663 + unsigned char mon; // 05
1664 + unsigned char year; // 06
1665 + unsigned char adjust; // 07
1666 + unsigned char almwmin; // 08
1667 + unsigned char almwhours;// 09
1668 + unsigned char almwdow; // 0a
1669 + unsigned char almdmin; // 0b
1670 + unsigned char almdhours;// 0c
1671 + unsigned char dummy; // 0d
1672 + unsigned char ctrl1; // 0e
1673 + unsigned char ctrl2; // 0f
1674 +};
1675 +
1676 +#define RTC_ACCESS_WAIT 100
1677 +#define DEVID_RTC 0x32
1678 +#define SLAVE_READ 0x01
1679 +#ifndef I2C_M_WR
1680 +#define I2C_M_WR 0x0
1681 +#endif
1682 +
1683 +//yamamoto static struct i2c_driver r2025x_driver;
1684 +
1685 +static int r2025x_use_count = 0;
1686 +
1687 +static struct i2c_client *this_client = NULL;
1688 +
1689 +static int rtc_read_proc(char *page, char **start, off_t off,
1690 + int count, int *eof, void *data);
1691 +
1692 +static int r2025x_read (struct i2c_client *client,
1693 + u8 reg_offset, u8* buf, int len)
1694 +{
1695 + u8* local_buf;
1696 + int ret;
1697 + struct i2c_msg random_addr_read;
1698 +
1699 + if (reg_offset > 15)
1700 + return -EINVAL;
1701 + if (reg_offset + len > 16)
1702 + return -EINVAL;
1703 +
1704 + if ((local_buf = (u8*)kmalloc(sizeof(struct rtc_registers) + 1,
1705 + GFP_KERNEL)) == NULL) {
1706 + err("buffer alloc failed\n");
1707 + return -ENOMEM;
1708 + }
1709 +
1710 + random_addr_read.addr = client->addr;
1711 + random_addr_read.flags = client->flags| I2C_M_RD;
1712 + random_addr_read.len = 16;
1713 + random_addr_read.buf = local_buf;
1714 +
1715 + if ((ret = i2c_transfer(client->adapter, &random_addr_read, 1)) != 1) {
1716 + dbg("i2c_transfer failed %08x\n",ret);
1717 + ret = -ENXIO;
1718 + }
1719 +
1720 + local_buf[16] = local_buf[0];
1721 + memcpy(buf, local_buf + 1 + reg_offset, len);
1722 +
1723 + kfree(local_buf);
1724 + udelay(RTC_ACCESS_WAIT);
1725 + return ret;
1726 +}
1727 +
1728 +static int r2025x_write (struct i2c_client *client,
1729 + u8 reg_offset, u8* buf, int len)
1730 +{
1731 + int ret;
1732 + u8* local_buf;
1733 + struct i2c_msg page_write = {
1734 + client->addr,
1735 + client->flags ,
1736 + len,
1737 + NULL
1738 + };
1739 +
1740 + if (reg_offset > 15)
1741 + return -EINVAL;
1742 + if (reg_offset + len > 16)
1743 + return -EINVAL;
1744 +
1745 + if ((local_buf = (u8*)kmalloc(len + 1,
1746 + GFP_KERNEL)) == NULL) {
1747 + err("buffer alloc failed\n");
1748 + return -ENOMEM;
1749 + }
1750 +
1751 + local_buf[0] = reg_offset;
1752 + memcpy(local_buf + 1, buf, len);
1753 + page_write.buf = local_buf;
1754 +
1755 + if ((ret = i2c_transfer(client->adapter, &page_write, 1)) != 1) {
1756 + ret = -ENXIO;
1757 + dbg("i2c_transfer failed\n");
1758 + }
1759 +
1760 + kfree(local_buf);
1761 + udelay(RTC_ACCESS_WAIT);
1762 + return ret;
1763 +}
1764 +
1765 +static int
1766 +r2025x_get_time(struct i2c_client *client, struct rtc_time *tm)
1767 +{
1768 + struct rtc_registers rtc;
1769 + int ret;
1770 +
1771 + /* read RTC registers */
1772 + if ((ret = r2025x_read(client, R2025x_RTC_BASE, (u8*)&rtc,
1773 + sizeof(struct rtc_registers))) < 0) {
1774 + dbg("couldn't read RTC\n");
1775 + return ret;
1776 + }
1777 + dbg("IN: year=%02x, mon=%02x, day=%02x, hour=%02x, "
1778 + "min=%02x, sec=%02x\n",
1779 + rtc.year, rtc.mon, rtc.day, rtc.hours,
1780 + rtc.mins, rtc.secs);
1781 +
1782 + tm->tm_year = ((rtc.year >>4 ) & 0xf) *10 + (rtc.year & 0x0f);
1783 + if (rtc.mon & 0x80)
1784 + tm->tm_year += 100;
1785 + tm->tm_mon = ((rtc.mon >>4 ) & 0x1) *10 + (rtc.mon & 0x0f);
1786 + tm->tm_mon--; /* tm_mon is 0 to 11 */
1787 + tm->tm_mday = ((rtc.day >>4 ) & 0x3) *10 + (rtc.day & 0x0f);
1788 + tm->tm_hour = ((rtc.hours >>4 ) & 0x7) *10 + (rtc.hours & 0x0f);
1789 + if ((rtc.ctrl1 & 0x20) == 0) {
1790 + tm->tm_hour = ((rtc.hours >>4 ) & 0x1) *10 + (rtc.hours & 0x0f);
1791 + if (rtc.hours & 0x20)
1792 + tm->tm_hour += 12;
1793 + } else {
1794 + tm->tm_hour = ((rtc.hours >>4 ) & 0x3) *10 + (rtc.hours & 0x0f);
1795 + }
1796 + tm->tm_min = ((rtc.mins >>4 ) & 0x7) *10 + (rtc.mins & 0x0f);
1797 + tm->tm_sec = ((rtc.secs >>4 ) & 0x7) *10 + (rtc.secs & 0x0f);
1798 +
1799 + dbg("OUT: year=%d, mon=%d, day=%d, hour=%d, min=%d, sec=%d\n",
1800 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour,
1801 + tm->tm_min, tm->tm_sec);
1802 +
1803 + return 0;
1804 +}
1805 +
1806 +static int
1807 +r2025x_set_time(struct i2c_client *client, const struct rtc_time *tm)
1808 +{
1809 + struct rtc_registers rtc;
1810 + int ret;
1811 + int tmpy;
1812 +
1813 + dbg("IN: year=%d, mon=%d, day=%d, hour=%d, min=%d, sec=%d\n",
1814 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour,
1815 + tm->tm_min, tm->tm_sec);
1816 +
1817 + tmpy = tm->tm_year % 100;
1818 +
1819 + rtc.year = (((tmpy / 10) << 4) | (tmpy % 10));
1820 + rtc.mon = ((((tm->tm_mon + 1) / 10) << 4) | ((tm->tm_mon + 1) % 10)) & 0x3f;
1821 + if (tm->tm_year >= 100)
1822 + rtc.mon |= 0x80;
1823 + rtc.day = (((tm->tm_mday / 10) << 4) | (tm->tm_mday % 10)) & 0x3f;
1824 + rtc.dayofweek = 0; // ignore day of week
1825 + rtc.hours = (((tm->tm_hour / 10) << 4) | (tm->tm_hour % 10)) & 0x3f;
1826 + rtc.mins = (((tm->tm_min / 10) << 4) | (tm->tm_min % 10)) & 0x7f;
1827 + rtc.secs = (((tm->tm_sec / 10) << 4) | (tm->tm_sec % 10)) & 0x7f;
1828 +
1829 + dbg("OUT: year=%02x, mon=%02x, day=%02x, hour=%02x, "
1830 + "min=%02x, sec=%02x\n",
1831 + rtc.year, rtc.mon, rtc.day, rtc.hours,
1832 + rtc.mins, rtc.secs);
1833 +
1834 + /* write RTC registers */
1835 + if ((ret = r2025x_write(client, R2025x_RTC_BASE, (u8*)&rtc, 8)) < 0) {
1836 + dbg("couldn't write RTC\n");
1837 + return ret;
1838 + }
1839 +
1840 + return 0;
1841 +}
1842 +
1843 +//yamamoto -->
1844 +//yamamoto static int
1845 +//yamamoto r2025x_probe(struct i2c_adapter *adap)
1846 +static int r2025x_probe(struct i2c_client *client, const struct i2c_device_id *id)
1847 +//yamamoto <--
1848 +{
1849 + int ret;
1850 + struct rtc_registers rtc;
1851 +
1852 + if (this_client != NULL)
1853 + return -EBUSY;
1854 +
1855 + this_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
1856 + if (this_client == NULL) {
1857 + return -ENOMEM;
1858 + }
1859 +
1860 + memset(this_client, 0, sizeof(struct i2c_client));
1861 +
1862 +//yamamoto -->
1863 + this_client = client;
1864 +//yamamoto <--
1865 +
1866 +//yamamoto strcpy(this_client->name, R2025x_MODULE_NAME);
1867 +//yamamoto this_client->flags = 0;
1868 +//yamamoto this_client->addr = DEVID_RTC;
1869 +//yamamoto this_client->adapter = adap;
1870 +//yamamoto this_client->driver = &r2025x_driver;
1871 +
1872 + /*
1873 + * use r2025x_get_time() to probe for an R2025x on this bus.
1874 + */
1875 + dbg("r2025x_probe Entry %08x\n",(u32)this_client);
1876 + if((ret = r2025x_read(this_client,R2025x_RTC_BASE, (u8 *)&rtc,
1877 + sizeof(struct rtc_registers)))< 0){
1878 + dbg("r2025x_probe r2025x_read error\n");
1879 + kfree(this_client);
1880 + this_client = NULL;
1881 + return ret;
1882 + }
1883 +
1884 +//yamamoto info("found R2025x on %s\n", adap->name);
1885 +
1886 +//yamamoto -->
1887 +//yamamoto /* attach it. */
1888 +//yamamoto dbg("r2025x_probe i2c_attach_client call\n");
1889 +//yamamoto ret = i2c_attach_client(this_client);
1890 +//yamamoto dbg("r2025x_probe i2c_attach_client call ret=%d\n",ret);
1891 +//yamamoto <--
1892 + return ret;
1893 +}
1894 +
1895 +//yamamoto -->
1896 +//yamamoto static int
1897 +//yamamoto r2025x_detach(struct i2c_client *client)
1898 +static int r2025x_remove(struct i2c_client *client)
1899 +//yamamoto <--
1900 +{
1901 +//yamamoto i2c_detach_client(client);
1902 +
1903 + if (this_client != NULL) {
1904 + kfree(this_client);
1905 + this_client = NULL;
1906 + }
1907 +
1908 + return 0;
1909 +}
1910 +
1911 +int rtc_open(struct inode *minode, struct file *mfile)
1912 +{
1913 + /*if(MOD_IN_USE)*/
1914 + if(r2025x_use_count > 0) {
1915 + return -EBUSY;
1916 + }
1917 +// MOD_INC_USE_COUNT;
1918 + ++r2025x_use_count;
1919 + return 0;
1920 +}
1921 +
1922 +int rtc_release(struct inode *minode, struct file *mfile)
1923 +{
1924 +// MOD_DEC_USE_COUNT;
1925 + --r2025x_use_count;
1926 + return 0;
1927 +}
1928 +
1929 +static loff_t rtc_llseek(struct file *mfile, loff_t offset, int origint)
1930 +{
1931 + return -ESPIPE;
1932 +}
1933 +
1934 +static int
1935 +r2025x_command(struct i2c_client *client, unsigned int cmd, void *arg)
1936 +{
1937 + return -EINVAL;
1938 +}
1939 +
1940 +static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
1941 + unsigned long arg)
1942 +{
1943 + struct rtc_time rtc_tm;
1944 + int ret;
1945 +
1946 + switch (cmd) {
1947 + case RTC_RD_TIME: /* Read the time/date from RTC */
1948 + if ((ret = r2025x_get_time(this_client, &rtc_tm)) < 0)
1949 + return ret;
1950 + return copy_to_user((void *)arg, &rtc_tm, sizeof(rtc_tm)) ?
1951 + -EFAULT : 0;
1952 + case RTC_SET_TIME: /* Set the RTC */
1953 + if (!capable(CAP_SYS_TIME))
1954 + return -EACCES;
1955 +
1956 + if (copy_from_user(&rtc_tm,
1957 + (struct rtc_time *) arg,
1958 + sizeof(struct rtc_time)))
1959 + return -EFAULT;
1960 +
1961 + return r2025x_set_time(this_client, &rtc_tm);
1962 + default:
1963 + return -EINVAL;
1964 + }
1965 +}
1966 +
1967 +//yamamoto -->
1968 +static struct i2c_device_id r2025x_idtable[] = {
1969 + { "r2025x", 0 },
1970 + { }
1971 +};
1972 +
1973 +MODULE_DEVICE_TABLE(i2c, r2025x_idtable);
1974 +//yamamoto <--
1975 +
1976 +static struct i2c_driver r2025x_driver = {
1977 + .driver = {
1978 + .name = R2025x_MODULE_NAME,
1979 + },
1980 +//yamamoto -->
1981 + .id_table = r2025x_idtable,
1982 + .probe = r2025x_probe,
1983 + .remove = __devexit_p(r2025x_remove),
1984 +//yamamoto .id = I2C_DRIVERID_R2025x,
1985 +//yamamoto .attach_adapter = r2025x_probe,
1986 +//yamamoto .detach_client = r2025x_detach,
1987 +//yamamoto <--
1988 + .command = r2025x_command
1989 +};
1990 +
1991 +static struct file_operations rtc_fops = {
1992 + owner: THIS_MODULE,
1993 + llseek: rtc_llseek,
1994 + ioctl: rtc_ioctl,
1995 + open: rtc_open,
1996 + release: rtc_release,
1997 +};
1998 +
1999 +static struct miscdevice r2025xrtc_miscdev = {
2000 + RTC_MINOR,
2001 + "rtc",
2002 + &rtc_fops
2003 +};
2004 +
2005 +static __init int r2025x_init(void)
2006 +{
2007 + int ret;
2008 +
2009 + info("I2C based RTC driver.\n");
2010 + ret = i2c_add_driver(&r2025x_driver);
2011 + dbg("r2025x_init i2c_add_driver call ret=%d\n",ret);
2012 + if (ret) {
2013 + err("Register I2C driver failed, errno is %d\n", ret);
2014 + return ret;
2015 + }
2016 + dbg("r2025x_init misc_register call\n");
2017 + ret = misc_register(&r2025xrtc_miscdev);
2018 + dbg("r2025x_init misc_register call ret=%d\n",ret);
2019 + if (ret) {
2020 + err("Register misc driver failed, errno is %d\n", ret);
2021 + i2c_del_driver(&r2025x_driver);
2022 + return ret;
2023 + }
2024 +
2025 + create_proc_read_entry("driver/rtc", 0, 0, rtc_read_proc, NULL);
2026 + dbg("r2025x_init Success\n");
2027 + return 0;
2028 +}
2029 +
2030 +static void __exit r2025x_exit(void)
2031 +{
2032 + remove_proc_entry("driver/rtc", NULL);
2033 + misc_deregister(&r2025xrtc_miscdev);
2034 + i2c_del_driver(&r2025x_driver);
2035 +}
2036 +
2037 +
2038 +module_init(r2025x_init);
2039 +module_exit(r2025x_exit);
2040 +
2041 +/*
2042 + * Info exported via "/proc/driver/rtc".
2043 + */
2044 +
2045 +static int rtc_proc_output(char *buf)
2046 +{
2047 + char *p;
2048 + struct rtc_time tm;
2049 + int ret;
2050 +
2051 + if ((ret = r2025x_get_time(this_client, &tm)) < 0)
2052 + return ret;
2053 +
2054 + p = buf;
2055 +
2056 + /*
2057 + * There is no way to tell if the luser has the RTC set for local
2058 + * time or for Universal Standard Time (GMT). Probably local though.
2059 + */
2060 + p += sprintf(p,
2061 + "rtc_time\t: %02d:%02d:%02d\n"
2062 + "rtc_date\t: %04d-%02d-%02d\n",
2063 + tm.tm_hour, tm.tm_min, tm.tm_sec,
2064 + tm.tm_year + 1900, tm.tm_mon + 1,
2065 + tm.tm_mday);
2066 +
2067 + return p - buf;
2068 +}
2069 +
2070 +static int rtc_read_proc(char *page, char **start, off_t off,
2071 + int count, int *eof, void *data)
2072 +{
2073 + int len = rtc_proc_output(page);
2074 + if (len <= off + count)
2075 + *eof = 1;
2076 + *start = page + off;
2077 + len -= off;
2078 + if (len > count)
2079 + len = count;
2080 + if (len < 0)
2081 + len = 0;
2082 + return len;
2083 +}
2084 +
2085 +MODULE_AUTHOR("Steve Longerbeam");
2086 +MODULE_LICENSE("GPL");
2087 +
2088 diff -urN linux-2.6.32.56.org/drivers/mtd/maps/alchemy-flash.c linux-2.6.32.56/drivers/mtd/maps/alchemy-flash.c
2089 --- linux-2.6.32.56.org/drivers/mtd/maps/alchemy-flash.c 2012-02-12 10:48:12.000000000 +0900
2090 +++ linux-2.6.32.56/drivers/mtd/maps/alchemy-flash.c 2012-02-15 10:20:12.000000000 +0900
2091 @@ -69,6 +69,12 @@
2092 #define BOARD_FLASH_WIDTH 4 /* 32-bits */
2093 #endif
2094
2095 +#ifdef CONFIG_MIPS_OMS400
2096 +#define BOARD_MAP_NAME "OpenMicroServer Flash"
2097 +#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
2098 +#define BOARD_FLASH_WIDTH 2 /* 16-bits */
2099 +#endif
2100 +
2101 #ifdef CONFIG_MIPS_DB1200
2102 #define BOARD_MAP_NAME "Db1200 Flash"
2103 #define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
2104 @@ -94,18 +100,45 @@
2105
2106 static struct mtd_partition alchemy_partitions[] = {
2107 {
2108 +#ifdef CONFIG_MIPS_OMS400
2109 + .name = "Firmware",
2110 +#else
2111 .name = "User FS",
2112 +#endif
2113 .size = BOARD_FLASH_SIZE - 0x00400000,
2114 .offset = 0x0000000
2115 },{
2116 .name = "YAMON",
2117 +#ifdef CONFIG_MIPS_OMS400
2118 + .size = 0x0180000,
2119 +#else
2120 .size = 0x0100000,
2121 +#endif
2122 .offset = MTDPART_OFS_APPEND,
2123 .mask_flags = MTD_WRITEABLE
2124 },{
2125 +#ifdef CONFIG_MIPS_OMS400
2126 + .name = "User Area",
2127 + .size = 0x00200000,
2128 + .offset = MTDPART_OFS_APPEND
2129 + },{
2130 + .name = "flashcfg save area",
2131 + .size = 0x00040000,
2132 + .offset = MTDPART_OFS_APPEND
2133 + },{
2134 + .name = "YAMON Params",
2135 + .size = 0x00040000,
2136 + .offset = MTDPART_OFS_APPEND
2137 + },{
2138 + .name = "Entire Flash ROM",
2139 + .size = BOARD_FLASH_SIZE,
2140 + .offset = 0x00000000,
2141 + .mask_flags = MTD_WRITEABLE
2142 +#else
2143 .name = "raw kernel",
2144 .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
2145 .offset = MTDPART_OFS_APPEND,
2146 +#endif
2147 }
2148 };
2149
2150 diff -urN linux-2.6.32.56.org/drivers/net/Kconfig linux-2.6.32.56/drivers/net/Kconfig
2151 --- linux-2.6.32.56.org/drivers/net/Kconfig 2012-02-12 10:48:12.000000000 +0900
2152 +++ linux-2.6.32.56/drivers/net/Kconfig 2012-02-15 10:28:12.000000000 +0900
2153 @@ -1590,6 +1590,10 @@
2154 To compile this driver as a module, choose M here: the module
2155 will be called 8139too. This is recommended.
2156
2157 +config 8139TOO_NAPI
2158 + bool "Use Rx Polling (NAPI)"
2159 + depends on 8139TOO
2160 +
2161 config 8139TOO_PIO
2162 bool "Use PIO instead of MMIO"
2163 default y
2164 @@ -2118,6 +2122,29 @@
2165 To compile this driver as a module, choose M here. The module
2166 will be called igbvf.
2167
2168 +choice
2169 + prompt "E1000 Rx buffer size"
2170 + depends on E1000 && MIPS_OMS400
2171 + default E1000_RX_BUFSIZE_48K
2172 + help
2173 + Set E1000 rx buffter size.
2174 +
2175 +config E1000_RX_BUFSIZE_48K
2176 + bool "48K"
2177 +
2178 +config E1000_RX_BUFSIZE_40K
2179 + bool "40K"
2180 +
2181 +config E1000_RX_BUFSIZE_32K
2182 + bool "32K"
2183 +
2184 +endchoice
2185 +
2186 +config E1000_NOCOPY_SMALL_SKB
2187 + bool "Do not copy skb when length < 256"
2188 + depends on E1000 && MIPS_OMS400
2189 + default n
2190 +
2191 source "drivers/net/ixp2000/Kconfig"
2192
2193 config MYRI_SBUS
2194 diff -urN linux-2.6.32.56.org/drivers/net/Makefile linux-2.6.32.56/drivers/net/Makefile
2195 --- linux-2.6.32.56.org/drivers/net/Makefile 2012-02-12 10:48:12.000000000 +0900
2196 +++ linux-2.6.32.56/drivers/net/Makefile 2012-02-15 10:34:09.000000000 +0900
2197 @@ -8,6 +8,7 @@
2198
2199 obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
2200
2201 +obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
2202 obj-$(CONFIG_E1000) += e1000/
2203 obj-$(CONFIG_E1000E) += e1000e/
2204 obj-$(CONFIG_IBM_NEW_EMAC) += ibm_newemac/
2205 @@ -216,7 +217,7 @@
2206 obj-$(CONFIG_EQUALIZER) += eql.o
2207 obj-$(CONFIG_KORINA) += korina.o
2208 obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o
2209 -obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
2210 +#obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
2211 obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
2212 obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o
2213 obj-$(CONFIG_DECLANCE) += declance.o
2214 diff -urN linux-2.6.32.56.org/drivers/net/e1000/e1000_main.c linux-2.6.32.56/drivers/net/e1000/e1000_main.c
2215 --- linux-2.6.32.56.org/drivers/net/e1000/e1000_main.c 2012-02-12 10:48:12.000000000 +0900
2216 +++ linux-2.6.32.56/drivers/net/e1000/e1000_main.c 2012-02-15 10:48:18.000000000 +0900
2217 @@ -542,8 +542,15 @@
2218 case e1000_82540:
2219 case e1000_82541:
2220 case e1000_82541_rev_2:
2221 +#if defined(CONFIG_E1000_RX_BUFSIZE_32K)
2222 + pba = E1000_PBA_32K;
2223 +#elif defined(CONFIG_E1000_RX_BUFSIZE_40K)
2224 + legacy_pba_adjust = true;
2225 + pba = E1000_PBA_40K;
2226 +#else
2227 legacy_pba_adjust = true;
2228 pba = E1000_PBA_48K;
2229 +#endif
2230 break;
2231 case e1000_82545:
2232 case e1000_82545_rev_3:
2233 @@ -3878,6 +3885,7 @@
2234 /* code added for copybreak, this should improve
2235 * performance for small packets with large amounts
2236 * of reassembly being done in the stack */
2237 +#ifndef CONFIG_E1000_NOCOPY_SMALL_SKB
2238 if (length < copybreak) {
2239 struct sk_buff *new_skb =
2240 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
2241 @@ -3896,6 +3904,7 @@
2242 /* else just continue with the old one */
2243 }
2244 /* end copybreak code */
2245 +#endif
2246 skb_put(skb, length);
2247
2248 /* Receive Checksum Offload */
2249 diff -urN linux-2.6.32.56.org/drivers/net/phy/lxt.c linux-2.6.32.56/drivers/net/phy/lxt.c
2250 --- linux-2.6.32.56.org/drivers/net/phy/lxt.c 2012-02-12 10:48:12.000000000 +0900
2251 +++ linux-2.6.32.56/drivers/net/phy/lxt.c 2012-02-15 10:56:03.000000000 +0900
2252 @@ -97,6 +97,16 @@
2253 return err;
2254 }
2255
2256 +#ifdef CONFIG_MIPS_OMS400
2257 +#define MII_LXT971A_CFG 16 /* PHY Configuration Register */
2258 +static int lxt971_config_init(struct phy_device *phydev)
2259 +{
2260 + int err;
2261 +
2262 + err = phy_write(phydev, MII_LXT971A_CFG, 0x0180);
2263 + return err;
2264 +}
2265 +#endif
2266
2267 static int lxt971_ack_interrupt(struct phy_device *phydev)
2268 {
2269 @@ -140,6 +150,9 @@
2270 .phy_id_mask = 0xfffffff0,
2271 .features = PHY_BASIC_FEATURES,
2272 .flags = PHY_HAS_INTERRUPT,
2273 +#ifdef CONFIG_MIPS_OMS400
2274 + .config_init = lxt971_config_init,
2275 +#endif
2276 .config_aneg = genphy_config_aneg,
2277 .read_status = genphy_read_status,
2278 .ack_interrupt = lxt971_ack_interrupt,
2279 diff -urN linux-2.6.32.56.org/drivers/pcmcia/Makefile linux-2.6.32.56/drivers/pcmcia/Makefile
2280 --- linux-2.6.32.56.org/drivers/pcmcia/Makefile 2012-02-12 10:48:12.000000000 +0900
2281 +++ linux-2.6.32.56/drivers/pcmcia/Makefile 2012-02-15 11:00:42.000000000 +0900
2282 @@ -48,6 +48,7 @@
2283 au1x00_ss-$(CONFIG_MIPS_DB1200) += au1000_db1x00.o
2284 au1x00_ss-$(CONFIG_MIPS_DB1500) += au1000_db1x00.o
2285 au1x00_ss-$(CONFIG_MIPS_DB1550) += au1000_db1x00.o
2286 +au1x00_ss-$(CONFIG_MIPS_OMS400) += au1000_db1x00.o
2287 au1x00_ss-$(CONFIG_MIPS_XXS1500) += au1000_xxs1500.o
2288
2289 sa1111_cs-y += sa1111_generic.o
2290 diff -urN linux-2.6.32.56.org/drivers/pcmcia/au1000_db1x00.c linux-2.6.32.56/drivers/pcmcia/au1000_db1x00.c
2291 --- linux-2.6.32.56.org/drivers/pcmcia/au1000_db1x00.c 2012-02-12 10:48:12.000000000 +0900
2292 +++ linux-2.6.32.56/drivers/pcmcia/au1000_db1x00.c 2012-02-15 11:11:36.000000000 +0900
2293 @@ -47,8 +47,10 @@
2294 #include <pb1200.h>
2295 #else
2296 #include <asm/mach-db1x00/db1x00.h>
2297 +#ifndef CONFIG_MIPS_OMS400
2298 static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
2299 #endif
2300 +#endif
2301
2302 #include "au1000_generic.h"
2303
2304 @@ -58,12 +60,18 @@
2305 #define debug(x,args...)
2306 #endif
2307
2308 -
2309 +#ifdef CONFIG_MIPS_OMS400
2310 +struct au1000_pcmcia_socket au1000_pcmcia_socket[2];
2311 +#else
2312 struct au1000_pcmcia_socket au1000_pcmcia_socket[PCMCIA_NUM_SOCKS];
2313 +#endif
2314 extern int au1x00_pcmcia_socket_probe(struct device *, struct pcmcia_low_level *, int, int);
2315
2316 static int db1x00_pcmcia_hw_init(struct au1000_pcmcia_socket *skt)
2317 {
2318 +#ifdef CONFIG_MIPS_OMS400
2319 + skt->irq = AU1000_GPIO_3;
2320 +#else
2321 #ifdef CONFIG_MIPS_DB1550
2322 skt->irq = skt->nr ? AU1000_GPIO_5 : AU1000_GPIO_3;
2323 #elif defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
2324 @@ -71,12 +79,15 @@
2325 #else
2326 skt->irq = skt->nr ? AU1000_GPIO_5 : AU1000_GPIO_2;
2327 #endif
2328 +#endif
2329 return 0;
2330 }
2331
2332 static void db1x00_pcmcia_shutdown(struct au1000_pcmcia_socket *skt)
2333 {
2334 +#ifndef CONFIG_MIPS_OMS400
2335 bcsr->pcmcia = 0; /* turn off power */
2336 +#endif
2337 au_sync_delay(2);
2338 }
2339
2340 @@ -93,20 +104,30 @@
2341
2342 switch (skt->nr) {
2343 case 0:
2344 +#ifdef CONFIG_MIPS_OMS400
2345 + vs = 2;
2346 + inserted = !(au_readl(SYS_PINSTATERD) & (1 << 5));
2347 +#else
2348 vs = bcsr->status & 0x3;
2349 #if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
2350 inserted = BOARD_CARD_INSERTED(0);
2351 #else
2352 inserted = !(bcsr->status & (1<<4));
2353 #endif
2354 +#endif
2355 break;
2356 case 1:
2357 +#ifdef CONFIG_MIPS_OMS400
2358 + vs = 0;
2359 + inserted = 0;
2360 +#else
2361 vs = (bcsr->status & 0xC)>>2;
2362 #if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
2363 inserted = BOARD_CARD_INSERTED(1);
2364 #else
2365 inserted = !(bcsr->status & (1<<5));
2366 #endif
2367 +#endif
2368 break;
2369 default:/* should never happen */
2370 return;
2371 @@ -132,6 +153,7 @@
2372 state->detect = 1;
2373 state->ready = 1;
2374 }
2375 +#ifndef CONFIG_MIPS_OMS400
2376 else {
2377 /* if the card was previously inserted and then ejected,
2378 * we should turn off power to it
2379 @@ -151,6 +173,7 @@
2380 au_sync_delay(10);
2381 }
2382 }
2383 +#endif
2384
2385 state->bvd1=1;
2386 state->bvd2=1;
2387 @@ -160,6 +183,7 @@
2388 static int
2389 db1x00_pcmcia_configure_socket(struct au1000_pcmcia_socket *skt, struct socket_state_t *state)
2390 {
2391 +#ifndef CONFIG_MIPS_OMS400
2392 u16 pwr;
2393 int sock = skt->nr;
2394
2395 @@ -261,6 +285,7 @@
2396 au_sync_delay(100);
2397 }
2398 }
2399 +#endif
2400 return 0;
2401 }
2402
2403 @@ -298,8 +323,12 @@
2404 int au1x_board_init(struct device *dev)
2405 {
2406 int ret = -ENODEV;
2407 +#ifdef CONFIG_MIPS_OMS400
2408 + ret = au1x00_pcmcia_socket_probe(dev, &db1x00_pcmcia_ops, 0, 1);
2409 +#else
2410 bcsr->pcmcia = 0; /* turn off power, if it's not already off */
2411 au_sync_delay(2);
2412 ret = au1x00_pcmcia_socket_probe(dev, &db1x00_pcmcia_ops, 0, 2);
2413 +#endif
2414 return ret;
2415 }
2416 diff -urN linux-2.6.32.56.org/drivers/pcmcia/au1000_generic.c linux-2.6.32.56/drivers/pcmcia/au1000_generic.c
2417 --- linux-2.6.32.56.org/drivers/pcmcia/au1000_generic.c 2012-02-12 10:48:12.000000000 +0900
2418 +++ linux-2.6.32.56/drivers/pcmcia/au1000_generic.c 2012-02-15 11:25:19.000000000 +0900
2419 @@ -408,6 +408,7 @@
2420 skt->phys_attr = AU1X_SOCK0_PSEUDO_PHYS_ATTR;
2421 skt->phys_mem = AU1X_SOCK0_PSEUDO_PHYS_MEM;
2422 }
2423 +#ifndef CONFIG_MIPS_OMS400
2424 #ifndef CONFIG_MIPS_XXS1500
2425 else {
2426 skt->virt_io = (void *)
2427 @@ -417,6 +418,7 @@
2428 skt->phys_mem = AU1X_SOCK1_PSEUDO_PHYS_MEM;
2429 }
2430 #endif
2431 +#endif
2432 pcmcia_base_vaddrs[i] = (u32 *)skt->virt_io;
2433 ret = ops->hw_init(skt);
2434
2435 @@ -425,6 +427,7 @@
2436 skt->socket.map_size = MAP_SIZE;
2437 skt->socket.pci_irq = skt->irq;
2438 skt->socket.io_offset = (unsigned long)skt->virt_io;
2439 + skt->socket.resource_ops = &pccard_static_ops;
2440
2441 skt->status = au1x00_pcmcia_skt_state(skt);
2442
2443 diff -urN linux-2.6.32.56.org/drivers/pcmcia/ds.c linux-2.6.32.56/drivers/pcmcia/ds.c
2444 --- linux-2.6.32.56.org/drivers/pcmcia/ds.c 2012-02-12 10:48:12.000000000 +0900
2445 +++ linux-2.6.32.56/drivers/pcmcia/ds.c 2012-02-15 11:30:27.000000000 +0900
2446 @@ -955,8 +955,10 @@
2447 */
2448 ds_dev_dbg(0, &dev->dev,
2449 "skipping FUNC_ID match until userspace interaction\n");
2450 +#ifndef CONFIG_MIPS_OMS400
2451 if (!dev->allow_func_id_match)
2452 return 0;
2453 +#endif
2454 }
2455
2456 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) {
2457 diff -urN linux-2.6.32.56.org/drivers/serial/8250.c linux-2.6.32.56/drivers/serial/8250.c
2458 --- linux-2.6.32.56.org/drivers/serial/8250.c 2012-02-12 10:48:12.000000000 +0900
2459 +++ linux-2.6.32.56/drivers/serial/8250.c 2012-02-15 11:32:53.000000000 +0900
2460 @@ -91,7 +91,11 @@
2461 * machine types want others as well - they're free
2462 * to redefine this in their header file.
2463 */
2464 +#if defined(CONFIG_MIPS_OMS400)
2465 +#define is_real_interrupt(irq) ((irq) < 0x100)
2466 +#else
2467 #define is_real_interrupt(irq) ((irq) != 0)
2468 +#endif
2469
2470 #ifdef CONFIG_SERIAL_8250_DETECT_IRQ
2471 #define CONFIG_SERIAL_DETECT_IRQ 1
2472 diff -urN linux-2.6.32.56.org/drivers/usb/host/ehci.h linux-2.6.32.56/drivers/usb/host/ehci.h
2473 --- linux-2.6.32.56.org/drivers/usb/host/ehci.h 2012-02-12 10:48:12.000000000 +0900
2474 +++ linux-2.6.32.56/drivers/usb/host/ehci.h 2012-02-15 11:44:20.000000000 +0900
2475 @@ -342,7 +342,13 @@
2476 * memory that is cache-inhibited (i.e. being used for DMA).
2477 * Spinlocks are used to protect all QH fields.
2478 */
2479 +#ifdef CONFIG_MIPS_OMS400
2480 + u8 __isolete_cache_1[1024];
2481 u32 refcount;
2482 + u8 __isolate_cashe_2[1024];
2483 +#else
2484 + u32 refcount;
2485 +#endif
2486 unsigned stamp;
2487
2488 u8 needs_rescan; /* Dequeue during giveback */
2489 diff -urN linux-2.6.32.56.org/drivers/usb/host/ohci-hcd.c linux-2.6.32.56/drivers/usb/host/ohci-hcd.c
2490 --- linux-2.6.32.56.org/drivers/usb/host/ohci-hcd.c 2012-02-12 10:48:12.000000000 +0900
2491 +++ linux-2.6.32.56/drivers/usb/host/ohci-hcd.c 2012-02-15 11:50:55.000000000 +0900
2492 @@ -1033,10 +1033,12 @@
2493 #define PLATFORM_DRIVER ohci_hcd_ep93xx_driver
2494 #endif
2495
2496 +#ifndef CONFIG_MIPS_OMS400
2497 #ifdef CONFIG_SOC_AU1X00
2498 #include "ohci-au1xxx.c"
2499 #define PLATFORM_DRIVER ohci_hcd_au1xxx_driver
2500 #endif
2501 +#endif
2502
2503 #ifdef CONFIG_PNX8550
2504 #include "ohci-pnx8550.c"
2505 diff -urN linux-2.6.32.56.org/include/asm-generic/bug.h linux-2.6.32.56/include/asm-generic/bug.h
2506 --- linux-2.6.32.56.org/include/asm-generic/bug.h 2012-02-12 10:48:12.000000000 +0900
2507 +++ linux-2.6.32.56/include/asm-generic/bug.h 2012-02-15 22:01:13.000000000 +0900
2508 @@ -126,6 +126,13 @@
2509 })
2510 #endif
2511
2512 +#ifndef WARN_RATELIMIT
2513 +#define WARN_RATELIMIT(condition, format...) ({ \
2514 + int __ret_warn_on = !!(condition); \
2515 + unlikely(__ret_warn_on); \
2516 +})
2517 +#endif
2518 +
2519 #endif
2520
2521 #define WARN_ON_ONCE(condition) ({ \
2522 diff -urN linux-2.6.32.56.org/include/asm-generic/int-ll64.h linux-2.6.32.56/include/asm-generic/int-ll64.h
2523 --- linux-2.6.32.56.org/include/asm-generic/int-ll64.h 2012-02-12 10:48:12.000000000 +0900
2524 +++ linux-2.6.32.56/include/asm-generic/int-ll64.h 2012-02-15 11:57:43.000000000 +0900
2525 @@ -25,13 +25,13 @@
2526 typedef __signed__ int __s32;
2527 typedef unsigned int __u32;
2528
2529 -#ifdef __GNUC__
2530 +//#ifdef __GNUC__
2531 __extension__ typedef __signed__ long long __s64;
2532 __extension__ typedef unsigned long long __u64;
2533 -#else
2534 -typedef __signed__ long long __s64;
2535 -typedef unsigned long long __u64;
2536 -#endif
2537 +//#else
2538 +//typedef __signed__ long long __s64;
2539 +//typedef unsigned long long __u64;
2540 +//#endif
2541
2542 #endif /* __ASSEMBLY__ */
2543
2544 diff -urN linux-2.6.32.56.org/include/linux/miscdevice.h linux-2.6.32.56/include/linux/miscdevice.h
2545 --- linux-2.6.32.56.org/include/linux/miscdevice.h 2012-02-12 10:48:12.000000000 +0900
2546 +++ linux-2.6.32.56/include/linux/miscdevice.h 2012-02-15 14:21:15.000000000 +0900
2547 @@ -1,5 +1,11 @@
2548 #ifndef _LINUX_MISCDEVICE_H
2549 #define _LINUX_MISCDEVICE_H
2550 +
2551 +/*
2552 + PlatHome <openlab.plathome.co.jp>
2553 + - Added PUSHSW_MINOR, SEGLED_MINOR for OpenBlockS
2554 +*/
2555 +
2556 #include <linux/module.h>
2557 #include <linux/major.h>
2558
2559 @@ -22,6 +28,10 @@
2560 #define SGI_MMTIMER 153
2561 #define STORE_QUEUE_MINOR 155
2562 #define I2O_MINOR 166
2563 +#define PUSHSW_MINOR 170
2564 +#define SEGLED_MINOR 171
2565 +#define OMS400TEMP_MINOR 172
2566 +#define OMS400DIO_MINOR 173
2567 #define MICROCODE_MINOR 184
2568 #define TUN_MINOR 200
2569 #define MWAVE_MINOR 219 /* ACP/Mwave Modem */
2570 diff -urN linux-2.6.32.56.org/include/linux/netfilter.h linux-2.6.32.56/include/linux/netfilter.h
2571 --- linux-2.6.32.56.org/include/linux/netfilter.h 2012-02-12 10:48:12.000000000 +0900
2572 +++ linux-2.6.32.56/include/linux/netfilter.h 2012-02-15 14:26:20.000000000 +0900
2573 @@ -13,6 +13,7 @@
2574 #endif
2575 #include <linux/types.h>
2576 #include <linux/compiler.h>
2577 +#include <linux/types.h>
2578
2579 /* Responses from hook functions. */
2580 #define NF_DROP 0
2581 diff -urN linux-2.6.32.56.org/include/linux/types.h linux-2.6.32.56/include/linux/types.h
2582 --- linux-2.6.32.56.org/include/linux/types.h 2012-02-12 10:48:12.000000000 +0900
2583 +++ linux-2.6.32.56/include/linux/types.h 2012-02-15 14:35:25.000000000 +0900
2584 @@ -179,7 +179,7 @@
2585 typedef unsigned __bitwise__ gfp_t;
2586 typedef unsigned __bitwise__ fmode_t;
2587
2588 -#ifdef CONFIG_PHYS_ADDR_T_64BIT
2589 +#if defined(CONFIG_PHYS_ADDR_T_64BIT) || defined(CONFIG_64BIT_PHYS_ADDR)
2590 typedef u64 phys_addr_t;
2591 #else
2592 typedef u32 phys_addr_t;
2593 diff -urN linux-2.6.32.56.org/include/pcmcia/ds.h linux-2.6.32.56/include/pcmcia/ds.h
2594 --- linux-2.6.32.56.org/include/pcmcia/ds.h 2012-02-12 10:48:12.000000000 +0900
2595 +++ linux-2.6.32.56/include/pcmcia/ds.h 2012-02-15 21:51:06.000000000 +0900
2596 @@ -244,10 +244,12 @@
2597
2598 #if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__)
2599
2600 -#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
2601 +#if defined(__arm__) || defined(__avr32__) || \
2602 defined(__bfin__)
2603 /* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
2604 typedef u_int ioaddr_t;
2605 +#elif defined(__mips__)
2606 +typedef unsigned long long ioaddr_t;
2607 #else
2608 typedef u_short ioaddr_t;
2609 #endif
2610 @@ -434,6 +436,9 @@
2611 #define INFO_CARD_SHARE 0x10
2612 #define INFO_CARD_EXCL 0x20
2613
2614 +#ifdef CONFIG_MIPS_OMS400
2615 +int pcmcia_bind_request(bind_info_t *bind_info);
2616 +#endif
2617
2618 #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */
2619
2620 diff -urN linux-2.6.32.56.org/init/do_mounts.c linux-2.6.32.56/init/do_mounts.c
2621 --- linux-2.6.32.56.org/init/do_mounts.c 2012-02-12 10:48:12.000000000 +0900
2622 +++ linux-2.6.32.56/init/do_mounts.c 2012-02-15 14:52:12.000000000 +0900
2623 @@ -57,6 +57,17 @@
2624 __setup("ro", readonly);
2625 __setup("rw", readwrite);
2626
2627 +#if defined(CONFIG_MIPS_OMS400)
2628 +int __initdata no_flashcfg;
2629 +
2630 +static int __init exec_flashcfg(char * str)
2631 +{
2632 + no_flashcfg = simple_strtoul(str,NULL,0);
2633 + return 1;
2634 +}
2635 +__setup("noflashcfg=", exec_flashcfg);
2636 +#endif
2637 +
2638 /*
2639 * Convert a name into device number. We accept the following variants:
2640 *
2641 @@ -366,6 +377,10 @@
2642 {
2643 int is_floppy;
2644
2645 +#if defined(CONFIG_MIPS_OMS400)
2646 + int real_root_mountflags = root_mountflags;
2647 +#endif
2648 +
2649 if (root_delay) {
2650 printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
2651 root_delay);
2652 @@ -413,9 +428,33 @@
2653 if (is_floppy && rd_doload && rd_load_disk(0))
2654 ROOT_DEV = Root_RAM0;
2655
2656 +#if defined(CONFIG_MIPS_OMS400)
2657 + /* write able root mount if load user configuration from flash necessary. */
2658 + if ((no_flashcfg == 0) && mount_initrd) {
2659 + root_mountflags &= ~MS_RDONLY;
2660 + }
2661 +#endif
2662 +
2663 mount_root();
2664 out:
2665 devtmpfs_mount("dev");
2666 sys_mount(".", "/", NULL, MS_MOVE, NULL);
2667 sys_chroot(".");
2668 +#if defined(CONFIG_MIPS_OMS400)
2669 + if ((no_flashcfg == 0) && mount_initrd) {
2670 + root_mountflags = real_root_mountflags;
2671 + printk("[prepare_namespace] Executing flashcfg...\n");
2672 + if ((MAJOR(ROOT_DEV) == RAMDISK_MAJOR) && (MINOR(ROOT_DEV) == 0)) {
2673 + int pid,i;
2674 + pid = kernel_thread(do_restore, "/usr/sbin/flashcfg", SIGCHLD);
2675 + if (pid > 0) {
2676 + while (pid != sys_wait4(-1, &i, 0, NULL))
2677 + yield();
2678 + }
2679 + else
2680 + printk("[prepare_namespace] Error starting restore thread!\n");
2681 + }
2682 + printk("[prepare_namespace] Finished executing flashcfg\n");
2683 + }
2684 +#endif
2685 }
2686 diff -urN linux-2.6.32.56.org/init/do_mounts.h linux-2.6.32.56/init/do_mounts.h
2687 --- linux-2.6.32.56.org/init/do_mounts.h 2012-02-12 10:48:12.000000000 +0900
2688 +++ linux-2.6.32.56/init/do_mounts.h 2012-02-15 14:53:58.000000000 +0900
2689 @@ -55,6 +55,8 @@
2690
2691 #endif
2692
2693 +extern int __initdata mount_initrd;
2694 +
2695 #ifdef CONFIG_BLK_DEV_INITRD
2696
2697 int __init initrd_load(void);
2698 @@ -74,3 +76,7 @@
2699 static inline void md_run_setup(void) {}
2700
2701 #endif
2702 +
2703 +#if defined(CONFIG_MIPS_OMS400)
2704 +int __init do_restore(void *shell);
2705 +#endif
2706 diff -urN linux-2.6.32.56.org/init/do_mounts_initrd.c linux-2.6.32.56/init/do_mounts_initrd.c
2707 --- linux-2.6.32.56.org/init/do_mounts_initrd.c 2012-02-12 10:48:12.000000000 +0900
2708 +++ linux-2.6.32.56/init/do_mounts_initrd.c 2012-02-15 14:58:30.000000000 +0900
2709 @@ -10,11 +10,20 @@
2710
2711 #include "do_mounts.h"
2712
2713 +/*
2714 + ozawa CONFIG_OBSS
2715 + PlatHome <openlab.plathome.co.jp>
2716 + - Added do_restore()
2717 + - write able root mount if load user configuration
2718 + in prepare_namespace()
2719 + - Added for CONFIG_MIPS_OMS400
2720 +*/
2721 +
2722 unsigned long initrd_start, initrd_end;
2723 int initrd_below_start_ok;
2724 unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
2725 static int __initdata old_fd, root_fd;
2726 -static int __initdata mount_initrd = 1;
2727 +int __initdata mount_initrd = 1;
2728
2729 static int __init no_initrd(char *str)
2730 {
2731 @@ -127,3 +136,23 @@
2732 sys_unlink("/initrd.image");
2733 return 0;
2734 }
2735 +
2736 +#if defined(CONFIG_MIPS_OMS400)
2737 +int __init do_restore(void *shell)
2738 +{
2739 + static char *argv[] = { "flashcfg",
2740 + "-x",
2741 + NULL, };
2742 + extern char *envp_init[];
2743 +
2744 + sys_close(old_fd);sys_close(root_fd);
2745 + sys_close(0);sys_close(1);sys_close(2);
2746 + sys_setsid();
2747 + (void) sys_open("/dev/console",O_RDWR,0);
2748 + (void) sys_dup(0);
2749 + (void) sys_dup(0);
2750 + kernel_execve(shell, argv, envp_init);
2751 + printk("[do_restore] Error starting restore thread!\n");
2752 + return (-1);
2753 +}
2754 +#endif
2755 diff -urN linux-2.6.32.56.org/init/do_mounts_rd.c linux-2.6.32.56/init/do_mounts_rd.c
2756 --- linux-2.6.32.56.org/init/do_mounts_rd.c 2012-02-12 10:48:12.000000000 +0900
2757 +++ linux-2.6.32.56/init/do_mounts_rd.c 2012-02-15 15:02:36.000000000 +0900
2758 @@ -1,3 +1,11 @@
2759 +/*
2760 + ozawa CONFIG_OBSS
2761 + PlatHome <openlab.plathome.co.jp>
2762 + - Added do_restore()
2763 + - write able root mount if load user configuration
2764 + in prepare_namespace()
2765 + - Added for CONFIG_MIPS_OMS400
2766 +*/
2767
2768 #include <linux/kernel.h>
2769 #include <linux/fs.h>
2770 @@ -158,7 +166,11 @@
2771 {
2772 int res = 0;
2773 int in_fd, out_fd;
2774 +#if defined(CONFIG_MIPS_OMS400)
2775 + long rd_blocks, devblocks;
2776 +#else
2777 unsigned long rd_blocks, devblocks;
2778 +#endif
2779 int nblocks, i, disk;
2780 char *buf = NULL;
2781 unsigned short rotate = 0;
2782 diff -urN linux-2.6.32.56.org/init/main.c linux-2.6.32.56/init/main.c
2783 --- linux-2.6.32.56.org/init/main.c 2012-02-12 10:48:12.000000000 +0900
2784 +++ linux-2.6.32.56/init/main.c 2012-02-15 15:15:02.000000000 +0900
2785 @@ -7,6 +7,14 @@
2786 * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96
2787 * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96
2788 * Simplified starting of init: Michael A. Griffith <grif@acm.org>
2789 + *
2790 + * Century <www.centurysys.co.jp>
2791 + * - Added LED display
2792 + * - Added recovery mode handling
2793 + * 2001-12-25 ozawa CONFIG_OBSS
2794 + * PlatHome <openlab.plathome.co.jp>
2795 + * - Added for OpenBlockS 266
2796 + *
2797 */
2798
2799 #include <linux/types.h>
2800 @@ -101,6 +109,14 @@
2801 enum system_states system_state __read_mostly;
2802 EXPORT_SYMBOL(system_state);
2803
2804 +#if defined(CONFIG_MIPS_OMS400) && defined(CONFIG_OMS400_LED)
2805 +#define STATUS_LED_OUT 1
2806 +#endif
2807 +
2808 +#if defined(STATUS_LED_OUT)
2809 +extern int obsled_out(int);
2810 +#endif
2811 +
2812 /*
2813 * Boot command-line arguments
2814 */
2815 @@ -522,6 +538,9 @@
2816 char * command_line;
2817 extern struct kernel_param __start___param[], __stop___param[];
2818
2819 +#if defined(STATUS_LED_OUT)
2820 + obsled_out(1);
2821 +#endif
2822 smp_setup_processor_id();
2823
2824 /*
2825 @@ -550,6 +569,9 @@
2826 tick_init();
2827 boot_cpu_init();
2828 page_address_init();
2829 +#if defined(STATUS_LED_OUT)
2830 + obsled_out(2);
2831 +#endif
2832 printk(KERN_NOTICE "%s", linux_banner);
2833 setup_arch(&command_line);
2834 mm_init_owner(&init_mm, &init_task);
2835 @@ -834,6 +856,9 @@
2836 * The Bourne shell can be used instead of init if we are
2837 * trying to recover a really broken machine.
2838 */
2839 +#if defined(STATUS_LED_OUT)
2840 + obsled_out(6);
2841 +#endif
2842 if (execute_command) {
2843 run_init_process(execute_command);
2844 printk(KERN_WARNING "Failed to execute %s. Attempting "
2845 @@ -855,6 +880,9 @@
2846 wait_for_completion(&kthreadd_done);
2847 lock_kernel();
2848
2849 +#if defined(STATUS_LED_OUT)
2850 + obsled_out(3);
2851 +#endif
2852 /*
2853 * init can allocate pages on any node
2854 */
2855 @@ -883,8 +911,15 @@
2856 smp_init();
2857 sched_init_smp();
2858
2859 +#if defined(STATUS_LED_OUT)
2860 + obsled_out(4);
2861 +#endif
2862 do_basic_setup();
2863
2864 +#if defined(STATUS_LED_OUT)
2865 + obsled_out(5);
2866 +#endif
2867 +
2868 /*
2869 * check if there is an early userspace init. If yes, let it do all
2870 * the work
2871 diff -urN linux-2.6.32.56.org/kernel/Kconfig.hz linux-2.6.32.56/kernel/Kconfig.hz
2872 --- linux-2.6.32.56.org/kernel/Kconfig.hz 2012-02-12 10:48:12.000000000 +0900
2873 +++ linux-2.6.32.56/kernel/Kconfig.hz 2012-02-15 15:18:38.000000000 +0900
2874 @@ -23,6 +23,12 @@
2875 with lots of processors that may show reduced performance if
2876 too many timer interrupts are occurring.
2877
2878 + config HZ_125
2879 + bool "125 HZ"
2880 +
2881 + config HZ_200
2882 + bool "200 HZ"
2883 +
2884 config HZ_250
2885 bool "250 HZ"
2886 help
2887 @@ -39,6 +45,9 @@
2888 on SMP and NUMA systems and exactly dividing by both PAL and
2889 NTSC frame rates for video and multimedia work.
2890
2891 + config HZ_500
2892 + bool "500 HZ"
2893 +
2894 config HZ_1000
2895 bool "1000 HZ"
2896 help
2897 @@ -50,8 +59,11 @@
2898 config HZ
2899 int
2900 default 100 if HZ_100
2901 + default 125 if HZ_125
2902 + default 200 if HZ_200
2903 default 250 if HZ_250
2904 default 300 if HZ_300
2905 + default 500 if HZ_500
2906 default 1000 if HZ_1000
2907
2908 config SCHED_HRTICK
2909 diff -urN linux-2.6.32.56.org/scripts/Makefile.modinst linux-2.6.32.56/scripts/Makefile.modinst
2910 --- linux-2.6.32.56.org/scripts/Makefile.modinst 2012-02-12 10:48:12.000000000 +0900
2911 +++ linux-2.6.32.56/scripts/Makefile.modinst 2012-02-15 15:20:09.000000000 +0900
2912 @@ -17,7 +17,7 @@
2913 @:
2914
2915 quiet_cmd_modules_install = INSTALL $@
2916 - cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)
2917 + cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; gzip -9 $(2)/$(notdir $@)
2918
2919 # Modules built outside the kernel source tree go into extra by default
2920 INSTALL_MOD_DIR ?= extra
2921 diff -urN linux-2.6.32.56.org/sound/usb/usbquirks.h linux-2.6.32.56/sound/usb/usbquirks.h
2922 --- linux-2.6.32.56.org/sound/usb/usbquirks.h 2012-02-12 10:48:12.000000000 +0900
2923 +++ linux-2.6.32.56/sound/usb/usbquirks.h 2012-02-15 15:22:28.000000000 +0900
2924 @@ -1916,6 +1916,17 @@
2925 }
2926 },
2927
2928 +{
2929 + /* Creative Sound Blaster Degital Music LX */
2930 + USB_DEVICE(0x041e, 0x3015),
2931 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2932 + .vendor_name = "Creative Labs",
2933 + .product_name = "Sound Blaster Music LX",
2934 + .ifnum = QUIRK_NO_INTERFACE
2935 + }
2936 +
2937 +},
2938 +
2939 /* Emagic devices */
2940 {
2941 USB_DEVICE(0x086a, 0x0001),
2942 diff -urN linux-2.6.32.56.org/usr/Makefile linux-2.6.32.56/usr/Makefile
2943 --- linux-2.6.32.56.org/usr/Makefile 2012-02-12 10:48:12.000000000 +0900
2944 +++ linux-2.6.32.56/usr/Makefile 2012-02-15 15:24:12.000000000 +0900
2945 @@ -59,3 +59,13 @@
2946 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
2947 $(call if_changed,initfs)
2948
2949 +ifdef CONFIG_MIPS_OMS400
2950 +
2951 +obj-y += initrd_data.o
2952 +
2953 +$(obj)/initrd_data.o: $(obj)/ramdisk.image.gz FORCE
2954 +
2955 +$(obj)/ramdisk.image.gz:
2956 + touch $(obj)/ramdisk.image.gz
2957 +
2958 +endif
2959 diff -urN linux-2.6.32.56.org/usr/initrd_data.S linux-2.6.32.56/usr/initrd_data.S
2960 --- linux-2.6.32.56.org/usr/initrd_data.S 1970-01-01 09:00:00.000000000 +0900
2961 +++ linux-2.6.32.56/usr/initrd_data.S 2012-02-14 12:01:40.000000000 +0900
2962 @@ -0,0 +1,7 @@
2963 +.section .initrd_data,"a"
2964 +.global Initrd_Data
2965 +_initrdstart:
2966 +.incbin "usr/ramdisk.image.gz"
2967 +_initrdend:
2968 +Initrd_Data:
2969 +.word 0x494e5244 , _initrdstart , _initrdend

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26