* [PATCH 0/3] Read MAC address through NVMEM for sama7g5ek
@ 2024-06-19 7:22 Andrei Simion
2024-06-19 7:22 ` [PATCH 1/3] eeprom: at24: avoid adjusting offset for 24AA025E{48, 64} Andrei Simion
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andrei Simion @ 2024-06-19 7:22 UTC (permalink / raw)
To: brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni,
claudiu.beznea, arnd, gregkh
Cc: linux-i2c, devicetree, linux-kernel, linux-arm-kernel,
Andrei Simion
This series proposes to add EEPROM support and reading MAC addresses through
NVMEM (via Devicetree) for sama7g5ek:
- Add in DT bindings document the EEPROM compatibles : "at24,mac02e4" and
"at24,mac02e6"
- Update to the driver to support "at24,mac02e4" and
"at24,mac02e6" and adjusting offset for those 24AA025E{48, 64}.
- Added the nodes in devicetree for eeproms where are stored eui48 MAC,
and update gmac nodes to read the MAC via devicetree through NVMEM.
Andrei Simion (1):
dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6
Claudiu Beznea (2):
eeprom: at24: avoid adjusting offset for 24AA025E{48, 64}
ARM: dts: at91: at91-sama7g5ek: add EEPROMs
.../devicetree/bindings/eeprom/at24.yaml | 10 ++-
.../arm/boot/dts/microchip/at91-sama7g5ek.dts | 44 +++++++++++
drivers/misc/eeprom/at24.c | 73 +++++++++++--------
3 files changed, 93 insertions(+), 34 deletions(-)
base-commit: 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/3] eeprom: at24: avoid adjusting offset for 24AA025E{48, 64} 2024-06-19 7:22 [PATCH 0/3] Read MAC address through NVMEM for sama7g5ek Andrei Simion @ 2024-06-19 7:22 ` Andrei Simion 2024-06-19 7:22 ` [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs Andrei Simion 2024-06-19 7:22 ` [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 Andrei Simion 2 siblings, 0 replies; 8+ messages in thread From: Andrei Simion @ 2024-06-19 7:22 UTC (permalink / raw) To: brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh Cc: linux-i2c, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea, Andrei Simion From: Claudiu Beznea <claudiu.beznea@microchip.com> The EEPROMs could be used only for MAC storage. In this case the EEPROM areas where MACs resides could be modeled as NVMEM cells (directly via DT bindings) such that the already available networking infrastructure to read properly the MAC addresses (via of_get_mac_address()). The previously available compatibles needs the offset adjustment probably for compatibility w/ old DT bindings. Added "atmel,24mac02e4", "atmel,24mac02e6" compatible for the usage w/ 24AA025E{48, 64} type of EEPROMs. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Co-developed-by: Andrei Simion <andrei.simion@microchip.com> Signed-off-by: Andrei Simion <andrei.simion@microchip.com> --- drivers/misc/eeprom/at24.c | 73 ++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 4bd4f32bcdab..8699a6c585c4 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -121,17 +121,19 @@ struct at24_chip_data { u32 byte_len; u8 flags; u8 bank_addr_shift; + u8 adjoff; void (*read_post)(unsigned int off, char *buf, size_t count); }; -#define AT24_CHIP_DATA(_name, _len, _flags) \ +#define AT24_CHIP_DATA(_name, _len, _flags, _adjoff) \ static const struct at24_chip_data _name = { \ - .byte_len = _len, .flags = _flags, \ + .byte_len = _len, .flags = _flags, .adjoff = _adjoff, \ } -#define AT24_CHIP_DATA_CB(_name, _len, _flags, _read_post) \ +#define AT24_CHIP_DATA_CB(_name, _len, _flags, _adjoff, _read_post) \ static const struct at24_chip_data _name = { \ .byte_len = _len, .flags = _flags, \ + .adjoff = _adjoff, \ .read_post = _read_post, \ } @@ -162,53 +164,57 @@ static void at24_read_post_vaio(unsigned int off, char *buf, size_t count) } /* needs 8 addresses as A0-A2 are ignored */ -AT24_CHIP_DATA(at24_data_24c00, 128 / 8, AT24_FLAG_TAKE8ADDR); +AT24_CHIP_DATA(at24_data_24c00, 128 / 8, AT24_FLAG_TAKE8ADDR, 0); /* old variants can't be handled with this generic entry! */ -AT24_CHIP_DATA(at24_data_24c01, 1024 / 8, 0); +AT24_CHIP_DATA(at24_data_24c01, 1024 / 8, 0, 0); AT24_CHIP_DATA(at24_data_24cs01, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c02, 2048 / 8, 0); + AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24c02, 2048 / 8, 0, 0); AT24_CHIP_DATA(at24_data_24cs02, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); + AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); AT24_CHIP_DATA(at24_data_24mac402, 48 / 8, - AT24_FLAG_MAC | AT24_FLAG_READONLY); + AT24_FLAG_MAC | AT24_FLAG_READONLY, 1); AT24_CHIP_DATA(at24_data_24mac602, 64 / 8, - AT24_FLAG_MAC | AT24_FLAG_READONLY); + AT24_FLAG_MAC | AT24_FLAG_READONLY, 1); +AT24_CHIP_DATA(at24_data_24mac02e4, 48 / 8, + AT24_FLAG_MAC | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24mac02e6, 64 / 8, + AT24_FLAG_MAC | AT24_FLAG_READONLY, 0); /* spd is a 24c02 in memory DIMMs */ AT24_CHIP_DATA(at24_data_spd, 2048 / 8, - AT24_FLAG_READONLY | AT24_FLAG_IRUGO); + AT24_FLAG_READONLY | AT24_FLAG_IRUGO, 0); /* 24c02_vaio is a 24c02 on some Sony laptops */ AT24_CHIP_DATA_CB(at24_data_24c02_vaio, 2048 / 8, - AT24_FLAG_READONLY | AT24_FLAG_IRUGO, + AT24_FLAG_READONLY | AT24_FLAG_IRUGO, 0, at24_read_post_vaio); -AT24_CHIP_DATA(at24_data_24c04, 4096 / 8, 0); +AT24_CHIP_DATA(at24_data_24c04, 4096 / 8, 0, 0); AT24_CHIP_DATA(at24_data_24cs04, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); + AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); /* 24rf08 quirk is handled at i2c-core */ -AT24_CHIP_DATA(at24_data_24c08, 8192 / 8, 0); +AT24_CHIP_DATA(at24_data_24c08, 8192 / 8, 0, 0); AT24_CHIP_DATA(at24_data_24cs08, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c16, 16384 / 8, 0); + AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24c16, 16384 / 8, 0, 0); AT24_CHIP_DATA(at24_data_24cs16, 16, - AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c32, 32768 / 8, AT24_FLAG_ADDR16); + AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24c32, 32768 / 8, AT24_FLAG_ADDR16, 0); /* M24C32-D Additional Write lockable page (M24C32-D order codes) */ -AT24_CHIP_DATA(at24_data_24c32d_wlp, 32, AT24_FLAG_ADDR16); +AT24_CHIP_DATA(at24_data_24c32d_wlp, 32, AT24_FLAG_ADDR16, 0); AT24_CHIP_DATA(at24_data_24cs32, 16, - AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c64, 65536 / 8, AT24_FLAG_ADDR16); + AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24c64, 65536 / 8, AT24_FLAG_ADDR16, 0); /* M24C64-D Additional Write lockable page (M24C64-D order codes) */ -AT24_CHIP_DATA(at24_data_24c64d_wlp, 32, AT24_FLAG_ADDR16); +AT24_CHIP_DATA(at24_data_24c64d_wlp, 32, AT24_FLAG_ADDR16, 0); AT24_CHIP_DATA(at24_data_24cs64, 16, - AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY); -AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16); -AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16); + AT24_FLAG_ADDR16 | AT24_FLAG_SERIAL | AT24_FLAG_READONLY, 0); +AT24_CHIP_DATA(at24_data_24c128, 131072 / 8, AT24_FLAG_ADDR16, 0); +AT24_CHIP_DATA(at24_data_24c256, 262144 / 8, AT24_FLAG_ADDR16, 0); +AT24_CHIP_DATA(at24_data_24c512, 524288 / 8, AT24_FLAG_ADDR16, 0); +AT24_CHIP_DATA(at24_data_24c1024, 1048576 / 8, AT24_FLAG_ADDR16, 0); +AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16, 0); AT24_CHIP_DATA_BS(at24_data_24c1025, 1048576 / 8, AT24_FLAG_ADDR16, 2); -AT24_CHIP_DATA(at24_data_24c2048, 2097152 / 8, AT24_FLAG_ADDR16); /* identical to 24c08 ? */ -AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0); +AT24_CHIP_DATA(at24_data_INT3499, 8192 / 8, 0, 0); static const struct i2c_device_id at24_ids[] = { { "24c00", (kernel_ulong_t)&at24_data_24c00 }, @@ -217,7 +223,9 @@ static const struct i2c_device_id at24_ids[] = { { "24c02", (kernel_ulong_t)&at24_data_24c02 }, { "24cs02", (kernel_ulong_t)&at24_data_24cs02 }, { "24mac402", (kernel_ulong_t)&at24_data_24mac402 }, + { "24mac02e4", (kernel_ulong_t)&at24_data_24mac02e4 }, { "24mac602", (kernel_ulong_t)&at24_data_24mac602 }, + { "24mac02e6", (kernel_ulong_t)&at24_data_24mac02e6 }, { "spd", (kernel_ulong_t)&at24_data_spd }, { "24c02-vaio", (kernel_ulong_t)&at24_data_24c02_vaio }, { "24c04", (kernel_ulong_t)&at24_data_24c04 }, @@ -250,7 +258,9 @@ static const struct of_device_id __maybe_unused at24_of_match[] = { { .compatible = "atmel,24c02", .data = &at24_data_24c02 }, { .compatible = "atmel,24cs02", .data = &at24_data_24cs02 }, { .compatible = "atmel,24mac402", .data = &at24_data_24mac402 }, + { .compatible = "atmel,24mac02e4", .data = &at24_data_24mac02e4 }, { .compatible = "atmel,24mac602", .data = &at24_data_24mac602 }, + { .compatible = "atmel,24mac02e6", .data = &at24_data_24mac02e6 }, { .compatible = "atmel,spd", .data = &at24_data_spd }, { .compatible = "atmel,24c04", .data = &at24_data_24c04 }, { .compatible = "atmel,24cs04", .data = &at24_data_24cs04 }, @@ -690,7 +700,8 @@ static int at24_probe(struct i2c_client *client) at24->read_post = cdata->read_post; at24->bank_addr_shift = cdata->bank_addr_shift; at24->num_addresses = num_addresses; - at24->offset_adj = at24_get_offset_adj(flags, byte_len); + at24->offset_adj = cdata->adjoff ? + at24_get_offset_adj(flags, byte_len) : 0; at24->client_regmaps[0] = regmap; at24->vcc_reg = devm_regulator_get(dev, "vcc"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs 2024-06-19 7:22 [PATCH 0/3] Read MAC address through NVMEM for sama7g5ek Andrei Simion 2024-06-19 7:22 ` [PATCH 1/3] eeprom: at24: avoid adjusting offset for 24AA025E{48, 64} Andrei Simion @ 2024-06-19 7:22 ` Andrei Simion 2024-06-20 6:28 ` kernel test robot 2024-06-19 7:22 ` [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 Andrei Simion 2 siblings, 1 reply; 8+ messages in thread From: Andrei Simion @ 2024-06-19 7:22 UTC (permalink / raw) To: brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh Cc: linux-i2c, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea, Andrei Simion From: Claudiu Beznea <claudiu.beznea@microchip.com> Add EEPROMs and nvmem-layout to describe eui48 mac address region. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Co-developed-by: Andrei Simion <andrei.simion@microchip.com> Signed-off-by: Andrei Simion <andrei.simion@microchip.com> --- .../arm/boot/dts/microchip/at91-sama7g5ek.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts b/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts index 20b2497657ae..66e8c8258684 100644 --- a/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts +++ b/arch/arm/boot/dts/microchip/at91-sama7g5ek.dts @@ -403,6 +403,46 @@ i2c8: i2c@600 { i2c-digital-filter; i2c-digital-filter-width-ns = <35>; status = "okay"; + + eeprom0: eeprom@52 { + compatible = "atmel,24mac02e4"; + reg = <0x52>; + #address-cells = <1>; + #size-cells = <1>; + size = <256>; + pagesize = <16>; + vcc-supply = <&vdd_3v3>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom0_eui48: eui48@fa { + reg = <0xfa 0x6>; + }; + }; + }; + + eeprom1: eeprom@53 { + compatible = "atmel,24mac02e4"; + reg = <0x53>; + #address-cells = <1>; + #size-cells = <1>; + size = <256>; + pagesize = <16>; + vcc-supply = <&vdd_3v3>; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom1_eui48: eui48@fa { + reg = <0xfa 0x6>; + }; + }; + }; }; }; @@ -440,6 +480,8 @@ &pinctrl_gmac0_mdio_default &pinctrl_gmac0_txck_default &pinctrl_gmac0_phy_irq>; phy-mode = "rgmii-id"; + nvmem-cells = <&eeprom0_eui48>; + nvmem-cell-names = "mac-address"; status = "okay"; ethernet-phy@7 { @@ -457,6 +499,8 @@ &gmac1 { &pinctrl_gmac1_mdio_default &pinctrl_gmac1_phy_irq>; phy-mode = "rmii"; + nvmem-cells = <&eeprom1_eui48>; + nvmem-cell-names = "mac-address"; status = "okay"; /* Conflict with pdmc0. */ ethernet-phy@0 { -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs 2024-06-19 7:22 ` [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs Andrei Simion @ 2024-06-20 6:28 ` kernel test robot 0 siblings, 0 replies; 8+ messages in thread From: kernel test robot @ 2024-06-20 6:28 UTC (permalink / raw) To: Andrei Simion, brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh Cc: oe-kbuild-all, linux-i2c, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea, Andrei Simion Hi Andrei, kernel test robot noticed the following build warnings: [auto build test WARNING on 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af] url: https://github.com/intel-lab-lkp/linux/commits/Andrei-Simion/eeprom-at24-avoid-adjusting-offset-for-24AA025E-48-64/20240619-153030 base: 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af patch link: https://lore.kernel.org/r/20240619072231.6876-3-andrei.simion%40microchip.com patch subject: [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs config: arm-randconfig-004-20240620 (https://download.01.org/0day-ci/archive/20240620/202406201413.tFxSruVt-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240620/202406201413.tFxSruVt-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202406201413.tFxSruVt-lkp@intel.com/ dtcheck warnings: (new ones prefixed by >>) >> arch/arm/boot/dts/microchip/at91-sama7g5ek.dts:407.22-425.5: Warning (avoid_unnecessary_addr_size): /soc/flexcom@e2818000/i2c@600/eeprom@52: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property arch/arm/boot/dts/microchip/at91-sama7g5ek.dts:427.22-445.5: Warning (avoid_unnecessary_addr_size): /soc/flexcom@e2818000/i2c@600/eeprom@53: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property vim +407 arch/arm/boot/dts/microchip/at91-sama7g5ek.dts 394 395 &flx8 { 396 atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>; 397 status = "okay"; 398 399 i2c8: i2c@600 { 400 pinctrl-names = "default"; 401 pinctrl-0 = <&pinctrl_i2c8_default>; 402 i2c-analog-filter; 403 i2c-digital-filter; 404 i2c-digital-filter-width-ns = <35>; 405 status = "okay"; 406 > 407 eeprom0: eeprom@52 { 408 compatible = "atmel,24mac02e4"; 409 reg = <0x52>; 410 #address-cells = <1>; 411 #size-cells = <1>; 412 size = <256>; 413 pagesize = <16>; 414 vcc-supply = <&vdd_3v3>; 415 416 nvmem-layout { 417 compatible = "fixed-layout"; 418 #address-cells = <1>; 419 #size-cells = <1>; 420 421 eeprom0_eui48: eui48@fa { 422 reg = <0xfa 0x6>; 423 }; 424 }; 425 }; 426 427 eeprom1: eeprom@53 { 428 compatible = "atmel,24mac02e4"; 429 reg = <0x53>; 430 #address-cells = <1>; 431 #size-cells = <1>; 432 size = <256>; 433 pagesize = <16>; 434 vcc-supply = <&vdd_3v3>; 435 436 nvmem-layout { 437 compatible = "fixed-layout"; 438 #address-cells = <1>; 439 #size-cells = <1>; 440 441 eeprom1_eui48: eui48@fa { 442 reg = <0xfa 0x6>; 443 }; 444 }; 445 }; 446 }; 447 }; 448 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 2024-06-19 7:22 [PATCH 0/3] Read MAC address through NVMEM for sama7g5ek Andrei Simion 2024-06-19 7:22 ` [PATCH 1/3] eeprom: at24: avoid adjusting offset for 24AA025E{48, 64} Andrei Simion 2024-06-19 7:22 ` [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs Andrei Simion @ 2024-06-19 7:22 ` Andrei Simion 2024-06-19 17:53 ` Conor Dooley 2 siblings, 1 reply; 8+ messages in thread From: Andrei Simion @ 2024-06-19 7:22 UTC (permalink / raw) To: brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh Cc: linux-i2c, devicetree, linux-kernel, linux-arm-kernel, Andrei Simion Update regex check and add pattern to match both EEPROMs. Signed-off-by: Andrei Simion <andrei.simion@microchip.com> --- Documentation/devicetree/bindings/eeprom/at24.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml index 3c36cd0510de..46daa662f6e7 100644 --- a/Documentation/devicetree/bindings/eeprom/at24.yaml +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml @@ -18,7 +18,7 @@ select: properties: compatible: contains: - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" + pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" required: - compatible @@ -37,8 +37,8 @@ properties: - allOf: - minItems: 1 items: - - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$" - - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" + - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+[a-z0-9]*|spd)$" + - pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" - oneOf: - items: pattern: c00$ @@ -54,6 +54,10 @@ properties: pattern: mac402$ - items: pattern: mac602$ + - items: + pattern: mac02e4$ + - items: + pattern: mac02e6$ - items: pattern: c04$ - items: -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 2024-06-19 7:22 ` [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 Andrei Simion @ 2024-06-19 17:53 ` Conor Dooley 2024-06-20 10:45 ` Andrei.Simion 0 siblings, 1 reply; 8+ messages in thread From: Conor Dooley @ 2024-06-19 17:53 UTC (permalink / raw) To: Andrei Simion Cc: brgl, robh, krzk+dt, conor+dt, nicolas.ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh, linux-i2c, devicetree, linux-kernel, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 1952 bytes --] On Wed, Jun 19, 2024 at 10:22:31AM +0300, Andrei Simion wrote: > Update regex check and add pattern to match both EEPROMs. > > Signed-off-by: Andrei Simion <andrei.simion@microchip.com> > --- > Documentation/devicetree/bindings/eeprom/at24.yaml | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml > index 3c36cd0510de..46daa662f6e7 100644 > --- a/Documentation/devicetree/bindings/eeprom/at24.yaml > +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml > @@ -18,7 +18,7 @@ select: > properties: > compatible: > contains: > - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" > + pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" Could we relax the pattern instead to make this bloat less? Would it be problematic to just allow "^atmel,(24(c|cs|mac)[a-z0-9]+|spd)$"? > required: > - compatible > > @@ -37,8 +37,8 @@ properties: > - allOf: > - minItems: 1 > items: > - - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$" > - - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" > + - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+[a-z0-9]*|spd)$" > + - pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" > - oneOf: > - items: > pattern: c00$ > @@ -54,6 +54,10 @@ properties: > pattern: mac402$ > - items: > pattern: mac602$ > + - items: > + pattern: mac02e4$ > + - items: > + pattern: mac02e6$ > - items: > pattern: c04$ > - items: > -- > 2.34.1 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 2024-06-19 17:53 ` Conor Dooley @ 2024-06-20 10:45 ` Andrei.Simion 2024-06-20 11:10 ` Conor Dooley 0 siblings, 1 reply; 8+ messages in thread From: Andrei.Simion @ 2024-06-20 10:45 UTC (permalink / raw) To: conor Cc: brgl, robh, krzk+dt, conor+dt, Nicolas.Ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh, linux-i2c, devicetree, linux-kernel, linux-arm-kernel On 19.06.2024 20:53, Conor Dooley wrote: >> Update regex check and add pattern to match both EEPROMs. >> >> Signed-off-by: Andrei Simion <andrei.simion@microchip.com> >> --- >> Documentation/devicetree/bindings/eeprom/at24.yaml | 10 +++++++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml >> index 3c36cd0510de..46daa662f6e7 100644 >> --- a/Documentation/devicetree/bindings/eeprom/at24.yaml >> +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml >> @@ -18,7 +18,7 @@ select: >> properties: >> compatible: >> contains: >> - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" >> + pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" > Could we relax the pattern instead to make this bloat less? Would it be > problematic to just allow "^atmel,(24(c|cs|mac)[a-z0-9]+|spd)$"? I) "^atmel,(24(c|cs|mac)[a-z0-9]+|spd)$" : The first pattern does not specify where the digits must occur within the alphanumeric sequence that follows 24c, 24cs, or 24mac. It allows the sequence to be all letters, all digits, or any mix thereof. II) "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" : The second pattern specifically requires that at least one digit appears immediately after 24c, 24cs, or 24mac, and only after this digit can letters appear. As hypothetical example : atmel,24cabc would match the first pattern but not the second because there are no digits immediately following 24c. atmel,24c123 would match both patterns because there are digits immediately following 24c, and the first pattern doesn't care about the position of the digits within the alphanumeric sequence. In case of at24,mac02e4 and at24,mac02e6 match both patterns. Let me know your thoughts. I agree to change the pattern as you suggest. BR, Andrei ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 2024-06-20 10:45 ` Andrei.Simion @ 2024-06-20 11:10 ` Conor Dooley 0 siblings, 0 replies; 8+ messages in thread From: Conor Dooley @ 2024-06-20 11:10 UTC (permalink / raw) To: Andrei.Simion Cc: conor, brgl, robh, krzk+dt, conor+dt, Nicolas.Ferre, alexandre.belloni, claudiu.beznea, arnd, gregkh, linux-i2c, devicetree, linux-kernel, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 2407 bytes --] On Thu, Jun 20, 2024 at 10:45:58AM +0000, Andrei.Simion@microchip.com wrote: > On 19.06.2024 20:53, Conor Dooley wrote: > >> Update regex check and add pattern to match both EEPROMs. > >> > >> Signed-off-by: Andrei Simion <andrei.simion@microchip.com> > >> --- > >> Documentation/devicetree/bindings/eeprom/at24.yaml | 10 +++++++--- > >> 1 file changed, 7 insertions(+), 3 deletions(-) > >> > >> diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml > >> index 3c36cd0510de..46daa662f6e7 100644 > >> --- a/Documentation/devicetree/bindings/eeprom/at24.yaml > >> +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml > >> @@ -18,7 +18,7 @@ select: > >> properties: > >> compatible: > >> contains: > >> - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$" > >> + pattern: "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" > > > Could we relax the pattern instead to make this bloat less? Would it be > > problematic to just allow "^atmel,(24(c|cs|mac)[a-z0-9]+|spd)$"? > > I) "^atmel,(24(c|cs|mac)[a-z0-9]+|spd)$" : > The first pattern does not specify where the digits must occur within > the alphanumeric sequence that follows 24c, 24cs, or 24mac. It allows > the sequence to be all letters, all digits, or any mix thereof. > > II) "^atmel,(24(c|cs|mac)[0-9]+[a-z0-9]*|spd)$" : > The second pattern specifically requires that at least one digit appears > immediately after 24c, 24cs, or 24mac, and only after this digit can > letters appear. > As hypothetical example : > atmel,24cabc would match the first pattern but not the second because > there are no digits immediately following 24c. > atmel,24c123 would match both patterns because there are digits > immediately following 24c, and the first pattern doesn't care about > the position of the digits within the alphanumeric sequence. > > In case of at24,mac02e4 and at24,mac02e6 match both patterns. > > Let me know your thoughts. Basically my reasoning here is that both patterns are very permissive (although one clearly more than the other) and do not stop people from creating compatibles that do not correspond to a real device, so I felt that the more complex regex didn't really provide enough benefit compared to keeping the regex simpler. > I agree to change the pattern as you suggest. :+1: [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-20 11:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 7:22 [PATCH 0/3] Read MAC address through NVMEM for sama7g5ek Andrei Simion
2024-06-19 7:22 ` [PATCH 1/3] eeprom: at24: avoid adjusting offset for 24AA025E{48, 64} Andrei Simion
2024-06-19 7:22 ` [PATCH 2/3] ARM: dts: at91: at91-sama7g5ek: add EEPROMs Andrei Simion
2024-06-20 6:28 ` kernel test robot
2024-06-19 7:22 ` [PATCH 3/3] dt-bindings: eeprom: at24: Add at24,mac02e4 and at24,mac02e6 Andrei Simion
2024-06-19 17:53 ` Conor Dooley
2024-06-20 10:45 ` Andrei.Simion
2024-06-20 11:10 ` Conor Dooley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).