2 * Platform driver for the Realtek RTL8366RB ethernet switch
4 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2010 Antti Seppälä <a.seppala@gmail.com>
6 * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/platform_device.h>
17 #include <linux/delay.h>
18 #include <linux/skbuff.h>
19 #include <linux/rtl8366rb.h>
21 #include "rtl8366_smi.h"
23 #define RTL8366RB_DRIVER_DESC "Realtek RTL8366RB ethernet switch driver"
24 #define RTL8366RB_DRIVER_VER "0.2.3"
26 #define RTL8366RB_PHY_NO_MAX 4
27 #define RTL8366RB_PHY_PAGE_MAX 7
28 #define RTL8366RB_PHY_ADDR_MAX 31
29 #define RTL8366RB_PHY_WAN 4
31 /* Switch Global Configuration register */
32 #define RTL8366RB_SGCR 0x0000
33 #define RTL8366RB_SGCR_EN_BC_STORM_CTRL BIT(0)
34 #define RTL8366RB_SGCR_MAX_LENGTH(_x) (_x << 4)
35 #define RTL8366RB_SGCR_MAX_LENGTH_MASK RTL8366RB_SGCR_MAX_LENGTH(0x3)
36 #define RTL8366RB_SGCR_MAX_LENGTH_1522 RTL8366RB_SGCR_MAX_LENGTH(0x0)
37 #define RTL8366RB_SGCR_MAX_LENGTH_1536 RTL8366RB_SGCR_MAX_LENGTH(0x1)
38 #define RTL8366RB_SGCR_MAX_LENGTH_1552 RTL8366RB_SGCR_MAX_LENGTH(0x2)
39 #define RTL8366RB_SGCR_MAX_LENGTH_9216 RTL8366RB_SGCR_MAX_LENGTH(0x3)
40 #define RTL8366RB_SGCR_EN_VLAN BIT(13)
41 #define RTL8366RB_SGCR_EN_VLAN_4KTB BIT(14)
43 /* Port Enable Control register */
44 #define RTL8366RB_PECR 0x0001
46 /* Switch Security Control registers */
47 #define RTL8366RB_SSCR0 0x0002
48 #define RTL8366RB_SSCR1 0x0003
49 #define RTL8366RB_SSCR2 0x0004
50 #define RTL8366RB_SSCR2_DROP_UNKNOWN_DA BIT(0)
52 #define RTL8366RB_RESET_CTRL_REG 0x0100
53 #define RTL8366RB_CHIP_CTRL_RESET_HW 1
54 #define RTL8366RB_CHIP_CTRL_RESET_SW (1 << 1)
56 #define RTL8366RB_CHIP_VERSION_CTRL_REG 0x050A
57 #define RTL8366RB_CHIP_VERSION_MASK 0xf
58 #define RTL8366RB_CHIP_ID_REG 0x0509
59 #define RTL8366RB_CHIP_ID_8366 0x5937
61 /* PHY registers control */
62 #define RTL8366RB_PHY_ACCESS_CTRL_REG 0x8000
63 #define RTL8366RB_PHY_ACCESS_DATA_REG 0x8002
65 #define RTL8366RB_PHY_CTRL_READ 1
66 #define RTL8366RB_PHY_CTRL_WRITE 0
68 #define RTL8366RB_PHY_REG_MASK 0x1f
69 #define RTL8366RB_PHY_PAGE_OFFSET 5
70 #define RTL8366RB_PHY_PAGE_MASK (0xf << 5)
71 #define RTL8366RB_PHY_NO_OFFSET 9
72 #define RTL8366RB_PHY_NO_MASK (0x1f << 9)
74 #define RTL8366RB_VLAN_INGRESS_CTRL2_REG 0x037f
76 /* LED control registers */
77 #define RTL8366RB_LED_BLINKRATE_REG 0x0430
78 #define RTL8366RB_LED_BLINKRATE_BIT 0
79 #define RTL8366RB_LED_BLINKRATE_MASK 0x0007
81 #define RTL8366RB_LED_CTRL_REG 0x0431
82 #define RTL8366RB_LED_0_1_CTRL_REG 0x0432
83 #define RTL8366RB_LED_2_3_CTRL_REG 0x0433
85 #define RTL8366RB_MIB_COUNT 33
86 #define RTL8366RB_GLOBAL_MIB_COUNT 1
87 #define RTL8366RB_MIB_COUNTER_PORT_OFFSET 0x0050
88 #define RTL8366RB_MIB_COUNTER_BASE 0x1000
89 #define RTL8366RB_MIB_CTRL_REG 0x13F0
90 #define RTL8366RB_MIB_CTRL_USER_MASK 0x0FFC
91 #define RTL8366RB_MIB_CTRL_BUSY_MASK BIT(0)
92 #define RTL8366RB_MIB_CTRL_RESET_MASK BIT(1)
93 #define RTL8366RB_MIB_CTRL_PORT_RESET(_p) BIT(2 + (_p))
94 #define RTL8366RB_MIB_CTRL_GLOBAL_RESET BIT(11)
96 #define RTL8366RB_PORT_VLAN_CTRL_BASE 0x0063
97 #define RTL8366RB_PORT_VLAN_CTRL_REG(_p) \
98 (RTL8366RB_PORT_VLAN_CTRL_BASE + (_p) / 4)
99 #define RTL8366RB_PORT_VLAN_CTRL_MASK 0xf
100 #define RTL8366RB_PORT_VLAN_CTRL_SHIFT(_p) (4 * ((_p) % 4))
103 #define RTL8366RB_VLAN_TABLE_READ_BASE 0x018C
104 #define RTL8366RB_VLAN_TABLE_WRITE_BASE 0x0185
107 #define RTL8366RB_TABLE_ACCESS_CTRL_REG 0x0180
108 #define RTL8366RB_TABLE_VLAN_READ_CTRL 0x0E01
109 #define RTL8366RB_TABLE_VLAN_WRITE_CTRL 0x0F01
111 #define RTL8366RB_VLAN_MC_BASE(_x) (0x0020 + (_x) * 3)
114 #define RTL8366RB_PORT_LINK_STATUS_BASE 0x0014
115 #define RTL8366RB_PORT_STATUS_SPEED_MASK 0x0003
116 #define RTL8366RB_PORT_STATUS_DUPLEX_MASK 0x0004
117 #define RTL8366RB_PORT_STATUS_LINK_MASK 0x0010
118 #define RTL8366RB_PORT_STATUS_TXPAUSE_MASK 0x0020
119 #define RTL8366RB_PORT_STATUS_RXPAUSE_MASK 0x0040
120 #define RTL8366RB_PORT_STATUS_AN_MASK 0x0080
123 #define RTL8366RB_PORT_NUM_CPU 5
124 #define RTL8366RB_NUM_PORTS 6
125 #define RTL8366RB_NUM_VLANS 16
126 #define RTL8366RB_NUM_LEDGROUPS 4
127 #define RTL8366RB_NUM_VIDS 4096
128 #define RTL8366RB_PRIORITYMAX 7
129 #define RTL8366RB_FIDMAX 7
132 #define RTL8366RB_PORT_1 (1 << 0) /* In userspace port 0 */
133 #define RTL8366RB_PORT_2 (1 << 1) /* In userspace port 1 */
134 #define RTL8366RB_PORT_3 (1 << 2) /* In userspace port 2 */
135 #define RTL8366RB_PORT_4 (1 << 3) /* In userspace port 3 */
136 #define RTL8366RB_PORT_5 (1 << 4) /* In userspace port 4 */
138 #define RTL8366RB_PORT_CPU (1 << 5) /* CPU port */
140 #define RTL8366RB_PORT_ALL (RTL8366RB_PORT_1 | \
147 #define RTL8366RB_PORT_ALL_BUT_CPU (RTL8366RB_PORT_1 | \
153 #define RTL8366RB_PORT_ALL_EXTERNAL (RTL8366RB_PORT_1 | \
158 #define RTL8366RB_PORT_ALL_INTERNAL RTL8366RB_PORT_CPU
160 #define RTL8366RB_VLAN_VID_MASK 0xfff
161 #define RTL8366RB_VLAN_PRIORITY_SHIFT 12
162 #define RTL8366RB_VLAN_PRIORITY_MASK 0x7
163 #define RTL8366RB_VLAN_UNTAG_SHIFT 8
164 #define RTL8366RB_VLAN_UNTAG_MASK 0xff
165 #define RTL8366RB_VLAN_MEMBER_MASK 0xff
166 #define RTL8366RB_VLAN_FID_MASK 0x7
169 /* Port ingress bandwidth control */
170 #define RTL8366RB_IB_BASE 0x0200
171 #define RTL8366RB_IB_REG(pnum) (RTL8366RB_IB_BASE + pnum)
172 #define RTL8366RB_IB_BDTH_MASK 0x3fff
173 #define RTL8366RB_IB_PREIFG_OFFSET 14
174 #define RTL8366RB_IB_PREIFG_MASK (1 << RTL8366RB_IB_PREIFG_OFFSET)
176 /* Port egress bandwidth control */
177 #define RTL8366RB_EB_BASE 0x02d1
178 #define RTL8366RB_EB_REG(pnum) (RTL8366RB_EB_BASE + pnum)
179 #define RTL8366RB_EB_BDTH_MASK 0x3fff
180 #define RTL8366RB_EB_PREIFG_REG 0x02f8
181 #define RTL8366RB_EB_PREIFG_OFFSET 9
182 #define RTL8366RB_EB_PREIFG_MASK (1 << RTL8366RB_EB_PREIFG_OFFSET)
184 #define RTL8366RB_BDTH_SW_MAX 1048512
185 #define RTL8366RB_BDTH_UNIT 64
186 #define RTL8366RB_BDTH_REG_DEFAULT 16383
189 #define RTL8366RB_QOS_BIT 15
190 #define RTL8366RB_QOS_MASK (1 << RTL8366RB_QOS_BIT)
191 /* Include/Exclude Preamble and IFG (20 bytes). 0:Exclude, 1:Include. */
192 #define RTL8366RB_QOS_DEFAULT_PREIFG 1
195 static struct rtl8366_mib_counter rtl8366rb_mib_counters
[] = {
196 { 0, 0, 4, "IfInOctets" },
197 { 0, 4, 4, "EtherStatsOctets" },
198 { 0, 8, 2, "EtherStatsUnderSizePkts" },
199 { 0, 10, 2, "EtherFragments" },
200 { 0, 12, 2, "EtherStatsPkts64Octets" },
201 { 0, 14, 2, "EtherStatsPkts65to127Octets" },
202 { 0, 16, 2, "EtherStatsPkts128to255Octets" },
203 { 0, 18, 2, "EtherStatsPkts256to511Octets" },
204 { 0, 20, 2, "EtherStatsPkts512to1023Octets" },
205 { 0, 22, 2, "EtherStatsPkts1024to1518Octets" },
206 { 0, 24, 2, "EtherOversizeStats" },
207 { 0, 26, 2, "EtherStatsJabbers" },
208 { 0, 28, 2, "IfInUcastPkts" },
209 { 0, 30, 2, "EtherStatsMulticastPkts" },
210 { 0, 32, 2, "EtherStatsBroadcastPkts" },
211 { 0, 34, 2, "EtherStatsDropEvents" },
212 { 0, 36, 2, "Dot3StatsFCSErrors" },
213 { 0, 38, 2, "Dot3StatsSymbolErrors" },
214 { 0, 40, 2, "Dot3InPauseFrames" },
215 { 0, 42, 2, "Dot3ControlInUnknownOpcodes" },
216 { 0, 44, 4, "IfOutOctets" },
217 { 0, 48, 2, "Dot3StatsSingleCollisionFrames" },
218 { 0, 50, 2, "Dot3StatMultipleCollisionFrames" },
219 { 0, 52, 2, "Dot3sDeferredTransmissions" },
220 { 0, 54, 2, "Dot3StatsLateCollisions" },
221 { 0, 56, 2, "EtherStatsCollisions" },
222 { 0, 58, 2, "Dot3StatsExcessiveCollisions" },
223 { 0, 60, 2, "Dot3OutPauseFrames" },
224 { 0, 62, 2, "Dot1dBasePortDelayExceededDiscards" },
225 { 0, 64, 2, "Dot1dTpPortInDiscards" },
226 { 0, 66, 2, "IfOutUcastPkts" },
227 { 0, 68, 2, "IfOutMulticastPkts" },
228 { 0, 70, 2, "IfOutBroadcastPkts" },
231 #define REG_WR(_smi, _reg, _val) \
233 err = rtl8366_smi_write_reg(_smi, _reg, _val); \
238 #define REG_RMW(_smi, _reg, _mask, _val) \
240 err = rtl8366_smi_rmwr(_smi, _reg, _mask, _val); \
245 static int rtl8366rb_reset_chip(struct rtl8366_smi
*smi
)
250 rtl8366_smi_write_reg(smi
, RTL8366RB_RESET_CTRL_REG
,
251 RTL8366RB_CHIP_CTRL_RESET_HW
);
254 if (rtl8366_smi_read_reg(smi
, RTL8366RB_RESET_CTRL_REG
, &data
))
257 if (!(data
& RTL8366RB_CHIP_CTRL_RESET_HW
))
262 printk("Timeout waiting for the switch to reset\n");
269 static int rtl8366rb_hw_init(struct rtl8366_smi
*smi
)
273 /* set maximum packet length to 1536 bytes */
274 REG_RMW(smi
, RTL8366RB_SGCR
, RTL8366RB_SGCR_MAX_LENGTH_MASK
,
275 RTL8366RB_SGCR_MAX_LENGTH_1536
);
277 /* enable all ports */
278 REG_WR(smi
, RTL8366RB_PECR
, 0);
280 /* enable learning for all ports */
281 REG_WR(smi
, RTL8366RB_SSCR0
, 0);
283 /* enable auto ageing for all ports */
284 REG_WR(smi
, RTL8366RB_SSCR1
, 0);
287 * discard VLAN tagged packets if the port is not a member of
288 * the VLAN with which the packets is associated.
290 REG_WR(smi
, RTL8366RB_VLAN_INGRESS_CTRL2_REG
, RTL8366RB_PORT_ALL
);
292 /* don't drop packets whose DA has not been learned */
293 REG_RMW(smi
, RTL8366RB_SSCR2
, RTL8366RB_SSCR2_DROP_UNKNOWN_DA
, 0);
298 static int rtl8366rb_read_phy_reg(struct rtl8366_smi
*smi
,
299 u32 phy_no
, u32 page
, u32 addr
, u32
*data
)
304 if (phy_no
> RTL8366RB_PHY_NO_MAX
)
307 if (page
> RTL8366RB_PHY_PAGE_MAX
)
310 if (addr
> RTL8366RB_PHY_ADDR_MAX
)
313 ret
= rtl8366_smi_write_reg(smi
, RTL8366RB_PHY_ACCESS_CTRL_REG
,
314 RTL8366RB_PHY_CTRL_READ
);
318 reg
= 0x8000 | (1 << (phy_no
+ RTL8366RB_PHY_NO_OFFSET
)) |
319 ((page
<< RTL8366RB_PHY_PAGE_OFFSET
) & RTL8366RB_PHY_PAGE_MASK
) |
320 (addr
& RTL8366RB_PHY_REG_MASK
);
322 ret
= rtl8366_smi_write_reg(smi
, reg
, 0);
326 ret
= rtl8366_smi_read_reg(smi
, RTL8366RB_PHY_ACCESS_DATA_REG
, data
);
333 static int rtl8366rb_write_phy_reg(struct rtl8366_smi
*smi
,
334 u32 phy_no
, u32 page
, u32 addr
, u32 data
)
339 if (phy_no
> RTL8366RB_PHY_NO_MAX
)
342 if (page
> RTL8366RB_PHY_PAGE_MAX
)
345 if (addr
> RTL8366RB_PHY_ADDR_MAX
)
348 ret
= rtl8366_smi_write_reg(smi
, RTL8366RB_PHY_ACCESS_CTRL_REG
,
349 RTL8366RB_PHY_CTRL_WRITE
);
353 reg
= 0x8000 | (1 << (phy_no
+ RTL8366RB_PHY_NO_OFFSET
)) |
354 ((page
<< RTL8366RB_PHY_PAGE_OFFSET
) & RTL8366RB_PHY_PAGE_MASK
) |
355 (addr
& RTL8366RB_PHY_REG_MASK
);
357 ret
= rtl8366_smi_write_reg(smi
, reg
, data
);
364 static int rtl8366rb_get_mib_counter(struct rtl8366_smi
*smi
, int counter
,
365 int port
, unsigned long long *val
)
372 if (port
> RTL8366RB_NUM_PORTS
|| counter
>= RTL8366RB_MIB_COUNT
)
375 addr
= RTL8366RB_MIB_COUNTER_BASE
+
376 RTL8366RB_MIB_COUNTER_PORT_OFFSET
* (port
) +
377 rtl8366rb_mib_counters
[counter
].offset
;
380 * Writing access counter address first
381 * then ASIC will prepare 64bits counter wait for being retrived
383 data
= 0; /* writing data will be discard by ASIC */
384 err
= rtl8366_smi_write_reg(smi
, addr
, data
);
388 /* read MIB control register */
389 err
= rtl8366_smi_read_reg(smi
, RTL8366RB_MIB_CTRL_REG
, &data
);
393 if (data
& RTL8366RB_MIB_CTRL_BUSY_MASK
)
396 if (data
& RTL8366RB_MIB_CTRL_RESET_MASK
)
400 for (i
= rtl8366rb_mib_counters
[counter
].length
; i
> 0; i
--) {
401 err
= rtl8366_smi_read_reg(smi
, addr
+ (i
- 1), &data
);
405 mibvalue
= (mibvalue
<< 16) | (data
& 0xFFFF);
412 static int rtl8366rb_get_vlan_4k(struct rtl8366_smi
*smi
, u32 vid
,
413 struct rtl8366_vlan_4k
*vlan4k
)
419 memset(vlan4k
, '\0', sizeof(struct rtl8366_vlan_4k
));
421 if (vid
>= RTL8366RB_NUM_VIDS
)
425 err
= rtl8366_smi_write_reg(smi
, RTL8366RB_VLAN_TABLE_WRITE_BASE
,
426 vid
& RTL8366RB_VLAN_VID_MASK
);
430 /* write table access control word */
431 err
= rtl8366_smi_write_reg(smi
, RTL8366RB_TABLE_ACCESS_CTRL_REG
,
432 RTL8366RB_TABLE_VLAN_READ_CTRL
);
436 for (i
= 0; i
< 3; i
++) {
437 err
= rtl8366_smi_read_reg(smi
,
438 RTL8366RB_VLAN_TABLE_READ_BASE
+ i
,
445 vlan4k
->untag
= (data
[1] >> RTL8366RB_VLAN_UNTAG_SHIFT
) &
446 RTL8366RB_VLAN_UNTAG_MASK
;
447 vlan4k
->member
= data
[1] & RTL8366RB_VLAN_MEMBER_MASK
;
448 vlan4k
->fid
= data
[2] & RTL8366RB_VLAN_FID_MASK
;
453 static int rtl8366rb_set_vlan_4k(struct rtl8366_smi
*smi
,
454 const struct rtl8366_vlan_4k
*vlan4k
)
460 if (vlan4k
->vid
>= RTL8366RB_NUM_VIDS
||
461 vlan4k
->member
> RTL8366RB_VLAN_MEMBER_MASK
||
462 vlan4k
->untag
> RTL8366RB_VLAN_UNTAG_MASK
||
463 vlan4k
->fid
> RTL8366RB_FIDMAX
)
466 data
[0] = vlan4k
->vid
& RTL8366RB_VLAN_VID_MASK
;
467 data
[1] = (vlan4k
->member
& RTL8366RB_VLAN_MEMBER_MASK
) |
468 ((vlan4k
->untag
& RTL8366RB_VLAN_UNTAG_MASK
) <<
469 RTL8366RB_VLAN_UNTAG_SHIFT
);
470 data
[2] = vlan4k
->fid
& RTL8366RB_VLAN_FID_MASK
;
472 for (i
= 0; i
< 3; i
++) {
473 err
= rtl8366_smi_write_reg(smi
,
474 RTL8366RB_VLAN_TABLE_WRITE_BASE
+ i
,
480 /* write table access control word */
481 err
= rtl8366_smi_write_reg(smi
, RTL8366RB_TABLE_ACCESS_CTRL_REG
,
482 RTL8366RB_TABLE_VLAN_WRITE_CTRL
);
487 static int rtl8366rb_get_vlan_mc(struct rtl8366_smi
*smi
, u32 index
,
488 struct rtl8366_vlan_mc
*vlanmc
)
494 memset(vlanmc
, '\0', sizeof(struct rtl8366_vlan_mc
));
496 if (index
>= RTL8366RB_NUM_VLANS
)
499 for (i
= 0; i
< 3; i
++) {
500 err
= rtl8366_smi_read_reg(smi
,
501 RTL8366RB_VLAN_MC_BASE(index
) + i
,
507 vlanmc
->vid
= data
[0] & RTL8366RB_VLAN_VID_MASK
;
508 vlanmc
->priority
= (data
[0] >> RTL8366RB_VLAN_PRIORITY_SHIFT
) &
509 RTL8366RB_VLAN_PRIORITY_MASK
;
510 vlanmc
->untag
= (data
[1] >> RTL8366RB_VLAN_UNTAG_SHIFT
) &
511 RTL8366RB_VLAN_UNTAG_MASK
;
512 vlanmc
->member
= data
[1] & RTL8366RB_VLAN_MEMBER_MASK
;
513 vlanmc
->fid
= data
[2] & RTL8366RB_VLAN_FID_MASK
;
518 static int rtl8366rb_set_vlan_mc(struct rtl8366_smi
*smi
, u32 index
,
519 const struct rtl8366_vlan_mc
*vlanmc
)
525 if (index
>= RTL8366RB_NUM_VLANS
||
526 vlanmc
->vid
>= RTL8366RB_NUM_VIDS
||
527 vlanmc
->priority
> RTL8366RB_PRIORITYMAX
||
528 vlanmc
->member
> RTL8366RB_VLAN_MEMBER_MASK
||
529 vlanmc
->untag
> RTL8366RB_VLAN_UNTAG_MASK
||
530 vlanmc
->fid
> RTL8366RB_FIDMAX
)
533 data
[0] = (vlanmc
->vid
& RTL8366RB_VLAN_VID_MASK
) |
534 ((vlanmc
->priority
& RTL8366RB_VLAN_PRIORITY_MASK
) <<
535 RTL8366RB_VLAN_PRIORITY_SHIFT
);
536 data
[1] = (vlanmc
->member
& RTL8366RB_VLAN_MEMBER_MASK
) |
537 ((vlanmc
->untag
& RTL8366RB_VLAN_UNTAG_MASK
) <<
538 RTL8366RB_VLAN_UNTAG_SHIFT
);
539 data
[2] = vlanmc
->fid
& RTL8366RB_VLAN_FID_MASK
;
541 for (i
= 0; i
< 3; i
++) {
542 err
= rtl8366_smi_write_reg(smi
,
543 RTL8366RB_VLAN_MC_BASE(index
) + i
,
552 static int rtl8366rb_get_mc_index(struct rtl8366_smi
*smi
, int port
, int *val
)
557 if (port
>= RTL8366RB_NUM_PORTS
)
560 err
= rtl8366_smi_read_reg(smi
, RTL8366RB_PORT_VLAN_CTRL_REG(port
),
565 *val
= (data
>> RTL8366RB_PORT_VLAN_CTRL_SHIFT(port
)) &
566 RTL8366RB_PORT_VLAN_CTRL_MASK
;
572 static int rtl8366rb_set_mc_index(struct rtl8366_smi
*smi
, int port
, int index
)
574 if (port
>= RTL8366RB_NUM_PORTS
|| index
>= RTL8366RB_NUM_VLANS
)
577 return rtl8366_smi_rmwr(smi
, RTL8366RB_PORT_VLAN_CTRL_REG(port
),
578 RTL8366RB_PORT_VLAN_CTRL_MASK
<<
579 RTL8366RB_PORT_VLAN_CTRL_SHIFT(port
),
580 (index
& RTL8366RB_PORT_VLAN_CTRL_MASK
) <<
581 RTL8366RB_PORT_VLAN_CTRL_SHIFT(port
));
584 static int rtl8366rb_is_vlan_valid(struct rtl8366_smi
*smi
, unsigned vlan
)
586 unsigned max
= RTL8366RB_NUM_VLANS
;
588 if (smi
->vlan4k_enabled
)
589 max
= RTL8366RB_NUM_VIDS
- 1;
591 if (vlan
== 0 || vlan
>= max
)
597 static int rtl8366rb_enable_vlan(struct rtl8366_smi
*smi
, int enable
)
599 return rtl8366_smi_rmwr(smi
, RTL8366RB_SGCR
, RTL8366RB_SGCR_EN_VLAN
,
600 (enable
) ? RTL8366RB_SGCR_EN_VLAN
: 0);
603 static int rtl8366rb_enable_vlan4k(struct rtl8366_smi
*smi
, int enable
)
605 return rtl8366_smi_rmwr(smi
, RTL8366RB_SGCR
,
606 RTL8366RB_SGCR_EN_VLAN_4KTB
,
607 (enable
) ? RTL8366RB_SGCR_EN_VLAN_4KTB
: 0);
610 static int rtl8366rb_sw_reset_mibs(struct switch_dev
*dev
,
611 const struct switch_attr
*attr
,
612 struct switch_val
*val
)
614 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
616 return rtl8366_smi_rmwr(smi
, RTL8366RB_MIB_CTRL_REG
, 0,
617 RTL8366RB_MIB_CTRL_GLOBAL_RESET
);
620 static int rtl8366rb_sw_get_blinkrate(struct switch_dev
*dev
,
621 const struct switch_attr
*attr
,
622 struct switch_val
*val
)
624 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
627 rtl8366_smi_read_reg(smi
, RTL8366RB_LED_BLINKRATE_REG
, &data
);
629 val
->value
.i
= (data
& (RTL8366RB_LED_BLINKRATE_MASK
));
634 static int rtl8366rb_sw_set_blinkrate(struct switch_dev
*dev
,
635 const struct switch_attr
*attr
,
636 struct switch_val
*val
)
638 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
640 if (val
->value
.i
>= 6)
643 return rtl8366_smi_rmwr(smi
, RTL8366RB_LED_BLINKRATE_REG
,
644 RTL8366RB_LED_BLINKRATE_MASK
,
648 static int rtl8366rb_sw_get_learning_enable(struct switch_dev
*dev
,
649 const struct switch_attr
*attr
,
650 struct switch_val
*val
)
652 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
655 rtl8366_smi_read_reg(smi
, RTL8366RB_SSCR0
, &data
);
656 val
->value
.i
= !data
;
662 static int rtl8366rb_sw_set_learning_enable(struct switch_dev
*dev
,
663 const struct switch_attr
*attr
,
664 struct switch_val
*val
)
666 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
671 portmask
= RTL8366RB_PORT_ALL
;
673 /* set learning for all ports */
674 REG_WR(smi
, RTL8366RB_SSCR0
, portmask
);
676 /* set auto ageing for all ports */
677 REG_WR(smi
, RTL8366RB_SSCR1
, portmask
);
683 static const char *rtl8366rb_speed_str(unsigned speed
)
697 static int rtl8366rb_sw_get_port_link(struct switch_dev
*dev
,
698 const struct switch_attr
*attr
,
699 struct switch_val
*val
)
701 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
702 u32 len
= 0, data
= 0;
704 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
707 memset(smi
->buf
, '\0', sizeof(smi
->buf
));
708 rtl8366_smi_read_reg(smi
, RTL8366RB_PORT_LINK_STATUS_BASE
+
709 (val
->port_vlan
/ 2), &data
);
711 if (val
->port_vlan
% 2)
714 if (data
& RTL8366RB_PORT_STATUS_LINK_MASK
) {
715 len
= snprintf(smi
->buf
, sizeof(smi
->buf
),
716 "port:%d link:up speed:%s %s-duplex %s%s%s",
718 rtl8366rb_speed_str(data
&
719 RTL8366RB_PORT_STATUS_SPEED_MASK
),
720 (data
& RTL8366RB_PORT_STATUS_DUPLEX_MASK
) ?
722 (data
& RTL8366RB_PORT_STATUS_TXPAUSE_MASK
) ?
724 (data
& RTL8366RB_PORT_STATUS_RXPAUSE_MASK
) ?
726 (data
& RTL8366RB_PORT_STATUS_AN_MASK
) ?
729 len
= snprintf(smi
->buf
, sizeof(smi
->buf
), "port:%d link: down",
733 val
->value
.s
= smi
->buf
;
739 static int rtl8366rb_sw_set_port_led(struct switch_dev
*dev
,
740 const struct switch_attr
*attr
,
741 struct switch_val
*val
)
743 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
748 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
751 if (val
->port_vlan
== RTL8366RB_PORT_NUM_CPU
) {
752 reg
= RTL8366RB_LED_BLINKRATE_REG
;
754 data
= val
->value
.i
<< 4;
756 reg
= RTL8366RB_LED_CTRL_REG
;
757 mask
= 0xF << (val
->port_vlan
* 4),
758 data
= val
->value
.i
<< (val
->port_vlan
* 4);
761 return rtl8366_smi_rmwr(smi
, reg
, mask
, data
);
764 static int rtl8366rb_sw_get_port_led(struct switch_dev
*dev
,
765 const struct switch_attr
*attr
,
766 struct switch_val
*val
)
768 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
771 if (val
->port_vlan
>= RTL8366RB_NUM_LEDGROUPS
)
774 rtl8366_smi_read_reg(smi
, RTL8366RB_LED_CTRL_REG
, &data
);
775 val
->value
.i
= (data
>> (val
->port_vlan
* 4)) & 0x000F;
780 static int rtl8366rb_sw_set_port_disable(struct switch_dev
*dev
,
781 const struct switch_attr
*attr
,
782 struct switch_val
*val
)
784 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
787 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
790 mask
= 1 << val
->port_vlan
;
796 return rtl8366_smi_rmwr(smi
, RTL8366RB_PECR
, mask
, data
);
799 static int rtl8366rb_sw_get_port_disable(struct switch_dev
*dev
,
800 const struct switch_attr
*attr
,
801 struct switch_val
*val
)
803 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
806 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
809 rtl8366_smi_read_reg(smi
, RTL8366RB_PECR
, &data
);
810 if (data
& (1 << val
->port_vlan
))
818 static int rtl8366rb_sw_set_port_rate_in(struct switch_dev
*dev
,
819 const struct switch_attr
*attr
,
820 struct switch_val
*val
)
822 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
824 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
827 if (val
->value
.i
> 0 && val
->value
.i
< RTL8366RB_BDTH_SW_MAX
)
828 val
->value
.i
= (val
->value
.i
- 1) / RTL8366RB_BDTH_UNIT
;
830 val
->value
.i
= RTL8366RB_BDTH_REG_DEFAULT
;
832 return rtl8366_smi_rmwr(smi
, RTL8366RB_IB_REG(val
->port_vlan
),
833 RTL8366RB_IB_BDTH_MASK
| RTL8366RB_IB_PREIFG_MASK
,
835 (RTL8366RB_QOS_DEFAULT_PREIFG
<< RTL8366RB_IB_PREIFG_OFFSET
));
839 static int rtl8366rb_sw_get_port_rate_in(struct switch_dev
*dev
,
840 const struct switch_attr
*attr
,
841 struct switch_val
*val
)
843 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
846 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
849 rtl8366_smi_read_reg(smi
, RTL8366RB_IB_REG(val
->port_vlan
), &data
);
850 data
&= RTL8366RB_IB_BDTH_MASK
;
851 if (data
< RTL8366RB_IB_BDTH_MASK
)
854 val
->value
.i
= (int)data
* RTL8366RB_BDTH_UNIT
;
859 static int rtl8366rb_sw_set_port_rate_out(struct switch_dev
*dev
,
860 const struct switch_attr
*attr
,
861 struct switch_val
*val
)
863 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
865 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
868 rtl8366_smi_rmwr(smi
, RTL8366RB_EB_PREIFG_REG
,
869 RTL8366RB_EB_PREIFG_MASK
,
870 (RTL8366RB_QOS_DEFAULT_PREIFG
<< RTL8366RB_EB_PREIFG_OFFSET
));
872 if (val
->value
.i
> 0 && val
->value
.i
< RTL8366RB_BDTH_SW_MAX
)
873 val
->value
.i
= (val
->value
.i
- 1) / RTL8366RB_BDTH_UNIT
;
875 val
->value
.i
= RTL8366RB_BDTH_REG_DEFAULT
;
877 return rtl8366_smi_rmwr(smi
, RTL8366RB_EB_REG(val
->port_vlan
),
878 RTL8366RB_EB_BDTH_MASK
, val
->value
.i
);
882 static int rtl8366rb_sw_get_port_rate_out(struct switch_dev
*dev
,
883 const struct switch_attr
*attr
,
884 struct switch_val
*val
)
886 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
889 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
892 rtl8366_smi_read_reg(smi
, RTL8366RB_EB_REG(val
->port_vlan
), &data
);
893 data
&= RTL8366RB_EB_BDTH_MASK
;
894 if (data
< RTL8366RB_EB_BDTH_MASK
)
897 val
->value
.i
= (int)data
* RTL8366RB_BDTH_UNIT
;
902 static int rtl8366rb_sw_set_qos_enable(struct switch_dev
*dev
,
903 const struct switch_attr
*attr
,
904 struct switch_val
*val
)
906 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
910 data
= RTL8366RB_QOS_MASK
;
914 return rtl8366_smi_rmwr(smi
, RTL8366RB_SGCR
, RTL8366RB_QOS_MASK
, data
);
917 static int rtl8366rb_sw_get_qos_enable(struct switch_dev
*dev
,
918 const struct switch_attr
*attr
,
919 struct switch_val
*val
)
921 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
924 rtl8366_smi_read_reg(smi
, RTL8366RB_SGCR
, &data
);
925 if (data
& RTL8366RB_QOS_MASK
)
933 static int rtl8366rb_sw_reset_port_mibs(struct switch_dev
*dev
,
934 const struct switch_attr
*attr
,
935 struct switch_val
*val
)
937 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
939 if (val
->port_vlan
>= RTL8366RB_NUM_PORTS
)
942 return rtl8366_smi_rmwr(smi
, RTL8366RB_MIB_CTRL_REG
, 0,
943 RTL8366RB_MIB_CTRL_PORT_RESET(val
->port_vlan
));
946 static int rtl8366rb_sw_reset_switch(struct switch_dev
*dev
)
948 struct rtl8366_smi
*smi
= sw_to_rtl8366_smi(dev
);
951 err
= rtl8366rb_reset_chip(smi
);
955 err
= rtl8366rb_hw_init(smi
);
959 return rtl8366_reset_vlan(smi
);
962 static struct switch_attr rtl8366rb_globals
[] = {
964 .type
= SWITCH_TYPE_INT
,
965 .name
= "enable_learning",
966 .description
= "Enable learning, enable aging",
967 .set
= rtl8366rb_sw_set_learning_enable
,
968 .get
= rtl8366rb_sw_get_learning_enable
,
971 .type
= SWITCH_TYPE_INT
,
972 .name
= "enable_vlan",
973 .description
= "Enable VLAN mode",
974 .set
= rtl8366_sw_set_vlan_enable
,
975 .get
= rtl8366_sw_get_vlan_enable
,
979 .type
= SWITCH_TYPE_INT
,
980 .name
= "enable_vlan4k",
981 .description
= "Enable VLAN 4K mode",
982 .set
= rtl8366_sw_set_vlan_enable
,
983 .get
= rtl8366_sw_get_vlan_enable
,
987 .type
= SWITCH_TYPE_NOVAL
,
988 .name
= "reset_mibs",
989 .description
= "Reset all MIB counters",
990 .set
= rtl8366rb_sw_reset_mibs
,
992 .type
= SWITCH_TYPE_INT
,
994 .description
= "Get/Set LED blinking rate (0 = 43ms, 1 = 84ms,"
995 " 2 = 120ms, 3 = 170ms, 4 = 340ms, 5 = 670ms)",
996 .set
= rtl8366rb_sw_set_blinkrate
,
997 .get
= rtl8366rb_sw_get_blinkrate
,
1000 .type
= SWITCH_TYPE_INT
,
1001 .name
= "enable_qos",
1002 .description
= "Enable QOS",
1003 .set
= rtl8366rb_sw_set_qos_enable
,
1004 .get
= rtl8366rb_sw_get_qos_enable
,
1009 static struct switch_attr rtl8366rb_port
[] = {
1011 .type
= SWITCH_TYPE_STRING
,
1013 .description
= "Get port link information",
1016 .get
= rtl8366rb_sw_get_port_link
,
1018 .type
= SWITCH_TYPE_NOVAL
,
1019 .name
= "reset_mib",
1020 .description
= "Reset single port MIB counters",
1021 .set
= rtl8366rb_sw_reset_port_mibs
,
1023 .type
= SWITCH_TYPE_STRING
,
1025 .description
= "Get MIB counters for port",
1028 .get
= rtl8366_sw_get_port_mib
,
1030 .type
= SWITCH_TYPE_INT
,
1032 .description
= "Get/Set port group (0 - 3) led mode (0 - 15)",
1034 .set
= rtl8366rb_sw_set_port_led
,
1035 .get
= rtl8366rb_sw_get_port_led
,
1037 .type
= SWITCH_TYPE_INT
,
1039 .description
= "Get/Set port state (enabled or disabled)",
1041 .set
= rtl8366rb_sw_set_port_disable
,
1042 .get
= rtl8366rb_sw_get_port_disable
,
1044 .type
= SWITCH_TYPE_INT
,
1046 .description
= "Get/Set port ingress (incoming) bandwidth limit in kbps",
1047 .max
= RTL8366RB_BDTH_SW_MAX
,
1048 .set
= rtl8366rb_sw_set_port_rate_in
,
1049 .get
= rtl8366rb_sw_get_port_rate_in
,
1051 .type
= SWITCH_TYPE_INT
,
1053 .description
= "Get/Set port egress (outgoing) bandwidth limit in kbps",
1054 .max
= RTL8366RB_BDTH_SW_MAX
,
1055 .set
= rtl8366rb_sw_set_port_rate_out
,
1056 .get
= rtl8366rb_sw_get_port_rate_out
,
1060 static struct switch_attr rtl8366rb_vlan
[] = {
1062 .type
= SWITCH_TYPE_STRING
,
1064 .description
= "Get vlan information",
1067 .get
= rtl8366_sw_get_vlan_info
,
1069 .type
= SWITCH_TYPE_INT
,
1071 .description
= "Get/Set vlan FID",
1072 .max
= RTL8366RB_FIDMAX
,
1073 .set
= rtl8366_sw_set_vlan_fid
,
1074 .get
= rtl8366_sw_get_vlan_fid
,
1078 static const struct switch_dev_ops rtl8366_ops
= {
1080 .attr
= rtl8366rb_globals
,
1081 .n_attr
= ARRAY_SIZE(rtl8366rb_globals
),
1084 .attr
= rtl8366rb_port
,
1085 .n_attr
= ARRAY_SIZE(rtl8366rb_port
),
1088 .attr
= rtl8366rb_vlan
,
1089 .n_attr
= ARRAY_SIZE(rtl8366rb_vlan
),
1092 .get_vlan_ports
= rtl8366_sw_get_vlan_ports
,
1093 .set_vlan_ports
= rtl8366_sw_set_vlan_ports
,
1094 .get_port_pvid
= rtl8366_sw_get_port_pvid
,
1095 .set_port_pvid
= rtl8366_sw_set_port_pvid
,
1096 .reset_switch
= rtl8366rb_sw_reset_switch
,
1099 static int rtl8366rb_switch_init(struct rtl8366_smi
*smi
)
1101 struct switch_dev
*dev
= &smi
->sw_dev
;
1104 dev
->name
= "RTL8366RB";
1105 dev
->cpu_port
= RTL8366RB_PORT_NUM_CPU
;
1106 dev
->ports
= RTL8366RB_NUM_PORTS
;
1107 dev
->vlans
= RTL8366RB_NUM_VIDS
;
1108 dev
->ops
= &rtl8366_ops
;
1109 dev
->devname
= dev_name(smi
->parent
);
1111 err
= register_switch(dev
, NULL
);
1113 dev_err(smi
->parent
, "switch registration failed\n");
1118 static void rtl8366rb_switch_cleanup(struct rtl8366_smi
*smi
)
1120 unregister_switch(&smi
->sw_dev
);
1123 static int rtl8366rb_mii_read(struct mii_bus
*bus
, int addr
, int reg
)
1125 struct rtl8366_smi
*smi
= bus
->priv
;
1129 err
= rtl8366rb_read_phy_reg(smi
, addr
, 0, reg
, &val
);
1136 static int rtl8366rb_mii_write(struct mii_bus
*bus
, int addr
, int reg
, u16 val
)
1138 struct rtl8366_smi
*smi
= bus
->priv
;
1142 err
= rtl8366rb_write_phy_reg(smi
, addr
, 0, reg
, val
);
1144 (void) rtl8366rb_read_phy_reg(smi
, addr
, 0, reg
, &t
);
1149 static int rtl8366rb_mii_bus_match(struct mii_bus
*bus
)
1151 return (bus
->read
== rtl8366rb_mii_read
&&
1152 bus
->write
== rtl8366rb_mii_write
);
1155 static int rtl8366rb_setup(struct rtl8366_smi
*smi
)
1159 ret
= rtl8366rb_reset_chip(smi
);
1163 ret
= rtl8366rb_hw_init(smi
);
1167 static int rtl8366rb_detect(struct rtl8366_smi
*smi
)
1173 ret
= rtl8366_smi_read_reg(smi
, RTL8366RB_CHIP_ID_REG
, &chip_id
);
1175 dev_err(smi
->parent
, "unable to read chip id\n");
1180 case RTL8366RB_CHIP_ID_8366
:
1183 dev_err(smi
->parent
, "unknown chip id (%04x)\n", chip_id
);
1187 ret
= rtl8366_smi_read_reg(smi
, RTL8366RB_CHIP_VERSION_CTRL_REG
,
1190 dev_err(smi
->parent
, "unable to read chip version\n");
1194 dev_info(smi
->parent
, "RTL%04x ver. %u chip found\n",
1195 chip_id
, chip_ver
& RTL8366RB_CHIP_VERSION_MASK
);
1200 static struct rtl8366_smi_ops rtl8366rb_smi_ops
= {
1201 .detect
= rtl8366rb_detect
,
1202 .setup
= rtl8366rb_setup
,
1204 .mii_read
= rtl8366rb_mii_read
,
1205 .mii_write
= rtl8366rb_mii_write
,
1207 .get_vlan_mc
= rtl8366rb_get_vlan_mc
,
1208 .set_vlan_mc
= rtl8366rb_set_vlan_mc
,
1209 .get_vlan_4k
= rtl8366rb_get_vlan_4k
,
1210 .set_vlan_4k
= rtl8366rb_set_vlan_4k
,
1211 .get_mc_index
= rtl8366rb_get_mc_index
,
1212 .set_mc_index
= rtl8366rb_set_mc_index
,
1213 .get_mib_counter
= rtl8366rb_get_mib_counter
,
1214 .is_vlan_valid
= rtl8366rb_is_vlan_valid
,
1215 .enable_vlan
= rtl8366rb_enable_vlan
,
1216 .enable_vlan4k
= rtl8366rb_enable_vlan4k
,
1219 static int __devinit
rtl8366rb_probe(struct platform_device
*pdev
)
1221 static int rtl8366_smi_version_printed
;
1222 struct rtl8366rb_platform_data
*pdata
;
1223 struct rtl8366_smi
*smi
;
1226 if (!rtl8366_smi_version_printed
++)
1227 printk(KERN_NOTICE RTL8366RB_DRIVER_DESC
1228 " version " RTL8366RB_DRIVER_VER
"\n");
1230 pdata
= pdev
->dev
.platform_data
;
1232 dev_err(&pdev
->dev
, "no platform data specified\n");
1237 smi
= rtl8366_smi_alloc(&pdev
->dev
);
1243 smi
->gpio_sda
= pdata
->gpio_sda
;
1244 smi
->gpio_sck
= pdata
->gpio_sck
;
1245 smi
->ops
= &rtl8366rb_smi_ops
;
1246 smi
->cpu_port
= RTL8366RB_PORT_NUM_CPU
;
1247 smi
->num_ports
= RTL8366RB_NUM_PORTS
;
1248 smi
->num_vlan_mc
= RTL8366RB_NUM_VLANS
;
1249 smi
->mib_counters
= rtl8366rb_mib_counters
;
1250 smi
->num_mib_counters
= ARRAY_SIZE(rtl8366rb_mib_counters
);
1252 err
= rtl8366_smi_init(smi
);
1256 platform_set_drvdata(pdev
, smi
);
1258 err
= rtl8366rb_switch_init(smi
);
1260 goto err_clear_drvdata
;
1265 platform_set_drvdata(pdev
, NULL
);
1266 rtl8366_smi_cleanup(smi
);
1273 static int rtl8366rb_phy_config_init(struct phy_device
*phydev
)
1275 if (!rtl8366rb_mii_bus_match(phydev
->bus
))
1281 static int rtl8366rb_phy_config_aneg(struct phy_device
*phydev
)
1283 /* phy 4 might be connected to a second mac, allow aneg config */
1284 if (phydev
->addr
== RTL8366RB_PHY_WAN
)
1285 return genphy_config_aneg(phydev
);
1290 static struct phy_driver rtl8366rb_phy_driver
= {
1291 .phy_id
= 0x001cc960,
1292 .name
= "Realtek RTL8366RB",
1293 .phy_id_mask
= 0x1ffffff0,
1294 .features
= PHY_GBIT_FEATURES
,
1295 .config_aneg
= rtl8366rb_phy_config_aneg
,
1296 .config_init
= rtl8366rb_phy_config_init
,
1297 .read_status
= genphy_read_status
,
1299 .owner
= THIS_MODULE
,
1303 static int __devexit
rtl8366rb_remove(struct platform_device
*pdev
)
1305 struct rtl8366_smi
*smi
= platform_get_drvdata(pdev
);
1308 rtl8366rb_switch_cleanup(smi
);
1309 platform_set_drvdata(pdev
, NULL
);
1310 rtl8366_smi_cleanup(smi
);
1317 static struct platform_driver rtl8366rb_driver
= {
1319 .name
= RTL8366RB_DRIVER_NAME
,
1320 .owner
= THIS_MODULE
,
1322 .probe
= rtl8366rb_probe
,
1323 .remove
= __devexit_p(rtl8366rb_remove
),
1326 static int __init
rtl8366rb_module_init(void)
1329 ret
= platform_driver_register(&rtl8366rb_driver
);
1333 ret
= phy_driver_register(&rtl8366rb_phy_driver
);
1335 goto err_platform_unregister
;
1339 err_platform_unregister
:
1340 platform_driver_unregister(&rtl8366rb_driver
);
1343 module_init(rtl8366rb_module_init
);
1345 static void __exit
rtl8366rb_module_exit(void)
1347 phy_driver_unregister(&rtl8366rb_phy_driver
);
1348 platform_driver_unregister(&rtl8366rb_driver
);
1350 module_exit(rtl8366rb_module_exit
);
1352 MODULE_DESCRIPTION(RTL8366RB_DRIVER_DESC
);
1353 MODULE_VERSION(RTL8366RB_DRIVER_VER
);
1354 MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
1355 MODULE_AUTHOR("Antti Seppälä <a.seppala@gmail.com>");
1356 MODULE_AUTHOR("Roman Yeryomin <roman@advem.lv>");
1357 MODULE_LICENSE("GPL v2");
1358 MODULE_ALIAS("platform:" RTL8366RB_DRIVER_NAME
);