18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (C) 2013 Texas Instruments Incorporated
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Hwmod present only in AM43x and those that differ other than register
58c2ecf20Sopenharmony_ci * offsets as compared to AM335x.
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 "omap_hwmod.h"
188c2ecf20Sopenharmony_ci#include "omap_hwmod_33xx_43xx_common_data.h"
198c2ecf20Sopenharmony_ci#include "prcm43xx.h"
208c2ecf20Sopenharmony_ci#include "omap_hwmod_common_data.h"
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* IP blocks */
238c2ecf20Sopenharmony_cistatic struct omap_hwmod am43xx_emif_hwmod = {
248c2ecf20Sopenharmony_ci	.name		= "emif",
258c2ecf20Sopenharmony_ci	.class		= &am33xx_emif_hwmod_class,
268c2ecf20Sopenharmony_ci	.clkdm_name	= "emif_clkdm",
278c2ecf20Sopenharmony_ci	.flags		= HWMOD_INIT_NO_IDLE,
288c2ecf20Sopenharmony_ci	.main_clk	= "dpll_ddr_m2_ck",
298c2ecf20Sopenharmony_ci	.prcm		= {
308c2ecf20Sopenharmony_ci		.omap4	= {
318c2ecf20Sopenharmony_ci			.clkctrl_offs	= AM43XX_CM_PER_EMIF_CLKCTRL_OFFSET,
328c2ecf20Sopenharmony_ci			.modulemode	= MODULEMODE_SWCTRL,
338c2ecf20Sopenharmony_ci		},
348c2ecf20Sopenharmony_ci	},
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic struct omap_hwmod am43xx_l4_hs_hwmod = {
388c2ecf20Sopenharmony_ci	.name		= "l4_hs",
398c2ecf20Sopenharmony_ci	.class		= &am33xx_l4_hwmod_class,
408c2ecf20Sopenharmony_ci	.clkdm_name	= "l3_clkdm",
418c2ecf20Sopenharmony_ci	.flags		= HWMOD_INIT_NO_IDLE,
428c2ecf20Sopenharmony_ci	.main_clk	= "l4hs_gclk",
438c2ecf20Sopenharmony_ci	.prcm		= {
448c2ecf20Sopenharmony_ci		.omap4	= {
458c2ecf20Sopenharmony_ci			.clkctrl_offs	= AM43XX_CM_PER_L4HS_CLKCTRL_OFFSET,
468c2ecf20Sopenharmony_ci			.modulemode	= MODULEMODE_SWCTRL,
478c2ecf20Sopenharmony_ci		},
488c2ecf20Sopenharmony_ci	},
498c2ecf20Sopenharmony_ci};
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistatic struct omap_hwmod_rst_info am33xx_wkup_m3_resets[] = {
528c2ecf20Sopenharmony_ci	{ .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 },
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic struct omap_hwmod am43xx_wkup_m3_hwmod = {
568c2ecf20Sopenharmony_ci	.name		= "wkup_m3",
578c2ecf20Sopenharmony_ci	.class		= &am33xx_wkup_m3_hwmod_class,
588c2ecf20Sopenharmony_ci	.clkdm_name	= "l4_wkup_aon_clkdm",
598c2ecf20Sopenharmony_ci	/* Keep hardreset asserted */
608c2ecf20Sopenharmony_ci	.flags		= HWMOD_INIT_NO_RESET | HWMOD_NO_IDLEST,
618c2ecf20Sopenharmony_ci	.main_clk	= "sys_clkin_ck",
628c2ecf20Sopenharmony_ci	.prcm		= {
638c2ecf20Sopenharmony_ci		.omap4	= {
648c2ecf20Sopenharmony_ci			.clkctrl_offs	= AM43XX_CM_WKUP_WKUP_M3_CLKCTRL_OFFSET,
658c2ecf20Sopenharmony_ci			.rstctrl_offs	= AM43XX_RM_WKUP_RSTCTRL_OFFSET,
668c2ecf20Sopenharmony_ci			.rstst_offs	= AM43XX_RM_WKUP_RSTST_OFFSET,
678c2ecf20Sopenharmony_ci			.modulemode	= MODULEMODE_SWCTRL,
688c2ecf20Sopenharmony_ci		},
698c2ecf20Sopenharmony_ci	},
708c2ecf20Sopenharmony_ci	.rst_lines	= am33xx_wkup_m3_resets,
718c2ecf20Sopenharmony_ci	.rst_lines_cnt	= ARRAY_SIZE(am33xx_wkup_m3_resets),
728c2ecf20Sopenharmony_ci};
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_cistatic struct omap_hwmod am43xx_control_hwmod = {
758c2ecf20Sopenharmony_ci	.name		= "control",
768c2ecf20Sopenharmony_ci	.class		= &am33xx_control_hwmod_class,
778c2ecf20Sopenharmony_ci	.clkdm_name	= "l4_wkup_clkdm",
788c2ecf20Sopenharmony_ci	.flags		= HWMOD_INIT_NO_IDLE,
798c2ecf20Sopenharmony_ci	.main_clk	= "sys_clkin_ck",
808c2ecf20Sopenharmony_ci	.prcm		= {
818c2ecf20Sopenharmony_ci		.omap4	= {
828c2ecf20Sopenharmony_ci			.clkctrl_offs	= AM43XX_CM_WKUP_CONTROL_CLKCTRL_OFFSET,
838c2ecf20Sopenharmony_ci			.modulemode	= MODULEMODE_SWCTRL,
848c2ecf20Sopenharmony_ci		},
858c2ecf20Sopenharmony_ci	},
868c2ecf20Sopenharmony_ci};
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* Interfaces */
898c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l3_main__emif = {
908c2ecf20Sopenharmony_ci	.master		= &am33xx_l3_main_hwmod,
918c2ecf20Sopenharmony_ci	.slave		= &am43xx_emif_hwmod,
928c2ecf20Sopenharmony_ci	.clk		= "dpll_core_m4_ck",
938c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU | OCP_USER_SDMA,
948c2ecf20Sopenharmony_ci};
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l3_main__l4_hs = {
978c2ecf20Sopenharmony_ci	.master		= &am33xx_l3_main_hwmod,
988c2ecf20Sopenharmony_ci	.slave		= &am43xx_l4_hs_hwmod,
998c2ecf20Sopenharmony_ci	.clk		= "l3s_gclk",
1008c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU | OCP_USER_SDMA,
1018c2ecf20Sopenharmony_ci};
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_wkup_m3__l4_wkup = {
1048c2ecf20Sopenharmony_ci	.master		= &am43xx_wkup_m3_hwmod,
1058c2ecf20Sopenharmony_ci	.slave		= &am33xx_l4_wkup_hwmod,
1068c2ecf20Sopenharmony_ci	.clk		= "sys_clkin_ck",
1078c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU | OCP_USER_SDMA,
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l4_wkup__wkup_m3 = {
1118c2ecf20Sopenharmony_ci	.master		= &am33xx_l4_wkup_hwmod,
1128c2ecf20Sopenharmony_ci	.slave		= &am43xx_wkup_m3_hwmod,
1138c2ecf20Sopenharmony_ci	.clk		= "sys_clkin_ck",
1148c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU | OCP_USER_SDMA,
1158c2ecf20Sopenharmony_ci};
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l4_wkup__smartreflex0 = {
1188c2ecf20Sopenharmony_ci	.master		= &am33xx_l4_wkup_hwmod,
1198c2ecf20Sopenharmony_ci	.slave		= &am33xx_smartreflex0_hwmod,
1208c2ecf20Sopenharmony_ci	.clk		= "sys_clkin_ck",
1218c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU,
1228c2ecf20Sopenharmony_ci};
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l4_wkup__smartreflex1 = {
1258c2ecf20Sopenharmony_ci	.master		= &am33xx_l4_wkup_hwmod,
1268c2ecf20Sopenharmony_ci	.slave		= &am33xx_smartreflex1_hwmod,
1278c2ecf20Sopenharmony_ci	.clk		= "sys_clkin_ck",
1288c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU,
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if am43xx_l4_wkup__control = {
1328c2ecf20Sopenharmony_ci	.master		= &am33xx_l4_wkup_hwmod,
1338c2ecf20Sopenharmony_ci	.slave		= &am43xx_control_hwmod,
1348c2ecf20Sopenharmony_ci	.clk		= "sys_clkin_ck",
1358c2ecf20Sopenharmony_ci	.user		= OCP_USER_MPU,
1368c2ecf20Sopenharmony_ci};
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_cistatic struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
1398c2ecf20Sopenharmony_ci	&am33xx_mpu__l3_main,
1408c2ecf20Sopenharmony_ci	&am33xx_mpu__prcm,
1418c2ecf20Sopenharmony_ci	&am33xx_l3_s__l4_ls,
1428c2ecf20Sopenharmony_ci	&am33xx_l3_s__l4_wkup,
1438c2ecf20Sopenharmony_ci	&am43xx_l3_main__l4_hs,
1448c2ecf20Sopenharmony_ci	&am33xx_l3_main__l3_s,
1458c2ecf20Sopenharmony_ci	&am33xx_l3_main__l3_instr,
1468c2ecf20Sopenharmony_ci	&am33xx_l3_s__l3_main,
1478c2ecf20Sopenharmony_ci	&am43xx_l3_main__emif,
1488c2ecf20Sopenharmony_ci	&am43xx_wkup_m3__l4_wkup,
1498c2ecf20Sopenharmony_ci	&am43xx_l4_wkup__wkup_m3,
1508c2ecf20Sopenharmony_ci	&am43xx_l4_wkup__control,
1518c2ecf20Sopenharmony_ci	&am43xx_l4_wkup__smartreflex0,
1528c2ecf20Sopenharmony_ci	&am43xx_l4_wkup__smartreflex1,
1538c2ecf20Sopenharmony_ci	&am33xx_l3_s__gpmc,
1548c2ecf20Sopenharmony_ci	&am33xx_l3_main__ocmc,
1558c2ecf20Sopenharmony_ci	NULL,
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ciint __init am43xx_hwmod_init(void)
1598c2ecf20Sopenharmony_ci{
1608c2ecf20Sopenharmony_ci	int ret;
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	omap_hwmod_am43xx_reg();
1638c2ecf20Sopenharmony_ci	omap_hwmod_init();
1648c2ecf20Sopenharmony_ci	ret = omap_hwmod_register_links(am43xx_hwmod_ocp_ifs);
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci	return ret;
1678c2ecf20Sopenharmony_ci}
168