1 /* SPDX-License-Identifier: BSD-3-Clause
5 #include "enet_ethdev.h"
7 /* Prefix path to sysfs directory where UIO device attributes are exported.
8 * Path for UIO device X is /sys/class/uio/uioX
10 #define FEC_UIO_DEVICE_SYS_ATTR_PATH "/sys/class/uio"
12 /* Subfolder in sysfs where mapping attributes are exported
13 * for each UIO device. Path for mapping Y for device X is:
14 * /sys/class/uio/uioX/maps/mapY
16 #define FEC_UIO_DEVICE_SYS_MAP_ATTR "maps/map"
18 /* Name of UIO device file prefix. Each UIO device will have a device file
19 * /dev/uioX, where X is the minor device number.
21 #define FEC_UIO_DEVICE_FILE_NAME "/dev/uio"
23 * Name of UIO device. User space FEC will have a corresponding
25 * Maximum length is #FEC_UIO_MAX_DEVICE_NAME_LENGTH.
27 * @note Must be kept in sync with FEC kernel driver
28 * define #FEC_UIO_DEVICE_NAME !
30 #define FEC_UIO_DEVICE_NAME "imx-fec-uio"
32 /* Maximum length for the name of an UIO device file.
33 * Device file name format is: /dev/uioX.
35 #define FEC_UIO_MAX_DEVICE_FILE_NAME_LENGTH 30
37 /* Maximum length for the name of an attribute file for an UIO device.
38 * Attribute files are exported in sysfs and have the name formatted as:
39 * /sys/class/uio/uioX/<attribute_file_name>
41 #define FEC_UIO_MAX_ATTR_FILE_NAME 100
43 /* The id for the mapping used to export ENETFEC registers and BD memory to
44 * user space through UIO device.
46 #define FEC_UIO_REG_MAP_ID 0
47 #define FEC_UIO_BD_MAP_ID 1
49 #define MAP_PAGE_SIZE 4096
55 void *register_base_addr;
61 int enetfec_configure(void);
62 int config_enetfec_uio(struct enetfec_private *fep);
63 void enetfec_uio_init(void);
64 void enetfec_cleanup(struct enetfec_private *fep);