]> Git Repo - u-boot.git/commitdiff
Merge patch series "Import "string" I/O functions from Linux"
authorTom Rini <[email protected]>
Tue, 28 Nov 2023 21:19:19 +0000 (16:19 -0500)
committerTom Rini <[email protected]>
Tue, 28 Nov 2023 21:19:19 +0000 (16:19 -0500)
To quote the author:

This series imports generic versions of ioread_rep/iowrite_rep and
reads/writes from Linux. Some cleanup is done to make sure that all
platforms have proper defines for implemented functions and there are no
redefinitions.

1  2 
drivers/mtd/nand/raw/atmel/nand-controller.c
drivers/mtd/nand/raw/nand_base.c
drivers/spi/cadence_qspi.c
drivers/spi/meson_spifc_a1.c

index 5c0265ccf584f1537496ad00c8108ed01963b927,37b0c3a5cdb0986e8efbc37c68d609a436152fed..a2151f98491f311f513ae29551e327d7404690d2
@@@ -64,7 -64,6 +64,7 @@@
  #include <linux/mfd/syscon/atmel-smc.h>
  #include <linux/mtd/rawnand.h>
  #include <linux/mtd/mtd.h>
 +#include <linux/time.h>
  #include <mach/at91_sfr.h>
  #include <nand.h>
  #include <regmap.h>
@@@ -72,6 -71,8 +72,6 @@@
  
  #include "pmecc.h"
  
 -#define NSEC_PER_SEC    1000000000L
 -
  #define ATMEL_HSMC_NFC_CFG                    0x0
  #define ATMEL_HSMC_NFC_CFG_SPARESIZE(x)               (((x) / 4) << 24)
  #define ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK     GENMASK(30, 24)
@@@ -351,40 -352,6 +351,6 @@@ static int atmel_nfc_wait(struct atmel_
        return ret;
  }
  
