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

misc: eeprom_93xx46: Add new 93c56 and 93c66 compatible strings

These two devices have respectively 2048 and 4096 bits of storage,
compared to 1024 for the 93c46.

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Link: https://lore.kernel.org/r/20210511210727.24895-3-linkmauve@linkmauve.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Emmanuel Gil Peyrot and committed by
Greg Kroah-Hartman
14374fbb 4a5ff99b

+35 -3
+32 -3
drivers/misc/eeprom/eeprom_93xx46.c
··· 29 29 30 30 struct eeprom_93xx46_devtype_data { 31 31 unsigned int quirks; 32 + unsigned char flags; 33 + }; 34 + 35 + static const struct eeprom_93xx46_devtype_data at93c46_data = { 36 + .flags = EE_SIZE1K, 37 + }; 38 + 39 + static const struct eeprom_93xx46_devtype_data at93c56_data = { 40 + .flags = EE_SIZE2K, 41 + }; 42 + 43 + static const struct eeprom_93xx46_devtype_data at93c66_data = { 44 + .flags = EE_SIZE4K, 32 45 }; 33 46 34 47 static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = { 48 + .flags = EE_SIZE1K, 35 49 .quirks = EEPROM_93XX46_QUIRK_SINGLE_WORD_READ | 36 50 EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH, 37 51 }; 38 52 39 53 static const struct eeprom_93xx46_devtype_data microchip_93lc46b_data = { 54 + .flags = EE_SIZE1K, 40 55 .quirks = EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE, 41 56 }; 42 57 ··· 396 381 } 397 382 398 383 static const struct of_device_id eeprom_93xx46_of_table[] = { 399 - { .compatible = "eeprom-93xx46", }, 384 + { .compatible = "eeprom-93xx46", .data = &at93c46_data, }, 385 + { .compatible = "atmel,at93c46", .data = &at93c46_data, }, 400 386 { .compatible = "atmel,at93c46d", .data = &atmel_at93c46d_data, }, 387 + { .compatible = "atmel,at93c56", .data = &at93c56_data, }, 388 + { .compatible = "atmel,at93c66", .data = &at93c66_data, }, 401 389 { .compatible = "microchip,93lc46b", .data = &microchip_93lc46b_data, }, 402 390 {} 403 391 }; ··· 450 432 const struct eeprom_93xx46_devtype_data *data = of_id->data; 451 433 452 434 pd->quirks = data->quirks; 435 + pd->flags |= data->flags; 453 436 } 454 437 455 438 spi->dev.platform_data = pd; ··· 480 461 if (!edev) 481 462 return -ENOMEM; 482 463 483 - edev->size = 128; 464 + if (pd->flags & EE_SIZE1K) 465 + edev->size = 128; 466 + else if (pd->flags & EE_SIZE2K) 467 + edev->size = 256; 468 + else if (pd->flags & EE_SIZE4K) 469 + edev->size = 512; 470 + else { 471 + dev_err(&spi->dev, "unspecified size\n"); 472 + return -EINVAL; 473 + } 484 474 485 475 if (pd->flags & EE_ADDR8) 486 476 edev->addrlen = ilog2(edev->size); ··· 524 496 if (IS_ERR(edev->nvmem)) 525 497 return PTR_ERR(edev->nvmem); 526 498 527 - dev_info(&spi->dev, "%d-bit eeprom %s\n", 499 + dev_info(&spi->dev, "%d-bit eeprom containing %d bytes %s\n", 528 500 (pd->flags & EE_ADDR8) ? 8 : 16, 501 + edev->size, 529 502 (pd->flags & EE_READONLY) ? "(readonly)" : ""); 530 503 531 504 if (!(pd->flags & EE_READONLY)) {
+3
include/linux/eeprom_93xx46.h
··· 10 10 #define EE_ADDR8 0x01 /* 8 bit addr. cfg */ 11 11 #define EE_ADDR16 0x02 /* 16 bit addr. cfg */ 12 12 #define EE_READONLY 0x08 /* forbid writing */ 13 + #define EE_SIZE1K 0x10 /* 1 kb of data, that is a 93xx46 */ 14 + #define EE_SIZE2K 0x20 /* 2 kb of data, that is a 93xx56 */ 15 + #define EE_SIZE4K 0x40 /* 4 kb of data, that is a 93xx66 */ 13 16 14 17 unsigned int quirks; 15 18 /* Single word read transfers only; no sequential read. */