static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) { struct platform_device *dev = mtd_to_platdev(mtd); void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); while (len--) *buf++ = __raw_readl(ndfdtr); }
static int txx9ndfmc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len) { struct platform_device *dev = mtd_to_platdev(mtd); void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); while (len--) if (*buf++ != (uint8_t)__raw_readl(ndfdtr)) return -EFAULT; return 0; }
static void txx9ndfmc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) { struct platform_device *dev = mtd_to_platdev(mtd); void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_WE, TXX9_NDFMCR); while (len--) __raw_writel(*buf++, ndfdtr); txx9ndfmc_write(dev, mcr, TXX9_NDFMCR); }
static void txx9ndfmc_write(struct platform_device *dev, u32 val, unsigned int reg) { __raw_writel(val, ndregaddr(dev, reg)); }
static u32 txx9ndfmc_read(struct platform_device *dev, unsigned int reg) { return __raw_readl(ndregaddr(dev, reg)); }