Skip to contentSkip to conversation

PHY: Add APM X-Gene SoC 15Gbps Multi-purpose PHY support

PATCH Superseded Loc Ho 2 participants 15 messages Feb 27, 2014 – Mar 5, 2014

Subsystems (4)

v12 of 18 Superseded Latest is v18 →

lore
Share & tools
lore

Loc Ho

author
#0 lore raw

v12 cover 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 PHY generic framework. In addition, the PHY generic framework is patched to provide an function to set the speed of the PHY.

v12:
* Add driver depend on HAS_IOMEM and OF
* Fix comment typo in header file phy-xgene.
* Change all macro shift value in hex to decimal
* Add time out for while loop to function sds_wr and sds_rd
* Set proper return value if failed to get IO resource 0
* Move devm_of_phy_provider_register to last operation in probe function
* Remove driver registration print statement
* Replace module init/exit with module_platform_driver
* Change license to GPL v2

v11:
* Add comment to function phy_set_speed
* Add commit log for documentation patch file
* Minor comment update to function xgene_phy_force_lat_summer_cal and xgene_phy_sata_force_gen

v10
* Update comment for function xgene_phy_force_lat_summer_cal and xgene_phy_sata_force_gen with function style fully-winged style

v9
* Update CMU parameter setting for register 13
* Add required delay when configure CMU PLL, Manual Calibration PLL, and VCO PLL
* Add comment for CMU PLL calibration loop delay of 10us
* Add required delay for stopping and starting summer calibrations
* Update comment for summer and latch calibration delays
* Update comment for PHY reset Rx delay and decrease max sleep time from 500 to 150us
* Always program the DFE (equalizer) setting to 0x7e00 as with original version
* Fix Tx speed selection to always using Gen3 setting when force to an specified generation speed

v8
* Update binding documentation
* Remove XGENE_PHY_DTS and XGENE_PHY_EXT_DTS defines
* Remove support for internal clock
* Remove support for external reference CMU
* Remove the need for external reference resource DTS entry and its related code

v7
* Add/Update PHY CMU/lane parameters and its default values
* Rename variable enable_manual_cal to preA3Chip
* Remove function phy_rd, phy_wr, and phy_wr_flush
* Change function cmu_wr, cmu_rd, cmu_toggle1to0, cmu_clrbits, cmu_setbits, serdes_wr, serdes_rd, serdes_clrbits, and serdes_setbits to take context instead void *
* Remove function serdes_toggle1to0
* Decrease the polling time from 10ms to 1ms on CMU calibration complete detection
* Move all SATA specify code in function xgene_phy_hw_initialize into function xgene_phy_hw_init_sata
* Add usleep_range after starting summer/latch calibrations
* Add usleep_range between receiver reset (function xgene_phy_reset_rxd)
* Save and restore PHY register 31 instead writing 0 in function xgene_phy_gen_avg_val
* Update function xgene_phy_sata_force_gen programming sequences
* Add support to reset the receiver lane in function xgene_phy_set_speed if speed is 0
* Update PHY parameters in DTS per controller
* Some minor code clean up

v6
* Move PHY document to Documentation/devicetree/binding/phy
* Remove _ADDR from all register defines
* Update clock-names property for sataphy1clk, sataphy2clk, and sataphy3clk

v5
* Update DTS binding documentation
* Remove direct clock access and use clock interface instead
* Change override parameters to decimal instead hex values
* Change apm,tx-amplitude, apm,tx-pre-cursor1, apm,tx-pre-cursor2, apm,tx-post-cursor to be unit of uV

v4
* Update documentation with 'apm,' instead 'apm-'
* Change DTS override parameter to have 'apm,'
* Add select GENERIC_PHY to Kconfig PHY_XGENE
* Make override parameters to be pair of three values instead one
* Some minor comment and indentation changes
* Remove error register addition offset
* Add ULL to constants
* Use module_init instead subsys_initcall
* Make DTS node based on first register address
* Update override setting values

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/phy/apm-xgene-phy.txt      |   79 +
 arch/arm64/boot/dts/apm-storm.dtsi                 |   75 +
 drivers/phy/Kconfig                                |    7 +
 drivers/phy/Makefile                               |    2 +
 drivers/phy/phy-core.c                             |   30 +
 drivers/phy/phy-xgene.c                            | 1813 ++++++++++++++++++++
 include/linux/phy/phy.h                            |    8 +
 7 files changed, 2014 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/apm-xgene-phy.txt
 create mode 100644 drivers/phy/phy-xgene.c
author
#1 lore raw

PATCH v12 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  |   30 ++++++++++++++++++++++++++++++
 include/linux/phy/phy.h |    8 ++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
drivers/phy/phy-core.c +30 -0
index 645c867..5451b6d 100644
@@ -258,6 +258,36 @@ int phy_power_off(struct phy *phy)
 EXPORT_SYMBOL_GPL(phy_power_off);
 
 /**
+ * phy_set_speed - set an specified lane at an specified speed
+ * @phy: phy instance to be set
+ * @lane: zero-based lane index
+ * @speed: operating speed in hz
+ *
+ * Returns 0 if successful, -ENOTSUPP if not supported,
+ * -EINVAL if parameter out of range.
+ */
+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
  * @index: the index of the phy
include/linux/phy/phy.h +8 -0
index e273e5a..4eb589c 100644
@@ -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;
 };
 
@@ -145,6 +147,7 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 {
 	phy->attrs.bus_width = bus_width;
 }
+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);
@@ -227,6 +230,11 @@ static inline void phy_set_bus_width(struct phy *phy, int bus_width)
 	return;
 }
 
+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
author
#2 lore raw

PATCH v12 2/4 Documentation: Add APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation

This patch adds APM X-Gene SoC 15Gbps Multi-purpose PHY driver binding documentation.

---
 .../devicetree/bindings/phy/apm-xgene-phy.txt      |   79 ++++++++++++++++++++
 1 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/apm-xgene-phy.txt
Documentation/devicetree/bindings/phy/apm-xgene-phy.txt new file +79 -0
new file mode 100644
index 0000000..5f3a65a
@@ -0,0 +1,79 @@
+* 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".
+- reg			: PHY memory resource is the SDS PHY access resource.
+- #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), 3 (USB), and 4 (XFI).
+
+Optional properties:
+- status		: Shall be "ok" if enabled or "disabled" if disabled.
+			  Default is "ok".
+- clocks		: Reference to the clock entry.
+- 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 each (up to 3)
+			  supported link speed on the host. Range from 0 to
+			  127 in unit of one bit period. Default is 10.
+- 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 each (up to 3)
+			  supported link speed on the host. Default is 0.
+- apm,tx-boost-gain	: Frequency boost AC (LSB 3-bit) and DC (2-bit)
+			  gain control. Two set of 3-tuple setting for each
+			  (up to 3) supported link speed on the host. Range is
+			  between 0 to 31 in unit of dB. Default is 3.
+- apm,tx-amplitude	: Amplitude control. Two set of 3-tuple setting for
+			  each (up to 3) supported link speed on the host.
+			  Range is between 0 to 199500 in unit of uV.
+			  Default is 199500 uV.
+- apm,tx-pre-cursor1	: 1st pre-cursor emphasis taps control. Two set of
+			  3-tuple setting for each (up to 3) supported link
+			  speed on the host. Range is 0 to 273000 in unit of
+			  uV. Default is 0.
+- apm,tx-pre-cursor2	: 2st pre-cursor emphasis taps control. Two set of
+			  3-tuple setting for each (up to 3) supported link
+			  speed on the host. Range is 0 to 127400 in unit uV.
+			  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 each
+			  supported link speed on the host.
+			   0 = 1-2Gbps
+			   1 = 2-4Gbps (1st tuple default)
+			   2 = 4-8Gbps
+			   3 = 8-15Gbps (2nd tuple default)
+			   4 = 2.5-4Gbps
+			   5 = 4-5Gbps
+			   6 = 5-6Gbps
+			   7 = 6-16Gbps (3rd tuple default)
+
+NOTE: PHY override parameters are board specific setting.
+
+Example:
+		phy1: phy at 1f21a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f21a000 0x0 0x100>;
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+
+		phy2: phy at 1f22a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f22a000 0x0 0x100>;
+			#phy-cells = <1>;
+			status = "ok";
+		};
+
+		phy3: phy at 1f23a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f23a000 0x0 0x100>;
+			#phy-cells = <1>;
+			status = "ok";
+		};
Signature · 1 line
1.5.5
author
#3 lore raw

