Skip to content

Commit 3696eeb

Browse files
amboarbebarino
authored andcommitted
clk: ast2600: Add RMII RCLK gates for all four MACs
RCLK is a fixed 50MHz clock derived from HPLL/HCLK that is described by a single gate for each MAC. Signed-off-by: Andrew Jeffery <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Reviewed-by: Joel Stanley <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 309d673 commit 3696eeb

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

drivers/clk/clk-ast2600.c

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "clk-aspeed.h"
1717

18-
#define ASPEED_G6_NUM_CLKS 67
18+
#define ASPEED_G6_NUM_CLKS 71
1919

2020
#define ASPEED_G6_SILICON_REV 0x004
2121

@@ -40,6 +40,9 @@
4040

4141
#define ASPEED_G6_STRAP1 0x500
4242

43+
#define ASPEED_MAC12_CLK_DLY 0x340
44+
#define ASPEED_MAC34_CLK_DLY 0x350
45+
4346
/* Globally visible clocks */
4447
static DEFINE_SPINLOCK(aspeed_g6_clk_lock);
4548

@@ -485,6 +488,11 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
485488
return PTR_ERR(hw);
486489
aspeed_g6_clk_data->hws[ASPEED_CLK_SDIO] = hw;
487490

491+
/* MAC1/2 RMII 50MHz RCLK */
492+
hw = clk_hw_register_fixed_rate(dev, "mac12rclk", "hpll", 0, 50000000);
493+
if (IS_ERR(hw))
494+
return PTR_ERR(hw);
495+
488496
/* MAC1/2 AHB bus clock divider */
489497
hw = clk_hw_register_divider_table(dev, "mac12", "hpll", 0,
490498
scu_g6_base + ASPEED_G6_CLK_SELECTION1, 16, 3, 0,
@@ -494,6 +502,27 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
494502
return PTR_ERR(hw);
495503
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC12] = hw;
496504

505+
/* RMII1 50MHz (RCLK) output enable */
506+
hw = clk_hw_register_gate(dev, "mac1rclk", "mac12rclk", 0,
507+
scu_g6_base + ASPEED_MAC12_CLK_DLY, 29, 0,
508+
&aspeed_g6_clk_lock);
509+
if (IS_ERR(hw))
510+
return PTR_ERR(hw);
511+
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC1RCLK] = hw;
512+
513+
/* RMII2 50MHz (RCLK) output enable */
514+
hw = clk_hw_register_gate(dev, "mac2rclk", "mac12rclk", 0,
515+
scu_g6_base + ASPEED_MAC12_CLK_DLY, 30, 0,
516+
&aspeed_g6_clk_lock);
517+
if (IS_ERR(hw))
518+
return PTR_ERR(hw);
519+
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC2RCLK] = hw;
520+
521+
/* MAC1/2 RMII 50MHz RCLK */
522+
hw = clk_hw_register_fixed_rate(dev, "mac34rclk", "hclk", 0, 50000000);
523+
if (IS_ERR(hw))
524+
return PTR_ERR(hw);
525+
497526
/* MAC3/4 AHB bus clock divider */
498527
hw = clk_hw_register_divider_table(dev, "mac34", "hpll", 0,
499528
scu_g6_base + 0x310, 24, 3, 0,
@@ -503,6 +532,22 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)
503532
return PTR_ERR(hw);
504533
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC34] = hw;
505534

535+
/* RMII3 50MHz (RCLK) output enable */
536+
hw = clk_hw_register_gate(dev, "mac3rclk", "mac34rclk", 0,
537+
scu_g6_base + ASPEED_MAC34_CLK_DLY, 29, 0,
538+
&aspeed_g6_clk_lock);
539+
if (IS_ERR(hw))
540+
return PTR_ERR(hw);
541+
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC3RCLK] = hw;
542+
543+
/* RMII4 50MHz (RCLK) output enable */
544+
hw = clk_hw_register_gate(dev, "mac4rclk", "mac34rclk", 0,
545+
scu_g6_base + ASPEED_MAC34_CLK_DLY, 30, 0,
546+
&aspeed_g6_clk_lock);
547+
if (IS_ERR(hw))
548+
return PTR_ERR(hw);
549+
aspeed_g6_clk_data->hws[ASPEED_CLK_MAC4RCLK] = hw;
550+
506551
/* LPC Host (LHCLK) clock divider */
507552
hw = clk_hw_register_divider_table(dev, "lhclk", "hpll", 0,
508553
scu_g6_base + ASPEED_G6_CLK_SELECTION1, 20, 3, 0,

0 commit comments

Comments
 (0)