Commit 536a4c8bb76e77217216bebd40178fb30ac5422b

Authored by Afzal Mohammed
1 parent 90cdb1c234
Exists in master

arm: omap: am33x: Move header files to plat/

dvfs.h is required by omap cpufreq driver that
lives in drivers folder, so move it to plat/
directory. Also move voltage.h, vc.h & vp.h
similarly to have clean header file inclusions

Signed-off-by: Afzal Mohammed <afzal@ti.com>

Showing 31 changed files with 525 additions and 550 deletions Side-by-side Diff

arch/arm/mach-omap2/dvfs.c
... ... @@ -21,7 +21,7 @@
21 21 #include <plat/omap_device.h>
22 22 #include <plat/omap_hwmod.h>
23 23 #include <plat/clock.h>
24   -#include "dvfs.h"
  24 +#include <plat/dvfs.h>
25 25 #include "smartreflex.h"
26 26 #include "powerdomain.h"
27 27  
arch/arm/mach-omap2/dvfs.h
1   -/*
2   - * OMAP3/OMAP4 DVFS Management Routines
3   - *
4   - * Author: Vishwanath BS <vishwanath.bs@ti.com>
5   - *
6   - * Copyright (C) 2011 Texas Instruments, Inc.
7   - * Vishwanath BS <vishwanath.bs@ti.com>
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License version 2 as
11   - * published by the Free Software Foundation.
12   - */
13   -
14   -#ifndef __ARCH_ARM_MACH_OMAP2_DVFS_H
15   -#define __ARCH_ARM_MACH_OMAP2_DVFS_H
16   -#include <plat/omap_hwmod.h>
17   -#include "voltage.h"
18   -
19   -#ifdef CONFIG_PM
20   -int omap_dvfs_register_device(struct device *dev, char *voltdm_name,
21   - char *clk_name);
22   -int omap_device_scale(struct device *req_dev, struct device *target_dev,
23   - unsigned long rate);
24   -#else
25   -static inline int omap_dvfs_register_device(struct omap_hwmod *oh,
26   - struct device *dev)
27   -static inline int omap_dvfs_register_device(struct device *dev,
28   - char *voltdm_name, char *clk_name)
29   -{
30   - return -EINVAL;
31   -}
32   -static inline int omap_device_scale(struct device *req_dev,
33   - struct device *target_dev, unsigned long rate)
34   -{
35   - return -EINVAL;
36   -}
37   -#endif
38   -#endif
arch/arm/mach-omap2/io.c
... ... @@ -38,7 +38,7 @@
38 38  
39 39 #include <plat/common.h>
40 40 #include <plat/omap-pm.h>
41   -#include "voltage.h"
  41 +#include <plat/voltage.h>
42 42 #include "powerdomain.h"
43 43  
44 44 #include "clockdomain.h"
arch/arm/mach-omap2/omap_opp_data.h
... ... @@ -20,8 +20,8 @@
20 20 #define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
21 21  
22 22 #include <plat/omap_hwmod.h>
  23 +#include <plat/voltage.h>
23 24  
24   -#include "voltage.h"
25 25  
26 26 /*
27 27 * *BIG FAT WARNING*:
arch/arm/mach-omap2/omap_twl.c
... ... @@ -17,8 +17,8 @@
17 17 #include <linux/io.h>
18 18 #include <linux/kernel.h>
19 19 #include <linux/i2c/twl.h>
  20 +#include <plat/voltage.h>
20 21  
21   -#include "voltage.h"
22 22  
23 23 #include "pm.h"
24 24  
arch/arm/mach-omap2/opp.c
... ... @@ -20,9 +20,9 @@
20 20 #include <linux/opp.h>
21 21  
22 22 #include <plat/omap_device.h>
  23 +#include <plat/dvfs.h>
23 24  
24 25 #include "omap_opp_data.h"
25   -#include "dvfs.h"
26 26  
27 27 /* Temp variable to allow multiple calls */
28 28 static u8 __initdata omap_table_init;
arch/arm/mach-omap2/pm.c
... ... @@ -18,8 +18,8 @@
18 18 #include <plat/omap-pm.h>
19 19 #include <plat/omap_device.h>
20 20 #include <plat/common.h>
  21 +#include <plat/voltage.h>
21 22  
22   -#include "voltage.h"
23 23 #include "powerdomain.h"
24 24 #include "clockdomain.h"
25 25 #include "pm.h"
arch/arm/mach-omap2/powerdomain.h
... ... @@ -23,8 +23,8 @@
23 23 #include <linux/atomic.h>
24 24  
25 25 #include <plat/cpu.h>
  26 +#include <plat/voltage.h>
26 27  
27   -#include "voltage.h"
28 28  
29 29 /* Powerdomain basic power states */
30 30 #define PWRDM_POWER_OFF 0x0
arch/arm/mach-omap2/prm2xxx_3xxx.c
... ... @@ -19,8 +19,7 @@
19 19 #include <plat/common.h>
20 20 #include <plat/cpu.h>
21 21 #include <plat/prcm.h>
22   -
23   -#include "vp.h"
  22 +#include <plat/vp.h>
24 23  
25 24 #include "prm2xxx_3xxx.h"
26 25 #include "cm2xxx_3xxx.h"
arch/arm/mach-omap2/prm44xx.c
... ... @@ -20,8 +20,8 @@
20 20 #include <plat/common.h>
21 21 #include <plat/cpu.h>
22 22 #include <plat/prcm.h>
  23 +#include <plat/vp.h>
23 24  
24   -#include "vp.h"
25 25 #include "prm44xx.h"
26 26 #include "prm-regbits-44xx.h"
27 27 #include "prcm44xx.h"
arch/arm/mach-omap2/smartreflex.h
... ... @@ -21,8 +21,8 @@
21 21 #define __ASM_ARM_OMAP_SMARTREFLEX_H
22 22  
23 23 #include <linux/platform_device.h>
  24 +#include <plat/voltage.h>