PATCH v12 3/4 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. Currently, only external clock and SATA mode are supported.

---
 drivers/phy/Kconfig     |    7 +
 drivers/phy/Makefile    |    2 +
 drivers/phy/phy-xgene.c | 1813 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1822 insertions(+), 0 deletions(-)
 create mode 100644 drivers/phy/phy-xgene.c
drivers/phy/Kconfig +7 -0
index afa2354..221a1b7 100644
@@ -64,4 +64,11 @@ config BCM_KONA_USB2_PHY
 	help
 	  Enable this to support the Broadcom Kona USB 2.0 PHY.
 
+config PHY_XGENE
+	tristate "APM X-Gene 15Gbps PHY support"
+	depends on HAS_IOMEM && OF && (ARM64 || COMPILE_TEST)
+	select GENERIC_PHY
+	help
+	  This option enables support for APM X-Gene SoC multi-purpose PHY.
+
 endmenu
drivers/phy/Makefile +2 -0
index b57c253..dee70f4 100644
@@ -9,3 +9,5 @@ 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
+obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
+
drivers/phy/phy-xgene.c new file +1813 -0

1,813 lines not on this page · raw message

Signature · 1 line
1.5.5
author
#4 lore raw

PATCH v12 4/4 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 2 and 3 are enabled by default.

---
 arch/arm64/boot/dts/apm-storm.dtsi |   75 ++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
arch/arm64/boot/dts/apm-storm.dtsi +75 -0
index d37d736..c78ddcf 100644
@@ -176,6 +176,51 @@
 				reg-names = "csr-reg";
 				clock-output-names = "eth8clk";
 			};
+
+			sataphy1clk: sataphy1clk at 1f21c000 {
+				compatible = "apm,xgene-device-clock";
+				#clock-cells = <1>;
+				clocks = <&socplldiv2 0>;
+				clock-names = "socplldiv2";
+				reg = <0x0 0x1f21c000 0x0 0x1000>;
+				reg-names = "csr-reg";
+				clock-output-names = "sataphy1clk";
+				status = "disabled";
+				csr-offset = <0x4>;
+				csr-mask = <0x00>;
+				enable-offset = <0x0>;
+				enable-mask = <0x06>;
+			};
+
+			sataphy2clk: sataphy1clk at 1f22c000 {
+				compatible = "apm,xgene-device-clock";
+				#clock-cells = <1>;
+				clocks = <&socplldiv2 0>;
+				clock-names = "socplldiv2";
+				reg = <0x0 0x1f22c000 0x0 0x1000>;
+				reg-names = "csr-reg";
+				clock-output-names = "sataphy2clk";
+				status = "ok";
+				csr-offset = <0x4>;
+				csr-mask = <0x3a>;
+				enable-offset = <0x0>;
+				enable-mask = <0x06>;
+			};
+
+			sataphy3clk: sataphy1clk at 1f23c000 {
+				compatible = "apm,xgene-device-clock";
+				#clock-cells = <1>;
+				clocks = <&socplldiv2 0>;
+				clock-names = "socplldiv2";
+				reg = <0x0 0x1f23c000 0x0 0x1000>;
+				reg-names = "csr-reg";
+				clock-output-names = "sataphy3clk";
+				status = "ok";
+				csr-offset = <0x4>;
+				csr-mask = <0x3a>;
+				enable-offset = <0x0>;
+				enable-mask = <0x06>;
+			};
 		};
 
 		serial0: serial at 1c020000 {
@@ -187,5 +232,35 @@
 			interrupt-parent = <&gic>;
 			interrupts = <0x0 0x4c 0x4>;
 		};
+
+		phy1: phy at 1f21a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f21a000 0x0 0x100>;
+			#phy-cells = <1>;
+			clocks = <&sataphy1clk 0>;
+			status = "disabled";
+			apm,tx-boost-gain = <30 30 30 30 30 30>;
+			apm,tx-eye-tuning = <2 10 10 2 10 10>;
+		};
+
+		phy2: phy at 1f22a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f22a000 0x0 0x100>;
+			#phy-cells = <1>;
+			clocks = <&sataphy2clk 0>;
+			status = "ok";
+			apm,tx-boost-gain = <30 30 30 30 30 30>;
+			apm,tx-eye-tuning = <1 10 10 2 10 10>;
+		};
+
+		phy3: phy at 1f23a000 {
+			compatible = "apm,xgene-phy";
+			reg = <0x0 0x1f23a000 0x0 0x100>;
+			#phy-cells = <1>;
+			clocks = <&sataphy3clk 0>;
+			status = "ok";
+			apm,tx-boost-gain = <31 31 31 31 31 31>;
+			apm,tx-eye-tuning = <2 10 10 2 10 10>;
+		};
 	};
 };
