blob: 6f7c207138e14ce10b4c009d7c87cd64a34a4a6b [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 */
Paul Mundta09d2832010-01-15 12:24:34 +090020static struct resource heartbeat_resource = {
21 .start = PA_LED,
22 .end = PA_LED,
23 .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090024};
25
26static struct platform_device heartbeat_device = {
27 .name = "heartbeat",
28 .id = -1,
Paul Mundta09d2832010-01-15 12:24:34 +090029 .num_resources = 1,
30 .resource = &heartbeat_resource,
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090031};
32
33/* SMC91x */
34static struct resource smc91x_eth_resources[] = {
35 [0] = {
36 .name = "smc91x-regs" ,
37 .start = PA_LAN + 0x300,
38 .end = PA_LAN + 0x300 + 0x10 ,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = SMC_IRQ,
43 .end = SMC_IRQ,
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48static struct platform_device smc91x_eth_device = {
49 .name = "smc91x",
50 .id = 0,
51 .dev = {
52 .dma_mask = NULL, /* don't use dma */
53 .coherent_dma_mask = 0xffffffff,
54 },
55 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
56 .resource = smc91x_eth_resources,
57};
58
59static struct platform_device *se7780_devices[] __initdata = {
60 &heartbeat_device,
61 &smc91x_eth_device,
62};
63
64static int __init se7780_devices_setup(void)
65{
66 return platform_add_devices(se7780_devices,
67 ARRAY_SIZE(se7780_devices));
68}
69device_initcall(se7780_devices_setup);
70
71#define GPIO_PHCR 0xFFEA000E
72#define GPIO_PMSELR 0xFFEA0080
73#define GPIO_PECR 0xFFEA0008
74
75static void __init se7780_setup(char **cmdline_p)
76{
77 /* "SH-Linux" on LED Display */
Paul Mundt9d56dd32010-01-26 12:58:40 +090078 __raw_writew( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
79 __raw_writew( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
80 __raw_writew( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
81 __raw_writew( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
82 __raw_writew( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
83 __raw_writew( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
84 __raw_writew( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
85 __raw_writew( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090086
87 printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
88
89 /*
90 * PCI REQ/GNT setting
91 * REQ0/GNT0 -> USB
92 * REQ1/GNT1 -> PC Card
93 * REQ2/GNT2 -> Serial ATA
94 * REQ3/GNT3 -> PCI slot
95 */
Paul Mundt9d56dd32010-01-26 12:58:40 +090096 __raw_writew(0x0213, FPGA_REQSEL);
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +090097
98 /* GPIO setting */
Paul Mundt9d56dd32010-01-26 12:58:40 +090099 __raw_writew(0x0000, GPIO_PECR);
100 __raw_writew(__raw_readw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
101 __raw_writew(0x0c00, GPIO_PMSELR);
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +0900102
103 /* iVDR Power ON */
Paul Mundt9d56dd32010-01-26 12:58:40 +0900104 __raw_writew(0x0001, FPGA_IVDRPW);
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +0900105}
106
107/*
108 * The Machine Vector
109 */
Paul Mundt82f81f42007-05-15 15:19:34 +0900110static struct sh_machine_vector mv_se7780 __initmv = {
Nobuhiro Iwamatsub7576232007-03-29 00:07:35 +0900111 .mv_name = "Solution Engine 7780" ,
112 .mv_setup = se7780_setup ,
113 .mv_nr_irqs = 111 ,
114 .mv_init_irq = init_se7780_IRQ,
115};