Skip to content

Commit

Permalink
mtd: rawnand: gpio: Inherit from nand_controller
Browse files Browse the repository at this point in the history
Inherit from nand_controller so we don't rely on the
nand_chip.legacy.dummy_controller field.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200603150746.1423257-2-boris.brezillon@collabora.com
  • Loading branch information
Boris Brezillon authored and Miquel Raynal committed Jun 26, 2020
1 parent 8fac41e commit b4c7196
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/nand/raw/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/of_address.h>

struct gpiomtd {
struct nand_controller base;
void __iomem *io_sync;
struct nand_chip nand_chip;
struct gpio_nand_platdata plat;
Expand Down Expand Up @@ -273,13 +274,15 @@ static int gpio_nand_probe(struct platform_device *pdev)
if (gpiomtd->rdy)
chip->legacy.dev_ready = gpio_nand_devready;

nand_controller_init(&gpiomtd->base);
nand_set_flash_node(chip, pdev->dev.of_node);
chip->legacy.IO_ADDR_W = chip->legacy.IO_ADDR_R;
chip->ecc.mode = NAND_ECC_SOFT;
chip->ecc.algo = NAND_ECC_HAMMING;
chip->options = gpiomtd->plat.options;
chip->legacy.chip_delay = gpiomtd->plat.chip_delay;
chip->legacy.cmd_ctrl = gpio_nand_cmd_ctrl;
chip->controller = &gpiomtd->base;

mtd = nand_to_mtd(chip);
mtd->dev.parent = dev;
Expand Down

0 comments on commit b4c7196

Please sign in to comment.