2 * Driver for NXP MCR20A 802.15.4 Wireless-PAN Networking controller
4 * Copyright (C) 2018 Xue Liu <liuxuenetmail@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <linux/kernel.h>
17 #include <linux/module.h>
18 #include <linux/gpio/consumer.h>
19 #include <linux/spi/spi.h>
20 #include <linux/workqueue.h>
21 #include <linux/interrupt.h>
22 #include <linux/irq.h>
23 #include <linux/skbuff.h>
24 #include <linux/of_gpio.h>
25 #include <linux/regmap.h>
26 #include <linux/ieee802154.h>
27 #include <linux/debugfs.h>
29 #include <net/mac802154.h>
30 #include <net/cfg802154.h>
32 #include <linux/device.h>
36 #define SPI_COMMAND_BUFFER 3
38 #define REGISTER_READ BIT(7)
39 #define REGISTER_WRITE (0 << 7)
40 #define REGISTER_ACCESS (0 << 6)
41 #define PACKET_BUFF_BURST_ACCESS BIT(6)
42 #define PACKET_BUFF_BYTE_ACCESS BIT(5)
44 #define MCR20A_WRITE_REG(x) (x)
45 #define MCR20A_READ_REG(x) (REGISTER_READ | (x))
46 #define MCR20A_BURST_READ_PACKET_BUF (0xC0)
47 #define MCR20A_BURST_WRITE_PACKET_BUF (0x40)
49 #define MCR20A_CMD_REG 0x80
50 #define MCR20A_CMD_REG_MASK 0x3f
51 #define MCR20A_CMD_WRITE 0x40
52 #define MCR20A_CMD_FB 0x20
54 /* Number of Interrupt Request Status Register */
55 #define MCR20A_IRQSTS_NUM 2 /* only IRQ_STS1 and IRQ_STS2 */
59 MCR20A_CCA_ED
, // energy detect - CCA bit not active,
60 // not to be used for T and CCCA sequences
61 MCR20A_CCA_MODE1
, // energy detect - CCA bit ACTIVE
62 MCR20A_CCA_MODE2
, // 802.15.4 compliant signal detect - CCA bit ACTIVE
67 MCR20A_XCVSEQ_IDLE
= 0x00,
68 MCR20A_XCVSEQ_RX
= 0x01,
69 MCR20A_XCVSEQ_TX
= 0x02,
70 MCR20A_XCVSEQ_CCA
= 0x03,
71 MCR20A_XCVSEQ_TR
= 0x04,
72 MCR20A_XCVSEQ_CCCA
= 0x05,
75 /* IEEE-802.15.4 defined constants (2.4 GHz logical channels) */
76 #define MCR20A_MIN_CHANNEL (11)
77 #define MCR20A_MAX_CHANNEL (26)
78 #define MCR20A_CHANNEL_SPACING (5)
80 /* MCR20A CCA Threshold constans */
81 #define MCR20A_MIN_CCA_THRESHOLD (0x6EU)
82 #define MCR20A_MAX_CCA_THRESHOLD (0x00U)
85 #define MCR20A_OVERWRITE_VERSION (0x0C)
87 /* MCR20A PLL configurations */
88 static const u8 PLL_INT
[16] = {
89 /* 2405 */ 0x0B, /* 2410 */ 0x0B, /* 2415 */ 0x0B,
90 /* 2420 */ 0x0B, /* 2425 */ 0x0B, /* 2430 */ 0x0B,
91 /* 2435 */ 0x0C, /* 2440 */ 0x0C, /* 2445 */ 0x0C,
92 /* 2450 */ 0x0C, /* 2455 */ 0x0C, /* 2460 */ 0x0C,
93 /* 2465 */ 0x0D, /* 2470 */ 0x0D, /* 2475 */ 0x0D,
97 static const u8 PLL_FRAC
[16] = {
98 /* 2405 */ 0x28, /* 2410 */ 0x50, /* 2415 */ 0x78,
99 /* 2420 */ 0xA0, /* 2425 */ 0xC8, /* 2430 */ 0xF0,
100 /* 2435 */ 0x18, /* 2440 */ 0x40, /* 2445 */ 0x68,
101 /* 2450 */ 0x90, /* 2455 */ 0xB8, /* 2460 */ 0xE0,
102 /* 2465 */ 0x08, /* 2470 */ 0x30, /* 2475 */ 0x58,
106 static const struct reg_sequence mar20a_iar_overwrites
[] = {
107 { IAR_MISC_PAD_CTRL
, 0x02 },
108 { IAR_VCO_CTRL1
, 0xB3 },
109 { IAR_VCO_CTRL2
, 0x07 },
110 { IAR_PA_TUNING
, 0x71 },
111 { IAR_CHF_IBUF
, 0x2F },
112 { IAR_CHF_QBUF
, 0x2F },
113 { IAR_CHF_IRIN
, 0x24 },
114 { IAR_CHF_QRIN
, 0x24 },
115 { IAR_CHF_IL
, 0x24 },
116 { IAR_CHF_QL
, 0x24 },
117 { IAR_CHF_CC1
, 0x32 },
118 { IAR_CHF_CCL
, 0x1D },
119 { IAR_CHF_CC2
, 0x2D },
120 { IAR_CHF_IROUT
, 0x24 },
121 { IAR_CHF_QROUT
, 0x24 },
122 { IAR_PA_CAL
, 0x28 },
123 { IAR_AGC_THR1
, 0x55 },
124 { IAR_AGC_THR2
, 0x2D },
125 { IAR_ATT_RSSI1
, 0x5F },
126 { IAR_ATT_RSSI2
, 0x8F },
127 { IAR_RSSI_OFFSET
, 0x61 },
128 { IAR_CHF_PMA_GAIN
, 0x03 },
129 { IAR_CCA1_THRESH
, 0x50 },
130 { IAR_CORR_NVAL
, 0x13 },
131 { IAR_ACKDELAY
, 0x3D },
134 #define MCR20A_VALID_CHANNELS (0x07FFF800)
136 struct mcr20a_platform_data
{
140 #define MCR20A_MAX_BUF (127)
142 #define printdev(X) (&X->spi->dev)
144 /* regmap information for Direct Access Register (DAR) access */
145 #define MCR20A_DAR_WRITE 0x01
146 #define MCR20A_DAR_READ 0x00
147 #define MCR20A_DAR_NUMREGS 0x3F
149 /* regmap information for Indirect Access Register (IAR) access */
150 #define MCR20A_IAR_ACCESS 0x80
151 #define MCR20A_IAR_NUMREGS 0xBEFF
153 /* Read/Write SPI Commands for DAR and IAR registers. */
154 #define MCR20A_READSHORT(reg) ((reg) << 1)
155 #define MCR20A_WRITESHORT(reg) ((reg) << 1 | 1)
156 #define MCR20A_READLONG(reg) (1 << 15 | (reg) << 5)
157 #define MCR20A_WRITELONG(reg) (1 << 15 | (reg) << 5 | 1 << 4)
159 /* Type definitions for link configuration of instantiable layers */
160 #define MCR20A_PHY_INDIRECT_QUEUE_SIZE (12)
163 mcr20a_dar_writeable(struct device
*dev
, unsigned int reg
)
174 case DAR_SRC_ADDRS_SUM_LSB
:
175 case DAR_SRC_ADDRS_SUM_MSB
:
179 case DAR_T2PRIMECMP_LSB
:
180 case DAR_T2PRIMECMP_MSB
:
191 case DAR_PLL_FRAC0_LSB
:
192 case DAR_PLL_FRAC0_MSB
:
195 case DAR_OVERWRITE_VER
:
196 case DAR_CLK_OUT_CTRL
:
205 mcr20a_dar_readable(struct device
*dev
, unsigned int reg
)
209 /* all writeable are also readable */
210 rc
= mcr20a_dar_writeable(dev
, reg
);
217 case DAR_CCA1_ED_FNL
:
218 case DAR_EVENT_TMR_LSB
:
219 case DAR_EVENT_TMR_MSB
:
220 case DAR_EVENT_TMR_USB
:
221 case DAR_TIMESTAMP_LSB
:
222 case DAR_TIMESTAMP_MSB
:
223 case DAR_TIMESTAMP_USB
:
226 case DAR_RSSI_CCA_CONT
:
234 mcr20a_dar_volatile(struct device
*dev
, unsigned int reg
)
236 /* can be changed during runtime */
241 /* use them in spi_async and regmap so it's volatile */
249 mcr20a_dar_precious(struct device
*dev
, unsigned int reg
)
251 /* don't clear irq line on read */
262 static const struct regmap_config mcr20a_dar_regmap
= {
263 .name
= "mcr20a_dar",
266 .write_flag_mask
= REGISTER_ACCESS
| REGISTER_WRITE
,
267 .read_flag_mask
= REGISTER_ACCESS
| REGISTER_READ
,
268 .cache_type
= REGCACHE_RBTREE
,
269 .writeable_reg
= mcr20a_dar_writeable
,
270 .readable_reg
= mcr20a_dar_readable
,
271 .volatile_reg
= mcr20a_dar_volatile
,
272 .precious_reg
= mcr20a_dar_precious
,
274 .can_multi_write
= true,
278 mcr20a_iar_writeable(struct device
*dev
, unsigned int reg
)
282 case IAR_PMC_LP_TRIM
:
283 case IAR_MACPANID0_LSB
:
284 case IAR_MACPANID0_MSB
:
285 case IAR_MACSHORTADDRS0_LSB
:
286 case IAR_MACSHORTADDRS0_MSB
:
287 case IAR_MACLONGADDRS0_0
:
288 case IAR_MACLONGADDRS0_8
:
289 case IAR_MACLONGADDRS0_16
:
290 case IAR_MACLONGADDRS0_24
:
291 case IAR_MACLONGADDRS0_32
:
292 case IAR_MACLONGADDRS0_40
:
293 case IAR_MACLONGADDRS0_48
:
294 case IAR_MACLONGADDRS0_56
:
295 case IAR_RX_FRAME_FILTER
:
297 case IAR_PLL_FRAC1_LSB
:
298 case IAR_PLL_FRAC1_MSB
:
299 case IAR_MACPANID1_LSB
:
300 case IAR_MACPANID1_MSB
:
301 case IAR_MACSHORTADDRS1_LSB
:
302 case IAR_MACSHORTADDRS1_MSB
:
303 case IAR_MACLONGADDRS1_0
:
304 case IAR_MACLONGADDRS1_8
:
305 case IAR_MACLONGADDRS1_16
:
306 case IAR_MACLONGADDRS1_24
:
307 case IAR_MACLONGADDRS1_32
:
308 case IAR_MACLONGADDRS1_40
:
309 case IAR_MACLONGADDRS1_48
:
310 case IAR_MACLONGADDRS1_56
:
311 case IAR_DUAL_PAN_CTRL
:
312 case IAR_DUAL_PAN_DWELL
:
313 case IAR_CCA1_THRESH
:
314 case IAR_CCA1_ED_OFFSET_COMP
:
315 case IAR_LQI_OFFSET_COMP
:
317 case IAR_CCA2_CORR_PEAKS
:
318 case IAR_CCA2_CORR_THRESH
:
319 case IAR_TMR_PRESCALE
:
320 case IAR_ANT_PAD_CTRL
:
321 case IAR_MISC_PAD_CTRL
:
324 case IAR_RX_WTR_MARK
:
329 case IAR_ANT_AGC_CTRL
:
335 case IAR_RSSI_OFFSET
:
337 case IAR_CHF_PMA_GAIN
:
359 mcr20a_iar_readable(struct device
*dev
, unsigned int reg
)
363 /* all writeable are also readable */
364 rc
= mcr20a_iar_writeable(dev
, reg
);
371 case IAR_DUAL_PAN_STS
:
372 case IAR_RX_BYTE_COUNT
:
373 case IAR_FILTERFAIL_CODE1
:
374 case IAR_FILTERFAIL_CODE2
:
383 mcr20a_iar_volatile(struct device
*dev
, unsigned int reg
)
385 /* can be changed during runtime */
387 case IAR_DUAL_PAN_STS
:
388 case IAR_RX_BYTE_COUNT
:
389 case IAR_FILTERFAIL_CODE1
:
390 case IAR_FILTERFAIL_CODE2
:
398 static const struct regmap_config mcr20a_iar_regmap
= {
399 .name
= "mcr20a_iar",
402 .write_flag_mask
= REGISTER_ACCESS
| REGISTER_WRITE
| IAR_INDEX
,
403 .read_flag_mask
= REGISTER_ACCESS
| REGISTER_READ
| IAR_INDEX
,
404 .cache_type
= REGCACHE_RBTREE
,
405 .writeable_reg
= mcr20a_iar_writeable
,
406 .readable_reg
= mcr20a_iar_readable
,
407 .volatile_reg
= mcr20a_iar_volatile
,
411 struct mcr20a_local
{
412 struct spi_device
*spi
;
414 struct ieee802154_hw
*hw
;
415 struct mcr20a_platform_data
*pdata
;
416 struct regmap
*regmap_dar
;
417 struct regmap
*regmap_iar
;
423 /* for writing tx buffer */
424 struct spi_message tx_buf_msg
;
426 /* burst buffer write command */
427 struct spi_transfer tx_xfer_header
;
429 /* len of tx packet */
430 struct spi_transfer tx_xfer_len
;
431 /* data of tx packet */
432 struct spi_transfer tx_xfer_buf
;
433 struct sk_buff
*tx_skb
;
435 /* for read length rxfifo */
436 struct spi_message reg_msg
;
438 u8 reg_data
[MCR20A_IRQSTS_NUM
];
439 struct spi_transfer reg_xfer_cmd
;
440 struct spi_transfer reg_xfer_data
;
442 /* receive handling */
443 struct spi_message rx_buf_msg
;
445 struct spi_transfer rx_xfer_header
;
447 struct spi_transfer rx_xfer_lqi
;
448 u8 rx_buf
[MCR20A_MAX_BUF
];
449 struct spi_transfer rx_xfer_buf
;
451 /* isr handling for reading intstat */
452 struct spi_message irq_msg
;
454 u8 irq_data
[MCR20A_IRQSTS_NUM
];
455 struct spi_transfer irq_xfer_data
;
456 struct spi_transfer irq_xfer_header
;
460 mcr20a_write_tx_buf_complete(void *context
)
462 struct mcr20a_local
*lp
= context
;
465 dev_dbg(printdev(lp
), "%s\n", __func__
);
467 lp
->reg_msg
.complete
= NULL
;
468 lp
->reg_cmd
[0] = MCR20A_WRITE_REG(DAR_PHY_CTRL1
);
469 lp
->reg_data
[0] = MCR20A_XCVSEQ_TX
;
470 lp
->reg_xfer_data
.len
= 1;
472 ret
= spi_async(lp
->spi
, &lp
->reg_msg
);
474 dev_err(printdev(lp
), "failed to set SEQ TX\n");
478 mcr20a_xmit(struct ieee802154_hw
*hw
, struct sk_buff
*skb
)
480 struct mcr20a_local
*lp
= hw
->priv
;
482 dev_dbg(printdev(lp
), "%s\n", __func__
);
486 print_hex_dump_debug("mcr20a tx: ", DUMP_PREFIX_OFFSET
, 16, 1,
487 skb
->data
, skb
->len
, 0);
491 lp
->reg_msg
.complete
= NULL
;
492 lp
->reg_cmd
[0] = MCR20A_WRITE_REG(DAR_PHY_CTRL1
);
493 lp
->reg_data
[0] = MCR20A_XCVSEQ_IDLE
;
494 lp
->reg_xfer_data
.len
= 1;
496 return spi_async(lp
->spi
, &lp
->reg_msg
);
500 mcr20a_ed(struct ieee802154_hw
*hw
, u8
*level
)
508 mcr20a_set_channel(struct ieee802154_hw
*hw
, u8 page
, u8 channel
)
510 struct mcr20a_local
*lp
= hw
->priv
;
513 dev_dbg(printdev(lp
), "%s\n", __func__
);
515 /* freqency = ((PLL_INT+64) + (PLL_FRAC/65536)) * 32 MHz */
516 ret
= regmap_write(lp
->regmap_dar
, DAR_PLL_INT0
, PLL_INT
[channel
- 11]);
519 ret
= regmap_write(lp
->regmap_dar
, DAR_PLL_FRAC0_LSB
, 0x00);
522 ret
= regmap_write(lp
->regmap_dar
, DAR_PLL_FRAC0_MSB
,
523 PLL_FRAC
[channel
- 11]);
531 mcr20a_start(struct ieee802154_hw
*hw
)
533 struct mcr20a_local
*lp
= hw
->priv
;
536 dev_dbg(printdev(lp
), "%s\n", __func__
);
538 /* No slotted operation */
539 dev_dbg(printdev(lp
), "no slotted operation\n");
540 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL1
,
541 DAR_PHY_CTRL1_SLOTTED
, 0x0);
546 enable_irq(lp
->spi
->irq
);
548 /* Unmask SEQ interrupt */
549 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL2
,
550 DAR_PHY_CTRL2_SEQMSK
, 0x0);
554 /* Start the RX sequence */
555 dev_dbg(printdev(lp
), "start the RX sequence\n");
556 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL1
,
557 DAR_PHY_CTRL1_XCVSEQ_MASK
, MCR20A_XCVSEQ_RX
);
565 mcr20a_stop(struct ieee802154_hw
*hw
)
567 struct mcr20a_local
*lp
= hw
->priv
;
569 dev_dbg(printdev(lp
), "%s\n", __func__
);
571 /* stop all running sequence */
572 regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL1
,
573 DAR_PHY_CTRL1_XCVSEQ_MASK
, MCR20A_XCVSEQ_IDLE
);
576 disable_irq(lp
->spi
->irq
);
580 mcr20a_set_hw_addr_filt(struct ieee802154_hw
*hw
,
581 struct ieee802154_hw_addr_filt
*filt
,
582 unsigned long changed
)
584 struct mcr20a_local
*lp
= hw
->priv
;
586 dev_dbg(printdev(lp
), "%s\n", __func__
);
588 if (changed
& IEEE802154_AFILT_SADDR_CHANGED
) {
589 u16 addr
= le16_to_cpu(filt
->short_addr
);
591 regmap_write(lp
->regmap_iar
, IAR_MACSHORTADDRS0_LSB
, addr
);
592 regmap_write(lp
->regmap_iar
, IAR_MACSHORTADDRS0_MSB
, addr
>> 8);
595 if (changed
& IEEE802154_AFILT_PANID_CHANGED
) {
596 u16 pan
= le16_to_cpu(filt
->pan_id
);
598 regmap_write(lp
->regmap_iar
, IAR_MACPANID0_LSB
, pan
);
599 regmap_write(lp
->regmap_iar
, IAR_MACPANID0_MSB
, pan
>> 8);
602 if (changed
& IEEE802154_AFILT_IEEEADDR_CHANGED
) {
605 memcpy(addr
, &filt
->ieee_addr
, 8);
606 for (i
= 0; i
< 8; i
++)
607 regmap_write(lp
->regmap_iar
,
608 IAR_MACLONGADDRS0_0
+ i
, addr
[i
]);
611 if (changed
& IEEE802154_AFILT_PANC_CHANGED
) {
612 if (filt
->pan_coord
) {
613 regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL4
,
614 DAR_PHY_CTRL4_PANCORDNTR0
, 0x10);
616 regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL4
,
617 DAR_PHY_CTRL4_PANCORDNTR0
, 0x00);
624 /* -30 dBm to 10 dBm */
625 #define MCR20A_MAX_TX_POWERS 0x14
626 static const s32 mcr20a_powers
[MCR20A_MAX_TX_POWERS
+ 1] = {
627 -3000, -2800, -2600, -2400, -2200, -2000, -1800, -1600, -1400,
628 -1200, -1000, -800, -600, -400, -200, 0, 200, 400, 600, 800, 1000
632 mcr20a_set_txpower(struct ieee802154_hw
*hw
, s32 mbm
)
634 struct mcr20a_local
*lp
= hw
->priv
;
637 dev_dbg(printdev(lp
), "%s(%d)\n", __func__
, mbm
);
639 for (i
= 0; i
< lp
->hw
->phy
->supported
.tx_powers_size
; i
++) {
640 if (lp
->hw
->phy
->supported
.tx_powers
[i
] == mbm
)
641 return regmap_write(lp
->regmap_dar
, DAR_PA_PWR
,
648 #define MCR20A_MAX_ED_LEVELS MCR20A_MIN_CCA_THRESHOLD
649 static s32 mcr20a_ed_levels
[MCR20A_MAX_ED_LEVELS
+ 1];
652 mcr20a_set_cca_mode(struct ieee802154_hw
*hw
,
653 const struct wpan_phy_cca
*cca
)
655 struct mcr20a_local
*lp
= hw
->priv
;
656 unsigned int cca_mode
= 0xff;
657 bool cca_mode_and
= false;
660 dev_dbg(printdev(lp
), "%s\n", __func__
);
662 /* mapping 802.15.4 to driver spec */
664 case NL802154_CCA_ENERGY
:
665 cca_mode
= MCR20A_CCA_MODE1
;
667 case NL802154_CCA_CARRIER
:
668 cca_mode
= MCR20A_CCA_MODE2
;
670 case NL802154_CCA_ENERGY_CARRIER
:
672 case NL802154_CCA_OPT_ENERGY_CARRIER_AND
:
673 cca_mode
= MCR20A_CCA_MODE3
;
676 case NL802154_CCA_OPT_ENERGY_CARRIER_OR
:
677 cca_mode
= MCR20A_CCA_MODE3
;
678 cca_mode_and
= false;
687 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL4
,
688 DAR_PHY_CTRL4_CCATYPE_MASK
,
689 cca_mode
<< DAR_PHY_CTRL4_CCATYPE_SHIFT
);
693 if (cca_mode
== MCR20A_CCA_MODE3
) {
695 ret
= regmap_update_bits(lp
->regmap_iar
, IAR_CCA_CTRL
,
696 IAR_CCA_CTRL_CCA3_AND_NOT_OR
,
699 ret
= regmap_update_bits(lp
->regmap_iar
,
701 IAR_CCA_CTRL_CCA3_AND_NOT_OR
,
712 mcr20a_set_cca_ed_level(struct ieee802154_hw
*hw
, s32 mbm
)
714 struct mcr20a_local
*lp
= hw
->priv
;
717 dev_dbg(printdev(lp
), "%s\n", __func__
);
719 for (i
= 0; i
< hw
->phy
->supported
.cca_ed_levels_size
; i
++) {
720 if (hw
->phy
->supported
.cca_ed_levels
[i
] == mbm
)
721 return regmap_write(lp
->regmap_iar
, IAR_CCA1_THRESH
, i
);
728 mcr20a_set_promiscuous_mode(struct ieee802154_hw
*hw
, const bool on
)
730 struct mcr20a_local
*lp
= hw
->priv
;
732 u8 rx_frame_filter_reg
= 0x0;
734 dev_dbg(printdev(lp
), "%s(%d)\n", __func__
, on
);
737 /* All frame types accepted*/
738 rx_frame_filter_reg
&= ~(IAR_RX_FRAME_FLT_FRM_VER
);
739 rx_frame_filter_reg
|= (IAR_RX_FRAME_FLT_ACK_FT
|
740 IAR_RX_FRAME_FLT_NS_FT
);
742 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL4
,
743 DAR_PHY_CTRL4_PROMISCUOUS
,
744 DAR_PHY_CTRL4_PROMISCUOUS
);
748 ret
= regmap_write(lp
->regmap_iar
, IAR_RX_FRAME_FILTER
,
749 rx_frame_filter_reg
);
753 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL4
,
754 DAR_PHY_CTRL4_PROMISCUOUS
, 0x0);
758 ret
= regmap_write(lp
->regmap_iar
, IAR_RX_FRAME_FILTER
,
759 IAR_RX_FRAME_FLT_FRM_VER
|
760 IAR_RX_FRAME_FLT_BEACON_FT
|
761 IAR_RX_FRAME_FLT_DATA_FT
|
762 IAR_RX_FRAME_FLT_CMD_FT
);
770 static const struct ieee802154_ops mcr20a_hw_ops
= {
771 .owner
= THIS_MODULE
,
772 .xmit_async
= mcr20a_xmit
,
774 .set_channel
= mcr20a_set_channel
,
775 .start
= mcr20a_start
,
777 .set_hw_addr_filt
= mcr20a_set_hw_addr_filt
,
778 .set_txpower
= mcr20a_set_txpower
,
779 .set_cca_mode
= mcr20a_set_cca_mode
,
780 .set_cca_ed_level
= mcr20a_set_cca_ed_level
,
781 .set_promiscuous_mode
= mcr20a_set_promiscuous_mode
,
785 mcr20a_request_rx(struct mcr20a_local
*lp
)
787 dev_dbg(printdev(lp
), "%s\n", __func__
);
789 /* Start the RX sequence */
790 regmap_update_bits_async(lp
->regmap_dar
, DAR_PHY_CTRL1
,
791 DAR_PHY_CTRL1_XCVSEQ_MASK
, MCR20A_XCVSEQ_RX
);
797 mcr20a_handle_rx_read_buf_complete(void *context
)
799 struct mcr20a_local
*lp
= context
;
800 u8 len
= lp
->reg_data
[0] & DAR_RX_FRAME_LENGTH_MASK
;
803 dev_dbg(printdev(lp
), "%s\n", __func__
);
805 dev_dbg(printdev(lp
), "RX is done\n");
807 if (!ieee802154_is_valid_psdu_len(len
)) {
808 dev_vdbg(&lp
->spi
->dev
, "corrupted frame received\n");
809 len
= IEEE802154_MTU
;
812 len
= len
- 2; /* get rid of frame check field */
814 skb
= dev_alloc_skb(len
);
818 memcpy(skb_put(skb
, len
), lp
->rx_buf
, len
);
819 ieee802154_rx_irqsafe(lp
->hw
, skb
, lp
->rx_lqi
[0]);
821 print_hex_dump_debug("mcr20a rx: ", DUMP_PREFIX_OFFSET
, 16, 1,
823 pr_debug("mcr20a rx: lqi: %02hhx\n", lp
->rx_lqi
[0]);
825 /* start RX sequence */
826 mcr20a_request_rx(lp
);
830 mcr20a_handle_rx_read_len_complete(void *context
)
832 struct mcr20a_local
*lp
= context
;
836 dev_dbg(printdev(lp
), "%s\n", __func__
);
838 /* get the length of received frame */
839 len
= lp
->reg_data
[0] & DAR_RX_FRAME_LENGTH_MASK
;
840 dev_dbg(printdev(lp
), "frame len : %d\n", len
);
842 /* prepare to read the rx buf */
843 lp
->rx_buf_msg
.complete
= mcr20a_handle_rx_read_buf_complete
;
844 lp
->rx_header
[0] = MCR20A_BURST_READ_PACKET_BUF
;
845 lp
->rx_xfer_buf
.len
= len
;
847 ret
= spi_async(lp
->spi
, &lp
->rx_buf_msg
);
849 dev_err(printdev(lp
), "failed to read rx buffer length\n");
853 mcr20a_handle_rx(struct mcr20a_local
*lp
)
855 dev_dbg(printdev(lp
), "%s\n", __func__
);
856 lp
->reg_msg
.complete
= mcr20a_handle_rx_read_len_complete
;
857 lp
->reg_cmd
[0] = MCR20A_READ_REG(DAR_RX_FRM_LEN
);
858 lp
->reg_xfer_data
.len
= 1;
860 return spi_async(lp
->spi
, &lp
->reg_msg
);
864 mcr20a_handle_tx_complete(struct mcr20a_local
*lp
)
866 dev_dbg(printdev(lp
), "%s\n", __func__
);
868 ieee802154_xmit_complete(lp
->hw
, lp
->tx_skb
, false);
870 return mcr20a_request_rx(lp
);
874 mcr20a_handle_tx(struct mcr20a_local
*lp
)
878 dev_dbg(printdev(lp
), "%s\n", __func__
);
880 /* write tx buffer */
881 lp
->tx_header
[0] = MCR20A_BURST_WRITE_PACKET_BUF
;
882 /* add 2 bytes of FCS */
883 lp
->tx_len
[0] = lp
->tx_skb
->len
+ 2;
884 lp
->tx_xfer_buf
.tx_buf
= lp
->tx_skb
->data
;
885 /* add 1 byte psduLength */
886 lp
->tx_xfer_buf
.len
= lp
->tx_skb
->len
+ 1;
888 ret
= spi_async(lp
->spi
, &lp
->tx_buf_msg
);
890 dev_err(printdev(lp
), "SPI write Failed for TX buf\n");
898 mcr20a_irq_clean_complete(void *context
)
900 struct mcr20a_local
*lp
= context
;
901 u8 seq_state
= lp
->irq_data
[DAR_IRQ_STS1
] & DAR_PHY_CTRL1_XCVSEQ_MASK
;
903 dev_dbg(printdev(lp
), "%s\n", __func__
);
905 enable_irq(lp
->spi
->irq
);
907 dev_dbg(printdev(lp
), "IRQ STA1 (%02x) STA2 (%02x)\n",
908 lp
->irq_data
[DAR_IRQ_STS1
], lp
->irq_data
[DAR_IRQ_STS2
]);
911 /* TX IRQ, RX IRQ and SEQ IRQ */
912 case (DAR_IRQSTS1_TXIRQ
| DAR_IRQSTS1_SEQIRQ
):
915 dev_dbg(printdev(lp
), "TX is done. No ACK\n");
916 mcr20a_handle_tx_complete(lp
);
919 case (DAR_IRQSTS1_RXIRQ
| DAR_IRQSTS1_SEQIRQ
):
921 dev_dbg(printdev(lp
), "RX is starting\n");
922 mcr20a_handle_rx(lp
);
924 case (DAR_IRQSTS1_RXIRQ
| DAR_IRQSTS1_TXIRQ
| DAR_IRQSTS1_SEQIRQ
):
928 dev_dbg(printdev(lp
), "TX is done. Get ACK\n");
929 mcr20a_handle_tx_complete(lp
);
932 dev_dbg(printdev(lp
), "RX is starting\n");
933 mcr20a_handle_rx(lp
);
936 case (DAR_IRQSTS1_SEQIRQ
):
938 dev_dbg(printdev(lp
), "TX is starting\n");
939 mcr20a_handle_tx(lp
);
941 dev_dbg(printdev(lp
), "MCR20A is stop\n");
947 static void mcr20a_irq_status_complete(void *context
)
950 struct mcr20a_local
*lp
= context
;
952 dev_dbg(printdev(lp
), "%s\n", __func__
);
953 regmap_update_bits_async(lp
->regmap_dar
, DAR_PHY_CTRL1
,
954 DAR_PHY_CTRL1_XCVSEQ_MASK
, MCR20A_XCVSEQ_IDLE
);
956 lp
->reg_msg
.complete
= mcr20a_irq_clean_complete
;
957 lp
->reg_cmd
[0] = MCR20A_WRITE_REG(DAR_IRQ_STS1
);
958 memcpy(lp
->reg_data
, lp
->irq_data
, MCR20A_IRQSTS_NUM
);
959 lp
->reg_xfer_data
.len
= MCR20A_IRQSTS_NUM
;
961 ret
= spi_async(lp
->spi
, &lp
->reg_msg
);
964 dev_err(printdev(lp
), "failed to clean irq status\n");
967 static irqreturn_t
mcr20a_irq_isr(int irq
, void *data
)
969 struct mcr20a_local
*lp
= data
;
972 disable_irq_nosync(irq
);
974 lp
->irq_header
[0] = MCR20A_READ_REG(DAR_IRQ_STS1
);
976 ret
= spi_async(lp
->spi
, &lp
->irq_msg
);
985 static int mcr20a_get_platform_data(struct spi_device
*spi
,
986 struct mcr20a_platform_data
*pdata
)
990 if (!spi
->dev
.of_node
)
993 pdata
->rst_gpio
= of_get_named_gpio(spi
->dev
.of_node
, "rst_b-gpio", 0);
994 dev_dbg(&spi
->dev
, "rst_b-gpio: %d\n", pdata
->rst_gpio
);
999 static void mcr20a_hw_setup(struct mcr20a_local
*lp
)
1002 struct ieee802154_hw
*hw
= lp
->hw
;
1003 struct wpan_phy
*phy
= lp
->hw
->phy
;
1005 dev_dbg(printdev(lp
), "%s\n", __func__
);
1007 phy
->symbol_duration
= 16;
1008 phy
->lifs_period
= 40;
1009 phy
->sifs_period
= 12;
1011 hw
->flags
= IEEE802154_HW_TX_OMIT_CKSUM
|
1012 IEEE802154_HW_AFILT
|
1013 IEEE802154_HW_PROMISCUOUS
;
1015 phy
->flags
= WPAN_PHY_FLAG_TXPOWER
| WPAN_PHY_FLAG_CCA_ED_LEVEL
|
1016 WPAN_PHY_FLAG_CCA_MODE
;
1018 phy
->supported
.cca_modes
= BIT(NL802154_CCA_ENERGY
) |
1019 BIT(NL802154_CCA_CARRIER
) | BIT(NL802154_CCA_ENERGY_CARRIER
);
1020 phy
->supported
.cca_opts
= BIT(NL802154_CCA_OPT_ENERGY_CARRIER_AND
) |
1021 BIT(NL802154_CCA_OPT_ENERGY_CARRIER_OR
);
1023 /* initiating cca_ed_levels */
1024 for (i
= MCR20A_MAX_CCA_THRESHOLD
; i
< MCR20A_MIN_CCA_THRESHOLD
+ 1;
1026 mcr20a_ed_levels
[i
] = -i
* 100;
1029 phy
->supported
.cca_ed_levels
= mcr20a_ed_levels
;
1030 phy
->supported
.cca_ed_levels_size
= ARRAY_SIZE(mcr20a_ed_levels
);
1032 phy
->cca
.mode
= NL802154_CCA_ENERGY
;
1034 phy
->supported
.channels
[0] = MCR20A_VALID_CHANNELS
;
1035 phy
->current_page
= 0;
1036 /* MCR20A default reset value */
1037 phy
->current_channel
= 20;
1038 phy
->symbol_duration
= 16;
1039 phy
->supported
.tx_powers
= mcr20a_powers
;
1040 phy
->supported
.tx_powers_size
= ARRAY_SIZE(mcr20a_powers
);
1041 phy
->cca_ed_level
= phy
->supported
.cca_ed_levels
[75];
1042 phy
->transmit_power
= phy
->supported
.tx_powers
[0x0F];
1046 mcr20a_setup_tx_spi_messages(struct mcr20a_local
*lp
)
1048 spi_message_init(&lp
->tx_buf_msg
);
1049 lp
->tx_buf_msg
.context
= lp
;
1050 lp
->tx_buf_msg
.complete
= mcr20a_write_tx_buf_complete
;
1052 lp
->tx_xfer_header
.len
= 1;
1053 lp
->tx_xfer_header
.tx_buf
= lp
->tx_header
;
1055 lp
->tx_xfer_len
.len
= 1;
1056 lp
->tx_xfer_len
.tx_buf
= lp
->tx_len
;
1058 spi_message_add_tail(&lp
->tx_xfer_header
, &lp
->tx_buf_msg
);
1059 spi_message_add_tail(&lp
->tx_xfer_len
, &lp
->tx_buf_msg
);
1060 spi_message_add_tail(&lp
->tx_xfer_buf
, &lp
->tx_buf_msg
);
1064 mcr20a_setup_rx_spi_messages(struct mcr20a_local
*lp
)
1066 spi_message_init(&lp
->reg_msg
);
1067 lp
->reg_msg
.context
= lp
;
1069 lp
->reg_xfer_cmd
.len
= 1;
1070 lp
->reg_xfer_cmd
.tx_buf
= lp
->reg_cmd
;
1071 lp
->reg_xfer_cmd
.rx_buf
= lp
->reg_cmd
;
1073 lp
->reg_xfer_data
.rx_buf
= lp
->reg_data
;
1074 lp
->reg_xfer_data
.tx_buf
= lp
->reg_data
;
1076 spi_message_add_tail(&lp
->reg_xfer_cmd
, &lp
->reg_msg
);
1077 spi_message_add_tail(&lp
->reg_xfer_data
, &lp
->reg_msg
);
1079 spi_message_init(&lp
->rx_buf_msg
);
1080 lp
->rx_buf_msg
.context
= lp
;
1081 lp
->rx_buf_msg
.complete
= mcr20a_handle_rx_read_buf_complete
;
1082 lp
->rx_xfer_header
.len
= 1;
1083 lp
->rx_xfer_header
.tx_buf
= lp
->rx_header
;
1084 lp
->rx_xfer_header
.rx_buf
= lp
->rx_header
;
1086 lp
->rx_xfer_buf
.rx_buf
= lp
->rx_buf
;
1088 lp
->rx_xfer_lqi
.len
= 1;
1089 lp
->rx_xfer_lqi
.rx_buf
= lp
->rx_lqi
;
1091 spi_message_add_tail(&lp
->rx_xfer_header
, &lp
->rx_buf_msg
);
1092 spi_message_add_tail(&lp
->rx_xfer_buf
, &lp
->rx_buf_msg
);
1093 spi_message_add_tail(&lp
->rx_xfer_lqi
, &lp
->rx_buf_msg
);
1097 mcr20a_setup_irq_spi_messages(struct mcr20a_local
*lp
)
1099 spi_message_init(&lp
->irq_msg
);
1100 lp
->irq_msg
.context
= lp
;
1101 lp
->irq_msg
.complete
= mcr20a_irq_status_complete
;
1102 lp
->irq_xfer_header
.len
= 1;
1103 lp
->irq_xfer_header
.tx_buf
= lp
->irq_header
;
1104 lp
->irq_xfer_header
.rx_buf
= lp
->irq_header
;
1106 lp
->irq_xfer_data
.len
= MCR20A_IRQSTS_NUM
;
1107 lp
->irq_xfer_data
.rx_buf
= lp
->irq_data
;
1109 spi_message_add_tail(&lp
->irq_xfer_header
, &lp
->irq_msg
);
1110 spi_message_add_tail(&lp
->irq_xfer_data
, &lp
->irq_msg
);
1114 mcr20a_phy_init(struct mcr20a_local
*lp
)
1117 unsigned int phy_reg
= 0;
1120 dev_dbg(printdev(lp
), "%s\n", __func__
);
1122 /* Disable Tristate on COCO MISO for SPI reads */
1123 ret
= regmap_write(lp
->regmap_iar
, IAR_MISC_PAD_CTRL
, 0x02);
1127 /* Clear all PP IRQ bits in IRQSTS1 to avoid unexpected interrupts
1128 * immediately after init
1130 ret
= regmap_write(lp
->regmap_dar
, DAR_IRQ_STS1
, 0xEF);
1134 /* Clear all PP IRQ bits in IRQSTS2 */
1135 ret
= regmap_write(lp
->regmap_dar
, DAR_IRQ_STS2
,
1136 DAR_IRQSTS2_ASM_IRQ
| DAR_IRQSTS2_PB_ERR_IRQ
|
1137 DAR_IRQSTS2_WAKE_IRQ
);
1141 /* Disable all timer interrupts */
1142 ret
= regmap_write(lp
->regmap_dar
, DAR_IRQ_STS3
, 0xFF);
1146 /* PHY_CTRL1 : default HW settings + AUTOACK enabled */
1147 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PHY_CTRL1
,
1148 DAR_PHY_CTRL1_AUTOACK
, DAR_PHY_CTRL1_AUTOACK
);
1150 /* PHY_CTRL2 : disable all interrupts */
1151 ret
= regmap_write(lp
->regmap_dar
, DAR_PHY_CTRL2
, 0xFF);
1155 /* PHY_CTRL3 : disable all timers and remaining interrupts */
1156 ret
= regmap_write(lp
->regmap_dar
, DAR_PHY_CTRL3
,
1157 DAR_PHY_CTRL3_ASM_MSK
| DAR_PHY_CTRL3_PB_ERR_MSK
|
1158 DAR_PHY_CTRL3_WAKE_MSK
);
1162 /* SRC_CTRL : enable Acknowledge Frame Pending and
1163 * Source Address Matching Enable
1165 ret
= regmap_write(lp
->regmap_dar
, DAR_SRC_CTRL
,
1166 DAR_SRC_CTRL_ACK_FRM_PND
|
1167 (DAR_SRC_CTRL_INDEX
<< DAR_SRC_CTRL_INDEX_SHIFT
));
1171 /* RX_FRAME_FILTER */
1172 /* FRM_VER[1:0] = b11. Accept FrameVersion 0 and 1 packets */
1173 ret
= regmap_write(lp
->regmap_iar
, IAR_RX_FRAME_FILTER
,
1174 IAR_RX_FRAME_FLT_FRM_VER
|
1175 IAR_RX_FRAME_FLT_BEACON_FT
|
1176 IAR_RX_FRAME_FLT_DATA_FT
|
1177 IAR_RX_FRAME_FLT_CMD_FT
);
1181 dev_info(printdev(lp
), "MCR20A DAR overwrites version: 0x%02x\n",
1182 MCR20A_OVERWRITE_VERSION
);
1184 /* Overwrites direct registers */
1185 ret
= regmap_write(lp
->regmap_dar
, DAR_OVERWRITE_VER
,
1186 MCR20A_OVERWRITE_VERSION
);
1190 /* Overwrites indirect registers */
1191 ret
= regmap_multi_reg_write(lp
->regmap_iar
, mar20a_iar_overwrites
,
1192 ARRAY_SIZE(mar20a_iar_overwrites
));
1196 /* Clear HW indirect queue */
1197 dev_dbg(printdev(lp
), "clear HW indirect queue\n");
1198 for (index
= 0; index
< MCR20A_PHY_INDIRECT_QUEUE_SIZE
; index
++) {
1199 phy_reg
= (u8
)(((index
& DAR_SRC_CTRL_INDEX
) <<
1200 DAR_SRC_CTRL_INDEX_SHIFT
)
1201 | (DAR_SRC_CTRL_SRCADDR_EN
)
1202 | (DAR_SRC_CTRL_INDEX_DISABLE
));
1203 ret
= regmap_write(lp
->regmap_dar
, DAR_SRC_CTRL
, phy_reg
);
1209 /* Assign HW Indirect hash table to PAN0 */
1210 ret
= regmap_read(lp
->regmap_iar
, IAR_DUAL_PAN_CTRL
, &phy_reg
);
1214 /* Clear current lvl */
1215 phy_reg
&= ~IAR_DUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_MSK
;
1218 phy_reg
|= MCR20A_PHY_INDIRECT_QUEUE_SIZE
<<
1219 IAR_DUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_SHIFT
;
1220 ret
= regmap_write(lp
->regmap_iar
, IAR_DUAL_PAN_CTRL
, phy_reg
);
1224 /* Set CCA threshold to -75 dBm */
1225 ret
= regmap_write(lp
->regmap_iar
, IAR_CCA1_THRESH
, 0x4B);
1229 /* Set prescaller to obtain 1 symbol (16us) timebase */
1230 ret
= regmap_write(lp
->regmap_iar
, IAR_TMR_PRESCALE
, 0x05);
1234 /* Enable autodoze mode. */
1235 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_PWR_MODES
,
1236 DAR_PWR_MODES_AUTODOZE
,
1237 DAR_PWR_MODES_AUTODOZE
);
1241 /* Disable clk_out */
1242 ret
= regmap_update_bits(lp
->regmap_dar
, DAR_CLK_OUT_CTRL
,
1243 DAR_CLK_OUT_CTRL_EN
, 0x0);
1254 mcr20a_probe(struct spi_device
*spi
)
1256 struct ieee802154_hw
*hw
;
1257 struct mcr20a_local
*lp
;
1258 struct mcr20a_platform_data
*pdata
;
1262 dev_dbg(&spi
->dev
, "%s\n", __func__
);
1265 dev_err(&spi
->dev
, "no IRQ specified\n");
1269 pdata
= kmalloc(sizeof(*pdata
), GFP_KERNEL
);
1273 /* set mcr20a platform data */
1274 ret
= mcr20a_get_platform_data(spi
, pdata
);
1276 dev_crit(&spi
->dev
, "mcr20a_get_platform_data failed.\n");
1280 /* init reset gpio */
1281 if (gpio_is_valid(pdata
->rst_gpio
)) {
1282 ret
= devm_gpio_request_one(&spi
->dev
, pdata
->rst_gpio
,
1283 GPIOF_OUT_INIT_HIGH
, "reset");
1289 if (gpio_is_valid(pdata
->rst_gpio
)) {
1290 usleep_range(10, 20);
1291 gpio_set_value_cansleep(pdata
->rst_gpio
, 0);
1292 usleep_range(10, 20);
1293 gpio_set_value_cansleep(pdata
->rst_gpio
, 1);
1294 usleep_range(120, 240);
1297 /* allocate ieee802154_hw and private data */
1298 hw
= ieee802154_alloc_hw(sizeof(*lp
), &mcr20a_hw_ops
);
1300 dev_crit(&spi
->dev
, "ieee802154_alloc_hw failed\n");
1305 /* init mcr20a local data */
1309 lp
->spi
->dev
.platform_data
= pdata
;
1312 /* init ieee802154_hw */
1313 hw
->parent
= &spi
->dev
;
1314 ieee802154_random_extended_addr(&hw
->phy
->perm_extended_addr
);
1317 lp
->buf
= devm_kzalloc(&spi
->dev
, SPI_COMMAND_BUFFER
, GFP_KERNEL
);
1324 mcr20a_setup_tx_spi_messages(lp
);
1325 mcr20a_setup_rx_spi_messages(lp
);
1326 mcr20a_setup_irq_spi_messages(lp
);
1329 lp
->regmap_dar
= devm_regmap_init_spi(spi
, &mcr20a_dar_regmap
);
1330 if (IS_ERR(lp
->regmap_dar
)) {
1331 ret
= PTR_ERR(lp
->regmap_dar
);
1332 dev_err(&spi
->dev
, "Failed to allocate dar map: %d\n",
1337 lp
->regmap_iar
= devm_regmap_init_spi(spi
, &mcr20a_iar_regmap
);
1338 if (IS_ERR(lp
->regmap_iar
)) {
1339 ret
= PTR_ERR(lp
->regmap_iar
);
1340 dev_err(&spi
->dev
, "Failed to allocate iar map: %d\n", ret
);
1344 mcr20a_hw_setup(lp
);
1346 spi_set_drvdata(spi
, lp
);
1348 ret
= mcr20a_phy_init(lp
);
1350 dev_crit(&spi
->dev
, "mcr20a_phy_init failed\n");
1354 irq_type
= irq_get_trigger_type(spi
->irq
);
1356 irq_type
= IRQF_TRIGGER_FALLING
;
1358 ret
= devm_request_irq(&spi
->dev
, spi
->irq
, mcr20a_irq_isr
,
1359 irq_type
, dev_name(&spi
->dev
), lp
);
1361 dev_err(&spi
->dev
, "could not request_irq for mcr20a\n");
1366 /* disable_irq by default and wait for starting hardware */
1367 disable_irq(spi
->irq
);
1369 ret
= ieee802154_register_hw(hw
);
1371 dev_crit(&spi
->dev
, "ieee802154_register_hw failed\n");
1378 ieee802154_free_hw(lp
->hw
);
1385 static int mcr20a_remove(struct spi_device
*spi
)
1387 struct mcr20a_local
*lp
= spi_get_drvdata(spi
);
1389 dev_dbg(&spi
->dev
, "%s\n", __func__
);
1391 ieee802154_unregister_hw(lp
->hw
);
1392 ieee802154_free_hw(lp
->hw
);
1397 static const struct of_device_id mcr20a_of_match
[] = {
1398 { .compatible
= "nxp,mcr20a", },
1401 MODULE_DEVICE_TABLE(of
, mcr20a_of_match
);
1403 static const struct spi_device_id mcr20a_device_id
[] = {
1404 { .name
= "mcr20a", },
1407 MODULE_DEVICE_TABLE(spi
, mcr20a_device_id
);
1409 static struct spi_driver mcr20a_driver
= {
1410 .id_table
= mcr20a_device_id
,
1412 .of_match_table
= of_match_ptr(mcr20a_of_match
),
1415 .probe
= mcr20a_probe
,
1416 .remove
= mcr20a_remove
,
1419 module_spi_driver(mcr20a_driver
);
1421 MODULE_DESCRIPTION("MCR20A Transceiver Driver");
1422 MODULE_LICENSE("GPL v2");
1423 MODULE_AUTHOR("Xue Liu <liuxuenetmail@gmail>");