From c28f800475fc326cb418592e92cdd8f2ff07c045 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Wed, 19 Dec 2012 16:36:54 +0000 Subject: ARM: ux500: Provide a means to obtain the SMSC9115 clock when DT is enabled Device Tree names devices differently to how some frameworks expect them. Until we can move a platform over to the new way of obtaining resources, we have to use the OF_DEV_AUXDATA() macros to craft a device name which can be used in searches during allocation time. Signed-off-by: Lee Jones Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/cpu-db8500.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 19235cf..1c7f794 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -282,6 +282,7 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", &db8500_prcmu_pdata), + OF_DEV_AUXDATA("smsc,lan9115", 0x50000000, "smsc911x", NULL), /* Requires device name bindings. */ OF_DEV_AUXDATA("stericsson,nmk-pinctrl", U8500_PRCMU_BASE, "pinctrl-db8500", NULL), -- cgit v1.1 From cd2fa6d6035adb92b49ef04cbd1950c59f592cf6 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 31 Jan 2013 11:31:16 +0000 Subject: ARM: ux500: Use the GPIO regulator framework for SDI0's 'en' and 'vsel' To prevent lots of unnecessary call-backs into platform code, we're now using the GPIO regulator framework to control the 'enable' (en) and 'voltage select' (vsel) GPIO pins which in turn control the MMCI's secondary regulator settings. This already works with Device Tree, but when booting with ATAGs we need to register it as a platform device. Signed-off-by: Lee Jones Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/board-mop500-regulators.c | 14 +++++++++ arch/arm/mach-ux500/board-mop500-regulators.h | 1 + arch/arm/mach-ux500/board-mop500.c | 45 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index 2a17bc5..cb75405 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c @@ -28,6 +28,20 @@ struct regulator_init_data gpio_en_3v3_regulator = { .consumer_supplies = gpio_en_3v3_consumers, }; +static struct regulator_consumer_supply sdi0_reg_consumers[] = { + REGULATOR_SUPPLY("vqmmc", "sdi0"), +}; + +struct regulator_init_data sdi0_reg_init_data = { + .constraints = { + .min_uV = 1800000, + .max_uV = 2900000, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers), + .consumer_supplies = sdi0_reg_consumers, +}; + /* * TPS61052 regulator */ diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h index 78a0642..0c79d90 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.h +++ b/arch/arm/mach-ux500/board-mop500-regulators.h @@ -19,5 +19,6 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; extern struct regulator_init_data tps61052_regulator; extern struct regulator_init_data gpio_en_3v3_regulator; +extern struct regulator_init_data sdi0_reg_init_data; #endif diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index b034578..cd100d5 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -89,6 +91,37 @@ static struct platform_device snowball_gpio_en_3v3_regulator_dev = { }, }; +/* Dynamically populated. */ +static struct gpio sdi0_reg_gpios[] = { + { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" }, +}; + +static struct gpio_regulator_state sdi0_reg_states[] = { + { .value = 2900000, .gpios = (0 << 0) }, + { .value = 1800000, .gpios = (1 << 0) }, +}; + +static struct gpio_regulator_config sdi0_reg_info = { + .supply_name = "ext-mmc-level-shifter", + .gpios = sdi0_reg_gpios, + .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios), + .states = sdi0_reg_states, + .nr_states = ARRAY_SIZE(sdi0_reg_states), + .type = REGULATOR_VOLTAGE, + .enable_high = 1, + .enabled_at_boot = 0, + .init_data = &sdi0_reg_init_data, + .startup_delay = 100, +}; + +static struct platform_device sdi0_regulator = { + .name = "gpio-regulator", + .id = -1, + .dev = { + .platform_data = &sdi0_reg_info, + }, +}; + static struct abx500_gpio_platform_data ab8500_gpio_pdata = { .gpio_base = MOP500_AB8500_PIN_GPIO(1), }; @@ -481,6 +514,7 @@ static struct hash_platform_data u8500_hash1_platform_data = { /* add any platform devices here - TODO */ static struct platform_device *mop500_platform_devs[] __initdata = { &mop500_gpio_keys_device, + &sdi0_regulator, }; #ifdef CONFIG_STE_DMA40 @@ -624,6 +658,7 @@ static struct platform_device *snowball_platform_devs[] __initdata = { &snowball_gpio_en_3v3_regulator_dev, &u8500_thsens_device, &u8500_cpufreq_cooling_device, + &sdi0_regulator, }; static void __init mop500_init_machine(void) @@ -635,6 +670,9 @@ static void __init mop500_init_machine(void) platform_device_register(&db8500_prcmu_device); mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; + sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN; + sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL; + mop500_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata); @@ -668,6 +706,10 @@ static void __init snowball_init_machine(void) int i; platform_device_register(&db8500_prcmu_device); + + sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO; + sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO; + snowball_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata); @@ -701,6 +743,9 @@ static void __init hrefv60_init_machine(void) */ mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; + sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO; + sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO; + hrefv60_pinmaps_init(); parent = u8500_init_devices(&ab8500_platdata); -- cgit v1.1 From fcab564e2fd3c9048e457fb699c253db9a169c67 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Fri, 7 Dec 2012 14:00:51 +0000 Subject: ARM: ux500: Remove traces of the ios_handler from platform code Now MMCI on/off functionality is using the regulator framework from the MMCI driver, there is no need to keep the ios_handler laying around, duplicating functionality. So we're removing it. Signed-off-by: Lee Jones Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/board-mop500-sdi.c | 52 ---------------------------------- 1 file changed, 52 deletions(-) (limited to 'arch/arm/mach-ux500') diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index 051b62c..6db0740 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c @@ -31,35 +31,6 @@ * SDI 0 (MicroSD slot) */ -/* GPIO pins used by the sdi0 level shifter */ -static int sdi0_en = -1; -static int sdi0_vsel = -1; - -static int mop500_sdi0_ios_handler(struct device *dev, struct mmc_ios *ios) -{ - switch (ios->power_mode) { - case MMC_POWER_UP: - case MMC_POWER_ON: - /* - * Level shifter voltage should depend on vdd to when deciding - * on either 1.8V or 2.9V. Once the decision has been made the - * level shifter must be disabled and re-enabled with a changed - * select signal in order to switch the voltage. Since there is - * no framework support yet for indicating 1.8V in vdd, use the - * default 2.9V. - */ - gpio_direction_output(sdi0_vsel, 0); - gpio_direction_output(sdi0_en, 1); - break; - case MMC_POWER_OFF: - gpio_direction_output(sdi0_vsel, 0); - gpio_direction_output(sdi0_en, 0); - break; - } - - return 0; -} - #ifdef CONFIG_STE_DMA40 struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { .mode = STEDMA40_MODE_LOGICAL, @@ -81,7 +52,6 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { #endif struct mmci_platform_data mop500_sdi0_data = { - .ios_handler = mop500_sdi0_ios_handler, .ocr_mask = MMC_VDD_29_30, .f_max = 50000000, .capabilities = MMC_CAP_4_BIT_DATA | @@ -101,22 +71,6 @@ struct mmci_platform_data mop500_sdi0_data = { static void sdi0_configure(struct device *parent) { - int ret; - - ret = gpio_request(sdi0_en, "level shifter enable"); - if (!ret) - ret = gpio_request(sdi0_vsel, - "level shifter 1v8-3v select"); - - if (ret) { - pr_warning("unable to config sdi0 gpios for level shifter.\n"); - return; - } - - /* Select the default 2.9V and enable level shifter */ - gpio_direction_output(sdi0_vsel, 0); - gpio_direction_output(sdi0_en, 1); - /* Add the device, force v2 to subrevision 1 */ db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID); } @@ -124,8 +78,6 @@ static void sdi0_configure(struct device *parent) void mop500_sdi_tc35892_init(struct device *parent) { mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD; - sdi0_en = GPIO_SDMMC_EN; - sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL; sdi0_configure(parent); } @@ -264,8 +216,6 @@ void __init snowball_sdi_init(struct device *parent) /* External Micro SD slot */ mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO; mop500_sdi0_data.cd_invert = true; - sdi0_en = SNOWBALL_SDMMC_EN_GPIO; - sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO; sdi0_configure(parent); } @@ -277,8 +227,6 @@ void __init hrefv60_sdi_init(struct device *parent) db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID); /* External Micro SD slot */ mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; - sdi0_en = HREFV60_SDMMC_EN_GPIO; - sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO; sdi0_configure(parent); /* WLAN SDIO channel */ db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID); -- cgit v1.1