]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
aspeed: Add P-Bus clock in ast2500 clock driver
authormaxims@google.com <maxims@google.com>
Mon, 17 Apr 2017 19:00:29 +0000 (12:00 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 8 May 2017 15:57:34 +0000 (11:57 -0400)
Add P-Bus Clock support to ast2500 clock driver.
This is the clock used by I2C devices.

Signed-off-by: Maxim Sloyko <maxims@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/include/asm/arch-aspeed/scu_ast2500.h
drivers/clk/aspeed/clk_ast2500.c

index 1cdd3b919824e908b6d60f435ac34192cfda235a..319d75e05cee6e471df1a56e512029fa011f3313 100644 (file)
@@ -21,7 +21,8 @@
 #define SCU_MPLL_NUM_MASK              0xff
 #define SCU_MPLL_POST_SHIFT            13
 #define SCU_MPLL_POST_MASK             0x3f
-
+#define SCU_PCLK_DIV_SHIFT             23
+#define SCU_PCLK_DIV_MASK              7
 #define SCU_HPLL_DENUM_SHIFT           0
 #define SCU_HPLL_DENUM_MASK            0x1f
 #define SCU_HPLL_NUM_SHIFT             5
index 504731271c386b7cf3f5bff8c24dcb0c92d769c3..9e4c66ea85f4039caf2615004e836ecfa01f8b72 100644 (file)
@@ -110,6 +110,17 @@ static ulong ast2500_clk_get_rate(struct clk *clk)
                rate = ast2500_get_mpll_rate(clkin,
                                             readl(&priv->scu->m_pll_param));
                break;
+       case BCLK_PCLK:
+               {
+                       ulong apb_div = 4 + 4 * ((readl(&priv->scu->clk_sel1)
+                                                 >> SCU_PCLK_DIV_SHIFT) &
+                                                SCU_PCLK_DIV_MASK);
+                       rate = ast2500_get_hpll_rate(clkin,
+                                                    readl(&priv->scu->
+                                                          h_pll_param));
+                       rate = rate / apb_div;
+               }
+               break;
        case PCLK_UART1:
                rate = ast2500_get_uart_clk_rate(priv->scu, 1);
                break;