PHY: Add APM X-Gene SoC 15Gbps Multi-purpose PHY support
Subsystems (4)
v3 cover PHY: Add APM X-Gene SoC 15Gbps Multi-purpose PHY support
PHY: Add APM X-Gene SoC 15Gbps Multi-purpose PHY support
This patch adds support for APM X-Gene SoC 15Gbps Multi-purpose PHY. This is the physical layer interface for the corresponding host controller. This driver uses the new PHY generic framework posted by Kishon Vijay Abrahm. In addition, the new PHY generic framework is patched to provide an function to set the speed of the PHY.
v3
* Major re-write of the code based on various review comments
* Support external clock only at the moment
* Support SATA mode only at the moment
* No UEFI support at the moment
v2
* Remove port knowledge from functions
* Make all functions static
* Remove ID completely
* Make resource requirement based on compatible type
* Rename override PHY parameters with more descriptive name
* Add override PHY parameter for per controller, per port, and per speed
* Patch the generic PHY frame to expose set_speed operation
v1
* Initial version
---
Loc Ho (4):
PHY: Add function set_speed to generic PHY framework
Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver
binding documentation
PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver
arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
.../devicetree/bindings/ata/apm-xgene-phy.txt | 89 + arch/arm64/boot/dts/apm-storm.dtsi | 31 + drivers/phy/Kconfig | 6 + drivers/phy/Makefile | 2 + drivers/phy/phy-core.c | 21 + drivers/phy/phy-xgene.c | 1838 ++++++++++++++++++++ include/linux/phy/phy.h | 8 + 7 files changed, 1995 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/ata/apm-xgene-phy.txt create mode 100644 drivers/phy/phy-xgene.c
PATCH v3 1/4 PHY: Add function set_speed to generic PHY framework
This patch adds function set_speed to the generic PHY framework operation structure. This function can be called to instruct the PHY underlying layer at specified lane to configure for specified speed in hertz.
--- drivers/phy/phy-core.c | 21 +++++++++++++++++++++ include/linux/phy/phy.h | 8 ++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)
drivers/phy/phy-core.c +21 -0
@@ -239,6 +239,27 @@ out: }EXPORT_SYMBOL_GPL (phy_power_off); +int phy_set_speed (struct phy *phy,int lane,u64 speed) +{ +int ret = -ENOTSUPP ; + +mutex_lock (&phy->mutex); +if (phy->ops->set_speed) { + ret = phy->ops->set_speed (phy, lane, speed); +if (ret <0 ) { +dev_err (&phy->dev,"phy set speed failed --> %d\n" , + ret); + goto out; + } + } + +out: +mutex_unlock (&phy->mutex); + +return ret; +} +EXPORT_SYMBOL_GPL (phy_set_speed); +/** * of_phy_get() - lookup and obtain a reference to a phy by phandle * @dev: device that requests this phy
include/linux/phy/phy.h +8 -0
@@ -27,6 +27,7 @@ struct phy;* @exit: operation to be performed while exiting * @power_on: powering on the phy * @power_off: powering off the phy +* @set_speed: set operation speed in hz * @owner: the module owner containing the ops */ struct phy_ops {
@@ -34,6 +35,7 @@ struct phy_ops {int (*exit)(struct phy *phy);int (*power_on)(struct phy *phy);int (*power_off)(struct phy *phy); +int (*set_speed)(struct phy *phy,int lane,u64 speed);struct module *owner; };
@@ -127,6 +129,7 @@ int phy_init(struct phy *phy);int phy_exit (struct phy *phy);int phy_power_on (struct phy *phy);int phy_power_off (struct phy *phy); +int phy_set_speed (struct phy *phy,int lane,u64 speed);struct phy *phy_get (struct device *dev,const char *string);struct phy *devm_phy_get (struct device *dev,const char *string);void phy_put (struct phy *phy);
@@ -199,6 +202,11 @@ static inline int phy_power_off(struct phy *phy)return -ENOSYS ; } +static inline int phy_set_speed (struct phy *phy,int lane,u64 speed) +{ +return -ENOSYS ; +} +static inline struct phy *phy_get (struct device *dev,const char *string) {return ERR_PTR (-ENOSYS );
Signature · 1 line
1.5.5
PATCH v3 2/4 Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation
Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation
--- .../devicetree/bindings/ata/apm-xgene-phy.txt | 89 ++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/ata/apm-xgene-phy.txt
Documentation/devicetree/bindings/ata/apm-xgene-phy.txt new file +89 -0
@@ -0,0 +1,89 @@ +* APM X-Gene 15Gbps Multi-purpose PHY nodes + +PHY nodes are defined to describe on-chip 15Gbps Multi-purpose PHY. Each +PHY (pair of lanes) has its own node. + +Required properties: +- compatible : Shall be "apm,xgene-phy" or + "apm,xgene-phy-ext". The "apm,xgene-phy" describes + an PHY with internal reference PLL located within + the IP. The "apm,xgene-phy-ext" describes an PHY + where the internal reference PLL located outside of + the IP. +- reg : First PHY memory resource is the SDS PHY access + resource. + Second PHY memory resoruce is the clock and reset + resources. + Third PHY memory resource is the SDS PHY access + resource outside of the IP if it is type + "apm,xgene-phy-ext". +- #phy-cells : Shall be 1 as it expects one argument for setting + the mode of the PHY. Possible values are 0 (SATA), + 1 (SGMII), 2 (PCIe), or 3 (USB). + +Optional properties: +- status : Shall be "ok" if enabled or "disabled" if disabled. + Default is "ok". +- apm-tx-eye-tuning : Manual control to fine tune the capture of the serial + bit lines from the automatic calibrated position. + Two set of 3-tuple setting for Gen1, Gen2, and Gen3. + Range from 0 to 0x7f in unit of one bit period. + Default is 0xa. +- apm-tx-eye-direction : Eye tuning manual control direction. 0 means sample + data earlier than the nominal sampling point. 1 means + sample data later than the nominal sampling point. + Two set of 3-tuple setting for Gen1, Gen2, and Gen3. + Default is 0x0. +- apm-tx-boost-gain : Frequency boost AC (LSB 3-bit) and DC (2-bit) + gain control. Two set of 3-tuple setting for Gen1, + Gen2, and Gen3. Range is between 0 to 0x1f in unit + of dB. Default is 0x3. +- apm-tx-amplitude : Amplitude control. Two set of 3-tuple setting for + Gen1, Gen2, and Gen3. Range is between 0 to 0xf in + unit of 13.3mV. Default is 0xf. +- apm-tx-pre-cursor1 : 1st pre-cursor emphasis taps control. Two set of + 3-tuple setting for Gen1, Gen2, and Gen3. Range is + between 0 to 0xf in unit of 18.2mV. Default is 0x0. +- apm-tx-pre-cursor2 : 2st pre-cursor emphasis taps control. Two set of + 3-tuple setting for Gen1, Gen2, and Gen3. Range is + between 0 to 0x7 in unit of 18.2mV. Default is 0x0. +- apm-tx-post-cursor : Post-cursor emphasis taps control. Two set of + 3-tuple setting for Gen1, Gen2, and Gen3. Range is + between 0 to 0x1f in unit of 18.2mV. Default is 0xf. +- apm-tx-speed : Tx operating speed. One set of 3-tuple for + Gen1 (0x1), Gen2 (0x3), and Gen3 (0x7). Default is + 0x7. + +NOTE: PHY override parameters are board specific setting. + +Example: + phy1: phy at 1f210000 { + compatible = "apm,xgene-phy"; + reg = <0x0 0x1f21a000 0x0 0x100>, + <0x0 0x1f21c000 0x0 0x100>; + #phy-cells = <1>; + status = "disabled"; + apm-tx-boost-gain = <0x2 0x2 0x2 0x2 0x2 0x2>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0xa 0xa 0xa>; + }; + + phy2: phy at 1f220000 { + compatible = "apm,xgene-phy"; + reg = <0x0 0x1f22a000 0x0 0x100>, + <0x0 0x1f22c000 0x0 0x100>; + #phy-cells = <1>; + status = "ok"; + apm-tx-boost-gain = <0x2 0x2 0x2 0x2 0x2 0x2>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0x5 0x5 0x5>; + }; + + phy3: phy at 1f230000 { + compatible = "apm,xgene-phy-ext"; + reg = <0x0 0x1f23a000 0x0 0x100>, + <0x0 0x1f23c000 0x0 0x100>, + <0x0 0x1f2d0000 0x0 0x100>; + #phy-cells = <1>; + status = "ok"; + apm-tx-boost-gain = <0x3 0x3 0x3 0x3 0x3 0x3>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0xc 0xc 0xc>; + };
Signature · 1 line
1.5.5
PATCH v3 3/4 PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver
PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver
This patch adds support for APM X-Gene SoC 15Gbps Multi-purpose PHY. This is the physical layer interface for the corresponding host controller. This driver uses the new PHY generic framework posted by Kishon Vijay Abrahm. Currently, only external clock and SATA mode are supported.
--- drivers/phy/Kconfig | 6 + drivers/phy/Makefile | 2 + drivers/phy/phy-xgene.c | 1838 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1846 insertions(+), 0 deletions(-) create mode 100644 drivers/phy/phy-xgene.c
drivers/phy/Kconfig +6 -0
@@ -51,4 +51,10 @@ config PHY_EXYNOS_DP_VIDEO help Support for Display Port PHY found on Samsung EXYNOS SoCs. +config PHY_XGENE + tristate "APM X-Gene 15Gbps PHY support" + depends on ARM64 || COMPILE_TEST + help + This option enables support for APM X-Gene SoC multi-purpose PHY. + endmenu
drivers/phy/Makefile +2 -0
@@ -7,3 +7,5 @@ obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o obj-$(CONFIG_PHY_EXYNOS_MIPI_VIDEO) += phy-exynos-mipi-video.o obj-$(CONFIG_OMAP_USB2) += phy-omap-usb2.o obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o +obj-$(CONFIG_PHY_XGENE) += phy-xgene.o +
drivers/phy/phy-xgene.c new file +1838 -0
1,838 lines not on this page · raw message
Signature · 1 line
1.5.5
PATCH v3 4/4 arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
This patch adds the DTS entries for the APM X-Gene SoC 15Gbps Multi-purpose PHY driver. The PHY for SATA controller 0 and 1 are enabled by default.
--- arch/arm64/boot/dts/apm-storm.dtsi | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
arch/arm64/boot/dts/apm-storm.dtsi +31 -0
@@ -193,5 +193,36 @@ reg = <0x0 0x17000014 0x0 0x100>; mask = <0x1>; }; + + phy1: phy at 1f210000 { + compatible = "apm,xgene-phy"; + reg = <0x0 0x1f21a000 0x0 0x100>, + <0x0 0x1f21c000 0x0 0x100>; + #phy-cells = <1>; + status = "disabled"; + apm-tx-boost-gain = <0x2 0x2 0x2 0x2 0x2 0x2>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0xa 0xa 0xa>; + }; + + phy2: phy at 1f220000 { + compatible = "apm,xgene-phy"; + reg = <0x0 0x1f22a000 0x0 0x100>, + <0x0 0x1f22c000 0x0 0x100>; + #phy-cells = <1>; + status = "ok"; + apm-tx-boost-gain = <0x2 0x2 0x2 0x2 0x2 0x2>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0x5 0x5 0x5>; + }; + + phy3: phy at 1f230000 { + compatible = "apm,xgene-phy-ext"; + reg = <0x0 0x1f23a000 0x0 0x100>, + <0x0 0x1f23c000 0x0 0x100>, + <0x0 0x1f2d0000 0x0 0x100>; + #phy-cells = <1>; + status = "ok"; + apm-tx-boost-gain = <0x3 0x3 0x3 0x3 0x3 0x3>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0xc 0xc 0xc>; + }; }; };
Signature · 1 line
1.5.5
PATCH v3 4/4 arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
Hello.
Quoted 1 line · Loc Ho
arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
As I already said, there's no need to repeat the patch summary line (the
mail subject) in the changelog verbatim.
Quoted 15 lines
This patch adds the DTS entries for the APM X-Gene SoC 15Gbps Multi-purpose PHY driver. The PHY for SATA controller 0 and 1 are enabled by default.
Signed-off-by Loc Ho <[email protected]>Signed-off-by Tuan Phan <[email protected]>Signed-off-by Suman Tripathi <[email protected]>--- arch/arm64/boot/dts/apm-storm.dtsi | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)arch/arm64/boot/dts/apm-storm.dtsi +0
-0
arch/arm64/boot/dts/apm-storm.dtsi line 197
Quoted 5 lines
arch/arm64/boot/dts/apm-storm.dtsi +2
-0@@ -193,5 +193,36 @@ reg = <0x0 0x17000014 0x0 0x100>; mask = <0x1>; }; + + phy1: phy at 1f210000 {
Shouldn't the address part of the node name correspond to the first
address specifier in the "reg" prop?
arch/arm64/boot/dts/apm-storm.dtsi line 204
Quoted 7 lines
arch/arm64/boot/dts/apm-storm.dtsi +7
-0+ compatible = "apm,xgene-phy"; + reg = <0x0 0x1f21a000 0x0 0x100>, + <0x0 0x1f21c000 0x0 0x100>; + #phy-cells = <1>; + status = "disabled"; + apm-tx-boost-gain = <0x2 0x2 0x2 0x2 0x2 0x2>; + apm-tx-eye-tuning = <0xa 0xa 0xa 0xa 0xa 0xa>;
The vendor name should be separated by comma in the vendor specific prop
names.
arch/arm64/boot/dts/apm-storm.dtsi line 205
Quoted 1 line
arch/arm64/boot/dts/apm-storm.dtsi +1
-0+ };
Same comments about the other 2 PHY nodes.
WBR, Sergei