[U-Boot] [PATCH v2 4/4] Flex-OneNAND boundary setting command

Scott Wood scottwood at freescale.com
Mon Mar 9 22:38:55 CET 2009


On Sun, Mar 08, 2009 at 12:17:36PM +0530, Rohit Hagargundgi wrote:
> +static inline int onenand_blocksize(loff_t ofs)
> +{
> +	struct onenand_chip *this = mtd->priv;
> +	int i;
> +
> +	if (!FLEXONENAND(this))
> +		return mtd->erasesize;
> +
> +	i = flexonenand_region(mtd, ofs);
> +	return mtd->eraseregions[i].erasesize;

Can we define the interface to the onenand code such that the caller
doesn't need to care what type of onenand it is, and non-flex will simply
appear to have one region?

> +		if (strncmp(cmd, "setboundary", 11) == 0) {
> +			int die, bdry, lock = 0;
> +
> +			if (argc < 4)
> +				goto usage;
> +
> +			die = (int) simple_strtoul(argv[2], NULL, 0);
> +			bdry = (int) simple_strtoul(argv[3], NULL, 0);
> +
> +			if (argc == 5 && strncmp(argv[4], "LOCK", 4) == 0)
> +				lock = 1;
> +
> +			return flexonenand_set_boundary(mtd, die, bdry, lock);
> +		}

What happens if the user runs the setboundary command on non-flex
onenand?  Does it fail gracefully?

> +
>  		break;
>  	}
>  
> @@ -478,9 +514,11 @@ U_BOOT_CMD(
>  	"onenand write[.oob] addr off size\n"
>  	"    read/write 'size' bytes starting at offset 'off'\n"
>  	"    to/from memory address 'addr', skipping bad blocks.\n"
> -	"onenand erase [force] [off size] - erase 'size' bytes from\n"
> +	"onenand erase [force] [off size] - erase 'size' bytes from off\n"

Quotes around 'off', as is done elsewhere in the help text.

-Scott


More information about the U-Boot mailing list