Commit 0db0561d authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'Felix-DSA-driver-cleanup-build-Seville-separately'



Vladimir Oltean says:

====================
Felix DSA driver cleanup: build Seville separately

When introducing the Seville switch support to the Felix driver, some
technical debt was created. Since both VSC9959 and VSC9953 are embedded
switches (one on an arm64 SoC and the other on a powerpc SoC), there is
no use case for having the code for both be present in the same module.

This was necessary at the time due to the common SERDES PCS code that
they were using, but that has been since refactored into
drivers/net/pcs/pcs-lynx.c.

This makes the Seville driver stop uselessly depending upon PCI and
FSL_ENETC_MDIO, which were only dependencies of Felix in fact.

Some whitespace/tab conversions are also present in this series as part
of the cleanup process.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 42ccf1cd d60bc62d
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -10,11 +10,17 @@ config NET_DSA_MSCC_FELIX
	select FSL_ENETC_MDIO
	select PCS_LYNX
	help
	  This driver supports network switches from the Vitesse /
	  Microsemi / Microchip Ocelot family of switching cores that are
	  connected to their host CPU via Ethernet.
	  The following switches are supported:
	  - VSC9959 (Felix): embedded as a PCIe function of the NXP LS1028A
	    ENETC integrated endpoint.
	  - VSC9953 (Seville): embedded as a platform device on the
	    NXP T1040 SoC.
	  This driver supports the VSC9959 (Felix) switch, which is embedded as
	  a PCIe function of the NXP LS1028A ENETC RCiEP.

config NET_DSA_MSCC_SEVILLE
	tristate "Ocelot / Seville Ethernet switch support"
	depends on NET_DSA
	depends on NET_VENDOR_MICROSEMI
	depends on HAS_IOMEM
	select MSCC_OCELOT_SWITCH_LIB
	select NET_DSA_TAG_OCELOT
	select PCS_LYNX
	help
	  This driver supports the VSC9953 (Seville) switch, which is embedded
	  as a platform device on the NXP T1040 SoC.
+5 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o
obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o

mscc_felix-objs := \
	felix.o \
	felix_vsc9959.o \
	felix_vsc9959.o

mscc_seville-objs := \
	felix.o \
	seville_vsc9953.o
+2 −45
Original line number Diff line number Diff line
@@ -538,23 +538,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
	return 0;
}

static struct ptp_clock_info ocelot_ptp_clock_info = {
	.owner		= THIS_MODULE,
	.name		= "felix ptp",
	.max_adj	= 0x7fffffff,
	.n_alarm	= 0,
	.n_ext_ts	= 0,
	.n_per_out	= OCELOT_PTP_PINS_NUM,
	.n_pins		= OCELOT_PTP_PINS_NUM,
	.pps		= 0,
	.gettime64	= ocelot_ptp_gettime64,
	.settime64	= ocelot_ptp_settime64,
	.adjtime	= ocelot_ptp_adjtime,
	.adjfine	= ocelot_ptp_adjfine,
	.verify		= ocelot_ptp_verify,
	.enable		= ocelot_ptp_enable,
};

/* Hardware initialization done here so that we can allocate structures with
 * devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing
 * us to allocate structures twice (leak memory) and map PCI memory twice
@@ -573,7 +556,7 @@ static int felix_setup(struct dsa_switch *ds)

	ocelot_init(ocelot);
	if (ocelot->ptp) {
		err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
		err = ocelot_init_timestamp(ocelot, felix->info->ptp_caps);
		if (err) {
			dev_err(ocelot->dev,
				"Timestamp initialization failed\n");
@@ -799,29 +782,3 @@ const struct dsa_switch_ops felix_switch_ops = {
	.cls_flower_stats	= felix_cls_flower_stats,
	.port_setup_tc		= felix_port_setup_tc,
};

static int __init felix_init(void)
{
	int err;

	err = pci_register_driver(&felix_vsc9959_pci_driver);
	if (err)
		return err;

	err = platform_driver_register(&seville_vsc9953_driver);
	if (err)
		return err;

	return 0;
}
module_init(felix_init);

static void __exit felix_exit(void)
{
	pci_unregister_driver(&felix_vsc9959_pci_driver);
	platform_driver_unregister(&seville_vsc9953_driver);
}
module_exit(felix_exit);

MODULE_DESCRIPTION("Felix Switch driver");
MODULE_LICENSE("GPL v2");
+2 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ struct felix_info {
	const struct vcap_props		*vcap;
	int				switch_pci_bar;
	int				imdio_pci_bar;
	const struct ptp_clock_info	*ptp_caps;
	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
	void	(*mdio_bus_free)(struct ocelot *ocelot);
	void	(*phylink_validate)(struct ocelot *ocelot, int port,
@@ -41,8 +42,6 @@ struct felix_info {
};

extern const struct dsa_switch_ops felix_switch_ops;
extern struct pci_driver felix_vsc9959_pci_driver;
extern struct platform_driver seville_vsc9953_driver;

/* DSA glue / front-end for struct ocelot */
struct felix {
@@ -55,6 +54,4 @@ struct felix {
	resource_size_t			imdio_base;
};

void vsc9959_mdio_bus_free(struct ocelot *ocelot);

#endif
+41 −16
Original line number Diff line number Diff line
@@ -719,6 +719,23 @@ static const struct vcap_props vsc9959_vcap_props[] = {
	},
};

