Go to the documentation of this file.
33 #ifndef _NO_OS_MDIO_H_
34 #define _NO_OS_MDIO_H_
40 #define NO_OS_MDIO_C22_REGS 32
41 #define NO_OS_MDIO_C45_START 0
42 #define NO_OS_MDIO_C22_START 1
43 #define NO_OS_MDIO_START_MASK NO_OS_GENMASK(31, 30)
44 #define NO_OS_MDIO_OP_ADDRESS 0
45 #define NO_OS_MDIO_OP_WRITE 1
46 #define NO_OS_MDIO_OP_READ 2
47 #define NO_OS_MDIO_OP_MASK NO_OS_GENMASK(29, 28)
48 #define NO_OS_MDIO_PHYADDR_MASK NO_OS_GENMASK(27, 23)
49 #define NO_OS_MDIO_REGADDR_MASK NO_OS_GENMASK(22, 18)
50 #define NO_OS_MDIO_TURNAROUND 2
51 #define NO_OS_MDIO_TURNAROUND_MASK NO_OS_GENMASK(17, 16)
52 #define NO_OS_MDIO_DATA_MASK NO_OS_GENMASK(15, 0)
53 #define NO_OS_MDIO_C45_DEVADDR_MASK NO_OS_GENMASK(20, 16)
54 #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:60
bool c45
Definition: no_os_mdio.h:65
uint8_t addr
Definition: no_os_mdio.h:81
int(* remove)(struct no_os_mdio_desc *)
Definition: no_os_mdio.h:98
int(* read)(struct no_os_mdio_desc *, uint32_t, uint16_t *)
Definition: no_os_mdio.h:96
struct no_os_mdio_ops * ops
Definition: no_os_mdio.h:69
int id
Definition: no_os_mdio.h:62
void * extra
Definition: no_os_mdio.h:71
int id
Definition: no_os_mdio.h:79
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:42
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:90
bool c45
Definition: no_os_mdio.h:80
int(* write)(struct no_os_mdio_desc *, uint32_t, uint16_t)
Definition: no_os_mdio.h:94
int(* init)(struct no_os_mdio_desc **, struct no_os_mdio_init_param *)
Definition: no_os_mdio.h:92
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:70
MDIO device descriptor created with no_os_mdio_init().
Definition: no_os_mdio.h:78
void * extra
Definition: no_os_mdio.h:83
uint8_t addr
Definition: no_os_mdio.h:67
Collection of MDIO ops that point to specific implementations.
Definition: no_os_mdio.h:90
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:110
Header file of utility functions.
struct no_os_mdio_ops * ops
Definition: no_os_mdio.h:82