18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2016 Maxime Ripard. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 78c2ecf20Sopenharmony_ci#include <linux/io.h> 88c2ecf20Sopenharmony_ci#include <linux/of_address.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include "ccu_common.h" 118c2ecf20Sopenharmony_ci#include "ccu_reset.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include "ccu_div.h" 148c2ecf20Sopenharmony_ci#include "ccu_gate.h" 158c2ecf20Sopenharmony_ci#include "ccu_mp.h" 168c2ecf20Sopenharmony_ci#include "ccu_mult.h" 178c2ecf20Sopenharmony_ci#include "ccu_nk.h" 188c2ecf20Sopenharmony_ci#include "ccu_nkm.h" 198c2ecf20Sopenharmony_ci#include "ccu_nkmp.h" 208c2ecf20Sopenharmony_ci#include "ccu_nm.h" 218c2ecf20Sopenharmony_ci#include "ccu_phase.h" 228c2ecf20Sopenharmony_ci#include "ccu_sdm.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include "ccu-sun5i.h" 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_core_clk = { 278c2ecf20Sopenharmony_ci .enable = BIT(31), 288c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET(8, 5, 0), 298c2ecf20Sopenharmony_ci .k = _SUNXI_CCU_MULT(4, 2), 308c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 2), 318c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 328c2ecf20Sopenharmony_ci .common = { 338c2ecf20Sopenharmony_ci .reg = 0x000, 348c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-core", 358c2ecf20Sopenharmony_ci "hosc", 368c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 378c2ecf20Sopenharmony_ci 0), 388c2ecf20Sopenharmony_ci }, 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* 428c2ecf20Sopenharmony_ci * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from 438c2ecf20Sopenharmony_ci * the base (2x, 4x and 8x), and one variable divider (the one true 448c2ecf20Sopenharmony_ci * pll audio). 458c2ecf20Sopenharmony_ci * 468c2ecf20Sopenharmony_ci * With sigma-delta modulation for fractional-N on the audio PLL, 478c2ecf20Sopenharmony_ci * we have to use specific dividers. This means the variable divider 488c2ecf20Sopenharmony_ci * can no longer be used, as the audio codec requests the exact clock 498c2ecf20Sopenharmony_ci * rates we support through this mechanism. So we now hard code the 508c2ecf20Sopenharmony_ci * variable divider to 1. This means the clock rates will no longer 518c2ecf20Sopenharmony_ci * match the clock names. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define SUN5I_PLL_AUDIO_REG 0x008 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistatic struct ccu_sdm_setting pll_audio_sdm_table[] = { 568c2ecf20Sopenharmony_ci { .rate = 22579200, .pattern = 0xc0010d84, .m = 8, .n = 7 }, 578c2ecf20Sopenharmony_ci { .rate = 24576000, .pattern = 0xc000ac02, .m = 14, .n = 14 }, 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistatic struct ccu_nm pll_audio_base_clk = { 618c2ecf20Sopenharmony_ci .enable = BIT(31), 628c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET(8, 7, 0), 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci /* 658c2ecf20Sopenharmony_ci * The datasheet is wrong here, this doesn't have any 668c2ecf20Sopenharmony_ci * offset 678c2ecf20Sopenharmony_ci */ 688c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV_OFFSET(0, 5, 0), 698c2ecf20Sopenharmony_ci .sdm = _SUNXI_CCU_SDM(pll_audio_sdm_table, 0, 708c2ecf20Sopenharmony_ci 0x00c, BIT(31)), 718c2ecf20Sopenharmony_ci .common = { 728c2ecf20Sopenharmony_ci .reg = 0x008, 738c2ecf20Sopenharmony_ci .features = CCU_FEATURE_SIGMA_DELTA_MOD, 748c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-audio-base", 758c2ecf20Sopenharmony_ci "hosc", 768c2ecf20Sopenharmony_ci &ccu_nm_ops, 778c2ecf20Sopenharmony_ci 0), 788c2ecf20Sopenharmony_ci }, 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic struct ccu_mult pll_video0_clk = { 828c2ecf20Sopenharmony_ci .enable = BIT(31), 838c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(0, 7, 0, 9, 127), 848c2ecf20Sopenharmony_ci .frac = _SUNXI_CCU_FRAC(BIT(15), BIT(14), 858c2ecf20Sopenharmony_ci 270000000, 297000000), 868c2ecf20Sopenharmony_ci .common = { 878c2ecf20Sopenharmony_ci .reg = 0x010, 888c2ecf20Sopenharmony_ci .features = (CCU_FEATURE_FRACTIONAL | 898c2ecf20Sopenharmony_ci CCU_FEATURE_ALL_PREDIV), 908c2ecf20Sopenharmony_ci .prediv = 8, 918c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video0", 928c2ecf20Sopenharmony_ci "hosc", 938c2ecf20Sopenharmony_ci &ccu_mult_ops, 948c2ecf20Sopenharmony_ci 0), 958c2ecf20Sopenharmony_ci }, 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_cistatic struct ccu_nkmp pll_ve_clk = { 998c2ecf20Sopenharmony_ci .enable = BIT(31), 1008c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET(8, 5, 0), 1018c2ecf20Sopenharmony_ci .k = _SUNXI_CCU_MULT(4, 2), 1028c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(0, 2), 1038c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(16, 2), 1048c2ecf20Sopenharmony_ci .common = { 1058c2ecf20Sopenharmony_ci .reg = 0x018, 1068c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ve", 1078c2ecf20Sopenharmony_ci "hosc", 1088c2ecf20Sopenharmony_ci &ccu_nkmp_ops, 1098c2ecf20Sopenharmony_ci 0), 1108c2ecf20Sopenharmony_ci }, 1118c2ecf20Sopenharmony_ci}; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_cistatic struct ccu_nk pll_ddr_base_clk = { 1148c2ecf20Sopenharmony_ci .enable = BIT(31), 1158c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET(8, 5, 0), 1168c2ecf20Sopenharmony_ci .k = _SUNXI_CCU_MULT(4, 2), 1178c2ecf20Sopenharmony_ci .common = { 1188c2ecf20Sopenharmony_ci .reg = 0x020, 1198c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr-base", 1208c2ecf20Sopenharmony_ci "hosc", 1218c2ecf20Sopenharmony_ci &ccu_nk_ops, 1228c2ecf20Sopenharmony_ci 0), 1238c2ecf20Sopenharmony_ci }, 1248c2ecf20Sopenharmony_ci}; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(pll_ddr_clk, "pll-ddr", "pll-ddr-base", 0x020, 0, 2, 1278c2ecf20Sopenharmony_ci CLK_IS_CRITICAL); 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistatic struct ccu_div pll_ddr_other_clk = { 1308c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(16, 2, CLK_DIVIDER_POWER_OF_TWO), 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci .common = { 1338c2ecf20Sopenharmony_ci .reg = 0x020, 1348c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-ddr-other", "pll-ddr-base", 1358c2ecf20Sopenharmony_ci &ccu_div_ops, 1368c2ecf20Sopenharmony_ci 0), 1378c2ecf20Sopenharmony_ci }, 1388c2ecf20Sopenharmony_ci}; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistatic struct ccu_nk pll_periph_clk = { 1418c2ecf20Sopenharmony_ci .enable = BIT(31), 1428c2ecf20Sopenharmony_ci .n = _SUNXI_CCU_MULT_OFFSET(8, 5, 0), 1438c2ecf20Sopenharmony_ci .k = _SUNXI_CCU_MULT(4, 2), 1448c2ecf20Sopenharmony_ci .fixed_post_div = 2, 1458c2ecf20Sopenharmony_ci .common = { 1468c2ecf20Sopenharmony_ci .reg = 0x028, 1478c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_POSTDIV, 1488c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-periph", 1498c2ecf20Sopenharmony_ci "hosc", 1508c2ecf20Sopenharmony_ci &ccu_nk_ops, 1518c2ecf20Sopenharmony_ci 0), 1528c2ecf20Sopenharmony_ci }, 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_cistatic struct ccu_mult pll_video1_clk = { 1568c2ecf20Sopenharmony_ci .enable = BIT(31), 1578c2ecf20Sopenharmony_ci .mult = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(0, 7, 0, 9, 127), 1588c2ecf20Sopenharmony_ci .frac = _SUNXI_CCU_FRAC(BIT(15), BIT(14), 1598c2ecf20Sopenharmony_ci 270000000, 297000000), 1608c2ecf20Sopenharmony_ci .common = { 1618c2ecf20Sopenharmony_ci .reg = 0x030, 1628c2ecf20Sopenharmony_ci .features = (CCU_FEATURE_FRACTIONAL | 1638c2ecf20Sopenharmony_ci CCU_FEATURE_ALL_PREDIV), 1648c2ecf20Sopenharmony_ci .prediv = 8, 1658c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT("pll-video1", 1668c2ecf20Sopenharmony_ci "hosc", 1678c2ecf20Sopenharmony_ci &ccu_mult_ops, 1688c2ecf20Sopenharmony_ci 0), 1698c2ecf20Sopenharmony_ci }, 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(hosc_clk, "hosc", "osc24M", 0x050, BIT(0), 0); 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#define SUN5I_AHB_REG 0x054 1758c2ecf20Sopenharmony_cistatic const char * const cpu_parents[] = { "osc32k", "hosc", 1768c2ecf20Sopenharmony_ci "pll-core" , "pll-periph" }; 1778c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv cpu_predivs[] = { 1788c2ecf20Sopenharmony_ci { .index = 3, .div = 3, }, 1798c2ecf20Sopenharmony_ci}; 1808c2ecf20Sopenharmony_cistatic struct ccu_mux cpu_clk = { 1818c2ecf20Sopenharmony_ci .mux = { 1828c2ecf20Sopenharmony_ci .shift = 16, 1838c2ecf20Sopenharmony_ci .width = 2, 1848c2ecf20Sopenharmony_ci .fixed_predivs = cpu_predivs, 1858c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(cpu_predivs), 1868c2ecf20Sopenharmony_ci }, 1878c2ecf20Sopenharmony_ci .common = { 1888c2ecf20Sopenharmony_ci .reg = 0x054, 1898c2ecf20Sopenharmony_ci .features = CCU_FEATURE_FIXED_PREDIV, 1908c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("cpu", 1918c2ecf20Sopenharmony_ci cpu_parents, 1928c2ecf20Sopenharmony_ci &ccu_mux_ops, 1938c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT | CLK_IS_CRITICAL), 1948c2ecf20Sopenharmony_ci } 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cistatic SUNXI_CCU_M(axi_clk, "axi", "cpu", 0x054, 0, 2, 0); 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_cistatic const char * const ahb_parents[] = { "axi" , "cpu", "pll-periph" }; 2008c2ecf20Sopenharmony_cistatic const struct ccu_mux_fixed_prediv ahb_predivs[] = { 2018c2ecf20Sopenharmony_ci { .index = 2, .div = 2, }, 2028c2ecf20Sopenharmony_ci}; 2038c2ecf20Sopenharmony_cistatic struct ccu_div ahb_clk = { 2048c2ecf20Sopenharmony_ci .div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO), 2058c2ecf20Sopenharmony_ci .mux = { 2068c2ecf20Sopenharmony_ci .shift = 6, 2078c2ecf20Sopenharmony_ci .width = 2, 2088c2ecf20Sopenharmony_ci .fixed_predivs = ahb_predivs, 2098c2ecf20Sopenharmony_ci .n_predivs = ARRAY_SIZE(ahb_predivs), 2108c2ecf20Sopenharmony_ci }, 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci .common = { 2138c2ecf20Sopenharmony_ci .reg = 0x054, 2148c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("ahb", 2158c2ecf20Sopenharmony_ci ahb_parents, 2168c2ecf20Sopenharmony_ci &ccu_div_ops, 2178c2ecf20Sopenharmony_ci 0), 2188c2ecf20Sopenharmony_ci }, 2198c2ecf20Sopenharmony_ci}; 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_cistatic struct clk_div_table apb0_div_table[] = { 2228c2ecf20Sopenharmony_ci { .val = 0, .div = 2 }, 2238c2ecf20Sopenharmony_ci { .val = 1, .div = 2 }, 2248c2ecf20Sopenharmony_ci { .val = 2, .div = 4 }, 2258c2ecf20Sopenharmony_ci { .val = 3, .div = 8 }, 2268c2ecf20Sopenharmony_ci { /* Sentinel */ }, 2278c2ecf20Sopenharmony_ci}; 2288c2ecf20Sopenharmony_cistatic SUNXI_CCU_DIV_TABLE(apb0_clk, "apb0", "ahb", 2298c2ecf20Sopenharmony_ci 0x054, 8, 2, apb0_div_table, 0); 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_cistatic const char * const apb1_parents[] = { "hosc", "pll-periph", "osc32k" }; 2328c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX(apb1_clk, "apb1", apb1_parents, 0x058, 2338c2ecf20Sopenharmony_ci 0, 5, /* M */ 2348c2ecf20Sopenharmony_ci 16, 2, /* P */ 2358c2ecf20Sopenharmony_ci 24, 2, /* mux */ 2368c2ecf20Sopenharmony_ci 0); 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(axi_dram_clk, "axi-dram", "axi", 2398c2ecf20Sopenharmony_ci 0x05c, BIT(0), 0); 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_otg_clk, "ahb-otg", "ahb", 2428c2ecf20Sopenharmony_ci 0x060, BIT(0), 0); 2438c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ehci_clk, "ahb-ehci", "ahb", 2448c2ecf20Sopenharmony_ci 0x060, BIT(1), 0); 2458c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ohci_clk, "ahb-ohci", "ahb", 2468c2ecf20Sopenharmony_ci 0x060, BIT(2), 0); 2478c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ss_clk, "ahb-ss", "ahb", 2488c2ecf20Sopenharmony_ci 0x060, BIT(5), 0); 2498c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_dma_clk, "ahb-dma", "ahb", 2508c2ecf20Sopenharmony_ci 0x060, BIT(6), 0); 2518c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_bist_clk, "ahb-bist", "ahb", 2528c2ecf20Sopenharmony_ci 0x060, BIT(7), 0); 2538c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc0_clk, "ahb-mmc0", "ahb", 2548c2ecf20Sopenharmony_ci 0x060, BIT(8), 0); 2558c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc1_clk, "ahb-mmc1", "ahb", 2568c2ecf20Sopenharmony_ci 0x060, BIT(9), 0); 2578c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_mmc2_clk, "ahb-mmc2", "ahb", 2588c2ecf20Sopenharmony_ci 0x060, BIT(10), 0); 2598c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_nand_clk, "ahb-nand", "ahb", 2608c2ecf20Sopenharmony_ci 0x060, BIT(13), 0); 2618c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_sdram_clk, "ahb-sdram", "ahb", 2628c2ecf20Sopenharmony_ci 0x060, BIT(14), CLK_IS_CRITICAL); 2638c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_emac_clk, "ahb-emac", "ahb", 2648c2ecf20Sopenharmony_ci 0x060, BIT(17), 0); 2658c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ts_clk, "ahb-ts", "ahb", 2668c2ecf20Sopenharmony_ci 0x060, BIT(18), 0); 2678c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi0_clk, "ahb-spi0", "ahb", 2688c2ecf20Sopenharmony_ci 0x060, BIT(20), 0); 2698c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi1_clk, "ahb-spi1", "ahb", 2708c2ecf20Sopenharmony_ci 0x060, BIT(21), 0); 2718c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_spi2_clk, "ahb-spi2", "ahb", 2728c2ecf20Sopenharmony_ci 0x060, BIT(22), 0); 2738c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_gps_clk, "ahb-gps", "ahb", 2748c2ecf20Sopenharmony_ci 0x060, BIT(26), 0); 2758c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_hstimer_clk, "ahb-hstimer", "ahb", 2768c2ecf20Sopenharmony_ci 0x060, BIT(28), 0); 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_ve_clk, "ahb-ve", "ahb", 2798c2ecf20Sopenharmony_ci 0x064, BIT(0), 0); 2808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_tve_clk, "ahb-tve", "ahb", 2818c2ecf20Sopenharmony_ci 0x064, BIT(2), 0); 2828c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_lcd_clk, "ahb-lcd", "ahb", 2838c2ecf20Sopenharmony_ci 0x064, BIT(4), 0); 2848c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_csi_clk, "ahb-csi", "ahb", 2858c2ecf20Sopenharmony_ci 0x064, BIT(8), 0); 2868c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_hdmi_clk, "ahb-hdmi", "ahb", 2878c2ecf20Sopenharmony_ci 0x064, BIT(11), 0); 2888c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_be_clk, "ahb-de-be", "ahb", 2898c2ecf20Sopenharmony_ci 0x064, BIT(12), 0); 2908c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_de_fe_clk, "ahb-de-fe", "ahb", 2918c2ecf20Sopenharmony_ci 0x064, BIT(14), 0); 2928c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_iep_clk, "ahb-iep", "ahb", 2938c2ecf20Sopenharmony_ci 0x064, BIT(19), 0); 2948c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ahb_gpu_clk, "ahb-gpu", "ahb", 2958c2ecf20Sopenharmony_ci 0x064, BIT(20), 0); 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_codec_clk, "apb0-codec", "apb0", 2988c2ecf20Sopenharmony_ci 0x068, BIT(0), 0); 2998c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_spdif_clk, "apb0-spdif", "apb0", 3008c2ecf20Sopenharmony_ci 0x068, BIT(1), 0); 3018c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_i2s_clk, "apb0-i2s", "apb0", 3028c2ecf20Sopenharmony_ci 0x068, BIT(3), 0); 3038c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_pio_clk, "apb0-pio", "apb0", 3048c2ecf20Sopenharmony_ci 0x068, BIT(5), 0); 3058c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_ir_clk, "apb0-ir", "apb0", 3068c2ecf20Sopenharmony_ci 0x068, BIT(6), 0); 3078c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb0_keypad_clk, "apb0-keypad", "apb0", 3088c2ecf20Sopenharmony_ci 0x068, BIT(10), 0); 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c0_clk, "apb1-i2c0", "apb1", 3118c2ecf20Sopenharmony_ci 0x06c, BIT(0), 0); 3128c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c1_clk, "apb1-i2c1", "apb1", 3138c2ecf20Sopenharmony_ci 0x06c, BIT(1), 0); 3148c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_i2c2_clk, "apb1-i2c2", "apb1", 3158c2ecf20Sopenharmony_ci 0x06c, BIT(2), 0); 3168c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart0_clk, "apb1-uart0", "apb1", 3178c2ecf20Sopenharmony_ci 0x06c, BIT(16), 0); 3188c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart1_clk, "apb1-uart1", "apb1", 3198c2ecf20Sopenharmony_ci 0x06c, BIT(17), 0); 3208c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart2_clk, "apb1-uart2", "apb1", 3218c2ecf20Sopenharmony_ci 0x06c, BIT(18), 0); 3228c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(apb1_uart3_clk, "apb1-uart3", "apb1", 3238c2ecf20Sopenharmony_ci 0x06c, BIT(19), 0); 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_cistatic const char * const mod0_default_parents[] = { "hosc", "pll-periph", 3268c2ecf20Sopenharmony_ci "pll-ddr-other" }; 3278c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(nand_clk, "nand", mod0_default_parents, 0x080, 3288c2ecf20Sopenharmony_ci 0, 4, /* M */ 3298c2ecf20Sopenharmony_ci 16, 2, /* P */ 3308c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3318c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3328c2ecf20Sopenharmony_ci 0); 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088, 3358c2ecf20Sopenharmony_ci 0, 4, /* M */ 3368c2ecf20Sopenharmony_ci 16, 2, /* P */ 3378c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3388c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3398c2ecf20Sopenharmony_ci 0); 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c, 3428c2ecf20Sopenharmony_ci 0, 4, /* M */ 3438c2ecf20Sopenharmony_ci 16, 2, /* P */ 3448c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3458c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3468c2ecf20Sopenharmony_ci 0); 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090, 3498c2ecf20Sopenharmony_ci 0, 4, /* M */ 3508c2ecf20Sopenharmony_ci 16, 2, /* P */ 3518c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3528c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3538c2ecf20Sopenharmony_ci 0); 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ts_clk, "ts", mod0_default_parents, 0x098, 3568c2ecf20Sopenharmony_ci 0, 4, /* M */ 3578c2ecf20Sopenharmony_ci 16, 2, /* P */ 3588c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3598c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3608c2ecf20Sopenharmony_ci 0); 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ss_clk, "ss", mod0_default_parents, 0x09c, 3638c2ecf20Sopenharmony_ci 0, 4, /* M */ 3648c2ecf20Sopenharmony_ci 16, 2, /* P */ 3658c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3668c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3678c2ecf20Sopenharmony_ci 0); 3688c2ecf20Sopenharmony_ci 3698c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0, 3708c2ecf20Sopenharmony_ci 0, 4, /* M */ 3718c2ecf20Sopenharmony_ci 16, 2, /* P */ 3728c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3738c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3748c2ecf20Sopenharmony_ci 0); 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4, 3778c2ecf20Sopenharmony_ci 0, 4, /* M */ 3788c2ecf20Sopenharmony_ci 16, 2, /* P */ 3798c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3808c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3818c2ecf20Sopenharmony_ci 0); 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(spi2_clk, "spi2", mod0_default_parents, 0x0a8, 3848c2ecf20Sopenharmony_ci 0, 4, /* M */ 3858c2ecf20Sopenharmony_ci 16, 2, /* P */ 3868c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3878c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3888c2ecf20Sopenharmony_ci 0); 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(ir_clk, "ir", mod0_default_parents, 0x0b0, 3918c2ecf20Sopenharmony_ci 0, 4, /* M */ 3928c2ecf20Sopenharmony_ci 16, 2, /* P */ 3938c2ecf20Sopenharmony_ci 24, 2, /* mux */ 3948c2ecf20Sopenharmony_ci BIT(31), /* gate */ 3958c2ecf20Sopenharmony_ci 0); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_cistatic const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x", 3988c2ecf20Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 3998c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(i2s_clk, "i2s", i2s_parents, 4008c2ecf20Sopenharmony_ci 0x0b8, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_cistatic const char * const spdif_parents[] = { "pll-audio-8x", "pll-audio-4x", 4038c2ecf20Sopenharmony_ci "pll-audio-2x", "pll-audio" }; 4048c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(spdif_clk, "spdif", spdif_parents, 4058c2ecf20Sopenharmony_ci 0x0c0, 16, 2, BIT(31), CLK_SET_RATE_PARENT); 4068c2ecf20Sopenharmony_ci 4078c2ecf20Sopenharmony_cistatic const char * const keypad_parents[] = { "hosc", "losc"}; 4088c2ecf20Sopenharmony_cistatic const u8 keypad_table[] = { 0, 2 }; 4098c2ecf20Sopenharmony_cistatic struct ccu_mp keypad_clk = { 4108c2ecf20Sopenharmony_ci .enable = BIT(31), 4118c2ecf20Sopenharmony_ci .m = _SUNXI_CCU_DIV(8, 5), 4128c2ecf20Sopenharmony_ci .p = _SUNXI_CCU_DIV(20, 2), 4138c2ecf20Sopenharmony_ci .mux = _SUNXI_CCU_MUX_TABLE(24, 2, keypad_table), 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci .common = { 4168c2ecf20Sopenharmony_ci .reg = 0x0c4, 4178c2ecf20Sopenharmony_ci .hw.init = CLK_HW_INIT_PARENTS("keypad", 4188c2ecf20Sopenharmony_ci keypad_parents, 4198c2ecf20Sopenharmony_ci &ccu_mp_ops, 4208c2ecf20Sopenharmony_ci 0), 4218c2ecf20Sopenharmony_ci }, 4228c2ecf20Sopenharmony_ci}; 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_ohci_clk, "usb-ohci", "pll-periph", 4258c2ecf20Sopenharmony_ci 0x0cc, BIT(6), 0); 4268c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "pll-periph", 4278c2ecf20Sopenharmony_ci 0x0cc, BIT(8), 0); 4288c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(usb_phy1_clk, "usb-phy1", "pll-periph", 4298c2ecf20Sopenharmony_ci 0x0cc, BIT(9), 0); 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_cistatic const char * const gps_parents[] = { "hosc", "pll-periph", 4328c2ecf20Sopenharmony_ci "pll-video1", "pll-ve" }; 4338c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gps_clk, "gps", gps_parents, 4348c2ecf20Sopenharmony_ci 0x0d0, 0, 3, 24, 2, BIT(31), 0); 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "pll-ddr", 4378c2ecf20Sopenharmony_ci 0x100, BIT(0), 0); 4388c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_csi_clk, "dram-csi", "pll-ddr", 4398c2ecf20Sopenharmony_ci 0x100, BIT(1), 0); 4408c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ts_clk, "dram-ts", "pll-ddr", 4418c2ecf20Sopenharmony_ci 0x100, BIT(3), 0); 4428c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_tve_clk, "dram-tve", "pll-ddr", 4438c2ecf20Sopenharmony_ci 0x100, BIT(5), 0); 4448c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_fe_clk, "dram-de-fe", "pll-ddr", 4458c2ecf20Sopenharmony_ci 0x100, BIT(25), 0); 4468c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_de_be_clk, "dram-de-be", "pll-ddr", 4478c2ecf20Sopenharmony_ci 0x100, BIT(26), 0); 4488c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_ace_clk, "dram-ace", "pll-ddr", 4498c2ecf20Sopenharmony_ci 0x100, BIT(29), 0); 4508c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(dram_iep_clk, "dram-iep", "pll-ddr", 4518c2ecf20Sopenharmony_ci 0x100, BIT(31), 0); 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_cistatic const char * const de_parents[] = { "pll-video0", "pll-video1", 4548c2ecf20Sopenharmony_ci "pll-ddr-other" }; 4558c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_be_clk, "de-be", de_parents, 4568c2ecf20Sopenharmony_ci 0x104, 0, 4, 24, 2, BIT(31), 0); 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(de_fe_clk, "de-fe", de_parents, 4598c2ecf20Sopenharmony_ci 0x10c, 0, 4, 24, 2, BIT(31), 0); 4608c2ecf20Sopenharmony_ci 4618c2ecf20Sopenharmony_cistatic const char * const tcon_parents[] = { "pll-video0", "pll-video1", 4628c2ecf20Sopenharmony_ci "pll-video0-2x", "pll-video1-2x" }; 4638c2ecf20Sopenharmony_cistatic SUNXI_CCU_MUX_WITH_GATE(tcon_ch0_clk, "tcon-ch0-sclk", tcon_parents, 4648c2ecf20Sopenharmony_ci 0x118, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(tcon_ch1_sclk2_clk, "tcon-ch1-sclk2", 4678c2ecf20Sopenharmony_ci tcon_parents, 4688c2ecf20Sopenharmony_ci 0x12c, 0, 4, 24, 2, BIT(31), CLK_SET_RATE_PARENT); 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_GATE(tcon_ch1_sclk1_clk, "tcon-ch1-sclk1", "tcon-ch1-sclk2", 4718c2ecf20Sopenharmony_ci 0x12c, 11, 1, BIT(15), CLK_SET_RATE_PARENT); 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_cistatic const char * const csi_parents[] = { "hosc", "pll-video0", "pll-video1", 4748c2ecf20Sopenharmony_ci "pll-video0-2x", "pll-video1-2x" }; 4758c2ecf20Sopenharmony_cistatic const u8 csi_table[] = { 0, 1, 2, 5, 6 }; 4768c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(csi_clk, "csi", 4778c2ecf20Sopenharmony_ci csi_parents, csi_table, 4788c2ecf20Sopenharmony_ci 0x134, 0, 5, 24, 3, BIT(31), 0); 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(ve_clk, "ve", "pll-ve", 4818c2ecf20Sopenharmony_ci 0x13c, BIT(31), CLK_SET_RATE_PARENT); 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(codec_clk, "codec", "pll-audio", 4848c2ecf20Sopenharmony_ci 0x140, BIT(31), CLK_SET_RATE_PARENT); 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(avs_clk, "avs", "hosc", 4878c2ecf20Sopenharmony_ci 0x144, BIT(31), 0); 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_cistatic const char * const hdmi_parents[] = { "pll-video0", "pll-video0-2x" }; 4908c2ecf20Sopenharmony_cistatic const u8 hdmi_table[] = { 0, 2 }; 4918c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_TABLE_GATE(hdmi_clk, "hdmi", 4928c2ecf20Sopenharmony_ci hdmi_parents, hdmi_table, 4938c2ecf20Sopenharmony_ci 0x150, 0, 4, 24, 2, BIT(31), 4948c2ecf20Sopenharmony_ci CLK_SET_RATE_PARENT); 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_cistatic const char * const gpu_parents[] = { "pll-video0", "pll-ve", 4978c2ecf20Sopenharmony_ci "pll-ddr-other", "pll-video1", 4988c2ecf20Sopenharmony_ci "pll-video1-2x" }; 4998c2ecf20Sopenharmony_cistatic SUNXI_CCU_M_WITH_MUX_GATE(gpu_clk, "gpu", gpu_parents, 5008c2ecf20Sopenharmony_ci 0x154, 0, 4, 24, 3, BIT(31), 0); 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_cistatic const char * const mbus_parents[] = { "hosc", "pll-periph", "pll-ddr" }; 5038c2ecf20Sopenharmony_cistatic SUNXI_CCU_MP_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents, 5048c2ecf20Sopenharmony_ci 0x15c, 0, 4, 16, 2, 24, 2, BIT(31), CLK_IS_CRITICAL); 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_cistatic SUNXI_CCU_GATE(iep_clk, "iep", "de-be", 5078c2ecf20Sopenharmony_ci 0x160, BIT(31), 0); 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistatic struct ccu_common *sun5i_a10s_ccu_clks[] = { 5108c2ecf20Sopenharmony_ci &hosc_clk.common, 5118c2ecf20Sopenharmony_ci &pll_core_clk.common, 5128c2ecf20Sopenharmony_ci &pll_audio_base_clk.common, 5138c2ecf20Sopenharmony_ci &pll_video0_clk.common, 5148c2ecf20Sopenharmony_ci &pll_ve_clk.common, 5158c2ecf20Sopenharmony_ci &pll_ddr_base_clk.common, 5168c2ecf20Sopenharmony_ci &pll_ddr_clk.common, 5178c2ecf20Sopenharmony_ci &pll_ddr_other_clk.common, 5188c2ecf20Sopenharmony_ci &pll_periph_clk.common, 5198c2ecf20Sopenharmony_ci &pll_video1_clk.common, 5208c2ecf20Sopenharmony_ci &cpu_clk.common, 5218c2ecf20Sopenharmony_ci &axi_clk.common, 5228c2ecf20Sopenharmony_ci &ahb_clk.common, 5238c2ecf20Sopenharmony_ci &apb0_clk.common, 5248c2ecf20Sopenharmony_ci &apb1_clk.common, 5258c2ecf20Sopenharmony_ci &axi_dram_clk.common, 5268c2ecf20Sopenharmony_ci &ahb_otg_clk.common, 5278c2ecf20Sopenharmony_ci &ahb_ehci_clk.common, 5288c2ecf20Sopenharmony_ci &ahb_ohci_clk.common, 5298c2ecf20Sopenharmony_ci &ahb_ss_clk.common, 5308c2ecf20Sopenharmony_ci &ahb_dma_clk.common, 5318c2ecf20Sopenharmony_ci &ahb_bist_clk.common, 5328c2ecf20Sopenharmony_ci &ahb_mmc0_clk.common, 5338c2ecf20Sopenharmony_ci &ahb_mmc1_clk.common, 5348c2ecf20Sopenharmony_ci &ahb_mmc2_clk.common, 5358c2ecf20Sopenharmony_ci &ahb_nand_clk.common, 5368c2ecf20Sopenharmony_ci &ahb_sdram_clk.common, 5378c2ecf20Sopenharmony_ci &ahb_emac_clk.common, 5388c2ecf20Sopenharmony_ci &ahb_ts_clk.common, 5398c2ecf20Sopenharmony_ci &ahb_spi0_clk.common, 5408c2ecf20Sopenharmony_ci &ahb_spi1_clk.common, 5418c2ecf20Sopenharmony_ci &ahb_spi2_clk.common, 5428c2ecf20Sopenharmony_ci &ahb_gps_clk.common, 5438c2ecf20Sopenharmony_ci &ahb_hstimer_clk.common, 5448c2ecf20Sopenharmony_ci &ahb_ve_clk.common, 5458c2ecf20Sopenharmony_ci &ahb_tve_clk.common, 5468c2ecf20Sopenharmony_ci &ahb_lcd_clk.common, 5478c2ecf20Sopenharmony_ci &ahb_csi_clk.common, 5488c2ecf20Sopenharmony_ci &ahb_hdmi_clk.common, 5498c2ecf20Sopenharmony_ci &ahb_de_be_clk.common, 5508c2ecf20Sopenharmony_ci &ahb_de_fe_clk.common, 5518c2ecf20Sopenharmony_ci &ahb_iep_clk.common, 5528c2ecf20Sopenharmony_ci &ahb_gpu_clk.common, 5538c2ecf20Sopenharmony_ci &apb0_codec_clk.common, 5548c2ecf20Sopenharmony_ci &apb0_spdif_clk.common, 5558c2ecf20Sopenharmony_ci &apb0_i2s_clk.common, 5568c2ecf20Sopenharmony_ci &apb0_pio_clk.common, 5578c2ecf20Sopenharmony_ci &apb0_ir_clk.common, 5588c2ecf20Sopenharmony_ci &apb0_keypad_clk.common, 5598c2ecf20Sopenharmony_ci &apb1_i2c0_clk.common, 5608c2ecf20Sopenharmony_ci &apb1_i2c1_clk.common, 5618c2ecf20Sopenharmony_ci &apb1_i2c2_clk.common, 5628c2ecf20Sopenharmony_ci &apb1_uart0_clk.common, 5638c2ecf20Sopenharmony_ci &apb1_uart1_clk.common, 5648c2ecf20Sopenharmony_ci &apb1_uart2_clk.common, 5658c2ecf20Sopenharmony_ci &apb1_uart3_clk.common, 5668c2ecf20Sopenharmony_ci &nand_clk.common, 5678c2ecf20Sopenharmony_ci &mmc0_clk.common, 5688c2ecf20Sopenharmony_ci &mmc1_clk.common, 5698c2ecf20Sopenharmony_ci &mmc2_clk.common, 5708c2ecf20Sopenharmony_ci &ts_clk.common, 5718c2ecf20Sopenharmony_ci &ss_clk.common, 5728c2ecf20Sopenharmony_ci &spi0_clk.common, 5738c2ecf20Sopenharmony_ci &spi1_clk.common, 5748c2ecf20Sopenharmony_ci &spi2_clk.common, 5758c2ecf20Sopenharmony_ci &ir_clk.common, 5768c2ecf20Sopenharmony_ci &i2s_clk.common, 5778c2ecf20Sopenharmony_ci &spdif_clk.common, 5788c2ecf20Sopenharmony_ci &keypad_clk.common, 5798c2ecf20Sopenharmony_ci &usb_ohci_clk.common, 5808c2ecf20Sopenharmony_ci &usb_phy0_clk.common, 5818c2ecf20Sopenharmony_ci &usb_phy1_clk.common, 5828c2ecf20Sopenharmony_ci &gps_clk.common, 5838c2ecf20Sopenharmony_ci &dram_ve_clk.common, 5848c2ecf20Sopenharmony_ci &dram_csi_clk.common, 5858c2ecf20Sopenharmony_ci &dram_ts_clk.common, 5868c2ecf20Sopenharmony_ci &dram_tve_clk.common, 5878c2ecf20Sopenharmony_ci &dram_de_fe_clk.common, 5888c2ecf20Sopenharmony_ci &dram_de_be_clk.common, 5898c2ecf20Sopenharmony_ci &dram_ace_clk.common, 5908c2ecf20Sopenharmony_ci &dram_iep_clk.common, 5918c2ecf20Sopenharmony_ci &de_be_clk.common, 5928c2ecf20Sopenharmony_ci &de_fe_clk.common, 5938c2ecf20Sopenharmony_ci &tcon_ch0_clk.common, 5948c2ecf20Sopenharmony_ci &tcon_ch1_sclk2_clk.common, 5958c2ecf20Sopenharmony_ci &tcon_ch1_sclk1_clk.common, 5968c2ecf20Sopenharmony_ci &csi_clk.common, 5978c2ecf20Sopenharmony_ci &ve_clk.common, 5988c2ecf20Sopenharmony_ci &codec_clk.common, 5998c2ecf20Sopenharmony_ci &avs_clk.common, 6008c2ecf20Sopenharmony_ci &hdmi_clk.common, 6018c2ecf20Sopenharmony_ci &gpu_clk.common, 6028c2ecf20Sopenharmony_ci &mbus_clk.common, 6038c2ecf20Sopenharmony_ci &iep_clk.common, 6048c2ecf20Sopenharmony_ci}; 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_cistatic const struct clk_hw *clk_parent_pll_audio[] = { 6078c2ecf20Sopenharmony_ci &pll_audio_base_clk.common.hw 6088c2ecf20Sopenharmony_ci}; 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_ci/* We hardcode the divider to 1 for now */ 6118c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio", 6128c2ecf20Sopenharmony_ci clk_parent_pll_audio, 6138c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 6148c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x", 6158c2ecf20Sopenharmony_ci clk_parent_pll_audio, 6168c2ecf20Sopenharmony_ci 2, 1, CLK_SET_RATE_PARENT); 6178c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_4x_clk, "pll-audio-4x", 6188c2ecf20Sopenharmony_ci clk_parent_pll_audio, 6198c2ecf20Sopenharmony_ci 1, 1, CLK_SET_RATE_PARENT); 6208c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HWS(pll_audio_8x_clk, "pll-audio-8x", 6218c2ecf20Sopenharmony_ci clk_parent_pll_audio, 6228c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 6238c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video0_2x_clk, "pll-video0-2x", 6248c2ecf20Sopenharmony_ci &pll_video0_clk.common.hw, 6258c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 6268c2ecf20Sopenharmony_cistatic CLK_FIXED_FACTOR_HW(pll_video1_2x_clk, "pll-video1-2x", 6278c2ecf20Sopenharmony_ci &pll_video1_clk.common.hw, 6288c2ecf20Sopenharmony_ci 1, 2, CLK_SET_RATE_PARENT); 6298c2ecf20Sopenharmony_ci 6308c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun5i_a10s_hw_clks = { 6318c2ecf20Sopenharmony_ci .hws = { 6328c2ecf20Sopenharmony_ci [CLK_HOSC] = &hosc_clk.common.hw, 6338c2ecf20Sopenharmony_ci [CLK_PLL_CORE] = &pll_core_clk.common.hw, 6348c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 6358c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 6368c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 6378c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 6388c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 6398c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 6408c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 6418c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 6428c2ecf20Sopenharmony_ci [CLK_PLL_DDR_BASE] = &pll_ddr_base_clk.common.hw, 6438c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 6448c2ecf20Sopenharmony_ci [CLK_PLL_DDR_OTHER] = &pll_ddr_other_clk.common.hw, 6458c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 6468c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 6478c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 6488c2ecf20Sopenharmony_ci [CLK_CPU] = &cpu_clk.common.hw, 6498c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 6508c2ecf20Sopenharmony_ci [CLK_AHB] = &ahb_clk.common.hw, 6518c2ecf20Sopenharmony_ci [CLK_APB0] = &apb0_clk.common.hw, 6528c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 6538c2ecf20Sopenharmony_ci [CLK_DRAM_AXI] = &axi_dram_clk.common.hw, 6548c2ecf20Sopenharmony_ci [CLK_AHB_OTG] = &ahb_otg_clk.common.hw, 6558c2ecf20Sopenharmony_ci [CLK_AHB_EHCI] = &ahb_ehci_clk.common.hw, 6568c2ecf20Sopenharmony_ci [CLK_AHB_OHCI] = &ahb_ohci_clk.common.hw, 6578c2ecf20Sopenharmony_ci [CLK_AHB_SS] = &ahb_ss_clk.common.hw, 6588c2ecf20Sopenharmony_ci [CLK_AHB_DMA] = &ahb_dma_clk.common.hw, 6598c2ecf20Sopenharmony_ci [CLK_AHB_BIST] = &ahb_bist_clk.common.hw, 6608c2ecf20Sopenharmony_ci [CLK_AHB_MMC0] = &ahb_mmc0_clk.common.hw, 6618c2ecf20Sopenharmony_ci [CLK_AHB_MMC1] = &ahb_mmc1_clk.common.hw, 6628c2ecf20Sopenharmony_ci [CLK_AHB_MMC2] = &ahb_mmc2_clk.common.hw, 6638c2ecf20Sopenharmony_ci [CLK_AHB_NAND] = &ahb_nand_clk.common.hw, 6648c2ecf20Sopenharmony_ci [CLK_AHB_SDRAM] = &ahb_sdram_clk.common.hw, 6658c2ecf20Sopenharmony_ci [CLK_AHB_EMAC] = &ahb_emac_clk.common.hw, 6668c2ecf20Sopenharmony_ci [CLK_AHB_TS] = &ahb_ts_clk.common.hw, 6678c2ecf20Sopenharmony_ci [CLK_AHB_SPI0] = &ahb_spi0_clk.common.hw, 6688c2ecf20Sopenharmony_ci [CLK_AHB_SPI1] = &ahb_spi1_clk.common.hw, 6698c2ecf20Sopenharmony_ci [CLK_AHB_SPI2] = &ahb_spi2_clk.common.hw, 6708c2ecf20Sopenharmony_ci [CLK_AHB_GPS] = &ahb_gps_clk.common.hw, 6718c2ecf20Sopenharmony_ci [CLK_AHB_HSTIMER] = &ahb_hstimer_clk.common.hw, 6728c2ecf20Sopenharmony_ci [CLK_AHB_VE] = &ahb_ve_clk.common.hw, 6738c2ecf20Sopenharmony_ci [CLK_AHB_TVE] = &ahb_tve_clk.common.hw, 6748c2ecf20Sopenharmony_ci [CLK_AHB_LCD] = &ahb_lcd_clk.common.hw, 6758c2ecf20Sopenharmony_ci [CLK_AHB_CSI] = &ahb_csi_clk.common.hw, 6768c2ecf20Sopenharmony_ci [CLK_AHB_HDMI] = &ahb_hdmi_clk.common.hw, 6778c2ecf20Sopenharmony_ci [CLK_AHB_DE_BE] = &ahb_de_be_clk.common.hw, 6788c2ecf20Sopenharmony_ci [CLK_AHB_DE_FE] = &ahb_de_fe_clk.common.hw, 6798c2ecf20Sopenharmony_ci [CLK_AHB_IEP] = &ahb_iep_clk.common.hw, 6808c2ecf20Sopenharmony_ci [CLK_AHB_GPU] = &ahb_gpu_clk.common.hw, 6818c2ecf20Sopenharmony_ci [CLK_APB0_CODEC] = &apb0_codec_clk.common.hw, 6828c2ecf20Sopenharmony_ci [CLK_APB0_I2S] = &apb0_i2s_clk.common.hw, 6838c2ecf20Sopenharmony_ci [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, 6848c2ecf20Sopenharmony_ci [CLK_APB0_IR] = &apb0_ir_clk.common.hw, 6858c2ecf20Sopenharmony_ci [CLK_APB0_KEYPAD] = &apb0_keypad_clk.common.hw, 6868c2ecf20Sopenharmony_ci [CLK_APB1_I2C0] = &apb1_i2c0_clk.common.hw, 6878c2ecf20Sopenharmony_ci [CLK_APB1_I2C1] = &apb1_i2c1_clk.common.hw, 6888c2ecf20Sopenharmony_ci [CLK_APB1_I2C2] = &apb1_i2c2_clk.common.hw, 6898c2ecf20Sopenharmony_ci [CLK_APB1_UART0] = &apb1_uart0_clk.common.hw, 6908c2ecf20Sopenharmony_ci [CLK_APB1_UART1] = &apb1_uart1_clk.common.hw, 6918c2ecf20Sopenharmony_ci [CLK_APB1_UART2] = &apb1_uart2_clk.common.hw, 6928c2ecf20Sopenharmony_ci [CLK_APB1_UART3] = &apb1_uart3_clk.common.hw, 6938c2ecf20Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 6948c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 6958c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 6968c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 6978c2ecf20Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 6988c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 6998c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 7008c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 7018c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 7028c2ecf20Sopenharmony_ci [CLK_IR] = &ir_clk.common.hw, 7038c2ecf20Sopenharmony_ci [CLK_I2S] = &i2s_clk.common.hw, 7048c2ecf20Sopenharmony_ci [CLK_KEYPAD] = &keypad_clk.common.hw, 7058c2ecf20Sopenharmony_ci [CLK_USB_OHCI] = &usb_ohci_clk.common.hw, 7068c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 7078c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 7088c2ecf20Sopenharmony_ci [CLK_GPS] = &gps_clk.common.hw, 7098c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 7108c2ecf20Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 7118c2ecf20Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 7128c2ecf20Sopenharmony_ci [CLK_DRAM_TVE] = &dram_tve_clk.common.hw, 7138c2ecf20Sopenharmony_ci [CLK_DRAM_DE_FE] = &dram_de_fe_clk.common.hw, 7148c2ecf20Sopenharmony_ci [CLK_DRAM_DE_BE] = &dram_de_be_clk.common.hw, 7158c2ecf20Sopenharmony_ci [CLK_DRAM_ACE] = &dram_ace_clk.common.hw, 7168c2ecf20Sopenharmony_ci [CLK_DRAM_IEP] = &dram_iep_clk.common.hw, 7178c2ecf20Sopenharmony_ci [CLK_DE_BE] = &de_be_clk.common.hw, 7188c2ecf20Sopenharmony_ci [CLK_DE_FE] = &de_fe_clk.common.hw, 7198c2ecf20Sopenharmony_ci [CLK_TCON_CH0] = &tcon_ch0_clk.common.hw, 7208c2ecf20Sopenharmony_ci [CLK_TCON_CH1_SCLK] = &tcon_ch1_sclk2_clk.common.hw, 7218c2ecf20Sopenharmony_ci [CLK_TCON_CH1] = &tcon_ch1_sclk1_clk.common.hw, 7228c2ecf20Sopenharmony_ci [CLK_CSI] = &csi_clk.common.hw, 7238c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 7248c2ecf20Sopenharmony_ci [CLK_CODEC] = &codec_clk.common.hw, 7258c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 7268c2ecf20Sopenharmony_ci [CLK_HDMI] = &hdmi_clk.common.hw, 7278c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 7288c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 7298c2ecf20Sopenharmony_ci [CLK_IEP] = &iep_clk.common.hw, 7308c2ecf20Sopenharmony_ci }, 7318c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 7328c2ecf20Sopenharmony_ci}; 7338c2ecf20Sopenharmony_ci 7348c2ecf20Sopenharmony_cistatic struct ccu_reset_map sun5i_a10s_ccu_resets[] = { 7358c2ecf20Sopenharmony_ci [RST_USB_PHY0] = { 0x0cc, BIT(0) }, 7368c2ecf20Sopenharmony_ci [RST_USB_PHY1] = { 0x0cc, BIT(1) }, 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci [RST_GPS] = { 0x0d0, BIT(30) }, 7398c2ecf20Sopenharmony_ci 7408c2ecf20Sopenharmony_ci [RST_DE_BE] = { 0x104, BIT(30) }, 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_ci [RST_DE_FE] = { 0x10c, BIT(30) }, 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_ci [RST_TVE] = { 0x118, BIT(29) }, 7458c2ecf20Sopenharmony_ci [RST_LCD] = { 0x118, BIT(30) }, 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci [RST_CSI] = { 0x134, BIT(30) }, 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_ci [RST_VE] = { 0x13c, BIT(0) }, 7508c2ecf20Sopenharmony_ci 7518c2ecf20Sopenharmony_ci [RST_GPU] = { 0x154, BIT(30) }, 7528c2ecf20Sopenharmony_ci 7538c2ecf20Sopenharmony_ci [RST_IEP] = { 0x160, BIT(30) }, 7548c2ecf20Sopenharmony_ci}; 7558c2ecf20Sopenharmony_ci 7568c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun5i_a10s_ccu_desc = { 7578c2ecf20Sopenharmony_ci .ccu_clks = sun5i_a10s_ccu_clks, 7588c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun5i_a10s_ccu_clks), 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci .hw_clks = &sun5i_a10s_hw_clks, 7618c2ecf20Sopenharmony_ci 7628c2ecf20Sopenharmony_ci .resets = sun5i_a10s_ccu_resets, 7638c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun5i_a10s_ccu_resets), 7648c2ecf20Sopenharmony_ci}; 7658c2ecf20Sopenharmony_ci 7668c2ecf20Sopenharmony_ci/* 7678c2ecf20Sopenharmony_ci * The A13 is the A10s minus the TS, GPS, HDMI, I2S and the keypad 7688c2ecf20Sopenharmony_ci */ 7698c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun5i_a13_hw_clks = { 7708c2ecf20Sopenharmony_ci .hws = { 7718c2ecf20Sopenharmony_ci [CLK_HOSC] = &hosc_clk.common.hw, 7728c2ecf20Sopenharmony_ci [CLK_PLL_CORE] = &pll_core_clk.common.hw, 7738c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 7748c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 7758c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 7768c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 7778c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 7788c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 7798c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 7808c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 7818c2ecf20Sopenharmony_ci [CLK_PLL_DDR_BASE] = &pll_ddr_base_clk.common.hw, 7828c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 7838c2ecf20Sopenharmony_ci [CLK_PLL_DDR_OTHER] = &pll_ddr_other_clk.common.hw, 7848c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 7858c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 7868c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 7878c2ecf20Sopenharmony_ci [CLK_CPU] = &cpu_clk.common.hw, 7888c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 7898c2ecf20Sopenharmony_ci [CLK_AHB] = &ahb_clk.common.hw, 7908c2ecf20Sopenharmony_ci [CLK_APB0] = &apb0_clk.common.hw, 7918c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 7928c2ecf20Sopenharmony_ci [CLK_DRAM_AXI] = &axi_dram_clk.common.hw, 7938c2ecf20Sopenharmony_ci [CLK_AHB_OTG] = &ahb_otg_clk.common.hw, 7948c2ecf20Sopenharmony_ci [CLK_AHB_EHCI] = &ahb_ehci_clk.common.hw, 7958c2ecf20Sopenharmony_ci [CLK_AHB_OHCI] = &ahb_ohci_clk.common.hw, 7968c2ecf20Sopenharmony_ci [CLK_AHB_SS] = &ahb_ss_clk.common.hw, 7978c2ecf20Sopenharmony_ci [CLK_AHB_DMA] = &ahb_dma_clk.common.hw, 7988c2ecf20Sopenharmony_ci [CLK_AHB_BIST] = &ahb_bist_clk.common.hw, 7998c2ecf20Sopenharmony_ci [CLK_AHB_MMC0] = &ahb_mmc0_clk.common.hw, 8008c2ecf20Sopenharmony_ci [CLK_AHB_MMC1] = &ahb_mmc1_clk.common.hw, 8018c2ecf20Sopenharmony_ci [CLK_AHB_MMC2] = &ahb_mmc2_clk.common.hw, 8028c2ecf20Sopenharmony_ci [CLK_AHB_NAND] = &ahb_nand_clk.common.hw, 8038c2ecf20Sopenharmony_ci [CLK_AHB_SDRAM] = &ahb_sdram_clk.common.hw, 8048c2ecf20Sopenharmony_ci [CLK_AHB_EMAC] = &ahb_emac_clk.common.hw, 8058c2ecf20Sopenharmony_ci [CLK_AHB_SPI0] = &ahb_spi0_clk.common.hw, 8068c2ecf20Sopenharmony_ci [CLK_AHB_SPI1] = &ahb_spi1_clk.common.hw, 8078c2ecf20Sopenharmony_ci [CLK_AHB_SPI2] = &ahb_spi2_clk.common.hw, 8088c2ecf20Sopenharmony_ci [CLK_AHB_HSTIMER] = &ahb_hstimer_clk.common.hw, 8098c2ecf20Sopenharmony_ci [CLK_AHB_VE] = &ahb_ve_clk.common.hw, 8108c2ecf20Sopenharmony_ci [CLK_AHB_TVE] = &ahb_tve_clk.common.hw, 8118c2ecf20Sopenharmony_ci [CLK_AHB_LCD] = &ahb_lcd_clk.common.hw, 8128c2ecf20Sopenharmony_ci [CLK_AHB_CSI] = &ahb_csi_clk.common.hw, 8138c2ecf20Sopenharmony_ci [CLK_AHB_DE_BE] = &ahb_de_be_clk.common.hw, 8148c2ecf20Sopenharmony_ci [CLK_AHB_DE_FE] = &ahb_de_fe_clk.common.hw, 8158c2ecf20Sopenharmony_ci [CLK_AHB_IEP] = &ahb_iep_clk.common.hw, 8168c2ecf20Sopenharmony_ci [CLK_AHB_GPU] = &ahb_gpu_clk.common.hw, 8178c2ecf20Sopenharmony_ci [CLK_APB0_CODEC] = &apb0_codec_clk.common.hw, 8188c2ecf20Sopenharmony_ci [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, 8198c2ecf20Sopenharmony_ci [CLK_APB0_IR] = &apb0_ir_clk.common.hw, 8208c2ecf20Sopenharmony_ci [CLK_APB1_I2C0] = &apb1_i2c0_clk.common.hw, 8218c2ecf20Sopenharmony_ci [CLK_APB1_I2C1] = &apb1_i2c1_clk.common.hw, 8228c2ecf20Sopenharmony_ci [CLK_APB1_I2C2] = &apb1_i2c2_clk.common.hw, 8238c2ecf20Sopenharmony_ci [CLK_APB1_UART0] = &apb1_uart0_clk.common.hw, 8248c2ecf20Sopenharmony_ci [CLK_APB1_UART1] = &apb1_uart1_clk.common.hw, 8258c2ecf20Sopenharmony_ci [CLK_APB1_UART2] = &apb1_uart2_clk.common.hw, 8268c2ecf20Sopenharmony_ci [CLK_APB1_UART3] = &apb1_uart3_clk.common.hw, 8278c2ecf20Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 8288c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 8298c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 8308c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 8318c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 8328c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 8338c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 8348c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 8358c2ecf20Sopenharmony_ci [CLK_IR] = &ir_clk.common.hw, 8368c2ecf20Sopenharmony_ci [CLK_USB_OHCI] = &usb_ohci_clk.common.hw, 8378c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 8388c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 8398c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 8408c2ecf20Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 8418c2ecf20Sopenharmony_ci [CLK_DRAM_TVE] = &dram_tve_clk.common.hw, 8428c2ecf20Sopenharmony_ci [CLK_DRAM_DE_FE] = &dram_de_fe_clk.common.hw, 8438c2ecf20Sopenharmony_ci [CLK_DRAM_DE_BE] = &dram_de_be_clk.common.hw, 8448c2ecf20Sopenharmony_ci [CLK_DRAM_ACE] = &dram_ace_clk.common.hw, 8458c2ecf20Sopenharmony_ci [CLK_DRAM_IEP] = &dram_iep_clk.common.hw, 8468c2ecf20Sopenharmony_ci [CLK_DE_BE] = &de_be_clk.common.hw, 8478c2ecf20Sopenharmony_ci [CLK_DE_FE] = &de_fe_clk.common.hw, 8488c2ecf20Sopenharmony_ci [CLK_TCON_CH0] = &tcon_ch0_clk.common.hw, 8498c2ecf20Sopenharmony_ci [CLK_TCON_CH1_SCLK] = &tcon_ch1_sclk2_clk.common.hw, 8508c2ecf20Sopenharmony_ci [CLK_TCON_CH1] = &tcon_ch1_sclk1_clk.common.hw, 8518c2ecf20Sopenharmony_ci [CLK_CSI] = &csi_clk.common.hw, 8528c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 8538c2ecf20Sopenharmony_ci [CLK_CODEC] = &codec_clk.common.hw, 8548c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 8558c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 8568c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 8578c2ecf20Sopenharmony_ci [CLK_IEP] = &iep_clk.common.hw, 8588c2ecf20Sopenharmony_ci }, 8598c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 8608c2ecf20Sopenharmony_ci}; 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun5i_a13_ccu_desc = { 8638c2ecf20Sopenharmony_ci .ccu_clks = sun5i_a10s_ccu_clks, 8648c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun5i_a10s_ccu_clks), 8658c2ecf20Sopenharmony_ci 8668c2ecf20Sopenharmony_ci .hw_clks = &sun5i_a13_hw_clks, 8678c2ecf20Sopenharmony_ci 8688c2ecf20Sopenharmony_ci .resets = sun5i_a10s_ccu_resets, 8698c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun5i_a10s_ccu_resets), 8708c2ecf20Sopenharmony_ci}; 8718c2ecf20Sopenharmony_ci 8728c2ecf20Sopenharmony_ci/* 8738c2ecf20Sopenharmony_ci * The GR8 is the A10s CCU minus the HDMI and keypad, plus SPDIF 8748c2ecf20Sopenharmony_ci */ 8758c2ecf20Sopenharmony_cistatic struct clk_hw_onecell_data sun5i_gr8_hw_clks = { 8768c2ecf20Sopenharmony_ci .hws = { 8778c2ecf20Sopenharmony_ci [CLK_HOSC] = &hosc_clk.common.hw, 8788c2ecf20Sopenharmony_ci [CLK_PLL_CORE] = &pll_core_clk.common.hw, 8798c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw, 8808c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO] = &pll_audio_clk.hw, 8818c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw, 8828c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw, 8838c2ecf20Sopenharmony_ci [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, 8848c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0] = &pll_video0_clk.common.hw, 8858c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO0_2X] = &pll_video0_2x_clk.hw, 8868c2ecf20Sopenharmony_ci [CLK_PLL_VE] = &pll_ve_clk.common.hw, 8878c2ecf20Sopenharmony_ci [CLK_PLL_DDR_BASE] = &pll_ddr_base_clk.common.hw, 8888c2ecf20Sopenharmony_ci [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, 8898c2ecf20Sopenharmony_ci [CLK_PLL_DDR_OTHER] = &pll_ddr_other_clk.common.hw, 8908c2ecf20Sopenharmony_ci [CLK_PLL_PERIPH] = &pll_periph_clk.common.hw, 8918c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1] = &pll_video1_clk.common.hw, 8928c2ecf20Sopenharmony_ci [CLK_PLL_VIDEO1_2X] = &pll_video1_2x_clk.hw, 8938c2ecf20Sopenharmony_ci [CLK_CPU] = &cpu_clk.common.hw, 8948c2ecf20Sopenharmony_ci [CLK_AXI] = &axi_clk.common.hw, 8958c2ecf20Sopenharmony_ci [CLK_AHB] = &ahb_clk.common.hw, 8968c2ecf20Sopenharmony_ci [CLK_APB0] = &apb0_clk.common.hw, 8978c2ecf20Sopenharmony_ci [CLK_APB1] = &apb1_clk.common.hw, 8988c2ecf20Sopenharmony_ci [CLK_DRAM_AXI] = &axi_dram_clk.common.hw, 8998c2ecf20Sopenharmony_ci [CLK_AHB_OTG] = &ahb_otg_clk.common.hw, 9008c2ecf20Sopenharmony_ci [CLK_AHB_EHCI] = &ahb_ehci_clk.common.hw, 9018c2ecf20Sopenharmony_ci [CLK_AHB_OHCI] = &ahb_ohci_clk.common.hw, 9028c2ecf20Sopenharmony_ci [CLK_AHB_SS] = &ahb_ss_clk.common.hw, 9038c2ecf20Sopenharmony_ci [CLK_AHB_DMA] = &ahb_dma_clk.common.hw, 9048c2ecf20Sopenharmony_ci [CLK_AHB_BIST] = &ahb_bist_clk.common.hw, 9058c2ecf20Sopenharmony_ci [CLK_AHB_MMC0] = &ahb_mmc0_clk.common.hw, 9068c2ecf20Sopenharmony_ci [CLK_AHB_MMC1] = &ahb_mmc1_clk.common.hw, 9078c2ecf20Sopenharmony_ci [CLK_AHB_MMC2] = &ahb_mmc2_clk.common.hw, 9088c2ecf20Sopenharmony_ci [CLK_AHB_NAND] = &ahb_nand_clk.common.hw, 9098c2ecf20Sopenharmony_ci [CLK_AHB_SDRAM] = &ahb_sdram_clk.common.hw, 9108c2ecf20Sopenharmony_ci [CLK_AHB_EMAC] = &ahb_emac_clk.common.hw, 9118c2ecf20Sopenharmony_ci [CLK_AHB_TS] = &ahb_ts_clk.common.hw, 9128c2ecf20Sopenharmony_ci [CLK_AHB_SPI0] = &ahb_spi0_clk.common.hw, 9138c2ecf20Sopenharmony_ci [CLK_AHB_SPI1] = &ahb_spi1_clk.common.hw, 9148c2ecf20Sopenharmony_ci [CLK_AHB_SPI2] = &ahb_spi2_clk.common.hw, 9158c2ecf20Sopenharmony_ci [CLK_AHB_GPS] = &ahb_gps_clk.common.hw, 9168c2ecf20Sopenharmony_ci [CLK_AHB_HSTIMER] = &ahb_hstimer_clk.common.hw, 9178c2ecf20Sopenharmony_ci [CLK_AHB_VE] = &ahb_ve_clk.common.hw, 9188c2ecf20Sopenharmony_ci [CLK_AHB_TVE] = &ahb_tve_clk.common.hw, 9198c2ecf20Sopenharmony_ci [CLK_AHB_LCD] = &ahb_lcd_clk.common.hw, 9208c2ecf20Sopenharmony_ci [CLK_AHB_CSI] = &ahb_csi_clk.common.hw, 9218c2ecf20Sopenharmony_ci [CLK_AHB_DE_BE] = &ahb_de_be_clk.common.hw, 9228c2ecf20Sopenharmony_ci [CLK_AHB_DE_FE] = &ahb_de_fe_clk.common.hw, 9238c2ecf20Sopenharmony_ci [CLK_AHB_IEP] = &ahb_iep_clk.common.hw, 9248c2ecf20Sopenharmony_ci [CLK_AHB_GPU] = &ahb_gpu_clk.common.hw, 9258c2ecf20Sopenharmony_ci [CLK_APB0_CODEC] = &apb0_codec_clk.common.hw, 9268c2ecf20Sopenharmony_ci [CLK_APB0_SPDIF] = &apb0_spdif_clk.common.hw, 9278c2ecf20Sopenharmony_ci [CLK_APB0_I2S] = &apb0_i2s_clk.common.hw, 9288c2ecf20Sopenharmony_ci [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, 9298c2ecf20Sopenharmony_ci [CLK_APB0_IR] = &apb0_ir_clk.common.hw, 9308c2ecf20Sopenharmony_ci [CLK_APB1_I2C0] = &apb1_i2c0_clk.common.hw, 9318c2ecf20Sopenharmony_ci [CLK_APB1_I2C1] = &apb1_i2c1_clk.common.hw, 9328c2ecf20Sopenharmony_ci [CLK_APB1_I2C2] = &apb1_i2c2_clk.common.hw, 9338c2ecf20Sopenharmony_ci [CLK_APB1_UART0] = &apb1_uart0_clk.common.hw, 9348c2ecf20Sopenharmony_ci [CLK_APB1_UART1] = &apb1_uart1_clk.common.hw, 9358c2ecf20Sopenharmony_ci [CLK_APB1_UART2] = &apb1_uart2_clk.common.hw, 9368c2ecf20Sopenharmony_ci [CLK_APB1_UART3] = &apb1_uart3_clk.common.hw, 9378c2ecf20Sopenharmony_ci [CLK_NAND] = &nand_clk.common.hw, 9388c2ecf20Sopenharmony_ci [CLK_MMC0] = &mmc0_clk.common.hw, 9398c2ecf20Sopenharmony_ci [CLK_MMC1] = &mmc1_clk.common.hw, 9408c2ecf20Sopenharmony_ci [CLK_MMC2] = &mmc2_clk.common.hw, 9418c2ecf20Sopenharmony_ci [CLK_TS] = &ts_clk.common.hw, 9428c2ecf20Sopenharmony_ci [CLK_SS] = &ss_clk.common.hw, 9438c2ecf20Sopenharmony_ci [CLK_SPI0] = &spi0_clk.common.hw, 9448c2ecf20Sopenharmony_ci [CLK_SPI1] = &spi1_clk.common.hw, 9458c2ecf20Sopenharmony_ci [CLK_SPI2] = &spi2_clk.common.hw, 9468c2ecf20Sopenharmony_ci [CLK_IR] = &ir_clk.common.hw, 9478c2ecf20Sopenharmony_ci [CLK_I2S] = &i2s_clk.common.hw, 9488c2ecf20Sopenharmony_ci [CLK_SPDIF] = &spdif_clk.common.hw, 9498c2ecf20Sopenharmony_ci [CLK_USB_OHCI] = &usb_ohci_clk.common.hw, 9508c2ecf20Sopenharmony_ci [CLK_USB_PHY0] = &usb_phy0_clk.common.hw, 9518c2ecf20Sopenharmony_ci [CLK_USB_PHY1] = &usb_phy1_clk.common.hw, 9528c2ecf20Sopenharmony_ci [CLK_GPS] = &gps_clk.common.hw, 9538c2ecf20Sopenharmony_ci [CLK_DRAM_VE] = &dram_ve_clk.common.hw, 9548c2ecf20Sopenharmony_ci [CLK_DRAM_CSI] = &dram_csi_clk.common.hw, 9558c2ecf20Sopenharmony_ci [CLK_DRAM_TS] = &dram_ts_clk.common.hw, 9568c2ecf20Sopenharmony_ci [CLK_DRAM_TVE] = &dram_tve_clk.common.hw, 9578c2ecf20Sopenharmony_ci [CLK_DRAM_DE_FE] = &dram_de_fe_clk.common.hw, 9588c2ecf20Sopenharmony_ci [CLK_DRAM_DE_BE] = &dram_de_be_clk.common.hw, 9598c2ecf20Sopenharmony_ci [CLK_DRAM_ACE] = &dram_ace_clk.common.hw, 9608c2ecf20Sopenharmony_ci [CLK_DRAM_IEP] = &dram_iep_clk.common.hw, 9618c2ecf20Sopenharmony_ci [CLK_DE_BE] = &de_be_clk.common.hw, 9628c2ecf20Sopenharmony_ci [CLK_DE_FE] = &de_fe_clk.common.hw, 9638c2ecf20Sopenharmony_ci [CLK_TCON_CH0] = &tcon_ch0_clk.common.hw, 9648c2ecf20Sopenharmony_ci [CLK_TCON_CH1_SCLK] = &tcon_ch1_sclk2_clk.common.hw, 9658c2ecf20Sopenharmony_ci [CLK_TCON_CH1] = &tcon_ch1_sclk1_clk.common.hw, 9668c2ecf20Sopenharmony_ci [CLK_CSI] = &csi_clk.common.hw, 9678c2ecf20Sopenharmony_ci [CLK_VE] = &ve_clk.common.hw, 9688c2ecf20Sopenharmony_ci [CLK_CODEC] = &codec_clk.common.hw, 9698c2ecf20Sopenharmony_ci [CLK_AVS] = &avs_clk.common.hw, 9708c2ecf20Sopenharmony_ci [CLK_GPU] = &gpu_clk.common.hw, 9718c2ecf20Sopenharmony_ci [CLK_MBUS] = &mbus_clk.common.hw, 9728c2ecf20Sopenharmony_ci [CLK_IEP] = &iep_clk.common.hw, 9738c2ecf20Sopenharmony_ci }, 9748c2ecf20Sopenharmony_ci .num = CLK_NUMBER, 9758c2ecf20Sopenharmony_ci}; 9768c2ecf20Sopenharmony_ci 9778c2ecf20Sopenharmony_cistatic const struct sunxi_ccu_desc sun5i_gr8_ccu_desc = { 9788c2ecf20Sopenharmony_ci .ccu_clks = sun5i_a10s_ccu_clks, 9798c2ecf20Sopenharmony_ci .num_ccu_clks = ARRAY_SIZE(sun5i_a10s_ccu_clks), 9808c2ecf20Sopenharmony_ci 9818c2ecf20Sopenharmony_ci .hw_clks = &sun5i_gr8_hw_clks, 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci .resets = sun5i_a10s_ccu_resets, 9848c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(sun5i_a10s_ccu_resets), 9858c2ecf20Sopenharmony_ci}; 9868c2ecf20Sopenharmony_ci 9878c2ecf20Sopenharmony_cistatic void __init sun5i_ccu_init(struct device_node *node, 9888c2ecf20Sopenharmony_ci const struct sunxi_ccu_desc *desc) 9898c2ecf20Sopenharmony_ci{ 9908c2ecf20Sopenharmony_ci void __iomem *reg; 9918c2ecf20Sopenharmony_ci u32 val; 9928c2ecf20Sopenharmony_ci 9938c2ecf20Sopenharmony_ci reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 9948c2ecf20Sopenharmony_ci if (IS_ERR(reg)) { 9958c2ecf20Sopenharmony_ci pr_err("%pOF: Could not map the clock registers\n", node); 9968c2ecf20Sopenharmony_ci return; 9978c2ecf20Sopenharmony_ci } 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_ci /* Force the PLL-Audio-1x divider to 1 */ 10008c2ecf20Sopenharmony_ci val = readl(reg + SUN5I_PLL_AUDIO_REG); 10018c2ecf20Sopenharmony_ci val &= ~GENMASK(29, 26); 10028c2ecf20Sopenharmony_ci writel(val | (0 << 26), reg + SUN5I_PLL_AUDIO_REG); 10038c2ecf20Sopenharmony_ci 10048c2ecf20Sopenharmony_ci /* 10058c2ecf20Sopenharmony_ci * Use the peripheral PLL as the AHB parent, instead of CPU / 10068c2ecf20Sopenharmony_ci * AXI which have rate changes due to cpufreq. 10078c2ecf20Sopenharmony_ci * 10088c2ecf20Sopenharmony_ci * This is especially a big deal for the HS timer whose parent 10098c2ecf20Sopenharmony_ci * clock is AHB. 10108c2ecf20Sopenharmony_ci */ 10118c2ecf20Sopenharmony_ci val = readl(reg + SUN5I_AHB_REG); 10128c2ecf20Sopenharmony_ci val &= ~GENMASK(7, 6); 10138c2ecf20Sopenharmony_ci writel(val | (2 << 6), reg + SUN5I_AHB_REG); 10148c2ecf20Sopenharmony_ci 10158c2ecf20Sopenharmony_ci sunxi_ccu_probe(node, reg, desc); 10168c2ecf20Sopenharmony_ci} 10178c2ecf20Sopenharmony_ci 10188c2ecf20Sopenharmony_cistatic void __init sun5i_a10s_ccu_setup(struct device_node *node) 10198c2ecf20Sopenharmony_ci{ 10208c2ecf20Sopenharmony_ci sun5i_ccu_init(node, &sun5i_a10s_ccu_desc); 10218c2ecf20Sopenharmony_ci} 10228c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun5i_a10s_ccu, "allwinner,sun5i-a10s-ccu", 10238c2ecf20Sopenharmony_ci sun5i_a10s_ccu_setup); 10248c2ecf20Sopenharmony_ci 10258c2ecf20Sopenharmony_cistatic void __init sun5i_a13_ccu_setup(struct device_node *node) 10268c2ecf20Sopenharmony_ci{ 10278c2ecf20Sopenharmony_ci sun5i_ccu_init(node, &sun5i_a13_ccu_desc); 10288c2ecf20Sopenharmony_ci} 10298c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun5i_a13_ccu, "allwinner,sun5i-a13-ccu", 10308c2ecf20Sopenharmony_ci sun5i_a13_ccu_setup); 10318c2ecf20Sopenharmony_ci 10328c2ecf20Sopenharmony_cistatic void __init sun5i_gr8_ccu_setup(struct device_node *node) 10338c2ecf20Sopenharmony_ci{ 10348c2ecf20Sopenharmony_ci sun5i_ccu_init(node, &sun5i_gr8_ccu_desc); 10358c2ecf20Sopenharmony_ci} 10368c2ecf20Sopenharmony_ciCLK_OF_DECLARE(sun5i_gr8_ccu, "nextthing,gr8-ccu", 10378c2ecf20Sopenharmony_ci sun5i_gr8_ccu_setup); 1038