bool acp3x_audio_mode;
struct resource *res;
struct platform_device *pdev[ACP3x_DEVS];
+ u32 pme_en;
};
-static int acp3x_power_on(void __iomem *acp3x_base)
+static int acp3x_power_on(struct acp3x_dev_data *adata)
{
+ void __iomem *acp3x_base = adata->acp3x_base;
u32 val;
int timeout;
while (++timeout < 500) {
val = rv_readl(acp3x_base + mmACP_PGFSM_STATUS);
if (!val) {
- /* Set PME_EN as after ACP power On,
- * PME_EN gets cleared
+ /* ACP power On clears PME_EN.
+ * Restore the value to its prior state
*/
- rv_writel(0x1, acp3x_base + mmACP_PME_EN);
+ rv_writel(adata->pme_en, acp3x_base + mmACP_PME_EN);
return 0;
}
udelay(1);
return -ETIMEDOUT;
}
-static int acp3x_init(void __iomem *acp3x_base)
+static int acp3x_init(struct acp3x_dev_data *adata)
{
+ void __iomem *acp3x_base = adata->acp3x_base;
int ret;
/* power on */
- ret = acp3x_power_on(acp3x_base);
+ ret = acp3x_power_on(adata);
if (ret) {
pr_err("ACP3x power on failed\n");
return ret;
}
pci_set_master(pci);
pci_set_drvdata(pci, adata);
- ret = acp3x_init(adata->acp3x_base);
+ /* Save ACP_PME_EN state */
+ adata->pme_en = rv_readl(adata->acp3x_base + mmACP_PME_EN);
+ ret = acp3x_init(adata);
if (ret)
goto disable_msi;
struct acp3x_dev_data *adata;
adata = dev_get_drvdata(dev);
- ret = acp3x_init(adata->acp3x_base);
+ ret = acp3x_init(adata);
if (ret) {
dev_err(dev, "ACP init failed\n");
return ret;