mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-14 06:35:12 +00:00
net: lan966x: Add initial VCAP
When lan966x driver is initialized, initialize also the VCAP module for lan966x. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
ee72d90b04
commit
b053122532
5 changed files with 47 additions and 1 deletions
|
@ -8,5 +8,6 @@ config LAN966X_SWITCH
|
||||||
select PHYLINK
|
select PHYLINK
|
||||||
select PACKING
|
select PACKING
|
||||||
select PAGE_POOL
|
select PAGE_POOL
|
||||||
|
select VCAP
|
||||||
help
|
help
|
||||||
This driver supports the Lan966x network switch device.
|
This driver supports the Lan966x network switch device.
|
||||||
|
|
|
@ -12,4 +12,7 @@ lan966x-switch-objs := lan966x_main.o lan966x_phylink.o lan966x_port.o \
|
||||||
lan966x_tc.o lan966x_mqprio.o lan966x_taprio.o \
|
lan966x_tc.o lan966x_mqprio.o lan966x_taprio.o \
|
||||||
lan966x_tbf.o lan966x_cbs.o lan966x_ets.o \
|
lan966x_tbf.o lan966x_cbs.o lan966x_ets.o \
|
||||||
lan966x_tc_matchall.o lan966x_police.o lan966x_mirror.o \
|
lan966x_tc_matchall.o lan966x_police.o lan966x_mirror.o \
|
||||||
lan966x_xdp.o
|
lan966x_xdp.o lan966x_vcap_impl.o
|
||||||
|
|
||||||
|
# Provide include files
|
||||||
|
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
|
||||||
|
|
|
@ -1157,8 +1157,15 @@ static int lan966x_probe(struct platform_device *pdev)
|
||||||
if (err)
|
if (err)
|
||||||
goto cleanup_ptp;
|
goto cleanup_ptp;
|
||||||
|
|
||||||
|
err = lan966x_vcap_init(lan966x);
|
||||||
|
if (err)
|
||||||
|
goto cleanup_fdma;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
cleanup_fdma:
|
||||||
|
lan966x_fdma_deinit(lan966x);
|
||||||
|
|
||||||
cleanup_ptp:
|
cleanup_ptp:
|
||||||
lan966x_ptp_deinit(lan966x);
|
lan966x_ptp_deinit(lan966x);
|
||||||
|
|
||||||
|
@ -1182,6 +1189,7 @@ static int lan966x_remove(struct platform_device *pdev)
|
||||||
struct lan966x *lan966x = platform_get_drvdata(pdev);
|
struct lan966x *lan966x = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
lan966x_taprio_deinit(lan966x);
|
lan966x_taprio_deinit(lan966x);
|
||||||
|
lan966x_vcap_deinit(lan966x);
|
||||||
lan966x_fdma_deinit(lan966x);
|
lan966x_fdma_deinit(lan966x);
|
||||||
lan966x_cleanup_ports(lan966x);
|
lan966x_cleanup_ports(lan966x);
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,9 @@ struct lan966x {
|
||||||
struct lan966x_port *mirror_monitor;
|
struct lan966x_port *mirror_monitor;
|
||||||
u32 mirror_mask[2];
|
u32 mirror_mask[2];
|
||||||
u32 mirror_count;
|
u32 mirror_count;
|
||||||
|
|
||||||
|
/* vcap */
|
||||||
|
struct vcap_control *vcap_ctrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lan966x_port_config {
|
struct lan966x_port_config {
|
||||||
|
@ -582,6 +585,9 @@ static inline bool lan966x_xdp_port_present(struct lan966x_port *port)
|
||||||
return !!port->xdp_prog;
|
return !!port->xdp_prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lan966x_vcap_init(struct lan966x *lan966x);
|
||||||
|
void lan966x_vcap_deinit(struct lan966x *lan966x);
|
||||||
|
|
||||||
static inline void __iomem *lan_addr(void __iomem *base[],
|
static inline void __iomem *lan_addr(void __iomem *base[],
|
||||||
int id, int tinst, int tcnt,
|
int id, int tinst, int tcnt,
|
||||||
int gbase, int ginst,
|
int gbase, int ginst,
|
||||||
|
|
28
drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
Normal file
28
drivers/net/ethernet/microchip/lan966x/lan966x_vcap_impl.c
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
|
||||||
|
#include "lan966x_main.h"
|
||||||
|
#include "vcap_api.h"
|
||||||
|
|
||||||
|
int lan966x_vcap_init(struct lan966x *lan966x)
|
||||||
|
{
|
||||||
|
struct vcap_control *ctrl;
|
||||||
|
|
||||||
|
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
|
||||||
|
if (!ctrl)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
lan966x->vcap_ctrl = ctrl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lan966x_vcap_deinit(struct lan966x *lan966x)
|
||||||
|
{
|
||||||
|
struct vcap_control *ctrl;
|
||||||
|
|
||||||
|
ctrl = lan966x->vcap_ctrl;
|
||||||
|
if (!ctrl)
|
||||||
|
return;
|
||||||
|
|
||||||
|
kfree(ctrl);
|
||||||
|
}
|
Loading…
Reference in a new issue