ath79: remove pre-5.10 specific kernel code
With Kernel 5.4 support removed, we can get rid of this legacy code. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
00b194871c
commit
79a81d36ae
@ -14,9 +14,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/mtd/mtd.h>
|
#include <linux/mtd/mtd.h>
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
#include <linux/mtd/nand.h>
|
#include <linux/mtd/nand.h>
|
||||||
#endif
|
|
||||||
#include <linux/mtd/rawnand.h>
|
#include <linux/mtd/rawnand.h>
|
||||||
#include <linux/mtd/partitions.h>
|
#include <linux/mtd/partitions.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
@ -722,11 +720,7 @@ static void ar934x_nfc_cmdfunc(struct nand_chip *nand, unsigned int command,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NAND_CMD_PAGEPROG:
|
case NAND_CMD_PAGEPROG:
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
if (nand->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
|
if (nand->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
|
||||||
#else
|
|
||||||
if (nand->ecc.mode == NAND_ECC_HW) {
|
|
||||||
#endif
|
|
||||||
/* the data is already written */
|
/* the data is already written */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1334,29 +1328,15 @@ static int ar934x_nfc_attach_chip(struct nand_chip *nand)
|
|||||||
if (mtd->writesize == 2048)
|
if (mtd->writesize == 2048)
|
||||||
nand->options |= NAND_NO_SUBPAGE_WRITE;
|
nand->options |= NAND_NO_SUBPAGE_WRITE;
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
if (nand->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
|
if (nand->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
|
||||||
#else
|
|
||||||
if (nand->ecc.mode == NAND_ECC_HW) {
|
|
||||||
#endif
|
|
||||||
ret = ar934x_nfc_setup_hwecc(nfc);
|
ret = ar934x_nfc_setup_hwecc(nfc);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
} else if (nand->ecc.engine_type != NAND_ECC_ENGINE_TYPE_SOFT) {
|
} else if (nand->ecc.engine_type != NAND_ECC_ENGINE_TYPE_SOFT) {
|
||||||
dev_err(dev, "unknown ECC mode %d\n", nand->ecc.engine_type);
|
dev_err(dev, "unknown ECC mode %d\n", nand->ecc.engine_type);
|
||||||
#else
|
|
||||||
} else if (nand->ecc.mode != NAND_ECC_SOFT) {
|
|
||||||
dev_err(dev, "unknown ECC mode %d\n", nand->ecc.mode);
|
|
||||||
#endif
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
} else if ((nand->ecc.algo != NAND_ECC_ALGO_BCH) &&
|
} else if ((nand->ecc.algo != NAND_ECC_ALGO_BCH) &&
|
||||||
(nand->ecc.algo != NAND_ECC_ALGO_HAMMING)) {
|
(nand->ecc.algo != NAND_ECC_ALGO_HAMMING)) {
|
||||||
#else
|
|
||||||
} else if ((nand->ecc.algo != NAND_ECC_BCH) &&
|
|
||||||
(nand->ecc.algo != NAND_ECC_HAMMING)) {
|
|
||||||
#endif
|
|
||||||
dev_err(dev, "unknown software ECC algo %d\n", nand->ecc.algo);
|
dev_err(dev, "unknown software ECC algo %d\n", nand->ecc.algo);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -1445,11 +1425,7 @@ static int ar934x_nfc_probe(struct platform_device *pdev)
|
|||||||
nand->legacy.read_byte = ar934x_nfc_read_byte;
|
nand->legacy.read_byte = ar934x_nfc_read_byte;
|
||||||
nand->legacy.write_buf = ar934x_nfc_write_buf;
|
nand->legacy.write_buf = ar934x_nfc_write_buf;
|
||||||
nand->legacy.read_buf = ar934x_nfc_read_buf;
|
nand->legacy.read_buf = ar934x_nfc_read_buf;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
nand->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; /* default */
|
nand->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; /* default */
|
||||||
#else
|
|
||||||
nand->ecc.mode = NAND_ECC_HW; /* default */
|
|
||||||
#endif
|
|
||||||
nand->priv = nfc;
|
nand->priv = nfc;
|
||||||
platform_set_drvdata(pdev, nfc);
|
platform_set_drvdata(pdev, nfc);
|
||||||
|
|
||||||
@ -1489,12 +1465,8 @@ static int ar934x_nfc_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
nfc = platform_get_drvdata(pdev);
|
nfc = platform_get_drvdata(pdev);
|
||||||
if (nfc) {
|
if (nfc) {
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
|
|
||||||
mtd_device_unregister(nand_to_mtd(&nfc->nand_chip));
|
mtd_device_unregister(nand_to_mtd(&nfc->nand_chip));
|
||||||
nand_cleanup(&nfc->nand_chip);
|
nand_cleanup(&nfc->nand_chip);
|
||||||
#else
|
|
||||||
nand_release(&nfc->nand_chip);
|
|
||||||
#endif
|
|
||||||
ar934x_nfc_free_buf(nfc);
|
ar934x_nfc_free_buf(nfc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,13 +188,8 @@ static int rb4xx_nand_probe(struct platform_device *pdev)
|
|||||||
if (mtd->writesize == 512)
|
if (mtd->writesize == 512)
|
||||||
mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops);
|
mtd_set_ooblayout(mtd, &rb4xx_nand_ecclayout_ops);
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
nand->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
|
nand->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
|
||||||
nand->chip.ecc.algo = NAND_ECC_ALGO_HAMMING;
|
nand->chip.ecc.algo = NAND_ECC_ALGO_HAMMING;
|
||||||
#else
|
|
||||||
nand->chip.ecc.mode = NAND_ECC_SOFT;
|
|
||||||
nand->chip.ecc.algo = NAND_ECC_HAMMING;
|
|
||||||
#endif
|
|
||||||
nand->chip.options = NAND_NO_SUBPAGE_WRITE;
|
nand->chip.options = NAND_NO_SUBPAGE_WRITE;
|
||||||
nand->chip.priv = nand;
|
nand->chip.priv = nand;
|
||||||
|
|
||||||
@ -211,12 +206,8 @@ static int rb4xx_nand_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
ret = mtd_device_register(mtd, NULL, 0);
|
ret = mtd_device_register(mtd, NULL, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
|
|
||||||
mtd_device_unregister(nand_to_mtd(&nand->chip));
|
mtd_device_unregister(nand_to_mtd(&nand->chip));
|
||||||
nand_cleanup(&nand->chip);
|
nand_cleanup(&nand->chip);
|
||||||
#else
|
|
||||||
nand_release(&nand->chip);
|
|
||||||
#endif
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,12 +218,8 @@ static int rb4xx_nand_remove(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct rb4xx_nand *nand = platform_get_drvdata(pdev);
|
struct rb4xx_nand *nand = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
|
mtd_device_unregister(nand_to_mtd(&nand->chip));
|
||||||
mtd_device_unregister(nand_to_mtd(&nand->chip));
|
nand_cleanup(&nand->chip);
|
||||||
nand_cleanup(&nand->chip);
|
|
||||||
#else
|
|
||||||
nand_release(&nand->chip);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -254,12 +254,8 @@ static void rb91x_nand_write_buf(struct nand_chip *chip, const u8 *buf, int len)
|
|||||||
|
|
||||||
static void rb91x_nand_release(struct rb91x_nand_drvdata *drvdata)
|
static void rb91x_nand_release(struct rb91x_nand_drvdata *drvdata)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
|
|
||||||
mtd_device_unregister(nand_to_mtd(&drvdata->chip));
|
mtd_device_unregister(nand_to_mtd(&drvdata->chip));
|
||||||
nand_cleanup(&drvdata->chip);
|
nand_cleanup(&drvdata->chip);
|
||||||
#else
|
|
||||||
nand_release(&drvdata->chip);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rb91x_nand_probe(struct platform_device *pdev)
|
static int rb91x_nand_probe(struct platform_device *pdev)
|
||||||
@ -304,13 +300,8 @@ static int rb91x_nand_probe(struct platform_device *pdev)
|
|||||||
drvdata->chip.legacy.read_buf = rb91x_nand_read_buf;
|
drvdata->chip.legacy.read_buf = rb91x_nand_read_buf;
|
||||||
|
|
||||||
drvdata->chip.legacy.chip_delay = 25;
|
drvdata->chip.legacy.chip_delay = 25;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
|
|
||||||
drvdata->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
|
drvdata->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
|
||||||
drvdata->chip.ecc.algo = NAND_ECC_ALGO_HAMMING;
|
drvdata->chip.ecc.algo = NAND_ECC_ALGO_HAMMING;
|
||||||
#else
|
|
||||||
drvdata->chip.ecc.mode = NAND_ECC_SOFT;
|
|
||||||
drvdata->chip.ecc.algo = NAND_ECC_HAMMING;
|
|
||||||
#endif
|
|
||||||
drvdata->chip.options = NAND_NO_SUBPAGE_WRITE;
|
drvdata->chip.options = NAND_NO_SUBPAGE_WRITE;
|
||||||
|
|
||||||
r = nand_scan(&drvdata->chip, 1);
|
r = nand_scan(&drvdata->chip, 1);
|
||||||
|
@ -178,11 +178,7 @@ struct ag71xx {
|
|||||||
|
|
||||||
struct phy_device *phy_dev;
|
struct phy_device *phy_dev;
|
||||||
void *phy_priv;
|
void *phy_priv;
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
|
|
||||||
phy_interface_t phy_if_mode;
|
phy_interface_t phy_if_mode;
|
||||||
#else
|
|
||||||
int phy_if_mode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int link;
|
unsigned int link;
|
||||||
unsigned int speed;
|
unsigned int speed;
|
||||||
|
@ -1198,11 +1198,7 @@ static void ag71xx_oom_timer_handler(struct timer_list *t)
|
|||||||
napi_schedule(&ag->napi);
|
napi_schedule(&ag->napi);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
|
|
||||||
static void ag71xx_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
static void ag71xx_tx_timeout(struct net_device *dev, unsigned int txqueue)
|
||||||
#else
|
|
||||||
static void ag71xx_tx_timeout(struct net_device *dev)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct ag71xx *ag = netdev_priv(dev);
|
struct ag71xx *ag = netdev_priv(dev);
|
||||||
|
|
||||||
@ -1679,13 +1675,8 @@ static int ag71xx_probe(struct platform_device *pdev)
|
|||||||
eth_random_addr(dev->dev_addr);
|
eth_random_addr(dev->dev_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0)
|
|
||||||
err = of_get_phy_mode(np, &ag->phy_if_mode);
|
err = of_get_phy_mode(np, &ag->phy_if_mode);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
#else
|
|
||||||
ag->phy_if_mode = of_get_phy_mode(np);
|
|
||||||
if (ag->phy_if_mode < 0) {
|
|
||||||
#endif
|
|
||||||
dev_err(&pdev->dev, "missing phy-mode property in DT\n");
|
dev_err(&pdev->dev, "missing phy-mode property in DT\n");
|
||||||
return ag->phy_if_mode;
|
return ag->phy_if_mode;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user