aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-g4evm.c
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2010-03-29 02:31:36 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-07 03:26:53 -0400
commit819ee86796ae263cd76dd734085dab70d1250cdb (patch)
tree8828864aa56406f1e7391453dfd130483f0cb1fa /arch/arm/mach-shmobile/board-g4evm.c
parent4eea423a4567937dc5e0abdc72bd21b546180459 (diff)
ARM: mach-shmobile: Add SDHI support
This patch add SDHI support for G4 board. Current gpio frame work doesn't have the method to control only pull-up/down/free. So, it have special gpio_pull_up function for SDHI. It is quick hack, so this function should be replaced by correct gpio frame work in future. Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-g4evm.c')
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index 10673a90be52..33441d58cfa6 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -30,6 +30,7 @@
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/input.h> 31#include <linux/input.h>
32#include <linux/input/sh_keysc.h> 32#include <linux/input/sh_keysc.h>
33#include <linux/mfd/sh_mobile_sdhi.h>
33#include <linux/gpio.h> 34#include <linux/gpio.h>
34#include <mach/sh7377.h> 35#include <mach/sh7377.h>
35#include <mach/common.h> 36#include <mach/common.h>
@@ -37,6 +38,31 @@
37#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
38#include <asm/mach/map.h> 39#include <asm/mach/map.h>
39 40
41/*
42 * SDHI
43 *
44 * SDHI0 : card detection is possible
45 * SDHI1 : card detection is impossible
46 *
47 * [G4-MAIN-BOARD]
48 * JP74 : short # DBG_2V8A for SDHI0
49 * JP75 : NC # DBG_3V3A for SDHI0
50 * JP76 : NC # DBG_3V3A_SD for SDHI0
51 * JP77 : NC # 3V3A_SDIO for SDHI1
52 * JP78 : short # DBG_2V8A for SDHI1
53 * JP79 : NC # DBG_3V3A for SDHI1
54 * JP80 : NC # DBG_3V3A_SD for SDHI1
55 *
56 * [G4-CORE-BOARD]
57 * S32 : all off # to dissever from G3-CORE_DBG board
58 * S33 : all off # to dissever from G3-CORE_DBG board
59 *
60 * [G3-CORE_DBG-BOARD]
61 * S1 : all off # to dissever from G3-CORE_DBG board
62 * S3 : all off # to dissever from G3-CORE_DBG board
63 * S4 : all off # to dissever from G3-CORE_DBG board
64 */
65
40static struct mtd_partition nor_flash_partitions[] = { 66static struct mtd_partition nor_flash_partitions[] = {
41 { 67 {
42 .name = "loader", 68 .name = "loader",
@@ -169,10 +195,53 @@ static struct platform_device keysc_device = {
169 }, 195 },
170}; 196};
171 197
198/* SDHI */
199static struct resource sdhi0_resources[] = {
200 [0] = {
201 .name = "SDHI0",
202 .start = 0xe6d50000,
203 .end = 0xe6d501ff,
204 .flags = IORESOURCE_MEM,
205 },
206 [1] = {
207 .start = 96,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212static struct platform_device sdhi0_device = {
213 .name = "sh_mobile_sdhi",
214 .num_resources = ARRAY_SIZE(sdhi0_resources),
215 .resource = sdhi0_resources,
216 .id = 0,
217};
218
219static struct resource sdhi1_resources[] = {
220 [0] = {
221 .name = "SDHI1",
222 .start = 0xe6d60000,
223 .end = 0xe6d601ff,
224 .flags = IORESOURCE_MEM,
225 },
226 [1] = {
227 .start = 100,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device sdhi1_device = {
233 .name = "sh_mobile_sdhi",
234 .num_resources = ARRAY_SIZE(sdhi1_resources),
235 .resource = sdhi1_resources,
236 .id = 1,
237};
238
172static struct platform_device *g4evm_devices[] __initdata = { 239static struct platform_device *g4evm_devices[] __initdata = {
173 &nor_flash_device, 240 &nor_flash_device,
174 &usb_host_device, 241 &usb_host_device,
175 &keysc_device, 242 &keysc_device,
243 &sdhi0_device,
244 &sdhi1_device,
176}; 245};
177 246
178static struct map_desc g4evm_io_desc[] __initdata = { 247static struct map_desc g4evm_io_desc[] __initdata = {
@@ -197,6 +266,36 @@ static void __init g4evm_map_io(void)
197 shmobile_setup_console(); 266 shmobile_setup_console();
198} 267}
199 268
269#define GPIO_SDHID0_D0 0xe60520fc
270#define GPIO_SDHID0_D1 0xe60520fd
271#define GPIO_SDHID0_D2 0xe60520fe
272#define GPIO_SDHID0_D3 0xe60520ff
273#define GPIO_SDHICMD0 0xe6052100
274
275#define GPIO_SDHID1_D0 0xe6052103
276#define GPIO_SDHID1_D1 0xe6052104
277#define GPIO_SDHID1_D2 0xe6052105
278#define GPIO_SDHID1_D3 0xe6052106
279#define GPIO_SDHICMD1 0xe6052107
280
281/*
282 * FIXME !!
283 *
284 * gpio_pull_up is quick_hack.
285 *
286 * current gpio frame work doesn't have
287 * the method to control only pull up/down/free.
288 * this function should be replaced by correct gpio function
289 */
290static void __init gpio_pull_up(u32 addr)
291{
292 u8 data = __raw_readb(addr);
293
294 data &= 0x0F;
295 data |= 0xC0;
296 __raw_writeb(data, addr);
297}
298
200static void __init g4evm_init(void) 299static void __init g4evm_init(void)
201{ 300{
202 sh7377_pinmux_init(); 301 sh7377_pinmux_init();
@@ -253,6 +352,34 @@ static void __init g4evm_init(void)
253 gpio_request(GPIO_FN_PORT71_KEYIN5_PU, NULL); 352 gpio_request(GPIO_FN_PORT71_KEYIN5_PU, NULL);
254 gpio_request(GPIO_FN_PORT72_KEYIN6_PU, NULL); 353 gpio_request(GPIO_FN_PORT72_KEYIN6_PU, NULL);
255 354
355 /* SDHI0 */
356 gpio_request(GPIO_FN_SDHICLK0, NULL);
357 gpio_request(GPIO_FN_SDHICD0, NULL);
358 gpio_request(GPIO_FN_SDHID0_0, NULL);
359 gpio_request(GPIO_FN_SDHID0_1, NULL);
360 gpio_request(GPIO_FN_SDHID0_2, NULL);
361 gpio_request(GPIO_FN_SDHID0_3, NULL);
362 gpio_request(GPIO_FN_SDHICMD0, NULL);
363 gpio_request(GPIO_FN_SDHIWP0, NULL);
364 gpio_pull_up(GPIO_SDHID0_D0);
365 gpio_pull_up(GPIO_SDHID0_D1);
366 gpio_pull_up(GPIO_SDHID0_D2);
367 gpio_pull_up(GPIO_SDHID0_D3);
368 gpio_pull_up(GPIO_SDHICMD0);
369
370 /* SDHI1 */
371 gpio_request(GPIO_FN_SDHICLK1, NULL);
372 gpio_request(GPIO_FN_SDHID1_0, NULL);
373 gpio_request(GPIO_FN_SDHID1_1, NULL);
374 gpio_request(GPIO_FN_SDHID1_2, NULL);
375 gpio_request(GPIO_FN_SDHID1_3, NULL);
376 gpio_request(GPIO_FN_SDHICMD1, NULL);
377 gpio_pull_up(GPIO_SDHID1_D0);
378 gpio_pull_up(GPIO_SDHID1_D1);
379 gpio_pull_up(GPIO_SDHID1_D2);
380 gpio_pull_up(GPIO_SDHID1_D3);
381 gpio_pull_up(GPIO_SDHICMD1);
382
256 sh7377_add_standard_devices(); 383 sh7377_add_standard_devices();
257 384
258 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); 385 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));