mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
regulator: s2mps11: odroidxu3: add ethernet power reset in shutdown
Ethernet device cannot be detected on warm boot sometimes. This patch is to add the power reset routines for ethernet device using PMIC. Then ethernet device can be reset hardware-wise. Change-Id: Iffbe2966da7e4679f63b91ab79241167391792df Signed-off-by: Brian Kim <brian.kim@hardkernel.com>
This commit is contained in:
@@ -1091,6 +1091,57 @@ static const struct regulator_desc s2mpu02_regulators[] = {
|
||||
regulator_desc_s2mpu02_buck7(7),
|
||||
};
|
||||
|
||||
static int s2mps11_pmic_ethonoff(struct platform_device *pdev, bool onoff)
|
||||
{
|
||||
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
||||
unsigned int reg_val = 0;
|
||||
int ret = 0;
|
||||
|
||||
ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, ®_val);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to read S2MPS11_REG_L15CTRL value\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, ®_val);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to read S2MPS11_REG_L17CTRL value\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (onoff) {
|
||||
/* ETH VDD0 ON */
|
||||
ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, 0xFF, 0x72);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL15 register\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ETH VDD1 ON */
|
||||
ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, 0xFF, 0x72);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL17 register\n");
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
/* ETH VDD0 OFF */
|
||||
ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L15CTRL, 0x3F, 0x00);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL15 register\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ETH VDD1 OFF */
|
||||
ret = regmap_update_bits(iodev->regmap_pmic, S2MPS11_REG_L17CTRL, 0x3F, 0x00);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "cannot update S2MPS11 LDO CTRL17 register\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int s2mps11_pmic_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
|
||||
@@ -1267,6 +1318,8 @@ static void s2mps11_pmic_shutdown(struct platform_device *pdev)
|
||||
"could not update S2MPS11_REG_L19CTRL Error!!\n");
|
||||
}
|
||||
|
||||
s2mps11_pmic_ethonoff(pdev, false);
|
||||
|
||||
mdelay(10);
|
||||
|
||||
if (regmap_update_bits(iodev->regmap_pmic,
|
||||
@@ -1280,6 +1333,8 @@ static void s2mps11_pmic_shutdown(struct platform_device *pdev)
|
||||
dev_crit(&pdev->dev,
|
||||
"could not update S2MPS11_REG_L13CTRL Error!!\n");
|
||||
}
|
||||
|
||||
s2mps11_pmic_ethonoff(pdev, true);
|
||||
}
|
||||
|
||||
static const struct platform_device_id s2mps11_pmic_id[] = {
|
||||
|
||||
Reference in New Issue
Block a user