blob: 0fdf7080e4a641002796a0f9fe34b76c363b95c3 [file] [log] [blame]
Paul Walmsleyc0718df2011-03-10 22:17:45 -07001/*
2 * OMAP3/4 Voltage Processor (VP) structure and macro definitions
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License version
15 * 2 as published by the Free Software Foundation.
16 */
17#ifndef __ARCH_ARM_MACH_OMAP2_VP_H
18#define __ARCH_ARM_MACH_OMAP2_VP_H
19
20#include <linux/kernel.h>
21
Kevin Hilman01f48d32011-03-21 14:29:13 -070022struct voltagedomain;
23
Kevin Hilman58aaa592011-03-28 10:52:04 -070024/*
25 * Voltage Processor (VP) identifiers
26 */
27#define OMAP3_VP_VDD_MPU_ID 0
28#define OMAP3_VP_VDD_CORE_ID 1
29#define OMAP4_VP_VDD_CORE_ID 0
30#define OMAP4_VP_VDD_IVA_ID 1
31#define OMAP4_VP_VDD_MPU_ID 2
32
Paul Walmsleyc0718df2011-03-10 22:17:45 -070033/* XXX document */
34#define VP_IDLE_TIMEOUT 200
35#define VP_TRANXDONE_TIMEOUT 300
36
Kevin Hilman58aaa592011-03-28 10:52:04 -070037/**
38 * struct omap_vp_ops - per-VP operations
39 * @check_txdone: check for VP transaction done
40 * @clear_txdone: clear VP transaction done status
41 */
42struct omap_vp_ops {
43 u32 (*check_txdone)(u8 vp_id);
44 void (*clear_txdone)(u8 vp_id);
45};
Paul Walmsleyc0718df2011-03-10 22:17:45 -070046
47/**
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070048 * struct omap_vp_common - register data common to all VDDs
Kevin Hilman0ec30412011-04-04 16:02:28 -070049 * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
Paul Walmsleyc0718df2011-03-10 22:17:45 -070050 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
51 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
Kevin Hilman0ec30412011-04-04 16:02:28 -070052 * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
Paul Walmsleyc0718df2011-03-10 22:17:45 -070053 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
54 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
55 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
56 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
57 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
58 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
Kevin Hilman0ec30412011-04-04 16:02:28 -070059 * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
60 * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
61 * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
62 * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
63 * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
64 * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
65 * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
Todd Poynorbea30ed2011-05-27 19:15:59 -070066 * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
Paul Walmsleyc0718df2011-03-10 22:17:45 -070067 */
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070068struct omap_vp_common {
Kevin Hilman0ec30412011-04-04 16:02:28 -070069 u32 vpconfig_erroroffset_mask;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070070 u32 vpconfig_errorgain_mask;
71 u32 vpconfig_initvoltage_mask;
Kevin Hilman0ec30412011-04-04 16:02:28 -070072 u8 vpconfig_timeouten;
73 u8 vpconfig_initvdd;
74 u8 vpconfig_forceupdate;
75 u8 vpconfig_vpenable;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070076 u8 vstepmin_stepmin_shift;
77 u8 vstepmin_smpswaittimemin_shift;
78 u8 vstepmax_stepmax_shift;
79 u8 vstepmax_smpswaittimemax_shift;
80 u8 vlimitto_vddmin_shift;
81 u8 vlimitto_vddmax_shift;
82 u8 vlimitto_timeout_shift;
Todd Poynorbea30ed2011-05-27 19:15:59 -070083 u8 vpvoltage_mask;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070084
Kevin Hilman58aaa592011-03-28 10:52:04 -070085 const struct omap_vp_ops *ops;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070086};
87
88/**
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070089 * struct omap_vp_instance - VP register offsets (per-VDD)
90 * @common: pointer to struct omap_vp_common * for this SoC
Paul Walmsleyc0718df2011-03-10 22:17:45 -070091 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
92 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
93 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
94 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
95 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
Kevin Hilman58aaa592011-03-28 10:52:04 -070096 * @id: Unique identifier for VP instance.
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070097 * @enabled: flag to keep track of whether vp is enabled or not
Paul Walmsleyc0718df2011-03-10 22:17:45 -070098 *
99 * XXX vp_common is probably not needed since it is per-SoC
100 */
Kevin Hilmanb7ea8032011-04-04 15:25:07 -0700101struct omap_vp_instance {
102 const struct omap_vp_common *common;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700103 u8 vpconfig;
104 u8 vstepmin;
105 u8 vstepmax;
106 u8 vlimitto;
107 u8 vstatus;
108 u8 voltage;
Kevin Hilman58aaa592011-03-28 10:52:04 -0700109 u8 id;
Kevin Hilmanb7ea8032011-04-04 15:25:07 -0700110 bool enabled;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700111};
112
Kevin Hilmanb7ea8032011-04-04 15:25:07 -0700113extern struct omap_vp_instance omap3_vp_mpu;
114extern struct omap_vp_instance omap3_vp_core;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700115
Kevin Hilmanb7ea8032011-04-04 15:25:07 -0700116extern struct omap_vp_instance omap4_vp_mpu;
117extern struct omap_vp_instance omap4_vp_iva;
118extern struct omap_vp_instance omap4_vp_core;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700119
Tero Kristo8b5d8c02012-09-25 19:33:35 +0300120extern struct omap_vp_param omap3_mpu_vp_data;
121extern struct omap_vp_param omap3_core_vp_data;
122
123extern struct omap_vp_param omap4_mpu_vp_data;
124extern struct omap_vp_param omap4_iva_vp_data;
125extern struct omap_vp_param omap4_core_vp_data;
126
Kevin Hilman01f48d32011-03-21 14:29:13 -0700127void omap_vp_init(struct voltagedomain *voltdm);
128void omap_vp_enable(struct voltagedomain *voltdm);
129void omap_vp_disable(struct voltagedomain *voltdm);
Kevin Hilman01f48d32011-03-21 14:29:13 -0700130int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
131 unsigned long target_volt);
Kevin Hilman76ea7422011-04-05 15:15:31 -0700132int omap_vp_update_errorgain(struct voltagedomain *voltdm,
133 unsigned long target_volt);
Kevin Hilman01f48d32011-03-21 14:29:13 -0700134
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700135#endif