2 * OMAP3/4 Voltage Processor (VP) structure and macro definitions
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>
9 * Copyright (C) 2008, 2011 Nokia Corporation
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.
17 #ifndef __ARCH_ARM_MACH_OMAP2_VP_H
18 #define __ARCH_ARM_MACH_OMAP2_VP_H
20 #include <linux/kernel.h>
25 #define VP_IDLE_TIMEOUT 500
26 #define VP_TRANXDONE_TIMEOUT 300
29 * struct omap_vp_ops - per-VP operations
30 * @check_txdone: check for VP transaction done
31 * @clear_txdone: clear VP transaction done status
34 u32 (*check_txdone
)(u8 vp_id
);
35 void (*clear_txdone
)(u8 vp_id
);
36 void (*recover
)(u8 vp_id
);
40 * struct omap_vp_common - register data common to all VDDs
41 * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
42 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
43 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
44 * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
45 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
46 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
47 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
48 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
49 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
50 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
51 * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
52 * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
53 * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
54 * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
55 * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
56 * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
57 * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
58 * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
60 struct omap_vp_common
{
61 u32 vpconfig_erroroffset_mask
;
62 u32 vpconfig_errorgain_mask
;
63 u32 vpconfig_initvoltage_mask
;
64 u8 vpconfig_timeouten
;
66 u8 vpconfig_forceupdate
;
69 u8 vstepmin_stepmin_shift
;
70 u8 vstepmin_smpswaittimemin_shift
;
71 u8 vstepmax_stepmax_shift
;
72 u8 vstepmax_smpswaittimemax_shift
;
73 u8 vlimitto_vddmin_shift
;
74 u8 vlimitto_vddmax_shift
;
75 u8 vlimitto_timeout_shift
;
78 const struct omap_vp_ops
*ops
;
82 * struct omap_vp_instance - VP register offsets (per-VDD)
83 * @common: pointer to struct omap_vp_common * for this SoC
84 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
85 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
86 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
87 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
88 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
89 * @enabled: flag to keep track of whether vp is enabled or not
91 * XXX vp_common is probably not needed since it is per-SoC
93 struct omap_vp_instance
{
94 const struct omap_vp_common
*common
;
105 extern struct omap_vp_instance omap3_vp_mpu
;
106 extern struct omap_vp_instance omap3_vp_core
;
108 extern struct omap_vp_instance omap4_vp_mpu
;
109 extern struct omap_vp_instance omap4_vp_iva
;
110 extern struct omap_vp_instance omap4_vp_core
;
112 void omap_vp_init(struct voltagedomain
*voltdm
);
113 void omap_vp_enable(struct voltagedomain
*voltdm
);
114 void omap_vp_disable(struct voltagedomain
*voltdm
);
115 unsigned long omap_vp_get_curr_volt(struct voltagedomain
*voltdm
);
116 int omap_vp_forceupdate_scale(struct voltagedomain
*voltdm
,
117 struct omap_volt_data
*target_v
);
118 int omap_vp_update_errorgain(struct voltagedomain
*voltdm
,
119 struct omap_volt_data
*volt_data
);
120 bool omap_vp_is_transdone(struct voltagedomain
*voltdm
);
121 void omap_vp_clear_transdone(struct voltagedomain
*voltdm
);