diff options
Diffstat (limited to 'drivers/clk/meson/axg.c')
-rw-r--r-- | drivers/clk/meson/axg.c | 287 |
1 files changed, 144 insertions, 143 deletions
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 2ad3801398dc..c12f81dfa674 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -11,7 +11,7 @@ #include <linux/clk-provider.h> #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/mod_devicetable.h> #include <linux/platform_device.h> #include <linux/module.h> @@ -21,6 +21,8 @@ #include "axg.h" #include "meson-eeclk.h" +#include <dt-bindings/clock/axg-clkc.h> + static DEFINE_SPINLOCK(meson_clk_lock); static struct clk_regmap axg_fixed_pll_dco = { @@ -1890,147 +1892,143 @@ static MESON_GATE(axg_ao_i2c, HHI_GCLK_AO, 4); /* Array of all clocks provided by this provider */ -static struct clk_hw_onecell_data axg_hw_onecell_data = { - .hws = { - [CLKID_SYS_PLL] = &axg_sys_pll.hw, - [CLKID_FIXED_PLL] = &axg_fixed_pll.hw, - [CLKID_FCLK_DIV2] = &axg_fclk_div2.hw, - [CLKID_FCLK_DIV3] = &axg_fclk_div3.hw, - [CLKID_FCLK_DIV4] = &axg_fclk_div4.hw, - [CLKID_FCLK_DIV5] = &axg_fclk_div5.hw, - [CLKID_FCLK_DIV7] = &axg_fclk_div7.hw, - [CLKID_GP0_PLL] = &axg_gp0_pll.hw, - [CLKID_MPEG_SEL] = &axg_mpeg_clk_sel.hw, - [CLKID_MPEG_DIV] = &axg_mpeg_clk_div.hw, - [CLKID_CLK81] = &axg_clk81.hw, - [CLKID_MPLL0] = &axg_mpll0.hw, - [CLKID_MPLL1] = &axg_mpll1.hw, - [CLKID_MPLL2] = &axg_mpll2.hw, - [CLKID_MPLL3] = &axg_mpll3.hw, - [CLKID_DDR] = &axg_ddr.hw, - [CLKID_AUDIO_LOCKER] = &axg_audio_locker.hw, - [CLKID_MIPI_DSI_HOST] = &axg_mipi_dsi_host.hw, - [CLKID_ISA] = &axg_isa.hw, - [CLKID_PL301] = &axg_pl301.hw, - [CLKID_PERIPHS] = &axg_periphs.hw, - [CLKID_SPICC0] = &axg_spicc_0.hw, - [CLKID_I2C] = &axg_i2c.hw, - [CLKID_RNG0] = &axg_rng0.hw, - [CLKID_UART0] = &axg_uart0.hw, - [CLKID_MIPI_DSI_PHY] = &axg_mipi_dsi_phy.hw, - [CLKID_SPICC1] = &axg_spicc_1.hw, - [CLKID_PCIE_A] = &axg_pcie_a.hw, - [CLKID_PCIE_B] = &axg_pcie_b.hw, - [CLKID_HIU_IFACE] = &axg_hiu_reg.hw, - [CLKID_ASSIST_MISC] = &axg_assist_misc.hw, - [CLKID_SD_EMMC_B] = &axg_emmc_b.hw, - [CLKID_SD_EMMC_C] = &axg_emmc_c.hw, - [CLKID_DMA] = &axg_dma.hw, - [CLKID_SPI] = &axg_spi.hw, - [CLKID_AUDIO] = &axg_audio.hw, - [CLKID_ETH] = &axg_eth_core.hw, - [CLKID_UART1] = &axg_uart1.hw, - [CLKID_G2D] = &axg_g2d.hw, - [CLKID_USB0] = &axg_usb0.hw, - [CLKID_USB1] = &axg_usb1.hw, - [CLKID_RESET] = &axg_reset.hw, - [CLKID_USB] = &axg_usb_general.hw, - [CLKID_AHB_ARB0] = &axg_ahb_arb0.hw, - [CLKID_EFUSE] = &axg_efuse.hw, - [CLKID_BOOT_ROM] = &axg_boot_rom.hw, - [CLKID_AHB_DATA_BUS] = &axg_ahb_data_bus.hw, - [CLKID_AHB_CTRL_BUS] = &axg_ahb_ctrl_bus.hw, - [CLKID_USB1_DDR_BRIDGE] = &axg_usb1_to_ddr.hw, - [CLKID_USB0_DDR_BRIDGE] = &axg_usb0_to_ddr.hw, - [CLKID_MMC_PCLK] = &axg_mmc_pclk.hw, - [CLKID_VPU_INTR] = &axg_vpu_intr.hw, - [CLKID_SEC_AHB_AHB3_BRIDGE] = &axg_sec_ahb_ahb3_bridge.hw, - [CLKID_GIC] = &axg_gic.hw, - [CLKID_AO_MEDIA_CPU] = &axg_ao_media_cpu.hw, - [CLKID_AO_AHB_SRAM] = &axg_ao_ahb_sram.hw, - [CLKID_AO_AHB_BUS] = &axg_ao_ahb_bus.hw, - [CLKID_AO_IFACE] = &axg_ao_iface.hw, - [CLKID_AO_I2C] = &axg_ao_i2c.hw, - [CLKID_SD_EMMC_B_CLK0_SEL] = &axg_sd_emmc_b_clk0_sel.hw, - [CLKID_SD_EMMC_B_CLK0_DIV] = &axg_sd_emmc_b_clk0_div.hw, - [CLKID_SD_EMMC_B_CLK0] = &axg_sd_emmc_b_clk0.hw, - [CLKID_SD_EMMC_C_CLK0_SEL] = &axg_sd_emmc_c_clk0_sel.hw, - [CLKID_SD_EMMC_C_CLK0_DIV] = &axg_sd_emmc_c_clk0_div.hw, - [CLKID_SD_EMMC_C_CLK0] = &axg_sd_emmc_c_clk0.hw, - [CLKID_MPLL0_DIV] = &axg_mpll0_div.hw, - [CLKID_MPLL1_DIV] = &axg_mpll1_div.hw, - [CLKID_MPLL2_DIV] = &axg_mpll2_div.hw, - [CLKID_MPLL3_DIV] = &axg_mpll3_div.hw, - [CLKID_HIFI_PLL] = &axg_hifi_pll.hw, - [CLKID_MPLL_PREDIV] = &axg_mpll_prediv.hw, - [CLKID_FCLK_DIV2_DIV] = &axg_fclk_div2_div.hw, - [CLKID_FCLK_DIV3_DIV] = &axg_fclk_div3_div.hw, - [CLKID_FCLK_DIV4_DIV] = &axg_fclk_div4_div.hw, - [CLKID_FCLK_DIV5_DIV] = &axg_fclk_div5_div.hw, - [CLKID_FCLK_DIV7_DIV] = &axg_fclk_div7_div.hw, - [CLKID_PCIE_PLL] = &axg_pcie_pll.hw, - [CLKID_PCIE_MUX] = &axg_pcie_mux.hw, - [CLKID_PCIE_REF] = &axg_pcie_ref.hw, - [CLKID_PCIE_CML_EN0] = &axg_pcie_cml_en0.hw, - [CLKID_PCIE_CML_EN1] = &axg_pcie_cml_en1.hw, - [CLKID_GEN_CLK_SEL] = &axg_gen_clk_sel.hw, - [CLKID_GEN_CLK_DIV] = &axg_gen_clk_div.hw, - [CLKID_GEN_CLK] = &axg_gen_clk.hw, - [CLKID_SYS_PLL_DCO] = &axg_sys_pll_dco.hw, - [CLKID_FIXED_PLL_DCO] = &axg_fixed_pll_dco.hw, - [CLKID_GP0_PLL_DCO] = &axg_gp0_pll_dco.hw, - [CLKID_HIFI_PLL_DCO] = &axg_hifi_pll_dco.hw, - [CLKID_PCIE_PLL_DCO] = &axg_pcie_pll_dco.hw, - [CLKID_PCIE_PLL_OD] = &axg_pcie_pll_od.hw, - [CLKID_VPU_0_DIV] = &axg_vpu_0_div.hw, - [CLKID_VPU_0_SEL] = &axg_vpu_0_sel.hw, - [CLKID_VPU_0] = &axg_vpu_0.hw, - [CLKID_VPU_1_DIV] = &axg_vpu_1_div.hw, - [CLKID_VPU_1_SEL] = &axg_vpu_1_sel.hw, - [CLKID_VPU_1] = &axg_vpu_1.hw, - [CLKID_VPU] = &axg_vpu.hw, - [CLKID_VAPB_0_DIV] = &axg_vapb_0_div.hw, - [CLKID_VAPB_0_SEL] = &axg_vapb_0_sel.hw, - [CLKID_VAPB_0] = &axg_vapb_0.hw, - [CLKID_VAPB_1_DIV] = &axg_vapb_1_div.hw, - [CLKID_VAPB_1_SEL] = &axg_vapb_1_sel.hw, - [CLKID_VAPB_1] = &axg_vapb_1.hw, - [CLKID_VAPB_SEL] = &axg_vapb_sel.hw, - [CLKID_VAPB] = &axg_vapb.hw, - [CLKID_VCLK] = &axg_vclk.hw, - [CLKID_VCLK2] = &axg_vclk2.hw, - [CLKID_VCLK_SEL] = &axg_vclk_sel.hw, - [CLKID_VCLK2_SEL] = &axg_vclk2_sel.hw, - [CLKID_VCLK_INPUT] = &axg_vclk_input.hw, - [CLKID_VCLK2_INPUT] = &axg_vclk2_input.hw, - [CLKID_VCLK_DIV] = &axg_vclk_div.hw, - [CLKID_VCLK2_DIV] = &axg_vclk2_div.hw, - [CLKID_VCLK_DIV2_EN] = &axg_vclk_div2_en.hw, - [CLKID_VCLK_DIV4_EN] = &axg_vclk_div4_en.hw, - [CLKID_VCLK_DIV6_EN] = &axg_vclk_div6_en.hw, - [CLKID_VCLK_DIV12_EN] = &axg_vclk_div12_en.hw, - [CLKID_VCLK2_DIV2_EN] = &axg_vclk2_div2_en.hw, - [CLKID_VCLK2_DIV4_EN] = &axg_vclk2_div4_en.hw, - [CLKID_VCLK2_DIV6_EN] = &axg_vclk2_div6_en.hw, - [CLKID_VCLK2_DIV12_EN] = &axg_vclk2_div12_en.hw, - [CLKID_VCLK_DIV1] = &axg_vclk_div1.hw, - [CLKID_VCLK_DIV2] = &axg_vclk_div2.hw, - [CLKID_VCLK_DIV4] = &axg_vclk_div4.hw, - [CLKID_VCLK_DIV6] = &axg_vclk_div6.hw, - [CLKID_VCLK_DIV12] = &axg_vclk_div12.hw, - [CLKID_VCLK2_DIV1] = &axg_vclk2_div1.hw, - [CLKID_VCLK2_DIV2] = &axg_vclk2_div2.hw, - [CLKID_VCLK2_DIV4] = &axg_vclk2_div4.hw, - [CLKID_VCLK2_DIV6] = &axg_vclk2_div6.hw, - [CLKID_VCLK2_DIV12] = &axg_vclk2_div12.hw, - [CLKID_CTS_ENCL_SEL] = &axg_cts_encl_sel.hw, - [CLKID_CTS_ENCL] = &axg_cts_encl.hw, - [CLKID_VDIN_MEAS_SEL] = &axg_vdin_meas_sel.hw, - [CLKID_VDIN_MEAS_DIV] = &axg_vdin_meas_div.hw, - [CLKID_VDIN_MEAS] = &axg_vdin_meas.hw, - [NR_CLKS] = NULL, - }, - .num = NR_CLKS, +static struct clk_hw *axg_hw_clks[] = { + [CLKID_SYS_PLL] = &axg_sys_pll.hw, + [CLKID_FIXED_PLL] = &axg_fixed_pll.hw, + [CLKID_FCLK_DIV2] = &axg_fclk_div2.hw, + [CLKID_FCLK_DIV3] = &axg_fclk_div3.hw, + [CLKID_FCLK_DIV4] = &axg_fclk_div4.hw, + [CLKID_FCLK_DIV5] = &axg_fclk_div5.hw, + [CLKID_FCLK_DIV7] = &axg_fclk_div7.hw, + [CLKID_GP0_PLL] = &axg_gp0_pll.hw, + [CLKID_MPEG_SEL] = &axg_mpeg_clk_sel.hw, + [CLKID_MPEG_DIV] = &axg_mpeg_clk_div.hw, + [CLKID_CLK81] = &axg_clk81.hw, + [CLKID_MPLL0] = &axg_mpll0.hw, + [CLKID_MPLL1] = &axg_mpll1.hw, + [CLKID_MPLL2] = &axg_mpll2.hw, + [CLKID_MPLL3] = &axg_mpll3.hw, + [CLKID_DDR] = &axg_ddr.hw, + [CLKID_AUDIO_LOCKER] = &axg_audio_locker.hw, + [CLKID_MIPI_DSI_HOST] = &axg_mipi_dsi_host.hw, + [CLKID_ISA] = &axg_isa.hw, + [CLKID_PL301] = &axg_pl301.hw, + [CLKID_PERIPHS] = &axg_periphs.hw, + [CLKID_SPICC0] = &axg_spicc_0.hw, + [CLKID_I2C] = &axg_i2c.hw, + [CLKID_RNG0] = &axg_rng0.hw, + [CLKID_UART0] = &axg_uart0.hw, + [CLKID_MIPI_DSI_PHY] = &axg_mipi_dsi_phy.hw, + [CLKID_SPICC1] = &axg_spicc_1.hw, + [CLKID_PCIE_A] = &axg_pcie_a.hw, + [CLKID_PCIE_B] = &axg_pcie_b.hw, + [CLKID_HIU_IFACE] = &axg_hiu_reg.hw, + [CLKID_ASSIST_MISC] = &axg_assist_misc.hw, + [CLKID_SD_EMMC_B] = &axg_emmc_b.hw, + [CLKID_SD_EMMC_C] = &axg_emmc_c.hw, + [CLKID_DMA] = &axg_dma.hw, + [CLKID_SPI] = &axg_spi.hw, + [CLKID_AUDIO] = &axg_audio.hw, + [CLKID_ETH] = &axg_eth_core.hw, + [CLKID_UART1] = &axg_uart1.hw, + [CLKID_G2D] = &axg_g2d.hw, + [CLKID_USB0] = &axg_usb0.hw, + [CLKID_USB1] = &axg_usb1.hw, + [CLKID_RESET] = &axg_reset.hw, + [CLKID_USB] = &axg_usb_general.hw, + [CLKID_AHB_ARB0] = &axg_ahb_arb0.hw, + [CLKID_EFUSE] = &axg_efuse.hw, + [CLKID_BOOT_ROM] = &axg_boot_rom.hw, + [CLKID_AHB_DATA_BUS] = &axg_ahb_data_bus.hw, + [CLKID_AHB_CTRL_BUS] = &axg_ahb_ctrl_bus.hw, + [CLKID_USB1_DDR_BRIDGE] = &axg_usb1_to_ddr.hw, + [CLKID_USB0_DDR_BRIDGE] = &axg_usb0_to_ddr.hw, + [CLKID_MMC_PCLK] = &axg_mmc_pclk.hw, + [CLKID_VPU_INTR] = &axg_vpu_intr.hw, + [CLKID_SEC_AHB_AHB3_BRIDGE] = &axg_sec_ahb_ahb3_bridge.hw, + [CLKID_GIC] = &axg_gic.hw, + [CLKID_AO_MEDIA_CPU] = &axg_ao_media_cpu.hw, + [CLKID_AO_AHB_SRAM] = &axg_ao_ahb_sram.hw, + [CLKID_AO_AHB_BUS] = &axg_ao_ahb_bus.hw, + [CLKID_AO_IFACE] = &axg_ao_iface.hw, + [CLKID_AO_I2C] = &axg_ao_i2c.hw, + [CLKID_SD_EMMC_B_CLK0_SEL] = &axg_sd_emmc_b_clk0_sel.hw, + [CLKID_SD_EMMC_B_CLK0_DIV] = &axg_sd_emmc_b_clk0_div.hw, + [CLKID_SD_EMMC_B_CLK0] = &axg_sd_emmc_b_clk0.hw, + [CLKID_SD_EMMC_C_CLK0_SEL] = &axg_sd_emmc_c_clk0_sel.hw, + [CLKID_SD_EMMC_C_CLK0_DIV] = &axg_sd_emmc_c_clk0_div.hw, + [CLKID_SD_EMMC_C_CLK0] = &axg_sd_emmc_c_clk0.hw, + [CLKID_MPLL0_DIV] = &axg_mpll0_div.hw, + [CLKID_MPLL1_DIV] = &axg_mpll1_div.hw, + [CLKID_MPLL2_DIV] = &axg_mpll2_div.hw, + [CLKID_MPLL3_DIV] = &axg_mpll3_div.hw, + [CLKID_HIFI_PLL] = &axg_hifi_pll.hw, + [CLKID_MPLL_PREDIV] = &axg_mpll_prediv.hw, + [CLKID_FCLK_DIV2_DIV] = &axg_fclk_div2_div.hw, + [CLKID_FCLK_DIV3_DIV] = &axg_fclk_div3_div.hw, + [CLKID_FCLK_DIV4_DIV] = &axg_fclk_div4_div.hw, + [CLKID_FCLK_DIV5_DIV] = &axg_fclk_div5_div.hw, + [CLKID_FCLK_DIV7_DIV] = &axg_fclk_div7_div.hw, + [CLKID_PCIE_PLL] = &axg_pcie_pll.hw, + [CLKID_PCIE_MUX] = &axg_pcie_mux.hw, + [CLKID_PCIE_REF] = &axg_pcie_ref.hw, + [CLKID_PCIE_CML_EN0] = &axg_pcie_cml_en0.hw, + [CLKID_PCIE_CML_EN1] = &axg_pcie_cml_en1.hw, + [CLKID_GEN_CLK_SEL] = &axg_gen_clk_sel.hw, + [CLKID_GEN_CLK_DIV] = &axg_gen_clk_div.hw, + [CLKID_GEN_CLK] = &axg_gen_clk.hw, + [CLKID_SYS_PLL_DCO] = &axg_sys_pll_dco.hw, + [CLKID_FIXED_PLL_DCO] = &axg_fixed_pll_dco.hw, + [CLKID_GP0_PLL_DCO] = &axg_gp0_pll_dco.hw, + [CLKID_HIFI_PLL_DCO] = &axg_hifi_pll_dco.hw, + [CLKID_PCIE_PLL_DCO] = &axg_pcie_pll_dco.hw, + [CLKID_PCIE_PLL_OD] = &axg_pcie_pll_od.hw, + [CLKID_VPU_0_DIV] = &axg_vpu_0_div.hw, + [CLKID_VPU_0_SEL] = &axg_vpu_0_sel.hw, + [CLKID_VPU_0] = &axg_vpu_0.hw, + [CLKID_VPU_1_DIV] = &axg_vpu_1_div.hw, + [CLKID_VPU_1_SEL] = &axg_vpu_1_sel.hw, + [CLKID_VPU_1] = &axg_vpu_1.hw, + [CLKID_VPU] = &axg_vpu.hw, + [CLKID_VAPB_0_DIV] = &axg_vapb_0_div.hw, + [CLKID_VAPB_0_SEL] = &axg_vapb_0_sel.hw, + [CLKID_VAPB_0] = &axg_vapb_0.hw, + [CLKID_VAPB_1_DIV] = &axg_vapb_1_div.hw, + [CLKID_VAPB_1_SEL] = &axg_vapb_1_sel.hw, + [CLKID_VAPB_1] = &axg_vapb_1.hw, + [CLKID_VAPB_SEL] = &axg_vapb_sel.hw, + [CLKID_VAPB] = &axg_vapb.hw, + [CLKID_VCLK] = &axg_vclk.hw, + [CLKID_VCLK2] = &axg_vclk2.hw, + [CLKID_VCLK_SEL] = &axg_vclk_sel.hw, + [CLKID_VCLK2_SEL] = &axg_vclk2_sel.hw, + [CLKID_VCLK_INPUT] = &axg_vclk_input.hw, + [CLKID_VCLK2_INPUT] = &axg_vclk2_input.hw, + [CLKID_VCLK_DIV] = &axg_vclk_div.hw, + [CLKID_VCLK2_DIV] = &axg_vclk2_div.hw, + [CLKID_VCLK_DIV2_EN] = &axg_vclk_div2_en.hw, + [CLKID_VCLK_DIV4_EN] = &axg_vclk_div4_en.hw, + [CLKID_VCLK_DIV6_EN] = &axg_vclk_div6_en.hw, + [CLKID_VCLK_DIV12_EN] = &axg_vclk_div12_en.hw, + [CLKID_VCLK2_DIV2_EN] = &axg_vclk2_div2_en.hw, + [CLKID_VCLK2_DIV4_EN] = &axg_vclk2_div4_en.hw, + [CLKID_VCLK2_DIV6_EN] = &axg_vclk2_div6_en.hw, + [CLKID_VCLK2_DIV12_EN] = &axg_vclk2_div12_en.hw, + [CLKID_VCLK_DIV1] = &axg_vclk_div1.hw, + [CLKID_VCLK_DIV2] = &axg_vclk_div2.hw, + [CLKID_VCLK_DIV4] = &axg_vclk_div4.hw, + [CLKID_VCLK_DIV6] = &axg_vclk_div6.hw, + [CLKID_VCLK_DIV12] = &axg_vclk_div12.hw, + [CLKID_VCLK2_DIV1] = &axg_vclk2_div1.hw, + [CLKID_VCLK2_DIV2] = &axg_vclk2_div2.hw, + [CLKID_VCLK2_DIV4] = &axg_vclk2_div4.hw, + [CLKID_VCLK2_DIV6] = &axg_vclk2_div6.hw, + [CLKID_VCLK2_DIV12] = &axg_vclk2_div12.hw, + [CLKID_CTS_ENCL_SEL] = &axg_cts_encl_sel.hw, + [CLKID_CTS_ENCL] = &axg_cts_encl.hw, + [CLKID_VDIN_MEAS_SEL] = &axg_vdin_meas_sel.hw, + [CLKID_VDIN_MEAS_DIV] = &axg_vdin_meas_div.hw, + [CLKID_VDIN_MEAS] = &axg_vdin_meas.hw, }; /* Convenience table to populate regmap in .probe */ @@ -2163,7 +2161,10 @@ static struct clk_regmap *const axg_clk_regmaps[] = { static const struct meson_eeclkc_data axg_clkc_data = { .regmap_clks = axg_clk_regmaps, .regmap_clk_num = ARRAY_SIZE(axg_clk_regmaps), - .hw_onecell_data = &axg_hw_onecell_data, + .hw_clks = { + .hws = axg_hw_clks, + .num = ARRAY_SIZE(axg_hw_clks), + }, }; |