18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * TI81XX Clock Domain data.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2010 Texas Instruments, Inc. - https://www.ti.com/
58c2ecf20Sopenharmony_ci * Copyright (C) 2013 SKTB SKiT, http://www.skitlab.ru/
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#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_81XX_H
188c2ecf20Sopenharmony_ci#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_81XX_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/kernel.h>
218c2ecf20Sopenharmony_ci#include <linux/io.h>
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#include "clockdomain.h"
248c2ecf20Sopenharmony_ci#include "cm81xx.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * Note that 814x seems to have HWSUP_SWSUP for many clockdomains
288c2ecf20Sopenharmony_ci * while 816x does not. According to the TRM, 816x only has HWSUP
298c2ecf20Sopenharmony_ci * for ALWON_L3_FAST. Also note that the TI tree clockdomains81xx.h
308c2ecf20Sopenharmony_ci * seems to have the related ifdef the wrong way around claiming
318c2ecf20Sopenharmony_ci * 816x supports HWSUP while 814x does not. For now, we only set
328c2ecf20Sopenharmony_ci * HWSUP for ALWON_L3_FAST as that seems to be supported for both
338c2ecf20Sopenharmony_ci * dm814x and dm816x.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Common for 81xx */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic struct clockdomain alwon_l3_slow_81xx_clkdm = {
398c2ecf20Sopenharmony_ci	.name		= "alwon_l3s_clkdm",
408c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
418c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
428c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_ALWON_L3_SLOW_CLKDM,
438c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cistatic struct clockdomain alwon_l3_med_81xx_clkdm = {
478c2ecf20Sopenharmony_ci	.name		= "alwon_l3_med_clkdm",
488c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
498c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
508c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_ALWON_L3_MED_CLKDM,
518c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic struct clockdomain alwon_l3_fast_81xx_clkdm = {
558c2ecf20Sopenharmony_ci	.name		= "alwon_l3_fast_clkdm",
568c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
578c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
588c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_ALWON_L3_FAST_CLKDM,
598c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_HWSUP_SWSUP,
608c2ecf20Sopenharmony_ci};
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_cistatic struct clockdomain alwon_ethernet_81xx_clkdm = {
638c2ecf20Sopenharmony_ci	.name		= "alwon_ethernet_clkdm",
648c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
658c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
668c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_ETHERNET_CLKDM,
678c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistatic struct clockdomain mmu_81xx_clkdm = {
718c2ecf20Sopenharmony_ci	.name		= "mmu_clkdm",
728c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
738c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
748c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_MMU_CLKDM,
758c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistatic struct clockdomain mmu_cfg_81xx_clkdm = {
798c2ecf20Sopenharmony_ci	.name		= "mmu_cfg_clkdm",
808c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
818c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
828c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_MMUCFG_CLKDM,
838c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistatic struct clockdomain default_l3_slow_81xx_clkdm = {
878c2ecf20Sopenharmony_ci	.name		= "default_l3_slow_clkdm",
888c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "default_pwrdm" },
898c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_DEFAULT_MOD,
908c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_DEFAULT_L3_SLOW_CLKDM,
918c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistatic struct clockdomain default_sata_81xx_clkdm = {
958c2ecf20Sopenharmony_ci	.name		= "default_clkdm",
968c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "default_pwrdm" },
978c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_DEFAULT_MOD,
988c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_DEFAULT_SATA_CLKDM,
998c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1008c2ecf20Sopenharmony_ci};
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* 816x only */
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_cistatic struct clockdomain alwon_mpu_816x_clkdm = {
1058c2ecf20Sopenharmony_ci	.name		= "alwon_mpu_clkdm",
1068c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "alwon_pwrdm" },
1078c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ALWON_MOD,
1088c2ecf20Sopenharmony_ci	.clkdm_offs	= TI81XX_CM_ALWON_MPU_CLKDM,
1098c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1108c2ecf20Sopenharmony_ci};
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_cistatic struct clockdomain active_gem_816x_clkdm = {
1138c2ecf20Sopenharmony_ci	.name		= "active_gem_clkdm",
1148c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "active_pwrdm" },
1158c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_ACTIVE_MOD,
1168c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_ACTIVE_GEM_CLKDM,
1178c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1188c2ecf20Sopenharmony_ci};
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_cistatic struct clockdomain ivahd0_816x_clkdm = {
1218c2ecf20Sopenharmony_ci	.name		= "ivahd0_clkdm",
1228c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "ivahd0_pwrdm" },
1238c2ecf20Sopenharmony_ci	.cm_inst	= TI816X_CM_IVAHD0_MOD,
1248c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_IVAHD0_CLKDM,
1258c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1268c2ecf20Sopenharmony_ci};
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_cistatic struct clockdomain ivahd1_816x_clkdm = {
1298c2ecf20Sopenharmony_ci	.name		= "ivahd1_clkdm",
1308c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "ivahd1_pwrdm" },
1318c2ecf20Sopenharmony_ci	.cm_inst	= TI816X_CM_IVAHD1_MOD,
1328c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_IVAHD1_CLKDM,
1338c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1348c2ecf20Sopenharmony_ci};
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cistatic struct clockdomain ivahd2_816x_clkdm = {
1378c2ecf20Sopenharmony_ci	.name		= "ivahd2_clkdm",
1388c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "ivahd2_pwrdm" },
1398c2ecf20Sopenharmony_ci	.cm_inst	= TI816X_CM_IVAHD2_MOD,
1408c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_IVAHD2_CLKDM,
1418c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1428c2ecf20Sopenharmony_ci};
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_cistatic struct clockdomain sgx_816x_clkdm = {
1458c2ecf20Sopenharmony_ci	.name		= "sgx_clkdm",
1468c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "sgx_pwrdm" },
1478c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_SGX_MOD,
1488c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_SGX_CLKDM,
1498c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistatic struct clockdomain default_l3_med_816x_clkdm = {
1538c2ecf20Sopenharmony_ci	.name		= "default_l3_med_clkdm",
1548c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "default_pwrdm" },
1558c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_DEFAULT_MOD,
1568c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_DEFAULT_L3_MED_CLKDM,
1578c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1588c2ecf20Sopenharmony_ci};
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_cistatic struct clockdomain default_ducati_816x_clkdm = {
1618c2ecf20Sopenharmony_ci	.name		= "default_ducati_clkdm",
1628c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "default_pwrdm" },
1638c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_DEFAULT_MOD,
1648c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_DEFAULT_DUCATI_CLKDM,
1658c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_cistatic struct clockdomain default_pci_816x_clkdm = {
1698c2ecf20Sopenharmony_ci	.name		= "default_pci_clkdm",
1708c2ecf20Sopenharmony_ci	.pwrdm		= { .name = "default_pwrdm" },
1718c2ecf20Sopenharmony_ci	.cm_inst	= TI81XX_CM_DEFAULT_MOD,
1728c2ecf20Sopenharmony_ci	.clkdm_offs	= TI816X_CM_DEFAULT_PCI_CLKDM,
1738c2ecf20Sopenharmony_ci	.flags		= CLKDM_CAN_SWSUP,
1748c2ecf20Sopenharmony_ci};
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_cistatic struct clockdomain *clockdomains_ti814x[] __initdata = {
1778c2ecf20Sopenharmony_ci	&alwon_l3_slow_81xx_clkdm,
1788c2ecf20Sopenharmony_ci	&alwon_l3_med_81xx_clkdm,
1798c2ecf20Sopenharmony_ci	&alwon_l3_fast_81xx_clkdm,
1808c2ecf20Sopenharmony_ci	&alwon_ethernet_81xx_clkdm,
1818c2ecf20Sopenharmony_ci	&mmu_81xx_clkdm,
1828c2ecf20Sopenharmony_ci	&mmu_cfg_81xx_clkdm,
1838c2ecf20Sopenharmony_ci	&default_l3_slow_81xx_clkdm,
1848c2ecf20Sopenharmony_ci	&default_sata_81xx_clkdm,
1858c2ecf20Sopenharmony_ci	NULL,
1868c2ecf20Sopenharmony_ci};
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_civoid __init ti814x_clockdomains_init(void)
1898c2ecf20Sopenharmony_ci{
1908c2ecf20Sopenharmony_ci	clkdm_register_platform_funcs(&am33xx_clkdm_operations);
1918c2ecf20Sopenharmony_ci	clkdm_register_clkdms(clockdomains_ti814x);
1928c2ecf20Sopenharmony_ci	clkdm_complete_init();
1938c2ecf20Sopenharmony_ci}
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_cistatic struct clockdomain *clockdomains_ti816x[] __initdata = {
1968c2ecf20Sopenharmony_ci	&alwon_mpu_816x_clkdm,
1978c2ecf20Sopenharmony_ci	&alwon_l3_slow_81xx_clkdm,
1988c2ecf20Sopenharmony_ci	&alwon_l3_med_81xx_clkdm,
1998c2ecf20Sopenharmony_ci	&alwon_l3_fast_81xx_clkdm,
2008c2ecf20Sopenharmony_ci	&alwon_ethernet_81xx_clkdm,
2018c2ecf20Sopenharmony_ci	&mmu_81xx_clkdm,
2028c2ecf20Sopenharmony_ci	&mmu_cfg_81xx_clkdm,
2038c2ecf20Sopenharmony_ci	&active_gem_816x_clkdm,
2048c2ecf20Sopenharmony_ci	&ivahd0_816x_clkdm,
2058c2ecf20Sopenharmony_ci	&ivahd1_816x_clkdm,
2068c2ecf20Sopenharmony_ci	&ivahd2_816x_clkdm,
2078c2ecf20Sopenharmony_ci	&sgx_816x_clkdm,
2088c2ecf20Sopenharmony_ci	&default_l3_med_816x_clkdm,
2098c2ecf20Sopenharmony_ci	&default_ducati_816x_clkdm,
2108c2ecf20Sopenharmony_ci	&default_pci_816x_clkdm,
2118c2ecf20Sopenharmony_ci	&default_l3_slow_81xx_clkdm,
2128c2ecf20Sopenharmony_ci	&default_sata_81xx_clkdm,
2138c2ecf20Sopenharmony_ci	NULL,
2148c2ecf20Sopenharmony_ci};
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_civoid __init ti816x_clockdomains_init(void)
2178c2ecf20Sopenharmony_ci{
2188c2ecf20Sopenharmony_ci	clkdm_register_platform_funcs(&am33xx_clkdm_operations);
2198c2ecf20Sopenharmony_ci	clkdm_register_clkdms(clockdomains_ti816x);
2208c2ecf20Sopenharmony_ci	clkdm_complete_init();
2218c2ecf20Sopenharmony_ci}
2228c2ecf20Sopenharmony_ci#endif
223