#include <stdint.h>
#include <unistd.h>
#include <ipxe/bitbash.h>
#include <ipxe/mii_bit.h>
Go to the source code of this file.
|
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
|
static uint32_t | mii_bit_xfer (struct bit_basher *basher, uint32_t mask, uint32_t write) |
| Transfer bits over MII bit-bashing interface. More...
|
|
static unsigned int | mii_bit_rw (struct bit_basher *basher, unsigned int phy, unsigned int reg, unsigned int data, unsigned int cmd) |
| Read or write via MII bit-bashing interface. More...
|
|
static int | mii_bit_read (struct mii_interface *mdio, unsigned int phy, unsigned int reg) |
| Read from MII register. More...
|
|
static int | mii_bit_write (struct mii_interface *mdio, unsigned int phy, unsigned int reg, unsigned int data) |
| Write to MII register. More...
|
|
void | init_mii_bit_basher (struct mii_bit_basher *miibit) |
| Initialise bit-bashing interface. More...
|
|
◆ FILE_LICENCE()
FILE_LICENCE |
( |
GPL2_OR_LATER_OR_UBDL |
| ) |
|
◆ mii_bit_xfer()
Transfer bits over MII bit-bashing interface.
- Parameters
-
basher | Bit basher |
mask | Mask |
write | Data to write |
- Return values
-
Definition at line 39 of file mii_bit.c.
44 for ( ; mask ; mask >>= 1 ) {
struct option_descriptor read[1]
static unsigned int unsigned int bit
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
int read_bit(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
void write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Set/clear output bit.
References bit, MII_BIT_MDC, MII_BIT_MDIO, read, read_bit(), udelay(), write, and write_bit().
Referenced by mii_bit_rw().
◆ mii_bit_rw()
static unsigned int mii_bit_rw |
( |
struct bit_basher * |
basher, |
|
|
unsigned int |
phy, |
|
|
unsigned int |
reg, |
|
|
unsigned int |
data, |
|
|
unsigned int |
cmd |
|
) |
| |
|
static |
Read or write via MII bit-bashing interface.
- Parameters
-
basher | Bit basher |
phy | PHY address |
reg | Register address |
data | Data to write |
cmd | Command |
- Return values
-
Definition at line 79 of file mii_bit.c.
#define MII_BIT_DATA_MASK
Data mask.
static unsigned int unsigned int reg
#define MII_BIT_START_MASK
Start mask.
#define MII_BIT_SWITCH_MASK
Switch mask.
#define MII_BIT_CMD_RW
Command read or write.
#define MII_BIT_SWITCH
Switch.
static uint32_t mii_bit_xfer(struct bit_basher *basher, uint32_t mask, uint32_t write)
Transfer bits over MII bit-bashing interface.
#define MII_BIT_PHY_MASK
PHY mask.
#define MII_BIT_CMD_MASK
Command mask.
uint8_t data[48]
Additional event data.
#define MII_BIT_START
Start.
#define MII_BIT_REG_MASK
Register mask.
void write_bit(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Set/clear output bit.
References cmd, data, MII_BIT_CMD_MASK, MII_BIT_CMD_RW, MII_BIT_DATA_MASK, MII_BIT_DRIVE, MII_BIT_PHY_MASK, MII_BIT_REG_MASK, MII_BIT_START, MII_BIT_START_MASK, MII_BIT_SWITCH, MII_BIT_SWITCH_MASK, mii_bit_xfer(), reg, and write_bit().
Referenced by mii_bit_read(), and mii_bit_write().
◆ mii_bit_read()
static int mii_bit_read |
( |
struct mii_interface * |
mdio, |
|
|
unsigned int |
phy, |
|
|
unsigned int |
reg |
|
) |
| |
|
static |
Read from MII register.
- Parameters
-
mdio | MII interface |
phy | PHY address |
reg | Register address |
- Return values
-
data | Data read, or negative error |
Definition at line 121 of file mii_bit.c.
struct mii_interface mdio
MII interface.
static unsigned int unsigned int reg
static unsigned int mii_bit_rw(struct bit_basher *basher, unsigned int phy, unsigned int reg, unsigned int data, unsigned int cmd)
Read or write via MII bit-bashing interface.
#define container_of(ptr, type, field)
Get containing structure.
#define MII_BIT_CMD_READ
Command read.
struct bit_basher basher
Bit-bashing interface.
A bit-bashing MII interface.
References mii_bit_basher::basher, container_of, mii_bit_basher::mdio, MII_BIT_CMD_READ, mii_bit_rw(), and reg.
◆ mii_bit_write()
static int mii_bit_write |
( |
struct mii_interface * |
mdio, |
|
|
unsigned int |
phy, |
|
|
unsigned int |
reg, |
|
|
unsigned int |
data |
|
) |
| |
|
static |
Write to MII register.
- Parameters
-
mdio | MII interface |
phy | PHY address |
reg | Register address |
data | Data to write |
- Return values
-
Definition at line 139 of file mii_bit.c.
struct mii_interface mdio
MII interface.
static unsigned int unsigned int reg
static unsigned int mii_bit_rw(struct bit_basher *basher, unsigned int phy, unsigned int reg, unsigned int data, unsigned int cmd)
Read or write via MII bit-bashing interface.
#define container_of(ptr, type, field)
Get containing structure.
#define MII_BIT_CMD_WRITE
Command write.
struct bit_basher basher
Bit-bashing interface.
uint8_t data[48]
Additional event data.
A bit-bashing MII interface.
References mii_bit_basher::basher, container_of, data, mii_bit_basher::mdio, MII_BIT_CMD_WRITE, mii_bit_rw(), and reg.
◆ init_mii_bit_basher()
Initialise bit-bashing interface.
- Parameters
-
Definition at line 160 of file mii_bit.c.
struct mii_interface mdio
MII interface.
static void mdio_init(struct mii_interface *mdio, struct mii_operations *op)
Initialise MII interface.
static struct mii_operations mii_bit_op
MII bit basher operations.
References mii_bit_basher::mdio, mdio_init(), and mii_bit_op.
Referenced by icplus_probe().
◆ mii_bit_op
Initial value:= {
}
static int mii_bit_write(struct mii_interface *mdio, unsigned int phy, unsigned int reg, unsigned int data)
Write to MII register.
static int mii_bit_read(struct mii_interface *mdio, unsigned int phy, unsigned int reg)
Read from MII register.
MII bit basher operations.
Definition at line 150 of file mii_bit.c.
Referenced by init_mii_bit_basher().