mirror of
https://github.com/torvalds/linux.git
synced 2025-04-09 14:45:27 +00:00

Clean up the existing export namespace code along the same lines of commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo) to __section("foo")") and for the same reason, it is not desired for the namespace argument to be a macro expansion itself. Scripted using git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file; do awk -i inplace ' /^#define EXPORT_SYMBOL_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /^#define MODULE_IMPORT_NS/ { gsub(/__stringify\(ns\)/, "ns"); print; next; } /MODULE_IMPORT_NS/ { $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g"); } /EXPORT_SYMBOL_NS/ { if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) { if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ && $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ && $0 !~ /^my/) { getline line; gsub(/[[:space:]]*\\$/, ""); gsub(/[[:space:]]/, "", line); $0 = $0 " " line; } $0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/, "\\1(\\2, \"\\3\")", "g"); } } { print }' $file; done Requested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc Acked-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
113 lines
2.7 KiB
C
113 lines
2.7 KiB
C
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
|
|
/*
|
|
* Copyright 2021-2022 Innovative Advantage Inc.
|
|
*/
|
|
|
|
#include <linux/mfd/ocelot.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/regmap.h>
|
|
#include <soc/mscc/ocelot.h>
|
|
#include <soc/mscc/vsc7514_regs.h>
|
|
#include "felix.h"
|
|
|
|
#define VSC7514_NUM_PORTS 11
|
|
|
|
#define OCELOT_PORT_MODE_SERDES (OCELOT_PORT_MODE_SGMII | \
|
|
OCELOT_PORT_MODE_QSGMII)
|
|
|
|
static const u32 vsc7512_port_modes[VSC7514_NUM_PORTS] = {
|
|
OCELOT_PORT_MODE_INTERNAL,
|
|
OCELOT_PORT_MODE_INTERNAL,
|
|
OCELOT_PORT_MODE_INTERNAL,
|
|
OCELOT_PORT_MODE_INTERNAL,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
OCELOT_PORT_MODE_SGMII,
|
|
OCELOT_PORT_MODE_SERDES,
|
|
};
|
|
|
|
static const struct ocelot_ops ocelot_ext_ops = {
|
|
.reset = ocelot_reset,
|
|
.wm_enc = ocelot_wm_enc,
|
|
.wm_dec = ocelot_wm_dec,
|
|
.wm_stat = ocelot_wm_stat,
|
|
.port_to_netdev = felix_port_to_netdev,
|
|
.netdev_to_port = felix_netdev_to_port,
|
|
};
|
|
|
|
static const char * const vsc7512_resource_names[TARGET_MAX] = {
|
|
[SYS] = "sys",
|
|
[REW] = "rew",
|
|
[S0] = "s0",
|
|
[S1] = "s1",
|
|
[S2] = "s2",
|
|
[QS] = "qs",
|
|
[QSYS] = "qsys",
|
|
[ANA] = "ana",
|
|
};
|
|
|
|
static const struct felix_info vsc7512_info = {
|
|
.resource_names = vsc7512_resource_names,
|
|
.regfields = vsc7514_regfields,
|
|
.map = vsc7514_regmap,
|
|
.ops = &ocelot_ext_ops,
|
|
.vcap = vsc7514_vcap_props,
|
|
.num_mact_rows = 1024,
|
|
.num_ports = VSC7514_NUM_PORTS,
|
|
.port_modes = vsc7512_port_modes,
|
|
.phylink_mac_config = ocelot_phylink_mac_config,
|
|
.configure_serdes = ocelot_port_configure_serdes,
|
|
};
|
|
|
|
static int ocelot_ext_probe(struct platform_device *pdev)
|
|
{
|
|
return felix_register_switch(&pdev->dev, 0, 1, false, false,
|
|
DSA_TAG_PROTO_OCELOT, &vsc7512_info);
|
|
}
|
|
|
|
static void ocelot_ext_remove(struct platform_device *pdev)
|
|
{
|
|
struct felix *felix = dev_get_drvdata(&pdev->dev);
|
|
|
|
if (!felix)
|
|
return;
|
|
|
|
dsa_unregister_switch(felix->ds);
|
|
}
|
|
|
|
static void ocelot_ext_shutdown(struct platform_device *pdev)
|
|
{
|
|
struct felix *felix = dev_get_drvdata(&pdev->dev);
|
|
|
|
if (!felix)
|
|
return;
|
|
|
|
dsa_switch_shutdown(felix->ds);
|
|
|
|
dev_set_drvdata(&pdev->dev, NULL);
|
|
}
|
|
|
|
static const struct of_device_id ocelot_ext_switch_of_match[] = {
|
|
{ .compatible = "mscc,vsc7512-switch" },
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match);
|
|
|
|
static struct platform_driver ocelot_ext_switch_driver = {
|
|
.driver = {
|
|
.name = "ocelot-ext-switch",
|
|
.of_match_table = ocelot_ext_switch_of_match,
|
|
},
|
|
.probe = ocelot_ext_probe,
|
|
.remove = ocelot_ext_remove,
|
|
.shutdown = ocelot_ext_shutdown,
|
|
};
|
|
module_platform_driver(ocelot_ext_switch_driver);
|
|
|
|
MODULE_DESCRIPTION("External Ocelot Switch driver");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS("MFD_OCELOT");
|