summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-04-16 16:52:28 -0600
committerTom Rini <trini@konsulko.com>2025-04-17 07:51:37 -0600
commit0f7a4ac96b27fa77b798c6c9598e05cf1654920b (patch)
tree4b48ea8277232039a0475fa674b9cc951d15c80d /include
parentc9c8df2c377e512553f2e9ad5d19c4b85efbf07d (diff)
parentd74728d8ed28fddc7ada266a9ece2cb858420cde (diff)
Merge patch series "airoha: add support spi/mmc/ethernet"
Christian Marangi <ansuelsmth@gmail.com> says: This is continuation of the initial patchset for airoha support. Some are trivial fix for spi. A new concept to setup SPI from detected NAND. Sadly DTS node still need to be merged upstream so we are currently adding them to u-boot dtsi and it's planned to be dropped once they are accepted in upstream kernel. Link: https://lore.kernel.org/r/20250407200208.25594-1-ansuelsmth@gmail.com
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/spinand.h2
-rw-r--r--include/regmap.h28
-rw-r--r--include/spi.h12
3 files changed, 41 insertions, 1 deletions
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 13b5a52f8b9..6fe6fd520a4 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -17,7 +17,7 @@
#include <linux/spi/spi.h>
#include <linux/spi/spi-mem.h>
#else
-#include <spi.h>
+#include <linux/bitops.h>
#include <spi-mem.h>
#include <linux/mtd/nand.h>
#endif
diff --git a/include/regmap.h b/include/regmap.h
index 22b043408ac..8c6f7c1c9b1 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -362,6 +362,34 @@ int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val);
/**
+ * regmap_set_bits() - Set bits to a regmap
+ *
+ * @map: Regmap to write bits to
+ * @offset: Offset in the regmap to write to
+ * @bits: Bits to set to the regmap at the specified offset
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static inline int regmap_set_bits(struct regmap *map, uint offset, uint bits)
+{
+ return regmap_update_bits(map, offset, bits, bits);
+}
+
+/**
+ * regmap_clear_bits() - Clear bits to a regmap
+ *
+ * @map: Regmap to write bits to
+ * @offset: Offset in the regmap to write to
+ * @bits: Bits to clear to the regmap at the specified offset
+ *
+ * Return: 0 if OK, -ve on error
+ */
+static inline int regmap_clear_bits(struct regmap *map, uint offset, uint bits)
+{
+ return regmap_update_bits(map, offset, bits, 0);
+}
+
+/**
* regmap_init_mem() - Set up a new register map that uses memory access
*
* @node: Device node that uses this map
diff --git a/include/spi.h b/include/spi.h
index 6944773b596..2783200d663 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -11,6 +11,8 @@
#include <linux/bitops.h>
+struct spinand_info;
+
/* SPI mode flags */
#define SPI_CPHA BIT(0) /* clock phase (1 = SPI_CLOCK_PHASE_SECOND) */
#define SPI_CPOL BIT(1) /* clock polarity (1 = SPI_POLARITY_HIGH) */
@@ -537,6 +539,16 @@ struct dm_spi_ops {
*/
int (*get_mmap)(struct udevice *dev, ulong *map_basep,
uint *map_sizep, uint *offsetp);
+
+ /**
+ * setup_for_spinand() - Setup the SPI for attached SPI NAND
+ *
+ * @dev: The SPI flash slave device
+ * @spinand_info: The SPI NAND info to configure for
+ * @return 0 if OK, -ve value on error
+ */
+ int (*setup_for_spinand)(struct spi_slave *slave,
+ const struct spinand_info *spinand_info);
};
struct dm_spi_emul_ops {