blob: 3ee43d77931bb0a2ad466066bcc4b2776e5f87c3 [file] [log] [blame]
developer880c8292022-07-11 11:52:59 +08001/*
2 * switch_ioctl.h: switch(ioctl) set API
3 */
4
5#ifndef SWITCH_IOCTL_H
6#define SWITCH_IOCTL_H
7
developer5dfa8b72022-11-03 11:33:07 +08008#define ETH_DEVNAME "eth0"
9#define BR_DEVNAME "br-lan"
developer880c8292022-07-11 11:52:59 +080010
developercc8110b2024-08-19 13:53:34 +080011#define RAETH_MII_READ 0x89F3
12#define RAETH_MII_WRITE 0x89F4
13#define RAETH_ESW_PHY_DUMP 0x89F7
developer880c8292022-07-11 11:52:59 +080014
15struct esw_reg {
developercc8110b2024-08-19 13:53:34 +080016 unsigned int off;
17 unsigned int val;
developer880c8292022-07-11 11:52:59 +080018};
19
20struct ra_mii_ioctl_data {
developercc8110b2024-08-19 13:53:34 +080021 __u16 phy_id;
22 __u16 reg_num;
23 __u32 val_in;
24 __u32 val_out;
developer880c8292022-07-11 11:52:59 +080025};
26
27struct ra_switch_ioctl_data {
developercc8110b2024-08-19 13:53:34 +080028 unsigned int cmd;
29 unsigned int on_off;
30 unsigned int port;
31 unsigned int bw;
32 unsigned int vid;
33 unsigned int fid;
34 unsigned int port_map;
35 unsigned int rx_port_map;
36 unsigned int tx_port_map;
37 unsigned int igmp_query_interval;
38 unsigned int reg_addr;
39 unsigned int reg_val;
40 unsigned int mode;
41 unsigned int qos_queue_num;
42 unsigned int qos_type;
43 unsigned int qos_pri;
44 unsigned int qos_dscp;
45 unsigned int qos_table_idx;
46 unsigned int qos_weight;
47 unsigned char mac[6];
developer880c8292022-07-11 11:52:59 +080048};
49
50extern int chip_name;
51
developer5dfa8b72022-11-03 11:33:07 +080052int switch_ioctl_init(void);
developer880c8292022-07-11 11:52:59 +080053void switch_ioctl_fini(void);
developer5dfa8b72022-11-03 11:33:07 +080054int reg_read_ioctl(unsigned int offset, unsigned int *value);
55int reg_write_ioctl(unsigned int offset, unsigned int value);
56int phy_dump_ioctl(unsigned int phy_addr);
57int mii_mgr_cl22_read_ioctl(unsigned int port_num, unsigned int reg,
developercc8110b2024-08-19 13:53:34 +080058 unsigned int *value);
developer880c8292022-07-11 11:52:59 +080059int mii_mgr_cl22_write_ioctl(unsigned int port_num, unsigned int reg,
developercc8110b2024-08-19 13:53:34 +080060 unsigned int value);
developer5dfa8b72022-11-03 11:33:07 +080061int mii_mgr_cl45_read_ioctl(unsigned int port_num, unsigned int dev,
developercc8110b2024-08-19 13:53:34 +080062 unsigned int reg, unsigned int *value);
developer5dfa8b72022-11-03 11:33:07 +080063int mii_mgr_cl45_write_ioctl(unsigned int port_num, unsigned int dev,
developercc8110b2024-08-19 13:53:34 +080064 unsigned int reg, unsigned int value);
developer880c8292022-07-11 11:52:59 +080065#endif