blob: f60aedba417cdaea81c7d53763359a9bf0871660 [file] [log] [blame]
Kyungmin Park86cd4f52009-11-17 08:41:23 +01001/* linux/arch/arm/plat-s3c/dev-hsmmc2.c
2 *
3 * Copyright (c) 2009 Samsung Electronics
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +01004 * Copyright (c) 2009 Maurus Cuelenaere
5 *
6 * Based on arch/arm/plat-s3c/dev-hsmmc1.c
7 * original file Copyright (c) 2008 Simtec Electronics
Kyungmin Park86cd4f52009-11-17 08:41:23 +01008 *
9 * S3C series device definition for hsmmc device 2
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18#include <linux/mmc/host.h>
19
20#include <mach/map.h>
21#include <plat/sdhci.h>
22#include <plat/devs.h>
23
24#define S3C_SZ_HSMMC (0x1000)
25
26static struct resource s3c_hsmmc2_resource[] = {
27 [0] = {
28 .start = S3C_PA_HSMMC2,
29 .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_HSMMC2,
34 .end = IRQ_HSMMC2,
35 .flags = IORESOURCE_IRQ,
36 }
37};
38
39static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL;
40
41struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
42 .max_width = 4,
43 .host_caps = (MMC_CAP_4_BIT_DATA |
44 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090045 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
Kyungmin Park86cd4f52009-11-17 08:41:23 +010046};
47
48struct platform_device s3c_device_hsmmc2 = {
49 .name = "s3c-sdhci",
50 .id = 2,
51 .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
52 .resource = s3c_hsmmc2_resource,
53 .dev = {
54 .dma_mask = &s3c_device_hsmmc2_dmamask,
55 .coherent_dma_mask = 0xffffffffUL,
56 .platform_data = &s3c_hsmmc2_def_platdata,
57 },
58};
59
60void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
61{
62 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
63
Marek Szyprowski19206b172010-07-23 09:27:18 +090064 set->cd_type = pd->cd_type;
65 set->ext_cd_init = pd->ext_cd_init;
66 set->ext_cd_cleanup = pd->ext_cd_cleanup;
67 set->ext_cd_gpio = pd->ext_cd_gpio;
68 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010069
Hyuk Lee40fcd5b2010-10-08 18:03:23 +090070 if (pd->max_width)
71 set->max_width = pd->max_width;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010072 if (pd->cfg_gpio)
73 set->cfg_gpio = pd->cfg_gpio;
74 if (pd->cfg_card)
75 set->cfg_card = pd->cfg_card;
Kyungmin Park944645c2010-08-19 14:13:34 -070076 if (pd->host_caps)
Hyuk Lee40fcd5b2010-10-08 18:03:23 +090077 set->host_caps |= pd->host_caps;
Jeongbae Seo28c80aa2010-10-08 18:03:27 +090078 if (pd->clk_type)
79 set->clk_type = pd->clk_type;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010080}