diff options
author | Ryusuke Sakato <sakato.ryusuke@renesas.com> | 2007-04-30 20:45:29 -0400 |
---|---|---|
committer | Paul Mundt <lethal@hera.kernel.org> | 2007-05-06 22:11:57 -0400 |
commit | 6865f0ea6ad91fec3ae7831c49d48b5a7db4b428 (patch) | |
tree | f5e58cf973b6c49ed04dafb7fdc035f10d3366d3 /arch/sh/boards/se | |
parent | 6b817c03489083a7457cda16b953a214dcef8d64 (diff) |
sh: Solution Engine 7722 board support.
This adds more full-featured support for the SH7722 Solution Engine.
Previously this was using the generic board, and lacked most of the
peripheral support.
Signed-off-by: Ryusuke Sakato <sakato.ryusuke@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/se')
-rw-r--r-- | arch/sh/boards/se/7722/Makefile | 10 | ||||
-rw-r--r-- | arch/sh/boards/se/7722/irq.c | 101 | ||||
-rw-r--r-- | arch/sh/boards/se/7722/setup.c | 148 |
3 files changed, 259 insertions, 0 deletions
diff --git a/arch/sh/boards/se/7722/Makefile b/arch/sh/boards/se/7722/Makefile new file mode 100644 index 000000000000..8694373389e5 --- /dev/null +++ b/arch/sh/boards/se/7722/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for the HITACHI UL SolutionEngine 7722 specific parts of the kernel | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | # | ||
9 | |||
10 | obj-y := setup.o irq.o | ||
diff --git a/arch/sh/boards/se/7722/irq.c b/arch/sh/boards/se/7722/irq.c new file mode 100644 index 000000000000..099e5deb77f8 --- /dev/null +++ b/arch/sh/boards/se/7722/irq.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7722/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7722 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <asm/irq.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/se7722.h> | ||
18 | |||
19 | #define INTC_INTMSK0 0xFFD00044 | ||
20 | #define INTC_INTMSKCLR0 0xFFD00064 | ||
21 | |||
22 | static void disable_se7722_irq(unsigned int irq) | ||
23 | { | ||
24 | struct ipr_data *p = get_irq_chip_data(irq); | ||
25 | ctrl_outw( ctrl_inw( p->addr ) | p->priority , p->addr ); | ||
26 | } | ||
27 | |||
28 | static void enable_se7722_irq(unsigned int irq) | ||
29 | { | ||
30 | struct ipr_data *p = get_irq_chip_data(irq); | ||
31 | ctrl_outw( ctrl_inw( p->addr ) & ~p->priority , p->addr ); | ||
32 | } | ||
33 | |||
34 | static struct irq_chip se7722_irq_chip __read_mostly = { | ||
35 | .name = "SE7722", | ||
36 | .mask = disable_se7722_irq, | ||
37 | .unmask = enable_se7722_irq, | ||
38 | .mask_ack = disable_se7722_irq, | ||
39 | }; | ||
40 | |||
41 | static struct ipr_data ipr_irq_table[] = { | ||
42 | /* irq ,idx,sft, priority , addr */ | ||
43 | { MRSHPC_IRQ0 , 0 , 0 , MRSHPC_BIT0 , IRQ01_MASK } , | ||
44 | { MRSHPC_IRQ1 , 0 , 0 , MRSHPC_BIT1 , IRQ01_MASK } , | ||
45 | { MRSHPC_IRQ2 , 0 , 0 , MRSHPC_BIT2 , IRQ01_MASK } , | ||
46 | { MRSHPC_IRQ3 , 0 , 0 , MRSHPC_BIT3 , IRQ01_MASK } , | ||
47 | { SMC_IRQ , 0 , 0 , SMC_BIT , IRQ01_MASK } , | ||
48 | { EXT_IRQ , 0 , 0 , EXT_BIT , IRQ01_MASK } , | ||
49 | }; | ||
50 | |||
51 | int se7722_irq_demux(int irq) | ||
52 | { | ||
53 | |||
54 | if ((irq == IRQ0_IRQ)||(irq == IRQ1_IRQ)) { | ||
55 | volatile unsigned short intv = | ||
56 | *(volatile unsigned short *)IRQ01_STS; | ||
57 | if (irq == IRQ0_IRQ){ | ||
58 | if(intv & SMC_BIT ) { | ||
59 | return SMC_IRQ; | ||
60 | } else if(intv & USB_BIT) { | ||
61 | return USB_IRQ; | ||
62 | } else { | ||
63 | printk("intv =%04x\n", intv); | ||
64 | return SMC_IRQ; | ||
65 | } | ||
66 | } else if(irq == IRQ1_IRQ){ | ||
67 | if(intv & MRSHPC_BIT0) { | ||
68 | return MRSHPC_IRQ0; | ||
69 | } else if(intv & MRSHPC_BIT1) { | ||
70 | return MRSHPC_IRQ1; | ||
71 | } else if(intv & MRSHPC_BIT2) { | ||
72 | return MRSHPC_IRQ2; | ||
73 | } else if(intv & MRSHPC_BIT3) { | ||
74 | return MRSHPC_IRQ3; | ||
75 | } else { | ||
76 | printk("BIT_EXTENTION =%04x\n", intv); | ||
77 | return EXT_IRQ; | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | return irq; | ||
82 | |||
83 | } | ||
84 | /* | ||
85 | * Initialize IRQ setting | ||
86 | */ | ||
87 | void __init init_se7722_IRQ(void) | ||
88 | { | ||
89 | int i = 0; | ||
90 | ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */ | ||
91 | ctrl_outl((3 << ((7 - 0) * 4))|(3 << ((7 - 1) * 4)), INTC_INTPRI0); /* irq0 pri=3,irq1,pri=3 */ | ||
92 | ctrl_outw((2 << ((7 - 0) * 2))|(2 << ((7 - 1) * 2)), INTC_ICR1); /* irq0,1 low-level irq */ | ||
93 | |||
94 | for (i = 0; i < ARRAY_SIZE(ipr_irq_table); i++) { | ||
95 | disable_irq_nosync(ipr_irq_table[i].irq); | ||
96 | set_irq_chip_and_handler_name( ipr_irq_table[i].irq, &se7722_irq_chip, | ||
97 | handle_level_irq, "level"); | ||
98 | set_irq_chip_data( ipr_irq_table[i].irq, &ipr_irq_table[i] ); | ||
99 | disable_se7722_irq(ipr_irq_table[i].irq); | ||
100 | } | ||
101 | } | ||
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c new file mode 100644 index 000000000000..636ca6c987e0 --- /dev/null +++ b/arch/sh/boards/se/7722/setup.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7722/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7722 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | * | ||
12 | */ | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/pata_platform.h> | ||
16 | #include <asm/machvec.h> | ||
17 | #include <asm/se7722.h> | ||
18 | #include <asm/io.h> | ||
19 | |||
20 | /* Heartbeat */ | ||
21 | static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; | ||
22 | |||
23 | static struct resource heartbeat_resources[] = { | ||
24 | [0] = { | ||
25 | .start = PA_LED, | ||
26 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | }; | ||
30 | |||
31 | static struct platform_device heartbeat_device = { | ||
32 | .name = "heartbeat", | ||
33 | .id = -1, | ||
34 | .dev = { | ||
35 | .platform_data = heartbeat_bit_pos, | ||
36 | }, | ||
37 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
38 | .resource = heartbeat_resources, | ||
39 | }; | ||
40 | |||
41 | /* SMC91x */ | ||
42 | static struct resource smc91x_eth_resources[] = { | ||
43 | [0] = { | ||
44 | .name = "smc91x-regs" , | ||
45 | .start = PA_LAN + 0x300, | ||
46 | .end = PA_LAN + 0x300 + 0x10 , | ||
47 | .flags = IORESOURCE_MEM, | ||
48 | }, | ||
49 | [1] = { | ||
50 | .start = SMC_IRQ, | ||
51 | .end = SMC_IRQ, | ||
52 | .flags = IORESOURCE_IRQ, | ||
53 | }, | ||
54 | }; | ||
55 | |||
56 | static struct platform_device smc91x_eth_device = { | ||
57 | .name = "smc91x", | ||
58 | .id = 0, | ||
59 | .dev = { | ||
60 | .dma_mask = NULL, /* don't use dma */ | ||
61 | .coherent_dma_mask = 0xffffffff, | ||
62 | }, | ||
63 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | ||
64 | .resource = smc91x_eth_resources, | ||
65 | }; | ||
66 | |||
67 | static struct resource cf_ide_resources[] = { | ||
68 | [0] = { | ||
69 | .start = PA_MRSHPC_IO + 0x1f0, | ||
70 | .end = PA_MRSHPC_IO + 0x1f0 + 8 , | ||
71 | .flags = IORESOURCE_IO, | ||
72 | }, | ||
73 | [1] = { | ||
74 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, | ||
75 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, | ||
76 | .flags = IORESOURCE_IO, | ||
77 | }, | ||
78 | [2] = { | ||
79 | .start = MRSHPC_IRQ0, | ||
80 | .flags = IORESOURCE_IRQ, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct platform_device cf_ide_device = { | ||
85 | .name = "pata_platform", | ||
86 | .id = -1, | ||
87 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
88 | .resource = cf_ide_resources, | ||
89 | }; | ||
90 | |||
91 | static struct platform_device *se7722_devices[] __initdata = { | ||
92 | &heartbeat_device, | ||
93 | &smc91x_eth_device, | ||
94 | &cf_ide_device, | ||
95 | }; | ||
96 | |||
97 | static int __init se7722_devices_setup(void) | ||
98 | { | ||
99 | return platform_add_devices(se7722_devices, | ||
100 | ARRAY_SIZE(se7722_devices)); | ||
101 | } | ||
102 | device_initcall(se7722_devices_setup); | ||
103 | |||
104 | static void __init se7722_setup(char **cmdline_p) | ||
105 | { | ||
106 | ctrl_outw(0x010D, FPGA_OUT); /* FPGA */ | ||
107 | |||
108 | ctrl_outl(0x00051001, MSTPCR0); | ||
109 | ctrl_outl(0x00000000, MSTPCR1); | ||
110 | /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */ | ||
111 | ctrl_outl(0xffffbfC0, MSTPCR2); | ||
112 | |||
113 | ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ | ||
114 | ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ | ||
115 | |||
116 | /* LCDC I/O */ | ||
117 | ctrl_outw(0x0020, PORT_PSELD); | ||
118 | |||
119 | /* SIOF1*/ | ||
120 | ctrl_outw(0x0003, PORT_PSELB); | ||
121 | ctrl_outw(0xe000, PORT_PSELC); | ||
122 | ctrl_outw(0x0000, PORT_PKCR); | ||
123 | |||
124 | /* LCDC */ | ||
125 | ctrl_outw(0x4020, PORT_PHCR); | ||
126 | ctrl_outw(0x0000, PORT_PLCR); | ||
127 | ctrl_outw(0x0000, PORT_PMCR); | ||
128 | ctrl_outw(0x0002, PORT_PRCR); | ||
129 | ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */ | ||
130 | |||
131 | /* KEYSC */ | ||
132 | ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */ | ||
133 | ctrl_outw(0x0000, PORT_PYCR); | ||
134 | ctrl_outw(0x0000, PORT_PZCR); | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * The Machine Vector | ||
139 | */ | ||
140 | struct sh_machine_vector mv_se7722 __initmv = { | ||
141 | .mv_name = "Solution Engine 7722" , | ||
142 | .mv_setup = se7722_setup , | ||
143 | .mv_nr_irqs = 109 , | ||
144 | .mv_init_irq = init_se7722_IRQ, | ||
145 | .mv_irq_demux = se7722_irq_demux, | ||
146 | |||
147 | }; | ||
148 | ALIAS_MV(se7722) | ||