7952347391
The MV88E6390 has a control register for what the histogram statistics actually contain. This means the stat_snapshot method should not set this information. So implement the 6390 stats_snapshot function without these bits. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
78 lines
2.0 KiB
C
78 lines
2.0 KiB
C
/*
|
|
* Marvell 88E6xxx Switch Global (1) Registers support
|
|
*
|
|
* Copyright (c) 2008 Marvell Semiconductor
|
|
*
|
|
* Copyright (c) 2016 Vivien Didelot <vivien.didelot@savoirfairelinux.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 "mv88e6xxx.h"
|
|
#include "global1.h"
|
|
|
|
int mv88e6xxx_g1_read(struct mv88e6xxx_chip *chip, int reg, u16 *val)
|
|
{
|
|
int addr = chip->info->global1_addr;
|
|
|
|
return mv88e6xxx_read(chip, addr, reg, val);
|
|
}
|
|
|
|
int mv88e6xxx_g1_write(struct mv88e6xxx_chip *chip, int reg, u16 val)
|
|
{
|
|
int addr = chip->info->global1_addr;
|
|
|
|
return mv88e6xxx_write(chip, addr, reg, val);
|
|
}
|
|
|
|
int mv88e6xxx_g1_wait(struct mv88e6xxx_chip *chip, int reg, u16 mask)
|
|
{
|
|
return mv88e6xxx_wait(chip, chip->info->global1_addr, reg, mask);
|
|
}
|
|
|
|
static int mv88e6xxx_g1_stats_wait(struct mv88e6xxx_chip *chip)
|
|
{
|
|
return mv88e6xxx_g1_wait(chip, GLOBAL_STATS_OP, GLOBAL_STATS_OP_BUSY);
|
|
}
|
|
|
|
int mv88e6xxx_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
|
|
{
|
|
int err;
|
|
|
|
/* Snapshot the hardware statistics counters for this port. */
|
|
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP,
|
|
GLOBAL_STATS_OP_CAPTURE_PORT |
|
|
GLOBAL_STATS_OP_HIST_RX_TX | port);
|
|
if (err)
|
|
return err;
|
|
|
|
/* Wait for the snapshotting to complete. */
|
|
return mv88e6xxx_g1_stats_wait(chip);
|
|
}
|
|
|
|
int mv88e6320_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
|
|
{
|
|
port = (port + 1) << 5;
|
|
|
|
return mv88e6xxx_g1_stats_snapshot(chip, port);
|
|
}
|
|
|
|
int mv88e6390_g1_stats_snapshot(struct mv88e6xxx_chip *chip, int port)
|
|
{
|
|
int err;
|
|
|
|
port = (port + 1) << 5;
|
|
|
|
/* Snapshot the hardware statistics counters for this port. */
|
|
err = mv88e6xxx_g1_write(chip, GLOBAL_STATS_OP,
|
|
GLOBAL_STATS_OP_CAPTURE_PORT | port);
|
|
if (err)
|
|
return err;
|
|
|
|
/* Wait for the snapshotting to complete. */
|
|
return mv88e6xxx_g1_stats_wait(chip);
|
|
}
|