|
@@ -439,3 +439,92 @@ static struct platform_device sdhi0_device = {
|
|
|
.num_resources = ARRAY_SIZE(sdhi0_resources),
|
|
|
.resource = sdhi0_resources,
|
|
|
.dev = {
|
|
|
+ .platform_data = &sdhi0_info,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+/* Fixed 3.3V regulator to be used by SDHI1 */
|
|
|
+static struct regulator_consumer_supply cn4_power_consumers[] =
|
|
|
+{
|
|
|
+ REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
|
|
|
+ REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
|
|
|
+};
|
|
|
+
|
|
|
+static struct regulator_init_data cn4_power_init_data = {
|
|
|
+ .constraints = {
|
|
|
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
|
|
+ },
|
|
|
+ .num_consumer_supplies = ARRAY_SIZE(cn4_power_consumers),
|
|
|
+ .consumer_supplies = cn4_power_consumers,
|
|
|
+};
|
|
|
+
|
|
|
+static struct fixed_voltage_config cn4_power_info = {
|
|
|
+ .supply_name = "CN4 SD/MMC Vdd",
|
|
|
+ .microvolts = 3300000,
|
|
|
+ .gpio = GPIO_PORT114,
|
|
|
+ .enable_high = 1,
|
|
|
+ .init_data = &cn4_power_init_data,
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device cn4_power = {
|
|
|
+ .name = "reg-fixed-voltage",
|
|
|
+ .id = 2,
|
|
|
+ .dev = {
|
|
|
+ .platform_data = &cn4_power_info,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
|
|
|
+{
|
|
|
+ static int power_gpio = -EINVAL;
|
|
|
+
|
|
|
+ if (power_gpio < 0) {
|
|
|
+ int ret = gpio_request(GPIO_PORT114, "sdhi1_power");
|
|
|
+ if (!ret) {
|
|
|
+ power_gpio = GPIO_PORT114;
|
|
|
+ gpio_direction_output(power_gpio, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * If requesting the GPIO above failed, it means, that the regulator got
|
|
|
+ * probed and grabbed the GPIO, but we don't know, whether the sdhi
|
|
|
+ * driver already uses the regulator. If it doesn't, we have to toggle
|
|
|
+ * the GPIO ourselves, even though it is now owned by the fixed
|
|
|
+ * regulator driver. We have to live with the race in case the driver
|
|
|
+ * gets unloaded and the GPIO freed between these two steps.
|
|
|
+ */
|
|
|
+ gpio_set_value(GPIO_PORT114, state);
|
|
|
+}
|
|
|
+
|
|
|
+static struct sh_mobile_sdhi_info sh_sdhi1_info = {
|
|
|
+ .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
|
|
|
+ .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
|
|
|
+ .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
|
|
|
+ .set_pwr = ag5evm_sdhi1_set_pwr,
|
|
|
+};
|
|
|
+
|
|
|
+static struct resource sdhi1_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .name = "SDHI1",
|
|
|
+ .start = 0xee120000,
|
|
|
+ .end = 0xee1200ff,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
|
|
|
+ .start = gic_spi(87),
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+ [2] = {
|
|
|
+ .name = SH_MOBILE_SDHI_IRQ_SDCARD,
|
|
|
+ .start = gic_spi(88),
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+ [3] = {
|
|
|
+ .name = SH_MOBILE_SDHI_IRQ_SDIO,
|
|
|
+ .start = gic_spi(89),
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|