This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
forked from lede-project/source
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
- Loading branch information
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
target/linux/ramips/patches-4.14/2200-mt7621-eth-dsa.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | ||
@@ -1792,6 +1792,19 @@ static irqreturn_t mtk_handle_irq_tx(int | ||
return IRQ_HANDLED; | ||
} | ||
|
||
+static irqreturn_t mtk_handle_irq(int irq, void *_eth) | ||
+{ | ||
+ struct mtk_eth *eth = _eth; | ||
+ | ||
+ if (mtk_r32(eth, MTK_PDMA_INT_STATUS) & MTK_RX_DONE_INT) | ||
+ mtk_handle_irq_rx(irq, _eth); | ||
+ | ||
+ if (mtk_r32(eth, MTK_QMTK_INT_STATUS) & MTK_TX_DONE_INT) | ||
+ mtk_handle_irq_tx(irq, _eth); | ||
+ | ||
+ return IRQ_HANDLED; | ||
+} | ||
+ | ||
#ifdef CONFIG_NET_POLL_CONTROLLER | ||
static void mtk_poll_controller(struct net_device *dev) | ||
{ | ||
@@ -2579,8 +2592,12 @@ static int mtk_probe(struct platform_dev | ||
} | ||
} | ||
|
||
- for (i = 0; i < 3; i++) { | ||
- eth->irq[i] = platform_get_irq(pdev, i); | ||
+ for (i = 0; i < 3; i++) | ||
+ { | ||
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT) && i > 0) | ||
+ eth->irq[i] = eth->irq[0]; | ||
+ else | ||
+ eth->irq[i] = platform_get_irq(pdev, i); | ||
if (eth->irq[i] < 0) { | ||
dev_err(&pdev->dev, "no IRQ%d resource found\n", i); | ||
return -ENXIO; | ||
@@ -2627,13 +2644,18 @@ static int mtk_probe(struct platform_dev | ||
goto err_deinit_hw; | ||
} | ||
|
||
- err = devm_request_irq(eth->dev, eth->irq[1], mtk_handle_irq_tx, 0, | ||
- dev_name(eth->dev), eth); | ||
- if (err) | ||
- goto err_free_dev; | ||
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SHARED_INT)) { | ||
+ err = devm_request_irq(eth->dev, eth->irq[0], mtk_handle_irq, 0, | ||
+ dev_name(eth->dev), eth); | ||
+ } else { | ||
+ err = devm_request_irq(eth->dev, eth->irq[1], mtk_handle_irq_tx, 0, | ||
+ dev_name(eth->dev), eth); | ||
+ if (err) | ||
+ goto err_free_dev; | ||
|
||
- err = devm_request_irq(eth->dev, eth->irq[2], mtk_handle_irq_rx, 0, | ||
- dev_name(eth->dev), eth); | ||
+ err = devm_request_irq(eth->dev, eth->irq[2], mtk_handle_irq_rx, 0, | ||
+ dev_name(eth->dev), eth); | ||
+ } | ||
if (err) | ||
goto err_free_dev; | ||
|
||
@@ -2706,6 +2728,12 @@ static const struct mtk_soc_data mt2701_ | ||
.required_pctl = true, | ||
}; | ||
|
||
+static const struct mtk_soc_data mt7621_data = { | ||
+ .caps = MTK_SHARED_INT, | ||
+ .required_clks = MT7621_CLKS_BITMAP, | ||
+ .required_pctl = false, | ||
+}; | ||
+ | ||
static const struct mtk_soc_data mt7622_data = { | ||
.caps = MTK_DUAL_GMAC_SHARED_SGMII | MTK_GMAC1_ESW, | ||
.required_clks = MT7622_CLKS_BITMAP, | ||
@@ -2720,6 +2748,7 @@ static const struct mtk_soc_data mt7623_ | ||
|
||
const struct of_device_id of_mtk_match[] = { | ||
{ .compatible = "mediatek,mt2701-eth", .data = &mt2701_data}, | ||
+ { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data}, | ||
{ .compatible = "mediatek,mt7622-eth", .data = &mt7622_data}, | ||
{ .compatible = "mediatek,mt7623-eth", .data = &mt7623_data}, | ||
{}, | ||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h | ||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h | ||
@@ -364,6 +364,7 @@ | ||
#define ETHSYS_CHIPID4_7 0x4 | ||
#define MT7623_ETH 7623 | ||
#define MT7622_ETH 7622 | ||
+#define MT7621_ETH 7621 | ||
|
||
/* ethernet subsystem config register */ | ||
#define ETHSYS_SYSCFG0 0x14 | ||
@@ -489,6 +490,8 @@ enum mtk_clks_map { | ||
BIT(MTK_CLK_SGMII_CDR_FB) | \ | ||
BIT(MTK_CLK_SGMII_CK) | \ | ||
BIT(MTK_CLK_ETH2PLL)) | ||
+#define MT7621_CLKS_BITMAP (0) | ||
+ | ||
enum mtk_dev_state { | ||
MTK_HW_INIT, | ||
MTK_RESETTING | ||
@@ -567,6 +570,8 @@ struct mtk_rx_ring { | ||
#define MTK_GMAC2_SGMII (BIT(10) | MTK_SGMII) | ||
#define MTK_DUAL_GMAC_SHARED_SGMII (BIT(11) | MTK_GMAC1_SGMII | \ | ||
MTK_GMAC2_SGMII) | ||
+#define MTK_SHARED_INT BIT(12) | ||
+ | ||
#define MTK_HAS_CAPS(caps, _x) (((caps) & (_x)) == (_x)) | ||
|
||
/* struct mtk_eth_data - This is the structure holding all differences | ||
--- a/drivers/net/ethernet/mediatek/Kconfig | ||
+++ b/drivers/net/ethernet/mediatek/Kconfig | ||
@@ -1,6 +1,6 @@ | ||
config NET_VENDOR_MEDIATEK | ||
bool "MediaTek ethernet driver" | ||
- depends on ARCH_MEDIATEK | ||
+ depends on ARCH_MEDIATEK || SOC_MT7621 | ||
---help--- | ||
If you have a Mediatek SoC with ethernet, say Y. | ||
|