Skip to contentSkip to conversation

Add driver support for Eswin EIC7700 SoC SATA Controller and PHY

PATCH Superseded Yulin Lu 3 participants 9 messages Sep 4, 2025 – Sep 5, 2025

Subsystems (3)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Yulin Lu

author
#0 lore raw

v3 cover Add driver support for Eswin EIC7700 SoC SATA Controller and PHY

This series depends on the config option patch [1].

[1] https://lore.kernel.org/all/[email protected]/

Updates:
v2 -> v3:
- Use full name in "From" and "Signed-off-by" fields information.
- eswin,eic7700-ahci.yaml
- Remove the introduction to the reg, interrupts, phys, and phy-names fields.
- Modify the usage of the clocks field in the examples.
- Corrected the order of dt properties.
- phy-eic7700-sata.c
- Register operations use the GENMASK macro and FIELD_PREP instead of
the original bit offset method, and add "#include <linux/bitfield.h>".
- Modified some macro definition names.
- Remove the redundant initialization assignments for "ret" and "val".
- Delete ".suppress_bind_attrs = true".
- Modify the driver name.
- Add "#include <linux/io.h>" to fix the robot test issue.
- Link to v2: https://lore.kernel.org/lkml/[email protected]/

v2 -> v1:
- Delete the original controller driver and use ahci_dwc.c instead.
- Add eswin,eic7700-ahci.yaml
- Correct the descriptions of reset, interrupt and other
hardware resources for the sata controller on EIC7700 SoC.
- The clocks for both sata controller and sata PHY are controlled
via a register bit in the HSP bus and are not registered in the
clock tree. Clock are managed within the PHY driver, therefore
it is not described in this document.
- Add $ref: snps,dwc-ahci-common.yaml#.
- Add eswin,eic7700-sata-phy.yaml
- Add this file to include the description of the PHY on EIC7700 SoC.
- Add an eswin directory under the PHY driver path, and include the SATA
PHY driver code for EIC7700 SoC.
- Link to v1: https://lore.kernel.org/all/[email protected]/

Yulin Lu (3):
dt-bindings: ata: eswin: Document for EIC7700 SoC ahci
dt-bindings: phy: eswin: Document for EIC7700 SoC SATA PHY
phy: eswin: Create eswin directory and add EIC7700 SATA PHY driver

 .../bindings/ata/eswin,eic7700-ahci.yaml      |  80 +++++++
 .../bindings/phy/eswin,eic7700-sata-phy.yaml  |  36 +++
 drivers/phy/Kconfig                           |   1 +
 drivers/phy/Makefile                          |   1 +
 drivers/phy/eswin/Kconfig                     |  14 ++
 drivers/phy/eswin/Makefile                    |   2 +
 drivers/phy/eswin/phy-eic7700-sata.c          | 205 ++++++++++++++++++
 7 files changed, 339 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml
 create mode 100644 drivers/phy/eswin/Kconfig
 create mode 100644 drivers/phy/eswin/Makefile
 create mode 100644 drivers/phy/eswin/phy-eic7700-sata.c
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v3 1/3 dt-bindings: ata: eswin: Document for EIC7700 SoC ahci

Add document for the SATA AHCI controller on the EIC7700 SoC platform, including descriptions of its hardware configurations.

---
 .../bindings/ata/eswin,eic7700-ahci.yaml      | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +80 -0
