Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * OMAP3/4 Voltage Processor (VP) structure and macro definitions
0004  *
0005  * Copyright (C) 2007, 2010 Texas Instruments, Inc.
0006  * Rajendra Nayak <rnayak@ti.com>
0007  * Lesly A M <x0080970@ti.com>
0008  * Thara Gopinath <thara@ti.com>
0009  *
0010  * Copyright (C) 2008, 2011 Nokia Corporation
0011  * Kalle Jokiniemi
0012  * Paul Walmsley
0013  */
0014 #ifndef __ARCH_ARM_MACH_OMAP2_VP_H
0015 #define __ARCH_ARM_MACH_OMAP2_VP_H
0016 
0017 #include <linux/kernel.h>
0018 
0019 struct voltagedomain;
0020 
0021 /* XXX document */
0022 #define VP_IDLE_TIMEOUT     200
0023 #define VP_TRANXDONE_TIMEOUT    300
0024 
0025 /**
0026  * struct omap_vp_ops - per-VP operations
0027  * @check_txdone: check for VP transaction done
0028  * @clear_txdone: clear VP transaction done status
0029  */
0030 struct omap_vp_ops {
0031     u32 (*check_txdone)(u8 vp_id);
0032     void (*clear_txdone)(u8 vp_id);
0033 };
0034 
0035 /**
0036  * struct omap_vp_common - register data common to all VDDs
0037  * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
0038  * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
0039  * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
0040  * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
0041  * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
0042  * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
0043  * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
0044  * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
0045  * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
0046  * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
0047  * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
0048  * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
0049  * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
0050  * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
0051  * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
0052  * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
0053  * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
0054  * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
0055  */
0056 struct omap_vp_common {
0057     u32 vpconfig_erroroffset_mask;
0058     u32 vpconfig_errorgain_mask;
0059     u32 vpconfig_initvoltage_mask;
0060     u8 vpconfig_timeouten;
0061     u8 vpconfig_initvdd;
0062     u8 vpconfig_forceupdate;
0063     u8 vpconfig_vpenable;
0064     u8 vstepmin_stepmin_shift;
0065     u8 vstepmin_smpswaittimemin_shift;
0066     u8 vstepmax_stepmax_shift;
0067     u8 vstepmax_smpswaittimemax_shift;
0068     u8 vlimitto_vddmin_shift;
0069     u8 vlimitto_vddmax_shift;
0070     u8 vlimitto_timeout_shift;
0071     u8 vpvoltage_mask;
0072 
0073     const struct omap_vp_ops *ops;
0074 };
0075 
0076 /**
0077  * struct omap_vp_instance - VP register offsets (per-VDD)
0078  * @common: pointer to struct omap_vp_common * for this SoC
0079  * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
0080  * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
0081  * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
0082  * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
0083  * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
0084  * @id: Unique identifier for VP instance.
0085  * @enabled: flag to keep track of whether vp is enabled or not
0086  *
0087  * XXX vp_common is probably not needed since it is per-SoC
0088  */
0089 struct omap_vp_instance {
0090     const struct omap_vp_common *common;
0091     u8 vpconfig;
0092     u8 vstepmin;
0093     u8 vstepmax;
0094     u8 vlimitto;
0095     u8 vstatus;
0096     u8 voltage;
0097     u8 id;
0098     bool enabled;
0099 };
0100 
0101 extern struct omap_vp_instance omap3_vp_mpu;
0102 extern struct omap_vp_instance omap3_vp_core;
0103 
0104 extern struct omap_vp_instance omap4_vp_mpu;
0105 extern struct omap_vp_instance omap4_vp_iva;
0106 extern struct omap_vp_instance omap4_vp_core;
0107 
0108 extern struct omap_vp_param omap3_mpu_vp_data;
0109 extern struct omap_vp_param omap3_core_vp_data;
0110 
0111 extern struct omap_vp_param omap4_mpu_vp_data;
0112 extern struct omap_vp_param omap4_iva_vp_data;
0113 extern struct omap_vp_param omap4_core_vp_data;
0114 
0115 void omap_vp_init(struct voltagedomain *voltdm);
0116 void omap_vp_enable(struct voltagedomain *voltdm);
0117 void omap_vp_disable(struct voltagedomain *voltdm);
0118 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
0119                   unsigned long target_volt);
0120 int omap_vp_update_errorgain(struct voltagedomain *voltdm,
0121                  unsigned long target_volt);
0122 
0123 #endif