blob: de75cbcdc9d1bdf34db8edb78a4347f873e331fa [file] [log] [blame]
Paul Walmsley69d88a02008-03-18 10:02:50 +02001/*
Paul Walmsley59fb6592010-12-21 15:30:55 -07002 * OMAP2+ Clock Management prototypes
Paul Walmsley69d88a02008-03-18 10:02:50 +02003 *
Paul Walmsleyd9a16f92012-10-29 20:57:39 -06004 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
Rajendra Nayak9b472672009-12-08 18:24:50 -07005 * Copyright (C) 2007-2009 Nokia Corporation
Paul Walmsley69d88a02008-03-18 10:02:50 +02006 *
7 * Written by Paul Walmsley
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
Paul Walmsley59fb6592010-12-21 15:30:55 -070013#ifndef __ARCH_ASM_MACH_OMAP2_CM_H
14#define __ARCH_ASM_MACH_OMAP2_CM_H
Paul Walmsley69d88a02008-03-18 10:02:50 +020015
Benoit Coussond9e66252010-05-20 12:31:08 -060016/*
17 * MAX_MODULE_READY_TIME: max duration in microseconds to wait for the
18 * PRCM to request that a module exit the inactive state in the case of
19 * OMAP2 & 3.
20 * In the case of OMAP4 this is the max duration in microseconds for the
21 * module to reach the functionnal state from an inactive state.
22 */
23#define MAX_MODULE_READY_TIME 2000
24
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060025# ifndef __ASSEMBLER__
Tero Kristo6c0afb52017-02-09 11:24:37 +020026#include <linux/clk/ti.h>
Paul Walmsleyd9a16f92012-10-29 20:57:39 -060027extern void __iomem *cm_base;
28extern void __iomem *cm2_base;
29extern 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
Paul Walmsley21325b252012-10-21 01:01:12 -060052 */
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060053struct cm_ll_data {
Tero Kristo6c0afb52017-02-09 11:24:37 +020054 int (*split_idlest_reg)(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060055 u8 *idlest_reg_id);
Tero Kristo021b6ff2014-10-27 08:39:23 -070056 int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
57 u8 idlest_shift);
Tero Kristoa8ae5af2014-10-27 08:39:23 -070058 int (*wait_module_idle)(u8 part, s16 prcm_mod, u16 idlest_reg,
59 u8 idlest_shift);
Tero Kristo128603f2014-10-27 08:39:24 -070060 void (*module_enable)(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
61 void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060062};
63
Tero Kristo6c0afb52017-02-09 11:24:37 +020064extern int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
Paul Walmsleyc4ceedc2012-10-29 20:56:29 -060065 u8 *idlest_reg_id);
Tero Kristo021b6ff2014-10-27 08:39:23 -070066int omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
67 u8 idlest_shift);
Tero Kristoa8ae5af2014-10-27 08:39:23 -070068int omap_cm_wait_module_idle(u8 part, s16 prcm_mod, u16 idlest_reg,
69 u8 idlest_shift);
Tero Kristo128603f2014-10-27 08:39:24 -070070int omap_cm_module_enable(u8 mode, u8 part, u16 inst, u16 clkctrl_offs);
71int omap_cm_module_disable(u8 part, u16 inst, u16 clkctrl_offs);
Paul Walmsley21325b252012-10-21 01:01:12 -060072extern int cm_register(struct cm_ll_data *cld);
73extern int cm_unregister(struct cm_ll_data *cld);
Tero Kristofe874142014-03-12 18:33:45 +020074int omap_cm_init(void);
Tero Kristo5970ca22014-11-11 16:51:52 +020075int omap2_cm_base_init(void);
Paul Walmsley21325b252012-10-21 01:01:12 -060076
77# endif
78
Paul Walmsley69d88a02008-03-18 10:02:50 +020079#endif