mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
This pull request contains the following core changes:
* Fix memory leaks in the core * Remove unused NAND locking support * Rename nand.h into rawnand.h (preparing support for spi NANDs) * Use NAND_MAX_ID_LEN where appropriate * Fix support for 20nm Hynix chips * Fix support for Samsung and Hynix SLC NANDs and the following driver changes: * Various cleanup, improvements and fixes in the qcom driver * Fixes for bugs detected by various static code analysis tools * Fix mxc ooblayout definition * Add a new part_parsers to tmio and sharpsl platform data in order to define a custom list of partition parsers * Request the reset line in exclusive mode in the sunxi driver * Fix a build error in the orion-nand driver when compiled for ARMv4 * Allow 64-bit mvebu platforms to select the PXA3XX driver -----BEGIN PGP SIGNATURE----- iQJABAABCAAqBQJZpwMZIxxib3Jpcy5icmV6aWxsb25AZnJlZS1lbGVjdHJvbnMu Y29tAAoJEGXtNgF+CLcAJEoP/jRnEjPznWT3+ngw6k/rnykkn/wexKV3iyX/6b71 MQT/ZFuT3HsHnUjyprPvyRWJeKun6XyIH5fk7FlXIei9TaWCt6/UGTKousaPKeR2 maggGeEjxGVpHJM/jpIYCyjt83zpezBqTupv52XhXxPaU7ROSpuHCd92YcPzIaT5 tcn8JrI7TGuGlBrBbA2y8ZrPtuug3IKqUfpIiQmoqr0jzQR+AbZKHg0kk5a8piOn OguK67uhxeOvq831bGPehCPDbuE0loNi4CssayJ1HrisfS95kH/cqrveapgKsUG/ fxaHh1i65I0lxa8sgUgeUiU04Zsy1YcgNbCj41AY4AHnjJ0+Qp1cV6KAB/x5/wH9 ES/fW06how+1BLEeLvOr+rIQ41WeP0qV2H3r/PtkeswKKAV3gSERBXVHmg1E7Yum HkmPqzhu+nSk3mP7p3yxpd7EwWQh2xpvVYrfQ5vQbtdfm8Uw9n6S8x+O89ch9wWi +KbMWFsmF78nuRWW3WTsaiOFKcTRLBT5RoU2z4i9hCvQT2Pnx3SBhHrIj6xqBI1S 8MpeDdlXHmRQfZxj+jDqU77JYqVEmy/5it9OjhjMpOqxfCf4K6Nlb75TEdR5Nh/9 BA1qqTBEslg3UqS8ofGFHGFZWrW3JHf02SYo2zU9IvBninh3HrqHiFhBc3p1xNDE 7GwD =bC1+ -----END PGP SIGNATURE----- Merge tag 'nand/for-4.14' of git://git.infradead.org/l2-mtd into mtd/next From Boris: " This pull request contains the following core changes: * Fix memory leaks in the core * Remove unused NAND locking support * Rename nand.h into rawnand.h (preparing support for spi NANDs) * Use NAND_MAX_ID_LEN where appropriate * Fix support for 20nm Hynix chips * Fix support for Samsung and Hynix SLC NANDs and the following driver changes: * Various cleanup, improvements and fixes in the qcom driver * Fixes for bugs detected by various static code analysis tools * Fix mxc ooblayout definition * Add a new part_parsers to tmio and sharpsl platform data in order to define a custom list of partition parsers * Request the reset line in exclusive mode in the sunxi driver * Fix a build error in the orion-nand driver when compiled for ARMv4 * Allow 64-bit mvebu platforms to select the PXA3XX driver "
This commit is contained in:
commit
d1f936d736
134 changed files with 1111 additions and 592 deletions
|
|
@ -2073,15 +2073,17 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
ret = stfsm_init(fsm);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to initialise FSM Controller\n");
|
||||
return ret;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
|
||||
stfsm_fetch_platform_configs(pdev);
|
||||
|
||||
/* Detect SPI FLASH device */
|
||||
info = stfsm_jedec_probe(fsm);
|
||||
if (!info)
|
||||
return -ENODEV;
|
||||
if (!info) {
|
||||
ret = -ENODEV;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
fsm->info = info;
|
||||
|
||||
/* Use device size to determine address width */
|
||||
|
|
@ -2095,11 +2097,11 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
if (info->config) {
|
||||
ret = info->config(fsm);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_clk_unprepare;
|
||||
} else {
|
||||
ret = stfsm_prepare_rwe_seqs_default(fsm);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
|
||||
fsm->mtd.name = info->name;
|
||||
|
|
@ -2124,6 +2126,10 @@ static int stfsm_probe(struct platform_device *pdev)
|
|||
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
|
||||
|
||||
return mtd_device_register(&fsm->mtd, NULL, 0);
|
||||
|
||||
err_clk_unprepare:
|
||||
clk_disable_unprepare(fsm->clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int stfsm_remove(struct platform_device *pdev)
|
||||
|
|
@ -2147,9 +2153,7 @@ static int stfsmfsm_resume(struct device *dev)
|
|||
{
|
||||
struct stfsm *fsm = dev_get_drvdata(dev);
|
||||
|
||||
clk_prepare_enable(fsm->clk);
|
||||
|
||||
return 0;
|
||||
return clk_prepare_enable(fsm->clk);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nftl.h>
|
||||
#include <linux/mtd/inftl.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/io.h>
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ config MTD_NAND_ATMEL
|
|||
|
||||
config MTD_NAND_PXA3xx
|
||||
tristate "NAND support on PXA3xx and Armada 370/XP"
|
||||
depends on PXA3xx || ARCH_MMP || PLAT_ORION
|
||||
depends on PXA3xx || ARCH_MMP || PLAT_ORION || ARCH_MVEBU
|
||||
help
|
||||
This enables the driver for the NAND flash device found on
|
||||
PXA3xx processors (NFCv1) and also on Armada 370/XP (NFCv2).
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/platform_data/gpio-omap.h>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
#include <linux/mfd/syscon/atmel-matrix.h>
|
||||
#include <linux/mfd/syscon/atmel-smc.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
|
@ -2089,8 +2089,8 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
|
|||
}
|
||||
|
||||
nc->irq = of_irq_get(nand_np, 0);
|
||||
if (nc->irq < 0) {
|
||||
ret = nc->irq;
|
||||
if (nc->irq <= 0) {
|
||||
ret = nc->irq ?: -ENXIO;
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get IRQ number (err = %d)\n",
|
||||
ret);
|
||||
|
|
@ -2179,11 +2179,12 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
|
|||
|
||||
nc->irq = of_irq_get(np, 0);
|
||||
of_node_put(np);
|
||||
if (nc->irq < 0) {
|
||||
if (nc->irq != -EPROBE_DEFER)
|
||||
if (nc->irq <= 0) {
|
||||
ret = nc->irq ?: -ENXIO;
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Failed to get IRQ number (err = %d)\n",
|
||||
nc->irq);
|
||||
return nc->irq;
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
np = of_parse_phandle(dev->of_node, "atmel,nfc-io", 0);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include <linux/genalloc.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <asm/io.h>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#endif
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
struct bcm47xxnflash {
|
||||
struct bcma_drv_cc *cc;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#include <linux/bitops.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <linux/bitops.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <linux/device.h>
|
||||
#undef DEBUG
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/rslib.h>
|
||||
#include <linux/pci.h>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* CM-X270 board.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/gpio.h>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of_device.h>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define __DENALI_H__
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
#define DEVICE_RESET 0x0
|
||||
#define DEVICE_RESET__BANK(bank) BIT(bank)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ static int denali_dt_probe(struct platform_device *pdev)
|
|||
dev_err(&pdev->dev, "no clk available\n");
|
||||
return PTR_ERR(dt->clk);
|
||||
}
|
||||
clk_prepare_enable(dt->clk);
|
||||
ret = clk_prepare_enable(dt->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
denali->clk_x_rate = clk_get_rate(dt->clk);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <linux/io.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/doc2000.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/inftl.h>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <linux/bitops.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/bch.h>
|
||||
#include <linux/bitrev.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/fsl_ifc.h>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <linux/gpio.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/nand-gpio.h>
|
||||
#include <linux/of.h>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#ifndef __DRIVERS_MTD_NAND_GPMI_NAND_H
|
||||
#define __DRIVERS_MTD_NAND_GPMI_NAND_H
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dmaengine.h>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <linux/gpio.h>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <linux/jz4780-nemc.h>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
|
@ -705,7 +705,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
|
|||
res = -ENOENT;
|
||||
goto err_exit1;
|
||||
}
|
||||
clk_prepare_enable(host->clk);
|
||||
res = clk_prepare_enable(host->clk);
|
||||
if (res)
|
||||
goto err_exit1;
|
||||
|
||||
nand_chip->cmd_ctrl = lpc32xx_nand_cmd_ctrl;
|
||||
nand_chip->dev_ready = lpc32xx_nand_device_ready;
|
||||
|
|
@ -846,9 +848,12 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
|
|||
static int lpc32xx_nand_resume(struct platform_device *pdev)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
|
||||
int ret;
|
||||
|
||||
/* Re-enable NAND clock */
|
||||
clk_prepare_enable(host->clk);
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Fresh init of NAND controller */
|
||||
lpc32xx_nand_setup(host);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
|
@ -840,7 +840,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
|
|||
res = -ENOENT;
|
||||
goto err_exit1;
|
||||
}
|
||||
clk_prepare_enable(host->clk);
|
||||
res = clk_prepare_enable(host->clk);
|
||||
if (res)
|
||||
goto err_exit1;
|
||||
|
||||
/* Set NAND IO addresses and command/ready functions */
|
||||
chip->IO_ADDR_R = SLC_DATA(host->io_base);
|
||||
|
|
@ -972,9 +974,12 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
|
|||
static int lpc32xx_nand_resume(struct platform_device *pdev)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
|
||||
int ret;
|
||||
|
||||
/* Re-enable NAND clock */
|
||||
clk_prepare_enable(host->clk);
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Fresh init of NAND controller */
|
||||
lpc32xx_nand_setup(host);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_device.h>
|
||||
|
|
|
|||
|
|
@ -464,8 +464,8 @@ static int mtk_ecc_probe(struct platform_device *pdev)
|
|||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
dev_err(dev, "failed to get irq\n");
|
||||
return -EINVAL;
|
||||
dev_err(dev, "failed to get irq: %d\n", irq);
|
||||
return irq;
|
||||
}
|
||||
|
||||
ret = dma_set_mask(dev, DMA_BIT_MASK(32));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/iopoll.h>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/device.h>
|
||||
|
|
@ -876,6 +876,8 @@ static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr)
|
|||
}
|
||||
}
|
||||
|
||||
#define MXC_V1_ECCBYTES 5
|
||||
|
||||
static int mxc_v1_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
struct mtd_oob_region *oobregion)
|
||||
{
|
||||
|
|
@ -885,7 +887,7 @@ static int mxc_v1_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|||
return -ERANGE;
|
||||
|
||||
oobregion->offset = (section * 16) + 6;
|
||||
oobregion->length = nand_chip->ecc.bytes;
|
||||
oobregion->length = MXC_V1_ECCBYTES;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -907,8 +909,7 @@ static int mxc_v1_ooblayout_free(struct mtd_info *mtd, int section,
|
|||
oobregion->length = 4;
|
||||
}
|
||||
} else {
|
||||
oobregion->offset = ((section - 1) * 16) +
|
||||
nand_chip->ecc.bytes + 6;
|
||||
oobregion->offset = ((section - 1) * 16) + MXC_V1_ECCBYTES + 6;
|
||||
if (section < nand_chip->ecc.steps)
|
||||
oobregion->length = (section * 16) + 6 -
|
||||
oobregion->offset;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
static void amd_nand_decode_id(struct nand_chip *chip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include <linux/nmi.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/nand_bch.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
|
@ -1247,179 +1247,6 @@ int nand_reset(struct nand_chip *chip, int chipnr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* __nand_unlock - [REPLACEABLE] unlocks specified locked blocks
|
||||
* @mtd: mtd info
|
||||
* @ofs: offset to start unlock from
|
||||
* @len: length to unlock
|
||||
* @invert:
|
||||
* - when = 0, unlock the range of blocks within the lower and
|
||||
* upper boundary address
|
||||
* - when = 1, unlock the range of blocks outside the boundaries
|
||||
* of the lower and upper boundary address
|
||||
*
|
||||
* Returs unlock status.
|
||||
*/
|
||||
static int __nand_unlock(struct mtd_info *mtd, loff_t ofs,
|
||||
uint64_t len, int invert)
|
||||
{
|
||||
int ret = 0;
|
||||
int status, page;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
|
||||
/* Submit address of first page to unlock */
|
||||
page = ofs >> chip->page_shift;
|
||||
chip->cmdfunc(mtd, NAND_CMD_UNLOCK1, -1, page & chip->pagemask);
|
||||
|
||||
/* Submit address of last page to unlock */
|
||||
page = (ofs + len) >> chip->page_shift;
|
||||
chip->cmdfunc(mtd, NAND_CMD_UNLOCK2, -1,
|
||||
(page | invert) & chip->pagemask);
|
||||
|
||||
/* Call wait ready function */
|
||||
status = chip->waitfunc(mtd, chip);
|
||||
/* See if device thinks it succeeded */
|
||||
if (status & NAND_STATUS_FAIL) {
|
||||
pr_debug("%s: error status = 0x%08x\n",
|
||||
__func__, status);
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* nand_unlock - [REPLACEABLE] unlocks specified locked blocks
|
||||
* @mtd: mtd info
|
||||
* @ofs: offset to start unlock from
|
||||
* @len: length to unlock
|
||||
*
|
||||
* Returns unlock status.
|
||||
*/
|
||||
int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
{
|
||||
int ret = 0;
|
||||
int chipnr;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
|
||||
pr_debug("%s: start = 0x%012llx, len = %llu\n",
|
||||
__func__, (unsigned long long)ofs, len);
|
||||
|
||||
if (check_offs_len(mtd, ofs, len))
|
||||
return -EINVAL;
|
||||
|
||||
/* Align to last block address if size addresses end of the device */
|
||||
if (ofs + len == mtd->size)
|
||||
len -= mtd->erasesize;
|
||||
|
||||
nand_get_device(mtd, FL_UNLOCKING);
|
||||
|
||||
/* Shift to get chip number */
|
||||
chipnr = ofs >> chip->chip_shift;
|
||||
|
||||
/*
|
||||
* Reset the chip.
|
||||
* If we want to check the WP through READ STATUS and check the bit 7
|
||||
* we must reset the chip
|
||||
* some operation can also clear the bit 7 of status register
|
||||
* eg. erase/program a locked block
|
||||
*/
|
||||
nand_reset(chip, chipnr);
|
||||
|
||||
chip->select_chip(mtd, chipnr);
|
||||
|
||||
/* Check, if it is write protected */
|
||||
if (nand_check_wp(mtd)) {
|
||||
pr_debug("%s: device is write protected!\n",
|
||||
__func__);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = __nand_unlock(mtd, ofs, len, 0);
|
||||
|
||||
out:
|
||||
chip->select_chip(mtd, -1);
|
||||
nand_release_device(mtd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(nand_unlock);
|
||||
|
||||
/**
|
||||
* nand_lock - [REPLACEABLE] locks all blocks present in the device
|
||||
* @mtd: mtd info
|
||||
* @ofs: offset to start unlock from
|
||||
* @len: length to unlock
|
||||
*
|
||||
* This feature is not supported in many NAND parts. 'Micron' NAND parts do
|
||||
* have this feature, but it allows only to lock all blocks, not for specified
|
||||
* range for block. Implementing 'lock' feature by making use of 'unlock', for
|
||||
* now.
|
||||
*
|
||||
* Returns lock status.
|
||||
*/
|
||||
int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||
{
|
||||
int ret = 0;
|
||||
int chipnr, status, page;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
|
||||
pr_debug("%s: start = 0x%012llx, len = %llu\n",
|
||||
__func__, (unsigned long long)ofs, len);
|
||||
|
||||
if (check_offs_len(mtd, ofs, len))
|
||||
return -EINVAL;
|
||||
|
||||
nand_get_device(mtd, FL_LOCKING);
|
||||
|
||||
/* Shift to get chip number */
|
||||
chipnr = ofs >> chip->chip_shift;
|
||||
|
||||
/*
|
||||
* Reset the chip.
|
||||
* If we want to check the WP through READ STATUS and check the bit 7
|
||||
* we must reset the chip
|
||||
* some operation can also clear the bit 7 of status register
|
||||
* eg. erase/program a locked block
|
||||
*/
|
||||
nand_reset(chip, chipnr);
|
||||
|
||||
chip->select_chip(mtd, chipnr);
|
||||
|
||||
/* Check, if it is write protected */
|
||||
if (nand_check_wp(mtd)) {
|
||||
pr_debug("%s: device is write protected!\n",
|
||||
__func__);
|
||||
status = MTD_ERASE_FAILED;
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Submit address of first page to lock */
|
||||
page = ofs >> chip->page_shift;
|
||||
chip->cmdfunc(mtd, NAND_CMD_LOCK, -1, page & chip->pagemask);
|
||||
|
||||
/* Call wait ready function */
|
||||
status = chip->waitfunc(mtd, chip);
|
||||
/* See if device thinks it succeeded */
|
||||
if (status & NAND_STATUS_FAIL) {
|
||||
pr_debug("%s: error status = 0x%08x\n",
|
||||
__func__, status);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = __nand_unlock(mtd, ofs, len, 0x1);
|
||||
|
||||
out:
|
||||
chip->select_chip(mtd, -1);
|
||||
nand_release_device(mtd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(nand_lock);
|
||||
|
||||
/**
|
||||
* nand_check_erased_buf - check if a buffer contains (almost) only 0xff data
|
||||
* @buf: buffer to test
|
||||
|
|
@ -3993,10 +3820,13 @@ static void nand_manufacturer_detect(struct nand_chip *chip)
|
|||
* nand_decode_ext_id() otherwise.
|
||||
*/
|
||||
if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
|
||||
chip->manufacturer.desc->ops->detect)
|
||||
chip->manufacturer.desc->ops->detect) {
|
||||
/* The 3rd id byte holds MLC / multichip data */
|
||||
chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]);
|
||||
chip->manufacturer.desc->ops->detect(chip);
|
||||
else
|
||||
} else {
|
||||
nand_decode_ext_id(chip);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -4036,7 +3866,7 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
|
|||
const struct nand_manufacturer *manufacturer;
|
||||
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||
int busw;
|
||||
int i, ret;
|
||||
int i;
|
||||
u8 *id_data = chip->id.data;
|
||||
u8 maf_id, dev_id;
|
||||
|
||||
|
|
@ -4066,7 +3896,7 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
|
|||
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
|
||||
|
||||
/* Read entire ID string */
|
||||
for (i = 0; i < 8; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(chip->id.data); i++)
|
||||
id_data[i] = chip->read_byte(mtd);
|
||||
|
||||
if (id_data[0] != maf_id || id_data[1] != dev_id) {
|
||||
|
|
@ -4075,7 +3905,7 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
chip->id.len = nand_id_len(id_data, 8);
|
||||
chip->id.len = nand_id_len(id_data, ARRAY_SIZE(chip->id.data));
|
||||
|
||||
/* Try to identify manufacturer */
|
||||
manufacturer = nand_get_manufacturer(maf_id);
|
||||
|
|
@ -4177,10 +4007,6 @@ ident_done:
|
|||
if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
|
||||
chip->cmdfunc = nand_command_lp;
|
||||
|
||||
ret = nand_manufacturer_init(chip);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
|
||||
maf_id, dev_id);
|
||||
|
||||
|
|
@ -4388,23 +4214,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Initialize the ->data_interface field. */
|
||||
ret = nand_init_data_interface(chip);
|
||||
if (ret)
|
||||
goto err_nand_init;
|
||||
|
||||
/*
|
||||
* Setup the data interface correctly on the chip and controller side.
|
||||
* This explicit call to nand_setup_data_interface() is only required
|
||||
* for the first die, because nand_reset() has been called before
|
||||
* ->data_interface and ->default_onfi_timing_mode were set.
|
||||
* For the other dies, nand_reset() will automatically switch to the
|
||||
* best mode for us.
|
||||
*/
|
||||
ret = nand_setup_data_interface(chip, 0);
|
||||
if (ret)
|
||||
goto err_nand_init;
|
||||
|
||||
nand_maf_id = chip->id.data[0];
|
||||
nand_dev_id = chip->id.data[1];
|
||||
|
||||
|
|
@ -4434,12 +4243,6 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
|
|||
mtd->size = i * chip->chipsize;
|
||||
|
||||
return 0;
|
||||
|
||||
err_nand_init:
|
||||
/* Free manufacturer priv data. */
|
||||
nand_manufacturer_cleanup(chip);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(nand_scan_ident);
|
||||
|
||||
|
|
@ -4826,55 +4629,60 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct nand_ecc_ctrl *ecc = &chip->ecc;
|
||||
struct nand_buffers *nbuf = NULL;
|
||||
int ret;
|
||||
int ret, i;
|
||||
|
||||
/* New bad blocks should be marked in OOB, flash-based BBT, or both */
|
||||
if (WARN_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
|
||||
!(chip->bbt_options & NAND_BBT_USE_FLASH))) {
|
||||
ret = -EINVAL;
|
||||
goto err_ident;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (invalid_ecc_page_accessors(chip)) {
|
||||
pr_err("Invalid ECC page accessors setup\n");
|
||||
ret = -EINVAL;
|
||||
goto err_ident;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(chip->options & NAND_OWN_BUFFERS)) {
|
||||
nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL);
|
||||
if (!nbuf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_ident;
|
||||
}
|
||||
if (!nbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL);
|
||||
if (!nbuf->ecccalc) {
|
||||
ret = -ENOMEM;
|
||||
goto err_free;
|
||||
goto err_free_nbuf;
|
||||
}
|
||||
|
||||
nbuf->ecccode = kmalloc(mtd->oobsize, GFP_KERNEL);
|
||||
if (!nbuf->ecccode) {
|
||||
ret = -ENOMEM;
|
||||
goto err_free;
|
||||
goto err_free_nbuf;
|
||||
}
|
||||
|
||||
nbuf->databuf = kmalloc(mtd->writesize + mtd->oobsize,
|
||||
GFP_KERNEL);
|
||||
if (!nbuf->databuf) {
|
||||
ret = -ENOMEM;
|
||||
goto err_free;
|
||||
goto err_free_nbuf;
|
||||
}
|
||||
|
||||
chip->buffers = nbuf;
|
||||
} else {
|
||||
if (!chip->buffers) {
|
||||
ret = -ENOMEM;
|
||||
goto err_ident;
|
||||
}
|
||||
} else if (!chip->buffers) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/*
|
||||
* FIXME: some NAND manufacturer drivers expect the first die to be
|
||||
* selected when manufacturer->init() is called. They should be fixed
|
||||
* to explictly select the relevant die when interacting with the NAND
|
||||
* chip.
|
||||
*/
|
||||
chip->select_chip(mtd, 0);
|
||||
ret = nand_manufacturer_init(chip);
|
||||
chip->select_chip(mtd, -1);
|
||||
if (ret)
|
||||
goto err_free_nbuf;
|
||||
|
||||
/* Set the internal oob buffer location, just after the page data */
|
||||
chip->oob_poi = chip->buffers->databuf + mtd->writesize;
|
||||
|
||||
|
|
@ -4896,7 +4704,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
WARN(1, "No oob scheme defined for oobsize %d\n",
|
||||
mtd->oobsize);
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4911,7 +4719,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
if (!ecc->calculate || !ecc->correct || !ecc->hwctl) {
|
||||
WARN(1, "No ECC functions supplied; hardware ECC not possible\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
if (!ecc->read_page)
|
||||
ecc->read_page = nand_read_page_hwecc_oob_first;
|
||||
|
|
@ -4943,7 +4751,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
ecc->write_page == nand_write_page_hwecc)) {
|
||||
WARN(1, "No ECC functions supplied; hardware ECC not possible\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
/* Use standard syndrome read/write page function? */
|
||||
if (!ecc->read_page)
|
||||
|
|
@ -4963,7 +4771,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
if (!ecc->strength) {
|
||||
WARN(1, "Driver must set ecc.strength when using hardware ECC\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -4976,7 +4784,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
ret = nand_set_ecc_soft_ops(mtd);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -4984,7 +4792,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
if (!ecc->read_page || !ecc->write_page) {
|
||||
WARN(1, "No ECC functions supplied; on-die ECC not possible\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
if (!ecc->read_oob)
|
||||
ecc->read_oob = nand_read_oob_std;
|
||||
|
|
@ -5008,7 +4816,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
default:
|
||||
WARN(1, "Invalid NAND_ECC_MODE %d\n", ecc->mode);
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
|
||||
/* For many systems, the standard OOB write also works for raw */
|
||||
|
|
@ -5029,13 +4837,13 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
if (ecc->steps * ecc->size != mtd->writesize) {
|
||||
WARN(1, "Invalid ECC parameters\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
ecc->total = ecc->steps * ecc->bytes;
|
||||
if (ecc->total > mtd->oobsize) {
|
||||
WARN(1, "Total number of ECC bytes exceeded oobsize\n");
|
||||
ret = -EINVAL;
|
||||
goto err_free;
|
||||
goto err_nand_manuf_cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -5117,6 +4925,21 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
if (!mtd->bitflip_threshold)
|
||||
mtd->bitflip_threshold = DIV_ROUND_UP(mtd->ecc_strength * 3, 4);
|
||||
|
||||
/* Initialize the ->data_interface field. */
|
||||
ret = nand_init_data_interface(chip);
|
||||
if (ret)
|
||||
goto err_nand_manuf_cleanup;
|
||||
|
||||
/* Enter fastest possible mode on all dies. */
|
||||
for (i = 0; i < chip->numchips; i++) {
|
||||
chip->select_chip(mtd, i);
|
||||
ret = nand_setup_data_interface(chip, i);
|
||||
chip->select_chip(mtd, -1);
|
||||
|
||||
if (ret)
|
||||
goto err_nand_data_iface_cleanup;
|
||||
}
|
||||
|
||||
/* Check, if we should skip the bad block table scan */
|
||||
if (chip->options & NAND_SKIP_BBTSCAN)
|
||||
return 0;
|
||||
|
|
@ -5124,10 +4947,17 @@ int nand_scan_tail(struct mtd_info *mtd)
|
|||
/* Build bad block table */
|
||||
ret = chip->scan_bbt(mtd);
|
||||
if (ret)
|
||||
goto err_free;
|
||||
goto err_nand_data_iface_cleanup;
|
||||
|
||||
return 0;
|
||||
|
||||
err_free:
|
||||
err_nand_data_iface_cleanup:
|
||||
nand_release_data_interface(chip);
|
||||
|
||||
err_nand_manuf_cleanup:
|
||||
nand_manufacturer_cleanup(chip);
|
||||
|
||||
err_free_nbuf:
|
||||
if (nbuf) {
|
||||
kfree(nbuf->databuf);
|
||||
kfree(nbuf->ecccode);
|
||||
|
|
@ -5135,12 +4965,6 @@ err_free:
|
|||
kfree(nbuf);
|
||||
}
|
||||
|
||||
err_ident:
|
||||
/* Clean up nand_scan_ident(). */
|
||||
|
||||
/* Free manufacturer priv data. */
|
||||
nand_manufacturer_cleanup(chip);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(nand_scan_tail);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/bbm.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_bch.h>
|
||||
#include <linux/bch.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <asm/byteorder.h>
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ static void hynix_nand_extract_ecc_requirements(struct nand_chip *chip,
|
|||
* The ECC requirements field meaning depends on the
|
||||
* NAND technology.
|
||||
*/
|
||||
u8 nand_tech = chip->id.data[5] & 0x3;
|
||||
u8 nand_tech = chip->id.data[5] & 0x7;
|
||||
|
||||
if (nand_tech < 3) {
|
||||
/* > 26nm, reference: H27UBG8T2A datasheet */
|
||||
|
|
@ -533,7 +533,7 @@ static void hynix_nand_extract_scrambling_requirements(struct nand_chip *chip,
|
|||
if (nand_tech > 0)
|
||||
chip->options |= NAND_NEED_SCRAMBLING;
|
||||
} else {
|
||||
nand_tech = chip->id.data[5] & 0x3;
|
||||
nand_tech = chip->id.data[5] & 0x7;
|
||||
|
||||
/* < 32nm */
|
||||
if (nand_tech > 2)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#define LP_OPTIONS 0
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
static int macronix_nand_init(struct nand_chip *chip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
/*
|
||||
* Special Micron status bit that indicates when the block has been
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
static void samsung_nand_decode_id(struct nand_chip *chip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
static const struct nand_data_interface onfi_sdr_timings[] = {
|
||||
/* Mode 0 */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
|
||||
static void toshiba_nand_decode_id(struct nand_chip *chip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_bch.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/delay.h>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/ndfc.h>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/err.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#define REG_FMICSR 0x00
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include <linux/jiffies.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/omap-dma.h>
|
||||
#include <linux/io.h>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
|
@ -54,13 +54,16 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
|||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
void __iomem *io_base = chip->IO_ADDR_R;
|
||||
#if __LINUX_ARM_ARCH__ >= 5
|
||||
uint64_t *buf64;
|
||||
#endif
|
||||
int i = 0;
|
||||
|
||||
while (len && (unsigned long)buf & 7) {
|
||||
*buf++ = readb(io_base);
|
||||
len--;
|
||||
}
|
||||
#if __LINUX_ARM_ARCH__ >= 5
|
||||
buf64 = (uint64_t *)buf;
|
||||
while (i < len/8) {
|
||||
/*
|
||||
|
|
@ -74,6 +77,10 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
|||
buf64[i++] = x;
|
||||
}
|
||||
i *= 8;
|
||||
#else
|
||||
readsl(io_base, buf, len/4);
|
||||
i = len / 4 * 4;
|
||||
#endif
|
||||
while (i < len)
|
||||
buf[i++] = readb(io_base);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
|
|
@ -112,14 +112,19 @@ static int oxnas_nand_probe(struct platform_device *pdev)
|
|||
if (count > 1)
|
||||
return -EINVAL;
|
||||
|
||||
clk_prepare_enable(oxnas->clk);
|
||||
err = clk_prepare_enable(oxnas->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
device_reset_optional(&pdev->dev);
|
||||
|
||||
for_each_child_of_node(np, nand_np) {
|
||||
chip = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip),
|
||||
GFP_KERNEL);
|
||||
if (!chip)
|
||||
return -ENOMEM;
|
||||
if (!chip) {
|
||||
err = -ENOMEM;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
|
||||
chip->controller = &oxnas->base;
|
||||
|
||||
|
|
@ -139,12 +144,12 @@ static int oxnas_nand_probe(struct platform_device *pdev)
|
|||
/* Scan to find existence of the device */
|
||||
err = nand_scan(mtd, 1);
|
||||
if (err)
|
||||
return err;
|
||||
goto err_clk_unprepare;
|
||||
|
||||
err = mtd_device_register(mtd, NULL, 0);
|
||||
if (err) {
|
||||
nand_release(mtd);
|
||||
return err;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
|
||||
oxnas->chips[nchips] = chip;
|
||||
|
|
@ -152,12 +157,18 @@ static int oxnas_nand_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
/* Exit if no chips found */
|
||||
if (!nchips)
|
||||
return -ENODEV;
|
||||
if (!nchips) {
|
||||
err = -ENODEV;
|
||||
goto err_clk_unprepare;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, oxnas);
|
||||
|
||||
return 0;
|
||||
|
||||
err_clk_unprepare:
|
||||
clk_disable_unprepare(oxnas->clk);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int oxnas_nand_remove(struct platform_device *pdev)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
struct plat_nand_data {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -10,7 +10,7 @@
|
|||
#include <linux/pci.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
#include <linux/of_device.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#include <linux/string.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/sh_flctl.h>
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
|
|||
|
||||
dma_addr = dma_map_single(chan->device->dev, buf, len, dir);
|
||||
|
||||
if (dma_addr)
|
||||
if (!dma_mapping_error(chan->device->dev, dma_addr))
|
||||
desc = dmaengine_prep_slave_single(chan, dma_addr, len,
|
||||
tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
||||
|
||||
|
|
@ -1141,8 +1141,8 @@ static int flctl_probe(struct platform_device *pdev)
|
|||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
if (irq < 0) {
|
||||
dev_err(&pdev->dev, "failed to get flste irq data\n");
|
||||
return -ENXIO;
|
||||
dev_err(&pdev->dev, "failed to get flste irq data: %d\n", irq);
|
||||
return irq;
|
||||
}
|
||||
|
||||
ret = devm_request_irq(&pdev->dev, irq, flctl_handle_flste, IRQF_SHARED,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/sharpsl.h>
|
||||
|
|
@ -183,7 +183,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
|
|||
/* Register the partitions */
|
||||
mtd->name = "sharpsl-nand";
|
||||
|
||||
err = mtd_device_parse_register(mtd, NULL, NULL,
|
||||
err = mtd_device_parse_register(mtd, data->part_parsers, NULL,
|
||||
data->partitions, data->nr_partitions);
|
||||
if (err)
|
||||
goto err_add;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sizes.h>
|
||||
#include "sm_common.h"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include <linux/of_device.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
|
|
@ -2212,7 +2212,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
goto out_ahb_clk_unprepare;
|
||||
|
||||
nfc->reset = devm_reset_control_get_optional(dev, "ahb");
|
||||
nfc->reset = devm_reset_control_get_optional_exclusive(dev, "ahb");
|
||||
if (IS_ERR(nfc->reset)) {
|
||||
ret = PTR_ERR(nfc->reset);
|
||||
goto out_mod_clk_unprepare;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/dmaengine.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -440,7 +440,9 @@ static int tmio_probe(struct platform_device *dev)
|
|||
goto err_irq;
|
||||
|
||||
/* Register the partitions */
|
||||
retval = mtd_device_parse_register(mtd, NULL, NULL,
|
||||
retval = mtd_device_parse_register(mtd,
|
||||
data ? data->part_parsers : NULL,
|
||||
NULL,
|
||||
data ? data->partition : NULL,
|
||||
data ? data->num_partitions : 0);
|
||||
if (!retval)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/io.h>
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
|
@ -814,12 +813,14 @@ static int vf610_nfc_suspend(struct device *dev)
|
|||
|
||||
static int vf610_nfc_resume(struct device *dev)
|
||||
{
|
||||
int err;
|
||||
|
||||
struct mtd_info *mtd = dev_get_drvdata(dev);
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
|
||||
clk_prepare_enable(nfc->clk);
|
||||
err = clk_prepare_enable(nfc->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
vf610_nfc_preinit_controller(nfc);
|
||||
vf610_nfc_init_controller(nfc);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright © 2016 Hauke Mehrtens <hauke@hauke-m.de>
|
||||
*/
|
||||
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_platform.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nftl.h>
|
||||
#include <linux/mtd/blktrans.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/nftl.h>
|
||||
|
||||
#define SECTORSIZE 512
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/mtd/blktrans.h>
|
||||
|
||||
struct ssfdcr_record {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
#include <linux/moduleparam.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/rawnand.h>
|
||||
#include <linux/slab.h>
|
||||
#include "mtd_test.h"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue