Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

misc: eeprom: Fix EWEN/EWDS/ERAL commands for 93xx56 and 93xx66

commit 14374fbb3f06 ("misc: eeprom_93xx46: Add new 93c56 and 93c66
compatible strings") added support for 93xx56 and 93xx66 eeproms, but
didn't take into account that the write enable/disable + erase all
commands are hardcoded for the 6-bit address of the 93xx46.

This commit fixes the command word generation by increasing the number
of shifts as the address field grows, keeping the command intact.

Also, the check for 8-bit or 16-bit mode is no longer required as this
is already taken into account in the edev->addrlen field.

Signed-off-by: Markus Perkins <markus@notsyncing.net>
Link: https://patch.msgid.link/20251202104823.429869-3-markus@notsyncing.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Markus Perkins and committed by
Greg Kroah-Hartman
b54c82d6 c0fef45d

+3 -8
+3 -8
drivers/misc/eeprom/eeprom_93xx46.c
··· 45 45 #define OP_START 0x4 46 46 #define OP_WRITE (OP_START | 0x1) 47 47 #define OP_READ (OP_START | 0x2) 48 + /* The following addresses are offset for the 1K EEPROM variant in 16-bit mode */ 48 49 #define ADDR_EWDS 0x00 49 50 #define ADDR_ERAL 0x20 50 51 #define ADDR_EWEN 0x30 ··· 192 191 bits = edev->addrlen + 3; 193 192 194 193 cmd_addr = OP_START << edev->addrlen; 195 - if (edev->pdata->flags & EE_ADDR8) 196 - cmd_addr |= (is_on ? ADDR_EWEN : ADDR_EWDS) << 1; 197 - else 198 - cmd_addr |= (is_on ? ADDR_EWEN : ADDR_EWDS); 194 + cmd_addr |= (is_on ? ADDR_EWEN : ADDR_EWDS) << (edev->addrlen - 6); 199 195 200 196 if (has_quirk_instruction_length(edev)) { 201 197 cmd_addr <<= 2; ··· 326 328 bits = edev->addrlen + 3; 327 329 328 330 cmd_addr = OP_START << edev->addrlen; 329 - if (edev->pdata->flags & EE_ADDR8) 330 - cmd_addr |= ADDR_ERAL << 1; 331 - else 332 - cmd_addr |= ADDR_ERAL; 331 + cmd_addr |= ADDR_ERAL << (edev->addrlen - 6); 333 332 334 333 if (has_quirk_instruction_length(edev)) { 335 334 cmd_addr <<= 2;