24 25  
25   -#include "voltage.h"
26 26  
27 27 /*
28 28 * Different Smartreflex IPs version. The v1 is the 65nm version used in
arch/arm/mach-omap2/sr_device.c
... ... @@ -23,9 +23,9 @@
23 23 #include <linux/io.h>
24 24  
25 25 #include <plat/omap_device.h>
  26 +#include <plat/voltage.h>
26 27  
27 28 #include "smartreflex.h"
28   -#include "voltage.h"
29 29 #include "control.h"
30 30 #include "pm.h"
31 31  
arch/arm/mach-omap2/vc.c
... ... @@ -12,9 +12,9 @@
12 12 #include <linux/init.h>
13 13  
14 14 #include <plat/cpu.h>
  15 +#include <plat/voltage.h>
  16 +#include <plat/vc.h>
15 17  
16   -#include "voltage.h"
17   -#include "vc.h"
18 18 #include "prm-regbits-34xx.h"
19 19 #include "prm-regbits-44xx.h"
20 20 #include "prm44xx.h"
arch/arm/mach-omap2/vc.h
1   -/*
2   - * OMAP3/4 Voltage Controller (VC) structure and macro definitions
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
14   - * modify it under the terms of the GNU General Public License version
15   - * 2 as published by the Free Software Foundation.
16   - */
17   -#ifndef __ARCH_ARM_MACH_OMAP2_VC_H
18   -#define __ARCH_ARM_MACH_OMAP2_VC_H
19   -
20   -#include <linux/kernel.h>
21   -
22   -struct voltagedomain;
23   -
24   -/**
25   - * struct omap_vc_common - per-VC register/bitfield data
26   - * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
27   - * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
28   - * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
29   - * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
30   - * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
31   - * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register
32   - * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register
33   - * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
34   - * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
35   - * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
36   - * @i2c_cfg_reg: I2C configuration register offset
37   - * @i2c_cfg_hsen_mask: high-speed mode bit field mask in I2C config register
38   - * @i2c_mcode_mask: MCODE field mask for I2C config register
39   - *
40   - * XXX One of cmd_on_mask and cmd_on_shift are not needed
41   - * XXX VALID should probably be a shift, not a mask
42   - */
43   -struct omap_vc_common {
44   - u32 cmd_on_mask;
45   - u32 valid;
46   - u8 bypass_val_reg;
47   - u8 data_shift;
48   - u8 slaveaddr_shift;
49   - u8 regaddr_shift;
50   - u8 cmd_on_shift;
51   - u8 cmd_onlp_shift;
52   - u8 cmd_ret_shift;
53   - u8 cmd_off_shift;
54   - u8 i2c_cfg_reg;
55   - u8 i2c_cfg_hsen_mask;
56   - u8 i2c_mcode_mask;
57   -};
58   -
59   -/* omap_vc_channel.flags values */
60   -#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
61   -#define OMAP_VC_CHANNEL_CFG_MUTANT BIT(1)
62   -
63   -/**
64   - * struct omap_vc_channel - VC per-instance data
65   - * @i2c_slave_addr: I2C slave address of PMIC for this VC channel
66   - * @volt_reg_addr: voltage configuration register address
67   - * @cmd_reg_addr: command configuration register address
68   - * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
69   - * @cfg_channel: current value of VC channel configuration register
70   - * @i2c_high_speed: whether or not to use I2C high-speed mode
71   - *
72   - * @common: pointer to VC common data for this platform
73   - * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
74   - * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
75   - * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
76   - * @cmdval_reg: register for on/ret/off voltage level values for this channel
77   - * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
78   - * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
79   - * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start
80   - * @cfg_channel_reg: VC channel configuration register
81   - * @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
82   - * @flags: VC channel-specific flags (optional)
83   - */
84   -struct omap_vc_channel {
85   - /* channel state */
86   - u16 i2c_slave_addr;
87   - u16 volt_reg_addr;
88   - u16 cmd_reg_addr;
89   - u16 setup_time;
90   - u8 cfg_channel;
91   - bool i2c_high_speed;
92   -
93   - /* register access data */
94   - const struct omap_vc_common *common;
95   - u32 smps_sa_mask;
96   - u32 smps_volra_mask;
97   - u32 smps_cmdra_mask;
98   - u8 cmdval_reg;
99   - u8 smps_sa_reg;
100   - u8 smps_volra_reg;
101   - u8 smps_cmdra_reg;
102   - u8 cfg_channel_reg;
103   - u8 cfg_channel_sa_shift;
104   - u8 flags;
105   -};
106   -
107   -extern struct omap_vc_channel omap3_vc_mpu;
108   -extern struct omap_vc_channel omap3_vc_core;
109   -
110   -extern struct omap_vc_channel omap4_vc_mpu;
111   -extern struct omap_vc_channel omap4_vc_iva;
112   -extern struct omap_vc_channel omap4_vc_core;
113   -
114   -void omap_vc_init_channel(struct voltagedomain *voltdm);
115   -int omap_vc_pre_scale(struct voltagedomain *voltdm,
116   - unsigned long target_volt,
117   - u8 *target_vsel, u8 *current_vsel);
118   -void omap_vc_post_scale(struct voltagedomain *voltdm,
119   - unsigned long target_volt,
120   - u8 target_vsel, u8 current_vsel);
121   -int omap_vc_bypass_scale(struct voltagedomain *voltdm,
122   - unsigned long target_volt);
123   -
124   -#endif
arch/arm/mach-omap2/vc3xxx_data.c
... ... @@ -19,11 +19,10 @@
19 19 #include <linux/init.h>
20 20  
21 21 #include <plat/common.h>
  22 +#include <plat/voltage.h>
  23 +#include <plat/vc.h>
