mtd: nand: sunxi: 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:
Родитель
0324e6469a
Коммит
32e9f2d8dd
|
@ -234,7 +234,6 @@ struct sunxi_nand_hw_ecc {
|
||||||
struct sunxi_nand_chip {
|
struct sunxi_nand_chip {
|
||||||
struct list_head node;
|
struct list_head node;
|
||||||
struct nand_chip nand;
|
struct nand_chip nand;
|
||||||
struct mtd_info mtd;
|
|
||||||
unsigned long clk_rate;
|
unsigned long clk_rate;
|
||||||
u32 timing_cfg;
|
u32 timing_cfg;
|
||||||
u32 timing_ctl;
|
u32 timing_ctl;
|
||||||
|
@ -991,6 +990,7 @@ static int sunxi_nand_chip_set_timings(struct sunxi_nand_chip *chip,
|
||||||
static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
|
static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
|
||||||
struct device_node *np)
|
struct device_node *np)
|
||||||
{
|
{
|
||||||
|
struct mtd_info *mtd = nand_to_mtd(&chip->nand);
|
||||||
const struct nand_sdr_timings *timings;
|
const struct nand_sdr_timings *timings;
|
||||||
int ret;
|
int ret;
|
||||||
int mode;
|
int mode;
|
||||||
|
@ -1008,12 +1008,11 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
|
||||||
|
|
||||||
feature[0] = mode;
|
feature[0] = mode;
|
||||||
for (i = 0; i < chip->nsels; i++) {
|
for (i = 0; i < chip->nsels; i++) {
|
||||||
chip->nand.select_chip(&chip->mtd, i);
|
chip->nand.select_chip(mtd, i);
|
||||||
ret = chip->nand.onfi_set_features(&chip->mtd,
|
ret = chip->nand.onfi_set_features(mtd, &chip->nand,
|
||||||
&chip->nand,
|
|
||||||
ONFI_FEATURE_ADDR_TIMING_MODE,
|
ONFI_FEATURE_ADDR_TIMING_MODE,
|
||||||
feature);
|
feature);
|
||||||
chip->nand.select_chip(&chip->mtd, -1);
|
chip->nand.select_chip(mtd, -1);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1336,7 +1335,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
|
||||||
nand->write_buf = sunxi_nfc_write_buf;
|
nand->write_buf = sunxi_nfc_write_buf;
|
||||||
nand->read_byte = sunxi_nfc_read_byte;
|
nand->read_byte = sunxi_nfc_read_byte;
|
||||||
|
|
||||||
mtd = &chip->mtd;
|
mtd = nand_to_mtd(nand);
|
||||||
mtd->dev.parent = dev;
|
mtd->dev.parent = dev;
|
||||||
mtd->priv = nand;
|
mtd->priv = nand;
|
||||||
|
|
||||||
|
@ -1407,7 +1406,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
|
||||||
while (!list_empty(&nfc->chips)) {
|
while (!list_empty(&nfc->chips)) {
|
||||||
chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip,
|
chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip,
|
||||||
node);
|
node);
|
||||||
nand_release(&chip->mtd);
|
nand_release(nand_to_mtd(&chip->nand));
|
||||||
sunxi_nand_ecc_cleanup(&chip->nand.ecc);
|
sunxi_nand_ecc_cleanup(&chip->nand.ecc);
|
||||||
list_del(&chip->node);
|
list_del(&chip->node);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче