Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp204837ybt; Thu, 9 Jul 2020 20:04:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlolcYZp/9QBBMldg+idulTHW9aoZfOGc3vebDwbV9/tfsCin7cQTK6vRBI8VhA1DNAH+a X-Received: by 2002:a17:906:c285:: with SMTP id r5mr57864178ejz.153.1594350284007; Thu, 09 Jul 2020 20:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594350284; cv=none; d=google.com; s=arc-20160816; b=Tz35ldG7HD53Z01iQENAw2gdqMB4Ga23nFN7Buugegivdz4Kp24wakUfeqKuYc59su mG2p7Iqvxw3xNsQbMnJvK9AeyzrGPbIW/VAWuHLegGV4fy2qdL2tpoaosQH+Bm0aStgH sVEeb0sW1wTB3J1a9L8GeI8nljbP+of4goaq1QraVjM0QMqvdjxLd53Ef0ml/sX2RNPA pxma5DxMwbugKwrbU8H14p/16CHKR0WY4u83rZDaltzLapCq6x91JqKXZ1Br2x93uS07 wOaxRhVtrbo/mduC0LzZs2uvZvf2Yjxm5rGiTNMg8UhrwXOdc9JpliE1BdxdxoF+W71c OzAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6KRtR9SdpYUMidTMu6Xmuj8Q02i63whibThkqFtREHc=; b=DbR8cGOAMAX3eyAFFXmGUPX2s/MmcBTsHf/Y3sjY1uqV3Ad7hkPqMD11C6/ZkU4UQw +DT/vlNsr+S9Z5Rtv04aGrFZHFlTwAG7YkYv7SI8ZLIj/cCthdNet4Xw7wINcDLoHDv9 SKrM8GKu5MmJhuprHjaG21Pre7wbmhoQbI3JXPCWqtWDLKeJu8M/v3a1Yu54WhuIchUc sdhmuYhh6WCa3oAeTWN/rm+/22XS1v7nsRpn2UJxkhrBh1bOnHaAnoNumpfTIzEXOUc+ phhWalYcg5n5LQYCkrJ+coyk4i8nrN6uO8lWVFqIybvQ0dDxSfBcxK8IYZp+KIBEzrcO pWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jms.id.au header.s=google header.b=OXG6ZPCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si3036210ejb.486.2020.07.09.20.04.21; Thu, 09 Jul 2020 20:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@jms.id.au header.s=google header.b=OXG6ZPCA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbgGJDDW (ORCPT + 99 others); Thu, 9 Jul 2020 23:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbgGJDDW (ORCPT ); Thu, 9 Jul 2020 23:03:22 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C12C08C5CE; Thu, 9 Jul 2020 20:03:21 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id rk21so4434560ejb.2; Thu, 09 Jul 2020 20:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6KRtR9SdpYUMidTMu6Xmuj8Q02i63whibThkqFtREHc=; b=OXG6ZPCAxCCAFxKGeTL6Oy1pdHDCjLE7HmgixA5c+sRgOyvyagscU036gw792Jyvro 3ApdT4aFjcKGMIsGHK9bR2eNPTljVrUkQMhnn2ty4A2hcBYb5GlR7nQdsVN71AcTsm84 dz/ySub8Vy57uB369VOkcXgz9JwwkjVndGkx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6KRtR9SdpYUMidTMu6Xmuj8Q02i63whibThkqFtREHc=; b=lmJRZCnh6/1OXEBhTSrFIy7+SO56pn1QTzFpgtoxkACDvcm2oCftER1giJxAHxnO7l 1JNUfVTwM6qYyYO9JYixptWpnsrAsXemJ0KRDLLDfsin917GSS5igmjQWDNeW3YyTyiw ONVQb4Qs9rqwZ2SjAIBq3esKvHozR9zZJWEhJHPp4OJOo7ofBV3/mG/S41roQX3rAEV3 hUin9dl/N/FNmA2Ygm3lll8RFW/rwie6SK0whACnEZyzaj0I6zxcLBNm2opHlgt1ghLk Q0RTOOkDRFVIBSeEndbXxE5HnezwaqzgKdtvgo7kF9qP4GV2s0kL2sKg0mkjxykML0Wx wO8A== X-Gm-Message-State: AOAM530NLhn9x6aljevtYq2AhpPJ8XwtQBWRvyb70apZVSnt3MKPtMXa iKLPeqVzV3PVnHPNiRBSbjEdztpBkVzHRx5VQwk= X-Received: by 2002:a17:906:841:: with SMTP id f1mr25340332ejd.229.1594350200465; Thu, 09 Jul 2020 20:03:20 -0700 (PDT) MIME-Version: 1.0 References: <20200709195706.12741-1-eajames@linux.ibm.com> <20200709195706.12741-2-eajames@linux.ibm.com> In-Reply-To: <20200709195706.12741-2-eajames@linux.ibm.com> From: Joel Stanley Date: Fri, 10 Jul 2020 03:03:08 +0000 Message-ID: Subject: Re: [PATCH 1/2] clk: AST2600: Add mux for EMMC clock To: Eddie James Cc: linux-clk@vger.kernel.org, Linux Kernel Mailing List , linux-aspeed , linux-mmc@vger.kernel.org, Andrew Jeffery , Ulf Hansson , Adrian Hunter , Stephen Boyd , Michael Turquette Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Jul 2020 at 19:57, Eddie James wrote: > > The EMMC clock can be derived from either the HPLL or the MPLL. Register > a clock mux so that the rate is calculated correctly based upon the > parent. > > Signed-off-by: Eddie James > Reviewed-by: Andrew Jeffery Acked-by: Joel Stanley Fixes: d3d04f6c330a ("clk: Add support for AST2600 SoC") Stephen, I think this should go to stable too. Cheers, Joel > --- > drivers/clk/clk-ast2600.c | 49 ++++++++++++++++++++++++++++++++------- > 1 file changed, 41 insertions(+), 8 deletions(-) > > diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c > index 99afc949925f..177368cac6dd 100644 > --- a/drivers/clk/clk-ast2600.c > +++ b/drivers/clk/clk-ast2600.c > @@ -131,6 +131,18 @@ static const struct clk_div_table ast2600_eclk_div_table[] = { > { 0 } > }; > > +static const struct clk_div_table ast2600_emmc_extclk_div_table[] = { > + { 0x0, 2 }, > + { 0x1, 4 }, > + { 0x2, 6 }, > + { 0x3, 8 }, > + { 0x4, 10 }, > + { 0x5, 12 }, > + { 0x6, 14 }, > + { 0x7, 16 }, > + { 0 } > +}; > + > static const struct clk_div_table ast2600_mac_div_table[] = { > { 0x0, 4 }, > { 0x1, 4 }, > @@ -390,6 +402,11 @@ static struct clk_hw *aspeed_g6_clk_hw_register_gate(struct device *dev, > return hw; > } > > +static const char *const emmc_extclk_parent_names[] = { > + "emmc_extclk_hpll_in", > + "mpll", > +}; > + > static const char * const vclk_parent_names[] = { > "dpll", > "d1pll", > @@ -459,16 +476,32 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) > return PTR_ERR(hw); > aspeed_g6_clk_data->hws[ASPEED_CLK_UARTX] = hw; > > - /* EMMC ext clock divider */ > - hw = clk_hw_register_gate(dev, "emmc_extclk_gate", "hpll", 0, > - scu_g6_base + ASPEED_G6_CLK_SELECTION1, 15, 0, > - &aspeed_g6_clk_lock); > + /* EMMC ext clock */ > + hw = clk_hw_register_fixed_factor(dev, "emmc_extclk_hpll_in", "hpll", > + 0, 1, 2); > if (IS_ERR(hw)) > return PTR_ERR(hw); > - hw = clk_hw_register_divider_table(dev, "emmc_extclk", "emmc_extclk_gate", 0, > - scu_g6_base + ASPEED_G6_CLK_SELECTION1, 12, 3, 0, > - ast2600_div_table, > - &aspeed_g6_clk_lock); > + > + hw = clk_hw_register_mux(dev, "emmc_extclk_mux", > + emmc_extclk_parent_names, > + ARRAY_SIZE(emmc_extclk_parent_names), 0, > + scu_g6_base + ASPEED_G6_CLK_SELECTION1, 11, 1, > + 0, &aspeed_g6_clk_lock); > + if (IS_ERR(hw)) > + return PTR_ERR(hw); > + > + hw = clk_hw_register_gate(dev, "emmc_extclk_gate", "emmc_extclk_mux", > + 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, > + 15, 0, &aspeed_g6_clk_lock); > + if (IS_ERR(hw)) > + return PTR_ERR(hw); > + > + hw = clk_hw_register_divider_table(dev, "emmc_extclk", > + "emmc_extclk_gate", 0, > + scu_g6_base + > + ASPEED_G6_CLK_SELECTION1, 12, > + 3, 0, ast2600_emmc_extclk_div_table, > + &aspeed_g6_clk_lock); > if (IS_ERR(hw)) > return PTR_ERR(hw); > aspeed_g6_clk_data->hws[ASPEED_CLK_EMMC] = hw; > -- > 2.24.0 >