提交 58aaa599 编写于 作者: K Kevin Hilman

OMAP2+: add PRM VP functions for checking/clearing VP TX done status

Add SoC specific PRM VP helper functions for checking and clearing
the VP transaction done status.

Longer term, these events should be handled by the forthcoming PRCM
interrupt handler.
Signed-off-by: NKevin Hilman <khilman@ti.com>
上级 e74e4405
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/prcm.h> #include <plat/prcm.h>
#include "vp.h"
#include "prm2xxx_3xxx.h" #include "prm2xxx_3xxx.h"
#include "cm2xxx_3xxx.h" #include "cm2xxx_3xxx.h"
#include "prm-regbits-24xx.h" #include "prm-regbits-24xx.h"
...@@ -156,3 +158,42 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) ...@@ -156,3 +158,42 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
} }
/* PRM VP */
/*
* struct omap3_vp - OMAP3 VP register access description.
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*/
struct omap3_vp {
u32 tranxdone_status;
};
struct omap3_vp omap3_vp[] = {
[OMAP3_VP_VDD_MPU_ID] = {
.tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
},
[OMAP3_VP_VDD_CORE_ID] = {
.tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
},
};
#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
u32 omap3_prm_vp_check_txdone(u8 vp_id)
{
struct omap3_vp *vp = &omap3_vp[vp_id];
u32 irqstatus;
irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
return irqstatus & vp->tranxdone_status;
}
void omap3_prm_vp_clear_txdone(u8 vp_id)
{
struct omap3_vp *vp = &omap3_vp[vp_id];
omap2_prm_write_mod_reg(vp->tranxdone_status,
OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
}
...@@ -303,6 +303,10 @@ extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); ...@@ -303,6 +303,10 @@ extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
/* OMAP3-specific VP functions */
u32 omap3_prm_vp_check_txdone(u8 vp_id);
void omap3_prm_vp_clear_txdone(u8 vp_id);
#endif /* CONFIG_ARCH_OMAP4 */ #endif /* CONFIG_ARCH_OMAP4 */
#endif #endif
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <plat/cpu.h> #include <plat/cpu.h>
#include <plat/prcm.h> #include <plat/prcm.h>
#include "vp.h"
#include "prm44xx.h" #include "prm44xx.h"
#include "prm-regbits-44xx.h" #include "prm-regbits-44xx.h"
...@@ -50,3 +51,51 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) ...@@ -50,3 +51,51 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
return v; return v;
} }
/* PRM VP */
/*
* struct omap4_vp - OMAP4 VP register access description.
* @irqstatus_mpu: offset to IRQSTATUS_MPU register for VP
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*/
struct omap4_vp {
u32 irqstatus_mpu;
u32 tranxdone_status;
};
static struct omap4_vp omap4_vp[] = {
[OMAP4_VP_VDD_MPU_ID] = {
.irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
.tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
},
[OMAP4_VP_VDD_IVA_ID] = {
.irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
},
[OMAP4_VP_VDD_CORE_ID] = {
.irqstatus_mpu = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
.tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
},
};
u32 omap4_prm_vp_check_txdone(u8 vp_id)
{
struct omap4_vp *vp = &omap4_vp[vp_id];
u32 irqstatus;
irqstatus = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
OMAP4430_PRM_OCP_SOCKET_INST,
vp->irqstatus_mpu);
return irqstatus & vp->tranxdone_status;
}
void omap4_prm_vp_clear_txdone(u8 vp_id)
{
struct omap4_vp *vp = &omap4_vp[vp_id];
omap4_prminst_write_inst_reg(vp->tranxdone_status,
OMAP4430_PRM_PARTITION,
OMAP4430_PRM_OCP_SOCKET_INST,
vp->irqstatus_mpu);
};
...@@ -751,6 +751,10 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx); ...@@ -751,6 +751,10 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx); extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx); extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
/* OMAP4-specific VP functions */
u32 omap4_prm_vp_check_txdone(u8 vp_id);
void omap4_prm_vp_clear_txdone(u8 vp_id);
# endif # endif
#endif #endif
...@@ -21,10 +21,28 @@ ...@@ -21,10 +21,28 @@
struct voltagedomain; struct voltagedomain;
/*
* Voltage Processor (VP) identifiers
*/
#define OMAP3_VP_VDD_MPU_ID 0
#define OMAP3_VP_VDD_CORE_ID 1
#define OMAP4_VP_VDD_CORE_ID 0
#define OMAP4_VP_VDD_IVA_ID 1
#define OMAP4_VP_VDD_MPU_ID 2
/* XXX document */ /* XXX document */
#define VP_IDLE_TIMEOUT 200 #define VP_IDLE_TIMEOUT 200
#define VP_TRANXDONE_TIMEOUT 300 #define VP_TRANXDONE_TIMEOUT 300
/**
* struct omap_vp_ops - per-VP operations
* @check_txdone: check for VP transaction done
* @clear_txdone: clear VP transaction done status
*/
struct omap_vp_ops {
u32 (*check_txdone)(u8 vp_id);
void (*clear_txdone)(u8 vp_id);
};
/** /**
* struct omap_vp_common_data - register data common to all VDDs * struct omap_vp_common_data - register data common to all VDDs
...@@ -68,41 +86,31 @@ struct omap_vp_common_data { ...@@ -68,41 +86,31 @@ struct omap_vp_common_data {
u8 vlimitto_vddmin_shift; u8 vlimitto_vddmin_shift;
u8 vlimitto_vddmax_shift; u8 vlimitto_vddmax_shift;
u8 vlimitto_timeout_shift; u8 vlimitto_timeout_shift;
};
/** const struct omap_vp_ops *ops;
* struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*
* XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
* hardware bug
* XXX This structure is probably not needed
*/
struct omap_vp_prm_irqst_data {
u32 tranxdone_status;
}; };
/** /**
* struct omap_vp_instance_data - VP register offsets (per-VDD) * struct omap_vp_instance_data - VP register offsets (per-VDD)
* @vp_common: pointer to struct omap_vp_common_data * for this SoC * @vp_common: pointer to struct omap_vp_common_data * for this SoC
* @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
* @vpconfig: PRM_VP*_CONFIG reg offset from PRM start * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
* @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
* @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
* @vstatus: PRM_VP*_VSTATUS reg offset from PRM start * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
* @voltage: PRM_VP*_VOLTAGE reg offset from PRM start * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
* @id: Unique identifier for VP instance.
* *
* XXX vp_common is probably not needed since it is per-SoC * XXX vp_common is probably not needed since it is per-SoC
*/ */
struct omap_vp_instance_data { struct omap_vp_instance_data {
const struct omap_vp_common_data *vp_common; const struct omap_vp_common_data *vp_common;
const struct omap_vp_prm_irqst_data *prm_irqst_data;
u8 vpconfig; u8 vpconfig;
u8 vstepmin; u8 vstepmin;
u8 vstepmax; u8 vstepmax;
u8 vlimitto; u8 vlimitto;
u8 vstatus; u8 vstatus;
u8 voltage; u8 voltage;
u8 id;
}; };
/** /**
......
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
#include "voltage.h" #include "voltage.h"
#include "vp.h" #include "vp.h"
#include "prm2xxx_3xxx.h"
static const struct omap_vp_ops omap3_vp_ops = {
.check_txdone = omap3_prm_vp_check_txdone,
.clear_txdone = omap3_prm_vp_clear_txdone,
};
/* /*
* VP data common to 34xx/36xx chips * VP data common to 34xx/36xx chips
...@@ -48,13 +54,11 @@ static const struct omap_vp_common_data omap3_vp_common = { ...@@ -48,13 +54,11 @@ static const struct omap_vp_common_data omap3_vp_common = {
.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT, .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT, .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT, .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
}; .ops = &omap3_vp_ops,
static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = {
.tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
}; };
struct omap_vp_instance_data omap3_vp1_data = { struct omap_vp_instance_data omap3_vp1_data = {
.id = OMAP3_VP_VDD_MPU_ID,
.vp_common = &omap3_vp_common, .vp_common = &omap3_vp_common,
.vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET, .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
.vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET, .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
...@@ -62,14 +66,10 @@ struct omap_vp_instance_data omap3_vp1_data = { ...@@ -62,14 +66,10 @@ struct omap_vp_instance_data omap3_vp1_data = {
.vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET, .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
.vstatus = OMAP3_PRM_VP1_STATUS_OFFSET, .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
.voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET, .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
.prm_irqst_data = &omap3_vp1_prm_irqst_data,
};
static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = {
.tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
}; };
struct omap_vp_instance_data omap3_vp2_data = { struct omap_vp_instance_data omap3_vp2_data = {
.id = OMAP3_VP_VDD_CORE_ID,
.vp_common = &omap3_vp_common, .vp_common = &omap3_vp_common,
.vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET, .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
.vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET, .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
...@@ -77,5 +77,4 @@ struct omap_vp_instance_data omap3_vp2_data = { ...@@ -77,5 +77,4 @@ struct omap_vp_instance_data omap3_vp2_data = {
.vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET, .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
.vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
.voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
.prm_irqst_data = &omap3_vp2_prm_irqst_data,
}; };
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include "vp.h" #include "vp.h"
static const struct omap_vp_ops omap4_vp_ops = {
.check_txdone = omap4_prm_vp_check_txdone,
.clear_txdone = omap4_prm_vp_clear_txdone,
};
/* /*
* VP data common to 44xx chips * VP data common to 44xx chips
* XXX This stuff presumably belongs in the vp44xx.c or vp.c file. * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
...@@ -49,13 +54,11 @@ static const struct omap_vp_common_data omap4_vp_common = { ...@@ -49,13 +54,11 @@ static const struct omap_vp_common_data omap4_vp_common = {
.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT, .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT, .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT, .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
}; .ops = &omap4_vp_ops,
static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = {
.tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
}; };
struct omap_vp_instance_data omap4_vp_mpu_data = { struct omap_vp_instance_data omap4_vp_mpu_data = {
.id = OMAP4_VP_VDD_MPU_ID,
.vp_common = &omap4_vp_common, .vp_common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET, .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET, .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
...@@ -63,14 +66,10 @@ struct omap_vp_instance_data omap4_vp_mpu_data = { ...@@ -63,14 +66,10 @@ struct omap_vp_instance_data omap4_vp_mpu_data = {
.vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET, .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
.vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET, .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
.voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET, .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
.prm_irqst_data = &omap4_vp_mpu_prm_irqst_data,
};
static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = {
.tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
}; };
struct omap_vp_instance_data omap4_vp_iva_data = { struct omap_vp_instance_data omap4_vp_iva_data = {
.id = OMAP4_VP_VDD_IVA_ID,
.vp_common = &omap4_vp_common, .vp_common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET, .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET, .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
...@@ -78,14 +77,10 @@ struct omap_vp_instance_data omap4_vp_iva_data = { ...@@ -78,14 +77,10 @@ struct omap_vp_instance_data omap4_vp_iva_data = {
.vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET, .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
.vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET, .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
.voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET, .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
.prm_irqst_data = &omap4_vp_iva_prm_irqst_data,
};
static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
.tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
}; };
struct omap_vp_instance_data omap4_vp_core_data = { struct omap_vp_instance_data omap4_vp_core_data = {
.id = OMAP4_VP_VDD_CORE_ID,
.vp_common = &omap4_vp_common, .vp_common = &omap4_vp_common,
.vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET, .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
.vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET, .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
...@@ -93,6 +88,4 @@ struct omap_vp_instance_data omap4_vp_core_data = { ...@@ -93,6 +88,4 @@ struct omap_vp_instance_data omap4_vp_core_data = {
.vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET, .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
.vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
.voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
.prm_irqst_data = &omap4_vp_core_prm_irqst_data,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册