From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabien Parent Date: Sun, 24 Mar 2019 16:46:32 +0100 Subject: [U-Boot] [PATCH v3 1/7] mmc: mtk-sd: add source_cg clock support In-Reply-To: <20190324154638.29800-1-fparent@baylibre.com> References: <20190324154638.29800-1-fparent@baylibre.com> Message-ID: <20190324154638.29800-2-fparent@baylibre.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Some MediaTek SoC need an additional clock "source_cg". Enable this new clock. We reuse the same clock name as in the kernel. Signed-off-by: Fabien Parent Acked-by: Ryder Lee --- v3: * No change v2: * Get rid of variable has_src_clk_cg --- drivers/mmc/mtk-sd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index d3f0778368..eed98b769c 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -247,6 +247,7 @@ struct msdc_host { struct msdc_compatible *dev_comp; struct clk src_clk; /* for SD/MMC bus clock */ + struct clk src_clk_cg; /* optional, MSDC source clock control gate */ struct clk h_clk; /* MSDC core clock */ u32 src_clk_freq; /* source clock */ @@ -1269,6 +1270,8 @@ static void msdc_ungate_clock(struct msdc_host *host) { clk_enable(&host->src_clk); clk_enable(&host->h_clk); + if (host->src_clk_cg.dev) + clk_enable(&host->src_clk_cg); } static int msdc_drv_probe(struct udevice *dev) @@ -1332,6 +1335,8 @@ static int msdc_ofdata_to_platdata(struct udevice *dev) if (ret < 0) return ret; + clk_get_by_name(dev, "source_cg", &host->src_clk_cg); /* optional */ + #if IS_ENABLED(DM_GPIO) gpio_request_by_name(dev, "wp-gpios", 0, &host->gpio_wp, GPIOD_IS_IN); gpio_request_by_name(dev, "cd-gpios", 0, &host->gpio_cd, GPIOD_IS_IN); -- 2.20.1