Commit c4aca6fa authored by Vivien Didelot's avatar Vivien Didelot Committed by Ezequiel Garcia
Browse files

zii: net: dsa: mv88e6xxx: add sysfs support



Introduce a new NET_DSA_MV88E6XXX_ZII Kconfig symbol to wrap all
future ZII specific hacks in the mv88e6xxx driver. Register a "zii"
sysfs directory to the device at the same time.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
parent 2a9ea655
......@@ -45,3 +45,10 @@ config NET_DSA_MV88E6XXX_PTP
help
Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch
chips that support it.
config NET_DSA_MV88E6XXX_ZII
bool "Support for ZII specific hacks"
default y
depends on NET_DSA_MV88E6XXX
help
Say Y to enable ZII specific hacks.
......@@ -16,3 +16,4 @@ mv88e6xxx-objs += port_hidden.o
mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_PTP) += ptp.o
mv88e6xxx-objs += serdes.o
mv88e6xxx-objs += smi.o
mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_ZII) += sysfs.o
......@@ -42,6 +42,9 @@
#include "ptp.h"
#include "serdes.h"
#include "smi.h"
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
#include "sysfs.h"
#endif
static void assert_reg_lock(struct mv88e6xxx_chip *chip)
{
......@@ -3069,6 +3072,13 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
goto unlock;
mv88e6xxx_dbg_create(chip);
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
err = mv88e6xxx_sysfs_setup(chip);
if (err)
goto unlock;
#endif
unlock:
mv88e6xxx_reg_unlock(chip);
......@@ -5674,6 +5684,10 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
mv88e6xxx_dbg_destroy(chip);
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_ZII)
mv88e6xxx_sysfs_teardown(chip);
#endif
if (chip->info->ptp_support) {
mv88e6xxx_hwtstamp_free(chip);
mv88e6xxx_ptp_free(chip);
......
/*
* Marvell 88E6xxx sysfs support
*
* Copyright (c) 2019 Zodiac Inflight Innovations
* Vivien Didelot <vivien.didelot@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/sysfs.h>
#include "chip.h"
static struct attribute *mv88e6xxx_sysfs_attrs[] = {
NULL
};
static const struct attribute_group mv88e6xxx_sysfs_group = {
.name = "zii",
.attrs = mv88e6xxx_sysfs_attrs,
};
int mv88e6xxx_sysfs_setup(struct mv88e6xxx_chip *chip)
{
return sysfs_create_group(&chip->dev->kobj, &mv88e6xxx_sysfs_group);
}
void mv88e6xxx_sysfs_teardown(struct mv88e6xxx_chip *chip)
{
sysfs_remove_group(&chip->dev->kobj, &mv88e6xxx_sysfs_group);
}
/*
* Marvell 88E6xxx sysfs support
*
* Copyright (c) 2019 Zodiac Inflight Innovations
* Vivien Didelot <vivien.didelot@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _MV88E6XXX_SYSFS_H
#define _MV88E6XXX_SYSFS_H
struct mv88e6xxx_chip;
int mv88e6xxx_sysfs_setup(struct mv88e6xxx_chip *chip);
void mv88e6xxx_sysfs_teardown(struct mv88e6xxx_chip *chip);
#endif /* _MV88E6XXX_SYSFS_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment