mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	ARM: OMAP3+: PRM: add common APIs for prm_vp_check/clear_txdone
PRM driver now only exports a generic API for clearing / checking VP txdone status. Signed-off-by: Tero Kristo <t-kristo@ti.com>
This commit is contained in:
		
							parent
							
								
									9cb6d36371
								
							
						
					
					
						commit
						e9f1ddcdec
					
				
					 9 changed files with 60 additions and 25 deletions
				
			
		| 
						 | 
					@ -147,6 +147,8 @@ struct prm_ll_data {
 | 
				
			||||||
				     u16 offset);
 | 
									     u16 offset);
 | 
				
			||||||
	void (*reset_system)(void);
 | 
						void (*reset_system)(void);
 | 
				
			||||||
	int (*clear_mod_irqs)(s16 module, u8 regs, u32 wkst_mask);
 | 
						int (*clear_mod_irqs)(s16 module, u8 regs, u32 wkst_mask);
 | 
				
			||||||
 | 
						u32 (*vp_check_txdone)(u8 vp_id);
 | 
				
			||||||
 | 
						void (*vp_clear_txdone)(u8 vp_id);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int prm_register(struct prm_ll_data *pld);
 | 
					extern int prm_register(struct prm_ll_data *pld);
 | 
				
			||||||
| 
						 | 
					@ -164,6 +166,18 @@ void omap_prm_reset_system(void);
 | 
				
			||||||
void omap_prm_reconfigure_io_chain(void);
 | 
					void omap_prm_reconfigure_io_chain(void);
 | 
				
			||||||
