blob: 1d3a867e94e3ad90fd653086705b181898605105 [file] [log] [blame]
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +09001/*
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>
Paul Mundt939a24a2008-07-29 21:41:37 +090015#include <mach-se/mach/se7780.h>
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090016#include <asm/io.h>
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090017#include <asm/heartbeat.h>
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090018
19/* Heartbeat */
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090020static struct heartbeat_data heartbeat_data = {
21 .regsize = 16,
22};
23
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090024static struct resource heartbeat_resources[] = {
25 [0] = {
26 .start = PA_LED,
Paul Mundta1fd3062007-08-23 15:11:44 +090027 .end = PA_LED,
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090028 .flags = IORESOURCE_MEM,
29 },
30};
31
32static struct platform_device heartbeat_device = {
33 .name = "heartbeat",
34 .id = -1,
Nobuhiro Iwamatsu9c88b6b2007-11-07 14:56:46 +090035 .dev = {
36 .platform_data = &heartbeat_data,
37 },
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090038 .num_resources = ARRAY_SIZE(heartbeat_resources),
39 .resource = heartbeat_resources,
40};
41
42/* SMC91x */
43static struct resource smc91x_eth_resources[] = {
44 [0] = {
45 .name = "smc91x-regs" ,
46 .start = PA_LAN + 0x300,
47 .end = PA_LAN + 0x300 + 0x10 ,
48 .flags = IORESOURCE_MEM,
49 },
50 [1] = {
51 .start = SMC_IRQ,
52 .end = SMC_IRQ,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device smc91x_eth_device = {
58 .name = "smc91x",
59 .id = 0,
60 .dev = {
61 .dma_mask = NULL, /* don't use dma */
62 .coherent_dma_mask = 0xffffffff,
63 },
64 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
65 .resource = smc91x_eth_resources,
66};
67
68static struct platform_device *se7780_devices[] __initdata = {
69 &heartbeat_device,
70 &smc91x_eth_device,
71};
72
73static int __init se7780_devices_setup(void)
74{
75 return platform_add_devices(se7780_devices,
76 ARRAY_SIZE(se7780_devices));
77}
78device_initcall(se7780_devices_setup);
79
80#define GPIO_PHCR 0xFFEA000E
81#define GPIO_PMSELR 0xFFEA0080
82#define GPIO_PECR 0xFFEA0008
83
84static void __init se7780_setup(char **cmdline_p)
85{
86 /* "SH-Linux" on LED Display */
87 ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
88 ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
89 ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
90 ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
91 ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
92 ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
93 ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
94 ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
95
96 printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
97
98 /*
99 * PCI REQ/GNT setting
100 * REQ0/GNT0 -> USB
101 * REQ1/GNT1 -> PC Card
102 * REQ2/GNT2 -> Serial ATA
103 * REQ3/GNT3 -> PCI slot
104 */
105 ctrl_outw(0x0213, FPGA_REQSEL);
106
107 /* GPIO setting */
108 ctrl_outw(0x0000, GPIO_PECR);
109 ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
110 ctrl_outw(0x0c00, GPIO_PMSELR);
111
112 /* iVDR Power ON */
113 ctrl_outw(0x0001, FPGA_IVDRPW);
114}
115
116/*
117 * The Machine Vector
118 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900119static struct sh_machine_vector mv_se7780 __initmv = {
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +0900120 .mv_name = "Solution Engine 7780" ,
121 .mv_setup = se7780_setup ,
122 .mv_nr_irqs = 111 ,
123 .mv_init_irq = init_se7780_IRQ,
124};