Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[pandora-kernel.git] / arch / arm / mach-ux500 / board-mop500-sdi.c
1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * Author: Hanumath Prasad <hanumath.prasad@stericsson.com>
5  * License terms: GNU General Public License (GPL) version 2
6  */
7
8 #include <linux/kernel.h>
9 #include <linux/gpio.h>
10 #include <linux/amba/bus.h>
11 #include <linux/amba/mmci.h>
12 #include <linux/mmc/host.h>
13 #include <linux/platform_device.h>
14
15 #include <plat/pincfg.h>
16 #include <mach/devices.h>
17 #include <mach/hardware.h>
18
19 #include "pins-db8500.h"
20 #include "board-mop500.h"
21
22 static pin_cfg_t mop500_sdi_pins[] = {
23         /* SDI4 (on-board eMMC) */
24         GPIO197_MC4_DAT3,
25         GPIO198_MC4_DAT2,
26         GPIO199_MC4_DAT1,
27         GPIO200_MC4_DAT0,
28         GPIO201_MC4_CMD,
29         GPIO202_MC4_FBCLK,
30         GPIO203_MC4_CLK,
31         GPIO204_MC4_DAT7,
32         GPIO205_MC4_DAT6,
33         GPIO206_MC4_DAT5,
34         GPIO207_MC4_DAT4,
35 };
36
37 static pin_cfg_t mop500_sdi2_pins[] = {
38         /* SDI2 (POP eMMC) */
39         GPIO128_MC2_CLK,
40         GPIO129_MC2_CMD,
41         GPIO130_MC2_FBCLK,
42         GPIO131_MC2_DAT0,
43         GPIO132_MC2_DAT1,
44         GPIO133_MC2_DAT2,
45         GPIO134_MC2_DAT3,
46         GPIO135_MC2_DAT4,
47         GPIO136_MC2_DAT5,
48         GPIO137_MC2_DAT6,
49         GPIO138_MC2_DAT7,
50 };
51
52 /*
53  * SDI 2 (POP eMMC, not on DB8500ed)
54  */
55
56 static struct mmci_platform_data mop500_sdi2_data = {
57         .ocr_mask       = MMC_VDD_165_195,
58         .f_max          = 100000000,
59         .capabilities   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
60         .gpio_cd        = -1,
61         .gpio_wp        = -1,
62 };
63
64 /*
65  * SDI 4 (on-board eMMC)
66  */
67
68 static struct mmci_platform_data mop500_sdi4_data = {
69         .ocr_mask       = MMC_VDD_29_30,
70         .f_max          = 100000000,
71         .capabilities   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
72                           MMC_CAP_MMC_HIGHSPEED,
73         .gpio_cd        = -1,
74         .gpio_wp        = -1,
75 };
76
77 void mop500_sdi_init(void)
78 {
79         nmk_config_pins(mop500_sdi_pins, ARRAY_SIZE(mop500_sdi_pins));
80
81         u8500_sdi2_device.dev.platform_data = &mop500_sdi2_data;
82         u8500_sdi4_device.dev.platform_data = &mop500_sdi4_data;
83
84         if (!cpu_is_u8500ed()) {
85                 nmk_config_pins(mop500_sdi2_pins, ARRAY_SIZE(mop500_sdi2_pins));
86                 amba_device_register(&u8500_sdi2_device, &iomem_resource);
87         }
88
89         /* On-board eMMC */
90         amba_device_register(&u8500_sdi4_device, &iomem_resource);
91 }