Commit 326119c9 authored by Andreas Fenkart's avatar Andreas Fenkart Committed by Ulf Hansson

mmc: omap_hsmmc: remove unnecessary omap_hsmmc_slot_data indirection

omap_hsmmc supports only one slot per controller, see OMAP_MMC_MAX_SLOTS.
This unnecessary indirection leads to confusion in the omap_hsmmc driver.
For example the card_detect callback is not installed by platform code
but from the driver probe function. So it should be a field of
omap_hsmmc_host. But since it is declared under the platform slot while
the drivers struct omap_hsmmc_host has no slot abstraction, this looks
like a bug, especially when not familiar that this driver only supports
1 slot anyway.
Either we should add a slot abstraction to omap_hsmmc_host or remove
it from the platform data struct. Removed since slot multiplexing is
an un-implemented feature
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarAndreas Fenkart <afenkart@gmail.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent df206c31
...@@ -39,8 +39,8 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot, ...@@ -39,8 +39,8 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
u32 reg, prog_io; u32 reg, prog_io;
struct omap_hsmmc_platform_data *mmc = dev->platform_data; struct omap_hsmmc_platform_data *mmc = dev->platform_data;
if (mmc->slots[0].remux) if (mmc->remux)
mmc->slots[0].remux(dev, slot, power_on); mmc->remux(dev, slot, power_on);
/* /*
* Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
...@@ -62,7 +62,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot, ...@@ -62,7 +62,7 @@ static void omap_hsmmc1_before_set_reg(struct device *dev, int slot,
omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1); omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
} }
if (mmc->slots[0].internal_clock) { if (mmc->internal_clock) {
reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
reg |= OMAP2_MMCSDIO1ADPCLKISEL; reg |= OMAP2_MMCSDIO1ADPCLKISEL;
omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0); omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
...@@ -115,7 +115,7 @@ static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc) ...@@ -115,7 +115,7 @@ static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc)
u32 reg; u32 reg;
reg = omap_ctrl_readl(control_devconf1_offset); reg = omap_ctrl_readl(control_devconf1_offset);
if (mmc->slots[0].internal_clock) if (mmc->internal_clock)
reg |= OMAP2_MMCSDIO2ADPCLKISEL; reg |= OMAP2_MMCSDIO2ADPCLKISEL;
else else
reg &= ~OMAP2_MMCSDIO2ADPCLKISEL; reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
...@@ -127,8 +127,8 @@ static void hsmmc2_before_set_reg(struct device *dev, int slot, ...@@ -127,8 +127,8 @@ static void hsmmc2_before_set_reg(struct device *dev, int slot,
{ {
struct omap_hsmmc_platform_data *mmc = dev->platform_data; struct omap_hsmmc_platform_data *mmc = dev->platform_data;
if (mmc->slots[0].remux) if (mmc->remux)
mmc->slots[0].remux(dev, slot, power_on); mmc->remux(dev, slot, power_on);
if (power_on) if (power_on)
hsmmc2_select_input_clk_src(mmc); hsmmc2_select_input_clk_src(mmc);
...@@ -154,14 +154,14 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on, ...@@ -154,14 +154,14 @@ static int nop_mmc_set_power(struct device *dev, int slot, int power_on,
static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
*mmc_controller, int controller_nr) *mmc_controller, int controller_nr)
{ {
if (gpio_is_valid(mmc_controller->slots[0].switch_pin) && if (gpio_is_valid(mmc_controller->switch_pin) &&
(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) (mmc_controller->switch_pin < OMAP_MAX_GPIO_LINES))
omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, omap_mux_init_gpio(mmc_controller->switch_pin,
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
if (gpio_is_valid(mmc_controller->slots[0].gpio_wp) && if (gpio_is_valid(mmc_controller->gpio_wp) &&
(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) (mmc_controller->gpio_wp < OMAP_MAX_GPIO_LINES))
omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, omap_mux_init_gpio(mmc_controller->gpio_wp,
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
if (cpu_is_omap34xx()) { if (cpu_is_omap34xx()) {
if (controller_nr == 0) { if (controller_nr == 0) {
omap_mux_init_signal("sdmmc1_clk", omap_mux_init_signal("sdmmc1_clk",
...@@ -170,7 +170,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data ...@@ -170,7 +170,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
omap_mux_init_signal("sdmmc1_dat0", omap_mux_init_signal("sdmmc1_dat0",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
if (mmc_controller->slots[0].caps & if (mmc_controller->caps &
(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
omap_mux_init_signal("sdmmc1_dat1", omap_mux_init_signal("sdmmc1_dat1",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
...@@ -179,7 +179,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data ...@@ -179,7 +179,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
omap_mux_init_signal("sdmmc1_dat3", omap_mux_init_signal("sdmmc1_dat3",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
} }
if (mmc_controller->slots[0].caps & if (mmc_controller->caps &
MMC_CAP_8_BIT_DATA) { MMC_CAP_8_BIT_DATA) {
omap_mux_init_signal("sdmmc1_dat4", omap_mux_init_signal("sdmmc1_dat4",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
...@@ -204,7 +204,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data ...@@ -204,7 +204,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
* For 8 wire configurations, Lines DAT4, 5, 6 and 7 * For 8 wire configurations, Lines DAT4, 5, 6 and 7
* need to be muxed in the board-*.c files * need to be muxed in the board-*.c files
*/ */
if (mmc_controller->slots[0].caps & if (mmc_controller->caps &
(MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
omap_mux_init_signal("sdmmc2_dat1", omap_mux_init_signal("sdmmc2_dat1",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
...@@ -213,7 +213,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data ...@@ -213,7 +213,7 @@ static inline void omap_hsmmc_mux(struct omap_hsmmc_platform_data
omap_mux_init_signal("sdmmc2_dat3", omap_mux_init_signal("sdmmc2_dat3",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
} }
if (mmc_controller->slots[0].caps & if (mmc_controller->caps &
MMC_CAP_8_BIT_DATA) { MMC_CAP_8_BIT_DATA) {
omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4", omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
OMAP_PIN_INPUT_PULLUP); OMAP_PIN_INPUT_PULLUP);
...@@ -249,23 +249,23 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, ...@@ -249,23 +249,23 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
else else
snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i", snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i",
c->mmc, 1); c->mmc, 1);
mmc->slots[0].name = hc_name; mmc->name = hc_name;
mmc->nr_slots = 1; mmc->nr_slots = 1;
mmc->slots[0].caps = c->caps; mmc->caps = c->caps;
mmc->slots[0].internal_clock = !c->ext_clock; mmc->internal_clock = !c->ext_clock;
mmc->reg_offset = 0; mmc->reg_offset = 0;
mmc->slots[0].switch_pin = c->gpio_cd; mmc->switch_pin = c->gpio_cd;
mmc->slots[0].gpio_wp = c->gpio_wp; mmc->gpio_wp = c->gpio_wp;
mmc->slots[0].remux = c->remux; mmc->remux = c->remux;
mmc->slots[0].init_card = c->init_card; mmc->init_card = c->init_card;
if (c->cover_only) if (c->cover_only)
mmc->slots[0].cover = 1; mmc->cover = 1;
if (c->nonremovable) if (c->nonremovable)
mmc->slots[0].nonremovable = 1; mmc->nonremovable = 1;
/* /*
* NOTE: MMC slots should have a Vcc regulator set up. * NOTE: MMC slots should have a Vcc regulator set up.
...@@ -275,42 +275,42 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, ...@@ -275,42 +275,42 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
* temporary HACK: ocr_mask instead of fixed supply * temporary HACK: ocr_mask instead of fixed supply
*/ */
if (soc_is_am35xx()) if (soc_is_am35xx())
mmc->slots[0].ocr_mask = MMC_VDD_165_195 | mmc->ocr_mask = MMC_VDD_165_195 |
MMC_VDD_26_27 | MMC_VDD_26_27 |
MMC_VDD_27_28 | MMC_VDD_27_28 |
MMC_VDD_29_30 | MMC_VDD_29_30 |
MMC_VDD_30_31 | MMC_VDD_30_31 |
MMC_VDD_31_32; MMC_VDD_31_32;
else else
mmc->slots[0].ocr_mask = c->ocr_mask; mmc->ocr_mask = c->ocr_mask;
if (!soc_is_am35xx()) if (!soc_is_am35xx())
mmc->slots[0].features |= HSMMC_HAS_PBIAS; mmc->features |= HSMMC_HAS_PBIAS;
switch (c->mmc) { switch (c->mmc) {
case 1: case 1:
if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { if (mmc->features & HSMMC_HAS_PBIAS) {
/* on-chip level shifting via PBIAS0/PBIAS1 */ /* on-chip level shifting via PBIAS0/PBIAS1 */
mmc->slots[0].before_set_reg = mmc->before_set_reg =
omap_hsmmc1_before_set_reg; omap_hsmmc1_before_set_reg;
mmc->slots[0].after_set_reg = mmc->after_set_reg =
omap_hsmmc1_after_set_reg; omap_hsmmc1_after_set_reg;
} }
if (soc_is_am35xx()) if (soc_is_am35xx())
mmc->slots[0].set_power = nop_mmc_set_power; mmc->set_power = nop_mmc_set_power;
/* OMAP3630 HSMMC1 supports only 4-bit */ /* OMAP3630 HSMMC1 supports only 4-bit */
if (cpu_is_omap3630() && if (cpu_is_omap3630() &&
(c->caps & MMC_CAP_8_BIT_DATA)) { (c->caps & MMC_CAP_8_BIT_DATA)) {
c->caps &= ~MMC_CAP_8_BIT_DATA; c->caps &= ~MMC_CAP_8_BIT_DATA;
c->caps |= MMC_CAP_4_BIT_DATA; c->caps |= MMC_CAP_4_BIT_DATA;
mmc->slots[0].caps = c->caps; mmc->caps = c->caps;
} }
break; break;
case 2: case 2:
if (soc_is_am35xx()) if (soc_is_am35xx())
mmc->slots[0].set_power = am35x_hsmmc2_set_power; mmc->set_power = am35x_hsmmc2_set_power;
if (c->ext_clock) if (c->ext_clock)
c->transceiver = 1; c->transceiver = 1;
...@@ -318,17 +318,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, ...@@ -318,17 +318,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
c->caps &= ~MMC_CAP_8_BIT_DATA; c->caps &= ~MMC_CAP_8_BIT_DATA;
c->caps |= MMC_CAP_4_BIT_DATA; c->caps |= MMC_CAP_4_BIT_DATA;
} }
if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { if (mmc->features & HSMMC_HAS_PBIAS) {
/* off-chip level shifting, or none */ /* off-chip level shifting, or none */
mmc->slots[0].before_set_reg = hsmmc2_before_set_reg; mmc->before_set_reg = hsmmc2_before_set_reg;
mmc->slots[0].after_set_reg = NULL; mmc->after_set_reg = NULL;
} }
break; break;
case 3: case 3:
case 4: case 4:
case 5: case 5:
mmc->slots[0].before_set_reg = NULL; mmc->before_set_reg = NULL;
mmc->slots[0].after_set_reg = NULL; mmc->after_set_reg = NULL;
break; break;
default: default:
pr_err("MMC%d configuration not supported!\n", c->mmc); pr_err("MMC%d configuration not supported!\n", c->mmc);
...@@ -363,8 +363,8 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) ...@@ -363,8 +363,8 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
if (!mmc_pdata) if (!mmc_pdata)
continue; continue;
mmc_pdata->slots[0].switch_pin = c->gpio_cd; mmc_pdata->switch_pin = c->gpio_cd;
mmc_pdata->slots[0].gpio_wp = c->gpio_wp; mmc_pdata->gpio_wp = c->gpio_wp;
res = omap_device_register(pdev); res = omap_device_register(pdev);
if (res) if (res)
...@@ -464,7 +464,7 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo, ...@@ -464,7 +464,7 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
platform_device_put(pdev); platform_device_put(pdev);
free_name: free_name:
kfree(mmc_data->slots[0].name); kfree(mmc_data->name);
free_mmc: free_mmc:
kfree(mmc_data); kfree(mmc_data);
......
This diff is collapsed.
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#define OMAP_HSMMC_MAX_SLOTS 1
/* /*
* struct omap_hsmmc_dev_attr.flags possibilities * struct omap_hsmmc_dev_attr.flags possibilities
* *
...@@ -57,62 +55,60 @@ struct omap_hsmmc_platform_data { ...@@ -57,62 +55,60 @@ struct omap_hsmmc_platform_data {
/* Register offset deviation */ /* Register offset deviation */
u16 reg_offset; u16 reg_offset;
struct omap_hsmmc_slot_data { /*
/* * 4/8 wires and any additional host capabilities
* 4/8 wires and any additional host capabilities * need to OR'd all capabilities (ref. linux/mmc/host.h)
* need to OR'd all capabilities (ref. linux/mmc/host.h) */
*/ u32 caps; /* Used for the MMC driver on 2430 and later */
u32 caps; /* Used for the MMC driver on 2430 and later */ u32 pm_caps; /* PM capabilities of the mmc */
u32 pm_caps; /* PM capabilities of the mmc */
/* switch pin can be for card detect (default) or card cover */ /* switch pin can be for card detect (default) or card cover */
unsigned cover:1; unsigned cover:1;
/* use the internal clock */ /* use the internal clock */
unsigned internal_clock:1; unsigned internal_clock:1;
/* nonremovable e.g. eMMC */ /* nonremovable e.g. eMMC */
unsigned nonremovable:1; unsigned nonremovable:1;
/* eMMC does not handle power off when not in sleep state */ /* eMMC does not handle power off when not in sleep state */
unsigned no_regulator_off_init:1; unsigned no_regulator_off_init:1;
/* we can put the features above into this variable */ /* we can put the features above into this variable */
#define HSMMC_HAS_PBIAS (1 << 0) #define HSMMC_HAS_PBIAS (1 << 0)
#define HSMMC_HAS_UPDATED_RESET (1 << 1) #define HSMMC_HAS_UPDATED_RESET (1 << 1)
#define HSMMC_HAS_HSPE_SUPPORT (1 << 2) #define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
unsigned features; unsigned features;
int switch_pin; /* gpio (card detect) */ int switch_pin; /* gpio (card detect) */
int gpio_wp; /* gpio (write protect) */ int gpio_wp; /* gpio (write protect) */
int (*set_power)(struct device *dev, int slot, int (*set_power)(struct device *dev, int slot,
int power_on, int vdd); int power_on, int vdd);
int (*get_ro)(struct device *dev, int slot); int (*get_ro)(struct device *dev, int slot);
void (*remux)(struct device *dev, int slot, int power_on); void (*remux)(struct device *dev, int slot, int power_on);
/* Call back before enabling / disabling regulators */ /* Call back before enabling / disabling regulators */
void (*before_set_reg)(struct device *dev, int slot, void (*before_set_reg)(struct device *dev, int slot,
int power_on, int vdd); int power_on, int vdd);
/* Call back after enabling / disabling regulators */ /* Call back after enabling / disabling regulators */
void (*after_set_reg)(struct device *dev, int slot, void (*after_set_reg)(struct device *dev, int slot,
int power_on, int vdd); int power_on, int vdd);
/* if we have special card, init it using this callback */ /* if we have special card, init it using this callback */
void (*init_card)(struct mmc_card *card); void (*init_card)(struct mmc_card *card);
/* return MMC cover switch state, can be NULL if not supported. /* return MMC cover switch state, can be NULL if not supported.
* *
* possible return values: * possible return values:
* 0 - closed * 0 - closed
* 1 - open * 1 - open
*/ */
int (*get_cover_state)(struct device *dev, int slot); int (*get_cover_state)(struct device *dev, int slot);
const char *name; const char *name;
u32 ocr_mask; u32 ocr_mask;
/* Card detection IRQs */ /* Card detection IRQs */
int card_detect_irq; int card_detect_irq;
int (*card_detect)(struct device *dev, int slot); int (*card_detect)(struct device *dev, int slot);
} slots[OMAP_HSMMC_MAX_SLOTS];
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment