blob: d277da6c0378387e48bb0b6fb2a533fbc42e0ec3 [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
22/* XXX document */
23#define VP_IDLE_TIMEOUT 200
24#define VP_TRANXDONE_TIMEOUT 300
25
26
27/**
28 * struct omap_vp_common_data - register data common to all VDDs
29 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
30 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
31 * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
32 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
33 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
34 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
35 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
36 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
37 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
38 * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
39 * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
40 * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
41 * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
42 * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
43 * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
44 * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
Kevin Hilmana7460da2011-03-16 13:35:22 -070045 * @prm_mod: PRM module id used for PRM register access
Paul Walmsleyc0718df2011-03-10 22:17:45 -070046 *
47 * XXX It it not necessary to have both a mask and a shift for the same
48 * bitfield - remove one
49 * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
50 */
51struct omap_vp_common_data {
52 u32 vpconfig_errorgain_mask;
53 u32 vpconfig_initvoltage_mask;
54 u32 vpconfig_timeouten;
55 u32 vpconfig_initvdd;
56 u32 vpconfig_forceupdate;
57 u32 vpconfig_vpenable;
Kevin Hilmana7460da2011-03-16 13:35:22 -070058 s16 prm_mod;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070059 u8 vpconfig_erroroffset_shift;
60 u8 vpconfig_errorgain_shift;
61 u8 vpconfig_initvoltage_shift;
62 u8 vstepmin_stepmin_shift;
63 u8 vstepmin_smpswaittimemin_shift;
64 u8 vstepmax_stepmax_shift;
65 u8 vstepmax_smpswaittimemax_shift;
66 u8 vlimitto_vddmin_shift;
67 u8 vlimitto_vddmax_shift;
68 u8 vlimitto_timeout_shift;
69};
70
71/**
72 * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
73 * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
74 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
75 *
76 * XXX prm_irqst_reg does not belong here
77 * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
78 * hardware bug
79 * XXX This structure is probably not needed
80 */
81struct omap_vp_prm_irqst_data {
82 u8 prm_irqst_reg;
83 u32 tranxdone_status;
84};
85
86/**
87 * struct omap_vp_instance_data - VP register offsets (per-VDD)
88 * @vp_common: pointer to struct omap_vp_common_data * for this SoC
89 * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
90 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
91 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
92 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
93 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
94 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
95 *
96 * XXX vp_common is probably not needed since it is per-SoC
97 */
98struct omap_vp_instance_data {
99 const struct omap_vp_common_data *vp_common;
100 const struct omap_vp_prm_irqst_data *prm_irqst_data;
101 u8 vpconfig;
102 u8 vstepmin;
103 u8 vstepmax;
104 u8 vlimitto;
105 u8 vstatus;
106 u8 voltage;
107};
108
109/**
110 * struct omap_vp_runtime_data - VP data populated at runtime by code
111 * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
112 * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
113 * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
114 * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
115 * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
116 * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
117 * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
118 * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
119 * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
120 *
121 * XXX Is this structure really needed? Why not just program the
122 * device directly? They are in PRM space, therefore in the WKUP
123 * powerdomain, so register contents should not be lost in off-mode.
124 * XXX Some of these fields are incorrectly named, e.g., vstep*
125 */
126struct omap_vp_runtime_data {
127 u32 vpconfig_erroroffset;
128 u16 vpconfig_errorgain;
129 u16 vstepmin_smpswaittimemin;
130 u16 vstepmax_smpswaittimemax;
131 u16 vlimitto_timeout;
132 u8 vstepmin_stepmin;
133 u8 vstepmax_stepmax;
134 u8 vlimitto_vddmin;
135 u8 vlimitto_vddmax;
136};
137
138extern struct omap_vp_instance_data omap3_vp1_data;
139extern struct omap_vp_instance_data omap3_vp2_data;
140
141extern struct omap_vp_instance_data omap4_vp_mpu_data;
142extern struct omap_vp_instance_data omap4_vp_iva_data;
143extern struct omap_vp_instance_data omap4_vp_core_data;
144
145#endif