diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-30 19:38:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-30 19:38:21 -0400 |
commit | e1e302d8a9ab06ba8d7d5ec503d8996e6cf0eca4 (patch) | |
tree | 6a6c805fdfd6a2f6433956cbee348b2c3a277784 /arch/mips/txx9 | |
parent | 944ac4259e39801c843a915c3da8194ac9af0440 (diff) | |
parent | 7f82f000ed030d1108b4de47d9e2d556092980c6 (diff) |
Merge branch 'linus' into tracing/ftrace
Diffstat (limited to 'arch/mips/txx9')
-rw-r--r-- | arch/mips/txx9/Kconfig | 6 | ||||
-rw-r--r-- | arch/mips/txx9/generic/7segled.c | 112 | ||||
-rw-r--r-- | arch/mips/txx9/generic/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 37 | ||||
-rw-r--r-- | arch/mips/txx9/rbtx4939/setup.c | 74 |
5 files changed, 225 insertions, 5 deletions
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig index 17052db4161d..226e8bb2f0a1 100644 --- a/arch/mips/txx9/Kconfig +++ b/arch/mips/txx9/Kconfig | |||
@@ -46,9 +46,10 @@ config TOSHIBA_RBTX4938 | |||
46 | support this machine type | 46 | support this machine type |
47 | 47 | ||
48 | config TOSHIBA_RBTX4939 | 48 | config TOSHIBA_RBTX4939 |
49 | bool "Toshiba RBTX4939 bobard" | 49 | bool "Toshiba RBTX4939 board" |
50 | depends on MACH_TX49XX | 50 | depends on MACH_TX49XX |
51 | select SOC_TX4939 | 51 | select SOC_TX4939 |
52 | select TXX9_7SEGLED | ||
52 | help | 53 | help |
53 | This Toshiba board is based on the TX4939 processor. Say Y here to | 54 | This Toshiba board is based on the TX4939 processor. Say Y here to |
54 | support this machine type | 55 | support this machine type |
@@ -86,6 +87,9 @@ config SOC_TX4939 | |||
86 | select HW_HAS_PCI | 87 | select HW_HAS_PCI |
87 | select PCI_TX4927 | 88 | select PCI_TX4927 |
88 | 89 | ||
90 | config TXX9_7SEGLED | ||
91 | bool | ||
92 | |||
89 | config TOSHIBA_FPCIB0 | 93 | config TOSHIBA_FPCIB0 |
90 | bool "FPCIB0 Backplane Support" | 94 | bool "FPCIB0 Backplane Support" |
91 | depends on PCI && MACH_TXX9 | 95 | depends on PCI && MACH_TXX9 |
diff --git a/arch/mips/txx9/generic/7segled.c b/arch/mips/txx9/generic/7segled.c new file mode 100644 index 000000000000..727ab21b6618 --- /dev/null +++ b/arch/mips/txx9/generic/7segled.c | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * 7 Segment LED routines | ||
3 | * Based on RBTX49xx patch from CELF patch archive. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | * | ||
9 | * (C) Copyright TOSHIBA CORPORATION 2005-2007 | ||
10 | * All Rights Reserved. | ||
11 | */ | ||
12 | #include <linux/sysdev.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/map_to_7segment.h> | ||
15 | #include <asm/txx9/generic.h> | ||
16 | |||
17 | static unsigned int tx_7segled_num; | ||
18 | static void (*tx_7segled_putc)(unsigned int pos, unsigned char val); | ||
19 | |||
20 | void __init txx9_7segled_init(unsigned int num, | ||
21 | void (*putc)(unsigned int pos, unsigned char val)) | ||
22 | { | ||
23 | tx_7segled_num = num; | ||
24 | tx_7segled_putc = putc; | ||
25 | } | ||
26 | |||
27 | static SEG7_CONVERSION_MAP(txx9_seg7map, MAP_ASCII7SEG_ALPHANUM_LC); | ||
28 | |||
29 | int txx9_7segled_putc(unsigned int pos, char c) | ||
30 | { | ||
31 | if (pos >= tx_7segled_num) | ||
32 | return -EINVAL; | ||
33 | c = map_to_seg7(&txx9_seg7map, c); | ||
34 | if (c < 0) | ||
35 | return c; | ||
36 | tx_7segled_putc(pos, c); | ||
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static ssize_t ascii_store(struct sys_device *dev, | ||
41 | struct sysdev_attribute *attr, | ||
42 | const char *buf, size_t size) | ||
43 | { | ||
44 | unsigned int ch = dev->id; | ||
45 | txx9_7segled_putc(ch, buf[0]); | ||
46 | return size; | ||
47 | } | ||
48 | |||
49 | static ssize_t raw_store(struct sys_device *dev, | ||
50 | struct sysdev_attribute *attr, | ||
51 | const char *buf, size_t size) | ||
52 | { | ||
53 | unsigned int ch = dev->id; | ||
54 | tx_7segled_putc(ch, buf[0]); | ||
55 | return size; | ||
56 | } | ||
57 | |||
58 | static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); | ||
59 | static SYSDEV_ATTR(raw, 0200, NULL, raw_store); | ||
60 | |||
61 | static ssize_t map_seg7_show(struct sysdev_class *class, char *buf) | ||
62 | { | ||
63 | memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); | ||
64 | return sizeof(txx9_seg7map); | ||
65 | } | ||
66 | |||
67 | static ssize_t map_seg7_store(struct sysdev_class *class, | ||
68 | const char *buf, size_t size) | ||
69 | { | ||
70 | if (size != sizeof(txx9_seg7map)) | ||
71 | return -EINVAL; | ||
72 | memcpy(&txx9_seg7map, buf, size); | ||
73 | return size; | ||
74 | } | ||
75 | |||
76 | static SYSDEV_CLASS_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); | ||
77 | |||
78 | static struct sysdev_class tx_7segled_sysdev_class = { | ||
79 | .name = "7segled", | ||
80 | }; | ||
81 | |||
82 | static int __init tx_7segled_init_sysfs(void) | ||
83 | { | ||
84 | int error, i; | ||
85 | if (!tx_7segled_num) | ||
86 | return -ENODEV; | ||
87 | error = sysdev_class_register(&tx_7segled_sysdev_class); | ||
88 | if (error) | ||
89 | return error; | ||
90 | error = sysdev_class_create_file(&tx_7segled_sysdev_class, | ||
91 | &attr_map_seg7); | ||
92 | if (error) | ||
93 | return error; | ||
94 | for (i = 0; i < tx_7segled_num; i++) { | ||
95 | struct sys_device *dev; | ||
96 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
97 | if (!dev) { | ||
98 | error = -ENODEV; | ||
99 | break; | ||
100 | } | ||
101 | dev->id = i; | ||
102 | dev->cls = &tx_7segled_sysdev_class; | ||
103 | error = sysdev_register(dev); | ||
104 | if (!error) { | ||
105 | sysdev_create_file(dev, &attr_ascii); | ||
106 | sysdev_create_file(dev, &attr_raw); | ||
107 | } | ||
108 | } | ||
109 | return error; | ||
110 | } | ||
111 | |||
112 | device_initcall(tx_7segled_init_sysfs); | ||
diff --git a/arch/mips/txx9/generic/Makefile b/arch/mips/txx9/generic/Makefile index 0030d23bef5b..f2579ce054a1 100644 --- a/arch/mips/txx9/generic/Makefile +++ b/arch/mips/txx9/generic/Makefile | |||
@@ -10,5 +10,6 @@ obj-$(CONFIG_SOC_TX4938) += mem_tx4927.o setup_tx4938.o irq_tx4938.o | |||
10 | obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o | 10 | obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o |
11 | obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o | 11 | obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o |
12 | obj-$(CONFIG_SPI) += spi_eeprom.o | 12 | obj-$(CONFIG_SPI) += spi_eeprom.o |
13 | obj-$(CONFIG_TXX9_7SEGLED) += 7segled.o | ||
13 | 14 | ||
14 | EXTRA_CFLAGS += -Werror | 15 | EXTRA_CFLAGS += -Werror |
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 5526375010f8..a13a08b8c9ec 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -156,11 +156,23 @@ static struct txx9_board_vec *__init find_board_byname(const char *name) | |||
156 | 156 | ||
157 | static void __init prom_init_cmdline(void) | 157 | static void __init prom_init_cmdline(void) |
158 | { | 158 | { |
159 | int argc = (int)fw_arg0; | 159 | int argc; |
160 | int *argv32 = (int *)fw_arg1; | 160 | int *argv32; |
161 | int i; /* Always ignore the "-c" at argv[0] */ | 161 | int i; /* Always ignore the "-c" at argv[0] */ |
162 | char builtin[CL_SIZE]; | 162 | char builtin[CL_SIZE]; |
163 | 163 | ||
164 | if (fw_arg0 >= CKSEG0 || fw_arg1 < CKSEG0) { | ||
165 | /* | ||
166 | * argc is not a valid number, or argv32 is not a valid | ||
167 | * pointer | ||
168 | */ | ||
169 | argc = 0; | ||
170 | argv32 = NULL; | ||
171 | } else { | ||
172 | argc = (int)fw_arg0; | ||
173 | argv32 = (int *)fw_arg1; | ||
174 | } | ||
175 | |||
164 | /* ignore all built-in args if any f/w args given */ | 176 | /* ignore all built-in args if any f/w args given */ |
165 | /* | 177 | /* |
166 | * But if built-in strings was started with '+', append them | 178 | * But if built-in strings was started with '+', append them |
@@ -414,10 +426,12 @@ char * __init prom_getcmdline(void) | |||
414 | 426 | ||
415 | const char *__init prom_getenv(const char *name) | 427 | const char *__init prom_getenv(const char *name) |
416 | { | 428 | { |
417 | const s32 *str = (const s32 *)fw_arg2; | 429 | const s32 *str; |
418 | 430 | ||
419 | if (!str) | 431 | if (fw_arg2 < CKSEG0) |
420 | return NULL; | 432 | return NULL; |
433 | |||
434 | str = (const s32 *)fw_arg2; | ||
421 | /* YAMON style ("name", "value" pairs) */ | 435 | /* YAMON style ("name", "value" pairs) */ |
422 | while (str[0] && str[1]) { | 436 | while (str[0] && str[1]) { |
423 | if (!strcmp((const char *)(unsigned long)str[0], name)) | 437 | if (!strcmp((const char *)(unsigned long)str[0], name)) |
@@ -622,6 +636,21 @@ unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; | |||
622 | EXPORT_SYMBOL(__swizzle_addr_b); | 636 | EXPORT_SYMBOL(__swizzle_addr_b); |
623 | #endif | 637 | #endif |
624 | 638 | ||
639 | #ifdef NEEDS_TXX9_IOSWABW | ||
640 | static u16 ioswabw_default(volatile u16 *a, u16 x) | ||
641 | { | ||
642 | return le16_to_cpu(x); | ||
643 | } | ||
644 | static u16 __mem_ioswabw_default(volatile u16 *a, u16 x) | ||
645 | { | ||
646 | return x; | ||
647 | } | ||
648 | u16 (*ioswabw)(volatile u16 *a, u16 x) = ioswabw_default; | ||
649 | EXPORT_SYMBOL(ioswabw); | ||
650 | u16 (*__mem_ioswabw)(volatile u16 *a, u16 x) = __mem_ioswabw_default; | ||
651 | EXPORT_SYMBOL(__mem_ioswabw); | ||
652 | #endif | ||
653 | |||
625 | void __init txx9_physmap_flash_init(int no, unsigned long addr, | 654 | void __init txx9_physmap_flash_init(int no, unsigned long addr, |
626 | unsigned long size, | 655 | unsigned long size, |
627 | const struct physmap_flash_data *pdata) | 656 | const struct physmap_flash_data *pdata) |
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c index 9855d7bccc20..6daee9b1cd5e 100644 --- a/arch/mips/txx9/rbtx4939/setup.c +++ b/arch/mips/txx9/rbtx4939/setup.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/leds.h> | 16 | #include <linux/leds.h> |
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/smc91x.h> | ||
17 | #include <asm/reboot.h> | 19 | #include <asm/reboot.h> |
18 | #include <asm/txx9/generic.h> | 20 | #include <asm/txx9/generic.h> |
19 | #include <asm/txx9/pci.h> | 21 | #include <asm/txx9/pci.h> |
@@ -33,6 +35,21 @@ static void __init rbtx4939_time_init(void) | |||
33 | tx4939_time_init(0); | 35 | tx4939_time_init(0); |
34 | } | 36 | } |
35 | 37 | ||
38 | #if defined(__BIG_ENDIAN) && \ | ||
39 | (defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)) | ||
40 | #define HAVE_RBTX4939_IOSWAB | ||
41 | #define IS_CE1_ADDR(addr) \ | ||
42 | ((((unsigned long)(addr) - IO_BASE) & 0xfff00000) == TXX9_CE(1)) | ||
43 | static u16 rbtx4939_ioswabw(volatile u16 *a, u16 x) | ||
44 | { | ||
45 | return IS_CE1_ADDR(a) ? x : le16_to_cpu(x); | ||
46 | } | ||
47 | static u16 rbtx4939_mem_ioswabw(volatile u16 *a, u16 x) | ||
48 | { | ||
49 | return !IS_CE1_ADDR(a) ? x : le16_to_cpu(x); | ||
50 | } | ||
51 | #endif /* __BIG_ENDIAN && CONFIG_SMC91X */ | ||
52 | |||
36 | static void __init rbtx4939_pci_setup(void) | 53 | static void __init rbtx4939_pci_setup(void) |
37 | { | 54 | { |
38 | #ifdef CONFIG_PCI | 55 | #ifdef CONFIG_PCI |
@@ -239,6 +256,32 @@ static inline void rbtx4939_led_setup(void) | |||
239 | } | 256 | } |
240 | #endif | 257 | #endif |
241 | 258 | ||
259 | static void __rbtx4939_7segled_putc(unsigned int pos, unsigned char val) | ||
260 | { | ||
261 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | ||
262 | unsigned long flags; | ||
263 | local_irq_save(flags); | ||
264 | /* bit7: reserved for LED class */ | ||
265 | led_val[pos] = (led_val[pos] & 0x80) | (val & 0x7f); | ||
266 | val = led_val[pos]; | ||
267 | local_irq_restore(flags); | ||
268 | #endif | ||
269 | writeb(val, rbtx4939_7seg_addr(pos / 4, pos % 4)); | ||
270 | } | ||
271 | |||
272 | static void rbtx4939_7segled_putc(unsigned int pos, unsigned char val) | ||
273 | { | ||
274 | /* convert from map_to_seg7() notation */ | ||
275 | val = (val & 0x88) | | ||
276 | ((val & 0x40) >> 6) | | ||
277 | ((val & 0x20) >> 4) | | ||
278 | ((val & 0x10) >> 2) | | ||
279 | ((val & 0x04) << 2) | | ||
280 | ((val & 0x02) << 4) | | ||
281 | ((val & 0x01) << 6); | ||
282 | __rbtx4939_7segled_putc(pos, val); | ||
283 | } | ||
284 | |||
242 | static void __init rbtx4939_arch_init(void) | 285 | static void __init rbtx4939_arch_init(void) |
243 | { | 286 | { |
244 | rbtx4939_pci_setup(); | 287 | rbtx4939_pci_setup(); |
@@ -246,6 +289,22 @@ static void __init rbtx4939_arch_init(void) | |||
246 | 289 | ||
247 | static void __init rbtx4939_device_init(void) | 290 | static void __init rbtx4939_device_init(void) |
248 | { | 291 | { |
292 | unsigned long smc_addr = RBTX4939_ETHER_ADDR - IO_BASE; | ||
293 | struct resource smc_res[] = { | ||
294 | { | ||
295 | .start = smc_addr, | ||
296 | .end = smc_addr + 0x10 - 1, | ||
297 | .flags = IORESOURCE_MEM, | ||
298 | }, { | ||
299 | .start = RBTX4939_IRQ_ETHER, | ||
300 | /* override default irq flag defined in smc91x.h */ | ||
301 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
302 | }, | ||
303 | }; | ||
304 | struct smc91x_platdata smc_pdata = { | ||
305 | .flags = SMC91X_USE_16BIT, | ||
306 | }; | ||
307 | struct platform_device *pdev; | ||
249 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) | 308 | #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE) |
250 | int i, j; | 309 | int i, j; |
251 | unsigned char ethaddr[2][6]; | 310 | unsigned char ethaddr[2][6]; |
@@ -262,6 +321,12 @@ static void __init rbtx4939_device_init(void) | |||
262 | } | 321 | } |
263 | tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); | 322 | tx4939_ethaddr_init(ethaddr[0], ethaddr[1]); |
264 | #endif | 323 | #endif |
324 | pdev = platform_device_alloc("smc91x", -1); | ||
325 | if (!pdev || | ||
326 | platform_device_add_resources(pdev, smc_res, ARRAY_SIZE(smc_res)) || | ||
327 | platform_device_add_data(pdev, &smc_pdata, sizeof(smc_pdata)) || | ||
328 | platform_device_add(pdev)) | ||
329 | platform_device_put(pdev); | ||
265 | rbtx4939_led_setup(); | 330 | rbtx4939_led_setup(); |
266 | tx4939_wdt_init(); | 331 | tx4939_wdt_init(); |
267 | tx4939_ata_init(); | 332 | tx4939_ata_init(); |
@@ -269,6 +334,8 @@ static void __init rbtx4939_device_init(void) | |||
269 | 334 | ||
270 | static void __init rbtx4939_setup(void) | 335 | static void __init rbtx4939_setup(void) |
271 | { | 336 | { |
337 | int i; | ||
338 | |||
272 | rbtx4939_ebusc_setup(); | 339 | rbtx4939_ebusc_setup(); |
273 | /* always enable ATA0 */ | 340 | /* always enable ATA0 */ |
274 | txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE); | 341 | txx9_set64(&tx4939_ccfgptr->pcfg, TX4939_PCFG_ATA0MODE); |
@@ -276,9 +343,16 @@ static void __init rbtx4939_setup(void) | |||
276 | if (txx9_master_clock == 0) | 343 | if (txx9_master_clock == 0) |
277 | txx9_master_clock = 20000000; | 344 | txx9_master_clock = 20000000; |
278 | tx4939_setup(); | 345 | tx4939_setup(); |
346 | #ifdef HAVE_RBTX4939_IOSWAB | ||
347 | ioswabw = rbtx4939_ioswabw; | ||
348 | __mem_ioswabw = rbtx4939_mem_ioswabw; | ||
349 | #endif | ||
279 | 350 | ||
280 | _machine_restart = rbtx4939_machine_restart; | 351 | _machine_restart = rbtx4939_machine_restart; |
281 | 352 | ||
353 | txx9_7segled_init(RBTX4939_MAX_7SEGLEDS, rbtx4939_7segled_putc); | ||
354 | for (i = 0; i < RBTX4939_MAX_7SEGLEDS; i++) | ||
355 | txx9_7segled_putc(i, '-'); | ||
282 | pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", | 356 | pr_info("RBTX4939 (Rev %02x) --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", |
283 | readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr), | 357 | readb(rbtx4939_board_rev_addr), readb(rbtx4939_ioc_rev_addr), |
284 | readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr)); | 358 | readb(rbtx4939_udipsw_addr), readb(rbtx4939_bdipsw_addr)); |