new file mode 100644
index 000000000000..9266f8f2543e
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ata/eswin,eic7700-ahci.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Eswin EIC7700 SoC SATA Controller
+
+maintainers:
+  - Yulin Lu <[email protected]>
+  - Huan He <[email protected]>
+
+description:
+  This document defines device tree bindings for the Synopsys DWC
+  implementation of the AHCI SATA controller found in Eswin's
+  Eic7700 SoC platform.
+
+select:
+  properties:
+    compatible:
+      const: eswin,eic7700-ahci
+  required:
+    - compatible
+
+allOf:
+  - $ref: snps,dwc-ahci-common.yaml#
+
+properties:
+  compatible:
+    items:
+      - const: eswin,eic7700-ahci
+      - const: snps,dwc-ahci
+
+  clocks:
+    minItems: 2
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: pclk
+      - const: aclk
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: arst
+
+  ports-implemented:
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - phys
+  - phy-names
+  - ports-implemented
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    sata@50420000 {
+        compatible = "eswin,eic7700-ahci", "snps,dwc-ahci";
+        reg = <0x50420000 0x10000>;
+        interrupt-parent = <&plic>;
+        interrupts = <58>;
+        clocks = <&clock 171>, <&clock 186>;
+        clock-names = "pclk", "aclk";
+        phys = <&sata_phy>;
+        phy-names = "sata-phy";
+        ports-implemented = <0x1>;
+        resets = <&reset 96>;
+        reset-names = "arst";
+    };
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: ata: eswin: Document for EIC7700 SoC ahci

Quoted 1 line · Yulin Lu

Add document for the SATA AHCI controller on the EIC7700 SoC platform,

Subject: drop "for", wrong grammar. "Document" is a verb.

Quoted 3 lines

including descriptions of its hardware configurations.

...

Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml line 14

Quoted 7 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +7 -0
+
+maintainers:
+  - Yulin Lu <[email protected]>
+  - Huan He <[email protected]>
+
+description:
+  This document defines device tree bindings for the Synopsys DWC

Describe the hardware, not the document. Entire line is completely redundant.

Quoted 3 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +3 -0
+  implementation of the AHCI SATA controller found in Eswin's
+  Eic7700 SoC platform.
+

...

Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml line 50

Quoted 13 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +13 -0
+  clock-names:
+    items:
+      - const: pclk
+      - const: aclk
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    const: arst
+
+  ports-implemented:
+    const: 1

I do not see how you addressed request about firmware. Nothing changed here, no explanation in the commit msg.

Best regards,
Krzysztof

maintainer
#3 lore raw

Re: [PATCH v3 1/3] dt-bindings: ata: eswin: Document for EIC7700 SoC ahci

Hello Krzysztof, Rob,

Quoted 6 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml line 50

Quoted 3 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +3 -0
+
+  ports-implemented:
+    const: 1

I do not see how you addressed request about firmware. Nothing changed here, no explanation in the commit msg.

In Yulin's defence, he did comment that when having the Ports Implemented register initialized by firmware, the Ports Implemented register apparently gets cleared to zero when rmmoding the driver (probably because it disables the clocks and regulators to the controller), thus this suggestion breaks the use case of being able to reload the driver (rmmod + insmod).

He mentioned this, and asked for advice here:
https://lore.kernel.org/linux-ide/[email protected]/

After no reply he asked the same question again:
https://lore.kernel.org/linux-ide/[email protected]/

I assume that Rob simply missed those messages.

Anyway, I provided my 50 cents here:
https://lore.kernel.org/linux-ide/[email protected]/

(I would like to add that I think it is the disabling of clocks and regulators that causes the register to be cleared, since we do call ahci_platform_assert_rsts() during the first probe, so if it was the reset that cleared the register, the first probe should also not have worked.)

Not sure if it relevant to mention this reply to Rob's review comment in the commit message, but perhaps it should have been mentioned in the change log.

Kind regards,
Niklas

#4 lore raw

Re: [PATCH v3 1/3] dt-bindings: ata: eswin: Document for EIC7700 SoC ahci

Quoted 27 lines · Niklas Cassel

Hello Krzysztof, Rob,

Quoted 6 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml line 50

Quoted 3 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +3 -0
+
+  ports-implemented:
+    const: 1

I do not see how you addressed request about firmware. Nothing changed here, no explanation in the commit msg.

In Yulin's defence, he did comment that when having the Ports Implemented register initialized by firmware, the Ports Implemented register apparently gets cleared to zero when rmmoding the driver (probably because it disables the clocks and regulators to the controller), thus this suggestion breaks the use case of being able to reload the driver (rmmod + insmod).

