1 /*
2  * OMAP3 Voltage Processor (VP) data
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 modify
14  * it under the terms of the GNU General Public License version 2 as
15  * published by the Free Software Foundation.
16  */
17 
18 #include <linux/io.h>
19 #include <linux/err.h>
20 #include <linux/init.h>
21 
22 #include <plat/common.h>
23 
24 #include "prm44xx.h"
25 #include "prm-regbits-44xx.h"
26 #include "voltage.h"
27 
28 #include "vp.h"
29 
30 /*
31  * VP data common to 44xx chips
32  * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
33  */
34 static const struct omap_vp_common_data omap4_vp_common = {
35 	.vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
36 	.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
37 	.vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
38 	.vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT,
39 	.vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK,
40 	.vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK,
41 	.vpconfig_initvdd = OMAP4430_INITVDD_MASK,
42 	.vpconfig_forceupdate = OMAP4430_FORCEUPDATE_MASK,
43 	.vpconfig_vpenable = OMAP4430_VPENABLE_MASK,
44 	.vstepmin_smpswaittimemin_shift = OMAP4430_SMPSWAITTIMEMIN_SHIFT,
45 	.vstepmax_smpswaittimemax_shift = OMAP4430_SMPSWAITTIMEMAX_SHIFT,
46 	.vstepmin_stepmin_shift = OMAP4430_VSTEPMIN_SHIFT,
47 	.vstepmax_stepmax_shift = OMAP4430_VSTEPMAX_SHIFT,
48 	.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
49 	.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
50 	.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
51 };
52 
53 static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = {
54 	.prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
55 	.tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
56 };
57 
58 struct omap_vp_instance_data omap4_vp_mpu_data = {
59 	.vp_common = &omap4_vp_common,
60 	.vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
61 	.vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
62 	.vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
63 	.vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
64 	.vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
65 	.voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
66 	.prm_irqst_data = &omap4_vp_mpu_prm_irqst_data,
67 };
68 
69 static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = {
70 	.prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
71 	.tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
72 };
73 
74 struct omap_vp_instance_data omap4_vp_iva_data = {
75 	.vp_common = &omap4_vp_common,
76 	.vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
77 	.vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
78 	.vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
79 	.vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
80 	.vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
81 	.voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
82 	.prm_irqst_data = &omap4_vp_iva_prm_irqst_data,
83 };
84 
85 static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
86 	.prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
87 	.tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
88 };
89 
90 struct omap_vp_instance_data omap4_vp_core_data = {
91 	.vp_common = &omap4_vp_common,
92 	.vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
93 	.vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
94 	.vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
95 	.vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
96 	.vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
97 	.voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
98 	.prm_irqst_data = &omap4_vp_core_prm_irqst_data,
99 };
100 
101