Skip to contentSkip to conversation

net: qcom/emac: simplify support for different SOCs

PATCH In review Timur Tabi 2 participants 6 messages Nov 21, 2016 – Nov 24, 2016

Subsystems (3)
lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

cover net: qcom/emac: simplify support for different SOCs

On SOCs that have the Qualcomm EMAC network controller, the internal PHY block is always different. Sometimes the differences are small, sometimes it might be a completely different IP. Either way, using version numbers to differentiate them and putting all of the init code in one file does not scale.

This patchset does two things: The first breaks up the current code into different files, and the second patch adds support for a third SOC, the Qualcomm Technologies QDF2400 ARM Server SOC.

Timur Tabi (2):
net: qcom/emac: move phy init code to separate files
net: qcom/emac: add support for the Qualcomm Technologies QDF2400

 drivers/net/ethernet/qualcomm/emac/Makefile        |   4 +-
 .../ethernet/qualcomm/emac/emac-sgmii-fsm9900.c    | 246 ++++++++++
 .../ethernet/qualcomm/emac/emac-sgmii-qdf2400.c    | 217 +++++++++
 .../ethernet/qualcomm/emac/emac-sgmii-qdf2432.c    | 210 ++++++++
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.c    | 542 +--------------------
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.h    |   6 +-
 6 files changed, 702 insertions(+), 523 deletions(-)
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2400.c
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2432.c
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#1 lore raw

PATCH 1/2 net: qcom/emac: move phy init code to separate files

The internal PHY of the EMAC differs on each SOC, and the list will only continue to grow. By separating the code into individual files, we can add support for more SOCs more cleanly.

Note: The internal PHY is also sometimes called the SGMII device.

We also stop referring to the various PHY variations by version number, so no more "v2", "v3", etc. Instead, the devices are named after the SOC they are, which is in sync with the device tree property names.

Future patches will probably rearrange more code among the files.

---
 drivers/net/ethernet/qualcomm/emac/Makefile        |   3 +-
 .../ethernet/qualcomm/emac/emac-sgmii-fsm9900.c    | 246 ++++++++++
 .../ethernet/qualcomm/emac/emac-sgmii-qdf2432.c    | 210 ++++++++
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.c    | 538 +--------------------
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.h    |   5 +-
 5 files changed, 479 insertions(+), 523 deletions(-)
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2432.c
drivers/net/ethernet/qualcomm/emac/Makefile +2 -1
index 01ee144..204b787 100644
@@ -4,4 +4,5 @@
 
 obj-$(CONFIG_QCOM_EMAC) += qcom-emac.o
 
-qcom-emac-objs := emac.o emac-mac.o emac-phy.o emac-sgmii.o
+qcom-emac-objs := emac.o emac-mac.o emac-phy.o emac-sgmii.o \
+		  emac-sgmii-fsm9900.o emac-sgmii-qdf2432.o
drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c new file +246 -0

246 lines not on this page · raw message

drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2432.c new file +210 -0

210 lines not on this page · raw message

drivers/net/ethernet/qualcomm/emac/emac-sgmii.c +18 -520

604 lines not on this page · raw message

drivers/net/ethernet/qualcomm/emac/emac-sgmii.h +3 -2
index ce79212..e2bef14 100644
@@ -16,9 +16,10 @@
 struct emac_adapter;
 struct platform_device;
 
-int emac_sgmii_init_v1(struct emac_adapter *adpt);
-int emac_sgmii_init_v2(struct emac_adapter *adpt);
 int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
 void emac_sgmii_reset(struct emac_adapter *adpt);
 
+int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
+int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
+
 #endif
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
maintainer
#2 lore raw

Re: [PATCH 1/2] net: qcom/emac: move phy init code to separate files

From: Timur Tabi <[email protected]>
Date: Mon, 21 Nov 2016 16:58:21 -0600

Quoted 6 lines
drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c new file +0 -0
new file mode 100644
index 0000000..46f01b3
@@ -0,0 +1,246 @@

...

drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c line 246

Quoted 3 lines
drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c new file +3 -0
+	return 0;
+}
+

Please do not place empty blank lines at the end of files.

GIT even warns about this.

author
#3 lore raw

Re: [PATCH 1/2] net: qcom/emac: move phy init code to separate files

Quoted 3 lines · David Miller

Please do not place empty blank lines at the end of files.

GIT even warns about this.

I need to rework this patchset anyway, and it won't be ready in time for 4.10. I will definitely fix this problem. Thanks.

Signature · 3 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
author
#4 lore raw

PATCH 2/2 net: qcom/emac: add support for the Qualcomm Technologies QDF2400

In reply to Timur Tabi

The QDF2432 and the QDF2400 have slightly different internal PHYs, so there are some programming differences. Some of the registers in the QDF2400 have moved, and some registers require different values during initialization.

Because of the differences, the internal PHY on the QDF2400 has a new ACPI HID, QCOM8072.

---
 drivers/net/ethernet/qualcomm/emac/Makefile        |   3 +-
 .../ethernet/qualcomm/emac/emac-sgmii-qdf2400.c    | 217 +++++++++++++++++++++
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.c    |   4 +
 drivers/net/ethernet/qualcomm/emac/emac-sgmii.h    |   1 +
 4 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2400.c
drivers/net/ethernet/qualcomm/emac/Makefile +2 -1
index 204b787..7a66879 100644
@@ -5,4 +5,5 @@
 obj-$(CONFIG_QCOM_EMAC) += qcom-emac.o
 
 qcom-emac-objs := emac.o emac-mac.o emac-phy.o emac-sgmii.o \
-		  emac-sgmii-fsm9900.o emac-sgmii-qdf2432.o
+		  emac-sgmii-fsm9900.o emac-sgmii-qdf2432.o \
+		  emac-sgmii-qdf2400.o
drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2400.c new file +217 -0

217 lines not on this page · raw message

drivers/net/ethernet/qualcomm/emac/emac-sgmii.c +4 -0
index 07c872a..c5dc9ef 100644
@@ -166,6 +166,10 @@ static int emac_sgmii_acpi_match(struct device *dev, void *data)
 			.id = "QCOM8071",
 			.driver_data = (kernel_ulong_t)emac_sgmii_init_qdf2432,
 		},
+		{
+			.id = "QCOM8072",
+			.driver_data = (kernel_ulong_t)emac_sgmii_init_qdf2400,
+		},
 		{}
 	};
 	const struct acpi_device_id *id = acpi_match_device(match_table, dev);
drivers/net/ethernet/qualcomm/emac/emac-sgmii.h +1 -0
index e2bef14..80ed3dc 100644
@@ -21,5 +21,6 @@ void emac_sgmii_reset(struct emac_adapter *adpt);
 
 int emac_sgmii_init_fsm9900(struct emac_adapter *adpt);
 int emac_sgmii_init_qdf2432(struct emac_adapter *adpt);
+int emac_sgmii_init_qdf2400(struct emac_adapter *adpt);
 
 #endif
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
author
#5 lore raw

Re: [PATCH 2/2] net: qcom/emac: add support for the Qualcomm Technologies QDF2400

Quoted 9 lines · Timur Tabi

The QDF2432 and the QDF2400 have slightly different internal PHYs, so there are some programming differences. Some of the registers in the QDF2400 have moved, and some registers require different values during initialization.

Because of the differences, the internal PHY on the QDF2400 has a new ACPI HID, QCOM8072.

There seems to be some disagreement internally as to whether a new HID is the right approach. Please hold off on applying patch [2/2] for now.

Patch [1/2] can be applied, however, if it passes review.

Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.