summaryrefslogtreecommitdiff
path: root/target/linux/oxnas/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2016-07-18 18:32:48 +0200
committerDaniel Golle <daniel@makrotopia.org>2016-07-18 18:35:32 +0200
commitc5ec5e1f7f33a18ea81d3d9254c5b49bbdfd5e16 (patch)
treed3f814a4a85f72d5093ba49c3518c8e7e46e9f33 /target/linux/oxnas/files
parent56f686b7107b17341e6357e31435237e6fb1bb0c (diff)
downloadmtk-20170518-c5ec5e1f7f33a18ea81d3d9254c5b49bbdfd5e16.zip
mtk-20170518-c5ec5e1f7f33a18ea81d3d9254c5b49bbdfd5e16.tar.gz
mtk-20170518-c5ec5e1f7f33a18ea81d3d9254c5b49bbdfd5e16.tar.bz2
oxnas: revert to kernel 4.1
A bug resulting in the NAND not being detected by newer kernels has kept me sleepless for months and yet I wasn't able to discover the cause. Bring back patches and files for 4.1 until this has been resolved. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target/linux/oxnas/files')
-rw-r--r--target/linux/oxnas/files/arch/arm/mach-oxnas/mach-ox820.c5
-rw-r--r--target/linux/oxnas/files/drivers/irqchip/irq-rps.c24
-rw-r--r--target/linux/oxnas/files/drivers/mtd/nand/oxnas_nand.c4
-rw-r--r--target/linux/oxnas/files/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c27
-rw-r--r--target/linux/oxnas/files/drivers/pinctrl/pinctrl-oxnas.c8
5 files changed, 67 insertions, 1 deletions
diff --git a/target/linux/oxnas/files/arch/arm/mach-oxnas/mach-ox820.c b/target/linux/oxnas/files/arch/arm/mach-oxnas/mach-ox820.c
index 31b7c90..4d648c6 100644
--- a/target/linux/oxnas/files/arch/arm/mach-oxnas/mach-ox820.c
+++ b/target/linux/oxnas/files/arch/arm/mach-oxnas/mach-ox820.c
@@ -8,6 +8,7 @@
#include <linux/slab.h>
#include <linux/gfp.h>
#include <linux/reset.h>
+#include <linux/version.h>
#include <asm/mach-types.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
@@ -73,7 +74,11 @@ static void __init ox820_dt_init(void)
static void __init ox820_timer_init(void)
{
of_clk_init(NULL);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ clocksource_of_init();
+#else
clocksource_probe();
+#endif
}
void ox820_init_early(void)
diff --git a/target/linux/oxnas/files/drivers/irqchip/irq-rps.c b/target/linux/oxnas/files/drivers/irqchip/irq-rps.c
index f2b0829..1e75ea1 100644
--- a/target/linux/oxnas/files/drivers/irqchip/irq-rps.c
+++ b/target/linux/oxnas/files/drivers/irqchip/irq-rps.c
@@ -6,7 +6,13 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/err.h>
#include <linux/io.h>
-#include <linux/irqchip.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+# include "irqchip.h"
+#else
+# include <linux/irqchip.h>
+#endif
struct rps_chip_data {
void __iomem *base;
@@ -56,7 +62,11 @@ static int rps_irq_domain_xlate(struct irq_domain *d,
unsigned long *out_hwirq,
unsigned int *out_type)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ if (d->of_node != controller)
+#else
if (irq_domain_get_of_node(d) != controller)
+#endif
return -EINVAL;
if (intsize < 1)
return -EINVAL;
@@ -72,7 +82,11 @@ static int rps_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
irq_set_chip_and_handler(irq, &rps_chip, handle_level_irq);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+#else
irq_set_probe(irq);
+#endif
irq_set_chip_data(irq, d->host_data);
return 0;
}
@@ -82,7 +96,11 @@ const struct irq_domain_ops rps_irq_domain_ops = {
.xlate = rps_irq_domain_xlate,
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+static void rps_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
+#else
static void rps_handle_cascade_irq(struct irq_desc *desc)
+#endif
{
struct rps_chip_data *chip_data = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -96,7 +114,11 @@ static void rps_handle_cascade_irq(struct irq_desc *desc)
cascade_irq = irq_find_mapping(chip_data->domain, rps_irq);
if (unlikely(rps_irq >= RPS_IRQ_COUNT))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ handle_bad_irq(cascade_irq, desc);
+#else
handle_bad_irq(desc);
+#endif
else
generic_handle_irq(cascade_irq);
diff --git a/target/linux/oxnas/files/drivers/mtd/nand/oxnas_nand.c b/target/linux/oxnas/files/drivers/mtd/nand/oxnas_nand.c
index c96d66b..9536e51 100644
--- a/target/linux/oxnas/files/drivers/mtd/nand/oxnas_nand.c
+++ b/target/linux/oxnas/files/drivers/mtd/nand/oxnas_nand.c
@@ -56,10 +56,14 @@ static int oxnas_nand_probe(struct platform_device *pdev)
return 0;
}
+/* allow users to override the partition in DT using the cmdline */
+static const char * part_probes[] = { "cmdlinepart", "ofpart", NULL };
+
static struct platform_nand_data oxnas_nand_data = {
.chip = {
.nr_chips = 1,
.chip_delay = 30,
+ .part_probe_types = part_probes,
},
.ctrl = {
.probe = oxnas_nand_probe,
diff --git a/target/linux/oxnas/files/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/target/linux/oxnas/files/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
index aafb118..07f9f44 100644
--- a/target/linux/oxnas/files/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/target/linux/oxnas/files/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -25,6 +25,7 @@
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/stmmac.h>
+#include <linux/version.h>
#include <mach/hardware.h>
@@ -91,21 +92,37 @@ static void oxnas_gmac_exit(struct platform_device *pdev, void *priv)
}
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+static void *oxnas_gmac_probe(struct platform_device *pdev)
+{
+#else
static int oxnas_gmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
int ret;
+#endif
struct device *dev = &pdev->dev;
struct oxnas_gmac *bsp_priv;
bsp_priv = devm_kzalloc(dev, sizeof(*bsp_priv), GFP_KERNEL);
if (!bsp_priv)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ return ERR_PTR(-ENOMEM);
+#else
return -ENOMEM;
+#endif
bsp_priv->clk = devm_clk_get(dev, "gmac");
if (IS_ERR(bsp_priv->clk))
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ return bsp_priv->clk;
+#else
return PTR_ERR(bsp_priv->clk);
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ return bsp_priv;
+#else
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
return ret;
@@ -123,8 +140,17 @@ static int oxnas_gmac_probe(struct platform_device *pdev)
return ret;
return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
+#endif
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+const struct stmmac_of_data oxnas_gmac_data = {
+ .has_gmac = 1,
+ .setup = oxnas_gmac_probe,
+ .init = oxnas_gmac_init,
+ .exit = oxnas_gmac_exit,
+};
+#else
static const struct of_device_id oxnas_gmac_match[] = {
{ .compatible = "plxtech,nas782x-gmac" },
{ }
@@ -141,5 +167,6 @@ static struct platform_driver oxnas_gmac_driver = {
},
};
module_platform_driver(oxnas_gmac_driver);
+#endif
MODULE_LICENSE("GPL v2");
diff --git a/target/linux/oxnas/files/drivers/pinctrl/pinctrl-oxnas.c b/target/linux/oxnas/files/drivers/pinctrl/pinctrl-oxnas.c
index 38a8cbb..034a730 100644
--- a/target/linux/oxnas/files/drivers/pinctrl/pinctrl-oxnas.c
+++ b/target/linux/oxnas/files/drivers/pinctrl/pinctrl-oxnas.c
@@ -27,6 +27,7 @@
/* Since we request GPIOs from ourself */
#include <linux/pinctrl/consumer.h>
#include <linux/spinlock.h>
+#include <linux/version.h>
#include "core.h"
@@ -1199,7 +1200,11 @@ static struct irq_chip gpio_irqchip = {
.irq_set_type = gpio_irq_type,
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
+#else
static void gpio_irq_handler(struct irq_desc *desc)
+#endif
{
struct irq_chip *chip = irq_desc_get_chip(desc);
struct irq_data *idata = irq_desc_get_irq_data(desc);
@@ -1240,6 +1245,9 @@ static int oxnas_gpio_irq_map(struct irq_domain *h, unsigned int virq,
irq_set_lockdep_class(virq, &gpio_lock_class);
irq_set_chip_and_handler(virq, &gpio_irqchip, handle_edge_irq);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+ set_irq_flags(virq, IRQF_VALID);
+#endif
irq_set_chip_data(virq, oxnas_gpio);
return 0;