1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * OMAP3 Voltage Processor (VP) data
4  *
5  * Copyright (C) 2007, 2010 Texas Instruments, Inc.
6  * Rajendra Nayak <rnayak@ti.com>
7  * Lesly A M <x0080970@ti.com>
8  * Thara Gopinath <thara@ti.com>
9  *
10  * Copyright (C) 2008, 2011 Nokia Corporation
11  * Kalle Jokiniemi
12  * Paul Walmsley
13  */
14 
15 #include <linux/io.h>
16 #include <linux/err.h>
17 #include <linux/init.h>
18 
19 #include "common.h"
20 
21 #include "prm-regbits-34xx.h"
22 #include "voltage.h"
23 
24 #include "vp.h"
25 #include "prm2xxx_3xxx.h"
26 
27 static const struct omap_vp_ops omap3_vp_ops = {
28 	.check_txdone = omap_prm_vp_check_txdone,
29 	.clear_txdone = omap_prm_vp_clear_txdone,
30 };
31 
32 /*
33  * VP data common to 34xx/36xx chips
34  * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
35  */
36 static const struct omap_vp_common omap3_vp_common = {
37 	.vpconfig_erroroffset_mask = OMAP3430_ERROROFFSET_MASK,
38 	.vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
39 	.vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK,
40 	.vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK,
41 	.vpconfig_initvdd = OMAP3430_INITVDD_MASK,
42 	.vpconfig_forceupdate = OMAP3430_FORCEUPDATE_MASK,
43 	.vpconfig_vpenable = OMAP3430_VPENABLE_MASK,
44 	.vstepmin_smpswaittimemin_shift = OMAP3430_SMPSWAITTIMEMIN_SHIFT,
45 	.vstepmax_smpswaittimemax_shift = OMAP3430_SMPSWAITTIMEMAX_SHIFT,
46 	.vstepmin_stepmin_shift = OMAP3430_VSTEPMIN_SHIFT,
47 	.vstepmax_stepmax_shift = OMAP3430_VSTEPMAX_SHIFT,
48 	.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
49 	.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
50 	.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
51 	.vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK,
52 
53 	.ops = &omap3_vp_ops,
54 };
55 
56 struct omap_vp_instance omap3_vp_mpu = {
57 	.id = OMAP3_VP_VDD_MPU_ID,
58 	.common = &omap3_vp_common,
59 	.vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
60 	.vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
61 	.vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
62 	.vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
63 	.vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
64 	.voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
65 };
66 
67 struct omap_vp_instance omap3_vp_core = {
68 	.id = OMAP3_VP_VDD_CORE_ID,
69 	.common = &omap3_vp_common,
70 	.vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
71 	.vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
72 	.vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
73 	.vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
74 	.vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
75 	.voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
76 };
77 
78 struct omap_vp_param omap3_mpu_vp_data = {
79 	.vddmin			= OMAP3430_VP1_VLIMITTO_VDDMIN,
80 	.vddmax			= OMAP3430_VP1_VLIMITTO_VDDMAX,
81 };
82 
83 struct omap_vp_param omap3_core_vp_data = {
84 	.vddmin			= OMAP3430_VP2_VLIMITTO_VDDMIN,
85 	.vddmax			= OMAP3430_VP2_VLIMITTO_VDDMAX,
86 };
87