int omap_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask);
 | 
					int omap_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * 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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					u32 omap_prm_vp_check_txdone(u8 vp_id);
 | 
				
			||||||
 | 
					void omap_prm_vp_clear_txdone(u8 vp_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,7 @@ static struct omap3_vp omap3_vp[] = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
 | 
					#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
u32 omap3_prm_vp_check_txdone(u8 vp_id)
 | 
					static u32 omap3_prm_vp_check_txdone(u8 vp_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct omap3_vp *vp = &omap3_vp[vp_id];
 | 
						struct omap3_vp *vp = &omap3_vp[vp_id];
 | 
				
			||||||
	u32 irqstatus;
 | 
						u32 irqstatus;
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@ u32 omap3_prm_vp_check_txdone(u8 vp_id)
 | 
				
			||||||
	return irqstatus & vp->tranxdone_status;
 | 
						return irqstatus & vp->tranxdone_status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void omap3_prm_vp_clear_txdone(u8 vp_id)
 | 
					static void omap3_prm_vp_clear_txdone(u8 vp_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct omap3_vp *vp = &omap3_vp[vp_id];
 | 
						struct omap3_vp *vp = &omap3_vp[vp_id];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -665,6 +665,8 @@ static struct prm_ll_data omap3xxx_prm_ll_data = {
 | 
				
			||||||
	.is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
 | 
						.is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
 | 
				
			||||||
	.reset_system = &omap3xxx_prm_dpll3_reset,
 | 
						.reset_system = &omap3xxx_prm_dpll3_reset,
 | 
				
			||||||
	.clear_mod_irqs = &omap3xxx_prm_clear_mod_irqs,
 | 
						.clear_mod_irqs = &omap3xxx_prm_clear_mod_irqs,
 | 
				
			||||||
 | 
						.vp_check_txdone = &omap3_prm_vp_check_txdone,
 | 
				
			||||||
 | 
						.vp_clear_txdone = &omap3_prm_vp_clear_txdone,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int __init omap3xxx_prm_init(void)
 | 
					int __init omap3xxx_prm_init(void)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,10 +132,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __ASSEMBLER__
 | 
					#ifndef __ASSEMBLER__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* OMAP3-specific VP functions */
 | 
					 | 
				
			||||||
u32 omap3_prm_vp_check_txdone(u8 vp_id);
 | 
					 | 
				
			||||||
void omap3_prm_vp_clear_txdone(u8 vp_id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * OMAP3 access functions for voltage controller (VC) and
 | 
					 * OMAP3 access functions for voltage controller (VC) and
 | 
				
			||||||
 * voltage proccessor (VP) in the PRM.
 | 
					 * voltage proccessor (VP) in the PRM.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,7 +138,7 @@ static struct omap4_vp omap4_vp[] = {
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
u32 omap4_prm_vp_check_txdone(u8 vp_id)
 | 
					static u32 omap4_prm_vp_check_txdone(u8 vp_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct omap4_vp *vp = &omap4_vp[vp_id];
 | 
						struct omap4_vp *vp = &omap4_vp[vp_id];
 | 
				
			||||||
	u32 irqstatus;
 | 
						u32 irqstatus;
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ u32 omap4_prm_vp_check_txdone(u8 vp_id)
 | 
				
			||||||
	return irqstatus & vp->tranxdone_status;
 | 
						return irqstatus & vp->tranxdone_status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void omap4_prm_vp_clear_txdone(u8 vp_id)
 | 
					static void omap4_prm_vp_clear_txdone(u8 vp_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct omap4_vp *vp = &omap4_vp[vp_id];
 | 
						struct omap4_vp *vp = &omap4_vp[vp_id];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -699,6 +699,8 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
 | 
				
			||||||
	.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 | 
						.deassert_hardreset	= omap4_prminst_deassert_hardreset,
 | 
				
			||||||
	.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
 | 
						.is_hardreset_asserted	= omap4_prminst_is_hardreset_asserted,
 | 
				
			||||||
	.reset_system		= omap4_prminst_global_warm_sw_reset,
 | 
						.reset_system		= omap4_prminst_global_warm_sw_reset,
 | 
				
			||||||
 | 
						.vp_check_txdone	= omap4_prm_vp_check_txdone,
 | 
				
			||||||
 | 
						.vp_clear_txdone	= omap4_prm_vp_clear_txdone,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int __init omap44xx_prm_init(void)
 | 
					int __init omap44xx_prm_init(void)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,10 +26,6 @@
 | 
				
			||||||
/* Function prototypes */
 | 
					/* Function prototypes */
 | 
				
			||||||
#ifndef __ASSEMBLER__
 | 
					#ifndef __ASSEMBLER__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* OMAP4/OMAP5-specific VP functions */
 | 
					 | 
				
			||||||
u32 omap4_prm_vp_check_txdone(u8 vp_id);
 | 
					 | 
				
			||||||
void omap4_prm_vp_clear_txdone(u8 vp_id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * OMAP4/OMAP5 access functions for voltage controller (VC) and
 | 
					 * OMAP4/OMAP5 access functions for voltage controller (VC) and
 | 
				
			||||||
 * voltage proccessor (VP) in the PRM.
 | 
					 * voltage proccessor (VP) in the PRM.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -554,6 +554,40 @@ int omap_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask)
 | 
				
			||||||
	return prm_ll_data->clear_mod_irqs(module, regs, wkst_mask);
 | 
						return prm_ll_data->clear_mod_irqs(module, regs, wkst_mask);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * omap_prm_vp_check_txdone - check voltage processor TX done status
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Checks if voltage processor transmission has been completed.
 | 
				
			||||||
 | 
					 * Returns non-zero if a transmission has completed, 0 otherwise.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					u32 omap_prm_vp_check_txdone(u8 vp_id)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!prm_ll_data->vp_check_txdone) {
 | 
				
			||||||
 | 
							WARN_ONCE(1, "prm: %s: no mapping function defined\n",
 | 
				
			||||||
 | 
								  __func__);
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return prm_ll_data->vp_check_txdone(vp_id);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * omap_prm_vp_clear_txdone - clears voltage processor TX done status
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Clears the status bit for completed voltage processor transmission
 | 
				
			||||||
 | 
					 * returned by prm_vp_check_txdone.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					void omap_prm_vp_clear_txdone(u8 vp_id)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (!prm_ll_data->vp_clear_txdone) {
 | 
				
			||||||
 | 
							WARN_ONCE(1, "prm: %s: no mapping function defined\n",
 | 
				
			||||||
 | 
								  __func__);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						prm_ll_data->vp_clear_txdone(vp_id);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * prm_register - register per-SoC low-level data with the PRM
 | 
					 * prm_register - register per-SoC low-level data with the PRM
 | 
				
			||||||
 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
 | 
					 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,15 +21,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,8 +28,8 @@
 | 
				
			||||||
#include "prm2xxx_3xxx.h"
 | 
					#include "prm2xxx_3xxx.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct omap_vp_ops omap3_vp_ops = {
 | 
					static const struct omap_vp_ops omap3_vp_ops = {
 | 
				
			||||||
	.check_txdone = omap3_prm_vp_check_txdone,
 | 
						.check_txdone = omap_prm_vp_check_txdone,
 | 
				
			||||||
	.clear_txdone = omap3_prm_vp_clear_txdone,
 | 
						.clear_txdone = omap_prm_vp_clear_txdone,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,8 +28,8 @@
 | 
				
			||||||
#include "vp.h"
 | 
					#include "vp.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct omap_vp_ops omap4_vp_ops = {
 | 
					static const struct omap_vp_ops omap4_vp_ops = {
 | 
				
			||||||
	.check_txdone = omap4_prm_vp_check_txdone,
 | 
						.check_txdone = omap_prm_vp_check_txdone,
 | 
				
			||||||
	.clear_txdone = omap4_prm_vp_clear_txdone,
 | 
						.clear_txdone = omap_prm_vp_clear_txdone,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue