Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bastian Hecht and committed by
Chris Ball
e82b4ac9 4932bd64

+17
+13
drivers/mmc/host/sh_mobile_sdhi.c
··· 109 109 mmc_data = &priv->mmc_data; 110 110 p->pdata = mmc_data; 111 111 112 + if (p->init) { 113 + ret = p->init(pdev); 114 + if (ret) 115 + goto einit; 116 + } 117 + 112 118 snprintf(clk_name, sizeof(clk_name), "sdhi%d", pdev->id); 113 119 priv->clk = clk_get(&pdev->dev, clk_name); 114 120 if (IS_ERR(priv->clk)) { ··· 239 233 eprobe: 240 234 clk_put(priv->clk); 241 235 eclkget: 236 + if (p->cleanup) 237 + p->cleanup(pdev); 238 + einit: 242 239 kfree(priv); 243 240 return ret; 244 241 } ··· 266 257 } 267 258 268 259 clk_put(priv->clk); 260 + 261 + if (p->cleanup) 262 + p->cleanup(pdev); 263 + 269 264 kfree(priv); 270 265 271 266 return 0;
+4
include/linux/mmc/sh_mobile_sdhi.h
··· 20 20 struct tmio_mmc_data *pdata; 21 21 void (*set_pwr)(struct platform_device *pdev, int state); 22 22 int (*get_cd)(struct platform_device *pdev); 23 + 24 + /* callbacks for board specific setup code */ 25 + int (*init)(struct platform_device *pdev); 26 + void (*cleanup)(struct platform_device *pdev); 23 27 }; 24 28 25 29 #endif /* LINUX_MMC_SH_MOBILE_SDHI_H */