aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.zh@hitachi.com>2007-03-28 11:07:35 -0400
committerPaul Mundt <lethal@hera.kernel.org>2007-05-06 22:11:55 -0400
commitb75762302e144b73f12b72c59b99401d036680aa (patch)
tree92b2ea71d705652bcb3ec9435e86fcf9c06b5757 /arch/sh/boards
parentcd6c7ea234dc8a8607283e056d8010b2bd3c6369 (diff)
sh: SH7780 Solution Engine board support.
This adds support for the SH7780-based Solution Engine reference board. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.zh@hitachi.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/se/7780/Makefile10
-rw-r--r--arch/sh/boards/se/7780/irq.c89
-rw-r--r--arch/sh/boards/se/7780/setup.c122
3 files changed, 221 insertions, 0 deletions
diff --git a/arch/sh/boards/se/7780/Makefile b/arch/sh/boards/se/7780/Makefile
new file mode 100644
index 000000000000..6b88adae3ecc
--- /dev/null
+++ b/arch/sh/boards/se/7780/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for the HITACHI UL SolutionEngine 7780 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
10obj-y := setup.o irq.o
diff --git a/arch/sh/boards/se/7780/irq.c b/arch/sh/boards/se/7780/irq.c
new file mode 100644
index 000000000000..3d0625c2d07b
--- /dev/null
+++ b/arch/sh/boards/se/7780/irq.c
@@ -0,0 +1,89 @@
1/*
2 * linux/arch/sh/boards/se/7780/irq.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 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/se7780.h>
18
19#define INTC_INTMSK0 0xFFD00044
20#define INTC_INTMSKCLR0 0xFFD00064
21
22static void disable_se7780_irq(unsigned int irq)
23{
24 struct intc2_data *p = get_irq_chip_data(irq);
25 ctrl_outl(1 << p->msk_shift, INTC_INTMSK0 + p->msk_offset);
26}
27
28static void enable_se7780_irq(unsigned int irq)
29{
30 struct intc2_data *p = get_irq_chip_data(irq);
31 ctrl_outl(1 << p->msk_shift, INTC_INTMSKCLR0 + p->msk_offset);
32}
33
34static struct irq_chip se7780_irq_chip __read_mostly = {
35 .name = "SE7780",
36 .mask = disable_se7780_irq,
37 .unmask = enable_se7780_irq,
38 .mask_ack = disable_se7780_irq,
39};
40
41static struct intc2_data intc2_irq_table[] = {
42 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT1 */
43 { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT2 */
44 { 6, 0, 29, 0, 29, 3 }, /* daughter board EXTINT3 */
45 { 8, 0, 28, 0, 28, 3 }, /* SMC 91C111 (LAN) */
46 { 10, 0, 27, 0, 27, 3 }, /* daughter board EXTINT4 */
47 { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT5 */
48 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT6 */
49 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT7 */
50 { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT8 */
51 { 0 , 0, 24, 0, 24, 3 }, /* SM501 */
52};
53
54/*
55 * Initialize IRQ setting
56 */
57void __init init_se7780_IRQ(void)
58{
59 int i ;
60
61 /* enable all interrupt at FPGA */
62 ctrl_outw(0, FPGA_INTMSK1);
63 /* mask SM501 interrupt */
64 ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
65 /* enable all interrupt at FPGA */
66 ctrl_outw(0, FPGA_INTMSK2);
67
68 /* set FPGA INTSEL register */
69 /* FPGA + 0x06 */
70 ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) |
71 (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1);
72
73 /* FPGA + 0x08 */
74 ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
75 (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) |
76 (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) |
77 (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2);
78
79 /* FPGA + 0x0A */
80 ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
81
82 for (i = 0; i < ARRAY_SIZE(intc2_irq_table); i++) {
83 disable_irq_nosync(intc2_irq_table[i].irq);
84 set_irq_chip_and_handler_name( intc2_irq_table[i].irq, &se7780_irq_chip,
85 handle_level_irq, "level");
86 set_irq_chip_data( intc2_irq_table[i].irq, &intc2_irq_table[i] );
87 disable_se7780_irq(intc2_irq_table[i].irq);
88 }
89}
diff --git a/arch/sh/boards/se/7780/setup.c b/arch/sh/boards/se/7780/setup.c
new file mode 100644
index 000000000000..df7d08a24c9f
--- /dev/null
+++ b/arch/sh/boards/se/7780/setup.c
@@ -0,0 +1,122 @@
1/*
2 * linux/arch/sh/boards/se/7780/setup.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 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/platform_device.h>
14#include <asm/machvec.h>
15#include <asm/se7780.h>
16#include <asm/io.h>
17
18/* Heartbeat */
19static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
20
21static struct resource heartbeat_resources[] = {
22 [0] = {
23 .start = PA_LED,
24 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
25 .flags = IORESOURCE_MEM,
26 },
27};
28
29static struct platform_device heartbeat_device = {
30 .name = "heartbeat",
31 .id = -1,
32 .dev = {
33 .platform_data = heartbeat_bit_pos,
34 },
35 .num_resources = ARRAY_SIZE(heartbeat_resources),
36 .resource = heartbeat_resources,
37};
38
39/* SMC91x */
40static struct resource smc91x_eth_resources[] = {
41 [0] = {
42 .name = "smc91x-regs" ,
43 .start = PA_LAN + 0x300,
44 .end = PA_LAN + 0x300 + 0x10 ,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = SMC_IRQ,
49 .end = SMC_IRQ,
50 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct platform_device smc91x_eth_device = {
55 .name = "smc91x",
56 .id = 0,
57 .dev = {
58 .dma_mask = NULL, /* don't use dma */
59 .coherent_dma_mask = 0xffffffff,
60 },
61 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
62 .resource = smc91x_eth_resources,
63};
64
65static struct platform_device *se7780_devices[] __initdata = {
66 &heartbeat_device,
67 &smc91x_eth_device,
68};
69
70static int __init se7780_devices_setup(void)
71{
72 return platform_add_devices(se7780_devices,
73 ARRAY_SIZE(se7780_devices));
74}
75device_initcall(se7780_devices_setup);
76
77#define GPIO_PHCR 0xFFEA000E
78#define GPIO_PMSELR 0xFFEA0080
79#define GPIO_PECR 0xFFEA0008
80
81static void __init se7780_setup(char **cmdline_p)
82{
83 /* "SH-Linux" on LED Display */
84 ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
85 ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
86 ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
87 ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
88 ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
89 ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
90 ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
91 ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
92
93 printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
94
95 /*
96 * PCI REQ/GNT setting
97 * REQ0/GNT0 -> USB
98 * REQ1/GNT1 -> PC Card
99 * REQ2/GNT2 -> Serial ATA
100 * REQ3/GNT3 -> PCI slot
101 */
102 ctrl_outw(0x0213, FPGA_REQSEL);
103
104 /* GPIO setting */
105 ctrl_outw(0x0000, GPIO_PECR);
106 ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
107 ctrl_outw(0x0c00, GPIO_PMSELR);
108
109 /* iVDR Power ON */
110 ctrl_outw(0x0001, FPGA_IVDRPW);
111}
112
113/*
114 * The Machine Vector
115 */
116struct sh_machine_vector mv_se7780 __initmv = {
117 .mv_name = "Solution Engine 7780" ,
118 .mv_setup = se7780_setup ,
119 .mv_nr_irqs = 111 ,
120 .mv_init_irq = init_se7780_IRQ,
121};
122ALIAS_MV(se7780)