15eda5d79SJoel Stanley // SPDX-License-Identifier: GPL-2.0+ 25eda5d79SJoel Stanley 35eda5d79SJoel Stanley #define pr_fmt(fmt) "clk-aspeed: " fmt 45eda5d79SJoel Stanley 55eda5d79SJoel Stanley #include <linux/clk-provider.h> 65eda5d79SJoel Stanley #include <linux/mfd/syscon.h> 75eda5d79SJoel Stanley #include <linux/of_address.h> 85eda5d79SJoel Stanley #include <linux/regmap.h> 95eda5d79SJoel Stanley #include <linux/slab.h> 105eda5d79SJoel Stanley #include <linux/spinlock.h> 115eda5d79SJoel Stanley 125eda5d79SJoel Stanley #include <dt-bindings/clock/aspeed-clock.h> 135eda5d79SJoel Stanley 145eda5d79SJoel Stanley #define ASPEED_NUM_CLKS 35 155eda5d79SJoel Stanley 16*99d01e0eSJoel Stanley #define ASPEED_RESET_CTRL 0x04 17*99d01e0eSJoel Stanley #define ASPEED_CLK_SELECTION 0x08 18*99d01e0eSJoel Stanley #define ASPEED_CLK_STOP_CTRL 0x0c 19*99d01e0eSJoel Stanley #define ASPEED_MPLL_PARAM 0x20 20*99d01e0eSJoel Stanley #define ASPEED_HPLL_PARAM 0x24 21*99d01e0eSJoel Stanley #define AST2500_HPLL_BYPASS_EN BIT(20) 22*99d01e0eSJoel Stanley #define AST2400_HPLL_STRAPPED BIT(18) 23*99d01e0eSJoel Stanley #define AST2400_HPLL_BYPASS_EN BIT(17) 24*99d01e0eSJoel Stanley #define ASPEED_MISC_CTRL 0x2c 25*99d01e0eSJoel Stanley #define UART_DIV13_EN BIT(12) 265eda5d79SJoel Stanley #define ASPEED_STRAP 0x70 27*99d01e0eSJoel Stanley #define CLKIN_25MHZ_EN BIT(23) 28*99d01e0eSJoel Stanley #define AST2400_CLK_SOURCE_SEL BIT(18) 29*99d01e0eSJoel Stanley #define ASPEED_CLK_SELECTION_2 0xd8 30*99d01e0eSJoel Stanley 31*99d01e0eSJoel Stanley /* Globally visible clocks */ 32*99d01e0eSJoel Stanley static DEFINE_SPINLOCK(aspeed_clk_lock); 335eda5d79SJoel Stanley 345eda5d79SJoel Stanley /* Keeps track of all clocks */ 355eda5d79SJoel Stanley static struct clk_hw_onecell_data *aspeed_clk_data; 365eda5d79SJoel Stanley 375eda5d79SJoel Stanley static void __iomem *scu_base; 385eda5d79SJoel Stanley 395eda5d79SJoel Stanley /** 405eda5d79SJoel Stanley * struct aspeed_gate_data - Aspeed gated clocks 415eda5d79SJoel Stanley * @clock_idx: bit used to gate this clock in the clock register 425eda5d79SJoel Stanley * @reset_idx: bit used to reset this IP in the reset register. -1 if no 435eda5d79SJoel Stanley * reset is required when enabling the clock 445eda5d79SJoel Stanley * @name: the clock name 455eda5d79SJoel Stanley * @parent_name: the name of the parent clock 465eda5d79SJoel Stanley * @flags: standard clock framework flags 475eda5d79SJoel Stanley */ 485eda5d79SJoel Stanley struct aspeed_gate_data { 495eda5d79SJoel Stanley u8 clock_idx; 505eda5d79SJoel Stanley s8 reset_idx; 515eda5d79SJoel Stanley const char *name; 525eda5d79SJoel Stanley const char *parent_name; 535eda5d79SJoel Stanley unsigned long flags; 545eda5d79SJoel Stanley }; 555eda5d79SJoel Stanley 565eda5d79SJoel Stanley /** 575eda5d79SJoel Stanley * struct aspeed_clk_gate - Aspeed specific clk_gate structure 585eda5d79SJoel Stanley * @hw: handle between common and hardware-specific interfaces 595eda5d79SJoel Stanley * @reg: register controlling gate 605eda5d79SJoel Stanley * @clock_idx: bit used to gate this clock in the clock register 615eda5d79SJoel Stanley * @reset_idx: bit used to reset this IP in the reset register. -1 if no 625eda5d79SJoel Stanley * reset is required when enabling the clock 635eda5d79SJoel Stanley * @flags: hardware-specific flags 645eda5d79SJoel Stanley * @lock: register lock 655eda5d79SJoel Stanley * 665eda5d79SJoel Stanley * Some of the clocks in the Aspeed SoC must be put in reset before enabling. 675eda5d79SJoel Stanley * This modified version of clk_gate allows an optional reset bit to be 685eda5d79SJoel Stanley * specified. 695eda5d79SJoel Stanley */ 705eda5d79SJoel Stanley struct aspeed_clk_gate { 715eda5d79SJoel Stanley struct clk_hw hw; 725eda5d79SJoel Stanley struct regmap *map; 735eda5d79SJoel Stanley u8 clock_idx; 745eda5d79SJoel Stanley s8 reset_idx; 755eda5d79SJoel Stanley u8 flags; 765eda5d79SJoel Stanley spinlock_t *lock; 775eda5d79SJoel Stanley }; 785eda5d79SJoel Stanley 795eda5d79SJoel Stanley #define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw) 805eda5d79SJoel Stanley 815eda5d79SJoel Stanley /* TODO: ask Aspeed about the actual parent data */ 825eda5d79SJoel Stanley static const struct aspeed_gate_data aspeed_gates[] = { 835eda5d79SJoel Stanley /* clk rst name parent flags */ 845eda5d79SJoel Stanley [ASPEED_CLK_GATE_ECLK] = { 0, -1, "eclk-gate", "eclk", 0 }, /* Video Engine */ 855eda5d79SJoel Stanley [ASPEED_CLK_GATE_GCLK] = { 1, 7, "gclk-gate", NULL, 0 }, /* 2D engine */ 865eda5d79SJoel Stanley [ASPEED_CLK_GATE_MCLK] = { 2, -1, "mclk-gate", "mpll", CLK_IS_CRITICAL }, /* SDRAM */ 875eda5d79SJoel Stanley [ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video Capture */ 885eda5d79SJoel Stanley [ASPEED_CLK_GATE_BCLK] = { 4, 10, "bclk-gate", "bclk", 0 }, /* PCIe/PCI */ 895eda5d79SJoel Stanley [ASPEED_CLK_GATE_DCLK] = { 5, -1, "dclk-gate", NULL, 0 }, /* DAC */ 905eda5d79SJoel Stanley [ASPEED_CLK_GATE_REFCLK] = { 6, -1, "refclk-gate", "clkin", CLK_IS_CRITICAL }, 915eda5d79SJoel Stanley [ASPEED_CLK_GATE_USBPORT2CLK] = { 7, 3, "usb-port2-gate", NULL, 0 }, /* USB2.0 Host port 2 */ 925eda5d79SJoel Stanley [ASPEED_CLK_GATE_LCLK] = { 8, 5, "lclk-gate", NULL, 0 }, /* LPC */ 935eda5d79SJoel Stanley [ASPEED_CLK_GATE_USBUHCICLK] = { 9, 15, "usb-uhci-gate", NULL, 0 }, /* USB1.1 (requires port 2 enabled) */ 945eda5d79SJoel Stanley [ASPEED_CLK_GATE_D1CLK] = { 10, 13, "d1clk-gate", NULL, 0 }, /* GFX CRT */ 955eda5d79SJoel Stanley [ASPEED_CLK_GATE_YCLK] = { 13, 4, "yclk-gate", NULL, 0 }, /* HAC */ 965eda5d79SJoel Stanley [ASPEED_CLK_GATE_USBPORT1CLK] = { 14, 14, "usb-port1-gate", NULL, 0 }, /* USB2 hub/USB2 host port 1/USB1.1 dev */ 975eda5d79SJoel Stanley [ASPEED_CLK_GATE_UART1CLK] = { 15, -1, "uart1clk-gate", "uart", 0 }, /* UART1 */ 985eda5d79SJoel Stanley [ASPEED_CLK_GATE_UART2CLK] = { 16, -1, "uart2clk-gate", "uart", 0 }, /* UART2 */ 995eda5d79SJoel Stanley [ASPEED_CLK_GATE_UART5CLK] = { 17, -1, "uart5clk-gate", "uart", 0 }, /* UART5 */ 1005eda5d79SJoel Stanley [ASPEED_CLK_GATE_ESPICLK] = { 19, -1, "espiclk-gate", NULL, 0 }, /* eSPI */ 1015eda5d79SJoel Stanley [ASPEED_CLK_GATE_MAC1CLK] = { 20, 11, "mac1clk-gate", "mac", 0 }, /* MAC1 */ 1025eda5d79SJoel Stanley [ASPEED_CLK_GATE_MAC2CLK] = { 21, 12, "mac2clk-gate", "mac", 0 }, /* MAC2 */ 1035eda5d79SJoel Stanley [ASPEED_CLK_GATE_RSACLK] = { 24, -1, "rsaclk-gate", NULL, 0 }, /* RSA */ 1045eda5d79SJoel Stanley [ASPEED_CLK_GATE_UART3CLK] = { 25, -1, "uart3clk-gate", "uart", 0 }, /* UART3 */ 1055eda5d79SJoel Stanley [ASPEED_CLK_GATE_UART4CLK] = { 26, -1, "uart4clk-gate", "uart", 0 }, /* UART4 */ 1065eda5d79SJoel Stanley [ASPEED_CLK_GATE_SDCLKCLK] = { 27, 16, "sdclk-gate", NULL, 0 }, /* SDIO/SD */ 1075eda5d79SJoel Stanley [ASPEED_CLK_GATE_LHCCLK] = { 28, -1, "lhclk-gate", "lhclk", 0 }, /* LPC master/LPC+ */ 1085eda5d79SJoel Stanley }; 1095eda5d79SJoel Stanley 110*99d01e0eSJoel Stanley static const struct clk_div_table ast2400_div_table[] = { 111*99d01e0eSJoel Stanley { 0x0, 2 }, 112*99d01e0eSJoel Stanley { 0x1, 4 }, 113*99d01e0eSJoel Stanley { 0x2, 6 }, 114*99d01e0eSJoel Stanley { 0x3, 8 }, 115*99d01e0eSJoel Stanley { 0x4, 10 }, 116*99d01e0eSJoel Stanley { 0x5, 12 }, 117*99d01e0eSJoel Stanley { 0x6, 14 }, 118*99d01e0eSJoel Stanley { 0x7, 16 }, 119*99d01e0eSJoel Stanley { 0 } 120*99d01e0eSJoel Stanley }; 121*99d01e0eSJoel Stanley 122*99d01e0eSJoel Stanley static const struct clk_div_table ast2500_div_table[] = { 123*99d01e0eSJoel Stanley { 0x0, 4 }, 124*99d01e0eSJoel Stanley { 0x1, 8 }, 125*99d01e0eSJoel Stanley { 0x2, 12 }, 126*99d01e0eSJoel Stanley { 0x3, 16 }, 127*99d01e0eSJoel Stanley { 0x4, 20 }, 128*99d01e0eSJoel Stanley { 0x5, 24 }, 129*99d01e0eSJoel Stanley { 0x6, 28 }, 130*99d01e0eSJoel Stanley { 0x7, 32 }, 131*99d01e0eSJoel Stanley { 0 } 132*99d01e0eSJoel Stanley }; 133*99d01e0eSJoel Stanley 134*99d01e0eSJoel Stanley static struct clk_hw *aspeed_ast2400_calc_pll(const char *name, u32 val) 135*99d01e0eSJoel Stanley { 136*99d01e0eSJoel Stanley unsigned int mult, div; 137*99d01e0eSJoel Stanley 138*99d01e0eSJoel Stanley if (val & AST2400_HPLL_BYPASS_EN) { 139*99d01e0eSJoel Stanley /* Pass through mode */ 140*99d01e0eSJoel Stanley mult = div = 1; 141*99d01e0eSJoel Stanley } else { 142*99d01e0eSJoel Stanley /* F = 24Mhz * (2-OD) * [(N + 2) / (D + 1)] */ 143*99d01e0eSJoel Stanley u32 n = (val >> 5) & 0x3f; 144*99d01e0eSJoel Stanley u32 od = (val >> 4) & 0x1; 145*99d01e0eSJoel Stanley u32 d = val & 0xf; 146*99d01e0eSJoel Stanley 147*99d01e0eSJoel Stanley mult = (2 - od) * (n + 2); 148*99d01e0eSJoel Stanley div = d + 1; 149*99d01e0eSJoel Stanley } 150*99d01e0eSJoel Stanley return clk_hw_register_fixed_factor(NULL, name, "clkin", 0, 151*99d01e0eSJoel Stanley mult, div); 152*99d01e0eSJoel Stanley }; 153*99d01e0eSJoel Stanley 154*99d01e0eSJoel Stanley static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val) 155*99d01e0eSJoel Stanley { 156*99d01e0eSJoel Stanley unsigned int mult, div; 157*99d01e0eSJoel Stanley 158*99d01e0eSJoel Stanley if (val & AST2500_HPLL_BYPASS_EN) { 159*99d01e0eSJoel Stanley /* Pass through mode */ 160*99d01e0eSJoel Stanley mult = div = 1; 161*99d01e0eSJoel Stanley } else { 162*99d01e0eSJoel Stanley /* F = clkin * [(M+1) / (N+1)] / (P + 1) */ 163*99d01e0eSJoel Stanley u32 p = (val >> 13) & 0x3f; 164*99d01e0eSJoel Stanley u32 m = (val >> 5) & 0xff; 165*99d01e0eSJoel Stanley u32 n = val & 0x1f; 166*99d01e0eSJoel Stanley 167*99d01e0eSJoel Stanley mult = (m + 1) / (n + 1); 168*99d01e0eSJoel Stanley div = p + 1; 169*99d01e0eSJoel Stanley } 170*99d01e0eSJoel Stanley 171*99d01e0eSJoel Stanley return clk_hw_register_fixed_factor(NULL, name, "clkin", 0, 172*99d01e0eSJoel Stanley mult, div); 173*99d01e0eSJoel Stanley } 174*99d01e0eSJoel Stanley 175*99d01e0eSJoel Stanley static void __init aspeed_ast2400_cc(struct regmap *map) 176*99d01e0eSJoel Stanley { 177*99d01e0eSJoel Stanley struct clk_hw *hw; 178*99d01e0eSJoel Stanley u32 val, freq, div; 179*99d01e0eSJoel Stanley 180*99d01e0eSJoel Stanley /* 181*99d01e0eSJoel Stanley * CLKIN is the crystal oscillator, 24, 48 or 25MHz selected by 182*99d01e0eSJoel Stanley * strapping 183*99d01e0eSJoel Stanley */ 184*99d01e0eSJoel Stanley regmap_read(map, ASPEED_STRAP, &val); 185*99d01e0eSJoel Stanley if (val & CLKIN_25MHZ_EN) 186*99d01e0eSJoel Stanley freq = 25000000; 187*99d01e0eSJoel Stanley else if (val & AST2400_CLK_SOURCE_SEL) 188*99d01e0eSJoel Stanley freq = 48000000; 189*99d01e0eSJoel Stanley else 190*99d01e0eSJoel Stanley freq = 24000000; 191*99d01e0eSJoel Stanley hw = clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, freq); 192*99d01e0eSJoel Stanley pr_debug("clkin @%u MHz\n", freq / 1000000); 193*99d01e0eSJoel Stanley 194*99d01e0eSJoel Stanley /* 195*99d01e0eSJoel Stanley * High-speed PLL clock derived from the crystal. This the CPU clock, 196*99d01e0eSJoel Stanley * and we assume that it is enabled 197*99d01e0eSJoel Stanley */ 198*99d01e0eSJoel Stanley regmap_read(map, ASPEED_HPLL_PARAM, &val); 199*99d01e0eSJoel Stanley WARN(val & AST2400_HPLL_STRAPPED, "hpll is strapped not configured"); 200*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_HPLL] = aspeed_ast2400_calc_pll("hpll", val); 201*99d01e0eSJoel Stanley 202*99d01e0eSJoel Stanley /* 203*99d01e0eSJoel Stanley * Strap bits 11:10 define the CPU/AHB clock frequency ratio (aka HCLK) 204*99d01e0eSJoel Stanley * 00: Select CPU:AHB = 1:1 205*99d01e0eSJoel Stanley * 01: Select CPU:AHB = 2:1 206*99d01e0eSJoel Stanley * 10: Select CPU:AHB = 4:1 207*99d01e0eSJoel Stanley * 11: Select CPU:AHB = 3:1 208*99d01e0eSJoel Stanley */ 209*99d01e0eSJoel Stanley regmap_read(map, ASPEED_STRAP, &val); 210*99d01e0eSJoel Stanley val = (val >> 10) & 0x3; 211*99d01e0eSJoel Stanley div = val + 1; 212*99d01e0eSJoel Stanley if (div == 3) 213*99d01e0eSJoel Stanley div = 4; 214*99d01e0eSJoel Stanley else if (div == 4) 215*99d01e0eSJoel Stanley div = 3; 216*99d01e0eSJoel Stanley hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, div); 217*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_AHB] = hw; 218*99d01e0eSJoel Stanley 219*99d01e0eSJoel Stanley /* APB clock clock selection register SCU08 (aka PCLK) */ 220*99d01e0eSJoel Stanley hw = clk_hw_register_divider_table(NULL, "apb", "hpll", 0, 221*99d01e0eSJoel Stanley scu_base + ASPEED_CLK_SELECTION, 23, 3, 0, 222*99d01e0eSJoel Stanley ast2400_div_table, 223*99d01e0eSJoel Stanley &aspeed_clk_lock); 224*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_APB] = hw; 225*99d01e0eSJoel Stanley } 226*99d01e0eSJoel Stanley 227*99d01e0eSJoel Stanley static void __init aspeed_ast2500_cc(struct regmap *map) 228*99d01e0eSJoel Stanley { 229*99d01e0eSJoel Stanley struct clk_hw *hw; 230*99d01e0eSJoel Stanley u32 val, freq, div; 231*99d01e0eSJoel Stanley 232*99d01e0eSJoel Stanley /* CLKIN is the crystal oscillator, 24 or 25MHz selected by strapping */ 233*99d01e0eSJoel Stanley regmap_read(map, ASPEED_STRAP, &val); 234*99d01e0eSJoel Stanley if (val & CLKIN_25MHZ_EN) 235*99d01e0eSJoel Stanley freq = 25000000; 236*99d01e0eSJoel Stanley else 237*99d01e0eSJoel Stanley freq = 24000000; 238*99d01e0eSJoel Stanley hw = clk_hw_register_fixed_rate(NULL, "clkin", NULL, 0, freq); 239*99d01e0eSJoel Stanley pr_debug("clkin @%u MHz\n", freq / 1000000); 240*99d01e0eSJoel Stanley 241*99d01e0eSJoel Stanley /* 242*99d01e0eSJoel Stanley * High-speed PLL clock derived from the crystal. This the CPU clock, 243*99d01e0eSJoel Stanley * and we assume that it is enabled 244*99d01e0eSJoel Stanley */ 245*99d01e0eSJoel Stanley regmap_read(map, ASPEED_HPLL_PARAM, &val); 246*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_HPLL] = aspeed_ast2500_calc_pll("hpll", val); 247*99d01e0eSJoel Stanley 248*99d01e0eSJoel Stanley /* Strap bits 11:9 define the AXI/AHB clock frequency ratio (aka HCLK)*/ 249*99d01e0eSJoel Stanley regmap_read(map, ASPEED_STRAP, &val); 250*99d01e0eSJoel Stanley val = (val >> 9) & 0x7; 251*99d01e0eSJoel Stanley WARN(val == 0, "strapping is zero: cannot determine ahb clock"); 252*99d01e0eSJoel Stanley div = 2 * (val + 1); 253*99d01e0eSJoel Stanley hw = clk_hw_register_fixed_factor(NULL, "ahb", "hpll", 0, 1, div); 254*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_AHB] = hw; 255*99d01e0eSJoel Stanley 256*99d01e0eSJoel Stanley /* APB clock clock selection register SCU08 (aka PCLK) */ 257*99d01e0eSJoel Stanley regmap_read(map, ASPEED_CLK_SELECTION, &val); 258*99d01e0eSJoel Stanley val = (val >> 23) & 0x7; 259*99d01e0eSJoel Stanley div = 4 * (val + 1); 260*99d01e0eSJoel Stanley hw = clk_hw_register_fixed_factor(NULL, "apb", "hpll", 0, 1, div); 261*99d01e0eSJoel Stanley aspeed_clk_data->hws[ASPEED_CLK_APB] = hw; 262*99d01e0eSJoel Stanley }; 263*99d01e0eSJoel Stanley 2645eda5d79SJoel Stanley static void __init aspeed_cc_init(struct device_node *np) 2655eda5d79SJoel Stanley { 2665eda5d79SJoel Stanley struct regmap *map; 2675eda5d79SJoel Stanley u32 val; 2685eda5d79SJoel Stanley int ret; 2695eda5d79SJoel Stanley int i; 2705eda5d79SJoel Stanley 2715eda5d79SJoel Stanley scu_base = of_iomap(np, 0); 2725eda5d79SJoel Stanley if (IS_ERR(scu_base)) 2735eda5d79SJoel Stanley return; 2745eda5d79SJoel Stanley 2755eda5d79SJoel Stanley aspeed_clk_data = kzalloc(sizeof(*aspeed_clk_data) + 2765eda5d79SJoel Stanley sizeof(*aspeed_clk_data->hws) * ASPEED_NUM_CLKS, 2775eda5d79SJoel Stanley GFP_KERNEL); 2785eda5d79SJoel Stanley if (!aspeed_clk_data) 2795eda5d79SJoel Stanley return; 2805eda5d79SJoel Stanley 2815eda5d79SJoel Stanley /* 2825eda5d79SJoel Stanley * This way all clocks fetched before the platform device probes, 2835eda5d79SJoel Stanley * except those we assign here for early use, will be deferred. 2845eda5d79SJoel Stanley */ 2855eda5d79SJoel Stanley for (i = 0; i < ASPEED_NUM_CLKS; i++) 2865eda5d79SJoel Stanley aspeed_clk_data->hws[i] = ERR_PTR(-EPROBE_DEFER); 2875eda5d79SJoel Stanley 2885eda5d79SJoel Stanley map = syscon_node_to_regmap(np); 2895eda5d79SJoel Stanley if (IS_ERR(map)) { 2905eda5d79SJoel Stanley pr_err("no syscon regmap\n"); 2915eda5d79SJoel Stanley return; 2925eda5d79SJoel Stanley } 2935eda5d79SJoel Stanley /* 2945eda5d79SJoel Stanley * We check that the regmap works on this very first access, 2955eda5d79SJoel Stanley * but as this is an MMIO-backed regmap, subsequent regmap 2965eda5d79SJoel Stanley * access is not going to fail and we skip error checks from 2975eda5d79SJoel Stanley * this point. 2985eda5d79SJoel Stanley */ 2995eda5d79SJoel Stanley ret = regmap_read(map, ASPEED_STRAP, &val); 3005eda5d79SJoel Stanley if (ret) { 3015eda5d79SJoel Stanley pr_err("failed to read strapping register\n"); 3025eda5d79SJoel Stanley return; 3035eda5d79SJoel Stanley } 3045eda5d79SJoel Stanley 305*99d01e0eSJoel Stanley if (of_device_is_compatible(np, "aspeed,ast2400-scu")) 306*99d01e0eSJoel Stanley aspeed_ast2400_cc(map); 307*99d01e0eSJoel Stanley else if (of_device_is_compatible(np, "aspeed,ast2500-scu")) 308*99d01e0eSJoel Stanley aspeed_ast2500_cc(map); 309*99d01e0eSJoel Stanley else 310*99d01e0eSJoel Stanley pr_err("unknown platform, failed to add clocks\n"); 311*99d01e0eSJoel Stanley 3125eda5d79SJoel Stanley aspeed_clk_data->num = ASPEED_NUM_CLKS; 3135eda5d79SJoel Stanley ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, aspeed_clk_data); 3145eda5d79SJoel Stanley if (ret) 3155eda5d79SJoel Stanley pr_err("failed to add DT provider: %d\n", ret); 3165eda5d79SJoel Stanley }; 3175eda5d79SJoel Stanley CLK_OF_DECLARE_DRIVER(aspeed_cc_g5, "aspeed,ast2500-scu", aspeed_cc_init); 3185eda5d79SJoel Stanley CLK_OF_DECLARE_DRIVER(aspeed_cc_g4, "aspeed,ast2400-scu", aspeed_cc_init); 319