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
;
26 static char ar913x_wmac_mac
[6];
28 static struct resource ar913x_wmac_resources
[] = {
30 .start
= AR91XX_WMAC_BASE
,
31 .end
= AR91XX_WMAC_BASE
+ AR91XX_WMAC_SIZE
- 1,
32 .flags
= IORESOURCE_MEM
,
34 .start
= AR71XX_CPU_IRQ_IP2
,
35 .end
= AR71XX_CPU_IRQ_IP2
,
36 .flags
= IORESOURCE_IRQ
,
40 static struct platform_device ar913x_wmac_device
= {
43 .resource
= ar913x_wmac_resources
,
44 .num_resources
= ARRAY_SIZE(ar913x_wmac_resources
),
46 .platform_data
= &ar913x_wmac_data
,
50 void __init
ar913x_add_device_wmac(u8
*cal_data
, u8
*mac_addr
)
53 memcpy(ar913x_wmac_data
.eeprom_data
, cal_data
,
54 sizeof(ar913x_wmac_data
.eeprom_data
));
57 memcpy(ar913x_wmac_mac
, mac_addr
, sizeof(ar913x_wmac_mac
));
58 ar913x_wmac_data
.macaddr
= ar913x_wmac_mac
;
61 ar71xx_device_stop(RESET_MODULE_AMBA2WMAC
);
64 ar71xx_device_start(RESET_MODULE_AMBA2WMAC
);
67 platform_device_register(&ar913x_wmac_device
);