ARM: OMAP2: Use hwmod to initialize mmc for 2420
This allows us to pass dma request lines in platform data to MMC driver the same way as we already do for omap2430 and later. Also note that we need to only build this code if MMC_OMAP is selected, so change Makefile accordingly and place it near the MMC_OMAP_HS in the Makefile. Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
5f7b900429
commit
b955eefc46
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "iomap.h"
|
||||
#include <plat/board.h>
|
||||
#include <plat/mmc.h>
|
||||
#include <plat/dma.h>
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
|
@ -603,75 +602,6 @@ static inline void omap_init_aes(void) { }
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
|
||||
|
||||
static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
|
||||
*mmc_controller)
|
||||
{
|
||||
if ((mmc_controller->slots[0].switch_pin > 0) && \
|
||||
(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
|
||||
omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
|
||||
OMAP_PIN_INPUT_PULLUP);
|
||||
if ((mmc_controller->slots[0].gpio_wp > 0) && \
|
||||
(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
|
||||
omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
|
||||
OMAP_PIN_INPUT_PULLUP);
|
||||
|
||||
omap_mux_init_signal("sdmmc_cmd", 0);
|
||||
omap_mux_init_signal("sdmmc_clki", 0);
|
||||
omap_mux_init_signal("sdmmc_clko", 0);
|
||||
omap_mux_init_signal("sdmmc_dat0", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir0", 0);
|
||||
omap_mux_init_signal("sdmmc_cmd_dir", 0);
|
||||
if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
|
||||
omap_mux_init_signal("sdmmc_dat1", 0);
|
||||
omap_mux_init_signal("sdmmc_dat2", 0);
|
||||
omap_mux_init_signal("sdmmc_dat3", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir1", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir2", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir3", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use internal loop-back in MMC/SDIO Module Input Clock
|
||||
* selection
|
||||
*/
|
||||
if (mmc_controller->slots[0].internal_clock) {
|
||||
u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
|
||||
v |= (1 << 24);
|
||||
omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
|
||||
}
|
||||
}
|
||||
|
||||
void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
struct omap_hwmod *oh;
|
||||
int id = 0;
|
||||
char *oh_name = "msdi1";
|
||||
char *dev_name = "mmci-omap";
|
||||
|
||||
if (!mmc_data[0]) {
|
||||
pr_err("%s fails: Incomplete platform data\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
omap242x_mmc_mux(mmc_data[0]);
|
||||
|
||||
oh = omap_hwmod_lookup(oh_name);
|
||||
if (!oh) {
|
||||
pr_err("Could not look up %s\n", oh_name);
|
||||
return;
|
||||
}
|
||||
pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
|
||||
sizeof(struct omap_mmc_platform_data), NULL, 0, 0);
|
||||
if (IS_ERR(pdev))
|
||||
WARN(1, "Can'd build omap_device for %s:%s.\n",
|
||||
dev_name, oh->name);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
|
||||
defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
|
||||
#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
|
||||
|
|
|
@ -22,11 +22,15 @@
|
|||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <plat/omap_hwmod.h>
|
||||
#include <plat/omap_device.h>
|
||||
#include <plat/mmc.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "control.h"
|
||||
#include "mux.h"
|
||||
|
||||
/*
|
||||
* MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
|
||||
|
@ -86,3 +90,72 @@ int omap_msdi_reset(struct omap_hwmod *oh)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
|
||||
|
||||
static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
|
||||
*mmc_controller)
|
||||
{
|
||||
if ((mmc_controller->slots[0].switch_pin > 0) && \
|
||||
(mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
|
||||
omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
|
||||
OMAP_PIN_INPUT_PULLUP);
|
||||
if ((mmc_controller->slots[0].gpio_wp > 0) && \
|
||||
(mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
|
||||
omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
|
||||
OMAP_PIN_INPUT_PULLUP);
|
||||
|
||||
omap_mux_init_signal("sdmmc_cmd", 0);
|
||||
omap_mux_init_signal("sdmmc_clki", 0);
|
||||
omap_mux_init_signal("sdmmc_clko", 0);
|
||||
omap_mux_init_signal("sdmmc_dat0", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir0", 0);
|
||||
omap_mux_init_signal("sdmmc_cmd_dir", 0);
|
||||
if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
|
||||
omap_mux_init_signal("sdmmc_dat1", 0);
|
||||
omap_mux_init_signal("sdmmc_dat2", 0);
|
||||
omap_mux_init_signal("sdmmc_dat3", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir1", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir2", 0);
|
||||
omap_mux_init_signal("sdmmc_dat_dir3", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use internal loop-back in MMC/SDIO Module Input Clock
|
||||
* selection
|
||||
*/
|
||||
if (mmc_controller->slots[0].internal_clock) {
|
||||
u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
|
||||
v |= (1 << 24);
|
||||
omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
|
||||
}
|
||||
}
|
||||
|
||||
void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
struct omap_hwmod *oh;
|
||||
int id = 0;
|
||||
char *oh_name = "msdi1";
|
||||
char *dev_name = "mmci-omap";
|
||||
|
||||
if (!mmc_data[0]) {
|
||||
pr_err("%s fails: Incomplete platform data\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
omap242x_mmc_mux(mmc_data[0]);
|
||||
|
||||
oh = omap_hwmod_lookup(oh_name);
|
||||
if (!oh) {
|
||||
pr_err("Could not look up %s\n", oh_name);
|
||||
return;
|
||||
}
|
||||
pdev = omap_device_build(dev_name, id, oh, mmc_data[0],
|
||||
sizeof(struct omap_mmc_platform_data), NULL, 0, 0);
|
||||
if (IS_ERR(pdev))
|
||||
WARN(1, "Can'd build omap_device for %s:%s.\n",
|
||||
dev_name, oh->name);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue