18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * AM33XX Clock Domain data.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2011-2012 Texas Instruments Incorporated - https://www.ti.com/
58c2ecf20Sopenharmony_ci * Vaibhav Hiremath <hvaibhav@ti.com>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or
88c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License as
98c2ecf20Sopenharmony_ci * published by the Free Software Foundation version 2.
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * This program is distributed "as is" WITHOUT ANY WARRANTY of any
128c2ecf20Sopenharmony_ci * kind, whether express or implied; without even the implied warranty
138c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
148c2ecf20Sopenharmony_ci * GNU General Public License for more details.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <linux/kernel.h>
188c2ecf20Sopenharmony_ci#include <linux/io.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include "clockdomain.h"
218c2ecf20Sopenharmony_ci#include "cm.h"
228c2ecf20Sopenharmony_ci#include "cm33xx.h"
238c2ecf20Sopenharmony_ci#include "cm-regbits-33xx.h"
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic struct clockdomain l4ls_am33xx_clkdm = {
268c2ecf20Sopenharmony_ci	.name		= "l4ls_clkdm",
278c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
288c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
298c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_L4LS_CLKSTCTRL_OFFSET,
308c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic struct clockdomain l3s_am33xx_clkdm = {
348c2ecf20Sopenharmony_ci	.name		= "l3s_clkdm",
358c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
368c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
378c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_L3S_CLKSTCTRL_OFFSET,
388c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistatic struct clockdomain l4fw_am33xx_clkdm = {
428c2ecf20Sopenharmony_ci	.name		= "l4fw_clkdm",
438c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
448c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
458c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_L4FW_CLKSTCTRL_OFFSET,
468c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic struct clockdomain l3_am33xx_clkdm = {
508c2ecf20Sopenharmony_ci	.name		= "l3_clkdm",
518c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
528c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
538c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_L3_CLKSTCTRL_OFFSET,
548c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistatic struct clockdomain l4hs_am33xx_clkdm = {
588c2ecf20Sopenharmony_ci	.name		= "l4hs_clkdm",
598c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
608c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
618c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_L4HS_CLKSTCTRL_OFFSET,
628c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
638c2ecf20Sopenharmony_ci};
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistatic struct clockdomain ocpwp_l3_am33xx_clkdm = {
668c2ecf20Sopenharmony_ci	.name		= "ocpwp_l3_clkdm",
678c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
688c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
698c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_OCPWP_L3_CLKSTCTRL_OFFSET,
708c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistatic struct clockdomain pruss_ocp_am33xx_clkdm = {
748c2ecf20Sopenharmony_ci	.name		= "pruss_ocp_clkdm",
758c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
768c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
778c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_PRUSS_CLKSTCTRL_OFFSET,
788c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic struct clockdomain cpsw_125mhz_am33xx_clkdm = {
828c2ecf20Sopenharmony_ci	.name		= "cpsw_125mhz_clkdm",
838c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
848c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
858c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_CPSW_CLKSTCTRL_OFFSET,
868c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistatic struct clockdomain lcdc_am33xx_clkdm = {
908c2ecf20Sopenharmony_ci	.name		= "lcdc_clkdm",
918c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
928c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
938c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_LCDC_CLKSTCTRL_OFFSET,
948c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistatic struct clockdomain clk_24mhz_am33xx_clkdm = {
988c2ecf20Sopenharmony_ci	.name		= "clk_24mhz_clkdm",
998c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "per_pwrdm" },
1008c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_PER_MOD,
1018c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_PER_CLK_24MHZ_CLKSTCTRL_OFFSET,
1028c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1038c2ecf20Sopenharmony_ci};
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_cistatic struct clockdomain l4_wkup_am33xx_clkdm = {
1068c2ecf20Sopenharmony_ci	.name		= "l4_wkup_clkdm",
1078c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "wkup_pwrdm" },
1088c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_WKUP_MOD,
1098c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_WKUP_CLKSTCTRL_OFFSET,
1108c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1118c2ecf20Sopenharmony_ci};
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_cistatic struct clockdomain l3_aon_am33xx_clkdm = {
1148c2ecf20Sopenharmony_ci	.name		= "l3_aon_clkdm",
1158c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "wkup_pwrdm" },
1168c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_WKUP_MOD,
1178c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_L3_AON_CLKSTCTRL_OFFSET,
1188c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1198c2ecf20Sopenharmony_ci};
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_cistatic struct clockdomain l4_wkup_aon_am33xx_clkdm = {
1228c2ecf20Sopenharmony_ci	.name		= "l4_wkup_aon_clkdm",
1238c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "wkup_pwrdm" },
1248c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_WKUP_MOD,
1258c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_L4_WKUP_AON_CLKSTCTRL_OFFSET,
1268c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1278c2ecf20Sopenharmony_ci};
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_cistatic struct clockdomain mpu_am33xx_clkdm = {
1308c2ecf20Sopenharmony_ci	.name		= "mpu_clkdm",
1318c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "mpu_pwrdm" },
1328c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_MPU_MOD,
1338c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_MPU_CLKSTCTRL_OFFSET,
1348c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1358c2ecf20Sopenharmony_ci};
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cistatic struct clockdomain l4_rtc_am33xx_clkdm = {
1388c2ecf20Sopenharmony_ci	.name		= "l4_rtc_clkdm",
1398c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "rtc_pwrdm" },
1408c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_RTC_MOD,
1418c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_RTC_CLKSTCTRL_OFFSET,
1428c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1438c2ecf20Sopenharmony_ci};
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistatic struct clockdomain gfx_l3_am33xx_clkdm = {
1468c2ecf20Sopenharmony_ci	.name		= "gfx_l3_clkdm",
1478c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "gfx_pwrdm" },
1488c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_GFX_MOD,
1498c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_GFX_L3_CLKSTCTRL_OFFSET,
1508c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1518c2ecf20Sopenharmony_ci};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_cistatic struct clockdomain gfx_l4ls_gfx_am33xx_clkdm = {
1548c2ecf20Sopenharmony_ci	.name		= "gfx_l4ls_gfx_clkdm",
1558c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "gfx_pwrdm" },
1568c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_GFX_MOD,
1578c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_GFX_L4LS_GFX_CLKSTCTRL__1_OFFSET,
1588c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cistatic struct clockdomain l4_cefuse_am33xx_clkdm = {
1628c2ecf20Sopenharmony_ci	.name		= "l4_cefuse_clkdm",
1638c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "cefuse_pwrdm" },
1648c2ecf20Sopenharmony_ci	.cm_inst	= AM33XX_CM_CEFUSE_MOD,
1658c2ecf20Sopenharmony_ci	.clkdm_offs	= AM33XX_CM_CEFUSE_CLKSTCTRL_OFFSET,
1668c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1678c2ecf20Sopenharmony_ci};
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_cistatic struct clockdomain *clockdomains_am33xx[] __initdata = {
1708c2ecf20Sopenharmony_ci	&l4ls_am33xx_clkdm,
1718c2ecf20Sopenharmony_ci	&l3s_am33xx_clkdm,
1728c2ecf20Sopenharmony_ci	&l4fw_am33xx_clkdm,
1738c2ecf20Sopenharmony_ci	&l3_am33xx_clkdm,
1748c2ecf20Sopenharmony_ci	&l4hs_am33xx_clkdm,
1758c2ecf20Sopenharmony_ci	&ocpwp_l3_am33xx_clkdm,
1768c2ecf20Sopenharmony_ci	&pruss_ocp_am33xx_clkdm,
1778c2ecf20Sopenharmony_ci	&cpsw_125mhz_am33xx_clkdm,
1788c2ecf20Sopenharmony_ci	&lcdc_am33xx_clkdm,
1798c2ecf20Sopenharmony_ci	&clk_24mhz_am33xx_clkdm,
1808c2ecf20Sopenharmony_ci	&l4_wkup_am33xx_clkdm,
1818c2ecf20Sopenharmony_ci	&l3_aon_am33xx_clkdm,
1828c2ecf20Sopenharmony_ci	&l4_wkup_aon_am33xx_clkdm,
1838c2ecf20Sopenharmony_ci	&mpu_am33xx_clkdm,
1848c2ecf20Sopenharmony_ci	&l4_rtc_am33xx_clkdm,
1858c2ecf20Sopenharmony_ci	&gfx_l3_am33xx_clkdm,
1868c2ecf20Sopenharmony_ci	&gfx_l4ls_gfx_am33xx_clkdm,
1878c2ecf20Sopenharmony_ci	&l4_cefuse_am33xx_clkdm,
1888c2ecf20Sopenharmony_ci	NULL,
1898c2ecf20Sopenharmony_ci};
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_civoid __init am33xx_clockdomains_init(void)
1928c2ecf20Sopenharmony_ci{
1938c2ecf20Sopenharmony_ci	clkdm_register_platform_funcs(&am33xx_clkdm_operations);
1948c2ecf20Sopenharmony_ci	clkdm_register_clkdms(clockdomains_am33xx);
1958c2ecf20Sopenharmony_ci	clkdm_complete_init();
1968c2ecf20Sopenharmony_ci}
197