18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * OMAP2+ Clock Management prototypes
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
68c2ecf20Sopenharmony_ci * Copyright (C) 2007-2009 Nokia Corporation
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Written by Paul Walmsley
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
118c2ecf20Sopenharmony_ci#define __ARCH_ASM_MACH_OMAP2_CM_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
158c2ecf20Sopenharmony_ci * PRCM to request that a module exit the inactive state in the case of
168c2ecf20Sopenharmony_ci * OMAP2 & 3.
178c2ecf20Sopenharmony_ci * In the case of OMAP4 this is the max duration in microseconds for the
188c2ecf20Sopenharmony_ci * module to reach the functionnal state from an inactive state.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci#define MAX_MODULE_READY_TIME		2000
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci# ifndef __ASSEMBLER__
238c2ecf20Sopenharmony_ci#include <linux/clk/ti.h>
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#include "prcm-common.h"
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciextern struct omap_domain_base cm_base;
288c2ecf20Sopenharmony_ciextern struct omap_domain_base cm2_base;
298c2ecf20Sopenharmony_ciextern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
308c2ecf20Sopenharmony_ci# endif
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/*
338c2ecf20Sopenharmony_ci * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
348c2ecf20Sopenharmony_ci * the PRCM to request that a module enter the inactive state in the
358c2ecf20Sopenharmony_ci * case of OMAP2 & 3.  In the case of OMAP4 this is the max duration
368c2ecf20Sopenharmony_ci * in microseconds for the module to reach the inactive state from
378c2ecf20Sopenharmony_ci * a functional state.
388c2ecf20Sopenharmony_ci * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
398c2ecf20Sopenharmony_ci * kernel init.
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci#define MAX_MODULE_DISABLE_TIME		5000
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci# ifndef __ASSEMBLER__
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/**
468c2ecf20Sopenharmony_ci * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
478c2ecf20Sopenharmony_ci * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
488c2ecf20Sopenharmony_ci * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
498c2ecf20Sopenharmony_ci * @wait_module_idle: ptr to the SoC CM-specific wait_module_idle impl
508c2ecf20Sopenharmony_ci * @module_enable: ptr to the SoC CM-specific module_enable impl
518c2ecf20Sopenharmony_ci * @module_disable: ptr to the SoC CM-specific module_disable impl
528c2ecf20Sopenharmony_ci * @xlate_clkctrl: ptr to the SoC CM-specific clkctrl xlate addr impl
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_cistruct cm_ll_data {
558c2ecf20Sopenharmony_ci	int (*split_idlest_reg)(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
568c2ecf20Sopenharmony_ci				u8 *idlest_reg_id);
578c2ecf20Sopenharmony_ci	int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
588c2ecf20Sopenharmony_ci				 u8 idlest_shift);
598c2ecf20Sopenharmony_ci	int (*wait_module_idle)(u8 part, s16 prcm_mod, u16 idlest_reg,
608c2ecf20Sopenharmony_ci				u8 idlest_shift);
618c2ecf20Sopenharmony_ci	void (*module_enable)(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
628c2ecf20Sopenharmony_ci	void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
638c2ecf20Sopenharmony_ci	u32 (*xlate_clkctrl)(u8 part, u16 inst, u16 clkctrl_offs);
648c2ecf20Sopenharmony_ci};
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciextern int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
678c2ecf20Sopenharmony_ci			       u8 *idlest_reg_id);
688c2ecf20Sopenharmony_ciint omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
698c2ecf20Sopenharmony_ci			      u8 idlest_shift);
708c2ecf20Sopenharmony_ciint omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
718c2ecf20Sopenharmony_ci			     u8 idlest_shift);
728c2ecf20Sopenharmony_ciint omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
738c2ecf20Sopenharmony_ciint omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
748c2ecf20Sopenharmony_ciu32 omap_cm_xlate_clkctrl(u8 part, u16 inst, u16 clkctrl_offs);
758c2ecf20Sopenharmony_ciextern int cm_register(const struct cm_ll_data *cld);
768c2ecf20Sopenharmony_ciextern int cm_unregister(const struct cm_ll_data *cld);
778c2ecf20Sopenharmony_ciint omap_cm_init(void);
788c2ecf20Sopenharmony_ciint omap2_cm_base_init(void);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci# endif
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#endif
83