162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * OMAP2+ Clock Management prototypes
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
662306a36Sopenharmony_ci * Copyright (C) 2007-2009 Nokia Corporation
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Written by Paul Walmsley
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
1162306a36Sopenharmony_ci#define __ARCH_ASM_MACH_OMAP2_CM_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/*
1462306a36Sopenharmony_ci * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
1562306a36Sopenharmony_ci * PRCM to request that a module exit the inactive state in the case of
1662306a36Sopenharmony_ci * OMAP2 & 3.
1762306a36Sopenharmony_ci * In the case of OMAP4 this is the max duration in microseconds for the
1862306a36Sopenharmony_ci * module to reach the functionnal state from an inactive state.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci#define MAX_MODULE_READY_TIME		2000
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci# ifndef __ASSEMBLER__
2362306a36Sopenharmony_ci#include <linux/clk/ti.h>
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#include "prcm-common.h"
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciextern struct omap_domain_base cm_base;
2862306a36Sopenharmony_ciextern struct omap_domain_base cm2_base;
2962306a36Sopenharmony_ci# endif
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/*
3262306a36Sopenharmony_ci * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
3362306a36Sopenharmony_ci * the PRCM to request that a module enter the inactive state in the
3462306a36Sopenharmony_ci * case of OMAP2 & 3.  In the case of OMAP4 this is the max duration
3562306a36Sopenharmony_ci * in microseconds for the module to reach the inactive state from
3662306a36Sopenharmony_ci * a functional state.
3762306a36Sopenharmony_ci * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
3862306a36Sopenharmony_ci * kernel init.
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#define MAX_MODULE_DISABLE_TIME		5000
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci# ifndef __ASSEMBLER__
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/**
4562306a36Sopenharmony_ci * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
4662306a36Sopenharmony_ci * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
4762306a36Sopenharmony_ci * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
4862306a36Sopenharmony_ci * @wait_module_idle: ptr to the SoC CM-specific wait_module_idle impl
4962306a36Sopenharmony_ci * @module_enable: ptr to the SoC CM-specific module_enable impl
5062306a36Sopenharmony_ci * @module_disable: ptr to the SoC CM-specific module_disable impl
5162306a36Sopenharmony_ci * @xlate_clkctrl: ptr to the SoC CM-specific clkctrl xlate addr impl
5262306a36Sopenharmony_ci */
5362306a36Sopenharmony_cistruct cm_ll_data {
5462306a36Sopenharmony_ci	int (*split_idlest_reg)(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
5562306a36Sopenharmony_ci				u8 *idlest_reg_id);
5662306a36Sopenharmony_ci	int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
5762306a36Sopenharmony_ci				 u8 idlest_shift);
5862306a36Sopenharmony_ci	int (*wait_module_idle)(u8 part, s16 prcm_mod, u16 idlest_reg,
5962306a36Sopenharmony_ci				u8 idlest_shift);
6062306a36Sopenharmony_ci	void (*module_enable)(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
6162306a36Sopenharmony_ci	void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
6262306a36Sopenharmony_ci	u32 (*xlate_clkctrl)(u8 part, u16 inst, u16 clkctrl_offs);
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciextern int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
6662306a36Sopenharmony_ci			       u8 *idlest_reg_id);
6762306a36Sopenharmony_ciint omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
6862306a36Sopenharmony_ci			      u8 idlest_shift);
6962306a36Sopenharmony_ciint omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
7062306a36Sopenharmony_ci			     u8 idlest_shift);
7162306a36Sopenharmony_ciint omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
7262306a36Sopenharmony_ciint omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
7362306a36Sopenharmony_ciu32 omap_cm_xlate_clkctrl(u8 part, u16 inst, u16 clkctrl_offs);
7462306a36Sopenharmony_ciextern int cm_register(const struct cm_ll_data *cld);
7562306a36Sopenharmony_ciextern int cm_unregister(const struct cm_ll_data *cld);
7662306a36Sopenharmony_ciint omap_cm_init(void);
7762306a36Sopenharmony_ciint omap2_cm_base_init(void);
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci# endif
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#endif
82