dev-dsa.c 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Atheros AR71xx DSA switch device support
  3. *
  4. * Copyright (C) 2008-2012 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/version.h>
  13. #include <linux/platform_device.h>
  14. #include <asm/mach-ath79/ath79.h>
  15. #include "dev-dsa.h"
  16. static struct platform_device ar71xx_dsa_switch_device = {
  17. .name = "dsa",
  18. .id = 0,
  19. };
  20. void __init ath79_register_dsa(struct device *netdev,
  21. struct device *miidev,
  22. struct dsa_platform_data *d)
  23. {
  24. int i;
  25. d->netdev = netdev;
  26. for (i = 0; i < d->nr_chips; i++)
  27. #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
  28. d->chip[i].mii_bus = miidev;
  29. #else
  30. d->chip[i].host_dev = miidev;
  31. #endif
  32. ar71xx_dsa_switch_device.dev.platform_data = d;
  33. platform_device_register(&ar71xx_dsa_switch_device);
  34. }