RE: [PATCH v3 1/4] NAND: FSL-UPM: add multi chip support
From: Singh, Vimal <hidden>
Date: 2009-03-25 10:52:04
+static void fun_select_chip(struct mtd_info *mtd, int chip_nr)
+{
+ struct nand_chip *chip =3D mtd->priv;
+ struct fsl_upm_nand *fun =3D to_fsl_upm_nand(mtd);
+
+ if (chip_nr =3D=3D -1) {
+ chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 |=20
NAND_CTRL_CHANGE);
+ } else if (chip_nr >=3D 0) {
+ fun->chip_number =3D chip_nr;
+ chip->IO_ADDR_R =3D chip->IO_ADDR_W =3D
+ fun->io_base + chip_nr * fun->chip_offset;
+ } else {
+ BUG();
+ }braces are not required here...
+ prop =3D of_get_property(ofdev->node, "num-chips", &size);
+ if (prop && size =3D=3D sizeof(uint32_t)) {
+ fun->num_chips =3D *prop;
+ if (fun->num_chips >=3D NAND_MAX_CHIPS) {
+ dev_err(&ofdev->dev, "too much chips");
+ ret =3D -EINVAL;
+ goto err1;
+ }
+ } else {
+ fun->num_chips =3D 1;
+ }ditto...=