Skip to content

Commit 801b787

Browse files
amboarbebarino
authored andcommitted
clk: aspeed: Add RMII RCLK gates for both AST2500 MACs
RCLK is a fixed 50MHz clock derived from HPLL 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 3696eeb commit 801b787

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

drivers/clk/clk-aspeed.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "clk-aspeed.h"
1616

17-
#define ASPEED_NUM_CLKS 36
17+
#define ASPEED_NUM_CLKS 38
1818

1919
#define ASPEED_RESET2_OFFSET 32
2020

@@ -28,6 +28,7 @@
2828
#define AST2400_HPLL_BYPASS_EN BIT(17)
2929
#define ASPEED_MISC_CTRL 0x2c
3030
#define UART_DIV13_EN BIT(12)
31+
#define ASPEED_MAC_CLK_DLY 0x48
3132
#define ASPEED_STRAP 0x70
3233
#define CLKIN_25MHZ_EN BIT(23)
3334
#define AST2400_CLK_SOURCE_SEL BIT(18)
@@ -462,6 +463,30 @@ static int aspeed_clk_probe(struct platform_device *pdev)
462463
return PTR_ERR(hw);
463464
aspeed_clk_data->hws[ASPEED_CLK_MAC] = hw;
464465

466+
if (of_device_is_compatible(pdev->dev.of_node, "aspeed,ast2500-scu")) {
467+
/* RMII 50MHz RCLK */
468+
hw = clk_hw_register_fixed_rate(dev, "mac12rclk", "hpll", 0,
469+
50000000);
470+
if (IS_ERR(hw))
471+
return PTR_ERR(hw);
472+
473+
/* RMII1 50MHz (RCLK) output enable */
474+
hw = clk_hw_register_gate(dev, "mac1rclk", "mac12rclk", 0,
475+
scu_base + ASPEED_MAC_CLK_DLY, 29, 0,
476+
&aspeed_clk_lock);
477+
if (IS_ERR(hw))
478+
return PTR_ERR(hw);
479+
aspeed_clk_data->hws[ASPEED_CLK_MAC1RCLK] = hw;
480+
481+
/* RMII2 50MHz (RCLK) output enable */
482+
hw = clk_hw_register_gate(dev, "mac2rclk", "mac12rclk", 0,
483+
scu_base + ASPEED_MAC_CLK_DLY, 30, 0,
484+
&aspeed_clk_lock);
485+
if (IS_ERR(hw))
486+
return PTR_ERR(hw);
487+
aspeed_clk_data->hws[ASPEED_CLK_MAC2RCLK] = hw;
488+
}
489+
465490
/* LPC Host (LHCLK) clock divider */
466491
hw = clk_hw_register_divider_table(dev, "lhclk", "hpll", 0,
467492
scu_base + ASPEED_CLK_SELECTION, 20, 3, 0,

0 commit comments

Comments
 (0)