dm9000.txt 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. DM9000 Network driver
  2. =====================
  3. Copyright 2008 Simtec Electronics,
  4. Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>
  5. Introduction
  6. ------------
  7. This file describes how to use the DM9000 platform-device based network driver
  8. that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h.
  9. The driver supports three DM9000 variants, the DM9000E which is the first chip
  10. supported as well as the newer DM9000A and DM9000B devices. It is currently
  11. maintained and tested by Ben Dooks, who should be CC: to any patches for this
  12. driver.
  13. Defining the platform device
  14. ----------------------------
  15. The minimum set of resources attached to the platform device are as follows:
  16. 1) The physical address of the address register
  17. 2) The physical address of the data register
  18. 3) The IRQ line the device's interrupt pin is connected to.
  19. These resources should be specified in that order, as the ordering of the
  20. two address regions is important (the driver expects these to be address
  21. and then data).
  22. An example from arch/arm/mach-s3c2410/mach-bast.c is:
  23. static struct resource bast_dm9k_resource[] = {
  24. [0] = {
  25. .start = S3C2410_CS5 + BAST_PA_DM9000,
  26. .end = S3C2410_CS5 + BAST_PA_DM9000 + 3,
  27. .flags = IORESOURCE_MEM,
  28. },
  29. [1] = {
  30. .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,
  31. .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,
  32. .flags = IORESOURCE_MEM,
  33. },
  34. [2] = {
  35. .start = IRQ_DM9000,
  36. .end = IRQ_DM9000,
  37. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  38. }
  39. };
  40. static struct platform_device bast_device_dm9k = {
  41. .name = "dm9000",
  42. .id = 0,
  43. .num_resources = ARRAY_SIZE(bast_dm9k_resource),
  44. .resource = bast_dm9k_resource,
  45. };
  46. Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags,
  47. as this will generate a warning if it is not present. The trigger from
  48. the flags field will be passed to request_irq() when registering the IRQ
  49. handler to ensure that the IRQ is setup correctly.
  50. This shows a typical platform device, without the optional configuration
  51. platform data supplied. The next example uses the same resources, but adds
  52. the optional platform data to pass extra configuration data:
  53. static struct dm9000_plat_data bast_dm9k_platdata = {
  54. .flags = DM9000_PLATF_16BITONLY,
  55. };
  56. static struct platform_device bast_device_dm9k = {
  57. .name = "dm9000",
  58. .id = 0,
  59. .num_resources = ARRAY_SIZE(bast_dm9k_resource),
  60. .resource = bast_dm9k_resource,
  61. .dev = {
  62. .platform_data = &bast_dm9k_platdata,
  63. }
  64. };
  65. The platform data is defined in include/linux/dm9000.h and described below.
  66. Platform data
  67. -------------
  68. Extra platform data for the DM9000 can describe the IO bus width to the
  69. device, whether or not an external PHY is attached to the device and
  70. the availability of an external configuration EEPROM.
  71. The flags for the platform data .flags field are as follows:
  72. DM9000_PLATF_8BITONLY
  73. The IO should be done with 8bit operations.
  74. DM9000_PLATF_16BITONLY
  75. The IO should be done with 16bit operations.
  76. DM9000_PLATF_32BITONLY
  77. The IO should be done with 32bit operations.
  78. DM9000_PLATF_EXT_PHY
  79. The chip is connected to an external PHY.
  80. DM9000_PLATF_NO_EEPROM
  81. This can be used to signify that the board does not have an
  82. EEPROM, or that the EEPROM should be hidden from the user.
  83. DM9000_PLATF_SIMPLE_PHY
  84. Switch to using the simpler PHY polling method which does not
  85. try and read the MII PHY state regularly. This is only available
  86. when using the internal PHY. See the section on link state polling
  87. for more information.
  88. The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry
  89. "Force simple NSR based PHY polling" allows this flag to be
  90. forced on at build time.
  91. PHY Link state polling
  92. ----------------------
  93. The driver keeps track of the link state and informs the network core
  94. about link (carrier) availability. This is managed by several methods
  95. depending on the version of the chip and on which PHY is being used.
  96. For the internal PHY, the original (and currently default) method is
  97. to read the MII state, either when the status changes if we have the
  98. necessary interrupt support in the chip or every two seconds via a
  99. periodic timer.
  100. To reduce the overhead for the internal PHY, there is now the option
  101. of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY
  102. platform data option to read the summary information without the
  103. expensive MII accesses. This method is faster, but does not print
  104. as much information.
  105. When using an external PHY, the driver currently has to poll the MII
  106. link status as there is no method for getting an interrupt on link change.
  107. DM9000A / DM9000B
  108. -----------------
  109. These chips are functionally similar to the DM9000E and are supported easily
  110. by the same driver. The features are:
  111. 1) Interrupt on internal PHY state change. This means that the periodic
  112. polling of the PHY status may be disabled on these devices when using
  113. the internal PHY.
  114. 2) TCP/UDP checksum offloading, which the driver does not currently support.
  115. ethtool
  116. -------
  117. The driver supports the ethtool interface for access to the driver
  118. state information, the PHY state and the EEPROM.