Skip to content

Commit

Permalink
net: dsa: realtek: convert subdrivers into modules
Browse files Browse the repository at this point in the history
Preparing for multiple interfaces support, the drivers
must be independent of realtek-smi.

Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
Tested-by: Arınç ÜNAL <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Alvin Šipraga <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
luizluca authored and davem330 committed Jan 28, 2022
1 parent cd645dc commit 765c39a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
20 changes: 18 additions & 2 deletions drivers/net/dsa/realtek/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
menuconfig NET_DSA_REALTEK
tristate "Realtek Ethernet switch family support"
depends on NET_DSA
select NET_DSA_TAG_RTL4_A
select NET_DSA_TAG_RTL8_4
select FIXED_PHY
select IRQ_DOMAIN
select REALTEK_PHY
Expand All @@ -18,3 +16,21 @@ config NET_DSA_REALTEK_SMI
help
Select to enable support for registering switches connected
through SMI.

config NET_DSA_REALTEK_RTL8365MB
tristate "Realtek RTL8365MB switch subdriver"
default y
depends on NET_DSA_REALTEK
depends on NET_DSA_REALTEK_SMI
select NET_DSA_TAG_RTL8_4
help
Select to enable support for Realtek RTL8365MB

config NET_DSA_REALTEK_RTL8366RB
tristate "Realtek RTL8366RB switch subdriver"
default y
depends on NET_DSA_REALTEK
depends on NET_DSA_REALTEK_SMI
select NET_DSA_TAG_RTL4_A
help
Select to enable support for Realtek RTL8366RB
4 changes: 3 additions & 1 deletion drivers/net/dsa/realtek/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o
obj-$(CONFIG_NET_DSA_REALTEK_RTL8366RB) += rtl8366.o
rtl8366-objs := rtl8366-core.o rtl8366rb.o
obj-$(CONFIG_NET_DSA_REALTEK_RTL8365MB) += rtl8365mb.o
Original file line number Diff line number Diff line change
Expand Up @@ -494,19 +494,23 @@ static void realtek_smi_shutdown(struct platform_device *pdev)
}

static const struct of_device_id realtek_smi_of_match[] = {
#if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8366RB)
{
.compatible = "realtek,rtl8366rb",
.data = &rtl8366rb_variant,
},
#endif
{
/* FIXME: add support for RTL8366S and more */
.compatible = "realtek,rtl8366s",
.data = NULL,
},
#if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8365MB)
{
.compatible = "realtek,rtl8365mb",
.data = &rtl8365mb_variant,
},
#endif
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, realtek_smi_of_match);
Expand All @@ -522,4 +526,6 @@ static struct platform_driver realtek_smi_driver = {
};
module_platform_driver(realtek_smi_driver);

MODULE_AUTHOR("Linus Walleij <[email protected]>");
MODULE_DESCRIPTION("Driver for Realtek ethernet switch connected via SMI interface");
MODULE_LICENSE("GPL");
4 changes: 4 additions & 0 deletions drivers/net/dsa/realtek/rtl8365mb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1986,3 +1986,7 @@ const struct realtek_variant rtl8365mb_variant = {
.chip_data_sz = sizeof(struct rtl8365mb),
};
EXPORT_SYMBOL_GPL(rtl8365mb_variant);

MODULE_AUTHOR("Alvin Šipraga <[email protected]>");
MODULE_DESCRIPTION("Driver for RTL8365MB-VC ethernet switch");
MODULE_LICENSE("GPL");
File renamed without changes.
4 changes: 4 additions & 0 deletions drivers/net/dsa/realtek/rtl8366rb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1816,3 +1816,7 @@ const struct realtek_variant rtl8366rb_variant = {
.chip_data_sz = sizeof(struct rtl8366rb),
};
EXPORT_SYMBOL_GPL(rtl8366rb_variant);

MODULE_AUTHOR("Linus Walleij <[email protected]>");
MODULE_DESCRIPTION("Driver for RTL8366RB ethernet switch");
MODULE_LICENSE("GPL");

0 comments on commit 765c39a

Please sign in to comment.