]>
git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - drivers/net/dsa/mv88e6xxx/smi.h
2 * Marvell 88E6xxx System Management Interface (SMI) support
4 * Copyright (c) 2008 Marvell Semiconductor
6 * Copyright (c) 2019 Vivien Didelot <vivien.didelot@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 #ifndef _MV88E6XXX_SMI_H
15 #define _MV88E6XXX_SMI_H
19 /* Offset 0x00: SMI Command Register */
20 #define MV88E6XXX_SMI_CMD 0x00
21 #define MV88E6XXX_SMI_CMD_BUSY 0x8000
22 #define MV88E6XXX_SMI_CMD_MODE_MASK 0x1000
23 #define MV88E6XXX_SMI_CMD_MODE_45 0x0000
24 #define MV88E6XXX_SMI_CMD_MODE_22 0x1000
25 #define MV88E6XXX_SMI_CMD_OP_MASK 0x0c00
26 #define MV88E6XXX_SMI_CMD_OP_22_WRITE 0x0400
27 #define MV88E6XXX_SMI_CMD_OP_22_READ 0x0800
28 #define MV88E6XXX_SMI_CMD_OP_45_WRITE_ADDR 0x0000
29 #define MV88E6XXX_SMI_CMD_OP_45_WRITE_DATA 0x0400
30 #define MV88E6XXX_SMI_CMD_OP_45_READ_DATA 0x0800
31 #define MV88E6XXX_SMI_CMD_OP_45_READ_DATA_INC 0x0c00
32 #define MV88E6XXX_SMI_CMD_DEV_ADDR_MASK 0x003e
33 #define MV88E6XXX_SMI_CMD_REG_ADDR_MASK 0x001f
35 /* Offset 0x01: SMI Data Register */
36 #define MV88E6XXX_SMI_DATA 0x01
38 int mv88e6xxx_smi_init(struct mv88e6xxx_chip
*chip
,
39 struct mii_bus
*bus
, int sw_addr
);
41 static inline int mv88e6xxx_smi_read(struct mv88e6xxx_chip
*chip
,
42 int dev
, int reg
, u16
*data
)
44 if (chip
->smi_ops
&& chip
->smi_ops
->read
)
45 return chip
->smi_ops
->read(chip
, dev
, reg
, data
);
50 static inline int mv88e6xxx_smi_write(struct mv88e6xxx_chip
*chip
,
51 int dev
, int reg
, u16 data
)
53 if (chip
->smi_ops
&& chip
->smi_ops
->write
)
54 return chip
->smi_ops
->write(chip
, dev
, reg
, data
);
59 #endif /* _MV88E6XXX_SMI_H */