New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Netgear WNR3500L v2 #4874
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
eede399
broadcom-wl: Fix compilation with kernel 5.10
ffainelli 1bbeccd
bcm47xx: Add support for brcmnand controller on BCMA bus
ffainelli e353550
bcm47xx: Updated devices database for Netgear WNR3500L V2
ffainelli 9d0fc8e
bcm47xx: Fix Netgear WNR3500L v2 image format
ffainelli File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
package/kernel/broadcom-wl/patches/040-remove_last_rx_usage.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
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
2 changes: 1 addition & 1 deletion
2
package/kernel/broadcom-wl/patches/916-fix-compilation-for-5_4.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
42 changes: 42 additions & 0 deletions
42
package/kernel/broadcom-wl/patches/917-fix-compilation-for-5_10.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,42 @@ | ||
Index: broadcom-wl-5.10.56.27.3/driver/wl_linux.c | ||
=================================================================== | ||
--- broadcom-wl-5.10.56.27.3.orig/driver/wl_linux.c | ||
+++ broadcom-wl-5.10.56.27.3/driver/wl_linux.c | ||
@@ -74,6 +74,10 @@ | ||
#error "No support for Kernel Rev <= 2.4.5, As the older kernel revs doesn't support Tasklets" | ||
#endif | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
+#define ioremap_nocache ioremap | ||
+#endif | ||
+ | ||
typedef void wlc_info_t; | ||
typedef void wlc_hw_info_t; | ||
#include <wlc_pub.h> | ||
@@ -1915,7 +1919,11 @@ wl_ioctl(struct net_device *dev, struct | ||
} | ||
|
||
/* optimization for direct ioctl calls from kernel */ | ||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) | ||
if (segment_eq(get_fs(), KERNEL_DS)) | ||
+#else | ||
+ if (uaccess_kernel()) | ||
+#endif | ||
buf = ioc.buf; | ||
|
||
else if (ioc.buf) { | ||
Index: broadcom-wl-5.10.56.27.3/driver/linux_osl.c | ||
=================================================================== | ||
--- broadcom-wl-5.10.56.27.3.orig/driver/linux_osl.c | ||
+++ broadcom-wl-5.10.56.27.3/driver/linux_osl.c | ||
@@ -34,6 +34,10 @@ | ||
#define OS_HANDLE_MAGIC 0x1234abcd /* Magic # to recognise osh */ | ||
#define BCM_MEM_FILENAME_LEN 24 /* Mem. filename length */ | ||
|
||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) | ||
+#define ioremap_nocache ioremap | ||
+#endif | ||
+ | ||
typedef struct bcm_mem_link { | ||
struct bcm_mem_link *prev; | ||
struct bcm_mem_link *next; |
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
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
111 changes: 111 additions & 0 deletions
111
...linux/bcm47xx/patches-5.10/100-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operat.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,111 @@ | ||
From a126431d8647ae3bbdc4efe854494aaa2b09eb2b Mon Sep 17 00:00:00 2001 | ||
From: Florian Fainelli <f.fainelli@gmail.com> | ||
Date: Mon, 13 Dec 2021 15:57:14 -0800 | ||
Subject: [PATCH 100/108] mtd: rawnand: brcmnand: Allow SoC to provide I/O | ||
operations | ||
|
||
Allow a brcmnand_soc instance to provide a custom set of I/O operations | ||
which we will require when using this driver on a BCMA bus which is not | ||
directly memory mapped I/O. Update the nand_{read,write}_reg accordingly | ||
to use the SoC operations if provided. | ||
|
||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> | ||
--- | ||
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 ++++++++++++-- | ||
drivers/mtd/nand/raw/brcmnand/brcmnand.h | 23 +++++++++++++++++++++++ | ||
2 files changed, 35 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
index f75929783b94..7a1673b1b1af 100644 | ||
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
@@ -594,13 +594,18 @@ enum { | ||
|
||
static inline u32 nand_readreg(struct brcmnand_controller *ctrl, u32 offs) | ||
{ | ||
+ if (brcmnand_soc_has_ops(ctrl->soc)) | ||
+ return brcmnand_soc_read(ctrl->soc, offs); | ||
return brcmnand_readl(ctrl->nand_base + offs); | ||
} | ||
|
||
static inline void nand_writereg(struct brcmnand_controller *ctrl, u32 offs, | ||
u32 val) | ||
{ | ||
- brcmnand_writel(val, ctrl->nand_base + offs); | ||
+ if (brcmnand_soc_has_ops(ctrl->soc)) | ||
+ brcmnand_soc_write(ctrl->soc, val, offs); | ||
+ else | ||
+ brcmnand_writel(val, ctrl->nand_base + offs); | ||
} | ||
|
||
static int brcmnand_revision_init(struct brcmnand_controller *ctrl) | ||
@@ -766,13 +771,18 @@ static inline void brcmnand_rmw_reg(struct brcmnand_controller *ctrl, | ||
|
||
static inline u32 brcmnand_read_fc(struct brcmnand_controller *ctrl, int word) | ||
{ | ||
+ if (brcmnand_soc_has_ops(ctrl->soc)) | ||
+ return brcmnand_soc_read(ctrl->soc, ~0); | ||
return __raw_readl(ctrl->nand_fc + word * 4); | ||
} | ||
|
||
static inline void brcmnand_write_fc(struct brcmnand_controller *ctrl, | ||
int word, u32 val) | ||
{ | ||
- __raw_writel(val, ctrl->nand_fc + word * 4); | ||
+ if (brcmnand_soc_has_ops(ctrl->soc)) | ||
+ brcmnand_soc_write(ctrl->soc, val, ~0); | ||
+ else | ||
+ __raw_writel(val, ctrl->nand_fc + word * 4); | ||
} | ||
|
||
static inline void edu_writel(struct brcmnand_controller *ctrl, | ||
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.h b/drivers/mtd/nand/raw/brcmnand/brcmnand.h | ||
index eb498fbe505e..a3f2ad5f6572 100644 | ||
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.h | ||
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.h | ||
@@ -11,12 +11,19 @@ | ||
|
||
struct platform_device; | ||
struct dev_pm_ops; | ||
+struct brcmnand_io_ops; | ||
|
||
struct brcmnand_soc { | ||
bool (*ctlrdy_ack)(struct brcmnand_soc *soc); | ||
void (*ctlrdy_set_enabled)(struct brcmnand_soc *soc, bool en); | ||
void (*prepare_data_bus)(struct brcmnand_soc *soc, bool prepare, | ||
bool is_param); | ||
+ const struct brcmnand_io_ops *ops; | ||
+}; | ||
+ | ||
+struct brcmnand_io_ops { | ||
+ u32 (*read_reg)(struct brcmnand_soc *soc, u32 offset); | ||
+ void (*write_reg)(struct brcmnand_soc *soc, u32 val, u32 offset); | ||
}; | ||
|
||
static inline void brcmnand_soc_data_bus_prepare(struct brcmnand_soc *soc, | ||
@@ -58,6 +65,22 @@ static inline void brcmnand_writel(u32 val, void __iomem *addr) | ||
writel_relaxed(val, addr); | ||
} | ||
|
||
+static inline bool brcmnand_soc_has_ops(struct brcmnand_soc *soc) | ||
+{ | ||
+ return soc && soc->ops && soc->ops->read_reg && soc->ops->write_reg; | ||
+} | ||
+ | ||
+static inline u32 brcmnand_soc_read(struct brcmnand_soc *soc, u32 offset) | ||
+{ | ||
+ return soc->ops->read_reg(soc, offset); | ||
+} | ||
+ | ||
+static inline void brcmnand_soc_write(struct brcmnand_soc *soc, u32 val, | ||
+ u32 offset) | ||
+{ | ||
+ soc->ops->write_reg(soc, val, offset); | ||
+} | ||
+ | ||
int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc); | ||
int brcmnand_remove(struct platform_device *pdev); | ||
|
||
-- | ||
2.25.1 | ||
|
39 changes: 39 additions & 0 deletions
39
...linux/bcm47xx/patches-5.10/101-mtd-rawnand-brcmnand-Assign-soc-as-early-as-possible.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,39 @@ | ||
From 6e3c0ce00126e4ae9eddb6c6f57de67ccf3e683b Mon Sep 17 00:00:00 2001 | ||
From: Florian Fainelli <f.fainelli@gmail.com> | ||
Date: Tue, 14 Dec 2021 15:11:15 -0800 | ||
Subject: [PATCH 101/108] mtd: rawnand: brcmnand: Assign soc as early as | ||
possible | ||
|
||
In order to key off the brcmnand_probe() code in subsequent changes | ||
depending upon ctlr->soc, assign that variable as early as possible, | ||
instead of much later when we have checked that it is non-NULL. | ||
|
||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> | ||
--- | ||
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 3 +-- | ||
1 file changed, 1 insertion(+), 2 deletions(-) | ||
|
||
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
index 7a1673b1b1af..fcea5a7443e8 100644 | ||
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
@@ -3008,6 +3008,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) | ||
|
||
dev_set_drvdata(dev, ctrl); | ||
ctrl->dev = dev; | ||
+ ctrl->soc = soc; | ||
|
||
init_completion(&ctrl->done); | ||
init_completion(&ctrl->dma_done); | ||
@@ -3148,8 +3149,6 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) | ||
* interesting ways | ||
*/ | ||
if (soc) { | ||
- ctrl->soc = soc; | ||
- | ||
ret = devm_request_irq(dev, ctrl->irq, brcmnand_irq, 0, | ||
DRV_NAME, ctrl); | ||
|
||
-- | ||
2.25.1 | ||
|
58 changes: 58 additions & 0 deletions
58
.../linux/bcm47xx/patches-5.10/102-mtd-rawnand-brcmnand-Avoid-pdev-in-brcmnand_init_cs.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,58 @@ | ||
From bc512bc38c4fe4ff8f47bd9de20b367f85238548 Mon Sep 17 00:00:00 2001 | ||
From: Florian Fainelli <f.fainelli@gmail.com> | ||
Date: Tue, 14 Dec 2021 15:45:24 -0800 | ||
Subject: [PATCH 102/108] mtd: rawnand: brcmnand: Avoid pdev in | ||
brcmnand_init_cs() | ||
|
||
In preparation for encapsulation more of what the loop calling | ||
brcmnand_init_cs() does, avoid using platform_device when it is the | ||
device behind platform_device that we are using for printing errors. | ||
|
||
No functional change. | ||
|
||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> | ||
--- | ||
drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++---- | ||
1 file changed, 4 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
index fcea5a7443e8..35f8d8e02d4a 100644 | ||
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c | ||
@@ -2763,7 +2763,7 @@ static const struct nand_controller_ops brcmnand_controller_ops = { | ||
static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) | ||
{ | ||
struct brcmnand_controller *ctrl = host->ctrl; | ||
- struct platform_device *pdev = host->pdev; | ||
+ struct device *dev = ctrl->dev; | ||
struct mtd_info *mtd; | ||
struct nand_chip *chip; | ||
int ret; | ||
@@ -2771,7 +2771,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) | ||
|
||
ret = of_property_read_u32(dn, "reg", &host->cs); | ||
if (ret) { | ||
- dev_err(&pdev->dev, "can't get chip-select\n"); | ||
+ dev_err(dev, "can't get chip-select\n"); | ||
return -ENXIO; | ||
} | ||
|
||
@@ -2780,13 +2780,13 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn) | ||
|
||
nand_set_flash_node(chip, dn); | ||
nand_set_controller_data(chip, host); | ||
- mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d", | ||
+ mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d", | ||
host->cs); | ||
if (!mtd->name) | ||
return -ENOMEM; | ||
|
||
mtd->owner = THIS_MODULE; | ||
- mtd->dev.parent = &pdev->dev; | ||
+ mtd->dev.parent = dev; | ||
|
||
chip->legacy.cmd_ctrl = brcmnand_cmd_ctrl; | ||
chip->legacy.cmdfunc = brcmnand_cmdfunc; | ||
-- | ||
2.25.1 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please run: