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.

net: dsa: mv88e6xxx: Make global2 support mandatory

Early generations of the mv88e6xxx did not have the global 2
registers. In order to keep the driver slim, it was decided to make
the code for these registers optional. Over time, more generations of
switches have been added, always supporting global 2 and adding more
and more registers. No effort has been made to keep these additional
registers also optional to slim the driver down when used for older
generations. Optional global 2 now just gives additional development
and maintenance burden for no real gain.

Make global 2 support always compiled in.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Tested-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20210127003210.663173-1-andrew@lunn.ch
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Andrew Lunn and committed by
Jakub Kicinski
63368a74 5998dd02

+3 -213
-12
drivers/net/dsa/mv88e6xxx/Kconfig
··· 9 9 This driver adds support for most of the Marvell 88E6xxx models of 10 10 Ethernet switch chips, except 88E6060. 11 11 12 - config NET_DSA_MV88E6XXX_GLOBAL2 13 - bool "Switch Global 2 Registers support" 14 - default y 15 - depends on NET_DSA_MV88E6XXX 16 - help 17 - This registers set at internal SMI address 0x1C provides extended 18 - features like EEPROM interface, trunking, cross-chip setup, etc. 19 - 20 - It is required on most chips. If the chip you compile the support for 21 - doesn't have such registers set, say N here. In doubt, say Y. 22 - 23 12 config NET_DSA_MV88E6XXX_PTP 24 13 bool "PTP support for Marvell 88E6xxx" 25 14 default n 26 - depends on NET_DSA_MV88E6XXX_GLOBAL2 27 15 depends on PTP_1588_CLOCK 28 16 help 29 17 Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch
+3 -3
drivers/net/dsa/mv88e6xxx/Makefile
··· 5 5 mv88e6xxx-objs += global1.o 6 6 mv88e6xxx-objs += global1_atu.o 7 7 mv88e6xxx-objs += global1_vtu.o 8 - mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2) += global2.o 9 - mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2) += global2_avb.o 10 - mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2) += global2_scratch.o 8 + mv88e6xxx-objs += global2.o 9 + mv88e6xxx-objs += global2_avb.o 10 + mv88e6xxx-objs += global2_scratch.o 11 11 mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_PTP) += hwtstamp.o 12 12 mv88e6xxx-objs += phy.o 13 13 mv88e6xxx-objs += port.o
-4
drivers/net/dsa/mv88e6xxx/chip.c
··· 5227 5227 /* Update the compatible info with the probed one */ 5228 5228 chip->info = info; 5229 5229 5230 - err = mv88e6xxx_g2_require(chip); 5231 - if (err) 5232 - return err; 5233 - 5234 5230 dev_info(chip->dev, "switch 0x%x detected: %s, revision %u\n", 5235 5231 chip->info->prod_num, chip->info->name, rev); 5236 5232
-194
drivers/net/dsa/mv88e6xxx/global2.h
··· 296 296 #define MV88E6352_G2_SCRATCH_GPIO_PCTL_TRIG 1 297 297 #define MV88E6352_G2_SCRATCH_GPIO_PCTL_EVREQ 2 298 298 299 - #ifdef CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 300 - 301 - static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) 302 - { 303 - return 0; 304 - } 305 - 306 299 int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val); 307 300 int mv88e6xxx_g2_write(struct mv88e6xxx_chip *chip, int reg, u16 val); 308 301 int mv88e6xxx_g2_wait_bit(struct mv88e6xxx_chip *chip, int reg, ··· 362 369 bool external); 363 370 int mv88e6xxx_g2_atu_stats_set(struct mv88e6xxx_chip *chip, u16 kind, u16 bin); 364 371 int mv88e6xxx_g2_atu_stats_get(struct mv88e6xxx_chip *chip, u16 *stats); 365 - 366 - #else /* !CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 367 - 368 - static inline int mv88e6xxx_g2_require(struct mv88e6xxx_chip *chip) 369 - { 370 - if (chip->info->global2_addr) { 371 - dev_err(chip->dev, "this chip requires CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 enabled\n"); 372 - return -EOPNOTSUPP; 373 - } 374 - 375 - return 0; 376 - } 377 - 378 - static inline int mv88e6xxx_g2_read(struct mv88e6xxx_chip *chip, int reg, u16 *val) 379 - { 380 - return -EOPNOTSUPP; 381 - } 382 - 383 - static inline int mv88e6xxx_g2_write(struct mv88e6xxx_chip *chip, int reg, u16 val) 384 - { 385 - return -EOPNOTSUPP; 386 - } 387 - 388 - static inline int mv88e6xxx_g2_wait_bit(struct mv88e6xxx_chip *chip, 389 - int reg, int bit, int val) 390 - { 391 - return -EOPNOTSUPP; 392 - } 393 - 394 - static inline int mv88e6352_g2_irl_init_all(struct mv88e6xxx_chip *chip, 395 - int port) 396 - { 397 - return -EOPNOTSUPP; 398 - } 399 - 400 - static inline int mv88e6390_g2_irl_init_all(struct mv88e6xxx_chip *chip, 401 - int port) 402 - { 403 - return -EOPNOTSUPP; 404 - } 405 - 406 - static inline int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip, 407 - struct mii_bus *bus, 408 - int addr, int reg, u16 *val) 409 - { 410 - return -EOPNOTSUPP; 411 - } 412 - 413 - static inline int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip, 414 - struct mii_bus *bus, 415 - int addr, int reg, u16 val) 416 - { 417 - return -EOPNOTSUPP; 418 - } 419 - 420 - static inline int mv88e6xxx_g2_set_switch_mac(struct mv88e6xxx_chip *chip, 421 - u8 *addr) 422 - { 423 - return -EOPNOTSUPP; 424 - } 425 - 426 - static inline int mv88e6xxx_g2_get_eeprom8(struct mv88e6xxx_chip *chip, 427 - struct ethtool_eeprom *eeprom, 428 - u8 *data) 429 - { 430 - return -EOPNOTSUPP; 431 - } 432 - 433 - static inline int mv88e6xxx_g2_set_eeprom8(struct mv88e6xxx_chip *chip, 434 - struct ethtool_eeprom *eeprom, 435 - u8 *data) 436 - { 437 - return -EOPNOTSUPP; 438 - } 439 - 440 - static inline int mv88e6xxx_g2_get_eeprom16(struct mv88e6xxx_chip *chip, 441 - struct ethtool_eeprom *eeprom, 442 - u8 *data) 443 - { 444 - return -EOPNOTSUPP; 445 - } 446 - 447 - static inline int mv88e6xxx_g2_set_eeprom16(struct mv88e6xxx_chip *chip, 448 - struct ethtool_eeprom *eeprom, 449 - u8 *data) 450 - { 451 - return -EOPNOTSUPP; 452 - } 453 - 454 - static inline int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, 455 - int src_dev, int src_port, u16 data) 456 - { 457 - return -EOPNOTSUPP; 458 - } 459 - 460 - static inline int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) 461 - { 462 - return -EOPNOTSUPP; 463 - } 464 - 465 - static inline int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip) 466 - { 467 - return -EOPNOTSUPP; 468 - } 469 - 470 - static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip) 471 - { 472 - } 473 - 474 - static inline int mv88e6xxx_g2_irq_mdio_setup(struct mv88e6xxx_chip *chip, 475 - struct mii_bus *bus) 476 - { 477 - return 0; 478 - } 479 - 480 - static inline void mv88e6xxx_g2_irq_mdio_free(struct mv88e6xxx_chip *chip, 481 - struct mii_bus *bus) 482 - { 483 - } 484 - 485 - static inline int mv88e6185_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) 486 - { 487 - return -EOPNOTSUPP; 488 - } 489 - 490 - static inline int mv88e6352_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) 491 - { 492 - return -EOPNOTSUPP; 493 - } 494 - 495 - static inline int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip) 496 - { 497 - return -EOPNOTSUPP; 498 - } 499 - 500 - static const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops = {}; 501 - static const struct mv88e6xxx_irq_ops mv88e6250_watchdog_ops = {}; 502 - static const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops = {}; 503 - 504 - static const struct mv88e6xxx_avb_ops mv88e6165_avb_ops = {}; 505 - static const struct mv88e6xxx_avb_ops mv88e6352_avb_ops = {}; 506 - static const struct mv88e6xxx_avb_ops mv88e6390_avb_ops = {}; 507 - 508 - static const struct mv88e6xxx_gpio_ops mv88e6352_gpio_ops = {}; 509 - 510 - static inline int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip, 511 - bool external) 512 - { 513 - return -EOPNOTSUPP; 514 - } 515 - 516 - static inline int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip) 517 - { 518 - return -EOPNOTSUPP; 519 - } 520 - 521 - static inline int mv88e6xxx_g2_trunk_mask_write(struct mv88e6xxx_chip *chip, 522 - int num, bool hash, u16 mask) 523 - { 524 - return -EOPNOTSUPP; 525 - } 526 - 527 - static inline int mv88e6xxx_g2_trunk_mapping_write(struct mv88e6xxx_chip *chip, 528 - int id, u16 map) 529 - { 530 - return -EOPNOTSUPP; 531 - } 532 - 533 - static inline int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, 534 - int target, int port) 535 - { 536 - return -EOPNOTSUPP; 537 - } 538 - 539 - static inline int mv88e6xxx_g2_atu_stats_set(struct mv88e6xxx_chip *chip, 540 - u16 kind, u16 bin) 541 - { 542 - return -EOPNOTSUPP; 543 - } 544 - 545 - static inline int mv88e6xxx_g2_atu_stats_get(struct mv88e6xxx_chip *chip, 546 - u16 *stats) 547 - { 548 - return -EOPNOTSUPP; 549 - } 550 - 551 - #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ 552 372 553 373 #endif /* _MV88E6XXX_GLOBAL2_H */