mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 19:06:14 +00:00
mtd: nand: jz4740: use the mtd instance embedded in struct nand_chip
struct nand_chip now embeds an mtd device. Make use of this mtd instance. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
fa100163d3
commit
d25cc7abb1
1 changed files with 4 additions and 5 deletions
|
@ -59,7 +59,6 @@
|
||||||
#define JZ_NAND_MEM_ADDR_OFFSET 0x10000
|
#define JZ_NAND_MEM_ADDR_OFFSET 0x10000
|
||||||
|
|
||||||
struct jz_nand {
|
struct jz_nand {
|
||||||
struct mtd_info mtd;
|
|
||||||
struct nand_chip chip;
|
struct nand_chip chip;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct resource *mem;
|
struct resource *mem;
|
||||||
|
@ -76,7 +75,7 @@ struct jz_nand {
|
||||||
|
|
||||||
static inline struct jz_nand *mtd_to_jz_nand(struct mtd_info *mtd)
|
static inline struct jz_nand *mtd_to_jz_nand(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
return container_of(mtd, struct jz_nand, mtd);
|
return container_of(mtd_to_nand(mtd), struct jz_nand, chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr)
|
static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr)
|
||||||
|
@ -334,8 +333,8 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
|
||||||
char gpio_name[9];
|
char gpio_name[9];
|
||||||
char res_name[6];
|
char res_name[6];
|
||||||
uint32_t ctrl;
|
uint32_t ctrl;
|
||||||
struct mtd_info *mtd = &nand->mtd;
|
|
||||||
struct nand_chip *chip = &nand->chip;
|
struct nand_chip *chip = &nand->chip;
|
||||||
|
struct mtd_info *mtd = nand_to_mtd(chip);
|
||||||
|
|
||||||
/* Request GPIO port. */
|
/* Request GPIO port. */
|
||||||
gpio = JZ_GPIO_MEM_CS0 + bank - 1;
|
gpio = JZ_GPIO_MEM_CS0 + bank - 1;
|
||||||
|
@ -432,8 +431,8 @@ static int jz_nand_probe(struct platform_device *pdev)
|
||||||
goto err_iounmap_mmio;
|
goto err_iounmap_mmio;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtd = &nand->mtd;
|
|
||||||
chip = &nand->chip;
|
chip = &nand->chip;
|
||||||
|
mtd = nand_to_mtd(chip);
|
||||||
mtd->priv = chip;
|
mtd->priv = chip;
|
||||||
mtd->dev.parent = &pdev->dev;
|
mtd->dev.parent = &pdev->dev;
|
||||||
mtd->name = "jz4740-nand";
|
mtd->name = "jz4740-nand";
|
||||||
|
@ -543,7 +542,7 @@ static int jz_nand_remove(struct platform_device *pdev)
|
||||||
struct jz_nand *nand = platform_get_drvdata(pdev);
|
struct jz_nand *nand = platform_get_drvdata(pdev);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
nand_release(&nand->mtd);
|
nand_release(nand_to_mtd(&nand->chip));
|
||||||
|
|
||||||
/* Deassert and disable all chips */
|
/* Deassert and disable all chips */
|
||||||
writel(0, nand->base + JZ_REG_NAND_CTRL);
|
writel(0, nand->base + JZ_REG_NAND_CTRL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue