Go to the documentation of this file.
39 #ifndef _NO_OS_MDIO_H_
40 #define _NO_OS_MDIO_H_
46 #define NO_OS_MDIO_C22_REGS 32
47 #define NO_OS_MDIO_C45_START 0
48 #define NO_OS_MDIO_C22_START 1
49 #define NO_OS_MDIO_START_MASK NO_OS_GENMASK(31, 30)
50 #define NO_OS_MDIO_OP_ADDRESS 0
51 #define NO_OS_MDIO_OP_WRITE 1
52 #define NO_OS_MDIO_OP_READ 2
53 #define NO_OS_MDIO_OP_MASK NO_OS_GENMASK(29, 28)
54 #define NO_OS_MDIO_PHYADDR_MASK NO_OS_GENMASK(27, 23)
55 #define NO_OS_MDIO_REGADDR_MASK NO_OS_GENMASK(22, 18)
56 #define NO_OS_MDIO_TURNAROUND 2
57 #define NO_OS_MDIO_TURNAROUND_MASK NO_OS_GENMASK(17, 16)
58 #define NO_OS_MDIO_DATA_MASK NO_OS_GENMASK(15, 0)
59 #define NO_OS_MDIO_C45_DEVADDR_MASK NO_OS_GENMASK(20, 16)
60 #define NO_OS_MDIO_C45_ADDR(dev, reg) (NO_OS_BIT(31) | no_os_field_prep(NO_OS_MDIO_C45_DEVADDR_MASK, dev) | (uint16_t)reg)
Parameters for an MDIO slave.
Definition: no_os_mdio.h:66
bool c45
Definition: no_os_mdio.h:71
uint8_t addr
Definition: no_os_mdio.h:87
int(* remove)(struct no_os_mdio_desc *)
Definition: no_os_mdio.h:104
int(* read)(struct no_os_mdio_desc *, uint32_t, uint16_t *)
Definition: no_os_mdio.h:102
struct no_os_mdio_ops * ops
Definition: no_os_mdio.h:75
int id
Definition: no_os_mdio.h:68
void * extra
Definition: no_os_mdio.h:77
int id
Definition: no_os_mdio.h:85
int no_os_mdio_init(struct no_os_mdio_desc **desc, struct no_os_mdio_init_param *param)
Initialize the MDIO interface.
Definition: no_os_mdio.c:48
int no_os_mdio_write(struct no_os_mdio_desc *desc, uint32_t reg, uint16_t val)
Write a register using MDIO.
Definition: no_os_mdio.c:96
bool c45
Definition: no_os_mdio.h:86
int(* write)(struct no_os_mdio_desc *, uint32_t, uint16_t)
Definition: no_os_mdio.h:100
int(* init)(struct no_os_mdio_desc **, struct no_os_mdio_init_param *)
Definition: no_os_mdio.h:98
int no_os_mdio_remove(struct no_os_mdio_desc *desc)
Free the resources allocated by no_os_mdio_init().
Definition: no_os_mdio.c:76
MDIO device descriptor created with no_os_mdio_init().
Definition: no_os_mdio.h:84
void * extra
Definition: no_os_mdio.h:89
uint8_t addr
Definition: no_os_mdio.h:73
Collection of MDIO ops that point to specific implementations.
Definition: no_os_mdio.h:96
int no_os_mdio_read(struct no_os_mdio_desc *desc, uint32_t reg, uint16_t *val)
Read a register using MDIO.
Definition: no_os_mdio.c:116
Header file of utility functions.
struct no_os_mdio_ops * ops
Definition: no_os_mdio.h:88