[PATCH v3 1/4] NAND: FSL-UPM: add multi chip support

Singh, Vimal vimalsingh at ti.com
Wed Mar 25 06:43:38 EDT 2009


> +static void fun_select_chip(struct mtd_info *mtd, int chip_nr)
> +{
> +       struct nand_chip *chip = mtd->priv;
> +       struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
> +
> +       if (chip_nr == -1) {
> +               chip->cmd_ctrl(mtd, NAND_CMD_NONE, 0 | 
> NAND_CTRL_CHANGE);
> +       } else if (chip_nr >= 0) {
> +               fun->chip_number = chip_nr;
> +               chip->IO_ADDR_R = chip->IO_ADDR_W =
> +                       fun->io_base + chip_nr * fun->chip_offset;
> +       } else {
> +               BUG();
> +       }
braces are not required here...


> +       prop = of_get_property(ofdev->node, "num-chips", &size);
> +       if (prop && size == sizeof(uint32_t)) {
> +               fun->num_chips = *prop;
> +               if (fun->num_chips >= NAND_MAX_CHIPS) {
> +                       dev_err(&ofdev->dev, "too much chips");
> +                       ret = -EINVAL;
> +                       goto err1;
> +               }
> +       } else {
> +               fun->num_chips = 1;
> +       }
ditto...


More information about the linux-mtd mailing list