Commit e0305cc1 authored by Steen Hegelund's avatar Steen Hegelund Committed by David S. Miller
Browse files

net: microchip: sparx5: Add VCAP debugFS support



Add a debugFS root folder for Sparx5 and add a vcap folder underneath with
the VCAP instances and the ports

Signed-off-by: default avatarSteen Hegelund <steen.hegelund@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 277e9179
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ sparx5-switch-y := sparx5_main.o sparx5_packet.o \
 sparx5_vcap_impl.o sparx5_vcap_ag_api.o sparx5_tc_flower.o sparx5_tc_matchall.o

sparx5-switch-$(CONFIG_SPARX5_DCB) += sparx5_dcb.o
sparx5-switch-$(CONFIG_DEBUG_FS) += sparx5_vcap_debugfs.o

# Provide include files
ccflags-y += -I$(srctree)/drivers/net/ethernet/microchip/vcap
+3 −0
Original line number Diff line number Diff line
@@ -763,6 +763,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
	/* Default values, some from DT */
	sparx5->coreclock = SPX5_CORE_CLOCK_DEFAULT;

	sparx5->debugfs_root = debugfs_create_dir("sparx5", NULL);

	ports = of_get_child_by_name(np, "ethernet-ports");
	if (!ports) {
		dev_err(sparx5->dev, "no ethernet-ports child node found\n");
@@ -906,6 +908,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
{
	struct sparx5 *sparx5 = platform_get_drvdata(pdev);

	debugfs_remove_recursive(sparx5->debugfs_root);
	if (sparx5->xtr_irq) {
		disable_irq(sparx5->xtr_irq);
		sparx5->xtr_irq = -ENXIO;
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/hrtimer.h>
#include <linux/debugfs.h>

#include "sparx5_main_regs.h"

@@ -292,6 +293,8 @@ struct sparx5 {
	struct vcap_control *vcap_ctrl;
	/* PGID allocation map */
	u8 pgid_map[PGID_TABLE_SIZE];
	/* Common root for debugfs */
	struct dentry *debugfs_root;
};

/* sparx5_switchdev.c */
+23 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0+
/* Microchip Sparx5 Switch driver VCAP debugFS implementation
 *
 * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
 */

#include <linux/types.h>
#include <linux/list.h>

#include "sparx5_vcap_debugfs.h"
#include "sparx5_main_regs.h"
#include "sparx5_main.h"
#include "sparx5_vcap_impl.h"
#include "sparx5_vcap_ag_api.h"

/* Provide port information via a callback interface */
int sparx5_port_info(struct net_device *ndev,
		     struct vcap_admin *admin,
		     struct vcap_output_print *out)
{
	/* this will be added later */
	return 0;
}
+33 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0+ */
/* Microchip Sparx5 Switch driver VCAP implementation
 *
 * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
 */

#ifndef __SPARX5_VCAP_DEBUGFS_H__
#define __SPARX5_VCAP_DEBUGFS_H__

#include <linux/netdevice.h>

#include <vcap_api.h>
#include <vcap_api_client.h>

#if defined(CONFIG_DEBUG_FS)

/* Provide port information via a callback interface */
int sparx5_port_info(struct net_device *ndev,
		     struct vcap_admin *admin,
		     struct vcap_output_print *out);

#else

static inline int sparx5_port_info(struct net_device *ndev,
				   struct vcap_admin *admin,
				   struct vcap_output_print *out)
{
	return 0;
}

#endif

#endif /* __SPARX5_VCAP_DEBUGFS_H__ */
Loading