From 7b3c4c370c09313e22b555e79167e73d233611d1 Mon Sep 17 00:00:00 2001 From: Andrew Lunn Date: Mon, 16 Jan 2023 12:15:09 +0100 Subject: regmap: Rework regmap_mdio_c45_{read|write} for new C45 API. The MDIO subsystem is getting rid of MII_ADDR_C45 and thus also encoding associated encoding of the C45 device address and register address into one value. regmap-mdio also uses this encoding for the C45 bus. Move to the new C45 helpers for MDIO access and provide regmap-mdio helper macros. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Link: https://lore.kernel.org/r/20230116111509.4086236-1-michael@walle.cc Signed-off-by: Mark Brown --- include/linux/regmap.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/linux/regmap.h') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index a3bc695bcca0..029b9e09d3ca 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -38,6 +38,14 @@ struct regmap_field; struct snd_ac97; struct sdw_slave; +/* + * regmap_mdio address encoding. IEEE 802.3ae clause 45 addresses consist of a + * device address and a register address. + */ +#define REGMAP_MDIO_C45_DEVAD_SHIFT 16 +#define REGMAP_MDIO_C45_DEVAD_MASK GENMASK(20, 16) +#define REGMAP_MDIO_C45_REGNUM_MASK GENMASK(15, 0) + /* An enum of all the supported cache types */ enum regcache_type { REGCACHE_NONE, -- cgit v1.2.3 From 7464145862d606cf9835f24080341a397cbc0669 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Tue, 14 Feb 2023 09:40:14 +0100 Subject: regmap: Reorder fields in 'struct regmap_bus' to save some memory Group some bool variables to reduce hole and avoid padding. On x86_64, this shrinks the size from 136 to 128 bytes. As an example: $ size drivers/base/regmap/regmap-fsi.o (Before) text data bss dec hex filename 4837 136 0 4973 136d drivers/base/regmap/regmap-fsi.o $ size drivers/base/regmap/regmap-fsi.o (After) text data bss dec hex filename 4701 136 0 4837 12e5 drivers/base/regmap/regmap-fsi.o Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/077ca39622c8870a3ea932298a9cec34f7a8295a.1676363976.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown --- include/linux/regmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/linux/regmap.h') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 029b9e09d3ca..f26432dc02ef 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -520,6 +520,7 @@ typedef void (*regmap_hw_free_context)(void *context); * to perform locking. This field is ignored if custom lock/unlock * functions are used (see fields lock/unlock of * struct regmap_config). + * @free_on_exit: kfree this on exit of regmap * @write: Write operation. * @gather_write: Write operation with split register/value, return -ENOTSUPP * if not implemented on a given device. @@ -548,10 +549,10 @@ typedef void (*regmap_hw_free_context)(void *context); * DEFAULT, BIG is assumed. * @max_raw_read: Max raw read size that can be used on the bus. * @max_raw_write: Max raw write size that can be used on the bus. - * @free_on_exit: kfree this on exit of regmap */ struct regmap_bus { bool fast_io; + bool free_on_exit; regmap_hw_write write; regmap_hw_gather_write gather_write; regmap_hw_async_write async_write; @@ -568,7 +569,6 @@ struct regmap_bus { enum regmap_endian val_format_endian_default; size_t max_raw_read; size_t max_raw_write; - bool free_on_exit; }; /* -- cgit v1.2.3 From 483e6ea1b35aaeffd9b6e6e660d756be49c2a9f5 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 16 Feb 2023 22:31:59 +0000 Subject: regmap-irq: Remove unused type_invert flag type_invert is deprecated and no longer used; it can now be removed. Signed-off-by: Aidan MacDonald Link: https://lore.kernel.org/r/20230216223200.150679-1-aidanmacdonald.0x0@gmail.com Signed-off-by: Mark Brown --- include/linux/regmap.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/linux/regmap.h') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index f26432dc02ef..c2233aeb3843 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1555,8 +1555,6 @@ struct regmap_irq_chip_data; * @ack_invert: Inverted ack register: cleared bits for ack. * @clear_ack: Use this to set 1 and 0 or vice-versa to clear interrupts. * @wake_invert: Inverted wake register: cleared bits are wake enabled. - * @type_invert: Invert the type flags. Deprecated, use config registers - * instead. * @type_in_mask: Use the mask registers for controlling irq type. Use this if * the hardware provides separate bits for rising/falling edge * or low/high level interrupts and they should be combined into @@ -1633,7 +1631,6 @@ struct regmap_irq_chip { unsigned int clear_ack:1; unsigned int wake_invert:1; unsigned int runtime_pm:1; - unsigned int type_invert:1; unsigned int type_in_mask:1; unsigned int clear_on_unmask:1; unsigned int not_fixed_stride:1; -- cgit v1.2.3 From c74e7af1245b2073930afc9a2a340d91e08f0f14 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 16 Feb 2023 22:32:00 +0000 Subject: regmap-irq: Remove unused mask_invert flag mask_invert is deprecated and no longer used; it can now be removed. Signed-off-by: Aidan MacDonald Link: https://lore.kernel.org/r/20230216223200.150679-2-aidanmacdonald.0x0@gmail.com Signed-off-by: Mark Brown --- include/linux/regmap.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/linux/regmap.h') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index c2233aeb3843..4d10790adeb0 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -1540,9 +1540,6 @@ struct regmap_irq_chip_data; * @config_base: Base address for IRQ type config regs. If null unsupported. * @irq_reg_stride: Stride to use for chips where registers are not contiguous. * @init_ack_masked: Ack all masked interrupts once during initalization. - * @mask_invert: Inverted mask register: cleared bits are masked out. - * Deprecated; prefer describing an inverted mask register as - * an unmask register. * @mask_unmask_non_inverted: Controls mask bit inversion for chips that set * both @mask_base and @unmask_base. If false, mask and unmask bits are * inverted (which is deprecated behavior); if true, bits will not be @@ -1624,7 +1621,6 @@ struct regmap_irq_chip { const unsigned int *config_base; unsigned int irq_reg_stride; unsigned int init_ack_masked:1; - unsigned int mask_invert:1; unsigned int mask_unmask_non_inverted:1; unsigned int use_ack:1; unsigned int ack_invert:1; -- cgit v1.2.3