blob: 2241659c32990c2336b95ce9bb4865ae1c502c32 [file] [log] [blame]
Nicholas Beck4862ec02008-01-23 12:50:51 +09001/*
2 * arch/sh/boards/renesas/sdk7780/setup.c
3 *
4 * Renesas Solutions SH7780 SDK Support
5 * Copyright (C) 2008 Nicholas Beck <nbeck@mpc-data.co.uk>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/init.h>
12#include <linux/types.h>
13#include <linux/platform_device.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050014#include <linux/ata_platform.h>
Nicholas Beck4862ec02008-01-23 12:50:51 +090015#include <asm/machvec.h>
Paul Mundt7639a452008-10-20 13:02:48 +090016#include <mach/sdk7780.h>
Nicholas Beck4862ec02008-01-23 12:50:51 +090017#include <asm/heartbeat.h>
18#include <asm/io.h>
19#include <asm/addrspace.h>
20
21#define GPIO_PECR 0xFFEA0008
22
Paul Mundta09d2832010-01-15 12:24:34 +090023/* Heartbeat */
24static struct resource heartbeat_resource = {
25 .start = PA_LED,
26 .end = PA_LED,
27 .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
Nicholas Beck4862ec02008-01-23 12:50:51 +090028};
29
30static struct platform_device heartbeat_device = {
31 .name = "heartbeat",
32 .id = -1,
Paul Mundt14965f12010-01-19 20:10:33 +090033 .num_resources = 1,
Paul Mundta09d2832010-01-15 12:24:34 +090034 .resource = &heartbeat_resource,
Nicholas Beck4862ec02008-01-23 12:50:51 +090035};
36
37/* SMC91x */
38static struct resource smc91x_eth_resources[] = {
39 [0] = {
40 .name = "smc91x-regs" ,
41 .start = PA_LAN + 0x300,
42 .end = PA_LAN + 0x300 + 0x10 ,
43 .flags = IORESOURCE_MEM,
44 },
45 [1] = {
46 .start = IRQ_ETHERNET,
47 .end = IRQ_ETHERNET,
48 .flags = IORESOURCE_IRQ,
49 },
50};
51
52static struct platform_device smc91x_eth_device = {
53 .name = "smc91x",
54 .id = 0,
55 .dev = {
56 .dma_mask = NULL, /* don't use dma */
57 .coherent_dma_mask = 0xffffffff,
58 },
59 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
60 .resource = smc91x_eth_resources,
61};
62
63static struct platform_device *sdk7780_devices[] __initdata = {
64 &heartbeat_device,
65 &smc91x_eth_device,
66};
67
68static int __init sdk7780_devices_setup(void)
69{
70 return platform_add_devices(sdk7780_devices,
71 ARRAY_SIZE(sdk7780_devices));
72}
73device_initcall(sdk7780_devices_setup);
74
75static void __init sdk7780_setup(char **cmdline_p)
76{
Paul Mundt9d56dd32010-01-26 12:58:40 +090077 u16 ver = __raw_readw(FPGA_FPVERR);
78 u16 dateStamp = __raw_readw(FPGA_FPDATER);
Nicholas Beck4862ec02008-01-23 12:50:51 +090079
80 printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
81 printk(KERN_INFO "Board version: %d (revision %d), "
82 "FPGA version: %d (revision %d), datestamp : %d\n",
83 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
84 (ver >> 4) & 0xf, ver & 0xf,
85 dateStamp);
86
87 /* Setup pin mux'ing for PCIC */
Paul Mundt9d56dd32010-01-26 12:58:40 +090088 __raw_writew(0x0000, GPIO_PECR);
Nicholas Beck4862ec02008-01-23 12:50:51 +090089}
90
91/*
92 * The Machine Vector
93 */
94static struct sh_machine_vector mv_se7780 __initmv = {
95 .mv_name = "Renesas SDK7780-R3" ,
96 .mv_setup = sdk7780_setup,
Nicholas Beck4862ec02008-01-23 12:50:51 +090097 .mv_init_irq = init_sdk7780_IRQ,
98};
99