blob: d02fe63dab59b8e55a2f166baa1213f337954fcd [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Paul Walmsley69d88a02008-03-18 10:02:50 +02002/*
Paul Walmsley59fb6592010-12-21 15:30:55 -07003 * OMAP2+ Clock Management prototypes
Paul Walmsley69d88a02008-03-18 10:02:50 +02004 *
Paul Walmsleyd9a16f92012-10-29 20:57:39 -06005 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
Rajendra Nayak9b472672009-12-08 18:24:50 -07006 * Copyright (C) 2007-2009 Nokia Corporation
Paul Walmsley69d88a02008-03-18 10:02:50 +02007 *
8 * Written by Paul Walmsley
Paul Walmsley69d88a02008-03-18 10:02:50 +02009 */
Paul Walmsley59fb6592010-12-21 15:30:55 -070010#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
11#define __ARCH_ASM_MACH_OMAP2_CM_H
Paul Walmsley69d88a02008-03-18 10:02:50 +020012
Benoit Coussond9e66252010-05-20 12:31:08 -060013/*
14 * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
15 * PRCM to request that a module exit the inactive state in the case of
16 * OMAP2 & 3.
17 * In the case of OMAP4 this is the max duration in microseconds for the
18 * module to reach the functionnal state from an inactive state.
19 */
20#define MAX_MODULE_READY_TIME 2000
21
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060022# ifndef __ASSEMBLER__
Tero Kristo6c0afb52017-02-09 11:24:37 +020023#include <linux/clk/ti.h>
Tero Kristo90129332017-05-31 18:00:00 +030024
25#include "prcm-common.h"
26
27extern struct omap_domain_base cm_base;
28extern struct omap_domain_base cm2_base;
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060029extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
30# endif
31
Paul Walmsleyb8f15b72012-06-17 11:57:53 -060032/*
33 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
34 * the PRCM to request that a module enter the inactive state in the
35 * case of OMAP2 & 3. In the case of OMAP4 this is the max duration
36 * in microseconds for the module to reach the inactive state from
37 * a functional state.
38 * XXX FSUSB on OMAP4430 takes ~4ms to idle after reset during
39 * kernel init.
40 */
41#define MAX_MODULE_DISABLE_TIME 5000
42
Paul Walmsley21325b252012-10-21 01:01:12 -060043# ifndef __ASSEMBLER__
44
45/**
46 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060047 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
48 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
Tero Kristoa8ae5af2014-10-27 08:39:23 -070049 * @wait_module_idle: ptr to the SoC CM-specific wait_module_idle impl
Tero Kristo128603f2014-10-27 08:39:24 -070050 * @module_enable: ptr to the SoC CM-specific module_enable impl
51 * @module_disable: ptr to the SoC CM-specific module_disable impl
Tero Kristo5fa4a3c2017-08-04 17:37:45 +030052 * @xlate_clkctrl: ptr to the SoC CM-specific clkctrl xlate addr impl
Paul Walmsley21325b252012-10-21 01:01:12 -060053 */
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060054struct cm_ll_data {
Tero Kristo6c0afb52017-02-09 11:24:37 +020055 int (*split_idlest_reg)(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060056 u8 *idlest_reg_id);
Tero Kristo021b6ff2014-10-27 08:39:23 -070057 int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
58 u8 idlest_shift);
Tero Kristoa8ae5af2014-10-27 08:39:23 -070059 int (*wait_module_idle)(u8 part, s16 prcm_mod, u16 idlest_reg,
60 u8 idlest_shift);
Tero Kristo128603f2014-10-27 08:39:24 -070061 void (*module_enable)(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
62 void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
Tero Kristo5fa4a3c2017-08-04 17:37:45 +030063 u32 (*xlate_clkctrl)(u8 part, u16 inst, u16 clkctrl_offs);
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060064};
65
Tero Kristo6c0afb52017-02-09 11:24:37 +020066extern int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060067 u8 *idlest_reg_id);
Tero Kristo021b6ff2014-10-27 08:39:23 -070068int omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
69 u8 idlest_shift);
Tero Kristoa8ae5af2014-10-27 08:39:23 -070070int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
71 u8 idlest_shift);
Tero Kristo128603f2014-10-27 08:39:24 -070072int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
73int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
Tero Kristo5fa4a3c2017-08-04 17:37:45 +030074u32 omap_cm_xlate_clkctrl(u8 part, u16 inst, u16 clkctrl_offs);
Bhumika Goyala529f8de2017-11-06 14:15:39 +010075extern int cm_register(const struct cm_ll_data *cld);
76extern int cm_unregister(const struct cm_ll_data *cld);
Tero Kristofe874142014-03-12 18:33:45 +020077int omap_cm_init(void);
Tero Kristo5970ca22014-11-11 16:51:52 +020078int omap2_cm_base_init(void);
Paul Walmsley21325b252012-10-21 01:01:12 -060079
80# endif
81
Paul Walmsley69d88a02008-03-18 10:02:50 +020082#endif