dev-ar913x-wmac.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Atheros AR913X SoC built-in WMAC device support
  3. *
  4. * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/delay.h>
  13. #include <linux/irq.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/ath9k_platform.h>
  16. #include <asm/mach-ath79/ath79.h>
  17. #include <asm/mach-ath79/ar71xx_regs.h>
  18. #include "dev-ar913x-wmac.h"
  19. static struct ath9k_platform_data ar913x_wmac_data;
  20. static struct resource ar913x_wmac_resources[] = {
  21. {
  22. .start = AR913X_WMAC_BASE,
  23. .end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1,
  24. .flags = IORESOURCE_MEM,
  25. }, {
  26. .start = ATH79_CPU_IRQ_IP2,
  27. .end = ATH79_CPU_IRQ_IP2,
  28. .flags = IORESOURCE_IRQ,
  29. },
  30. };
  31. static struct platform_device ar913x_wmac_device = {
  32. .name = "ath9k",
  33. .id = -1,
  34. .resource = ar913x_wmac_resources,
  35. .num_resources = ARRAY_SIZE(ar913x_wmac_resources),
  36. .dev = {
  37. .platform_data = &ar913x_wmac_data,
  38. },
  39. };
  40. void __init ath79_register_ar913x_wmac(u8 *cal_data)
  41. {
  42. if (cal_data)
  43. memcpy(ar913x_wmac_data.eeprom_data, cal_data,
  44. sizeof(ar913x_wmac_data.eeprom_data));
  45. /* reset the WMAC */
  46. ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
  47. mdelay(10);
  48. ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
  49. mdelay(10);
  50. platform_device_register(&ar913x_wmac_device);
  51. }