| From 0a98733a6514780187f2f435f3057949932d531b Mon Sep 17 00:00:00 2001 |
| From: Bastian Hecht <hechtb@googlemail.com> |
| Date: Fri, 16 Mar 2012 12:19:29 -0400 |
| Subject: mmc: sh_mobile_sdhi: add a callback for board specific init code |
| |
| Some boards need a preliminary setup stage to prepare the sdhi |
| controller. |
| |
| Signed-off-by: Bastian Hecht <hechtb@gmail.com> |
| Signed-off-by: Chris Ball <cjb@laptop.org> |
| (cherry picked from commit e82b4ac94e5c43fad51b975aed058858ceda1f0f) |
| |
| Signed-off-by: Simon Horman <horms@verge.net.au> |
| --- |
| drivers/mmc/host/sh_mobile_sdhi.c | 13 +++++++++++++ |
| include/linux/mmc/sh_mobile_sdhi.h | 4 ++++ |
| 2 files changed, 17 insertions(+) |
| |
| diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c |
| index f91c3aa..07ff3fe 100644 |
| --- a/drivers/mmc/host/sh_mobile_sdhi.c |
| +++ b/drivers/mmc/host/sh_mobile_sdhi.c |
| @@ -109,6 +109,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) |
| mmc_data = &priv->mmc_data; |
| p->pdata = mmc_data; |
| |
| + if (p->init) { |
| + ret = p->init(pdev); |
| + if (ret) |
| + goto einit; |
| + } |
| + |
| snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id); |
| priv->clk = clk_get(&pdev->dev, clk_name); |
| if (IS_ERR(priv->clk)) { |
| @@ -233,6 +239,9 @@ eirq_card_detect: |
| eprobe: |
| clk_put(priv->clk); |
| eclkget: |
| + if (p->cleanup) |
| + p->cleanup(pdev); |
| +einit: |
| kfree(priv); |
| return ret; |
| } |
| @@ -257,6 +266,10 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev) |
| } |
| |
| clk_put(priv->clk); |
| + |
| + if (p->cleanup) |
| + p->cleanup(pdev); |
| + |
| kfree(priv); |
| |
| return 0; |
| diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h |
| index 082a736..686b85b 100644 |
| --- a/include/linux/mmc/sh_mobile_sdhi.h |
| +++ b/include/linux/mmc/sh_mobile_sdhi.h |
| @@ -20,6 +20,10 @@ struct sh_mobile_sdhi_info { |
| struct tmio_mmc_data *pdata; |
| void (*set_pwr)(struct platform_device *pdev, int state); |
| int (*get_cd)(struct platform_device *pdev); |
| + |
| + /* callbacks for board specific setup code */ |
| + int (*init)(struct platform_device *pdev); |
| + void (*cleanup)(struct platform_device *pdev); |
| }; |
| |
| #endif /* LINUX_MMC_SH_MOBILE_SDHI_H */ |
| -- |
| 1.7.10.2.565.gbd578b5 |
| |