module: Convert symbol namespace to string literal
[linux.git] / drivers / net / dsa / ocelot / ocelot_ext.c
blobd5c557a20292ede5e0de7e5587393b2e3ffb2b9d
1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
2 /*
3 * Copyright 2021-2022 Innovative Advantage Inc.
4 */
6 #include <linux/mfd/ocelot.h>
7 #include <linux/platform_device.h>
8 #include <linux/regmap.h>
9 #include <soc/mscc/ocelot.h>
10 #include <soc/mscc/vsc7514_regs.h>
11 #include "felix.h"
13 #define VSC7514_NUM_PORTS 11
15 #define OCELOT_PORT_MODE_SERDES (OCELOT_PORT_MODE_SGMII | \
16 OCELOT_PORT_MODE_QSGMII)
18 static const u32 vsc7512_port_modes[VSC7514_NUM_PORTS] = {
19 OCELOT_PORT_MODE_INTERNAL,
20 OCELOT_PORT_MODE_INTERNAL,
21 OCELOT_PORT_MODE_INTERNAL,
22 OCELOT_PORT_MODE_INTERNAL,
23 OCELOT_PORT_MODE_SERDES,
24 OCELOT_PORT_MODE_SERDES,
25 OCELOT_PORT_MODE_SERDES,
26 OCELOT_PORT_MODE_SERDES,
27 OCELOT_PORT_MODE_SERDES,
28 OCELOT_PORT_MODE_SGMII,
29 OCELOT_PORT_MODE_SERDES,
32 static const struct ocelot_ops ocelot_ext_ops = {
33 .reset = ocelot_reset,
34 .wm_enc = ocelot_wm_enc,
35 .wm_dec = ocelot_wm_dec,
36 .wm_stat = ocelot_wm_stat,
37 .port_to_netdev = felix_port_to_netdev,
38 .netdev_to_port = felix_netdev_to_port,
41 static const char * const vsc7512_resource_names[TARGET_MAX] = {
42 [SYS] = "sys",
43 [REW] = "rew",
44 [S0] = "s0",
45 [S1] = "s1",
46 [S2] = "s2",
47 [QS] = "qs",
48 [QSYS] = "qsys",
49 [ANA] = "ana",
52 static const struct felix_info vsc7512_info = {
53 .resource_names = vsc7512_resource_names,
54 .regfields = vsc7514_regfields,
55 .map = vsc7514_regmap,
56 .ops = &ocelot_ext_ops,
57 .vcap = vsc7514_vcap_props,
58 .num_mact_rows = 1024,
59 .num_ports = VSC7514_NUM_PORTS,
60 .port_modes = vsc7512_port_modes,
61 .phylink_mac_config = ocelot_phylink_mac_config,
62 .configure_serdes = ocelot_port_configure_serdes,
65 static int ocelot_ext_probe(struct platform_device *pdev)
67 return felix_register_switch(&pdev->dev, 0, 1, false, false,
68 DSA_TAG_PROTO_OCELOT, &vsc7512_info);
71 static void ocelot_ext_remove(struct platform_device *pdev)
73 struct felix *felix = dev_get_drvdata(&pdev->dev);
75 if (!felix)
76 return;
78 dsa_unregister_switch(felix->ds);
81 static void ocelot_ext_shutdown(struct platform_device *pdev)
83 struct felix *felix = dev_get_drvdata(&pdev->dev);
85 if (!felix)
86 return;
88 dsa_switch_shutdown(felix->ds);
90 dev_set_drvdata(&pdev->dev, NULL);
93 static const struct of_device_id ocelot_ext_switch_of_match[] = {
94 { .compatible = "mscc,vsc7512-switch" },
95 { },
97 MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match);
99 static struct platform_driver ocelot_ext_switch_driver = {
100 .driver = {
101 .name = "ocelot-ext-switch",
102 .of_match_table = ocelot_ext_switch_of_match,
104 .probe = ocelot_ext_probe,
105 .remove = ocelot_ext_remove,
106 .shutdown = ocelot_ext_shutdown,
108 module_platform_driver(ocelot_ext_switch_driver);
110 MODULE_DESCRIPTION("External Ocelot Switch driver");
111 MODULE_LICENSE("GPL");
112 MODULE_IMPORT_NS("MFD_OCELOT");