diff mbox series

[u-boot,v2019.04-aspeed-openbmc,09/11] clk: aspeed: Add HACE yclk to ast2600

Message ID 20210413080755.73572-10-joel@jms.id.au
State New
Headers show
Series Use HACE to | expand

Commit Message

Joel Stanley April 13, 2021, 8:07 a.m. UTC
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/clk/aspeed/clk_ast2600.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Klaus Heinrich Kiwi April 13, 2021, 8:42 p.m. UTC | #1
On 4/13/2021 5:07 AM, Joel Stanley wrote:
> Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
> ---
>   drivers/clk/aspeed/clk_ast2600.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/clk/aspeed/clk_ast2600.c b/drivers/clk/aspeed/clk_ast2600.c
> index 4c00008a5dfd..ba9a0a0a9a5a 100644
> --- a/drivers/clk/aspeed/clk_ast2600.c
> +++ b/drivers/clk/aspeed/clk_ast2600.c
> @@ -1066,6 +1066,25 @@ static ulong ast2600_enable_usbbhclk(struct ast2600_scu *scu)
>   	return 0;
>   }
> 
> +/* also known as yclk */
> +static ulong ast2600_enable_haceclk(struct ast2600_scu *scu)
> +{
> +	u32 reset_bit;
> +	u32 clkstop_bit;
> +
> +	reset_bit = BIT(ASPEED_RESET_HACE);
> +	clkstop_bit = BIT(13);
> +
> +	writel(reset_bit, &scu->sysreset_ctrl1);
> +	udelay(100);
> +	writel(clkstop_bit, &scu->clk_stop_clr_ctrl1);
> +	mdelay(20);
> +
> +	writel(reset_bit, &scu->sysreset_clr_ctrl1);
> +
> +	return 0;
> +}
> +
>   static int ast2600_clk_enable(struct clk *clk)
>   {
>   	struct ast2600_clk_priv *priv = dev_get_priv(clk->dev);
> @@ -1104,6 +1123,9 @@ static int ast2600_clk_enable(struct clk *clk)
>   		case ASPEED_CLK_GATE_USBPORT2CLK:
>   			ast2600_enable_usbbhclk(priv->scu);
>   			break;
> +		case ASPEED_CLK_GATE_YCLK:
> +			ast2600_enable_haceclk(priv->scu);
> +			break;
>   		default:
>   			pr_debug("can't enable clk \n");
>   			return -ENOENT;
>
diff mbox series

Patch

diff --git a/drivers/clk/aspeed/clk_ast2600.c b/drivers/clk/aspeed/clk_ast2600.c
index 4c00008a5dfd..ba9a0a0a9a5a 100644
--- a/drivers/clk/aspeed/clk_ast2600.c
+++ b/drivers/clk/aspeed/clk_ast2600.c
@@ -1066,6 +1066,25 @@  static ulong ast2600_enable_usbbhclk(struct ast2600_scu *scu)
 	return 0;
 }
 
+/* also known as yclk */
+static ulong ast2600_enable_haceclk(struct ast2600_scu *scu)
+{
+	u32 reset_bit;
+	u32 clkstop_bit;
+
+	reset_bit = BIT(ASPEED_RESET_HACE);
+	clkstop_bit = BIT(13);
+
+	writel(reset_bit, &scu->sysreset_ctrl1);
+	udelay(100);
+	writel(clkstop_bit, &scu->clk_stop_clr_ctrl1);
+	mdelay(20);
+
+	writel(reset_bit, &scu->sysreset_clr_ctrl1);
+
+	return 0;
+}
+
 static int ast2600_clk_enable(struct clk *clk)
 {
 	struct ast2600_clk_priv *priv = dev_get_priv(clk->dev);
@@ -1104,6 +1123,9 @@  static int ast2600_clk_enable(struct clk *clk)
 		case ASPEED_CLK_GATE_USBPORT2CLK:
 			ast2600_enable_usbbhclk(priv->scu);
 			break;
+		case ASPEED_CLK_GATE_YCLK:
+			ast2600_enable_haceclk(priv->scu);
+			break;
 		default:
 			pr_debug("can't enable clk \n");
 			return -ENOENT;