]> git.karo-electronics.de Git - mv-sheeva.git/blob - arch/arm/plat-s3c/dev-hsmmc2.c
ARM: S5PC1xx: add platform helpers for SDHCI host controllers
[mv-sheeva.git] / arch / arm / plat-s3c / dev-hsmmc2.c
1 /* linux/arch/arm/plat-s3c/dev-hsmmc2.c
2  *
3  * Copyright (c) 2009 Samsung Electronics
4  *
5  * S3C series device definition for hsmmc device 2
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 version 2 as
9  * published by the Free Software Foundation.
10 */
11
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
14 #include <linux/mmc/host.h>
15
16 #include <mach/map.h>
17 #include <plat/sdhci.h>
18 #include <plat/devs.h>
19
20 #define S3C_SZ_HSMMC    (0x1000)
21
22 static struct resource s3c_hsmmc2_resource[] = {
23         [0] = {
24                 .start = S3C_PA_HSMMC2,
25                 .end   = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1,
26                 .flags = IORESOURCE_MEM,
27         },
28         [1] = {
29                 .start = IRQ_HSMMC2,
30                 .end   = IRQ_HSMMC2,
31                 .flags = IORESOURCE_IRQ,
32         }
33 };
34
35 static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL;
36
37 struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
38         .max_width      = 4,
39         .host_caps      = (MMC_CAP_4_BIT_DATA |
40                            MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
41 };
42
43 struct platform_device s3c_device_hsmmc2 = {
44         .name           = "s3c-sdhci",
45         .id             = 2,
46         .num_resources  = ARRAY_SIZE(s3c_hsmmc2_resource),
47         .resource       = s3c_hsmmc2_resource,
48         .dev            = {
49                 .dma_mask               = &s3c_device_hsmmc2_dmamask,
50                 .coherent_dma_mask      = 0xffffffffUL,
51                 .platform_data          = &s3c_hsmmc2_def_platdata,
52         },
53 };
54
55 void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
56 {
57         struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
58
59         set->max_width = pd->max_width;
60
61         if (pd->cfg_gpio)
62                 set->cfg_gpio = pd->cfg_gpio;
63         if (pd->cfg_card)
64                 set->cfg_card = pd->cfg_card;
65 }