He mentioned this, and asked for advice here:
https://lore.kernel.org/linux-ide/[email protected]/

After no reply he asked the same question again:
https://lore.kernel.org/linux-ide/[email protected]/

I assume that Rob simply missed those messages.

Anyway, I provided my 50 cents here:
https://lore.kernel.org/linux-ide/[email protected]/

Quoted 8 lines

(I would like to add that I think it is the disabling of clocks and regulators that causes the register to be cleared, since we do call ahci_platform_assert_rsts() during the first probe, so if it was the reset that cleared the register, the first probe should also not have worked.)

Not sure if it relevant to mention this reply to Rob's review comment in the commit message, but perhaps it should have been mentioned in the change log.

Reviewer questions for more serious stuff happen for a reason, so when discussion is resolved somehow differently than reviewer suggested, it pretty often deserves explanation in commit msg.

Well, in changelog as absolute minimum. No explanation happened here in the changelog, nor in the commit msg.

Best regards,
Krzysztof

#5 lore raw

Re: Re: [PATCH v3 1/3] dt-bindings: ata: eswin: Document for EIC7700 SoC ahci

Hello Krzysztof, Niklas, Rob,

Thank you very much for your suggestions and reply.

Quoted 12 lines · Niklas Cassel
Quoted 10 lines

Hello Krzysztof, Rob,

Quoted 6 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml line 50

Quoted 3 lines
Documentation/devicetree/bindings/ata/eswin,eic7700-ahci.yaml new file +3 -0
+
+  ports-implemented:
+    const: 1

I do not see how you addressed request about firmware. Nothing changed here, no explanation in the commit msg.

...

Quoted 9 lines
Quoted 9 lines

Anyway, I provided my 50 cents here:
https://lore.kernel.org/linux-ide/[email protected]/

(I would like to add that I think it is the disabling of clocks and regulators that causes the register to be cleared, since we do call ahci_platform_assert_rsts() during the first probe, so if it was the reset that cleared the register, the first probe should also not have worked.)

Thank you very much for your explanation. To add some context:
In our system, the ports-implemented register has already been configured by the firmware (which is U-Boot on the HiFive Premier P550 board).
Therefore, when entering the kernel, the value of this register is correctly set to 0x1.

During probe, ahci_platform_enable_resources → ahci_platform_deassert_rsts is called. And when the driver is removed, ahci_platform_disable_resources
→ ahci_platform_assert_rsts is triggered.
This reset operation causes the register to be restored to 0.
According to the IP databook, this register is indeed set to 0 after reset.

This is my understanding. I'd greatly appreciate it if you point out any issues.

Quoted 10 lines
Quoted 3 lines

Not sure if it relevant to mention this reply to Rob's review comment in the commit message, but perhaps it should have been mentioned in the change log.

Reviewer questions for more serious stuff happen for a reason, so when discussion is resolved somehow differently than reviewer suggested, it pretty often deserves explanation in commit msg.

Well, in changelog as absolute minimum. No explanation happened here in the changelog, nor in the commit msg.

Thank you very much for your suggestion.
I'll add explanations in the commit message and changelogs for the next patch.

Best regards,
Yulin

author
#6 lore raw

PATCH v3 2/3 dt-bindings: phy: eswin: Document for EIC7700 SoC SATA PHY

In reply to Yulin Lu

Add document for the SATA phy on the EIC7700 SoC platform, describing its usage.

---
 .../bindings/phy/eswin,eic7700-sata-phy.yaml  | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml
Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml new file +36 -0
new file mode 100644
index 000000000000..d914cb4402d8
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/eswin,eic7700-sata-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Eswin EIC7700 SoC SATA PHY
+
+maintainers:
+  - Yulin Lu <[email protected]>
+  - Huan He <[email protected]>
+
+properties:
+  compatible:
+    const: eswin,eic7700-sata-phy
+
+  "#phy-cells":
+    const: 0
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - "#phy-cells"
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    sata-phy@50440300 {
+        compatible = "eswin,eic7700-sata-phy";
+        reg = <0x50440300 0x40>;
+        #phy-cells = <0>;
+    };
Signature · 1 line
2.25.1
Reviewed-by on v3 2/3
#7 lore raw

