2 * Atheros AR913x SoC built-in WMAC device support
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * Parts of this file are based on Atheros' 2.6.15 BSP
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/delay.h>
17 #include <linux/etherdevice.h>
18 #include <linux/platform_device.h>
19 #include <linux/ath9k_platform.h>
21 #include <asm/mach-ar71xx/ar71xx.h>
23 #include "dev-ar913x-wmac.h"
25 static struct ath9k_platform_data ar913x_wmac_data
= {
28 static char ar913x_wmac_mac
[6];
30 static struct resource ar913x_wmac_resources
[] = {
32 .start
= AR91XX_WMAC_BASE
,
33 .end
= AR91XX_WMAC_BASE
+ AR91XX_WMAC_SIZE
- 1,
34 .flags
= IORESOURCE_MEM
,
36 .start
= AR71XX_CPU_IRQ_IP2
,
37 .end
= AR71XX_CPU_IRQ_IP2
,
38 .flags
= IORESOURCE_IRQ
,
42 static struct platform_device ar913x_wmac_device
= {
45 .resource
= ar913x_wmac_resources
,
46 .num_resources
= ARRAY_SIZE(ar913x_wmac_resources
),
48 .platform_data
= &ar913x_wmac_data
,
52 void __init
ar913x_add_device_wmac(u8
*cal_data
, u8
*mac_addr
)
55 memcpy(ar913x_wmac_data
.eeprom_data
, cal_data
,
56 sizeof(ar913x_wmac_data
.eeprom_data
));
59 memcpy(ar913x_wmac_mac
, mac_addr
, sizeof(ar913x_wmac_mac
));
60 ar913x_wmac_data
.macaddr
= ar913x_wmac_mac
;
63 ar71xx_device_stop(RESET_MODULE_AMBA2WMAC
);
66 ar71xx_device_start(RESET_MODULE_AMBA2WMAC
);
69 platform_device_register(&ar913x_wmac_device
);