PHY driver for Marvell SATA
Subsystems (3)
v2 cover PHY driver for Marvell SATA
This second version addresses most of the points raised during review.
What has not been changed is the phy-names property. This is awaiting feedback on my comment that the naming follows how clocks are named in the driver & DT binding. For this reason i've also not added the
Ack-by: received in the review comments.
Andrew Lunn (4):
Phy: DT binding documentation for Marvell MVEBU SATA phy.
Phy: Add a PHY driver for Marvell MVEBU SATA PHY.
SATA: MV: Add support for the optional PHYs
Phy: Add DT nodes on kirkwood and Dove for the SATA PHY
Documentation/devicetree/bindings/ata/marvell.txt | 6 + .../devicetree/bindings/phy/phy-mvebu.txt | 22 ++++ arch/arm/boot/dts/dove.dtsi | 11 ++ arch/arm/boot/dts/kirkwood-6281.dtsi | 2 + arch/arm/boot/dts/kirkwood-6282.dtsi | 2 + arch/arm/boot/dts/kirkwood.dtsi | 18 +++ drivers/ata/sata_mv.c | 19 +++ drivers/phy/Kconfig | 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-mvebu-sata.c | 137 +++++++++++++++++++++ 10 files changed, 224 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-mvebu.txt create mode 100644 drivers/phy/phy-mvebu-sata.c
Signature · 1 line
1.8.5
PATCH v2 1/4 Phy: DT binding documentation for Marvell MVEBU SATA phy.
Describe the binding for the Marvell MVEBU SATA phy. This driver can be used at least with Kirkwood, Dove and maybe others. Additionally, update the SATA binding with the properties to link to the phy nodes.
---v1->v2:
Correct #phy-cells
Correct number after @ to match first reg address. Rename to mvebu-phy.txt
--- Documentation/devicetree/bindings/ata/marvell.txt | 6 ++++++ .../devicetree/bindings/phy/phy-mvebu.txt | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-mvebu.txt
Documentation/devicetree/bindings/ata/marvell.txt +6 -0
@@ -6,11 +6,17 @@ Required Properties: - interrupts : Interrupt controller is using - nr-ports : Number of SATA ports in use. +Optional Properties: +- phys : List of phandles to sata phys +- phy-names : Should be "0", "1", etc, one number per phandle + Example: sata at 80000 { compatible = "marvell,orion-sata"; reg = <0x80000 0x5000>; interrupts = <21>; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; nr-ports = <2>; }
Documentation/devicetree/bindings/phy/phy-mvebu.txt new file +22 -0
@@ -0,0 +1,22 @@ +* Marvell MVEBU SATA PHY + +Power control for the SATA phy found on Marvell MVEBU SoCs. + +This document extends the binding described in phy-bindings.txt + +Required properties : + + - reg : Offset and length of the register set for the SATA device + - compatible : Should be "marvell,mvebu-sata-phy" + - clocks : phandle of clock and specifier that supplies the device + - clock-names : Should be "sata" + +Example: + sata-phy at 84000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x84000 0x0334>; + clocks = <&gate_clk 15>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + };
Signature · 1 line
1.8.5
PATCH v2 1/4 Phy: DT binding documentation for Marvell MVEBU SATA phy.
Quoted 6 lines · Andrew Lunn
Describe the binding for the Marvell MVEBU SATA phy. This driver can be used at least with Kirkwood, Dove and maybe others. Additionally, update the SATA binding with the properties to link to the phy nodes.
Signed-off-by Andrew Lunn <[email protected]>
Quoted 8 lines
---
v1->v2:
Correct #phy-cells
Correct number after @ to match first reg address.Rename to mvebu-phy.txt
Ok, this follows samsung-phy.txt.
Quoted 3 lines
--- Documentation/devicetree/bindings/ata/marvell.txt | 6 ++++++ .../devicetree/bindings/phy/phy-mvebu.txt | 22 ++++++++++++++++++++++
but this does not... ?
thx,
Jason.
Quoted 56 lines
2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/phy-mvebu.txtDocumentation/devicetree/bindings/ata/marvell.txt +6
-0@@ -6,11 +6,17 @@ Required Properties: - interrupts : Interrupt controller is using - nr-ports : Number of SATA ports in use. +Optional Properties: +- phys : List of phandles to sata phys +- phy-names : Should be "0", "1", etc, one number per phandle + Example: sata at 80000 { compatible = "marvell,orion-sata"; reg = <0x80000 0x5000>; interrupts = <21>; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; nr-ports = <2>; }Documentation/devicetree/bindings/phy/phy-mvebu.txt new file +22
-0@@ -0,0 +1,22 @@ +* Marvell MVEBU SATA PHY + +Power control for the SATA phy found on Marvell MVEBU SoCs. + +This document extends the binding described in phy-bindings.txt + +Required properties : + + - reg : Offset and length of the register set for the SATA device + - compatible : Should be "marvell,mvebu-sata-phy" + - clocks : phandle of clock and specifier that supplies the device + - clock-names : Should be "sata" + +Example: + sata-phy at 84000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x84000 0x0334>; + clocks = <&gate_clk 15>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + };Signature · 1 line
1.8.5
PATCH v2 2/4 Phy: Add a PHY driver for Marvell MVEBU SATA PHY.
In reply to Andrew LunnKirkwood and Dove can turn the SATA phy on and off. Add a PHY driver to control this.
---v1->v2:
Use #defines instead of magic values
select GENERIC_PHY in Kconfig.
--- drivers/phy/Kconfig | 6 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-mvebu-sata.c | 137 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 drivers/phy/phy-mvebu-sata.c
drivers/phy/Kconfig +6 -0
@@ -21,6 +21,12 @@ config PHY_EXYNOS_MIPI_VIDEO Support for MIPI CSI-2 and MIPI DSI DPHY found on Samsung S5P and EXYNOS SoCs. +config PHY_MVEBU_SATA + def_bool y + depends on ARCH_KIRKWOOD || ARCH_DOVE + depends on OF + select GENERIC_PHY + config OMAP_USB2 tristate "OMAP USB2 PHY Driver" depends on ARCH_OMAP2PLUS
drivers/phy/Makefile +1 -0
@@ -5,5 +5,6 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o +obj-$(CONFIG_PHY_MVEBU_SATA) += phy-mvebu-sata.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o
drivers/phy/phy-mvebu-sata.c new file +137 -0
137 lines not on this page · raw message
Signature · 1 line
1.8.5
PATCH v2 3/4 SATA: MV: Add support for the optional PHYs
In reply to Andrew LunnSome Marvell SoCs have a SATA PHY which can be powered off, in order to save power. Make use of the generic phy framework to control these phys.
--- drivers/ata/sata_mv.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/ata/sata_mv.c +19 -0
@@ -60,6 +60,7 @@#include <linux/dma-mapping.h> #include <linux/device.h> #include <linux/clk.h> +#include <linux/phy/phy.h> #include <linux/platform_device.h> #include <linux/ata_platform.h> #include <linux/mbus.h>
@@ -563,6 +564,12 @@ struct mv_host_priv {struct clk *clk;struct clk **port_clks;/* +* Some devices have a SATA PHY which can be enabled/disabled +* in order to save power. These are optional: if the platform +* devices does not have any phy, they won't be used. +*/ +struct phy **port_phys; +/* * These consistent DMA memory pools give us guaranteed * alignment for hardware-accessed data structures, * and less memory waste in accomplishing the alignment.
@@ -4076,6 +4083,11 @@ static int mv_platform_probe(struct platform_device *pdev) GFP_KERNEL);if (!hpriv->port_clks)return -ENOMEM ; + hpriv->port_phys =devm_kzalloc (&pdev->dev, +sizeof (struct phy *) * n_ports, +GFP_KERNEL ); +if (!hpriv->port_phys) +return -ENOMEM ; host->private_data = hpriv; hpriv->n_ports = n_ports; hpriv->board_idx = chip_soc;
@@ -4097,6 +4109,9 @@ static int mv_platform_probe(struct platform_device *pdev) hpriv->port_clks[port] =clk_get (&pdev->dev, port_number);if (!IS_ERR (hpriv->port_clks[port]))clk_prepare_enable (hpriv->port_clks[port]); + hpriv->port_phys[port] =devm_phy_get (&pdev->dev, port_number); +if (!IS_ERR (hpriv->port_phys[port])) +phy_power_on (hpriv->port_phys[port]); }/*
@@ -4132,6 +4147,8 @@ err:clk_disable_unprepare (hpriv->port_clks[port]);clk_put (hpriv->port_clks[port]); } +if (!IS_ERR (hpriv->port_phys[port])) +phy_power_off (hpriv->port_phys[port]); }return rc;
@@ -4161,6 +4178,8 @@ static int mv_platform_remove(struct platform_device *pdev)clk_disable_unprepare (hpriv->port_clks[port]);clk_put (hpriv->port_clks[port]); } +if (!IS_ERR (hpriv->port_phys[port])) +phy_power_off (hpriv->port_phys[port]); }return 0 ; }
Signature · 1 line
1.8.5
PATCH v2 4/4 Phy: Add DT nodes on kirkwood and Dove for the SATA PHY
In reply to Andrew LunnAdd nodes for the two SATA PHYs on kirkewood. Add node for the one SATA PHY on Dove. Add pHandles to the PHYs in the sata nodes.
---v1->v2:sata_phy at ... ->sata-phy@
value after '@' matching the first address in the reg.
--- arch/arm/boot/dts/dove.dtsi | 11 +++++++++++ arch/arm/boot/dts/kirkwood-6281.dtsi | 2 ++ arch/arm/boot/dts/kirkwood-6282.dtsi | 2 ++ arch/arm/boot/dts/kirkwood.dtsi | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+)
arch/arm/boot/dts/dove.dtsi +11 -0
@@ -490,10 +490,21 @@ reg = <0xa0000 0x2400>; interrupts = <62>; clocks = <&gate_clk 3>; + phys = <&sata_phy0>; + phy-names = "0"; nr-ports = <1>; status = "disabled"; }; + sata_phy0: sata-phy at a2000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0xa2000 0x0334>; + clocks = <&gate_clk 3>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; + rtc: real-time-clock at d8500 { compatible = "marvell,orion-rtc"; reg = <0xd8500 0x20>;
arch/arm/boot/dts/kirkwood-6281.dtsi +2 -0
@@ -89,6 +89,8 @@ interrupts = <21>; clocks = <&gate_clk 14>, <&gate_clk 15>; clock-names = "0", "1"; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; status = "disabled"; };
arch/arm/boot/dts/kirkwood-6282.dtsi +2 -0
@@ -117,6 +117,8 @@ interrupts = <21>; clocks = <&gate_clk 14>, <&gate_clk 15>; clock-names = "0", "1"; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; status = "disabled"; };
arch/arm/boot/dts/kirkwood.dtsi +18 -0
@@ -282,5 +282,23 @@ /* set phy-handle property in board file */ }; }; + + sata_phy0: sata-phy at 82000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x82000 0x0334>; + clocks = <&gate_clk 14>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; + + sata_phy1: sata-phy at 84000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x84000 0x0334>; + clocks = <&gate_clk 15>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; }; };
Signature · 1 line
1.8.5
PATCH v2 4/4 Phy: Add DT nodes on kirkwood and Dove for the SATA PHY
Quoted 1 line · Andrew Lunn
Add nodes for the two SATA PHYs on kirkewood.
s/kirkewood/kirkwood/ but only if you do a respin. Otherwise, I can patch it up when I pull it in.
thx,
Jason.
Quoted 98 lines
Add node for the one SATA PHY on Dove.
Add pHandles to the PHYs in the sata nodes.Signed-off-by Andrew Lunn <[email protected]>---
v1->v2:sata_phyat ... ->sata-phy@
value after '@' matching the first address in the reg.--- arch/arm/boot/dts/dove.dtsi | 11 +++++++++++ arch/arm/boot/dts/kirkwood-6281.dtsi | 2 ++ arch/arm/boot/dts/kirkwood-6282.dtsi | 2 ++ arch/arm/boot/dts/kirkwood.dtsi | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+)arch/arm/boot/dts/dove.dtsi +11
-0@@ -490,10 +490,21 @@ reg = <0xa0000 0x2400>; interrupts = <62>; clocks = <&gate_clk 3>; + phys = <&sata_phy0>; + phy-names = "0"; nr-ports = <1>; status = "disabled"; }; + sata_phy0: sata-phy at a2000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0xa2000 0x0334>; + clocks = <&gate_clk 3>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; + rtc: real-time-clock at d8500 { compatible = "marvell,orion-rtc"; reg = <0xd8500 0x20>;arch/arm/boot/dts/kirkwood-6281.dtsi +2
-0@@ -89,6 +89,8 @@ interrupts = <21>; clocks = <&gate_clk 14>, <&gate_clk 15>; clock-names = "0", "1"; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; status = "disabled"; };arch/arm/boot/dts/kirkwood-6282.dtsi +2
-0@@ -117,6 +117,8 @@ interrupts = <21>; clocks = <&gate_clk 14>, <&gate_clk 15>; clock-names = "0", "1"; + phys = <&sata_phy0>, <&sata_phy1>; + phy-names = "0", "1"; status = "disabled"; };arch/arm/boot/dts/kirkwood.dtsi +18
-0@@ -282,5 +282,23 @@ /* set phy-handle property in board file */ }; }; + + sata_phy0: sata-phy at 82000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x82000 0x0334>; + clocks = <&gate_clk 14>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; + + sata_phy1: sata-phy at 84000 { + compatible = "marvell,mvebu-sata-phy"; + reg = <0x84000 0x0334>; + clocks = <&gate_clk 15>; + clock-names = "sata"; + #phy-cells = <0>; + status = "ok"; + }; }; };Signature · 1 line
1.8.5
v2 cover PHY driver for Marvell SATA
In reply to Andrew LunnAndrew,
wrt merging...
Quoted 7 lines · Andrew Lunn
This second version addresses most of the points raised during review.
What has not been changed is the phy-names property. This is awaiting feedback on my comment that the naming follows how clocks are named in the driver & DT binding. For this reason i've also not added the
Ack-by: received in the review comments.
Quoted 6 lines
Andrew Lunn (4):
Phy: DT binding documentation for Marvell MVEBU SATA phy.
Phy: Add a PHY driver for Marvell MVEBU SATA PHY.
SATA: MV: Add support for the optional PHYs
Phy: Add DT nodes on kirkwood and Dove for the SATA PHY
This is actually really easy.
Quoted 2 lines
Documentation/devicetree/bindings/ata/marvell.txt | 6 + .../devicetree/bindings/phy/phy-mvebu.txt | 22 ++++
Keep this with the phy driver patch.
Quoted 4 lines
arch/arm/boot/dts/dove.dtsi | 11 ++ arch/arm/boot/dts/kirkwood-6281.dtsi | 2 + arch/arm/boot/dts/kirkwood-6282.dtsi | 2 + arch/arm/boot/dts/kirkwood.dtsi | 18 +++
I'll take this.
Quoted 1 line
drivers/ata/sata_mv.c | 19 +++
This uses the phy if it's available, so this can go through ata. No dependency problems there.
Quoted 3 lines
drivers/phy/Kconfig | 6 + drivers/phy/Makefile | 1 + drivers/phy/phy-mvebu-sata.c | 137 +++++++++++++++++++++
And this can go through Kishon with the binding docs.
thx,
Jason.