···11+DM9000 Network driver22+=====================33+44+Copyright 2008 Simtec Electronics,55+ Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org>66+77+88+Introduction99+------------1010+1111+This file describes how to use the DM9000 platform-device based network driver1212+that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h.1313+1414+The driver supports three DM9000 variants, the DM9000E which is the first chip1515+supported as well as the newer DM9000A and DM9000B devices. It is currently1616+maintained and tested by Ben Dooks, who should be CC: to any patches for this1717+driver.1818+1919+2020+Defining the platform device2121+----------------------------2222+2323+The minimum set of resources attached to the platform device are as follows:2424+2525+ 1) The physical address of the address register2626+ 2) The physical address of the data register2727+ 3) The IRQ line the device's interrupt pin is connected to.2828+2929+These resources should be specified in that order, as the ordering of the3030+two address regions is important (the driver expects these to be address3131+and then data).3232+3333+An example from arch/arm/mach-s3c2410/mach-bast.c is:3434+3535+static struct resource bast_dm9k_resource[] = {3636+ [0] = {3737+ .start = S3C2410_CS5 + BAST_PA_DM9000,3838+ .end = S3C2410_CS5 + BAST_PA_DM9000 + 3,3939+ .flags = IORESOURCE_MEM,4040+ },4141+ [1] = {4242+ .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40,4343+ .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f,4444+ .flags = IORESOURCE_MEM,4545+ },4646+ [2] = {4747+ .start = IRQ_DM9000,4848+ .end = IRQ_DM9000,4949+ .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,5050+ }5151+};5252+5353+static struct platform_device bast_device_dm9k = {5454+ .name = "dm9000",5555+ .id = 0,5656+ .num_resources = ARRAY_SIZE(bast_dm9k_resource),5757+ .resource = bast_dm9k_resource,5858+};5959+6060+Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags,6161+as this will generate a warning if it is not present. The trigger from6262+the flags field will be passed to request_irq() when registering the IRQ6363+handler to ensure that the IRQ is setup correctly.6464+6565+This shows a typical platform device, without the optional configuration6666+platform data supplied. The next example uses the same resources, but adds6767+the optional platform data to pass extra configuration data:6868+6969+static struct dm9000_plat_data bast_dm9k_platdata = {7070+ .flags = DM9000_PLATF_16BITONLY,7171+};7272+7373+static struct platform_device bast_device_dm9k = {7474+ .name = "dm9000",7575+ .id = 0,7676+ .num_resources = ARRAY_SIZE(bast_dm9k_resource),7777+ .resource = bast_dm9k_resource,7878+ .dev = {7979+ .platform_data = &bast_dm9k_platdata,8080+ }8181+};8282+8383+The platform data is defined in include/linux/dm9000.h and described below.8484+8585+8686+Platform data8787+-------------8888+8989+Extra platform data for the DM9000 can describe the IO bus width to the9090+device, whether or not an external PHY is attached to the device and9191+the availability of an external configuration EEPROM.9292+9393+The flags for the platform data .flags field are as follows:9494+9595+DM9000_PLATF_8BITONLY9696+9797+ The IO should be done with 8bit operations.9898+9999+DM9000_PLATF_16BITONLY100100+101101+ The IO should be done with 16bit operations.102102+103103+DM9000_PLATF_32BITONLY104104+105105+ The IO should be done with 32bit operations.106106+107107+DM9000_PLATF_EXT_PHY108108+109109+ The chip is connected to an external PHY.110110+111111+DM9000_PLATF_NO_EEPROM112112+113113+ This can be used to signify that the board does not have an114114+ EEPROM, or that the EEPROM should be hidden from the user.115115+116116+DM9000_PLATF_SIMPLE_PHY117117+118118+ Switch to using the simpler PHY polling method which does not119119+ try and read the MII PHY state regularly. This is only available120120+ when using the internal PHY. See the section on link state polling121121+ for more information.122122+123123+ The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry124124+ "Force simple NSR based PHY polling" allows this flag to be125125+ forced on at build time.126126+127127+128128+PHY Link state polling129129+----------------------130130+131131+The driver keeps track of the link state and informs the network core132132+about link (carrier) availablilty. This is managed by several methods133133+depending on the version of the chip and on which PHY is being used.134134+135135+For the internal PHY, the original (and currently default) method is136136+to read the MII state, either when the status changes if we have the137137+necessary interrupt support in the chip or every two seconds via a138138+periodic timer.139139+140140+To reduce the overhead for the internal PHY, there is now the option141141+of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY142142+platform data option to read the summary information without the143143+expensive MII accesses. This method is faster, but does not print144144+as much information.145145+146146+When using an external PHY, the driver currently has to poll the MII147147+link status as there is no method for getting an interrupt on link change.148148+149149+150150+DM9000A / DM9000B151151+-----------------152152+153153+These chips are functionally similar to the DM9000E and are supported easily154154+by the same driver. The features are:155155+156156+ 1) Interrupt on internal PHY state change. This means that the periodic157157+ polling of the PHY status may be disabled on these devices when using158158+ the internal PHY.159159+160160+ 2) TCP/UDP checksum offloading, which the driver does not currently support.161161+162162+163163+ethtool164164+-------165165+166166+The driver supports the ethtool interface for access to the driver167167+state information, the PHY state and the EEPROM.