22 24  
23 25 #include "prm-regbits-34xx.h"
24   -#include "voltage.h"
25   -
26   -#include "vc.h"
27 26  
28 27 /*
29 28 * VC data common to 34xx/36xx chips
arch/arm/mach-omap2/vc44xx_data.c
... ... @@ -19,12 +19,11 @@
19 19 #include <linux/init.h>
20 20  
21 21 #include <plat/common.h>
  22 +#include <plat/vc.h>
22 23  
23 24 #include "prm44xx.h"
24 25 #include "prm-regbits-44xx.h"
25 26 #include "voltage.h"
26   -
27   -#include "vc.h"
28 27  
29 28 /*
30 29 * VC data common to 44xx chips
arch/arm/mach-omap2/voltage.c
... ... @@ -27,6 +27,9 @@
27 27 #include <linux/clk.h>
28 28  
29 29 #include <plat/common.h>
  30 +#include <plat/voltage.h>
  31 +#include <plat/vc.h>
  32 +#include <plat/vp.h>
30 33  
31 34 #include "prm-regbits-34xx.h"
32 35 #include "prm-regbits-44xx.h"
33 36  
... ... @@ -35,11 +38,7 @@
35 38 #include "prminst44xx.h"
36 39 #include "control.h"
37 40  
38   -#include "voltage.h"
39 41 #include "powerdomain.h"
40   -
41   -#include "vc.h"
42   -#include "vp.h"
43 42  
44 43 static LIST_HEAD(voltdm_list);
45 44  
arch/arm/mach-omap2/voltage.h
1   -/*
2   - * OMAP Voltage Management Routines
3   - *
4   - * Author: Thara Gopinath <thara@ti.com>
5   - *
6   - * Copyright (C) 2009 Texas Instruments, Inc.
7   - * Thara Gopinath <thara@ti.com>
8   - *
9   - * This program is free software; you can redistribute it and/or modify
10   - * it under the terms of the GNU General Public License version 2 as
11   - * published by the Free Software Foundation.
12   - */
13   -
14   -#ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
15   -#define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
16   -
17   -#include <linux/err.h>
18   -
19   -#include "vc.h"
20   -#include "vp.h"
21   -
22   -struct powerdomain;
23   -
24   -/* XXX document */
25   -#define VOLTSCALE_VPFORCEUPDATE 1
26   -#define VOLTSCALE_VCBYPASS 2
27   -
28   -/*
29   - * OMAP3 GENERIC setup times. Revisit to see if these needs to be
30   - * passed from board or PMIC file
31   - */
32   -#define OMAP3_CLKSETUP 0xff
33   -#define OMAP3_VOLTOFFSET 0xff
34   -#define OMAP3_VOLTSETUP2 0xff
35   -
36   -struct omap_vdd_info;
37   -
38   -/**
39   - * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
40   - * data
41   - * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
42   - * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
43   - *
44   - * XXX What about VOLTOFFSET/VOLTCTRL?
45   - */
46   -struct omap_vfsm_instance {
47   - u32 voltsetup_mask;
48   - u8 voltsetup_reg;
49   -};
50   -
51   -/**
52   - * struct voltagedomain - omap voltage domain global structure.
53   - * @name: Name of the voltage domain which can be used as a unique identifier.
54   - * @scalable: Whether or not this voltage domain is scalable
55   - * @node: list_head linking all voltage domains
56   - * @pwrdm_list: list_head linking all powerdomains in this voltagedomain
57   - * @vc: pointer to VC channel associated with this voltagedomain
58   - * @vp: pointer to VP associated with this voltagedomain
59   - * @read: read a VC/VP register
60   - * @write: write a VC/VP register
61   - * @read: read-modify-write a VC/VP register
62   - * @sys_clk: system clock name/frequency, used for various timing calculations
63   - * @scale: function used to scale the voltage of the voltagedomain
64   - * @nominal_volt: current nominal voltage for this voltage domain
65   - * @volt_data: voltage table having the distinct voltages supported
66   - * by the domain and other associated per voltage data.
67   - */
68   -struct voltagedomain {
69   - char *name;
70   - bool scalable;
71   - struct list_head node;
72   - struct list_head pwrdm_list;
73   - struct omap_vc_channel *vc;
74   - const struct omap_vfsm_instance *vfsm;
75   - struct omap_vp_instance *vp;
76   - struct omap_voltdm_pmic *pmic;
77   -
78   - /* VC/VP register access functions: SoC specific */
79   - u32 (*read) (u8 offset);
80   - void (*write) (u32 val, u8 offset);
81   - u32 (*rmw)(u32 mask, u32 bits, u8 offset);
82   -
83   - union {
84   - const char *name;
85   - u32 rate;
86   - } sys_clk;
87   -
88   - int (*scale) (struct voltagedomain *voltdm,
89   - unsigned long target_volt);
90   -
91   - u32 nominal_volt;
92   - struct omap_volt_data *volt_data;
93   - struct omap_vdd_info *vdd;
94   - struct dentry *debug_dir;
95   -};
96   -
97   -/**
98   - * struct omap_volt_data - Omap voltage specific data.
99   - * @voltage_nominal: The possible voltage value in uV
100   - * @sr_efuse_offs: The offset of the efuse register(from system
101   - * control module base address) from where to read
102   - * the n-target value for the smartreflex module.
103   - * @sr_errminlimit: Error min limit value for smartreflex. This value
104   - * differs at differnet opp and thus is linked
105   - * with voltage.
106   - * @vp_errorgain: Error gain value for the voltage processor. This
107   - * field also differs according to the voltage/opp.
108   - */
109   -struct omap_volt_data {
110   - u32 volt_nominal;
111   - u32 sr_efuse_offs;
112   - u8 sr_errminlimit;
113   - u8 vp_errgain;
114   -};
115   -
116   -/**
117   - * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
118   - * @slew_rate: PMIC slew rate (in uv/us)
119   - * @step_size: PMIC voltage step size (in uv)
120   - * @i2c_slave_addr: I2C slave address of PMIC
121   - * @volt_reg_addr: voltage configuration register address
122   - * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address
123   - * @i2c_high_speed: whether VC uses I2C high-speed mode to PMIC
124   - * @i2c_mcode: master code value for I2C high-speed preamble transmission
125   - * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
126   - * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
127   - */
128   -struct omap_voltdm_pmic {
129   - int slew_rate;
130   - int step_size;
131   - u32 on_volt;
132   - u32 onlp_volt;
133   - u32 ret_volt;
134   - u32 off_volt;
135   - u16 volt_setup_time;
136   - u16 i2c_slave_addr;
137   - u16 volt_reg_addr;
138   - u16 cmd_reg_addr;
139   - u8 vp_erroroffset;
140   - u8 vp_vstepmin;
141   - u8 vp_vstepmax;
142   - u8 vp_vddmin;
143   - u8 vp_vddmax;
144   - u8 vp_timeout_us;
145   - bool i2c_high_speed;
146   - u8 i2c_mcode;
147   - unsigned long (*vsel_to_uv) (const u8 vsel);
148   - u8 (*uv_to_vsel) (unsigned long uV);
149   -};
150   -
151   -/**
152   - * struct omap_vdd_dep_volt - Map table for voltage dependencies
153   - * @main_vdd_volt : The main vdd voltage
154   - * @dep_vdd_volt : The voltage at which the dependent vdd should be
155   - * when the main vdd is at <main_vdd_volt> voltage
156   - *
157   - * Table containing the parent vdd voltage and the dependent vdd voltage
158   - * corresponding to it.
159   - */
160   -struct omap_vdd_dep_volt {
161   - u32 main_vdd_volt;
162   - u32 dep_vdd_volt;
163   -};
164   -
165   -/**
166   - * struct omap_vdd_dep_info - Dependent vdd info
167   - * @name : Dependent vdd name
168   - * @_dep_voltdm : internal structure meant to prevent multiple lookups
169   - * @dep_table : Table containing the dependent vdd voltage
170   - * corresponding to every main vdd voltage.
171   - * @nr_dep_entries : number of dependency voltage entries
172   - */
173   -struct omap_vdd_dep_info {
174   - char *name;
175   - struct voltagedomain *_dep_voltdm;
176   - struct omap_vdd_dep_volt *dep_table;
177   - int nr_dep_entries;
178   -};
179   -
180   -/**
181   - * omap_vdd_info - Per Voltage Domain info
182   - *
183   - * @volt_data : voltage table having the distinct voltages supported
184   - * by the domain and other associated per voltage data.
185   - * @dep_vdd_info : Array ending with a 0 terminator for dependency
186   - * voltage information.
187   - */
188   -struct omap_vdd_info {
189   - struct omap_volt_data *volt_data;
190   - struct omap_vdd_dep_info *dep_vdd_info;
191   -};
192   -
193   -void omap_voltage_get_volttable(struct voltagedomain *voltdm,
194   - struct omap_volt_data **volt_data);
195   -struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
196   - unsigned long volt);
197   -int omap_voltage_register_pmic(struct voltagedomain *voltdm,
198   - struct omap_voltdm_pmic *pmic);
199   -void omap_change_voltscale_method(struct voltagedomain *voltdm,
200   - int voltscale_method);
201   -int omap_voltage_late_init(void);
202   -
203   -extern void omap2xxx_voltagedomains_init(void);
204   -extern void omap3xxx_voltagedomains_init(void);
205   -extern void am33xx_voltagedomains_init(void);
206   -extern void omap44xx_voltagedomains_init(void);
207   -
208   -struct voltagedomain *voltdm_lookup(const char *name);
209   -void voltdm_init(struct voltagedomain **voltdm_list);
210   -int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
211   -int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
212   - void *user);
213   -int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
214   - int (*fn)(struct voltagedomain *voltdm,
215   - struct powerdomain *pwrdm));
216   -int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
217   -void voltdm_reset(struct voltagedomain *voltdm);
218   -unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
219   -#endif
arch/arm/mach-omap2/voltagedomains2xxx_data.c
... ... @@ -9,8 +9,8 @@
9 9 */
10 10 #include <linux/kernel.h>
11 11 #include <linux/init.h>
  12 +#include <plat/voltage.h>
