Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __DSA_PDATA_H
0003 #define __DSA_PDATA_H
0004 
0005 struct device;
0006 struct net_device;
0007 
0008 #define DSA_MAX_SWITCHES    4
0009 #define DSA_MAX_PORTS       12
0010 #define DSA_RTABLE_NONE     -1
0011 
0012 struct dsa_chip_data {
0013     /*
0014      * How to access the switch configuration registers.
0015      */
0016     struct device   *host_dev;
0017     int     sw_addr;
0018 
0019     /*
0020      * Reference to network devices
0021      */
0022     struct device   *netdev[DSA_MAX_PORTS];
0023 
0024     /* set to size of eeprom if supported by the switch */
0025     int     eeprom_len;
0026 
0027     /* Device tree node pointer for this specific switch chip
0028      * used during switch setup in case additional properties
0029      * and resources needs to be used
0030      */
0031     struct device_node *of_node;
0032 
0033     /*
0034      * The names of the switch's ports.  Use "cpu" to
0035      * designate the switch port that the cpu is connected to,
0036      * "dsa" to indicate that this port is a DSA link to
0037      * another switch, NULL to indicate the port is unused,
0038      * or any other string to indicate this is a physical port.
0039      */
0040     char        *port_names[DSA_MAX_PORTS];
0041     struct device_node *port_dn[DSA_MAX_PORTS];
0042 
0043     /*
0044      * An array of which element [a] indicates which port on this
0045      * switch should be used to send packets to that are destined
0046      * for switch a. Can be NULL if there is only one switch chip.
0047      */
0048     s8      rtable[DSA_MAX_SWITCHES];
0049 };
0050 
0051 struct dsa_platform_data {
0052     /*
0053      * Reference to a Linux network interface that connects
0054      * to the root switch chip of the tree.
0055      */
0056     struct device   *netdev;
0057     struct net_device *of_netdev;
0058 
0059     /*
0060      * Info structs describing each of the switch chips
0061      * connected via this network interface.
0062      */
0063     int     nr_chips;
0064     struct dsa_chip_data    *chip;
0065 };
0066 
0067 
0068 #endif /* __DSA_PDATA_H */