mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 01:59:02 +00:00
8590531048
Manually rebased: bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch[*] Removed upstreamed: backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch[1] backport-5.15/817-v6.5-01-leds-trigger-netdev-Recheck-NETDEV_LED_MODE_LINKUP-o.patch[2] pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch[3] pending-5.15/160-workqueue-fix-enum-type-for-gcc-13.patch[4] bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch[5] bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch[6] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=02474292a44205c1eb5a03634ead155a3c9134f4 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=86b93cbfe104e99fd3d25a49748b99fb88101573 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=79b9ab357b6f5675007f4c02ff8765cbd8dc06a2 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=d528faa9e828b9fc46dfb684a2a9fd8c2e860ed8 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=5899bc4058e89d5110a23797ff94439c53b77c25 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=95afd2c7c7d26087730dc938709e025a303e5499 Build system: x86/64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Co-authored-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John Audia <therealgraysky@proton.me> [rebased ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch ] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
91 lines
3.3 KiB
Diff
91 lines
3.3 KiB
Diff
From 86fc59ef818beb0e1945d17f8e734898baba7e4e Mon Sep 17 00:00:00 2001
|
|
From: Colin Foster <colin.foster@in-advantage.com>
|
|
Date: Sun, 13 Mar 2022 15:45:23 -0700
|
|
Subject: [PATCH 1/2] regmap: add configurable downshift for addresses
|
|
|
|
Add an additional reg_downshift to be applied to register addresses before
|
|
any register accesses. An example of a device that uses this is a VSC7514
|
|
chip, which require each register address to be downshifted by two if the
|
|
access is performed over a SPI bus.
|
|
|
|
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
|
|
Link: https://lore.kernel.org/r/20220313224524.399947-2-colin.foster@in-advantage.com
|
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
---
|
|
drivers/base/regmap/internal.h | 1 +
|
|
drivers/base/regmap/regmap.c | 5 +++++
|
|
include/linux/regmap.h | 3 +++
|
|
3 files changed, 9 insertions(+)
|
|
|
|
--- a/drivers/base/regmap/internal.h
|
|
+++ b/drivers/base/regmap/internal.h
|
|
@@ -31,6 +31,7 @@ struct regmap_format {
|
|
size_t buf_size;
|
|
size_t reg_bytes;
|
|
size_t pad_bytes;
|
|
+ size_t reg_downshift;
|
|
size_t val_bytes;
|
|
void (*format_write)(struct regmap *map,
|
|
unsigned int reg, unsigned int val);
|
|
--- a/drivers/base/regmap/regmap.c
|
|
+++ b/drivers/base/regmap/regmap.c
|
|
@@ -823,6 +823,7 @@ struct regmap *__regmap_init(struct devi
|
|
|
|
map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8);
|
|
map->format.pad_bytes = config->pad_bits / 8;
|
|
+ map->format.reg_downshift = config->reg_downshift;
|
|
map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8);
|
|
map->format.buf_size = DIV_ROUND_UP(config->reg_bits +
|
|
config->val_bits + config->pad_bits, 8);
|
|
@@ -1735,6 +1736,7 @@ static int _regmap_raw_write_impl(struct
|
|
return ret;
|
|
}
|
|
|
|
+ reg >>= map->format.reg_downshift;
|
|
map->format.format_reg(map->work_buf, reg, map->reg_shift);
|
|
regmap_set_work_buf_flag_mask(map, map->format.reg_bytes,
|
|
map->write_flag_mask);
|
|
@@ -1905,6 +1907,7 @@ static int _regmap_bus_formatted_write(v
|
|
return ret;
|
|
}
|
|
|
|
+ reg >>= map->format.reg_downshift;
|
|
map->format.format_write(map, reg, val);
|
|
|
|
trace_regmap_hw_write_start(map, reg, 1);
|
|
@@ -2346,6 +2349,7 @@ static int _regmap_raw_multi_reg_write(s
|
|
unsigned int reg = regs[i].reg;
|
|
unsigned int val = regs[i].def;
|
|
trace_regmap_hw_write_start(map, reg, 1);
|
|
+ reg >>= map->format.reg_downshift;
|
|
map->format.format_reg(u8, reg, map->reg_shift);
|
|
u8 += reg_bytes + pad_bytes;
|
|
map->format.format_val(u8, val, 0);
|
|
@@ -2673,6 +2677,7 @@ static int _regmap_raw_read(struct regma
|
|
return ret;
|
|
}
|
|
|
|
+ reg >>= map->format.reg_downshift;
|
|
map->format.format_reg(map->work_buf, reg, map->reg_shift);
|
|
regmap_set_work_buf_flag_mask(map, map->format.reg_bytes,
|
|
map->read_flag_mask);
|
|
--- a/include/linux/regmap.h
|
|
+++ b/include/linux/regmap.h
|
|
@@ -237,6 +237,8 @@ typedef void (*regmap_unlock)(void *);
|
|
* @reg_stride: The register address stride. Valid register addresses are a
|
|
* multiple of this value. If set to 0, a value of 1 will be
|
|
* used.
|
|
+ * @reg_downshift: The number of bits to downshift the register before
|
|
+ * performing any operations.
|
|
* @pad_bits: Number of bits of padding between register and value.
|
|
* @val_bits: Number of bits in a register value, mandatory.
|
|
*
|
|
@@ -360,6 +362,7 @@ struct regmap_config {
|
|
|
|
int reg_bits;
|
|
int reg_stride;
|
|
+ int reg_downshift;
|
|
int pad_bits;
|
|
int val_bits;
|
|
|