static const struct ptp_clock_info vsc9959_ptp_caps = {
	.owner		= THIS_MODULE,
	.name		= "felix ptp",
	.max_adj	= 0x7fffffff,
	.n_alarm	= 0,
	.n_ext_ts	= 0,
	.n_per_out	= OCELOT_PTP_PINS_NUM,
	.n_pins		= OCELOT_PTP_PINS_NUM,
	.pps		= 0,
	.gettime64	= ocelot_ptp_gettime64,
	.settime64	= ocelot_ptp_settime64,
	.adjtime	= ocelot_ptp_adjtime,
	.adjfine	= ocelot_ptp_adjfine,
	.verify		= ocelot_ptp_verify,
	.enable		= ocelot_ptp_enable,
};

#define VSC9959_INIT_TIMEOUT			50000
#define VSC9959_GCB_RST_SLEEP			100
#define VSC9959_SYS_RAMINIT_SLEEP		80
@@ -727,7 +744,7 @@ static int vsc9959_gcb_soft_rst_status(struct ocelot *ocelot)
{
	int val;

	regmap_field_read(ocelot->regfields[GCB_SOFT_RST_SWC_RST], &val);
	ocelot_field_read(ocelot, GCB_SOFT_RST_SWC_RST, &val);

	return val;
}
@@ -737,12 +754,15 @@ static int vsc9959_sys_ram_init_status(struct ocelot *ocelot)
	return ocelot_read(ocelot, SYS_RAM_INIT);
}

/* CORE_ENA is in SYS:SYSTEM:RESET_CFG
 * RAM_INIT is in SYS:RAM_CTRL:RAM_INIT
 */
static int vsc9959_reset(struct ocelot *ocelot)
{
	int val, err;

	/* soft-reset the switch core */
	regmap_field_write(ocelot->regfields[GCB_SOFT_RST_SWC_RST], 1);
	ocelot_field_write(ocelot, GCB_SOFT_RST_SWC_RST, 1);

	err = readx_poll_timeout(vsc9959_gcb_soft_rst_status, ocelot, val, !val,
				 VSC9959_GCB_RST_SLEEP, VSC9959_INIT_TIMEOUT);
@@ -762,7 +782,7 @@ static int vsc9959_reset(struct ocelot *ocelot)
	}

	/* enable switch core */
	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
	ocelot_field_write(ocelot, SYS_RESET_CFG_CORE_ENA, 1);

	return 0;
}
@@ -933,7 +953,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
	return 0;
}

void vsc9959_mdio_bus_free(struct ocelot *ocelot)
static void vsc9959_mdio_bus_free(struct ocelot *ocelot)
{
	struct felix *felix = ocelot_to_felix(ocelot);
	int port;
@@ -1166,6 +1186,7 @@ static const struct felix_info felix_info_vsc9959 = {
	.num_tx_queues		= FELIX_NUM_TC,
	.switch_pci_bar		= 4,
	.imdio_pci_bar		= 0,
	.ptp_caps		= &vsc9959_ptp_caps,
	.mdio_bus_alloc		= vsc9959_mdio_bus_alloc,
	.mdio_bus_free		= vsc9959_mdio_bus_free,
	.phylink_validate	= vsc9959_phylink_validate,
@@ -1307,9 +1328,13 @@ static struct pci_device_id felix_ids[] = {
};
MODULE_DEVICE_TABLE(pci, felix_ids);

struct pci_driver felix_vsc9959_pci_driver = {
static struct pci_driver felix_vsc9959_pci_driver = {
	.name		= "mscc_felix",
	.id_table	= felix_ids,
	.probe		= felix_pci_probe,
	.remove		= felix_pci_remove,
};
module_pci_driver(felix_vsc9959_pci_driver);

MODULE_DESCRIPTION("Felix Switch driver");
MODULE_LICENSE("GPL v2");
Loading