sead3-net.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/irq.h>
  10. #include <linux/irqchip/mips-gic.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/smsc911x.h>
  13. #include <asm/mips-boards/sead3int.h>
  14. static struct smsc911x_platform_config sead3_smsc911x_data = {
  15. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  16. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  17. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  18. .phy_interface = PHY_INTERFACE_MODE_MII,
  19. };
  20. struct resource sead3_net_resources[] = {
  21. {
  22. .start = 0x1f010000,
  23. .end = 0x1f01ffff,
  24. .flags = IORESOURCE_MEM
  25. },
  26. {
  27. .flags = IORESOURCE_IRQ
  28. }
  29. };
  30. static struct platform_device sead3_net_device = {
  31. .name = "smsc911x",
  32. .id = 0,
  33. .dev = {
  34. .platform_data = &sead3_smsc911x_data,
  35. },
  36. .num_resources = ARRAY_SIZE(sead3_net_resources),
  37. .resource = sead3_net_resources
  38. };
  39. static int __init sead3_net_init(void)
  40. {
  41. if (gic_present)
  42. sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
  43. else
  44. sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
  45. return platform_device_register(&sead3_net_device);
  46. }
  47. device_initcall(sead3_net_init);