Re: [PATCH 2/3] ata: sata_dwc_460ex: add phy support
Sergei Shtylyov writes: > Hello. > > On 12/16/2015 2:25 AM, Mans Rullgard wrote: > >> This adds support for powering on an optional PHY when activating the >> device. >> >> Signed-off-by: Mans Rullgard > [...] >> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c >> index 9985749..d07aae1 100644 >> --- a/drivers/ata/sata_dwc_460ex.c >> +++ b/drivers/ata/sata_dwc_460ex.c > [...] >> @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device >> *ofdev) >> } >> #endif >> >> +hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); >> +if (IS_ERR(hsdev->phy)) { >> +err = PTR_ERR(hsdev->phy); >> +hsdev->phy = NULL; >> +goto error_out; >> +} >> + >> +err = phy_init(hsdev->phy); >> +if (err) >> +goto error_out; > >If phy_init() fails, do we really need to call phy_exit()? No, but it doesn't hurt either, and it makes the code slightly simpler. I can change it though. >> + >> +err = phy_power_on(hsdev->phy); >> +if (err) >> +goto error_out; >> + >> /* >> * Now, register with libATA core, this will also initiate the >> * device discovery process, invoking our port_start() handler & >> @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device >> *ofdev) >> return 0; >> >> error_out: >> +phy_exit(hsdev->phy); >> iounmap(base); >> return err; >> } > [...] > > MBR, Sergei > -- Måns Rullgård -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] ata: sata_dwc_460ex: add phy support
Hello. On 12/16/2015 2:25 AM, Mans Rullgard wrote: This adds support for powering on an optional PHY when activating the device. Signed-off-by: Mans Rullgard [...] diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 9985749..d07aae1 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c [...] @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device *ofdev) } #endif + hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); + if (IS_ERR(hsdev->phy)) { + err = PTR_ERR(hsdev->phy); + hsdev->phy = NULL; + goto error_out; + } + + err = phy_init(hsdev->phy); + if (err) + goto error_out; If phy_init() fails, do we really need to call phy_exit()? + + err = phy_power_on(hsdev->phy); + if (err) + goto error_out; + /* * Now, register with libATA core, this will also initiate the * device discovery process, invoking our port_start() handler & @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) return 0; error_out: + phy_exit(hsdev->phy); iounmap(base); return err; } [...] MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] ata: sata_dwc_460ex: add phy support
Hello. On 12/16/2015 2:25 AM, Mans Rullgard wrote: This adds support for powering on an optional PHY when activating the device. Signed-off-by: Mans Rullgard[...] diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 9985749..d07aae1 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c [...] @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device *ofdev) } #endif + hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); + if (IS_ERR(hsdev->phy)) { + err = PTR_ERR(hsdev->phy); + hsdev->phy = NULL; + goto error_out; + } + + err = phy_init(hsdev->phy); + if (err) + goto error_out; If phy_init() fails, do we really need to call phy_exit()? + + err = phy_power_on(hsdev->phy); + if (err) + goto error_out; + /* * Now, register with libATA core, this will also initiate the * device discovery process, invoking our port_start() handler & @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) return 0; error_out: + phy_exit(hsdev->phy); iounmap(base); return err; } [...] MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] ata: sata_dwc_460ex: add phy support
Sergei Shtylyovwrites: > Hello. > > On 12/16/2015 2:25 AM, Mans Rullgard wrote: > >> This adds support for powering on an optional PHY when activating the >> device. >> >> Signed-off-by: Mans Rullgard > [...] >> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c >> index 9985749..d07aae1 100644 >> --- a/drivers/ata/sata_dwc_460ex.c >> +++ b/drivers/ata/sata_dwc_460ex.c > [...] >> @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device >> *ofdev) >> } >> #endif >> >> +hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); >> +if (IS_ERR(hsdev->phy)) { >> +err = PTR_ERR(hsdev->phy); >> +hsdev->phy = NULL; >> +goto error_out; >> +} >> + >> +err = phy_init(hsdev->phy); >> +if (err) >> +goto error_out; > >If phy_init() fails, do we really need to call phy_exit()? No, but it doesn't hurt either, and it makes the code slightly simpler. I can change it though. >> + >> +err = phy_power_on(hsdev->phy); >> +if (err) >> +goto error_out; >> + >> /* >> * Now, register with libATA core, this will also initiate the >> * device discovery process, invoking our port_start() handler & >> @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device >> *ofdev) >> return 0; >> >> error_out: >> +phy_exit(hsdev->phy); >> iounmap(base); >> return err; >> } > [...] > > MBR, Sergei > -- Måns Rullgård -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ata: sata_dwc_460ex: add phy support
This adds support for powering on an optional PHY when activating the device. Signed-off-by: Mans Rullgard --- drivers/ata/Kconfig | 1 + drivers/ata/sata_dwc_460ex.c | 21 + 2 files changed, 22 insertions(+) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 193c673..b13c609 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -296,6 +296,7 @@ config ATA_PIIX config SATA_DWC tristate "DesignWare Cores SATA support" + select GENERIC_PHY help This option enables support for the on-chip SATA controller of the AppliedMicro processor 460EX. diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 9985749..d07aae1 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -145,6 +146,7 @@ struct sata_dwc_device { struct ata_host *host; u8 __iomem *reg_base; struct sata_dwc_regs*sata_dwc_regs; /* DW Synopsys SATA specific */ + struct phy *phy; #ifdef CONFIG_SATA_DWC_OLD_DMA struct dw_dma_chip *dma; #endif @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device *ofdev) } #endif + hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); + if (IS_ERR(hsdev->phy)) { + err = PTR_ERR(hsdev->phy); + hsdev->phy = NULL; + goto error_out; + } + + err = phy_init(hsdev->phy); + if (err) + goto error_out; + + err = phy_power_on(hsdev->phy); + if (err) + goto error_out; + /* * Now, register with libATA core, this will also initiate the * device discovery process, invoking our port_start() handler & @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) return 0; error_out: + phy_exit(hsdev->phy); iounmap(base); return err; } @@ -1343,6 +1361,9 @@ static int sata_dwc_remove(struct platform_device *ofdev) ata_host_detach(host); + phy_power_off(hsdev->phy); + phy_exit(hsdev->phy); + #ifdef CONFIG_SATA_DWC_OLD_DMA /* Free SATA DMA resources */ if (hsdev->dma) { -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ata: sata_dwc_460ex: add phy support
This adds support for powering on an optional PHY when activating the device. Signed-off-by: Mans Rullgard--- drivers/ata/Kconfig | 1 + drivers/ata/sata_dwc_460ex.c | 21 + 2 files changed, 22 insertions(+) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 193c673..b13c609 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -296,6 +296,7 @@ config ATA_PIIX config SATA_DWC tristate "DesignWare Cores SATA support" + select GENERIC_PHY help This option enables support for the on-chip SATA controller of the AppliedMicro processor 460EX. diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c index 9985749..d07aae1 100644 --- a/drivers/ata/sata_dwc_460ex.c +++ b/drivers/ata/sata_dwc_460ex.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -145,6 +146,7 @@ struct sata_dwc_device { struct ata_host *host; u8 __iomem *reg_base; struct sata_dwc_regs*sata_dwc_regs; /* DW Synopsys SATA specific */ + struct phy *phy; #ifdef CONFIG_SATA_DWC_OLD_DMA struct dw_dma_chip *dma; #endif @@ -1318,6 +1320,21 @@ static int sata_dwc_probe(struct platform_device *ofdev) } #endif + hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); + if (IS_ERR(hsdev->phy)) { + err = PTR_ERR(hsdev->phy); + hsdev->phy = NULL; + goto error_out; + } + + err = phy_init(hsdev->phy); + if (err) + goto error_out; + + err = phy_power_on(hsdev->phy); + if (err) + goto error_out; + /* * Now, register with libATA core, this will also initiate the * device discovery process, invoking our port_start() handler & @@ -1331,6 +1348,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) return 0; error_out: + phy_exit(hsdev->phy); iounmap(base); return err; } @@ -1343,6 +1361,9 @@ static int sata_dwc_remove(struct platform_device *ofdev) ata_host_detach(host); + phy_power_off(hsdev->phy); + phy_exit(hsdev->phy); + #ifdef CONFIG_SATA_DWC_OLD_DMA /* Free SATA DMA resources */ if (hsdev->dma) { -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/