1 --- a/drivers/mtd/nand/rb750_nand.c
2 +++ b/drivers/mtd/nand/rb750_nand.c
5 * NAND flash driver for the MikroTik RouterBOARD 750
7 - * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
8 + * Copyright (C) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published
12 * by the Free Software Foundation.
15 -#include <linux/init.h>
16 +#include <linux/kernel.h>
17 +#include <linux/module.h>
18 #include <linux/mtd/nand.h>
19 #include <linux/mtd/mtd.h>
20 #include <linux/mtd/partitions.h>
23 #include <linux/slab.h>
25 -#include <asm/mach-ar71xx/ar71xx.h>
26 -#include <asm/mach-ar71xx/mach-rb750.h>
27 +#include <asm/mach-ath79/ar71xx_regs.h>
28 +#include <asm/mach-ath79/ath79.h>
29 +#include <asm/mach-ath79/mach-rb750.h>
31 #define DRV_NAME "rb750-nand"
32 #define DRV_VERSION "0.1.0"
33 @@ -73,7 +75,7 @@ static struct mtd_partition rb750_nand_p
35 static void rb750_nand_write(const u8 *buf, unsigned len)
37 - void __iomem *base = ar71xx_gpio_base;
38 + void __iomem *base = ath79_gpio_base;
42 @@ -107,7 +109,7 @@ static void rb750_nand_write(const u8 *b
43 static int rb750_nand_read_verify(u8 *read_buf, unsigned len,
46 - void __iomem *base = ar71xx_gpio_base;
47 + void __iomem *base = ath79_gpio_base;
50 for (i = 0; i < len; i++) {
51 @@ -136,7 +138,7 @@ static int rb750_nand_read_verify(u8 *re
53 static void rb750_nand_select_chip(struct mtd_info *mtd, int chip)
55 - void __iomem *base = ar71xx_gpio_base;
56 + void __iomem *base = ath79_gpio_base;
60 @@ -145,9 +147,7 @@ static void rb750_nand_select_chip(struc
62 rb750_latch_change(RB750_LVC573_LE, 0);
64 - /* disable alternate functions */
65 - ar71xx_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE,
66 - AR724X_GPIO_FUNC_SPI_EN);
67 + rb750_nand_pins_enable();
69 /* set input mode for data lines */
70 t = __raw_readl(base + AR71XX_GPIO_REG_OE);
71 @@ -172,9 +172,7 @@ static void rb750_nand_select_chip(struc
72 __raw_writel(t | RB750_NAND_IO0 | RB750_NAND_RDY,
73 base + AR71XX_GPIO_REG_OE);
75 - /* restore alternate functions */
76 - ar71xx_gpio_function_setup(AR724X_GPIO_FUNC_SPI_EN,
77 - AR724X_GPIO_FUNC_JTAG_DISABLE);
78 + rb750_nand_pins_disable();
81 rb750_latch_change(0, RB750_LVC573_LE);
82 @@ -183,7 +181,7 @@ static void rb750_nand_select_chip(struc
84 static int rb750_nand_dev_ready(struct mtd_info *mtd)
86 - void __iomem *base = ar71xx_gpio_base;
87 + void __iomem *base = ath79_gpio_base;
89 return !!(__raw_readl(base + AR71XX_GPIO_REG_IN) & RB750_NAND_RDY);
91 @@ -192,7 +190,7 @@ static void rb750_nand_cmd_ctrl(struct m
94 if (ctrl & NAND_CTRL_CHANGE) {
95 - void __iomem *base = ar71xx_gpio_base;
96 + void __iomem *base = ath79_gpio_base;
99 t = __raw_readl(base + AR71XX_GPIO_REG_OUT);
100 @@ -236,7 +234,7 @@ static int rb750_nand_verify_buf(struct
102 static void __init rb750_nand_gpio_init(void)
104 - void __iomem *base = ar71xx_gpio_base;
105 + void __iomem *base = ath79_gpio_base;
109 @@ -306,12 +304,8 @@ static int __devinit rb750_nand_probe(st
110 goto err_set_drvdata;
113 -#ifdef CONFIG_MTD_PARTITIONS
114 - ret = add_mtd_partitions(&info->mtd, rb750_nand_partitions,
115 + ret = mtd_device_register(&info->mtd, rb750_nand_partitions,
116 ARRAY_SIZE(rb750_nand_partitions));
118 - ret = add_mtd_device(&info->mtd);
121 goto err_release_nand;