net: dsa: mv88e6xxx: factorize GLOBAL_CONTROL_2 setup
[deliverable/linux.git] / drivers / net / dsa / mv88e6123.c
CommitLineData
91da11f8
LB
1/*
2 * net/dsa/mv88e6123_61_65.c - Marvell 88e6123/6161/6165 switch chip support
e84665c9 3 * Copyright (c) 2008-2009 Marvell Semiconductor
91da11f8
LB
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
19b2f97e
BG
11#include <linux/delay.h>
12#include <linux/jiffies.h>
91da11f8 13#include <linux/list.h>
2bbba277 14#include <linux/module.h>
91da11f8
LB
15#include <linux/netdevice.h>
16#include <linux/phy.h>
c8f0b869 17#include <net/dsa.h>
91da11f8
LB
18#include "mv88e6xxx.h"
19
f6271e67
VD
20static const struct mv88e6xxx_info mv88e6123_table[] = {
21 {
22 .prod_num = PORT_SWITCH_ID_PROD_NUM_6123,
22356476 23 .family = MV88E6XXX_FAMILY_6165,
f6271e67 24 .name = "Marvell 88E6123",
cd5a2c82 25 .num_databases = 4096,
009a2b98 26 .num_ports = 3,
b5058d7a 27 .flags = MV88E6XXX_FLAGS_FAMILY_6165,
f6271e67
VD
28 }, {
29 .prod_num = PORT_SWITCH_ID_PROD_NUM_6161,
22356476 30 .family = MV88E6XXX_FAMILY_6165,
f6271e67 31 .name = "Marvell 88E6161",
cd5a2c82 32 .num_databases = 4096,
009a2b98 33 .num_ports = 6,
b5058d7a 34 .flags = MV88E6XXX_FLAGS_FAMILY_6165,
f6271e67
VD
35 }, {
36 .prod_num = PORT_SWITCH_ID_PROD_NUM_6165,
22356476 37 .family = MV88E6XXX_FAMILY_6165,
f6271e67 38 .name = "Marvell 88E6165",
cd5a2c82 39 .num_databases = 4096,
009a2b98 40 .num_ports = 6,
b5058d7a 41 .flags = MV88E6XXX_FLAGS_FAMILY_6165,
f6271e67 42 }
b9b37713
VD
43};
44
0209d144
VD
45static const char *mv88e6123_drv_probe(struct device *dsa_dev,
46 struct device *host_dev, int sw_addr,
47 void **priv)
91da11f8 48{
a77d43f1
AL
49 return mv88e6xxx_drv_probe(dsa_dev, host_dev, sw_addr, priv,
50 mv88e6123_table,
51 ARRAY_SIZE(mv88e6123_table));
91da11f8
LB
52}
53
ca3dfa51 54static int mv88e6123_setup(struct dsa_switch *ds)
91da11f8 55{
158bc065 56 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
91da11f8
LB
57 int ret;
58
158bc065
AL
59 ps->ds = ds;
60
61 ret = mv88e6xxx_setup_common(ps);
acdaffcc
GR
62 if (ret < 0)
63 return ret;
91da11f8 64
dbde9e66 65 return mv88e6xxx_setup_ports(ds);
91da11f8
LB
66}
67
ca3dfa51 68struct dsa_switch_driver mv88e6123_switch_driver = {
ac7a04c3 69 .tag_protocol = DSA_TAG_PROTO_EDSA,
e49bad31 70 .probe = mv88e6123_drv_probe,
ca3dfa51 71 .setup = mv88e6123_setup,
1d13a06e 72 .set_addr = mv88e6xxx_set_addr,
fd3a0ee4
AL
73 .phy_read = mv88e6xxx_phy_read,
74 .phy_write = mv88e6xxx_phy_write,
aadbdb8a
VD
75 .set_eee = mv88e6xxx_set_eee,
76 .get_eee = mv88e6xxx_get_eee,
e413e7e1
AL
77 .get_strings = mv88e6xxx_get_strings,
78 .get_ethtool_stats = mv88e6xxx_get_ethtool_stats,
79 .get_sset_count = mv88e6xxx_get_sset_count,
dea87024 80 .adjust_link = mv88e6xxx_adjust_link,
87e5f66b 81#ifdef CONFIG_NET_DSA_HWMON
eaa23765 82 .get_temp = mv88e6xxx_get_temp,
6594f615
VD
83 .get_temp_limit = mv88e6xxx_get_temp_limit,
84 .set_temp_limit = mv88e6xxx_set_temp_limit,
85 .get_temp_alarm = mv88e6xxx_get_temp_alarm,
87e5f66b 86#endif
d24645be
VD
87 .get_eeprom = mv88e6xxx_get_eeprom,
88 .set_eeprom = mv88e6xxx_set_eeprom,
a1ab91f3
GR
89 .get_regs_len = mv88e6xxx_get_regs_len,
90 .get_regs = mv88e6xxx_get_regs,
936f234a
VD
91 .port_bridge_join = mv88e6xxx_port_bridge_join,
92 .port_bridge_leave = mv88e6xxx_port_bridge_leave,
93 .port_stp_state_set = mv88e6xxx_port_stp_state_set,
54d77b5b
VD
94 .port_vlan_filtering = mv88e6xxx_port_vlan_filtering,
95 .port_vlan_prepare = mv88e6xxx_port_vlan_prepare,
96 .port_vlan_add = mv88e6xxx_port_vlan_add,
97 .port_vlan_del = mv88e6xxx_port_vlan_del,
98 .port_vlan_dump = mv88e6xxx_port_vlan_dump,
2672f825
VD
99 .port_fdb_prepare = mv88e6xxx_port_fdb_prepare,
100 .port_fdb_add = mv88e6xxx_port_fdb_add,
101 .port_fdb_del = mv88e6xxx_port_fdb_del,
102 .port_fdb_dump = mv88e6xxx_port_fdb_dump,
91da11f8 103};
3d825ede
BH
104
105MODULE_ALIAS("platform:mv88e6123");
106MODULE_ALIAS("platform:mv88e6161");
107MODULE_ALIAS("platform:mv88e6165");
This page took 0.55613 seconds and 5 git commands to generate.