-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refresh buildroot / adapt from litex_hw_ci
- bump kernel to 6.9 for all defconfig with a path serie for peripherals not upstream - Fix openSBI build with patches to let system/openSBI selects xlen/mabi, and only set arch
- Loading branch information
1 parent
6f65868
commit d97ae0f
Showing
24 changed files
with
6,814 additions
and
12 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
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
102 changes: 102 additions & 0 deletions
102
buildroot/patches/linux/6.9/0001-LiteX-LiteEth-add-polling-support.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,102 @@ | ||
From f803101a8081466b71cf24df45675f79839bc06e Mon Sep 17 00:00:00 2001 | ||
From: Antony Pavlov <antonynpavlov@gmail.com> | ||
Date: Wed, 25 Aug 2021 17:36:39 -0400 | ||
Subject: [PATCH 01/19] LiteX: LiteEth: add polling support | ||
|
||
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> | ||
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> | ||
--- | ||
drivers/net/ethernet/litex/litex_liteeth.c | 41 ++++++++++++++++++---- | ||
1 file changed, 34 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/drivers/net/ethernet/litex/litex_liteeth.c b/drivers/net/ethernet/litex/litex_liteeth.c | ||
index ff54fbe41bcc..de2c83c1ecfe 100644 | ||
--- a/drivers/net/ethernet/litex/litex_liteeth.c | ||
+++ b/drivers/net/ethernet/litex/litex_liteeth.c | ||
@@ -8,6 +8,7 @@ | ||
|
||
#include <linux/etherdevice.h> | ||
#include <linux/interrupt.h> | ||
+#include <linux/iopoll.h> | ||
#include <linux/litex.h> | ||
#include <linux/module.h> | ||
#include <linux/of_net.h> | ||
@@ -43,6 +44,10 @@ struct liteeth { | ||
struct device *dev; | ||
u32 slot_size; | ||
|
||
+ /* Polling support */ | ||
+ int use_polling; | ||
+ struct timer_list poll_timer; | ||
+ | ||
/* Tx */ | ||
u32 tx_slot; | ||
u32 num_tx_slots; | ||
@@ -111,6 +116,14 @@ static irqreturn_t liteeth_interrupt(int irq, void *dev_id) | ||
return IRQ_HANDLED; | ||
} | ||
|
||
+static void liteeth_timeout(struct timer_list *t) | ||
+{ | ||
+ struct liteeth *priv = from_timer(priv, t, poll_timer); | ||
+ | ||
+ liteeth_interrupt(0, priv->netdev); | ||
+ mod_timer(&priv->poll_timer, jiffies + msecs_to_jiffies(10)); | ||
+} | ||
+ | ||
static int liteeth_open(struct net_device *netdev) | ||
{ | ||
struct liteeth *priv = netdev_priv(netdev); | ||
@@ -120,10 +133,16 @@ static int liteeth_open(struct net_device *netdev) | ||
litex_write8(priv->base + LITEETH_WRITER_EV_PENDING, 1); | ||
litex_write8(priv->base + LITEETH_READER_EV_PENDING, 1); | ||
|
||
- err = request_irq(netdev->irq, liteeth_interrupt, 0, netdev->name, netdev); | ||
- if (err) { | ||
- netdev_err(netdev, "failed to request irq %d\n", netdev->irq); | ||
- return err; | ||
+ if (priv->use_polling) { | ||
+ timer_setup(&priv->poll_timer, liteeth_timeout, 0); | ||
+ mod_timer(&priv->poll_timer, jiffies + msecs_to_jiffies(50)); | ||
+ } else { | ||
+ err = request_irq(netdev->irq, liteeth_interrupt, 0, netdev->name, netdev); | ||
+ if (err) { | ||
+ netdev_err(netdev, "failed to request irq %d\n", netdev->irq); | ||
+ return err; | ||
+ } | ||
+ | ||
} | ||
|
||
/* Enable IRQs */ | ||
@@ -146,7 +165,11 @@ static int liteeth_stop(struct net_device *netdev) | ||
litex_write8(priv->base + LITEETH_WRITER_EV_ENABLE, 0); | ||
litex_write8(priv->base + LITEETH_READER_EV_ENABLE, 0); | ||
|
||
- free_irq(netdev->irq, netdev); | ||
+ if (priv->use_polling) { | ||
+ del_timer_sync(&priv->poll_timer); | ||
+ } else { | ||
+ free_irq(netdev->irq, netdev); | ||
+ } | ||
|
||
return 0; | ||
} | ||
@@ -253,9 +276,13 @@ static int liteeth_probe(struct platform_device *pdev) | ||
if (!netdev->tstats) | ||
return -ENOMEM; | ||
|
||
+ priv->use_polling = 0; | ||
irq = platform_get_irq(pdev, 0); | ||
- if (irq < 0) | ||
- return irq; | ||
+ if (irq < 0) { | ||
+ dev_err(&pdev->dev, "Failed to get IRQ, using polling\n"); | ||
+ priv->use_polling = 1; | ||
+ irq = 0; | ||
+ } | ||
netdev->irq = irq; | ||
|
||
priv->base = devm_platform_ioremap_resource_byname(pdev, "mac"); | ||
-- | ||
2.43.0 | ||
|
47 changes: 47 additions & 0 deletions
47
buildroot/patches/linux/6.9/0002-LiteSDCard-re-introduce-gpio-based-card-detection.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,47 @@ | ||
From e4912261137f29a582455989e329b8a7ee35bf80 Mon Sep 17 00:00:00 2001 | ||
From: Gabriel Somlo <gsomlo@gmail.com> | ||
Date: Wed, 8 Dec 2021 07:43:45 -0500 | ||
Subject: [PATCH 02/19] LiteSDCard: re-introduce gpio-based card detection | ||
|
||
This is untested, and therefore unsuitable for upstreaming at this | ||
time. We need an example configuration in Doc/dt/bindings/mmc/litex* | ||
and a successful `tested-by` on hardware before we should consider | ||
pushing this into upstream linux. | ||
|
||
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com> | ||
--- | ||
drivers/mmc/host/litex_mmc.c | 11 ++++++++++- | ||
1 file changed, 10 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c | ||
index 4ec8072dc60b..960a19ce7d4b 100644 | ||
--- a/drivers/mmc/host/litex_mmc.c | ||
+++ b/drivers/mmc/host/litex_mmc.c | ||
@@ -23,6 +23,7 @@ | ||
#include <linux/mmc/host.h> | ||
#include <linux/mmc/mmc.h> | ||
#include <linux/mmc/sd.h> | ||
+#include <linux/mmc/slot-gpio.h> | ||
|
||
#define LITEX_PHY_CARDDETECT 0x00 | ||
#define LITEX_PHY_CLOCKERDIV 0x04 | ||
@@ -240,7 +241,15 @@ static int litex_mmc_get_cd(struct mmc_host *mmc) | ||
if (!mmc_card_is_removable(mmc)) | ||
return 1; | ||
|
||
- ret = !litex_read8(host->sdphy + LITEX_PHY_CARDDETECT); | ||
+ ret = mmc_gpio_get_cd(mmc); | ||
+ if (ret >= 0) { | ||
+ /* GPIO based card-detect explicitly specified in DTS */ | ||
+ ret = !!ret; | ||
+ } else { | ||
+ /* Use gateware card-detect bit by default */ | ||
+ ret = !litex_read8(host->sdphy + LITEX_PHY_CARDDETECT); | ||
+ } | ||
+ | ||
if (ret) | ||
return ret; | ||
|
||
-- | ||
2.43.0 | ||
|
Oops, something went wrong.
d97ae0f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So happy we boot mainline kernel now.
Great work.