* [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson
@ 2021-06-18 2:53 Qing Zhang
2021-06-18 2:53 ` [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000 Qing Zhang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Qing Zhang @ 2021-06-18 2:53 UTC (permalink / raw
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring
Cc: Huacai Chen, linux-mips, linux-kernel, devicetree, netdev,
Jiaxun Yang
This GMAC module is integrated into the Loongson-2K SoC and the LS7A
bridge chip.
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 9 +
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
.../ethernet/stmicro/stmmac/dwmac-loongson.c | 218 ++++++++++++++++++
3 files changed, 228 insertions(+)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 7737e4d0bb9e..0fc4532a2caa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -238,6 +238,15 @@ config DWMAC_INTEL
This selects the Intel platform specific bus support for the
stmmac driver. This driver is used for Intel Quark/EHL/TGL.
+config DWMAC_LOONGSON
+ tristate "Loongson PCI DWMAC support"
+ default MACH_LOONGSON64
+ depends on STMMAC_ETH && PCI
+ depends on COMMON_CLK
+ help
+ This selects the LOONGSON PCI bus support for the stmmac driver,
+ Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge.
+
config STMMAC_PCI
tristate "STMMAC PCI bus support"
depends on STMMAC_ETH && PCI
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index f2e478b884b0..56d0d536859c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -36,4 +36,5 @@ dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
obj-$(CONFIG_DWMAC_INTEL) += dwmac-intel.o
+obj-$(CONFIG_DWMAC_LOONGSON) += dwmac-loongson.o
stmmac-pci-objs:= stmmac_pci.o
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
new file mode 100644
index 000000000000..8cd4e2e8ec40
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -0,0 +1,218 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2020, Loongson Corporation
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/pci.h>
+#include <linux/dmi.h>
+#include <linux/device.h>
+#include <linux/of_irq.h>
+#include "stmmac.h"
+
+static int loongson_default_data(struct plat_stmmacenet_data *plat)
+{
+ plat->clk_csr = 2; /* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */
+ plat->has_gmac = 1;
+ plat->force_sf_dma_mode = 1;
+
+ /* Set default value for multicast hash bins */
+ plat->multicast_filter_bins = HASH_TABLE_SIZE;
+
+ /* Set default value for unicast filter entries */
+ plat->unicast_filter_entries = 1;
+
+ /* Set the maxmtu to a default of JUMBO_LEN */
+ plat->maxmtu = JUMBO_LEN;
+
+ /* Set default number of RX and TX queues to use */
+ plat->tx_queues_to_use = 1;
+ plat->rx_queues_to_use = 1;
+
+ /* Disable Priority config by default */
+ plat->tx_queues_cfg[0].use_prio = false;
+ plat->rx_queues_cfg[0].use_prio = false;
+
+ /* Disable RX queues routing by default */
+ plat->rx_queues_cfg[0].pkt_route = 0x0;
+
+ /* Default to phy auto-detection */
+ plat->phy_addr = -1;
+
+ plat->dma_cfg->pbl = 32;
+ plat->dma_cfg->pblx8 = true;
+
+ plat->multicast_filter_bins = 256;
+ return 0;
+}
+
+static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+ struct plat_stmmacenet_data *plat;
+ struct stmmac_resources res;
+ int ret, i, mdio;
+ struct device_node *np;
+
+ np = dev_of_node(&pdev->dev);
+
+ if (!np) {
+ pr_info("dwmac_loongson_pci: No OF node\n");
+ return -ENODEV;
+ }
+
+ if (!of_device_is_compatible(np, "loongson, pci-gmac")) {
+ pr_info("dwmac_loongson_pci: Incompatible OF node\n");
+ return -ENODEV;
+ }
+
+ plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
+ if (!plat)
+ return -ENOMEM;
+
+ if (plat->mdio_node) {
+ dev_err(&pdev->dev, "Found MDIO subnode\n");
+ mdio = true;
+ }
+
+ if (mdio) {
+ plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
+ sizeof(*plat->mdio_bus_data),
+ GFP_KERNEL);
+ if (!plat->mdio_bus_data)
+ return -ENOMEM;
+ plat->mdio_bus_data->needs_reset = true;
+ }
+
+ plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg), GFP_KERNEL);
+ if (!plat->dma_cfg)
+ return -ENOMEM;
+
+ /* Enable pci device */
+ ret = pci_enable_device(pdev);
+ if (ret) {
+ dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n", __func__);
+ return ret;
+ }
+
+ /* Get the base address of device */
+ for (i = 0; i < PCI_STD_NUM_BARS; i++) {
+ if (pci_resource_len(pdev, i) == 0)
+ continue;
+ ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
+ if (ret)
+ return ret;
+ break;
+ }
+
+ plat->bus_id = of_alias_get_id(np, "ethernet");
+ if (plat->bus_id < 0)
+ plat->bus_id = pci_dev_id(pdev);
+
+ plat->phy_interface = device_get_phy_mode(&pdev->dev);
+ if (plat->phy_interface < 0)
+ dev_err(&pdev->dev, "phy_mode not found\n");
+
+ plat->interface = PHY_INTERFACE_MODE_GMII;
+
+ pci_set_master(pdev);
+
+ loongson_default_data(plat);
+ pci_enable_msi(pdev);
+ memset(&res, 0, sizeof(res));
+ res.addr = pcim_iomap_table(pdev)[0];
+
+ res.irq = of_irq_get_byname(np, "macirq");
+ if (res.irq < 0) {
+ dev_err(&pdev->dev, "IRQ macirq not found\n");
+ ret = -ENODEV;
+ }
+
+ res.wol_irq = of_irq_get_byname(np, "eth_wake_irq");
+ if (res.wol_irq < 0) {
+ dev_info(&pdev->dev, "IRQ eth_wake_irq not found, using macirq\n");
+ res.wol_irq = res.irq;
+ }
+
+ res.lpi_irq = of_irq_get_byname(np, "eth_lpi");
+ if (res.lpi_irq < 0) {
+ dev_err(&pdev->dev, "IRQ eth_lpi not found\n");
+ ret = -ENODEV;
+ }
+
+ return stmmac_dvr_probe(&pdev->dev, plat, &res);
+}
+
+static void loongson_dwmac_remove(struct pci_dev *pdev)
+{
+ int i;
+
+ stmmac_dvr_remove(&pdev->dev);
+
+ for (i = 0; i < PCI_STD_NUM_BARS; i++) {
+ if (pci_resource_len(pdev, i) == 0)
+ continue;
+ pcim_iounmap_regions(pdev, BIT(i));
+ break;
+ }
+
+ pci_disable_device(pdev);
+}
+
+static int __maybe_unused loongson_dwmac_suspend(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ int ret;
+
+ ret = stmmac_suspend(dev);
+ if (ret)
+ return ret;
+
+ ret = pci_save_state(pdev);
+ if (ret)
+ return ret;
+
+ pci_disable_device(pdev);
+ pci_wake_from_d3(pdev, true);
+ return 0;
+}
+
+static int __maybe_unused loongson_dwmac_resume(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+ int ret;
+
+ pci_restore_state(pdev);
+ pci_set_power_state(pdev, PCI_D0);
+
+ ret = pci_enable_device(pdev);
+ if (ret)
+ return ret;
+
+ pci_set_master(pdev);
+
+ return stmmac_resume(dev);
+}
+
+static SIMPLE_DEV_PM_OPS(loongson_dwmac_pm_ops, loongson_dwmac_suspend,
+ loongson_dwmac_resume);
+
+static const struct pci_device_id loongson_dwmac_id_table[] = {
+ { PCI_VDEVICE(LOONGSON, 0x7a03) },
+ {}
+};
+MODULE_DEVICE_TABLE(pci, loongson_dwmac_id_table);
+
+struct pci_driver loongson_dwmac_driver = {
+ .name = "dwmac-loongson-pci",
+ .id_table = loongson_dwmac_id_table,
+ .probe = loongson_dwmac_probe,
+ .remove = loongson_dwmac_remove,
+ .driver = {
+ .pm = &loongson_dwmac_pm_ops,
+ },
+};
+
+module_pci_driver(loongson_dwmac_driver);
+
+MODULE_DESCRIPTION("Loongson DWMAC PCI driver");
+MODULE_AUTHOR("Qing Zhang <zhangqing@loongson.cn>");
+MODULE_LICENSE("GPL v2");
--
2.31.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000
2021-06-18 2:53 [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Qing Zhang
@ 2021-06-18 2:53 ` Qing Zhang
2021-06-21 2:59 ` Andrew Lunn
2021-06-18 2:53 ` [PATCH 3/4] MIPS: Loongson64: DTS: Add GMAC support for LS7A PCH Qing Zhang
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Qing Zhang @ 2021-06-18 2:53 UTC (permalink / raw
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring
Cc: Huacai Chen, linux-mips, linux-kernel, devicetree, netdev
The GMAC module is now supported, enable it.
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
---
.../boot/dts/loongson/loongson64-2k1000.dtsi | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
index 569e814def83..5747f171de29 100644
--- a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi
@@ -114,6 +114,52 @@ pci@1a000000 {
ranges = <0x01000000 0x0 0x00000000 0x0 0x18000000 0x0 0x00010000>,
<0x02000000 0x0 0x40000000 0x0 0x40000000 0x0 0x40000000>;
+ gmac@3,0 {
+ compatible = "pci0014,7a03.0",
+ "pci0014,7a03",
+ "pciclass0c0320",
+ "pciclass0c03",
+ "loongson, pci-gmac";
+
+ reg = <0x1800 0x0 0x0 0x0 0x0>;
+ interrupts = <12 IRQ_TYPE_LEVEL_LOW>,
+ <13 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "macirq", "eth_lpi";
+ interrupt-parent = <&liointc0>;
+ phy-mode = "rgmii";
+ mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "snps,dwmac-mdio";
+ phy0: ethernet-phy@0 {
+ reg = <0>;
+ };
+ };
+ };
+
+ gmac@3,1 {
+ compatible = "pci0014,7a03.0",
+ "pci0014,7a03",
+ "pciclass0c0320",
+ "pciclass0c03",
+ "loongson, pci-gmac";
+
+ reg = <0x1900 0x0 0x0 0x0 0x0>;
+ interrupts = <14 IRQ_TYPE_LEVEL_LOW>,
+ <15 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-names = "macirq", "eth_lpi";
+ interrupt-parent = <&liointc0>;
+ phy-mode = "rgmii";
+ mdio {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "snps,dwmac-mdio";
+ phy1: ethernet-phy@1 {
+ reg = <0>;
+ };
+ };
+ };
+
ehci@4,1 {
compatible = "pci0014,7a14.0",
"pci0014,7a14",
--
2.31.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] MIPS: Loongson64: DTS: Add GMAC support for LS7A PCH
2021-06-18 2:53 [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Qing Zhang
2021-06-18 2:53 ` [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000 Qing Zhang
@ 2021-06-18 2:53 ` Qing Zhang
2021-06-18 2:53 ` [PATCH 4/4] dt-bindings: dwmac: Add bindings for new Loongson SoC and bridge chip Qing Zhang
2021-06-21 2:55 ` [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Andrew Lunn
3 siblings, 0 replies; 7+ messages in thread
From: Qing Zhang @ 2021-06-18 2:53 UTC (permalink / raw
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring
Cc: Huacai Chen, linux-mips, linux-kernel, devicetree, netdev
The GMAC module is now supported, enable it.
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
---
arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
index f99a7a11fded..58b9bb47c58a 100644
--- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
+++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi
@@ -186,7 +186,8 @@ gmac@3,0 {
compatible = "pci0014,7a03.0",
"pci0014,7a03",
"pciclass020000",
- "pciclass0200";
+ "pciclass0200",
+ "loongson, pci-gmac";
reg = <0x1800 0x0 0x0 0x0 0x0>;
interrupts = <12 IRQ_TYPE_LEVEL_HIGH>,
@@ -208,7 +209,8 @@ gmac@3,1 {
compatible = "pci0014,7a03.0",
"pci0014,7a03",
"pciclass020000",
- "pciclass0200";
+ "pciclass0200",
+ "loongson, pci-gmac";
reg = <0x1900 0x0 0x0 0x0 0x0>;
interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
--
2.31.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] dt-bindings: dwmac: Add bindings for new Loongson SoC and bridge chip
2021-06-18 2:53 [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Qing Zhang
2021-06-18 2:53 ` [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000 Qing Zhang
2021-06-18 2:53 ` [PATCH 3/4] MIPS: Loongson64: DTS: Add GMAC support for LS7A PCH Qing Zhang
@ 2021-06-18 2:53 ` Qing Zhang
2021-06-21 2:55 ` [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Andrew Lunn
3 siblings, 0 replies; 7+ messages in thread
From: Qing Zhang @ 2021-06-18 2:53 UTC (permalink / raw
To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring
Cc: Huacai Chen, linux-mips, linux-kernel, devicetree, netdev
Add the dwmac bindings for the Loongson-2K SoC and the LS7A
bridge chip.
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
---
Documentation/devicetree/bindings/net/snps,dwmac.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 2edd8bea993e..9631bbbb6f69 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -56,6 +56,8 @@ properties:
- amlogic,meson8m2-dwmac
- amlogic,meson-gxbb-dwmac
- amlogic,meson-axg-dwmac
+ - loongson,ls2k-dwmac
+ - loongson,ls7a-dwmac
- rockchip,px30-gmac
- rockchip,rk3128-gmac
- rockchip,rk3228-gmac
@@ -310,6 +312,8 @@ allOf:
- allwinner,sun8i-r40-emac
- allwinner,sun8i-v3s-emac
- allwinner,sun50i-a64-emac
+ - loongson,ls2k-dwmac
+ - loongson,ls7a-dwmac
- snps,dwxgmac
- snps,dwxgmac-2.10
- st,spear600-gmac
@@ -353,6 +357,8 @@ allOf:
- allwinner,sun8i-r40-emac
- allwinner,sun8i-v3s-emac
- allwinner,sun50i-a64-emac
+ - loongson,ls2k-dwmac
+ - loongson,ls7a-dwmac
- snps,dwmac-4.00
- snps,dwmac-4.10a
- snps,dwmac-4.20a
--
2.31.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson
2021-06-18 2:53 [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Qing Zhang
` (2 preceding siblings ...)
2021-06-18 2:53 ` [PATCH 4/4] dt-bindings: dwmac: Add bindings for new Loongson SoC and bridge chip Qing Zhang
@ 2021-06-21 2:55 ` Andrew Lunn
2021-06-22 2:10 ` zhangqing
3 siblings, 1 reply; 7+ messages in thread
From: Andrew Lunn @ 2021-06-21 2:55 UTC (permalink / raw
To: Qing Zhang
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring, Huacai Chen, linux-mips, linux-kernel, devicetree,
netdev, Jiaxun Yang
> +static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> + struct plat_stmmacenet_data *plat;
> + struct stmmac_resources res;
> + int ret, i, mdio;
> + struct device_node *np;
> +
> + np = dev_of_node(&pdev->dev);
> +
> + if (!np) {
> + pr_info("dwmac_loongson_pci: No OF node\n");
> + return -ENODEV;
> + }
> +
> + if (!of_device_is_compatible(np, "loongson, pci-gmac")) {
> + pr_info("dwmac_loongson_pci: Incompatible OF node\n");
> + return -ENODEV;
> + }
> +
> + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
> + if (!plat)
> + return -ENOMEM;
> +
> + if (plat->mdio_node) {
> + dev_err(&pdev->dev, "Found MDIO subnode\n");
It is an error is an MDIO node is found?
> + mdio = true;
> + }
> +
...
> +
> + plat->phy_interface = device_get_phy_mode(&pdev->dev);
> + if (plat->phy_interface < 0)
> + dev_err(&pdev->dev, "phy_mode not found\n");
> +
> + plat->interface = PHY_INTERFACE_MODE_GMII;
Seems odd you call device_get_phy_mode() but then have this hard coded
PHY_INTERFACE_MODE_GMII?
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000
2021-06-18 2:53 ` [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000 Qing Zhang
@ 2021-06-21 2:59 ` Andrew Lunn
0 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2021-06-21 2:59 UTC (permalink / raw
To: Qing Zhang
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring, Huacai Chen, linux-mips, linux-kernel, devicetree,
netdev
> + gmac@3,1 {
> + compatible = "pci0014,7a03.0",
> + "pci0014,7a03",
> + "pciclass0c0320",
> + "pciclass0c03",
> + "loongson, pci-gmac";
> +
> + reg = <0x1900 0x0 0x0 0x0 0x0>;
> + interrupts = <14 IRQ_TYPE_LEVEL_LOW>,
> + <15 IRQ_TYPE_LEVEL_LOW>;
> + interrupt-names = "macirq", "eth_lpi";
> + interrupt-parent = <&liointc0>;
> + phy-mode = "rgmii";
rgmii? But you set PHY_INTERFACE_MODE_GMII?
> + mdio {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "snps,dwmac-mdio";
> + phy1: ethernet-phy@1 {
> + reg = <0>;
The value after the @ should match the reg value.
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson
2021-06-21 2:55 ` [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Andrew Lunn
@ 2021-06-22 2:10 ` zhangqing
0 siblings, 0 replies; 7+ messages in thread
From: zhangqing @ 2021-06-22 2:10 UTC (permalink / raw
To: Andrew Lunn
Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu, Maxime Coquelin,
David S . Miller, Jakub Kicinski, Thomas Bogendoerfer,
Rob Herring, Huacai Chen, linux-mips, linux-kernel, devicetree,
netdev, Jiaxun Yang
On 06/21/2021 10:55 AM, Andrew Lunn wrote:
>> +static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>> +{
>> + struct plat_stmmacenet_data *plat;
>> + struct stmmac_resources res;
>> + int ret, i, mdio;
>> + struct device_node *np;
>> +
>> + np = dev_of_node(&pdev->dev);
>> +
>> + if (!np) {
>> + pr_info("dwmac_loongson_pci: No OF node\n");
>> + return -ENODEV;
>> + }
>> +
>> + if (!of_device_is_compatible(np, "loongson, pci-gmac")) {
>> + pr_info("dwmac_loongson_pci: Incompatible OF node\n");
>> + return -ENODEV;
>> + }
>> +
>> + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
>> + if (!plat)
>> + return -ENOMEM;
>> +
>> + if (plat->mdio_node) {
>> + dev_err(&pdev->dev, "Found MDIO subnode\n");
> It is an error is an MDIO node is found?
Hi,Andrew
Thanks for your advice,
Using dev_ DEG () is appropriate,
and other issues I will fix in v2.
Thanks,
-Qing
>
>> + mdio = true;
>> + }
>> +
> ...
>
>> +
>> + plat->phy_interface = device_get_phy_mode(&pdev->dev);
>> + if (plat->phy_interface < 0)
>> + dev_err(&pdev->dev, "phy_mode not found\n");
>> +
>> + plat->interface = PHY_INTERFACE_MODE_GMII;
> Seems odd you call device_get_phy_mode() but then have this hard coded
> PHY_INTERFACE_MODE_GMII?
>
> Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-22 2:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-18 2:53 [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Qing Zhang
2021-06-18 2:53 ` [PATCH 2/4] MIPS: Loongson64: Add GMAC support for Loongson-2K1000 Qing Zhang
2021-06-21 2:59 ` Andrew Lunn
2021-06-18 2:53 ` [PATCH 3/4] MIPS: Loongson64: DTS: Add GMAC support for LS7A PCH Qing Zhang
2021-06-18 2:53 ` [PATCH 4/4] dt-bindings: dwmac: Add bindings for new Loongson SoC and bridge chip Qing Zhang
2021-06-21 2:55 ` [PATCH 1/4] stmmac: pci: Add dwmac support for Loongson Andrew Lunn
2021-06-22 2:10 ` zhangqing
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 read-only IMAP folder(s) and NNTP newsgroup(s).