12 13  
13   -#include "voltage.h"
14 14  
15 15 static struct voltagedomain omap2_voltdm_core = {
16 16 .name = "core",
arch/arm/mach-omap2/voltagedomains33xx_data.c
... ... @@ -10,7 +10,7 @@
10 10 #include <linux/kernel.h>
11 11 #include <linux/init.h>
12 12  
13   -#include "voltage.h"
  13 +#include <plat/voltage.h>
14 14  
15 15 static struct voltagedomain am33xx_voltdm_mpu = {
16 16 .name = "mpu",
arch/arm/mach-omap2/voltagedomains3xxx_data.c
... ... @@ -20,12 +20,12 @@
20 20  
21 21 #include <plat/common.h>
22 22 #include <plat/cpu.h>
  23 +#include <plat/voltage.h>
  24 +#include <plat/vc.h>
  25 +#include <plat/vp.h>
23 26  
24 27 #include "prm-regbits-34xx.h"
25 28 #include "omap_opp_data.h"
26   -#include "voltage.h"
27   -#include "vc.h"
28   -#include "vp.h"
29 29  
30 30 /*
31 31 * VDD data
arch/arm/mach-omap2/voltagedomains44xx_data.c
... ... @@ -22,6 +22,8 @@
22 22 #include <linux/init.h>
23 23  
24 24 #include <plat/common.h>
  25 +#include <plat/vc.h>
  26 +#include <plat/vp.h>
25 27  
26 28 #include "prm-regbits-44xx.h"
27 29 #include "prm44xx.h"
... ... @@ -29,8 +31,6 @@
29 31 #include "prminst44xx.h"
30 32 #include "voltage.h"
31 33 #include "omap_opp_data.h"
32   -#include "vc.h"
33   -#include "vp.h"
34 34  
35 35 static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
36 36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
arch/arm/mach-omap2/vp.c
... ... @@ -2,9 +2,9 @@
2 2 #include <linux/init.h>
3 3  
4 4 #include <plat/common.h>
  5 +#include <plat/voltage.h>
  6 +#include <plat/vp.h>
5 7  
6   -#include "voltage.h"
7   -#include "vp.h"
8 8 #include "prm-regbits-34xx.h"
9 9 #include "prm-regbits-44xx.h"
10 10 #include "prm44xx.h"
arch/arm/mach-omap2/vp.h
1   -/*
2   - * OMAP3/4 Voltage Processor (VP) structure and macro definitions
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
14   - * modify it under the terms of the GNU General Public License version
15   - * 2 as published by the Free Software Foundation.
16   - */
17   -#ifndef __ARCH_ARM_MACH_OMAP2_VP_H
18   -#define __ARCH_ARM_MACH_OMAP2_VP_H
19   -
20   -#include <linux/kernel.h>
21   -
22   -struct voltagedomain;
23   -
24   -/*
25   - * Voltage Processor (VP) identifiers
26   - */
27   -#define OMAP3_VP_VDD_MPU_ID 0
28   -#define OMAP3_VP_VDD_CORE_ID 1
29   -#define OMAP4_VP_VDD_CORE_ID 0
30   -#define OMAP4_VP_VDD_IVA_ID 1
31   -#define OMAP4_VP_VDD_MPU_ID 2
32   -
33   -/* XXX document */
34   -#define VP_IDLE_TIMEOUT 200
35   -#define VP_TRANXDONE_TIMEOUT 300
36   -
37   -/**
38   - * struct omap_vp_ops - per-VP operations
39   - * @check_txdone: check for VP transaction done
40   - * @clear_txdone: clear VP transaction done status
41   - */
42   -struct omap_vp_ops {
43   - u32 (*check_txdone)(u8 vp_id);
44   - void (*clear_txdone)(u8 vp_id);
45   -};
46   -
47   -/**
48   - * struct omap_vp_common - register data common to all VDDs
49   - * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
50   - * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
51   - * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
52   - * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
53   - * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
54   - * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
55   - * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
56   - * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
57   - * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
58   - * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
59   - * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
60   - * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
61   - * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
62   - * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
63   - * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
64   - * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
65   - * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
66   - * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
67   - */
68   -struct omap_vp_common {
69   - u32 vpconfig_erroroffset_mask;
70   - u32 vpconfig_errorgain_mask;
71   - u32 vpconfig_initvoltage_mask;
72   - u8 vpconfig_timeouten;
73   - u8 vpconfig_initvdd;
74   - u8 vpconfig_forceupdate;
75   - u8 vpconfig_vpenable;
76   - u8 vstepmin_stepmin_shift;
77   - u8 vstepmin_smpswaittimemin_shift;
78   - u8 vstepmax_stepmax_shift;
79   - u8 vstepmax_smpswaittimemax_shift;
80   - u8 vlimitto_vddmin_shift;
81   - u8 vlimitto_vddmax_shift;
82   - u8 vlimitto_timeout_shift;
83   - u8 vpvoltage_mask;
84   -
85   - const struct omap_vp_ops *ops;
86   -};
87   -
88   -/**
89   - * struct omap_vp_instance - VP register offsets (per-VDD)
90   - * @common: pointer to struct omap_vp_common * for this SoC
91   - * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
92   - * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
93   - * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
94   - * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
95   - * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
96   - * @id: Unique identifier for VP instance.
97   - * @enabled: flag to keep track of whether vp is enabled or not
98   - *
99   - * XXX vp_common is probably not needed since it is per-SoC
100   - */
101   -struct omap_vp_instance {
102   - const struct omap_vp_common *common;
103   - u8 vpconfig;
104   - u8 vstepmin;
105   - u8 vstepmax;
106   - u8 vlimitto;
107   - u8 vstatus;
108   - u8 voltage;
109   - u8 id;
110   - bool enabled;
111   -};
112   -
113   -extern struct omap_vp_instance omap3_vp_mpu;
114   -extern struct omap_vp_instance omap3_vp_core;
115   -
116   -extern struct omap_vp_instance omap4_vp_mpu;
117   -extern struct omap_vp_instance omap4_vp_iva;
118   -extern struct omap_vp_instance omap4_vp_core;
119   -
120   -void omap_vp_init(struct voltagedomain *voltdm);
121   -void omap_vp_enable(struct voltagedomain *voltdm);
122   -void omap_vp_disable(struct voltagedomain *voltdm);
123   -int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
124   - unsigned long target_volt);
125   -int omap_vp_update_errorgain(struct voltagedomain *voltdm,
126   - unsigned long target_volt);
127   -
128   -#endif
arch/arm/mach-omap2/vp3xxx_data.c
... ... @@ -20,11 +20,11 @@
20 20 #include <linux/init.h>
21 21  
22 22 #include <plat/common.h>
  23 +#include <plat/voltage.h>
  24 +#include <plat/vp.h>
23 25  
24 26 #include "prm-regbits-34xx.h"
25   -#include "voltage.h"
26 27  
27   -#include "vp.h"
28 28 #include "prm2xxx_3xxx.h"
29 29  
30 30 static const struct omap_vp_ops omap3_vp_ops = {
arch/arm/mach-omap2/vp44xx_data.c
... ... @@ -20,12 +20,11 @@
20 20 #include <linux/init.h>
21 21  
22 22 #include <plat/common.h>
  23 +#include <plat/voltage.h>
  24 +#include <plat/vp.h>
23 25  
24 26 #include "prm44xx.h"
25 27 #include "prm-regbits-44xx.h"
26   -#include "voltage.h"
27   -
28   -#include "vp.h"
29 28  
30 29 static const struct omap_vp_ops omap4_vp_ops = {
31 30 .check_txdone = omap4_prm_vp_check_txdone,
arch/arm/plat-omap/include/plat/dvfs.h
  1 +/*
  2 + * OMAP3/OMAP4 DVFS Management Routines
  3 + *
  4 + * Author: Vishwanath BS <vishwanath.bs@ti.com>
  5 + *
  6 + * Copyright (C) 2011 Texas Instruments, Inc.
  7 + * Vishwanath BS <vishwanath.bs@ti.com>
  8 + *
  9 + * This program is free software; you can redistribute it and/or modify
  10 + * it under the terms of the GNU General Public License version 2 as
  11 + * published by the Free Software Foundation.
  12 + */
  13 +
  14 +#ifndef __ARCH_ARM_MACH_OMAP2_DVFS_H
  15 +#define __ARCH_ARM_MACH_OMAP2_DVFS_H
  16 +#include <plat/omap_hwmod.h>
  17 +#include <plat/voltage.h>
  18 +
  19 +#ifdef CONFIG_PM
  20 +int omap_dvfs_register_device(struct device *dev, char *voltdm_name,
  21 + char *clk_name);
  22 +int omap_device_scale(struct device *req_dev, struct device *target_dev,
  23 + unsigned long rate);
  24 +#else
  25 +static inline int omap_dvfs_register_device(struct omap_hwmod *oh,
  26 + struct device *dev)
  27 +static inline int omap_dvfs_register_device(struct device *dev,
  28 + char *voltdm_name, char *clk_name)
  29 +{
  30 + return -EINVAL;
  31 +}
  32 +static inline int omap_device_scale(struct device *req_dev,
  33 + struct device *target_dev, unsigned long rate)
  34 +{
  35 + return -EINVAL;
  36 +}
  37 +#endif
  38 +#endif
arch/arm/plat-omap/include/plat/vc.h
  1 +/*
  2 + * OMAP3/4 Voltage Controller (VC) structure and macro definitions
  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
  14 + * modify it under the terms of the GNU General Public License version
  15 + * 2 as published by the Free Software Foundation.
  16 + */
  17 +#ifndef __ARCH_ARM_MACH_OMAP2_VC_H
  18 +#define __ARCH_ARM_MACH_OMAP2_VC_H
  19 +
  20 +#include <linux/kernel.h>
  21 +
  22 +struct voltagedomain;
  23 +
  24 +/**
  25 + * struct omap_vc_common - per-VC register/bitfield data
  26 + * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
  27 + * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
  28 + * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
  29 + * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
  30 + * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
  31 + * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register
  32 + * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register
  33 + * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
  34 + * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
  35 + * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
  36 + * @i2c_cfg_reg: I2C configuration register offset
  37 + * @i2c_cfg_hsen_mask: high-speed mode bit field mask in I2C config register
  38 + * @i2c_mcode_mask: MCODE field mask for I2C config register
  39 + *
  40 + * XXX One of cmd_on_mask and cmd_on_shift are not needed
  41 + * XXX VALID should probably be a shift, not a mask
  42 + */
  43 +struct omap_vc_common {
  44 + u32 cmd_on_mask;
  45 + u32 valid;
  46 + u8 bypass_val_reg;
  47 + u8 data_shift;
  48 + u8 slaveaddr_shift;
  49 + u8 regaddr_shift;
  50 + u8 cmd_on_shift;
  51 + u8 cmd_onlp_shift;
  52 + u8 cmd_ret_shift;
  53 + u8 cmd_off_shift;
  54 + u8 i2c_cfg_reg;
  55 + u8 i2c_cfg_hsen_mask;
  56 + u8 i2c_mcode_mask;
  57 +};
  58 +
  59 +/* omap_vc_channel.flags values */
  60 +#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
  61 +#define OMAP_VC_CHANNEL_CFG_MUTANT BIT(1)
  62 +
  63 +/**
  64 + * struct omap_vc_channel - VC per-instance data
  65 + * @i2c_slave_addr: I2C slave address of PMIC for this VC channel
  66 + * @volt_reg_addr: voltage configuration register address
  67 + * @cmd_reg_addr: command configuration register address
  68 + * @setup_time: setup time (in sys_clk cycles) of regulator for this channel
  69 + * @cfg_channel: current value of VC channel configuration register
  70 + * @i2c_high_speed: whether or not to use I2C high-speed mode
  71 + *
  72 + * @common: pointer to VC common data for this platform
  73 + * @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
  74 + * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
  75 + * @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
  76 + * @cmdval_reg: register for on/ret/off voltage level values for this channel
  77 + * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
  78 + * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
  79 + * @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start
  80 + * @cfg_channel_reg: VC channel configuration register
  81 + * @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
  82 + * @flags: VC channel-specific flags (optional)
  83 + */
  84 +struct omap_vc_channel {
  85 + /* channel state */
  86 + u16 i2c_slave_addr;
  87 + u16 volt_reg_addr;
  88 + u16 cmd_reg_addr;
  89 + u16 setup_time;
  90 + u8 cfg_channel;
  91 + bool i2c_high_speed;
  92 +
  93 + /* register access data */
  94 + const struct omap_vc_common *common;
  95 + u32 smps_sa_mask;
  96 + u32 smps_volra_mask;
  97 + u32 smps_cmdra_mask;
  98 + u8 cmdval_reg;
  99 + u8 smps_sa_reg;
  100 + u8 smps_volra_reg;
  101 + u8 smps_cmdra_reg;
  102 + u8 cfg_channel_reg;
  103 + u8 cfg_channel_sa_shift;
  104 + u8 flags;
  105 +};
  106 +
  107 +extern struct omap_vc_channel omap3_vc_mpu;
  108 +extern struct omap_vc_channel omap3_vc_core;
  109 +
  110 +extern struct omap_vc_channel omap4_vc_mpu;
  111 +extern struct omap_vc_channel omap4_vc_iva;
  112 +extern struct omap_vc_channel omap4_vc_core;
  113 +
  114 +void omap_vc_init_channel(struct voltagedomain *voltdm);
  115 +int omap_vc_pre_scale(struct voltagedomain *voltdm,
  116 + unsigned long target_volt,
  117 + u8 *target_vsel, u8 *current_vsel);
  118 +void omap_vc_post_scale(struct voltagedomain *voltdm,
  119 + unsigned long target_volt,
  120 + u8 target_vsel, u8 current_vsel);
  121 +int omap_vc_bypass_scale(struct voltagedomain *voltdm,
  122 + unsigned long target_volt);
  123 +
  124 +#endif
arch/arm/plat-omap/include/plat/voltage.h
1 1 /*
2 2 * OMAP Voltage Management Routines
3 3 *
4   - * Copyright (C) 2011, Texas Instruments, Inc.
  4 + * Author: Thara Gopinath <thara@ti.com>
5 5 *
  6 + * Copyright (C) 2009 Texas Instruments, Inc.
  7 + * Thara Gopinath <thara@ti.com>
  8 + *
6 9 * This program is free software; you can redistribute it and/or modify
7 10 * it under the terms of the GNU General Public License version 2 as
8 11 * published by the Free Software Foundation.
9 12  
10 13  
11 14  
12 15  
... ... @@ -11,11 +14,207 @@
11 14 #ifndef __ARCH_ARM_OMAP_VOLTAGE_H
12 15 #define __ARCH_ARM_OMAP_VOLTAGE_H
13 16  
14   -struct voltagedomain;
  17 +#include <linux/err.h>
15 18  
  19 +#include <plat/vc.h>
  20 +#include <plat/vp.h>
  21 +
  22 +struct powerdomain;
  23 +
  24 +/* XXX document */
  25 +#define VOLTSCALE_VPFORCEUPDATE 1
  26 +#define VOLTSCALE_VCBYPASS 2
  27 +
  28 +/*
  29 + * OMAP3 GENERIC setup times. Revisit to see if these needs to be
  30 + * passed from board or PMIC file
  31 + */
  32 +#define OMAP3_CLKSETUP 0xff
  33 +#define OMAP3_VOLTOFFSET 0xff
  34 +#define OMAP3_VOLTSETUP2 0xff
  35 +
  36 +struct omap_vdd_info;
  37 +
  38 +/**
  39 + * struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
  40 + * data
  41 + * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
  42 + * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
  43 + *
  44 + * XXX What about VOLTOFFSET/VOLTCTRL?
  45 + */
  46 +struct omap_vfsm_instance {
  47 + u32 voltsetup_mask;
  48 + u8 voltsetup_reg;
  49 +};
  50 +
  51 +/**
  52 + * struct voltagedomain - omap voltage domain global structure.
  53 + * @name: Name of the voltage domain which can be used as a unique identifier.
  54 + * @scalable: Whether or not this voltage domain is scalable
  55 + * @node: list_head linking all voltage domains
  56 + * @pwrdm_list: list_head linking all powerdomains in this voltagedomain
  57 + * @vc: pointer to VC channel associated with this voltagedomain
  58 + * @vp: pointer to VP associated with this voltagedomain
  59 + * @read: read a VC/VP register
  60 + * @write: write a VC/VP register
  61 + * @read: read-modify-write a VC/VP register
  62 + * @sys_clk: system clock name/frequency, used for various timing calculations
  63 + * @scale: function used to scale the voltage of the voltagedomain
  64 + * @nominal_volt: current nominal voltage for this voltage domain
  65 + * @volt_data: voltage table having the distinct voltages supported
  66 + * by the domain and other associated per voltage data.
  67 + */
  68 +struct voltagedomain {
  69 + char *name;
  70 + bool scalable;
  71 + struct list_head node;
  72 + struct list_head pwrdm_list;
  73 + struct omap_vc_channel *vc;
  74 + const struct omap_vfsm_instance *vfsm;
  75 + struct omap_vp_instance *vp;
  76 + struct omap_voltdm_pmic *pmic;
  77 +
  78 + /* VC/VP register access functions: SoC specific */
  79 + u32 (*read) (u8 offset);
  80 + void (*write) (u32 val, u8 offset);
  81 + u32 (*rmw)(u32 mask, u32 bits, u8 offset);
  82 +
  83 + union {
  84 + const char *name;
  85 + u32 rate;
  86 + } sys_clk;
  87 +
  88 + int (*scale) (struct voltagedomain *voltdm,
  89 + unsigned long target_volt);
  90 +
  91 + u32 nominal_volt;
  92 + struct omap_volt_data *volt_data;
  93 + struct omap_vdd_info *vdd;
  94 + struct dentry *debug_dir;
  95 +};
  96 +
  97 +/**
  98 + * struct omap_volt_data - Omap voltage specific data.
  99 + * @voltage_nominal: The possible voltage value in uV
  100 + * @sr_efuse_offs: The offset of the efuse register(from system
  101 + * control module base address) from where to read
  102 + * the n-target value for the smartreflex module.
  103 + * @sr_errminlimit: Error min limit value for smartreflex. This value
  104 + * differs at differnet opp and thus is linked
  105 + * with voltage.
  106 + * @vp_errorgain: Error gain value for the voltage processor. This
  107 + * field also differs according to the voltage/opp.
  108 + */
  109 +struct omap_volt_data {
  110 + u32 volt_nominal;
  111 + u32 sr_efuse_offs;
  112 + u8 sr_errminlimit;
  113 + u8 vp_errgain;
  114 +};
  115 +
  116 +/**
  117 + * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
  118 + * @slew_rate: PMIC slew rate (in uv/us)
  119 + * @step_size: PMIC voltage step size (in uv)
  120 + * @i2c_slave_addr: I2C slave address of PMIC
  121 + * @volt_reg_addr: voltage configuration register address
  122 + * @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address
  123 + * @i2c_high_speed: whether VC uses I2C high-speed mode to PMIC
  124 + * @i2c_mcode: master code value for I2C high-speed preamble transmission
  125 + * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
  126 + * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
  127 + */
  128 +struct omap_voltdm_pmic {
  129 + int slew_rate;
  130 + int step_size;
  131 + u32 on_volt;
  132 + u32 onlp_volt;
  133 + u32 ret_volt;
  134 + u32 off_volt;
  135 + u16 volt_setup_time;
  136 + u16 i2c_slave_addr;
  137 + u16 volt_reg_addr;
  138 + u16 cmd_reg_addr;
  139 + u8 vp_erroroffset;
  140 + u8 vp_vstepmin;
  141 + u8 vp_vstepmax;
  142 + u8 vp_vddmin;
  143 + u8 vp_vddmax;
  144 + u8 vp_timeout_us;
  145 + bool i2c_high_speed;
  146 + u8 i2c_mcode;
  147 + unsigned long (*vsel_to_uv) (const u8 vsel);
  148 + u8 (*uv_to_vsel) (unsigned long uV);
  149 +};
  150 +
  151 +/**
  152 + * struct omap_vdd_dep_volt - Map table for voltage dependencies
  153 + * @main_vdd_volt : The main vdd voltage
  154 + * @dep_vdd_volt : The voltage at which the dependent vdd should be
  155 + * when the main vdd is at <main_vdd_volt> voltage
  156 + *
  157 + * Table containing the parent vdd voltage and the dependent vdd voltage
  158 + * corresponding to it.
  159 + */
  160 +struct omap_vdd_dep_volt {
  161 + u32 main_vdd_volt;
  162 + u32 dep_vdd_volt;
  163 +};
  164 +
  165 +/**
  166 + * struct omap_vdd_dep_info - Dependent vdd info
  167 + * @name : Dependent vdd name
  168 + * @_dep_voltdm : internal structure meant to prevent multiple lookups
  169 + * @dep_table : Table containing the dependent vdd voltage
  170 + * corresponding to every main vdd voltage.
  171 + * @nr_dep_entries : number of dependency voltage entries
  172 + */
  173 +struct omap_vdd_dep_info {
  174 + char *name;
  175 + struct voltagedomain *_dep_voltdm;
  176 + struct omap_vdd_dep_volt *dep_table;
  177 + int nr_dep_entries;
  178 +};
  179 +
  180 +/**
  181 + * omap_vdd_info - Per Voltage Domain info
  182 + *
  183 + * @volt_data : voltage table having the distinct voltages supported
  184 + * by the domain and other associated per voltage data.
  185 + * @dep_vdd_info : Array ending with a 0 terminator for dependency
  186 + * voltage information.
  187 + */
  188 +struct omap_vdd_info {
  189 + struct omap_volt_data *volt_data;
  190 + struct omap_vdd_dep_info *dep_vdd_info;
  191 +};
  192 +
  193 +void omap_voltage_get_volttable(struct voltagedomain *voltdm,
  194 + struct omap_volt_data **volt_data);
  195 +struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
  196 + unsigned long volt);
  197 +int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  198 + struct omap_voltdm_pmic *pmic);
  199 +void omap_change_voltscale_method(struct voltagedomain *voltdm,
  200 + int voltscale_method);
  201 +int omap_voltage_late_init(void);
  202 +
  203 +extern void omap2xxx_voltagedomains_init(void);
  204 +extern void omap3xxx_voltagedomains_init(void);
  205 +extern void am33xx_voltagedomains_init(void);
  206 +extern void omap44xx_voltagedomains_init(void);
  207 +
16 208 struct voltagedomain *voltdm_lookup(const char *name);
  209 +void voltdm_init(struct voltagedomain **voltdm_list);
  210 +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
  211 +int voltdm_for_each(int (*fn)(struct voltagedomain *voltdm, void *user),
  212 + void *user);
  213 +int voltdm_for_each_pwrdm(struct voltagedomain *voltdm,
  214 + int (*fn)(struct voltagedomain *voltdm,
  215 + struct powerdomain *pwrdm));
17 216 int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
  217 +void voltdm_reset(struct voltagedomain *voltdm);
18 218 unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
19   -
20 219 #endif
arch/arm/plat-omap/include/plat/vp.h
  1 +/*
  2 + * OMAP3/4 Voltage Processor (VP) structure and macro definitions
  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
  14 + * modify it under the terms of the GNU General Public License version
  15 + * 2 as published by the Free Software Foundation.
  16 + */
  17 +#ifndef __ARCH_ARM_MACH_OMAP2_VP_H
  18 +#define __ARCH_ARM_MACH_OMAP2_VP_H
  19 +
  20 +#include <linux/kernel.h>
  21 +
  22 +struct voltagedomain;
  23 +
  24 +/*
  25 + * Voltage Processor (VP) identifiers
  26 + */
  27 +#define OMAP3_VP_VDD_MPU_ID 0
  28 +#define OMAP3_VP_VDD_CORE_ID 1
  29 +#define OMAP4_VP_VDD_CORE_ID 0
  30 +#define OMAP4_VP_VDD_IVA_ID 1
  31 +#define OMAP4_VP_VDD_MPU_ID 2
  32 +
  33 +/* XXX document */
  34 +#define VP_IDLE_TIMEOUT 200
  35 +#define VP_TRANXDONE_TIMEOUT 300
  36 +
  37 +/**
  38 + * struct omap_vp_ops - per-VP operations
  39 + * @check_txdone: check for VP transaction done
  40 + * @clear_txdone: clear VP transaction done status
  41 + */
  42 +struct omap_vp_ops {
  43 + u32 (*check_txdone)(u8 vp_id);
  44 + void (*clear_txdone)(u8 vp_id);
  45 +};
  46 +
  47 +/**
  48 + * struct omap_vp_common - register data common to all VDDs
  49 + * @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
  50 + * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
  51 + * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
  52 + * @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
  53 + * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
  54 + * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
  55 + * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
  56 + * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
  57 + * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
  58 + * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
  59 + * @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
  60 + * @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
  61 + * @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
  62 + * @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
  63 + * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
  64 + * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
  65 + * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
  66 + * @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
  67 + */
  68 +struct omap_vp_common {
  69 + u32 vpconfig_erroroffset_mask;
  70 + u32 vpconfig_errorgain_mask;
  71 + u32 vpconfig_initvoltage_mask;
  72 + u8 vpconfig_timeouten;
  73 + u8 vpconfig_initvdd;
  74 + u8 vpconfig_forceupdate;
  75 + u8 vpconfig_vpenable;
  76 + u8 vstepmin_stepmin_shift;
  77 + u8 vstepmin_smpswaittimemin_shift;
  78 + u8 vstepmax_stepmax_shift;
  79 + u8 vstepmax_smpswaittimemax_shift;
  80 + u8 vlimitto_vddmin_shift;
  81 + u8 vlimitto_vddmax_shift;
  82 + u8 vlimitto_timeout_shift;
  83 + u8 vpvoltage_mask;
  84 +
  85 + const struct omap_vp_ops *ops;
  86 +};
  87 +
  88 +/**
  89 + * struct omap_vp_instance - VP register offsets (per-VDD)
  90 + * @common: pointer to struct omap_vp_common * for this SoC
  91 + * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
  92 + * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
  93 + * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
  94 + * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
  95 + * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
  96 + * @id: Unique identifier for VP instance.
  97 + * @enabled: flag to keep track of whether vp is enabled or not
  98 + *
  99 + * XXX vp_common is probably not needed since it is per-SoC
  100 + */
  101 +struct omap_vp_instance {
  102 + const struct omap_vp_common *common;
  103 + u8 vpconfig;
  104 + u8 vstepmin;
  105 + u8 vstepmax;
  106 + u8 vlimitto;
  107 + u8 vstatus;
  108 + u8 voltage;
  109 + u8 id;
  110 + bool enabled;
  111 +};
  112 +
  113 +extern struct omap_vp_instance omap3_vp_mpu;
  114 +extern struct omap_vp_instance omap3_vp_core;
  115 +
  116 +extern struct omap_vp_instance omap4_vp_mpu;
  117 +extern struct omap_vp_instance omap4_vp_iva;
  118 +extern struct omap_vp_instance omap4_vp_core;
  119 +
  120 +void omap_vp_init(struct voltagedomain *voltdm);
  121 +void omap_vp_enable(struct voltagedomain *voltdm);
  122 +void omap_vp_disable(struct voltagedomain *voltdm);
  123 +int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
  124 + unsigned long target_volt);
  125 +int omap_vp_update_errorgain(struct voltagedomain *voltdm,
  126 + unsigned long target_volt);
  127 +
  128 +#endif
drivers/cpufreq/omap-cpufreq.c
... ... @@ -33,6 +33,7 @@
33 33 #include <plat/omap-pm.h>
34 34 #include <plat/omap_device.h>
35 35 #include <plat/common.h>
  36 +#include <plat/dvfs.h>
36 37  
37 38 #include <mach/hardware.h>
38 39