2cd4a8ff44d1bc795eaedd5ed267f738f892e19e
2 * Realtek RTL8366 SMI interface driver defines
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #ifndef _RTL8366_SMI_H
12 #define _RTL8366_SMI_H
14 #include <linux/phy.h>
15 #include <linux/switch.h>
17 struct rtl8366_smi_ops
;
18 struct rtl8366_vlan_ops
;
24 struct rtl8366_mib_counter
{
32 struct device
*parent
;
33 unsigned int gpio_sda
;
34 unsigned int gpio_sck
;
36 struct mii_bus
*mii_bus
;
37 int mii_irq
[PHY_MAX_ADDR
];
38 struct switch_dev sw_dev
;
40 unsigned int cpu_port
;
41 unsigned int num_ports
;
42 unsigned int num_vlan_mc
;
43 unsigned int num_mib_counters
;
44 struct rtl8366_mib_counter
*mib_counters
;
46 struct rtl8366_smi_ops
*ops
;
49 #ifdef CONFIG_RTL8366S_PHY_DEBUG_FS
50 struct dentry
*debugfs_root
;
55 struct rtl8366_vlan_mc
{
63 struct rtl8366_vlan_4k
{
70 struct rtl8366_smi_ops
{
71 int (*detect
)(struct rtl8366_smi
*smi
);
72 int (*setup
)(struct rtl8366_smi
*smi
);
74 int (*mii_read
)(struct mii_bus
*bus
, int addr
, int reg
);
75 int (*mii_write
)(struct mii_bus
*bus
, int addr
, int reg
, u16 val
);
77 int (*get_vlan_mc
)(struct rtl8366_smi
*smi
, u32 index
,
78 struct rtl8366_vlan_mc
*vlanmc
);
79 int (*set_vlan_mc
)(struct rtl8366_smi
*smi
, u32 index
,
80 const struct rtl8366_vlan_mc
*vlanmc
);
81 int (*get_vlan_4k
)(struct rtl8366_smi
*smi
, u32 vid
,
82 struct rtl8366_vlan_4k
*vlan4k
);
83 int (*set_vlan_4k
)(struct rtl8366_smi
*smi
,
84 const struct rtl8366_vlan_4k
*vlan4k
);
85 int (*get_mc_index
)(struct rtl8366_smi
*smi
, int port
, int *val
);
86 int (*set_mc_index
)(struct rtl8366_smi
*smi
, int port
, int index
);
87 int (*get_mib_counter
)(struct rtl8366_smi
*smi
, int counter
,
88 int port
, unsigned long long *val
);
89 int (*is_vlan_valid
)(struct rtl8366_smi
*smi
, unsigned vlan
);
92 struct rtl8366_smi
*rtl8366_smi_alloc(struct device
*parent
);
93 int rtl8366_smi_init(struct rtl8366_smi
*smi
);
94 void rtl8366_smi_cleanup(struct rtl8366_smi
*smi
);
95 int rtl8366_smi_write_reg(struct rtl8366_smi
*smi
, u32 addr
, u32 data
);
96 int rtl8366_smi_read_reg(struct rtl8366_smi
*smi
, u32 addr
, u32
*data
);
97 int rtl8366_smi_rmwr(struct rtl8366_smi
*smi
, u32 addr
, u32 mask
, u32 data
);
99 int rtl8366_reset_vlan(struct rtl8366_smi
*smi
);
101 #ifdef CONFIG_RTL8366S_PHY_DEBUG_FS
102 int rtl8366_debugfs_open(struct inode
*inode
, struct file
*file
);
105 static inline struct rtl8366_smi
*sw_to_rtl8366_smi(struct switch_dev
*sw
)
107 return container_of(sw
, struct rtl8366_smi
, sw_dev
);
110 int rtl8366_sw_get_port_pvid(struct switch_dev
*dev
, int port
, int *val
);
111 int rtl8366_sw_set_port_pvid(struct switch_dev
*dev
, int port
, int val
);
112 int rtl8366_sw_get_port_mib(struct switch_dev
*dev
,
113 const struct switch_attr
*attr
,
114 struct switch_val
*val
);
115 int rtl8366_sw_get_vlan_info(struct switch_dev
*dev
,
116 const struct switch_attr
*attr
,
117 struct switch_val
*val
);
118 int rtl8366_sw_get_vlan_ports(struct switch_dev
*dev
, struct switch_val
*val
);
119 int rtl8366_sw_set_vlan_ports(struct switch_dev
*dev
, struct switch_val
*val
);
121 #endif /* _RTL8366_SMI_H */
This page took 0.044599 seconds and 3 git commands to generate.