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 "prm44xx.h"
22 #include "prm-regbits-44xx.h"
23 #include "voltage.h"
24 
25 #include "vp.h"
26 
27 static const struct omap_vp_ops omap4_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 44xx chips
34  * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
35  */
36 static const struct omap_vp_common omap4_vp_common = {
37 	.vpconfig_erroroffset_mask = OMAP4430_ERROROFFSET_MASK,
38 	.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
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 	.vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK,
52 	.ops = &omap4_vp_ops,
53 };
54 
55 struct omap_vp_instance omap4_vp_mpu = {
56 	.id = OMAP4_VP_VDD_MPU_ID,
57 	.common = &omap4_vp_common,
58 	.vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
59 	.vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
60 	.vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
61 	.vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
62 	.vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
63 	.voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
64 };
65 
66 struct omap_vp_instance omap4_vp_iva = {
67 	.id = OMAP4_VP_VDD_IVA_ID,
68 	.common = &omap4_vp_common,
69 	.vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
70 	.vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
71 	.vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
72 	.vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
73 	.vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
74 	.voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
75 };
76 
77 struct omap_vp_instance omap4_vp_core = {
78 	.id = OMAP4_VP_VDD_CORE_ID,
79 	.common = &omap4_vp_common,
80 	.vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
81 	.vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
82 	.vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
83 	.vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
84 	.vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
85 	.voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
86 };
87 
88 struct omap_vp_param omap4_mpu_vp_data = {
89 	.vddmin			= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
90 	.vddmax			= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
91 };
92 
93 struct omap_vp_param omap4_iva_vp_data = {
94 	.vddmin			= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
95 	.vddmax			= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
96 };
97 
98 struct omap_vp_param omap4_core_vp_data = {
99 	.vddmin			= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
100 	.vddmax			= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
101 };
102