From 3b0da99efa056e91f51c30eb80b5c0185dc9e228 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 07:11:43 +0900 Subject: [PATCH 1/9] ODROIDX: board: Change regulator's visual names --- arch/arm/mach-exynos/mach-hkdk4412.c | 125 ++++++++++++--------------- 1 file changed, 55 insertions(+), 70 deletions(-) diff --git a/arch/arm/mach-exynos/mach-hkdk4412.c b/arch/arm/mach-exynos/mach-hkdk4412.c index 6da1606867d670..6fe0636c06788d 100644 --- a/arch/arm/mach-exynos/mach-hkdk4412.c +++ b/arch/arm/mach-exynos/mach-hkdk4412.c @@ -109,78 +109,64 @@ static struct s3c_sdhci_platdata hkdk4412_hsmmc3_pdata __initdata = { }; static struct regulator_consumer_supply __initdata max77686_buck1_consumer[] = { - REGULATOR_SUPPLY("vdd_mif", NULL), }; static struct regulator_consumer_supply __initdata max77686_buck2_consumer[] = { - REGULATOR_SUPPLY("vdd_arm", NULL), + REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ }; static struct regulator_consumer_supply __initdata max77686_buck3_consumer[] = { - REGULATOR_SUPPLY("vdd_int", NULL), + REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */ }; static struct regulator_consumer_supply __initdata max77686_buck4_consumer[] = { - REGULATOR_SUPPLY("vdd_g3d", NULL), + REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */ }; static struct regulator_consumer_supply __initdata max77686_ldo1_consumer[] = { - REGULATOR_SUPPLY("vdd_alive", NULL), + REGULATOR_SUPPLY("vdd_alive", NULL), /* ALIVE */ }; static struct regulator_consumer_supply __initdata max77686_ldo3_consumer[] = { - REGULATOR_SUPPLY("vddq_aud", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo4_consumer[] = { - REGULATOR_SUPPLY("vddq_mmc2", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo5_consumer[] = { - REGULATOR_SUPPLY("vddq_mmc1", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo8_consumer[] = { - REGULATOR_SUPPLY("vdd10_mipi", NULL), REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */ REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */ }; static struct regulator_consumer_supply __initdata max77686_ldo10_consumer[] = { - REGULATOR_SUPPLY("vdd18_mipi", NULL), REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */ }; static struct regulator_consumer_supply __initdata max77686_ldo11_consumer[] = { - REGULATOR_SUPPLY("vdd_ldo11", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo13_consumer[] = { - REGULATOR_SUPPLY("vdd18_mipihsi", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo14_consumer[] = { - REGULATOR_SUPPLY("vdd_ldo14", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo17_consumer[] = { - REGULATOR_SUPPLY("vddq_cam", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo18_consumer[] = { - REGULATOR_SUPPLY("vddq_isp", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo19_consumer[] = { - REGULATOR_SUPPLY("vt_cam", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo23_consumer[] = { - REGULATOR_SUPPLY("vdd_touch", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo24_consumer[] = { - REGULATOR_SUPPLY("vdd_touchled", NULL), }; static struct regulator_consumer_supply __initdata max77686_ldo25_consumer[] = { @@ -188,12 +174,11 @@ static struct regulator_consumer_supply __initdata max77686_ldo25_consumer[] = { }; static struct regulator_consumer_supply __initdata max77686_ldo26_consumer[] = { - REGULATOR_SUPPLY("vdd_motor", NULL), }; static struct regulator_init_data __initdata max77686_buck1_data = { .constraints = { - .name = "vdd_mif range", + .name = "VDD_MIF_1.0V", .min_uV = 800000, .max_uV = 1050000, .always_on = 1, @@ -207,7 +192,7 @@ static struct regulator_init_data __initdata max77686_buck1_data = { static struct regulator_init_data __initdata max77686_buck2_data = { .constraints = { - .name = "vdd_arm range", + .name = "VDD_ARM_1.3V", .min_uV = 800000, .max_uV = 1350000, .always_on = 1, @@ -220,7 +205,7 @@ static struct regulator_init_data __initdata max77686_buck2_data = { static struct regulator_init_data __initdata max77686_buck3_data = { .constraints = { - .name = "vdd_int range", + .name = "VDD_INT_1.0V", .min_uV = 800000, .max_uV = 1150000, .always_on = 1, @@ -233,7 +218,7 @@ static struct regulator_init_data __initdata max77686_buck3_data = { static struct regulator_init_data __initdata max77686_buck4_data = { .constraints = { - .name = "vdd_g3d range", + .name = "VDD_G3D_1.0V", .min_uV = 850000, .max_uV = 1200000, .boot_on = 1, @@ -249,7 +234,7 @@ static struct regulator_init_data __initdata max77686_buck4_data = { static struct regulator_init_data __initdata max77686_buck5_data = { .constraints = { - .name = "BUCK5 VDDQ_CKEM1_2", + .name = "VDDQ_CKEM1M2_1.2V", .min_uV = 1200000, .max_uV = 1200000, .always_on = 1, @@ -265,7 +250,7 @@ static struct regulator_init_data __initdata max77686_buck5_data = { static struct regulator_init_data __initdata max77686_buck6_data = { .constraints = { - .name = "BUCK6 1V35", + .name = "VDD_INL_1.35V", .min_uV = 1350000, .max_uV = 1350000, .always_on = 1, @@ -281,7 +266,7 @@ static struct regulator_init_data __initdata max77686_buck6_data = { static struct regulator_init_data __initdata max77686_buck7_data = { .constraints = { - .name = "BUCK7 2V0", + .name = "VDD_INL_2.0V", .min_uV = 2000000, .max_uV = 2000000, .always_on = 1, @@ -297,14 +282,14 @@ static struct regulator_init_data __initdata max77686_buck7_data = { static struct regulator_init_data __initdata max77686_buck8_data = { .constraints = { - .name = "BUCK8 3V3", - .min_uV = 3300000, - .max_uV = 3300000, + .name = "VDD_BUCK8_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, .always_on = 1, .apply_uV = 1, .valid_ops_mask = REGULATOR_CHANGE_STATUS, .state_mem = { - .uV = 3300000, + .uV = 2800000, .mode = REGULATOR_MODE_NORMAL, .enabled = 1, }, @@ -313,7 +298,7 @@ static struct regulator_init_data __initdata max77686_buck8_data = { static struct regulator_init_data __initdata max77686_buck9_data = { .constraints = { - .name = "BUCK9 1V2", + .name = "VDD_BUCK9_1.2V", .min_uV = 1200000, .max_uV = 1200000, .always_on = 1, @@ -329,7 +314,7 @@ static struct regulator_init_data __initdata max77686_buck9_data = { static struct regulator_init_data __initdata max77686_ldo1_data = { .constraints = { - .name = "LDO1 VDD_ALIVE", + .name = "VDD_ALIVE_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -346,7 +331,7 @@ static struct regulator_init_data __initdata max77686_ldo1_data = { static struct regulator_init_data __initdata max77686_ldo2_data = { .constraints = { - .name = "LDO2 VDDQ_M1_1V8", + .name = "VDDQ_M1M2_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -361,7 +346,7 @@ static struct regulator_init_data __initdata max77686_ldo2_data = { static struct regulator_init_data __initdata max77686_ldo3_data = { .constraints = { - .name = "LDO3 VDDQ_AUD_1V8", + .name = "VDDQ_M0_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -378,7 +363,7 @@ static struct regulator_init_data __initdata max77686_ldo3_data = { static struct regulator_init_data __initdata max77686_ldo4_data = { .constraints = { - .name = "LDO4 VDDQ_MMC2_2V8", + .name = "VDDQ_MMC2_2.8V", .min_uV = 2800000, .max_uV = 2800000, .apply_uV = 1, @@ -395,7 +380,7 @@ static struct regulator_init_data __initdata max77686_ldo4_data = { static struct regulator_init_data __initdata max77686_ldo5_data = { .constraints = { - .name = "LDO5 VDDQ_MMC1_1V8", + .name = "VDDQ_MMC13_1V8", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -412,7 +397,7 @@ static struct regulator_init_data __initdata max77686_ldo5_data = { static struct regulator_init_data __initdata max77686_ldo6_data = { .constraints = { - .name = "LDO6 VDD10_MPLL_1V0", + .name = "VDD_MPLL_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -427,7 +412,7 @@ static struct regulator_init_data __initdata max77686_ldo6_data = { static struct regulator_init_data __initdata max77686_ldo7_data = { .constraints = { - .name = "LDO7 VDD10_EPLL_1V0", + .name = "VDD_VPLL_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -442,7 +427,7 @@ static struct regulator_init_data __initdata max77686_ldo7_data = { static struct regulator_init_data __initdata max77686_ldo8_data = { .constraints = { - .name = "LDO8 VDD10_MIPI_1V0", + .name = "VDD10_HDMI_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -459,7 +444,7 @@ static struct regulator_init_data __initdata max77686_ldo8_data = { static struct regulator_init_data __initdata max77686_ldo9_data = { .constraints = { - .name = "LDO9 VT_CORE_1V0", + .name = "VDD_VTCORE_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -474,7 +459,7 @@ static struct regulator_init_data __initdata max77686_ldo9_data = { static struct regulator_init_data __initdata max77686_ldo10_data = { .constraints = { - .name = "LDO10 VDD18_MIPI_1V8", + .name = "VDDQ_MIPIHSI_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -491,13 +476,13 @@ static struct regulator_init_data __initdata max77686_ldo10_data = { static struct regulator_init_data __initdata max77686_ldo11_data = { .constraints = { - .name = "vdd_ldo11 range", - .min_uV = 1900000, - .max_uV = 1900000, + .name = "VDD18_ABB1_1.8V", + .min_uV = 1800000, + .max_uV = 1800000, .apply_uV = 1, .always_on = 1, .state_mem = { - .uV = 1900000, + .uV = 1800000, .enabled = 1, }, }, @@ -507,7 +492,7 @@ static struct regulator_init_data __initdata max77686_ldo11_data = { static struct regulator_init_data __initdata max77686_ldo12_data = { .constraints = { - .name = "LDO12 VDD33_UOTG_3V3", + .name = "VDD33_UOTG_3.3V", .min_uV = 3300000, .max_uV = 3300000, .apply_uV = 1, @@ -522,7 +507,7 @@ static struct regulator_init_data __initdata max77686_ldo12_data = { static struct regulator_init_data __initdata max77686_ldo13_data = { .constraints = { - .name = "LDO13 VDD18_MIPIHSI_1V8", + .name = "VDDQ_C2C_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -539,13 +524,13 @@ static struct regulator_init_data __initdata max77686_ldo13_data = { static struct regulator_init_data __initdata max77686_ldo14_data = { .constraints = { - .name = "vdd_ldo14 range", - .min_uV = 1900000, - .max_uV = 1900000, + .name = "VDD18_ABB2_1.8V", + .min_uV = 1800000, + .max_uV = 1800000, .apply_uV = 1, .always_on = 1, .state_mem = { - .uV = 1900000, + .uV = 1800000, .enabled = 1, }, }, @@ -555,7 +540,7 @@ static struct regulator_init_data __initdata max77686_ldo14_data = { static struct regulator_init_data __initdata max77686_ldo15_data = { .constraints = { - .name = "LDO15 VDD10_OTG", + .name = "VDD10_HSIC_1.0V", .min_uV = 1000000, .max_uV = 1000000, .apply_uV = 1, @@ -570,7 +555,7 @@ static struct regulator_init_data __initdata max77686_ldo15_data = { static struct regulator_init_data __initdata max77686_ldo16_data = { .constraints = { - .name = "LDO16 VDD18_HSIC", + .name = "VDD18_HSIC_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -585,7 +570,7 @@ static struct regulator_init_data __initdata max77686_ldo16_data = { static struct regulator_init_data __initdata max77686_ldo17_data = { .constraints = { - .name = "LDO17 VDDQ_CAM_1V8", + .name = "VDDQ_CAM_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -602,7 +587,7 @@ static struct regulator_init_data __initdata max77686_ldo17_data = { static struct regulator_init_data __initdata max77686_ldo18_data = { .constraints = { - .name = "LDO18 VDDQ_ISP_1V8", + .name = "VDD_LDO18_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 1, @@ -619,7 +604,7 @@ static struct regulator_init_data __initdata max77686_ldo18_data = { static struct regulator_init_data __initdata max77686_ldo19_data = { .constraints = { - .name = "LDO19 VT_CAM_1V8", + .name = "VDD_VTCAM_1.8V", .min_uV = 1800000, .max_uV = 1800000, .apply_uV = 0, @@ -637,14 +622,14 @@ static struct regulator_init_data __initdata max77686_ldo19_data = { static struct regulator_init_data __initdata max77686_ldo20_data = { .constraints = { - .name = "LDO20 EMMC_IO_1V8", - .min_uV = 1900000, - .max_uV = 1900000, + .name = "VDD_LDO20_1V8", + .min_uV = 1800000, + .max_uV = 1800000, .always_on = 1, .boot_on = 1, .valid_ops_mask = REGULATOR_CHANGE_STATUS, .state_mem = { - .uV = 1900000, + .uV = 1800000, .enabled = 0, }, }, @@ -652,14 +637,14 @@ static struct regulator_init_data __initdata max77686_ldo20_data = { static struct regulator_init_data __initdata max77686_ldo21_data = { .constraints = { - .name = "LDO21 TFLASH_2V8", + .name = "VDD_SDCARD_3.3V", .min_uV = 3300000, .max_uV = 3300000, .apply_uV = 1, .always_on = 1, .valid_ops_mask = REGULATOR_CHANGE_STATUS, .state_mem = { - .uV = 2800000, + .uV = 3300000, .enabled = 1, }, }, @@ -667,14 +652,14 @@ static struct regulator_init_data __initdata max77686_ldo21_data = { static struct regulator_init_data __initdata max77686_ldo22_data = { .constraints = { - .name = "LDO22", - .min_uV = 3300000, - .max_uV = 3300000, + .name = "VDD_LDO22_2.8V", + .min_uV = 2800000, + .max_uV = 2800000, .apply_uV = 1, .always_on = 0, .valid_ops_mask = REGULATOR_CHANGE_STATUS, .state_mem = { - .uV = 3300000, + .uV = 2800000, .enabled = 0, }, }, @@ -682,7 +667,7 @@ static struct regulator_init_data __initdata max77686_ldo22_data = { static struct regulator_init_data __initdata max77686_ldo23_data = { .constraints = { - .name = "LDO23 VDD_TOUCH_2V8", + .name = "VDD_TOUCH_2.8V", .min_uV = 2800000, .max_uV = 2800000, .apply_uV = 1, @@ -699,7 +684,7 @@ static struct regulator_init_data __initdata max77686_ldo23_data = { static struct regulator_init_data __initdata max77686_ldo24_data = { .constraints = { - .name = "LDO24 VDD_TOUCHLED_3V3", + .name = "VDD_TOUCHLED_3.3V", .min_uV = 3300000, .max_uV = 3300000, .apply_uV = 1, @@ -716,7 +701,7 @@ static struct regulator_init_data __initdata max77686_ldo24_data = { static struct regulator_init_data __initdata max77686_ldo25_data = { .constraints = { - .name = "LDO25 VDDQ_LCD_1V8", + .name = "VDDQ_LCD_1.8V", .min_uV = 1800000, .max_uV = 1800000, .boot_on = 1, @@ -732,7 +717,7 @@ static struct regulator_init_data __initdata max77686_ldo25_data = { static struct regulator_init_data __initdata max77686_ldo26_data = { .constraints = { - .name = "LDO26 VDD_MOTOR_3V0", + .name = "VDD_MOTOR_3.0V", .min_uV = 3000000, .max_uV = 3000000, .apply_uV = 1, From 244f1d8dabadd21c240af3d1d825965963bd80a3 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 06:56:33 +0900 Subject: [PATCH 2/9] ODROID-X: hsmmc: Remove unnecessary HSMMC3 --- arch/arm/mach-exynos/mach-hkdk4412.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-exynos/mach-hkdk4412.c b/arch/arm/mach-exynos/mach-hkdk4412.c index 6fe0636c06788d..a965edcbdb9ffc 100644 --- a/arch/arm/mach-exynos/mach-hkdk4412.c +++ b/arch/arm/mach-exynos/mach-hkdk4412.c @@ -1032,7 +1032,6 @@ static struct s3c_hsotg_plat hkdk4412_hsotg_pdata; static struct platform_device *hkdk4412_devices[] __initdata = { &s3c_device_hsmmc2, - &s3c_device_hsmmc3, &s3c_device_i2c0, &s3c_device_i2c1, &s3c_device_i2c3, @@ -1152,7 +1151,6 @@ static void __init hkdk4412_machine_init(void) ARRAY_SIZE(hkdk4412_i2c_devs7)); s3c_sdhci2_set_platdata(&hkdk4412_hsmmc2_pdata); - s3c_sdhci3_set_platdata(&hkdk4412_hsmmc3_pdata); hkdk4412_ehci_init(); hkdk4412_ohci_init(); From e80dad8284de57fb211f90050b165620b706072c Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 10:58:30 +0900 Subject: [PATCH 3/9] ODROID-X: hsmmc: Remove hsmmc3 platform data --- arch/arm/mach-exynos/mach-hkdk4412.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/mach-exynos/mach-hkdk4412.c b/arch/arm/mach-exynos/mach-hkdk4412.c index a965edcbdb9ffc..6e46656e7a7843 100644 --- a/arch/arm/mach-exynos/mach-hkdk4412.c +++ b/arch/arm/mach-exynos/mach-hkdk4412.c @@ -1030,6 +1030,34 @@ static void __init hkdk4412_ohci_init(void) /* USB OTG */ static struct s3c_hsotg_plat hkdk4412_hsotg_pdata; +static struct s3c_sdhci_platdata hkdk4412_hsmmc2_pdata __initdata = { + .cd_type = S3C_SDHCI_CD_INTERNAL, +#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT + .max_width = 8, + .host_caps = MMC_CAP_8_BIT_DATA, +#endif +}; + +/* DWMMC */ +static int hkdk4412_dwmci_get_bus_wd(u32 slot_id) +{ + return 8; +} + +static int hkdk4412_dwmci_init(u32 slot_id, irq_handler_t handler, void *data) +{ + return 0; +} + +static struct dw_mci_board hkdk4412_dwmci_pdata = { + .num_slots = 1, + .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION, +// .bus_hz = 80 * 1000 * 1000, + .detect_delay_ms = 200, + .init = hkdk4412_dwmci_init, + .get_bus_wd = hkdk4412_dwmci_get_bus_wd, +}; + static struct platform_device *hkdk4412_devices[] __initdata = { &s3c_device_hsmmc2, &s3c_device_i2c0, From 3ed84a5f3d21ef5bd8db357f6936e1d66a17def4 Mon Sep 17 00:00:00 2001 From: Thomas Abraham Date: Tue, 17 Jul 2012 10:38:58 +0000 Subject: [PATCH 4/9] mmc: dw_mmc: lookup for optional biu and ciu clocks Some platforms allow for clock gating and control of bus interface unit clock and card interface unit clock. Add support for clock lookup of optional biu and ciu clocks for clock gating and clock speed determination. Signed-off-by: Abhilash Kesavan Signed-off-by: Thomas Abraham --- drivers/mmc/host/dw_mmc.c | 39 +++++++++++++++++++++++++++++++++++--- include/linux/mmc/dw_mmc.h | 4 ++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cde646d06..bc7c7cd304fe65 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1952,13 +1952,30 @@ int dw_mci_probe(struct dw_mci *host) return -ENODEV; } - if (!host->pdata->bus_hz) { + host->biu_clk = clk_get(host->dev, "biu"); + if (IS_ERR(host->biu_clk)) + dev_dbg(host->dev, "biu clock not available\n"); + else + clk_prepare_enable(host->biu_clk); + + host->ciu_clk = clk_get(host->dev, "ciu"); + if (IS_ERR(host->ciu_clk)) + dev_dbg(host->dev, "ciu clock not available\n"); + else + clk_prepare_enable(host->ciu_clk); + + if (IS_ERR(host->ciu_clk)) + host->bus_hz = host->pdata->bus_hz; + else + host->bus_hz = clk_get_rate(host->ciu_clk); + + if (!host->bus_hz) { dev_err(&host->dev, "Platform data must supply bus speed\n"); - return -ENODEV; + ret = -ENODEV; + goto err_clk; } - host->bus_hz = host->pdata->bus_hz; host->quirks = host->pdata->quirks; spin_lock_init(&host->lock); @@ -2106,6 +2123,16 @@ int dw_mci_probe(struct dw_mci *host) regulator_disable(host->vmmc); regulator_put(host->vmmc); } + +err_clk: + if (!IS_ERR(host->ciu_clk)) { + clk_disable_unprepare(host->ciu_clk); + clk_put(host->ciu_clk); + } + if (!IS_ERR(host->biu_clk)) { + clk_disable_unprepare(host->biu_clk); + clk_put(host->biu_clk); + } return ret; } EXPORT_SYMBOL(dw_mci_probe); @@ -2139,6 +2166,12 @@ void dw_mci_remove(struct dw_mci *host) regulator_put(host->vmmc); } + if (!IS_ERR(host->ciu_clk)) + clk_disable_unprepare(host->ciu_clk); + if (!IS_ERR(host->biu_clk)) + clk_disable_unprepare(host->biu_clk); + clk_put(host->ciu_clk); + clk_put(host->biu_clk); } EXPORT_SYMBOL(dw_mci_remove); diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index 7a7ebd367cfdd2..fa9a1395d3e6de 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -78,6 +78,8 @@ struct mmc_data; * @data_offset: Set the offset of DATA register according to VERID. * @dev: Device associated with the MMC controller. * @pdata: Platform data associated with the MMC controller. + * @biu_clk: Pointer to bus interface unit clock instance. + * @ciu_clk: Pointer to card interface unit clock instance. * @slot: Slots sharing this MMC controller. * @fifo_depth: depth of FIFO. * @data_shift: log2 of FIFO item size. @@ -158,6 +160,8 @@ struct dw_mci { u16 data_offset; struct device dev; struct dw_mci_board *pdata; + struct clk *biu_clk; + struct clk *ciu_clk; struct dw_mci_slot *slot[MAX_MCI_SLOTS]; /* FIFO push and pull */ From 3d07c6622e10ebb921f257daa5e2845e604f50aa Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 06:39:20 +0900 Subject: [PATCH 5/9] ODROID-X: dw_mmc: Exynos4 speicific code change 'biu' and 'ciu' clock source is chagned to "dwmmc" and "sclk_dwmci", to use Exynos speicific clock gating. Signed-off-by: Dongjin Kim --- drivers/mmc/host/dw_mmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bc7c7cd304fe65..584f757e39b122 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1952,15 +1952,15 @@ int dw_mci_probe(struct dw_mci *host) return -ENODEV; } - host->biu_clk = clk_get(host->dev, "biu"); + host->biu_clk = clk_get(&host->dev, "dwmmc"); if (IS_ERR(host->biu_clk)) - dev_dbg(host->dev, "biu clock not available\n"); + dev_dbg(&host->dev, "biu clock not available\n"); else clk_prepare_enable(host->biu_clk); - host->ciu_clk = clk_get(host->dev, "ciu"); + host->ciu_clk = clk_get(&host->dev, "sclk_dwmci"); if (IS_ERR(host->ciu_clk)) - dev_dbg(host->dev, "ciu clock not available\n"); + dev_dbg(&host->dev, "ciu clock not available\n"); else clk_prepare_enable(host->ciu_clk); From 1a8a0cf3810e2d0f4305efcdbe7047899364cd4a Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 06:48:56 +0900 Subject: [PATCH 6/9] ARM: EXYNOS: Add DWMCI device Defined the clocks for DWCI and gpio configuration. Signed-off-by: Dongjin Kim --- arch/arm/mach-exynos/Kconfig | 13 ++++++ arch/arm/mach-exynos/Makefile | 1 + arch/arm/mach-exynos/clock-exynos4.c | 12 +++++ arch/arm/mach-exynos/setup-dwmci-gpio.c | 62 +++++++++++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 arch/arm/mach-exynos/setup-dwmci-gpio.c diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index ae9077373d5769..3349fb0d87e36d 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -162,6 +162,17 @@ config EXYNOS4_SETUP_SDHCI_GPIO help Common setup code for SDHCI gpio. +config EXYNOS4_SETUP_DWMCI + bool + select EXYNOS4_SETUP_DWMCI_GPIO + help + Internal helper functions for EXYNOS4 based DWMCI systems. + +config EXYNOS4_SETUP_DWMCI_GPIO + bool + help + Common setup code for DWMCI gpio. + config EXYNOS4_SETUP_FIMC bool help @@ -413,6 +424,8 @@ config MACH_HKDK4412 select S5P_DEV_TV select S5P_GPIO_INT select EXYNOS4_DEV_USB_OHCI + select EXYNOS4_DEV_DWMCI + select EXYNOS4_SETUP_DWMCI select SAMSUNG_DEV_ADC help Machine support for Odroid-X based on Samsung EXYNOS4412 diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index dccc3812eba076..84af2288b821ce 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -69,5 +69,6 @@ obj-$(CONFIG_EXYNOS4_SETUP_I2C6) += setup-i2c6.o obj-$(CONFIG_EXYNOS4_SETUP_I2C7) += setup-i2c7.o obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o +obj-$(CONFIG_EXYNOS4_SETUP_DWMCI_GPIO) += setup-dwmci-gpio.o obj-$(CONFIG_EXYNOS4_SETUP_USB_PHY) += setup-usb-phy.o obj-$(CONFIG_EXYNOS_SETUP_SPI) += setup-spi.o diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c index 2f51293c187577..7e7a7ebbe22c70 100644 --- a/arch/arm/mach-exynos/clock-exynos4.c +++ b/arch/arm/mach-exynos/clock-exynos4.c @@ -1205,6 +1205,17 @@ static struct clksrc_clk exynos4_clk_sclk_mmc3 = { .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS2, .shift = 24, .size = 8 }, }; +static struct clksrc_clk exynos4_clk_sclk_dwmci = { + .clk = { + .name = "sclk_dwmci", + .devname = "dw_mmc", + .parent = &exynos4_clk_dout_mmc4.clk, + .enable = exynos4_clksrc_mask_fsys_ctrl, + .ctrlbit = (1 << 16), + }, + .reg_div = { .reg = EXYNOS4_CLKDIV_FSYS3, .shift = 8, .size = 8 }, +}; + static struct clksrc_clk exynos4_clk_mdout_spi0 = { .clk = { .name = "mdout_spi", @@ -1318,6 +1329,7 @@ static struct clksrc_clk *exynos4_clksrc_cdev[] = { &exynos4_clk_sclk_mmc1, &exynos4_clk_sclk_mmc2, &exynos4_clk_sclk_mmc3, + &exynos4_clk_sclk_dwmci, &exynos4_clk_sclk_spi0, &exynos4_clk_sclk_spi1, &exynos4_clk_sclk_spi2, diff --git a/arch/arm/mach-exynos/setup-dwmci-gpio.c b/arch/arm/mach-exynos/setup-dwmci-gpio.c new file mode 100644 index 00000000000000..0a021b637f426d --- /dev/null +++ b/arch/arm/mach-exynos/setup-dwmci-gpio.c @@ -0,0 +1,62 @@ +/* linux/arch/arm/mach-exynos4/setup-sdhci-gpio.c + * + * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * EXYNOS4 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ +#include +#include +#include +#include +#include +#include +#include + +#include + +void exynos4_setup_dwmci_cfg_gpio(struct platfrom_device *dev, int width) +{ + unsigned int gpio; + + for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) { + gpio_request(gpio, "GPK0"); + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); + gpio_free(gpio); + } + + switch (width) { + case MMC_BUS_WIDTH_8: + for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) { + gpio_request(gpio, "GPK1"); + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); + s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); + gpio_free(gpio); + } + case MMC_BUS_WIDTH_4: + for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) { + gpio_request(gpio, "GPK0"); + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); + s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); + gpio_free(gpio); + } + break; + case MMC_BUS_WIDTH_1: + gpio = EXYNOS4_GPK0(3); + gpio_request(gpio, "GPK0"); + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); + s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2); + gpio_free(gpio); + default: + break; + } +} From 3efa0e5382fecf84d39b13cbde8c2e42b54a0a78 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 10:47:08 +0900 Subject: [PATCH 7/9] ODROID-X: board: Add eMMC device support Signed-off-by: Dongjin Kim --- arch/arm/mach-exynos/mach-hkdk4412.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-exynos/mach-hkdk4412.c b/arch/arm/mach-exynos/mach-hkdk4412.c index 6e46656e7a7843..35c4412f20b33d 100644 --- a/arch/arm/mach-exynos/mach-hkdk4412.c +++ b/arch/arm/mach-exynos/mach-hkdk4412.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -48,9 +49,12 @@ #include #include #include +#include #include "common.h" +extern void exynos4_setup_dwmci_cfg_gpio(struct platfrom_device *dev, int width); + /* Following are default values for UCON, ULCON and UFCON UART registers */ #define HKDK4412_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ S3C2410_UCON_RXILEVEL | \ @@ -96,18 +100,6 @@ static struct s3c2410_uartcfg hkdk4412_uartcfgs[] __initdata = { }, }; -static struct s3c_sdhci_platdata hkdk4412_hsmmc2_pdata __initdata = { - .cd_type = S3C_SDHCI_CD_INTERNAL, -#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT - .max_width = 8, - .host_caps = MMC_CAP_8_BIT_DATA, -#endif -}; - -static struct s3c_sdhci_platdata hkdk4412_hsmmc3_pdata __initdata = { - .cd_type = S3C_SDHCI_CD_INTERNAL, -}; - static struct regulator_consumer_supply __initdata max77686_buck1_consumer[] = { }; @@ -1084,6 +1076,7 @@ static struct platform_device *hkdk4412_devices[] __initdata = { &hdmi_fixed_voltage, #endif &exynos4_device_ohci, + &exynos4_device_dwmci, &hkdk4412_leds_gpio, #if defined(CONFIG_LCD_LP101WH1) &hkdk4412_lcd_lp101wh1, @@ -1180,6 +1173,9 @@ static void __init hkdk4412_machine_init(void) s3c_sdhci2_set_platdata(&hkdk4412_hsmmc2_pdata); + exynos4_setup_dwmci_cfg_gpio(NULL, 8); + exynos4_dwmci_set_platdata(&hkdk4412_dwmci_pdata); + hkdk4412_ehci_init(); hkdk4412_ohci_init(); s3c_hsotg_set_platdata(&hkdk4412_hsotg_pdata); From 4cc4db22554dcb6df83c78eb792303a79d50c105 Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 10:47:56 +0900 Subject: [PATCH 8/9] ODROID-X: config: Enable eMMC kernel config "Synopsys DesignWare Memory Card Interface" is enabled. Signed-off-by: Dongjin Kim --- arch/arm/configs/odroidx_defconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/odroidx_defconfig b/arch/arm/configs/odroidx_defconfig index f57717fb32750d..3f4398f8771f58 100644 --- a/arch/arm/configs/odroidx_defconfig +++ b/arch/arm/configs/odroidx_defconfig @@ -377,6 +377,7 @@ CONFIG_EXYNOS_DEV_DMA=y CONFIG_EXYNOS_DEV_DRM=y CONFIG_EXYNOS4_SETUP_FIMD0=y CONFIG_EXYNOS_DEV_SYSMMU=y +CONFIG_EXYNOS4_DEV_DWMCI=y CONFIG_EXYNOS4_DEV_USB_OHCI=y CONFIG_EXYNOS4_SETUP_I2C1=y CONFIG_EXYNOS4_SETUP_I2C3=y @@ -384,6 +385,8 @@ CONFIG_EXYNOS4_SETUP_I2C7=y CONFIG_EXYNOS4_SETUP_KEYPAD=y CONFIG_EXYNOS4_SETUP_SDHCI=y CONFIG_EXYNOS4_SETUP_SDHCI_GPIO=y +CONFIG_EXYNOS4_SETUP_DWMCI=y +CONFIG_EXYNOS4_SETUP_DWMCI_GPIO=y CONFIG_EXYNOS4_SETUP_USB_PHY=y # @@ -606,6 +609,8 @@ CONFIG_PM=y # CONFIG_PM_DEBUG is not set # CONFIG_APM_EMULATION is not set CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_PM_GENERIC_DOMAINS_RUNTIME=y CONFIG_CPU_PM=y CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_ARM_CPU_SUSPEND=y @@ -2369,7 +2374,9 @@ CONFIG_MMC_SDHCI_S3C=y # CONFIG_MMC_SDHCI_PXAV3 is not set # CONFIG_MMC_SDHCI_PXAV2 is not set # CONFIG_MMC_SDHCI_S3C_DMA is not set -# CONFIG_MMC_DW is not set +CONFIG_MMC_DW=y +# CONFIG_MMC_DW_IDMAC is not set +CONFIG_MMC_DW_PLTFM=y # CONFIG_MMC_VUB300 is not set # CONFIG_MMC_USHC is not set # CONFIG_MEMSTICK is not set From bfc181dd42be413ce9c0ed1dafde1a47a70014eb Mon Sep 17 00:00:00 2001 From: Dongjin Kim Date: Mon, 13 Aug 2012 04:55:35 +0900 Subject: [PATCH 9/9] ODROID-X: config: Enable Exynos4 CPU_FREQ driver Exynos4 cpufreq driver is enabled, and 'performance' is selected for its power governor as default. Signed-off-by: Dongjin Kim --- arch/arm/configs/odroidx_defconfig | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/arch/arm/configs/odroidx_defconfig b/arch/arm/configs/odroidx_defconfig index 3f4398f8771f58..8c8d8f0f1f4a6b 100644 --- a/arch/arm/configs/odroidx_defconfig +++ b/arch/arm/configs/odroidx_defconfig @@ -568,8 +568,31 @@ CONFIG_CMDLINE_FROM_BOOTLOADER=y # # CPU Frequency scaling # -# CONFIG_CPU_FREQ is not set -# CONFIG_CPU_IDLE is not set +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_TABLE=y +CONFIG_CPU_FREQ_STAT=y +CONFIG_CPU_FREQ_STAT_DETAILS=y +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=m +CONFIG_CPU_FREQ_GOV_USERSPACE=m +CONFIG_CPU_FREQ_GOV_ONDEMAND=m +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m + +# +# ARM CPU frequency scaling drivers +# +CONFIG_ARM_EXYNOS_CPUFREQ=y +# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set +CONFIG_ARM_EXYNOS4X12_CPUFREQ=y +# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y # CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set #