static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) { struct nand_chip *chip = mtd->priv; writesl(chip->IO_ADDR_W, buf, (len >> 2)); if (len & 3) writesb(chip->IO_ADDR_W, buf + (len & ~0x3), (len & 3)); }
int cadence_qspi_apb_indirect_write_execute(struct cadence_spi_platdata *plat, unsigned int n_tx, const u8 *txbuf) { unsigned int page_size = plat->page_size; unsigned int remaining = n_tx; unsigned int write_bytes; int ret; /* Configure the indirect read transfer bytes */ writel(n_tx, plat->regbase + CQSPI_REG_INDIRECTWRBYTES); /* Start the indirect write transfer */ writel(CQSPI_REG_INDIRECTWR_START, plat->regbase + CQSPI_REG_INDIRECTWR); while (remaining > 0) { write_bytes = remaining > page_size ? page_size : remaining; /* Handle non-4-byte aligned access to avoid data abort. */ if (((uintptr_t)txbuf % 4) || (write_bytes % 4)) writesb(plat->ahbbase, txbuf, write_bytes); else writesl(plat->ahbbase, txbuf, write_bytes >> 2); ret = wait_for_bit("QSPI", plat->regbase + CQSPI_REG_SDRAMLEVEL, CQSPI_REG_SDRAMLEVEL_WR_MASK << CQSPI_REG_SDRAMLEVEL_WR_LSB, 0, 10, 0); if (ret) { printf("Indirect write timed out (%i)\n", ret); goto failwr; } txbuf += write_bytes; remaining -= write_bytes; } /* Check indirect done status */ ret = wait_for_bit("QSPI", plat->regbase + CQSPI_REG_INDIRECTWR, CQSPI_REG_INDIRECTWR_DONE, 1, 10, 0); if (ret) { printf("Indirect write completion error (%i)\n", ret); goto failwr; } /* Clear indirect completion status */ writel(CQSPI_REG_INDIRECTWR_DONE, plat->regbase + CQSPI_REG_INDIRECTWR); return 0; failwr: /* Cancel the indirect write */ writel(CQSPI_REG_INDIRECTWR_CANCEL, plat->regbase + CQSPI_REG_INDIRECTWR); return ret; }
/* * s3c2410_udc_write_packet */ static inline int s3c2410_udc_write_packet(int fifo, struct s3c2410_request *req, unsigned max) { unsigned len = min(req->req.length - req->req.actual, max); u8 *buf = req->req.buf + req->req.actual; prefetch(buf); dprintk(DEBUG_VERBOSE, "%s %d %d %d %d\n", __func__, req->req.actual, req->req.length, len, req->req.actual + len); req->req.actual += len; udelay(5); writesb(base_addr + fifo, buf, len); return len; }
static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count) { writesb(reg, data, count); }