* [PATCH 0/3] net: qcom/emac: various minor improvements
@ 2017-06-22 18:05 Timur Tabi
2017-06-22 18:05 ` [PATCH 1/3] net: qcom/emac: add shutdown function Timur Tabi
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Timur Tabi @ 2017-06-22 18:05 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: timur
A collection of minor fixes and features to the Qualcomm Technologies
EMAC network driver.
Timur Tabi (3):
net: qcom/emac: add shutdown function
net: qcom/emac: do not reset the EMAC during initialization
net: qcom/emac: add support for emulation systems
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 23 +++++++++++++++++++++--
drivers/net/ethernet/qualcomm/emac/emac.c | 16 ++++++++++++++--
2 files changed, 35 insertions(+), 4 deletions(-)
--
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] net: qcom/emac: add shutdown function
2017-06-22 18:05 [PATCH 0/3] net: qcom/emac: various minor improvements Timur Tabi
@ 2017-06-22 18:05 ` Timur Tabi
2017-06-22 18:05 ` [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization Timur Tabi
2017-06-22 18:05 ` [PATCH 3/3] net: qcom/emac: add support for emulation systems Timur Tabi
2 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2017-06-22 18:05 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: timur
The shutdown function halts all DMA and interrupts, so that all
operations are discontinued when the system shuts down, e.g. via
kexec or a forced reboot.
Tested-by: Tyler Baicar <tbaicar@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 98a326f..77c5c92 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -762,6 +762,19 @@ static int emac_remove(struct platform_device *pdev)
return 0;
}
+static void emac_shutdown(struct platform_device *pdev)
+{
+ struct net_device *netdev = dev_get_drvdata(&pdev->dev);
+ struct emac_adapter *adpt = netdev_priv(netdev);
+ struct emac_sgmii *sgmii = &adpt->phy;
+
+ /* Closing the SGMII turns off its interrupts */
+ sgmii->close(adpt);
+
+ /* Resetting the MAC turns off all DMA and its interrupts */
+ emac_mac_reset(adpt);
+}
+
static struct platform_driver emac_platform_driver = {
.probe = emac_probe,
.remove = emac_remove,
@@ -770,6 +783,7 @@ static int emac_remove(struct platform_device *pdev)
.of_match_table = emac_dt_match,
.acpi_match_table = ACPI_PTR(emac_acpi_match),
},
+ .shutdown = emac_shutdown,
};
module_platform_driver(emac_platform_driver);
--
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.
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization
2017-06-22 18:05 [PATCH 0/3] net: qcom/emac: various minor improvements Timur Tabi
2017-06-22 18:05 ` [PATCH 1/3] net: qcom/emac: add shutdown function Timur Tabi
@ 2017-06-22 18:05 ` Timur Tabi
2017-06-23 18:00 ` David Miller
2017-06-22 18:05 ` [PATCH 3/3] net: qcom/emac: add support for emulation systems Timur Tabi
2 siblings, 1 reply; 7+ messages in thread
From: Timur Tabi @ 2017-06-22 18:05 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: timur
It doesn't make sense to reset the EMAC in the middle of initializing
it during the probe.
Tested-by: Richard Ruigrok <rruigrok@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 77c5c92..746d94e 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -683,8 +683,6 @@ static int emac_probe(struct platform_device *pdev)
goto err_undo_mdiobus;
}
- emac_mac_reset(adpt);
-
/* set hw features */
netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_RX |
--
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.
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] net: qcom/emac: add support for emulation systems
2017-06-22 18:05 [PATCH 0/3] net: qcom/emac: various minor improvements Timur Tabi
2017-06-22 18:05 ` [PATCH 1/3] net: qcom/emac: add shutdown function Timur Tabi
2017-06-22 18:05 ` [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization Timur Tabi
@ 2017-06-22 18:05 ` Timur Tabi
2 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2017-06-22 18:05 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: timur
On emulation systems, the EMAC's internal PHY ("SGMII") is not present,
but is not needed for network functionality. So just display a warning
message and ignore the SGMII.
Tested-by: Philip Elcan <pelcan@codeaurora.org>
Tested-by: Adam Wallis <awallis@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
index 18c184e..29ba37a 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
@@ -297,6 +297,14 @@ static int emac_sgmii_acpi_match(struct device *dev, void *data)
{}
};
+/* Dummy function for systems without an internal PHY. This avoids having
+ * to check for NULL pointers before calling the functions.
+ */
+static int emac_sgmii_dummy(struct emac_adapter *adpt)
+{
+ return 0;
+}
+
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
{
struct platform_device *sgmii_pdev = NULL;
@@ -311,8 +319,19 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
emac_sgmii_acpi_match);
if (!dev) {
- dev_err(&pdev->dev, "cannot find internal phy node\n");
- return -ENODEV;
+ dev_warn(&pdev->dev, "cannot find internal phy node\n");
+ /* There is typically no internal PHY on emulation
+ * systems, so if we can't find the node, assume
+ * we are on an emulation system and stub-out
+ * support for the internal PHY. These systems only
+ * use ACPI.
+ */
+ phy->open = emac_sgmii_dummy;
+ phy->close = emac_sgmii_dummy;
+ phy->link_up = emac_sgmii_dummy;
+ phy->link_down = emac_sgmii_dummy;
+
+ return 0;
}
sgmii_pdev = to_platform_device(dev);
--
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.
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization
2017-06-22 18:05 ` [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization Timur Tabi
@ 2017-06-23 18:00 ` David Miller
2017-06-23 18:37 ` Timur Tabi
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2017-06-23 18:00 UTC (permalink / raw)
To: timur; +Cc: netdev
From: Timur Tabi <timur@codeaurora.org>
Date: Thu, 22 Jun 2017 13:05:31 -0500
> It doesn't make sense to reset the EMAC in the middle of initializing
> it during the probe.
>
> Tested-by: Richard Ruigrok <rruigrok@codeaurora.org>
> Signed-off-by: Timur Tabi <timur@codeaurora.org>
Why not?
What if the boot loader or something else left the chip in
a weird state?
I'm not applying this.
If it's correct, the explanation in this commit message need
to be imporved. The change must be better justified.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization
2017-06-23 18:00 ` David Miller
@ 2017-06-23 18:37 ` Timur Tabi
2017-06-23 18:54 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Timur Tabi @ 2017-06-23 18:37 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On 06/23/2017 01:00 PM, David Miller wrote:
> What if the boot loader or something else left the chip in
> a weird state?
We depend on the boot loader leaving the NIC in a very specific state
already, otherwise the driver can't initialize the hardware. The
firmware has to pre-initialize the EMAC for us.
Not only that, but the driver was resetting the MAC *after* programming
the clocks (on non-ACPI systems) and initializing both PHYs.
> I'm not applying this.
>
> If it's correct, the explanation in this commit message need
> to be imporved. The change must be better justified.
Since this is for ACPI systems, I could do this:
if (!has_acpi_companion(&pdev->dev))
emac_mac_reset(adpt);
But at the very least, the call should be moved to earlier in the function.
--
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization
2017-06-23 18:37 ` Timur Tabi
@ 2017-06-23 18:54 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-06-23 18:54 UTC (permalink / raw)
To: timur; +Cc: netdev
From: Timur Tabi <timur@codeaurora.org>
Date: Fri, 23 Jun 2017 13:37:58 -0500
> On 06/23/2017 01:00 PM, David Miller wrote:
>> What if the boot loader or something else left the chip in
>> a weird state?
>
> We depend on the boot loader leaving the NIC in a very specific state
> already, otherwise the driver can't initialize the hardware. The
> firmware has to pre-initialize the EMAC for us.
>
> Not only that, but the driver was resetting the MAC *after*
> programming the clocks (on non-ACPI systems) and initializing both
> PHYs.
>
>> I'm not applying this.
>> If it's correct, the explanation in this commit message need
>> to be imporved. The change must be better justified.
>
> Since this is for ACPI systems, I could do this:
>
> if (!has_acpi_companion(&pdev->dev))
> emac_mac_reset(adpt);
>
> But at the very least, the call should be moved to earlier in the
> function.
Please just explain the ACPI situation in the commit log message
and resubmit the series.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-06-23 18:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 18:05 [PATCH 0/3] net: qcom/emac: various minor improvements Timur Tabi
2017-06-22 18:05 ` [PATCH 1/3] net: qcom/emac: add shutdown function Timur Tabi
2017-06-22 18:05 ` [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization Timur Tabi
2017-06-23 18:00 ` David Miller
2017-06-23 18:37 ` Timur Tabi
2017-06-23 18:54 ` David Miller
2017-06-22 18:05 ` [PATCH 3/3] net: qcom/emac: add support for emulation systems Timur Tabi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).