2 * Atheros AR71xx SoC platform devices
4 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
8 * Parts of this file are based on Atheros 2.6.15 BSP
9 * Parts of this file are based on Atheros 2.6.31 BSP
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 2 as published
13 * by the Free Software Foundation.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/delay.h>
19 #include <linux/etherdevice.h>
20 #include <linux/platform_device.h>
21 #include <linux/serial_8250.h>
23 #include <asm/mach-ar71xx/ar71xx.h>
24 #include <asm/mach-ar71xx/ar933x_uart_platform.h>
28 unsigned char ar71xx_mac_base
[ETH_ALEN
] __initdata
;
30 static struct resource ar71xx_uart_resources
[] = {
32 .start
= AR71XX_UART_BASE
,
33 .end
= AR71XX_UART_BASE
+ AR71XX_UART_SIZE
- 1,
34 .flags
= IORESOURCE_MEM
,
38 #define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
39 static struct plat_serial8250_port ar71xx_uart_data
[] = {
41 .mapbase
= AR71XX_UART_BASE
,
42 .irq
= AR71XX_MISC_IRQ_UART
,
43 .flags
= AR71XX_UART_FLAGS
,
47 /* terminating entry */
51 static struct platform_device ar71xx_uart_device
= {
53 .id
= PLAT8250_DEV_PLATFORM
,
54 .resource
= ar71xx_uart_resources
,
55 .num_resources
= ARRAY_SIZE(ar71xx_uart_resources
),
57 .platform_data
= ar71xx_uart_data
61 static struct resource ar933x_uart_resources
[] = {
63 .start
= AR933X_UART_BASE
,
64 .end
= AR933X_UART_BASE
+ AR71XX_UART_SIZE
- 1,
65 .flags
= IORESOURCE_MEM
,
68 .start
= AR71XX_MISC_IRQ_UART
,
69 .end
= AR71XX_MISC_IRQ_UART
,
70 .flags
= IORESOURCE_IRQ
,
74 static struct ar933x_uart_platform_data ar933x_uart_data
;
75 static struct platform_device ar933x_uart_device
= {
76 .name
= "ar933x-uart",
78 .resource
= ar933x_uart_resources
,
79 .num_resources
= ARRAY_SIZE(ar933x_uart_resources
),
81 .platform_data
= &ar933x_uart_data
,
85 void __init
ar71xx_add_device_uart(void)
87 struct platform_device
*pdev
;
90 case AR71XX_SOC_AR7130
:
91 case AR71XX_SOC_AR7141
:
92 case AR71XX_SOC_AR7161
:
93 case AR71XX_SOC_AR7240
:
94 case AR71XX_SOC_AR7241
:
95 case AR71XX_SOC_AR7242
:
96 case AR71XX_SOC_AR9130
:
97 case AR71XX_SOC_AR9132
:
98 pdev
= &ar71xx_uart_device
;
99 ar71xx_uart_data
[0].uartclk
= ar71xx_ahb_freq
;
102 case AR71XX_SOC_AR9330
:
103 case AR71XX_SOC_AR9331
:
104 pdev
= &ar933x_uart_device
;
105 ar933x_uart_data
.uartclk
= ar71xx_ref_freq
;
108 case AR71XX_SOC_AR9341
:
109 case AR71XX_SOC_AR9342
:
110 case AR71XX_SOC_AR9344
:
111 pdev
= &ar71xx_uart_device
;
112 ar71xx_uart_data
[0].uartclk
= ar71xx_ref_freq
;
119 platform_device_register(pdev
);
122 static struct resource ar71xx_mdio_resources
[] = {
125 .flags
= IORESOURCE_MEM
,
126 .start
= AR71XX_GE0_BASE
,
127 .end
= AR71XX_GE0_BASE
+ 0x200 - 1,
131 static struct ag71xx_mdio_platform_data ar71xx_mdio_data
;
133 struct platform_device ar71xx_mdio_device
= {
134 .name
= "ag71xx-mdio",
136 .resource
= ar71xx_mdio_resources
,
137 .num_resources
= ARRAY_SIZE(ar71xx_mdio_resources
),
139 .platform_data
= &ar71xx_mdio_data
,
143 static void ar71xx_set_pll(u32 cfg_reg
, u32 pll_reg
, u32 pll_val
, u32 shift
)
148 base
= ioremap_nocache(AR71XX_PLL_BASE
, AR71XX_PLL_SIZE
);
150 t
= __raw_readl(base
+ cfg_reg
);
153 __raw_writel(t
, base
+ cfg_reg
);
156 __raw_writel(pll_val
, base
+ pll_reg
);
159 __raw_writel(t
, base
+ cfg_reg
);
163 __raw_writel(t
, base
+ cfg_reg
);
166 printk(KERN_DEBUG
"ar71xx: pll_reg %#x: %#x\n",
167 (unsigned int)(base
+ pll_reg
), __raw_readl(base
+ pll_reg
));
172 void __init
ar71xx_add_device_mdio(u32 phy_mask
)
174 switch (ar71xx_soc
) {
175 case AR71XX_SOC_AR7240
:
176 ar71xx_mdio_data
.is_ar7240
= 1;
178 case AR71XX_SOC_AR7241
:
179 ar71xx_mdio_data
.is_ar7240
= 1;
180 ar71xx_mdio_resources
[0].start
= AR71XX_GE1_BASE
;
181 ar71xx_mdio_resources
[0].end
= AR71XX_GE1_BASE
+ 0x200 - 1;
183 case AR71XX_SOC_AR7242
:
184 ar71xx_set_pll(AR71XX_PLL_REG_SEC_CONFIG
,
185 AR7242_PLL_REG_ETH0_INT_CLOCK
, 0x62000000,
186 AR71XX_ETH0_PLL_SHIFT
);
188 case AR71XX_SOC_AR9330
:
189 case AR71XX_SOC_AR9331
:
190 ar71xx_mdio_data
.is_ar7240
= 1;
191 ar71xx_mdio_resources
[0].start
= AR71XX_GE1_BASE
;
192 ar71xx_mdio_resources
[0].end
= AR71XX_GE1_BASE
+ 0x200 - 1;
198 ar71xx_mdio_data
.phy_mask
= phy_mask
;
200 platform_device_register(&ar71xx_mdio_device
);
203 struct ar71xx_eth_pll_data ar71xx_eth0_pll_data
;
204 struct ar71xx_eth_pll_data ar71xx_eth1_pll_data
;
206 static u32
ar71xx_get_eth_pll(unsigned int mac
, int speed
)
208 struct ar71xx_eth_pll_data
*pll_data
;
213 pll_data
= &ar71xx_eth0_pll_data
;
216 pll_data
= &ar71xx_eth1_pll_data
;
224 pll_val
= pll_data
->pll_10
;
227 pll_val
= pll_data
->pll_100
;
230 pll_val
= pll_data
->pll_1000
;
239 static void ar71xx_set_pll_ge0(int speed
)
241 u32 val
= ar71xx_get_eth_pll(0, speed
);
243 ar71xx_set_pll(AR71XX_PLL_REG_SEC_CONFIG
, AR71XX_PLL_REG_ETH0_INT_CLOCK
,
244 val
, AR71XX_ETH0_PLL_SHIFT
);
247 static void ar71xx_set_pll_ge1(int speed
)
249 u32 val
= ar71xx_get_eth_pll(1, speed
);
251 ar71xx_set_pll(AR71XX_PLL_REG_SEC_CONFIG
, AR71XX_PLL_REG_ETH1_INT_CLOCK
,
252 val
, AR71XX_ETH1_PLL_SHIFT
);
255 static void ar724x_set_pll_ge0(int speed
)
260 static void ar724x_set_pll_ge1(int speed
)
265 static void ar7242_set_pll_ge0(int speed
)
267 u32 val
= ar71xx_get_eth_pll(0, speed
);
269 ar71xx_set_pll(AR71XX_PLL_REG_SEC_CONFIG
, AR7242_PLL_REG_ETH0_INT_CLOCK
,
270 val
, AR71XX_ETH0_PLL_SHIFT
);
273 static void ar91xx_set_pll_ge0(int speed
)
275 u32 val
= ar71xx_get_eth_pll(0, speed
);
277 ar71xx_set_pll(AR91XX_PLL_REG_ETH_CONFIG
, AR91XX_PLL_REG_ETH0_INT_CLOCK
,
278 val
, AR91XX_ETH0_PLL_SHIFT
);
281 static void ar91xx_set_pll_ge1(int speed
)
283 u32 val
= ar71xx_get_eth_pll(1, speed
);
285 ar71xx_set_pll(AR91XX_PLL_REG_ETH_CONFIG
, AR91XX_PLL_REG_ETH1_INT_CLOCK
,
286 val
, AR91XX_ETH1_PLL_SHIFT
);
289 static void ar933x_set_pll_ge0(int speed
)
294 static void ar933x_set_pll_ge1(int speed
)
299 static void ar71xx_ddr_flush_ge0(void)
301 ar71xx_ddr_flush(AR71XX_DDR_REG_FLUSH_GE0
);
304 static void ar71xx_ddr_flush_ge1(void)
306 ar71xx_ddr_flush(AR71XX_DDR_REG_FLUSH_GE1
);
309 static void ar724x_ddr_flush_ge0(void)
311 ar71xx_ddr_flush(AR724X_DDR_REG_FLUSH_GE0
);
314 static void ar724x_ddr_flush_ge1(void)
316 ar71xx_ddr_flush(AR724X_DDR_REG_FLUSH_GE1
);
319 static void ar91xx_ddr_flush_ge0(void)
321 ar71xx_ddr_flush(AR91XX_DDR_REG_FLUSH_GE0
);
324 static void ar91xx_ddr_flush_ge1(void)
326 ar71xx_ddr_flush(AR91XX_DDR_REG_FLUSH_GE1
);
329 static void ar933x_ddr_flush_ge0(void)
331 ar71xx_ddr_flush(AR933X_DDR_REG_FLUSH_GE0
);
334 static void ar933x_ddr_flush_ge1(void)
336 ar71xx_ddr_flush(AR933X_DDR_REG_FLUSH_GE1
);
339 static struct resource ar71xx_eth0_resources
[] = {
342 .flags
= IORESOURCE_MEM
,
343 .start
= AR71XX_GE0_BASE
,
344 .end
= AR71XX_GE0_BASE
+ 0x200 - 1,
347 .flags
= IORESOURCE_MEM
,
348 .start
= AR71XX_MII_BASE
+ MII_REG_MII0_CTRL
,
349 .end
= AR71XX_MII_BASE
+ MII_REG_MII0_CTRL
+ 3,
352 .flags
= IORESOURCE_IRQ
,
353 .start
= AR71XX_CPU_IRQ_GE0
,
354 .end
= AR71XX_CPU_IRQ_GE0
,
358 struct ag71xx_platform_data ar71xx_eth0_data
= {
359 .reset_bit
= RESET_MODULE_GE0_MAC
,
362 struct platform_device ar71xx_eth0_device
= {
365 .resource
= ar71xx_eth0_resources
,
366 .num_resources
= ARRAY_SIZE(ar71xx_eth0_resources
),
368 .platform_data
= &ar71xx_eth0_data
,
372 static struct resource ar71xx_eth1_resources
[] = {
375 .flags
= IORESOURCE_MEM
,
376 .start
= AR71XX_GE1_BASE
,
377 .end
= AR71XX_GE1_BASE
+ 0x200 - 1,
380 .flags
= IORESOURCE_MEM
,
381 .start
= AR71XX_MII_BASE
+ MII_REG_MII1_CTRL
,
382 .end
= AR71XX_MII_BASE
+ MII_REG_MII1_CTRL
+ 3,
385 .flags
= IORESOURCE_IRQ
,
386 .start
= AR71XX_CPU_IRQ_GE1
,
387 .end
= AR71XX_CPU_IRQ_GE1
,
391 struct ag71xx_platform_data ar71xx_eth1_data
= {
392 .reset_bit
= RESET_MODULE_GE1_MAC
,
395 struct platform_device ar71xx_eth1_device
= {
398 .resource
= ar71xx_eth1_resources
,
399 .num_resources
= ARRAY_SIZE(ar71xx_eth1_resources
),
401 .platform_data
= &ar71xx_eth1_data
,
405 #define AR71XX_PLL_VAL_1000 0x00110000
406 #define AR71XX_PLL_VAL_100 0x00001099
407 #define AR71XX_PLL_VAL_10 0x00991099
409 #define AR724X_PLL_VAL_1000 0x00110000
410 #define AR724X_PLL_VAL_100 0x00001099
411 #define AR724X_PLL_VAL_10 0x00991099
413 #define AR7242_PLL_VAL_1000 0x1c000000
414 #define AR7242_PLL_VAL_100 0x00000101
415 #define AR7242_PLL_VAL_10 0x00001616
417 #define AR91XX_PLL_VAL_1000 0x1a000000
418 #define AR91XX_PLL_VAL_100 0x13000a44
419 #define AR91XX_PLL_VAL_10 0x00441099
421 #define AR933X_PLL_VAL_1000 0x00110000
422 #define AR933X_PLL_VAL_100 0x00001099
423 #define AR933X_PLL_VAL_10 0x00991099
425 static void __init
ar71xx_init_eth_pll_data(unsigned int id
)
427 struct ar71xx_eth_pll_data
*pll_data
;
428 u32 pll_10
, pll_100
, pll_1000
;
432 pll_data
= &ar71xx_eth0_pll_data
;
435 pll_data
= &ar71xx_eth1_pll_data
;
441 switch (ar71xx_soc
) {
442 case AR71XX_SOC_AR7130
:
443 case AR71XX_SOC_AR7141
:
444 case AR71XX_SOC_AR7161
:
445 pll_10
= AR71XX_PLL_VAL_10
;
446 pll_100
= AR71XX_PLL_VAL_100
;
447 pll_1000
= AR71XX_PLL_VAL_1000
;
450 case AR71XX_SOC_AR7240
:
451 case AR71XX_SOC_AR7241
:
452 pll_10
= AR724X_PLL_VAL_10
;
453 pll_100
= AR724X_PLL_VAL_100
;
454 pll_1000
= AR724X_PLL_VAL_1000
;
457 case AR71XX_SOC_AR7242
:
458 pll_10
= AR7242_PLL_VAL_10
;
459 pll_100
= AR7242_PLL_VAL_100
;
460 pll_1000
= AR7242_PLL_VAL_1000
;
463 case AR71XX_SOC_AR9130
:
464 case AR71XX_SOC_AR9132
:
465 pll_10
= AR91XX_PLL_VAL_10
;
466 pll_100
= AR91XX_PLL_VAL_100
;
467 pll_1000
= AR91XX_PLL_VAL_1000
;
470 case AR71XX_SOC_AR9330
:
471 case AR71XX_SOC_AR9331
:
472 pll_10
= AR933X_PLL_VAL_10
;
473 pll_100
= AR933X_PLL_VAL_100
;
474 pll_1000
= AR933X_PLL_VAL_1000
;
481 if (!pll_data
->pll_10
)
482 pll_data
->pll_10
= pll_10
;
484 if (!pll_data
->pll_100
)
485 pll_data
->pll_100
= pll_100
;
487 if (!pll_data
->pll_1000
)
488 pll_data
->pll_1000
= pll_1000
;
491 static int ar71xx_eth_instance __initdata
;
492 void __init
ar71xx_add_device_eth(unsigned int id
)
494 struct platform_device
*pdev
;
495 struct ag71xx_platform_data
*pdata
;
497 ar71xx_init_eth_pll_data(id
);
501 switch (ar71xx_eth0_data
.phy_if_mode
) {
502 case PHY_INTERFACE_MODE_MII
:
503 ar71xx_eth0_data
.mii_if
= MII0_CTRL_IF_MII
;
505 case PHY_INTERFACE_MODE_GMII
:
506 ar71xx_eth0_data
.mii_if
= MII0_CTRL_IF_GMII
;
508 case PHY_INTERFACE_MODE_RGMII
:
509 ar71xx_eth0_data
.mii_if
= MII0_CTRL_IF_RGMII
;
511 case PHY_INTERFACE_MODE_RMII
:
512 ar71xx_eth0_data
.mii_if
= MII0_CTRL_IF_RMII
;
515 printk(KERN_ERR
"ar71xx: invalid PHY interface mode "
519 pdev
= &ar71xx_eth0_device
;
522 switch (ar71xx_eth1_data
.phy_if_mode
) {
523 case PHY_INTERFACE_MODE_RMII
:
524 ar71xx_eth1_data
.mii_if
= MII1_CTRL_IF_RMII
;
526 case PHY_INTERFACE_MODE_RGMII
:
527 ar71xx_eth1_data
.mii_if
= MII1_CTRL_IF_RGMII
;
530 printk(KERN_ERR
"ar71xx: invalid PHY interface mode "
534 pdev
= &ar71xx_eth1_device
;
537 printk(KERN_ERR
"ar71xx: invalid ethernet id %d\n", id
);
541 pdata
= pdev
->dev
.platform_data
;
543 switch (ar71xx_soc
) {
544 case AR71XX_SOC_AR7130
:
545 pdata
->ddr_flush
= id
? ar71xx_ddr_flush_ge1
546 : ar71xx_ddr_flush_ge0
;
547 pdata
->set_pll
= id
? ar71xx_set_pll_ge1
548 : ar71xx_set_pll_ge0
;
551 case AR71XX_SOC_AR7141
:
552 case AR71XX_SOC_AR7161
:
553 pdata
->ddr_flush
= id
? ar71xx_ddr_flush_ge1
554 : ar71xx_ddr_flush_ge0
;
555 pdata
->set_pll
= id
? ar71xx_set_pll_ge1
556 : ar71xx_set_pll_ge0
;
560 case AR71XX_SOC_AR7242
:
561 ar71xx_eth0_data
.reset_bit
|= AR724X_RESET_GE0_MDIO
;
562 ar71xx_eth1_data
.reset_bit
|= AR724X_RESET_GE1_MDIO
;
563 pdata
->ddr_flush
= id
? ar724x_ddr_flush_ge1
564 : ar724x_ddr_flush_ge0
;
565 pdata
->set_pll
= id
? ar724x_set_pll_ge1
566 : ar7242_set_pll_ge0
;
568 pdata
->is_ar724x
= 1;
570 if (!pdata
->fifo_cfg1
)
571 pdata
->fifo_cfg1
= 0x0010ffff;
572 if (!pdata
->fifo_cfg2
)
573 pdata
->fifo_cfg2
= 0x015500aa;
574 if (!pdata
->fifo_cfg3
)
575 pdata
->fifo_cfg3
= 0x01f00140;
578 case AR71XX_SOC_AR7241
:
579 ar71xx_eth0_data
.reset_bit
|= AR724X_RESET_GE0_MDIO
;
580 ar71xx_eth1_data
.reset_bit
|= AR724X_RESET_GE1_MDIO
;
582 case AR71XX_SOC_AR7240
:
583 pdata
->ddr_flush
= id
? ar724x_ddr_flush_ge1
584 : ar724x_ddr_flush_ge0
;
585 pdata
->set_pll
= id
? ar724x_set_pll_ge1
586 : ar724x_set_pll_ge0
;
587 pdata
->is_ar724x
= 1;
589 if (!pdata
->fifo_cfg1
)
590 pdata
->fifo_cfg1
= 0x0010ffff;
591 if (!pdata
->fifo_cfg2
)
592 pdata
->fifo_cfg2
= 0x015500aa;
593 if (!pdata
->fifo_cfg3
)
594 pdata
->fifo_cfg3
= 0x01f00140;
597 case AR71XX_SOC_AR9130
:
598 pdata
->ddr_flush
= id
? ar91xx_ddr_flush_ge1
599 : ar91xx_ddr_flush_ge0
;
600 pdata
->set_pll
= id
? ar91xx_set_pll_ge1
601 : ar91xx_set_pll_ge0
;
602 pdata
->is_ar91xx
= 1;
605 case AR71XX_SOC_AR9132
:
606 pdata
->ddr_flush
= id
? ar91xx_ddr_flush_ge1
607 : ar91xx_ddr_flush_ge0
;
608 pdata
->set_pll
= id
? ar91xx_set_pll_ge1
609 : ar91xx_set_pll_ge0
;
610 pdata
->is_ar91xx
= 1;
614 case AR71XX_SOC_AR9330
:
615 case AR71XX_SOC_AR9331
:
616 ar71xx_eth0_data
.reset_bit
= AR933X_RESET_GE0_MAC
|
617 AR933X_RESET_GE0_MDIO
;
618 ar71xx_eth1_data
.reset_bit
= AR933X_RESET_GE1_MAC
|
619 AR933X_RESET_GE1_MDIO
;
620 pdata
->ddr_flush
= id
? ar933x_ddr_flush_ge1
621 : ar933x_ddr_flush_ge0
;
622 pdata
->set_pll
= id
? ar933x_set_pll_ge1
623 : ar933x_set_pll_ge0
;
625 pdata
->is_ar724x
= 1;
627 if (!pdata
->fifo_cfg1
)
628 pdata
->fifo_cfg1
= 0x0010ffff;
629 if (!pdata
->fifo_cfg2
)
630 pdata
->fifo_cfg2
= 0x015500aa;
631 if (!pdata
->fifo_cfg3
)
632 pdata
->fifo_cfg3
= 0x01f00140;
639 switch (pdata
->phy_if_mode
) {
640 case PHY_INTERFACE_MODE_GMII
:
641 case PHY_INTERFACE_MODE_RGMII
:
642 if (!pdata
->has_gbit
) {
643 printk(KERN_ERR
"ar71xx: no gbit available on eth%d\n",
652 if (!is_valid_ether_addr(pdata
->mac_addr
)) {
653 random_ether_addr(pdata
->mac_addr
);
655 "ar71xx: using random MAC address for eth%d\n",
656 ar71xx_eth_instance
);
659 if (pdata
->mii_bus_dev
== NULL
)
660 pdata
->mii_bus_dev
= &ar71xx_mdio_device
.dev
;
662 /* Reset the device */
663 ar71xx_device_stop(pdata
->reset_bit
);
666 ar71xx_device_start(pdata
->reset_bit
);
669 platform_device_register(pdev
);
670 ar71xx_eth_instance
++;
673 static struct resource ar71xx_spi_resources
[] = {
675 .start
= AR71XX_SPI_BASE
,
676 .end
= AR71XX_SPI_BASE
+ AR71XX_SPI_SIZE
- 1,
677 .flags
= IORESOURCE_MEM
,
681 static struct platform_device ar71xx_spi_device
= {
682 .name
= "ar71xx-spi",
684 .resource
= ar71xx_spi_resources
,
685 .num_resources
= ARRAY_SIZE(ar71xx_spi_resources
),
688 void __init
ar71xx_add_device_spi(struct ar71xx_spi_platform_data
*pdata
,
689 struct spi_board_info
const *info
,
692 spi_register_board_info(info
, n
);
693 ar71xx_spi_device
.dev
.platform_data
= pdata
;
694 platform_device_register(&ar71xx_spi_device
);
697 void __init
ar71xx_add_device_wdt(void)
699 platform_device_register_simple("ar71xx-wdt", -1, NULL
, 0);
702 void __init
ar71xx_set_mac_base(unsigned char *mac
)
704 memcpy(ar71xx_mac_base
, mac
, ETH_ALEN
);
707 void __init
ar71xx_parse_mac_addr(char *mac_str
)
712 t
= sscanf(mac_str
, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
713 &tmp
[0], &tmp
[1], &tmp
[2], &tmp
[3], &tmp
[4], &tmp
[5]);
716 t
= sscanf(mac_str
, "%02hhx.%02hhx.%02hhx.%02hhx.%02hhx.%02hhx",
717 &tmp
[0], &tmp
[1], &tmp
[2], &tmp
[3], &tmp
[4], &tmp
[5]);
720 ar71xx_set_mac_base(tmp
);
722 printk(KERN_DEBUG
"ar71xx: failed to parse mac address "
723 "\"%s\"\n", mac_str
);
726 static int __init
ar71xx_ethaddr_setup(char *str
)
728 ar71xx_parse_mac_addr(str
);
731 __setup("ethaddr=", ar71xx_ethaddr_setup
);
733 static int __init
ar71xx_kmac_setup(char *str
)
735 ar71xx_parse_mac_addr(str
);
738 __setup("kmac=", ar71xx_kmac_setup
);
740 void __init
ar71xx_init_mac(unsigned char *dst
, const unsigned char *src
,
745 if (!is_valid_ether_addr(src
)) {
746 memset(dst
, '\0', ETH_ALEN
);
750 t
= (((u32
) src
[3]) << 16) + (((u32
) src
[4]) << 8) + ((u32
) src
[5]);
756 dst
[3] = (t
>> 16) & 0xff;
757 dst
[4] = (t
>> 8) & 0xff;