18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * omap_hwmod macros, structures 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2009-2011 Nokia Corporation 68c2ecf20Sopenharmony_ci * Copyright (C) 2011-2012 Texas Instruments, Inc. 78c2ecf20Sopenharmony_ci * Paul Walmsley 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Created in collaboration with (alphabetical order): Benoît Cousson, 108c2ecf20Sopenharmony_ci * Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram Pandita, Sakari 118c2ecf20Sopenharmony_ci * Poussa, Anand Sawant, Santosh Shilimkar, Richard Woodruff 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * These headers and macros are used to define OMAP on-chip module 148c2ecf20Sopenharmony_ci * data and their integration with other OMAP modules and Linux. 158c2ecf20Sopenharmony_ci * Copious documentation and references can also be found in the 168c2ecf20Sopenharmony_ci * omap_hwmod code, in arch/arm/mach-omap2/omap_hwmod.c (as of this 178c2ecf20Sopenharmony_ci * writing). 188c2ecf20Sopenharmony_ci * 198c2ecf20Sopenharmony_ci * To do: 208c2ecf20Sopenharmony_ci * - add interconnect error log structures 218c2ecf20Sopenharmony_ci * - init_conn_id_bit (CONNID_BIT_VECTOR) 228c2ecf20Sopenharmony_ci * - implement default hwmod SMS/SDRC flags? 238c2ecf20Sopenharmony_ci * - move Linux-specific data ("non-ROM data") out 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H 268c2ecf20Sopenharmony_ci#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_HWMOD_H 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#include <linux/kernel.h> 298c2ecf20Sopenharmony_ci#include <linux/init.h> 308c2ecf20Sopenharmony_ci#include <linux/list.h> 318c2ecf20Sopenharmony_ci#include <linux/ioport.h> 328c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct omap_device; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciextern struct sysc_regbits omap_hwmod_sysc_type1; 378c2ecf20Sopenharmony_ciextern struct sysc_regbits omap_hwmod_sysc_type2; 388c2ecf20Sopenharmony_ciextern struct sysc_regbits omap_hwmod_sysc_type3; 398c2ecf20Sopenharmony_ciextern struct sysc_regbits omap34xx_sr_sysc_fields; 408c2ecf20Sopenharmony_ciextern struct sysc_regbits omap36xx_sr_sysc_fields; 418c2ecf20Sopenharmony_ciextern struct sysc_regbits omap3_sham_sysc_fields; 428c2ecf20Sopenharmony_ciextern struct sysc_regbits omap3xxx_aes_sysc_fields; 438c2ecf20Sopenharmony_ciextern struct sysc_regbits omap_hwmod_sysc_type_mcasp; 448c2ecf20Sopenharmony_ciextern struct sysc_regbits omap_hwmod_sysc_type_usb_host_fs; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* 478c2ecf20Sopenharmony_ci * OCP SYSCONFIG bit shifts/masks TYPE1. These are for IPs compliant 488c2ecf20Sopenharmony_ci * with the original PRCM protocol defined for OMAP2420 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci#define SYSC_TYPE1_MIDLEMODE_SHIFT 12 518c2ecf20Sopenharmony_ci#define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_TYPE1_MIDLEMODE_SHIFT) 528c2ecf20Sopenharmony_ci#define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8 538c2ecf20Sopenharmony_ci#define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_TYPE1_CLOCKACTIVITY_SHIFT) 548c2ecf20Sopenharmony_ci#define SYSC_TYPE1_SIDLEMODE_SHIFT 3 558c2ecf20Sopenharmony_ci#define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_TYPE1_SIDLEMODE_SHIFT) 568c2ecf20Sopenharmony_ci#define SYSC_TYPE1_ENAWAKEUP_SHIFT 2 578c2ecf20Sopenharmony_ci#define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_TYPE1_ENAWAKEUP_SHIFT) 588c2ecf20Sopenharmony_ci#define SYSC_TYPE1_SOFTRESET_SHIFT 1 598c2ecf20Sopenharmony_ci#define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_TYPE1_SOFTRESET_SHIFT) 608c2ecf20Sopenharmony_ci#define SYSC_TYPE1_AUTOIDLE_SHIFT 0 618c2ecf20Sopenharmony_ci#define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_TYPE1_AUTOIDLE_SHIFT) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* 648c2ecf20Sopenharmony_ci * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant 658c2ecf20Sopenharmony_ci * with the new PRCM protocol defined for new OMAP4 IPs. 668c2ecf20Sopenharmony_ci */ 678c2ecf20Sopenharmony_ci#define SYSC_TYPE2_SOFTRESET_SHIFT 0 688c2ecf20Sopenharmony_ci#define SYSC_TYPE2_SOFTRESET_MASK (1 << SYSC_TYPE2_SOFTRESET_SHIFT) 698c2ecf20Sopenharmony_ci#define SYSC_TYPE2_SIDLEMODE_SHIFT 2 708c2ecf20Sopenharmony_ci#define SYSC_TYPE2_SIDLEMODE_MASK (0x3 << SYSC_TYPE2_SIDLEMODE_SHIFT) 718c2ecf20Sopenharmony_ci#define SYSC_TYPE2_MIDLEMODE_SHIFT 4 728c2ecf20Sopenharmony_ci#define SYSC_TYPE2_MIDLEMODE_MASK (0x3 << SYSC_TYPE2_MIDLEMODE_SHIFT) 738c2ecf20Sopenharmony_ci#define SYSC_TYPE2_DMADISABLE_SHIFT 16 748c2ecf20Sopenharmony_ci#define SYSC_TYPE2_DMADISABLE_MASK (0x1 << SYSC_TYPE2_DMADISABLE_SHIFT) 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci/* 778c2ecf20Sopenharmony_ci * OCP SYSCONFIG bit shifts/masks TYPE3. 788c2ecf20Sopenharmony_ci * This is applicable for some IPs present in AM33XX 798c2ecf20Sopenharmony_ci */ 808c2ecf20Sopenharmony_ci#define SYSC_TYPE3_SIDLEMODE_SHIFT 0 818c2ecf20Sopenharmony_ci#define SYSC_TYPE3_SIDLEMODE_MASK (0x3 << SYSC_TYPE3_SIDLEMODE_SHIFT) 828c2ecf20Sopenharmony_ci#define SYSC_TYPE3_MIDLEMODE_SHIFT 2 838c2ecf20Sopenharmony_ci#define SYSC_TYPE3_MIDLEMODE_MASK (0x3 << SYSC_TYPE3_MIDLEMODE_SHIFT) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* OCP SYSSTATUS bit shifts/masks */ 868c2ecf20Sopenharmony_ci#define SYSS_RESETDONE_SHIFT 0 878c2ecf20Sopenharmony_ci#define SYSS_RESETDONE_MASK (1 << SYSS_RESETDONE_SHIFT) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* Master standby/slave idle mode flags */ 908c2ecf20Sopenharmony_ci#define HWMOD_IDLEMODE_FORCE (1 << 0) 918c2ecf20Sopenharmony_ci#define HWMOD_IDLEMODE_NO (1 << 1) 928c2ecf20Sopenharmony_ci#define HWMOD_IDLEMODE_SMART (1 << 2) 938c2ecf20Sopenharmony_ci#define HWMOD_IDLEMODE_SMART_WKUP (1 << 3) 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* modulemode control type (SW or HW) */ 968c2ecf20Sopenharmony_ci#define MODULEMODE_HWCTRL 1 978c2ecf20Sopenharmony_ci#define MODULEMODE_SWCTRL 2 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART1_FLAGS 0 1008c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART2_FLAGS 0 1018c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART3_FLAGS 0 1028c2ecf20Sopenharmony_ci#define DEBUG_OMAP3UART3_FLAGS 0 1038c2ecf20Sopenharmony_ci#define DEBUG_OMAP3UART4_FLAGS 0 1048c2ecf20Sopenharmony_ci#define DEBUG_OMAP4UART3_FLAGS 0 1058c2ecf20Sopenharmony_ci#define DEBUG_OMAP4UART4_FLAGS 0 1068c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART1_FLAGS 0 1078c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART2_FLAGS 0 1088c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART3_FLAGS 0 1098c2ecf20Sopenharmony_ci#define DEBUG_AM33XXUART1_FLAGS 0 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define DEBUG_OMAPUART_FLAGS (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#ifdef CONFIG_OMAP_GPMC_DEBUG 1148c2ecf20Sopenharmony_ci#define DEBUG_OMAP_GPMC_HWMOD_FLAGS HWMOD_INIT_NO_RESET 1158c2ecf20Sopenharmony_ci#else 1168c2ecf20Sopenharmony_ci#define DEBUG_OMAP_GPMC_HWMOD_FLAGS 0 1178c2ecf20Sopenharmony_ci#endif 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#if defined(CONFIG_DEBUG_OMAP2UART1) 1208c2ecf20Sopenharmony_ci#undef DEBUG_OMAP2UART1_FLAGS 1218c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART1_FLAGS DEBUG_OMAPUART_FLAGS 1228c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP2UART2) 1238c2ecf20Sopenharmony_ci#undef DEBUG_OMAP2UART2_FLAGS 1248c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART2_FLAGS DEBUG_OMAPUART_FLAGS 1258c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP2UART3) 1268c2ecf20Sopenharmony_ci#undef DEBUG_OMAP2UART3_FLAGS 1278c2ecf20Sopenharmony_ci#define DEBUG_OMAP2UART3_FLAGS DEBUG_OMAPUART_FLAGS 1288c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP3UART3) 1298c2ecf20Sopenharmony_ci#undef DEBUG_OMAP3UART3_FLAGS 1308c2ecf20Sopenharmony_ci#define DEBUG_OMAP3UART3_FLAGS DEBUG_OMAPUART_FLAGS 1318c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP3UART4) 1328c2ecf20Sopenharmony_ci#undef DEBUG_OMAP3UART4_FLAGS 1338c2ecf20Sopenharmony_ci#define DEBUG_OMAP3UART4_FLAGS DEBUG_OMAPUART_FLAGS 1348c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP4UART3) 1358c2ecf20Sopenharmony_ci#undef DEBUG_OMAP4UART3_FLAGS 1368c2ecf20Sopenharmony_ci#define DEBUG_OMAP4UART3_FLAGS DEBUG_OMAPUART_FLAGS 1378c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_OMAP4UART4) 1388c2ecf20Sopenharmony_ci#undef DEBUG_OMAP4UART4_FLAGS 1398c2ecf20Sopenharmony_ci#define DEBUG_OMAP4UART4_FLAGS DEBUG_OMAPUART_FLAGS 1408c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_TI81XXUART1) 1418c2ecf20Sopenharmony_ci#undef DEBUG_TI81XXUART1_FLAGS 1428c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART1_FLAGS DEBUG_OMAPUART_FLAGS 1438c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_TI81XXUART2) 1448c2ecf20Sopenharmony_ci#undef DEBUG_TI81XXUART2_FLAGS 1458c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART2_FLAGS DEBUG_OMAPUART_FLAGS 1468c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_TI81XXUART3) 1478c2ecf20Sopenharmony_ci#undef DEBUG_TI81XXUART3_FLAGS 1488c2ecf20Sopenharmony_ci#define DEBUG_TI81XXUART3_FLAGS DEBUG_OMAPUART_FLAGS 1498c2ecf20Sopenharmony_ci#elif defined(CONFIG_DEBUG_AM33XXUART1) 1508c2ecf20Sopenharmony_ci#undef DEBUG_AM33XXUART1_FLAGS 1518c2ecf20Sopenharmony_ci#define DEBUG_AM33XXUART1_FLAGS DEBUG_OMAPUART_FLAGS 1528c2ecf20Sopenharmony_ci#endif 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/** 1558c2ecf20Sopenharmony_ci * struct omap_hwmod_rst_info - IPs reset lines use by hwmod 1568c2ecf20Sopenharmony_ci * @name: name of the reset line (module local name) 1578c2ecf20Sopenharmony_ci * @rst_shift: Offset of the reset bit 1588c2ecf20Sopenharmony_ci * @st_shift: Offset of the reset status bit (OMAP2/3 only) 1598c2ecf20Sopenharmony_ci * 1608c2ecf20Sopenharmony_ci * @name should be something short, e.g., "cpu0" or "rst". It is defined 1618c2ecf20Sopenharmony_ci * locally to the hwmod. 1628c2ecf20Sopenharmony_ci */ 1638c2ecf20Sopenharmony_cistruct omap_hwmod_rst_info { 1648c2ecf20Sopenharmony_ci const char *name; 1658c2ecf20Sopenharmony_ci u8 rst_shift; 1668c2ecf20Sopenharmony_ci u8 st_shift; 1678c2ecf20Sopenharmony_ci}; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/** 1708c2ecf20Sopenharmony_ci * struct omap_hwmod_opt_clk - optional clocks used by this hwmod 1718c2ecf20Sopenharmony_ci * @role: "sys", "32k", "tv", etc -- for use in clk_get() 1728c2ecf20Sopenharmony_ci * @clk: opt clock: OMAP clock name 1738c2ecf20Sopenharmony_ci * @_clk: pointer to the struct clk (filled in at runtime) 1748c2ecf20Sopenharmony_ci * 1758c2ecf20Sopenharmony_ci * The module's interface clock and main functional clock should not 1768c2ecf20Sopenharmony_ci * be added as optional clocks. 1778c2ecf20Sopenharmony_ci */ 1788c2ecf20Sopenharmony_cistruct omap_hwmod_opt_clk { 1798c2ecf20Sopenharmony_ci const char *role; 1808c2ecf20Sopenharmony_ci const char *clk; 1818c2ecf20Sopenharmony_ci struct clk *_clk; 1828c2ecf20Sopenharmony_ci}; 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci/* omap_hwmod_omap2_firewall.flags bits */ 1868c2ecf20Sopenharmony_ci#define OMAP_FIREWALL_L3 (1 << 0) 1878c2ecf20Sopenharmony_ci#define OMAP_FIREWALL_L4 (1 << 1) 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci/** 1908c2ecf20Sopenharmony_ci * struct omap_hwmod_omap2_firewall - OMAP2/3 device firewall data 1918c2ecf20Sopenharmony_ci * @l3_perm_bit: bit shift for L3_PM_*_PERMISSION_* 1928c2ecf20Sopenharmony_ci * @l4_fw_region: L4 firewall region ID 1938c2ecf20Sopenharmony_ci * @l4_prot_group: L4 protection group ID 1948c2ecf20Sopenharmony_ci * @flags: (see omap_hwmod_omap2_firewall.flags macros above) 1958c2ecf20Sopenharmony_ci */ 1968c2ecf20Sopenharmony_cistruct omap_hwmod_omap2_firewall { 1978c2ecf20Sopenharmony_ci u8 l3_perm_bit; 1988c2ecf20Sopenharmony_ci u8 l4_fw_region; 1998c2ecf20Sopenharmony_ci u8 l4_prot_group; 2008c2ecf20Sopenharmony_ci u8 flags; 2018c2ecf20Sopenharmony_ci}; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci/* 2048c2ecf20Sopenharmony_ci * omap_hwmod_ocp_if.user bits: these indicate the initiators that use this 2058c2ecf20Sopenharmony_ci * interface to interact with the hwmod. Used to add sleep dependencies 2068c2ecf20Sopenharmony_ci * when the module is enabled or disabled. 2078c2ecf20Sopenharmony_ci */ 2088c2ecf20Sopenharmony_ci#define OCP_USER_MPU (1 << 0) 2098c2ecf20Sopenharmony_ci#define OCP_USER_SDMA (1 << 1) 2108c2ecf20Sopenharmony_ci#define OCP_USER_DSP (1 << 2) 2118c2ecf20Sopenharmony_ci#define OCP_USER_IVA (1 << 3) 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci/* omap_hwmod_ocp_if.flags bits */ 2148c2ecf20Sopenharmony_ci#define OCPIF_SWSUP_IDLE (1 << 0) 2158c2ecf20Sopenharmony_ci#define OCPIF_CAN_BURST (1 << 1) 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci/* omap_hwmod_ocp_if._int_flags possibilities */ 2188c2ecf20Sopenharmony_ci#define _OCPIF_INT_FLAGS_REGISTERED (1 << 0) 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci/** 2228c2ecf20Sopenharmony_ci * struct omap_hwmod_ocp_if - OCP interface data 2238c2ecf20Sopenharmony_ci * @master: struct omap_hwmod that initiates OCP transactions on this link 2248c2ecf20Sopenharmony_ci * @slave: struct omap_hwmod that responds to OCP transactions on this link 2258c2ecf20Sopenharmony_ci * @addr: address space associated with this link 2268c2ecf20Sopenharmony_ci * @clk: interface clock: OMAP clock name 2278c2ecf20Sopenharmony_ci * @_clk: pointer to the interface struct clk (filled in at runtime) 2288c2ecf20Sopenharmony_ci * @fw: interface firewall data 2298c2ecf20Sopenharmony_ci * @width: OCP data width 2308c2ecf20Sopenharmony_ci * @user: initiators using this interface (see OCP_USER_* macros above) 2318c2ecf20Sopenharmony_ci * @flags: OCP interface flags (see OCPIF_* macros above) 2328c2ecf20Sopenharmony_ci * @_int_flags: internal flags (see _OCPIF_INT_FLAGS* macros above) 2338c2ecf20Sopenharmony_ci * 2348c2ecf20Sopenharmony_ci * It may also be useful to add a tag_cnt field for OCP2.x devices. 2358c2ecf20Sopenharmony_ci * 2368c2ecf20Sopenharmony_ci * Parameter names beginning with an underscore are managed internally by 2378c2ecf20Sopenharmony_ci * the omap_hwmod code and should not be set during initialization. 2388c2ecf20Sopenharmony_ci */ 2398c2ecf20Sopenharmony_cistruct omap_hwmod_ocp_if { 2408c2ecf20Sopenharmony_ci struct omap_hwmod *master; 2418c2ecf20Sopenharmony_ci struct omap_hwmod *slave; 2428c2ecf20Sopenharmony_ci struct omap_hwmod_addr_space *addr; 2438c2ecf20Sopenharmony_ci const char *clk; 2448c2ecf20Sopenharmony_ci struct clk *_clk; 2458c2ecf20Sopenharmony_ci struct list_head node; 2468c2ecf20Sopenharmony_ci union { 2478c2ecf20Sopenharmony_ci struct omap_hwmod_omap2_firewall omap2; 2488c2ecf20Sopenharmony_ci } fw; 2498c2ecf20Sopenharmony_ci u8 width; 2508c2ecf20Sopenharmony_ci u8 user; 2518c2ecf20Sopenharmony_ci u8 flags; 2528c2ecf20Sopenharmony_ci u8 _int_flags; 2538c2ecf20Sopenharmony_ci}; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci/* Macros for use in struct omap_hwmod_sysconfig */ 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci/* Flags for use in omap_hwmod_sysconfig.idlemodes */ 2598c2ecf20Sopenharmony_ci#define MASTER_STANDBY_SHIFT 4 2608c2ecf20Sopenharmony_ci#define SLAVE_IDLE_SHIFT 0 2618c2ecf20Sopenharmony_ci#define SIDLE_FORCE (HWMOD_IDLEMODE_FORCE << SLAVE_IDLE_SHIFT) 2628c2ecf20Sopenharmony_ci#define SIDLE_NO (HWMOD_IDLEMODE_NO << SLAVE_IDLE_SHIFT) 2638c2ecf20Sopenharmony_ci#define SIDLE_SMART (HWMOD_IDLEMODE_SMART << SLAVE_IDLE_SHIFT) 2648c2ecf20Sopenharmony_ci#define SIDLE_SMART_WKUP (HWMOD_IDLEMODE_SMART_WKUP << SLAVE_IDLE_SHIFT) 2658c2ecf20Sopenharmony_ci#define MSTANDBY_FORCE (HWMOD_IDLEMODE_FORCE << MASTER_STANDBY_SHIFT) 2668c2ecf20Sopenharmony_ci#define MSTANDBY_NO (HWMOD_IDLEMODE_NO << MASTER_STANDBY_SHIFT) 2678c2ecf20Sopenharmony_ci#define MSTANDBY_SMART (HWMOD_IDLEMODE_SMART << MASTER_STANDBY_SHIFT) 2688c2ecf20Sopenharmony_ci#define MSTANDBY_SMART_WKUP (HWMOD_IDLEMODE_SMART_WKUP << MASTER_STANDBY_SHIFT) 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci/* omap_hwmod_sysconfig.sysc_flags capability flags */ 2718c2ecf20Sopenharmony_ci#define SYSC_HAS_AUTOIDLE (1 << 0) 2728c2ecf20Sopenharmony_ci#define SYSC_HAS_SOFTRESET (1 << 1) 2738c2ecf20Sopenharmony_ci#define SYSC_HAS_ENAWAKEUP (1 << 2) 2748c2ecf20Sopenharmony_ci#define SYSC_HAS_EMUFREE (1 << 3) 2758c2ecf20Sopenharmony_ci#define SYSC_HAS_CLOCKACTIVITY (1 << 4) 2768c2ecf20Sopenharmony_ci#define SYSC_HAS_SIDLEMODE (1 << 5) 2778c2ecf20Sopenharmony_ci#define SYSC_HAS_MIDLEMODE (1 << 6) 2788c2ecf20Sopenharmony_ci#define SYSS_HAS_RESET_STATUS (1 << 7) 2798c2ecf20Sopenharmony_ci#define SYSC_NO_CACHE (1 << 8) /* XXX SW flag, belongs elsewhere */ 2808c2ecf20Sopenharmony_ci#define SYSC_HAS_RESET_STATUS (1 << 9) 2818c2ecf20Sopenharmony_ci#define SYSC_HAS_DMADISABLE (1 << 10) 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* omap_hwmod_sysconfig.clockact flags */ 2848c2ecf20Sopenharmony_ci#define CLOCKACT_TEST_BOTH 0x0 2858c2ecf20Sopenharmony_ci#define CLOCKACT_TEST_MAIN 0x1 2868c2ecf20Sopenharmony_ci#define CLOCKACT_TEST_ICLK 0x2 2878c2ecf20Sopenharmony_ci#define CLOCKACT_TEST_NONE 0x3 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/** 2908c2ecf20Sopenharmony_ci * struct omap_hwmod_class_sysconfig - hwmod class OCP_SYS* data 2918c2ecf20Sopenharmony_ci * @rev_offs: IP block revision register offset (from module base addr) 2928c2ecf20Sopenharmony_ci * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 2938c2ecf20Sopenharmony_ci * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 2948c2ecf20Sopenharmony_ci * @srst_udelay: Delay needed after doing a softreset in usecs 2958c2ecf20Sopenharmony_ci * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} 2968c2ecf20Sopenharmony_ci * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported 2978c2ecf20Sopenharmony_ci * @clockact: the default value of the module CLOCKACTIVITY bits 2988c2ecf20Sopenharmony_ci * 2998c2ecf20Sopenharmony_ci * @clockact describes to the module which clocks are likely to be 3008c2ecf20Sopenharmony_ci * disabled when the PRCM issues its idle request to the module. Some 3018c2ecf20Sopenharmony_ci * modules have separate clockdomains for the interface clock and main 3028c2ecf20Sopenharmony_ci * functional clock, and can check whether they should acknowledge the 3038c2ecf20Sopenharmony_ci * idle request based on the internal module functionality that has 3048c2ecf20Sopenharmony_ci * been associated with the clocks marked in @clockact. This field is 3058c2ecf20Sopenharmony_ci * only used if HWMOD_SET_DEFAULT_CLOCKACT is set (see below) 3068c2ecf20Sopenharmony_ci * 3078c2ecf20Sopenharmony_ci * @sysc_fields: structure containing the offset positions of various bits in 3088c2ecf20Sopenharmony_ci * SYSCONFIG register. This can be populated using omap_hwmod_sysc_type1 or 3098c2ecf20Sopenharmony_ci * omap_hwmod_sysc_type2 defined in omap_hwmod_common_data.c depending on 3108c2ecf20Sopenharmony_ci * whether the device ip is compliant with the original PRCM protocol 3118c2ecf20Sopenharmony_ci * defined for OMAP2420 or the new PRCM protocol for new OMAP4 IPs. 3128c2ecf20Sopenharmony_ci * If the device follows a different scheme for the sysconfig register , 3138c2ecf20Sopenharmony_ci * then this field has to be populated with the correct offset structure. 3148c2ecf20Sopenharmony_ci */ 3158c2ecf20Sopenharmony_cistruct omap_hwmod_class_sysconfig { 3168c2ecf20Sopenharmony_ci s32 rev_offs; 3178c2ecf20Sopenharmony_ci s32 sysc_offs; 3188c2ecf20Sopenharmony_ci s32 syss_offs; 3198c2ecf20Sopenharmony_ci u16 sysc_flags; 3208c2ecf20Sopenharmony_ci struct sysc_regbits *sysc_fields; 3218c2ecf20Sopenharmony_ci u8 srst_udelay; 3228c2ecf20Sopenharmony_ci u8 idlemodes; 3238c2ecf20Sopenharmony_ci}; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci/** 3268c2ecf20Sopenharmony_ci * struct omap_hwmod_omap2_prcm - OMAP2/3-specific PRCM data 3278c2ecf20Sopenharmony_ci * @module_offs: PRCM submodule offset from the start of the PRM/CM 3288c2ecf20Sopenharmony_ci * @idlest_reg_id: IDLEST register ID (e.g., 3 for CM_IDLEST3) 3298c2ecf20Sopenharmony_ci * @idlest_idle_bit: register bit shift for CM_IDLEST slave idle bit 3308c2ecf20Sopenharmony_ci * 3318c2ecf20Sopenharmony_ci * @prcm_reg_id and @module_bit are specific to the AUTOIDLE, WKST, 3328c2ecf20Sopenharmony_ci * WKEN, GRPSEL registers. In an ideal world, no extra information 3338c2ecf20Sopenharmony_ci * would be needed for IDLEST information, but alas, there are some 3348c2ecf20Sopenharmony_ci * exceptions, so @idlest_reg_id, @idlest_idle_bit, @idlest_stdby_bit 3358c2ecf20Sopenharmony_ci * are needed for the IDLEST registers (c.f. 2430 I2CHS, 3430 USBHOST) 3368c2ecf20Sopenharmony_ci */ 3378c2ecf20Sopenharmony_cistruct omap_hwmod_omap2_prcm { 3388c2ecf20Sopenharmony_ci s16 module_offs; 3398c2ecf20Sopenharmony_ci u8 idlest_reg_id; 3408c2ecf20Sopenharmony_ci u8 idlest_idle_bit; 3418c2ecf20Sopenharmony_ci}; 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci/* 3448c2ecf20Sopenharmony_ci * Possible values for struct omap_hwmod_omap4_prcm.flags 3458c2ecf20Sopenharmony_ci * 3468c2ecf20Sopenharmony_ci * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM 3478c2ecf20Sopenharmony_ci * module-level context loss register associated with them; this 3488c2ecf20Sopenharmony_ci * flag bit should be set in those cases 3498c2ecf20Sopenharmony_ci * HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET: Some IP blocks have a valid CLKCTRL 3508c2ecf20Sopenharmony_ci * offset of zero; this flag bit should be set in those cases to 3518c2ecf20Sopenharmony_ci * distinguish from hwmods that have no clkctrl offset. 3528c2ecf20Sopenharmony_ci * HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK: Module clockctrl clock is managed 3538c2ecf20Sopenharmony_ci * by the common clock framework and not hwmod. 3548c2ecf20Sopenharmony_ci */ 3558c2ecf20Sopenharmony_ci#define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0) 3568c2ecf20Sopenharmony_ci#define HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET (1 << 1) 3578c2ecf20Sopenharmony_ci#define HWMOD_OMAP4_CLKFWK_CLKCTR_CLOCK (1 << 2) 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci/** 3608c2ecf20Sopenharmony_ci * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data 3618c2ecf20Sopenharmony_ci * @clkctrl_offs: offset of the PRCM clock control register 3628c2ecf20Sopenharmony_ci * @rstctrl_offs: offset of the XXX_RSTCTRL register located in the PRM 3638c2ecf20Sopenharmony_ci * @context_offs: offset of the RM_*_CONTEXT register 3648c2ecf20Sopenharmony_ci * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register 3658c2ecf20Sopenharmony_ci * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM 3668c2ecf20Sopenharmony_ci * @submodule_wkdep_bit: bit shift of the WKDEP range 3678c2ecf20Sopenharmony_ci * @flags: PRCM register capabilities for this IP block 3688c2ecf20Sopenharmony_ci * @modulemode: allowable modulemodes 3698c2ecf20Sopenharmony_ci * @context_lost_counter: Count of module level context lost 3708c2ecf20Sopenharmony_ci * 3718c2ecf20Sopenharmony_ci * If @lostcontext_mask is not defined, context loss check code uses 3728c2ecf20Sopenharmony_ci * whole register without masking. @lostcontext_mask should only be 3738c2ecf20Sopenharmony_ci * defined in cases where @context_offs register is shared by two or 3748c2ecf20Sopenharmony_ci * more hwmods. 3758c2ecf20Sopenharmony_ci */ 3768c2ecf20Sopenharmony_cistruct omap_hwmod_omap4_prcm { 3778c2ecf20Sopenharmony_ci u16 clkctrl_offs; 3788c2ecf20Sopenharmony_ci u16 rstctrl_offs; 3798c2ecf20Sopenharmony_ci u16 rstst_offs; 3808c2ecf20Sopenharmony_ci u16 context_offs; 3818c2ecf20Sopenharmony_ci u32 lostcontext_mask; 3828c2ecf20Sopenharmony_ci u8 submodule_wkdep_bit; 3838c2ecf20Sopenharmony_ci u8 modulemode; 3848c2ecf20Sopenharmony_ci u8 flags; 3858c2ecf20Sopenharmony_ci int context_lost_counter; 3868c2ecf20Sopenharmony_ci}; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci/* 3908c2ecf20Sopenharmony_ci * omap_hwmod.flags definitions 3918c2ecf20Sopenharmony_ci * 3928c2ecf20Sopenharmony_ci * HWMOD_SWSUP_SIDLE: omap_hwmod code should manually bring module in and out 3938c2ecf20Sopenharmony_ci * of idle, rather than relying on module smart-idle 3948c2ecf20Sopenharmony_ci * HWMOD_SWSUP_MSTANDBY: omap_hwmod code should manually bring module in and 3958c2ecf20Sopenharmony_ci * out of standby, rather than relying on module smart-standby 3968c2ecf20Sopenharmony_ci * HWMOD_INIT_NO_RESET: don't reset this module at boot - important for 3978c2ecf20Sopenharmony_ci * SDRAM controller, etc. XXX probably belongs outside the main hwmod file 3988c2ecf20Sopenharmony_ci * XXX Should be HWMOD_SETUP_NO_RESET 3998c2ecf20Sopenharmony_ci * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM 4008c2ecf20Sopenharmony_ci * controller, etc. XXX probably belongs outside the main hwmod file 4018c2ecf20Sopenharmony_ci * XXX Should be HWMOD_SETUP_NO_IDLE 4028c2ecf20Sopenharmony_ci * HWMOD_NO_OCP_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE) 4038c2ecf20Sopenharmony_ci * when module is enabled, rather than the default, which is to 4048c2ecf20Sopenharmony_ci * enable autoidle 4058c2ecf20Sopenharmony_ci * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup 4068c2ecf20Sopenharmony_ci * HWMOD_NO_IDLEST: this module does not have idle status - this is the case 4078c2ecf20Sopenharmony_ci * only for few initiator modules on OMAP2 & 3. 4088c2ecf20Sopenharmony_ci * HWMOD_CONTROL_OPT_CLKS_IN_RESET: Enable all optional clocks during reset. 4098c2ecf20Sopenharmony_ci * This is needed for devices like DSS that require optional clocks enabled 4108c2ecf20Sopenharmony_ci * in order to complete the reset. Optional clocks will be disabled 4118c2ecf20Sopenharmony_ci * again after the reset. 4128c2ecf20Sopenharmony_ci * HWMOD_16BIT_REG: Module has 16bit registers 4138c2ecf20Sopenharmony_ci * HWMOD_EXT_OPT_MAIN_CLK: The only main functional clock source for 4148c2ecf20Sopenharmony_ci * this IP block comes from an off-chip source and is not always 4158c2ecf20Sopenharmony_ci * enabled. This prevents the hwmod code from being able to 4168c2ecf20Sopenharmony_ci * enable and reset the IP block early. XXX Eventually it should 4178c2ecf20Sopenharmony_ci * be possible to query the clock framework for this information. 4188c2ecf20Sopenharmony_ci * HWMOD_BLOCK_WFI: Some OMAP peripherals apparently don't work 4198c2ecf20Sopenharmony_ci * correctly if the MPU is allowed to go idle while the 4208c2ecf20Sopenharmony_ci * peripherals are active. This is apparently true for the I2C on 4218c2ecf20Sopenharmony_ci * OMAP2420, and also the EMAC on AM3517/3505. It's unlikely that 4228c2ecf20Sopenharmony_ci * this is really true -- we're probably not configuring something 4238c2ecf20Sopenharmony_ci * correctly, or this is being abused to deal with some PM latency 4248c2ecf20Sopenharmony_ci * issues -- but we're currently suffering from a shortage of 4258c2ecf20Sopenharmony_ci * folks who are able to track these issues down properly. 4268c2ecf20Sopenharmony_ci * HWMOD_FORCE_MSTANDBY: Always keep MIDLEMODE bits cleared so that device 4278c2ecf20Sopenharmony_ci * is kept in force-standby mode. Failing to do so causes PM problems 4288c2ecf20Sopenharmony_ci * with musb on OMAP3630 at least. Note that musb has a dedicated register 4298c2ecf20Sopenharmony_ci * to control MSTANDBY signal when MIDLEMODE is set to force-standby. 4308c2ecf20Sopenharmony_ci * HWMOD_SWSUP_SIDLE_ACT: omap_hwmod code should manually bring the module 4318c2ecf20Sopenharmony_ci * out of idle, but rely on smart-idle to the put it back in idle, 4328c2ecf20Sopenharmony_ci * so the wakeups are still functional (Only known case for now is UART) 4338c2ecf20Sopenharmony_ci * HWMOD_RECONFIG_IO_CHAIN: omap_hwmod code needs to reconfigure wake-up 4348c2ecf20Sopenharmony_ci * events by calling _reconfigure_io_chain() when a device is enabled 4358c2ecf20Sopenharmony_ci * or idled. 4368c2ecf20Sopenharmony_ci * HWMOD_OPT_CLKS_NEEDED: The optional clocks are needed for the module to 4378c2ecf20Sopenharmony_ci * operate and they need to be handled at the same time as the main_clk. 4388c2ecf20Sopenharmony_ci * HWMOD_NO_IDLE: Do not idle the hwmod at all. Useful to handle certain 4398c2ecf20Sopenharmony_ci * IPs like CPSW on DRA7, where clocks to this module cannot be disabled. 4408c2ecf20Sopenharmony_ci * HWMOD_CLKDM_NOAUTO: Allows the hwmod's clockdomain to be prevented from 4418c2ecf20Sopenharmony_ci * entering HW_AUTO while hwmod is active. This is needed to workaround 4428c2ecf20Sopenharmony_ci * some modules which don't function correctly with HW_AUTO. For example, 4438c2ecf20Sopenharmony_ci * DCAN on DRA7x SoC needs this to workaround errata i893. 4448c2ecf20Sopenharmony_ci */ 4458c2ecf20Sopenharmony_ci#define HWMOD_SWSUP_SIDLE (1 << 0) 4468c2ecf20Sopenharmony_ci#define HWMOD_SWSUP_MSTANDBY (1 << 1) 4478c2ecf20Sopenharmony_ci#define HWMOD_INIT_NO_RESET (1 << 2) 4488c2ecf20Sopenharmony_ci#define HWMOD_INIT_NO_IDLE (1 << 3) 4498c2ecf20Sopenharmony_ci#define HWMOD_NO_OCP_AUTOIDLE (1 << 4) 4508c2ecf20Sopenharmony_ci#define HWMOD_SET_DEFAULT_CLOCKACT (1 << 5) 4518c2ecf20Sopenharmony_ci#define HWMOD_NO_IDLEST (1 << 6) 4528c2ecf20Sopenharmony_ci#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7) 4538c2ecf20Sopenharmony_ci#define HWMOD_16BIT_REG (1 << 8) 4548c2ecf20Sopenharmony_ci#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9) 4558c2ecf20Sopenharmony_ci#define HWMOD_BLOCK_WFI (1 << 10) 4568c2ecf20Sopenharmony_ci#define HWMOD_FORCE_MSTANDBY (1 << 11) 4578c2ecf20Sopenharmony_ci#define HWMOD_SWSUP_SIDLE_ACT (1 << 12) 4588c2ecf20Sopenharmony_ci#define HWMOD_RECONFIG_IO_CHAIN (1 << 13) 4598c2ecf20Sopenharmony_ci#define HWMOD_OPT_CLKS_NEEDED (1 << 14) 4608c2ecf20Sopenharmony_ci#define HWMOD_NO_IDLE (1 << 15) 4618c2ecf20Sopenharmony_ci#define HWMOD_CLKDM_NOAUTO (1 << 16) 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci/* 4648c2ecf20Sopenharmony_ci * omap_hwmod._int_flags definitions 4658c2ecf20Sopenharmony_ci * These are for internal use only and are managed by the omap_hwmod code. 4668c2ecf20Sopenharmony_ci * 4678c2ecf20Sopenharmony_ci * _HWMOD_NO_MPU_PORT: no path exists for the MPU to write to this module 4688c2ecf20Sopenharmony_ci * _HWMOD_SYSCONFIG_LOADED: set when the OCP_SYSCONFIG value has been cached 4698c2ecf20Sopenharmony_ci * _HWMOD_SKIP_ENABLE: set if hwmod enabled during init (HWMOD_INIT_NO_IDLE) - 4708c2ecf20Sopenharmony_ci * causes the first call to _enable() to only update the pinmux 4718c2ecf20Sopenharmony_ci */ 4728c2ecf20Sopenharmony_ci#define _HWMOD_NO_MPU_PORT (1 << 0) 4738c2ecf20Sopenharmony_ci#define _HWMOD_SYSCONFIG_LOADED (1 << 1) 4748c2ecf20Sopenharmony_ci#define _HWMOD_SKIP_ENABLE (1 << 2) 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci/* 4778c2ecf20Sopenharmony_ci * omap_hwmod._state definitions 4788c2ecf20Sopenharmony_ci * 4798c2ecf20Sopenharmony_ci * INITIALIZED: reset (optionally), initialized, enabled, disabled 4808c2ecf20Sopenharmony_ci * (optionally) 4818c2ecf20Sopenharmony_ci * 4828c2ecf20Sopenharmony_ci * 4838c2ecf20Sopenharmony_ci */ 4848c2ecf20Sopenharmony_ci#define _HWMOD_STATE_UNKNOWN 0 4858c2ecf20Sopenharmony_ci#define _HWMOD_STATE_REGISTERED 1 4868c2ecf20Sopenharmony_ci#define _HWMOD_STATE_CLKS_INITED 2 4878c2ecf20Sopenharmony_ci#define _HWMOD_STATE_INITIALIZED 3 4888c2ecf20Sopenharmony_ci#define _HWMOD_STATE_ENABLED 4 4898c2ecf20Sopenharmony_ci#define _HWMOD_STATE_IDLE 5 4908c2ecf20Sopenharmony_ci#define _HWMOD_STATE_DISABLED 6 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 4938c2ecf20Sopenharmony_ci#define _HWMOD_STATE_DEFAULT _HWMOD_STATE_IDLE 4948c2ecf20Sopenharmony_ci#else 4958c2ecf20Sopenharmony_ci#define _HWMOD_STATE_DEFAULT _HWMOD_STATE_ENABLED 4968c2ecf20Sopenharmony_ci#endif 4978c2ecf20Sopenharmony_ci 4988c2ecf20Sopenharmony_ci/** 4998c2ecf20Sopenharmony_ci * struct omap_hwmod_class - the type of an IP block 5008c2ecf20Sopenharmony_ci * @name: name of the hwmod_class 5018c2ecf20Sopenharmony_ci * @sysc: device SYSCONFIG/SYSSTATUS register data 5028c2ecf20Sopenharmony_ci * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown 5038c2ecf20Sopenharmony_ci * @reset: ptr to fn to be executed in place of the standard hwmod reset fn 5048c2ecf20Sopenharmony_ci * @lock: ptr to fn to be executed to lock IP registers 5058c2ecf20Sopenharmony_ci * @unlock: ptr to fn to be executed to unlock IP registers 5068c2ecf20Sopenharmony_ci * 5078c2ecf20Sopenharmony_ci * Represent the class of a OMAP hardware "modules" (e.g. timer, 5088c2ecf20Sopenharmony_ci * smartreflex, gpio, uart...) 5098c2ecf20Sopenharmony_ci * 5108c2ecf20Sopenharmony_ci * @pre_shutdown is a function that will be run immediately before 5118c2ecf20Sopenharmony_ci * hwmod clocks are disabled, etc. It is intended for use for hwmods 5128c2ecf20Sopenharmony_ci * like the MPU watchdog, which cannot be disabled with the standard 5138c2ecf20Sopenharmony_ci * omap_hwmod_shutdown(). The function should return 0 upon success, 5148c2ecf20Sopenharmony_ci * or some negative error upon failure. Returning an error will cause 5158c2ecf20Sopenharmony_ci * omap_hwmod_shutdown() to abort the device shutdown and return an 5168c2ecf20Sopenharmony_ci * error. 5178c2ecf20Sopenharmony_ci * 5188c2ecf20Sopenharmony_ci * If @reset is defined, then the function it points to will be 5198c2ecf20Sopenharmony_ci * executed in place of the standard hwmod _reset() code in 5208c2ecf20Sopenharmony_ci * mach-omap2/omap_hwmod.c. This is needed for IP blocks which have 5218c2ecf20Sopenharmony_ci * unusual reset sequences - usually processor IP blocks like the IVA. 5228c2ecf20Sopenharmony_ci */ 5238c2ecf20Sopenharmony_cistruct omap_hwmod_class { 5248c2ecf20Sopenharmony_ci const char *name; 5258c2ecf20Sopenharmony_ci struct omap_hwmod_class_sysconfig *sysc; 5268c2ecf20Sopenharmony_ci int (*pre_shutdown)(struct omap_hwmod *oh); 5278c2ecf20Sopenharmony_ci int (*reset)(struct omap_hwmod *oh); 5288c2ecf20Sopenharmony_ci void (*lock)(struct omap_hwmod *oh); 5298c2ecf20Sopenharmony_ci void (*unlock)(struct omap_hwmod *oh); 5308c2ecf20Sopenharmony_ci}; 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_ci/** 5338c2ecf20Sopenharmony_ci * struct omap_hwmod - integration data for OMAP hardware "modules" (IP blocks) 5348c2ecf20Sopenharmony_ci * @name: name of the hwmod 5358c2ecf20Sopenharmony_ci * @class: struct omap_hwmod_class * to the class of this hwmod 5368c2ecf20Sopenharmony_ci * @od: struct omap_device currently associated with this hwmod (internal use) 5378c2ecf20Sopenharmony_ci * @prcm: PRCM data pertaining to this hwmod 5388c2ecf20Sopenharmony_ci * @main_clk: main clock: OMAP clock name 5398c2ecf20Sopenharmony_ci * @_clk: pointer to the main struct clk (filled in at runtime) 5408c2ecf20Sopenharmony_ci * @opt_clks: other device clocks that drivers can request (0..*) 5418c2ecf20Sopenharmony_ci * @voltdm: pointer to voltage domain (filled in at runtime) 5428c2ecf20Sopenharmony_ci * @dev_attr: arbitrary device attributes that can be passed to the driver 5438c2ecf20Sopenharmony_ci * @_sysc_cache: internal-use hwmod flags 5448c2ecf20Sopenharmony_ci * @mpu_rt_idx: index of device address space for register target (for DT boot) 5458c2ecf20Sopenharmony_ci * @_mpu_rt_va: cached register target start address (internal use) 5468c2ecf20Sopenharmony_ci * @_mpu_port: cached MPU register target slave (internal use) 5478c2ecf20Sopenharmony_ci * @opt_clks_cnt: number of @opt_clks 5488c2ecf20Sopenharmony_ci * @master_cnt: number of @master entries 5498c2ecf20Sopenharmony_ci * @slaves_cnt: number of @slave entries 5508c2ecf20Sopenharmony_ci * @response_lat: device OCP response latency (in interface clock cycles) 5518c2ecf20Sopenharmony_ci * @_int_flags: internal-use hwmod flags 5528c2ecf20Sopenharmony_ci * @_state: internal-use hwmod state 5538c2ecf20Sopenharmony_ci * @_postsetup_state: internal-use state to leave the hwmod in after _setup() 5548c2ecf20Sopenharmony_ci * @flags: hwmod flags (documented below) 5558c2ecf20Sopenharmony_ci * @_lock: spinlock serializing operations on this hwmod 5568c2ecf20Sopenharmony_ci * @node: list node for hwmod list (internal use) 5578c2ecf20Sopenharmony_ci * @parent_hwmod: (temporary) a pointer to the hierarchical parent of this hwmod 5588c2ecf20Sopenharmony_ci * 5598c2ecf20Sopenharmony_ci * @main_clk refers to this module's "main clock," which for our 5608c2ecf20Sopenharmony_ci * purposes is defined as "the functional clock needed for register 5618c2ecf20Sopenharmony_ci * accesses to complete." Modules may not have a main clock if the 5628c2ecf20Sopenharmony_ci * interface clock also serves as a main clock. 5638c2ecf20Sopenharmony_ci * 5648c2ecf20Sopenharmony_ci * Parameter names beginning with an underscore are managed internally by 5658c2ecf20Sopenharmony_ci * the omap_hwmod code and should not be set during initialization. 5668c2ecf20Sopenharmony_ci * 5678c2ecf20Sopenharmony_ci * @masters and @slaves are now deprecated. 5688c2ecf20Sopenharmony_ci * 5698c2ecf20Sopenharmony_ci * @parent_hwmod is temporary; there should be no need for it, as this 5708c2ecf20Sopenharmony_ci * information should already be expressed in the OCP interface 5718c2ecf20Sopenharmony_ci * structures. @parent_hwmod is present as a workaround until we improve 5728c2ecf20Sopenharmony_ci * handling for hwmods with multiple parents (e.g., OMAP4+ DSS with 5738c2ecf20Sopenharmony_ci * multiple register targets across different interconnects). 5748c2ecf20Sopenharmony_ci */ 5758c2ecf20Sopenharmony_cistruct omap_hwmod { 5768c2ecf20Sopenharmony_ci const char *name; 5778c2ecf20Sopenharmony_ci struct omap_hwmod_class *class; 5788c2ecf20Sopenharmony_ci struct omap_device *od; 5798c2ecf20Sopenharmony_ci struct omap_hwmod_rst_info *rst_lines; 5808c2ecf20Sopenharmony_ci union { 5818c2ecf20Sopenharmony_ci struct omap_hwmod_omap2_prcm omap2; 5828c2ecf20Sopenharmony_ci struct omap_hwmod_omap4_prcm omap4; 5838c2ecf20Sopenharmony_ci } prcm; 5848c2ecf20Sopenharmony_ci const char *main_clk; 5858c2ecf20Sopenharmony_ci struct clk *_clk; 5868c2ecf20Sopenharmony_ci struct omap_hwmod_opt_clk *opt_clks; 5878c2ecf20Sopenharmony_ci const char *clkdm_name; 5888c2ecf20Sopenharmony_ci struct clockdomain *clkdm; 5898c2ecf20Sopenharmony_ci struct list_head slave_ports; /* connect to *_TA */ 5908c2ecf20Sopenharmony_ci void *dev_attr; 5918c2ecf20Sopenharmony_ci u32 _sysc_cache; 5928c2ecf20Sopenharmony_ci void __iomem *_mpu_rt_va; 5938c2ecf20Sopenharmony_ci spinlock_t _lock; 5948c2ecf20Sopenharmony_ci struct lock_class_key hwmod_key; /* unique lock class */ 5958c2ecf20Sopenharmony_ci struct list_head node; 5968c2ecf20Sopenharmony_ci struct omap_hwmod_ocp_if *_mpu_port; 5978c2ecf20Sopenharmony_ci u32 flags; 5988c2ecf20Sopenharmony_ci u8 mpu_rt_idx; 5998c2ecf20Sopenharmony_ci u8 response_lat; 6008c2ecf20Sopenharmony_ci u8 rst_lines_cnt; 6018c2ecf20Sopenharmony_ci u8 opt_clks_cnt; 6028c2ecf20Sopenharmony_ci u8 slaves_cnt; 6038c2ecf20Sopenharmony_ci u8 hwmods_cnt; 6048c2ecf20Sopenharmony_ci u8 _int_flags; 6058c2ecf20Sopenharmony_ci u8 _state; 6068c2ecf20Sopenharmony_ci u8 _postsetup_state; 6078c2ecf20Sopenharmony_ci struct omap_hwmod *parent_hwmod; 6088c2ecf20Sopenharmony_ci}; 6098c2ecf20Sopenharmony_ci 6108c2ecf20Sopenharmony_cistruct device_node; 6118c2ecf20Sopenharmony_ci 6128c2ecf20Sopenharmony_cistruct omap_hwmod *omap_hwmod_lookup(const char *name); 6138c2ecf20Sopenharmony_ciint omap_hwmod_for_each(int (*fn)(struct omap_hwmod *oh, void *data), 6148c2ecf20Sopenharmony_ci void *data); 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ciint __init omap_hwmod_setup_one(const char *name); 6178c2ecf20Sopenharmony_ciint omap_hwmod_parse_module_range(struct omap_hwmod *oh, 6188c2ecf20Sopenharmony_ci struct device_node *np, 6198c2ecf20Sopenharmony_ci struct resource *res); 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_cistruct ti_sysc_module_data; 6228c2ecf20Sopenharmony_cistruct ti_sysc_cookie; 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ciint omap_hwmod_init_module(struct device *dev, 6258c2ecf20Sopenharmony_ci const struct ti_sysc_module_data *data, 6268c2ecf20Sopenharmony_ci struct ti_sysc_cookie *cookie); 6278c2ecf20Sopenharmony_ci 6288c2ecf20Sopenharmony_ciint omap_hwmod_enable(struct omap_hwmod *oh); 6298c2ecf20Sopenharmony_ciint omap_hwmod_idle(struct omap_hwmod *oh); 6308c2ecf20Sopenharmony_ciint omap_hwmod_shutdown(struct omap_hwmod *oh); 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ciint omap_hwmod_assert_hardreset(struct omap_hwmod *oh, const char *name); 6338c2ecf20Sopenharmony_ciint omap_hwmod_deassert_hardreset(struct omap_hwmod *oh, const char *name); 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_civoid omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs); 6368c2ecf20Sopenharmony_ciu32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs); 6378c2ecf20Sopenharmony_ciint omap_hwmod_softreset(struct omap_hwmod *oh); 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ciint omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags); 6408c2ecf20Sopenharmony_ciint omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 6418c2ecf20Sopenharmony_ciint omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type, 6428c2ecf20Sopenharmony_ci const char *name, struct resource *res); 6438c2ecf20Sopenharmony_ci 6448c2ecf20Sopenharmony_cistruct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh); 6458c2ecf20Sopenharmony_civoid __iomem *omap_hwmod_get_mpu_rt_va(struct omap_hwmod *oh); 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ciint omap_hwmod_for_each_by_class(const char *classname, 6488c2ecf20Sopenharmony_ci int (*fn)(struct omap_hwmod *oh, 6498c2ecf20Sopenharmony_ci void *user), 6508c2ecf20Sopenharmony_ci void *user); 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ciint omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); 6538c2ecf20Sopenharmony_ciint omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ciextern void __init omap_hwmod_init(void); 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ciconst char *omap_hwmod_get_main_clk(struct omap_hwmod *oh); 6588c2ecf20Sopenharmony_ci 6598c2ecf20Sopenharmony_ci/* 6608c2ecf20Sopenharmony_ci * 6618c2ecf20Sopenharmony_ci */ 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_civoid omap_hwmod_rtc_unlock(struct omap_hwmod *oh); 6648c2ecf20Sopenharmony_civoid omap_hwmod_rtc_lock(struct omap_hwmod *oh); 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci/* 6678c2ecf20Sopenharmony_ci * Chip variant-specific hwmod init routines - XXX should be converted 6688c2ecf20Sopenharmony_ci * to use initcalls once the initial boot ordering is straightened out 6698c2ecf20Sopenharmony_ci */ 6708c2ecf20Sopenharmony_ciextern int omap2420_hwmod_init(void); 6718c2ecf20Sopenharmony_ciextern int omap2430_hwmod_init(void); 6728c2ecf20Sopenharmony_ciextern int omap3xxx_hwmod_init(void); 6738c2ecf20Sopenharmony_ciextern int omap44xx_hwmod_init(void); 6748c2ecf20Sopenharmony_ciextern int omap54xx_hwmod_init(void); 6758c2ecf20Sopenharmony_ciextern int am33xx_hwmod_init(void); 6768c2ecf20Sopenharmony_ciextern int dm814x_hwmod_init(void); 6778c2ecf20Sopenharmony_ciextern int dm816x_hwmod_init(void); 6788c2ecf20Sopenharmony_ciextern int dra7xx_hwmod_init(void); 6798c2ecf20Sopenharmony_ciint am43xx_hwmod_init(void); 6808c2ecf20Sopenharmony_ci 6818c2ecf20Sopenharmony_ciextern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois); 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci#endif 684