883a776d46251d1b376c60eff47e5c31fe7713ad
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / files / drivers / net / phy / rtl8366_smi.h
1 /*
2 * Realtek RTL8366 SMI interface driver defines
3 *
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
5 *
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.
9 */
10
11 #ifndef _RTL8366_SMI_H
12 #define _RTL8366_SMI_H
13
14 #include <linux/phy.h>
15
16 struct rtl8366_smi_ops;
17 struct mii_bus;
18
19 struct rtl8366_smi {
20 struct device *parent;
21 unsigned int gpio_sda;
22 unsigned int gpio_sck;
23 spinlock_t lock;
24 struct mii_bus *mii_bus;
25 int mii_irq[PHY_MAX_ADDR];
26
27 struct rtl8366_smi_ops *ops;
28 };
29
30 struct rtl8366_smi_ops {
31 int (*detect)(struct rtl8366_smi *smi);
32
33 int (*mii_read)(struct mii_bus *bus, int addr, int reg);
34 int (*mii_write)(struct mii_bus *bus, int addr, int reg, u16 val);
35 };
36
37 struct rtl8366_vlan_mc {
38 u16 vid;
39 u8 priority;
40 u8 untag;
41 u8 member;
42 u8 fid;
43 };
44
45 struct rtl8366_vlan_4k {
46 u16 vid;
47 u8 untag;
48 u8 member;
49 u8 fid;
50 };
51
52 int rtl8366_smi_init(struct rtl8366_smi *smi);
53 void rtl8366_smi_cleanup(struct rtl8366_smi *smi);
54 int rtl8366_smi_write_reg(struct rtl8366_smi *smi, u32 addr, u32 data);
55 int rtl8366_smi_read_reg(struct rtl8366_smi *smi, u32 addr, u32 *data);
56
57 #endif /* _RTL8366_SMI_H */