All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next v2 00/12] net: dsa: mv88e6xxx: misc probe improvements
@ 2016-06-14 18:31 Vivien Didelot
  2016-06-14 18:31 ` [PATCH v2 net-next v2 01/12] net: dsa: mv88e6xxx: fix style issues Vivien Didelot
                   ` (11 more replies)
  0 siblings, 12 replies; 30+ messages in thread
From: Vivien Didelot @ 2016-06-14 18:31 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn,
	Florian Fainelli, Vivien Didelot

Some switch models have different way to access their internal registers
through SMI, and different places where to find the switch ID register.

This patchset abstracts these differences with a new SMI ops structure
and new data in the info structure: the port_base_addr member indicates
where start the ports registers and the MV88E6XXX_FLAG_MULTI_CHIP flag
indicates the need for an indirect SMI access.

The new MDIO probe code uses the compatible info data to detect the
device, and the legacy probe code iterate on compatible info table
(which currently only contains the 88E6085 info) to detect devices.

With these changes, the driver can easily support other switch models
with different register access. For instance, the 88E6060 uses a direct
SMI access even if the chip SMI address is non-zero and port registers
(where the switch ID registers is located) start at 0x8. The port
registers of the 88E6390X start at 0x10. Adding support to probe these
two models would basically look like this:

     static const struct mv88e6xxx_info mv88e6xxx_table[] = {
    +    [MV88E6060] = {
    +        .prod_num = PORT_SWITCH_ID_PROD_NUM_6060,
    +        .family = MV88E6XXX_FAMILY_6060,
    +        .name = "Marvell 88E6060",
    +        .num_databases = 16,
    +        .num_ports = 6,
    +        .port_base_addr = 0x8,
    +        .flags = ...,
    +    },
    +
         [MV88E6085] = {
             .prod_num = PORT_SWITCH_ID_PROD_NUM_6085,
             .family = MV88E6XXX_FAMILY_6097,
    ...
             .port_base_addr = 0x10,
             .flags = MV88E6XXX_FLAGS_FAMILY_6352,
         },
    +
    +    [MV88E6390] = {
    +        .prod_num = PORT_SWITCH_ID_PROD_NUM_6390,
    +        .family = MV88E6XXX_FAMILY_6390,
    +        .name = "Marvell 88E6390X",
    +        .num_databases = 4096,
    +        .num_ports = 11,
    +        .port_base_addr = 0x0,
    +        .flags = ... | MV88E6XXX_FLAG_MULTI_CHIP,
    +    },
     };
     
     static const struct of_device_id mv88e6xxx_of_id_table[] = {
         {
    +        .compatible = "marvell,mv88e6060",
    +        .data = &mv88e6xxx_table[MV88E6060],
    +    }, {
             .compatible = "marvell,mv88e6085",
             .data = &mv88e6xxx_table[MV88E6085],
    +    }, {
    +        .compatible = "marvell,mv88e6390",
    +        .data = &mv88e6xxx_table[MV88E6390],
         },
         { /* sentinel */ },
     };

This patchset also adds helpers to abstract common code of probe
functions and make them more readable before adding the changes
described above.

Changes since v1 [1]:

  - merge style fix from Ben Dooks
  - add Acked-by/Reviewed-by tags
  - drop one compatible string per model
  - detect the SMI device based on the compatible info
  - add an SMI ops structure

[1] https://lkml.org/lkml/2016/6/8/1201

Vivien Didelot (12):
  net: dsa: mv88e6xxx: fix style issues
  net: dsa: mv88e6xxx: remove redundant assignments
  net: dsa: mv88e6xxx: use already declared variables
  net: dsa: mv88e6xxx: do not increment bus refcount
  net: dsa: mv88e6xxx: add switch register helpers
  net: dsa: mv88e6xxx: add port base address to info
  net: dsa: mv88e6xxx: put chip info in ID table
  net: dsa: mv88e6xxx: read switch ID from info
  net: dsa: mv88e6xxx: add SMI detection helper
  net: dsa: mv88e6xxx: iterate on compatible info
  net: dsa: mv88e6xxx: add an SMI ops structure
  net: dsa: mv88e6xxx: add addressing mode to info

 drivers/net/dsa/mv88e6xxx.c | 342 ++++++++++++++++++++++++++++----------------
 drivers/net/dsa/mv88e6xxx.h |  26 +++-
 2 files changed, 244 insertions(+), 124 deletions(-)

-- 
2.8.3

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2016-06-14 23:11 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 18:31 [PATCH v2 net-next v2 00/12] net: dsa: mv88e6xxx: misc probe improvements Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 01/12] net: dsa: mv88e6xxx: fix style issues Vivien Didelot
2016-06-14 21:14   ` Andrew Lunn
2016-06-14 18:31 ` [PATCH v2 net-next v2 02/12] net: dsa: mv88e6xxx: remove redundant assignments Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 03/12] net: dsa: mv88e6xxx: use already declared variables Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 04/12] net: dsa: mv88e6xxx: do not increment bus refcount Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 05/12] net: dsa: mv88e6xxx: add switch register helpers Vivien Didelot
2016-06-14 21:17   ` Andrew Lunn
2016-06-14 18:31 ` [PATCH v2 net-next v2 06/12] net: dsa: mv88e6xxx: add port base address to info Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 07/12] net: dsa: mv88e6xxx: put chip info in ID table Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 08/12] net: dsa: mv88e6xxx: read switch ID from info Vivien Didelot
2016-06-14 18:50   ` Sergei Shtylyov
2016-06-14 21:01     ` Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 09/12] net: dsa: mv88e6xxx: add SMI detection helper Vivien Didelot
2016-06-14 21:50   ` Andrew Lunn
2016-06-14 22:10     ` Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 10/12] net: dsa: mv88e6xxx: iterate on compatible info Vivien Didelot
2016-06-14 19:38   ` Sergei Shtylyov
2016-06-14 21:46   ` Andrew Lunn
2016-06-14 22:13     ` Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 11/12] net: dsa: mv88e6xxx: add an SMI ops structure Vivien Didelot
2016-06-14 22:04   ` Andrew Lunn
2016-06-14 22:26     ` Vivien Didelot
2016-06-14 18:31 ` [PATCH v2 net-next v2 12/12] net: dsa: mv88e6xxx: add addressing mode to info Vivien Didelot
2016-06-14 21:34   ` Andrew Lunn
2016-06-14 21:52     ` Vivien Didelot
2016-06-14 22:09   ` Andrew Lunn
2016-06-14 22:24     ` Vivien Didelot
2016-06-14 22:44       ` Andrew Lunn
2016-06-14 23:11         ` Vivien Didelot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.