blob: bab5b95139048a10d1e845b521ca74a4b84952a3 [file] [log] [blame]
Luca Santini3db91702008-09-08 12:01:15 +09001/*
2 * Renesas Europe EDOSK7760 Board Support
3 *
4 * Copyright (C) 2008 SPES Societa' Progettazione Elettronica e Software Ltd.
5 * Author: Luca Santini <luca.santini@spesonline.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21#include <linux/init.h>
22#include <linux/types.h>
23#include <linux/platform_device.h>
24#include <linux/smc91x.h>
25#include <linux/interrupt.h>
Paul Mundt03c57132012-05-18 14:52:31 +090026#include <linux/sh_intc.h>
Luca Santini3db91702008-09-08 12:01:15 +090027#include <linux/i2c.h>
Luca Santini4018ffc2008-09-12 18:07:16 +090028#include <linux/mtd/physmap.h>
Luca Santini3db91702008-09-08 12:01:15 +090029#include <asm/machvec.h>
30#include <asm/io.h>
31#include <asm/addrspace.h>
32#include <asm/delay.h>
33#include <asm/i2c-sh7760.h>
Luca Santini347cd342008-09-21 10:32:29 +090034#include <asm/sizes.h>
Luca Santini3db91702008-09-08 12:01:15 +090035
36/* Bus state controller registers for CS4 area */
37#define BSC_CS4BCR 0xA4FD0010
38#define BSC_CS4WCR 0xA4FD0030
39
40#define SMC_IOBASE 0xA2000000
41#define SMC_IO_OFFSET 0x300
42#define SMC_IOADDR (SMC_IOBASE + SMC_IO_OFFSET)
43
Luca Santini4018ffc2008-09-12 18:07:16 +090044/* NOR flash */
45static struct mtd_partition edosk7760_nor_flash_partitions[] = {
46 {
47 .name = "bootloader",
48 .offset = 0,
Luca Santini347cd342008-09-21 10:32:29 +090049 .size = SZ_256K,
Luca Santini4018ffc2008-09-12 18:07:16 +090050 .mask_flags = MTD_WRITEABLE, /* Read-only */
51 }, {
52 .name = "kernel",
53 .offset = MTDPART_OFS_APPEND,
Luca Santini347cd342008-09-21 10:32:29 +090054 .size = SZ_2M,
Luca Santini4018ffc2008-09-12 18:07:16 +090055 }, {
56 .name = "fs",
57 .offset = MTDPART_OFS_APPEND,
Paul Mundtf47adbb2011-03-22 22:43:09 +090058 .size = (26 << 20),
Luca Santini4018ffc2008-09-12 18:07:16 +090059 }, {
60 .name = "other",
61 .offset = MTDPART_OFS_APPEND,
62 .size = MTDPART_SIZ_FULL,
63 },
64};
65
66static struct physmap_flash_data edosk7760_nor_flash_data = {
67 .width = 4,
68 .parts = edosk7760_nor_flash_partitions,
69 .nr_parts = ARRAY_SIZE(edosk7760_nor_flash_partitions),
70};
71
72static struct resource edosk7760_nor_flash_resources[] = {
73 [0] = {
74 .name = "NOR Flash",
75 .start = 0x00000000,
Luca Santini347cd342008-09-21 10:32:29 +090076 .end = 0x00000000 + SZ_32M - 1,
Luca Santini4018ffc2008-09-12 18:07:16 +090077 .flags = IORESOURCE_MEM,
78 }
79};
80
81static struct platform_device edosk7760_nor_flash_device = {
82 .name = "physmap-flash",
83 .resource = edosk7760_nor_flash_resources,
84 .num_resources = ARRAY_SIZE(edosk7760_nor_flash_resources),
85 .dev = {
86 .platform_data = &edosk7760_nor_flash_data,
87 },
88};
89
Luca Santini3db91702008-09-08 12:01:15 +090090/* i2c initialization functions */
91static struct sh7760_i2c_platdata i2c_pd = {
92 .speed_khz = 400,
93};
94
95static struct resource sh7760_i2c1_res[] = {
96 {
97 .start = SH7760_I2C1_MMIO,
98 .end = SH7760_I2C1_MMIOEND,
99 .flags = IORESOURCE_MEM,
100 },{
Paul Mundt03c57132012-05-18 14:52:31 +0900101 .start = evt2irq(0x9e0),
102 .end = evt2irq(0x9e0),
Luca Santini3db91702008-09-08 12:01:15 +0900103 .flags = IORESOURCE_IRQ,
104 },
105};
106
107static struct platform_device sh7760_i2c1_dev = {
108 .dev = {
109 .platform_data = &i2c_pd,
110 },
111
112 .name = SH7760_I2C_DEVNAME,
113 .id = 1,
114 .resource = sh7760_i2c1_res,
115 .num_resources = ARRAY_SIZE(sh7760_i2c1_res),
116};
117
118static struct resource sh7760_i2c0_res[] = {
119 {
120 .start = SH7760_I2C0_MMIO,
121 .end = SH7760_I2C0_MMIOEND,
122 .flags = IORESOURCE_MEM,
123 }, {
Paul Mundt03c57132012-05-18 14:52:31 +0900124 .start = evt2irq(0x9c0),
125 .end = evt2irq(0x9c0),
Luca Santini3db91702008-09-08 12:01:15 +0900126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device sh7760_i2c0_dev = {
131 .dev = {
132 .platform_data = &i2c_pd,
133 },
134 .name = SH7760_I2C_DEVNAME,
135 .id = 0,
136 .resource = sh7760_i2c0_res,
137 .num_resources = ARRAY_SIZE(sh7760_i2c0_res),
138};
139
140/* eth initialization functions */
141static struct smc91x_platdata smc91x_info = {
142 .flags = SMC91X_USE_16BIT | SMC91X_IO_SHIFT_1 | IORESOURCE_IRQ_LOWLEVEL,
143};
144
145static struct resource smc91x_res[] = {
146 [0] = {
147 .start = SMC_IOADDR,
Luca Santini347cd342008-09-21 10:32:29 +0900148 .end = SMC_IOADDR + SZ_32 - 1,
Luca Santini3db91702008-09-08 12:01:15 +0900149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
Paul Mundt03c57132012-05-18 14:52:31 +0900152 .start = evt2irq(0x2a0),
153 .end = evt2irq(0x2a0),
Luca Santini3db91702008-09-08 12:01:15 +0900154 .flags = IORESOURCE_IRQ ,
155 }
156};
157
158static struct platform_device smc91x_dev = {
159 .name = "smc91x",
160 .id = -1,
161 .num_resources = ARRAY_SIZE(smc91x_res),
162 .resource = smc91x_res,
163
164 .dev = {
165 .platform_data = &smc91x_info,
166 },
167};
168
169/* platform init code */
170static struct platform_device *edosk7760_devices[] __initdata = {
Luca Santini4018ffc2008-09-12 18:07:16 +0900171 &smc91x_dev,
172 &edosk7760_nor_flash_device,
Luca Santini3db91702008-09-08 12:01:15 +0900173 &sh7760_i2c0_dev,
174 &sh7760_i2c1_dev,
Luca Santini3db91702008-09-08 12:01:15 +0900175};
176
177static int __init init_edosk7760_devices(void)
178{
179 plat_irq_setup_pins(IRQ_MODE_IRQ);
180
181 return platform_add_devices(edosk7760_devices,
182 ARRAY_SIZE(edosk7760_devices));
183}
Nobuhiro Iwamatsu95d210c2011-01-07 03:02:15 +0000184device_initcall(init_edosk7760_devices);
Luca Santini3db91702008-09-08 12:01:15 +0900185
186/*
187 * The Machine Vector
188 */
189struct sh_machine_vector mv_edosk7760 __initmv = {
190 .mv_name = "EDOSK7760",
Luca Santini3db91702008-09-08 12:01:15 +0900191};