lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151208172641.4e1f935a@bbrezillon>
Date:	Tue, 8 Dec 2015 17:26:41 +0100
From:	Boris Brezillon <boris.brezillon@...e-electrons.com>
To:	Harvey Hunt <harvey.hunt@...tec.com>
Cc:	<linux-mtd@...ts.infradead.org>,
	Zubair Lutfullah Kakakhel <Zubair.Kakakhel@...tec.com>,
	<linux-kernel@...r.kernel.org>, Alex Smith <alex.smith@...tec.com>,
	Brian Norris <computersforpeace@...il.com>,
	"David Woodhouse" <dwmw2@...radead.org>
Subject: Re: [PATCH v9 2/3] mtd: nand: jz4780: driver for NAND devices on
 JZ4780 SoCs

On Tue, 8 Dec 2015 16:03:55 +0000
Harvey Hunt <harvey.hunt@...tec.com> wrote:

> >
> > static void jz4780_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
> > 				 unsigned int ctrl)
> > {
> > 	struct jz4780_nand_chip *nand = to_jz4780_nand_chip(mtd);
> > 	struct jz4780_nand_controller *nfc = to_jz4780_nand_controller(nand->chip.controller);
> > 	struct jz4780_nand_cs *cs;
> >
> > 	if (WARN_ON(nfc->selected < 0))
> > 		return;
> >
> > 	cs = &nfc->cs[nfc->selected];
> >
> > 	if (ctrl & NAND_CTRL_CHANGE) {
> > 		if (cmd != NAND_CMD_NONE) {
> > 			if (ctrl & NAND_ALE)
> > 				writeb(cmd, cs->base + OFFSET_ADDR);
> > 			else if (ctrl & NAND_CLE)
> > 				writeb(cmd, cs->base + OFFSET_CMD);
> > 		}
> >
> > 		jz4780_nemc_assert(nfc->dev, cs->bank, ctrl & NAND_NCE);
> > 	}
> > }
> >
> 
> Okay, I understand your point now. I would also have to implement the 
> read/write functions to replace the defaults, correct? If so, it feels 
> strange to add functions to reimplement the default ones.
> 

Actually it should be something like this, because NAND_CTRL_CHANGE is
cleared after the first address cycle.

static void jz4780_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 				 unsigned int ctrl)
{
	struct jz4780_nand_chip *nand = to_jz4780_nand_chip(mtd);
	struct jz4780_nand_controller *nfc = to_jz4780_nand_controller(nand->chip.controller);
	struct jz4780_nand_cs *cs;

	if (WARN_ON(nfc->selected < 0))
		return;

	cs = &nfc->cs[nfc->selected];

	jz4780_nemc_assert(nfc->dev, cs->bank, ctrl & NAND_NCE);

 	if (cmd == NAND_CMD_NONE)
		return;

	if (ctrl & NAND_ALE)
		writeb(cmd, cs->base + OFFSET_ADDR);
 	else if (ctrl & NAND_CLE)
 		writeb(cmd, cs->base + OFFSET_CMD);
}

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