Signature · 1 line
1.5.5
#5 lore raw

Re: [PATCH v12 3/4] PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver

In reply to Loc Ho

Hi,

drivers/phy/phy-xgene.c line 1623

Quoted 6 lines · Loc Ho
drivers/phy/phy-xgene.c new file +6 -0
+/*
+ * This function is used to configure the PHY to operation as either SATA Gen1
+ * or Gen2 speed.
+ */
+static void xgene_phy_sata_force_gen(struct xgene_phy_ctx *ctx,
+				     int lane, int gen)

why do you need to *force* the generation ? Is this because of some silicon errata ? It almost seems like this should be done through link negotiation between both link partners.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140227/d35f8bec/attachment.sig>
author
#6 lore raw

Re: [PATCH v12 3/4] PHY: add APM X-Gene SoC 15Gbps Multi-purpose PHY driver

Hi Balbi,

Quoted 10 lines

drivers/phy/phy-xgene.c line 1623

Quoted 6 lines
drivers/phy/phy-xgene.c new file +6 -0
+/*
+ * This function is used to configure the PHY to operation as either SATA Gen1
+ * or Gen2 speed.
+ */
+static void xgene_phy_sata_force_gen(struct xgene_phy_ctx *ctx,
+                                  int lane, int gen)

why do you need to *force* the generation ? Is this because of some silicon errata ? It almost seems like this should be done through link negotiation between both link partners.

You can call this as an errata or limitation of the underlying PHY IP. As start, the PHY is configured with auto neg up to 6Gbps (or Gen3 speed). After link up, we will know whether it is Gen1 (1.5Gbps), Gen2 (3.0Gbps), or Gen3 (6.0Gbps). In order to ensure reliability, the PHY needs to be configured at specified speed. For this reason and after link up, the PHY is re-trained for the linked up speed.

-Loc

#7 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

In reply to Loc Ho

Hi,

Quoted 3 lines · Loc Ho

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140227/5b5f69ec/attachment-0001.sig>
author
#8 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi Balbi,

Quoted 8 lines · Loc Ho
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

-Loc

#9 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi,

Quoted 5 lines · Loc Ho
Quoted 5 lines · Loc Ho
Quoted 3 lines

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.

Quoted 8 lines
Quoted 3 lines

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic. After negoatiation, don't you get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

cheers

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140227/ce88d27e/attachment.sig>
author
#10 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

Quoted 7 lines
Quoted 4 lines

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic.

Setting the operation speed is pretty generic from an interface point of view. An generic multi-purpose PHY can support multiple speed. If the upper layer wish to operate at an specified speed (say for testing purpose and etc), it can be allowed.

Quoted 3 lines

After negoatiation, don't you
get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

There is NO interrupt from the PHY. The IRQ is assoicated with the AHCI IP. With SATA host flow, it starts off with an COMRESET to start the link negotiation. At that point, it will poll for completion.

Any other concerns?

-Loc

#11 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi,

Quoted 13 lines · Loc Ho
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

Quoted 5 lines
Quoted 2 lines

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic.

Setting the operation speed is pretty generic from an interface point of view. An generic multi-purpose PHY can support multiple speed. If

no it's not. Specially when you consider that your "speed" argument can be just about anything and depending on the underlying bus, it *will* be treated differently. Note that e.g. in OMAP devices the exact *same* PHY IP is used for PCIe, SATA and USB... now, let's assume for the sake of argument that we were to implement ->set_speed() in that environment, how do you plan to do that ? a 6MHz arguments isn't valid from USB stand point and could mean different things in PCIe or SATA.

Quoted 2 lines

the upper layer wish to operate at an specified speed (say for testing purpose and etc), it can be allowed.

anything for testing purposes, should be limited to test scenarios.

Quoted 9 lines
Quoted 3 lines

After negoatiation, don't you
get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

There is NO interrupt from the PHY. The IRQ is assoicated with the AHCI IP. With SATA host flow, it starts off with an COMRESET to start the link negotiation. At that point, it will poll for completion.

Any other concerns?

hey, calm down... just trying to prevent us from applying something which isn't truly generic and I don't think "->set_speed" is generic enough. The semantics of the "speed" argument won't be valid for all use cases.

I can already see people using that to pass USB_SPEED_{LOW,FULL,HIGH,SUPER}, instead of actual speed numbers. We wil end up with a mess to handle from a PHY driver, specially in cases such as OMAP where, as mentioned above, the same IP is used for SATA, PCIe and USB3.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140227/ac781324/attachment.sig>
author
#12 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

HI,

Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

Quoted 5 lines
Quoted 2 lines

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic.

Setting the operation speed is pretty generic from an interface point of view. An generic multi-purpose PHY can support multiple speed. If

Quoted 8 lines

no it's not. Specially when you consider that your "speed" argument can be just about anything and depending on the underlying bus, it *will* be treated differently. Note that e.g. in OMAP devices the exact *same* PHY IP is used for PCIe, SATA and USB... now, let's assume for the sake of argument that we were to implement ->set_speed() in that environment, how do you plan to do that ? a 6MHz arguments isn't valid from USB stand point and could mean different things in PCIe or SATA.

Correct me if I am wrong here. If the same PHY is used for PCIe, SATA, and USB, would you not need to indicate what speed the PHY should be operated at - unless the underlying IP magically negotiate and configured automatically? If so, what about PHY isn't so intelligent? How should you suggest that we handle these?

Quoted 4 lines
Quoted 2 lines

the upper layer wish to operate at an specified speed (say for testing purpose and etc), it can be allowed.

anything for testing purposes, should be limited to test scenarios.

Testing purpose is only one use case. Another use case is to limit the speed so that I can confirm the driver actually works with various speed of the device and handle correctly.

Quoted 16 lines
Quoted 10 lines
Quoted 4 lines

After negoatiation, don't you
get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

There is NO interrupt from the PHY. The IRQ is assoicated with the AHCI IP. With SATA host flow, it starts off with an COMRESET to start the link negotiation. At that point, it will poll for completion.

Any other concerns?

hey, calm down... just trying to prevent us from applying something which isn't truly generic and I don't think "->set_speed" is generic enough. The semantics of the "speed" argument won't be valid for all use cases.

Quoted 6 lines

I can already see people using that to pass USB_SPEED_{LOW,FULL,HIGH,SUPER}, instead of actual speed numbers. We wil end up with a mess to handle from a PHY driver, specially in cases such as OMAP where, as mentioned above, the same IP is used for SATA, PCIe and USB3.

This PHY isn't as "intelligent" as other PHY's. What would you suggest as I need an method to indicate to the underlying PHY that I want to operate at an specified speed?

-Loc

author
#13 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi Felipe and Kishon,

Quoted 66 lines
Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

Quoted 5 lines
Quoted 2 lines

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic.

Setting the operation speed is pretty generic from an interface point of view. An generic multi-purpose PHY can support multiple speed. If

Quoted 8 lines

no it's not. Specially when you consider that your "speed" argument can be just about anything and depending on the underlying bus, it *will* be treated differently. Note that e.g. in OMAP devices the exact *same* PHY IP is used for PCIe, SATA and USB... now, let's assume for the sake of argument that we were to implement ->set_speed() in that environment, how do you plan to do that ? a 6MHz arguments isn't valid from USB stand point and could mean different things in PCIe or SATA.

Correct me if I am wrong here. If the same PHY is used for PCIe, SATA, and USB, would you not need to indicate what speed the PHY should be operated at - unless the underlying IP magically negotiate and configured automatically? If so, what about PHY isn't so intelligent? How should you suggest that we handle these?

Quoted 4 lines
Quoted 2 lines

the upper layer wish to operate at an specified speed (say for testing purpose and etc), it can be allowed.

anything for testing purposes, should be limited to test scenarios.

Testing purpose is only one use case. Another use case is to limit the speed so that I can confirm the driver actually works with various speed of the device and handle correctly.

Quoted 16 lines
Quoted 10 lines
Quoted 4 lines

After negoatiation, don't you
get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

There is NO interrupt from the PHY. The IRQ is assoicated with the AHCI IP. With SATA host flow, it starts off with an COMRESET to start the link negotiation. At that point, it will poll for completion.

Any other concerns?

hey, calm down... just trying to prevent us from applying something which isn't truly generic and I don't think "->set_speed" is generic enough. The semantics of the "speed" argument won't be valid for all use cases.

Quoted 6 lines

I can already see people using that to pass USB_SPEED_{LOW,FULL,HIGH,SUPER}, instead of actual speed numbers. We wil end up with a mess to handle from a PHY driver, specially in cases such as OMAP where, as mentioned above, the same IP is used for SATA, PCIe and USB3.

Quoted 3 lines

This PHY isn't as "intelligent" as other PHY's. What would you suggest as I need an method to indicate to the underlying PHY that I want to operate at an specified speed?

Sorry if I am pinging you guys too fast here. I am look from an solution and open to any solution in which it is acceptable for your original intent of the generic PHY framework. I understand that you don't believe set_speed is generic enough and may not apply to omap. Or if you prefer we can try changing the init function to take an initial MAX speed?

-Loc

author
#14 lore raw

Re: [PATCH v12 1/4] PHY: Add function set_speed to generic PHY framework

Hi,

Quoted 70 lines
Quoted 66 lines
Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 3 lines

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.

why ? looks like clk_set_rate() is your friend here. Can you be more descriptive of the use case ? When will this be used ?

The phy_set_speed is used to configure the operation speed of the PHY at run-time. The clock interface in general is used to configure the clock input to the IP. I don't believe they are the same thing. Maybe it will be clear in my response to your second email

Quoted 5 lines
Quoted 2 lines

The problem with this is that you end up adding SATA-specific details to something which is supposed to be generic.

Setting the operation speed is pretty generic from an interface point of view. An generic multi-purpose PHY can support multiple speed. If

Quoted 8 lines

no it's not. Specially when you consider that your "speed" argument can be just about anything and depending on the underlying bus, it *will* be treated differently. Note that e.g. in OMAP devices the exact *same* PHY IP is used for PCIe, SATA and USB... now, let's assume for the sake of argument that we were to implement ->set_speed() in that environment, how do you plan to do that ? a 6MHz arguments isn't valid from USB stand point and could mean different things in PCIe or SATA.

Correct me if I am wrong here. If the same PHY is used for PCIe, SATA, and USB, would you not need to indicate what speed the PHY should be operated at - unless the underlying IP magically negotiate and configured automatically? If so, what about PHY isn't so intelligent? How should you suggest that we handle these?

Quoted 4 lines
Quoted 2 lines

the upper layer wish to operate at an specified speed (say for testing purpose and etc), it can be allowed.

anything for testing purposes, should be limited to test scenarios.

Testing purpose is only one use case. Another use case is to limit the speed so that I can confirm the driver actually works with various speed of the device and handle correctly.

Quoted 16 lines
Quoted 10 lines
Quoted 4 lines

After negoatiation, don't you
get any interrupt from your PHY indicating that link speed negotiation is done ? Or is that IRQ only on AHCI IP ?

There is NO interrupt from the PHY. The IRQ is assoicated with the AHCI IP. With SATA host flow, it starts off with an COMRESET to start the link negotiation. At that point, it will poll for completion.

Any other concerns?

hey, calm down... just trying to prevent us from applying something which isn't truly generic and I don't think "->set_speed" is generic enough. The semantics of the "speed" argument won't be valid for all use cases.

Quoted 6 lines

I can already see people using that to pass USB_SPEED_{LOW,FULL,HIGH,SUPER}, instead of actual speed numbers. We wil end up with a mess to handle from a PHY driver, specially in cases such as OMAP where, as mentioned above, the same IP is used for SATA, PCIe and USB3.

Quoted 3 lines

This PHY isn't as "intelligent" as other PHY's. What would you suggest as I need an method to indicate to the underlying PHY that I want to operate at an specified speed?

Quoted 7 lines

Sorry if I am pinging you guys too fast here. I am look from an solution and open to any solution in which it is acceptable for your original intent of the generic PHY framework. I understand that you don't believe set_speed is generic enough and may not apply to omap. Or if you prefer we can try changing the init function to take an initial MAX speed?

For the initial version, I will remove support for Gen1/Gen2 until we come up with an solution. Then post patches that will address individual errata's.

-Loc