Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296809
b: refs/heads/master
c: b58d12f
h: refs/heads/master
i:
  296807: 1db17b7
v: v3
  • Loading branch information
Mattias Nilsson authored and Samuel Ortiz committed Mar 6, 2012
1 parent a8b7f22 commit cadb89f
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c72fe851df21603cd149320df49064eb2f903707
refs/heads/master: b58d12fe6ccd16030e1a69b5c443075f7bed0f6d
51 changes: 33 additions & 18 deletions trunk/drivers/mfd/db8500-prcmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@
/* Offset for the firmware version within the TCPM */
#define PRCMU_FW_VERSION_OFFSET 0xA4

/* PRCMU project numbers, defined by PRCMU FW */
#define PRCMU_PROJECT_ID_8500V1_0 1
#define PRCMU_PROJECT_ID_8500V2_0 2
#define PRCMU_PROJECT_ID_8400V2_0 3

/* Index of different voltages to be used when accessing AVSData */
#define PRCM_AVS_BASE 0x2FC
#define PRCM_AVS_VBB_RET (PRCM_AVS_BASE + 0x0)
Expand Down Expand Up @@ -266,6 +261,11 @@
#define WAKEUP_BIT_GPIO7 BIT(30)
#define WAKEUP_BIT_GPIO8 BIT(31)

static struct {
bool valid;
struct prcmu_fw_version version;
} fw_info;

/*
* This vector maps irq numbers to the bits in the bit field used in
* communication with the PRCMU firmware.
Expand Down Expand Up @@ -522,14 +522,6 @@ static const char *hwacc_ret_regulator_name[NUM_HW_ACC] = {

#define PRCMU_PLLDSI_LOCKP_LOCKED 0x3

static struct {
u8 project_number;
u8 api_version;
u8 func_version;
u8 errata;
} prcmu_version;


int db8500_prcmu_enable_dsipll(void)
{
int i;
Expand Down Expand Up @@ -619,6 +611,11 @@ void prcmu_disable_spi2(void)
spin_unlock_irqrestore(&gpiocr_lock, flags);
}

struct prcmu_fw_version *prcmu_get_fw_version(void)
{
return fw_info.valid ? &fw_info.version : NULL;
}

bool prcmu_has_arm_maxopp(void)
{
return (readb(tcdm_base + PRCM_AVS_VARM_MAX_OPP) &
Expand Down Expand Up @@ -2077,6 +2074,22 @@ static struct irq_chip prcmu_irq_chip = {
.irq_unmask = prcmu_irq_unmask,
};

static char *fw_project_name(u8 project)
{
switch (project) {
case PRCMU_FW_PROJECT_U8500:
return "U8500";
case PRCMU_FW_PROJECT_U8500_C2:
return "U8500 C2";
case PRCMU_FW_PROJECT_U9500:
return "U9500";
case PRCMU_FW_PROJECT_U9500_C2:
return "U9500 C2";
default:
return "Unknown";
}
}

void __init db8500_prcmu_early_init(void)
{
unsigned int i;
Expand All @@ -2086,11 +2099,13 @@ void __init db8500_prcmu_early_init(void)
if (tcpm_base != NULL) {
u32 version;
version = readl(tcpm_base + PRCMU_FW_VERSION_OFFSET);
prcmu_version.project_number = version & 0xFF;
prcmu_version.api_version = (version >> 8) & 0xFF;
prcmu_version.func_version = (version >> 16) & 0xFF;
prcmu_version.errata = (version >> 24) & 0xFF;
pr_info("PRCMU firmware version %d.%d.%d\n",
fw_info.version.project = version & 0xFF;
fw_info.version.api_version = (version >> 8) & 0xFF;
fw_info.version.func_version = (version >> 16) & 0xFF;
fw_info.version.errata = (version >> 24) & 0xFF;
fw_info.valid = true;
pr_info("PRCMU firmware: %s, version %d.%d.%d\n",
fw_project_name(fw_info.version.project),
(version >> 8) & 0xFF, (version >> 16) & 0xFF,
(version >> 24) & 0xFF);
iounmap(tcpm_base);
Expand Down
18 changes: 18 additions & 0 deletions trunk/include/linux/mfd/db8500-prcmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,18 @@ struct prcmu_auto_pm_config {
u8 sva_policy;
};

#define PRCMU_FW_PROJECT_U8500 2
#define PRCMU_FW_PROJECT_U9500 4
#define PRCMU_FW_PROJECT_U8500_C2 7
#define PRCMU_FW_PROJECT_U9500_C2 11

struct prcmu_fw_version {
u8 project;
u8 api_version;
u8 func_version;
u8 errata;
};

#ifdef CONFIG_MFD_DB8500_PRCMU

void db8500_prcmu_early_init(void);
Expand All @@ -502,6 +514,7 @@ enum ap_pwrst prcmu_get_xp70_current_state(void);
bool prcmu_has_arm_maxopp(void);
int prcmu_set_ape_opp(u8 opp);
int prcmu_get_ape_opp(void);
struct prcmu_fw_version *prcmu_get_fw_version(void);
int prcmu_request_ape_opp_100_voltage(bool enable);
int prcmu_release_usb_wakeup_state(void);
int prcmu_set_ddr_opp(u8 opp);
Expand Down Expand Up @@ -573,6 +586,11 @@ static inline bool prcmu_has_arm_maxopp(void)
return false;
}

static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
{
return NULL;
}

static inline int prcmu_set_ape_opp(u8 opp)
{
return 0;
Expand Down

0 comments on commit cadb89f

Please sign in to comment.