提交 e1463618 编写于 作者: M Manish Narani 提交者: Ulf Hansson

mmc: sdhci-of-arasan: Separate out clk related data to another structure

To improve the code readability, use two different structs, one for
clock provider data and one for mmc platform data.
Signed-off-by: NManish Narani <manish.narani@xilinx.com>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 b0b19ce6
...@@ -71,14 +71,23 @@ struct sdhci_arasan_soc_ctl_map { ...@@ -71,14 +71,23 @@ struct sdhci_arasan_soc_ctl_map {
bool hiword_update; bool hiword_update;
}; };
/**
* struct sdhci_arasan_clk_data
* @sdcardclk_hw: Struct for the clock we might provide to a PHY.
* @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw.
*/
struct sdhci_arasan_clk_data {
struct clk_hw sdcardclk_hw;
struct clk *sdcardclk;
};
/** /**
* struct sdhci_arasan_data * struct sdhci_arasan_data
* @host: Pointer to the main SDHCI host structure. * @host: Pointer to the main SDHCI host structure.
* @clk_ahb: Pointer to the AHB clock * @clk_ahb: Pointer to the AHB clock
* @phy: Pointer to the generic phy * @phy: Pointer to the generic phy
* @is_phy_on: True if the PHY is on; false if not. * @is_phy_on: True if the PHY is on; false if not.
* @sdcardclk_hw: Struct for the clock we might provide to a PHY. * @clk_data: Struct for the Arasan Controller Clock Data.
* @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw.
* @soc_ctl_base: Pointer to regmap for syscon for soc_ctl registers. * @soc_ctl_base: Pointer to regmap for syscon for soc_ctl registers.
* @soc_ctl_map: Map to get offsets into soc_ctl registers. * @soc_ctl_map: Map to get offsets into soc_ctl registers.
*/ */
...@@ -89,8 +98,7 @@ struct sdhci_arasan_data { ...@@ -89,8 +98,7 @@ struct sdhci_arasan_data {
bool is_phy_on; bool is_phy_on;
bool has_cqe; bool has_cqe;
struct clk_hw sdcardclk_hw; struct sdhci_arasan_clk_data clk_data;
struct clk *sdcardclk;
struct regmap *soc_ctl_base; struct regmap *soc_ctl_base;
const struct sdhci_arasan_soc_ctl_map *soc_ctl_map; const struct sdhci_arasan_soc_ctl_map *soc_ctl_map;
...@@ -535,8 +543,10 @@ static unsigned long sdhci_arasan_sdcardclk_recalc_rate(struct clk_hw *hw, ...@@ -535,8 +543,10 @@ static unsigned long sdhci_arasan_sdcardclk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate) unsigned long parent_rate)
{ {
struct sdhci_arasan_clk_data *clk_data =
container_of(hw, struct sdhci_arasan_clk_data, sdcardclk_hw);
struct sdhci_arasan_data *sdhci_arasan = struct sdhci_arasan_data *sdhci_arasan =
container_of(hw, struct sdhci_arasan_data, sdcardclk_hw); container_of(clk_data, struct sdhci_arasan_data, clk_data);
struct sdhci_host *host = sdhci_arasan->host; struct sdhci_host *host = sdhci_arasan->host;
return host->mmc->actual_clock; return host->mmc->actual_clock;
...@@ -648,6 +658,7 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, ...@@ -648,6 +658,7 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,
struct clk *clk_xin, struct clk *clk_xin,
struct device *dev) struct device *dev)
{ {
struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct clk_init_data sdcardclk_init; struct clk_init_data sdcardclk_init;
const char *parent_clk_name; const char *parent_clk_name;
...@@ -670,13 +681,13 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, ...@@ -670,13 +681,13 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,
sdcardclk_init.flags = CLK_GET_RATE_NOCACHE; sdcardclk_init.flags = CLK_GET_RATE_NOCACHE;
sdcardclk_init.ops = &arasan_sdcardclk_ops; sdcardclk_init.ops = &arasan_sdcardclk_ops;
sdhci_arasan->sdcardclk_hw.init = &sdcardclk_init; clk_data->sdcardclk_hw.init = &sdcardclk_init;
sdhci_arasan->sdcardclk = clk_data->sdcardclk =
devm_clk_register(dev, &sdhci_arasan->sdcardclk_hw); devm_clk_register(dev, &clk_data->sdcardclk_hw);
sdhci_arasan->sdcardclk_hw.init = NULL; clk_data->sdcardclk_hw.init = NULL;
ret = of_clk_add_provider(np, of_clk_src_simple_get, ret = of_clk_add_provider(np, of_clk_src_simple_get,
sdhci_arasan->sdcardclk); clk_data->sdcardclk);
if (ret) if (ret)
dev_err(dev, "Failed to add clock provider\n"); dev_err(dev, "Failed to add clock provider\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册