Re: [PATCH v3 2/3] dt-bindings: phy: eswin: Document for EIC7700 SoC SATA PHY

On 04/09/2025 08:38, Yulin Lu wrote:

Same comment about subject.

Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml line 21

Quoted 8 lines
Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml new file +8 -0
+  compatible:
+    const: eswin,eic7700-sata-phy
+
+  "#phy-cells":
+    const: 0
+
+  reg:
+    maxItems: 1

reg is the second property.

Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml line 26

Quoted 5 lines
Documentation/devicetree/bindings/phy/eswin,eic7700-sata-phy.yaml new file +5 -0
+
+required:
+  - compatible
+  - "#phy-cells"
+  - reg

Same here

Best regards,
Krzysztof

author
#8 lore raw

PATCH v3 3/3 phy: eswin: Create eswin directory and add EIC7700 SATA PHY driver

In reply to Yulin Lu

Created the eswin phy driver directory and added support for the SATA phy driver on the EIC7700 SoC platform.

---
 drivers/phy/Kconfig                  |   1 +
 drivers/phy/Makefile                 |   1 +
 drivers/phy/eswin/Kconfig            |  14 ++
 drivers/phy/eswin/Makefile           |   2 +
 drivers/phy/eswin/phy-eic7700-sata.c | 205 +++++++++++++++++++++++++++
 5 files changed, 223 insertions(+)
 create mode 100644 drivers/phy/eswin/Kconfig
 create mode 100644 drivers/phy/eswin/Makefile
 create mode 100644 drivers/phy/eswin/phy-eic7700-sata.c
drivers/phy/Kconfig +1 -0
index 58c911e1b2d2..e82ebcfe534a 100644
@@ -105,6 +105,7 @@ source "drivers/phy/allwinner/Kconfig"
 source "drivers/phy/amlogic/Kconfig"
 source "drivers/phy/broadcom/Kconfig"
 source "drivers/phy/cadence/Kconfig"
+source "drivers/phy/eswin/Kconfig"
 source "drivers/phy/freescale/Kconfig"
 source "drivers/phy/hisilicon/Kconfig"
 source "drivers/phy/ingenic/Kconfig"
drivers/phy/Makefile +1 -0
index c670a8dac468..ed7444949259 100644
@@ -17,6 +17,7 @@ obj-y					+= allwinner/	\
 					   amlogic/	\
 					   broadcom/	\
 					   cadence/	\
+					   eswin/	\
 					   freescale/	\
 					   hisilicon/	\
 					   ingenic/	\
drivers/phy/eswin/Kconfig new file +14 -0
new file mode 100644
index 000000000000..3fcd76582c3b
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for Eswin platforms
+#
+config PHY_EIC7700_SATA
+	tristate "eic7700 Sata SerDes/PHY driver"
+	depends on ARCH_ESWIN || COMPILE_TEST
+	depends on HAS_IOMEM
+	select GENERIC_PHY
+	help
+	  Enable this to support SerDes/Phy found on ESWIN's
+	  EIC7700 SoC.This Phy supports SATA 1.5 Gb/s,
+	  SATA 3.0 Gb/s, SATA 6.0 Gb/s speeds.
+	  It supports one SATA host port to accept one SATA device.
drivers/phy/eswin/Makefile new file +2 -0
new file mode 100644
index 000000000000..db08c66be812
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_PHY_EIC7700_SATA)	+= phy-eic7700-sata.o
drivers/phy/eswin/phy-eic7700-sata.c new file +205 -0

205 lines not on this page · raw message

Signature · 1 line
2.25.1