linux/drivers/net/pse-pd/tps23881.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for the TI TPS23881 PoE PSE Controller driver (I2C bus)
 *
 * Copyright (c) 2023 Bootlin, Kory Maincent <[email protected]>
 */

#include <linux/bitfield.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pse-pd/pse.h>

#define TPS23881_MAX_CHANS

#define TPS23881_REG_PW_STATUS
#define TPS23881_REG_OP_MODE
#define TPS23881_OP_MODE_SEMIAUTO
#define TPS23881_REG_DIS_EN
#define TPS23881_REG_DET_CLA_EN
#define TPS23881_REG_GEN_MASK
#define TPS23881_REG_NBITACC
#define TPS23881_REG_PW_EN
#define TPS23881_REG_PORT_MAP
#define TPS23881_REG_PORT_POWER
#define TPS23881_REG_POEPLUS
#define TPS23881_REG_TPON
#define TPS23881_REG_FWREV
#define TPS23881_REG_DEVID
#define TPS23881_REG_DEVID_MASK
#define TPS23881_DEVICE_ID
#define TPS23881_REG_SRAM_CTRL
#define TPS23881_REG_SRAM_DATA

struct tps23881_port_desc {};

struct tps23881_priv {};

static struct tps23881_priv *to_tps23881_priv(struct pse_controller_dev *pcdev)
{}

static int tps23881_pi_enable(struct pse_controller_dev *pcdev, int id)
{}

static int tps23881_pi_disable(struct pse_controller_dev *pcdev, int id)
{}

static int tps23881_pi_is_enabled(struct pse_controller_dev *pcdev, int id)
{}

static int tps23881_ethtool_get_status(struct pse_controller_dev *pcdev,
				       unsigned long id,
				       struct netlink_ext_ack *extack,
				       struct pse_control_status *status)
{}

/* Parse managers subnode into a array of device node */
static int
tps23881_get_of_channels(struct tps23881_priv *priv,
			 struct device_node *chan_node[TPS23881_MAX_CHANS])
{}

struct tps23881_port_matrix {};

static int
tps23881_match_channel(const struct pse_pi_pairset *pairset,
		       struct device_node *chan_node[TPS23881_MAX_CHANS])
{}

static bool
tps23881_is_chan_free(struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS],
		      int chan)
{}

/* Fill port matrix with the matching channels */
static int
tps23881_match_port_matrix(struct pse_pi *pi, int pi_id,
			   struct device_node *chan_node[TPS23881_MAX_CHANS],
			   struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS])
{}

static int
tps23881_get_unused_chan(struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS],
			 int port_cnt)
{}

/* Sort the port matrix to following particular hardware ports matrix
 * specification of the tps23881. The device has two 4-ports groups and
 * each 4-pair powered device has to be configured to use two consecutive
 * logical channel in each 4 ports group (1 and 2 or 3 and 4). Also the
 * hardware matrix has to be fully configured even with unused chan to be
 * valid.
 */
static int
tps23881_sort_port_matrix(struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS])
{}

/* Write port matrix to the hardware port matrix and the software port
 * matrix.
 */
static int
tps23881_write_port_matrix(struct tps23881_priv *priv,
			   struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS],
			   int port_cnt)
{}

static int
tps23881_set_ports_conf(struct tps23881_priv *priv,
			struct tps23881_port_matrix port_matrix[TPS23881_MAX_CHANS])
{}

static int
tps23881_set_ports_matrix(struct tps23881_priv *priv,
			  struct device_node *chan_node[TPS23881_MAX_CHANS])
{}

static int tps23881_setup_pi_matrix(struct pse_controller_dev *pcdev)
{}

static const struct pse_controller_ops tps23881_ops =;

static const char fw_parity_name[] =;
static const char fw_sram_name[] =;

struct tps23881_fw_conf {};

static const struct tps23881_fw_conf tps23881_fw_parity_conf[] =;

static const struct tps23881_fw_conf tps23881_fw_sram_conf[] =;

static int tps23881_flash_sram_fw_part(struct i2c_client *client,
				       const char *fw_name,
				       const struct tps23881_fw_conf *fw_conf)
{}

static int tps23881_flash_sram_fw(struct i2c_client *client)
{}

static int tps23881_i2c_probe(struct i2c_client *client)
{}

static const struct i2c_device_id tps23881_id[] =;
MODULE_DEVICE_TABLE(i2c, tps23881_id);

static const struct of_device_id tps23881_of_match[] =;
MODULE_DEVICE_TABLE(of, tps23881_of_match);

static struct i2c_driver tps23881_driver =;
module_i2c_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();