Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321231
b: refs/heads/master
c: d4c191d
h: refs/heads/master
i:
  321229: 367fc3e
  321227: 3c71c9a
  321223: 3cf8efe
  321215: 57bd669
v: v3
  • Loading branch information
Guennadi Liakhovetski authored and Paul Mundt committed Jun 28, 2012
1 parent 1122e91 commit c501973
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 67ef578699ff42aa772d797bffae1f9e25c254c5
refs/heads/master: d4c191dfb9190880644c1542a21c9deda5c76151
117 changes: 100 additions & 17 deletions trunk/arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/usb/r8a66597.h>
#include <linux/usb/renesas_usbhs.h>
#include <linux/i2c.h>
Expand Down Expand Up @@ -518,10 +520,86 @@ static struct i2c_board_info ts_i2c_clients = {
.irq = IRQ0,
};

static struct regulator_consumer_supply cn12_power_consumers[] =
{
REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
};

static struct regulator_init_data cn12_power_init_data = {
.constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(cn12_power_consumers),
.consumer_supplies = cn12_power_consumers,
};

static struct fixed_voltage_config cn12_power_info = {
.supply_name = "CN12 SD/MMC Vdd",
.microvolts = 3300000,
.gpio = GPIO_PTB7,
.enable_high = 1,
.init_data = &cn12_power_init_data,
};

static struct platform_device cn12_power = {
.name = "reg-fixed-voltage",
.id = 0,
.dev = {
.platform_data = &cn12_power_info,
},
};

#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
/* SDHI0 */
static struct regulator_consumer_supply sdhi0_power_consumers[] =
{
REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
};

static struct regulator_init_data sdhi0_power_init_data = {
.constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = ARRAY_SIZE(sdhi0_power_consumers),
.consumer_supplies = sdhi0_power_consumers,
};

static struct fixed_voltage_config sdhi0_power_info = {
.supply_name = "CN11 SD/MMC Vdd",
.microvolts = 3300000,
.gpio = GPIO_PTB6,
.enable_high = 1,
.init_data = &sdhi0_power_init_data,
};

static struct platform_device sdhi0_power = {
.name = "reg-fixed-voltage",
.id = 1,
.dev = {
.platform_data = &sdhi0_power_info,
},
};

static void sdhi0_set_pwr(struct platform_device *pdev, int state)
{
static int power_gpio = -EINVAL;

if (power_gpio < 0) {
int ret = gpio_request(GPIO_PTB6, NULL);
if (!ret) {
power_gpio = GPIO_PTB6;
gpio_direction_output(power_gpio, 0);
}
}

/*
* Toggle the GPIO regardless, whether we managed to grab it above or
* the fixed regulator driver did.
*/
gpio_set_value(GPIO_PTB6, state);
}

Expand Down Expand Up @@ -562,13 +640,27 @@ static struct platform_device sdhi0_device = {
},
};

#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* SDHI1 */
static void sdhi1_set_pwr(struct platform_device *pdev, int state)
static void cn12_set_pwr(struct platform_device *pdev, int state)
{
static int power_gpio = -EINVAL;

if (power_gpio < 0) {
int ret = gpio_request(GPIO_PTB7, NULL);
if (!ret) {
power_gpio = GPIO_PTB7;
gpio_direction_output(power_gpio, 0);
}
}

/*
* Toggle the GPIO regardless, whether we managed to grab it above or
* the fixed regulator driver did.
*/
gpio_set_value(GPIO_PTB7, state);
}

#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* SDHI1 */
static int sdhi1_get_cd(struct platform_device *pdev)
{
return !gpio_get_value(GPIO_PTW7);
Expand All @@ -579,7 +671,7 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
.tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
MMC_CAP_NEEDS_POLL,
.set_pwr = sdhi1_set_pwr,
.set_pwr = cn12_set_pwr,
.get_cd = sdhi1_get_cd,
};

Expand Down Expand Up @@ -899,14 +991,9 @@ static struct platform_device vou_device = {

#if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* SH_MMCIF */
static void mmcif_set_pwr(struct platform_device *pdev, int state)
{
gpio_set_value(GPIO_PTB7, state);
}

static void mmcif_down_pwr(struct platform_device *pdev)
{
gpio_set_value(GPIO_PTB7, 0);
cn12_set_pwr(pdev, 0);
}

static struct resource sh_mmcif_resources[] = {
Expand All @@ -929,7 +1016,7 @@ static struct resource sh_mmcif_resources[] = {
};

static struct sh_mmcif_plat_data sh_mmcif_plat = {
.set_pwr = mmcif_set_pwr,
.set_pwr = cn12_set_pwr,
.down_pwr = mmcif_down_pwr,
.sup_pclk = 0, /* SH7724: Max Pclk/2 */
.caps = MMC_CAP_4_BIT_DATA |
Expand Down Expand Up @@ -960,7 +1047,9 @@ static struct platform_device *ecovec_devices[] __initdata = {
&ceu0_device,
&ceu1_device,
&keysc_device,
&cn12_power,
#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
&sdhi0_power,
&sdhi0_device,
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
&sdhi1_device,
Expand Down Expand Up @@ -1258,8 +1347,6 @@ static int __init arch_setup(void)
gpio_request(GPIO_FN_SDHI0D2, NULL);
gpio_request(GPIO_FN_SDHI0D1, NULL);
gpio_request(GPIO_FN_SDHI0D0, NULL);
gpio_request(GPIO_PTB6, NULL);
gpio_direction_output(GPIO_PTB6, 0);
#else
/* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
Expand Down Expand Up @@ -1288,8 +1375,6 @@ static int __init arch_setup(void)
gpio_request(GPIO_FN_MMC_D0, NULL);
gpio_request(GPIO_FN_MMC_CLK, NULL);
gpio_request(GPIO_FN_MMC_CMD, NULL);
gpio_request(GPIO_PTB7, NULL);
gpio_direction_output(GPIO_PTB7, 0);

cn12_enabled = true;
#elif defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
Expand All @@ -1301,8 +1386,6 @@ static int __init arch_setup(void)
gpio_request(GPIO_FN_SDHI1D2, NULL);
gpio_request(GPIO_FN_SDHI1D1, NULL);
gpio_request(GPIO_FN_SDHI1D0, NULL);
gpio_request(GPIO_PTB7, NULL);
gpio_direction_output(GPIO_PTB7, 0);

/* Card-detect, used on CN12 with SDHI1 */
gpio_request(GPIO_PTW7, NULL);
Expand Down

0 comments on commit c501973

Please sign in to comment.