Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1560550 > unrolled thread
| Started by | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| First post | 2017-01-17 13:30 +0100 |
| Last post | 2017-01-17 13:30 +0100 |
| Articles | 12 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/14] ARM: da850-lcdk: add SATA support Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
[PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
Re: [PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 David Lechner <david@lechnology.com> - 2017-01-17 19:40 +0100
Re: [PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 Sekhar Nori <nsekhar@ti.com> - 2017-01-18 10:10 +0100
[PATCH v2 03/14] ARM: davinci: add a clock lookup entry for the SATA clock Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
[PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
Re: [PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk David Lechner <david@lechnology.com> - 2017-01-17 21:40 +0100
Re: [PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk Sekhar Nori <nsekhar@ti.com> - 2017-01-18 10:40 +0100
[PATCH v2 05/14] ARM: davinci: da850: add con_id for the SATA clock Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
[PATCH v2 02/14] ARM: davinci_all_defconfig: enable SATA modules Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
[PATCH v2 07/14] sata: ahci-da850: add device tree match table Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
[PATCH v2 09/14] sata: ahci: export ahci_do_hardreset() locally Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-17 13:30 +0100
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 00/14] ARM: da850-lcdk: add SATA support |
| Message-ID | <t0B3H-72K-5@gated-at.bofh.it> |
This series contains all the changes necessary to make SATA work on the da850-lcdk board. The first patch adds DT bindings for the ahci-da850 driver. The second enables relevant modules in davinci_all_defconfig. Patches 03/14-06/14 modify the way the clocks are handled regarding SATA on the da850 platform. We modify the ahci driver to retrieve the clock via con_id and model the external SATA oscillator as a real clock. Patches 07/14-11/14 extend the ahci-da850 driver. Add DT support, implement workarounds necessary to make SATA work on the da850-lcdk board and un-hardcode the external clock multiplier. Last three patches add device tree changes required to probe the driver. v1 -> v2: - dropped patch 04/10 - replaced with local changes in the ahci-da850 driver - added comments explaining the workaround in ahci softreset - s/0x218000/218000 in the sata DT node label - added patches chaning the way clocks are handled in the da850 SATA code both in arch/ and in the ahci driver - dropped the clock multiplier property in the DT bindings in favor of using struct clk to pass the refclk rate to the driver - minor tweaks in commit messages Bartosz Golaszewski (14): devicetree: bindings: add bindings for ahci-da850 ARM: davinci_all_defconfig: enable SATA modules ARM: davinci: add a clock lookup entry for the SATA clock sata: ahci-da850: get the sata clock using a connector id ARM: davinci: da850: add con_id for the SATA clock ARM: davinci: da850: model the SATA refclk sata: ahci-da850: add device tree match table sata: ahci-da850: implement a workaround for the softreset quirk sata: ahci: export ahci_do_hardreset() locally sata: ahci-da850: add a workaround for controller instability sata: ahci-da850: un-hardcode the MPY bits ARM: dts: da850: add pinmux settings for the SATA controller ARM: dts: da850: add the SATA node ARM: dts: da850-lcdk: enable the SATA node .../devicetree/bindings/ata/ahci-da850.txt | 18 +++ arch/arm/boot/dts/da850-lcdk.dts | 4 + arch/arm/boot/dts/da850.dtsi | 30 ++++ arch/arm/configs/davinci_all_defconfig | 2 + arch/arm/mach-davinci/da850.c | 2 +- arch/arm/mach-davinci/da8xx-dt.c | 9 ++ arch/arm/mach-davinci/devices-da8xx.c | 23 +++ arch/arm/mach-davinci/include/mach/da8xx.h | 1 + drivers/ata/ahci.h | 3 + drivers/ata/ahci_da850.c | 172 +++++++++++++++++++-- drivers/ata/libahci.c | 18 ++- 11 files changed, 262 insertions(+), 20 deletions(-) create mode 100644 Documentation/devicetree/bindings/ata/ahci-da850.txt -- 2.9.3
[toc] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 |
| Message-ID | <t0B3I-72K-25@gated-at.bofh.it> |
| In reply to | #1560550 |
Add DT bindings for the TI DA850 AHCI SATA controller.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
Documentation/devicetree/bindings/ata/ahci-da850.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 Documentation/devicetree/bindings/ata/ahci-da850.txt
diff --git a/Documentation/devicetree/bindings/ata/ahci-da850.txt b/Documentation/devicetree/bindings/ata/ahci-da850.txt
new file mode 100644
index 0000000..e7111b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/ahci-da850.txt
@@ -0,0 +1,18 @@
+Device tree binding for the TI DA850 AHCI SATA Controller
+---------------------------------------------------------
+
+Required properties:
+ - compatible: must be "ti,da850-ahci"
+ - reg: physical base addresses and sizes of the controller's register areas
+ - interrupts: interrupt specifier (refer to the interrupt binding)
+
+Optional properties:
+ - clocks: clock specifier (refer to the common clock binding)
+
+Example:
+
+ sata: ahci@218000 {
+ compatible = "ti,da850-ahci";
+ reg = <0x218000 0x2000>, <0x22c018 0x4>;
+ interrupts = <67>;
+ };
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-01-17 19:40 +0100 |
| Subject | Re: [PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 |
| Message-ID | <t0GPM-25I-31@gated-at.bofh.it> |
| In reply to | #1560551 |
On 01/17/2017 06:26 AM, Bartosz Golaszewski wrote:
> Add DT bindings for the TI DA850 AHCI SATA controller.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
> Documentation/devicetree/bindings/ata/ahci-da850.txt | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/ata/ahci-da850.txt
>
> diff --git a/Documentation/devicetree/bindings/ata/ahci-da850.txt b/Documentation/devicetree/bindings/ata/ahci-da850.txt
> new file mode 100644
> index 0000000..e7111b4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/ata/ahci-da850.txt
> @@ -0,0 +1,18 @@
> +Device tree binding for the TI DA850 AHCI SATA Controller
> +---------------------------------------------------------
> +
> +Required properties:
> + - compatible: must be "ti,da850-ahci"
> + - reg: physical base addresses and sizes of the controller's register areas
> + - interrupts: interrupt specifier (refer to the interrupt binding)
> +
> +Optional properties:
> + - clocks: clock specifier (refer to the common clock binding)
Won't you also need a clock-names property since there are two clocks?
> +
> +Example:
> +
> + sata: ahci@218000 {
> + compatible = "ti,da850-ahci";
> + reg = <0x218000 0x2000>, <0x22c018 0x4>;
> + interrupts = <67>;
> + };
>
It would be nice to have clocks and clock-names in the example as well.
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2017-01-18 10:10 +0100 |
| Subject | Re: [PATCH v2 01/14] devicetree: bindings: add bindings for ahci-da850 |
| Message-ID | <t0UpJ-26m-23@gated-at.bofh.it> |
| In reply to | #1560902 |
On Wednesday 18 January 2017 12:05 AM, David Lechner wrote:
> On 01/17/2017 06:26 AM, Bartosz Golaszewski wrote:
>> Add DT bindings for the TI DA850 AHCI SATA controller.
>>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
>> Documentation/devicetree/bindings/ata/ahci-da850.txt | 18
>> ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/ata/ahci-da850.txt
>>
>> diff --git a/Documentation/devicetree/bindings/ata/ahci-da850.txt
>> b/Documentation/devicetree/bindings/ata/ahci-da850.txt
>> new file mode 100644
>> index 0000000..e7111b4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/ata/ahci-da850.txt
>> @@ -0,0 +1,18 @@
>> +Device tree binding for the TI DA850 AHCI SATA Controller
>> +---------------------------------------------------------
>> +
>> +Required properties:
>> + - compatible: must be "ti,da850-ahci"
>> + - reg: physical base addresses and sizes of the controller's
>> register areas
>> + - interrupts: interrupt specifier (refer to the interrupt binding)
>> +
>> +Optional properties:
>> + - clocks: clock specifier (refer to the common clock binding)
>
> Won't you also need a clock-names property since there are two clocks?
>
>> +
>> +Example:
>> +
>> + sata: ahci@218000 {
>> + compatible = "ti,da850-ahci";
>> + reg = <0x218000 0x2000>, <0x22c018 0x4>;
>> + interrupts = <67>;
>> + };
>>
>
> It would be nice to have clocks and clock-names in the example as well.
Well, we don't use the common clock binding today. Is it really
necessary to add them now. Thats basically going to remain completely
untested.
I would drop the mention of clocks specification as an optional property
too.
Thanks,
Sekhar
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 03/14] ARM: davinci: add a clock lookup entry for the SATA clock |
| Message-ID | <t0B3I-72K-33@gated-at.bofh.it> |
| In reply to | #1560550 |
This entry is needed for the ahci driver to get a functional clock.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
arch/arm/mach-davinci/da8xx-dt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 9ee44da..b83e5d1 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -42,6 +42,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL),
OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL),
+ OF_DEV_AUXDATA("ti,da850-ahci", 0x01e18000, "ahci_da850", NULL),
{}
};
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk |
| Message-ID | <t0B3I-72K-27@gated-at.bofh.it> |
| In reply to | #1560550 |
Register a dummy clock modelling the external SATA oscillator for
da850 DT mode. For non-DT boot we don't register the clock - instead
we rely on the default MPY value defined in the da850 ahci driver (as
is done currently).
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
arch/arm/mach-davinci/da8xx-dt.c | 8 ++++++++
arch/arm/mach-davinci/devices-da8xx.c | 23 +++++++++++++++++++++++
arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
3 files changed, 32 insertions(+)
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index b83e5d1..13137cb 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -61,6 +61,14 @@ static void __init da850_init_machine(void)
pr_warn("%s: registering USB 1.1 PHY clock failed: %d",
__func__, ret);
+ if (of_machine_is_compatible("ti,da850-evm") ||
+ of_machine_is_compatible("ti,da850-lcdk")) {
+ ret = da850_register_sata_refclk(100000000);
+ if (ret)
+ pr_warn("%s: registering SATA_REFCLK clock failed: %d",
+ __func__, ret);
+ }
+
of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
davinci_pm_init();
}
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index c2457b3..2bb5b69 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -24,6 +24,7 @@
#include <mach/common.h>
#include <mach/time.h>
#include <mach/da8xx.h>
+#include <mach/clock.h>
#include "cpuidle.h"
#include "sram.h"
@@ -1023,6 +1024,28 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect)
}
#ifdef CONFIG_ARCH_DAVINCI_DA850
+static struct clk sata_refclk = {
+ .name = "sata_refclk",
+ .set_rate = davinci_simple_set_rate,
+};
+
+static struct clk_lookup sata_refclk_lookup =
+ CLK("ahci_da850", "refclk", &sata_refclk);
+
+int __init da850_register_sata_refclk(int rate)
+{
+ int ret;
+
+ sata_refclk.rate = rate;
+ ret = clk_register(&sata_refclk);
+ if (ret)
+ return ret;
+
+ clkdev_add(&sata_refclk_lookup);
+
+ return 0;
+}
+
static struct resource da850_sata_resources[] = {
{
.start = DA850_SATA_BASE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 85ff218..7e46422 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -95,6 +95,7 @@ int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
int da8xx_register_usb_refclkin(int rate);
int da8xx_register_usb20_phy_clk(bool use_usb_refclkin);
int da8xx_register_usb11_phy_clk(bool use_usb_refclkin);
+int da850_register_sata_refclk(int rate);
int da8xx_register_emac(void);
int da8xx_register_uio_pruss(void);
int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | David Lechner <david@lechnology.com> |
|---|---|
| Date | 2017-01-17 21:40 +0100 |
| Subject | Re: [PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk |
| Message-ID | <t0IHV-3fQ-35@gated-at.bofh.it> |
| In reply to | #1560553 |
On 01/17/2017 06:26 AM, Bartosz Golaszewski wrote: > Register a dummy clock modelling the external SATA oscillator for > da850 DT mode. For non-DT boot we don't register the clock - instead > we rely on the default MPY value defined in the da850 ahci driver (as > is done currently). Why not register a clock for non-DT boot as well?
[toc] | [prev] | [next] | [standalone]
| From | Sekhar Nori <nsekhar@ti.com> |
|---|---|
| Date | 2017-01-18 10:40 +0100 |
| Subject | Re: [PATCH v2 06/14] ARM: davinci: da850: model the SATA refclk |
| Message-ID | <t0USJ-2fJ-5@gated-at.bofh.it> |
| In reply to | #1560553 |
On Tuesday 17 January 2017 05:56 PM, Bartosz Golaszewski wrote:
> Register a dummy clock modelling the external SATA oscillator for
I would not call it a dummy clock. Its representing something physically
present. Just call it "fixed rate clock" ?
> da850 DT mode. For non-DT boot we don't register the clock - instead
> we rely on the default MPY value defined in the da850 ahci driver (as
> is done currently).
Here too, like David suggested, it will be nice to register it both for
DT and non-DT case. With that I think your driver will be simple too
since you dont have to worry about the case when refclkpn is not supplied.
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
> arch/arm/mach-davinci/da8xx-dt.c | 8 ++++++++
> arch/arm/mach-davinci/devices-da8xx.c | 23 +++++++++++++++++++++++
> arch/arm/mach-davinci/include/mach/da8xx.h | 1 +
> 3 files changed, 32 insertions(+)
>
> diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
> index b83e5d1..13137cb 100644
> --- a/arch/arm/mach-davinci/da8xx-dt.c
> +++ b/arch/arm/mach-davinci/da8xx-dt.c
> @@ -61,6 +61,14 @@ static void __init da850_init_machine(void)
> pr_warn("%s: registering USB 1.1 PHY clock failed: %d",
> __func__, ret);
>
> + if (of_machine_is_compatible("ti,da850-evm") ||
> + of_machine_is_compatible("ti,da850-lcdk")) {
> + ret = da850_register_sata_refclk(100000000);
> + if (ret)
> + pr_warn("%s: registering SATA_REFCLK clock failed: %d",
> + __func__, ret);
> + }
Since all supported boards use 100 Mhz refclk anyway, I would drop the
machine check and just do:
/* All existing boards use 100MHz SATA refclkpn */
unsigned long sata_refclkpn = 100 * 1000 * 1000;
ret = da850_register_sata_refclk(sata_refclkpn);
It should then be easy for the odd board (when it comes) to set
sata_refclkpn to a different value.
Thanks,
Sekhar
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 05/14] ARM: davinci: da850: add con_id for the SATA clock |
| Message-ID | <t0B3J-72K-41@gated-at.bofh.it> |
| In reply to | #1560550 |
The ahci-da850 SATA driver is now capable of retrieving clocks by
con_id. Add the connector id for the sysclk2-derived SATA clock.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
arch/arm/mach-davinci/da850.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 1d873d1..dbf1daa 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -571,7 +571,7 @@ static struct clk_lookup da850_clks[] = {
CLK("spi_davinci.0", NULL, &spi0_clk),
CLK("spi_davinci.1", NULL, &spi1_clk),
CLK("vpif", NULL, &vpif_clk),
- CLK("ahci_da850", NULL, &sata_clk),
+ CLK("ahci_da850", "sata", &sata_clk),
CLK("davinci-rproc.0", NULL, &dsp_clk),
CLK(NULL, NULL, &ehrpwm_clk),
CLK("ehrpwm.0", "fck", &ehrpwm0_clk),
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 02/14] ARM: davinci_all_defconfig: enable SATA modules |
| Message-ID | <t0B3I-72K-31@gated-at.bofh.it> |
| In reply to | #1560550 |
Add the da850-ahci driver to davinci defconfig. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> --- arch/arm/configs/davinci_all_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig index 8806754..a1b9c58 100644 --- a/arch/arm/configs/davinci_all_defconfig +++ b/arch/arm/configs/davinci_all_defconfig @@ -78,6 +78,8 @@ CONFIG_IDE=m CONFIG_BLK_DEV_PALMCHIP_BK3710=m CONFIG_SCSI=m CONFIG_BLK_DEV_SD=m +CONFIG_ATA=m +CONFIG_AHCI_DA850=m CONFIG_NETDEVICES=y CONFIG_NETCONSOLE=y CONFIG_TUN=m -- 2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 07/14] sata: ahci-da850: add device tree match table |
| Message-ID | <t0B3I-72K-35@gated-at.bofh.it> |
| In reply to | #1560550 |
We're using device tree for da850-lcdk. Add the match table to allow
to probe the driver.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/ata/ahci_da850.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 18f57c2..c071701 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -121,11 +121,18 @@ static int ahci_da850_probe(struct platform_device *pdev)
static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
ahci_platform_resume);
+static const struct of_device_id ahci_da850_of_match[] = {
+ { .compatible = "ti,da850-ahci", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, ahci_da850_of_match);
+
static struct platform_driver ahci_da850_driver = {
.probe = ahci_da850_probe,
.remove = ata_platform_remove_one,
.driver = {
.name = DRV_NAME,
+ .of_match_table = ahci_da850_of_match,
.pm = &ahci_da850_pm_ops,
},
};
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Bartosz Golaszewski <bgolaszewski@baylibre.com> |
|---|---|
| Date | 2017-01-17 13:30 +0100 |
| Subject | [PATCH v2 09/14] sata: ahci: export ahci_do_hardreset() locally |
| Message-ID | <t0B3J-72K-39@gated-at.bofh.it> |
| In reply to | #1560550 |
We need a way to retrieve the information about the online state of
the link in the ahci-da850 driver.
Create a new function: ahci_do_hardreset() which is called from
ahci_hardreset() for backwards compatibility, but has an additional
argument: 'online' - which can be used to check if the link is online
after this function returns.
The new routine will be used in the ahci-da850 driver to avoid code
duplication when implementing a workaround for tha da850 SATA
controller quirk/instability.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
drivers/ata/ahci.h | 3 +++
drivers/ata/libahci.c | 18 +++++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 0cc08f8..5db6ab2 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -398,6 +398,9 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
int pmp, unsigned long deadline,
int (*check_ready)(struct ata_link *link));
+int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
+ unsigned long deadline, bool *online);
+
unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
int ahci_stop_engine(struct ata_port *ap);
void ahci_start_fis_rx(struct ata_port *ap);
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index ee7db31..3159f9e 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1519,8 +1519,8 @@ static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
return rc;
}
-static int ahci_hardreset(struct ata_link *link, unsigned int *class,
- unsigned long deadline)
+int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
+ unsigned long deadline, bool *online)
{
const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
struct ata_port *ap = link->ap;
@@ -1528,7 +1528,6 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
struct ahci_host_priv *hpriv = ap->host->private_data;
u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
struct ata_taskfile tf;
- bool online;
int rc;
DPRINTK("ENTER\n");
@@ -1540,17 +1539,26 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
tf.command = ATA_BUSY;
ata_tf_to_fis(&tf, 0, 0, d2h_fis);
- rc = sata_link_hardreset(link, timing, deadline, &online,
+ rc = sata_link_hardreset(link, timing, deadline, online,
ahci_check_ready);
hpriv->start_engine(ap);
- if (online)
+ if (*online)
*class = ahci_dev_classify(ap);
DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
return rc;
}
+EXPORT_SYMBOL_GPL(ahci_do_hardreset);
+
+static int ahci_hardreset(struct ata_link *link, unsigned int *class,
+ unsigned long deadline)
+{
+ bool online;
+
+ return ahci_do_hardreset(link, class, deadline, &online);
+}
static void ahci_postreset(struct ata_link *link, unsigned int *class)
{
--
2.9.3
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web