- static void iowrite8_rep(void *addr, const uint8_t *buf, int len)
- {
-       int i;
-       for (i = 0; i < len; i++)
-               writeb(buf[i], addr);
- }
- static void ioread8_rep(void *addr, uint8_t *buf, int len)
- {
-       int i;
-       for (i = 0; i < len; i++)
-               buf[i] = readb(addr);
- }
- static void ioread16_rep(void *addr, void *buf, int len)
- {
-       int i;
-       u16 *p = (u16 *)buf;
-       for (i = 0; i < len; i++)
-               p[i] = readw(addr);
- }
- static void iowrite16_rep(void *addr, const void *buf, int len)
- {
-       int i;
-       u16 *p = (u16 *)buf;
-       for (i = 0; i < len; i++)
-               writew(p[i], addr);
- }
  static u8 atmel_nand_read_byte(struct mtd_info *mtd)
  {
        struct nand_chip *chip = mtd_to_nand(mtd);
index 44b6cb63a01fdc61736d8d717bb5f5ab1cacf5ad,815ddf5d8dbde69148c1447cf2df7fd3f345a066..c40a0f23d7bf02523c671eb5e442e802caac854a
@@@ -245,39 -245,6 +245,6 @@@ static void nand_write_byte16(struct mt
        chip->write_buf(mtd, (uint8_t *)&word, 2);
  }
  
- static void iowrite8_rep(void *addr, const uint8_t *buf, int len)
- {
-       int i;
-       for (i = 0; i < len; i++)
-               writeb(buf[i], addr);
- }
- static void ioread8_rep(void *addr, uint8_t *buf, int len)
- {
-       int i;
-       for (i = 0; i < len; i++)
-               buf[i] = readb(addr);
- }
- static void ioread16_rep(void *addr, void *buf, int len)
- {
-       int i;
-       u16 *p = (u16 *) buf;
-       for (i = 0; i < len; i++)
-               p[i] = readw(addr);
- }
- static void iowrite16_rep(void *addr, void *buf, int len)
- {
-       int i;
-         u16 *p = (u16 *) buf;
-         for (i = 0; i < len; i++)
-                 writew(p[i], addr);
- }
  /**
   * nand_write_buf - [DEFAULT] write buffer to chip
   * @mtd: MTD device structure
@@@ -4462,14 -4429,17 +4429,14 @@@ ident_done
        else if (chip->jedec_version)
                pr_info("%s %s\n", manufacturer_desc->name,
                        chip->jedec_params.model);
 -      else
 +      else if (manufacturer_desc)
                pr_info("%s %s\n", manufacturer_desc->name, type->name);
  #else
        if (chip->jedec_version)
                pr_info("%s %s\n", manufacturer_desc->name,
                        chip->jedec_params.model);
 -      else
 +      else if (manufacturer_desc)
                pr_info("%s %s\n", manufacturer_desc->name, type->name);
 -
 -      pr_info("%s %s\n", manufacturer_desc->name,
 -              type->name);
  #endif
  
        pr_info("%d MiB, %s, erase size: %d KiB, page size: %d, OOB size: %d\n",
index b0c656dbb4f539618f8aa7b08185a02fa86f2b0d,23240c1302b4d71c8311b4f29a95e2ee06167eb5..2efd626852e8760af5aae811f92a20ec6d16bf58
@@@ -7,7 -7,6 +7,6 @@@
  #include <common.h>
  #include <clk.h>
  #include <log.h>
- #include <asm-generic/io.h>
  #include <dm.h>
  #include <fdtdec.h>
  #include <malloc.h>
  #include <dm/device_compat.h>
  #include <linux/err.h>
  #include <linux/errno.h>
+ #include <linux/io.h>
  #include <linux/sizes.h>
 +#include <linux/time.h>
  #include <zynqmp_firmware.h>
  #include "cadence_qspi.h"
  #include <dt-bindings/power/xlnx-versal-power.h>
  
 -#define NSEC_PER_SEC                  1000000000L
 -
  #define CQSPI_STIG_READ                       0
  #define CQSPI_STIG_WRITE              1
  #define CQSPI_READ                    2
index 418d4d5e10144c0f52003081410d05ca21dafb0f,a33b1a3879b347c15b271ffa3c8a8e87fa3c2f85..cca4debb4126e9f7d073313a9beb910c49c5515d
@@@ -16,7 -16,6 +16,7 @@@
  #include <spi-mem.h>
  #include <asm/io.h>
  #include <linux/log2.h>
 +#include <linux/time.h>
  #include <linux/iopoll.h>
  #include <linux/bitfield.h>
  
@@@ -118,7 -117,7 +118,7 @@@ static int amlogic_spifc_a1_request(str
  
        return readl_poll_timeout(spifc->base + SPIFC_A1_USER_CTRL0_REG,
                                  val, (val & mask) == mask,
 -                                200 * 1000);
 +                                200 * USEC_PER_MSEC);
  }
  
  static void amlogic_spifc_a1_drain_buffer(struct amlogic_spifc_a1 *spifc,
  
        writel(SPIFC_A1_DBUF_AUTO_UPDATE_ADDR,
               spifc->base + SPIFC_A1_DBUF_CTRL_REG);
-       readsl(spifc->base + SPIFC_A1_DBUF_DATA_REG, buf, count);
+       ioread32_rep(spifc->base + SPIFC_A1_DBUF_DATA_REG, buf, count);
  
        if (pad) {
                data = readl(spifc->base + SPIFC_A1_DBUF_DATA_REG);
@@@ -147,7 -146,7 +147,7 @@@ static void amlogic_spifc_a1_fill_buffe
  
        writel(SPIFC_A1_DBUF_DIR | SPIFC_A1_DBUF_AUTO_UPDATE_ADDR,
               spifc->base + SPIFC_A1_DBUF_CTRL_REG);
-       writesl(spifc->base + SPIFC_A1_DBUF_DATA_REG, buf, count);
+       iowrite32_rep(spifc->base + SPIFC_A1_DBUF_DATA_REG, buf, count);
  
        if (pad) {
                memcpy(&data, buf + len - pad, pad);
This page took 0.06266 seconds and 4 git commands to generate.