On Thursday 28 December 2017 11:42 AM, Jagan Teki wrote:
[...]
> +static const struct mtd_ops spi_nor_mtd_ops = {
> +     .read   = spi_nor_mread,
> +     .erase  = spi_nor_merase,
> +};
> +

Wondering why spi_nor_mwrite is not hooked up here?

> +U_BOOT_DRIVER(spinor_mtd) = {
> +     .name           = "spinor_mtd",
> +     .id             = UCLASS_MTD,
> +     .ops            = &spi_nor_mtd_ops,
> +     .probe          = spi_nor_mtd_probe,
> +};
> +
> +U_BOOT_DRIVER(spinor) = {
> +     .name   = "spinor",
> +     .id     = UCLASS_SPI_NOR,
> +};
> +
> +UCLASS_DRIVER(spinor) = {
> +     .id             = UCLASS_SPI_NOR,
> +     .name           = "spinor",
> +     .flags          = DM_UC_FLAG_SEQ_ALIAS,
> +     .per_device_auto_alloc_size = sizeof(struct spi_nor_uclass_priv),
> +};

[...]

> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> new file mode 100644
> index 0000000..e1688e2
> --- /dev/null
> +++ b/include/linux/mtd/spi-nor.h
> @@ -0,0 +1,217 @@
[...]
> +struct spi_nor {
> +     struct udevice          *dev;
> +     const char              *name;
> +     u8                      init_done;
> +     u32                     page_size;
> +     u8                      addr_width;
> +     u8                      erase_opcode;
> +     u8                      read_opcode;
> +     u8                      read_dummy;
> +     u8                      program_opcode;
> +     u32                     max_write_size;
> +     u32                     flags;
> +     u8                      mode;

> +     u8                      read_mode;

Where is this field used? Shouldn't this field carry single/dual/quad
mode information?

> +     u8                      cmd_buf[SNOR_MAX_CMD_SIZE];
> +
> +     void *memory_map;
> +};
> +
> +struct spi_nor_ops {
> +     int (*read_reg)(struct udevice *dev, u8 cmd, u8 *val, int len);
> +     int (*write_reg)(struct udevice *dev, u8 cmd, u8 *data, int len);
> +
> +     int (*read)(struct udevice *dev, loff_t from, size_t len,
> +                 u_char *buf);
> +     int (*write)(struct udevice *dev, loff_t to, size_t len,
> +                  const u_char *buf);
> +};
> +
> +#define spi_nor_get_ops(dev) ((struct spi_nor_ops *)(dev)->driver->ops)
> +
> +int spi_nor_merase(struct udevice *dev, struct erase_info *instr);
> +int spi_nor_mread(struct udevice *dev, loff_t from, size_t len,
> +               size_t *retlen, u_char *buf);
> +
> +int spi_nor_scan(struct spi_nor *nor);
> +int spi_nor_bind(struct udevice *dev, struct spi_nor *nor);
> +
> +struct spi_nor *find_spi_nor_device(int dev_num);
> +int get_spi_nor_num(void);
> +struct spi_nor *spi_nor_get_spi_nor_dev(struct udevice *dev);
> +struct mtd_info *spi_nor_get_mtd_info(struct spi_nor *nor);
> +
> +#endif /* __MTD_SPI_NOR_H */
> 

-- 
Regards
Vignesh
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to