mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] stmmac: pci: Add support for LS7A bridge chip
@ 2020-07-10  8:51 Zhi Li
  2020-07-10 15:50 ` Jakub Kicinski
  2020-07-11  1:35 ` Jiaxun Yang
  0 siblings, 2 replies; 6+ messages in thread
From: Zhi Li @ 2020-07-10  8:51 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba, mcoquelin.stm32
  Cc: netdev, linux-kernel, lixuefeng, chenhc, jiaxun.yang, yangtiezhu,
	Hongbin Li

Add gmac platform data to support LS7A bridge chip.

Co-developed-by: Hongbin Li <lihongbin@loongson.cn>
Signed-off-by: Hongbin Li <lihongbin@loongson.cn>
Signed-off-by: Zhi Li <lizhi01@loongson.cn>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 272cb47..dab2a40 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -138,6 +138,24 @@ static const struct stmmac_pci_info snps_gmac5_pci_info = {
 	.setup = snps_gmac5_default_data,
 };
 
+static int loongson_default_data(struct pci_dev *pdev, struct plat_stmmacenent_data *plat)
+{
+	common_default_data(plat);
+
+	plat->bus_id = pci_dev_id(pdev);
+	plat->phy_addr = 0;
+	plat->interface = PHY_INTERFACE_MODE_GMII;
+
+	plat->dma_cfg->pbl = 32;
+	plat->dma_cfg->pblx8 = true;
+
+	return 0;
+}
+
+static struct stmmac_pci_info loongson_pci_info = {
+	.setup = loongson_default_data;
+};
+
 /**
  * stmmac_pci_probe
  *
@@ -204,6 +222,8 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	res.addr = pcim_iomap_table(pdev)[i];
 	res.wol_irq = pdev->irq;
 	res.irq = pdev->irq;
+	if (pdev->vendor == PCI_VENDOR_ID_LOONGSON)
+		res.lpi_irq = pdev->irq + 1;
 
 	return stmmac_dvr_probe(&pdev->dev, plat, &res);
 }
@@ -273,11 +293,13 @@ static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
 
 #define PCI_DEVICE_ID_STMMAC_STMMAC		0x1108
 #define PCI_DEVICE_ID_SYNOPSYS_GMAC5_ID		0x7102
+#define PCI_DEVICE_ID_LOONGSON_GMAC		0x7a03
 
 static const struct pci_device_id stmmac_id_table[] = {
 	{ PCI_DEVICE_DATA(STMMAC, STMMAC, &stmmac_pci_info) },
 	{ PCI_DEVICE_DATA(STMICRO, MAC, &stmmac_pci_info) },
 	{ PCI_DEVICE_DATA(SYNOPSYS, GMAC5_ID, &snps_gmac5_pci_info) },
+	{ PCI_DEVICE_DATA(LOONGSON, GMAC, &loongson_pci_info) },
 	{}
 };
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <1606125828-15742-1-git-send-email-lizhi01@loongson.cn>]

end of thread, other threads:[~2020-11-25  7:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  8:51 [PATCH] stmmac: pci: Add support for LS7A bridge chip Zhi Li
2020-07-10 15:50 ` Jakub Kicinski
2020-07-11  1:35 ` Jiaxun Yang
2020-07-11  1:45   ` Jiaxun Yang
     [not found] <1606125828-15742-1-git-send-email-lizhi01@loongson.cn>
2020-11-23 10:31 ` Jiaxun Yang
2020-11-25  7:07   ` Zhi Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®